@haposoft/cafekit 0.16.0-rc.3 → 0.16.0-rc.4
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/bin/__tests__/codex-hooks.test.js +444 -14
- package/bin/__tests__/codex-native.test.js +228 -7
- package/bin/__tests__/develop-contract.test.js +615 -185
- package/bin/__tests__/installer-safety.test.js +39 -0
- package/bin/__tests__/opencode-spec-gate.test.js +24 -16
- package/bin/__tests__/package-inventory.test.js +687 -13
- package/bin/__tests__/specs-v2-execution-closeout.test.js +421 -0
- package/bin/__tests__/specs-v2-policy-and-scaffold.test.js +601 -0
- package/bin/__tests__/specs-v2-validator-grounder-contract.test.js +952 -0
- package/bin/__tests__/test-runtime-dependency-closure.cjs +182 -0
- package/bin/__tests__/validator-grounding.test.js +1914 -221
- package/bin/lib/managed-writer.js +12 -3
- package/bin/phases/codex-runtime.js +17 -1
- package/package.json +1 -1
- package/src/claude/CLAUDE.md +6 -0
- package/src/claude/agents/code-auditor.md +20 -0
- package/src/claude/agents/spec-maker.md +143 -99
- package/src/claude/hooks/__tests__/completion-authority.test.js +291 -58
- package/src/claude/hooks/__tests__/privacy-block.test.js +172 -0
- package/src/claude/hooks/__tests__/semantic-review-authority.test.js +257 -0
- package/src/claude/hooks/__tests__/spec-gate.test.js +115 -40
- package/src/claude/hooks/completion-authority-check.cjs +37 -288
- package/src/claude/hooks/completion-authority-state.cjs +10 -8
- package/src/claude/hooks/completion-authority.cjs +13 -7
- package/src/claude/hooks/docs-sync.cjs +5 -2
- package/src/claude/hooks/lib/privacy-command-analysis.cjs +393 -0
- package/src/claude/hooks/lib/runtime-path-safety.cjs +119 -0
- package/src/claude/hooks/privacy-block.cjs +77 -30
- package/src/claude/hooks/semantic-review-authority.cjs +152 -0
- package/src/claude/hooks/spec-gate.cjs +47 -117
- package/src/claude/hooks/spec-state.cjs +8 -2
- package/src/claude/migration-manifest.json +9 -1
- package/src/claude/rules/state-sync.md +52 -21
- package/src/claude/rules/workflow.md +17 -9
- package/src/claude/scripts/spec-final-state.cjs +244 -0
- package/src/claude/scripts/spec-ground.cjs +535 -173
- package/src/claude/scripts/spec-readiness.cjs +118 -0
- package/src/claude/scripts/spec-receipt.cjs +162 -0
- package/src/claude/scripts/spec-resolver.cjs +67 -16
- package/src/claude/scripts/spec-scaffold.cjs +1354 -139
- package/src/claude/scripts/spec-semantic-model.cjs +396 -0
- package/src/claude/scripts/validate-spec-output.cjs +2782 -142
- package/src/claude/scripts/workflow-policy.cjs +501 -183
- package/src/claude/settings/settings.json +4 -0
- package/src/claude/skills/code-review/SKILL.md +12 -3
- package/src/claude/skills/code-review/references/spec-compliance-review.md +10 -2
- package/src/claude/skills/code-review/references/verification-gate.md +13 -0
- package/src/claude/skills/develop/SKILL.md +47 -60
- package/src/claude/skills/develop/references/parallel-waves.md +9 -6
- package/src/claude/skills/develop/references/quality-gate.md +19 -12
- package/src/claude/skills/specs/SKILL.md +183 -177
- package/src/claude/skills/specs/references/ask-user-question-gates.md +27 -18
- package/src/claude/skills/specs/references/cross-spec-dependency.md +8 -4
- package/src/claude/skills/specs/references/research-strategy.md +4 -1
- package/src/claude/skills/specs/references/review.md +200 -260
- package/src/claude/skills/specs/references/scope-inquiry.md +18 -5
- package/src/claude/skills/specs/rules/design-discovery-full.md +33 -81
- package/src/claude/skills/specs/rules/design-discovery-light.md +21 -42
- package/src/claude/skills/specs/rules/design-principles.md +136 -180
- package/src/claude/skills/specs/rules/design-review.md +42 -97
- package/src/claude/skills/specs/rules/ears-format.md +42 -50
- package/src/claude/skills/specs/rules/phase-decision-matrix.md +42 -41
- package/src/claude/skills/specs/rules/task-scoring-rubric.md +2 -1
- package/src/claude/skills/specs/rules/tasks-generation.md +189 -300
- package/src/claude/skills/specs/templates/design.md +49 -263
- package/src/claude/skills/specs/templates/requirements.md +26 -36
- package/src/claude/skills/specs/templates/research.md +9 -98
- package/src/claude/skills/specs/templates/spec-state.json +23 -85
- package/src/claude/skills/specs/templates/task.md +30 -102
- package/src/claude/skills/sync/SKILL.md +33 -10
- package/src/claude/skills/sync/references/sync-protocols.md +31 -13
- package/src/claude/skills/test/SKILL.md +17 -7
- package/src/codex/AGENTS.md +6 -0
- package/src/codex/hooks/completion-authority-check.cjs +43 -240
- package/src/codex/hooks/completion-authority-state.cjs +10 -8
- package/src/codex/hooks/completion-authority.cjs +13 -7
- package/src/codex/hooks/lib/hook-context.cjs +16 -2
- package/src/codex/hooks/lib/privacy-command-analysis.cjs +3 -0
- package/src/codex/hooks/lib/privacy-state.cjs +38 -16
- package/src/codex/hooks/lib/runtime-path-safety.cjs +3 -0
- package/src/codex/hooks/lib/spec-receipt.cjs +72 -134
- package/src/codex/hooks/lib/spec-utils.cjs +56 -5
- package/src/codex/hooks/privacy-approval.cjs +1 -1
- package/src/codex/hooks/privacy-block.cjs +67 -11
- package/src/codex/hooks/semantic-review-authority.cjs +130 -0
- package/src/codex/hooks/spec-gate.cjs +49 -34
- package/src/codex/hooks/spec-state.cjs +10 -3
- package/src/codex/hooks/state.cjs +2 -0
- package/src/codex/hooks.json +6 -1
- package/src/codex/rules/state-sync.md +47 -27
- package/src/common/AGENTS.md +1 -1
|
@@ -1,296 +1,82 @@
|
|
|
1
|
-
# Design
|
|
1
|
+
# Design
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
**Purpose**: Provide sufficient detail to ensure implementation consistency across different implementers, preventing interpretation drift.
|
|
3
|
+
<!-- Delete every optional section that is not relevant. Compact keeps only the four core sections. -->
|
|
5
4
|
|
|
6
|
-
|
|
7
|
-
- Include essential sections that directly inform implementation decisions
|
|
8
|
-
- Omit optional sections unless critical to preventing implementation errors
|
|
9
|
-
- Match detail level to feature complexity
|
|
10
|
-
- Use diagrams and tables over lengthy prose
|
|
5
|
+
## Boundary
|
|
11
6
|
|
|
12
|
-
**
|
|
13
|
-
|
|
7
|
+
- **Owns:** {{Behavior/state this design owns}}
|
|
8
|
+
- **Reads:** {{Relevant inputs or existing state, or none}}
|
|
9
|
+
- **Writes/exposes:** {{Outputs, state, route, artifact, or none}}
|
|
10
|
+
- **Outside boundary:** {{Explicit non-goal or delegated responsibility}}
|
|
14
11
|
|
|
15
|
-
|
|
12
|
+
## Typed Anchors
|
|
16
13
|
|
|
17
|
-
|
|
18
|
-
2-3 paragraphs max
|
|
19
|
-
**Purpose**: This feature delivers [specific value] to [target users].
|
|
20
|
-
**Users**: [Target user groups] will utilize this for [specific workflows].
|
|
21
|
-
**Impact** (if applicable): Changes the current [system state] by [specific modifications].
|
|
14
|
+
<!-- Files-first. IDs are unique across the whole spec. Design-owned anchors use A-D-NN. Access/Action are machine authority; Role never implies lifecycle. -->
|
|
22
15
|
|
|
16
|
+
| ID | Type | Target | Role | Access | Action |
|
|
17
|
+
|---|---|---|---|---|---|
|
|
18
|
+
| A-D-01 | file | `{{path/to/existing-or-planned-file}}` | {{owner / consumer / entrypoint / proof / constraint}} | {{read / write}} | {{read / create / modify / delete}} |
|
|
19
|
+
<!-- For a typed proof boundary, add: | A-D-02 | artifact | `{{path/to/proof-artifact}}` | proof evidence owner | write | create | -->
|
|
23
20
|
|
|
24
|
-
|
|
25
|
-
- Primary objective 1
|
|
26
|
-
- Primary objective 2
|
|
27
|
-
- Success criteria
|
|
21
|
+
## Decisions and Invariants
|
|
28
22
|
|
|
29
|
-
|
|
30
|
-
- Explicitly excluded functionality
|
|
31
|
-
- Future considerations outside current scope
|
|
32
|
-
- Integration points deferred
|
|
23
|
+
<!-- Keep stable D/I/C IDs: every RN.M semantic-review counterexample cites one exact design reference. -->
|
|
33
24
|
|
|
34
|
-
|
|
25
|
+
### D1 — {{Decision name}}
|
|
35
26
|
|
|
36
|
-
|
|
37
|
-
|
|
27
|
+
- **Decision:** {{Canonical behavior or boundary}}
|
|
28
|
+
- **Rejects ambiguity:** {{Alternative interpretation implementers must not choose}}
|
|
29
|
+
- **Negative path:** {{Failure/error behavior when relevant}}
|
|
30
|
+
- **Anchors:** A-D-01
|
|
38
31
|
|
|
39
|
-
###
|
|
40
|
-
When modifying existing systems:
|
|
41
|
-
- Current architecture patterns and constraints
|
|
42
|
-
- Existing domain boundaries to be respected
|
|
43
|
-
- Integration points that must be maintained
|
|
44
|
-
- Technical debt addressed or worked around
|
|
32
|
+
### I1 — {{Invariant name}}
|
|
45
33
|
|
|
46
|
-
|
|
47
|
-
**RECOMMENDED**: Include Mermaid diagram showing the chosen architecture pattern and system boundaries (required for complex features, optional for simple additions)
|
|
34
|
+
{{Property that must remain true across implementation and verification.}}
|
|
48
35
|
|
|
49
|
-
|
|
50
|
-
- Selected pattern: [name and brief rationale]
|
|
51
|
-
- Domain/feature boundaries: [how responsibilities are separated to avoid conflicts]
|
|
52
|
-
- Existing patterns preserved: [list key patterns]
|
|
53
|
-
- New components rationale: [why each is needed]
|
|
54
|
-
- Steering compliance: [principles maintained]
|
|
36
|
+
### Named Contracts (conditional)
|
|
55
37
|
|
|
56
|
-
|
|
38
|
+
<!-- Define each implementation-significant contract once. Tasks reference IDs and never copy bodies. For any public, replay, or operator API contract, include method, route, auth, required headers, request schema, success response, error semantics, and idempotency/concurrency behavior. -->
|
|
57
39
|
|
|
58
|
-
|
|
59
|
-
|-------|------------------|-----------------|-------|
|
|
60
|
-
| Frontend / CLI | | | |
|
|
61
|
-
| Backend / Services | | | |
|
|
62
|
-
| Data / Storage | | | |
|
|
63
|
-
| Messaging / Events | | | |
|
|
64
|
-
| Infrastructure / Runtime | | | |
|
|
40
|
+
#### C1 — {{Contract name}}
|
|
65
41
|
|
|
66
|
-
|
|
42
|
+
- **Owner:** {{boundary or future owner task}}
|
|
43
|
+
- **Consumers:** {{boundaries or future consumer tasks}}
|
|
44
|
+
- **Shape/behavior:** {{typed request, response, event, schema, state, or error contract}}
|
|
45
|
+
- **Compatibility:** {{versioning or migration constraint when relevant}}
|
|
67
46
|
|
|
68
|
-
##
|
|
47
|
+
## Verification Definitions
|
|
69
48
|
|
|
70
|
-
|
|
49
|
+
<!--
|
|
50
|
+
Canonical parser syntax is one single-line definition per V ID. Keep every
|
|
51
|
+
label on the same line; do not replace this with a table or a V heading.
|
|
52
|
+
-->
|
|
71
53
|
|
|
72
|
-
|
|
73
|
-
|---------------|--------------------|------------|-------------------------|
|
|
74
|
-
| Auth / session | | | |
|
|
75
|
-
| Transport / entrypoints | | | |
|
|
76
|
-
| Data / persistence | | | |
|
|
77
|
-
| Deletion / retention policy | | | |
|
|
78
|
-
| Generated artifacts / runtime outputs | | | |
|
|
54
|
+
- **V1**: Criteria R{{SUBJECT_REQ}}.{{X}}; Owner A-D-01; Decision refs D1, I1, C1; Method command `{{exact command}}`; Expected {{concrete observable result}}; Negative/failure {{concrete rejected or recovery case}}; Reachability/grounding entrypoint `{{exact/repository/entrypoint}}` via A-D-01.
|
|
79
55
|
|
|
80
|
-
|
|
56
|
+
<!-- Only for a typed proof boundary, insert after Owner: Proof criteria Rn.m; Proof owner <distinct owner>; Evidence anchor <proof-owned anchor>; -->
|
|
81
57
|
|
|
82
|
-
|
|
58
|
+
<!-- Full-only conditional sections follow. Keep only those relevant to this feature. -->
|
|
83
59
|
|
|
84
|
-
|
|
60
|
+
## Flow (Full, conditional)
|
|
85
61
|
|
|
86
|
-
|
|
62
|
+
{{Only multi-step, branching, asynchronous, or cross-boundary flow decisions.}}
|
|
87
63
|
|
|
88
|
-
##
|
|
64
|
+
## Data and Consistency (Full, conditional)
|
|
89
65
|
|
|
90
|
-
|
|
91
|
-
- Sequence (multi-party interactions)
|
|
92
|
-
- Process / state (branching logic or lifecycle)
|
|
93
|
-
- Data / event flow (pipelines, async messaging)
|
|
66
|
+
{{Ownership, schema, constraints, concurrency, lifecycle, or idempotency. For any retention/lifecycle policy, state clock anchor, clock source, timezone/precision, cutoff comparator/inclusivity, enforcement boundary, and a wrong-clock/boundary counterexample.}}
|
|
94
67
|
|
|
95
|
-
|
|
96
|
-
> Describe flow-level decisions (e.g., gating conditions, retries) briefly after the diagram instead of restating each step.
|
|
68
|
+
## Errors and Recovery (Full, conditional)
|
|
97
69
|
|
|
98
|
-
|
|
70
|
+
{{Trigger, error contract, retry/rollback/reconciliation, and terminal state.}}
|
|
99
71
|
|
|
100
|
-
|
|
72
|
+
## Security and Privacy (Full, conditional)
|
|
101
73
|
|
|
102
|
-
|
|
74
|
+
{{Trust boundary, authorization, sensitive data, deletion, and retention decisions.}}
|
|
103
75
|
|
|
104
|
-
|
|
105
|
-
|-------------|---------|------------|------------|-------|
|
|
106
|
-
| 1.1 | | | | |
|
|
107
|
-
| 1.2 | | | | |
|
|
76
|
+
## Migration and Compatibility (Full, conditional)
|
|
108
77
|
|
|
109
|
-
|
|
78
|
+
{{Ordering, compatibility window, rollback trigger, and migration proof.}}
|
|
110
79
|
|
|
111
|
-
##
|
|
80
|
+
## Unresolved Questions
|
|
112
81
|
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
- Summaries can be a table or compact list. Example table:
|
|
116
|
-
| Component | Domain/Layer | Intent | Req Coverage | Key Dependencies (P0/P1) | Contracts |
|
|
117
|
-
|-----------|--------------|--------|--------------|--------------------------|-----------|
|
|
118
|
-
| ExampleComponent | UI | Displays XYZ | 1, 2 | GameProvider (P0), MapPanel (P1) | Service, State |
|
|
119
|
-
- Only components introducing new boundaries (e.g., logic hooks, external integrations, persistence) require full detail blocks. Simple presentation components can rely on the summary row plus a short Implementation Note.
|
|
120
|
-
|
|
121
|
-
Group detailed blocks by domain or architectural layer. For each detailed component, list requirement IDs as `2.1, 2.3` (omit “Requirement”). When multiple UI components share the same contract, reference a base interface/props definition instead of duplicating code blocks.
|
|
122
|
-
|
|
123
|
-
### [Domain / Layer]
|
|
124
|
-
|
|
125
|
-
#### [Component Name]
|
|
126
|
-
|
|
127
|
-
| Field | Detail |
|
|
128
|
-
|-------|--------|
|
|
129
|
-
| Intent | 1-line description of the responsibility |
|
|
130
|
-
| Requirements | 2.1, 2.3 |
|
|
131
|
-
| Owner / Reviewers | (optional) |
|
|
132
|
-
|
|
133
|
-
**Responsibilities & Constraints**
|
|
134
|
-
- Primary responsibility
|
|
135
|
-
- Domain boundary and transaction scope
|
|
136
|
-
- Data ownership / invariants
|
|
137
|
-
|
|
138
|
-
**Dependencies**
|
|
139
|
-
- Inbound: Component/service name — purpose (Criticality)
|
|
140
|
-
- Outbound: Component/service name — purpose (Criticality)
|
|
141
|
-
- External: Service/library — purpose (Criticality)
|
|
142
|
-
|
|
143
|
-
Summarize external dependency findings here; deeper investigation (API signatures, rate limits, migration notes) lives in `research.md`.
|
|
144
|
-
|
|
145
|
-
**Contracts**: Service [ ] / API [ ] / Event [ ] / Batch [ ] / State [ ] ← check only the ones that apply.
|
|
146
|
-
|
|
147
|
-
##### Service Interface
|
|
148
|
-
```typescript
|
|
149
|
-
interface [ComponentName]Service {
|
|
150
|
-
methodName(input: InputType): Result<OutputType, ErrorType>;
|
|
151
|
-
}
|
|
152
|
-
```
|
|
153
|
-
- Preconditions:
|
|
154
|
-
- Postconditions:
|
|
155
|
-
- Invariants:
|
|
156
|
-
|
|
157
|
-
##### API Contract
|
|
158
|
-
| Method | Endpoint | Request | Response | Errors |
|
|
159
|
-
|--------|----------|---------|----------|--------|
|
|
160
|
-
| POST | /api/resource | CreateRequest | Resource | 400, 409, 500 |
|
|
161
|
-
|
|
162
|
-
##### Event Contract
|
|
163
|
-
- Published events:
|
|
164
|
-
- Subscribed events:
|
|
165
|
-
- Ordering / delivery guarantees:
|
|
166
|
-
|
|
167
|
-
##### Batch / Job Contract
|
|
168
|
-
- Trigger:
|
|
169
|
-
- Input / validation:
|
|
170
|
-
- Output / destination:
|
|
171
|
-
- Idempotency & recovery:
|
|
172
|
-
|
|
173
|
-
##### State Management
|
|
174
|
-
- State model:
|
|
175
|
-
- Persistence & consistency:
|
|
176
|
-
- Concurrency strategy:
|
|
177
|
-
|
|
178
|
-
**Implementation Notes**
|
|
179
|
-
- Integration:
|
|
180
|
-
- Validation:
|
|
181
|
-
- Risks:
|
|
182
|
-
|
|
183
|
-
## Data Models
|
|
184
|
-
|
|
185
|
-
Focus on the portions of the data landscape that change with this feature.
|
|
186
|
-
|
|
187
|
-
### Domain Model
|
|
188
|
-
- Aggregates and transactional boundaries
|
|
189
|
-
- Entities, value objects, domain events
|
|
190
|
-
- Business rules & invariants
|
|
191
|
-
- Optional Mermaid diagram for complex relationships
|
|
192
|
-
|
|
193
|
-
### Logical Data Model
|
|
194
|
-
|
|
195
|
-
**Structure Definition**:
|
|
196
|
-
- Entity relationships and cardinality
|
|
197
|
-
- Attributes and their types
|
|
198
|
-
- Natural keys and identifiers
|
|
199
|
-
- Referential integrity rules
|
|
200
|
-
|
|
201
|
-
**Consistency & Integrity**:
|
|
202
|
-
- Transaction boundaries
|
|
203
|
-
- Cascading rules
|
|
204
|
-
- Temporal aspects (versioning, audit)
|
|
205
|
-
|
|
206
|
-
### Physical Data Model
|
|
207
|
-
**When to include**: When implementation requires specific storage design decisions
|
|
208
|
-
|
|
209
|
-
**For Relational Databases**:
|
|
210
|
-
- Table definitions with data types
|
|
211
|
-
- Primary/foreign keys and constraints
|
|
212
|
-
- Indexes and performance optimizations
|
|
213
|
-
- Partitioning strategy for scale
|
|
214
|
-
|
|
215
|
-
**For Document Stores**:
|
|
216
|
-
- Collection structures
|
|
217
|
-
- Embedding vs referencing decisions
|
|
218
|
-
- Sharding key design
|
|
219
|
-
- Index definitions
|
|
220
|
-
|
|
221
|
-
**For Event Stores**:
|
|
222
|
-
- Event schema definitions
|
|
223
|
-
- Stream aggregation strategies
|
|
224
|
-
- Snapshot policies
|
|
225
|
-
- Projection definitions
|
|
226
|
-
|
|
227
|
-
**For Key-Value/Wide-Column Stores**:
|
|
228
|
-
- Key design patterns
|
|
229
|
-
- Column families or value structures
|
|
230
|
-
- TTL and compaction strategies
|
|
231
|
-
|
|
232
|
-
### Data Contracts & Integration
|
|
233
|
-
|
|
234
|
-
**API Data Transfer**
|
|
235
|
-
- Request/response schemas
|
|
236
|
-
- Validation rules
|
|
237
|
-
- Serialization format (JSON, Protobuf, etc.)
|
|
238
|
-
|
|
239
|
-
**Event Schemas**
|
|
240
|
-
- Published event structures
|
|
241
|
-
- Schema versioning strategy
|
|
242
|
-
- Backward/forward compatibility rules
|
|
243
|
-
|
|
244
|
-
**Cross-Service Data Management**
|
|
245
|
-
- Distributed transaction patterns (Saga, 2PC)
|
|
246
|
-
- Data synchronization strategies
|
|
247
|
-
- Eventual consistency handling
|
|
248
|
-
|
|
249
|
-
Skip subsections that are not relevant to this feature.
|
|
250
|
-
|
|
251
|
-
## Error Handling
|
|
252
|
-
|
|
253
|
-
### Error Strategy
|
|
254
|
-
Concrete error handling patterns and recovery mechanisms for each error type.
|
|
255
|
-
|
|
256
|
-
### Error Categories and Responses
|
|
257
|
-
**User Errors** (4xx): Invalid input → field-level validation; Unauthorized → auth guidance; Not found → navigation help
|
|
258
|
-
**System Errors** (5xx): Infrastructure failures → graceful degradation; Timeouts → circuit breakers; Exhaustion → rate limiting
|
|
259
|
-
**Business Logic Errors** (422): Rule violations → condition explanations; State conflicts → transition guidance
|
|
260
|
-
|
|
261
|
-
**Process Flow Visualization** (when complex business logic exists):
|
|
262
|
-
Include Mermaid flowchart only for complex error scenarios with business workflows.
|
|
263
|
-
|
|
264
|
-
### Monitoring
|
|
265
|
-
Error tracking, logging, and health monitoring implementation.
|
|
266
|
-
|
|
267
|
-
## Testing Strategy
|
|
268
|
-
|
|
269
|
-
### Default sections (adapt names/sections to fit the domain)
|
|
270
|
-
- Unit Tests: 3–5 items from core functions/modules (e.g., auth methods, subscription logic)
|
|
271
|
-
- Integration Tests: 3–5 cross-component flows (e.g., webhook handling, notifications)
|
|
272
|
-
- E2E/UI Tests (if applicable): 3–5 critical user paths (e.g., forms, dashboards)
|
|
273
|
-
- Performance/Load (if applicable): 3–4 items (e.g., concurrency, high-volume ops)
|
|
274
|
-
|
|
275
|
-
## Conditional Sections (Include when relevant)
|
|
276
|
-
|
|
277
|
-
### Security Considerations
|
|
278
|
-
_**REQUIRED** when features handle user data, authentication, PII, external integrations, or permissions. Omit only for purely internal UI changes._
|
|
279
|
-
- Threat modeling, security controls, compliance requirements
|
|
280
|
-
- Authentication and authorization patterns
|
|
281
|
-
- Data protection and privacy considerations
|
|
282
|
-
|
|
283
|
-
### Performance & Scalability
|
|
284
|
-
_Use this section when performance targets, high load, or scaling concerns exist. Record only feature-specific targets or trade-offs and rely on steering documents for general practices._
|
|
285
|
-
- Target metrics and measurement strategies
|
|
286
|
-
- Scaling approaches (horizontal/vertical)
|
|
287
|
-
- Caching strategies and optimization techniques
|
|
288
|
-
|
|
289
|
-
### Migration Strategy
|
|
290
|
-
Include a Mermaid flowchart showing migration phases when schema/data movement is required.
|
|
291
|
-
- Phase breakdown, rollback triggers, validation checkpoints
|
|
292
|
-
|
|
293
|
-
## Supporting References (Optional)
|
|
294
|
-
- Create this section only when keeping the information in the main body would hurt readability (e.g., very long TypeScript definitions, vendor option matrices, exhaustive schema tables). Keep decision-making context in the main sections so the design stays self-contained.
|
|
295
|
-
- Link to the supporting references from the main text instead of inlining large snippets.
|
|
296
|
-
- Background research notes and comparisons continue to live in `research.md`, but their conclusions must be summarized in the main design.
|
|
82
|
+
- None.
|
|
@@ -1,52 +1,42 @@
|
|
|
1
|
-
# Requirements
|
|
1
|
+
# Requirements
|
|
2
2
|
|
|
3
|
-
##
|
|
4
|
-
{{INTRODUCTION}}
|
|
3
|
+
## Outcomes
|
|
5
4
|
|
|
6
|
-
|
|
5
|
+
- {{Observable product or system outcome}}
|
|
7
6
|
|
|
8
|
-
|
|
9
|
-
<!-- Requirement headings MUST include a leading numeric ID only (for example: "Requirement 1: ...", "1. Overview", "2 Feature: ..."). Alphabetic IDs like "Requirement A" are not allowed. -->
|
|
10
|
-
<!-- Acceptance criteria use EXPLICIT literal IDs `R{N}.{M}` (R1.1, R1.2, ...), NOT a bare numbered list. This lets the validator verify per-criterion coverage (each R1.1 must be mapped by a task `_Requirements: 1.1_`). Do not switch to a bare `1. 2. 3.` list — that silently disables sub-criterion coverage. -->
|
|
11
|
-
**Objective:** As a {{ROLE}}, I want {{CAPABILITY}}, so that {{BENEFIT}}
|
|
7
|
+
## Scope
|
|
12
8
|
|
|
13
|
-
|
|
14
|
-
- **R1.1** When [event], the [system] shall [response/action]
|
|
15
|
-
- **R1.2** If [trigger], then the [system] shall [response/action]
|
|
16
|
-
- **R1.3** While [precondition], the [system] shall [response/action]
|
|
17
|
-
- **R1.4** Where [feature is included], the [system] shall [response/action]
|
|
18
|
-
- **R1.5** The [system] shall [response/action]
|
|
9
|
+
### In scope
|
|
19
10
|
|
|
20
|
-
|
|
21
|
-
**Objective:** As a {{ROLE}}, I want {{CAPABILITY}}, so that {{BENEFIT}}
|
|
11
|
+
- {{Approved behavior or boundary}}
|
|
22
12
|
|
|
23
|
-
|
|
24
|
-
- **R2.1** When [event], the [system] shall [response/action]
|
|
25
|
-
- **R2.2** When [event] and [condition], the [system] shall [response/action]
|
|
13
|
+
### Non-goals
|
|
26
14
|
|
|
27
|
-
|
|
15
|
+
- {{Explicit exclusion that prevents scope inference}}
|
|
28
16
|
|
|
29
|
-
##
|
|
17
|
+
## Requirements
|
|
30
18
|
|
|
31
|
-
|
|
19
|
+
### Requirement 1: {{Outcome area}}
|
|
32
20
|
|
|
33
|
-
|
|
34
|
-
**Objective:** As a
|
|
21
|
+
<!-- Keep Objective/User Story only when role and benefit remove ambiguity. -->
|
|
22
|
+
{{Optional: **Objective:** As a <role>, I want <capability>, so that <benefit>.}}
|
|
35
23
|
|
|
36
24
|
#### Acceptance Criteria
|
|
37
|
-
- **R{{NEXT_REQ_NUMBER}}.1** The [system] shall [measurable performance metric, e.g. "respond within 500ms"]
|
|
38
|
-
- **R{{NEXT_REQ_NUMBER}}.2** The [system] shall [measurable scale metric, e.g. "support 100 concurrent users"]
|
|
39
25
|
|
|
40
|
-
|
|
41
|
-
**Objective:** As a security/compliance stakeholder, I want the feature to protect sensitive data and enforce access boundaries, so that the system is safe to ship.
|
|
26
|
+
- **R1.1** When {{event}}, the {{system}} shall {{measurable subject response}}.
|
|
42
27
|
|
|
43
|
-
|
|
44
|
-
- **R{{NEXT_REQ_NUMBER_PLUS_ONE}}.1** The [system] shall [measurable security behavior, e.g. "encrypt data at rest using AES-256"]
|
|
45
|
-
- **R{{NEXT_REQ_NUMBER_PLUS_ONE}}.2** If [unauthorized or invalid condition], the [system] shall [deny or recover with explicit behavior]
|
|
28
|
+
<!-- Add a separate proof criterion only when a typed proof boundary exists. -->
|
|
46
29
|
|
|
47
|
-
|
|
48
|
-
|
|
30
|
+
<!-- Add state, optional-feature, or ubiquitous EARS criteria only when relevant. -->
|
|
31
|
+
<!-- Add a concrete example only when values, order, boundaries, or transformation could be interpreted differently. -->
|
|
49
32
|
|
|
50
|
-
####
|
|
51
|
-
|
|
52
|
-
-
|
|
33
|
+
#### Examples (conditional)
|
|
34
|
+
|
|
35
|
+
- {{Input/state}} → {{expected output/state}}
|
|
36
|
+
|
|
37
|
+
<!-- Repeat Requirement N with literal RN.M acceptance IDs. -->
|
|
38
|
+
<!-- Add feature-specific NFRs in the same numeric sequence only when measurable and relevant. -->
|
|
39
|
+
|
|
40
|
+
## Unresolved Questions
|
|
41
|
+
|
|
42
|
+
- None.
|
|
@@ -1,108 +1,19 @@
|
|
|
1
|
-
# Research
|
|
1
|
+
# Research: {{FEATURE_NAME}}
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
**Purpose**: Capture discovery findings, architectural investigations, and rationale that inform the technical design.
|
|
3
|
+
Research exists only because this uncertainty can change requirements or design. Record evidence and a decision; do not use this file as a generic discovery log.
|
|
5
4
|
|
|
6
|
-
|
|
7
|
-
- Log research activities and outcomes during the discovery phase.
|
|
8
|
-
- Document design decision trade-offs that are too detailed for `design.md`.
|
|
9
|
-
- Provide references and evidence for future audits or reuse.
|
|
10
|
-
---
|
|
5
|
+
## Uncertainty
|
|
11
6
|
|
|
12
|
-
|
|
13
|
-
- **Feature**: `<feature-name>`
|
|
14
|
-
- **Discovery Scope**: New Feature / Extension / Simple Addition / Complex Integration
|
|
15
|
-
- **Key Findings**:
|
|
16
|
-
- Finding 1
|
|
17
|
-
- Finding 2
|
|
18
|
-
- Finding 3
|
|
7
|
+
- {{UNCERTAINTY}}
|
|
19
8
|
|
|
20
9
|
## Evidence Summary
|
|
21
|
-
This section is mandatory for non-trivial specs. It must be written before finalizing requirements, design, or tasks.
|
|
22
10
|
|
|
23
|
-
|
|
24
|
-
- Result or skip rationale:
|
|
25
|
-
- Relevant files/modules:
|
|
26
|
-
- Existing patterns/contracts:
|
|
27
|
-
- Tests or checks affected:
|
|
28
|
-
- **External / Current Research**: Required / Skipped
|
|
29
|
-
- Result or skip rationale:
|
|
30
|
-
- Primary sources:
|
|
31
|
-
- Current constraints or best practices:
|
|
32
|
-
- **Selected Decision**:
|
|
33
|
-
- Decision:
|
|
34
|
-
- Why it fits the current codebase:
|
|
35
|
-
- Why it fits current external constraints:
|
|
36
|
-
- **Rejected Alternatives**:
|
|
37
|
-
- Alternative 1 — rejection reason
|
|
38
|
-
- Alternative 2 — rejection reason
|
|
39
|
-
- **Remaining Gaps / Questions**:
|
|
40
|
-
- Gap 1
|
|
41
|
-
- Gap 2
|
|
42
|
-
- **Downstream Task & Test Implications**:
|
|
43
|
-
- Task implication:
|
|
44
|
-
- Test/verification implication:
|
|
11
|
+
<!-- Cite concrete repository evidence or current primary sources that resolve the uncertainty. -->
|
|
45
12
|
|
|
46
|
-
##
|
|
47
|
-
Capture only useful repo evidence, not raw file dumps.
|
|
13
|
+
## Decision
|
|
48
14
|
|
|
49
|
-
|
|
50
|
-
|------|---------|-----------------|-------------|
|
|
51
|
-
| Project surface | | | |
|
|
52
|
-
| Relevant files/modules | | | |
|
|
53
|
-
| Existing patterns | | | |
|
|
54
|
-
| Contracts | | | |
|
|
55
|
-
| Tests and verification | | | |
|
|
56
|
-
| Blast radius | | | |
|
|
57
|
-
| Staleness / conflicts | | | |
|
|
15
|
+
<!-- State the selected decision and how the evidence supports it. -->
|
|
58
16
|
|
|
59
|
-
##
|
|
60
|
-
Use official docs, standards, package repos, release notes, or maintained upstream references first.
|
|
17
|
+
## Remaining Gaps
|
|
61
18
|
|
|
62
|
-
|
|
63
|
-
|----------|--------|---------|-----------------|
|
|
64
|
-
| | | | |
|
|
65
|
-
|
|
66
|
-
## Research Log
|
|
67
|
-
Document notable investigation steps and their outcomes. Group entries by topic for readability.
|
|
68
|
-
|
|
69
|
-
### [Topic or Question]
|
|
70
|
-
- **Context**: What triggered this investigation?
|
|
71
|
-
- **Sources Consulted**: Links, documentation, API references, benchmarks
|
|
72
|
-
- **Findings**: Concise bullet points summarizing the insights
|
|
73
|
-
- **Implications**: How this affects architecture, contracts, or implementation
|
|
74
|
-
|
|
75
|
-
_Repeat the subsection for each major topic._
|
|
76
|
-
|
|
77
|
-
## Architecture Pattern Evaluation
|
|
78
|
-
List candidate patterns or approaches that were considered. Use the table format where helpful.
|
|
79
|
-
|
|
80
|
-
| Option | Description | Strengths | Risks / Limitations | Notes |
|
|
81
|
-
|--------|-------------|-----------|---------------------|-------|
|
|
82
|
-
| Hexagonal | Ports & adapters abstraction around core domain | Clear boundaries, testable core | Requires adapter layer build-out | Aligns with existing steering principle X |
|
|
83
|
-
|
|
84
|
-
## Design Decisions
|
|
85
|
-
Record major decisions that influence `design.md`. Focus on choices with significant trade-offs.
|
|
86
|
-
|
|
87
|
-
### Decision: `<Title>`
|
|
88
|
-
- **Context**: Problem or requirement driving the decision
|
|
89
|
-
- **Alternatives Considered**:
|
|
90
|
-
1. Option A — short description
|
|
91
|
-
2. Option B — short description
|
|
92
|
-
- **Selected Approach**: What was chosen and how it works
|
|
93
|
-
- **Rationale**: Why this approach fits the current project context
|
|
94
|
-
- **Status**: [Proposed / Accepted / Superseded]
|
|
95
|
-
- **Trade-offs**: Benefits vs. compromises
|
|
96
|
-
- **Follow-up**: Items to verify during implementation or testing
|
|
97
|
-
|
|
98
|
-
_Repeat the subsection for each decision._
|
|
99
|
-
|
|
100
|
-
## Risks & Mitigations
|
|
101
|
-
- Risk 1 — Proposed mitigation
|
|
102
|
-
- Risk 2 — Proposed mitigation
|
|
103
|
-
- Risk 3 — Proposed mitigation
|
|
104
|
-
|
|
105
|
-
## References
|
|
106
|
-
Provide canonical links and citations (official docs, standards, ADRs, internal guidelines).
|
|
107
|
-
- [Title](https://example.com) — brief note on relevance
|
|
108
|
-
- ...
|
|
19
|
+
<!-- List only unresolved gaps that still affect scope/design, or state `None` with evidence. -->
|