@unbrained/pm-lint 0.0.0-stage → 2026.10.13
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 +30 -0
- package/LICENSE +21 -0
- package/README.md +350 -2
- package/dist/index.d.ts +41 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +26 -0
- package/dist/index.js.map +1 -0
- package/dist/src/baseline-file.d.ts +7 -0
- package/dist/src/baseline-file.d.ts.map +1 -0
- package/dist/src/baseline-file.js +63 -0
- package/dist/src/baseline-file.js.map +1 -0
- package/dist/src/baseline.d.ts +40 -0
- package/dist/src/baseline.d.ts.map +1 -0
- package/dist/src/baseline.js +68 -0
- package/dist/src/baseline.js.map +1 -0
- package/dist/src/commands.d.ts +33 -0
- package/dist/src/commands.d.ts.map +1 -0
- package/dist/src/commands.js +94 -0
- package/dist/src/commands.js.map +1 -0
- package/dist/src/engine.d.ts +39 -0
- package/dist/src/engine.d.ts.map +1 -0
- package/dist/src/engine.js +110 -0
- package/dist/src/engine.js.map +1 -0
- package/dist/src/repair-command.d.ts +6 -0
- package/dist/src/repair-command.d.ts.map +1 -0
- package/dist/src/repair-command.js +26 -0
- package/dist/src/repair-command.js.map +1 -0
- package/dist/src/repair-snapshot.d.ts +5 -0
- package/dist/src/repair-snapshot.d.ts.map +1 -0
- package/dist/src/repair-snapshot.js +66 -0
- package/dist/src/repair-snapshot.js.map +1 -0
- package/dist/src/repairs.d.ts +64 -0
- package/dist/src/repairs.d.ts.map +1 -0
- package/dist/src/repairs.js +129 -0
- package/dist/src/repairs.js.map +1 -0
- package/dist/src/rule-pack-command.d.ts +8 -0
- package/dist/src/rule-pack-command.d.ts.map +1 -0
- package/dist/src/rule-pack-command.js +30 -0
- package/dist/src/rule-pack-command.js.map +1 -0
- package/dist/src/rule-pack.d.ts +79 -0
- package/dist/src/rule-pack.d.ts.map +1 -0
- package/dist/src/rule-pack.js +174 -0
- package/dist/src/rule-pack.js.map +1 -0
- package/dist/src/rules.d.ts +26 -0
- package/dist/src/rules.d.ts.map +1 -0
- package/dist/src/rules.js +150 -0
- package/dist/src/rules.js.map +1 -0
- package/dist/src/settings.d.ts +31 -0
- package/dist/src/settings.d.ts.map +1 -0
- package/dist/src/settings.js +109 -0
- package/dist/src/settings.js.map +1 -0
- package/dist/src/types.d.ts +44 -0
- package/dist/src/types.d.ts.map +1 -0
- package/dist/src/types.js +2 -0
- package/dist/src/types.js.map +1 -0
- package/dist/src/witness-command.d.ts +6 -0
- package/dist/src/witness-command.d.ts.map +1 -0
- package/dist/src/witness-command.js +27 -0
- package/dist/src/witness-command.js.map +1 -0
- package/dist/src/witnesses.d.ts +74 -0
- package/dist/src/witnesses.d.ts.map +1 -0
- package/dist/src/witnesses.js +171 -0
- package/dist/src/witnesses.js.map +1 -0
- package/docs/portable-rule-packs-validation.md +86 -0
- package/docs/repair-preview-example.md +43 -0
- package/docs/repair-preview-validation.md +42 -0
- package/examples/authoring-rules.json +30 -0
- package/manifest.json +13 -0
- package/package.json +140 -4
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
import { createHash } from 'node:crypto';
|
|
2
|
+
import { readFile, realpath } from 'node:fs/promises';
|
|
3
|
+
import { isAbsolute, relative, resolve, sep } from 'node:path';
|
|
4
|
+
import { certifyCompleteListResult, splitAcceptanceCriteria } from '@unbrained/pm-cli/sdk';
|
|
5
|
+
import { sourceDigest } from './baseline.js';
|
|
6
|
+
/** Fail closed without echoing filesystem details or untrusted input. */
|
|
7
|
+
export class WitnessRefusal extends Error {
|
|
8
|
+
/** Machine-readable failure category. */
|
|
9
|
+
code;
|
|
10
|
+
/** Concrete recovery action safe to render in agent receipts. */
|
|
11
|
+
remedy;
|
|
12
|
+
/** Carry a machine code and a concrete next action. */
|
|
13
|
+
constructor(code, message, remedy) {
|
|
14
|
+
super(message);
|
|
15
|
+
this.name = 'WitnessRefusal';
|
|
16
|
+
this.code = code;
|
|
17
|
+
this.remedy = remedy;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
/** Require an exact key set on a plain JSON object. */
|
|
21
|
+
function keys(value, expected) {
|
|
22
|
+
return value !== null && typeof value === 'object' && !Array.isArray(value) && Object.keys(value).sort().join(',') === expected;
|
|
23
|
+
}
|
|
24
|
+
/** Require bounded nonblank strings without changing their exact citation spelling. */
|
|
25
|
+
function text(value) { return typeof value === 'string' && value.trim().length > 0 && value.length <= 4096; }
|
|
26
|
+
/** Refuse malformed contracts instead of silently treating them as an empty scan. */
|
|
27
|
+
function invalid() {
|
|
28
|
+
throw new WitnessRefusal('invalid_contract', 'Invalid version 1 witness contract.', 'Use version 1, unique item_id/criterion bindings, and nonempty typed witnesses with exact keys and SHA-256 evidence.');
|
|
29
|
+
}
|
|
30
|
+
/** Validate and detach all external input before any tracker or evidence read. */
|
|
31
|
+
export function parseWitnessContract(value) {
|
|
32
|
+
if (!keys(value, 'bindings,version') || value.version !== 1 || !Array.isArray(value.bindings))
|
|
33
|
+
invalid();
|
|
34
|
+
const seen = new Set();
|
|
35
|
+
for (const binding of value.bindings) {
|
|
36
|
+
if (!keys(binding, 'criterion,item_id,witnesses') || !text(binding.item_id) || !text(binding.criterion) || !Array.isArray(binding.witnesses) || binding.witnesses.length === 0)
|
|
37
|
+
invalid();
|
|
38
|
+
const identity = JSON.stringify([binding.item_id, binding.criterion]);
|
|
39
|
+
if (seen.has(identity))
|
|
40
|
+
invalid();
|
|
41
|
+
seen.add(identity);
|
|
42
|
+
for (const witness of binding.witnesses) {
|
|
43
|
+
if (keys(witness, 'kind,reason') && witness.kind === 'pending' && text(witness.reason))
|
|
44
|
+
continue;
|
|
45
|
+
if (!validEvidence(witness))
|
|
46
|
+
invalid();
|
|
47
|
+
if ((witness.outcome !== 'pass' && witness.outcome !== 'fail') || typeof witness.sha256 !== 'string' || !/^[a-f0-9]{64}$/.test(witness.sha256))
|
|
48
|
+
invalid();
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
return structuredClone(value);
|
|
52
|
+
}
|
|
53
|
+
/** Accept exact core test identities, including path-only tests, and file observations. */
|
|
54
|
+
function validEvidence(value) {
|
|
55
|
+
if (keys(value, 'kind,outcome,path,sha256'))
|
|
56
|
+
return (value.kind === 'test' || value.kind === 'observation') && text(value.path);
|
|
57
|
+
if (keys(value, 'command,kind,outcome,sha256'))
|
|
58
|
+
return value.kind === 'test' && text(value.command);
|
|
59
|
+
return keys(value, 'command,kind,outcome,path,sha256') && value.kind === 'test' && text(value.command) && text(value.path);
|
|
60
|
+
}
|
|
61
|
+
/** Hash exact file bytes so whitespace and content drift remain observable. */
|
|
62
|
+
export function observationDigest(bytes) { return createHash('sha256').update(bytes).digest('hex'); }
|
|
63
|
+
/** Load only the explicit sidecar; never discover a git root or infer links from prose. */
|
|
64
|
+
export async function readWitnessContract(path) {
|
|
65
|
+
let value;
|
|
66
|
+
try {
|
|
67
|
+
value = JSON.parse(await readFile(path, 'utf8'));
|
|
68
|
+
}
|
|
69
|
+
catch {
|
|
70
|
+
throw new WitnessRefusal('contract_io', 'Cannot read witness JSON.', 'Supply --contract with a readable version 1 JSON document.');
|
|
71
|
+
}
|
|
72
|
+
return parseWitnessContract(value);
|
|
73
|
+
}
|
|
74
|
+
/** Test a resolved path against the caller-selected evidence root. */
|
|
75
|
+
function within(root, path) {
|
|
76
|
+
const tail = relative(root, path);
|
|
77
|
+
return tail !== '..' && !tail.startsWith(`..${sep}`) && !isAbsolute(tail);
|
|
78
|
+
}
|
|
79
|
+
/** Read a repository-relative citation without following escapes or invoking git. */
|
|
80
|
+
async function observationState(root, witness) {
|
|
81
|
+
// A line suffix is a citation only; the digest binds the entire file.
|
|
82
|
+
const path = witness.path.replace(/#L\d+(?:-L\d+)?$|:\d+(?::\d+)?$/, '');
|
|
83
|
+
if (isAbsolute(path) || !within(resolve(root), resolve(root, path)))
|
|
84
|
+
throw new WitnessRefusal('unsafe_citation', 'Observation escapes the evidence root.', 'Use a relative file citation inside the selected evidence root.');
|
|
85
|
+
try {
|
|
86
|
+
const canonicalRoot = await realpath(root);
|
|
87
|
+
const target = await realpath(resolve(root, path));
|
|
88
|
+
if (!within(canonicalRoot, target))
|
|
89
|
+
throw new WitnessRefusal('unsafe_citation', 'Observation symlink escapes the evidence root.', 'Use a file whose resolved target remains inside the evidence root.');
|
|
90
|
+
return observationDigest(await readFile(target)) === witness.sha256 ? 'supported' : 'stale';
|
|
91
|
+
}
|
|
92
|
+
catch (error) {
|
|
93
|
+
if (error instanceof WitnessRefusal)
|
|
94
|
+
throw error;
|
|
95
|
+
const code = error.code;
|
|
96
|
+
if (code === 'ENOENT' || code === 'ENOTDIR')
|
|
97
|
+
return 'dangling';
|
|
98
|
+
throw new WitnessRefusal('evidence_io', 'Cannot read observation evidence.', 'Make the cited artifact a readable regular file, then retry.');
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
/** Recovery messages are stable and bounded instead of copying source evidence. */
|
|
102
|
+
const REMEDIES = {
|
|
103
|
+
supported: '', pending: 'Collect the explicitly pending proof, then replace its declaration.',
|
|
104
|
+
missing: 'Declare a test, observation or explicit pending proof for this exact criterion.',
|
|
105
|
+
dangling: 'Restore the cited item, linked test or observation, or correct the declaration.',
|
|
106
|
+
stale: 'Review changed criteria or evidence and refresh the exact declaration and digest.',
|
|
107
|
+
contradictory: 'Resolve failing or conflicting outcome declarations before claiming support.',
|
|
108
|
+
};
|
|
109
|
+
/** Compare exact UTF-16 code units without locale collation or Unicode normalization. */
|
|
110
|
+
function compareWitnessText(left, right) {
|
|
111
|
+
return left < right ? -1 : left > right ? 1 : 0;
|
|
112
|
+
}
|
|
113
|
+
/** Check declared contracts against certified tracker state; never execute a linked test. */
|
|
114
|
+
export async function lintWitnesses(client, contract, evidenceRoot) {
|
|
115
|
+
const checked = parseWitnessContract(contract);
|
|
116
|
+
const corpus = certifyCompleteListResult(await client.listAllComplete());
|
|
117
|
+
const items = new Map(corpus.items.map(/** Index certified items once. */ /** Index certified items once. */ item => [item.id, item]));
|
|
118
|
+
const criteria = new Map(corpus.items.map(/** Let core own criterion boundary semantics. */ /** Let core own criterion boundary semantics. */ item => [item.id, splitAcceptanceCriteria(item.acceptance_criteria)]));
|
|
119
|
+
const findings = [];
|
|
120
|
+
const summary = { supported: 0, pending: 0, missing: 0, dangling: 0, stale: 0, contradictory: 0 };
|
|
121
|
+
/** Record every declaration separately so stale evidence never conceals contradiction. */
|
|
122
|
+
function add(item_id, criterion, state, citation = '') {
|
|
123
|
+
findings.push({ item_id, criterion, state, citation, remedy: REMEDIES[state] });
|
|
124
|
+
summary[state] += 1;
|
|
125
|
+
}
|
|
126
|
+
const bound = new Set();
|
|
127
|
+
for (const binding of checked.bindings) {
|
|
128
|
+
const { item_id, criterion } = binding;
|
|
129
|
+
bound.add(JSON.stringify([item_id, criterion]));
|
|
130
|
+
const item = items.get(item_id);
|
|
131
|
+
if (item === undefined) {
|
|
132
|
+
add(item_id, criterion, 'dangling');
|
|
133
|
+
continue;
|
|
134
|
+
}
|
|
135
|
+
if (!criteria.get(item_id).includes(criterion)) {
|
|
136
|
+
add(item_id, criterion, 'stale');
|
|
137
|
+
continue;
|
|
138
|
+
}
|
|
139
|
+
for (const witness of binding.witnesses) {
|
|
140
|
+
if (witness.kind === 'pending') {
|
|
141
|
+
add(item_id, criterion, 'pending');
|
|
142
|
+
continue;
|
|
143
|
+
}
|
|
144
|
+
let state;
|
|
145
|
+
let citation;
|
|
146
|
+
if (witness.kind === 'observation') {
|
|
147
|
+
citation = witness.path;
|
|
148
|
+
state = await observationState(evidenceRoot, witness);
|
|
149
|
+
}
|
|
150
|
+
else {
|
|
151
|
+
citation = witness.path ?? witness.command;
|
|
152
|
+
const matches = (item.tests ?? []).filter(/** Every supplied identity field must match exactly. */ /** Every supplied identity field must match exactly. */ entry => (witness.command === undefined || entry.command === witness.command) && (witness.path === undefined || entry.path === witness.path));
|
|
153
|
+
state = matches.length === 0 ? 'dangling' : matches.length > 1 ? 'contradictory' : sourceDigest(matches[0]) === witness.sha256 ? 'supported' : 'stale';
|
|
154
|
+
}
|
|
155
|
+
if (state !== 'supported' || witness.outcome !== 'fail')
|
|
156
|
+
add(item_id, criterion, state, citation);
|
|
157
|
+
if (witness.outcome === 'fail')
|
|
158
|
+
add(item_id, criterion, 'contradictory', citation);
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
let criteriaCount = 0;
|
|
162
|
+
for (const [id, entries] of criteria) {
|
|
163
|
+
criteriaCount += entries.length;
|
|
164
|
+
for (const criterion of entries)
|
|
165
|
+
if (!bound.has(JSON.stringify([id, criterion])))
|
|
166
|
+
add(id, criterion, 'missing');
|
|
167
|
+
}
|
|
168
|
+
findings.sort(/** Exact identity ordering ignores scan order, declaration order and host locale. */ (a, b) => compareWitnessText(a.item_id, b.item_id) || compareWitnessText(a.criterion, b.criterion) || compareWitnessText(a.citation, b.citation) || compareWitnessText(a.state, b.state));
|
|
169
|
+
return { findings, count: findings.length, corpus_count: corpus.items.length, criteria_count: criteriaCount, summary, complete_list: corpus.complete_list, exit_code: findings.some(/** Explicit pending proof remains unfinished. */ /** Explicit pending proof remains unfinished. */ row => row.state !== 'supported') ? 1 : 0 };
|
|
170
|
+
}
|
|
171
|
+
//# sourceMappingURL=witnesses.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"witnesses.js","sourceRoot":"","sources":["../../src/witnesses.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AACtD,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,WAAW,CAAC;AAC/D,OAAO,EAAE,yBAAyB,EAAE,uBAAuB,EAAE,MAAM,uBAAuB,CAAC;AAE3F,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAwC7C,yEAAyE;AACzE,MAAM,OAAO,cAAe,SAAQ,KAAK;IACv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20, pm-presets export/upgrade, pm-review workflows, and existing
|
|
5
|
+
pm-lint rules, baselines and witnesses. Core owns schema types and mutation
|
|
6
|
+
workflow governance (required fields, transitions, authors, field writers and
|
|
7
|
+
approvals). Presets distributes schemas/settings/templates. Portable packs add
|
|
8
|
+
read-only literal text and length authoring assertions with organization-owned
|
|
9
|
+
explanations; they do not replace or install governance policies.
|
|
10
|
+
|
|
11
|
+
## Public read-only measurement
|
|
12
|
+
|
|
13
|
+
Source: public [pm-presets tracker at
|
|
14
|
+
470c2b2](https://github.com/unbraind/pm-presets/tree/470c2b2a367c36dbf19513b4db2f84fa979a057c/.agents/pm).
|
|
15
|
+
Repository visibility and the exact commit were verified through GitHub before
|
|
16
|
+
measurement. Only committed tracker files were copied to a disposable directory
|
|
17
|
+
outside git. Snapshot files and directories were made read-only. Extensions were
|
|
18
|
+
disabled, and git discovery was fenced at the snapshot's parent directory.
|
|
19
|
+
|
|
20
|
+
Reproduce after preparing an equivalent read-only snapshot:
|
|
21
|
+
|
|
22
|
+
```sh
|
|
23
|
+
GIT_CEILING_DIRECTORIES="$SNAPSHOT_PARENT" node test/public-rule-pack-validation.ts "$SNAPSHOT_PM_ROOT"
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
| Measurement | Result |
|
|
27
|
+
| --- | ---: |
|
|
28
|
+
| Certified items, including terminal work | 76 |
|
|
29
|
+
| Rules in shipped example | 3 |
|
|
30
|
+
| Potential item/rule pairs | 228 |
|
|
31
|
+
| Applicable checks after exact selectors | 157 |
|
|
32
|
+
| Findings | 25 |
|
|
33
|
+
| Error / warning / informational findings | 0 / 25 / 0 |
|
|
34
|
+
| `ORG.acceptance` / `ORG.context` / `ORG.title` findings | 0 / 25 / 0 |
|
|
35
|
+
| Complete SDK JSON receipt size | 6,193 bytes |
|
|
36
|
+
| Gate exit code | 0 |
|
|
37
|
+
|
|
38
|
+
Reversing the rule declaration order produced an identical complete receipt.
|
|
39
|
+
Hashing all snapshot filenames and bytes before and after both runs proved no
|
|
40
|
+
source changes. No source item text or operational data is reproduced here.
|
|
41
|
+
|
|
42
|
+
## Regression and adapter evidence
|
|
43
|
+
|
|
44
|
+
The focused suite uses real initialized temporary trackers, core serialization,
|
|
45
|
+
and actual built CLI processes. It checks every predicate, exact selectors,
|
|
46
|
+
strict parsing and unknown keys, duplicate identities, unsafe pattern modes,
|
|
47
|
+
all resource dimensions, stable ordering, typed remedies, read failures, and
|
|
48
|
+
TOON/JSON host output. TOON and legacy JSON Markdown readers produce identical
|
|
49
|
+
complete diagnostic receipts from the same canonical metadata. The pinned SDK
|
|
50
|
+
migrates legacy Markdown during reads; that compatibility test uses a disposable
|
|
51
|
+
writable fixture. It does not establish hosted Postgres or network deployment.
|
|
52
|
+
|
|
53
|
+
The git-free CLI tests set a git discovery ceiling and run with a PATH containing
|
|
54
|
+
no git executable. Packed acceptance exercises the shipped example and public SDK
|
|
55
|
+
through real npm/npx and native Bun/bunx consumers in CI.
|
|
56
|
+
|
|
57
|
+
## Full release-gate receipt
|
|
58
|
+
|
|
59
|
+
Implementation commit `3b6a590809aa72f82e1e83f742542731f732e09f` passed
|
|
60
|
+
[CI run 40014216019](https://github.com/unbraind/pm-lint/actions/runs/40014216019).
|
|
61
|
+
The subsequent evidence commit changes documentation and tracker receipts only.
|
|
62
|
+
|
|
63
|
+
| Gate | Suite | Packed acceptance | Coverage |
|
|
64
|
+
| --- | ---: | ---: | --- |
|
|
65
|
+
| `npm run release:check`, Node 22 | 106/106 | 1/1 | 100/100/100/100 |
|
|
66
|
+
| `npm run release:check`, Node 26 | 106/106 | 1/1 | 100/100/100/100 |
|
|
67
|
+
| `bun run release:check`, Node 26 | 106/106 | 1/1 | 100/100/100/100 |
|
|
68
|
+
|
|
69
|
+
Coverage reconciled all 21 configured authored sources, with unchanged 100%
|
|
70
|
+
thresholds in each dimension. Each packed acceptance test ran npm/npx and native
|
|
71
|
+
Bun/bunx SDK/CLI consumers. All three gates had zero failed, skipped or canceled
|
|
72
|
+
top-level tests. Fresh-checkout tracker health, privacy/identity, duplication,
|
|
73
|
+
typecheck, lint, docstrings, production dependency audit, package contents,
|
|
74
|
+
changelog and release-attestation checks passed. CodeQL also passed.
|
|
75
|
+
|
|
76
|
+
Behavioral revert proof removed only semantic evaluation, rebuilt, and made both
|
|
77
|
+
selected semantic/CLI tests fail (0/2 pass). Independently bypassing strict parsing
|
|
78
|
+
and rebuilding made both parser/resource tests fail (0/2 pass). Restoring the
|
|
79
|
+
implementation returned the focused suite to 22/22; the final pack-only coverage
|
|
80
|
+
run passed 8/8 and measured both new runtime modules at 100/100/100/100.
|
|
81
|
+
|
|
82
|
+
The package worktree's separate local strict-health check reported ignored
|
|
83
|
+
managed-extension host-version skew and pre-existing merge-fence drift. Neither
|
|
84
|
+
was changed by this feature; both fresh CI jobs passed tracker health. No hosted
|
|
85
|
+
backend acceptance or external review approval is claimed. Automated review
|
|
86
|
+
services reported unavailable/skipped/neutral review states, not approvals.
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# Revision-bound repair context
|
|
2
|
+
|
|
3
|
+
```ts
|
|
4
|
+
import { previewAuthoringRepairs, RepairRefusal } from '@unbrained/pm-lint';
|
|
5
|
+
|
|
6
|
+
try {
|
|
7
|
+
const first = await previewAuthoringRepairs('.agents/pm', { id: 'pm-example-abcd' });
|
|
8
|
+
console.log(first.patch, first.questions);
|
|
9
|
+
// Refresh validation against exactly the observed native revision, with zero source writes.
|
|
10
|
+
const checked = await previewAuthoringRepairs('.agents/pm', {
|
|
11
|
+
id: first.id,
|
|
12
|
+
revision: first.revision,
|
|
13
|
+
});
|
|
14
|
+
console.log(checked.plan_key, checked.validation, checked.writes);
|
|
15
|
+
} catch (error) {
|
|
16
|
+
if (error instanceof RepairRefusal) console.error(error.code, error.remedy);
|
|
17
|
+
else throw error;
|
|
18
|
+
}
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
For a title with surrounding spaces and repeated tags, the patch contains the
|
|
22
|
+
trimmed title and core-normalized tag list. If an Issue has no `expected_result`,
|
|
23
|
+
questions include `missing_expected_behavior`: “What should happen for the
|
|
24
|
+
reported reproduction steps?” No expected behavior or acceptance criterion is
|
|
25
|
+
supplied by the package.
|
|
26
|
+
|
|
27
|
+
```sh
|
|
28
|
+
pm lint repair --id pm-example-abcd
|
|
29
|
+
pm lint repair --id pm-example-abcd --json
|
|
30
|
+
pm lint repair --id pm-example-abcd --revision <observed-sha256> --json
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
| Refusal | Recovery |
|
|
34
|
+
| --- | --- |
|
|
35
|
+
| `invalid_request` | Supply one canonical id and an optional observed revision. |
|
|
36
|
+
| `unknown_item` | Select a current id from the certified tracker. |
|
|
37
|
+
| `stale_revision` | Discard saved context and request a fresh preview. |
|
|
38
|
+
| `limit_exceeded` | Inspect the oversized field directly and author an explicit repair. |
|
|
39
|
+
| `unsafe_repair` | Resolve unsafe storage or core validation constraints, then refresh. |
|
|
40
|
+
|
|
41
|
+
A preview is an observation of a source snapshot. Concurrent writers may edit
|
|
42
|
+
after it returns. Apply-time mutation preconditions remain the caller's
|
|
43
|
+
responsibility; a plan key is not a lock or an executable transaction id.
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
# Repair preview validation
|
|
2
|
+
|
|
3
|
+
The focused suite uses real SDK trackers outside git and runs the installed CLI
|
|
4
|
+
with git absent from PATH. It verifies disposable SDK mutation validation,
|
|
5
|
+
source byte/name equality, substantive questions, stale revision refusals,
|
|
6
|
+
16 KiB bounds, foreign-state exclusion and concurrent peer edits at every
|
|
7
|
+
exposed read/plan/validation boundary.
|
|
8
|
+
|
|
9
|
+
The seeded state test runs 500 random operation sequences with seed
|
|
10
|
+
`0x51a7e202`. It includes native TOON/JSON Markdown inputs, whitespace/CRLF
|
|
11
|
+
variants, replayed older documents and revision requests, relationships and all
|
|
12
|
+
populated native metadata. An independent real SDK tracker supplies the reference
|
|
13
|
+
state; the result is compared with state read back through the SDK, without
|
|
14
|
+
handwritten normalization. Plan output also round trips through JSON. The feature
|
|
15
|
+
has no import/export/sync mutation adapter or durable journal path.
|
|
16
|
+
|
|
17
|
+
Read-only public snapshots (repository visibility checked before validation):
|
|
18
|
+
|
|
19
|
+
| Source | Revision | Items / previews / revision rechecks | Mechanical findings | Questions | Max JSON / TOON bytes | Source writes |
|
|
20
|
+
| --- | --- | --- | --- | --- | --- | --- |
|
|
21
|
+
| pm-lint | `d9813e3461fd8ecb982819f1d13bb479a20afb73` | 17 / 17 / 17 | 0 | 0 | 530 / 499 | 0 |
|
|
22
|
+
| pm-review | `24e04fcf308c58988bb2869a86491f367e9b39e6` | 54 / 54 / 54 | 0 | 4 | 661 / 620 | 0 |
|
|
23
|
+
|
|
24
|
+
The sibling tracker questions were one `PML002` acceptance gap and three
|
|
25
|
+
`missing_expected_behavior` gaps. Both snapshots were exported from public main
|
|
26
|
+
into plain temporary directories and made read-only. Full byte/name inventories
|
|
27
|
+
were equal before and after all previews. These sources contained no mechanical
|
|
28
|
+
debt; synthetic regressions separately prove staged title/duplicate-tag fixes.
|
|
29
|
+
Reproduce by exporting a public tracker snapshot and running
|
|
30
|
+
`node test/public-repair-validation.ts <read-only-tracker-copy>`.
|
|
31
|
+
|
|
32
|
+
Behavioral revert proof: the focused mechanical regression exits 1 independently
|
|
33
|
+
when mechanical patches are replaced with an empty plan, when the revision guard
|
|
34
|
+
is removed, and when snapshot isolation is removed. Restoring each implementation
|
|
35
|
+
returns the test to green. The third revert exposes SDK cache writes, rather than
|
|
36
|
+
only checking item text.
|
|
37
|
+
|
|
38
|
+
The pinned development SDK stays at 2026.10.20. The peer/manifest minimum now
|
|
39
|
+
matches that SDK because the repair path uses its structured planner and semantic
|
|
40
|
+
preview APIs. Full release checks run in CI through npm on Node 22 and 26 and
|
|
41
|
+
through Bun on Node 26, with the existing 100/100/100/100 and zero-duplication
|
|
42
|
+
thresholds unchanged. CI receipts are linked from the pull request.
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 1,
|
|
3
|
+
"rules": [
|
|
4
|
+
{
|
|
5
|
+
"id": "ORG.acceptance",
|
|
6
|
+
"field": "acceptance_criteria",
|
|
7
|
+
"predicate": { "op": "present" },
|
|
8
|
+
"severity": "error",
|
|
9
|
+
"explanation": "Active work needs an observable acceptance result.",
|
|
10
|
+
"remedy": "Describe a result that another agent can independently verify.",
|
|
11
|
+
"when": { "statuses": ["open", "in_progress", "blocked"] }
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
"id": "ORG.context",
|
|
15
|
+
"field": "description",
|
|
16
|
+
"predicate": { "op": "min_length", "value": 80 },
|
|
17
|
+
"severity": "warn",
|
|
18
|
+
"explanation": "Short context can omit the concrete problem and intended behavior.",
|
|
19
|
+
"remedy": "Explain the trigger, expected result and useful evidence."
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
"id": "ORG.title",
|
|
23
|
+
"field": "title",
|
|
24
|
+
"predicate": { "op": "not_contains", "value": "TODO" },
|
|
25
|
+
"severity": "info",
|
|
26
|
+
"explanation": "A placeholder title hides the intended result.",
|
|
27
|
+
"remedy": "Name the concrete user-visible result in the title."
|
|
28
|
+
}
|
|
29
|
+
]
|
|
30
|
+
}
|
package/manifest.json
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "pm-lint",
|
|
3
|
+
"version": "2026.10.13",
|
|
4
|
+
"description": "Authoring-quality lint rules for useful pm item context",
|
|
5
|
+
"author": "@unbraind",
|
|
6
|
+
"entry": "./dist/index.js",
|
|
7
|
+
"pm_min_version": "2026.10.20",
|
|
8
|
+
"priority": 90,
|
|
9
|
+
"capabilities": [
|
|
10
|
+
"commands",
|
|
11
|
+
"schema"
|
|
12
|
+
]
|
|
13
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,142 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@unbrained/pm-lint",
|
|
3
|
-
"version": "
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "2026.10.13",
|
|
4
|
+
"description": "Authoring-quality lint rules for useful pm item context",
|
|
5
|
+
"repository": {
|
|
6
|
+
"type": "git",
|
|
7
|
+
"url": "git+https://github.com/unbraind/pm-lint.git"
|
|
8
|
+
},
|
|
9
|
+
"bugs": {
|
|
10
|
+
"url": "https://github.com/unbraind/pm-lint/issues"
|
|
11
|
+
},
|
|
12
|
+
"homepage": "https://pm-cli.unbrained.dev/packages/pm-lint",
|
|
13
|
+
"type": "module",
|
|
14
|
+
"main": "dist/index.js",
|
|
15
|
+
"types": "dist/index.d.ts",
|
|
16
|
+
"files": [
|
|
17
|
+
"dist/",
|
|
18
|
+
"examples/",
|
|
19
|
+
"docs/portable-rule-packs-validation.md",
|
|
20
|
+
"manifest.json",
|
|
21
|
+
"README.md",
|
|
22
|
+
"LICENSE",
|
|
23
|
+
"CHANGELOG.md",
|
|
24
|
+
"docs/repair-preview-example.md",
|
|
25
|
+
"docs/repair-preview-validation.md"
|
|
26
|
+
],
|
|
27
|
+
"scripts": {
|
|
28
|
+
"build": "tsc",
|
|
29
|
+
"build:test": "tsc -p tsconfig.test.json",
|
|
30
|
+
"test": "npm run build && npm run build:test && node --test test/*.test.ts",
|
|
31
|
+
"test:install": "npm run build && node --test --test-reporter=spec test/install.acceptance.ts",
|
|
32
|
+
"prepack": "npm run build",
|
|
33
|
+
"typecheck": "tsc --noEmit && tsc -p tsconfig.test.json",
|
|
34
|
+
"check": "npm run typecheck",
|
|
35
|
+
"docstring": "node scripts/docstring-gate.ts",
|
|
36
|
+
"lint": "node scripts/lint.ts",
|
|
37
|
+
"duplication": "node scripts/duplication-gate.ts",
|
|
38
|
+
"audit:prod": "node --input-type=module -e \"import { spawnSync } from 'node:child_process'; import { devNull } from 'node:os'; const env = { ...process.env, npm_config_userconfig: devNull, NPM_CONFIG_USERCONFIG: devNull }; for (const key of Object.keys(env)) if (key.toLowerCase() === 'npm_config_allow_scripts') delete env[key]; const win = process.platform === 'win32'; const r = spawnSync(win ? 'npm.cmd' : 'npm', ['audit', '--omit=dev', '--ignore-scripts'], { stdio: 'inherit', env, shell: win }); process.exit(r.status ?? 1);\"",
|
|
39
|
+
"pack:dry-run": "npm pack --dry-run",
|
|
40
|
+
"changelog": "pm-changelog --pm-root .agents/pm --mode prepend --output CHANGELOG.md --release-version-from-package --date-from-version --since-previous-tag --until-release-tag --item-url-base https://github.com/unbraind/pm-lint/blob/main/.agents/pm --respect-item-release --status closed,in_progress --pm-bin ./node_modules/.bin/pm --pm-arg=--output-budget --pm-arg=unbounded --pm-arg=--output-limit --pm-arg=unbounded",
|
|
41
|
+
"changelog:full": "pm-changelog --pm-root .agents/pm --mode replace --output CHANGELOG.md --all-release-tags --release-version-from-package --date-from-version --item-url-base https://github.com/unbraind/pm-lint/blob/main/.agents/pm --respect-item-release --status closed,in_progress --pm-bin ./node_modules/.bin/pm --pm-arg=--output-budget --pm-arg=unbounded --pm-arg=--output-limit --pm-arg=unbounded",
|
|
42
|
+
"changelog:check": "pm-changelog --pm-root .agents/pm --mode replace --output CHANGELOG.md --all-release-tags --release-version-from-package --date-from-version --item-url-base https://github.com/unbraind/pm-lint/blob/main/.agents/pm --respect-item-release --status closed,in_progress --check --pm-bin ./node_modules/.bin/pm --pm-arg=--output-budget --pm-arg=unbounded --pm-arg=--output-limit --pm-arg=unbounded",
|
|
43
|
+
"release:check": "npm run identity:check && npm run typecheck && npm run lint && npm run duplication && npm run build && npm run docstring && npm run coverage && npm run audit:prod && npm run pack:dry-run && npm run changelog:check && npm run verify:release-publish-attestation && npm run test:install",
|
|
44
|
+
"prepublishOnly": "npm run release:check",
|
|
45
|
+
"release:notes": "pm-changelog --pm-root .agents/pm --stdout --since-previous-tag --until-release-tag --release-version-from-package --date-from-version --item-url-base https://github.com/unbraind/pm-lint/blob/main/.agents/pm --respect-item-release --status closed,in_progress --pm-bin ./node_modules/.bin/pm --github-step-summary --pm-arg=--output-budget --pm-arg=unbounded --pm-arg=--output-limit --pm-arg=unbounded",
|
|
46
|
+
"prepare": "node scripts/prepare-merge-driver.ts",
|
|
47
|
+
"merge:install": "pm merge install",
|
|
48
|
+
"coverage": "npm run build && npm run build:test && node scripts/coverage-gate.ts",
|
|
49
|
+
"verify:release-publish-attestation": "node scripts/verify-release-publish-attestation.ts",
|
|
50
|
+
"identity:check": "node scripts/identity-gate.ts"
|
|
51
|
+
},
|
|
52
|
+
"peerDependencies": {
|
|
53
|
+
"@unbrained/pm-cli": ">=2026.10.20"
|
|
54
|
+
},
|
|
55
|
+
"devDependencies": {
|
|
56
|
+
"@babel/eslint-parser": "8.0.7",
|
|
57
|
+
"@babel/plugin-syntax-typescript": "8.0.3",
|
|
58
|
+
"@types/node": "26.6.5",
|
|
59
|
+
"@unbrained/pm-cli": "2026.10.20",
|
|
60
|
+
"c8": "^12.0.0",
|
|
61
|
+
"eslint": "10.13.0",
|
|
62
|
+
"jscpd": "5.4.1",
|
|
63
|
+
"pm-changelog": "2026.10.20",
|
|
64
|
+
"pm-ops": "2026.10.20",
|
|
65
|
+
"typescript": "7.0.2"
|
|
66
|
+
},
|
|
67
|
+
"keywords": [
|
|
68
|
+
"pm-cli",
|
|
69
|
+
"pm-extension",
|
|
70
|
+
"lint",
|
|
71
|
+
"context",
|
|
72
|
+
"quality"
|
|
73
|
+
],
|
|
74
|
+
"license": "MIT",
|
|
75
|
+
"engines": {
|
|
76
|
+
"node": ">=22.18.0"
|
|
77
|
+
},
|
|
78
|
+
"author": "@unbraind",
|
|
79
|
+
"pm": {
|
|
80
|
+
"aliases": [
|
|
81
|
+
"lint"
|
|
82
|
+
],
|
|
83
|
+
"extensions": [
|
|
84
|
+
"."
|
|
85
|
+
],
|
|
86
|
+
"catalog": {
|
|
87
|
+
"display_name": "pm-lint",
|
|
88
|
+
"category": "quality",
|
|
89
|
+
"summary": "Authoring-quality lint rules for useful pm item context",
|
|
90
|
+
"tags": [
|
|
91
|
+
"lint",
|
|
92
|
+
"context",
|
|
93
|
+
"quality"
|
|
94
|
+
],
|
|
95
|
+
"links": {
|
|
96
|
+
"docs": "https://github.com/unbraind/pm-lint#readme",
|
|
97
|
+
"npm": "https://www.npmjs.com/package/@unbrained/pm-lint",
|
|
98
|
+
"repository": "https://github.com/unbraind/pm-lint",
|
|
99
|
+
"report": "https://github.com/unbraind/pm-lint/issues"
|
|
100
|
+
}
|
|
101
|
+
},
|
|
102
|
+
"docs": [
|
|
103
|
+
"README.md",
|
|
104
|
+
"CHANGELOG.md",
|
|
105
|
+
"docs/repair-preview-example.md",
|
|
106
|
+
"docs/repair-preview-validation.md"
|
|
107
|
+
],
|
|
108
|
+
"examples": [
|
|
109
|
+
"README.md",
|
|
110
|
+
"examples/authoring-rules.json",
|
|
111
|
+
"docs/repair-preview-example.md"
|
|
112
|
+
]
|
|
113
|
+
},
|
|
114
|
+
"publishConfig": {
|
|
115
|
+
"access": "public"
|
|
116
|
+
},
|
|
117
|
+
"coverageGate": {
|
|
118
|
+
"sources": [
|
|
119
|
+
"src",
|
|
120
|
+
"scripts",
|
|
121
|
+
"index.ts",
|
|
122
|
+
"eslint.config.ts"
|
|
123
|
+
],
|
|
124
|
+
"tests": [
|
|
125
|
+
"test/*.test.ts"
|
|
126
|
+
],
|
|
127
|
+
"thresholds": {
|
|
128
|
+
"statements": 100,
|
|
129
|
+
"branches": 100,
|
|
130
|
+
"functions": 100,
|
|
131
|
+
"lines": 100
|
|
132
|
+
},
|
|
133
|
+
"ignore": []
|
|
134
|
+
},
|
|
135
|
+
"duplicationGate": {
|
|
136
|
+
"threshold": 0,
|
|
137
|
+
"minTokens": 50
|
|
138
|
+
},
|
|
139
|
+
"dependencies": {
|
|
140
|
+
"@toon-format/toon": "4.4.0"
|
|
141
|
+
}
|
|
142
|
+
}
|