@fission-ai/openspec 0.19.0 → 0.20.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 +7 -0
- package/dist/commands/artifact-workflow.js +6 -1
- package/dist/core/completions/generators/powershell-generator.d.ts +1 -0
- package/dist/core/completions/generators/powershell-generator.js +9 -0
- package/dist/core/templates/agents-template.d.ts +1 -1
- package/dist/core/templates/agents-template.js +7 -7
- package/dist/core/templates/skill-templates.d.ts +9 -0
- package/dist/core/templates/skill-templates.js +335 -0
- package/dist/core/templates/slash-command-templates.js +2 -2
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -428,6 +428,13 @@ We collect only command names and version to understand usage patterns. No argum
|
|
|
428
428
|
- Develop CLI locally: `pnpm run dev` or `pnpm run dev:cli`
|
|
429
429
|
- Conventional commits (one-line): `type(scope): subject`
|
|
430
430
|
|
|
431
|
+
<details>
|
|
432
|
+
<summary><strong>Maintainers & Advisors</strong></summary>
|
|
433
|
+
|
|
434
|
+
See [MAINTAINERS.md](MAINTAINERS.md) for the list of core maintainers and advisors who help guide the project.
|
|
435
|
+
|
|
436
|
+
</details>
|
|
437
|
+
|
|
431
438
|
## License
|
|
432
439
|
|
|
433
440
|
MIT
|
|
@@ -14,7 +14,7 @@ import path from 'path';
|
|
|
14
14
|
import * as fs from 'fs';
|
|
15
15
|
import { loadChangeContext, formatChangeStatus, generateInstructions, listSchemas, listSchemasWithInfo, getSchemaDir, resolveSchema, ArtifactGraph, } from '../core/artifact-graph/index.js';
|
|
16
16
|
import { createChange, validateChangeName } from '../utils/change-utils.js';
|
|
17
|
-
import { getExploreSkillTemplate, getNewChangeSkillTemplate, getContinueChangeSkillTemplate, getApplyChangeSkillTemplate, getFfChangeSkillTemplate, getSyncSpecsSkillTemplate, getArchiveChangeSkillTemplate, getOpsxExploreCommandTemplate, getOpsxNewCommandTemplate, getOpsxContinueCommandTemplate, getOpsxApplyCommandTemplate, getOpsxFfCommandTemplate, getOpsxSyncCommandTemplate, getOpsxArchiveCommandTemplate } from '../core/templates/skill-templates.js';
|
|
17
|
+
import { getExploreSkillTemplate, getNewChangeSkillTemplate, getContinueChangeSkillTemplate, getApplyChangeSkillTemplate, getFfChangeSkillTemplate, getSyncSpecsSkillTemplate, getArchiveChangeSkillTemplate, getVerifyChangeSkillTemplate, getOpsxExploreCommandTemplate, getOpsxNewCommandTemplate, getOpsxContinueCommandTemplate, getOpsxApplyCommandTemplate, getOpsxFfCommandTemplate, getOpsxSyncCommandTemplate, getOpsxArchiveCommandTemplate, getOpsxVerifyCommandTemplate } from '../core/templates/skill-templates.js';
|
|
18
18
|
import { FileSystemUtils } from '../utils/file-system.js';
|
|
19
19
|
const DEFAULT_SCHEMA = 'spec-driven';
|
|
20
20
|
/**
|
|
@@ -587,6 +587,7 @@ async function artifactExperimentalSetupCommand() {
|
|
|
587
587
|
const ffChangeSkill = getFfChangeSkillTemplate();
|
|
588
588
|
const syncSpecsSkill = getSyncSpecsSkillTemplate();
|
|
589
589
|
const archiveChangeSkill = getArchiveChangeSkillTemplate();
|
|
590
|
+
const verifyChangeSkill = getVerifyChangeSkillTemplate();
|
|
590
591
|
// Get command templates
|
|
591
592
|
const exploreCommand = getOpsxExploreCommandTemplate();
|
|
592
593
|
const newCommand = getOpsxNewCommandTemplate();
|
|
@@ -595,6 +596,7 @@ async function artifactExperimentalSetupCommand() {
|
|
|
595
596
|
const ffCommand = getOpsxFfCommandTemplate();
|
|
596
597
|
const syncCommand = getOpsxSyncCommandTemplate();
|
|
597
598
|
const archiveCommand = getOpsxArchiveCommandTemplate();
|
|
599
|
+
const verifyCommand = getOpsxVerifyCommandTemplate();
|
|
598
600
|
// Create skill directories and SKILL.md files
|
|
599
601
|
const skills = [
|
|
600
602
|
{ template: exploreSkill, dirName: 'openspec-explore' },
|
|
@@ -604,6 +606,7 @@ async function artifactExperimentalSetupCommand() {
|
|
|
604
606
|
{ template: ffChangeSkill, dirName: 'openspec-ff-change' },
|
|
605
607
|
{ template: syncSpecsSkill, dirName: 'openspec-sync-specs' },
|
|
606
608
|
{ template: archiveChangeSkill, dirName: 'openspec-archive-change' },
|
|
609
|
+
{ template: verifyChangeSkill, dirName: 'openspec-verify-change' },
|
|
607
610
|
];
|
|
608
611
|
const createdSkillFiles = [];
|
|
609
612
|
for (const { template, dirName } of skills) {
|
|
@@ -630,6 +633,7 @@ ${template.instructions}
|
|
|
630
633
|
{ template: ffCommand, fileName: 'ff.md' },
|
|
631
634
|
{ template: syncCommand, fileName: 'sync.md' },
|
|
632
635
|
{ template: archiveCommand, fileName: 'archive.md' },
|
|
636
|
+
{ template: verifyCommand, fileName: 'verify.md' },
|
|
633
637
|
];
|
|
634
638
|
const createdCommandFiles = [];
|
|
635
639
|
for (const { template, fileName } of commands) {
|
|
@@ -682,6 +686,7 @@ ${template.content}
|
|
|
682
686
|
console.log(' • /opsx:apply - Implement tasks');
|
|
683
687
|
console.log(' • /opsx:ff - Fast-forward: create all artifacts at once');
|
|
684
688
|
console.log(' • /opsx:sync - Sync delta specs to main specs');
|
|
689
|
+
console.log(' • /opsx:verify - Verify implementation matches artifacts');
|
|
685
690
|
console.log(' • /opsx:archive - Archive a completed change');
|
|
686
691
|
console.log();
|
|
687
692
|
console.log(chalk.yellow('💡 This is an experimental feature.'));
|
|
@@ -5,6 +5,7 @@ import { CompletionGenerator, CommandDefinition } from '../types.js';
|
|
|
5
5
|
*/
|
|
6
6
|
export declare class PowerShellGenerator implements CompletionGenerator {
|
|
7
7
|
readonly shell: "powershell";
|
|
8
|
+
private stripTrailingCommaFromLastLine;
|
|
8
9
|
/**
|
|
9
10
|
* Generate a PowerShell completion script
|
|
10
11
|
*
|
|
@@ -5,6 +5,11 @@ import { POWERSHELL_DYNAMIC_HELPERS } from '../templates/powershell-templates.js
|
|
|
5
5
|
*/
|
|
6
6
|
export class PowerShellGenerator {
|
|
7
7
|
shell = 'powershell';
|
|
8
|
+
stripTrailingCommaFromLastLine(lines) {
|
|
9
|
+
if (lines.length === 0)
|
|
10
|
+
return;
|
|
11
|
+
lines[lines.length - 1] = lines[lines.length - 1].replace(/,\s*$/, '');
|
|
12
|
+
}
|
|
8
13
|
/**
|
|
9
14
|
* Generate a PowerShell completion script
|
|
10
15
|
*
|
|
@@ -17,6 +22,7 @@ export class PowerShellGenerator {
|
|
|
17
22
|
for (const cmd of commands) {
|
|
18
23
|
commandLines.push(` @{Name="${cmd.name}"; Description="${this.escapeDescription(cmd.description)}"},`);
|
|
19
24
|
}
|
|
25
|
+
this.stripTrailingCommaFromLastLine(commandLines);
|
|
20
26
|
const topLevelCommands = commandLines.join('\n');
|
|
21
27
|
// Build command cases using push() for loop clarity
|
|
22
28
|
const commandCaseLines = [];
|
|
@@ -81,6 +87,7 @@ Register-ArgumentCompleter -CommandName openspec -ScriptBlock $openspecCompleter
|
|
|
81
87
|
lines.push(`${indent} @{Name="${longFlag}"; Description="${this.escapeDescription(flag.description)}"},`);
|
|
82
88
|
}
|
|
83
89
|
}
|
|
90
|
+
this.stripTrailingCommaFromLastLine(lines);
|
|
84
91
|
lines.push(`${indent} )`);
|
|
85
92
|
lines.push(`${indent} $flags | Where-Object { $_.Name -like "$wordToComplete*" } | ForEach-Object {`);
|
|
86
93
|
lines.push(`${indent} [System.Management.Automation.CompletionResult]::new($_.Name, $_.Name, "ParameterName", $_.Description)`);
|
|
@@ -95,6 +102,7 @@ Register-ArgumentCompleter -CommandName openspec -ScriptBlock $openspecCompleter
|
|
|
95
102
|
for (const subcmd of cmd.subcommands) {
|
|
96
103
|
lines.push(`${indent} @{Name="${subcmd.name}"; Description="${this.escapeDescription(subcmd.description)}"},`);
|
|
97
104
|
}
|
|
105
|
+
this.stripTrailingCommaFromLastLine(lines);
|
|
98
106
|
lines.push(`${indent} )`);
|
|
99
107
|
lines.push(`${indent} $subcommands | Where-Object { $_.Name -like "$wordToComplete*" } | ForEach-Object {`);
|
|
100
108
|
lines.push(`${indent} [System.Management.Automation.CompletionResult]::new($_.Name, $_.Name, "ParameterValue", $_.Description)`);
|
|
@@ -137,6 +145,7 @@ Register-ArgumentCompleter -CommandName openspec -ScriptBlock $openspecCompleter
|
|
|
137
145
|
lines.push(`${indent} @{Name="${longFlag}"; Description="${this.escapeDescription(flag.description)}"},`);
|
|
138
146
|
}
|
|
139
147
|
}
|
|
148
|
+
this.stripTrailingCommaFromLastLine(lines);
|
|
140
149
|
lines.push(`${indent} )`);
|
|
141
150
|
lines.push(`${indent} $flags | Where-Object { $_.Name -like "$wordToComplete*" } | ForEach-Object {`);
|
|
142
151
|
lines.push(`${indent} [System.Management.Automation.CompletionResult]::new($_.Name, $_.Name, "ParameterName", $_.Description)`);
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const agentsTemplate = "# OpenSpec Instructions\n\nInstructions for AI coding assistants using OpenSpec for spec-driven development.\n\n## TL;DR Quick Checklist\n\n- Search existing work: `openspec spec list --long`, `openspec list` (use `rg` only for full-text search)\n- Decide scope: new capability vs modify existing capability\n- Pick a unique `change-id`: kebab-case, verb-led (`add-`, `update-`, `remove-`, `refactor-`)\n- Scaffold: `proposal.md`, `tasks.md`, `design.md` (only if needed), and delta specs per affected capability\n- Write deltas: use `## ADDED|MODIFIED|REMOVED|RENAMED Requirements`; include at least one `#### Scenario:` per requirement\n- Validate: `openspec validate [change-id] --strict` and fix issues\n- Request approval: Do not start implementation until proposal is approved\n\n## Three-Stage Workflow\n\n### Stage 1: Creating Changes\nCreate proposal when you need to:\n- Add features or functionality\n- Make breaking changes (API, schema)\n- Change architecture or patterns \n- Optimize performance (changes behavior)\n- Update security patterns\n\nTriggers (examples):\n- \"Help me create a change proposal\"\n- \"Help me plan a change\"\n- \"Help me create a proposal\"\n- \"I want to create a spec proposal\"\n- \"I want to create a spec\"\n\nLoose matching guidance:\n- Contains one of: `proposal`, `change`, `spec`\n- With one of: `create`, `plan`, `make`, `start`, `help`\n\nSkip proposal for:\n- Bug fixes (restore intended behavior)\n- Typos, formatting, comments\n- Dependency updates (non-breaking)\n- Configuration changes\n- Tests for existing behavior\n\n**Workflow**\n1. Review `openspec/project.md`, `openspec list`, and `openspec list --specs` to understand current context.\n2. Choose a unique verb-led `change-id` and scaffold `proposal.md`, `tasks.md`, optional `design.md`, and spec deltas under `openspec/changes/<id>/`.\n3. Draft spec deltas using `## ADDED|MODIFIED|REMOVED Requirements` with at least one `#### Scenario:` per requirement.\n4. Run `openspec validate <id> --strict` and resolve any issues before sharing the proposal.\n\n### Stage 2: Implementing Changes\nTrack these steps as TODOs and complete them one by one.\n1. **Read proposal.md** - Understand what's being built\n2. **Read design.md** (if exists) - Review technical decisions\n3. **Read tasks.md** - Get implementation checklist\n4. **Implement tasks sequentially** - Complete in order\n5. **Confirm completion** - Ensure every item in `tasks.md` is finished before updating statuses\n6. **Update checklist** - After all work is done, set every task to `- [x]` so the list reflects reality\n7. **Approval gate** - Do not start implementation until the proposal is reviewed and approved\n\n### Stage 3: Archiving Changes\nAfter deployment, create separate PR to:\n- Move `changes/[name]/` \u2192 `changes/archive/YYYY-MM-DD-[name]/`\n- Update `specs/` if capabilities changed\n- Use `openspec archive <change-id> --skip-specs --yes` for tooling-only changes (always pass the change ID explicitly)\n- Run `openspec validate --strict` to confirm the archived change passes checks\n\n## Before Any Task\n\n**Context Checklist:**\n- [ ] Read relevant specs in `specs/[capability]/spec.md`\n- [ ] Check pending changes in `changes/` for conflicts\n- [ ] Read `openspec/project.md` for conventions\n- [ ] Run `openspec list` to see active changes\n- [ ] Run `openspec list --specs` to see existing capabilities\n\n**Before Creating Specs:**\n- Always check if capability already exists\n- Prefer modifying existing specs over creating duplicates\n- Use `openspec show [spec]` to review current state\n- If request is ambiguous, ask 1\u20132 clarifying questions before scaffolding\n\n### Search Guidance\n- Enumerate specs: `openspec spec list --long` (or `--json` for scripts)\n- Enumerate changes: `openspec list` (or `openspec change list --json` - deprecated but available)\n- Show details:\n - Spec: `openspec show <spec-id> --type spec` (use `--json` for filters)\n - Change: `openspec show <change-id> --json --deltas-only`\n- Full-text search (use ripgrep): `rg -n \"Requirement:|Scenario:\" openspec/specs`\n\n## Quick Start\n\n### CLI Commands\n\n```bash\n# Essential commands\nopenspec list # List active changes\nopenspec list --specs # List specifications\nopenspec show [item] # Display change or spec\nopenspec validate [item] # Validate changes or specs\nopenspec archive <change-id> [--yes|-y] # Archive after deployment (add --yes for non-interactive runs)\n\n# Project management\nopenspec init [path] # Initialize OpenSpec\nopenspec update [path] # Update instruction files\n\n# Interactive mode\nopenspec show # Prompts for selection\nopenspec validate # Bulk validation mode\n\n# Debugging\nopenspec show [change] --json --deltas-only\nopenspec validate [change] --strict\n```\n\n### Command Flags\n\n- `--json` - Machine-readable output\n- `--type change|spec` - Disambiguate items\n- `--strict` - Comprehensive validation\n- `--no-interactive` - Disable prompts\n- `--skip-specs` - Archive without spec updates\n- `--yes`/`-y` - Skip confirmation prompts (non-interactive archive)\n\n## Directory Structure\n\n```\nopenspec/\n\u251C\u2500\u2500 project.md # Project conventions\n\u251C\u2500\u2500 specs/ # Current truth - what IS built\n\u2502 \u2514\u2500\u2500 [capability]/ # Single focused capability\n\u2502 \u251C\u2500\u2500 spec.md # Requirements and scenarios\n\u2502 \u2514\u2500\u2500 design.md # Technical patterns\n\u251C\u2500\u2500 changes/ # Proposals - what SHOULD change\n\u2502 \u251C\u2500\u2500 [change-name]/\n\u2502 \u2502 \u251C\u2500\u2500 proposal.md # Why, what, impact\n\u2502 \u2502 \u251C\u2500\u2500 tasks.md # Implementation checklist\n\u2502 \u2502 \u251C\u2500\u2500 design.md # Technical decisions (optional; see criteria)\n\u2502 \u2502 \u2514\u2500\u2500 specs/ # Delta changes\n\u2502 \u2502 \u2514\u2500\u2500 [capability]/\n\u2502 \u2502 \u2514\u2500\u2500 spec.md # ADDED/MODIFIED/REMOVED\n\u2502 \u2514\u2500\u2500 archive/ # Completed changes\n```\n\n## Creating Change Proposals\n\n### Decision Tree\n\n```\nNew request?\n\u251C\u2500 Bug fix restoring spec behavior? \u2192 Fix directly\n\u251C\u2500 Typo/format/comment? \u2192 Fix directly \n\u251C\u2500 New feature/capability? \u2192 Create proposal\n\u251C\u2500 Breaking change? \u2192 Create proposal\n\u251C\u2500 Architecture change? \u2192 Create proposal\n\u2514\u2500 Unclear? \u2192 Create proposal (safer)\n```\n\n### Proposal Structure\n\n1. **Create directory:** `changes/[change-id]/` (kebab-case, verb-led, unique)\n\n2. **Write proposal.md:**\n```markdown\n# Change: [Brief description of change]\n\n## Why\n[1-2 sentences on problem/opportunity]\n\n## What Changes\n- [Bullet list of changes]\n- [Mark breaking changes with **BREAKING**]\n\n## Impact\n- Affected specs: [list capabilities]\n- Affected code: [key files/systems]\n```\n\n3. **Create spec deltas:** `specs/[capability]/spec.md`\n```markdown\n## ADDED Requirements\n### Requirement: New Feature\nThe system SHALL provide...\n\n#### Scenario: Success case\n- **WHEN** user performs action\n- **THEN** expected result\n\n## MODIFIED Requirements\n### Requirement: Existing Feature\n[Complete modified requirement]\n\n## REMOVED Requirements\n### Requirement: Old Feature\n**Reason**: [Why removing]\n**Migration**: [How to handle]\n```\nIf multiple capabilities are affected, create multiple delta files under `changes/[change-id]/specs/<capability>/spec.md`\u2014one per capability.\n\n4. **Create tasks.md:**\n```markdown\n## 1. Implementation\n- [ ] 1.1 Create database schema\n- [ ] 1.2 Implement API endpoint\n- [ ] 1.3 Add frontend component\n- [ ] 1.4 Write tests\n```\n\n5. **Create design.md when needed:**\nCreate `design.md` if any of the following apply; otherwise omit it:\n- Cross-cutting change (multiple services/modules) or a new architectural pattern\n- New external dependency or significant data model changes\n- Security, performance, or migration complexity\n- Ambiguity that benefits from technical decisions before coding\n\nMinimal `design.md` skeleton:\n```markdown\n## Context\n[Background, constraints, stakeholders]\n\n## Goals / Non-Goals\n- Goals: [...]\n- Non-Goals: [...]\n\n## Decisions\n- Decision: [What and why]\n- Alternatives considered: [Options + rationale]\n\n## Risks / Trade-offs\n- [Risk] \u2192 Mitigation\n\n## Migration Plan\n[Steps, rollback]\n\n## Open Questions\n- [...]\n```\n\n## Spec File Format\n\n### Critical: Scenario Formatting\n\n**CORRECT** (use #### headers):\n```markdown\n#### Scenario: User login success\n- **WHEN** valid credentials provided\n- **THEN** return JWT token\n```\n\n**WRONG** (don't use bullets or bold):\n```markdown\n- **Scenario: User login** \u274C\n**Scenario**: User login \u274C\n### Scenario: User login \u274C\n```\n\nEvery requirement MUST have at least one scenario.\n\n### Requirement Wording\n- Use SHALL/MUST for normative requirements (avoid should/may unless intentionally non-normative)\n\n### Delta Operations\n\n- `## ADDED Requirements` - New capabilities\n- `## MODIFIED Requirements` - Changed behavior\n- `## REMOVED Requirements` - Deprecated features\n- `## RENAMED Requirements` - Name changes\n\nHeaders matched with `trim(header)` - whitespace ignored.\n\n#### When to use ADDED vs MODIFIED\n- ADDED: Introduces a new capability or sub-capability that can stand alone as a requirement. Prefer ADDED when the change is orthogonal (e.g., adding \"Slash Command Configuration\") rather than altering the semantics of an existing requirement.\n- MODIFIED: Changes the behavior, scope, or acceptance criteria of an existing requirement. Always paste the full, updated requirement content (header + all scenarios). The archiver will replace the entire requirement with what you provide here; partial deltas will drop previous details.\n- RENAMED: Use when only the name changes. If you also change behavior, use RENAMED (name) plus MODIFIED (content) referencing the new name.\n\nCommon pitfall: Using MODIFIED to add a new concern without including the previous text. This causes loss of detail at archive time. If you aren\u2019t explicitly changing the existing requirement, add a new requirement under ADDED instead.\n\nAuthoring a MODIFIED requirement correctly:\n1) Locate the existing requirement in `openspec/specs/<capability>/spec.md`.\n2) Copy the entire requirement block (from `### Requirement: ...` through its scenarios).\n3) Paste it under `## MODIFIED Requirements` and edit to reflect the new behavior.\n4) Ensure the header text matches exactly (whitespace-insensitive) and keep at least one `#### Scenario:`.\n\nExample for RENAMED:\n```markdown\n## RENAMED Requirements\n- FROM: `### Requirement: Login`\n- TO: `### Requirement: User Authentication`\n```\n\n## Troubleshooting\n\n### Common Errors\n\n**\"Change must have at least one delta\"**\n- Check `changes/[name]/specs/` exists with .md files\n- Verify files have operation prefixes (## ADDED Requirements)\n\n**\"Requirement must have at least one scenario\"**\n- Check scenarios use `#### Scenario:` format (4 hashtags)\n- Don't use bullet points or bold for scenario headers\n\n**Silent scenario parsing failures**\n- Exact format required: `#### Scenario: Name`\n- Debug with: `openspec show [change] --json --deltas-only`\n\n### Validation Tips\n\n```bash\n# Always use strict mode for comprehensive checks\nopenspec validate [change] --strict\n\n# Debug delta parsing\nopenspec show [change] --json | jq '.deltas'\n\n# Check specific requirement\nopenspec show [spec] --json -r 1\n```\n\n## Happy Path Script\n\n```bash\n# 1) Explore current state\nopenspec spec list --long\nopenspec list\n# Optional full-text search:\n# rg -n \"Requirement:|Scenario:\" openspec/specs\n# rg -n \"^#|Requirement:\" openspec/changes\n\n# 2) Choose change id and scaffold\nCHANGE=add-two-factor-auth\nmkdir -p openspec/changes/$CHANGE/{specs/auth}\nprintf \"## Why\\n...\\n\\n## What Changes\\n- ...\\n\\n## Impact\\n- ...\\n\" > openspec/changes/$CHANGE/proposal.md\nprintf \"## 1. Implementation\\n- [ ] 1.1 ...\\n\" > openspec/changes/$CHANGE/tasks.md\n\n# 3) Add deltas (example)\ncat > openspec/changes/$CHANGE/specs/auth/spec.md << 'EOF'\n## ADDED Requirements\n### Requirement: Two-Factor Authentication\nUsers MUST provide a second factor during login.\n\n#### Scenario: OTP required\n- **WHEN** valid credentials are provided\n- **THEN** an OTP challenge is required\nEOF\n\n# 4) Validate\nopenspec validate $CHANGE --strict\n```\n\n## Multi-Capability Example\n\n```\nopenspec/changes/add-2fa-notify/\n\u251C\u2500\u2500 proposal.md\n\u251C\u2500\u2500 tasks.md\n\u2514\u2500\u2500 specs/\n \u251C\u2500\u2500 auth/\n \u2502 \u2514\u2500\u2500 spec.md # ADDED: Two-Factor Authentication\n \u2514\u2500\u2500 notifications/\n \u2514\u2500\u2500 spec.md # ADDED: OTP email notification\n```\n\nauth/spec.md\n```markdown\n## ADDED Requirements\n### Requirement: Two-Factor Authentication\n...\n```\n\nnotifications/spec.md\n```markdown\n## ADDED Requirements\n### Requirement: OTP Email Notification\n...\n```\n\n## Best Practices\n\n### Simplicity First\n- Default to <100 lines of new code\n- Single-file implementations until proven insufficient\n- Avoid frameworks without clear justification\n- Choose boring, proven patterns\n\n### Complexity Triggers\nOnly add complexity with:\n- Performance data showing current solution too slow\n- Concrete scale requirements (>1000 users, >100MB data)\n- Multiple proven use cases requiring abstraction\n\n### Clear References\n- Use `file.ts:42` format for code locations\n- Reference specs as `specs/auth/spec.md`\n- Link related changes and PRs\n\n### Capability Naming\n- Use verb-noun: `user-auth`, `payment-capture`\n- Single purpose per capability\n- 10-minute understandability rule\n- Split if description needs \"AND\"\n\n### Change ID Naming\n- Use kebab-case, short and descriptive: `add-two-factor-auth`\n- Prefer verb-led prefixes: `add-`, `update-`, `remove-`, `refactor-`\n- Ensure uniqueness; if taken, append `-2`, `-3`, etc.\n\n## Tool Selection Guide\n\n| Task | Tool | Why |\n|------|------|-----|\n| Find files by pattern | Glob | Fast pattern matching |\n| Search code content | Grep | Optimized regex search |\n| Read specific files | Read | Direct file access |\n| Explore unknown scope | Task | Multi-step investigation |\n\n## Error Recovery\n\n### Change Conflicts\n1. Run `openspec list` to see active changes\n2. Check for overlapping specs\n3. Coordinate with change owners\n4. Consider combining proposals\n\n### Validation Failures\n1. Run with `--strict` flag\n2. Check JSON output for details\n3. Verify spec file format\n4. Ensure scenarios properly formatted\n\n### Missing Context\n1. Read project.md first\n2. Check related specs\n3. Review recent archives\n4. Ask for clarification\n\n## Quick Reference\n\n### Stage Indicators\n- `changes/` - Proposed, not yet built\n- `specs/` - Built and deployed\n- `archive/` - Completed changes\n\n### File Purposes\n- `proposal.md` - Why and what\n- `tasks.md` - Implementation steps\n- `design.md` - Technical decisions\n- `spec.md` - Requirements and behavior\n\n### CLI Essentials\n```bash\nopenspec list # What's in progress?\nopenspec show [item] # View details\nopenspec validate --strict # Is it correct?\nopenspec archive <change-id> [--yes|-y] # Mark complete (add --yes for automation)\n```\n\nRemember: Specs are truth. Changes are proposals. Keep them in sync.\n";
|
|
1
|
+
export declare const agentsTemplate = "# OpenSpec Instructions\n\nInstructions for AI coding assistants using OpenSpec for spec-driven development.\n\n## TL;DR Quick Checklist\n\n- Search existing work: `openspec spec list --long`, `openspec list` (use `rg` only for full-text search)\n- Decide scope: new capability vs modify existing capability\n- Pick a unique `change-id`: kebab-case, verb-led (`add-`, `update-`, `remove-`, `refactor-`)\n- Scaffold: `proposal.md`, `tasks.md`, `design.md` (only if needed), and delta specs per affected capability\n- Write deltas: use `## ADDED|MODIFIED|REMOVED|RENAMED Requirements`; include at least one `#### Scenario:` per requirement\n- Validate: `openspec validate [change-id] --strict --no-interactive` and fix issues\n- Request approval: Do not start implementation until proposal is approved\n\n## Three-Stage Workflow\n\n### Stage 1: Creating Changes\nCreate proposal when you need to:\n- Add features or functionality\n- Make breaking changes (API, schema)\n- Change architecture or patterns \n- Optimize performance (changes behavior)\n- Update security patterns\n\nTriggers (examples):\n- \"Help me create a change proposal\"\n- \"Help me plan a change\"\n- \"Help me create a proposal\"\n- \"I want to create a spec proposal\"\n- \"I want to create a spec\"\n\nLoose matching guidance:\n- Contains one of: `proposal`, `change`, `spec`\n- With one of: `create`, `plan`, `make`, `start`, `help`\n\nSkip proposal for:\n- Bug fixes (restore intended behavior)\n- Typos, formatting, comments\n- Dependency updates (non-breaking)\n- Configuration changes\n- Tests for existing behavior\n\n**Workflow**\n1. Review `openspec/project.md`, `openspec list`, and `openspec list --specs` to understand current context.\n2. Choose a unique verb-led `change-id` and scaffold `proposal.md`, `tasks.md`, optional `design.md`, and spec deltas under `openspec/changes/<id>/`.\n3. Draft spec deltas using `## ADDED|MODIFIED|REMOVED Requirements` with at least one `#### Scenario:` per requirement.\n4. Run `openspec validate <id> --strict --no-interactive` and resolve any issues before sharing the proposal.\n\n### Stage 2: Implementing Changes\nTrack these steps as TODOs and complete them one by one.\n1. **Read proposal.md** - Understand what's being built\n2. **Read design.md** (if exists) - Review technical decisions\n3. **Read tasks.md** - Get implementation checklist\n4. **Implement tasks sequentially** - Complete in order\n5. **Confirm completion** - Ensure every item in `tasks.md` is finished before updating statuses\n6. **Update checklist** - After all work is done, set every task to `- [x]` so the list reflects reality\n7. **Approval gate** - Do not start implementation until the proposal is reviewed and approved\n\n### Stage 3: Archiving Changes\nAfter deployment, create separate PR to:\n- Move `changes/[name]/` \u2192 `changes/archive/YYYY-MM-DD-[name]/`\n- Update `specs/` if capabilities changed\n- Use `openspec archive <change-id> --skip-specs --yes` for tooling-only changes (always pass the change ID explicitly)\n- Run `openspec validate --strict --no-interactive` to confirm the archived change passes checks\n\n## Before Any Task\n\n**Context Checklist:**\n- [ ] Read relevant specs in `specs/[capability]/spec.md`\n- [ ] Check pending changes in `changes/` for conflicts\n- [ ] Read `openspec/project.md` for conventions\n- [ ] Run `openspec list` to see active changes\n- [ ] Run `openspec list --specs` to see existing capabilities\n\n**Before Creating Specs:**\n- Always check if capability already exists\n- Prefer modifying existing specs over creating duplicates\n- Use `openspec show [spec]` to review current state\n- If request is ambiguous, ask 1\u20132 clarifying questions before scaffolding\n\n### Search Guidance\n- Enumerate specs: `openspec spec list --long` (or `--json` for scripts)\n- Enumerate changes: `openspec list` (or `openspec change list --json` - deprecated but available)\n- Show details:\n - Spec: `openspec show <spec-id> --type spec` (use `--json` for filters)\n - Change: `openspec show <change-id> --json --deltas-only`\n- Full-text search (use ripgrep): `rg -n \"Requirement:|Scenario:\" openspec/specs`\n\n## Quick Start\n\n### CLI Commands\n\n```bash\n# Essential commands\nopenspec list # List active changes\nopenspec list --specs # List specifications\nopenspec show [item] # Display change or spec\nopenspec validate [item] # Validate changes or specs\nopenspec archive <change-id> [--yes|-y] # Archive after deployment (add --yes for non-interactive runs)\n\n# Project management\nopenspec init [path] # Initialize OpenSpec\nopenspec update [path] # Update instruction files\n\n# Interactive mode\nopenspec show # Prompts for selection\nopenspec validate # Bulk validation mode\n\n# Debugging\nopenspec show [change] --json --deltas-only\nopenspec validate [change] --strict --no-interactive\n```\n\n### Command Flags\n\n- `--json` - Machine-readable output\n- `--type change|spec` - Disambiguate items\n- `--strict` - Comprehensive validation\n- `--no-interactive` - Disable prompts\n- `--skip-specs` - Archive without spec updates\n- `--yes`/`-y` - Skip confirmation prompts (non-interactive archive)\n\n## Directory Structure\n\n```\nopenspec/\n\u251C\u2500\u2500 project.md # Project conventions\n\u251C\u2500\u2500 specs/ # Current truth - what IS built\n\u2502 \u2514\u2500\u2500 [capability]/ # Single focused capability\n\u2502 \u251C\u2500\u2500 spec.md # Requirements and scenarios\n\u2502 \u2514\u2500\u2500 design.md # Technical patterns\n\u251C\u2500\u2500 changes/ # Proposals - what SHOULD change\n\u2502 \u251C\u2500\u2500 [change-name]/\n\u2502 \u2502 \u251C\u2500\u2500 proposal.md # Why, what, impact\n\u2502 \u2502 \u251C\u2500\u2500 tasks.md # Implementation checklist\n\u2502 \u2502 \u251C\u2500\u2500 design.md # Technical decisions (optional; see criteria)\n\u2502 \u2502 \u2514\u2500\u2500 specs/ # Delta changes\n\u2502 \u2502 \u2514\u2500\u2500 [capability]/\n\u2502 \u2502 \u2514\u2500\u2500 spec.md # ADDED/MODIFIED/REMOVED\n\u2502 \u2514\u2500\u2500 archive/ # Completed changes\n```\n\n## Creating Change Proposals\n\n### Decision Tree\n\n```\nNew request?\n\u251C\u2500 Bug fix restoring spec behavior? \u2192 Fix directly\n\u251C\u2500 Typo/format/comment? \u2192 Fix directly \n\u251C\u2500 New feature/capability? \u2192 Create proposal\n\u251C\u2500 Breaking change? \u2192 Create proposal\n\u251C\u2500 Architecture change? \u2192 Create proposal\n\u2514\u2500 Unclear? \u2192 Create proposal (safer)\n```\n\n### Proposal Structure\n\n1. **Create directory:** `changes/[change-id]/` (kebab-case, verb-led, unique)\n\n2. **Write proposal.md:**\n```markdown\n# Change: [Brief description of change]\n\n## Why\n[1-2 sentences on problem/opportunity]\n\n## What Changes\n- [Bullet list of changes]\n- [Mark breaking changes with **BREAKING**]\n\n## Impact\n- Affected specs: [list capabilities]\n- Affected code: [key files/systems]\n```\n\n3. **Create spec deltas:** `specs/[capability]/spec.md`\n```markdown\n## ADDED Requirements\n### Requirement: New Feature\nThe system SHALL provide...\n\n#### Scenario: Success case\n- **WHEN** user performs action\n- **THEN** expected result\n\n## MODIFIED Requirements\n### Requirement: Existing Feature\n[Complete modified requirement]\n\n## REMOVED Requirements\n### Requirement: Old Feature\n**Reason**: [Why removing]\n**Migration**: [How to handle]\n```\nIf multiple capabilities are affected, create multiple delta files under `changes/[change-id]/specs/<capability>/spec.md`\u2014one per capability.\n\n4. **Create tasks.md:**\n```markdown\n## 1. Implementation\n- [ ] 1.1 Create database schema\n- [ ] 1.2 Implement API endpoint\n- [ ] 1.3 Add frontend component\n- [ ] 1.4 Write tests\n```\n\n5. **Create design.md when needed:**\nCreate `design.md` if any of the following apply; otherwise omit it:\n- Cross-cutting change (multiple services/modules) or a new architectural pattern\n- New external dependency or significant data model changes\n- Security, performance, or migration complexity\n- Ambiguity that benefits from technical decisions before coding\n\nMinimal `design.md` skeleton:\n```markdown\n## Context\n[Background, constraints, stakeholders]\n\n## Goals / Non-Goals\n- Goals: [...]\n- Non-Goals: [...]\n\n## Decisions\n- Decision: [What and why]\n- Alternatives considered: [Options + rationale]\n\n## Risks / Trade-offs\n- [Risk] \u2192 Mitigation\n\n## Migration Plan\n[Steps, rollback]\n\n## Open Questions\n- [...]\n```\n\n## Spec File Format\n\n### Critical: Scenario Formatting\n\n**CORRECT** (use #### headers):\n```markdown\n#### Scenario: User login success\n- **WHEN** valid credentials provided\n- **THEN** return JWT token\n```\n\n**WRONG** (don't use bullets or bold):\n```markdown\n- **Scenario: User login** \u274C\n**Scenario**: User login \u274C\n### Scenario: User login \u274C\n```\n\nEvery requirement MUST have at least one scenario.\n\n### Requirement Wording\n- Use SHALL/MUST for normative requirements (avoid should/may unless intentionally non-normative)\n\n### Delta Operations\n\n- `## ADDED Requirements` - New capabilities\n- `## MODIFIED Requirements` - Changed behavior\n- `## REMOVED Requirements` - Deprecated features\n- `## RENAMED Requirements` - Name changes\n\nHeaders matched with `trim(header)` - whitespace ignored.\n\n#### When to use ADDED vs MODIFIED\n- ADDED: Introduces a new capability or sub-capability that can stand alone as a requirement. Prefer ADDED when the change is orthogonal (e.g., adding \"Slash Command Configuration\") rather than altering the semantics of an existing requirement.\n- MODIFIED: Changes the behavior, scope, or acceptance criteria of an existing requirement. Always paste the full, updated requirement content (header + all scenarios). The archiver will replace the entire requirement with what you provide here; partial deltas will drop previous details.\n- RENAMED: Use when only the name changes. If you also change behavior, use RENAMED (name) plus MODIFIED (content) referencing the new name.\n\nCommon pitfall: Using MODIFIED to add a new concern without including the previous text. This causes loss of detail at archive time. If you aren\u2019t explicitly changing the existing requirement, add a new requirement under ADDED instead.\n\nAuthoring a MODIFIED requirement correctly:\n1) Locate the existing requirement in `openspec/specs/<capability>/spec.md`.\n2) Copy the entire requirement block (from `### Requirement: ...` through its scenarios).\n3) Paste it under `## MODIFIED Requirements` and edit to reflect the new behavior.\n4) Ensure the header text matches exactly (whitespace-insensitive) and keep at least one `#### Scenario:`.\n\nExample for RENAMED:\n```markdown\n## RENAMED Requirements\n- FROM: `### Requirement: Login`\n- TO: `### Requirement: User Authentication`\n```\n\n## Troubleshooting\n\n### Common Errors\n\n**\"Change must have at least one delta\"**\n- Check `changes/[name]/specs/` exists with .md files\n- Verify files have operation prefixes (## ADDED Requirements)\n\n**\"Requirement must have at least one scenario\"**\n- Check scenarios use `#### Scenario:` format (4 hashtags)\n- Don't use bullet points or bold for scenario headers\n\n**Silent scenario parsing failures**\n- Exact format required: `#### Scenario: Name`\n- Debug with: `openspec show [change] --json --deltas-only`\n\n### Validation Tips\n\n```bash\n# Always use strict mode for comprehensive checks\nopenspec validate [change] --strict --no-interactive\n\n# Debug delta parsing\nopenspec show [change] --json | jq '.deltas'\n\n# Check specific requirement\nopenspec show [spec] --json -r 1\n```\n\n## Happy Path Script\n\n```bash\n# 1) Explore current state\nopenspec spec list --long\nopenspec list\n# Optional full-text search:\n# rg -n \"Requirement:|Scenario:\" openspec/specs\n# rg -n \"^#|Requirement:\" openspec/changes\n\n# 2) Choose change id and scaffold\nCHANGE=add-two-factor-auth\nmkdir -p openspec/changes/$CHANGE/{specs/auth}\nprintf \"## Why\\n...\\n\\n## What Changes\\n- ...\\n\\n## Impact\\n- ...\\n\" > openspec/changes/$CHANGE/proposal.md\nprintf \"## 1. Implementation\\n- [ ] 1.1 ...\\n\" > openspec/changes/$CHANGE/tasks.md\n\n# 3) Add deltas (example)\ncat > openspec/changes/$CHANGE/specs/auth/spec.md << 'EOF'\n## ADDED Requirements\n### Requirement: Two-Factor Authentication\nUsers MUST provide a second factor during login.\n\n#### Scenario: OTP required\n- **WHEN** valid credentials are provided\n- **THEN** an OTP challenge is required\nEOF\n\n# 4) Validate\nopenspec validate $CHANGE --strict --no-interactive\n```\n\n## Multi-Capability Example\n\n```\nopenspec/changes/add-2fa-notify/\n\u251C\u2500\u2500 proposal.md\n\u251C\u2500\u2500 tasks.md\n\u2514\u2500\u2500 specs/\n \u251C\u2500\u2500 auth/\n \u2502 \u2514\u2500\u2500 spec.md # ADDED: Two-Factor Authentication\n \u2514\u2500\u2500 notifications/\n \u2514\u2500\u2500 spec.md # ADDED: OTP email notification\n```\n\nauth/spec.md\n```markdown\n## ADDED Requirements\n### Requirement: Two-Factor Authentication\n...\n```\n\nnotifications/spec.md\n```markdown\n## ADDED Requirements\n### Requirement: OTP Email Notification\n...\n```\n\n## Best Practices\n\n### Simplicity First\n- Default to <100 lines of new code\n- Single-file implementations until proven insufficient\n- Avoid frameworks without clear justification\n- Choose boring, proven patterns\n\n### Complexity Triggers\nOnly add complexity with:\n- Performance data showing current solution too slow\n- Concrete scale requirements (>1000 users, >100MB data)\n- Multiple proven use cases requiring abstraction\n\n### Clear References\n- Use `file.ts:42` format for code locations\n- Reference specs as `specs/auth/spec.md`\n- Link related changes and PRs\n\n### Capability Naming\n- Use verb-noun: `user-auth`, `payment-capture`\n- Single purpose per capability\n- 10-minute understandability rule\n- Split if description needs \"AND\"\n\n### Change ID Naming\n- Use kebab-case, short and descriptive: `add-two-factor-auth`\n- Prefer verb-led prefixes: `add-`, `update-`, `remove-`, `refactor-`\n- Ensure uniqueness; if taken, append `-2`, `-3`, etc.\n\n## Tool Selection Guide\n\n| Task | Tool | Why |\n|------|------|-----|\n| Find files by pattern | Glob | Fast pattern matching |\n| Search code content | Grep | Optimized regex search |\n| Read specific files | Read | Direct file access |\n| Explore unknown scope | Task | Multi-step investigation |\n\n## Error Recovery\n\n### Change Conflicts\n1. Run `openspec list` to see active changes\n2. Check for overlapping specs\n3. Coordinate with change owners\n4. Consider combining proposals\n\n### Validation Failures\n1. Run with `--strict` flag\n2. Check JSON output for details\n3. Verify spec file format\n4. Ensure scenarios properly formatted\n\n### Missing Context\n1. Read project.md first\n2. Check related specs\n3. Review recent archives\n4. Ask for clarification\n\n## Quick Reference\n\n### Stage Indicators\n- `changes/` - Proposed, not yet built\n- `specs/` - Built and deployed\n- `archive/` - Completed changes\n\n### File Purposes\n- `proposal.md` - Why and what\n- `tasks.md` - Implementation steps\n- `design.md` - Technical decisions\n- `spec.md` - Requirements and behavior\n\n### CLI Essentials\n```bash\nopenspec list # What's in progress?\nopenspec show [item] # View details\nopenspec validate --strict --no-interactive # Is it correct?\nopenspec archive <change-id> [--yes|-y] # Mark complete (add --yes for automation)\n```\n\nRemember: Specs are truth. Changes are proposals. Keep them in sync.\n";
|
|
2
2
|
//# sourceMappingURL=agents-template.d.ts.map
|
|
@@ -9,7 +9,7 @@ Instructions for AI coding assistants using OpenSpec for spec-driven development
|
|
|
9
9
|
- Pick a unique \`change-id\`: kebab-case, verb-led (\`add-\`, \`update-\`, \`remove-\`, \`refactor-\`)
|
|
10
10
|
- Scaffold: \`proposal.md\`, \`tasks.md\`, \`design.md\` (only if needed), and delta specs per affected capability
|
|
11
11
|
- Write deltas: use \`## ADDED|MODIFIED|REMOVED|RENAMED Requirements\`; include at least one \`#### Scenario:\` per requirement
|
|
12
|
-
- Validate: \`openspec validate [change-id] --strict\` and fix issues
|
|
12
|
+
- Validate: \`openspec validate [change-id] --strict --no-interactive\` and fix issues
|
|
13
13
|
- Request approval: Do not start implementation until proposal is approved
|
|
14
14
|
|
|
15
15
|
## Three-Stage Workflow
|
|
@@ -44,7 +44,7 @@ Skip proposal for:
|
|
|
44
44
|
1. Review \`openspec/project.md\`, \`openspec list\`, and \`openspec list --specs\` to understand current context.
|
|
45
45
|
2. Choose a unique verb-led \`change-id\` and scaffold \`proposal.md\`, \`tasks.md\`, optional \`design.md\`, and spec deltas under \`openspec/changes/<id>/\`.
|
|
46
46
|
3. Draft spec deltas using \`## ADDED|MODIFIED|REMOVED Requirements\` with at least one \`#### Scenario:\` per requirement.
|
|
47
|
-
4. Run \`openspec validate <id> --strict\` and resolve any issues before sharing the proposal.
|
|
47
|
+
4. Run \`openspec validate <id> --strict --no-interactive\` and resolve any issues before sharing the proposal.
|
|
48
48
|
|
|
49
49
|
### Stage 2: Implementing Changes
|
|
50
50
|
Track these steps as TODOs and complete them one by one.
|
|
@@ -61,7 +61,7 @@ After deployment, create separate PR to:
|
|
|
61
61
|
- Move \`changes/[name]/\` → \`changes/archive/YYYY-MM-DD-[name]/\`
|
|
62
62
|
- Update \`specs/\` if capabilities changed
|
|
63
63
|
- Use \`openspec archive <change-id> --skip-specs --yes\` for tooling-only changes (always pass the change ID explicitly)
|
|
64
|
-
- Run \`openspec validate --strict\` to confirm the archived change passes checks
|
|
64
|
+
- Run \`openspec validate --strict --no-interactive\` to confirm the archived change passes checks
|
|
65
65
|
|
|
66
66
|
## Before Any Task
|
|
67
67
|
|
|
@@ -108,7 +108,7 @@ openspec validate # Bulk validation mode
|
|
|
108
108
|
|
|
109
109
|
# Debugging
|
|
110
110
|
openspec show [change] --json --deltas-only
|
|
111
|
-
openspec validate [change] --strict
|
|
111
|
+
openspec validate [change] --strict --no-interactive
|
|
112
112
|
\`\`\`
|
|
113
113
|
|
|
114
114
|
### Command Flags
|
|
@@ -306,7 +306,7 @@ Example for RENAMED:
|
|
|
306
306
|
|
|
307
307
|
\`\`\`bash
|
|
308
308
|
# Always use strict mode for comprehensive checks
|
|
309
|
-
openspec validate [change] --strict
|
|
309
|
+
openspec validate [change] --strict --no-interactive
|
|
310
310
|
|
|
311
311
|
# Debug delta parsing
|
|
312
312
|
openspec show [change] --json | jq '.deltas'
|
|
@@ -343,7 +343,7 @@ Users MUST provide a second factor during login.
|
|
|
343
343
|
EOF
|
|
344
344
|
|
|
345
345
|
# 4) Validate
|
|
346
|
-
openspec validate $CHANGE --strict
|
|
346
|
+
openspec validate $CHANGE --strict --no-interactive
|
|
347
347
|
\`\`\`
|
|
348
348
|
|
|
349
349
|
## Multi-Capability Example
|
|
@@ -449,7 +449,7 @@ Only add complexity with:
|
|
|
449
449
|
\`\`\`bash
|
|
450
450
|
openspec list # What's in progress?
|
|
451
451
|
openspec show [item] # View details
|
|
452
|
-
openspec validate --strict # Is it correct?
|
|
452
|
+
openspec validate --strict --no-interactive # Is it correct?
|
|
453
453
|
openspec archive <change-id> [--yes|-y] # Mark complete (add --yes for automation)
|
|
454
454
|
\`\`\`
|
|
455
455
|
|
|
@@ -79,8 +79,17 @@ export declare function getArchiveChangeSkillTemplate(): SkillTemplate;
|
|
|
79
79
|
* Template for /opsx:sync slash command
|
|
80
80
|
*/
|
|
81
81
|
export declare function getOpsxSyncCommandTemplate(): CommandTemplate;
|
|
82
|
+
/**
|
|
83
|
+
* Template for openspec-verify-change skill
|
|
84
|
+
* For verifying implementation matches change artifacts before archiving
|
|
85
|
+
*/
|
|
86
|
+
export declare function getVerifyChangeSkillTemplate(): SkillTemplate;
|
|
82
87
|
/**
|
|
83
88
|
* Template for /opsx:archive slash command
|
|
84
89
|
*/
|
|
85
90
|
export declare function getOpsxArchiveCommandTemplate(): CommandTemplate;
|
|
91
|
+
/**
|
|
92
|
+
* Template for /opsx:verify slash command
|
|
93
|
+
*/
|
|
94
|
+
export declare function getOpsxVerifyCommandTemplate(): CommandTemplate;
|
|
86
95
|
//# sourceMappingURL=skill-templates.d.ts.map
|
|
@@ -1752,6 +1752,173 @@ Main specs are now updated. The change remains active - archive when implementat
|
|
|
1752
1752
|
- The operation should be idempotent - running twice should give same result`
|
|
1753
1753
|
};
|
|
1754
1754
|
}
|
|
1755
|
+
/**
|
|
1756
|
+
* Template for openspec-verify-change skill
|
|
1757
|
+
* For verifying implementation matches change artifacts before archiving
|
|
1758
|
+
*/
|
|
1759
|
+
export function getVerifyChangeSkillTemplate() {
|
|
1760
|
+
return {
|
|
1761
|
+
name: 'openspec-verify-change',
|
|
1762
|
+
description: 'Verify implementation matches change artifacts. Use when the user wants to validate that implementation is complete, correct, and coherent before archiving.',
|
|
1763
|
+
instructions: `Verify that an implementation matches the change artifacts (specs, tasks, design).
|
|
1764
|
+
|
|
1765
|
+
**Input**: Optionally specify a change name. If omitted, MUST prompt for available changes.
|
|
1766
|
+
|
|
1767
|
+
**Steps**
|
|
1768
|
+
|
|
1769
|
+
1. **If no change name provided, prompt for selection**
|
|
1770
|
+
|
|
1771
|
+
Run \`openspec list --json\` to get available changes. Use the **AskUserQuestion tool** to let the user select.
|
|
1772
|
+
|
|
1773
|
+
Show changes that have implementation tasks (tasks artifact exists).
|
|
1774
|
+
Include the schema used for each change if available.
|
|
1775
|
+
Mark changes with incomplete tasks as "(In Progress)".
|
|
1776
|
+
|
|
1777
|
+
**IMPORTANT**: Do NOT guess or auto-select a change. Always let the user choose.
|
|
1778
|
+
|
|
1779
|
+
2. **Check status to understand the schema**
|
|
1780
|
+
\`\`\`bash
|
|
1781
|
+
openspec status --change "<name>" --json
|
|
1782
|
+
\`\`\`
|
|
1783
|
+
Parse the JSON to understand:
|
|
1784
|
+
- \`schemaName\`: The workflow being used (e.g., "spec-driven", "tdd")
|
|
1785
|
+
- Which artifacts exist for this change
|
|
1786
|
+
|
|
1787
|
+
3. **Get the change directory and load artifacts**
|
|
1788
|
+
|
|
1789
|
+
\`\`\`bash
|
|
1790
|
+
openspec instructions apply --change "<name>" --json
|
|
1791
|
+
\`\`\`
|
|
1792
|
+
|
|
1793
|
+
This returns the change directory and context files. Read all available artifacts from \`contextFiles\`.
|
|
1794
|
+
|
|
1795
|
+
4. **Initialize verification report structure**
|
|
1796
|
+
|
|
1797
|
+
Create a report structure with three dimensions:
|
|
1798
|
+
- **Completeness**: Track tasks and spec coverage
|
|
1799
|
+
- **Correctness**: Track requirement implementation and scenario coverage
|
|
1800
|
+
- **Coherence**: Track design adherence and pattern consistency
|
|
1801
|
+
|
|
1802
|
+
Each dimension can have CRITICAL, WARNING, or SUGGESTION issues.
|
|
1803
|
+
|
|
1804
|
+
5. **Verify Completeness**
|
|
1805
|
+
|
|
1806
|
+
**Task Completion**:
|
|
1807
|
+
- If tasks.md exists in contextFiles, read it
|
|
1808
|
+
- Parse checkboxes: \`- [ ]\` (incomplete) vs \`- [x]\` (complete)
|
|
1809
|
+
- Count complete vs total tasks
|
|
1810
|
+
- If incomplete tasks exist:
|
|
1811
|
+
- Add CRITICAL issue for each incomplete task
|
|
1812
|
+
- Recommendation: "Complete task: <description>" or "Mark as done if already implemented"
|
|
1813
|
+
|
|
1814
|
+
**Spec Coverage**:
|
|
1815
|
+
- If delta specs exist in \`openspec/changes/<name>/specs/\`:
|
|
1816
|
+
- Extract all requirements (marked with "### Requirement:")
|
|
1817
|
+
- For each requirement:
|
|
1818
|
+
- Search codebase for keywords related to the requirement
|
|
1819
|
+
- Assess if implementation likely exists
|
|
1820
|
+
- If requirements appear unimplemented:
|
|
1821
|
+
- Add CRITICAL issue: "Requirement not found: <requirement name>"
|
|
1822
|
+
- Recommendation: "Implement requirement X: <description>"
|
|
1823
|
+
|
|
1824
|
+
6. **Verify Correctness**
|
|
1825
|
+
|
|
1826
|
+
**Requirement Implementation Mapping**:
|
|
1827
|
+
- For each requirement from delta specs:
|
|
1828
|
+
- Search codebase for implementation evidence
|
|
1829
|
+
- If found, note file paths and line ranges
|
|
1830
|
+
- Assess if implementation matches requirement intent
|
|
1831
|
+
- If divergence detected:
|
|
1832
|
+
- Add WARNING: "Implementation may diverge from spec: <details>"
|
|
1833
|
+
- Recommendation: "Review <file>:<lines> against requirement X"
|
|
1834
|
+
|
|
1835
|
+
**Scenario Coverage**:
|
|
1836
|
+
- For each scenario in delta specs (marked with "#### Scenario:"):
|
|
1837
|
+
- Check if conditions are handled in code
|
|
1838
|
+
- Check if tests exist covering the scenario
|
|
1839
|
+
- If scenario appears uncovered:
|
|
1840
|
+
- Add WARNING: "Scenario not covered: <scenario name>"
|
|
1841
|
+
- Recommendation: "Add test or implementation for scenario: <description>"
|
|
1842
|
+
|
|
1843
|
+
7. **Verify Coherence**
|
|
1844
|
+
|
|
1845
|
+
**Design Adherence**:
|
|
1846
|
+
- If design.md exists in contextFiles:
|
|
1847
|
+
- Extract key decisions (look for sections like "Decision:", "Approach:", "Architecture:")
|
|
1848
|
+
- Verify implementation follows those decisions
|
|
1849
|
+
- If contradiction detected:
|
|
1850
|
+
- Add WARNING: "Design decision not followed: <decision>"
|
|
1851
|
+
- Recommendation: "Update implementation or revise design.md to match reality"
|
|
1852
|
+
- If no design.md: Skip design adherence check, note "No design.md to verify against"
|
|
1853
|
+
|
|
1854
|
+
**Code Pattern Consistency**:
|
|
1855
|
+
- Review new code for consistency with project patterns
|
|
1856
|
+
- Check file naming, directory structure, coding style
|
|
1857
|
+
- If significant deviations found:
|
|
1858
|
+
- Add SUGGESTION: "Code pattern deviation: <details>"
|
|
1859
|
+
- Recommendation: "Consider following project pattern: <example>"
|
|
1860
|
+
|
|
1861
|
+
8. **Generate Verification Report**
|
|
1862
|
+
|
|
1863
|
+
**Summary Scorecard**:
|
|
1864
|
+
\`\`\`
|
|
1865
|
+
## Verification Report: <change-name>
|
|
1866
|
+
|
|
1867
|
+
### Summary
|
|
1868
|
+
| Dimension | Status |
|
|
1869
|
+
|--------------|------------------|
|
|
1870
|
+
| Completeness | X/Y tasks, N reqs|
|
|
1871
|
+
| Correctness | M/N reqs covered |
|
|
1872
|
+
| Coherence | Followed/Issues |
|
|
1873
|
+
\`\`\`
|
|
1874
|
+
|
|
1875
|
+
**Issues by Priority**:
|
|
1876
|
+
|
|
1877
|
+
1. **CRITICAL** (Must fix before archive):
|
|
1878
|
+
- Incomplete tasks
|
|
1879
|
+
- Missing requirement implementations
|
|
1880
|
+
- Each with specific, actionable recommendation
|
|
1881
|
+
|
|
1882
|
+
2. **WARNING** (Should fix):
|
|
1883
|
+
- Spec/design divergences
|
|
1884
|
+
- Missing scenario coverage
|
|
1885
|
+
- Each with specific recommendation
|
|
1886
|
+
|
|
1887
|
+
3. **SUGGESTION** (Nice to fix):
|
|
1888
|
+
- Pattern inconsistencies
|
|
1889
|
+
- Minor improvements
|
|
1890
|
+
- Each with specific recommendation
|
|
1891
|
+
|
|
1892
|
+
**Final Assessment**:
|
|
1893
|
+
- If CRITICAL issues: "X critical issue(s) found. Fix before archiving."
|
|
1894
|
+
- If only warnings: "No critical issues. Y warning(s) to consider. Ready for archive (with noted improvements)."
|
|
1895
|
+
- If all clear: "All checks passed. Ready for archive."
|
|
1896
|
+
|
|
1897
|
+
**Verification Heuristics**
|
|
1898
|
+
|
|
1899
|
+
- **Completeness**: Focus on objective checklist items (checkboxes, requirements list)
|
|
1900
|
+
- **Correctness**: Use keyword search, file path analysis, reasonable inference - don't require perfect certainty
|
|
1901
|
+
- **Coherence**: Look for glaring inconsistencies, don't nitpick style
|
|
1902
|
+
- **False Positives**: When uncertain, prefer SUGGESTION over WARNING, WARNING over CRITICAL
|
|
1903
|
+
- **Actionability**: Every issue must have a specific recommendation with file/line references where applicable
|
|
1904
|
+
|
|
1905
|
+
**Graceful Degradation**
|
|
1906
|
+
|
|
1907
|
+
- If only tasks.md exists: verify task completion only, skip spec/design checks
|
|
1908
|
+
- If tasks + specs exist: verify completeness and correctness, skip design
|
|
1909
|
+
- If full artifacts: verify all three dimensions
|
|
1910
|
+
- Always note which checks were skipped and why
|
|
1911
|
+
|
|
1912
|
+
**Output Format**
|
|
1913
|
+
|
|
1914
|
+
Use clear markdown with:
|
|
1915
|
+
- Table for summary scorecard
|
|
1916
|
+
- Grouped lists for issues (CRITICAL/WARNING/SUGGESTION)
|
|
1917
|
+
- Code references in format: \`file.ts:123\`
|
|
1918
|
+
- Specific, actionable recommendations
|
|
1919
|
+
- No vague suggestions like "consider reviewing"`
|
|
1920
|
+
};
|
|
1921
|
+
}
|
|
1755
1922
|
/**
|
|
1756
1923
|
* Template for /opsx:archive slash command
|
|
1757
1924
|
*/
|
|
@@ -1931,4 +2098,172 @@ Target archive directory already exists.
|
|
|
1931
2098
|
- If sync is requested, use /opsx:sync approach (agent-driven)`
|
|
1932
2099
|
};
|
|
1933
2100
|
}
|
|
2101
|
+
/**
|
|
2102
|
+
* Template for /opsx:verify slash command
|
|
2103
|
+
*/
|
|
2104
|
+
export function getOpsxVerifyCommandTemplate() {
|
|
2105
|
+
return {
|
|
2106
|
+
name: 'OPSX: Verify',
|
|
2107
|
+
description: 'Verify implementation matches change artifacts before archiving',
|
|
2108
|
+
category: 'Workflow',
|
|
2109
|
+
tags: ['workflow', 'verify', 'experimental'],
|
|
2110
|
+
content: `Verify that an implementation matches the change artifacts (specs, tasks, design).
|
|
2111
|
+
|
|
2112
|
+
**Input**: Optionally specify \`--change <name>\` after \`/opsx:verify\`. If omitted, MUST prompt for available changes.
|
|
2113
|
+
|
|
2114
|
+
**Steps**
|
|
2115
|
+
|
|
2116
|
+
1. **If no change name provided, prompt for selection**
|
|
2117
|
+
|
|
2118
|
+
Run \`openspec list --json\` to get available changes. Use the **AskUserQuestion tool** to let the user select.
|
|
2119
|
+
|
|
2120
|
+
Show changes that have implementation tasks (tasks artifact exists).
|
|
2121
|
+
Include the schema used for each change if available.
|
|
2122
|
+
Mark changes with incomplete tasks as "(In Progress)".
|
|
2123
|
+
|
|
2124
|
+
**IMPORTANT**: Do NOT guess or auto-select a change. Always let the user choose.
|
|
2125
|
+
|
|
2126
|
+
2. **Check status to understand the schema**
|
|
2127
|
+
\`\`\`bash
|
|
2128
|
+
openspec status --change "<name>" --json
|
|
2129
|
+
\`\`\`
|
|
2130
|
+
Parse the JSON to understand:
|
|
2131
|
+
- \`schemaName\`: The workflow being used (e.g., "spec-driven", "tdd")
|
|
2132
|
+
- Which artifacts exist for this change
|
|
2133
|
+
|
|
2134
|
+
3. **Get the change directory and load artifacts**
|
|
2135
|
+
|
|
2136
|
+
\`\`\`bash
|
|
2137
|
+
openspec instructions apply --change "<name>" --json
|
|
2138
|
+
\`\`\`
|
|
2139
|
+
|
|
2140
|
+
This returns the change directory and context files. Read all available artifacts from \`contextFiles\`.
|
|
2141
|
+
|
|
2142
|
+
4. **Initialize verification report structure**
|
|
2143
|
+
|
|
2144
|
+
Create a report structure with three dimensions:
|
|
2145
|
+
- **Completeness**: Track tasks and spec coverage
|
|
2146
|
+
- **Correctness**: Track requirement implementation and scenario coverage
|
|
2147
|
+
- **Coherence**: Track design adherence and pattern consistency
|
|
2148
|
+
|
|
2149
|
+
Each dimension can have CRITICAL, WARNING, or SUGGESTION issues.
|
|
2150
|
+
|
|
2151
|
+
5. **Verify Completeness**
|
|
2152
|
+
|
|
2153
|
+
**Task Completion**:
|
|
2154
|
+
- If tasks.md exists in contextFiles, read it
|
|
2155
|
+
- Parse checkboxes: \`- [ ]\` (incomplete) vs \`- [x]\` (complete)
|
|
2156
|
+
- Count complete vs total tasks
|
|
2157
|
+
- If incomplete tasks exist:
|
|
2158
|
+
- Add CRITICAL issue for each incomplete task
|
|
2159
|
+
- Recommendation: "Complete task: <description>" or "Mark as done if already implemented"
|
|
2160
|
+
|
|
2161
|
+
**Spec Coverage**:
|
|
2162
|
+
- If delta specs exist in \`openspec/changes/<name>/specs/\`:
|
|
2163
|
+
- Extract all requirements (marked with "### Requirement:")
|
|
2164
|
+
- For each requirement:
|
|
2165
|
+
- Search codebase for keywords related to the requirement
|
|
2166
|
+
- Assess if implementation likely exists
|
|
2167
|
+
- If requirements appear unimplemented:
|
|
2168
|
+
- Add CRITICAL issue: "Requirement not found: <requirement name>"
|
|
2169
|
+
- Recommendation: "Implement requirement X: <description>"
|
|
2170
|
+
|
|
2171
|
+
6. **Verify Correctness**
|
|
2172
|
+
|
|
2173
|
+
**Requirement Implementation Mapping**:
|
|
2174
|
+
- For each requirement from delta specs:
|
|
2175
|
+
- Search codebase for implementation evidence
|
|
2176
|
+
- If found, note file paths and line ranges
|
|
2177
|
+
- Assess if implementation matches requirement intent
|
|
2178
|
+
- If divergence detected:
|
|
2179
|
+
- Add WARNING: "Implementation may diverge from spec: <details>"
|
|
2180
|
+
- Recommendation: "Review <file>:<lines> against requirement X"
|
|
2181
|
+
|
|
2182
|
+
**Scenario Coverage**:
|
|
2183
|
+
- For each scenario in delta specs (marked with "#### Scenario:"):
|
|
2184
|
+
- Check if conditions are handled in code
|
|
2185
|
+
- Check if tests exist covering the scenario
|
|
2186
|
+
- If scenario appears uncovered:
|
|
2187
|
+
- Add WARNING: "Scenario not covered: <scenario name>"
|
|
2188
|
+
- Recommendation: "Add test or implementation for scenario: <description>"
|
|
2189
|
+
|
|
2190
|
+
7. **Verify Coherence**
|
|
2191
|
+
|
|
2192
|
+
**Design Adherence**:
|
|
2193
|
+
- If design.md exists in contextFiles:
|
|
2194
|
+
- Extract key decisions (look for sections like "Decision:", "Approach:", "Architecture:")
|
|
2195
|
+
- Verify implementation follows those decisions
|
|
2196
|
+
- If contradiction detected:
|
|
2197
|
+
- Add WARNING: "Design decision not followed: <decision>"
|
|
2198
|
+
- Recommendation: "Update implementation or revise design.md to match reality"
|
|
2199
|
+
- If no design.md: Skip design adherence check, note "No design.md to verify against"
|
|
2200
|
+
|
|
2201
|
+
**Code Pattern Consistency**:
|
|
2202
|
+
- Review new code for consistency with project patterns
|
|
2203
|
+
- Check file naming, directory structure, coding style
|
|
2204
|
+
- If significant deviations found:
|
|
2205
|
+
- Add SUGGESTION: "Code pattern deviation: <details>"
|
|
2206
|
+
- Recommendation: "Consider following project pattern: <example>"
|
|
2207
|
+
|
|
2208
|
+
8. **Generate Verification Report**
|
|
2209
|
+
|
|
2210
|
+
**Summary Scorecard**:
|
|
2211
|
+
\`\`\`
|
|
2212
|
+
## Verification Report: <change-name>
|
|
2213
|
+
|
|
2214
|
+
### Summary
|
|
2215
|
+
| Dimension | Status |
|
|
2216
|
+
|--------------|------------------|
|
|
2217
|
+
| Completeness | X/Y tasks, N reqs|
|
|
2218
|
+
| Correctness | M/N reqs covered |
|
|
2219
|
+
| Coherence | Followed/Issues |
|
|
2220
|
+
\`\`\`
|
|
2221
|
+
|
|
2222
|
+
**Issues by Priority**:
|
|
2223
|
+
|
|
2224
|
+
1. **CRITICAL** (Must fix before archive):
|
|
2225
|
+
- Incomplete tasks
|
|
2226
|
+
- Missing requirement implementations
|
|
2227
|
+
- Each with specific, actionable recommendation
|
|
2228
|
+
|
|
2229
|
+
2. **WARNING** (Should fix):
|
|
2230
|
+
- Spec/design divergences
|
|
2231
|
+
- Missing scenario coverage
|
|
2232
|
+
- Each with specific recommendation
|
|
2233
|
+
|
|
2234
|
+
3. **SUGGESTION** (Nice to fix):
|
|
2235
|
+
- Pattern inconsistencies
|
|
2236
|
+
- Minor improvements
|
|
2237
|
+
- Each with specific recommendation
|
|
2238
|
+
|
|
2239
|
+
**Final Assessment**:
|
|
2240
|
+
- If CRITICAL issues: "X critical issue(s) found. Fix before archiving."
|
|
2241
|
+
- If only warnings: "No critical issues. Y warning(s) to consider. Ready for archive (with noted improvements)."
|
|
2242
|
+
- If all clear: "All checks passed. Ready for archive."
|
|
2243
|
+
|
|
2244
|
+
**Verification Heuristics**
|
|
2245
|
+
|
|
2246
|
+
- **Completeness**: Focus on objective checklist items (checkboxes, requirements list)
|
|
2247
|
+
- **Correctness**: Use keyword search, file path analysis, reasonable inference - don't require perfect certainty
|
|
2248
|
+
- **Coherence**: Look for glaring inconsistencies, don't nitpick style
|
|
2249
|
+
- **False Positives**: When uncertain, prefer SUGGESTION over WARNING, WARNING over CRITICAL
|
|
2250
|
+
- **Actionability**: Every issue must have a specific recommendation with file/line references where applicable
|
|
2251
|
+
|
|
2252
|
+
**Graceful Degradation**
|
|
2253
|
+
|
|
2254
|
+
- If only tasks.md exists: verify task completion only, skip spec/design checks
|
|
2255
|
+
- If tasks + specs exist: verify completeness and correctness, skip design
|
|
2256
|
+
- If full artifacts: verify all three dimensions
|
|
2257
|
+
- Always note which checks were skipped and why
|
|
2258
|
+
|
|
2259
|
+
**Output Format**
|
|
2260
|
+
|
|
2261
|
+
Use clear markdown with:
|
|
2262
|
+
- Table for summary scorecard
|
|
2263
|
+
- Grouped lists for issues (CRITICAL/WARNING/SUGGESTION)
|
|
2264
|
+
- Code references in format: \`file.ts:123\`
|
|
2265
|
+
- Specific, actionable recommendations
|
|
2266
|
+
- No vague suggestions like "consider reviewing"`
|
|
2267
|
+
};
|
|
2268
|
+
}
|
|
1934
2269
|
//# sourceMappingURL=skill-templates.js.map
|
|
@@ -11,7 +11,7 @@ const proposalSteps = `**Steps**
|
|
|
11
11
|
4. Capture architectural reasoning in \`design.md\` when the solution spans multiple systems, introduces new patterns, or demands trade-off discussion before committing to specs.
|
|
12
12
|
5. Draft spec deltas in \`changes/<id>/specs/<capability>/spec.md\` (one folder per capability) using \`## ADDED|MODIFIED|REMOVED Requirements\` with at least one \`#### Scenario:\` per requirement and cross-reference related capabilities when relevant.
|
|
13
13
|
6. Draft \`tasks.md\` as an ordered list of small, verifiable work items that deliver user-visible progress, include validation (tests, tooling), and highlight dependencies or parallelizable work.
|
|
14
|
-
7. Validate with \`openspec validate <id> --strict\` and resolve every issue before sharing the proposal.`;
|
|
14
|
+
7. Validate with \`openspec validate <id> --strict --no-interactive\` and resolve every issue before sharing the proposal.`;
|
|
15
15
|
const proposalReferences = `**Reference**
|
|
16
16
|
- Use \`openspec show <id> --json --deltas-only\` or \`openspec show <spec> --type spec\` to inspect details when validation fails.
|
|
17
17
|
- Search existing requirements with \`rg -n "Requirement:|Scenario:" openspec/specs\` before writing new ones.
|
|
@@ -34,7 +34,7 @@ const archiveSteps = `**Steps**
|
|
|
34
34
|
2. Validate the change ID by running \`openspec list\` (or \`openspec show <id>\`) and stop if the change is missing, already archived, or otherwise not ready to archive.
|
|
35
35
|
3. Run \`openspec archive <id> --yes\` so the CLI moves the change and applies spec updates without prompts (use \`--skip-specs\` only for tooling-only work).
|
|
36
36
|
4. Review the command output to confirm the target specs were updated and the change landed in \`changes/archive/\`.
|
|
37
|
-
5. Validate with \`openspec validate --strict\` and inspect with \`openspec show <id>\` if anything looks off.`;
|
|
37
|
+
5. Validate with \`openspec validate --strict --no-interactive\` and inspect with \`openspec show <id>\` if anything looks off.`;
|
|
38
38
|
const archiveReferences = `**Reference**
|
|
39
39
|
- Use \`openspec list\` to confirm change IDs before archiving.
|
|
40
40
|
- Inspect refreshed specs with \`openspec list --specs\` and address any validation issues before handing off.`;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fission-ai/openspec",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.20.0",
|
|
4
4
|
"description": "AI-native system for spec-driven development",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"openspec",
|
|
@@ -42,6 +42,7 @@
|
|
|
42
42
|
"node": ">=20.19.0"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
|
+
"@changesets/changelog-github": "^0.5.2",
|
|
45
46
|
"@changesets/cli": "^2.27.7",
|
|
46
47
|
"@types/node": "^24.2.0",
|
|
47
48
|
"@vitest/ui": "^3.2.4",
|
|
@@ -75,7 +76,6 @@
|
|
|
75
76
|
"check:pack-version": "node scripts/pack-version-check.mjs",
|
|
76
77
|
"release": "pnpm run release:ci",
|
|
77
78
|
"release:ci": "pnpm run check:pack-version && pnpm exec changeset publish",
|
|
78
|
-
"release:local": "pnpm exec changeset version && pnpm run check:pack-version && pnpm exec changeset publish",
|
|
79
79
|
"changeset": "changeset"
|
|
80
80
|
}
|
|
81
81
|
}
|