@specsafe/core 0.4.0 → 0.6.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/dist/agents/adapters/base.d.ts +44 -0
- package/dist/agents/adapters/base.d.ts.map +1 -0
- package/dist/agents/adapters/base.js +164 -0
- package/dist/agents/adapters/base.js.map +1 -0
- package/dist/agents/adapters/claude-code.d.ts +14 -0
- package/dist/agents/adapters/claude-code.d.ts.map +1 -0
- package/dist/agents/adapters/claude-code.js +120 -0
- package/dist/agents/adapters/claude-code.js.map +1 -0
- package/dist/agents/adapters/copilot.d.ts +13 -0
- package/dist/agents/adapters/copilot.d.ts.map +1 -0
- package/dist/agents/adapters/copilot.js +115 -0
- package/dist/agents/adapters/copilot.js.map +1 -0
- package/dist/agents/adapters/cursor.d.ts +13 -0
- package/dist/agents/adapters/cursor.d.ts.map +1 -0
- package/dist/agents/adapters/cursor.js +105 -0
- package/dist/agents/adapters/cursor.js.map +1 -0
- package/dist/agents/adapters/gemini-cli.d.ts +13 -0
- package/dist/agents/adapters/gemini-cli.d.ts.map +1 -0
- package/dist/agents/adapters/gemini-cli.js +79 -0
- package/dist/agents/adapters/gemini-cli.js.map +1 -0
- package/dist/agents/adapters/index.d.ts +16 -0
- package/dist/agents/adapters/index.d.ts.map +1 -0
- package/dist/agents/adapters/index.js +47 -0
- package/dist/agents/adapters/index.js.map +1 -0
- package/dist/agents/adapters/opencode.d.ts +13 -0
- package/dist/agents/adapters/opencode.d.ts.map +1 -0
- package/dist/agents/adapters/opencode.js +67 -0
- package/dist/agents/adapters/opencode.js.map +1 -0
- package/dist/agents/index.d.ts +8 -0
- package/dist/agents/index.d.ts.map +1 -0
- package/dist/agents/index.js +9 -0
- package/dist/agents/index.js.map +1 -0
- package/dist/agents/registry.d.ts +70 -0
- package/dist/agents/registry.d.ts.map +1 -0
- package/dist/agents/registry.js +194 -0
- package/dist/agents/registry.js.map +1 -0
- package/dist/agents/types.d.ts +71 -0
- package/dist/agents/types.d.ts.map +1 -0
- package/dist/agents/types.js +6 -0
- package/dist/agents/types.js.map +1 -0
- package/dist/delta/merger.d.ts +36 -0
- package/dist/delta/merger.d.ts.map +1 -0
- package/dist/delta/merger.js +264 -0
- package/dist/delta/merger.js.map +1 -0
- package/dist/delta/parser.d.ts +27 -0
- package/dist/delta/parser.d.ts.map +1 -0
- package/dist/delta/parser.js +196 -0
- package/dist/delta/parser.js.map +1 -0
- package/dist/delta/types.d.ts +39 -0
- package/dist/delta/types.d.ts.map +1 -0
- package/dist/delta/types.js +6 -0
- package/dist/delta/types.js.map +1 -0
- package/dist/ears/index.d.ts +11 -0
- package/dist/ears/index.d.ts.map +1 -0
- package/dist/ears/index.js +11 -0
- package/dist/ears/index.js.map +1 -0
- package/dist/ears/parser.d.ts +22 -0
- package/dist/ears/parser.d.ts.map +1 -0
- package/dist/ears/parser.js +273 -0
- package/dist/ears/parser.js.map +1 -0
- package/dist/ears/template.d.ts +20 -0
- package/dist/ears/template.d.ts.map +1 -0
- package/dist/ears/template.js +364 -0
- package/dist/ears/template.js.map +1 -0
- package/dist/ears/types.d.ts +58 -0
- package/dist/ears/types.d.ts.map +1 -0
- package/dist/ears/types.js +6 -0
- package/dist/ears/types.js.map +1 -0
- package/dist/ears/validator.d.ts +37 -0
- package/dist/ears/validator.d.ts.map +1 -0
- package/dist/ears/validator.js +234 -0
- package/dist/ears/validator.js.map +1 -0
- package/dist/elicitation/engine.d.ts +75 -0
- package/dist/elicitation/engine.d.ts.map +1 -0
- package/dist/elicitation/engine.js +174 -0
- package/dist/elicitation/engine.js.map +1 -0
- package/dist/elicitation/flows.d.ts +18 -0
- package/dist/elicitation/flows.d.ts.map +1 -0
- package/dist/elicitation/flows.js +331 -0
- package/dist/elicitation/flows.js.map +1 -0
- package/dist/elicitation/generator.d.ts +20 -0
- package/dist/elicitation/generator.d.ts.map +1 -0
- package/dist/elicitation/generator.js +260 -0
- package/dist/elicitation/generator.js.map +1 -0
- package/dist/elicitation/index.d.ts +27 -0
- package/dist/elicitation/index.d.ts.map +1 -0
- package/dist/elicitation/index.js +29 -0
- package/dist/elicitation/index.js.map +1 -0
- package/dist/elicitation/types.d.ts +69 -0
- package/dist/elicitation/types.d.ts.map +1 -0
- package/dist/elicitation/types.js +6 -0
- package/dist/elicitation/types.js.map +1 -0
- package/dist/extensions/builtins/complexity.d.ts +7 -0
- package/dist/extensions/builtins/complexity.d.ts.map +1 -0
- package/dist/extensions/builtins/complexity.js +97 -0
- package/dist/extensions/builtins/complexity.js.map +1 -0
- package/dist/extensions/builtins/owasp.d.ts +7 -0
- package/dist/extensions/builtins/owasp.d.ts.map +1 -0
- package/dist/extensions/builtins/owasp.js +76 -0
- package/dist/extensions/builtins/owasp.js.map +1 -0
- package/dist/extensions/index.d.ts +54 -0
- package/dist/extensions/index.d.ts.map +1 -0
- package/dist/extensions/index.js +72 -0
- package/dist/extensions/index.js.map +1 -0
- package/dist/extensions/loader.d.ts +28 -0
- package/dist/extensions/loader.d.ts.map +1 -0
- package/dist/extensions/loader.js +62 -0
- package/dist/extensions/loader.js.map +1 -0
- package/dist/extensions/registry.d.ts +74 -0
- package/dist/extensions/registry.d.ts.map +1 -0
- package/dist/extensions/registry.js +159 -0
- package/dist/extensions/registry.js.map +1 -0
- package/dist/extensions/types.d.ts +70 -0
- package/dist/extensions/types.d.ts.map +1 -0
- package/dist/extensions/types.js +2 -0
- package/dist/extensions/types.js.map +1 -0
- package/dist/governance/builtins.d.ts +7 -0
- package/dist/governance/builtins.d.ts.map +1 -0
- package/dist/governance/builtins.js +105 -0
- package/dist/governance/builtins.js.map +1 -0
- package/dist/governance/constitution.d.ts +23 -0
- package/dist/governance/constitution.d.ts.map +1 -0
- package/dist/governance/constitution.js +245 -0
- package/dist/governance/constitution.js.map +1 -0
- package/dist/governance/index.d.ts +3 -0
- package/dist/governance/index.d.ts.map +1 -0
- package/dist/governance/index.js +2 -0
- package/dist/governance/index.js.map +1 -0
- package/dist/governance/template.d.ts +12 -0
- package/dist/governance/template.d.ts.map +1 -0
- package/dist/governance/template.js +84 -0
- package/dist/governance/template.js.map +1 -0
- package/dist/governance/types.d.ts +64 -0
- package/dist/governance/types.d.ts.map +1 -0
- package/dist/governance/types.js +2 -0
- package/dist/governance/types.js.map +1 -0
- package/dist/index.d.ts +23 -18
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +17 -18
- package/dist/index.js.map +1 -1
- package/dist/templates/checklist.d.ts +7 -0
- package/dist/templates/checklist.d.ts.map +1 -0
- package/dist/templates/checklist.js +131 -0
- package/dist/templates/checklist.js.map +1 -0
- package/dist/templates/delta-template.d.ts +18 -0
- package/dist/templates/delta-template.d.ts.map +1 -0
- package/dist/templates/delta-template.js +191 -0
- package/dist/templates/delta-template.js.map +1 -0
- package/dist/templates/engine.d.ts +20 -0
- package/dist/templates/engine.d.ts.map +1 -0
- package/dist/templates/engine.js +187 -0
- package/dist/templates/engine.js.map +1 -0
- package/dist/templates/types.d.ts +67 -0
- package/dist/templates/types.d.ts.map +1 -0
- package/dist/templates/types.js +5 -0
- package/dist/templates/types.js.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Semantic Merger
|
|
3
|
+
* Applies delta specs to base specs at the requirement level
|
|
4
|
+
*/
|
|
5
|
+
import type { DeltaSpec, MergeResult } from './types.js';
|
|
6
|
+
export declare class SemanticMerger {
|
|
7
|
+
/**
|
|
8
|
+
* Apply a delta spec to a base spec
|
|
9
|
+
*/
|
|
10
|
+
merge(baseContent: string, deltaSpec: DeltaSpec): MergeResult;
|
|
11
|
+
/**
|
|
12
|
+
* Parse requirements from spec content
|
|
13
|
+
*/
|
|
14
|
+
private parseRequirements;
|
|
15
|
+
/**
|
|
16
|
+
* Format a requirement for insertion
|
|
17
|
+
*/
|
|
18
|
+
private formatRequirement;
|
|
19
|
+
/**
|
|
20
|
+
* Remove a requirement block from content
|
|
21
|
+
*/
|
|
22
|
+
private removeRequirementBlock;
|
|
23
|
+
/**
|
|
24
|
+
* Replace a requirement block in content
|
|
25
|
+
*/
|
|
26
|
+
private replaceRequirementBlock;
|
|
27
|
+
/**
|
|
28
|
+
* Insert a requirement block after the requirements section
|
|
29
|
+
*/
|
|
30
|
+
private insertRequirementBlock;
|
|
31
|
+
/**
|
|
32
|
+
* Preview the changes without applying them
|
|
33
|
+
*/
|
|
34
|
+
diff(baseContent: string, deltaSpec: DeltaSpec): string;
|
|
35
|
+
}
|
|
36
|
+
//# sourceMappingURL=merger.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"merger.d.ts","sourceRoot":"","sources":["../../src/delta/merger.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,WAAW,EAA6B,MAAM,YAAY,CAAC;AAUpF,qBAAa,cAAc;IACzB;;OAEG;IACH,KAAK,CAAC,WAAW,EAAE,MAAM,EAAE,SAAS,EAAE,SAAS,GAAG,WAAW;IA8G7D;;OAEG;IACH,OAAO,CAAC,iBAAiB;IA0FzB;;OAEG;IACH,OAAO,CAAC,iBAAiB;IAazB;;OAEG;IACH,OAAO,CAAC,sBAAsB;IAM9B;;OAEG;IACH,OAAO,CAAC,uBAAuB;IAW/B;;OAEG;IACH,OAAO,CAAC,sBAAsB;IA2B9B;;OAEG;IACH,IAAI,CAAC,WAAW,EAAE,MAAM,EAAE,SAAS,EAAE,SAAS,GAAG,MAAM;CAkCxD"}
|
|
@@ -0,0 +1,264 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Semantic Merger
|
|
3
|
+
* Applies delta specs to base specs at the requirement level
|
|
4
|
+
*/
|
|
5
|
+
export class SemanticMerger {
|
|
6
|
+
/**
|
|
7
|
+
* Apply a delta spec to a base spec
|
|
8
|
+
*/
|
|
9
|
+
merge(baseContent, deltaSpec) {
|
|
10
|
+
const conflicts = [];
|
|
11
|
+
const stats = {
|
|
12
|
+
added: 0,
|
|
13
|
+
modified: 0,
|
|
14
|
+
removed: 0,
|
|
15
|
+
conflicts: 0
|
|
16
|
+
};
|
|
17
|
+
let content = baseContent;
|
|
18
|
+
// Parse requirements from base spec
|
|
19
|
+
const requirements = this.parseRequirements(content);
|
|
20
|
+
const requirementMap = new Map(requirements.map(r => [r.id, r]));
|
|
21
|
+
// Sort removals by startLine descending to avoid stale indices
|
|
22
|
+
const removalsToProcess = deltaSpec.removed
|
|
23
|
+
.map(id => ({ id, req: requirementMap.get(id) }))
|
|
24
|
+
.filter((item) => item.req !== undefined)
|
|
25
|
+
.sort((a, b) => b.req.startLine - a.req.startLine);
|
|
26
|
+
// Apply REMOVED requirements
|
|
27
|
+
for (const { id, req } of removalsToProcess) {
|
|
28
|
+
// Remove the entire requirement block
|
|
29
|
+
content = this.removeRequirementBlock(content, req);
|
|
30
|
+
requirementMap.delete(id);
|
|
31
|
+
stats.removed++;
|
|
32
|
+
}
|
|
33
|
+
// Track conflicts for removed requirements not found
|
|
34
|
+
for (const id of deltaSpec.removed) {
|
|
35
|
+
if (!removalsToProcess.find(item => item.id === id)) {
|
|
36
|
+
conflicts.push({
|
|
37
|
+
type: 'requirement_not_found',
|
|
38
|
+
requirementId: id,
|
|
39
|
+
message: `Cannot remove requirement ${id}: not found in base spec`
|
|
40
|
+
});
|
|
41
|
+
stats.conflicts++;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
// Re-parse content after removals to rebuild requirementMap with updated line numbers
|
|
45
|
+
const updatedRequirements = this.parseRequirements(content);
|
|
46
|
+
requirementMap.clear();
|
|
47
|
+
for (const req of updatedRequirements) {
|
|
48
|
+
requirementMap.set(req.id, req);
|
|
49
|
+
}
|
|
50
|
+
// Sort modifications by startLine descending to avoid stale indices
|
|
51
|
+
const modificationsToProcess = deltaSpec.modified
|
|
52
|
+
.map(modReq => ({ modReq, oldReq: requirementMap.get(modReq.id) }))
|
|
53
|
+
.filter((item) => item.oldReq !== undefined)
|
|
54
|
+
.sort((a, b) => b.oldReq.startLine - a.oldReq.startLine);
|
|
55
|
+
// Apply MODIFIED requirements
|
|
56
|
+
for (const { modReq, oldReq } of modificationsToProcess) {
|
|
57
|
+
const newReqBlock = this.formatRequirement(modReq);
|
|
58
|
+
content = this.replaceRequirementBlock(content, oldReq, newReqBlock);
|
|
59
|
+
// Update map with new requirement
|
|
60
|
+
requirementMap.set(modReq.id, {
|
|
61
|
+
id: modReq.id,
|
|
62
|
+
text: modReq.text,
|
|
63
|
+
priority: modReq.priority || oldReq.priority,
|
|
64
|
+
startLine: oldReq.startLine,
|
|
65
|
+
endLine: oldReq.endLine
|
|
66
|
+
});
|
|
67
|
+
stats.modified++;
|
|
68
|
+
}
|
|
69
|
+
// Track conflicts for modified requirements not found
|
|
70
|
+
for (const modReq of deltaSpec.modified) {
|
|
71
|
+
if (!modificationsToProcess.find(item => item.modReq.id === modReq.id)) {
|
|
72
|
+
conflicts.push({
|
|
73
|
+
type: 'requirement_not_found',
|
|
74
|
+
requirementId: modReq.id,
|
|
75
|
+
message: `Cannot modify requirement ${modReq.id}: not found in base spec`
|
|
76
|
+
});
|
|
77
|
+
stats.conflicts++;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
// Apply ADDED requirements
|
|
81
|
+
for (const addReq of deltaSpec.added) {
|
|
82
|
+
if (requirementMap.has(addReq.id)) {
|
|
83
|
+
conflicts.push({
|
|
84
|
+
type: 'duplicate_add',
|
|
85
|
+
requirementId: addReq.id,
|
|
86
|
+
message: `Cannot add requirement ${addReq.id}: already exists in base spec`
|
|
87
|
+
});
|
|
88
|
+
stats.conflicts++;
|
|
89
|
+
continue;
|
|
90
|
+
}
|
|
91
|
+
const newReqBlock = this.formatRequirement(addReq);
|
|
92
|
+
// Insert after the last requirement in the requirements section
|
|
93
|
+
content = this.insertRequirementBlock(content, newReqBlock);
|
|
94
|
+
stats.added++;
|
|
95
|
+
}
|
|
96
|
+
return {
|
|
97
|
+
success: conflicts.length === 0,
|
|
98
|
+
content,
|
|
99
|
+
conflicts,
|
|
100
|
+
stats
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Parse requirements from spec content
|
|
105
|
+
*/
|
|
106
|
+
parseRequirements(content) {
|
|
107
|
+
const lines = content.split('\n');
|
|
108
|
+
const requirements = [];
|
|
109
|
+
let inRequirementsSection = false;
|
|
110
|
+
let currentReq = null;
|
|
111
|
+
for (let i = 0; i < lines.length; i++) {
|
|
112
|
+
const line = lines[i];
|
|
113
|
+
// Detect requirements section
|
|
114
|
+
if (line.match(/^##\s+(Functional\s+)?Requirements?/i)) {
|
|
115
|
+
inRequirementsSection = true;
|
|
116
|
+
continue;
|
|
117
|
+
}
|
|
118
|
+
// Exit requirements section on next ## header
|
|
119
|
+
if (inRequirementsSection && line.match(/^##\s+/) && !line.match(/^##\s+(Functional\s+)?Requirements?/i)) {
|
|
120
|
+
if (currentReq) {
|
|
121
|
+
currentReq.endLine = i - 1;
|
|
122
|
+
requirements.push(currentReq);
|
|
123
|
+
currentReq = null;
|
|
124
|
+
}
|
|
125
|
+
inRequirementsSection = false;
|
|
126
|
+
continue;
|
|
127
|
+
}
|
|
128
|
+
if (!inRequirementsSection)
|
|
129
|
+
continue;
|
|
130
|
+
// Look for requirement IDs in tables or headers
|
|
131
|
+
// Table format: | FR-1 | ... | P0 | ... | or | FR-AUTH-1 | ... | P0 | ... |
|
|
132
|
+
const tableMatch = line.match(/\|\s*([A-Z][A-Z0-9-]+)\s*\|([^|]+)\|\s*(P[012])?\s*\|/);
|
|
133
|
+
if (tableMatch) {
|
|
134
|
+
if (currentReq) {
|
|
135
|
+
currentReq.endLine = i - 1;
|
|
136
|
+
requirements.push(currentReq);
|
|
137
|
+
}
|
|
138
|
+
currentReq = {
|
|
139
|
+
id: tableMatch[1],
|
|
140
|
+
text: tableMatch[2].trim(),
|
|
141
|
+
priority: tableMatch[3],
|
|
142
|
+
startLine: i,
|
|
143
|
+
endLine: i
|
|
144
|
+
};
|
|
145
|
+
continue;
|
|
146
|
+
}
|
|
147
|
+
// Header format: ### FR-1 or **FR-1:** or ### FR-AUTH-1
|
|
148
|
+
const headerMatch = line.match(/^###\s+([A-Z][A-Z0-9-]+)|^\*\*([A-Z][A-Z0-9-]+):/);
|
|
149
|
+
if (headerMatch) {
|
|
150
|
+
if (currentReq) {
|
|
151
|
+
currentReq.endLine = i - 1;
|
|
152
|
+
requirements.push(currentReq);
|
|
153
|
+
}
|
|
154
|
+
currentReq = {
|
|
155
|
+
id: headerMatch[1] || headerMatch[2],
|
|
156
|
+
text: '',
|
|
157
|
+
startLine: i,
|
|
158
|
+
endLine: i
|
|
159
|
+
};
|
|
160
|
+
continue;
|
|
161
|
+
}
|
|
162
|
+
// Accumulate requirement text
|
|
163
|
+
if (currentReq && line.trim()) {
|
|
164
|
+
currentReq.text = (currentReq.text + ' ' + line.trim()).trim();
|
|
165
|
+
currentReq.endLine = i;
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
// Save last requirement
|
|
169
|
+
if (currentReq) {
|
|
170
|
+
requirements.push(currentReq);
|
|
171
|
+
}
|
|
172
|
+
return requirements;
|
|
173
|
+
}
|
|
174
|
+
/**
|
|
175
|
+
* Format a requirement for insertion
|
|
176
|
+
*/
|
|
177
|
+
formatRequirement(req) {
|
|
178
|
+
let block = `| ${req.id} | ${req.text} | ${req.priority || 'P1'} | |\n`;
|
|
179
|
+
if (req.scenarios && req.scenarios.length > 0) {
|
|
180
|
+
block += `\n**Scenarios:**\n`;
|
|
181
|
+
for (const scenario of req.scenarios) {
|
|
182
|
+
block += `- ${scenario}\n`;
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
return block;
|
|
186
|
+
}
|
|
187
|
+
/**
|
|
188
|
+
* Remove a requirement block from content
|
|
189
|
+
*/
|
|
190
|
+
removeRequirementBlock(content, req) {
|
|
191
|
+
const lines = content.split('\n');
|
|
192
|
+
lines.splice(req.startLine, req.endLine - req.startLine + 1);
|
|
193
|
+
return lines.join('\n');
|
|
194
|
+
}
|
|
195
|
+
/**
|
|
196
|
+
* Replace a requirement block in content
|
|
197
|
+
*/
|
|
198
|
+
replaceRequirementBlock(content, oldReq, newBlock) {
|
|
199
|
+
const lines = content.split('\n');
|
|
200
|
+
const newLines = newBlock.split('\n').filter(l => l); // Remove empty lines
|
|
201
|
+
lines.splice(oldReq.startLine, oldReq.endLine - oldReq.startLine + 1, ...newLines);
|
|
202
|
+
return lines.join('\n');
|
|
203
|
+
}
|
|
204
|
+
/**
|
|
205
|
+
* Insert a requirement block after the requirements section
|
|
206
|
+
*/
|
|
207
|
+
insertRequirementBlock(content, newBlock) {
|
|
208
|
+
const lines = content.split('\n');
|
|
209
|
+
let insertIndex = -1;
|
|
210
|
+
// Find the requirements table end
|
|
211
|
+
for (let i = 0; i < lines.length; i++) {
|
|
212
|
+
if (lines[i].match(/^##\s+(Functional\s+)?Requirements?/i)) {
|
|
213
|
+
// Look for the end of the table (next ## or empty section)
|
|
214
|
+
for (let j = i + 1; j < lines.length; j++) {
|
|
215
|
+
if (lines[j].match(/^##\s+/) && !lines[j].match(/^##\s+(Functional\s+)?Requirements?/i)) {
|
|
216
|
+
insertIndex = j - 1;
|
|
217
|
+
break;
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
break;
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
if (insertIndex === -1) {
|
|
224
|
+
// No requirements section found, append at end
|
|
225
|
+
return content + '\n' + newBlock;
|
|
226
|
+
}
|
|
227
|
+
lines.splice(insertIndex + 1, 0, newBlock);
|
|
228
|
+
return lines.join('\n');
|
|
229
|
+
}
|
|
230
|
+
/**
|
|
231
|
+
* Preview the changes without applying them
|
|
232
|
+
*/
|
|
233
|
+
diff(baseContent, deltaSpec) {
|
|
234
|
+
let diff = `# Delta Spec Preview: ${deltaSpec.id}\n\n`;
|
|
235
|
+
diff += `**Base Spec:** ${deltaSpec.baseSpecId}\n`;
|
|
236
|
+
diff += `**Description:** ${deltaSpec.description}\n\n`;
|
|
237
|
+
if (deltaSpec.added.length > 0) {
|
|
238
|
+
diff += `## Added Requirements (${deltaSpec.added.length})\n\n`;
|
|
239
|
+
for (const req of deltaSpec.added) {
|
|
240
|
+
diff += `+ ${req.id}: ${req.text}\n`;
|
|
241
|
+
}
|
|
242
|
+
diff += '\n';
|
|
243
|
+
}
|
|
244
|
+
if (deltaSpec.modified.length > 0) {
|
|
245
|
+
diff += `## Modified Requirements (${deltaSpec.modified.length})\n\n`;
|
|
246
|
+
for (const req of deltaSpec.modified) {
|
|
247
|
+
diff += `~ ${req.id}: ${req.text}\n`;
|
|
248
|
+
if (req.oldText) {
|
|
249
|
+
diff += ` (was: ${req.oldText})\n`;
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
diff += '\n';
|
|
253
|
+
}
|
|
254
|
+
if (deltaSpec.removed.length > 0) {
|
|
255
|
+
diff += `## Removed Requirements (${deltaSpec.removed.length})\n\n`;
|
|
256
|
+
for (const id of deltaSpec.removed) {
|
|
257
|
+
diff += `- ${id}\n`;
|
|
258
|
+
}
|
|
259
|
+
diff += '\n';
|
|
260
|
+
}
|
|
261
|
+
return diff;
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
//# sourceMappingURL=merger.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"merger.js","sourceRoot":"","sources":["../../src/delta/merger.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAYH,MAAM,OAAO,cAAc;IACzB;;OAEG;IACH,KAAK,CAAC,WAAmB,EAAE,SAAoB;QAC7C,MAAM,SAAS,GAAoB,EAAE,CAAC;QACtC,MAAM,KAAK,GAAe;YACxB,KAAK,EAAE,CAAC;YACR,QAAQ,EAAE,CAAC;YACX,OAAO,EAAE,CAAC;YACV,SAAS,EAAE,CAAC;SACb,CAAC;QAEF,IAAI,OAAO,GAAG,WAAW,CAAC;QAE1B,oCAAoC;QACpC,MAAM,YAAY,GAAG,IAAI,CAAC,iBAAiB,CAAC,OAAO,CAAC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AAC;YAChE,KAAK,MAAM,GAAG,IAAI,SAAS,CAAC,KAAK,EAAE,CAAC;gBAClC,IAAI,IAAI,KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,CAAC,IAAI,IAAI,CAAC;YACvC,CAAC;YACD,IAAI,IAAI,IAAI,CAAC;QACf,CAAC;QAED,IAAI,SAAS,CAAC,QAAQ,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YAClC,IAAI,IAAI,6BAA6B,SAAS,CAAC,QAAQ,CAAC,MAAM,OAAO,CAAC;YACtE,KAAK,MAAM,GAAG,IAAI,SAAS,CAAC,QAAQ,EAAE,CAAC;gBACrC,IAAI,IAAI,KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,CAAC,IAAI,IAAI,CAAC;gBACrC,IAAI,GAAG,CAAC,OAAO,EAAE,CAAC;oBAChB,IAAI,IAAI,WAAW,GAAG,CAAC,OAAO,KAAK,CAAC;gBACtC,CAAC;YACH,CAAC;YACD,IAAI,IAAI,IAAI,CAAC;QACf,CAAC;QAED,IAAI,SAAS,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YACjC,IAAI,IAAI,4BAA4B,SAAS,CAAC,OAAO,CAAC,MAAM,OAAO,CAAC;YACpE,KAAK,MAAM,EAAE,IAAI,SAAS,CAAC,OAAO,EAAE,CAAC;gBACnC,IAAI,IAAI,KAAK,EAAE,IAAI,CAAC;YACtB,CAAC;YACD,IAAI,IAAI,IAAI,CAAC;QACf,CAAC;QAED,OAAO,IAAI,CAAC;IACd,CAAC;CACF"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Delta Spec Parser
|
|
3
|
+
* Parses delta spec files with ADDED/MODIFIED/REMOVED sections
|
|
4
|
+
*/
|
|
5
|
+
import type { DeltaSpec } from './types.js';
|
|
6
|
+
export declare class DeltaParser {
|
|
7
|
+
/**
|
|
8
|
+
* Parse a delta spec from markdown content
|
|
9
|
+
*/
|
|
10
|
+
parse(content: string, deltaSpecId: string, baseSpecId: string, author?: string): DeltaSpec;
|
|
11
|
+
/**
|
|
12
|
+
* Extract description from content
|
|
13
|
+
*/
|
|
14
|
+
private extractDescription;
|
|
15
|
+
/**
|
|
16
|
+
* Save current requirement to appropriate list
|
|
17
|
+
*/
|
|
18
|
+
private saveCurrentRequirement;
|
|
19
|
+
/**
|
|
20
|
+
* Validate delta spec structure
|
|
21
|
+
*/
|
|
22
|
+
validate(deltaSpec: DeltaSpec): {
|
|
23
|
+
valid: boolean;
|
|
24
|
+
errors: string[];
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=parser.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parser.d.ts","sourceRoot":"","sources":["../../src/delta/parser.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAoB,MAAM,YAAY,CAAC;AAE9D,qBAAa,WAAW;IACtB;;OAEG;IACH,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,GAAE,MAAoB,GAAG,SAAS;IA6HxG;;OAEG;IACH,OAAO,CAAC,kBAAkB;IAU1B;;OAEG;IACH,OAAO,CAAC,sBAAsB;IAuB9B;;OAEG;IACH,QAAQ,CAAC,SAAS,EAAE,SAAS,GAAG;QAAE,KAAK,EAAE,OAAO,CAAC;QAAC,MAAM,EAAE,MAAM,EAAE,CAAA;KAAE;CAkDrE"}
|
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Delta Spec Parser
|
|
3
|
+
* Parses delta spec files with ADDED/MODIFIED/REMOVED sections
|
|
4
|
+
*/
|
|
5
|
+
export class DeltaParser {
|
|
6
|
+
/**
|
|
7
|
+
* Parse a delta spec from markdown content
|
|
8
|
+
*/
|
|
9
|
+
parse(content, deltaSpecId, baseSpecId, author = 'developer') {
|
|
10
|
+
const lines = content.split('\n');
|
|
11
|
+
// Extract metadata from frontmatter or header
|
|
12
|
+
const description = this.extractDescription(lines);
|
|
13
|
+
const added = [];
|
|
14
|
+
const modified = [];
|
|
15
|
+
const removed = [];
|
|
16
|
+
let currentSection = 'none';
|
|
17
|
+
let currentRequirement = null;
|
|
18
|
+
for (let i = 0; i < lines.length; i++) {
|
|
19
|
+
const line = lines[i].trim();
|
|
20
|
+
// Detect section headers
|
|
21
|
+
if (line.match(/^##\s+ADDED\s+Requirements?/i)) {
|
|
22
|
+
// console.log('Found ADDED section');
|
|
23
|
+
this.saveCurrentRequirement(currentRequirement, currentSection, added, modified);
|
|
24
|
+
currentSection = 'added';
|
|
25
|
+
currentRequirement = null;
|
|
26
|
+
continue;
|
|
27
|
+
}
|
|
28
|
+
if (line.match(/^##\s+MODIFIED\s+Requirements?/i)) {
|
|
29
|
+
this.saveCurrentRequirement(currentRequirement, currentSection, added, modified);
|
|
30
|
+
currentSection = 'modified';
|
|
31
|
+
currentRequirement = null;
|
|
32
|
+
continue;
|
|
33
|
+
}
|
|
34
|
+
if (line.match(/^##\s+REMOVED\s+Requirements?/i)) {
|
|
35
|
+
this.saveCurrentRequirement(currentRequirement, currentSection, added, modified);
|
|
36
|
+
currentSection = 'removed';
|
|
37
|
+
currentRequirement = null;
|
|
38
|
+
continue;
|
|
39
|
+
}
|
|
40
|
+
// Reset section on other headers (only ## not ###)
|
|
41
|
+
if (line.match(/^##(?!#)/) && !line.match(/^##\s+(ADDED|MODIFIED|REMOVED)/i)) {
|
|
42
|
+
this.saveCurrentRequirement(currentRequirement, currentSection, added, modified);
|
|
43
|
+
currentSection = 'none';
|
|
44
|
+
currentRequirement = null;
|
|
45
|
+
continue;
|
|
46
|
+
}
|
|
47
|
+
if (currentSection === 'none')
|
|
48
|
+
continue;
|
|
49
|
+
// Parse REMOVED section (just IDs)
|
|
50
|
+
if (currentSection === 'removed') {
|
|
51
|
+
// Match lines like: - FR-1, - REQ-001, - FR-AUTH-1, etc.
|
|
52
|
+
const idMatch = line.match(/^[-*]\s+([A-Z][A-Z0-9-]+)/);
|
|
53
|
+
if (idMatch) {
|
|
54
|
+
removed.push(idMatch[1]);
|
|
55
|
+
}
|
|
56
|
+
continue;
|
|
57
|
+
}
|
|
58
|
+
// Parse ADDED and MODIFIED sections
|
|
59
|
+
// Look for requirement ID headers like ### FR-1 or **FR-1:** or ### FR-AUTH-1
|
|
60
|
+
const headerMatch = line.match(/^###\s+([A-Z][A-Z0-9-]+)|^\*\*([A-Z][A-Z0-9-]+):/);
|
|
61
|
+
if (headerMatch) {
|
|
62
|
+
// Save previous requirement
|
|
63
|
+
this.saveCurrentRequirement(currentRequirement, currentSection, added, modified);
|
|
64
|
+
const id = headerMatch[1] || headerMatch[2];
|
|
65
|
+
currentRequirement = { id, text: '', scenarios: [] };
|
|
66
|
+
continue;
|
|
67
|
+
}
|
|
68
|
+
// Parse requirement content
|
|
69
|
+
if (currentRequirement) {
|
|
70
|
+
// Extract priority
|
|
71
|
+
const priorityMatch = line.match(/\*\*Priority:\*\*\s+(P[012])/);
|
|
72
|
+
if (priorityMatch) {
|
|
73
|
+
currentRequirement.priority = priorityMatch[1];
|
|
74
|
+
continue;
|
|
75
|
+
}
|
|
76
|
+
// Extract "was" notation for MODIFIED
|
|
77
|
+
const wasMatch = line.match(/←\s*\(was\s+(.+)\)/);
|
|
78
|
+
if (wasMatch && currentSection === 'modified') {
|
|
79
|
+
currentRequirement.oldText = wasMatch[1];
|
|
80
|
+
// Remove the "was" part and keep the new text
|
|
81
|
+
const newText = line.replace(/←\s*\(was\s+.+\)/, '').trim();
|
|
82
|
+
if (newText) {
|
|
83
|
+
currentRequirement.text = (currentRequirement.text + ' ' + newText).trim();
|
|
84
|
+
}
|
|
85
|
+
continue;
|
|
86
|
+
}
|
|
87
|
+
// Accumulate requirement text
|
|
88
|
+
if (line && !line.startsWith('#') && !line.startsWith('**Priority:**')) {
|
|
89
|
+
// Skip bold headers like **Scenarios:** entirely
|
|
90
|
+
if (line.match(/^\*\*\w+:/)) {
|
|
91
|
+
continue;
|
|
92
|
+
}
|
|
93
|
+
if (line.startsWith('-') || line.startsWith('*')) {
|
|
94
|
+
// Scenario or list item
|
|
95
|
+
currentRequirement.scenarios = currentRequirement.scenarios || [];
|
|
96
|
+
currentRequirement.scenarios.push(line.replace(/^[-*]\s+/, ''));
|
|
97
|
+
}
|
|
98
|
+
else {
|
|
99
|
+
currentRequirement.text = (currentRequirement.text + ' ' + line).trim();
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
// Save last requirement
|
|
105
|
+
this.saveCurrentRequirement(currentRequirement, currentSection, added, modified);
|
|
106
|
+
return {
|
|
107
|
+
id: deltaSpecId,
|
|
108
|
+
baseSpecId,
|
|
109
|
+
description,
|
|
110
|
+
createdAt: new Date(),
|
|
111
|
+
author,
|
|
112
|
+
added,
|
|
113
|
+
modified,
|
|
114
|
+
removed
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Extract description from content
|
|
119
|
+
*/
|
|
120
|
+
extractDescription(lines) {
|
|
121
|
+
for (const line of lines) {
|
|
122
|
+
const descMatch = line.match(/\*\*Description:\*\*\s+(.+)/);
|
|
123
|
+
if (descMatch) {
|
|
124
|
+
return descMatch[1];
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
return 'Delta spec change';
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* Save current requirement to appropriate list
|
|
131
|
+
*/
|
|
132
|
+
saveCurrentRequirement(req, section, added, modified) {
|
|
133
|
+
if (!req || !req.id)
|
|
134
|
+
return;
|
|
135
|
+
const requirement = {
|
|
136
|
+
id: req.id,
|
|
137
|
+
text: req.text || '',
|
|
138
|
+
priority: req.priority,
|
|
139
|
+
scenarios: req.scenarios,
|
|
140
|
+
oldText: req.oldText
|
|
141
|
+
};
|
|
142
|
+
if (section === 'added') {
|
|
143
|
+
added.push(requirement);
|
|
144
|
+
}
|
|
145
|
+
else if (section === 'modified') {
|
|
146
|
+
modified.push(requirement);
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* Validate delta spec structure
|
|
151
|
+
*/
|
|
152
|
+
validate(deltaSpec) {
|
|
153
|
+
const errors = [];
|
|
154
|
+
if (!deltaSpec.baseSpecId) {
|
|
155
|
+
errors.push('Missing baseSpecId');
|
|
156
|
+
}
|
|
157
|
+
if (deltaSpec.added.length === 0 && deltaSpec.modified.length === 0 && deltaSpec.removed.length === 0) {
|
|
158
|
+
errors.push('Delta spec has no changes (no requirements added, modified, or removed)');
|
|
159
|
+
}
|
|
160
|
+
// Check for duplicate IDs in added
|
|
161
|
+
const addedIds = new Set();
|
|
162
|
+
for (const req of deltaSpec.added) {
|
|
163
|
+
if (addedIds.has(req.id)) {
|
|
164
|
+
errors.push(`Duplicate requirement ID in ADDED section: ${req.id}`);
|
|
165
|
+
}
|
|
166
|
+
addedIds.add(req.id);
|
|
167
|
+
}
|
|
168
|
+
// Check for duplicate IDs in modified
|
|
169
|
+
const modifiedIds = new Set();
|
|
170
|
+
for (const req of deltaSpec.modified) {
|
|
171
|
+
if (modifiedIds.has(req.id)) {
|
|
172
|
+
errors.push(`Duplicate requirement ID in MODIFIED section: ${req.id}`);
|
|
173
|
+
}
|
|
174
|
+
modifiedIds.add(req.id);
|
|
175
|
+
}
|
|
176
|
+
// Check for overlap between sections
|
|
177
|
+
for (const req of deltaSpec.added) {
|
|
178
|
+
if (modifiedIds.has(req.id)) {
|
|
179
|
+
errors.push(`Requirement ${req.id} appears in both ADDED and MODIFIED sections`);
|
|
180
|
+
}
|
|
181
|
+
if (deltaSpec.removed.includes(req.id)) {
|
|
182
|
+
errors.push(`Requirement ${req.id} appears in both ADDED and REMOVED sections`);
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
for (const req of deltaSpec.modified) {
|
|
186
|
+
if (deltaSpec.removed.includes(req.id)) {
|
|
187
|
+
errors.push(`Requirement ${req.id} appears in both MODIFIED and REMOVED sections`);
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
return {
|
|
191
|
+
valid: errors.length === 0,
|
|
192
|
+
errors
|
|
193
|
+
};
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
//# sourceMappingURL=parser.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parser.js","sourceRoot":"","sources":["../../src/delta/parser.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,MAAM,OAAO,WAAW;IACtB;;OAEG;IACH,KAAK,CAAC,OAAe,EAAE,WAAmB,EAAE,UAAkB,EAAE,SAAiB,WAAW;QAC1F,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QAElC,8CAA8C;QAC9C,MAAM,WAAW,GAAG,IAAI,CAAC,kBAAkB,CAAC,KAAK,CAAC,CAAC;QAEnD,MAAM,KAAK,GAAuB,EAAE,CAAC;QACrC,MAAM,QAAQ,GAAuB,EAAE,CAAC;QACxC,MAAM,OAAO,GAAa,EAAE,CAAC;QAE7B,IAAI,cAAc,GAA8C,MAAM,CAAC;QACvE,IAAI,kBAAkB,GAAqC,IAAI,CAAC;QAEhE,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;YACtC,MAAM,IAAI,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;YAE7B,yBAAyB;YACzB,IAAI,IAAI,CAAC,KAAK,CAAC,8BAA8B,CAAC,EAAE,CAAC;gBAC/C,sCAAsC;gBACtC,IAAI,CAAC,sBAAsB,CAAC,kBAAkB,EAAE,cAAc,EAAE,KAAK,EAAE,QAAQ,CAAC,CAAC;gBACjF,cAAc,GAAG,OAAO,CAAC;gBACzB,kBAAkB,GAAG,IAAI,CAAC;gBAC1B,SAAS;YACX,CAAC;YAED,IA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+
* Defines structures for incremental spec changes (brownfield projects)
|
|
4
|
+
*/
|
|
5
|
+
export interface DeltaRequirement {
|
|
6
|
+
id: string;
|
|
7
|
+
text: string;
|
|
8
|
+
priority?: 'P0' | 'P1' | 'P2';
|
|
9
|
+
scenarios?: string[];
|
|
10
|
+
oldText?: string;
|
|
11
|
+
}
|
|
12
|
+
export interface DeltaSpec {
|
|
13
|
+
id: string;
|
|
14
|
+
baseSpecId: string;
|
|
15
|
+
description: string;
|
|
16
|
+
createdAt: Date;
|
|
17
|
+
author: string;
|
|
18
|
+
added: DeltaRequirement[];
|
|
19
|
+
modified: DeltaRequirement[];
|
|
20
|
+
removed: string[];
|
|
21
|
+
}
|
|
22
|
+
export interface MergeResult {
|
|
23
|
+
success: boolean;
|
|
24
|
+
content: string;
|
|
25
|
+
conflicts: MergeConflict[];
|
|
26
|
+
stats: MergeStats;
|
|
27
|
+
}
|
|
28
|
+
export interface MergeConflict {
|
|
29
|
+
type: 'requirement_not_found' | 'duplicate_add' | 'invalid_format';
|
|
30
|
+
requirementId?: string;
|
|
31
|
+
message: string;
|
|
32
|
+
}
|
|
33
|
+
export interface MergeStats {
|
|
34
|
+
added: number;
|
|
35
|
+
modified: number;
|
|
36
|
+
removed: number;
|
|
37
|
+
conflicts: number;
|
|
38
|
+
}
|
|
39
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/delta/types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,MAAM,WAAW,gBAAgB;IAC/B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;IAC9B,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;IACrB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,SAAS;IACxB,EAAE,EAAE,MAAM,CAAC;IACX,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,IAAI,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,gBAAgB,EAAE,CAAC;IAC1B,QAAQ,EAAE,gBAAgB,EAAE,CAAC;IAC7B,OAAO,EAAE,MAAM,EAAE,CAAC;CACnB;AAED,MAAM,WAAW,WAAW;IAC1B,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,aAAa,EAAE,CAAC;IAC3B,KAAK,EAAE,UAAU,CAAC;CACnB;AAED,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,uBAAuB,GAAG,eAAe,GAAG,gBAAgB,CAAC;IACnE,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,UAAU;IACzB,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;CACnB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/delta/types.ts"],"names":[],"mappings":"AAAA;;;GAGG"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* EARS (Easy Approach to Requirements Syntax) Module
|
|
3
|
+
*
|
|
4
|
+
* Provides tools for parsing, validating, and templating requirements
|
|
5
|
+
* using the EARS format for improved testability.
|
|
6
|
+
*/
|
|
7
|
+
export * from './types.js';
|
|
8
|
+
export * from './parser.js';
|
|
9
|
+
export * from './validator.js';
|
|
10
|
+
export * from './template.js';
|
|
11
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/ears/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,eAAe,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* EARS (Easy Approach to Requirements Syntax) Module
|
|
3
|
+
*
|
|
4
|
+
* Provides tools for parsing, validating, and templating requirements
|
|
5
|
+
* using the EARS format for improved testability.
|
|
6
|
+
*/
|
|
7
|
+
export * from './types.js';
|
|
8
|
+
export * from './parser.js';
|
|
9
|
+
export * from './validator.js';
|
|
10
|
+
export * from './template.js';
|
|
11
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/ears/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,eAAe,CAAC"}
|