@fission-ai/openspec 0.17.2 → 0.18.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.
Files changed (52) hide show
  1. package/dist/cli/index.js +7 -1
  2. package/dist/commands/artifact-workflow.d.ts +17 -0
  3. package/dist/commands/artifact-workflow.js +818 -0
  4. package/dist/core/archive.d.ts +0 -5
  5. package/dist/core/archive.js +4 -257
  6. package/dist/core/artifact-graph/graph.d.ts +56 -0
  7. package/dist/core/artifact-graph/graph.js +141 -0
  8. package/dist/core/artifact-graph/index.d.ts +7 -0
  9. package/dist/core/artifact-graph/index.js +13 -0
  10. package/dist/core/artifact-graph/instruction-loader.d.ts +130 -0
  11. package/dist/core/artifact-graph/instruction-loader.js +173 -0
  12. package/dist/core/artifact-graph/resolver.d.ts +61 -0
  13. package/dist/core/artifact-graph/resolver.js +187 -0
  14. package/dist/core/artifact-graph/schema.d.ts +13 -0
  15. package/dist/core/artifact-graph/schema.js +108 -0
  16. package/dist/core/artifact-graph/state.d.ts +12 -0
  17. package/dist/core/artifact-graph/state.js +54 -0
  18. package/dist/core/artifact-graph/types.d.ts +45 -0
  19. package/dist/core/artifact-graph/types.js +43 -0
  20. package/dist/core/converters/json-converter.js +2 -1
  21. package/dist/core/global-config.d.ts +10 -0
  22. package/dist/core/global-config.js +28 -0
  23. package/dist/core/index.d.ts +1 -1
  24. package/dist/core/index.js +1 -1
  25. package/dist/core/list.d.ts +6 -1
  26. package/dist/core/list.js +88 -6
  27. package/dist/core/specs-apply.d.ts +73 -0
  28. package/dist/core/specs-apply.js +384 -0
  29. package/dist/core/templates/skill-templates.d.ts +76 -0
  30. package/dist/core/templates/skill-templates.js +1472 -0
  31. package/dist/core/update.js +1 -1
  32. package/dist/core/validation/validator.js +2 -1
  33. package/dist/core/view.js +28 -8
  34. package/dist/utils/change-metadata.d.ts +47 -0
  35. package/dist/utils/change-metadata.js +130 -0
  36. package/dist/utils/change-utils.d.ts +51 -0
  37. package/dist/utils/change-utils.js +100 -0
  38. package/dist/utils/file-system.d.ts +5 -0
  39. package/dist/utils/file-system.js +7 -0
  40. package/dist/utils/index.d.ts +3 -1
  41. package/dist/utils/index.js +4 -1
  42. package/package.json +4 -1
  43. package/schemas/spec-driven/schema.yaml +148 -0
  44. package/schemas/spec-driven/templates/design.md +19 -0
  45. package/schemas/spec-driven/templates/proposal.md +23 -0
  46. package/schemas/spec-driven/templates/spec.md +8 -0
  47. package/schemas/spec-driven/templates/tasks.md +9 -0
  48. package/schemas/tdd/schema.yaml +213 -0
  49. package/schemas/tdd/templates/docs.md +15 -0
  50. package/schemas/tdd/templates/implementation.md +11 -0
  51. package/schemas/tdd/templates/spec.md +11 -0
  52. package/schemas/tdd/templates/test.md +11 -0
