openspec/changes/fix-opencode-commands-directory/design.md
The OpenCode adapter in src/core/command-generation/adapters/opencode.ts currently generates command files at .opencode/command/opsx-<id>.md (singular command). OpenCode's official documentation uses .opencode/commands/ (plural), and every other adapter in the codebase follows the plural convention for commands directories. The legacy cleanup module in src/core/legacy-cleanup.ts also references the singular form for detecting old artifacts.
Goals:
.opencode/commands/ convention.opencode/command/ to legacy cleanup so existing installations are properly cleanedNon-Goals:
.opencode/skills/) — already correctDecision: Change path.join('.opencode', 'command', ...) to path.join('.opencode', 'commands', ...) in the adapter's getFilePath method.
Rationale: This is a single-line change that aligns with the established pattern across all other adapters. No abstraction or indirection needed.
Alternatives considered:
Decision: Update the LEGACY_SLASH_COMMAND_PATHS entry for 'opencode' from '.opencode/command/openspec-*.md' to '.opencode/command/opsx-*.md' (the old singular path becomes the legacy pattern) and ensure the new path is handled by the current command generation pipeline.
Rationale: The existing legacy cleanup infrastructure uses LEGACY_SLASH_COMMAND_PATHS as an explicit lookup. The old singular-path pattern already matches the legacy format (openspec-* prefix from the old SlashCommandRegistry era). The current command generation uses the opsx-* prefix, so we also need to add a legacy pattern for opsx-* files in the old singular directory.
Alternatives considered:
Decision: Update the docs/supported-tools.md table entry for OpenCode from .opencode/command/opsx-<id>.md to .opencode/commands/opsx-<id>.md.
Rationale: Documentation must match the actual generated paths.
.opencode/command/ artifacts. On next openspec init, old files are cleaned up and new files written to .opencode/commands/.