cliewen-openspec 0.1.0-alpha.1 → 0.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 CHANGED
@@ -2,9 +2,23 @@
2
2
 
3
3
  Changes that matter to projects using Cliewen for OpenSpec.
4
4
 
5
- ## 0.1 (unreleased)
5
+ ## 0.1.0 (2026-11-09)
6
6
 
7
- This first release is under development. The current package version is `0.1.0-alpha.1`; it has not been published to npm. To try it, follow the [local installation guide](docs/guide/getting-started.md).
7
+ - Optional indexed project learnings help agents retrieve relevant lessons and maintain or retire stale guidance. Notes remain project-owned and survive disabling the facility, updates, and uninstall. Learnings are off by default. Agents that gather context before reading schema instructions may need the [project instruction example](docs/configuration.md#instructions-before-context-collection).
8
+ - Optional Humanizer guidance defaults to automatic host discovery, with explicit on/off modes, one status per session, and a clear-writing fallback. Missing skills never block writing or install automatically. See [configuration and host limits](docs/configuration.md#humanizer-and-writing).
9
+ - Shared writing guidance asks agents to validate local document links before handoff and describe future files as planned paths until they exist. This requests an agent check; the CLI does not validate every Markdown link.
10
+ - Technical explanations should distinguish supported inputs from observed runtime behavior and describe what each verification command actually checked. These are review instructions, not an automatic guarantee of factual correctness.
11
+
12
+ - Evidence-first verification plans acceptance cases before implementation, verifies small tasks, reviews effective assertions, and maintains tests as requirements change. It records execution evidence without requiring an order of test and production edits. See [the verification approach](docs/configuration.md#evidence-first-verification).
13
+ - Delivery guidance asks agents to test relevant combinations of input content and options, including preservation on default and disabled paths. These combinations require review; passing case counts do not establish their coverage. See [planning interacting cases](docs/testing/test-quality.md#plan-interacting-cases).
14
+
15
+ - Independently configurable checks for positive/negative case coverage, assertion-effectiveness reviews, and test maintenance when requirements change or are retired. The default warns about missing assessments; projects can disable individual policies or make them blocking.
16
+ - Case IDs and coverage categories in Node test reports, plus scoped exceptions and review records tied to inspected file contents. Passing record checks still require review of assertion meaning and approval claims. See [test quality and lifecycle](docs/testing/test-quality.md) for development-source usage and limitations.
17
+ - The first non-prerelease release starts with the current configuration. Upgrading earlier alpha installations is outside its supported scope; authored-file preservation remains part of the installer contract.
18
+
19
+ ## 0.1.0-alpha.1 (2026-11-01)
20
+
21
+ The first public alpha was published as `cliewen-openspec@0.1.0-alpha.1`, with the `alpha` tag. Its features and limitations below describe that historical snapshot. Follow the [installation guide](docs/guide/getting-started.md) for 0.1.0.
8
22
 
9
23
  ### OpenSpec workflows
10
24
 
@@ -52,4 +66,4 @@ The [user guide](docs/guide/index.md) covers installation, schema selection, exi
52
66
  - Discovery findings and combined-workflow approval fields require review. A recorded status cannot prove that a person approved the change.
53
67
  - Documentation and diagram guidance does not validate your project's document metadata or diagram syntax.
54
68
  - Acceptance ID allocation supports sequential work. Parallel branches may allocate the same number and need conflict resolution.
55
- - Release validation across the supported coding agents is still incomplete. Treat the package as an alpha; review its output before relying on it.
69
+ - Release validation across the supported coding agents is still incomplete. Treat the package as an alpha; review its output before relying on it.
package/README.md CHANGED
@@ -2,7 +2,9 @@
2
2
 
3
3
  Durable decisions, living documentation, and evidence for OpenSpec.
4
4
 
5
- **Alpha implementation.** Installs `cliewen-delivery`, `cliewen-discovery`, and `cliewen-all`, allocates acceptance IDs, and checks real delivery test evidence through OpenSpec archiving. Discovery supports investigation and recommendation without required production implementation. No npm release is published yet.
5
+ **Version `0.1.0`.** Installs `cliewen-delivery`, `cliewen-discovery`, and `cliewen-all`, allocates acceptance IDs, and checks real delivery test evidence through OpenSpec archiving. Discovery supports investigation and recommendation without required production implementation.
6
+
7
+ The release includes [test quality and lifecycle checks](docs/testing/test-quality.md), optional project learnings, and Humanizer guidance. Follow [Your first change](docs/guide/getting-started.md) to build and install its local tarball. The published `0.1.0-alpha.1` is an earlier snapshot and does not include these additions; its manifest is not supported by 0.1.0.
6
8
 
7
9
  ## Schema collection
8
10
 
@@ -12,28 +14,20 @@ Durable decisions, living documentation, and evidence for OpenSpec.
12
14
 
13
15
  `cliewen-base` names the internal shared foundation used to build these bundles. It is not a separately selectable schema. Discovery remains the workflow for investigation and decision-making.
14
16
 
15
- The shared design covers documentation, Decision Records, Mermaid, optional plans and evidence. Evidence is enabled by default. See the [discovery guide](docs/guide/discovery.md) for investigation, a no-change outcome, and delivery handoff. This alpha supplies documentation/DR guidance; structural metadata and Mermaid validators remain planned.
17
+ The shared design covers documentation, Decision Records, Mermaid, optional plans and evidence. Evidence is enabled by default. See the [discovery guide](docs/guide/discovery.md) for investigation, a no-change outcome, and delivery handoff. The package supplies documentation and decision guidance; structural metadata and Mermaid validators remain planned.
16
18
 
17
19
  Use [the combined workflow](docs/guide/all.md) to investigate and deliver in one change, with a proposed decision and human approval before implementation. Its no-delivery branch uses native `skip_specs`, without fake product requirements.
18
20
 
19
- ## Try the alpha locally
21
+ ## Install
20
22
 
21
23
  Requires Node.js 20.19 or newer and Git. The integration test uses OpenSpec 1.15.0. Windows and Linux CI exercise Node 22 and 24.
22
24
 
23
- In this repository:
24
-
25
- ```sh
26
- npm ci
27
- npm test
28
- npm pack
29
- ```
30
-
31
- In a separate project, initialize OpenSpec and install the resulting tarball:
25
+ In your project, install the versioned packages and initialize OpenSpec:
32
26
 
33
27
  ```sh
34
28
  npm install --save-dev @fission-ai/openspec@1.15.0
35
29
  npx --no-install openspec init
36
- npm install --save-dev /path/to/cliewen-openspec-0.1.0-alpha.1.tgz
30
+ npm install --save-dev cliewen-openspec@0.1.0
37
31
  npx --no-install cliewen-openspec init --default
38
32
  npx --no-install openspec new change add-export --schema cliewen-delivery
39
33
  ```
@@ -55,11 +49,13 @@ npx --no-install cliewen-openspec ac next --capability export
55
49
 
56
50
  `--default` explicitly selects delivery for future changes. Omit it to preserve the existing schema. `init --dry-run` previews writes. Use the generated ID in scenario headings and test titles; commit the ID registry along with specs.
57
51
 
58
- For an existing installation, install the new tarball and use `cliewen-openspec update --dry-run --json`, then `cliewen-openspec update --json` after reviewing the plan. Update refreshes owned resources from supported manifests, preserving configuration, selected schemas, IDs, and authored files. See [updating an installation](docs/guide/updating.md).
52
+ The explicit version selects 0.1.0. Earlier alpha installation manifests are unsupported; use a fresh installation rather than editing a manifest version. For the complete CSV example, follow [your first change](docs/guide/getting-started.md).
53
+
54
+ For an existing installation, install the desired package version and use `cliewen-openspec update --dry-run --json`, then `cliewen-openspec update --json` after reviewing the plan. Update refreshes owned resources from supported manifests, preserving configuration, selected schemas, IDs, and authored files. See [updating an installation](docs/guide/updating.md).
59
55
 
60
56
  Configure capability-specific AC prefixes and number padding, and choose test placement in `.cliewen-openspec/config.yaml`. Testing each implementation task before moving on is the default. Use `ac rename-prefix` to change an established prefix without resetting its sequence. See [project configuration](docs/configuration.md) for examples and prefix selection.
61
57
 
62
- Optionally set `testing.approach: tdd` with `testing.placement: per-task` to plan red-green-refactor within every implementation task. The default `flexible` approach allows tests before or after code within the selected placement.
58
+ Use **spec-driven development with evidence-first verification**: plan acceptance cases before implementation, verify small tasks, assess assertion effectiveness, and maintain tests as requirements change. See [the verification approach](docs/configuration.md#evidence-first-verification).
63
59
 
64
60
  After implementation, commit the project inputs and collect evidence from Node tests:
65
61
 
@@ -74,15 +70,15 @@ After reviewing the assertions and evidence, archive with OpenSpec. Commit the a
74
70
 
75
71
  ## Project documents
76
72
 
77
- - [User guide source](docs/guide/index.md) and [published documentation](https://flemming-n-larsen.github.io/cliewen-openspec/)
73
+ - [User guide source](docs/guide/index.md) and [published documentation](https://cliewen-openspec.github.io/cliewen-openspec/)
78
74
  - [Decisions](docs/decisions/README.md)
79
75
  - [Changelog](CHANGELOG.md)
80
76
  - [Project configuration](docs/configuration.md)
81
77
  - [Pilot reference prompt](docs/testing/pilot-prompt.md)
82
78
  - [Implementation plan](plan.md)
83
79
  - [Practice mapping](docs/cliewen-mapping.md)
84
- - [Alpha architecture](docs/architecture/README.md)
85
- - [Website](https://flemming-n-larsen.github.io/cliewen-openspec/)
80
+ - [Architecture](docs/architecture/README.md)
81
+ - [Website](https://cliewen-openspec.github.io/cliewen-openspec/)
86
82
  - [Credits](CREDITS.md)
87
83
 
88
84
  Implemented commands: `init`, `update`, `uninstall`, `ac next`, `ac rename-prefix`, `check` and `recover`. Review generated/resource changes before applying them. [Uninstall](docs/guide/uninstalling.md) preserves project data and requires an explicit replacement when removing the selected default. Tests never establish assertion quality automatically.
@@ -97,7 +93,9 @@ Build the documentation with `npm run docs:build` and preview it with `npm run d
97
93
 
98
94
  ## Feedback
99
95
 
100
- [Report a bug](https://github.com/flemming-n-larsen/cliewen-openspec/issues/new?template=bug_report.yml) or [suggest an improvement](https://github.com/flemming-n-larsen/cliewen-openspec/issues/new?template=idea.yml). Documentation problems and workflow ideas are welcome. A small example helps us understand the problem; a proposed implementation is optional.
96
+ [Report a bug](https://github.com/cliewen-openspec/cliewen-openspec/issues/new?template=bug_report.yml) or [suggest an improvement](https://github.com/cliewen-openspec/cliewen-openspec/issues/new?template=idea.yml). Documentation problems and workflow ideas are welcome. A small example helps us understand the problem; a proposed implementation is optional.
97
+
98
+ Maintainers use the [feedback triage guide](docs/feedback-triage.md) to reproduce problems, record decisions, and link accepted work to OpenSpec changes.
101
99
 
102
100
  ## License
103
101
 
@@ -3,7 +3,7 @@
3
3
  import fs from 'node:fs';
4
4
  import path from 'node:path';
5
5
  import { spawnSync, execFileSync } from 'node:child_process';
6
- import { config, local, scenarios } from '../dist/core.js';
6
+ import { config, local, scenarios, markdowns } from '../dist/core.js';
7
7
  const git = (...args) => execFileSync('git', args, { encoding: 'utf8' }).trim();
8
8
  try {
9
9
  if (git('status', '--porcelain', '--untracked-files=all')) throw Error('Commit project inputs before collecting evidence.');
@@ -26,7 +26,19 @@ try {
26
26
  }
27
27
  if (!files.length) throw Error('Pass explicit test file paths');
28
28
  const selected = change === undefined ? undefined : new Set(scenarios(process.cwd(), change).map(s => s.id));
29
- if (selected && (!selected.size || selected.has(''))) throw Error('Selected change requires scenarios with AC IDs');
29
+ let removedRequirements = 0, activeRequirements = 0;
30
+ if (selected?.size === 0) for (const file of markdowns(local(process.cwd(), `openspec/changes/${change}/specs`))) {
31
+ let fence = '', section = '';
32
+ for (const line of fs.readFileSync(file, 'utf8').replace(/<!--[\s\S]*?-->/g, '').split(/\r?\n/)) {
33
+ const boundary = line.match(/^\s*(`{3,}|~{3,})/);
34
+ if (boundary) { if (!fence) fence = boundary[1]; else if (fence[0] === boundary[1][0] && boundary[1].length >= fence.length) fence = ''; continue; }
35
+ if (fence) continue;
36
+ if (/^## /.test(line)) section = line.trim();
37
+ if (/^### Requirement:/.test(line)) { if (section === '## REMOVED Requirements') removedRequirements++; else activeRequirements++; }
38
+ }
39
+ }
40
+ const retirementOnly = selected?.size === 0 && removedRequirements > 0 && activeRequirements === 0;
41
+ if (selected && ((!selected.size && !retirementOnly) || selected.has(''))) throw Error('Selected change requires scenarios with AC IDs');
30
42
  const run = spawnSync(process.execPath, ['--test', '--test-reporter=tap', ...files], { encoding: 'utf8' });
31
43
  if (run.error) throw run.error;
32
44
  process.stdout.write(run.stdout ?? ''); process.stderr.write(run.stderr ?? '');
@@ -36,12 +48,17 @@ try {
36
48
  if (m) {
37
49
  const tags = [...m[2].matchAll(/\[Test-type: ([^\]\r\n]+)\]/g)];
38
50
  if (tags.length !== 1 || !Object.hasOwn(settings.testing.types, tags[0][1])) throw Error(`Test ${m[2]} requires one configured [Test-type: NAME] tag`);
39
- if (!selected || selected.has(m[3])) results.push({ scenario: m[3], test: m[2], testType: tags[0][1], outcome: /#\s*(SKIP|TODO)/i.test(m[2]) ? 'skipped' : m[1] === 'ok' ? 'passed' : 'failed' });
51
+ const metadata = {};
52
+ for (const [tag, field] of [['Case', 'caseId'], ['Coverage', 'coverage']]) {
53
+ const values = [...m[2].matchAll(new RegExp(`\\[${tag}: ([^\\]\\r\\n]*)\\]`, 'g'))];
54
+ if (values.length) metadata[field] = values.length === 1 ? values[0][1] : null;
55
+ }
56
+ if (!selected || selected.has(m[3])) results.push({ scenario: m[3], test: m[2], testType: tags[0][1], ...metadata, outcome: /#\s*(SKIP|TODO)/i.test(m[2]) ? 'skipped' : m[1] === 'ok' ? 'passed' : 'failed' });
40
57
  }
41
58
  }
42
59
  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.');
43
60
  if (run.status === null) throw Error('Test runner did not complete; no report produced');
44
- if (!results.length) throw Error('No AC-tagged test results found for the selected scope; no report produced');
61
+ if (!results.length && !retirementOnly) throw Error('No AC-tagged test results found for the selected scope; no report produced');
45
62
  fs.mkdirSync(path.dirname(output), { recursive: true });
46
63
  fs.writeFileSync(output, JSON.stringify({ version: 1, revision, ...(change === undefined ? {} : { scope: { change } }), execution: { exitCode: run.status }, results }, null, 2) + '\n');
47
64
  process.exitCode = run.status === 0 ? 0 : 1;
package/dist/cli.js CHANGED
@@ -1,10 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import path from 'node:path';
3
3
  import { check, init, update, uninstall, nextId, renamePrefix, capabilityForPrefix, recover, version } from './core.js';
4
- import { startTask, runTask } from './tdd.js';
5
4
  const args = process.argv.slice(2);
6
- const separator = args.indexOf('--');
7
- const forwarded = separator < 0 ? [] : args.splice(separator).slice(1);
8
5
  const wantsJson = args.includes('--json');
9
6
  function option(name) { const i = args.indexOf(name); if (i < 0)
10
7
  return undefined; const value = args[i + 1]; if (!value || value.startsWith('--'))
@@ -17,7 +14,6 @@ try {
17
14
  const change = option('--change');
18
15
  const capability = option('--capability');
19
16
  const replacement = option('--default-schema');
20
- const task = option('--task'), phase = option('--phase'), reason = option('--reason');
21
17
  const command = args.shift();
22
18
  if (dry && !['init', 'update', 'uninstall'].includes(command ?? ''))
23
19
  throw Error('--dry-run is supported only by init, update, and uninstall');
@@ -25,37 +21,17 @@ try {
25
21
  throw Error('--default-schema is supported only by uninstall');
26
22
  if (makeDefault && command !== 'init')
27
23
  throw Error('--default is supported only by init');
28
- if (change && !['check', 'tdd'].includes(command ?? ''))
29
- throw Error('--change is supported only by check and tdd');
24
+ if (change && command !== 'check')
25
+ throw Error('--change is supported only by check');
30
26
  if (failPending && command !== 'check')
31
27
  throw Error('--fail-on-pending is supported only by check');
32
- if ((task || phase || reason || separator >= 0) && command !== 'tdd')
33
- throw Error('--task, --phase, --reason, and -- command are supported only by tdd');
34
28
  if (change && !/^[a-z0-9]+(?:-[a-z0-9]+)*$/.test(change))
35
29
  throw Error('Change must be a kebab-case name');
36
30
  if (json && !['init', 'update', 'uninstall', 'check'].includes(command ?? ''))
37
31
  throw Error('--json is supported only by init, update, uninstall, and check');
38
32
  if (capability && (command !== 'ac' || args[0] !== 'next'))
39
33
  throw Error('--capability is supported only by ac next');
40
- if (command === 'tdd') {
41
- if (!change || !task)
42
- throw Error('tdd requires --change NAME and --task ID');
43
- if (args.length !== 1)
44
- throw Error('Use tdd start or tdd run');
45
- if (args[0] === 'start' && !phase && !reason && separator < 0) {
46
- startTask(root, change, task);
47
- console.log(`Recorded starting files for ${change} task ${task}`);
48
- }
49
- else if (args[0] === 'run' && phase && forwarded.length) {
50
- const result = runTask(root, change, task, phase, forwarded, reason);
51
- process.stdout.write(result.stdout);
52
- process.stderr.write(result.stderr);
53
- process.exitCode = result.exitCode;
54
- }
55
- else
56
- throw Error('Use tdd start --change NAME --task ID or tdd run --change NAME --task ID --phase PHASE [--reason TEXT] -- COMMAND ARGS');
57
- }
58
- else if (command === 'ac') {
34
+ if (command === 'ac') {
59
35
  const action = args.shift();
60
36
  if (action === 'next') {
61
37
  if (capability ? args.length !== 0 : args.length !== 1)
@@ -91,7 +67,7 @@ try {
91
67
  process.exitCode = ok ? 0 : 1;
92
68
  }
93
69
  else if (!command || command === '--help')
94
- console.log('cliewen-openspec (alpha)\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\ntdd start --change NAME --task ID\ntdd run --change NAME --task ID --phase PHASE [--reason TEXT] -- COMMAND ARGS\ncheck [--change NAME] [--json] [--fail-on-pending]\nrecover\nAll commands accept --root PATH (before -- when forwarding a test command).');
70
+ 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\ncheck [--change NAME] [--json] [--fail-on-pending]\nrecover\nAll commands accept --root PATH.');
95
71
  else
96
72
  throw Error(`Unknown command: ${command}`);
97
73
  }
package/dist/core.d.ts CHANGED
@@ -1,7 +1,15 @@
1
+ import { type QualitySettings } from './quality.js';
1
2
  export { nextId, renamePrefix, capabilityForPrefix } from './ac.js';
2
- export declare const version = "0.1.0-alpha.1";
3
+ export declare const version = "0.1.0";
3
4
  export type Config = {
4
5
  docsRoot: string;
6
+ learnings: {
7
+ enabled: boolean;
8
+ directory: string;
9
+ };
10
+ writing: {
11
+ humanizer: 'auto' | 'on' | 'off';
12
+ };
5
13
  features: Record<string, boolean>;
6
14
  evidence: {
7
15
  report: string;
@@ -10,9 +18,8 @@ export type Config = {
10
18
  capabilities: Record<string, string>;
11
19
  padding: number;
12
20
  };
13
- testing: {
21
+ testing: QualitySettings & {
14
22
  placement: 'per-task' | 'end-of-change';
15
- approach: 'flexible' | 'tdd';
16
23
  types: Record<string, {
17
24
  description: string;
18
25
  }>;
package/dist/core.js CHANGED
@@ -8,10 +8,11 @@ import { parse, parseDocument, stringify, isMap } from 'yaml';
8
8
  import { deliveryFiles } from './delivery.js';
9
9
  import { discoveryFiles } from './discovery.js';
10
10
  import { allFiles } from './all.js';
11
+ import { template } from './schema-source.js';
11
12
  import { validateRegistry } from './ac.js';
12
- import { checkTdd } from './tdd.js';
13
+ import { qualityDefaults, configureQuality, checkQuality } from './quality.js';
13
14
  export { nextId, renamePrefix, capabilityForPrefix } from './ac.js';
14
- export const version = '0.1.0-alpha.1';
15
+ export const version = '0.1.0';
15
16
  const state = '.cliewen-openspec';
16
17
  const features = ['documentation', 'decisions', 'mermaid', 'planning', 'review', 'evidence'];
17
18
  export function local(root, relative) {
@@ -42,7 +43,7 @@ const normalize = (s) => s.replace(/\r\n/g, '\n');
42
43
  const hash = (s) => createHash('sha256').update(normalize(s)).digest('hex');
43
44
  const read = (p) => fs.readFileSync(p, 'utf8');
44
45
  export function defaults() {
45
- return { docsRoot: 'docs', features: Object.fromEntries(features.map(f => [f, true])), evidence: { report: '.cliewen-openspec/evidence.json' }, ac: { capabilities: {}, padding: 3 }, testing: { placement: 'per-task', approach: 'flexible', types: {
46
+ return { 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: {
46
47
  Unit: { description: 'Isolated behavior without external dependencies' },
47
48
  Integration: { description: 'Interaction between components or dependencies' },
48
49
  E2E: { description: 'Complete user or system workflow' }
@@ -58,8 +59,32 @@ function keys(o, allowed, label) {
58
59
  export function config(root) {
59
60
  const p = local(root, `${state}/config.yaml`);
60
61
  const raw = parse(read(p));
61
- keys(raw, ['docsRoot', 'features', 'evidence', 'ac', 'testing'], 'config');
62
+ keys(raw, ['docsRoot', 'learnings', 'writing', 'features', 'evidence', 'ac', 'testing'], 'config');
62
63
  const c = defaults();
64
+ if (raw.learnings !== undefined) {
65
+ keys(raw.learnings, ['enabled', 'directory'], 'learnings');
66
+ if (raw.learnings.enabled !== undefined) {
67
+ if (typeof raw.learnings.enabled !== 'boolean')
68
+ throw Error('learnings.enabled must be boolean');
69
+ c.learnings.enabled = raw.learnings.enabled;
70
+ }
71
+ if (raw.learnings.directory !== undefined) {
72
+ const directory = raw.learnings.directory;
73
+ if (typeof directory !== 'string' || !directory.trim() || directory !== directory.trim())
74
+ throw Error('learnings.directory must be a nonempty trimmed relative path');
75
+ if (path.isAbsolute(directory) || path.win32.parse(directory).root || directory.split(/[\\/]/).includes('..'))
76
+ throw Error('learnings.directory must stay within docsRoot');
77
+ c.learnings.directory = directory;
78
+ }
79
+ }
80
+ if (raw.writing !== undefined) {
81
+ keys(raw.writing, ['humanizer'], 'writing');
82
+ if (raw.writing.humanizer !== undefined) {
83
+ if (!['auto', 'on', 'off'].includes(raw.writing.humanizer))
84
+ throw Error('writing.humanizer must be auto, on, or off');
85
+ c.writing.humanizer = raw.writing.humanizer;
86
+ }
87
+ }
63
88
  if (raw.ac !== undefined) {
64
89
  keys(raw.ac, ['capabilities', 'padding'], 'ac');
65
90
  if (raw.ac.capabilities !== undefined) {
@@ -82,7 +107,10 @@ export function config(root) {
82
107
  }
83
108
  }
84
109
  if (raw.testing !== undefined) {
85
- keys(raw.testing, ['placement', 'approach', 'types'], 'testing');
110
+ if (Object.hasOwn(raw.testing, 'approach'))
111
+ throw Error('testing.approach has been retired. Remove it from .cliewen-openspec/config.yaml; use evidence-first verification. See docs/configuration.md#evidence-first-verification.');
112
+ keys(raw.testing, ['placement', 'types', 'quality', 'lifecycle'], 'testing');
113
+ configureQuality(c.testing, raw.testing);
86
114
  if (raw.testing.types !== undefined) {
87
115
  const types = raw.testing.types;
88
116
  if (!types || typeof types !== 'object' || Array.isArray(types) || !Object.keys(types).length)
@@ -101,14 +129,7 @@ export function config(root) {
101
129
  throw Error('testing.placement must be per-task or end-of-change');
102
130
  c.testing.placement = raw.testing.placement;
103
131
  }
104
- if (raw.testing.approach !== undefined) {
105
- if (!['flexible', 'tdd'].includes(raw.testing.approach))
106
- throw Error('testing.approach must be flexible or tdd');
107
- c.testing.approach = raw.testing.approach;
108
- }
109
132
  }
110
- if (c.testing.approach === 'tdd' && c.testing.placement !== 'per-task')
111
- throw Error('testing.approach tdd requires testing.placement per-task');
112
133
  if (raw.docsRoot !== undefined) {
113
134
  if (typeof raw.docsRoot !== 'string')
114
135
  throw Error('docsRoot must be a string');
@@ -128,7 +149,11 @@ export function config(root) {
128
149
  throw Error('evidence.report must be a string');
129
150
  c.evidence.report = raw.evidence.report;
130
151
  }
152
+ if (!c.features.evidence && [c.testing.quality.coverage.mode, c.testing.quality.effectiveness.mode, c.testing.lifecycle.mode].includes('enforce'))
153
+ throw Error('Test policy enforcement requires features.evidence: true; enable evidence or use review/off mode.');
131
154
  local(root, c.docsRoot);
155
+ if (c.learnings.enabled && c.features.documentation)
156
+ local(root, `${c.docsRoot}/${c.learnings.directory}`);
132
157
  local(root, c.evidence.report);
133
158
  return c;
134
159
  }
@@ -189,7 +214,7 @@ export function recover(root) {
189
214
  }
190
215
  fs.unlinkSync(jp);
191
216
  }
192
- function bundledFiles() { return { ...deliveryFiles(), ...discoveryFiles(), ...allFiles() }; }
217
+ function bundledFiles() { return { ...deliveryFiles(), ...discoveryFiles(), ...allFiles(), [`${state}/templates/learning.md`]: template('base/templates/learning.md') }; }
193
218
  function manifestText(files) {
194
219
  return JSON.stringify({ version, files: Object.fromEntries(Object.entries(files).map(([file, content]) => [file, hash(content)])) }, null, 2) + '\n';
195
220
  }
@@ -202,12 +227,12 @@ function ownedManifest(root, operation) {
202
227
  const previous = JSON.parse(read(mp));
203
228
  keys(previous, ['version', 'files'], 'manifest');
204
229
  if (previous.version !== version)
205
- throw Error(`Unsupported installed version: ${previous.version}; ${operation} currently supports ${version} manifests only`);
230
+ throw Error(`Unsupported installed version: ${previous.version}; ${operation} supports ${version} manifests only. This package does not migrate other versions.`);
206
231
  if (!previous.files || typeof previous.files !== 'object' || Array.isArray(previous.files) || !Object.keys(previous.files).length)
207
232
  throw Error('Manifest files must be a nonempty ownership mapping');
208
233
  for (const [file, digest] of Object.entries(previous.files)) {
209
234
  local(root, file);
210
- const owned = file === `${state}/templates/decision.md` || /^openspec\/schemas\/cliewen-(delivery|discovery|all)\/(schema\.yaml|templates\/[a-z0-9][a-z0-9-]*\.md)$/.test(file);
235
+ const owned = [`${state}/templates/decision.md`, `${state}/templates/learning.md`].includes(file) || /^openspec\/schemas\/cliewen-(delivery|discovery|all)\/(schema\.yaml|templates\/[a-z0-9][a-z0-9-]*\.md)$/.test(file);
211
236
  if (!owned || typeof digest !== 'string' || !/^[a-f0-9]{64}$/.test(digest))
212
237
  throw Error(`Invalid owned-file entry in manifest: ${file}`);
213
238
  }
@@ -387,7 +412,7 @@ export function init(root, dryRun, makeDefault) {
387
412
  const mp = local(root, `${state}/manifest.json`);
388
413
  const previous = fs.existsSync(mp) ? JSON.parse(read(mp)) : undefined;
389
414
  if (previous && previous.version !== version)
390
- throw Error('Installed version differs; use update for a supported installation or review migration requirements.');
415
+ throw Error(`Installed version differs; init supports ${version} manifests only and does not migrate other versions.`);
391
416
  const files = bundledFiles();
392
417
  const writes = {};
393
418
  for (const [p, content] of Object.entries(files)) {
@@ -411,7 +436,7 @@ export function init(root, dryRun, makeDefault) {
411
436
  writes[entry] = '---\ntype: overview\n---\n# Project documentation\n\nKeep architecture/, design/, decisions/, testing/ and optional plans/ here as needed. Link to OpenSpec specs for behavior. Do not invent project intent.\n';
412
437
  const ignore = `${state}/.gitignore`;
413
438
  if (!fs.existsSync(local(root, ignore)))
414
- writes[ignore] = 'evidence.json\ntransaction.json\ntdd/\n';
439
+ writes[ignore] = 'evidence.json\ntransaction.json\nreview-output/\n';
415
440
  const cfgPath = 'openspec/config.yaml';
416
441
  const original = fs.existsSync(local(root, cfgPath)) ? read(local(root, cfgPath)) : '';
417
442
  if (makeDefault) {
@@ -436,7 +461,13 @@ export function markdowns(dir) {
436
461
  export function scenarios(root, change) {
437
462
  if (change && !/^[a-z0-9]+(?:-[a-z0-9]+)*$/.test(change))
438
463
  throw Error('Change must be a kebab-case name');
439
- const folder = change ? local(root, `openspec/changes/${change}/specs`) : local(root, 'openspec/specs');
464
+ let folder = change ? local(root, `openspec/changes/${change}/specs`) : local(root, 'openspec/specs');
465
+ const metadata = change ? local(root, `openspec/changes/${change}/.openspec.yaml`) : undefined;
466
+ if (metadata && fs.existsSync(metadata) && parse(read(metadata))?.skip_specs === true) {
467
+ if (markdowns(folder).length)
468
+ throw Error('skip_specs changes must not contain product spec deltas');
469
+ folder = local(root, 'openspec/specs');
470
+ }
440
471
  if (change && !fs.existsSync(folder))
441
472
  throw Error(`Change specs do not exist: ${change}`);
442
473
  const out = [];
@@ -478,6 +509,8 @@ export function check(root, change, failPending = false) {
478
509
  add('not-installed', 'Run init');
479
510
  else {
480
511
  const m = JSON.parse(read(mp));
512
+ if (m.version !== version)
513
+ add('unsupported-installed-version', `Installed manifest ${m.version}; this package supports ${version} only. No automatic migration is available.`);
481
514
  for (const [p, h] of Object.entries(m.files))
482
515
  if (!fs.existsSync(local(root, p)) || hash(read(local(root, p))) !== h)
483
516
  add('owned-file-modified', p);
@@ -524,10 +557,10 @@ export function check(root, change, failPending = false) {
524
557
  }
525
558
  }
526
559
  }
527
- if (c.testing.approach === 'tdd')
528
- findings.push(...checkTdd(root, change));
529
560
  if (!c.features.evidence) {
530
561
  add('evidence-disabled', 'Evidence was explicitly disabled', 'info');
562
+ if ([c.testing.quality.coverage.mode, c.testing.quality.effectiveness.mode, c.testing.lifecycle.mode].includes('review'))
563
+ add('quality-evidence-unavailable', 'Test policy review remains advisory: enable evidence for execution-backed assessment.', 'warning');
531
564
  return findings;
532
565
  }
533
566
  const specs = scenarios(root, change);
@@ -612,6 +645,7 @@ export function check(root, change, failPending = false) {
612
645
  for (const id of ids)
613
646
  if (!seen.has(id))
614
647
  add('missing-evidence', id);
648
+ findings.push(...checkQuality(root, c, specs, report, change, local));
615
649
  add('sufficiency-not-assessed', 'Execution and linkage do not prove assertion quality; review the assertions against the scenarios.', 'info');
616
650
  return findings;
617
651
  }
@@ -0,0 +1,27 @@
1
+ import type { Config, Finding } from './core.js';
2
+ type Mode = 'off' | 'review' | 'enforce';
3
+ type Category = 'positive' | 'negative' | 'boundary';
4
+ export type QualitySettings = {
5
+ quality: {
6
+ coverage: {
7
+ mode: Mode;
8
+ minimumCases: Record<Category, number>;
9
+ };
10
+ effectiveness: {
11
+ mode: Mode;
12
+ };
13
+ };
14
+ lifecycle: {
15
+ mode: Mode;
16
+ };
17
+ };
18
+ export declare function qualityDefaults(): QualitySettings;
19
+ export declare function configureQuality(settings: QualitySettings, raw: Record<string, any>): void;
20
+ type Scenario = {
21
+ id: string;
22
+ file: string;
23
+ testTypes: string[];
24
+ };
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[];
27
+ export {};