@@ -0,0 +1,19 @@
1
+ ## Context
2
+
3
+ <!-- Background and current state -->
4
+
5
+ ## Goals / Non-Goals
6
+
7
+ **Goals:**
8
+ <!-- What this design aims to achieve -->
9
+
10
+ **Non-Goals:**
11
+ <!-- What is explicitly out of scope -->
12
+
13
+ ## Decisions
14
+
15
+ <!-- Key design decisions and rationale -->
16
+
17
+ ## Risks / Trade-offs
18
+
19
+ <!-- Known risks and trade-offs -->
@@ -0,0 +1,23 @@
1
+ ## Why
2
+
3
+ <!-- Explain the motivation for this change. What problem does this solve? Why now? -->
4
+
5
+ ## What Changes
6
+
7
+ <!-- Describe what will change. Be specific about new capabilities, modifications, or removals. -->
8
+
9
+ ## Capabilities
10
+
11
+ ### New Capabilities
12
+ <!-- Capabilities being introduced. Replace <name> with kebab-case identifier (e.g., user-auth, data-export, api-rate-limiting). Each creates specs/<name>/spec.md -->
13
+ - `<name>`: <brief description of what this capability covers>
14
+
15
+ ### Modified Capabilities
16
+ <!-- Existing capabilities whose REQUIREMENTS are changing (not just implementation).
17
+ Only list here if spec-level behavior changes. Each needs a delta spec file.
18
+ Use existing spec names from openspec/specs/. Leave empty if no requirement changes. -->
19
+ - `<existing-name>`: <what requirement is changing>
20
+
21
+ ## Impact
22
+
23
+ <!-- Affected code, APIs, dependencies, systems -->
@@ -0,0 +1,8 @@
1
+ ## ADDED Requirements
2
+
3
+ ### Requirement: <!-- requirement name -->
4
+ <!-- requirement text -->
5
+
6
+ #### Scenario: <!-- scenario name -->
7
+ - **WHEN** <!-- condition -->
8
+ - **THEN** <!-- expected outcome -->
@@ -0,0 +1,9 @@
1
+ ## 1. <!-- Task Group Name -->
2
+
3
+ - [ ] 1.1 <!-- Task description -->
4
+ - [ ] 1.2 <!-- Task description -->
5
+
6
+ ## 2. <!-- Task Group Name -->
7
+
8
+ - [ ] 2.1 <!-- Task description -->
9
+ - [ ] 2.2 <!-- Task description -->
@@ -0,0 +1,213 @@
1
+ name: tdd
2
+ version: 1
3
+ description: Test-driven development workflow - tests → implementation → docs
4
+ artifacts:
5
+ - id: spec
6
+ generates: spec.md
7
+ description: Feature specification defining requirements
8
+ template: spec.md
9
+ instruction: |
10
+ Create the feature specification that defines WHAT to build.
11
+
12
+ Sections:
13
+ - **Feature**: Name and high-level description of the feature's purpose and user value
14
+ - **Requirements**: List of specific requirements. Use SHALL/MUST for normative language.
15
+ - **Acceptance Criteria**: Testable criteria in WHEN/THEN format
16
+
17
+ Format requirements:
18
+ - Each requirement should be specific and testable
19
+ - Use `#### Scenario: <name>` with WHEN/THEN format for acceptance criteria
20
+ - Define edge cases and error scenarios explicitly
21
+ - Every requirement MUST have at least one scenario
22
+
23
+ Example:
24
+ ```
25
+ ## Feature: User Authentication
26
+
27
+ Users can securely log into the application.
28
+
29
+ ## Requirements
30
+
31
+ ### Requirement: Password validation
32
+ The system SHALL validate passwords meet minimum security requirements.
33
+
34
+ #### Scenario: Valid password accepted
35
+ - **WHEN** password has 8+ chars, uppercase, lowercase, and number
36
+ - **THEN** password is accepted
37
+
38
+ #### Scenario: Weak password rejected
39
+ - **WHEN** password is less than 8 characters
40
+ - **THEN** system displays "Password too short" error
41
+ ```
42
+
43
+ This spec drives test creation - each scenario becomes a test case.
44
+ requires: []
45
+
46
+ - id: tests
47
+ generates: "tests/*.test.ts"
48
+ description: Test files written before implementation
49
+ template: test.md
50
+ instruction: |
51
+ Write tests BEFORE implementation (TDD red phase).
52
+
53
+ File naming:
54
+ - Create test files as `tests/<feature>.test.ts`
55
+ - One test file per feature/capability
56
+ - Use descriptive names matching the spec
57
+
58
+ Test structure:
59
+ - Use Given/When/Then format matching spec scenarios
60
+ - Group related tests with `describe()` blocks
61
+ - Each scenario from spec becomes at least one `it()` test
62
+
63
+ Coverage requirements:
64
+ - Cover each requirement from the spec
65
+ - Include happy path (success cases)
66
+ - Include edge cases (boundary conditions)
67
+ - Include error scenarios (invalid input, failures)
68
+ - Tests should fail initially (no implementation yet)
69
+
70
+ Example:
71
+ ```typescript
72
+ describe('Password validation', () => {
73
+ it('accepts valid password with all requirements', () => {
74
+ // GIVEN a password meeting all requirements
75
+ const password = 'SecurePass1';
76
+ // WHEN validating
77
+ const result = validatePassword(password);
78
+ // THEN it should be accepted
79
+ expect(result.valid).toBe(true);
80
+ });
81
+
82
+ it('rejects password shorter than 8 characters', () => {
83
+ // GIVEN a short password
84
+ const password = 'Short1';
85
+ // WHEN validating
86
+ const result = validatePassword(password);
87
+ // THEN it should be rejected with message
88
+ expect(result.valid).toBe(false);
89
+ expect(result.error).toBe('Password too short');
90
+ });
91
+ });
92
+ ```
93
+
94
+ Follow the spec requirements exactly - tests verify the spec.
95
+ requires:
96
+ - spec
97
+
98
+ - id: implementation
99
+ generates: "src/*.ts"
100
+ description: Implementation code to pass the tests
101
+ template: implementation.md
102
+ instruction: |
103
+ Implement the feature to make tests pass (TDD green phase).
104
+
105
+ TDD workflow:
106
+ 1. Run tests - confirm they fail (red)
107
+ 2. Write minimal code to pass ONE test
108
+ 3. Run tests - confirm that test passes (green)
109
+ 4. Refactor if needed while keeping tests green
110
+ 5. Repeat for next failing test
111
+
112
+ Implementation guidelines:
113
+ - Write minimal code to pass each test - no more, no less
114
+ - Run tests frequently to verify progress
115
+ - Keep functions small and focused
116
+ - Use clear, descriptive names
117
+
118
+ Code organization:
119
+ - Create source files in `src/<feature>.ts`
120
+ - Export public API clearly
121
+ - Keep implementation details private
122
+ - Add JSDoc comments for public functions
123
+
124
+ Example structure:
125
+ ```typescript
126
+ /**
127
+ * Validates a password meets security requirements.
128
+ * @param password - The password to validate
129
+ * @returns Validation result with valid flag and optional error
130
+ */
131
+ export function validatePassword(password: string): ValidationResult {
132
+ if (password.length < 8) {
133
+ return { valid: false, error: 'Password too short' };
134
+ }
135
+ // ... additional checks
136
+ return { valid: true };
137
+ }
138
+ ```
139
+
140
+ Don't over-engineer - implement only what tests require.
141
+ requires:
142
+ - tests
143
+
144
+ - id: docs
145
+ generates: "docs/*.md"
146
+ description: Documentation for the implemented feature
147
+ template: docs.md
148
+ instruction: |
149
+ Document the implemented feature.
150
+
151
+ Sections:
152
+ - **Overview**: What the feature does and why it exists (1-2 paragraphs)
153
+ - **Getting Started**: Quick start guide to use the feature immediately
154
+ - **Examples**: Code examples showing common use cases
155
+ - **Reference**: Detailed API documentation, configuration options
156
+
157
+ Guidelines:
158
+ - Write for the user, not the developer
159
+ - Start with the most common use case
160
+ - Include copy-pasteable code examples
161
+ - Document all configuration options with defaults
162
+ - Note any limitations, edge cases, or gotchas
163
+ - Link to related features or specs
164
+
165
+ Example structure:
166
+ ```markdown
167
+ ## Overview
168
+
169
+ Password validation ensures user passwords meet security requirements
170
+ before account creation or password changes.
171
+
172
+ ## Getting Started
173
+
174
+ Import and use the validation function:
175
+
176
+ ```typescript
177
+ import { validatePassword } from './password';
178
+
179
+ const result = validatePassword('MySecurePass1');
180
+ if (!result.valid) {
181
+ console.error(result.error);
182
+ }
183
+ ```
184
+
185
+ ## Examples
186
+
187
+ ### Basic validation
188
+ ...
189
+
190
+ ### Custom error handling
191
+ ...
192
+
193
+ ## Reference
194
+
195
+ ### validatePassword(password)
196
+
197
+ | Parameter | Type | Description |
198
+ |-----------|------|-------------|
199
+ | password | string | The password to validate |
200
+
201
+ **Returns**: `{ valid: boolean, error?: string }`
202
+ ```
203
+
204
+ Reference the spec for requirements, implementation for details.
205
+ requires:
206
+ - implementation
207
+
208
+ apply:
209
+ requires: [tests]
210
+ tracks: null
211
+ instruction: |
212
+ Run tests to see failures. Implement minimal code to pass each test.
213
+ Refactor while keeping tests green.
@@ -0,0 +1,15 @@
1
+ ## Overview
2
+
3
+ <!-- Feature overview -->
4
+
5
+ ## Getting Started
6
+
7
+ <!-- Quick start guide -->
8
+
9
+ ## Examples
10
+
11
+ <!-- Code examples -->
12
+
13
+ ## Reference
14
+
15
+ <!-- API reference or additional details -->
@@ -0,0 +1,11 @@
1
+ ## Implementation Notes
2
+
3
+ <!-- Technical implementation details -->
4
+
5
+ ## API
6
+
7
+ <!-- Public API documentation -->
8
+
9
+ ## Usage
10
+
11
+ <!-- Usage examples -->
@@ -0,0 +1,11 @@
1
+ ## Feature: <!-- feature name -->
2
+
3
+ <!-- Feature description -->
4
+
5
+ ## Requirements
6
+
7
+ <!-- List of requirements -->
8
+
9
+ ## Acceptance Criteria
10
+
11
+ <!-- List of acceptance criteria -->
@@ -0,0 +1,11 @@
1
+ ## Test Plan
2
+
3
+ <!-- Describe the testing strategy -->
4
+
5
+ ## Test Cases
6
+
7
+ ### <!-- Test case name -->
8
+
9
+ - **Given:** <!-- preconditions -->
10
+ - **When:** <!-- action -->
11
+ - **Then:** <!-- expected result -->