@rengler33/prov 0.1.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/README.md +314 -0
- package/dist/cli.d.ts +26 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +381 -0
- package/dist/cli.js.map +1 -0
- package/dist/commands/agent.d.ts +107 -0
- package/dist/commands/agent.d.ts.map +1 -0
- package/dist/commands/agent.js +197 -0
- package/dist/commands/agent.js.map +1 -0
- package/dist/commands/agent.test.d.ts +5 -0
- package/dist/commands/agent.test.d.ts.map +1 -0
- package/dist/commands/agent.test.js +199 -0
- package/dist/commands/agent.test.js.map +1 -0
- package/dist/commands/constraint.d.ts +100 -0
- package/dist/commands/constraint.d.ts.map +1 -0
- package/dist/commands/constraint.js +763 -0
- package/dist/commands/constraint.js.map +1 -0
- package/dist/commands/constraint.test.d.ts +9 -0
- package/dist/commands/constraint.test.d.ts.map +1 -0
- package/dist/commands/constraint.test.js +470 -0
- package/dist/commands/constraint.test.js.map +1 -0
- package/dist/commands/graph.d.ts +99 -0
- package/dist/commands/graph.d.ts.map +1 -0
- package/dist/commands/graph.js +552 -0
- package/dist/commands/graph.js.map +1 -0
- package/dist/commands/graph.test.d.ts +2 -0
- package/dist/commands/graph.test.d.ts.map +1 -0
- package/dist/commands/graph.test.js +258 -0
- package/dist/commands/graph.test.js.map +1 -0
- package/dist/commands/impact.d.ts +83 -0
- package/dist/commands/impact.d.ts.map +1 -0
- package/dist/commands/impact.js +319 -0
- package/dist/commands/impact.js.map +1 -0
- package/dist/commands/impact.test.d.ts +2 -0
- package/dist/commands/impact.test.d.ts.map +1 -0
- package/dist/commands/impact.test.js +234 -0
- package/dist/commands/impact.test.js.map +1 -0
- package/dist/commands/init.d.ts +45 -0
- package/dist/commands/init.d.ts.map +1 -0
- package/dist/commands/init.js +94 -0
- package/dist/commands/init.js.map +1 -0
- package/dist/commands/init.test.d.ts +7 -0
- package/dist/commands/init.test.d.ts.map +1 -0
- package/dist/commands/init.test.js +174 -0
- package/dist/commands/init.test.js.map +1 -0
- package/dist/commands/integration.test.d.ts +10 -0
- package/dist/commands/integration.test.d.ts.map +1 -0
- package/dist/commands/integration.test.js +456 -0
- package/dist/commands/integration.test.js.map +1 -0
- package/dist/commands/mcp.d.ts +21 -0
- package/dist/commands/mcp.d.ts.map +1 -0
- package/dist/commands/mcp.js +616 -0
- package/dist/commands/mcp.js.map +1 -0
- package/dist/commands/mcp.test.d.ts +7 -0
- package/dist/commands/mcp.test.d.ts.map +1 -0
- package/dist/commands/mcp.test.js +132 -0
- package/dist/commands/mcp.test.js.map +1 -0
- package/dist/commands/plan.d.ts +218 -0
- package/dist/commands/plan.d.ts.map +1 -0
- package/dist/commands/plan.js +1307 -0
- package/dist/commands/plan.js.map +1 -0
- package/dist/commands/plan.test.d.ts +9 -0
- package/dist/commands/plan.test.d.ts.map +1 -0
- package/dist/commands/plan.test.js +569 -0
- package/dist/commands/plan.test.js.map +1 -0
- package/dist/commands/spec.d.ts +94 -0
- package/dist/commands/spec.d.ts.map +1 -0
- package/dist/commands/spec.js +635 -0
- package/dist/commands/spec.js.map +1 -0
- package/dist/commands/spec.test.d.ts +9 -0
- package/dist/commands/spec.test.d.ts.map +1 -0
- package/dist/commands/spec.test.js +407 -0
- package/dist/commands/spec.test.js.map +1 -0
- package/dist/commands/trace.d.ts +157 -0
- package/dist/commands/trace.d.ts.map +1 -0
- package/dist/commands/trace.js +847 -0
- package/dist/commands/trace.js.map +1 -0
- package/dist/commands/trace.test.d.ts +9 -0
- package/dist/commands/trace.test.d.ts.map +1 -0
- package/dist/commands/trace.test.js +524 -0
- package/dist/commands/trace.test.js.map +1 -0
- package/dist/graph.d.ts +204 -0
- package/dist/graph.d.ts.map +1 -0
- package/dist/graph.js +496 -0
- package/dist/graph.js.map +1 -0
- package/dist/graph.test.d.ts +2 -0
- package/dist/graph.test.d.ts.map +1 -0
- package/dist/graph.test.js +382 -0
- package/dist/graph.test.js.map +1 -0
- package/dist/hash.d.ts +72 -0
- package/dist/hash.d.ts.map +1 -0
- package/dist/hash.js +137 -0
- package/dist/hash.js.map +1 -0
- package/dist/hash.test.d.ts +2 -0
- package/dist/hash.test.d.ts.map +1 -0
- package/dist/hash.test.js +227 -0
- package/dist/hash.test.js.map +1 -0
- package/dist/index.d.ts +18 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +64 -0
- package/dist/index.js.map +1 -0
- package/dist/index.test.d.ts +2 -0
- package/dist/index.test.d.ts.map +1 -0
- package/dist/index.test.js +11 -0
- package/dist/index.test.js.map +1 -0
- package/dist/output.d.ts +84 -0
- package/dist/output.d.ts.map +1 -0
- package/dist/output.js +175 -0
- package/dist/output.js.map +1 -0
- package/dist/output.test.d.ts +7 -0
- package/dist/output.test.d.ts.map +1 -0
- package/dist/output.test.js +146 -0
- package/dist/output.test.js.map +1 -0
- package/dist/staleness.d.ts +162 -0
- package/dist/staleness.d.ts.map +1 -0
- package/dist/staleness.js +309 -0
- package/dist/staleness.js.map +1 -0
- package/dist/staleness.test.d.ts +2 -0
- package/dist/staleness.test.d.ts.map +1 -0
- package/dist/staleness.test.js +448 -0
- package/dist/staleness.test.js.map +1 -0
- package/dist/storage.d.ts +267 -0
- package/dist/storage.d.ts.map +1 -0
- package/dist/storage.js +623 -0
- package/dist/storage.js.map +1 -0
- package/dist/storage.test.d.ts +5 -0
- package/dist/storage.test.d.ts.map +1 -0
- package/dist/storage.test.js +434 -0
- package/dist/storage.test.js.map +1 -0
- package/dist/types.d.ts +270 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +12 -0
- package/dist/types.js.map +1 -0
- package/dist/types.test.d.ts +2 -0
- package/dist/types.test.d.ts.map +1 -0
- package/dist/types.test.js +232 -0
- package/dist/types.test.js.map +1 -0
- package/dist/watcher.d.ts +139 -0
- package/dist/watcher.d.ts.map +1 -0
- package/dist/watcher.js +406 -0
- package/dist/watcher.js.map +1 -0
- package/dist/watcher.test.d.ts +5 -0
- package/dist/watcher.test.d.ts.map +1 -0
- package/dist/watcher.test.js +327 -0
- package/dist/watcher.test.js.map +1 -0
- package/package.json +53 -0
|
@@ -0,0 +1,407 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tests for prov spec commands.
|
|
3
|
+
*
|
|
4
|
+
* @see req:cli:spec-add
|
|
5
|
+
* @see req:cli:spec-list
|
|
6
|
+
* @see req:cli:spec-validate
|
|
7
|
+
*/
|
|
8
|
+
import { describe, it, expect, beforeEach, afterEach, vi } from 'vitest';
|
|
9
|
+
import { existsSync, rmSync, readFileSync, mkdirSync, writeFileSync } from 'node:fs';
|
|
10
|
+
import { join } from 'node:path';
|
|
11
|
+
import { tmpdir } from 'node:os';
|
|
12
|
+
import { runSpecAdd, runSpecList, runSpecValidate } from './spec.js';
|
|
13
|
+
import { runInit } from './init.js';
|
|
14
|
+
import { PROV_DIR, GRAPH_FILE } from '../storage.js';
|
|
15
|
+
// Sample valid spec YAML
|
|
16
|
+
const VALID_SPEC = `id: spec:test-feature:v1
|
|
17
|
+
version: 1.0.0
|
|
18
|
+
title: Test Feature Specification
|
|
19
|
+
status: draft
|
|
20
|
+
|
|
21
|
+
intent: |
|
|
22
|
+
A test specification for unit testing.
|
|
23
|
+
|
|
24
|
+
requirements:
|
|
25
|
+
- id: req:test-feature:init
|
|
26
|
+
description: Initialize the test feature
|
|
27
|
+
acceptance:
|
|
28
|
+
- Feature can be initialized
|
|
29
|
+
- Initialization is idempotent
|
|
30
|
+
depends_on: []
|
|
31
|
+
|
|
32
|
+
- id: req:test-feature:run
|
|
33
|
+
description: Run the test feature
|
|
34
|
+
acceptance:
|
|
35
|
+
- Feature can be executed
|
|
36
|
+
depends_on:
|
|
37
|
+
- req:test-feature:init
|
|
38
|
+
`;
|
|
39
|
+
// Sample spec with validation errors
|
|
40
|
+
const INVALID_SPEC_NO_ID = `version: 1.0.0
|
|
41
|
+
title: Missing ID Spec
|
|
42
|
+
status: draft
|
|
43
|
+
intent: A spec without an id field
|
|
44
|
+
requirements: []
|
|
45
|
+
`;
|
|
46
|
+
const INVALID_SPEC_BAD_REQ_ID = `id: spec:bad-req:v1
|
|
47
|
+
version: 1.0.0
|
|
48
|
+
title: Bad Requirement ID
|
|
49
|
+
status: draft
|
|
50
|
+
intent: A spec with invalid requirement id format
|
|
51
|
+
requirements:
|
|
52
|
+
- id: invalid-req-format
|
|
53
|
+
description: This has bad ID format
|
|
54
|
+
acceptance:
|
|
55
|
+
- Some acceptance criteria
|
|
56
|
+
`;
|
|
57
|
+
const VALID_SPEC_2 = `id: spec:another-feature:v1
|
|
58
|
+
version: 1.0.0
|
|
59
|
+
title: Another Feature Specification
|
|
60
|
+
status: active
|
|
61
|
+
|
|
62
|
+
intent: |
|
|
63
|
+
Another test specification.
|
|
64
|
+
|
|
65
|
+
requirements:
|
|
66
|
+
- id: req:another-feature:setup
|
|
67
|
+
description: Setup the feature
|
|
68
|
+
acceptance:
|
|
69
|
+
- Feature is properly configured
|
|
70
|
+
`;
|
|
71
|
+
describe('spec add command', () => {
|
|
72
|
+
let testDir;
|
|
73
|
+
let mockStdout;
|
|
74
|
+
let mockStderr;
|
|
75
|
+
beforeEach(() => {
|
|
76
|
+
// Create a unique test directory
|
|
77
|
+
testDir = join(tmpdir(), `prov-spec-test-${Date.now()}-${Math.random().toString(36).slice(2)}`);
|
|
78
|
+
mkdirSync(testDir, { recursive: true });
|
|
79
|
+
mkdirSync(join(testDir, 'spec'), { recursive: true });
|
|
80
|
+
// Capture stdout/stderr
|
|
81
|
+
mockStdout = [];
|
|
82
|
+
mockStderr = [];
|
|
83
|
+
vi.spyOn(process.stdout, 'write').mockImplementation((msg) => {
|
|
84
|
+
mockStdout.push(String(msg));
|
|
85
|
+
return true;
|
|
86
|
+
});
|
|
87
|
+
vi.spyOn(process.stderr, 'write').mockImplementation((msg) => {
|
|
88
|
+
mockStderr.push(String(msg));
|
|
89
|
+
return true;
|
|
90
|
+
});
|
|
91
|
+
// Mock process.exit to throw instead of exiting
|
|
92
|
+
vi.spyOn(process, 'exit').mockImplementation((code) => {
|
|
93
|
+
throw new Error(`Process exited with code ${String(code)}`);
|
|
94
|
+
});
|
|
95
|
+
// Initialize prov
|
|
96
|
+
runInit({ dir: testDir }, {});
|
|
97
|
+
mockStdout = [];
|
|
98
|
+
mockStderr = [];
|
|
99
|
+
});
|
|
100
|
+
afterEach(() => {
|
|
101
|
+
// Clean up test directory
|
|
102
|
+
if (existsSync(testDir)) {
|
|
103
|
+
rmSync(testDir, { recursive: true, force: true });
|
|
104
|
+
}
|
|
105
|
+
vi.restoreAllMocks();
|
|
106
|
+
});
|
|
107
|
+
describe('adding a valid spec', () => {
|
|
108
|
+
it('should add spec to graph', () => {
|
|
109
|
+
const specPath = join(testDir, 'spec', 'test.spec.yaml');
|
|
110
|
+
writeFileSync(specPath, VALID_SPEC);
|
|
111
|
+
const globalOpts = { dir: testDir, format: 'json' };
|
|
112
|
+
runSpecAdd(globalOpts, 'spec/test.spec.yaml', {});
|
|
113
|
+
const output = mockStdout.join('');
|
|
114
|
+
const result = JSON.parse(output);
|
|
115
|
+
expect(result.success).toBe(true);
|
|
116
|
+
expect(result.specId).toBe('spec:test-feature:v1');
|
|
117
|
+
});
|
|
118
|
+
it('should store spec and requirements in graph', () => {
|
|
119
|
+
const specPath = join(testDir, 'spec', 'test.spec.yaml');
|
|
120
|
+
writeFileSync(specPath, VALID_SPEC);
|
|
121
|
+
const globalOpts = { dir: testDir };
|
|
122
|
+
runSpecAdd(globalOpts, 'spec/test.spec.yaml', {});
|
|
123
|
+
// Verify graph contains spec and requirements
|
|
124
|
+
const graphPath = join(testDir, PROV_DIR, GRAPH_FILE);
|
|
125
|
+
const graph = JSON.parse(readFileSync(graphPath, 'utf8'));
|
|
126
|
+
expect(graph.nodes['spec:test-feature:v1']).toBeDefined();
|
|
127
|
+
expect(graph.nodes['req:test-feature:init']).toBeDefined();
|
|
128
|
+
expect(graph.nodes['req:test-feature:run']).toBeDefined();
|
|
129
|
+
// Verify edges exist
|
|
130
|
+
expect(graph.edges).toContainEqual({
|
|
131
|
+
from: 'spec:test-feature:v1',
|
|
132
|
+
to: 'req:test-feature:init',
|
|
133
|
+
type: 'contains',
|
|
134
|
+
});
|
|
135
|
+
});
|
|
136
|
+
it('should output JSON when format is json', () => {
|
|
137
|
+
const specPath = join(testDir, 'spec', 'test.spec.yaml');
|
|
138
|
+
writeFileSync(specPath, VALID_SPEC);
|
|
139
|
+
const globalOpts = { dir: testDir, format: 'json' };
|
|
140
|
+
runSpecAdd(globalOpts, 'spec/test.spec.yaml', {});
|
|
141
|
+
const output = mockStdout.join('');
|
|
142
|
+
const result = JSON.parse(output);
|
|
143
|
+
expect(result.success).toBe(true);
|
|
144
|
+
expect(result.specId).toBe('spec:test-feature:v1');
|
|
145
|
+
expect(result.requirementCount).toBe(2);
|
|
146
|
+
expect(result.hash).toMatch(/^sha256:/);
|
|
147
|
+
});
|
|
148
|
+
it('should be idempotent - adding same spec twice', () => {
|
|
149
|
+
const specPath = join(testDir, 'spec', 'test.spec.yaml');
|
|
150
|
+
writeFileSync(specPath, VALID_SPEC);
|
|
151
|
+
const globalOpts = { dir: testDir };
|
|
152
|
+
runSpecAdd(globalOpts, 'spec/test.spec.yaml', {});
|
|
153
|
+
mockStdout = [];
|
|
154
|
+
runSpecAdd(globalOpts, 'spec/test.spec.yaml', {});
|
|
155
|
+
const output = mockStdout.join('');
|
|
156
|
+
expect(output).toContain('unchanged');
|
|
157
|
+
});
|
|
158
|
+
});
|
|
159
|
+
describe('error handling', () => {
|
|
160
|
+
it('should fail if prov not initialized', () => {
|
|
161
|
+
// Use a directory without prov initialized
|
|
162
|
+
const uninitDir = join(testDir, 'uninit');
|
|
163
|
+
mkdirSync(uninitDir, { recursive: true });
|
|
164
|
+
mkdirSync(join(uninitDir, 'spec'), { recursive: true });
|
|
165
|
+
const specPath = join(uninitDir, 'spec', 'test.spec.yaml');
|
|
166
|
+
writeFileSync(specPath, VALID_SPEC);
|
|
167
|
+
const globalOpts = { dir: uninitDir, format: 'json' };
|
|
168
|
+
expect(() => {
|
|
169
|
+
runSpecAdd(globalOpts, 'spec/test.spec.yaml', {});
|
|
170
|
+
}).toThrow('Process exited with code 1');
|
|
171
|
+
const output = mockStdout.join('');
|
|
172
|
+
const result = JSON.parse(output);
|
|
173
|
+
expect(result.success).toBe(false);
|
|
174
|
+
expect(result.error).toContain('not initialized');
|
|
175
|
+
});
|
|
176
|
+
it('should fail if file not found', () => {
|
|
177
|
+
const globalOpts = { dir: testDir, format: 'json' };
|
|
178
|
+
expect(() => {
|
|
179
|
+
runSpecAdd(globalOpts, 'spec/nonexistent.yaml', {});
|
|
180
|
+
}).toThrow('Process exited with code 1');
|
|
181
|
+
const output = mockStdout.join('');
|
|
182
|
+
const result = JSON.parse(output);
|
|
183
|
+
expect(result.success).toBe(false);
|
|
184
|
+
expect(result.error).toContain('File not found');
|
|
185
|
+
});
|
|
186
|
+
it('should fail if spec has validation errors', () => {
|
|
187
|
+
const specPath = join(testDir, 'spec', 'invalid.spec.yaml');
|
|
188
|
+
writeFileSync(specPath, INVALID_SPEC_NO_ID);
|
|
189
|
+
const globalOpts = { dir: testDir, format: 'json' };
|
|
190
|
+
expect(() => {
|
|
191
|
+
runSpecAdd(globalOpts, 'spec/invalid.spec.yaml', {});
|
|
192
|
+
}).toThrow('Process exited with code 1');
|
|
193
|
+
const output = mockStdout.join('');
|
|
194
|
+
const result = JSON.parse(output);
|
|
195
|
+
expect(result.success).toBe(false);
|
|
196
|
+
expect(result.validationErrors).toContain('Missing required field: id');
|
|
197
|
+
});
|
|
198
|
+
});
|
|
199
|
+
});
|
|
200
|
+
describe('spec list command', () => {
|
|
201
|
+
let testDir;
|
|
202
|
+
let mockStdout;
|
|
203
|
+
let mockStderr;
|
|
204
|
+
beforeEach(() => {
|
|
205
|
+
testDir = join(tmpdir(), `prov-spec-list-test-${Date.now()}-${Math.random().toString(36).slice(2)}`);
|
|
206
|
+
mkdirSync(testDir, { recursive: true });
|
|
207
|
+
mkdirSync(join(testDir, 'spec'), { recursive: true });
|
|
208
|
+
mockStdout = [];
|
|
209
|
+
mockStderr = [];
|
|
210
|
+
vi.spyOn(process.stdout, 'write').mockImplementation((msg) => {
|
|
211
|
+
mockStdout.push(String(msg));
|
|
212
|
+
return true;
|
|
213
|
+
});
|
|
214
|
+
vi.spyOn(process.stderr, 'write').mockImplementation((msg) => {
|
|
215
|
+
mockStderr.push(String(msg));
|
|
216
|
+
return true;
|
|
217
|
+
});
|
|
218
|
+
vi.spyOn(process, 'exit').mockImplementation((code) => {
|
|
219
|
+
throw new Error(`Process exited with code ${String(code)}`);
|
|
220
|
+
});
|
|
221
|
+
// Initialize prov
|
|
222
|
+
runInit({ dir: testDir }, {});
|
|
223
|
+
mockStdout = [];
|
|
224
|
+
mockStderr = [];
|
|
225
|
+
});
|
|
226
|
+
afterEach(() => {
|
|
227
|
+
if (existsSync(testDir)) {
|
|
228
|
+
rmSync(testDir, { recursive: true, force: true });
|
|
229
|
+
}
|
|
230
|
+
vi.restoreAllMocks();
|
|
231
|
+
});
|
|
232
|
+
it('should list no specs when none added', () => {
|
|
233
|
+
const globalOpts = { dir: testDir, format: 'json' };
|
|
234
|
+
runSpecList(globalOpts, {});
|
|
235
|
+
const output = mockStdout.join('');
|
|
236
|
+
const result = JSON.parse(output);
|
|
237
|
+
expect(result.specs).toHaveLength(0);
|
|
238
|
+
});
|
|
239
|
+
it('should list added specs in table format', () => {
|
|
240
|
+
// Add a spec first
|
|
241
|
+
const specPath = join(testDir, 'spec', 'test.spec.yaml');
|
|
242
|
+
writeFileSync(specPath, VALID_SPEC);
|
|
243
|
+
runSpecAdd({ dir: testDir }, 'spec/test.spec.yaml', {});
|
|
244
|
+
mockStdout = [];
|
|
245
|
+
const globalOpts = { dir: testDir };
|
|
246
|
+
runSpecList(globalOpts, {});
|
|
247
|
+
const output = mockStdout.join('');
|
|
248
|
+
expect(output).toContain('spec:test-feature:v1');
|
|
249
|
+
expect(output).toContain('Test Feature Specification');
|
|
250
|
+
});
|
|
251
|
+
it('should list multiple specs', () => {
|
|
252
|
+
// Add two specs
|
|
253
|
+
writeFileSync(join(testDir, 'spec', 'test1.spec.yaml'), VALID_SPEC);
|
|
254
|
+
writeFileSync(join(testDir, 'spec', 'test2.spec.yaml'), VALID_SPEC_2);
|
|
255
|
+
runSpecAdd({ dir: testDir }, 'spec/test1.spec.yaml', {});
|
|
256
|
+
runSpecAdd({ dir: testDir }, 'spec/test2.spec.yaml', {});
|
|
257
|
+
mockStdout = [];
|
|
258
|
+
const globalOpts = { dir: testDir, format: 'json' };
|
|
259
|
+
runSpecList(globalOpts, {});
|
|
260
|
+
const output = mockStdout.join('');
|
|
261
|
+
const result = JSON.parse(output);
|
|
262
|
+
expect(result.specs).toHaveLength(2);
|
|
263
|
+
const specIds = result.specs.map((s) => s.id);
|
|
264
|
+
expect(specIds).toContain('spec:test-feature:v1');
|
|
265
|
+
expect(specIds).toContain('spec:another-feature:v1');
|
|
266
|
+
});
|
|
267
|
+
it('should detect stale specs', () => {
|
|
268
|
+
const specPath = join(testDir, 'spec', 'test.spec.yaml');
|
|
269
|
+
writeFileSync(specPath, VALID_SPEC);
|
|
270
|
+
runSpecAdd({ dir: testDir }, 'spec/test.spec.yaml', {});
|
|
271
|
+
// Modify the spec file
|
|
272
|
+
const modifiedSpec = VALID_SPEC.replace('A test specification', 'A modified test specification');
|
|
273
|
+
writeFileSync(specPath, modifiedSpec);
|
|
274
|
+
mockStdout = [];
|
|
275
|
+
const globalOpts = { dir: testDir, format: 'json' };
|
|
276
|
+
runSpecList(globalOpts, {});
|
|
277
|
+
const output = mockStdout.join('');
|
|
278
|
+
const result = JSON.parse(output);
|
|
279
|
+
expect(result.specs[0].status).toBe('stale');
|
|
280
|
+
});
|
|
281
|
+
it('should detect missing spec files', () => {
|
|
282
|
+
const specPath = join(testDir, 'spec', 'test.spec.yaml');
|
|
283
|
+
writeFileSync(specPath, VALID_SPEC);
|
|
284
|
+
runSpecAdd({ dir: testDir }, 'spec/test.spec.yaml', {});
|
|
285
|
+
// Delete the spec file
|
|
286
|
+
rmSync(specPath);
|
|
287
|
+
mockStdout = [];
|
|
288
|
+
const globalOpts = { dir: testDir, format: 'json' };
|
|
289
|
+
runSpecList(globalOpts, {});
|
|
290
|
+
const output = mockStdout.join('');
|
|
291
|
+
const result = JSON.parse(output);
|
|
292
|
+
expect(result.specs[0].status).toBe('missing');
|
|
293
|
+
});
|
|
294
|
+
});
|
|
295
|
+
describe('spec validate command', () => {
|
|
296
|
+
let testDir;
|
|
297
|
+
let mockStdout;
|
|
298
|
+
let mockStderr;
|
|
299
|
+
beforeEach(() => {
|
|
300
|
+
testDir = join(tmpdir(), `prov-spec-validate-test-${Date.now()}-${Math.random().toString(36).slice(2)}`);
|
|
301
|
+
mkdirSync(testDir, { recursive: true });
|
|
302
|
+
mkdirSync(join(testDir, 'spec'), { recursive: true });
|
|
303
|
+
mockStdout = [];
|
|
304
|
+
mockStderr = [];
|
|
305
|
+
vi.spyOn(process.stdout, 'write').mockImplementation((msg) => {
|
|
306
|
+
mockStdout.push(String(msg));
|
|
307
|
+
return true;
|
|
308
|
+
});
|
|
309
|
+
vi.spyOn(process.stderr, 'write').mockImplementation((msg) => {
|
|
310
|
+
mockStderr.push(String(msg));
|
|
311
|
+
return true;
|
|
312
|
+
});
|
|
313
|
+
vi.spyOn(process, 'exit').mockImplementation((code) => {
|
|
314
|
+
throw new Error(`Process exited with code ${String(code)}`);
|
|
315
|
+
});
|
|
316
|
+
});
|
|
317
|
+
afterEach(() => {
|
|
318
|
+
if (existsSync(testDir)) {
|
|
319
|
+
rmSync(testDir, { recursive: true, force: true });
|
|
320
|
+
}
|
|
321
|
+
vi.restoreAllMocks();
|
|
322
|
+
});
|
|
323
|
+
it('should validate with no errors for valid specs', () => {
|
|
324
|
+
writeFileSync(join(testDir, 'spec', 'test.spec.yaml'), VALID_SPEC);
|
|
325
|
+
const globalOpts = { dir: testDir, format: 'json' };
|
|
326
|
+
runSpecValidate(globalOpts, {});
|
|
327
|
+
const output = mockStdout.join('');
|
|
328
|
+
const result = JSON.parse(output);
|
|
329
|
+
expect(result.valid).toBe(true);
|
|
330
|
+
expect(result.issues).toHaveLength(0);
|
|
331
|
+
expect(result.specsChecked).toBe(1);
|
|
332
|
+
});
|
|
333
|
+
it('should report errors for invalid specs', () => {
|
|
334
|
+
writeFileSync(join(testDir, 'spec', 'invalid.spec.yaml'), INVALID_SPEC_NO_ID);
|
|
335
|
+
const globalOpts = { dir: testDir, format: 'json' };
|
|
336
|
+
expect(() => {
|
|
337
|
+
runSpecValidate(globalOpts, {});
|
|
338
|
+
}).toThrow('Process exited with code 1');
|
|
339
|
+
const output = mockStdout.join('');
|
|
340
|
+
const result = JSON.parse(output);
|
|
341
|
+
expect(result.valid).toBe(false);
|
|
342
|
+
expect(result.issues.some((i) => i.message.includes('Missing required field: id'))).toBe(true);
|
|
343
|
+
});
|
|
344
|
+
it('should report invalid requirement ID format', () => {
|
|
345
|
+
writeFileSync(join(testDir, 'spec', 'bad-req.spec.yaml'), INVALID_SPEC_BAD_REQ_ID);
|
|
346
|
+
const globalOpts = { dir: testDir, format: 'json' };
|
|
347
|
+
expect(() => {
|
|
348
|
+
runSpecValidate(globalOpts, {});
|
|
349
|
+
}).toThrow('Process exited with code 1');
|
|
350
|
+
const output = mockStdout.join('');
|
|
351
|
+
const result = JSON.parse(output);
|
|
352
|
+
expect(result.valid).toBe(false);
|
|
353
|
+
expect(result.issues.some((i) => i.message.includes('invalid ID format'))).toBe(true);
|
|
354
|
+
});
|
|
355
|
+
it('should detect duplicate spec IDs across files', () => {
|
|
356
|
+
writeFileSync(join(testDir, 'spec', 'spec1.yaml'), VALID_SPEC);
|
|
357
|
+
writeFileSync(join(testDir, 'spec', 'spec2.yaml'), VALID_SPEC); // Same spec ID!
|
|
358
|
+
const globalOpts = { dir: testDir };
|
|
359
|
+
expect(() => {
|
|
360
|
+
runSpecValidate(globalOpts, {});
|
|
361
|
+
}).toThrow('Process exited with code 1');
|
|
362
|
+
const output = mockStdout.join('') + mockStderr.join('');
|
|
363
|
+
expect(output).toContain('Duplicate spec ID');
|
|
364
|
+
});
|
|
365
|
+
it('should output JSON when format is json', () => {
|
|
366
|
+
writeFileSync(join(testDir, 'spec', 'test.spec.yaml'), VALID_SPEC);
|
|
367
|
+
const globalOpts = { dir: testDir, format: 'json' };
|
|
368
|
+
runSpecValidate(globalOpts, {});
|
|
369
|
+
const output = mockStdout.join('');
|
|
370
|
+
const result = JSON.parse(output);
|
|
371
|
+
expect(result.valid).toBe(true);
|
|
372
|
+
expect(result.issues).toHaveLength(0);
|
|
373
|
+
expect(result.specsChecked).toBe(1);
|
|
374
|
+
});
|
|
375
|
+
it('should report missing dependency references', () => {
|
|
376
|
+
const specWithMissingDep = `id: spec:missing-dep:v1
|
|
377
|
+
version: 1.0.0
|
|
378
|
+
title: Spec with Missing Dependency
|
|
379
|
+
status: draft
|
|
380
|
+
intent: Tests dependency validation
|
|
381
|
+
requirements:
|
|
382
|
+
- id: req:missing-dep:main
|
|
383
|
+
description: Has a missing dependency
|
|
384
|
+
acceptance:
|
|
385
|
+
- Something
|
|
386
|
+
depends_on:
|
|
387
|
+
- req:nonexistent:feature
|
|
388
|
+
`;
|
|
389
|
+
writeFileSync(join(testDir, 'spec', 'missing-dep.spec.yaml'), specWithMissingDep);
|
|
390
|
+
const globalOpts = { dir: testDir };
|
|
391
|
+
expect(() => {
|
|
392
|
+
runSpecValidate(globalOpts, {});
|
|
393
|
+
}).toThrow('Process exited with code 1');
|
|
394
|
+
const output = mockStdout.join('') + mockStderr.join('');
|
|
395
|
+
expect(output).toContain('unknown dependency');
|
|
396
|
+
});
|
|
397
|
+
it('should report empty result when no spec files found', () => {
|
|
398
|
+
// Empty spec directory
|
|
399
|
+
const globalOpts = { dir: testDir, format: 'json' };
|
|
400
|
+
runSpecValidate(globalOpts, {});
|
|
401
|
+
const output = mockStdout.join('');
|
|
402
|
+
const result = JSON.parse(output);
|
|
403
|
+
expect(result.valid).toBe(true);
|
|
404
|
+
expect(result.specsChecked).toBe(0);
|
|
405
|
+
});
|
|
406
|
+
});
|
|
407
|
+
//# sourceMappingURL=spec.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"spec.test.js","sourceRoot":"","sources":["../../src/commands/spec.test.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,UAAU,EAAE,SAAS,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AACzE,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,YAAY,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACrF,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACjC,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AACrE,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAmCrD,yBAAyB;AACzB,MAAM,UAAU,GAAG;;;;;;;;;;;;;;;;;;;;;;CAsBlB,CAAC;AAEF,qCAAqC;AACrC,MAAM,kBAAkB,GAAG;;;;;CAK1B,CAAC;AAEF,MAAM,uBAAuB,GAAG;;;;;;;;;;CAU/B,CAAC;AAEF,MAAM,YAAY,GAAG;;;;;;;;;;;;;CAapB,CAAC;AAEF,QAAQ,CAAC,kBAAkB,EAAE,GAAG,EAAE;IAChC,IAAI,OAAe,CAAC;IACpB,IAAI,UAAoB,CAAC;IACzB,IAAI,UAAoB,CAAC;IAEzB,UAAU,CAAC,GAAG,EAAE;QACd,iCAAiC;QACjC,OAAO,GAAG,IAAI,CAAC,MAAM,EAAE,EAAE,kBAAkB,IAAI,CAAC,GAAG,EAAE,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC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+
/**
|
|
2
|
+
* prov trace commands implementation.
|
|
3
|
+
*
|
|
4
|
+
* Commands for managing artifact traces:
|
|
5
|
+
* - trace add: Link an artifact to a plan step
|
|
6
|
+
* - trace show: Show provenance for an artifact
|
|
7
|
+
* - trace why: Show implementations of a requirement
|
|
8
|
+
*
|
|
9
|
+
* @see req:cli:trace-add
|
|
10
|
+
* @see req:cli:trace-show
|
|
11
|
+
* @see req:cli:trace-why
|
|
12
|
+
*/
|
|
13
|
+
import { type GlobalOptions } from '../cli.js';
|
|
14
|
+
import type { TraceId, StepId, RequirementId, Hash } from '../types.js';
|
|
15
|
+
/**
|
|
16
|
+
* Options for trace add command.
|
|
17
|
+
*/
|
|
18
|
+
export interface TraceAddOptions {
|
|
19
|
+
to: string;
|
|
20
|
+
autoHash?: boolean;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Result of trace add command.
|
|
24
|
+
*/
|
|
25
|
+
export interface TraceAddResult {
|
|
26
|
+
success: boolean;
|
|
27
|
+
traceId?: TraceId;
|
|
28
|
+
artifactPath?: string;
|
|
29
|
+
stepId?: StepId;
|
|
30
|
+
artifactHash?: Hash;
|
|
31
|
+
error?: string;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Options for trace show command.
|
|
35
|
+
*/
|
|
36
|
+
export interface TraceShowOptions {
|
|
37
|
+
format?: string;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Provenance chain entry.
|
|
41
|
+
*/
|
|
42
|
+
export interface ProvenanceEntry {
|
|
43
|
+
type: 'artifact' | 'step' | 'decision' | 'requirement' | 'spec';
|
|
44
|
+
id: string;
|
|
45
|
+
description?: string;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Result of trace show command.
|
|
49
|
+
*/
|
|
50
|
+
export interface TraceShowResult {
|
|
51
|
+
success: boolean;
|
|
52
|
+
artifact?: {
|
|
53
|
+
path: string;
|
|
54
|
+
hash: Hash;
|
|
55
|
+
stale: boolean;
|
|
56
|
+
};
|
|
57
|
+
trace?: {
|
|
58
|
+
id: TraceId;
|
|
59
|
+
stepId: StepId;
|
|
60
|
+
createdAt: string;
|
|
61
|
+
};
|
|
62
|
+
provenance?: ProvenanceEntry[];
|
|
63
|
+
error?: string;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Options for trace why command.
|
|
67
|
+
*/
|
|
68
|
+
export interface TraceWhyOptions {
|
|
69
|
+
format?: string;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Implementation entry for why command.
|
|
73
|
+
*/
|
|
74
|
+
export interface ImplementationEntry {
|
|
75
|
+
artifactPath: string;
|
|
76
|
+
stepId: StepId;
|
|
77
|
+
stepAction: string;
|
|
78
|
+
traceId: TraceId;
|
|
79
|
+
stale: boolean;
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Result of trace why command.
|
|
83
|
+
*/
|
|
84
|
+
export interface TraceWhyResult {
|
|
85
|
+
success: boolean;
|
|
86
|
+
requirementId?: RequirementId;
|
|
87
|
+
requirement?: {
|
|
88
|
+
id: RequirementId;
|
|
89
|
+
description: string;
|
|
90
|
+
};
|
|
91
|
+
implementations?: ImplementationEntry[];
|
|
92
|
+
error?: string;
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Execute the trace add command.
|
|
96
|
+
*
|
|
97
|
+
* Links an artifact (file) to a plan step, recording the current hash
|
|
98
|
+
* for staleness detection.
|
|
99
|
+
*
|
|
100
|
+
* @see req:cli:trace-add
|
|
101
|
+
*/
|
|
102
|
+
export declare function runTraceAdd(globalOpts: GlobalOptions, artifactPath: string, options: TraceAddOptions): void;
|
|
103
|
+
/**
|
|
104
|
+
* Execute the trace show command.
|
|
105
|
+
*
|
|
106
|
+
* Shows the provenance chain for an artifact: artifact -> step -> decision/requirement -> spec.
|
|
107
|
+
*
|
|
108
|
+
* @see req:cli:trace-show
|
|
109
|
+
*/
|
|
110
|
+
export declare function runTraceShow(globalOpts: GlobalOptions, artifactPath: string, _options: TraceShowOptions): void;
|
|
111
|
+
/**
|
|
112
|
+
* Execute the trace why command.
|
|
113
|
+
*
|
|
114
|
+
* Shows all artifacts that implement a requirement, traversing:
|
|
115
|
+
* requirement <- step <- artifact
|
|
116
|
+
*
|
|
117
|
+
* @see req:cli:trace-why
|
|
118
|
+
*/
|
|
119
|
+
export declare function runTraceWhy(globalOpts: GlobalOptions, reqIdStr: string, _options: TraceWhyOptions): void;
|
|
120
|
+
/**
|
|
121
|
+
* Options for trace scan command.
|
|
122
|
+
*/
|
|
123
|
+
export interface TraceScanOptions {
|
|
124
|
+
dirs?: string[];
|
|
125
|
+
format?: string;
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* A scanned trace marker found in source code.
|
|
129
|
+
*/
|
|
130
|
+
export interface ScannedTrace {
|
|
131
|
+
file: string;
|
|
132
|
+
line: number;
|
|
133
|
+
stepId: StepId;
|
|
134
|
+
comment: string;
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* Result of trace scan command.
|
|
138
|
+
*/
|
|
139
|
+
export interface TraceScanResult {
|
|
140
|
+
success: boolean;
|
|
141
|
+
scannedFiles?: number;
|
|
142
|
+
tracesFound?: number;
|
|
143
|
+
tracesAdded?: number;
|
|
144
|
+
tracesUpdated?: number;
|
|
145
|
+
traces?: ScannedTrace[];
|
|
146
|
+
error?: string;
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* Execute the trace scan command.
|
|
150
|
+
*
|
|
151
|
+
* Scans source files for inline trace markers (// prov:step:xxx)
|
|
152
|
+
* and creates/updates traces automatically.
|
|
153
|
+
*
|
|
154
|
+
* @see req:agent:inline-tracing
|
|
155
|
+
*/
|
|
156
|
+
export declare function runTraceScan(globalOpts: GlobalOptions, options: TraceScanOptions): void;
|
|
157
|
+
//# sourceMappingURL=trace.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"trace.d.ts","sourceRoot":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