@mytechtoday/augment-extensions 0.1.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/AGENTS.md +152 -0
- package/LICENSE +22 -0
- package/MODULES.md +124 -0
- package/README.md +195 -0
- package/cli/dist/cli.d.ts +3 -0
- package/cli/dist/cli.d.ts.map +1 -0
- package/cli/dist/cli.js +100 -0
- package/cli/dist/cli.js.map +1 -0
- package/cli/dist/commands/init.d.ts +6 -0
- package/cli/dist/commands/init.d.ts.map +1 -0
- package/cli/dist/commands/init.js +137 -0
- package/cli/dist/commands/init.js.map +1 -0
- package/cli/dist/commands/link.d.ts +6 -0
- package/cli/dist/commands/link.d.ts.map +1 -0
- package/cli/dist/commands/link.js +85 -0
- package/cli/dist/commands/link.js.map +1 -0
- package/cli/dist/commands/list.d.ts +7 -0
- package/cli/dist/commands/list.d.ts.map +1 -0
- package/cli/dist/commands/list.js +122 -0
- package/cli/dist/commands/list.js.map +1 -0
- package/cli/dist/commands/search.d.ts +6 -0
- package/cli/dist/commands/search.d.ts.map +1 -0
- package/cli/dist/commands/search.js +16 -0
- package/cli/dist/commands/search.js.map +1 -0
- package/cli/dist/commands/show.d.ts +6 -0
- package/cli/dist/commands/show.d.ts.map +1 -0
- package/cli/dist/commands/show.js +106 -0
- package/cli/dist/commands/show.js.map +1 -0
- package/cli/dist/commands/update.d.ts +6 -0
- package/cli/dist/commands/update.d.ts.map +1 -0
- package/cli/dist/commands/update.js +19 -0
- package/cli/dist/commands/update.js.map +1 -0
- package/modules/coding-standards/typescript/README.md +45 -0
- package/modules/coding-standards/typescript/module.json +27 -0
- package/modules/coding-standards/typescript/rules/naming-conventions.md +225 -0
- package/modules/workflows/beads/README.md +135 -0
- package/modules/workflows/beads/examples/complete-workflow-example.md +278 -0
- package/modules/workflows/beads/module.json +54 -0
- package/modules/workflows/beads/rules/best-practices.md +398 -0
- package/modules/workflows/beads/rules/file-format.md +283 -0
- package/modules/workflows/beads/rules/manual-setup.md +315 -0
- package/modules/workflows/beads/rules/workflow.md +285 -0
- package/modules/workflows/openspec/README.md +96 -0
- package/modules/workflows/openspec/examples/complete-change-example.md +230 -0
- package/modules/workflows/openspec/module.json +53 -0
- package/modules/workflows/openspec/rules/best-practices.md +272 -0
- package/modules/workflows/openspec/rules/manual-setup.md +231 -0
- package/modules/workflows/openspec/rules/spec-format.md +193 -0
- package/modules/workflows/openspec/rules/workflow.md +189 -0
- package/package.json +72 -0
|
@@ -0,0 +1,272 @@
|
|
|
1
|
+
# OpenSpec Best Practices
|
|
2
|
+
|
|
3
|
+
## Change Management
|
|
4
|
+
|
|
5
|
+
### Keep Changes Atomic
|
|
6
|
+
|
|
7
|
+
✅ **Good**: One focused change per folder
|
|
8
|
+
```
|
|
9
|
+
openspec/changes/add-2fa/
|
|
10
|
+
openspec/changes/add-profile-search/
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
❌ **Bad**: Multiple unrelated changes in one folder
|
|
14
|
+
```
|
|
15
|
+
openspec/changes/misc-improvements/ # Too vague
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
### Use Descriptive Names
|
|
19
|
+
|
|
20
|
+
✅ **Good**: Clear, specific names
|
|
21
|
+
- `add-2fa`
|
|
22
|
+
- `fix-login-timeout`
|
|
23
|
+
- `refactor-auth-flow`
|
|
24
|
+
|
|
25
|
+
❌ **Bad**: Generic or cryptic names
|
|
26
|
+
- `feature-123`
|
|
27
|
+
- `updates`
|
|
28
|
+
- `fix`
|
|
29
|
+
|
|
30
|
+
### Review Before Implementation
|
|
31
|
+
|
|
32
|
+
Always review and iterate on specs before coding:
|
|
33
|
+
|
|
34
|
+
1. Create proposal and specs
|
|
35
|
+
2. Review with stakeholders
|
|
36
|
+
3. Refine until agreement
|
|
37
|
+
4. Then implement
|
|
38
|
+
|
|
39
|
+
**Why**: Catching issues in specs is 10x cheaper than in code.
|
|
40
|
+
|
|
41
|
+
## Specification Writing
|
|
42
|
+
|
|
43
|
+
### Be Specific
|
|
44
|
+
|
|
45
|
+
✅ **Good**: Concrete, testable requirements
|
|
46
|
+
```markdown
|
|
47
|
+
### Requirement: Session Timeout
|
|
48
|
+
The system SHALL terminate sessions after 30 minutes of inactivity.
|
|
49
|
+
|
|
50
|
+
#### Scenario: Inactive session
|
|
51
|
+
- GIVEN a user is logged in
|
|
52
|
+
- WHEN 30 minutes pass with no activity
|
|
53
|
+
- THEN the session is terminated
|
|
54
|
+
- AND the user is redirected to login
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
❌ **Bad**: Vague requirements
|
|
58
|
+
```markdown
|
|
59
|
+
### Requirement: Security
|
|
60
|
+
The system should be secure.
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
### Include Edge Cases
|
|
64
|
+
|
|
65
|
+
✅ **Good**: Cover error scenarios
|
|
66
|
+
```markdown
|
|
67
|
+
#### Scenario: Invalid OTP
|
|
68
|
+
- WHEN a user submits an invalid OTP
|
|
69
|
+
- THEN an error message is displayed
|
|
70
|
+
- AND the user can retry up to 3 times
|
|
71
|
+
- AND after 3 failures, the account is locked
|
|
72
|
+
|
|
73
|
+
#### Scenario: Expired OTP
|
|
74
|
+
- WHEN a user submits an expired OTP (>5 minutes old)
|
|
75
|
+
- THEN an error message is displayed
|
|
76
|
+
- AND a new OTP can be requested
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
### Use Consistent Language
|
|
80
|
+
|
|
81
|
+
- **SHALL** - Mandatory requirement
|
|
82
|
+
- **MUST** - Mandatory requirement (stronger emphasis)
|
|
83
|
+
- **SHOULD** - Recommended but not mandatory
|
|
84
|
+
- **MAY** - Optional feature
|
|
85
|
+
|
|
86
|
+
## Task Management
|
|
87
|
+
|
|
88
|
+
### Break Down Large Tasks
|
|
89
|
+
|
|
90
|
+
✅ **Good**: Granular, actionable tasks
|
|
91
|
+
```markdown
|
|
92
|
+
## 2. Backend Implementation
|
|
93
|
+
- [ ] 2.1 Create OTP model with secret and expiry fields
|
|
94
|
+
- [ ] 2.2 Add OTP generation function using TOTP algorithm
|
|
95
|
+
- [ ] 2.3 Add OTP verification function with rate limiting
|
|
96
|
+
- [ ] 2.4 Update login endpoint to require OTP
|
|
97
|
+
- [ ] 2.5 Add OTP enrollment endpoint
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
❌ **Bad**: Vague, large tasks
|
|
101
|
+
```markdown
|
|
102
|
+
## 2. Backend
|
|
103
|
+
- [ ] 2.1 Implement 2FA
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
### Group Related Tasks
|
|
107
|
+
|
|
108
|
+
Organize tasks by phase or component:
|
|
109
|
+
|
|
110
|
+
```markdown
|
|
111
|
+
## 1. Database Setup
|
|
112
|
+
- [ ] 1.1 Add OTP secret column
|
|
113
|
+
- [ ] 1.2 Add OTP logs table
|
|
114
|
+
- [ ] 1.3 Create migration
|
|
115
|
+
|
|
116
|
+
## 2. Backend API
|
|
117
|
+
- [ ] 2.1 OTP generation endpoint
|
|
118
|
+
- [ ] 2.2 OTP verification endpoint
|
|
119
|
+
|
|
120
|
+
## 3. Frontend UI
|
|
121
|
+
- [ ] 3.1 OTP input component
|
|
122
|
+
- [ ] 3.2 Update login flow
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
### Update Tasks During Implementation
|
|
126
|
+
|
|
127
|
+
If scope changes during implementation, update tasks.md:
|
|
128
|
+
|
|
129
|
+
```markdown
|
|
130
|
+
## 2. Backend Implementation
|
|
131
|
+
- [x] 2.1 Create OTP model
|
|
132
|
+
- [x] 2.2 Add OTP generation
|
|
133
|
+
- [ ] 2.3 Add OTP verification
|
|
134
|
+
- [ ] 2.4 Add rate limiting (ADDED during implementation)
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
## Multi-Spec Changes
|
|
138
|
+
|
|
139
|
+
### When Changes Affect Multiple Components
|
|
140
|
+
|
|
141
|
+
Create deltas for each affected spec:
|
|
142
|
+
|
|
143
|
+
```
|
|
144
|
+
openspec/changes/add-user-roles/
|
|
145
|
+
├── proposal.md
|
|
146
|
+
├── tasks.md
|
|
147
|
+
└── specs/
|
|
148
|
+
├── auth/
|
|
149
|
+
│ └── spec.md # Auth changes
|
|
150
|
+
├── users/
|
|
151
|
+
│ └── spec.md # User model changes
|
|
152
|
+
└── permissions/
|
|
153
|
+
└── spec.md # Permission system changes
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
### Reference Dependencies
|
|
157
|
+
|
|
158
|
+
In proposal.md, note cross-component dependencies:
|
|
159
|
+
|
|
160
|
+
```markdown
|
|
161
|
+
## Dependencies
|
|
162
|
+
- Auth spec changes depend on User model changes
|
|
163
|
+
- Permission checks require Auth changes to be complete
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
## Archiving
|
|
167
|
+
|
|
168
|
+
### Archive Promptly
|
|
169
|
+
|
|
170
|
+
Don't let completed changes accumulate in `openspec/changes/`:
|
|
171
|
+
|
|
172
|
+
```bash
|
|
173
|
+
# With CLI
|
|
174
|
+
openspec archive add-2fa --yes
|
|
175
|
+
|
|
176
|
+
# Without CLI - move to archive
|
|
177
|
+
mv openspec/changes/add-2fa openspec/archive/
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
### Keep Archive Organized
|
|
181
|
+
|
|
182
|
+
Archive folder structure:
|
|
183
|
+
|
|
184
|
+
```
|
|
185
|
+
openspec/archive/
|
|
186
|
+
├── 2024-01-add-2fa/
|
|
187
|
+
├── 2024-01-profile-search/
|
|
188
|
+
└── 2024-02-role-permissions/
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
Consider adding date prefixes for chronological ordering.
|
|
192
|
+
|
|
193
|
+
## Project Context
|
|
194
|
+
|
|
195
|
+
### Keep project.md Updated
|
|
196
|
+
|
|
197
|
+
Update `openspec/project.md` when:
|
|
198
|
+
- Tech stack changes
|
|
199
|
+
- New conventions are adopted
|
|
200
|
+
- Architecture evolves
|
|
201
|
+
- New guidelines are established
|
|
202
|
+
|
|
203
|
+
### Include Examples
|
|
204
|
+
|
|
205
|
+
Add examples to project.md:
|
|
206
|
+
|
|
207
|
+
```markdown
|
|
208
|
+
## Naming Conventions
|
|
209
|
+
|
|
210
|
+
### API Endpoints
|
|
211
|
+
- Use kebab-case: `/api/user-profiles`
|
|
212
|
+
- Use plural nouns: `/api/users` not `/api/user`
|
|
213
|
+
- Version with prefix: `/api/v1/users`
|
|
214
|
+
|
|
215
|
+
### Database Tables
|
|
216
|
+
- Use snake_case: `user_profiles`
|
|
217
|
+
- Use plural nouns: `users` not `user`
|
|
218
|
+
```
|
|
219
|
+
|
|
220
|
+
## AI Agent Collaboration
|
|
221
|
+
|
|
222
|
+
### Provide Context
|
|
223
|
+
|
|
224
|
+
When asking AI to create changes:
|
|
225
|
+
|
|
226
|
+
```
|
|
227
|
+
Create an OpenSpec change for adding role-based permissions.
|
|
228
|
+
Context: We have 3 roles (admin, editor, viewer) and need to restrict
|
|
229
|
+
access to certain API endpoints based on role.
|
|
230
|
+
```
|
|
231
|
+
|
|
232
|
+
### Iterate on Specs
|
|
233
|
+
|
|
234
|
+
Don't accept first draft:
|
|
235
|
+
|
|
236
|
+
```
|
|
237
|
+
The spec looks good, but can you add scenarios for:
|
|
238
|
+
1. What happens when a user has multiple roles?
|
|
239
|
+
2. How do we handle role changes for active sessions?
|
|
240
|
+
```
|
|
241
|
+
|
|
242
|
+
### Reference Existing Specs
|
|
243
|
+
|
|
244
|
+
When implementing:
|
|
245
|
+
|
|
246
|
+
```
|
|
247
|
+
Please implement the tasks in openspec/changes/add-roles/tasks.md
|
|
248
|
+
Make sure to follow the patterns established in openspec/specs/auth/spec.md
|
|
249
|
+
```
|
|
250
|
+
|
|
251
|
+
## Common Pitfalls
|
|
252
|
+
|
|
253
|
+
### ❌ Skipping Spec Review
|
|
254
|
+
|
|
255
|
+
Don't jump straight to implementation. Review specs first.
|
|
256
|
+
|
|
257
|
+
### ❌ Vague Requirements
|
|
258
|
+
|
|
259
|
+
Avoid "should work well" or "be fast". Be specific with numbers and behaviors.
|
|
260
|
+
|
|
261
|
+
### ❌ Missing Scenarios
|
|
262
|
+
|
|
263
|
+
Every requirement needs at least one scenario showing how it works.
|
|
264
|
+
|
|
265
|
+
### ❌ Forgetting to Archive
|
|
266
|
+
|
|
267
|
+
Clean up completed changes to keep the workspace organized.
|
|
268
|
+
|
|
269
|
+
### ❌ Mixing Concerns
|
|
270
|
+
|
|
271
|
+
Keep each change focused on one feature or fix.
|
|
272
|
+
|
|
@@ -0,0 +1,231 @@
|
|
|
1
|
+
# OpenSpec Manual Setup (Without CLI)
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
You can use the OpenSpec workflow without installing the CLI. This guide shows how to set up and use OpenSpec manually.
|
|
6
|
+
|
|
7
|
+
## Initial Setup
|
|
8
|
+
|
|
9
|
+
### 1. Create Directory Structure
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
mkdir -p openspec/specs
|
|
13
|
+
mkdir -p openspec/changes
|
|
14
|
+
mkdir -p openspec/archive
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
### 2. Create Project Context File
|
|
18
|
+
|
|
19
|
+
Create `openspec/project.md`:
|
|
20
|
+
|
|
21
|
+
```markdown
|
|
22
|
+
# Project Context
|
|
23
|
+
|
|
24
|
+
## Overview
|
|
25
|
+
[Brief description of your project]
|
|
26
|
+
|
|
27
|
+
## Tech Stack
|
|
28
|
+
- Language: [e.g., TypeScript, Python]
|
|
29
|
+
- Framework: [e.g., React, Django]
|
|
30
|
+
- Database: [e.g., PostgreSQL, MongoDB]
|
|
31
|
+
|
|
32
|
+
## Conventions
|
|
33
|
+
- Code style: [e.g., ESLint, Black]
|
|
34
|
+
- Testing: [e.g., Jest, pytest]
|
|
35
|
+
- Naming: [e.g., camelCase for variables]
|
|
36
|
+
|
|
37
|
+
## Architecture
|
|
38
|
+
[High-level architecture notes]
|
|
39
|
+
|
|
40
|
+
## Guidelines
|
|
41
|
+
[Project-specific rules and patterns]
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
### 3. Create AGENTS.md Integration
|
|
45
|
+
|
|
46
|
+
Add to your project's `AGENTS.md` (or create it):
|
|
47
|
+
|
|
48
|
+
```markdown
|
|
49
|
+
# OpenSpec Workflow
|
|
50
|
+
|
|
51
|
+
This project uses OpenSpec for spec-driven development.
|
|
52
|
+
|
|
53
|
+
## Directory Structure
|
|
54
|
+
|
|
55
|
+
- `openspec/specs/` - Current specifications (source of truth)
|
|
56
|
+
- `openspec/changes/` - Proposed changes (work in progress)
|
|
57
|
+
- `openspec/archive/` - Completed changes
|
|
58
|
+
- `openspec/project.md` - Project context and conventions
|
|
59
|
+
|
|
60
|
+
## Workflow
|
|
61
|
+
|
|
62
|
+
### Creating a Change
|
|
63
|
+
|
|
64
|
+
1. Create a new folder: `openspec/changes/<change-name>/`
|
|
65
|
+
2. Add `proposal.md` - Why and what
|
|
66
|
+
3. Add `tasks.md` - Implementation checklist
|
|
67
|
+
4. Add `specs/<component>/spec.md` - Spec deltas
|
|
68
|
+
|
|
69
|
+
### Implementing a Change
|
|
70
|
+
|
|
71
|
+
1. Read the spec deltas in `openspec/changes/<change-name>/specs/`
|
|
72
|
+
2. Work through `tasks.md` sequentially
|
|
73
|
+
3. Mark tasks complete: `- [x]` as you finish
|
|
74
|
+
4. Reference specs when making implementation decisions
|
|
75
|
+
|
|
76
|
+
### Archiving a Change
|
|
77
|
+
|
|
78
|
+
1. Copy spec deltas to `openspec/specs/`
|
|
79
|
+
2. Apply ADDED/MODIFIED/REMOVED sections
|
|
80
|
+
3. Move change folder to `openspec/archive/<change-name>/`
|
|
81
|
+
|
|
82
|
+
## Spec Format
|
|
83
|
+
|
|
84
|
+
See the spec format guide for details on writing specifications.
|
|
85
|
+
|
|
86
|
+
### Delta Sections
|
|
87
|
+
|
|
88
|
+
- `## ADDED Requirements` - New capabilities
|
|
89
|
+
- `## MODIFIED Requirements` - Changed behavior
|
|
90
|
+
- `## REMOVED Requirements` - Deprecated features
|
|
91
|
+
|
|
92
|
+
### Requirement Format
|
|
93
|
+
|
|
94
|
+
```markdown
|
|
95
|
+
### Requirement: <Name>
|
|
96
|
+
The system SHALL <requirement>.
|
|
97
|
+
|
|
98
|
+
#### Scenario: <Name>
|
|
99
|
+
- WHEN <condition>
|
|
100
|
+
- THEN <result>
|
|
101
|
+
```
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
### 4. Add to .gitignore (Optional)
|
|
105
|
+
|
|
106
|
+
If you want to keep changes private:
|
|
107
|
+
|
|
108
|
+
```bash
|
|
109
|
+
echo "openspec/changes/" >> .gitignore
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
## Creating Your First Change
|
|
113
|
+
|
|
114
|
+
### 1. Create Change Folder
|
|
115
|
+
|
|
116
|
+
```bash
|
|
117
|
+
mkdir -p openspec/changes/add-feature-x
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
### 2. Create Proposal
|
|
121
|
+
|
|
122
|
+
Create `openspec/changes/add-feature-x/proposal.md`:
|
|
123
|
+
|
|
124
|
+
```markdown
|
|
125
|
+
# Add Feature X
|
|
126
|
+
|
|
127
|
+
## Motivation
|
|
128
|
+
[Why this change is needed]
|
|
129
|
+
|
|
130
|
+
## Changes
|
|
131
|
+
- [What will change]
|
|
132
|
+
- [What components are affected]
|
|
133
|
+
|
|
134
|
+
## Impact
|
|
135
|
+
- [Breaking changes]
|
|
136
|
+
- [Migration requirements]
|
|
137
|
+
- [Dependencies]
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
### 3. Create Tasks
|
|
141
|
+
|
|
142
|
+
Create `openspec/changes/add-feature-x/tasks.md`:
|
|
143
|
+
|
|
144
|
+
```markdown
|
|
145
|
+
## 1. [Phase Name]
|
|
146
|
+
- [ ] 1.1 [Task description]
|
|
147
|
+
- [ ] 1.2 [Task description]
|
|
148
|
+
|
|
149
|
+
## 2. [Phase Name]
|
|
150
|
+
- [ ] 2.1 [Task description]
|
|
151
|
+
- [ ] 2.2 [Task description]
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
### 4. Create Spec Deltas
|
|
155
|
+
|
|
156
|
+
Create `openspec/changes/add-feature-x/specs/<component>/spec.md`:
|
|
157
|
+
|
|
158
|
+
```markdown
|
|
159
|
+
# Delta for <Component>
|
|
160
|
+
|
|
161
|
+
## ADDED Requirements
|
|
162
|
+
|
|
163
|
+
### Requirement: <Name>
|
|
164
|
+
The system SHALL <requirement>.
|
|
165
|
+
|
|
166
|
+
#### Scenario: <Name>
|
|
167
|
+
- WHEN <condition>
|
|
168
|
+
- THEN <result>
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
## Working with AI Agents
|
|
172
|
+
|
|
173
|
+
### Creating a Change
|
|
174
|
+
|
|
175
|
+
Ask your AI:
|
|
176
|
+
|
|
177
|
+
```
|
|
178
|
+
Create a new OpenSpec change in openspec/changes/add-search-filters/ with:
|
|
179
|
+
1. proposal.md explaining why we need search filters
|
|
180
|
+
2. tasks.md with implementation steps
|
|
181
|
+
3. specs/search/spec.md with the new requirements
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
### Implementing
|
|
185
|
+
|
|
186
|
+
Ask your AI:
|
|
187
|
+
|
|
188
|
+
```
|
|
189
|
+
Please implement the tasks in openspec/changes/add-search-filters/tasks.md
|
|
190
|
+
Reference the specs in openspec/changes/add-search-filters/specs/ for requirements
|
|
191
|
+
Mark each task complete as you finish
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
### Archiving
|
|
195
|
+
|
|
196
|
+
Ask your AI:
|
|
197
|
+
|
|
198
|
+
```
|
|
199
|
+
Please archive the add-search-filters change:
|
|
200
|
+
1. Copy spec deltas from openspec/changes/add-search-filters/specs/ to openspec/specs/
|
|
201
|
+
2. Apply the ADDED/MODIFIED/REMOVED sections to the source specs
|
|
202
|
+
3. Move openspec/changes/add-search-filters/ to openspec/archive/
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
## Limitations Without CLI
|
|
206
|
+
|
|
207
|
+
- ❌ No automatic validation
|
|
208
|
+
- ❌ No slash commands (unless manually configured)
|
|
209
|
+
- ❌ Manual archiving process
|
|
210
|
+
- ❌ No auto-generated AGENTS.md updates
|
|
211
|
+
|
|
212
|
+
## Benefits Without CLI
|
|
213
|
+
|
|
214
|
+
- ✅ No installation required
|
|
215
|
+
- ✅ Works immediately
|
|
216
|
+
- ✅ Full control over file structure
|
|
217
|
+
- ✅ Compatible with all AI agents
|
|
218
|
+
- ✅ Simple git workflow
|
|
219
|
+
|
|
220
|
+
## Upgrading to CLI Later
|
|
221
|
+
|
|
222
|
+
If you decide to install the CLI later:
|
|
223
|
+
|
|
224
|
+
```bash
|
|
225
|
+
npm install -g @fission-ai/openspec@latest
|
|
226
|
+
cd your-project
|
|
227
|
+
openspec init
|
|
228
|
+
```
|
|
229
|
+
|
|
230
|
+
The CLI will detect your existing structure and integrate with it.
|
|
231
|
+
|
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
# OpenSpec Specification Format
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
OpenSpec uses a structured markdown format for specifications. Specs live in two places:
|
|
6
|
+
|
|
7
|
+
- **`openspec/specs/`** - Current specifications (source of truth)
|
|
8
|
+
- **`openspec/changes/<change-name>/specs/`** - Proposed changes (deltas)
|
|
9
|
+
|
|
10
|
+
## Spec Structure
|
|
11
|
+
|
|
12
|
+
### Source Spec (openspec/specs/auth/spec.md)
|
|
13
|
+
|
|
14
|
+
```markdown
|
|
15
|
+
# Auth Specification
|
|
16
|
+
|
|
17
|
+
## Purpose
|
|
18
|
+
Authentication and session management.
|
|
19
|
+
|
|
20
|
+
## Requirements
|
|
21
|
+
|
|
22
|
+
### Requirement: User Authentication
|
|
23
|
+
The system SHALL issue a JWT on successful login.
|
|
24
|
+
|
|
25
|
+
#### Scenario: Valid credentials
|
|
26
|
+
- WHEN a user submits valid credentials
|
|
27
|
+
- THEN a JWT is returned
|
|
28
|
+
- AND the JWT contains user ID and role
|
|
29
|
+
|
|
30
|
+
#### Scenario: Invalid credentials
|
|
31
|
+
- WHEN a user submits invalid credentials
|
|
32
|
+
- THEN an error is returned
|
|
33
|
+
- AND no JWT is issued
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
### Delta Spec (openspec/changes/add-2fa/specs/auth/spec.md)
|
|
37
|
+
|
|
38
|
+
```markdown
|
|
39
|
+
# Delta for Auth
|
|
40
|
+
|
|
41
|
+
## ADDED Requirements
|
|
42
|
+
|
|
43
|
+
### Requirement: Two-Factor Authentication
|
|
44
|
+
The system MUST require a second factor during login.
|
|
45
|
+
|
|
46
|
+
#### Scenario: OTP required
|
|
47
|
+
- WHEN a user submits valid credentials
|
|
48
|
+
- THEN an OTP challenge is required
|
|
49
|
+
- AND the OTP is sent to the user's registered device
|
|
50
|
+
|
|
51
|
+
#### Scenario: Valid OTP
|
|
52
|
+
- WHEN a user submits a valid OTP
|
|
53
|
+
- THEN a JWT is issued
|
|
54
|
+
- AND the user is logged in
|
|
55
|
+
|
|
56
|
+
## MODIFIED Requirements
|
|
57
|
+
|
|
58
|
+
### Requirement: User Authentication
|
|
59
|
+
The system SHALL issue a JWT on successful login after two-factor verification.
|
|
60
|
+
|
|
61
|
+
#### Scenario: Valid credentials
|
|
62
|
+
- WHEN a user submits valid credentials
|
|
63
|
+
- THEN an OTP challenge is required (CHANGED)
|
|
64
|
+
- AND no JWT is issued until OTP verification (ADDED)
|
|
65
|
+
|
|
66
|
+
## REMOVED Requirements
|
|
67
|
+
|
|
68
|
+
(None for this change)
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
## Delta Format Rules
|
|
72
|
+
|
|
73
|
+
### Section Headers
|
|
74
|
+
|
|
75
|
+
Use these exact headers in delta specs:
|
|
76
|
+
|
|
77
|
+
- `## ADDED Requirements` - New capabilities
|
|
78
|
+
- `## MODIFIED Requirements` - Changed behavior
|
|
79
|
+
- `## REMOVED Requirements` - Deprecated features
|
|
80
|
+
|
|
81
|
+
### Requirement Format
|
|
82
|
+
|
|
83
|
+
```markdown
|
|
84
|
+
### Requirement: <Name>
|
|
85
|
+
The system SHALL/MUST/SHOULD <requirement text>.
|
|
86
|
+
|
|
87
|
+
#### Scenario: <Scenario Name>
|
|
88
|
+
- WHEN <condition>
|
|
89
|
+
- THEN <expected behavior>
|
|
90
|
+
- AND <additional expectation>
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
### Keywords
|
|
94
|
+
|
|
95
|
+
- **SHALL** - Mandatory requirement
|
|
96
|
+
- **MUST** - Mandatory requirement (stronger)
|
|
97
|
+
- **SHOULD** - Recommended but not mandatory
|
|
98
|
+
- **MAY** - Optional
|
|
99
|
+
|
|
100
|
+
### Scenario Format
|
|
101
|
+
|
|
102
|
+
Use Given-When-Then style:
|
|
103
|
+
|
|
104
|
+
- **GIVEN** - Initial context (optional)
|
|
105
|
+
- **WHEN** - Action or condition
|
|
106
|
+
- **THEN** - Expected result
|
|
107
|
+
- **AND** - Additional conditions/results
|
|
108
|
+
|
|
109
|
+
## Example: Complete Change
|
|
110
|
+
|
|
111
|
+
### Proposal (openspec/changes/add-2fa/proposal.md)
|
|
112
|
+
|
|
113
|
+
```markdown
|
|
114
|
+
# Add Two-Factor Authentication
|
|
115
|
+
|
|
116
|
+
## Motivation
|
|
117
|
+
Users need stronger account security. Passwords alone are insufficient.
|
|
118
|
+
|
|
119
|
+
## Changes
|
|
120
|
+
- Add OTP generation and verification
|
|
121
|
+
- Modify login flow to require 2FA
|
|
122
|
+
- Add user settings for 2FA enrollment
|
|
123
|
+
|
|
124
|
+
## Impact
|
|
125
|
+
- Breaking change: All users must enroll in 2FA
|
|
126
|
+
- Database migration required
|
|
127
|
+
- Frontend login flow changes
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
### Tasks (openspec/changes/add-2fa/tasks.md)
|
|
131
|
+
|
|
132
|
+
```markdown
|
|
133
|
+
## 1. Database Setup
|
|
134
|
+
- [ ] 1.1 Add OTP secret column to users table
|
|
135
|
+
- [ ] 1.2 Create OTP verification logs table
|
|
136
|
+
- [ ] 1.3 Add migration script
|
|
137
|
+
|
|
138
|
+
## 2. Backend Implementation
|
|
139
|
+
- [ ] 2.1 Add OTP generation endpoint
|
|
140
|
+
- [ ] 2.2 Modify login flow to require OTP
|
|
141
|
+
- [ ] 2.3 Add OTP verification endpoint
|
|
142
|
+
- [ ] 2.4 Add 2FA enrollment endpoint
|
|
143
|
+
|
|
144
|
+
## 3. Frontend Updates
|
|
145
|
+
- [ ] 3.1 Create OTP input component
|
|
146
|
+
- [ ] 3.2 Update login flow UI
|
|
147
|
+
- [ ] 3.3 Add 2FA settings page
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
### Spec Delta (openspec/changes/add-2fa/specs/auth/spec.md)
|
|
151
|
+
|
|
152
|
+
See example above in "Delta Spec" section.
|
|
153
|
+
|
|
154
|
+
## Archiving Process
|
|
155
|
+
|
|
156
|
+
When archiving, the delta is applied to the source spec:
|
|
157
|
+
|
|
158
|
+
1. **ADDED** sections are appended to source spec
|
|
159
|
+
2. **MODIFIED** sections replace existing requirements
|
|
160
|
+
3. **REMOVED** sections are deleted from source spec
|
|
161
|
+
|
|
162
|
+
Result: `openspec/specs/auth/spec.md` now includes 2FA requirements.
|
|
163
|
+
|
|
164
|
+
## Best Practices
|
|
165
|
+
|
|
166
|
+
1. **One Spec Per Component**: Don't mix auth and profile specs
|
|
167
|
+
2. **Complete Scenarios**: Every requirement needs at least one scenario
|
|
168
|
+
3. **Clear Language**: Use SHALL/MUST for clarity
|
|
169
|
+
4. **Atomic Changes**: Each delta should be independently reviewable
|
|
170
|
+
5. **Update Existing**: Use MODIFIED for changes, not ADDED + REMOVED
|
|
171
|
+
|
|
172
|
+
## Validation
|
|
173
|
+
|
|
174
|
+
### With CLI
|
|
175
|
+
|
|
176
|
+
```bash
|
|
177
|
+
openspec validate <change-name>
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
Checks:
|
|
181
|
+
- Required headers present
|
|
182
|
+
- Requirement format correct
|
|
183
|
+
- Scenario format valid
|
|
184
|
+
- No orphaned scenarios
|
|
185
|
+
|
|
186
|
+
### Without CLI
|
|
187
|
+
|
|
188
|
+
Manual checklist:
|
|
189
|
+
- [ ] All deltas have ADDED/MODIFIED/REMOVED sections
|
|
190
|
+
- [ ] Every requirement has a scenario
|
|
191
|
+
- [ ] Keywords (SHALL/MUST) used correctly
|
|
192
|
+
- [ ] Scenarios follow WHEN/THEN format
|
|
193
|
+
|