Skip to content

fix(command): register /dag-template-update on the v1 command surface #378

Description

@LeXwDeX

Problem

/dag-template-update is documented as a compiled built-in command, and core already ships its prompt and v2 draft registration, but the executable v1 Command.Default registry does not register it. Invoking the documented command therefore reaches Command.get and throws Command not found: "dag-template-update".

User Impact

The documented no-git template refresh journey is completely blocked. Users following README/AGENTS guidance see an error instead of the preview, backup, and sync flow.

Evidence

  • packages/opencode/src/command/index.ts:48-59,120-156: Default and its layer register dag-flow, dag-init, and dag-auto, but not dag-template-update.
  • packages/core/src/plugin/command.ts:21,31-33,53-56: DagTemplateUpdateDescription and v2 draft.update exist, but DagTemplateUpdateContent is not exported.
  • packages/core/src/plugin/command/dag-template-update.txt: shipped prompt asset.
  • packages/opencode/src/session/prompt.ts:2036-2042: missing commands throw.
  • packages/server/src/handlers/command.ts:7: clients list commands through CommandV2.Service.list(), creating a listed-but-unexecutable mismatch.
  • README.md:111, README.zh.md:93, AGENTS.md:218: command is documented as built-in.
  • Audit against origin/main 31bd2d4: rg "dag-template-update|DAG_TEMPLATE_UPDATE" packages/opencode/src and rg "CommandV2" packages/opencode/src both return no matches.

Fix Requirements

  1. Export DagTemplateUpdateContent from packages/core/src/plugin/command.ts, using the existing DAG_TEMPLATE_UPDATE_PROMPT import and the same pattern as DagFlowContent. Do not duplicate DagTemplateUpdateDescription.
  2. Add DAG_TEMPLATE_UPDATE: "dag-template-update" to Command.Default.
  3. Register the built-in in the command layer using the existing DAG command pattern.
  4. Add a focused registration/resolution regression test in packages/opencode/test/command/command.test.ts.

Non-goals

  • Do not change command semantics, prompt text, or v2 draft registration.
  • Do not add or change HTTP routes; SDK regeneration is not required.
  • Do not rewrite documentation.

Acceptance Criteria

  • Command.get("dag-template-update") returns command info with DagTemplateUpdateDescription and the shipped template.
  • Invoking /dag-template-update no longer throws Command not found.
  • Exactly one DagTemplateUpdateDescription export exists.
  • New and existing command tests pass.

Likely Code Locations

  • packages/opencode/src/command/index.ts
  • packages/core/src/plugin/command.ts
  • packages/opencode/test/command/command.test.ts

Verification

git grep -n "DAG_TEMPLATE_UPDATE" -- packages/opencode/src/command/index.ts
cd packages/opencode && bun test test/command/command.test.ts && bun typecheck

Metadata

Metadata

Assignees

No one assigned

    Labels

    ready-for-agentFully specified and ready for an agent

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions