You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(opencode): use plural commands/ directory to match OpenCode convention (Fission-AI#760)
* fix(opencode): use plural `commands/` directory to match OpenCode convention
The OpenCode adapter was using `.opencode/command/` (singular) but OpenCode's
official documentation specifies `.opencode/commands/` (plural). This aligns
with every other adapter in the codebase. Legacy cleanup updated to detect
old singular-path artifacts. FixesFission-AI#748.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fix(legacy): detect both opsx-* and openspec-* patterns, auto-cleanup in CI
- Extend LegacySlashCommandPattern.pattern to accept string | string[]
- OpenCode legacy entry now detects both opsx-*.md and openspec-*.md
- Auto-cleanup legacy artifacts in non-interactive mode instead of
aborting with exit 1 (safe: slash commands are OpenSpec-managed,
config cleanup only removes markers)
- Add 7 tests (6 legacy detection + 1 non-interactive init)
- Update spec with array pattern support and auto-cleanup scenario
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* chore: update task description to reflect dual-pattern support
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Co-authored-by: Tabish Bidiwale <30385142+TabishB@users.noreply.github.com>
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.
4
+
5
+
## Goals / Non-Goals
6
+
7
+
**Goals:**
8
+
- Align the OpenCode adapter path with OpenCode's official `.opencode/commands/` convention
9
+
- Add the old singular path `.opencode/command/` to legacy cleanup so existing installations are properly cleaned
10
+
- Update documentation to reflect the corrected path
11
+
- Update test assertions to match the new path
12
+
13
+
**Non-Goals:**
14
+
- Changing the OpenCode skill path (`.opencode/skills/`) — already correct
15
+
- Modifying any other adapter's directory structure
16
+
- Adding migration prompts or interactive upgrade flows
17
+
18
+
## Decisions
19
+
20
+
### 1. Direct path rename in adapter
21
+
22
+
**Decision:** Change `path.join('.opencode', 'command', ...)` to `path.join('.opencode', 'commands', ...)` in the adapter's `getFilePath` method.
23
+
24
+
**Rationale:** This is a single-line change that aligns with the established pattern across all other adapters. No abstraction or indirection needed.
25
+
26
+
**Alternatives considered:**
27
+
- Add a configuration option for the directory name — rejected as over-engineering for a bug fix
28
+
- Keep singular and add plural as alias — rejected as it creates ambiguity about which is canonical
29
+
30
+
### 2. Legacy cleanup via existing constant map
31
+
32
+
**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.
33
+
34
+
**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.
35
+
36
+
**Alternatives considered:**
37
+
- Add a separate migration script — rejected; the existing legacy cleanup mechanism handles this scenario
38
+
39
+
### 3. Documentation update
40
+
41
+
**Decision:** Update the `docs/supported-tools.md` table entry for OpenCode from `.opencode/command/opsx-<id>.md` to `.opencode/commands/opsx-<id>.md`.
42
+
43
+
**Rationale:** Documentation must match the actual generated paths.
44
+
45
+
## Risks / Trade-offs
46
+
47
+
-**[Existing installations have files at old path]** → Mitigated by legacy cleanup detecting `.opencode/command/` artifacts. On next `openspec init`, old files are cleaned up and new files written to `.opencode/commands/`.
48
+
-**[Users referencing old path in custom scripts]** → Low risk. The old path was incorrect per OpenCode's specification, so custom references were already misaligned.
The OpenCode adapter uses `.opencode/command/` (singular) for its commands directory, but OpenCode's official documentation specifies `.opencode/commands/` (plural). Every other adapter in the codebase also uses plural directory names (`.claude/commands/`, `.cursor/commands/`, `.factory/commands/`, etc.). This inconsistency was introduced in Oct 2025 without documented rationale. Fixes [#748](https://github.com/Fission-AI/OpenSpec/issues/748).
4
+
5
+
## What Changes
6
+
7
+
- OpenCode adapter path changes from `.opencode/command/` to `.opencode/commands/`
-[x] 1.1 Update `src/core/command-generation/adapters/opencode.ts`: change `path.join('.opencode', 'command', ...)` to `path.join('.opencode', 'commands', ...)` and update the JSDoc comment
4
+
5
+
## 2. Legacy Cleanup
6
+
7
+
-[x] 2.1 Update `src/core/legacy-cleanup.ts`: update the `'opencode'` entry in `LEGACY_SLASH_COMMAND_PATHS` to detect both `opsx-*.md` and `openspec-*.md` patterns at `.opencode/command/` for backward compatibility
8
+
9
+
## 3. Documentation
10
+
11
+
-[x] 3.1 Update `docs/supported-tools.md`: change OpenCode command path from `.opencode/command/opsx-<id>.md` to `.opencode/commands/opsx-<id>.md`
12
+
13
+
## 4. Tests
14
+
15
+
-[x] 4.1 Update `test/core/command-generation/adapters.test.ts`: change the OpenCode file path assertion from `path.join('.opencode', 'command', 'opsx-explore.md')` to `path.join('.opencode', 'commands', 'opsx-explore.md')`
16
+
17
+
## 5. Changeset
18
+
19
+
-[x] 5.1 Create a changeset file (`.changeset/fix-opencode-commands-directory.md`) with a patch bump describing the path fix
0 commit comments