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
{{ message }}
Repository navigation
/dcp-compress slash command not registered on recent OpenCode versions (command snapshot timing) #609
DCP 3.1.14 installs cleanly and the debug log shows DCP initialized with no errors.
/dcp (TUI panel, registered via tui.json) works.
/dcp-compress never appears in the slash-command autocomplete list, and typing it manually sends it as a plain user message instead of triggering compression.
Root cause
Recent OpenCode versions (Effect-based refactor) build the slash-command list as a one-shot snapshot:
packages/opencode/src/command/index.ts — the Command service's init() runs once on first access, expands cfg.command into a static record, and never re-reads config afterwards. There is no subscription to config changes.
DCP registers the command inside its plugin config hook (index.ts):
The TUI requests the command list almost immediately at startup, so the Command snapshot is built before plugin config hooks run. The injected dcp-compress entry lands in cfg.command after the snapshot was taken and is never picked up.
The same race affects any plugin that registers commands via the config hook; DCP is just the most visible one.
Workaround
Manually declare the command in opencode.json so it exists at config-load time:
DCP's "command.execute.before" handler matches by name (input.command === "dcp-compress"), so it intercepts the manually-declared command identically.
Proposed fix
Add a "chat.message" hook as a fallback: when a user message's text starts with /dcp-compress, run the same manual-trigger path (handleManualTriggerCommand -> state.pendingManualTrigger) and normalize the stored text to the canonical marker. This makes the command work even when the host never registered it. I have a PR ready.
Activity