-
Notifications
You must be signed in to change notification settings - Fork 1.2k
feat: add Opencode slash commands #83
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
c211d7d
First pass at adding Opencode slash commands
jim-at-jibba a883dae
Fix the agent
jim-at-jibba b1ecb35
Pass in Arguments to opencode slash commands
jim-at-jibba 4d86f8d
Merge branch 'main' into opencode-commands
jim-at-jibba d252617
Merge branch 'main' into opencode-commands
jim-at-jibba da4a83e
Remove unneeded agents file
jim-at-jibba File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,40 +1,19 @@ | ||
| <!-- OPENSPEC:START --> | ||
| # OpenSpec Project | ||
| # Repository Guidelines | ||
|
|
||
| This document provides instructions for AI coding assistants on how to use OpenSpec conventions for spec-driven development. Follow these rules precisely when working on OpenSpec-enabled projects. | ||
| ## Project Structure & Module Organization | ||
| OpenSpec ships as a TypeScript-first CLI. Source code lives in `src`, with feature logic in `core`, interactive flows in `cli`, reusable helpers in `utils`, and command wiring in `commands`. After `pnpm run build`, deliverables land in `dist` and feed the published entry point `bin/openspec.js`. Specs and change proposals reside in `openspec/specs` and `openspec/changes`; update them whenever behavior shifts so automation stays aligned. Shared assets live in `assets`, and Vitest suites in `test` mirror the source layout for easy cross-reference. | ||
|
|
||
| This project uses OpenSpec for spec-driven development. Specifications are the source of truth. | ||
| ## Build, Test, and Development Commands | ||
| Run `pnpm install` to sync dependencies. `pnpm run build` compiles TypeScript to `dist` and must stay green before release. Use `pnpm run dev` for a `tsc --watch` loop and `pnpm run dev:cli` to rebuild then execute the local CLI. `pnpm test` runs the Vitest suite once, `pnpm run test:watch` keeps it hot while iterating, and `pnpm run test:coverage` verifies instrumentation thresholds. Use `pnpm run changeset` when preparing a release entry. | ||
|
|
||
| See @openspec/AGENTS.md for detailed conventions and guidelines. | ||
| <!-- OPENSPEC:END --> | ||
| ## Coding Style & Naming Conventions | ||
| We follow idiomatic TypeScript with ES modules, 2-space indentation, and semicolons. Prefer named exports from index barrels and keep filenames kebab-cased (e.g., `list-command.ts`). Classes use `PascalCase`, functions and variables use `camelCase`, and constants representing flags may use `SCREAMING_SNAKE_CASE`. Keep modules small, colocate helpers under `src/utils`, and avoid new dependencies without spec-backed justification. | ||
|
|
||
| ## Complexity Management | ||
| ## Testing Guidelines | ||
| Every behavior change needs Vitest coverage under `test`, co-located by feature (e.g., `test/core/update.test.ts`). Name suites after the module under test and lean on `vitest.setup.ts` for shared configuration. Run `pnpm test` before pushing and add regression cases for each bug fix or spec requirement. | ||
|
|
||
| **Default to minimal solutions:** | ||
| - Propose <100 lines of new code for features | ||
| - Prefer single-file implementations until proven insufficient | ||
| - Avoid frameworks, abstractions, and optimizations without clear justification | ||
| - Choose boring, well-understood patterns over novel approaches | ||
| ## Commit & Pull Request Guidelines | ||
| Commits follow Conventional Commits (`type(scope): subject`) and stay single-line. Reference the touched module in the scope when practical. Each PR should summarize the spec or issue it fulfills, list manual verification steps, and note updates to any `openspec/` assets. Include CLI output snippets or screenshots when the UX changes, and ensure CI and coverage checks pass before requesting review. | ||
|
|
||
| **Question requests for complexity:** | ||
| - Caching? → Ask for performance data and targets | ||
| - New framework? → Suggest plain code first | ||
| - Extra layers? → Start with the thinnest viable design | ||
|
|
||
| **Justify complexity with data:** | ||
| - Performance metrics showing current solution is too slow | ||
| - Concrete scale requirements (e.g., >1000 users, >100MB data) | ||
| - Multiple proven use cases requiring an abstraction | ||
|
|
||
| ## Package Manager | ||
| Always use pnpm (NOT npm or yarn) for all Node.js package management: | ||
| - Install dependencies: `pnpm install` | ||
| - Add packages: `pnpm add [package]` | ||
| - Run scripts: `pnpm run [script]` | ||
|
|
||
| ## Git Commits | ||
| Use conventional commits with these rules: | ||
| - Format: `type(scope): subject` (e.g., `fix: resolve auth error`, `feat(api): add user endpoint`) | ||
| - Keep commit messages to ONE line only - no body or footer | ||
| - Common types: feat, fix, docs, style, refactor, test, chore | ||
| - Never add co-authorship lines or attribution | ||
| ## OpenSpec Workflow Tips | ||
| Treat specs as the contract: update `openspec/project.md` or the relevant `openspec/specs/*.md` before coding, then run `pnpm run dev:cli` to validate the CLI against the revised artifacts. `openspec list --specs` confirms the catalog, and `openspec change` drafts proposals—commit these alongside code so reviewers can trace rationale to implementation. | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,41 @@ | ||
| import { SlashCommandConfigurator } from "./base.js"; | ||
| import { SlashCommandId } from "../../templates/index.js"; | ||
|
|
||
| const FILE_PATHS: Record<SlashCommandId, string> = { | ||
| proposal: ".opencode/command/openspec-proposal.md", | ||
| apply: ".opencode/command/openspec-apply.md", | ||
| archive: ".opencode/command/openspec-archive.md", | ||
| }; | ||
|
|
||
| const FRONTMATTER: Record<SlashCommandId, string> = { | ||
| proposal: `--- | ||
| agent: build | ||
| description: Scaffold a new OpenSpec change and validate strictly. | ||
| --- | ||
| The user has requested the following change proposal. Use the openspec instructions to create their change proposal. | ||
| <UserRequest> | ||
| $ARGUMENTS | ||
| </UserRequest> | ||
| `, | ||
| apply: `--- | ||
| agent: build | ||
| description: Implement an approved OpenSpec change and keep tasks in sync. | ||
| ---`, | ||
| archive: `--- | ||
| agent: build | ||
| description: Archive a deployed OpenSpec change and update specs. | ||
| ---`, | ||
| }; | ||
|
|
||
| export class OpenCodeSlashCommandConfigurator extends SlashCommandConfigurator { | ||
| readonly toolId = "opencode"; | ||
| readonly isAvailable = true; | ||
|
|
||
| protected getRelativePath(id: SlashCommandId): string { | ||
| return FILE_PATHS[id]; | ||
| } | ||
|
|
||
| protected getFrontmatter(id: SlashCommandId): string | undefined { | ||
| return FRONTMATTER[id]; | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! This was way out of date haha. I might add back in the updated openspec agent instructions here later, since I build this repo with codex as well which requires some instructions on openspec being present in the root AGENTS.md
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, thats my bad. I think I got COdex to do the first pass and it made the update. I can revert if you want.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's fine for now! It dosent block the functionality of the package.