@unbrained/pm-lint 0.0.0-stage → 2026.10.28

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.
Files changed (95) hide show
  1. package/CHANGELOG.md +32 -0
  2. package/LICENSE +21 -0
  3. package/README.md +446 -2
  4. package/dist/index.d.ts +51 -0
  5. package/dist/index.d.ts.map +1 -0
  6. package/dist/index.js +33 -0
  7. package/dist/index.js.map +1 -0
  8. package/dist/src/baseline-file.d.ts +7 -0
  9. package/dist/src/baseline-file.d.ts.map +1 -0
  10. package/dist/src/baseline-file.js +79 -0
  11. package/dist/src/baseline-file.js.map +1 -0
  12. package/dist/src/baseline.d.ts +39 -0
  13. package/dist/src/baseline.d.ts.map +1 -0
  14. package/dist/src/baseline.js +68 -0
  15. package/dist/src/baseline.js.map +1 -0
  16. package/dist/src/commands.d.ts +33 -0
  17. package/dist/src/commands.d.ts.map +1 -0
  18. package/dist/src/commands.js +94 -0
  19. package/dist/src/commands.js.map +1 -0
  20. package/dist/src/engine.d.ts +48 -0
  21. package/dist/src/engine.d.ts.map +1 -0
  22. package/dist/src/engine.js +124 -0
  23. package/dist/src/engine.js.map +1 -0
  24. package/dist/src/incremental-command.d.ts +6 -0
  25. package/dist/src/incremental-command.d.ts.map +1 -0
  26. package/dist/src/incremental-command.js +27 -0
  27. package/dist/src/incremental-command.js.map +1 -0
  28. package/dist/src/incremental-contract.d.ts +72 -0
  29. package/dist/src/incremental-contract.d.ts.map +1 -0
  30. package/dist/src/incremental-contract.js +142 -0
  31. package/dist/src/incremental-contract.js.map +1 -0
  32. package/dist/src/incremental-file.d.ts +13 -0
  33. package/dist/src/incremental-file.d.ts.map +1 -0
  34. package/dist/src/incremental-file.js +119 -0
  35. package/dist/src/incremental-file.js.map +1 -0
  36. package/dist/src/incremental.d.ts +41 -0
  37. package/dist/src/incremental.d.ts.map +1 -0
  38. package/dist/src/incremental.js +116 -0
  39. package/dist/src/incremental.js.map +1 -0
  40. package/dist/src/repair-command.d.ts +6 -0
  41. package/dist/src/repair-command.d.ts.map +1 -0
  42. package/dist/src/repair-command.js +26 -0
  43. package/dist/src/repair-command.js.map +1 -0
  44. package/dist/src/repair-snapshot.d.ts +5 -0
  45. package/dist/src/repair-snapshot.d.ts.map +1 -0
  46. package/dist/src/repair-snapshot.js +66 -0
  47. package/dist/src/repair-snapshot.js.map +1 -0
  48. package/dist/src/repairs.d.ts +64 -0
  49. package/dist/src/repairs.d.ts.map +1 -0
  50. package/dist/src/repairs.js +129 -0
  51. package/dist/src/repairs.js.map +1 -0
  52. package/dist/src/rule-pack-command.d.ts +8 -0
  53. package/dist/src/rule-pack-command.d.ts.map +1 -0
  54. package/dist/src/rule-pack-command.js +30 -0
  55. package/dist/src/rule-pack-command.js.map +1 -0
  56. package/dist/src/rule-pack.d.ts +79 -0
  57. package/dist/src/rule-pack.d.ts.map +1 -0
  58. package/dist/src/rule-pack.js +174 -0
  59. package/dist/src/rule-pack.js.map +1 -0
  60. package/dist/src/rules.d.ts +28 -0
  61. package/dist/src/rules.d.ts.map +1 -0
  62. package/dist/src/rules.js +153 -0
  63. package/dist/src/rules.js.map +1 -0
  64. package/dist/src/settings.d.ts +31 -0
  65. package/dist/src/settings.d.ts.map +1 -0
  66. package/dist/src/settings.js +109 -0
  67. package/dist/src/settings.js.map +1 -0
  68. package/dist/src/sidecar-publication.d.ts +39 -0
  69. package/dist/src/sidecar-publication.d.ts.map +1 -0
  70. package/dist/src/sidecar-publication.js +105 -0
  71. package/dist/src/sidecar-publication.js.map +1 -0
  72. package/dist/src/statuses.d.ts +8 -0
  73. package/dist/src/statuses.d.ts.map +1 -0
  74. package/dist/src/statuses.js +10 -0
  75. package/dist/src/statuses.js.map +1 -0
  76. package/dist/src/types.d.ts +44 -0
  77. package/dist/src/types.d.ts.map +1 -0
  78. package/dist/src/types.js +2 -0
  79. package/dist/src/types.js.map +1 -0
  80. package/dist/src/witness-command.d.ts +6 -0
  81. package/dist/src/witness-command.d.ts.map +1 -0
  82. package/dist/src/witness-command.js +27 -0
  83. package/dist/src/witness-command.js.map +1 -0
  84. package/dist/src/witnesses.d.ts +74 -0
  85. package/dist/src/witnesses.d.ts.map +1 -0
  86. package/dist/src/witnesses.js +171 -0
  87. package/dist/src/witnesses.js.map +1 -0
  88. package/docs/incremental-example.md +64 -0
  89. package/docs/incremental-validation.md +99 -0
  90. package/docs/portable-rule-packs-validation.md +86 -0
  91. package/docs/repair-preview-example.md +43 -0
  92. package/docs/repair-preview-validation.md +42 -0
  93. package/examples/authoring-rules.json +30 -0
  94. package/manifest.json +13 -0
  95. package/package.json +150 -4
