Skip to content

fix(opencode): use commands/ directory (plural) to match OpenCode docs#2453

Open
marcusburghardt wants to merge 1 commit intogithub:mainfrom
marcusburghardt:fix/opencode-commands-dir
Open

fix(opencode): use commands/ directory (plural) to match OpenCode docs#2453
marcusburghardt wants to merge 1 commit intogithub:mainfrom
marcusburghardt:fix/opencode-commands-dir

Conversation

@marcusburghardt
Copy link
Copy Markdown

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 runtime
supports both via a {command,commands} glob, so the singular form
works 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.py
and 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 continue
working without changes. After updating, new specify init
runs will deploy Speckit commands to .opencode/commands/
(plural). Previously deployed Speckit commands in
.opencode/command/ remain functional but can be removed:

rm .opencode/command/speckit.*.md

Testing

  • Tested locally with uv run specify --help
  • Ran existing tests with uv sync && uv run pytest
  • Tested with a sample project (if applicable)

Ran specify init /tmp/speckit-test --integration opencode --script sh
and 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

  • I did not use AI assistance for this contribution
  • I did use AI assistance (describe below)

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.

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)
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 command to commands.
  • 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 current AGENT_CONFIGS entry; 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",
Comment on lines +765 to 766
opencode_git_feature = project / ".opencode" / "commands" / "speckit.git.feature.md"
assert opencode_git_feature.exists(), "Git extension command should exist for opencode"
@mnriem
Copy link
Copy Markdown
Collaborator

mnriem commented May 5, 2026

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)?

Copy link
Copy Markdown
Collaborator

@mnriem mnriem left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See comments above

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants