sdd-flow 2.0.0 → 2.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +47 -33
- package/README.md +430 -113
- package/README.pt-BR.md +414 -100
- package/bin/cli.js +209 -175
- package/docs/architecture.md +98 -91
- package/docs/formats.md +221 -212
- package/docs/local-testing.pt-BR.md +200 -195
- package/docs/methodology.pt-BR.md +6 -0
- package/docs/migration.md +82 -75
- package/docs/releases.pt-BR.md +108 -186
- package/docs/spec-management.pt-BR.md +169 -0
- package/docs/usage.pt-BR.md +315 -305
- package/docs/validation.md +109 -95
- package/lib/adapters.js +1 -1
- package/lib/catalog.js +162 -0
- package/lib/check.js +25 -9
- package/lib/context.js +139 -117
- package/lib/handoff.js +1 -0
- package/lib/install.js +13 -7
- package/lib/io.js +119 -119
- package/lib/management.js +210 -0
- package/lib/markdown.js +71 -71
- package/lib/project.js +191 -200
- package/lib/verification.js +7 -4
- package/package.json +55 -55
- package/templates/agents/AGENTS.md +66 -54
- package/templates/agents/RULES.md +4 -1
- package/templates/agents/SETUP.md +2 -1
- package/templates/agents/config.yaml +13 -13
- package/templates/agents/prompts/intake.md +23 -23
- package/templates/agents/prompts/rpi-close.md +3 -0
- package/templates/agents/prompts/rpi-implement.md +5 -1
- package/templates/agents/prompts/rpi-plan.md +3 -0
package/lib/project.js
CHANGED
|
@@ -1,200 +1,191 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
const fs = require('node:fs');
|
|
4
|
-
const path = require('node:path');
|
|
5
|
-
const YAML = require('yaml');
|
|
6
|
-
const io = require('./io');
|
|
7
|
-
const md = require('./markdown');
|
|
8
|
-
const quality = require('./quality');
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
const
|
|
12
|
-
const
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
if (
|
|
31
|
-
if (!
|
|
32
|
-
if (!['
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
if (!
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
if (
|
|
41
|
-
if (
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
function
|
|
74
|
-
const
|
|
75
|
-
const
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
const
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
return
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
const
|
|
138
|
-
|
|
139
|
-
if (
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
const
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
const
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
const
|
|
162
|
-
|
|
163
|
-
if (!
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
const
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
const
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
const
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
io.write(root, relative + '/TASK.md', md.markdown({ schema_version: 2, artifact: 'tasks', id, tasks: [] },
|
|
193
|
-
portuguese
|
|
194
|
-
? '# Tarefas\n\nMantenha o estado das tarefas no front matter. Planeje resultados coesos e verificáveis, incluindo os testes.'
|
|
195
|
-
: '# Tasks\n\nKeep task state in the front matter. Plan cohesive, independently verifiable outcomes, including their tests.'));
|
|
196
|
-
}
|
|
197
|
-
return spec;
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
module.exports = { MODES, PHASES, CONFIG, documentationSettings, config, specDirectories, locate, loadSpec, writeChange, skills, scopeDocument, scopeDigest, approvalValid, sourceSnapshot, inputDigest, createSpec };
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const fs = require('node:fs');
|
|
4
|
+
const path = require('node:path');
|
|
5
|
+
const YAML = require('yaml');
|
|
6
|
+
const io = require('./io');
|
|
7
|
+
const md = require('./markdown');
|
|
8
|
+
const quality = require('./quality');
|
|
9
|
+
const catalog = require('./catalog');
|
|
10
|
+
|
|
11
|
+
const MODES = ['light', 'standard', 'rigorous'];
|
|
12
|
+
const PHASES = ['research', 'plan', 'implement', 'validate', 'close'];
|
|
13
|
+
const CONFIG = 'agents/config.yaml';
|
|
14
|
+
|
|
15
|
+
function documentationSettings(cfg) {
|
|
16
|
+
const settings = cfg.documentation;
|
|
17
|
+
if (settings !== undefined && (!settings || typeof settings !== 'object' || Array.isArray(settings))) throw new Error('documentation must be a mapping');
|
|
18
|
+
const language = settings?.language ?? 'auto';
|
|
19
|
+
if (typeof language !== 'string' || !language.trim()) throw new Error('documentation.language must be auto or a language tag such as pt-BR');
|
|
20
|
+
try {
|
|
21
|
+
return { language: language === 'auto' ? language : Intl.getCanonicalLocales(language)[0], encoding: 'UTF-8' };
|
|
22
|
+
} catch {
|
|
23
|
+
throw new Error('documentation.language must be auto or a valid language tag such as pt-BR');
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
function config(root) {
|
|
28
|
+
if (!io.exists(root, CONFIG)) throw new Error('Missing agents/config.yaml. Run sdd init, or sdd update for a v1 project.');
|
|
29
|
+
const value = md.parseYaml(io.read(root, CONFIG), CONFIG);
|
|
30
|
+
if (value.schema_version !== 2) throw new Error('Unsupported config schema_version; expected 2');
|
|
31
|
+
if (!MODES.includes(value.mode)) throw new Error('Invalid project mode');
|
|
32
|
+
if (!['batch', 'step'].includes(value.autonomy)) throw new Error('Invalid autonomy; expected batch or step');
|
|
33
|
+
if (!['required', 'optional'].includes(value.approval)) throw new Error('Invalid approval policy');
|
|
34
|
+
documentationSettings(value);
|
|
35
|
+
quality.settings(value);
|
|
36
|
+
if (!Number.isSafeInteger(value.context?.max_bytes) || value.context.max_bytes < 1024) throw new Error('context.max_bytes must be an integer >= 1024');
|
|
37
|
+
if (!Array.isArray(value.checks) || !Array.isArray(value.verification?.exclude)) throw new Error('checks and verification.exclude must be arrays');
|
|
38
|
+
const names = new Set();
|
|
39
|
+
for (const check of value.checks) {
|
|
40
|
+
if (!/^[a-z][a-z0-9-]*$/.test(check.name) || names.has(check.name)) throw new Error('Invalid or duplicate check name');
|
|
41
|
+
if (typeof check.command !== 'string' || !check.command.trim()) throw new Error('Check command must be a nonempty string');
|
|
42
|
+
if (!Number.isSafeInteger(check.timeout_ms) || check.timeout_ms < 1 || check.timeout_ms > 3600000) throw new Error('Check timeout_ms must be between 1 and 3600000');
|
|
43
|
+
names.add(check.name);
|
|
44
|
+
quality.checkSettings(check);
|
|
45
|
+
}
|
|
46
|
+
for (const exclude of value.verification.exclude) {
|
|
47
|
+
io.resolve(root, exclude);
|
|
48
|
+
if (exclude === 'agents' || exclude === 'src' || exclude === 'tests' || exclude === 'package.json') {
|
|
49
|
+
throw new Error('Do not exclude source or dependency manifests: ' + exclude);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
return value;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
function specDirectories(root, options) { return catalog.list(root, options); }
|
|
56
|
+
|
|
57
|
+
function locate(root, id, options) { return catalog.locate(root, id, options); }
|
|
58
|
+
|
|
59
|
+
function loadSpec(root, id, options) {
|
|
60
|
+
const location = locate(root, id, options);
|
|
61
|
+
const manifestPath = location.relative + '/change.yaml';
|
|
62
|
+
if (!io.exists(root, manifestPath)) return { ...location, legacy: true };
|
|
63
|
+
const change = md.parseYaml(io.read(root, manifestPath), manifestPath);
|
|
64
|
+
if (change.schema_version !== 2 || change.id !== location.id) throw new Error(manifestPath + ': invalid schema_version or id');
|
|
65
|
+
return { ...location, change, legacy: false };
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
function writeChange(root, spec) {
|
|
69
|
+
io.write(root, spec.relative + '/change.yaml', YAML.stringify(spec.change, { lineWidth: 0 }));
|
|
70
|
+
catalog.remember(root, spec);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
function skills(root) {
|
|
74
|
+
const records = [];
|
|
75
|
+
for (const file of io.walk(root, 'agents/skills', rel => rel.split('/').some(s => s.startsWith('_')))) {
|
|
76
|
+
if (!file.endsWith('/SKILL.md')) continue;
|
|
77
|
+
const { data } = md.load(root, file);
|
|
78
|
+
const expected = path.posix.basename(path.posix.dirname(file));
|
|
79
|
+
if (typeof data.name !== 'string' || !/^[a-z0-9]+(?:-[a-z0-9]+)*$/.test(data.name) || data.name.length > 64 || data.name !== expected) {
|
|
80
|
+
throw new Error(file + ': name must match its directory and Agent Skills naming rules');
|
|
81
|
+
}
|
|
82
|
+
if (typeof data.description !== 'string' || !data.description.trim() || data.description.length > 1024) throw new Error(file + ': description must contain 1–1024 characters');
|
|
83
|
+
if (records.some(s => s.name === data.name)) throw new Error('Duplicate skill name: ' + data.name);
|
|
84
|
+
records.push({ name: data.name, description: data.description, path: file });
|
|
85
|
+
}
|
|
86
|
+
return records;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
function scopeDocument(root, spec) {
|
|
90
|
+
const change = spec.change;
|
|
91
|
+
const fields = ['schema_version', 'id', 'title', 'mode', 'capabilities', 'decisions', 'skills', 'depends_on', 'context', 'sources'];
|
|
92
|
+
const normative = Object.fromEntries(fields.map(k => [k, change[k] ?? null]));
|
|
93
|
+
const specification = md.load(root, spec.relative + '/SPEC.md');
|
|
94
|
+
let tasks = null;
|
|
95
|
+
if (io.exists(root, spec.relative + '/TASK.md')) {
|
|
96
|
+
const source = md.load(root, spec.relative + '/TASK.md');
|
|
97
|
+
tasks = {
|
|
98
|
+
body: source.body,
|
|
99
|
+
data: { ...source.data, tasks: (source.data.tasks || []).map(t => {
|
|
100
|
+
const { status, cancellation, evidence, deferral, ...plan } = t;
|
|
101
|
+
return plan;
|
|
102
|
+
}) },
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
const policy = config(root);
|
|
106
|
+
return { change: normative, specification, tasks, policy: {
|
|
107
|
+
approval: policy.approval, autonomy: policy.autonomy, checks: policy.checks, verification: policy.verification,
|
|
108
|
+
quality: quality.settings(policy),
|
|
109
|
+
project_policies: io.exists(root, 'agents/POLICIES.md') ? io.read(root, 'agents/POLICIES.md') : '',
|
|
110
|
+
project_quality: io.exists(root, 'agents/QUALITY.md') ? io.read(root, 'agents/QUALITY.md') : '',
|
|
111
|
+
} };
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
function scopeDigest(root, spec) {
|
|
115
|
+
return io.digest(scopeDocument(root, spec));
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
function approvalValid(root, spec) {
|
|
119
|
+
return Boolean(spec.change.approval?.by && spec.change.approval?.at && spec.change.approval?.digest === scopeDigest(root, spec));
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
function sourceSnapshot(root) {
|
|
123
|
+
const cfg = config(root);
|
|
124
|
+
const excluded = ['.git', 'node_modules', 'agents', ...cfg.verification.exclude];
|
|
125
|
+
const files = io.walk(root, '', (rel, entry) => {
|
|
126
|
+
if (excluded.some(prefix => rel === prefix || rel.startsWith(prefix + '/'))) return true;
|
|
127
|
+
if (entry.isDirectory() && ['node_modules', '.git', '__pycache__', '.pytest_cache'].includes(entry.name)) return true;
|
|
128
|
+
return false;
|
|
129
|
+
});
|
|
130
|
+
return Object.fromEntries(files.map(file => [file, io.hash(fs.readFileSync(io.resolve(root, file)))]));
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
function inputDigest(root, spec) {
|
|
134
|
+
const references = [...spec.change.capabilities, ...spec.change.decisions,
|
|
135
|
+
...spec.change.sources.map(x => typeof x === 'string' ? x : x.path),
|
|
136
|
+
...spec.change.context.map(x => typeof x === 'string' ? x : x.path)];
|
|
137
|
+
for (const name of spec.change.skills) {
|
|
138
|
+
const found = skills(root).find(s => s.name === name);
|
|
139
|
+
if (!found) throw new Error('Unknown skill: ' + name);
|
|
140
|
+
references.push(...io.walk(root, path.posix.dirname(found.path)));
|
|
141
|
+
}
|
|
142
|
+
const historical = new Set([...spec.change.sources, ...spec.change.context].filter(catalog.historical).map(ref => ref.path));
|
|
143
|
+
const docs = Object.fromEntries([...new Set(references)].sort().map(file => {
|
|
144
|
+
const actual = catalog.referencePath(root, file);
|
|
145
|
+
return [file, historical.has(file) && !io.exists(root, actual) ? 'missing-historical-reference' : io.hash(io.read(root, actual))];
|
|
146
|
+
}));
|
|
147
|
+
const tasks = io.exists(root, spec.relative + '/TASK.md') ? md.load(root, spec.relative + '/TASK.md').data.tasks : [];
|
|
148
|
+
return { digest: io.digest({ scope: scopeDigest(root, spec), config: config(root), files: sourceSnapshot(root), docs, tasks }), docs };
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
function createSpec(root, title, mode) {
|
|
152
|
+
const cfg = config(root);
|
|
153
|
+
mode = mode || cfg.mode;
|
|
154
|
+
if (!MODES.includes(mode)) throw new Error('Mode must be light, standard or rigorous');
|
|
155
|
+
if (typeof title !== 'string' || !title.trim()) throw new Error('Provide a feature name');
|
|
156
|
+
const name = title.normalize('NFKD').replace(/[\u0300-\u036f]/g, '').toLowerCase().replace(/[^a-z0-9]+/g, '-').replace(/^-|-$/g, '');
|
|
157
|
+
if (!name || name.length > 96) throw new Error('Feature name must produce a slug of 1–96 characters');
|
|
158
|
+
const registryPath = 'agents/.sdd/registry.json';
|
|
159
|
+
const registry = catalog.registry(root);
|
|
160
|
+
if (!Array.isArray(registry.ids) || registry.ids.some(id => typeof id !== 'string' || !/^\d+-/.test(id))) throw new Error('Invalid SDD registry');
|
|
161
|
+
const all = [...registry.ids, ...specDirectories(root).map(s => s.id)];
|
|
162
|
+
const numbers = [...all, ...specDirectories(root).map(s => s.name)].filter(id => /^\d+-/.test(id)).map(id => Number(id.split('-')[0]));
|
|
163
|
+
if (numbers.some(n => !Number.isSafeInteger(n) || n < 0)) throw new Error('Invalid spec number in registry');
|
|
164
|
+
const next = Math.max(0, ...numbers) + 1;
|
|
165
|
+
if (!Number.isSafeInteger(next)) throw new Error('Spec numbering exceeded the safe integer range');
|
|
166
|
+
const id = String(next).padStart(3, '0') + '-' + name;
|
|
167
|
+
const relative = 'agents/specs/' + id;
|
|
168
|
+
fs.mkdirSync(io.resolve(root, relative), { recursive: false });
|
|
169
|
+
registry.ids = [...new Set([...all, id])].sort();
|
|
170
|
+
io.writeJson(root, registryPath, registry);
|
|
171
|
+
const spec = { id, relative, change: {
|
|
172
|
+
schema_version: 2, id, title, mode, status: 'draft',
|
|
173
|
+
capabilities: [], decisions: [], skills: [], depends_on: [], context: [], sources: [], approval: null,
|
|
174
|
+
} };
|
|
175
|
+
writeChange(root, spec);
|
|
176
|
+
const portuguese = documentationSettings(cfg).language.toLowerCase().split('-')[0] === 'pt';
|
|
177
|
+
io.write(root, relative + '/SPEC.md', md.markdown({
|
|
178
|
+
schema_version: 2, artifact: 'spec', id, requirements: [], acceptance: [],
|
|
179
|
+
}, '# ' + title + (portuguese
|
|
180
|
+
? '\n\n## Objetivo\n\nDescreva o resultado observável.\n\n## Escopo\n\nIndique o que muda e o que fica fora desta alteração.'
|
|
181
|
+
: '\n\n## Goal\n\nDescribe the observable outcome.\n\n## Scope\n\nState what changes and what remains outside this change.')));
|
|
182
|
+
if (mode !== 'light') {
|
|
183
|
+
io.write(root, relative + '/TASK.md', md.markdown({ schema_version: 2, artifact: 'tasks', id, tasks: [] },
|
|
184
|
+
portuguese
|
|
185
|
+
? '# Tarefas\n\nMantenha o estado das tarefas no front matter. Planeje resultados coesos e verificáveis, incluindo os testes.'
|
|
186
|
+
: '# Tasks\n\nKeep task state in the front matter. Plan cohesive, independently verifiable outcomes, including their tests.'));
|
|
187
|
+
}
|
|
188
|
+
return spec;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
module.exports = { MODES, PHASES, CONFIG, documentationSettings, config, specDirectories, locate, loadSpec, writeChange, skills, scopeDocument, scopeDigest, approvalValid, sourceSnapshot, inputDigest, createSpec };
|
package/lib/verification.js
CHANGED
|
@@ -6,6 +6,7 @@ const { spawn, spawnSync } = require('node:child_process');
|
|
|
6
6
|
const io = require('./io');
|
|
7
7
|
const md = require('./markdown');
|
|
8
8
|
const project = require('./project');
|
|
9
|
+
const catalog = require('./catalog');
|
|
9
10
|
const { check, requireValid } = require('./check');
|
|
10
11
|
const quality = require('./quality');
|
|
11
12
|
const handoff = require('./handoff');
|
|
@@ -75,6 +76,7 @@ function runCheck(root, checkDefinition) {
|
|
|
75
76
|
|
|
76
77
|
function readEvidence(root, file, spec, fingerprint) {
|
|
77
78
|
if (!file) return { cases: [], artifacts: {} };
|
|
79
|
+
file = catalog.referencePath(root, file);
|
|
78
80
|
const evidence = io.json(root, file);
|
|
79
81
|
if (evidence.schema_version !== 2 || evidence.id !== spec.id || evidence.input_digest !== fingerprint) {
|
|
80
82
|
throw new Error('Manual/inspection evidence is stale or belongs to another spec. Run sdd evidence ' + spec.id + ', repeat the affected observations, and pass the returned path to --evidence.');
|
|
@@ -96,7 +98,7 @@ function readEvidence(root, file, spec, fingerprint) {
|
|
|
96
98
|
}
|
|
97
99
|
}
|
|
98
100
|
for (const artifact of item.artifacts) {
|
|
99
|
-
artifacts[artifact] = io.hash(fs.readFileSync(io.resolve(root, artifact)));
|
|
101
|
+
artifacts[artifact] = io.hash(fs.readFileSync(io.resolve(root, catalog.referencePath(root, artifact))));
|
|
100
102
|
}
|
|
101
103
|
}
|
|
102
104
|
return { cases: evidence.cases, artifacts };
|
|
@@ -223,7 +225,7 @@ function currentReceipt(root, spec) {
|
|
|
223
225
|
throw new Error('Verification is stale; verify the current code and contract again');
|
|
224
226
|
}
|
|
225
227
|
for (const [file, expected] of Object.entries(receipt.artifacts || {})) {
|
|
226
|
-
if (io.hash(fs.readFileSync(io.resolve(root, file))) !== expected) throw new Error('Evidence artifact changed: ' + file);
|
|
228
|
+
if (io.hash(fs.readFileSync(io.resolve(root, catalog.referencePath(root, file)))) !== expected) throw new Error('Evidence artifact changed: ' + file);
|
|
227
229
|
}
|
|
228
230
|
for (const run of receipt.checks || []) {
|
|
229
231
|
if (io.hash(io.read(root, spec.relative + '/' + run.log)) !== run.log_hash) throw new Error('Verification log changed: ' + run.log);
|
|
@@ -243,10 +245,10 @@ function close(root, id, { note, by, archive = false } = {}) {
|
|
|
243
245
|
throw new Error('Provide --note explaining why this change needs no lasting capability update');
|
|
244
246
|
}
|
|
245
247
|
for (const file of spec.change.capabilities) {
|
|
246
|
-
const doc = md.load(root, file);
|
|
248
|
+
const doc = md.load(root, catalog.referencePath(root, file));
|
|
247
249
|
if (!Array.isArray(doc.data.changes) || !doc.data.changes.includes(spec.id)) throw new Error(file + ': consolidate the verified behavior and add this spec ID to changes before verifying');
|
|
248
250
|
}
|
|
249
|
-
const target = 'agents/archive/' + spec.
|
|
251
|
+
const target = 'agents/archive/' + require('node:path').posix.basename(spec.relative);
|
|
250
252
|
if (archive && spec.relative !== target && io.exists(root, target)) throw new Error('Archive destination already exists: ' + target);
|
|
251
253
|
spec.change.status = 'closed';
|
|
252
254
|
spec.change.closure = { by: by.trim(), at: new Date().toISOString(), run_id: receipt.run_id,
|
|
@@ -260,6 +262,7 @@ function close(root, id, { note, by, archive = false } = {}) {
|
|
|
260
262
|
fs.mkdirSync(io.resolve(root, 'agents/archive'), { recursive: true });
|
|
261
263
|
fs.renameSync(io.resolve(root, spec.relative), io.resolve(root, target));
|
|
262
264
|
spec.relative = target;
|
|
265
|
+
catalog.remember(root, spec);
|
|
263
266
|
}
|
|
264
267
|
return { id: spec.id, status: 'closed', path: spec.relative, closure: spec.change.closure };
|
|
265
268
|
}
|
package/package.json
CHANGED
|
@@ -1,55 +1,55 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "sdd-flow",
|
|
3
|
-
"version": "2.
|
|
4
|
-
"description": "Portable spec-driven workflow with bounded context and evidence-based verification",
|
|
5
|
-
"bin": {
|
|
6
|
-
"sdd-cli": "bin/cli.js",
|
|
7
|
-
"sdd": "bin/cli.js"
|
|
8
|
-
},
|
|
9
|
-
"files": [
|
|
10
|
-
"bin/",
|
|
11
|
-
"lib/",
|
|
12
|
-
"templates/",
|
|
13
|
-
"docs/",
|
|
14
|
-
"CHANGELOG.md",
|
|
15
|
-
"README.pt-BR.md",
|
|
16
|
-
"CONTRIBUTING.md"
|
|
17
|
-
],
|
|
18
|
-
"engines": {
|
|
19
|
-
"node": ">=22"
|
|
20
|
-
},
|
|
21
|
-
"keywords": [
|
|
22
|
-
"sdd",
|
|
23
|
-
"spec-driven-development",
|
|
24
|
-
"rpiv",
|
|
25
|
-
"ai-workflow",
|
|
26
|
-
"claude-code",
|
|
27
|
-
"opencode",
|
|
28
|
-
"agentic",
|
|
29
|
-
"workflow"
|
|
30
|
-
],
|
|
31
|
-
"author": "moisesuailab",
|
|
32
|
-
"license": "MIT",
|
|
33
|
-
"repository": {
|
|
34
|
-
"type": "git",
|
|
35
|
-
"url": "git+https://github.com/moisesuailab/sdd-flow.git"
|
|
36
|
-
},
|
|
37
|
-
"scripts": {
|
|
38
|
-
"test": "node --test",
|
|
39
|
-
"check": "node scripts/check-package.js",
|
|
40
|
-
"test:coverage": "node --test --experimental-test-coverage",
|
|
41
|
-
"release:check": "node scripts/release-check.js",
|
|
42
|
-
"prepublishOnly": "npm test && npm run check"
|
|
43
|
-
},
|
|
44
|
-
"dependencies": {
|
|
45
|
-
"yaml": "^2.9.1"
|
|
46
|
-
},
|
|
47
|
-
"homepage": "https://github.com/moisesuailab/sdd-flow#readme",
|
|
48
|
-
"bugs": {
|
|
49
|
-
"url": "https://github.com/moisesuailab/sdd-flow/issues"
|
|
50
|
-
},
|
|
51
|
-
"publishConfig": {
|
|
52
|
-
"access": "public",
|
|
53
|
-
"registry": "https://registry.npmjs.org"
|
|
54
|
-
}
|
|
55
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "sdd-flow",
|
|
3
|
+
"version": "2.1.0",
|
|
4
|
+
"description": "Portable spec-driven workflow with bounded context and evidence-based verification",
|
|
5
|
+
"bin": {
|
|
6
|
+
"sdd-cli": "bin/cli.js",
|
|
7
|
+
"sdd": "bin/cli.js"
|
|
8
|
+
},
|
|
9
|
+
"files": [
|
|
10
|
+
"bin/",
|
|
11
|
+
"lib/",
|
|
12
|
+
"templates/",
|
|
13
|
+
"docs/",
|
|
14
|
+
"CHANGELOG.md",
|
|
15
|
+
"README.pt-BR.md",
|
|
16
|
+
"CONTRIBUTING.md"
|
|
17
|
+
],
|
|
18
|
+
"engines": {
|
|
19
|
+
"node": ">=22"
|
|
20
|
+
},
|
|
21
|
+
"keywords": [
|
|
22
|
+
"sdd",
|
|
23
|
+
"spec-driven-development",
|
|
24
|
+
"rpiv",
|
|
25
|
+
"ai-workflow",
|
|
26
|
+
"claude-code",
|
|
27
|
+
"opencode",
|
|
28
|
+
"agentic",
|
|
29
|
+
"workflow"
|
|
30
|
+
],
|
|
31
|
+
"author": "moisesuailab",
|
|
32
|
+
"license": "MIT",
|
|
33
|
+
"repository": {
|
|
34
|
+
"type": "git",
|
|
35
|
+
"url": "git+https://github.com/moisesuailab/sdd-flow.git"
|
|
36
|
+
},
|
|
37
|
+
"scripts": {
|
|
38
|
+
"test": "node --test",
|
|
39
|
+
"check": "node scripts/check-package.js",
|
|
40
|
+
"test:coverage": "node --test --experimental-test-coverage",
|
|
41
|
+
"release:check": "node scripts/release-check.js",
|
|
42
|
+
"prepublishOnly": "npm test && npm run check"
|
|
43
|
+
},
|
|
44
|
+
"dependencies": {
|
|
45
|
+
"yaml": "^2.9.1"
|
|
46
|
+
},
|
|
47
|
+
"homepage": "https://github.com/moisesuailab/sdd-flow#readme",
|
|
48
|
+
"bugs": {
|
|
49
|
+
"url": "https://github.com/moisesuailab/sdd-flow/issues"
|
|
50
|
+
},
|
|
51
|
+
"publishConfig": {
|
|
52
|
+
"access": "public",
|
|
53
|
+
"registry": "https://registry.npmjs.org"
|
|
54
|
+
}
|
|
55
|
+
}
|