Skip to content

feat: add V1 slash commands (list, get, logs, delete)#10

Open
tsaiggo wants to merge 5 commits intodifferent-ai:mainfrom
tsaiggo:feat/v1-slash-commands
Open

feat: add V1 slash commands (list, get, logs, delete)#10
tsaiggo wants to merge 5 commits intodifferent-ai:mainfrom
tsaiggo:feat/v1-slash-commands

Conversation

@tsaiggo
Copy link

@tsaiggo tsaiggo commented Mar 14, 2026

Summary

Add 4 slash commands to the opencode-scheduler plugin, enabling users to interact with scheduled jobs directly via /scheduler-* commands instead of remembering tool names and argument formats.

Why

Currently, users must rely on natural language prompts or know the exact tool names (list_jobs, get_job, etc.) to manage scheduled jobs. Slash commands provide a discoverable, autocomplete-friendly interface that reduces friction.

Commands

Command Description Existing Tool
/scheduler-list List all scheduled jobs list_jobs
/scheduler-get Get details of a specific job by name get_job
/scheduler-logs View execution logs for a job job_logs
/scheduler-delete Delete a job (with confirmation) delete_job

How It Works

  • Commands are registered via the plugin's config hook, which injects command templates into Config.command at plugin load time.
  • Each command is a prompt template containing $ARGUMENTS placeholder — OpenCode replaces this with user input and sends it to the LLM, which then calls the corresponding existing tool.
  • No changes to existing tool implementations. Commands are a UI layer on top of existing functionality.

Scope (V1)

This is intentionally scoped to read-only + delete operations only. Commands like schedule, run, update, and cleanup are deferred to a future version.

Backward Compatibility

  • No breaking changes. Existing natural language prompts and direct tool calls continue to work exactly as before.
  • The config hook preserves any pre-existing commands via object spread.

Testing

  • 9 tests, 29 assertions using vitest
  • Coverage: command keys, template content, descriptions, safety confirmation (delete), $ARGUMENTS placeholders, config mutation, existing command preservation

Files Changed

File Change
src/commands.ts New — 4 command templates + applySchedulerCommands()
src/commands.test.ts New — 9 tests with vitest
src/index.ts Modified — Added import (line 21) + 3 lines in config hook (line 2540-2542)
README.md Modified — Added slash commands documentation section
package.json Modified — Added vitest devDependency + test script

tsaiggo added 5 commits March 14, 2026 01:26
- Add src/commands.ts with 4 command templates (list, get, logs, delete)
- Add src/commands.test.ts with 9 tests covering command keys, templates, safety
- applySchedulerCommands() mutates config.command to inject commands
- Import applySchedulerCommands from ./commands
- Add async config(input) hook to plugin return object
- Commands injected at plugin load time via config mutation
- Add Slash Commands section with 4 commands in table format
- Include autocomplete usage instructions
- Chinese descriptions matching src/commands.ts definitions
@tsaiggo
Copy link
Author

tsaiggo commented Mar 14, 2026

Ref #8

@tsaiggo
Copy link
Author

tsaiggo commented Mar 15, 2026

Hi @benjaminshafii, can you review this PR and leave any comments, thanks

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.

1 participant