@@ -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.28",
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.23",
8
+ "priority": 90,
9
+ "capabilities": [
10
+ "commands",
11
+ "schema"
12
+ ]
13
+ }
package/package.json CHANGED
@@ -1,6 +1,152 @@
1
1
  {
2
2
  "name": "@unbrained/pm-lint",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "2026.10.28",
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
+ "docs/incremental-example.md",
27
+ "docs/incremental-validation.md"
28
+ ],
29
+ "scripts": {
30
+ "build": "tsc",
31
+ "build:test": "tsc -p tsconfig.test.json",
32
+ "test": "npm run build && npm run build:test && node --test --test-concurrency=2 test/*.test.ts",
33
+ "test:install": "npm run build && node --test --test-concurrency=2 --test-reporter=spec test/install.acceptance.ts",
34
+ "prepack": "npm run build",
35
+ "typecheck": "tsc --noEmit && tsc -p tsconfig.test.json",
36
+ "check": "npm run typecheck",
37
+ "docstring": "node scripts/docstring-gate.ts",
38
+ "lint": "node scripts/lint.ts",
39
+ "duplication": "node scripts/duplication-gate.ts",
40
+ "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);\"",
41
+ "pack:dry-run": "npm pack --dry-run",
42
+ "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",
43
+ "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",
44
+ "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",
45
+ "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",
46
+ "prepublishOnly": "npm run release:check",
47
+ "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",
48
+ "prepare": "node scripts/prepare-merge-driver.ts",
49
+ "merge:install": "pm merge install",
50
+ "coverage": "npm run build && npm run build:test && node scripts/coverage-gate.ts",
51
+ "verify:release-publish-attestation": "node scripts/verify-release-publish-attestation.ts",
52
+ "identity:check": "node scripts/identity-gate.ts"
53
+ },
54
+ "peerDependencies": {
55
+ "@unbrained/pm-cli": ">=2026.10.23"
56
+ },
57
+ "devDependencies": {
58
+ "@babel/eslint-parser": "8.0.7",
59
+ "@babel/plugin-syntax-typescript": "8.0.3",
60
+ "@types/node": "26.6.5",
61
+ "@unbrained/pm-cli": "2026.10.25",
62
+ "c8": "^12.0.0",
63
+ "eslint": "10.13.0",
64
+ "jscpd": "5.4.2",
65
+ "pm-changelog": "2026.10.25",
66
+ "pm-ops": "2026.10.25",
67
+ "typescript": "7.0.2",
68
+ "yaml": "2.9.1"
69
+ },
70
+ "keywords": [
71
+ "pm-cli",
72
+ "pm-extension",
73
+ "lint",
74
+ "context",
75
+ "quality"
76
+ ],
77
+ "license": "MIT",
78
+ "engines": {
79
+ "node": ">=22.18.0"
80
+ },
81
+ "author": {
82
+ "name": "unbrained",
83
+ "url": "https://unbrained.dev/about"
84
+ },
85
+ "pm": {
86
+ "aliases": [
87
+ "lint"
88
+ ],
89
+ "extensions": [
90
+ "."
91
+ ],
92
+ "catalog": {
93
+ "display_name": "pm-lint",
94
+ "category": "quality",
95
+ "summary": "Authoring-quality lint rules for useful pm item context",
96
+ "tags": [
97
+ "lint",
98
+ "context",
99
+ "quality"
100
+ ],
101
+ "links": {
102
+ "docs": "https://github.com/unbraind/pm-lint#readme",
103
+ "npm": "https://www.npmjs.com/package/@unbrained/pm-lint",
104
+ "repository": "https://github.com/unbraind/pm-lint",
105
+ "report": "https://github.com/unbraind/pm-lint/issues"
106
+ }
107
+ },
108
+ "docs": [
109
+ "README.md",
110
+ "CHANGELOG.md",
111
+ "docs/repair-preview-example.md",
112
+ "docs/repair-preview-validation.md",
113
+ "docs/incremental-example.md",
114
+ "docs/incremental-validation.md"
115
+ ],
116
+ "examples": [
117
+ "README.md",
118
+ "examples/authoring-rules.json",
119
+ "docs/repair-preview-example.md",
120
+ "docs/incremental-example.md"
121
+ ]
122
+ },
123
+ "publishConfig": {
124
+ "access": "public",
125
+ "provenance": true
126
+ },
127
+ "coverageGate": {
128
+ "sources": [
129
+ "src",
130
+ "scripts",
131
+ "index.ts",
132
+ "eslint.config.ts"
133
+ ],
134
+ "tests": [
135
+ "test/*.test.ts"
136
+ ],
137
+ "thresholds": {
138
+ "statements": 100,
139
+ "branches": 100,
140
+ "functions": 100,
141
+ "lines": 100
142
+ },
143
+ "ignore": []
144
+ },
145
+ "duplicationGate": {
146
+ "threshold": 0,
147
+ "minTokens": 50
148
+ },
149
+ "dependencies": {
150
+ "@toon-format/toon": "4.4.0"
151
+ }
152
+ }