fix(opencode): use commands/ directory (plural) to match OpenCode docs#2453
fix(opencode): use commands/ directory (plural) to match OpenCode docs#2453marcusburghardt wants to merge 1 commit intogithub:mainfrom
Conversation
OpenCode documentation (https://opencode.ai/docs/commands/) uses .opencode/commands/ (plural) as the canonical command directory. The OpenCode runtime supports both .opencode/command/ and .opencode/commands/ via a {command,commands} glob, but the singular form was the original convention and is now outdated. Update the OpenCode integration to write to .opencode/commands/ instead of .opencode/command/, aligning with the documented standard and the OpenSpec fix (Fission-AI/OpenSpec#748). Signed-off-by: Marcus Burghardt <maburgha@redhat.com> Assisted-by: OpenCode (claude-opus-4-6)
There was a problem hiding this comment.
Pull request overview
This PR updates the OpenCode integration to use OpenCode’s documented .opencode/commands/ directory instead of the legacy singular .opencode/command/, and adjusts the related tests accordingly. The change fits the integration layer by aligning Spec Kit’s generated command paths with the current OpenCode convention.
Changes:
- Switches the OpenCode integration’s command output directory from
commandtocommands. - Updates the registrar path for OpenCode command registration to the plural directory.
- Refreshes OpenCode integration and integration-switch tests to assert the new path.
Show a summary per file
| File | Description |
|---|---|
src/specify_cli/integrations/opencode/__init__.py |
Updates OpenCode integration config and registrar paths to the plural commands directory. |
tests/integrations/test_integration_opencode.py |
Updates Opencode integration test constants to match the new directory layout. |
tests/integrations/test_integration_subcommand.py |
Updates integration-switch extension assertions to expect .opencode/commands/. |
Copilot's findings
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comments suppressed due to low confidence (1)
src/specify_cli/integrations/opencode/init.py:16
- This path change also breaks cleanup of commands that were previously registered for OpenCode. Extension/preset registries only store command names, and
unregister_commands()reconstructs the file path from the currentAGENT_CONFIGSentry; after this change it will try to delete.opencode/commands/...and leave legacy.opencode/command/...files behind. Because OpenCode still loads both directories, removed/disabled/upgraded commands can remain active.
registrar_config = {
"dir": ".opencode/commands",
- Files reviewed: 3/3 changed files
- Comments generated: 2
| } | ||
| registrar_config = { | ||
| "dir": ".opencode/command", | ||
| "dir": ".opencode/commands", |
| opencode_git_feature = project / ".opencode" / "commands" / "speckit.git.feature.md" | ||
| assert opencode_git_feature.exists(), "Git extension command should exist for opencode" |
|
Please support both models so we are not breaking existing installs. If the old one is detected we should warn the user that they need to upgrade their code agent integration (see https://github.github.com/spec-kit/reference/integrations.html#upgrade-an-integration)? |
Description
Align the OpenCode integration's command directory with OpenCode's
documented standard:
.opencode/commands/(plural) instead of.opencode/command/(singular).OpenCode's documentation (https://opencode.ai/docs/commands/) uses
commands/as the canonical directory name. The OpenCode runtimesupports both via a
{command,commands}glob, so the singular formworks but is outdated. OpenSpec already fixed this in
Fission-AI/OpenSpec#748.
This is a two-value change in
opencode/__init__.py:commands_subdir:"command"→"commands"registrar_config.dir:".opencode/command"→".opencode/commands"With corresponding test updates in
test_integration_opencode.pyand
test_integration_subcommand.py.Backward compatibility
No user action is required. OpenCode loads commands from both
.opencode/command/and.opencode/commands/via its{command,commands}glob, so existing projects continueworking without changes. After updating, new
specify initruns will deploy Speckit commands to
.opencode/commands/(plural). Previously deployed Speckit commands in
.opencode/command/remain functional but can be removed:Testing
uv run specify --helpuv sync && uv run pytestRan
specify init /tmp/speckit-test --integration opencode --script shand verified commands are created in
.opencode/commands/(plural)with no
.opencode/command/(singular) directory created.Also ran
uv run python -m pytest tests/test_agent_config_consistency.py(24/24 pass).
AI Disclosure
This fix was identified through codebase analysis using OpenCode
(claude-opus-4-6). The two-line source change and test updates
were authored with AI assistance. All tests were run and verified
locally.