@popoverai/dotrequirements 0.11.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 +478 -0
- package/dist/cli.d.ts +3 -0
- package/dist/cli.js +82 -0
- package/dist/commands/init.d.ts +6 -0
- package/dist/commands/init.js +355 -0
- package/dist/commands/link.d.ts +15 -0
- package/dist/commands/link.js +156 -0
- package/dist/commands/login.d.ts +12 -0
- package/dist/commands/login.js +117 -0
- package/dist/commands/logout.d.ts +5 -0
- package/dist/commands/logout.js +17 -0
- package/dist/commands/mcp-setup.d.ts +5 -0
- package/dist/commands/mcp-setup.js +367 -0
- package/dist/commands/mcp.d.ts +6 -0
- package/dist/commands/mcp.js +10 -0
- package/dist/commands/pull.d.ts +7 -0
- package/dist/commands/pull.js +171 -0
- package/dist/commands/push.d.ts +11 -0
- package/dist/commands/push.js +310 -0
- package/dist/commands/test.d.ts +6 -0
- package/dist/commands/test.js +78 -0
- package/dist/config.d.ts +5 -0
- package/dist/config.js +16 -0
- package/dist/convex.d.ts +56 -0
- package/dist/convex.js +58 -0
- package/dist/harness/cache.d.ts +135 -0
- package/dist/harness/cache.js +342 -0
- package/dist/harness/convexReporting.d.ts +15 -0
- package/dist/harness/convexReporting.js +136 -0
- package/dist/harness/coverageCache.d.ts +30 -0
- package/dist/harness/coverageCache.js +70 -0
- package/dist/harness/finalize.d.ts +48 -0
- package/dist/harness/finalize.js +299 -0
- package/dist/harness/index.d.ts +70 -0
- package/dist/harness/index.js +103 -0
- package/dist/harness/localReporting.d.ts +6 -0
- package/dist/harness/localReporting.js +49 -0
- package/dist/harness/prepare.d.ts +41 -0
- package/dist/harness/prepare.js +83 -0
- package/dist/harness/requirementsLoader.d.ts +45 -0
- package/dist/harness/requirementsLoader.js +201 -0
- package/dist/harness/tracking.d.ts +49 -0
- package/dist/harness/tracking.js +179 -0
- package/dist/harness/types.d.ts +12 -0
- package/dist/harness/types.js +6 -0
- package/dist/mcp/convexClient.d.ts +43 -0
- package/dist/mcp/convexClient.js +101 -0
- package/dist/mcp/grep.d.ts +24 -0
- package/dist/mcp/grep.js +261 -0
- package/dist/mcp/index.d.ts +3 -0
- package/dist/mcp/index.js +1758 -0
- package/dist/mcp/requirements.d.ts +47 -0
- package/dist/mcp/requirements.js +141 -0
- package/dist/mcp/testCodeExtractor.d.ts +22 -0
- package/dist/mcp/testCodeExtractor.js +152 -0
- package/dist/mcp/types.d.ts +27 -0
- package/dist/mcp/types.js +2 -0
- package/dist/schema/browser.d.ts +12 -0
- package/dist/schema/browser.js +24 -0
- package/dist/schema/builder.d.ts +25 -0
- package/dist/schema/builder.js +125 -0
- package/dist/schema/conversions.d.ts +69 -0
- package/dist/schema/conversions.js +201 -0
- package/dist/schema/index.d.ts +14 -0
- package/dist/schema/index.js +24 -0
- package/dist/schema/parser-core.d.ts +61 -0
- package/dist/schema/parser-core.js +247 -0
- package/dist/schema/parser.d.ts +44 -0
- package/dist/schema/parser.js +295 -0
- package/dist/schema/resolver.d.ts +66 -0
- package/dist/schema/resolver.js +185 -0
- package/dist/schema/schemas.d.ts +312 -0
- package/dist/schema/schemas.js +258 -0
- package/dist/schema/test-schema.d.ts +5 -0
- package/dist/schema/test-schema.js +81 -0
- package/dist/templates/antigravity-gemini.md +3 -0
- package/dist/templates/antigravity-overview-rule.md +3 -0
- package/dist/templates/antigravity-test-rule.md +3 -0
- package/dist/templates/behavioral-core.md +25 -0
- package/dist/templates/claude-code-overview-skill.md +6 -0
- package/dist/templates/claude-code-skill.md +6 -0
- package/dist/templates/claude-code-test-skill.md +6 -0
- package/dist/templates/codex-agents.md +3 -0
- package/dist/templates/codex-overview-agents.md +3 -0
- package/dist/templates/codex-test-agents.md +3 -0
- package/dist/templates/cursor-overview-rule.mdc +5 -0
- package/dist/templates/cursor-rule.mdc +5 -0
- package/dist/templates/cursor-test-rule.mdc +5 -0
- package/dist/templates/example-requirements.d.ts +8 -0
- package/dist/templates/example-requirements.js +88 -0
- package/dist/templates/example-requirements.ts +88 -0
- package/dist/templates/overview-core.md +27 -0
- package/dist/templates/requirements-readme.d.ts +5 -0
- package/dist/templates/requirements-readme.js +31 -0
- package/dist/templates/requirements-readme.ts +30 -0
- package/dist/templates/test-writing-core.md +72 -0
- package/dist/utils/brand.d.ts +5 -0
- package/dist/utils/brand.js +8 -0
- package/dist/utils/browser-launch.d.ts +19 -0
- package/dist/utils/browser-launch.js +36 -0
- package/dist/utils/detect-existing-project.d.ts +5 -0
- package/dist/utils/detect-existing-project.js +34 -0
- package/dist/utils/env.d.ts +19 -0
- package/dist/utils/env.js +56 -0
- package/dist/utils/gitignore.d.ts +7 -0
- package/dist/utils/gitignore.js +29 -0
- package/dist/utils/local-project.d.ts +31 -0
- package/dist/utils/local-project.js +33 -0
- package/dist/utils/oauth-callback-server.d.ts +28 -0
- package/dist/utils/oauth-callback-server.js +156 -0
- package/dist/utils/oauth-flow.d.ts +22 -0
- package/dist/utils/oauth-flow.js +120 -0
- package/dist/utils/project-discovery.d.ts +57 -0
- package/dist/utils/project-discovery.js +146 -0
- package/dist/utils/project-name.d.ts +8 -0
- package/dist/utils/project-name.js +48 -0
- package/dist/utils/project-selector.d.ts +25 -0
- package/dist/utils/project-selector.js +69 -0
- package/dist/utils/prompts.d.ts +33 -0
- package/dist/utils/prompts.js +60 -0
- package/dist/utils/templates.d.ts +29 -0
- package/dist/utils/templates.js +67 -0
- package/dist/utils/token-refresh.d.ts +24 -0
- package/dist/utils/token-refresh.js +69 -0
- package/dist/utils/token-storage.d.ts +31 -0
- package/dist/utils/token-storage.js +57 -0
- package/package.json +82 -0
package/README.md
ADDED
|
@@ -0,0 +1,478 @@
|
|
|
1
|
+
# dot•requirements
|
|
2
|
+
|
|
3
|
+
Requirements tracking CLI, test harness, and MCP server for AI-assisted development.
|
|
4
|
+
|
|
5
|
+
**dot•requirements** treats requirements as discrete, testable data that flows from discovery through implementation to testing. Write requirements as structured Markdown, reference them in tests, and track coverage over time.
|
|
6
|
+
|
|
7
|
+
> **Alpha Software** — This package is under active development and may be unstable or incomplete. We're working toward a stable release, but things may break. Please report issues to support@popover.ca.
|
|
8
|
+
|
|
9
|
+
## Installation
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
npm install @popoverai/dotrequirements
|
|
13
|
+
# or
|
|
14
|
+
pnpm add @popoverai/dotrequirements
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
> **Note:** Examples use `dotreq` for brevity. The full command `dotrequirements` also works.
|
|
18
|
+
|
|
19
|
+
## Quick Start
|
|
20
|
+
|
|
21
|
+
### 1. Initialize a project
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
npx dotreq init
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
This creates a `.requirements/` directory with example requirements and configures your project.
|
|
28
|
+
|
|
29
|
+
### 2. Write requirements
|
|
30
|
+
|
|
31
|
+
Create `*.requirements.md` files in `.requirements/` or colocate them with your code:
|
|
32
|
+
|
|
33
|
+
```markdown
|
|
34
|
+
---
|
|
35
|
+
projectId: my-project
|
|
36
|
+
version: 1
|
|
37
|
+
document:
|
|
38
|
+
id: auth-requirements
|
|
39
|
+
title: "Authentication Requirements"
|
|
40
|
+
---
|
|
41
|
+
|
|
42
|
+
## User Authentication
|
|
43
|
+
|
|
44
|
+
```dotrequirements
|
|
45
|
+
AUTH-LOGIN-1: A registered user, Jamie, can log in to their account
|
|
46
|
+
0. → When Jamie provides a valid username and password, they are authenticated and brought to their dashboard
|
|
47
|
+
1. → When Jamie provides an incorrect password, they see an error message and remain on the login page
|
|
48
|
+
2. → When Jamie's account has been deactivated, but they provide otherwise correct credentials, they see a message explaining their account status
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
If your team prefers a structure such as Gherkin, you can add labels:
|
|
52
|
+
|
|
53
|
+
```dotrequirements
|
|
54
|
+
AUTH-LOGIN-2: A user with two-factor authentication enabled must provide an OTP
|
|
55
|
+
0. Given → Jamie has two-factor authentication enabled on their account
|
|
56
|
+
1. When → Jamie provides valid credentials
|
|
57
|
+
2. Then → Jamie is prompted to enter an OTP before accessing their dashboard
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
### 3. Reference requirements in tests
|
|
61
|
+
|
|
62
|
+
```typescript
|
|
63
|
+
import { requirement } from '@popoverai/dotrequirements/test';
|
|
64
|
+
|
|
65
|
+
describe(requirement('AUTH-LOGIN-1'), () => {
|
|
66
|
+
it(requirement('AUTH-LOGIN-1.0'), () => {
|
|
67
|
+
// valid credentials → authenticated
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
it(requirement('AUTH-LOGIN-1.1'), () => {
|
|
71
|
+
// incorrect password → error message
|
|
72
|
+
});
|
|
73
|
+
});
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
### 4. Track coverage
|
|
77
|
+
|
|
78
|
+
After running tests, you'll see a coverage report showing which requirements have been tested.
|
|
79
|
+
|
|
80
|
+
---
|
|
81
|
+
|
|
82
|
+
## What Works Locally
|
|
83
|
+
|
|
84
|
+
The following features work fully offline—no account required:
|
|
85
|
+
|
|
86
|
+
- Write requirements (`.requirements.md` files)
|
|
87
|
+
- Validate requirements (`dotreq test`)
|
|
88
|
+
- Reference requirements in tests (`requirement()`)
|
|
89
|
+
- Coverage reporting (console output)
|
|
90
|
+
- MCP tools (search, validate, explore)
|
|
91
|
+
|
|
92
|
+
The following features require a dot•requirements cloud account:
|
|
93
|
+
|
|
94
|
+
- Sync requirements (`pull` / `push`)
|
|
95
|
+
- Historical coverage tracking
|
|
96
|
+
- AI-powered style checking
|
|
97
|
+
- Team collaboration
|
|
98
|
+
|
|
99
|
+
To enable cloud features, run `dotreq login`.
|
|
100
|
+
|
|
101
|
+
---
|
|
102
|
+
|
|
103
|
+
## CLI Commands
|
|
104
|
+
|
|
105
|
+
### `dotreq init`
|
|
106
|
+
|
|
107
|
+
Initialize a new project. Creates `.requirements/` directory, example files, and configuration.
|
|
108
|
+
|
|
109
|
+
```bash
|
|
110
|
+
dotreq init
|
|
111
|
+
dotreq init --name my-project
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
### `dotreq link`
|
|
115
|
+
|
|
116
|
+
Link your local environment to an existing project (when you already have a project in dot•requirements cloud).
|
|
117
|
+
|
|
118
|
+
```bash
|
|
119
|
+
dotreq link
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
### `dotreq pull`
|
|
123
|
+
|
|
124
|
+
Sync requirements from dot•requirements cloud to local `.requirements/` files.
|
|
125
|
+
|
|
126
|
+
```bash
|
|
127
|
+
dotreq pull
|
|
128
|
+
dotreq pull --project <project-id>
|
|
129
|
+
dotreq pull --document <document-id>
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
### `dotreq push`
|
|
133
|
+
|
|
134
|
+
Push local requirements to dot•requirements cloud.
|
|
135
|
+
|
|
136
|
+
```bash
|
|
137
|
+
dotreq push
|
|
138
|
+
dotreq push .requirements/auth.requirements.md
|
|
139
|
+
dotreq push --yes # Skip confirmation
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
### `dotreq test`
|
|
143
|
+
|
|
144
|
+
Validate requirements files against the schema.
|
|
145
|
+
|
|
146
|
+
```bash
|
|
147
|
+
dotreq test
|
|
148
|
+
dotreq test --file .requirements/auth.requirements.md
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
### `dotreq login` / `logout`
|
|
152
|
+
|
|
153
|
+
Authenticate with dot•requirements cloud.
|
|
154
|
+
|
|
155
|
+
```bash
|
|
156
|
+
dotreq login
|
|
157
|
+
dotreq logout
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
### `dotreq mcp-setup`
|
|
161
|
+
|
|
162
|
+
Configure the MCP server for AI assistants (Claude Code, Cursor, etc.).
|
|
163
|
+
|
|
164
|
+
```bash
|
|
165
|
+
dotreq mcp-setup
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
### `dotreq mcp`
|
|
169
|
+
|
|
170
|
+
Start the MCP server manually (typically not needed—AI assistants start it automatically after `mcp-setup`).
|
|
171
|
+
|
|
172
|
+
```bash
|
|
173
|
+
dotreq mcp
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
---
|
|
177
|
+
|
|
178
|
+
## Test Harness
|
|
179
|
+
|
|
180
|
+
The test harness tracks which requirements are exercised by your tests.
|
|
181
|
+
|
|
182
|
+
### Setup with Vitest
|
|
183
|
+
|
|
184
|
+
**vitest.config.ts:**
|
|
185
|
+
|
|
186
|
+
```typescript
|
|
187
|
+
import { defineConfig } from 'vitest/config';
|
|
188
|
+
|
|
189
|
+
export default defineConfig({
|
|
190
|
+
test: {
|
|
191
|
+
globalSetup: './vitest.setup.ts',
|
|
192
|
+
},
|
|
193
|
+
});
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
**vitest.setup.ts:**
|
|
197
|
+
|
|
198
|
+
```typescript
|
|
199
|
+
import { prepare, finalize } from '@popoverai/dotrequirements/test';
|
|
200
|
+
|
|
201
|
+
// Named exports: Vitest calls setup() before tests, teardown() after
|
|
202
|
+
export function setup() {
|
|
203
|
+
prepare();
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
export async function teardown() {
|
|
207
|
+
await finalize();
|
|
208
|
+
}
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
Alternatively, you can use the default export pattern that returns a teardown function—see the [Vitest globalSetup docs](https://vitest.dev/config/globalsetup).
|
|
212
|
+
|
|
213
|
+
### Setup with Jest
|
|
214
|
+
|
|
215
|
+
**jest.config.cjs:**
|
|
216
|
+
|
|
217
|
+
```javascript
|
|
218
|
+
module.exports = {
|
|
219
|
+
globalSetup: './jest.setup.cjs',
|
|
220
|
+
globalTeardown: './jest.teardown.cjs',
|
|
221
|
+
};
|
|
222
|
+
```
|
|
223
|
+
|
|
224
|
+
**jest.setup.cjs:**
|
|
225
|
+
|
|
226
|
+
```javascript
|
|
227
|
+
const { prepare } = require('@popoverai/dotrequirements/test');
|
|
228
|
+
|
|
229
|
+
module.exports = async function setup() {
|
|
230
|
+
prepare();
|
|
231
|
+
};
|
|
232
|
+
```
|
|
233
|
+
|
|
234
|
+
**jest.teardown.cjs:**
|
|
235
|
+
|
|
236
|
+
```javascript
|
|
237
|
+
const { finalize } = require('@popoverai/dotrequirements/test');
|
|
238
|
+
|
|
239
|
+
module.exports = async function teardown() {
|
|
240
|
+
await finalize();
|
|
241
|
+
};
|
|
242
|
+
```
|
|
243
|
+
|
|
244
|
+
> **Note:** Jest global setup/teardown files run in a separate process from your tests. If using ES modules, configure Jest's `transform` option accordingly.
|
|
245
|
+
|
|
246
|
+
### Using `requirement()` in Tests
|
|
247
|
+
|
|
248
|
+
The `requirement()` function returns a formatted string for test descriptions and tracks coverage:
|
|
249
|
+
|
|
250
|
+
```typescript
|
|
251
|
+
import { requirement } from '@popoverai/dotrequirements/test';
|
|
252
|
+
|
|
253
|
+
// Reference root requirement
|
|
254
|
+
test(requirement('AUTH-LOGIN-1'), () => {
|
|
255
|
+
// Returns: "A registered user, Jamie, can log in to their account"
|
|
256
|
+
});
|
|
257
|
+
|
|
258
|
+
// Reference by numeric path
|
|
259
|
+
test(requirement('AUTH-LOGIN-1.0'), () => {
|
|
260
|
+
// Returns: "When Jamie provides a valid username and password..."
|
|
261
|
+
});
|
|
262
|
+
|
|
263
|
+
// Reference by label path (for requirements with labels)
|
|
264
|
+
test(requirement('AUTH-LOGIN-2.given'), () => {
|
|
265
|
+
// Returns: "Given: Jamie has two-factor authentication enabled on their account"
|
|
266
|
+
});
|
|
267
|
+
|
|
268
|
+
// Track multiple requirements in one test
|
|
269
|
+
test(requirement('AUTH-LOGIN-1', 'AUTH-SECURITY-1'), () => {
|
|
270
|
+
// Both requirements tracked; returns first one's content
|
|
271
|
+
});
|
|
272
|
+
```
|
|
273
|
+
|
|
274
|
+
### Path Reference Patterns
|
|
275
|
+
|
|
276
|
+
| Pattern | Example | Description |
|
|
277
|
+
|---------|---------|-------------|
|
|
278
|
+
| Root | `AUTH-LOGIN-1` | Root requirement |
|
|
279
|
+
| Numeric | `AUTH-LOGIN-1.0` | First child (position 0) |
|
|
280
|
+
| Numeric nested | `AUTH-LOGIN-1.2.0` | First child of third child |
|
|
281
|
+
| Label | `AUTH-LOGIN-2.given` | First "Given" criterion |
|
|
282
|
+
| Label disambiguated | `AUTH-LOGIN-2.given#1` | Second "Given" criterion |
|
|
283
|
+
| Label nested | `AUTH-LOGIN-2.then.and` | First "And" under first "Then" |
|
|
284
|
+
|
|
285
|
+
### Coverage Reporting
|
|
286
|
+
|
|
287
|
+
#### Local Report
|
|
288
|
+
|
|
289
|
+
After tests complete, a coverage summary prints to the console:
|
|
290
|
+
|
|
291
|
+
```
|
|
292
|
+
=== Requirements Coverage Report ===
|
|
293
|
+
Total Requirements: 12
|
|
294
|
+
Tested Requirements: 10
|
|
295
|
+
Untested Requirements: 2
|
|
296
|
+
Coverage: 83.3%
|
|
297
|
+
|
|
298
|
+
Tested:
|
|
299
|
+
✓ AUTH-LOGIN-1 (A registered user, Jamie, can log in to their account)
|
|
300
|
+
✓ AUTH-LOGIN-1.0 (When Jamie provides a valid username and password...)
|
|
301
|
+
...
|
|
302
|
+
|
|
303
|
+
Untested:
|
|
304
|
+
✗ AUTH-LOGIN-2
|
|
305
|
+
✗ AUTH-SECURITY-1
|
|
306
|
+
```
|
|
307
|
+
|
|
308
|
+
#### Cloud Reporting
|
|
309
|
+
|
|
310
|
+
With cloud credentials configured, coverage is automatically reported to dot•requirements cloud:
|
|
311
|
+
|
|
312
|
+
- Historical tracking of when requirements were last tested
|
|
313
|
+
- Branch-based coverage (tracks `main`, feature branches, etc.)
|
|
314
|
+
- Query coverage via the MCP server
|
|
315
|
+
|
|
316
|
+
Configure by adding to `.env.local`:
|
|
317
|
+
|
|
318
|
+
```bash
|
|
319
|
+
DOTREQUIREMENTS_PROJECT_ID=your-project-id
|
|
320
|
+
DOTREQUIREMENTS_PROJECT_SECRET=your-project-secret
|
|
321
|
+
```
|
|
322
|
+
|
|
323
|
+
Cloud reporting is fire-and-forget—it never blocks or fails your tests.
|
|
324
|
+
|
|
325
|
+
---
|
|
326
|
+
|
|
327
|
+
## Requirements File Format
|
|
328
|
+
|
|
329
|
+
Requirements use Markdown with YAML frontmatter and `dotrequirements` fenced code blocks.
|
|
330
|
+
|
|
331
|
+
### File Naming
|
|
332
|
+
|
|
333
|
+
Files must match the pattern `*.requirements.md`:
|
|
334
|
+
|
|
335
|
+
```
|
|
336
|
+
.requirements/
|
|
337
|
+
auth.requirements.md
|
|
338
|
+
checkout.requirements.md
|
|
339
|
+
|
|
340
|
+
src/components/
|
|
341
|
+
Button.requirements.md # Colocated with implementation
|
|
342
|
+
Button.tsx
|
|
343
|
+
```
|
|
344
|
+
|
|
345
|
+
### Structure
|
|
346
|
+
|
|
347
|
+
```markdown
|
|
348
|
+
---
|
|
349
|
+
projectId: my-project
|
|
350
|
+
version: 1
|
|
351
|
+
document:
|
|
352
|
+
id: unique-doc-id
|
|
353
|
+
title: "Document Title"
|
|
354
|
+
---
|
|
355
|
+
|
|
356
|
+
# Optional Markdown Content
|
|
357
|
+
|
|
358
|
+
You can include any Markdown here for context.
|
|
359
|
+
|
|
360
|
+
## Requirement Heading
|
|
361
|
+
|
|
362
|
+
```dotrequirements
|
|
363
|
+
AUTH-LOGIN-1: A registered user, Jamie, can log in to their account
|
|
364
|
+
0. → When Jamie provides valid credentials, they are authenticated
|
|
365
|
+
1. → When Jamie provides an incorrect password, they see an error
|
|
366
|
+
2. → When Jamie's account is deactivated, they see a status message
|
|
367
|
+
```
|
|
368
|
+
|
|
369
|
+
More Markdown content between requirements...
|
|
370
|
+
|
|
371
|
+
## Another Requirement (with labels)
|
|
372
|
+
|
|
373
|
+
```dotrequirements
|
|
374
|
+
AUTH-LOGIN-2: A user with two-factor auth must provide an OTP
|
|
375
|
+
0. Given → Jamie has two-factor authentication enabled
|
|
376
|
+
1. When → Jamie provides valid credentials
|
|
377
|
+
2. Then → Jamie is prompted to enter an OTP
|
|
378
|
+
```
|
|
379
|
+
```
|
|
380
|
+
|
|
381
|
+
### Format Details
|
|
382
|
+
|
|
383
|
+
- **Frontmatter**: YAML metadata (`projectId`, `version`, `document`)
|
|
384
|
+
- **Headings**: Optional documentation (not parsed as requirement data)
|
|
385
|
+
- **Fenced blocks**: `dotrequirements` blocks contain structured requirement data
|
|
386
|
+
- **First line**: `KEY: content` — the requirement identifier and summary
|
|
387
|
+
- **Criteria**: `position. → content` or `position. Label → content`
|
|
388
|
+
- **Arrow delimiter**: `→` (Unicode) or `->` (ASCII) both work
|
|
389
|
+
- **Labels**: Optional — use `Given`, `When`, `Then`, `And` if your team prefers BDD style
|
|
390
|
+
|
|
391
|
+
See [MARKDOWN_SCHEMA.md](https://github.com/PopoverAI/dotrequirements/blob/main/docs/reference/MARKDOWN_SCHEMA.md) for the complete specification.
|
|
392
|
+
|
|
393
|
+
---
|
|
394
|
+
|
|
395
|
+
## MCP Server
|
|
396
|
+
|
|
397
|
+
The package includes an MCP (Model Context Protocol) server for AI assistant integration. This enables AI coding assistants to search, validate, and work with your requirements.
|
|
398
|
+
|
|
399
|
+
### Setup
|
|
400
|
+
|
|
401
|
+
```bash
|
|
402
|
+
dotreq mcp-setup
|
|
403
|
+
```
|
|
404
|
+
|
|
405
|
+
Follow the prompts to configure for your AI assistant (Claude Code, Cursor, etc.).
|
|
406
|
+
|
|
407
|
+
### Available Tools
|
|
408
|
+
|
|
409
|
+
**Exploration:**
|
|
410
|
+
- `search_requirements` — Search by text or regex
|
|
411
|
+
- `get_requirement` — Get a requirement with its children and coverage
|
|
412
|
+
- `list_all_requirements` — List all requirements in the project
|
|
413
|
+
- `list_untested_requirements` — Find requirements without test coverage
|
|
414
|
+
- `get_requirements_by_test` — Get requirements referenced by a test file
|
|
415
|
+
- `get_tests_by_requirement` — Get tests that reference a requirement
|
|
416
|
+
|
|
417
|
+
**Authoring:**
|
|
418
|
+
- `create_requirement_document` — Get a Markdown template with format examples
|
|
419
|
+
- `validate_requirements` — Validate file schema (works offline)
|
|
420
|
+
- `style_check` — AI-powered style feedback on requirements
|
|
421
|
+
- `review_test` — Comprehensive test review (style + semantic correctness)
|
|
422
|
+
|
|
423
|
+
**Cloud:**
|
|
424
|
+
- `push_requirements` — Push to dot•requirements cloud
|
|
425
|
+
- `get_requirement_coverage` — Query coverage data
|
|
426
|
+
- `get_project_coverage_summary` — Project-wide coverage stats
|
|
427
|
+
|
|
428
|
+
**Diagnostic:**
|
|
429
|
+
- `debug_mcp_environment` — Debug MCP server configuration
|
|
430
|
+
|
|
431
|
+
---
|
|
432
|
+
|
|
433
|
+
## Package Exports
|
|
434
|
+
|
|
435
|
+
```typescript
|
|
436
|
+
// CLI (main entry point)
|
|
437
|
+
import '@popoverai/dotrequirements';
|
|
438
|
+
|
|
439
|
+
// Test harness
|
|
440
|
+
import { requirement, prepare, finalize } from '@popoverai/dotrequirements/test';
|
|
441
|
+
|
|
442
|
+
// Schema utilities
|
|
443
|
+
import { parseRequirementsFile, validateRequirementsFile } from '@popoverai/dotrequirements/schema';
|
|
444
|
+
|
|
445
|
+
// Browser-compatible schema (no Node.js dependencies)
|
|
446
|
+
import { parseRequirementBlock } from '@popoverai/dotrequirements/schema/browser';
|
|
447
|
+
|
|
448
|
+
// MCP server
|
|
449
|
+
import '@popoverai/dotrequirements/mcp';
|
|
450
|
+
```
|
|
451
|
+
|
|
452
|
+
---
|
|
453
|
+
|
|
454
|
+
## Configuration
|
|
455
|
+
|
|
456
|
+
The CLI stores configuration in `.env.local`:
|
|
457
|
+
|
|
458
|
+
```bash
|
|
459
|
+
# Project credentials (from dotreq init or login)
|
|
460
|
+
DOTREQUIREMENTS_PROJECT_ID=your-project-id
|
|
461
|
+
DOTREQUIREMENTS_PROJECT_SECRET=your-project-secret
|
|
462
|
+
```
|
|
463
|
+
|
|
464
|
+
The `.env.local` file is automatically added to `.gitignore` during initialization.
|
|
465
|
+
|
|
466
|
+
---
|
|
467
|
+
|
|
468
|
+
## Links
|
|
469
|
+
|
|
470
|
+
- [Documentation](https://docs.dotrequirements.io)
|
|
471
|
+
- [Getting Started Guide](https://docs.dotrequirements.io/getting-started)
|
|
472
|
+
- [Support](mailto:support@popover.ca)
|
|
473
|
+
|
|
474
|
+
---
|
|
475
|
+
|
|
476
|
+
## License
|
|
477
|
+
|
|
478
|
+
MIT
|
package/dist/cli.d.ts
ADDED
package/dist/cli.js
ADDED
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { Command } from 'commander';
|
|
3
|
+
import { initCommand } from './commands/init.js';
|
|
4
|
+
import { linkCommand } from './commands/link.js';
|
|
5
|
+
import { pullCommand } from './commands/pull.js';
|
|
6
|
+
import { pushCommand } from './commands/push.js';
|
|
7
|
+
import { testCommand } from './commands/test.js';
|
|
8
|
+
import { mcpCommand } from './commands/mcp.js';
|
|
9
|
+
import { mcpSetupCommand } from './commands/mcp-setup.js';
|
|
10
|
+
import { loginCommand } from './commands/login.js';
|
|
11
|
+
import { logoutCommand } from './commands/logout.js';
|
|
12
|
+
import { loadEnvFile } from './utils/env.js';
|
|
13
|
+
// Load environment variables from .env.local if it exists
|
|
14
|
+
loadEnvFile();
|
|
15
|
+
/**
|
|
16
|
+
* Wrap command handlers to catch errors and display them cleanly
|
|
17
|
+
* without showing stack traces to users
|
|
18
|
+
*/
|
|
19
|
+
function wrapCommand(fn) {
|
|
20
|
+
return async (...args) => {
|
|
21
|
+
try {
|
|
22
|
+
await fn(...args);
|
|
23
|
+
}
|
|
24
|
+
catch (error) {
|
|
25
|
+
if (error instanceof Error) {
|
|
26
|
+
console.error(`\nError: ${error.message}\n`);
|
|
27
|
+
}
|
|
28
|
+
else {
|
|
29
|
+
console.error(`\nError: ${String(error)}\n`);
|
|
30
|
+
}
|
|
31
|
+
process.exit(1);
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
const program = new Command();
|
|
36
|
+
program
|
|
37
|
+
.name('dotrequirements')
|
|
38
|
+
.description('Requirements tracking CLI with test harness and MCP server')
|
|
39
|
+
.version('0.1.0');
|
|
40
|
+
program
|
|
41
|
+
.command('init')
|
|
42
|
+
.description('Initialize a new dotrequirements project')
|
|
43
|
+
.option('-n, --name <name>', 'Project name (defaults to package.json name or directory name)')
|
|
44
|
+
.action(wrapCommand(initCommand));
|
|
45
|
+
program
|
|
46
|
+
.command('link')
|
|
47
|
+
.description('Link local environment to an existing project')
|
|
48
|
+
.action(wrapCommand(linkCommand));
|
|
49
|
+
program
|
|
50
|
+
.command('pull')
|
|
51
|
+
.description('Sync requirements from cloud to local .requirements/ files')
|
|
52
|
+
.option('-p, --project <id>', 'Project ID to sync')
|
|
53
|
+
.option('-d, --document <id>', 'Specific document ID to sync')
|
|
54
|
+
.action(wrapCommand(pullCommand));
|
|
55
|
+
program
|
|
56
|
+
.command('push [file]')
|
|
57
|
+
.description('Push local requirements from .requirements/ to cloud')
|
|
58
|
+
.option('-y, --yes', 'Skip confirmation prompt')
|
|
59
|
+
.action(wrapCommand(pushCommand));
|
|
60
|
+
program
|
|
61
|
+
.command('test')
|
|
62
|
+
.description('Validate requirements files in .requirements/')
|
|
63
|
+
.option('-f, --file <path>', 'Specific file to validate')
|
|
64
|
+
.action(wrapCommand(testCommand));
|
|
65
|
+
program
|
|
66
|
+
.command('mcp')
|
|
67
|
+
.description('Start the MCP (Model Context Protocol) server for AI assistant integration')
|
|
68
|
+
.action(wrapCommand(mcpCommand));
|
|
69
|
+
program
|
|
70
|
+
.command('mcp-setup')
|
|
71
|
+
.description('Configure MCP server for your AI assistant (Claude Code, Claude Desktop, etc.)')
|
|
72
|
+
.action(wrapCommand(mcpSetupCommand));
|
|
73
|
+
program
|
|
74
|
+
.command('login')
|
|
75
|
+
.description('Authenticate with dot•requirements and enable cloud features')
|
|
76
|
+
.action(wrapCommand(loginCommand));
|
|
77
|
+
program
|
|
78
|
+
.command('logout')
|
|
79
|
+
.description('Clear stored authentication tokens')
|
|
80
|
+
.action(wrapCommand(logoutCommand));
|
|
81
|
+
program.parse();
|
|
82
|
+
//# sourceMappingURL=cli.js.map
|