cliewen-openspec 0.3.0 → 0.4.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 +10 -0
- package/adapters/node-test.mjs +9 -4
- package/dist/cli.js +37 -11
- package/dist/core.d.ts +22 -3
- package/dist/core.js +106 -15
- package/dist/quality.d.ts +1 -1
- package/dist/quality.js +22 -7
- package/dist/release.d.ts +1 -1
- package/dist/release.js +2 -2
- package/dist/setup-profile.d.ts +31 -0
- package/dist/setup-profile.js +59 -0
- package/docs/configuration.md +27 -4
- package/docs/testing/evidence.md +14 -1
- package/docs/testing/test-quality.md +3 -1
- package/package.json +1 -1
- package/schemas/base/instructions/closure.md +2 -2
- package/schemas/base/instructions/planning.md +32 -1
- package/schemas/delivery/instructions/apply.md +2 -0
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,16 @@ Changes that matter to projects using Cliewen for OpenSpec.
|
|
|
4
4
|
|
|
5
5
|
## Unreleased
|
|
6
6
|
|
|
7
|
+
## 0.4.0 (2026-11-23)
|
|
8
|
+
|
|
9
|
+
- Delivery agents assess whether the request and verification are clear enough to start. When a decision is missing, the agent can leave the question on an existing ticket so another agent can resume after the answer. Projects can adjust the threshold or turn the assessment off. [Readiness settings](docs/configuration.md#implementation-readiness)
|
|
10
|
+
|
|
11
|
+
- Delivery guidance now asks agents to review the full plan before coding and the actual changes before archive. It helps catch unrequested work, missed requirements, and missing verification. [Review delivery scope](docs/guide/workflow.md#review-delivery-scope)
|
|
12
|
+
|
|
13
|
+
- Choose a solo or team setup profile during initialization and revisit it as your project grows. Preview the switch and select which recommendations to apply. [Set up a profile or switch to team](docs/guide/cli.md#choose-or-change-a-setup-profile)
|
|
14
|
+
|
|
15
|
+
- Check test evidence for one permanent OpenSpec capability with `cliewen-openspec check --capability NAME`. The check names active criteria that lack results, so a green test run can still reveal a missing test. [Collect capability evidence](docs/testing/evidence.md#collect-evidence-for-one-capability)
|
|
16
|
+
|
|
7
17
|
## 0.3.0 (2026-11-21)
|
|
8
18
|
|
|
9
19
|
- Separate OpenSpec archive sessions now receive the same [Humanizer guidance](docs/configuration.md#humanizer-and-writing) as the workflows. Enabled modes report the result once, and `off` keeps the handoff free of skill status.
|
package/adapters/node-test.mjs
CHANGED
|
@@ -16,16 +16,21 @@ try {
|
|
|
16
16
|
if (fs.existsSync(output)) fs.unlinkSync(output);
|
|
17
17
|
const files = [];
|
|
18
18
|
let change;
|
|
19
|
+
let capability;
|
|
19
20
|
const args = process.argv.slice(2);
|
|
20
21
|
for (let i = 0; i < args.length; i++) {
|
|
21
22
|
if (args[i] === '--change') {
|
|
22
23
|
if (change !== undefined || !args[i + 1] || args[i + 1].startsWith('-')) throw Error('Pass --change NAME once');
|
|
23
24
|
change = args[++i];
|
|
25
|
+
} else if (args[i] === '--capability') {
|
|
26
|
+
if (capability !== undefined || !args[i + 1] || args[i + 1].startsWith('-')) throw Error('Pass --capability NAME once');
|
|
27
|
+
capability = args[++i];
|
|
24
28
|
} else if (args[i].startsWith('-')) throw Error(`Unknown adapter option: ${args[i]}`);
|
|
25
29
|
else files.push(args[i]);
|
|
26
30
|
}
|
|
27
31
|
if (!files.length) throw Error('Pass explicit test file paths');
|
|
28
|
-
const
|
|
32
|
+
const scope = capability !== undefined ? { capability } : change !== undefined ? { change } : undefined;
|
|
33
|
+
const selected = scope && new Set(scenarios(process.cwd(), change, capability).map(s => s.id));
|
|
29
34
|
let removedRequirements = 0, activeRequirements = 0;
|
|
30
35
|
if (selected?.size === 0) for (const file of markdowns(local(process.cwd(), `openspec/changes/${change}/specs`))) {
|
|
31
36
|
let fence = '', section = '';
|
|
@@ -38,7 +43,7 @@ try {
|
|
|
38
43
|
}
|
|
39
44
|
}
|
|
40
45
|
const retirementOnly = selected?.size === 0 && removedRequirements > 0 && activeRequirements === 0;
|
|
41
|
-
if (selected && ((!selected.size && !retirementOnly) || selected.has(''))) throw Error('Selected
|
|
46
|
+
if (selected && ((!selected.size && !retirementOnly) || selected.has(''))) throw Error('Selected scope requires scenarios with AC IDs');
|
|
42
47
|
const run = spawnSync(process.execPath, ['--test', '--test-reporter=tap', ...files], { encoding: 'utf8' });
|
|
43
48
|
if (run.error) throw run.error;
|
|
44
49
|
process.stdout.write(run.stdout ?? ''); process.stderr.write(run.stderr ?? '');
|
|
@@ -58,8 +63,8 @@ try {
|
|
|
58
63
|
}
|
|
59
64
|
if (git('rev-parse', 'HEAD') !== revision || git('status', '--porcelain', '--untracked-files=all')) throw Error('Test execution changed repository inputs; evidence cannot be attributed to the original revision.');
|
|
60
65
|
if (run.status === null) throw Error('Test runner did not complete; no report produced');
|
|
61
|
-
if (!results.length && !retirementOnly) throw Error('No AC-tagged test results found for the selected scope; no report produced');
|
|
66
|
+
if (!results.length && !retirementOnly && capability === undefined) throw Error('No AC-tagged test results found for the selected scope; no report produced');
|
|
62
67
|
fs.mkdirSync(path.dirname(output), { recursive: true });
|
|
63
|
-
fs.writeFileSync(output, JSON.stringify({ version: 1, revision,
|
|
68
|
+
fs.writeFileSync(output, JSON.stringify({ version: 1, revision, scope, execution: { exitCode: run.status }, results }, null, 2) + '\n');
|
|
64
69
|
process.exitCode = run.status === 0 ? 0 : 1;
|
|
65
70
|
} catch (e) { console.error(e.message); process.exitCode = 2; }
|
package/dist/cli.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { coordinate, syncIds, resumeIds, abandonRequest } from './ac-coordination.js';
|
|
3
3
|
import path from 'node:path';
|
|
4
|
-
import { check, lifecycle, uninstall, nextId, renamePrefix, capabilityForPrefix, recover, version } from './core.js';
|
|
4
|
+
import { applyProfile, check, lifecycle, uninstall, nextId, renamePrefix, capabilityForPrefix, recover, version } from './core.js';
|
|
5
|
+
import { selectSetupProfile } from './setup-profile.js';
|
|
5
6
|
const args = process.argv.slice(2);
|
|
6
7
|
const wantsJson = args.includes('--json');
|
|
7
8
|
function option(name) { const i = args.indexOf(name); if (i < 0)
|
|
@@ -16,9 +17,21 @@ try {
|
|
|
16
17
|
const capability = option('--capability');
|
|
17
18
|
const replacement = option('--default-schema');
|
|
18
19
|
const apply = flag('--apply');
|
|
20
|
+
const profile = option('--profile');
|
|
21
|
+
const concurrent = flag('--concurrent');
|
|
22
|
+
const sharedReview = flag('--shared-review');
|
|
23
|
+
const enableReview = flag('--enable-review');
|
|
19
24
|
const command = args.shift();
|
|
20
|
-
if (apply && (command !== 'ac' || args[0] !== 'coordinate'))
|
|
21
|
-
throw Error('--apply is supported only by ac coordinate');
|
|
25
|
+
if (apply && command !== 'profile' && (command !== 'ac' || args[0] !== 'coordinate'))
|
|
26
|
+
throw Error('--apply is supported only by profile and ac coordinate');
|
|
27
|
+
if (profile !== undefined && command !== 'init')
|
|
28
|
+
throw Error('--profile is supported only by init');
|
|
29
|
+
if ((concurrent || sharedReview || enableReview) && command !== 'init' && command !== 'profile')
|
|
30
|
+
throw Error('Setup options are supported only by init and profile');
|
|
31
|
+
if ((concurrent || sharedReview || enableReview) && command === 'init' && profile === undefined)
|
|
32
|
+
throw Error('Use setup options with --profile solo or --profile team');
|
|
33
|
+
if (enableReview && (!sharedReview || (command === 'profile' && !apply)))
|
|
34
|
+
throw Error('--enable-review requires --shared-review and an applying command');
|
|
22
35
|
if (dry && !['init', 'update', 'uninstall'].includes(command ?? ''))
|
|
23
36
|
throw Error('--dry-run is supported only by init, update, and uninstall');
|
|
24
37
|
if (replacement !== undefined && command !== 'uninstall')
|
|
@@ -31,10 +44,10 @@ try {
|
|
|
31
44
|
throw Error('--fail-on-pending is supported only by check');
|
|
32
45
|
if (change && !/^[a-z0-9]+(?:-[a-z0-9]+)*$/.test(change))
|
|
33
46
|
throw Error('Change must be a kebab-case name');
|
|
34
|
-
if (json && !['init', 'update', 'uninstall', 'check', 'docs', 'ci'].includes(command ?? ''))
|
|
35
|
-
throw Error('--json is supported only by init, update, uninstall, check, docs check, and ci inspect');
|
|
36
|
-
if (capability && (command !== 'ac' || args[0] !== 'next'))
|
|
37
|
-
throw Error('--capability is supported only by ac next');
|
|
47
|
+
if (json && !['init', 'profile', 'update', 'uninstall', 'check', 'docs', 'ci'].includes(command ?? ''))
|
|
48
|
+
throw Error('--json is supported only by init, profile, update, uninstall, check, docs check, and ci inspect');
|
|
49
|
+
if (capability && command !== 'check' && (command !== 'ac' || args[0] !== 'next'))
|
|
50
|
+
throw Error('--capability is supported only by check and ac next');
|
|
38
51
|
if (command === 'ci') {
|
|
39
52
|
if (args.length !== 1 || args[0] !== 'inspect')
|
|
40
53
|
throw Error('Use ci inspect [--json] [--root PATH]');
|
|
@@ -80,12 +93,25 @@ try {
|
|
|
80
93
|
else
|
|
81
94
|
throw Error('Use ac next --capability NAME, ac rename-prefix CAPABILITY PREFIX, ac coordinate REMOTE [--apply], ac sync, ac resume, or ac abandon');
|
|
82
95
|
}
|
|
96
|
+
else if (command === 'profile') {
|
|
97
|
+
if (args.length !== 1)
|
|
98
|
+
throw Error('Use profile solo|team [--apply]');
|
|
99
|
+
const interactive = apply && !json && Boolean(process.stdin.isTTY && process.stdout.isTTY);
|
|
100
|
+
const result = await selectSetupProfile(root, args[0], { interactive, concurrent, sharedReview, enableReview, existingOnly: true });
|
|
101
|
+
if (!result)
|
|
102
|
+
throw Error('Choose a solo or team profile');
|
|
103
|
+
const writes = apply ? applyProfile(root, result.selection) : [];
|
|
104
|
+
console.log(JSON.stringify({ dryRun: !apply, ...result.summary, writes }, null, 2));
|
|
105
|
+
}
|
|
83
106
|
else if (args.length)
|
|
84
107
|
throw Error(`Unexpected arguments: ${args.join(' ')}`);
|
|
85
108
|
else if (command === '--version')
|
|
86
109
|
console.log(version);
|
|
87
|
-
else if (command === 'init')
|
|
88
|
-
|
|
110
|
+
else if (command === 'init') {
|
|
111
|
+
const interactive = !dry && !json && Boolean(process.stdin.isTTY && process.stdout.isTTY);
|
|
112
|
+
const result = await selectSetupProfile(root, profile, { interactive, concurrent, sharedReview, enableReview });
|
|
113
|
+
console.log(JSON.stringify({ dryRun: dry, ...lifecycle(root, 'init', dry, makeDefault, result?.selection), setupProfile: result?.summary }, null, 2));
|
|
114
|
+
}
|
|
89
115
|
else if (command === 'update')
|
|
90
116
|
console.log(JSON.stringify({ dryRun: dry, ...lifecycle(root, 'update', dry) }, null, 2));
|
|
91
117
|
else if (command === 'uninstall')
|
|
@@ -96,13 +122,13 @@ try {
|
|
|
96
122
|
console.log('Recovery complete');
|
|
97
123
|
}
|
|
98
124
|
else if (command === 'check') {
|
|
99
|
-
const findings = check(root, change, failPending);
|
|
125
|
+
const findings = check(root, change, failPending, capability);
|
|
100
126
|
const ok = !findings.some(f => f.severity === 'error');
|
|
101
127
|
console.log(json ? JSON.stringify({ ok, findings }, null, 2) : findings.map(f => `${f.severity.toUpperCase()} ${f.code}: ${f.message}`).join('\n'));
|
|
102
128
|
process.exitCode = ok ? 0 : 1;
|
|
103
129
|
}
|
|
104
130
|
else if (!command || command === '--help')
|
|
105
|
-
console.log('cliewen-openspec\ninit [--default] [--dry-run]\nupdate [--dry-run] [--json]\nuninstall [--default-schema NAME] [--dry-run] [--json]\nac next --capability NAME\nac next PREFIX (registered active prefix only)\nac rename-prefix CAPABILITY PREFIX\nac coordinate REMOTE [--apply] (preview by default)\nac sync\nac resume\nac abandon\ndocs check [--json]\nci inspect [--json]\ncheck [--change NAME] [--json] [--fail-on-pending]\nrecover\nAll commands accept --root PATH.');
|
|
131
|
+
console.log('cliewen-openspec\ninit [--default] [--dry-run] [--profile solo|team]\nprofile solo|team [--concurrent] [--shared-review] [--apply [--enable-review]] [--json]\nupdate [--dry-run] [--json]\nuninstall [--default-schema NAME] [--dry-run] [--json]\nac next --capability NAME\nac next PREFIX (registered active prefix only)\nac rename-prefix CAPABILITY PREFIX\nac coordinate REMOTE [--apply] (preview by default)\nac sync\nac resume\nac abandon\ndocs check [--json]\nci inspect [--json]\ncheck [--change NAME | --capability NAME] [--json] [--fail-on-pending]\nrecover\nAll commands accept --root PATH.');
|
|
106
132
|
else
|
|
107
133
|
throw Error(`Unknown command: ${command}`);
|
|
108
134
|
}
|
package/dist/core.d.ts
CHANGED
|
@@ -13,6 +13,10 @@ export type Config = {
|
|
|
13
13
|
exclude: string[];
|
|
14
14
|
maxFiles: number;
|
|
15
15
|
};
|
|
16
|
+
readiness: {
|
|
17
|
+
enabled: boolean;
|
|
18
|
+
threshold: number;
|
|
19
|
+
};
|
|
16
20
|
docsRoot: string;
|
|
17
21
|
learnings: {
|
|
18
22
|
enabled: boolean;
|
|
@@ -60,18 +64,33 @@ export type LifecycleResult = {
|
|
|
60
64
|
compatibility: Compatibility;
|
|
61
65
|
recoveredTransaction: boolean;
|
|
62
66
|
};
|
|
63
|
-
export
|
|
67
|
+
export type SetupProfile = 'solo' | 'team';
|
|
68
|
+
export declare function setupProfile(value: string): SetupProfile;
|
|
69
|
+
export declare function profileSnapshot(root: string, existingOnly?: boolean): {
|
|
70
|
+
settings: string | undefined;
|
|
71
|
+
stored: string | undefined;
|
|
72
|
+
current: SetupProfile | undefined;
|
|
73
|
+
review: boolean;
|
|
74
|
+
coordinated: boolean;
|
|
75
|
+
};
|
|
76
|
+
type ProfileSelection = {
|
|
77
|
+
profile: SetupProfile;
|
|
78
|
+
enableReview: boolean;
|
|
79
|
+
basis: ReturnType<typeof profileSnapshot>;
|
|
80
|
+
};
|
|
81
|
+
export declare function applyProfile(root: string, selection: ProfileSelection): string[];
|
|
82
|
+
export declare function lifecycle(root: string, operation: 'init' | 'update', dryRun?: boolean, makeDefault?: boolean, profile?: ProfileSelection): LifecycleResult;
|
|
64
83
|
export declare function init(root: string, dryRun: boolean, makeDefault: boolean): string[];
|
|
65
84
|
export declare function update(root: string, dryRun?: boolean): {
|
|
66
85
|
writes: string[];
|
|
67
86
|
deletes: string[];
|
|
68
87
|
};
|
|
69
88
|
export declare function markdowns(dir: string): string[];
|
|
70
|
-
export declare function scenarios(root: string, change?: string): {
|
|
89
|
+
export declare function scenarios(root: string, change?: string, capability?: string): {
|
|
71
90
|
id: string;
|
|
72
91
|
title: string;
|
|
73
92
|
file: string;
|
|
74
93
|
testTypes: string[];
|
|
75
94
|
}[];
|
|
76
95
|
export declare function git(root: string, args: string[]): string;
|
|
77
|
-
export declare function check(root: string, change?: string, failPending?: boolean): Finding[];
|
|
96
|
+
export declare function check(root: string, change?: string, failPending?: boolean, capability?: string): Finding[];
|
package/dist/core.js
CHANGED
|
@@ -48,7 +48,7 @@ const normalize = (s) => s.replace(/\r\n/g, '\n');
|
|
|
48
48
|
const hash = (s) => createHash('sha256').update(normalize(s)).digest('hex');
|
|
49
49
|
const read = (p) => fs.readFileSync(p, 'utf8');
|
|
50
50
|
export function defaults() {
|
|
51
|
-
return { ciInspection: ciDefaults(), documentationChecks: documentationDefaults(), contextSelection: { mode: 'guided', roots: [], exclude: [], maxFiles: 8 }, docsRoot: 'docs', learnings: { enabled: false, directory: 'learnings' }, writing: { humanizer: 'auto' }, features: Object.fromEntries(features.map(f => [f, true])), evidence: { report: '.cliewen-openspec/evidence.json' }, ac: { capabilities: {}, padding: 3 }, testing: { ...qualityDefaults(), placement: 'per-task', types: {
|
|
51
|
+
return { ciInspection: ciDefaults(), documentationChecks: documentationDefaults(), contextSelection: { mode: 'guided', roots: [], exclude: [], maxFiles: 8 }, readiness: { enabled: true, threshold: 3 }, docsRoot: 'docs', learnings: { enabled: false, directory: 'learnings' }, writing: { humanizer: 'auto' }, features: Object.fromEntries(features.map(f => [f, true])), evidence: { report: '.cliewen-openspec/evidence.json' }, ac: { capabilities: {}, padding: 3 }, testing: { ...qualityDefaults(), placement: 'per-task', types: {
|
|
52
52
|
Unit: { description: 'Isolated behavior without external dependencies' },
|
|
53
53
|
Integration: { description: 'Interaction between components or dependencies' },
|
|
54
54
|
E2E: { description: 'Complete user or system workflow' }
|
|
@@ -64,10 +64,19 @@ function keys(o, allowed, label) {
|
|
|
64
64
|
export function config(root) {
|
|
65
65
|
const p = local(root, `${state}/config.yaml`);
|
|
66
66
|
const raw = parse(read(p));
|
|
67
|
-
keys(raw, ['docsRoot', 'learnings', 'writing', 'features', 'evidence', 'ac', 'testing', 'contextSelection', 'documentationChecks', 'ciInspection'], 'config');
|
|
67
|
+
keys(raw, ['docsRoot', 'learnings', 'writing', 'features', 'evidence', 'ac', 'testing', 'contextSelection', 'documentationChecks', 'ciInspection', 'readiness'], 'config');
|
|
68
68
|
const c = defaults();
|
|
69
69
|
c.documentationChecks = documentationSettings(raw.documentationChecks);
|
|
70
70
|
c.ciInspection = ciSettings(raw.ciInspection);
|
|
71
|
+
if (raw.readiness !== undefined) {
|
|
72
|
+
keys(raw.readiness, ['enabled', 'threshold'], 'readiness');
|
|
73
|
+
const { enabled = c.readiness.enabled, threshold = c.readiness.threshold } = raw.readiness;
|
|
74
|
+
if (typeof enabled !== 'boolean')
|
|
75
|
+
throw Error('readiness.enabled must be boolean');
|
|
76
|
+
if (!Number.isInteger(threshold) || threshold < 2 || threshold > 4)
|
|
77
|
+
throw Error('readiness.threshold must be an integer from 2 through 4');
|
|
78
|
+
c.readiness = { enabled, threshold };
|
|
79
|
+
}
|
|
71
80
|
if (raw.learnings !== undefined) {
|
|
72
81
|
keys(raw.learnings, ['enabled', 'directory'], 'learnings');
|
|
73
82
|
if (raw.learnings.enabled !== undefined) {
|
|
@@ -515,12 +524,72 @@ function requireLocalPlanning(root) {
|
|
|
515
524
|
if (standalone || (pointer && !localDirs))
|
|
516
525
|
throw Error('External OpenSpec stores are not supported by Cliewen init/update. Use a repository-local OpenSpec project with its own specs and changes; cross-repository acceptance identities and evidence require separate support. No files changed.');
|
|
517
526
|
}
|
|
518
|
-
export function
|
|
527
|
+
export function setupProfile(value) {
|
|
528
|
+
if (value !== 'solo' && value !== 'team')
|
|
529
|
+
throw Error('Choose a solo or team profile');
|
|
530
|
+
return value;
|
|
531
|
+
}
|
|
532
|
+
const profileFile = `${state}/setup-profile.json`;
|
|
533
|
+
const settingsFile = `${state}/config.yaml`;
|
|
534
|
+
export function profileSnapshot(root, existingOnly = false) {
|
|
535
|
+
if (existingOnly) {
|
|
536
|
+
if (fs.existsSync(local(root, `${state}/transaction.json`)))
|
|
537
|
+
throw Error('Run recover before previewing a profile.');
|
|
538
|
+
ownedManifest(root, 'update');
|
|
539
|
+
if (!fs.existsSync(local(root, settingsFile)))
|
|
540
|
+
throw Error('Project settings are missing. Run init before switching profiles.');
|
|
541
|
+
}
|
|
542
|
+
const optional = (file) => {
|
|
543
|
+
const target = local(root, file);
|
|
544
|
+
return fs.existsSync(target) ? read(target) : undefined;
|
|
545
|
+
};
|
|
546
|
+
const settings = optional(settingsFile);
|
|
547
|
+
const stored = optional(profileFile);
|
|
548
|
+
const coordination = optional(`${state}/ac-coordination.json`);
|
|
549
|
+
const record = stored === undefined ? null : JSON.parse(stored);
|
|
550
|
+
if (stored !== undefined && (record?.version !== 1 || !['solo', 'team'].includes(record.profile)))
|
|
551
|
+
throw Error(`Invalid setup profile in ${profileFile}`);
|
|
552
|
+
return {
|
|
553
|
+
settings, stored, current: record?.profile,
|
|
554
|
+
review: settings === undefined ? defaults().features.review : config(root).features.review,
|
|
555
|
+
coordinated: coordination !== undefined && JSON.parse(coordination)?.mode === 'git'
|
|
556
|
+
};
|
|
557
|
+
}
|
|
558
|
+
function profileWrites(root, selection) {
|
|
559
|
+
const { profile, enableReview, basis } = selection;
|
|
560
|
+
if (!isDeepStrictEqual(profileSnapshot(root), basis))
|
|
561
|
+
throw Error('Project settings changed after preview. Preview the profile again.');
|
|
562
|
+
const writes = {};
|
|
563
|
+
if (basis.current !== profile)
|
|
564
|
+
writes[profileFile] = JSON.stringify({ version: 1, profile }, null, 2) + '\n';
|
|
565
|
+
if (enableReview && !basis.review) {
|
|
566
|
+
const doc = parseDocument(basis.settings ?? '{}');
|
|
567
|
+
const expected = doc.toJS();
|
|
568
|
+
expected.features.review = true;
|
|
569
|
+
doc.setIn(['features', 'review'], true);
|
|
570
|
+
if (!isDeepStrictEqual(doc.toJS(), expected))
|
|
571
|
+
throw Error('Enabling review would also change other YAML values. Resolve shared aliases first.');
|
|
572
|
+
writes[settingsFile] = doc.toString();
|
|
573
|
+
}
|
|
574
|
+
return writes;
|
|
575
|
+
}
|
|
576
|
+
export function applyProfile(root, selection) {
|
|
577
|
+
return withStateLock(root, () => {
|
|
578
|
+
if (fs.existsSync(local(root, `${state}/transaction.json`)))
|
|
579
|
+
throw Error('Run recover before applying a profile.');
|
|
580
|
+
ownedManifest(root, 'update');
|
|
581
|
+
const writes = profileWrites(root, selection);
|
|
582
|
+
transaction(root, writes);
|
|
583
|
+
return Object.keys(writes);
|
|
584
|
+
});
|
|
585
|
+
}
|
|
586
|
+
export function lifecycle(root, operation, dryRun = false, makeDefault = false, profile) {
|
|
519
587
|
const tools = compatibility(root);
|
|
520
588
|
requireLocalPlanning(root);
|
|
521
|
-
|
|
589
|
+
const run = () => applyLifecycle(root, operation, dryRun, makeDefault, tools, profile);
|
|
590
|
+
return dryRun ? run() : withStateLock(root, run);
|
|
522
591
|
}
|
|
523
|
-
function applyLifecycle(root, operation, dryRun, makeDefault, tools) {
|
|
592
|
+
function applyLifecycle(root, operation, dryRun, makeDefault, tools, profile) {
|
|
524
593
|
const pending = fs.existsSync(local(root, `${state}/transaction.json`));
|
|
525
594
|
if (pending && dryRun)
|
|
526
595
|
throw Error('Interrupted transaction exists; run recover before preview. No preview files changed.');
|
|
@@ -530,6 +599,8 @@ function applyLifecycle(root, operation, dryRun, makeDefault, tools) {
|
|
|
530
599
|
const mp = local(root, `${state}/manifest.json`);
|
|
531
600
|
const installedVersion = fs.existsSync(mp) ? ownedManifest(root, 'update').version : null;
|
|
532
601
|
const changes = operation === 'init' ? planInit(root, makeDefault) : planUpdate(root);
|
|
602
|
+
if (profile)
|
|
603
|
+
Object.assign(changes, profileWrites(root, profile));
|
|
533
604
|
const writes = Object.keys(changes).filter(file => changes[file] !== null);
|
|
534
605
|
const result = { writes, deletes: Object.keys(changes).filter(file => changes[file] === null), creates: writes.filter(file => !fs.existsSync(local(root, file))), replaces: writes.filter(file => fs.existsSync(local(root, file))), installedVersion, targetVersion: version, compatibility: tools, recoveredTransaction: pending };
|
|
535
606
|
transaction(root, changes, dryRun);
|
|
@@ -553,7 +624,9 @@ export function markdowns(dir) {
|
|
|
553
624
|
return [];
|
|
554
625
|
return fs.readdirSync(dir, { withFileTypes: true }).flatMap(e => e.isDirectory() ? markdowns(path.join(dir, e.name)) : e.isFile() && e.name.endsWith('.md') ? [path.join(dir, e.name)] : []);
|
|
555
626
|
}
|
|
556
|
-
export function scenarios(root, change) {
|
|
627
|
+
export function scenarios(root, change, capability) {
|
|
628
|
+
if (change !== undefined && capability !== undefined)
|
|
629
|
+
throw Error('Choose either --change or --capability');
|
|
557
630
|
if (change && !/^[a-z0-9]+(?:-[a-z0-9]+)*$/.test(change))
|
|
558
631
|
throw Error('Change must be a kebab-case name');
|
|
559
632
|
let folder = change ? local(root, `openspec/changes/${change}/specs`) : local(root, 'openspec/specs');
|
|
@@ -566,7 +639,18 @@ export function scenarios(root, change) {
|
|
|
566
639
|
if (change && !fs.existsSync(folder))
|
|
567
640
|
throw Error(`Change specs do not exist: ${change}`);
|
|
568
641
|
const out = [];
|
|
569
|
-
|
|
642
|
+
let files;
|
|
643
|
+
if (capability === undefined)
|
|
644
|
+
files = markdowns(folder);
|
|
645
|
+
else {
|
|
646
|
+
if (!/^[a-z0-9]+(?:-[a-z0-9]+)*$/.test(capability))
|
|
647
|
+
throw Error('Capability must be a kebab-case name');
|
|
648
|
+
const spec = local(root, `openspec/specs/${capability}/spec.md`);
|
|
649
|
+
if (!fs.existsSync(spec))
|
|
650
|
+
throw Error(`Permanent capability spec does not exist: ${capability}`);
|
|
651
|
+
files = [spec];
|
|
652
|
+
}
|
|
653
|
+
for (const file of files) {
|
|
570
654
|
let fence = false, removed = false;
|
|
571
655
|
let current;
|
|
572
656
|
for (const line of read(file).split(/\r?\n/)) {
|
|
@@ -590,13 +674,16 @@ export function scenarios(root, change) {
|
|
|
590
674
|
current.testTypes.push(type[1]);
|
|
591
675
|
}
|
|
592
676
|
}
|
|
677
|
+
if (capability !== undefined && !out.length)
|
|
678
|
+
throw Error(`No active scenarios in permanent capability: ${capability}`);
|
|
593
679
|
return out;
|
|
594
680
|
}
|
|
595
681
|
export function git(root, args) { return execFileSync('git', ['-C', root, ...args], { encoding: 'utf8', stdio: ['ignore', 'pipe', 'pipe'] }).trim(); }
|
|
596
|
-
export function check(root, change, failPending = false) {
|
|
682
|
+
export function check(root, change, failPending = false, capability) {
|
|
597
683
|
const findings = [];
|
|
598
684
|
const add = (code, message, severity = 'error') => findings.push({ code, severity, message });
|
|
599
685
|
const c = config(root);
|
|
686
|
+
const selected = capability === undefined ? undefined : scenarios(root, change, capability);
|
|
600
687
|
if (fs.existsSync(local(root, `${state}/transaction.json`)))
|
|
601
688
|
add('interrupted-transaction', 'Run recover before continuing');
|
|
602
689
|
const mp = local(root, `${state}/manifest.json`);
|
|
@@ -662,7 +749,7 @@ export function check(root, change, failPending = false) {
|
|
|
662
749
|
add('quality-evidence-unavailable', 'Test policy review remains advisory: enable evidence for execution-backed assessment.', 'warning');
|
|
663
750
|
return findings;
|
|
664
751
|
}
|
|
665
|
-
const specs = scenarios(root, change);
|
|
752
|
+
const specs = selected ?? scenarios(root, change);
|
|
666
753
|
const ids = new Set();
|
|
667
754
|
for (const s of specs) {
|
|
668
755
|
if (!s.id)
|
|
@@ -688,14 +775,18 @@ export function check(root, change, failPending = false) {
|
|
|
688
775
|
if (!report || report.version !== 1 || typeof report.revision !== 'string' || !/^[a-f0-9]{40,64}$/.test(report.revision) || !Array.isArray(report.results))
|
|
689
776
|
throw Error('Invalid evidence report: expected version 1, full revision and results');
|
|
690
777
|
if (report.scope !== undefined) {
|
|
691
|
-
keys(report.scope, ['change'], 'evidence scope');
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
778
|
+
keys(report.scope, ['change', 'capability'], 'evidence scope');
|
|
779
|
+
const entries = Object.entries(report.scope);
|
|
780
|
+
if (entries.length !== 1 || typeof entries[0][1] !== 'string' || !/^[a-z0-9]+(?:-[a-z0-9]+)*$/.test(entries[0][1]))
|
|
781
|
+
throw Error('Invalid evidence scope: expected one kebab-case change or capability name');
|
|
782
|
+
const [kind, name] = entries[0];
|
|
783
|
+
if (name !== (kind === 'change' ? change : capability))
|
|
784
|
+
add('evidence-scope-mismatch', `Report is scoped to ${kind} ${name}. Collect evidence for the requested scope.`);
|
|
696
785
|
if (report.execution === undefined)
|
|
697
786
|
throw Error('Scoped evidence requires the complete test runner exit code');
|
|
698
787
|
}
|
|
788
|
+
else if (capability !== undefined)
|
|
789
|
+
add('evidence-scope-mismatch', `Collect evidence with --capability ${capability}.`);
|
|
699
790
|
if (report.execution !== undefined && (!report.execution || !Number.isInteger(report.execution.exitCode)))
|
|
700
791
|
throw Error('Invalid evidence execution result');
|
|
701
792
|
if (report.execution?.exitCode !== undefined && report.execution.exitCode !== 0)
|
|
@@ -744,7 +835,7 @@ export function check(root, change, failPending = false) {
|
|
|
744
835
|
for (const id of ids)
|
|
745
836
|
if (!seen.has(id))
|
|
746
837
|
add('missing-evidence', id);
|
|
747
|
-
findings.push(...checkQuality(root, c, specs, report, change, local));
|
|
838
|
+
findings.push(...checkQuality(root, c, specs, report, change, local, capability));
|
|
748
839
|
add('sufficiency-not-assessed', 'Execution and linkage do not prove assertion quality; review the assertions against the scenarios.', 'info');
|
|
749
840
|
return findings;
|
|
750
841
|
}
|
package/dist/quality.d.ts
CHANGED
|
@@ -23,5 +23,5 @@ type Scenario = {
|
|
|
23
23
|
testTypes: string[];
|
|
24
24
|
};
|
|
25
25
|
type Resolve = (root: string, relative: string) => string;
|
|
26
|
-
export declare function checkQuality(root: string, config: Config, specs: Scenario[], report: any, change: string | undefined, resolve: Resolve): Finding[];
|
|
26
|
+
export declare function checkQuality(root: string, config: Config, specs: Scenario[], report: any, change: string | undefined, resolve: Resolve, capability?: string): Finding[];
|
|
27
27
|
export {};
|
package/dist/quality.js
CHANGED
|
@@ -47,7 +47,7 @@ export function configureQuality(settings, raw) {
|
|
|
47
47
|
}
|
|
48
48
|
}
|
|
49
49
|
const git = (root, ...args) => execFileSync('git', ['-C', root, ...args], { stdio: ['ignore', 'pipe', 'pipe'], maxBuffer: 32 * 1024 * 1024 });
|
|
50
|
-
export function checkQuality(root, config, specs, report, change, resolve) {
|
|
50
|
+
export function checkQuality(root, config, specs, report, change, resolve, capability) {
|
|
51
51
|
const findings = [];
|
|
52
52
|
const modes = { coverage: config.testing.quality.coverage.mode, effectiveness: config.testing.quality.effectiveness.mode, lifecycle: config.testing.lifecycle.mode };
|
|
53
53
|
const add = (policy, code, message) => {
|
|
@@ -57,7 +57,8 @@ export function checkQuality(root, config, specs, report, change, resolve) {
|
|
|
57
57
|
if (Object.values(modes).every(value => value === 'off'))
|
|
58
58
|
return findings;
|
|
59
59
|
const ids = new Set(specs.map(s => s.id));
|
|
60
|
-
const
|
|
60
|
+
const recordName = capability !== undefined ? `capability-${capability}` : change ? `change-${change}` : 'specs';
|
|
61
|
+
const recordPath = `.cliewen-openspec/reviews/${recordName}.yaml`;
|
|
61
62
|
let review;
|
|
62
63
|
let usable = false;
|
|
63
64
|
try {
|
|
@@ -75,7 +76,9 @@ export function checkQuality(root, config, specs, report, change, resolve) {
|
|
|
75
76
|
only(review, ['version', 'scope', 'baseline', 'inputs', 'effectiveness', 'lifecycle', 'exceptions'], 'test review');
|
|
76
77
|
if (review.version !== 1 || !object(review.inputs) || !Object.keys(review.inputs).length || ![review.effectiveness, review.lifecycle, review.exceptions].every(Array.isArray))
|
|
77
78
|
throw Error('Expected version 1, nonempty inputs, and effectiveness/lifecycle/exceptions lists');
|
|
78
|
-
|
|
79
|
+
const scopeMatches = object(review.scope) && Object.keys(review.scope).length === 1 &&
|
|
80
|
+
(capability !== undefined ? review.scope.capability === capability : change ? review.scope.change === change : review.scope.specs === true);
|
|
81
|
+
if (!scopeMatches)
|
|
79
82
|
throw Error('test-review-scope-mismatch');
|
|
80
83
|
if (typeof review.baseline !== 'string' || !/^[a-f0-9]{40,64}$/.test(review.baseline))
|
|
81
84
|
throw Error('baseline must be a full Git commit ID');
|
|
@@ -219,14 +222,14 @@ export function checkQuality(root, config, specs, report, change, resolve) {
|
|
|
219
222
|
return;
|
|
220
223
|
// Scenario projection and baseline comparison are performed without changing OpenSpec files.
|
|
221
224
|
try {
|
|
222
|
-
lifecycleReview(root, review, change, ids, report, add, waived, resolve);
|
|
225
|
+
lifecycleReview(root, review, change, ids, report, add, waived, resolve, capability);
|
|
223
226
|
}
|
|
224
227
|
catch (error) {
|
|
225
228
|
add('lifecycle', 'lifecycle-unresolved', String(error));
|
|
226
229
|
}
|
|
227
230
|
}
|
|
228
231
|
}
|
|
229
|
-
function lifecycleReview(root, review, change, ids, report, add, waived, resolve) {
|
|
232
|
+
function lifecycleReview(root, review, change, ids, report, add, waived, resolve, capability) {
|
|
230
233
|
const requirements = (source) => {
|
|
231
234
|
const result = new Map();
|
|
232
235
|
let operation = 'permanent', current, scenario, fence = '';
|
|
@@ -313,7 +316,8 @@ function lifecycleReview(root, review, change, ids, report, add, waived, resolve
|
|
|
313
316
|
}
|
|
314
317
|
return result;
|
|
315
318
|
};
|
|
316
|
-
const
|
|
319
|
+
const baselineTree = tree(review.baseline);
|
|
320
|
+
const baseline = flatten(baselineTree);
|
|
317
321
|
const targetTree = tree('HEAD');
|
|
318
322
|
if (change) {
|
|
319
323
|
const folder = `openspec/changes/${change}/specs`;
|
|
@@ -344,7 +348,14 @@ function lifecycleReview(root, review, change, ids, report, add, waived, resolve
|
|
|
344
348
|
}
|
|
345
349
|
}
|
|
346
350
|
const target = flatten(targetTree);
|
|
347
|
-
const
|
|
351
|
+
const selected = new Set(ids);
|
|
352
|
+
if (capability !== undefined) {
|
|
353
|
+
for (const requirement of baselineTree.get(`${capability}/spec.md`)?.values() ?? []) {
|
|
354
|
+
for (const id of requirement.scenarios.keys())
|
|
355
|
+
selected.add(id);
|
|
356
|
+
}
|
|
357
|
+
}
|
|
358
|
+
const required = new Set([...baseline.keys()].filter(id => (capability === undefined || selected.has(id)) && (!target.has(id) || baseline.get(id) !== target.get(id))));
|
|
348
359
|
const dispositions = new Set();
|
|
349
360
|
for (const entry of review.lifecycle) {
|
|
350
361
|
try {
|
|
@@ -352,6 +363,8 @@ function lifecycleReview(root, review, change, ids, report, add, waived, resolve
|
|
|
352
363
|
if (!text(entry.scenario) || dispositions.has(entry.scenario) || !['unchanged', 'modified', 'retired'].includes(entry.change) || !text(entry.reason) || !['proposed', 'reviewed'].includes(entry.status) || !Array.isArray(entry.tests))
|
|
353
364
|
throw Error('Invalid or duplicate lifecycle disposition');
|
|
354
365
|
dispositions.add(entry.scenario);
|
|
366
|
+
if (capability !== undefined && !selected.has(entry.scenario))
|
|
367
|
+
throw Error('Lifecycle disposition is outside the selected capability');
|
|
355
368
|
if (!baseline.has(entry.scenario))
|
|
356
369
|
throw Error('Lifecycle scenario must exist at baseline');
|
|
357
370
|
const isRetired = !target.has(entry.scenario);
|
|
@@ -392,6 +405,8 @@ function lifecycleReview(root, review, change, ids, report, add, waived, resolve
|
|
|
392
405
|
throw Error('Remapping needs replacement scenarios');
|
|
393
406
|
if (test.action !== 'remap' && test.replacementScenarios !== undefined)
|
|
394
407
|
throw Error('Replacement scenarios require remap');
|
|
408
|
+
if (capability !== undefined && test.action === 'remap' && replacements.some((id) => !ids.has(id)))
|
|
409
|
+
throw Error('Use a whole-project check for cross-capability remapping');
|
|
395
410
|
for (const id of replacements ?? [])
|
|
396
411
|
if (!target.has(id) || ((test.action === 'remap' || ids.has(id)) && !report.results.some((row) => row.scenario === id && row.outcome === 'passed')))
|
|
397
412
|
throw Error('Remapped or in-scope obligations require target scenarios and passing evidence');
|
package/dist/release.d.ts
CHANGED
package/dist/release.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export const version = '0.
|
|
1
|
+
export const version = '0.4.0';
|
|
2
2
|
export const requirements = { node: '22.12.0', openspec: '1.15.0' };
|
|
3
|
-
export const supportedInstallations = ['0.1.0', '0.2.0', version];
|
|
3
|
+
export const supportedInstallations = ['0.1.0', '0.2.0', '0.3.0', version];
|
|
4
4
|
export function stableVersion(value) {
|
|
5
5
|
const match = /^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:\+[0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*)?$/.exec(value);
|
|
6
6
|
if (!match)
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { type SetupProfile } from './core.js';
|
|
2
|
+
export declare function selectSetupProfile(root: string, selected: string | undefined, options: {
|
|
3
|
+
interactive: boolean;
|
|
4
|
+
concurrent: boolean;
|
|
5
|
+
sharedReview: boolean;
|
|
6
|
+
enableReview: boolean;
|
|
7
|
+
existingOnly?: boolean;
|
|
8
|
+
}): Promise<{
|
|
9
|
+
selection: {
|
|
10
|
+
profile: "solo" | "team";
|
|
11
|
+
enableReview: boolean;
|
|
12
|
+
basis: {
|
|
13
|
+
settings: string | undefined;
|
|
14
|
+
stored: string | undefined;
|
|
15
|
+
current: SetupProfile | undefined;
|
|
16
|
+
review: boolean;
|
|
17
|
+
coordinated: boolean;
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
summary: {
|
|
21
|
+
current: SetupProfile | null;
|
|
22
|
+
proposed: "solo" | "team";
|
|
23
|
+
recommendations: string[];
|
|
24
|
+
settings: {
|
|
25
|
+
key: string;
|
|
26
|
+
current: boolean;
|
|
27
|
+
proposed: boolean;
|
|
28
|
+
selected: boolean;
|
|
29
|
+
}[];
|
|
30
|
+
};
|
|
31
|
+
} | undefined>;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { createInterface } from 'node:readline/promises';
|
|
2
|
+
import { profileSnapshot, setupProfile } from './core.js';
|
|
3
|
+
export async function selectSetupProfile(root, selected, options) {
|
|
4
|
+
const { interactive, existingOnly } = options;
|
|
5
|
+
let { concurrent, sharedReview, enableReview } = options;
|
|
6
|
+
let profile = selected === undefined ? undefined : setupProfile(selected);
|
|
7
|
+
if (!profile && !interactive)
|
|
8
|
+
return;
|
|
9
|
+
const basis = profileSnapshot(root, existingOnly);
|
|
10
|
+
const terminal = interactive ? createInterface({ input: process.stdin, output: process.stderr }) : undefined;
|
|
11
|
+
const abort = new AbortController();
|
|
12
|
+
terminal?.once('SIGINT', () => terminal.close());
|
|
13
|
+
terminal?.once('close', () => abort.abort());
|
|
14
|
+
const ask = (question) => terminal.question(question, { signal: abort.signal });
|
|
15
|
+
const yes = async (question) => /^y(?:es)?$/i.test((await ask(question)).trim());
|
|
16
|
+
try {
|
|
17
|
+
if (!profile) {
|
|
18
|
+
const explanation = basis.settings === undefined
|
|
19
|
+
? 'Assign acceptance IDs locally. Agents are asked to test each implementation task and collect evidence. Test quality and lifecycle findings are advisory. Set up CI separately if you use it.'
|
|
20
|
+
: 'Keep your current settings if you choose a profile later.';
|
|
21
|
+
process.stderr.write(`${explanation}\nSee all settings at https://cliewen-openspec.github.io/guide/configuration.html#full-defaults\n`);
|
|
22
|
+
const choice = (await ask('How do you work on this project? Solo / Team / Choose later [later]: ')).trim().toLowerCase();
|
|
23
|
+
if (!choice || choice === 'later' || choice === 'choose later')
|
|
24
|
+
return;
|
|
25
|
+
profile = setupProfile(choice);
|
|
26
|
+
}
|
|
27
|
+
if (terminal) {
|
|
28
|
+
process.stderr.write(`Setup profile: ${basis.current ?? 'none'} → ${profile}\n`);
|
|
29
|
+
if (!concurrent && !basis.coordinated)
|
|
30
|
+
concurrent = await yes('Can separate clones or worktrees allocate IDs concurrently? [y/N] ');
|
|
31
|
+
if (profile === 'team' && !sharedReview && !basis.review)
|
|
32
|
+
sharedReview = await yes('Does the team review changes together? [y/N] ');
|
|
33
|
+
}
|
|
34
|
+
if (enableReview && (profile !== 'team' || !sharedReview))
|
|
35
|
+
throw Error('Use --enable-review with a team profile and --shared-review.');
|
|
36
|
+
const reviewRecommended = profile === 'team' && sharedReview && !basis.review;
|
|
37
|
+
const recommendations = [];
|
|
38
|
+
if (concurrent && !basis.coordinated) {
|
|
39
|
+
recommendations.push('Preview Git coordination with cliewen-openspec ac coordinate REMOTE. Concurrent allocation needs a shared authority.');
|
|
40
|
+
}
|
|
41
|
+
if (profile === 'team')
|
|
42
|
+
recommendations.push('Use the project’s existing integration policy for review and CI.');
|
|
43
|
+
if (reviewRecommended)
|
|
44
|
+
recommendations.push('Enable features.review for agents to prepare changes for team review (false → true).');
|
|
45
|
+
if (terminal) {
|
|
46
|
+
for (const recommendation of recommendations)
|
|
47
|
+
process.stderr.write(`${recommendation}\n`);
|
|
48
|
+
if (reviewRecommended && !enableReview)
|
|
49
|
+
enableReview = await yes('Enable features.review? [y/N] ');
|
|
50
|
+
}
|
|
51
|
+
return {
|
|
52
|
+
selection: { profile, enableReview, basis },
|
|
53
|
+
summary: { current: basis.current ?? null, proposed: profile, recommendations, settings: reviewRecommended ? [{ key: 'features.review', current: false, proposed: true, selected: enableReview }] : [] }
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
finally {
|
|
57
|
+
terminal?.close();
|
|
58
|
+
}
|
|
59
|
+
}
|
package/docs/configuration.md
CHANGED
|
@@ -5,13 +5,13 @@ type: reference
|
|
|
5
5
|
|
|
6
6
|
Cliewen reads project settings from `.cliewen-openspec/config.yaml`.
|
|
7
7
|
|
|
8
|
-
This reference describes Cliewen `0.
|
|
8
|
+
This reference describes Cliewen `0.4.0`. For an older package, consult the reference bundled with that version.
|
|
9
9
|
|
|
10
10
|
## Version compatibility
|
|
11
11
|
|
|
12
|
-
Cliewen 0.
|
|
12
|
+
Cliewen 0.4.0 requires **Node.js 22.12 or newer** and **OpenSpec 1.15.0 or newer**. Git remains necessary for identity coordination and revision-bound evidence. The documentation checker runs independently of Git and OpenSpec. Versions 0.1.0 and 0.2.0 retain their Node 20.19+ requirements. The worked guide uses OpenSpec 2.0.0.
|
|
13
13
|
|
|
14
|
-
Cliewen
|
|
14
|
+
Cliewen supports repository-local OpenSpec 2.0.0 workflows. External stores and multi-repo evidence remain unsupported. Init and update reject standalone stores and declared external planning layouts before recovery or writes. Local specs and changes take precedence when both exist.
|
|
15
15
|
|
|
16
16
|
OpenSpec has its own installation requirements:
|
|
17
17
|
|
|
@@ -31,7 +31,7 @@ Init/update check the target package's minimums, including previews, before reco
|
|
|
31
31
|
|
|
32
32
|
The check uses the project's resolvable OpenSpec npm installation first, otherwise the CLI on PATH, including a standalone executable. It runs that installation's public `--version`; an incompatible or broken selected local installation does not fall back to a global version. Output identifies the source and detected versions. Missing tools, invalid/prerelease versions, execution failure, or a probe exceeding five seconds stop init/update with an actionable error. Cliewen neither downloads nor upgrades OpenSpec during this check.
|
|
33
33
|
|
|
34
|
-
|
|
34
|
+
Version 0.4.0 accepts ownership manifests from 0.1.0 through 0.4.0. Alpha manifests, unknown formats, and downgrades are rejected. See [updating an installation](guide/updating.md) for preview and apply examples.
|
|
35
35
|
|
|
36
36
|
## Documentation checks in development source
|
|
37
37
|
|
|
@@ -141,6 +141,26 @@ Valid advisory reports exit 0 even for missing or unknown requirements; invalid
|
|
|
141
141
|
|
|
142
142
|
Requests have a 10-second deadline and a 1 MiB response limit, with 60 seconds for the inspection, at most 10 pages of 100 effective rules and 32 ruleset-detail requests. Truncated, refused, malformed or contradictory results leave affected coverage unknown. Required-workflow rules, other hosts and actor-specific permissions are outside supported coverage. No project file, host setting or persistent report is written. See [the command reference](guide/cli.md#ci-inspect).
|
|
143
143
|
|
|
144
|
+
## Setup profiles
|
|
145
|
+
|
|
146
|
+
The development CLI offers optional solo and team profiles. A new project starts with local acceptance ID allocation, per-task test guidance, evidence enabled, advisory test quality and lifecycle findings, and CI configured separately. Choosing later uses these defaults for a new project and keeps current settings in an existing one.
|
|
147
|
+
|
|
148
|
+
The solo profile asks whether multiple clones or worktrees allocate IDs at the same time. The team profile uses the same concurrency question and can suggest enabling review guidance when the team reviews changes together. Both start with the same effective settings. Settings only change when you select a recommendation.
|
|
149
|
+
|
|
150
|
+
The selected profile is stored in the project-owned `.cliewen-openspec/setup-profile.json`. Init, update, and uninstall preserve it when you make no new profile selection. [Switch an existing project from solo to team](guide/cli.md#choose-or-change-a-setup-profile)
|
|
151
|
+
|
|
152
|
+
## Implementation readiness
|
|
153
|
+
|
|
154
|
+
By default, before implementation the agent rates outcome clarity and delivery feasibility from 1 to 4. It uses the lower score and a threshold of 3. Solo and team projects use the same settings. Change the threshold to an integer from 2 through 4, or set `readiness.enabled` to `false` to skip the assessment.
|
|
155
|
+
|
|
156
|
+
```yaml
|
|
157
|
+
readiness:
|
|
158
|
+
enabled: true
|
|
159
|
+
threshold: 3
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
[How an agent handles an unanswered question](guide/workflow.md#assess-implementation-readiness)
|
|
163
|
+
|
|
144
164
|
## Full defaults
|
|
145
165
|
|
|
146
166
|
This is the complete configuration written by `init`. Omitted fields use these values; unknown settings and invalid values fail validation. Changes apply when the next operation reads the config. They do not rewrite existing proposals or task lists.
|
|
@@ -165,6 +185,9 @@ contextSelection:
|
|
|
165
185
|
roots: []
|
|
166
186
|
exclude: []
|
|
167
187
|
maxFiles: 8
|
|
188
|
+
readiness:
|
|
189
|
+
enabled: true
|
|
190
|
+
threshold: 3
|
|
168
191
|
docsRoot: docs
|
|
169
192
|
learnings:
|
|
170
193
|
enabled: false
|
package/docs/testing/evidence.md
CHANGED
|
@@ -70,7 +70,7 @@ For `cliewen-all`, check first validates decision frontmatter and the outcome br
|
|
|
70
70
|
| `test-failed`, `test-skipped`, or `runner-failed` | Inspect real test output, fix failures, and collect a new report; do not edit a report to claim a pass |
|
|
71
71
|
| `missing-ac-id` or `missing-evidence` | Check scenario headings and bracketed IDs in test titles; supply a test result for each selected scenario |
|
|
72
72
|
| `unknown-ac-reference` | Use the matching `--change` scope or collect a report containing only the scenarios being checked |
|
|
73
|
-
| `evidence-scope-mismatch` |
|
|
73
|
+
| `evidence-scope-mismatch` | Use the same scope for collection and checking. After synchronization, collect fresh evidence for the permanent spec scope you want to check. |
|
|
74
74
|
| `duplicate-ac-id` or `duplicate-test-result` | Inspect duplicate scenario identities or repeated test result entries before recollecting |
|
|
75
75
|
| `pending-without-reason` | Record why execution is pending; use `--fail-on-pending` when pending work must block |
|
|
76
76
|
| `owned-file-modified` | Review edits to installer-owned files; update replaces unmodified owned content and rejects conflicting local edits. See the update guide |
|
|
@@ -83,6 +83,19 @@ A `manual` result is reported as a warning and does not become automated proof.
|
|
|
83
83
|
|
|
84
84
|
Each selected scenario requires exactly one nonempty `Test-type` line. Each result requires `testType`, including pending and manual results. Types must belong to `testing.types` and match the scenario exactly. Findings are `invalid-scenario-test-type`, `missing-test-type`, `unknown-test-type`, and `test-type-mismatch`. Fix the scenario or test metadata, commit, and recollect evidence. Reports without types must be regenerated. The report envelope remains version 1 with stricter result checks.
|
|
85
85
|
|
|
86
|
+
## Collect evidence for one capability
|
|
87
|
+
|
|
88
|
+
The development version can check one capability once its permanent spec includes the requirements you want to verify. For example, run these commands on a clean Git revision containing `openspec/specs/export/spec.md`:
|
|
89
|
+
|
|
90
|
+
```text
|
|
91
|
+
node node_modules/cliewen-openspec/adapters/node-test.mjs --capability export test/export.test.mjs
|
|
92
|
+
cliewen-openspec check --capability export --json
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
The adapter records `scope: {"capability":"export"}`, the tested revision, and the full runner exit code. A failure anywhere in the supplied test files blocks the check. If the run produces no tagged results for export, the report lets the checker name the criteria that lack evidence.
|
|
96
|
+
|
|
97
|
+
Use the same capability name for both commands. The most recent collection replaces the configured report. After synchronization or archive changes the tested revision, commit the intended edits and collect again. CI can use the check's exit code directly. [Exit codes](../guide/cli.md#check)
|
|
98
|
+
|
|
86
99
|
The adapter records explicit metadata; it cannot establish whether a test actually exercises the claimed boundary. Review that boundary and task descriptions alongside assertions. See [test-type configuration](../configuration.md#test-types).
|
|
87
100
|
|
|
88
101
|
Execution reports establish observed outcomes and revision freshness. Follow [evidence-first verification](../configuration.md#evidence-first-verification) to plan acceptance cases, assess assertion quality, and maintain tests. Historical recorder logs are preserved but no longer gate completion.
|
|
@@ -29,7 +29,9 @@ Use a small table in the acceptance plan when it helps. Explain why combinations
|
|
|
29
29
|
|
|
30
30
|
## Record what you reviewed
|
|
31
31
|
|
|
32
|
-
For a change named `add-count`, author `.cliewen-openspec/reviews/change-add-count.yaml`. For permanent specs, use `.cliewen-openspec/reviews/specs.yaml`.
|
|
32
|
+
For a change named `add-count`, author `.cliewen-openspec/reviews/change-add-count.yaml`. For all permanent specs, use `.cliewen-openspec/reviews/specs.yaml`. For a capability named `count`, use `.cliewen-openspec/reviews/capability-count.yaml` with `scope: {capability: count}`. Update and uninstall preserve these project documents.
|
|
33
|
+
|
|
34
|
+
Capability lifecycle review checks criteria from the selected capability at the baseline and at HEAD. Include the permanent spec inputs used to verify references to other capabilities. Use a whole-project check when remapping a test to a criterion in another capability so the review can check its replacement evidence.
|
|
33
35
|
|
|
34
36
|
The record contains `version: 1`, matching `scope` (`{change: add-count}` or `{specs: true}`), a full Git `baseline` commit, an `inputs` mapping, and `effectiveness`, `lifecycle`, and `exceptions` lists. Unknown fields are rejected. The baseline must be available locally and an ancestor of HEAD.
|
|
35
37
|
|
package/package.json
CHANGED
|
@@ -6,7 +6,7 @@ Use native OpenSpec status and the selected change's metadata to establish its s
|
|
|
6
6
|
|
|
7
7
|
For relevant integration review with ciInspection configured and enabled, use .cliewen-openspec/ci-inspection.md. Keep observed requirements, missing or unknown coverage and bypass visibility separate from CI results and archive authorization. Explicit off skips inspection; no extra approval gate or report is required.
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
For delivery, compare the actual diff, tests, and affected documentation with the reviewed scope and accepted amendments. For each agreed outcome and constraint, check the delivered behavior and its verification result. Distinguish missing behavior from missing or unavailable evidence. Look for unrequested changes and explain necessary supporting edits. Use "Handle scope findings" in .cliewen-openspec/planning.md even when optional planning is disabled. Preserve the review outcome and any accepted amendments with the change, and surface unresolved items before archive. Keep a clean result in an existing task note or handoff.
|
|
10
10
|
|
|
11
11
|
Use the shared manual-step and observation guidance in .cliewen-openspec/planning.md independently of its optional planning settings. Automate feasible authorized checks before asking for manual work, explain any residual human need, and retain actual observation context and limits in existing records. Distinguish agent checks, human feedback, change approval, and release authorization. Reassess observations affected by later changes; manual evidence retains its existing warnings and freshness requirements. Missing feedback alone adds no routine approval gate.
|
|
12
12
|
|
|
@@ -30,6 +30,6 @@ After successful archive, repair affected moved-file links and preserve useful k
|
|
|
30
30
|
|
|
31
31
|
Use existing authorized ticket tools when applicable. Distinguish read access, write capability, and authorization. If access is read-only, unavailable, fails, or lacks authorization, report the archive result and concrete pending update separately without claiming ticket closure. A ticket may require additional deployment or human verification before completion.
|
|
32
32
|
|
|
33
|
-
For delivered behavior with evidence enabled, finish
|
|
33
|
+
For delivered behavior with evidence enabled, finish the tracked closure edits and commit the reviewed inputs. Once the permanent specs reflect the change, collect fresh evidence and run Cliewen check. For one affected capability, use --capability NAME on both the Node adapter and check. Use the whole-project scope when evidence must cover multiple capabilities together. Archive or any later commit makes earlier reports historical. Keep reports ignored and untracked. Report the tested revision and result, including pending verification. No-delivery outcomes retain their own review contract.
|
|
34
34
|
|
|
35
35
|
Finish with a brief handoff: actual archive location, spec synchronization result, remaining work or pending updates, and relevant verification limits. Use existing records rather than a mandatory new artifact.
|
|
@@ -30,4 +30,35 @@ Discover suitable ticket access through the host's exposed MCP servers, connecto
|
|
|
30
30
|
|
|
31
31
|
If discovery is unavailable, report availability as unknown. If a tool is missing, inaccessible, or fails, report what was actually observed, explain the needed connection when known, and provide links or concrete pending manual updates. Do not claim an unperformed update succeeded or infer that a hidden integration does not exist. Do not install integrations or change host configuration automatically.
|
|
32
32
|
|
|
33
|
-
Use descriptive OpenSpec kebab-case change names. Preserve original ticket IDs and descriptive links in proposal content when applicable, and preserve existing names and paths.
|
|
33
|
+
Use descriptive OpenSpec kebab-case change names. Preserve original ticket IDs and descriptive links in proposal content when applicable, and preserve existing names and paths.
|
|
34
|
+
|
|
35
|
+
## Review delivery scope before implementation
|
|
36
|
+
|
|
37
|
+
In Delivery and the delivery branch of Combined, review the complete proposal, spec changes, design or combined decision, and tasks before the first implementation task. Start from the original request and accepted amendments. For each requested outcome and constraint, find where the plan addresses it and how it will be verified. Then check whether any planned work goes beyond the request. Agreement among the artifacts can still leave a requirement out. If the request or an amendment is unavailable, state what you checked and what context you still need. Repeat this review for the affected parts of a materially changed plan.
|
|
38
|
+
|
|
39
|
+
## Handle scope findings
|
|
40
|
+
|
|
41
|
+
In either delivery review, warn about suspected extra work or omissions. Name the request or scope boundary, the specific finding, and its practical impact. Correct a clear in-scope omission and recheck it. The scope owner can accept an addition, remove it from the current change, or defer it to one or more follow-ups. The owner can also narrow or defer a requested item. Record the disposition once in an existing change artifact. Remove deferred work from the current delivery and use the selected planning authority when enabled. Prepare follow-up proposals as their work becomes actionable. Keep unresolved items open and continue independent in-scope work when authorized. Keep a clean review brief.
|
|
42
|
+
|
|
43
|
+
## Assess implementation readiness
|
|
44
|
+
|
|
45
|
+
In Delivery and the delivery branch of Combined, assess readiness after the plan review and before implementation. Read readiness.enabled (default true) and readiness.threshold (default 3). With readiness disabled, skip ratings and continue the ordinary workflow.
|
|
46
|
+
|
|
47
|
+
Rate outcome clarity and feasibility separately. For clarity, consider the requested behavior and constraints. For feasibility, consider the approach, prerequisites, and how you will verify the result. Rate each dimension using the evidence available:
|
|
48
|
+
|
|
49
|
+
| Score | Basis |
|
|
50
|
+
| --- | --- |
|
|
51
|
+
| 1 | A consequential unknown blocks the work. |
|
|
52
|
+
| 2 | Competing interpretations or an unverified dependency could materially change the result. |
|
|
53
|
+
| 3 | Work can proceed with stated, low-risk assumptions. |
|
|
54
|
+
| 4 | This dimension is clear enough to explain and verify without a material open question. |
|
|
55
|
+
|
|
56
|
+
Give a short reason for each rating. Use the lower score. If it meets the threshold, proceed with the authorized work. Difficulty alone does not reduce a rating. Routine ready cases need no separate report or approval.
|
|
57
|
+
|
|
58
|
+
Below the threshold, check relevant available evidence first and pause the affected work. Ask the smallest question that could change the decision when the user needs to decide. For technical uncertainty, use authorized focused discovery or propose a smaller delivery. Reassess after receiving new information. Stop asking when ready or when further questions would add nothing, and report any remaining blocker.
|
|
59
|
+
|
|
60
|
+
### Resume a ticket after clarification
|
|
61
|
+
|
|
62
|
+
For a ticket-driven change with planning enabled, reread the ticket before writing or resuming. With authorized write access, record the blocking question, why the answer matters, the OpenSpec change name and path, and the exact repository-relative paths to .cliewen-openspec/planning.md and .cliewen-openspec/config.yaml. Use the project's waiting convention. When retrying, reuse the outstanding question and retry only missing updates. If an update is unauthorized, unavailable, or fails, report the question and the exact pending update in the handoff. For local work or when planning is off, use the conversation or existing handoff.
|
|
63
|
+
|
|
64
|
+
On pickup, retrieve the named change's native apply instructions and read the exact installed paths in the handoff before scoring. Use the answer already recorded on the ticket without asking again or posting it back. Update only the outcomes, constraints, and verification that the answer settles. Keep existing behavior outside that decision intact and keep deferred work outside this delivery. Reassess readiness on the four-point scale using the installed Cliewen configuration. Resume when the threshold is met and existing authorization permits it. Independent authorized work can proceed while this item waits.
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
For delivery, complete the review under "Review delivery scope before implementation" in .cliewen-openspec/planning.md before starting implementation tasks. Apply the work-scoping review even when optional planning is disabled.
|
|
2
|
+
Then follow "Assess implementation readiness" in the same reference. Read readiness.enabled and readiness.threshold from the project configuration, defaulting to true and 3. When disabled, skip the score and continue with existing scope and approval rules.
|
|
1
3
|
Implement tasks and maintain relevant documents. ${testingApproach} Follow testing.placement (default per-task): run each implementation task's relevant tests and fix failures before moving on.
|
|
2
4
|
End-of-change defers the automated suite to final verification; still perform a suitable check for each task before proceeding.
|
|
3
5
|
Final regression and revision-bound evidence collection still follow implementation in either mode.
|