@popoverai/dotrequirements 0.21.0 → 0.21.1
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/dist/commands/mcp-setup.js +10 -5
- package/dist/templates/context-file-section.md +2 -1
- package/dist/templates/example-requirements.js +11 -11
- package/dist/templates/example-requirements.ts +11 -11
- package/dist/utils/context-file.d.ts +8 -0
- package/dist/utils/context-file.js +19 -0
- package/package.json +1 -1
|
@@ -5,7 +5,7 @@ import { join } from 'path';
|
|
|
5
5
|
import prompts from 'prompts';
|
|
6
6
|
import { loadTemplate } from '../utils/templates.js';
|
|
7
7
|
import { brand } from '../utils/brand.js';
|
|
8
|
-
import { getContextFileName,
|
|
8
|
+
import { getContextFileName, findGitRoot, findDotrequirementsSection, appendOrUpdateSection, buildNoGitRepoMessage, } from '../utils/context-file.js';
|
|
9
9
|
/**
|
|
10
10
|
* Load the context file section template
|
|
11
11
|
*/
|
|
@@ -16,12 +16,17 @@ function loadContextFileSection() {
|
|
|
16
16
|
* Install workflow guidance to the appropriate context file for a platform
|
|
17
17
|
*/
|
|
18
18
|
async function installContextFileSection(platform) {
|
|
19
|
-
const
|
|
20
|
-
if (!
|
|
21
|
-
console.error(`\n❌
|
|
19
|
+
const fileName = getContextFileName(platform);
|
|
20
|
+
if (!fileName) {
|
|
21
|
+
console.error(`\n❌ Unknown platform: ${platform}`);
|
|
22
22
|
return;
|
|
23
23
|
}
|
|
24
|
-
const
|
|
24
|
+
const gitRoot = await findGitRoot();
|
|
25
|
+
if (!gitRoot) {
|
|
26
|
+
console.log('\n' + buildNoGitRepoMessage(fileName) + '\n');
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
const contextFilePath = join(gitRoot, fileName);
|
|
25
30
|
const sectionContent = loadContextFileSection();
|
|
26
31
|
// Check if file exists and has existing section
|
|
27
32
|
let existingSection = null;
|
|
@@ -21,7 +21,7 @@ requirements, so your plan should too.
|
|
|
21
21
|
### Requirements Syntax
|
|
22
22
|
|
|
23
23
|
```dotrequirements
|
|
24
|
-
|
|
24
|
+
DOMAIN-1: Short description of expected behavior
|
|
25
25
|
0. -> First criterion or condition
|
|
26
26
|
1. -> Second criterion
|
|
27
27
|
1.0. -> Nested detail under second criterion
|
|
@@ -31,6 +31,7 @@ REQ-ID: Short description of expected behavior
|
|
|
31
31
|
- Criteria: `position. -> content` (optional label before the arrow)
|
|
32
32
|
- Nesting: Indent with 2 spaces, use `x.y` position paths
|
|
33
33
|
- Delimiter: `->` or `→`
|
|
34
|
+
- **Key style**: Use sequential keys with a short domain prefix (`ORCHESTRATOR-1`, `ORCHESTRATOR-2`, ...) rather than semantic keys (`AUTONOMOUS-ADVANCE`). Sequential keys stay stable when a requirement gets reworded, so test references don't break. Call `create_requirement_document` for full key-naming guidance.
|
|
34
35
|
|
|
35
36
|
### Test Usage
|
|
36
37
|
|
|
@@ -18,15 +18,15 @@ document:
|
|
|
18
18
|
|
|
19
19
|
This file demonstrates the dotrequirements format. Feel free to edit or delete it.
|
|
20
20
|
|
|
21
|
-
##
|
|
21
|
+
## HOWTO-1: How to use dotrequirements
|
|
22
22
|
|
|
23
23
|
\`\`\`dotrequirements
|
|
24
|
-
|
|
25
|
-
0. → Requirements live here and are referenced by index, like requirement('
|
|
26
|
-
1. Labels → Anything before the arrow is a label. You can reference a requirement by its index or its label: requirement('
|
|
27
|
-
2. Labels → Repeated labels can be referenced sequentially: requirement('
|
|
28
|
-
2.0. Nesting → You can keep nesting. Label references don't need to be nested: requirement('
|
|
29
|
-
2.1. Several words → Reference multi-word labels using kebab-case. Label references are never case sensitive: requirement('
|
|
24
|
+
HOWTO-1: How to use dotrequirements
|
|
25
|
+
0. → Requirements live here and are referenced by index, like requirement('HOWTO-1.0')
|
|
26
|
+
1. Labels → Anything before the arrow is a label. You can reference a requirement by its index or its label: requirement('HOWTO-1.1') == requirement('HOWTO-1.labels')
|
|
27
|
+
2. Labels → Repeated labels can be referenced sequentially: requirement('HOWTO-1.labels#2')
|
|
28
|
+
2.0. Nesting → You can keep nesting. Label references don't need to be nested: requirement('HOWTO-1.nesting').
|
|
29
|
+
2.1. Several words → Reference multi-word labels using kebab-case. Label references are never case sensitive: requirement('HOWTO-1.several-words')
|
|
30
30
|
3. → While you _can_ write your requirements longhand in this format, there are a number of better ways.
|
|
31
31
|
3.0. MCP → The dotrequirements MCP equips an AI assistant to develop requirements with you
|
|
32
32
|
3.1. Your current tools → Dotrequirements has a composer for Jira, Confluence, and Notion
|
|
@@ -36,12 +36,12 @@ HOW-TO: How to use dotrequirements
|
|
|
36
36
|
|
|
37
37
|
---
|
|
38
38
|
|
|
39
|
-
##
|
|
39
|
+
## AUTH-1: User authentication flow
|
|
40
40
|
|
|
41
41
|
**Implementation notes:** Use bcrypt for password hashing with work factor >= 12.
|
|
42
42
|
|
|
43
43
|
\`\`\`dotrequirements
|
|
44
|
-
|
|
44
|
+
AUTH-1: User authentication flow
|
|
45
45
|
0. AC → Login form accepts email and password
|
|
46
46
|
1. AC → Invalid credentials show error message
|
|
47
47
|
2. Edge-case → Rate limiting after 5 failed attempts
|
|
@@ -71,11 +71,11 @@ import { requirement } from '@popoverai/dotrequirements/test';
|
|
|
71
71
|
|
|
72
72
|
test('login with valid credentials', () => {
|
|
73
73
|
// Reference by numeric path
|
|
74
|
-
const ac = requirement('
|
|
74
|
+
const ac = requirement('AUTH-1.0');
|
|
75
75
|
// Returns: "AC: Login form accepts email and password"
|
|
76
76
|
|
|
77
77
|
// Reference by label
|
|
78
|
-
const edgeCase = requirement('
|
|
78
|
+
const edgeCase = requirement('AUTH-1.edge-case');
|
|
79
79
|
// Returns: "Edge-case: Rate limiting after 5 failed attempts"
|
|
80
80
|
|
|
81
81
|
// Your test implementation...
|
|
@@ -19,15 +19,15 @@ document:
|
|
|
19
19
|
|
|
20
20
|
This file demonstrates the dotrequirements format. Feel free to edit or delete it.
|
|
21
21
|
|
|
22
|
-
##
|
|
22
|
+
## HOWTO-1: How to use dotrequirements
|
|
23
23
|
|
|
24
24
|
\`\`\`dotrequirements
|
|
25
|
-
|
|
26
|
-
0. → Requirements live here and are referenced by index, like requirement('
|
|
27
|
-
1. Labels → Anything before the arrow is a label. You can reference a requirement by its index or its label: requirement('
|
|
28
|
-
2. Labels → Repeated labels can be referenced sequentially: requirement('
|
|
29
|
-
2.0. Nesting → You can keep nesting. Label references don't need to be nested: requirement('
|
|
30
|
-
2.1. Several words → Reference multi-word labels using kebab-case. Label references are never case sensitive: requirement('
|
|
25
|
+
HOWTO-1: How to use dotrequirements
|
|
26
|
+
0. → Requirements live here and are referenced by index, like requirement('HOWTO-1.0')
|
|
27
|
+
1. Labels → Anything before the arrow is a label. You can reference a requirement by its index or its label: requirement('HOWTO-1.1') == requirement('HOWTO-1.labels')
|
|
28
|
+
2. Labels → Repeated labels can be referenced sequentially: requirement('HOWTO-1.labels#2')
|
|
29
|
+
2.0. Nesting → You can keep nesting. Label references don't need to be nested: requirement('HOWTO-1.nesting').
|
|
30
|
+
2.1. Several words → Reference multi-word labels using kebab-case. Label references are never case sensitive: requirement('HOWTO-1.several-words')
|
|
31
31
|
3. → While you _can_ write your requirements longhand in this format, there are a number of better ways.
|
|
32
32
|
3.0. MCP → The dotrequirements MCP equips an AI assistant to develop requirements with you
|
|
33
33
|
3.1. Your current tools → Dotrequirements has a composer for Jira, Confluence, and Notion
|
|
@@ -37,12 +37,12 @@ HOW-TO: How to use dotrequirements
|
|
|
37
37
|
|
|
38
38
|
---
|
|
39
39
|
|
|
40
|
-
##
|
|
40
|
+
## AUTH-1: User authentication flow
|
|
41
41
|
|
|
42
42
|
**Implementation notes:** Use bcrypt for password hashing with work factor >= 12.
|
|
43
43
|
|
|
44
44
|
\`\`\`dotrequirements
|
|
45
|
-
|
|
45
|
+
AUTH-1: User authentication flow
|
|
46
46
|
0. AC → Login form accepts email and password
|
|
47
47
|
1. AC → Invalid credentials show error message
|
|
48
48
|
2. Edge-case → Rate limiting after 5 failed attempts
|
|
@@ -72,11 +72,11 @@ import { requirement } from '@popoverai/dotrequirements/test';
|
|
|
72
72
|
|
|
73
73
|
test('login with valid credentials', () => {
|
|
74
74
|
// Reference by numeric path
|
|
75
|
-
const ac = requirement('
|
|
75
|
+
const ac = requirement('AUTH-1.0');
|
|
76
76
|
// Returns: "AC: Login form accepts email and password"
|
|
77
77
|
|
|
78
78
|
// Reference by label
|
|
79
|
-
const edgeCase = requirement('
|
|
79
|
+
const edgeCase = requirement('AUTH-1.edge-case');
|
|
80
80
|
// Returns: "Edge-case: Rate limiting after 5 failed attempts"
|
|
81
81
|
|
|
82
82
|
// Your test implementation...
|
|
@@ -35,4 +35,12 @@ export declare function appendOrUpdateSection(filePath: string, sectionContent:
|
|
|
35
35
|
* Get the full path to the context file for a platform
|
|
36
36
|
*/
|
|
37
37
|
export declare function getContextFilePath(platform: string): Promise<string | null>;
|
|
38
|
+
/**
|
|
39
|
+
* Build a user-facing message explaining that context file installation
|
|
40
|
+
* was skipped because the current directory is not inside a git repository.
|
|
41
|
+
*
|
|
42
|
+
* The MCP server itself is configured separately, so this message is only
|
|
43
|
+
* about the second step (writing the platform's context file).
|
|
44
|
+
*/
|
|
45
|
+
export declare function buildNoGitRepoMessage(fileName: string): string;
|
|
38
46
|
//# sourceMappingURL=context-file.d.ts.map
|
|
@@ -91,4 +91,23 @@ export async function getContextFilePath(platform) {
|
|
|
91
91
|
return null;
|
|
92
92
|
return join(gitRoot, fileName);
|
|
93
93
|
}
|
|
94
|
+
/**
|
|
95
|
+
* Build a user-facing message explaining that context file installation
|
|
96
|
+
* was skipped because the current directory is not inside a git repository.
|
|
97
|
+
*
|
|
98
|
+
* The MCP server itself is configured separately, so this message is only
|
|
99
|
+
* about the second step (writing the platform's context file).
|
|
100
|
+
*/
|
|
101
|
+
export function buildNoGitRepoMessage(fileName) {
|
|
102
|
+
return [
|
|
103
|
+
`⚠️ Skipped writing ${fileName}: not inside a git repository.`,
|
|
104
|
+
` ${fileName} would have been created at the git repo root, but no .git directory was found.`,
|
|
105
|
+
'',
|
|
106
|
+
' To finish setup, either:',
|
|
107
|
+
' • run `git init` here, then re-run `dotreq mcp-setup`, or',
|
|
108
|
+
' • `cd` into an existing project directory and run `dotreq mcp-setup` there.',
|
|
109
|
+
'',
|
|
110
|
+
' Note: the MCP server itself was configured successfully — only the context file step was skipped.',
|
|
111
|
+
].join('\n');
|
|
112
|
+
}
|
|
94
113
|
//# sourceMappingURL=context-file.js.map
|