@fission-ai/openspec 0.2.0 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +156 -110
- package/dist/core/config.d.ts +7 -5
- package/dist/core/config.js +4 -4
- package/dist/core/configurators/agents.d.ts +8 -0
- package/dist/core/configurators/agents.js +15 -0
- package/dist/core/configurators/registry.js +3 -0
- package/dist/core/configurators/slash/opencode.d.ts +9 -0
- package/dist/core/configurators/slash/opencode.js +36 -0
- package/dist/core/configurators/slash/registry.js +3 -0
- package/dist/core/init.d.ts +28 -0
- package/dist/core/init.js +358 -50
- package/dist/core/parsers/change-parser.js +3 -2
- package/dist/core/parsers/markdown-parser.d.ts +1 -0
- package/dist/core/parsers/markdown-parser.js +5 -1
- package/dist/core/parsers/requirement-blocks.js +10 -5
- package/dist/core/templates/claude-template.d.ts +1 -1
- package/dist/core/templates/claude-template.js +1 -105
- package/dist/core/templates/index.d.ts +1 -0
- package/dist/core/templates/index.js +3 -0
- package/dist/core/templates/slash-command-templates.js +1 -1
- package/dist/core/update.js +9 -2
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -15,6 +15,7 @@
|
|
|
15
15
|
<a href="https://nodejs.org/"><img alt="node version" src="https://img.shields.io/node/v/@fission-ai/openspec?style=flat-square" /></a>
|
|
16
16
|
<a href="./LICENSE"><img alt="License: MIT" src="https://img.shields.io/badge/License-MIT-blue.svg?style=flat-square" /></a>
|
|
17
17
|
<a href="https://conventionalcommits.org"><img alt="Conventional Commits" src="https://img.shields.io/badge/Conventional%20Commits-1.0.0-yellow.svg?style=flat-square" /></a>
|
|
18
|
+
<a href="https://discord.gg/saTQQGQZ"><img alt="Discord" src="https://img.shields.io/discord/1411657095639601154?logo=discord&logoColor=white&style=flat-square" /></a>
|
|
18
19
|
</p>
|
|
19
20
|
|
|
20
21
|
<p align="center">
|
|
@@ -22,134 +23,187 @@
|
|
|
22
23
|
</p>
|
|
23
24
|
|
|
24
25
|
<p align="center">
|
|
25
|
-
Follow <a href="https://x.com/0xTab">@0xTab on X</a> for updates.
|
|
26
|
+
Follow <a href="https://x.com/0xTab">@0xTab on X</a> for updates · Join the <a href="https://discord.gg/saTQQGQZ">OpenSpec Discord</a> for help and questions.
|
|
26
27
|
</p>
|
|
27
28
|
|
|
28
29
|
# OpenSpec
|
|
29
30
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
Create **alignment** between humans and AI coding assistants through spec-driven development. **No API keys required.**
|
|
33
|
-
|
|
34
|
-
OpenSpec ensures you and your AI assistant agree on what to build before any code is written. By discussing and refining specifications first, you bring determinism to AI code generation, getting exactly what you want, not what the AI thinks you might want.
|
|
31
|
+
OpenSpec aligns humans and AI coding assistants with spec-driven development so you agree on what to build before any code is written. **No API keys required.**
|
|
35
32
|
|
|
36
33
|
## Why OpenSpec?
|
|
37
34
|
|
|
38
|
-
|
|
35
|
+
AI coding assistants are powerful but unpredictable when requirements live in chat history. OpenSpec adds a lightweight specification workflow that locks intent before implementation, giving you deterministic, reviewable outputs.
|
|
39
36
|
|
|
40
|
-
|
|
41
|
-
-
|
|
42
|
-
-
|
|
43
|
-
-
|
|
44
|
-
-
|
|
45
|
-
- **Progress Tracking** - See what's proposed, in progress, or completed at a glance
|
|
46
|
-
- **Living Documentation** - Specs evolve with your code as a natural byproduct
|
|
47
|
-
- **Universal Tool Support** - Works with any AI assistant (Claude Code, Cursor, and more)
|
|
48
|
-
- **No API Keys Required** - Integrates through context rules, not external services
|
|
37
|
+
Key outcomes:
|
|
38
|
+
- Human and AI stakeholders agree on specs before work begins.
|
|
39
|
+
- Structured change folders (proposals, tasks, and spec updates) keep scope explicit and auditable.
|
|
40
|
+
- Shared visibility into what's proposed, active, or archived.
|
|
41
|
+
- Works with the AI tools you already use: custom slash commands where supported, context rules everywhere else.
|
|
49
42
|
|
|
50
43
|
## How It Works
|
|
51
44
|
|
|
52
45
|
```
|
|
53
|
-
|
|
54
|
-
│
|
|
55
|
-
│
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
46
|
+
┌────────────────────┐
|
|
47
|
+
│ Draft Change │
|
|
48
|
+
│ Proposal │
|
|
49
|
+
└────────┬───────────┘
|
|
50
|
+
│ share intent with your AI
|
|
51
|
+
▼
|
|
52
|
+
┌────────────────────┐
|
|
53
|
+
│ Review & Align │
|
|
54
|
+
│ (edit specs/tasks) │◀──── feedback loop ──────┐
|
|
55
|
+
└────────┬───────────┘ │
|
|
56
|
+
│ approved plan │
|
|
57
|
+
▼ │
|
|
58
|
+
┌────────────────────┐ │
|
|
59
|
+
│ Implement Tasks │──────────────────────────┘
|
|
60
|
+
│ (AI writes code) │
|
|
61
|
+
└────────┬───────────┘
|
|
62
|
+
│ ship the change
|
|
63
|
+
▼
|
|
64
|
+
┌────────────────────┐
|
|
65
|
+
│ Archive & Update │
|
|
66
|
+
│ Specs (source) │
|
|
67
|
+
└────────────────────┘
|
|
68
|
+
|
|
69
|
+
1. Draft a change proposal that captures the spec updates you want.
|
|
70
|
+
2. Review the proposal with your AI assistant until everyone agrees.
|
|
71
|
+
3. Implement tasks that reference the agreed specs.
|
|
72
|
+
4. Archive the change to merge the approved updates back into the source-of-truth specs.
|
|
67
73
|
```
|
|
68
74
|
|
|
69
|
-
##
|
|
75
|
+
## Getting Started
|
|
76
|
+
|
|
77
|
+
### Supported AI Tools
|
|
78
|
+
|
|
79
|
+
#### Native Slash Commands
|
|
80
|
+
These tools have built-in OpenSpec commands. Select the OpenSpec integration when prompted.
|
|
70
81
|
|
|
71
|
-
|
|
82
|
+
| Tool | Commands |
|
|
83
|
+
|------|----------|
|
|
84
|
+
| **Claude Code** | `/openspec:proposal`, `/openspec:apply`, `/openspec:archive` |
|
|
85
|
+
| **Cursor** | `/openspec-proposal`, `/openspec-apply`, `/openspec-archive` |
|
|
86
|
+
| **OpenCode** | `/openspec-proposal`, `/openspec-apply`, `/openspec-archive` |
|
|
72
87
|
|
|
73
|
-
|
|
88
|
+
#### AGENTS.md Compatible
|
|
89
|
+
These tools automatically read workflow instructions from `openspec/AGENTS.md`. Ask them to follow the OpenSpec workflow if they need a reminder. Learn more about the [AGENTS.md convention](https://agents.md/).
|
|
74
90
|
|
|
75
|
-
|
|
91
|
+
| Tools |
|
|
92
|
+
|-------|
|
|
93
|
+
| Codex • Amp • Jules • Gemini CLI • GitHub Copilot • Others |
|
|
76
94
|
|
|
77
|
-
Install
|
|
95
|
+
### Install & Initialize
|
|
96
|
+
|
|
97
|
+
#### Prerequisites
|
|
98
|
+
- **Node.js >= 20.19.0** - Check your version with `node --version`
|
|
99
|
+
|
|
100
|
+
#### Step 1: Install the CLI globally
|
|
78
101
|
|
|
79
102
|
```bash
|
|
80
|
-
npm install -g @fission-ai/openspec
|
|
103
|
+
npm install -g @fission-ai/openspec@latest
|
|
81
104
|
```
|
|
82
105
|
|
|
83
|
-
|
|
106
|
+
Verify installation:
|
|
107
|
+
```bash
|
|
108
|
+
openspec --version
|
|
109
|
+
```
|
|
84
110
|
|
|
85
|
-
|
|
111
|
+
#### Step 2: Initialize OpenSpec in your project
|
|
86
112
|
|
|
113
|
+
Navigate to your project directory:
|
|
87
114
|
```bash
|
|
88
|
-
# Navigate to your project
|
|
89
115
|
cd my-project
|
|
116
|
+
```
|
|
90
117
|
|
|
91
|
-
|
|
118
|
+
Run the initialization:
|
|
119
|
+
```bash
|
|
92
120
|
openspec init
|
|
121
|
+
```
|
|
93
122
|
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
123
|
+
**What happens during initialization:**
|
|
124
|
+
- You'll be prompted to select your AI tool (Claude Code, Cursor, etc.)
|
|
125
|
+
- OpenSpec automatically configures slash commands or `AGENTS.md` based on your selection
|
|
126
|
+
- A new `openspec/` directory structure is created in your project
|
|
98
127
|
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
# ├── changes/ # Proposed changes
|
|
103
|
-
# └── AGENTS.md # AI instructions for your tool
|
|
104
|
-
```
|
|
128
|
+
**After setup:**
|
|
129
|
+
- Primary AI tools can trigger `/openspec` workflows without additional configuration
|
|
130
|
+
- Run `openspec list` to verify the setup and view any active changes
|
|
105
131
|
|
|
106
|
-
###
|
|
132
|
+
### Create Your First Change
|
|
107
133
|
|
|
108
|
-
|
|
134
|
+
Here's a real example showing the complete OpenSpec workflow. This works with any AI tool. Those with native slash commands will recognize the shortcuts automatically.
|
|
109
135
|
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
- design.md (API design decisions)
|
|
120
|
-
- specs/user-profile/spec.md (new requirements)
|
|
121
|
-
|
|
122
|
-
You: "The proposal looks good. Let's implement it."
|
|
123
|
-
|
|
124
|
-
AI: "Following the tasks in openspec/changes/add-user-profile-api/tasks.md:
|
|
125
|
-
Task 1.1: Create user profile model..."
|
|
126
|
-
*Implements each task systematically*
|
|
136
|
+
#### 1. Draft the Proposal
|
|
137
|
+
Start by asking your AI to create a change proposal:
|
|
138
|
+
|
|
139
|
+
```text
|
|
140
|
+
You: Create an OpenSpec change proposal for adding profile search filters by role and team
|
|
141
|
+
(Shortcut for tools with slash commands: /openspec:proposal Add profile search filters)
|
|
142
|
+
|
|
143
|
+
AI: I'll create an OpenSpec change proposal for profile filters.
|
|
144
|
+
*Scaffolds openspec/changes/add-profile-filters/ with proposal.md, tasks.md, spec deltas.*
|
|
127
145
|
```
|
|
128
146
|
|
|
129
|
-
|
|
147
|
+
#### 2. Verify & Review
|
|
148
|
+
Check that the change was created correctly and review the proposal:
|
|
130
149
|
|
|
131
150
|
```bash
|
|
132
|
-
|
|
133
|
-
openspec
|
|
151
|
+
$ openspec list # Confirm the change folder exists
|
|
152
|
+
$ openspec validate add-profile-filters # Validate spec formatting
|
|
153
|
+
$ openspec show add-profile-filters # Review proposal, tasks, and spec delta
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
#### 3. Refine the Specs
|
|
157
|
+
Iterate on the specifications until they match your needs:
|
|
134
158
|
|
|
135
|
-
|
|
136
|
-
|
|
159
|
+
```text
|
|
160
|
+
You: Can you add acceptance criteria for the role and team filters?
|
|
137
161
|
|
|
138
|
-
|
|
139
|
-
openspec
|
|
140
|
-
# This moves the change to archive/ and updates specs/
|
|
162
|
+
AI: I'll update the spec delta with scenarios for role and team filters.
|
|
163
|
+
*Edits openspec/changes/add-profile-filters/specs/profile/spec.md and tasks.md.*
|
|
141
164
|
```
|
|
142
165
|
|
|
143
|
-
|
|
166
|
+
#### 4. Implement the Change
|
|
167
|
+
Once specs look good, start implementation:
|
|
144
168
|
|
|
169
|
+
```text
|
|
170
|
+
You: The specs look good. Let's implement this change.
|
|
171
|
+
(Shortcut for tools with slash commands: /openspec:apply add-profile-filters)
|
|
172
|
+
|
|
173
|
+
AI: I'll work through the tasks in the add-profile-filters change.
|
|
174
|
+
*Implements tasks from openspec/changes/add-profile-filters/tasks.md*
|
|
175
|
+
*Marks tasks complete: Task 1.1 ✓, Task 1.2 ✓, Task 2.1 ✓...*
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
#### 5. Archive the Completed Change
|
|
179
|
+
After implementation is complete, archive the change:
|
|
180
|
+
|
|
181
|
+
```text
|
|
182
|
+
AI: All tasks are complete. The implementation is ready.
|
|
183
|
+
|
|
184
|
+
You: Please archive the change
|
|
185
|
+
(Shortcut for tools with slash commands: /openspec:archive add-profile-filters)
|
|
186
|
+
|
|
187
|
+
AI: I'll archive the add-profile-filters change.
|
|
188
|
+
*Runs: openspec archive add-profile-filters*
|
|
189
|
+
✓ Change archived successfully. Specs updated. Ready for the next feature!
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
Or run the command yourself in terminal:
|
|
145
193
|
```bash
|
|
146
|
-
#
|
|
147
|
-
|
|
148
|
-
openspec archive <change> # Mark a change as complete after deployment
|
|
194
|
+
$ openspec archive add-profile-filters # Archive the completed change
|
|
195
|
+
```
|
|
149
196
|
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
197
|
+
**Note:** Tools with native slash commands (Claude Code, Cursor) can use the shortcuts shown. All other tools work with natural language requests to "create an OpenSpec proposal", "apply the OpenSpec change", or "archive the change".
|
|
198
|
+
|
|
199
|
+
## Command Reference
|
|
200
|
+
|
|
201
|
+
```bash
|
|
202
|
+
openspec list # View active change folders
|
|
203
|
+
openspec view # Interactive dashboard of specs and changes
|
|
204
|
+
openspec show <change> # Display change details (proposal, tasks, spec updates)
|
|
205
|
+
openspec validate <change> # Check spec formatting and structure
|
|
206
|
+
openspec archive <change> # Move a completed change into archive/
|
|
153
207
|
```
|
|
154
208
|
|
|
155
209
|
## Example: How AI Creates OpenSpec Files
|
|
@@ -236,46 +290,38 @@ Deltas are "patches" that show how specs change:
|
|
|
236
290
|
- Every requirement needs at least one `#### Scenario:` block
|
|
237
291
|
- Use SHALL/MUST in requirement text
|
|
238
292
|
|
|
239
|
-
|
|
240
|
-
## Why OpenSpec Works
|
|
241
|
-
|
|
242
|
-
OpenSpec creates **alignment** between you and your AI coding assistant:
|
|
243
|
-
|
|
244
|
-
1. **You describe** what you want to build
|
|
245
|
-
2. **AI creates specs** before writing any code
|
|
246
|
-
3. **You review and adjust** the specifications
|
|
247
|
-
4. **AI implements** exactly what was specified
|
|
248
|
-
5. **Everyone understands** what's being built through clear specs
|
|
249
|
-
|
|
250
|
-
**True Interoperability:** OpenSpec is designed to be universal. No API keys, no vendor lock-in. It works by adding context rules to ANY AI coding tool - whether you use Claude Code today, switch to Cursor tomorrow, or adopt the next breakthrough AI assistant. Your specs remain portable and your workflow stays consistent.
|
|
251
|
-
|
|
252
|
-
|
|
253
293
|
## How OpenSpec Compares
|
|
254
294
|
|
|
255
295
|
### vs. Kiro.dev
|
|
256
|
-
OpenSpec groups
|
|
296
|
+
OpenSpec groups every change for a feature in one folder (`openspec/changes/feature-name/`), making it easy to track related specs, tasks, and designs together. Kiro spreads updates across multiple spec folders, which can make feature tracking harder.
|
|
257
297
|
|
|
258
298
|
### vs. No Specs
|
|
259
|
-
Without specs, AI coding assistants generate code
|
|
299
|
+
Without specs, AI coding assistants generate code from vague prompts, often missing requirements or adding unwanted features. OpenSpec brings predictability by agreeing on the desired behavior before any code is written.
|
|
260
300
|
|
|
261
301
|
## Team Adoption
|
|
262
302
|
|
|
263
|
-
|
|
303
|
+
1. **Initialize OpenSpec** – Run `openspec init` in your repo.
|
|
304
|
+
2. **Start with new features** – Ask your AI to capture upcoming work as change proposals.
|
|
305
|
+
3. **Grow incrementally** – Each change archives into living specs that document your system.
|
|
306
|
+
4. **Stay flexible** – Different teammates can use Claude Code, Cursor, or any AGENTS.md-compatible tool while sharing the same specs.
|
|
264
307
|
|
|
265
|
-
|
|
266
|
-
2. **Start with new features** - Use OpenSpec for your next change proposal
|
|
267
|
-
3. **Build incrementally** - Each new feature adds to your spec library
|
|
268
|
-
4. **Future capability** - We're working on tools to generate specs from existing code
|
|
308
|
+
Run `openspec update` whenever someone switches tools so your agents pick up the latest instructions and slash-command bindings.
|
|
269
309
|
|
|
270
|
-
|
|
310
|
+
## Updating OpenSpec
|
|
271
311
|
|
|
312
|
+
1. **Upgrade the package**
|
|
313
|
+
```bash
|
|
314
|
+
npm install -g @fission-ai/openspec@latest
|
|
315
|
+
```
|
|
316
|
+
2. **Refresh agent instructions**
|
|
317
|
+
- Run `openspec update` inside each project to regenerate AI guidance and ensure the latest slash commands are active.
|
|
272
318
|
|
|
273
319
|
## Contributing
|
|
274
320
|
|
|
275
|
-
- Install dependencies: `
|
|
276
|
-
- Build: `
|
|
277
|
-
- Test: `
|
|
278
|
-
- Develop CLI locally: `
|
|
321
|
+
- Install dependencies: `pnpm install`
|
|
322
|
+
- Build: `pnpm run build`
|
|
323
|
+
- Test: `pnpm test`
|
|
324
|
+
- Develop CLI locally: `pnpm run dev` or `pnpm run dev:cli`
|
|
279
325
|
- Conventional commits (one-line): `type(scope): subject`
|
|
280
326
|
|
|
281
327
|
## License
|
package/dist/core/config.d.ts
CHANGED
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
export declare const OPENSPEC_DIR_NAME = "openspec";
|
|
2
|
-
export interface OpenSpecConfig {
|
|
3
|
-
aiTools: string[];
|
|
4
|
-
}
|
|
5
2
|
export declare const OPENSPEC_MARKERS: {
|
|
6
3
|
start: string;
|
|
7
4
|
end: string;
|
|
8
5
|
};
|
|
9
|
-
export
|
|
6
|
+
export interface OpenSpecConfig {
|
|
7
|
+
aiTools: string[];
|
|
8
|
+
}
|
|
9
|
+
export interface AIToolOption {
|
|
10
10
|
name: string;
|
|
11
11
|
value: string;
|
|
12
12
|
available: boolean;
|
|
13
|
-
|
|
13
|
+
successLabel?: string;
|
|
14
|
+
}
|
|
15
|
+
export declare const AI_TOOLS: AIToolOption[];
|
|
14
16
|
//# sourceMappingURL=config.d.ts.map
|
package/dist/core/config.js
CHANGED
|
@@ -4,9 +4,9 @@ export const OPENSPEC_MARKERS = {
|
|
|
4
4
|
end: '<!-- OPENSPEC:END -->'
|
|
5
5
|
};
|
|
6
6
|
export const AI_TOOLS = [
|
|
7
|
-
{ name: 'Claude Code', value: 'claude', available: true },
|
|
8
|
-
{ name: 'Cursor', value: 'cursor', available: true },
|
|
9
|
-
{ name: '
|
|
10
|
-
{ name: '
|
|
7
|
+
{ name: 'Claude Code (✅ OpenSpec custom slash commands available)', value: 'claude', available: true, successLabel: 'Claude Code' },
|
|
8
|
+
{ name: 'Cursor (✅ OpenSpec custom slash commands available)', value: 'cursor', available: true, successLabel: 'Cursor' },
|
|
9
|
+
{ name: 'OpenCode (✅ OpenSpec custom slash commands available)', value: 'opencode', available: true, successLabel: 'OpenCode' },
|
|
10
|
+
{ name: 'AGENTS.md (works with Codex, Amp, Copilot, …)', value: 'agents', available: true, successLabel: 'your AGENTS.md-compatible assistant' }
|
|
11
11
|
];
|
|
12
12
|
//# sourceMappingURL=config.js.map
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ToolConfigurator } from './base.js';
|
|
2
|
+
export declare class AgentsStandardConfigurator implements ToolConfigurator {
|
|
3
|
+
name: string;
|
|
4
|
+
configFileName: string;
|
|
5
|
+
isAvailable: boolean;
|
|
6
|
+
configure(projectPath: string, _openspecDir: string): Promise<void>;
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=agents.d.ts.map
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import path from 'path';
|
|
2
|
+
import { FileSystemUtils } from '../../utils/file-system.js';
|
|
3
|
+
import { TemplateManager } from '../templates/index.js';
|
|
4
|
+
import { OPENSPEC_MARKERS } from '../config.js';
|
|
5
|
+
export class AgentsStandardConfigurator {
|
|
6
|
+
name = 'AGENTS.md standard';
|
|
7
|
+
configFileName = 'AGENTS.md';
|
|
8
|
+
isAvailable = true;
|
|
9
|
+
async configure(projectPath, _openspecDir) {
|
|
10
|
+
const filePath = path.join(projectPath, this.configFileName);
|
|
11
|
+
const content = TemplateManager.getAgentsStandardTemplate();
|
|
12
|
+
await FileSystemUtils.updateFileWithMarkers(filePath, content, OPENSPEC_MARKERS.start, OPENSPEC_MARKERS.end);
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=agents.js.map
|
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
import { ClaudeConfigurator } from './claude.js';
|
|
2
|
+
import { AgentsStandardConfigurator } from './agents.js';
|
|
2
3
|
export class ToolRegistry {
|
|
3
4
|
static tools = new Map();
|
|
4
5
|
static {
|
|
5
6
|
const claudeConfigurator = new ClaudeConfigurator();
|
|
7
|
+
const agentsConfigurator = new AgentsStandardConfigurator();
|
|
6
8
|
// Register with the ID that matches the checkbox value
|
|
7
9
|
this.tools.set('claude', claudeConfigurator);
|
|
10
|
+
this.tools.set('agents', agentsConfigurator);
|
|
8
11
|
}
|
|
9
12
|
static register(tool) {
|
|
10
13
|
this.tools.set(tool.name.toLowerCase().replace(/\s+/g, '-'), tool);
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { SlashCommandConfigurator } from "./base.js";
|
|
2
|
+
import { SlashCommandId } from "../../templates/index.js";
|
|
3
|
+
export declare class OpenCodeSlashCommandConfigurator extends SlashCommandConfigurator {
|
|
4
|
+
readonly toolId = "opencode";
|
|
5
|
+
readonly isAvailable = true;
|
|
6
|
+
protected getRelativePath(id: SlashCommandId): string;
|
|
7
|
+
protected getFrontmatter(id: SlashCommandId): string | undefined;
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=opencode.d.ts.map
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { SlashCommandConfigurator } from "./base.js";
|
|
2
|
+
const FILE_PATHS = {
|
|
3
|
+
proposal: ".opencode/command/openspec-proposal.md",
|
|
4
|
+
apply: ".opencode/command/openspec-apply.md",
|
|
5
|
+
archive: ".opencode/command/openspec-archive.md",
|
|
6
|
+
};
|
|
7
|
+
const FRONTMATTER = {
|
|
8
|
+
proposal: `---
|
|
9
|
+
agent: build
|
|
10
|
+
description: Scaffold a new OpenSpec change and validate strictly.
|
|
11
|
+
---
|
|
12
|
+
The user has requested the following change proposal. Use the openspec instructions to create their change proposal.
|
|
13
|
+
<UserRequest>
|
|
14
|
+
$ARGUMENTS
|
|
15
|
+
</UserRequest>
|
|
16
|
+
`,
|
|
17
|
+
apply: `---
|
|
18
|
+
agent: build
|
|
19
|
+
description: Implement an approved OpenSpec change and keep tasks in sync.
|
|
20
|
+
---`,
|
|
21
|
+
archive: `---
|
|
22
|
+
agent: build
|
|
23
|
+
description: Archive a deployed OpenSpec change and update specs.
|
|
24
|
+
---`,
|
|
25
|
+
};
|
|
26
|
+
export class OpenCodeSlashCommandConfigurator extends SlashCommandConfigurator {
|
|
27
|
+
toolId = "opencode";
|
|
28
|
+
isAvailable = true;
|
|
29
|
+
getRelativePath(id) {
|
|
30
|
+
return FILE_PATHS[id];
|
|
31
|
+
}
|
|
32
|
+
getFrontmatter(id) {
|
|
33
|
+
return FRONTMATTER[id];
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
//# sourceMappingURL=opencode.js.map
|
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
import { ClaudeSlashCommandConfigurator } from './claude.js';
|
|
2
2
|
import { CursorSlashCommandConfigurator } from './cursor.js';
|
|
3
|
+
import { OpenCodeSlashCommandConfigurator } from './opencode.js';
|
|
3
4
|
export class SlashCommandRegistry {
|
|
4
5
|
static configurators = new Map();
|
|
5
6
|
static {
|
|
6
7
|
const claude = new ClaudeSlashCommandConfigurator();
|
|
7
8
|
const cursor = new CursorSlashCommandConfigurator();
|
|
9
|
+
const opencode = new OpenCodeSlashCommandConfigurator();
|
|
8
10
|
this.configurators.set(claude.toolId, claude);
|
|
9
11
|
this.configurators.set(cursor.toolId, cursor);
|
|
12
|
+
this.configurators.set(opencode.toolId, opencode);
|
|
10
13
|
}
|
|
11
14
|
static register(configurator) {
|
|
12
15
|
this.configurators.set(configurator.toolId, configurator);
|
package/dist/core/init.d.ts
CHANGED
|
@@ -1,10 +1,38 @@
|
|
|
1
|
+
type ToolLabel = {
|
|
2
|
+
primary: string;
|
|
3
|
+
annotation?: string;
|
|
4
|
+
};
|
|
5
|
+
type ToolWizardChoice = {
|
|
6
|
+
value: string;
|
|
7
|
+
label: ToolLabel;
|
|
8
|
+
configured: boolean;
|
|
9
|
+
};
|
|
10
|
+
type ToolWizardConfig = {
|
|
11
|
+
extendMode: boolean;
|
|
12
|
+
baseMessage: string;
|
|
13
|
+
choices: ToolWizardChoice[];
|
|
14
|
+
initialSelected?: string[];
|
|
15
|
+
};
|
|
16
|
+
type ToolSelectionPrompt = (config: ToolWizardConfig) => Promise<string[]>;
|
|
17
|
+
type InitCommandOptions = {
|
|
18
|
+
prompt?: ToolSelectionPrompt;
|
|
19
|
+
};
|
|
1
20
|
export declare class InitCommand {
|
|
21
|
+
private readonly prompt;
|
|
22
|
+
constructor(options?: InitCommandOptions);
|
|
2
23
|
execute(targetPath: string): Promise<void>;
|
|
3
24
|
private validate;
|
|
4
25
|
private getConfiguration;
|
|
26
|
+
private promptForAITools;
|
|
27
|
+
private getExistingToolStates;
|
|
28
|
+
private isToolConfigured;
|
|
5
29
|
private createDirectoryStructure;
|
|
6
30
|
private generateFiles;
|
|
7
31
|
private configureAITools;
|
|
8
32
|
private displaySuccessMessage;
|
|
33
|
+
private formatToolNames;
|
|
34
|
+
private renderBanner;
|
|
35
|
+
private startSpinner;
|
|
9
36
|
}
|
|
37
|
+
export {};
|
|
10
38
|
//# sourceMappingURL=init.d.ts.map
|