@boyingliu01/xp-gate 0.39.2 → 0.39.3

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 (85) hide show
  1. package/package.json +1 -1
  2. package/plugins/claude-code/.claude-plugin/plugin.json +1 -1
  3. package/plugins/claude-code/skills/delphi-review/AGENTS.md +1 -1
  4. package/plugins/claude-code/skills/sprint-flow/AGENTS.md +1 -1
  5. package/plugins/claude-code/skills/test-specification-alignment/AGENTS.md +1 -1
  6. package/plugins/dsh/package.json +1 -1
  7. package/plugins/dsh/skills/delphi-review/AGENTS.md +1 -1
  8. package/plugins/dsh/skills/reinstall-xp-gate/.architecture-skip +8 -0
  9. package/plugins/dsh/skills/reinstall-xp-gate/.github/workflows/test.yml +106 -0
  10. package/plugins/dsh/skills/reinstall-xp-gate/CHANGELOG.md +379 -0
  11. package/plugins/dsh/skills/reinstall-xp-gate/LICENSE +21 -0
  12. package/plugins/dsh/skills/reinstall-xp-gate/QUALITY-OVERVIEW.md +173 -0
  13. package/plugins/dsh/skills/reinstall-xp-gate/README.md +167 -0
  14. package/plugins/dsh/skills/reinstall-xp-gate/SKILL.md +271 -0
  15. package/plugins/dsh/skills/reinstall-xp-gate/TODO.md +253 -0
  16. package/plugins/dsh/skills/reinstall-xp-gate/VERSION +1 -0
  17. package/plugins/dsh/skills/reinstall-xp-gate/package.json +28 -0
  18. package/plugins/dsh/skills/reinstall-xp-gate/scripts/audit.mjs +193 -0
  19. package/plugins/dsh/skills/reinstall-xp-gate/scripts/coverage.mjs +140 -0
  20. package/plugins/dsh/skills/reinstall-xp-gate/scripts/hp-gate.mjs +175 -0
  21. package/plugins/dsh/skills/reinstall-xp-gate/scripts/install.mjs +64 -0
  22. package/plugins/dsh/skills/reinstall-xp-gate/scripts/lib/agent-paths.mjs +67 -0
  23. package/plugins/dsh/skills/reinstall-xp-gate/scripts/lib/agents.mjs +247 -0
  24. package/plugins/dsh/skills/reinstall-xp-gate/scripts/lib/backups.mjs +96 -0
  25. package/plugins/dsh/skills/reinstall-xp-gate/scripts/lib/baseline.mjs +101 -0
  26. package/plugins/dsh/skills/reinstall-xp-gate/scripts/lib/ccn.mjs +124 -0
  27. package/plugins/dsh/skills/reinstall-xp-gate/scripts/lib/delphi.mjs +61 -0
  28. package/plugins/dsh/skills/reinstall-xp-gate/scripts/lib/fs-tree.mjs +108 -0
  29. package/plugins/dsh/skills/reinstall-xp-gate/scripts/lib/gatecheck.mjs +290 -0
  30. package/plugins/dsh/skills/reinstall-xp-gate/scripts/lib/json-file.mjs +37 -0
  31. package/plugins/dsh/skills/reinstall-xp-gate/scripts/lib/mutations.mjs +154 -0
  32. package/plugins/dsh/skills/reinstall-xp-gate/scripts/lib/platform.mjs +92 -0
  33. package/plugins/dsh/skills/reinstall-xp-gate/scripts/lib/probes.mjs +128 -0
  34. package/plugins/dsh/skills/reinstall-xp-gate/scripts/lib/proc.mjs +33 -0
  35. package/plugins/dsh/skills/reinstall-xp-gate/scripts/lib/report.mjs +29 -0
  36. package/plugins/dsh/skills/reinstall-xp-gate/scripts/lib/residue.mjs +188 -0
  37. package/plugins/dsh/skills/reinstall-xp-gate/scripts/lib/selfsync.mjs +75 -0
  38. package/plugins/dsh/skills/reinstall-xp-gate/scripts/lib/skills.mjs +121 -0
  39. package/plugins/dsh/skills/reinstall-xp-gate/scripts/lib/spawn.mjs +181 -0
  40. package/plugins/dsh/skills/reinstall-xp-gate/scripts/lib/testreport.mjs +26 -0
  41. package/plugins/dsh/skills/reinstall-xp-gate/scripts/lib/tools.mjs +238 -0
  42. package/plugins/dsh/skills/reinstall-xp-gate/scripts/lib/util.mjs +33 -0
  43. package/plugins/dsh/skills/reinstall-xp-gate/scripts/lib/verdict.mjs +45 -0
  44. package/plugins/dsh/skills/reinstall-xp-gate/scripts/lib/version.mjs +29 -0
  45. package/plugins/dsh/skills/reinstall-xp-gate/scripts/lib/xp-cli.mjs +66 -0
  46. package/plugins/dsh/skills/reinstall-xp-gate/scripts/mutation.mjs +132 -0
  47. package/plugins/dsh/skills/reinstall-xp-gate/scripts/preflight.mjs +75 -0
  48. package/plugins/dsh/skills/reinstall-xp-gate/scripts/reinstall.mjs +305 -0
  49. package/plugins/dsh/skills/reinstall-xp-gate/scripts/setup-wsl.sh +633 -0
  50. package/plugins/dsh/skills/reinstall-xp-gate/scripts/verify.mjs +239 -0
  51. package/plugins/dsh/skills/reinstall-xp-gate/tests/agents.test.mjs +168 -0
  52. package/plugins/dsh/skills/reinstall-xp-gate/tests/baseline.test.mjs +104 -0
  53. package/plugins/dsh/skills/reinstall-xp-gate/tests/ccn.test.mjs +87 -0
  54. package/plugins/dsh/skills/reinstall-xp-gate/tests/cleanup.test.mjs +128 -0
  55. package/plugins/dsh/skills/reinstall-xp-gate/tests/coverage.test.mjs +69 -0
  56. package/plugins/dsh/skills/reinstall-xp-gate/tests/delphi.test.mjs +78 -0
  57. package/plugins/dsh/skills/reinstall-xp-gate/tests/fixtures.mjs +61 -0
  58. package/plugins/dsh/skills/reinstall-xp-gate/tests/gatecheck-audit.test.mjs +157 -0
  59. package/plugins/dsh/skills/reinstall-xp-gate/tests/gatecheck.test.mjs +57 -0
  60. package/plugins/dsh/skills/reinstall-xp-gate/tests/mutation-anchors.test.mjs +49 -0
  61. package/plugins/dsh/skills/reinstall-xp-gate/tests/proc-contract.test.mjs +58 -0
  62. package/plugins/dsh/skills/reinstall-xp-gate/tests/proc.test.mjs +255 -0
  63. package/plugins/dsh/skills/reinstall-xp-gate/tests/report.test.mjs +66 -0
  64. package/plugins/dsh/skills/reinstall-xp-gate/tests/residue.test.mjs +278 -0
  65. package/plugins/dsh/skills/reinstall-xp-gate/tests/selfsync.test.mjs +70 -0
  66. package/plugins/dsh/skills/reinstall-xp-gate/tests/skills.test.mjs +171 -0
  67. package/plugins/dsh/skills/reinstall-xp-gate/tests/testreport.test.mjs +40 -0
  68. package/plugins/dsh/skills/reinstall-xp-gate/tests/timeout-budgets.test.mjs +38 -0
  69. package/plugins/dsh/skills/reinstall-xp-gate/tests/tools-leaf.test.mjs +323 -0
  70. package/plugins/dsh/skills/reinstall-xp-gate/tests/tools-probe.test.mjs +350 -0
  71. package/plugins/dsh/skills/reinstall-xp-gate/tests/tools.test.mjs +131 -0
  72. package/plugins/dsh/skills/reinstall-xp-gate/tests/util.test.mjs +154 -0
  73. package/plugins/dsh/skills/sprint-flow/AGENTS.md +1 -1
  74. package/plugins/dsh/skills/test-specification-alignment/AGENTS.md +1 -1
  75. package/plugins/opencode/package.json +1 -1
  76. package/plugins/opencode/skills/delphi-review/AGENTS.md +1 -1
  77. package/plugins/opencode/skills/sprint-flow/AGENTS.md +1 -1
  78. package/plugins/opencode/skills/test-specification-alignment/AGENTS.md +1 -1
  79. package/plugins/qoder/plugin.json +1 -1
  80. package/plugins/qoder/skills/delphi-review/AGENTS.md +1 -1
  81. package/plugins/qoder/skills/sprint-flow/AGENTS.md +1 -1
  82. package/plugins/qoder/skills/test-specification-alignment/AGENTS.md +1 -1
  83. package/skills/delphi-review/AGENTS.md +1 -1
  84. package/skills/sprint-flow/AGENTS.md +1 -1
  85. package/skills/test-specification-alignment/AGENTS.md +1 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@boyingliu01/xp-gate",
3
- "version": "0.39.2",
3
+ "version": "0.39.3",
4
4
  "description": "Deterministic quality gates for AI-generated code: 15 gates, Delphi review, sprint flow. Works with Claude Code, OpenCode, Qoder.",
5
5
  "bin": {
6
6
  "xp-gate": "bin/xp-gate.js"
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "xp-gate",
3
- "version": "0.39.2",
3
+ "version": "0.39.3",
4
4
  "displayName": "XP-Gate",
5
5
  "description": "Extreme Programming quality gates + AI workflow skills for Claude Code. Includes 12 pre-commit gates (Gate 0-11), 8 pre-push gates, Sprint Flow (6 phases), and Delphi multi-expert review (>=90% consensus).",
6
6
  "author": {
@@ -3,7 +3,7 @@
3
3
  **Generated:** 2026-11-04
4
4
  **Commit:** eb2097b0
5
5
  **Branch:** sprint/2026-11-03-02
6
- **Version:** 0.39.2.0
6
+ **Version:** 0.39.3.0
7
7
 
8
8
  ## OVERVIEW
9
9
  Delphi Consensus Review — multi-round anonymous expert review (≥90% threshold, exactly 3 experts with distinct executable model IDs). Supports design, requirements, and code-walkthrough modes.
@@ -3,7 +3,7 @@
3
3
  **Generated:** 2026-11-04
4
4
  **Commit:** eb2097b0
5
5
  **Branch:** sprint/2026-11-03-02
6
- **Version:** 0.39.2.0
6
+ **Version:** 0.39.3.0
7
7
 
8
8
  ## OVERVIEW
9
9
  **6-phase** development pipeline (v2.0 compact redesign, Issue #290): PREP → DESIGN → BUILD → VERIFY → SHIP → CLOSE. Phase 3/6 BUILD default build mode is **ralph-loop** (REQ-level iteration; each REQ starts from a clean context instead of accumulating one across REQs). HARD-GATE between DESIGN (2/6) and BUILD (3/6): design must pass Delphi review (≥90% consensus) before any coding.
@@ -3,7 +3,7 @@
3
3
  **Generated:** 2026-11-04
4
4
  **Commit:** eb2097b0
5
5
  **Branch:** sprint/2026-11-03-02
6
- **Version:** 0.39.2.0
6
+ **Version:** 0.39.3.0
7
7
 
8
8
  ## OVERVIEW
9
9
  Test-Specification Alignment Engine — two-stage validation ensuring tests accurately reflect requirements and design specs.
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@boyingliu01/dsh-plugin-xp-gate",
3
- "version": "0.39.2",
3
+ "version": "0.39.3",
4
4
  "description": "XP-Gate deterministic quality gates + AI workflow skills as a DeepSeek Harness (DSH) native plugin: gate-check / gate-principles / gate-arch tools + 12 SKILL.md skills",
5
5
  "type": "module",
6
6
  "main": "./lib/index.js",
@@ -3,7 +3,7 @@
3
3
  **Generated:** 2026-11-04
4
4
  **Commit:** eb2097b0
5
5
  **Branch:** sprint/2026-11-03-02
6
- **Version:** 0.39.2.0
6
+ **Version:** 0.39.3.0
7
7
 
8
8
  ## OVERVIEW
9
9
  Delphi Consensus Review — multi-round anonymous expert review (≥90% threshold, exactly 3 experts with distinct executable model IDs). Supports design, requirements, and code-walkthrough modes.
@@ -0,0 +1,8 @@
1
+ # xp-gate Gate 6 exemption (documented mechanism: "To skip with warning, create .architecture-skip")
2
+ #
3
+ # WHY: this repository is a portable agent skill, not a layered application.
4
+ # It contains SKILL.md plus flat Node ESM helper scripts under scripts/lib/.
5
+ # There is no import graph to constrain, no layering to enforce, and therefore
6
+ # no architecture.yaml that could be written honestly. Gate 6's own message
7
+ # says it needs "explicit architecture constraints"; declaring none is the
8
+ # truthful state, and the warning keeps that visible rather than hidden.
@@ -0,0 +1,106 @@
1
+ name: test
2
+
3
+ on:
4
+ push:
5
+ branches: [main]
6
+ pull_request:
7
+ schedule:
8
+ # A green suite proves the tests agree with the code on the day it was
9
+ # written. The gate audit below depends on the *installed* xp-gate release,
10
+ # which changes without this repo changing -- hence the weekly run.
11
+ - cron: '0 3 * * 1'
12
+
13
+ # Least privilege: this workflow only reads the repo and runs local commands.
14
+ # Without an explicit block GitHub defaults to write-all, which is CKV2_GHA_1.
15
+ permissions:
16
+ contents: read
17
+
18
+ jobs:
19
+ test:
20
+ name: tests (node ${{ matrix.node }})
21
+ runs-on: ubuntu-latest
22
+ strategy:
23
+ fail-fast: false
24
+ matrix:
25
+ # Node 18 EOL 2025-04-30, Node 20 EOL 2026-04-30: neither gets security
26
+ # patches any more, and setup-node keeps dropping prebuilt EOL releases,
27
+ # which would turn this matrix red for reasons unrelated to this repo.
28
+ # 22 is supported to 2027-04-30, 24 to 2028-04-30, 26 to 2029-04-30.
29
+ node: ['22', '24', '26']
30
+ steps:
31
+ - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
32
+ - uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
33
+ with:
34
+ node-version: ${{ matrix.node }}
35
+ # No `npm install`: the suite uses the built-in node:test runner and has
36
+ # no dependencies. An empty install step would only add a failure mode.
37
+ - run: node --test tests/*.test.mjs
38
+ # The coverage floor Gate 5 enforces locally. Node 22+ prints the numbers;
39
+ # scripts/coverage.mjs translates them to the istanbul artefact the gate
40
+ # reads, so this repo does not need vitest just to satisfy a file shape.
41
+ # Runs on the LTS line only: --experimental-test-coverage is still flagged
42
+ # experimental, and its exact percentages drift between majors, so
43
+ # reporting from a single version keeps the number reproducible.
44
+ - if: matrix.node == '26'
45
+ run: node scripts/coverage.mjs
46
+
47
+ mutation:
48
+ name: mutation gate
49
+ runs-on: ubuntu-latest
50
+ steps:
51
+ - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
52
+ - uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
53
+ with:
54
+ node-version: '26'
55
+ # Fails if any injected defect survives the suite, i.e. if a property this
56
+ # skill exists to guarantee has stopped being tested. See scripts/mutation.mjs.
57
+ - run: node scripts/mutation.mjs
58
+
59
+ hp-gate:
60
+ name: complexity of .mjs sources
61
+ runs-on: ubuntu-latest
62
+ steps:
63
+ - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
64
+ - uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
65
+ with:
66
+ node-version: '26'
67
+ - uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5
68
+ with:
69
+ python-version: '3.12'
70
+ - run: pip install lizard
71
+ # xp-gate's Gate 3 never looks at this repo. Its LIZARD_EXTENSIONS and
72
+ # SEMGREP_EXTENSIONS are /\.(ts|tsx|js|jsx|py|go|java|...)$/ -- neither
73
+ # lists mjs -- so a pure-ESM project reports "no source files to check"
74
+ # and passes Gate 3 on complexity without measuring a single function
75
+ # (xp-gate#732, reproduced: the same code as src/a.js is checked and the
76
+ # same code as src/a.mjs is skipped). hp-gate runs lizard over
77
+ # .mjs/.cjs with the same CCN 5 threshold Gate 3 uses, so the number that
78
+ # would have been checked is now checked here.
79
+ - run: node scripts/hp-gate.mjs
80
+
81
+ gate-audit:
82
+ name: gates actually block
83
+ runs-on: ubuntu-latest
84
+ if: github.event_name == 'schedule' || github.event_name == 'workflow_dispatch'
85
+ steps:
86
+ - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
87
+ - uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
88
+ with:
89
+ node-version: '26'
90
+ - uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5
91
+ with:
92
+ python-version: '3.12'
93
+ - name: Install xp-gate
94
+ run: npm install -g @boyingliu01/xp-gate
95
+ - name: Install gate tools
96
+ run: |
97
+ pip install semgrep lizard
98
+ npm install -g jscpd
99
+ # Gray-box: plant a defect the gate is responsible for catching and require
100
+ # the gate to say so. A gate that passes a dirty tree is broken, and no
101
+ # amount of hash comparison in verify.mjs would reveal it.
102
+ #
103
+ # Skipped on push/PR because it installs a toolchain and runs the real CLI;
104
+ # the point is to catch an upstream regression after it ships, not to gate
105
+ # this repo's own commits.
106
+ - run: node scripts/audit.mjs --gates
@@ -0,0 +1,379 @@
1
+ # Changelog
2
+
3
+ All notable changes to this skill are documented here.
4
+ Format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/);
5
+ versioning is [Semantic Versioning](https://semver.org/).
6
+
7
+ ## [2.0.2] - 2026-11-24
8
+
9
+ ### Fixed
10
+
11
+ - **An uninstalled agent stayed "live" because xp-gate's own writes looked like
12
+ the user coming back** (issue #4). `probeLiveness` falls through to a recency
13
+ check once the app directory and the CLI are both gone, and that check reads
14
+ the config directory's mtime. xp-gate itself writes `tui.json` and `skills/`
15
+ there, and creating either refreshes the mtime -- so the evidence of use was
16
+ the checker's own output, and a removed OpenCode kept receiving twelve skills
17
+ on every install forever.
18
+
19
+ A home holding only those two entries is now treated as residue. A home that
20
+ also contains something the agent or its user made still counts as live, and
21
+ so does an empty home: that is a fresh install with no skills yet, which is
22
+ the machine that most needs them.
23
+
24
+ This release exists because 2.0.1 was tagged before the fix landed; the six
25
+ installed copies on this machine were verified to move to it.
26
+
27
+ ## [2.0.1] - 2026-11-24
28
+
29
+ ### Fixed
30
+
31
+ - **The mutation gate reported a clean run while silently skipping eight of its
32
+ own checks.** Refactoring `util.mjs` into `fs-tree.mjs`, and moving
33
+ `cmpVersion` to `version.mjs`, left eight mutations anchored to text that had
34
+ moved. Each printed `[skip] anchor not found`, and the script still ended with
35
+ "every mutated defect was caught" and exit code 0 -- so eight of nineteen
36
+ property checks disappeared and the gate looked healthier than before. Since
37
+ this project exists to catch exactly "the gate passed but measured nothing",
38
+ that was the worst possible failure mode for it to have.
39
+
40
+ Fixed at both ends: the table moved to `scripts/lib/mutations.mjs` so it can
41
+ be imported (the mutator has top-level side effects and cannot be), and
42
+ `tests/mutation-anchors.test.mjs` now fails when an anchor or its target file
43
+ is gone. A skipped mutation also exits 1 and no longer prints the all-clear.
44
+ Verified by planting a bogus anchor and watching the run fail.
45
+
46
+ - **`pipLatest` exceeded the CCN ceiling while being moved.** Spelling its
47
+ injectable defaults as `deps.x || realX` cost three branches and reached CCN 7
48
+ against a limit of 5; they are a lookup table now.
49
+
50
+ ### Changed
51
+
52
+ - **Four modules were split by responsibility**, which cleared Gate 4's last
53
+ four `many-exports` findings (4 -> 0):
54
+ `proc.mjs` -> `platform.mjs` / `spawn.mjs` / `xp-cli.mjs`;
55
+ `util.mjs` -> `fs-tree.mjs` / `json-file.mjs` / `backups.mjs`;
56
+ `tools.mjs` -> `version.mjs` / `probes.mjs`;
57
+ `agents.mjs` -> `agent-paths.mjs`.
58
+
59
+ The original four remain the import surface and re-export everything, so no
60
+ import site changed and the public API is byte-for-byte the same. That is
61
+ pinned by `tests/proc-contract.test.mjs` rather than left to review.
62
+
63
+ ### Documentation
64
+
65
+ - Corrected the quality overview's Gate 3 claim. It said Gate 3 cannot see this
66
+ repo because `LIZARD_EXTENSIONS` lacks `mjs`/`cjs`; a control experiment shows
67
+ the opposite -- with one staged `.mjs` it prints "All functions within
68
+ complexity threshold", and a fixture containing only an over-complex `.mjs` is
69
+ BLOCKED. The `SKIPPED` on a clean tree means "nothing changed", not "cannot
70
+ see". No upstream issue was filed for it.
71
+
72
+ ## [2.0.0] - 2026-11-23
73
+
74
+ ### Changed (BREAKING)
75
+
76
+ - **Renamed the skill and the repository `xp-gate-reinstall` ->
77
+ `reinstall-xp-gate`.**
78
+
79
+ The old name read as if this skill belonged to xp-gate, and that reading is
80
+ not harmless: the whole point of the skill is to uninstall and reinstall
81
+ xp-gate, so shipping it as part of xp-gate would mean the tool removes itself
82
+ mid-run. It has to live outside. The name now says what it does instead of
83
+ what it acts on.
84
+
85
+ What changed: the `name:` in `SKILL.md`, the directory `install.mjs` writes
86
+ into each agent root, the canonical copy under
87
+ `~/.local/share/xp-gate/skills/`, the repo URL, and the `.bashrc` block
88
+ markers written by `setup-wsl.sh`.
89
+
90
+ ### Added
91
+
92
+ - **Automatic cleanup of the pre-2.0.0 copies.** Renaming the directory would
93
+ otherwise leave an `xp-gate-reinstall/` in every agent root on every machine
94
+ that had run the old installer, and nothing would ever update it again -- the
95
+ package no longer ships anything under that name -- so each box would
96
+ accumulate a permanent stale skill that still looks live.
97
+ `pruneDeadRoots` now sweeps both names.
98
+
99
+ The sweep matches on the `SKILL.md` `name:` marker, not on the directory name
100
+ alone. The previous version deleted `xp-gate-reinstall/` unconditionally, so a
101
+ user who had edited their copy would have lost those edits with no warning;
102
+ that is now covered by a test.
103
+
104
+ - `setup-wsl.sh` recognises the old `# >>> xp-gate-reinstall >>>` block in
105
+ `~/.bashrc` as already present. Without it, a re-run on an existing machine
106
+ would append a second block with competing `EDITOR` and alias definitions.
107
+
108
+ ### Notes
109
+
110
+ - `setup-wsl.sh` claimed xp-gate's package had shipped this skill since v1.2.2.
111
+ Measured on 0.38.125: its `skills/` holds 12 skills and this is not one of
112
+ them. The comment now records that, while keeping the "sync last" ordering so
113
+ machines still on an older package are unaffected.
114
+
115
+ ## [1.3.3] - 2026-02-21
116
+
117
+ ### Fixed
118
+
119
+ - **A doctor FAIL that could only be fixed by reinstalling the editor the user
120
+ deliberately removed.** `doctor-tui.js` requires `~/.config/opencode/tui.json`
121
+ unconditionally and reports `TUI registration: FAIL / Not registered` when it
122
+ is absent, without ever asking whether OpenCode exists. Once OpenCode was
123
+ uninstalled the check became unsatisfiable by design, and `verify.mjs` passed
124
+ every doctor FAIL straight through — so a correct configuration reported as a
125
+ broken one.
126
+
127
+ `agentInstalled` (new, in `lib/agents.mjs`) resolves the agent's CLI, and
128
+ `verify.mjs` now reports this one check as `SKIP` with the reason attached
129
+ rather than `FAIL`. The branch is gated on the CLI actually being absent, so a
130
+ machine that still uses OpenCode keeps failing loudly when its TUI is
131
+ unregistered. Dropping the FAIL silently was the alternative and was rejected:
132
+ the SKIP names the check and says why, so a tolerated gap is distinguishable
133
+ from a clean run.
134
+
135
+ ## [1.3.2] - 2026-02-21
136
+
137
+ ### Fixed
138
+
139
+ - **The audit reported a stronger gate as broken.** xp-gate 0.38.75 added
140
+ `--threshold 15` to Gate 2's jscpd invocation; before that jscpd was called
141
+ without a threshold, returned 0 no matter how much duplication it found, and
142
+ the gate passed unconditionally — which is why the case could only ever expect
143
+ `detected`. Once the gate started failing, the stale expectation reported it as
144
+ FAILED. Verified on 0.38.75 with the planted fixture: `Found 1 clones`, then
145
+ `ERROR: jscpd found too many duplicates (50.0%) over threshold (15.0%)`. The
146
+ control tree still passes, so the case separates rather than failing always.
147
+
148
+ ### Changed
149
+
150
+ - This closes the Gate 2 gap recorded in 1.3.0, where the audit called Gate 2
151
+ permanently UNMEASURABLE on Windows with jscpd >= 5. It now measures, and
152
+ measures correctly: audit 13/13 PASS with 3/3 cases separating.
153
+
154
+ ## [1.3.1] - 2026-02-21
155
+
156
+ The theme: **the installer's own maintenance state had no bound.**
157
+
158
+ ### Fixed
159
+
160
+ - **`install.mjs` grew its backup directory without limit.** Every run backs up
161
+ each agent copy it is about to overwrite and nothing ever removed one.
162
+ Measured before the policy existed: 50 backups / 11 MB dating back to v1.1.0,
163
+ growing by one set per install. `pruneBackups` now keeps the newest 3 stamped
164
+ backups **per agent**. The cap is per label rather than per directory because
165
+ one run backs up all nine agents with the same timestamp, so a global cap of 3
166
+ would delete six of the backups that run had just written — the retain count
167
+ would be spent on simultaneity instead of history, and rolling back one agent
168
+ would be impossible while its siblings survived.
169
+ - **`toolReport()` crashed with "lookup is not a function".** `rows.map(classify)`
170
+ passes `(value, index, array)`, so the index landed in the `lookup` parameter.
171
+ `verify.mjs` died outright while every unit test stayed green, because they all
172
+ passed `lookup` explicitly. The map call is now an explicit arrow.
173
+
174
+ ### Added
175
+
176
+ - `tests/cleanup.test.mjs`: 7 cases covering pruning (per-agent cap, name-stamp
177
+ ordering over mtime, unrecognised directories spared, no-op guards) and the
178
+ map-arity regression. An earlier version of the arity test called
179
+ `toolReport()` and hung the suite for 60 s shelling out to npm/pip for all
180
+ eight tools; it now drives `classify` through `map` with a fake lookup.
181
+ - 3 mutation entries for the pruning rules, so the retention policy cannot
182
+ regress silently. 19/19 mutations killed.
183
+
184
+ ## [1.3.0] - 2026-02-19
185
+
186
+ The theme: **make the quality claims measurable.** Three separate checks in this
187
+ repo reported "clean" while measuring nothing, and each was found only by
188
+ re-deriving the number by hand.
189
+
190
+ ### Added
191
+
192
+ - **`scripts/hp-gate.mjs` — complexity for the files xp-gate cannot see.**
193
+ xp-gate's `LIZARD_EXTENSIONS` and `SEMGREP_EXTENSIONS` (`gates/common.ts`)
194
+ both omit `mjs`/`cjs`, so a pure-ESM project passes Gate 3 with the message
195
+ "⏭️ SKIPPED – Complexity (no source files to check)" and no function measured
196
+ (xp-gate#732). Measured control: the same CCN-22 file is checked as `src/a.js`
197
+ and skipped as `src/a.mjs`. `hp-gate` runs lizard over `.mjs`/`.cjs` at the
198
+ same CCN 5 threshold Gate 3 uses, plus `node --check` per file (Gate 1 also
199
+ skips `.mjs`). Wired into CI and `npm run hp-gate`.
200
+
201
+ - **`scripts/lib/ccn.mjs` — the CSV contract, testable.** `parseLizardCsv`,
202
+ `splitCsvLine`, `ccnViolations`, with `tests/ccn.test.mjs` pinning all three
203
+ numeric columns. Field order verified against lizard 1.26.1
204
+ `lizard_ext/csvoutput.py`: `nloc, cyclomatic_complexity, token_count, …`.
205
+
206
+ - **`tests/gatecheck-audit.test.mjs`** — pins the audit's own bookkeeping: a
207
+ blocked control is `unmeasurable`, not a gate failure, and a known upstream
208
+ gap neither counts as a pass nor turns the audit permanently red.
209
+
210
+ ### Fixed
211
+
212
+ - **`hp-gate` passed a tree containing a CCN-22 function, twice.** First because
213
+ lizard was run without `--csv` (empty stdout); then because the parser read
214
+ column 0 (NLOC) instead of column 1 (CCN), yielding zero rows. Both surfaced
215
+ as "every function within CCN 5". There is now a hard `scanBroken` failure
216
+ when a non-empty source set parses to zero rows, plus a mutation for each of
217
+ the three ways to misread the columns.
218
+
219
+ - **`audit.mjs` reported a blocking control as a gate failure.** Gate 2's clean
220
+ tree prints `Gate 2 FAILED: spawnSync npx ENOENT` even with jscpd 5.4.3 on
221
+ PATH, because `lib/gate-runner.js` probes `<root>/node_modules/jscpd/bin/jscpd`
222
+ and jscpd 5.x moved its bin to `run-jscpd.js`; the three fallbacks fail on
223
+ Windows for three different reasons (`jscpd.cmd` EINVAL, `jscpd` ENOENT,
224
+ `npx` ENOENT) — all through `execFileSync` without a shell. Reported as
225
+ `UNMEASURABLE` now; the root cause is documented in `lib/gatecheck.mjs`.
226
+
227
+ - **`cmpVersion` mutation was equivalent to the original** and could never be
228
+ killed, so it tested nothing while looking like coverage. Replaced with two
229
+ mutations that do change behaviour (first-component-only, string compare).
230
+
231
+ - **Four `residue.mjs` mutation anchors went stale** during refactoring and were
232
+ silently reported as `SKIPPED`. Re-anchored, and the anchors now target the
233
+ named helpers (`classifyCopy`, `isIdenticalCopy`) so a future split is more
234
+ likely to fail loudly than to pass quietly.
235
+
236
+ - **Every production function in this repo was above CCN 5.** 14 functions
237
+ exceeded the threshold the repo's own gates would enforce (had they looked);
238
+ the worst was `runCase` at 27. All 414 functions are now within CCN 5,
239
+ including the tests. The refactors split behaviour, they did not delete it —
240
+ the suite grew from 97 to 114 cases and mutation coverage from 8 to 16
241
+ mutations while the violation count went to zero.
242
+
243
+ - **Version bump to 1.3.0** and `VERSION` now matches `package.json`.
244
+
245
+ ## [1.2.0] - 2026-11-17
246
+
247
+ ### Added
248
+
249
+ - **`scripts/audit.mjs` — ask "are the gates still effective" without
250
+ reinstalling.** `reinstall.mjs` used to be the only entry point, so the only
251
+ way to check whether the gates still block was to tear down and rebuild the
252
+ installation. Those are different questions. Two layers, reported separately:
253
+ on-disk parity, and whether the gates actually reject a planted defect.
254
+
255
+ - **`scripts/lib/gatecheck.mjs` — gray-box gate verification.** Builds a
256
+ throwaway git repo, plants a defect the gate is responsible for catching, and
257
+ requires the gate to say so. Every case runs twice: the same gate on the same
258
+ tree without the defect. Recall alone is not a verdict — a gate that blocks
259
+ everything would otherwise score as perfect.
260
+
261
+ Measured on 0.38.9:
262
+
263
+ | Gate | clean | planted | verdict |
264
+ |---|---|---|---|
265
+ | 8 — secret scan | passed | blocked | ok |
266
+ | 3 — complexity | skipped | blocked | ok |
267
+ | 2 — duplicates | passed | detected | ok |
268
+
269
+ `detected` is a separate verdict from `blocked` because the gates disagree
270
+ about severity: Gate 8 exits 1 on a secret, while Gate 2 reports
271
+ `Found N clones` and exits 0 with or without clones.
272
+
273
+ - **`scripts/mutation.mjs` — `npm run mutation`.** Eight injected defects that
274
+ must all be caught, each tied to a property this skill exists to guarantee
275
+ (wrong directory deleted, user's edit overwritten, outdated tool reported
276
+ current). Turns the one-off mutation pass from 1.1.1 into a repeatable gate.
277
+ Currently 8/8 killed.
278
+
279
+ - **CI** (`.github/workflows/test.yml`): tests on Node 18/20/22, the mutation
280
+ gate on every push, and the gray-box gate audit weekly — the last one because
281
+ it depends on the *installed* xp-gate release, which changes without this
282
+ repository changing.
283
+
284
+ ### Fixed
285
+
286
+ - `verdictOf` read `./failed-tests.js` as `blocked`: `FAILED` was matched as a
287
+ substring, so a filename containing "failed" turned a clean gate run into a
288
+ failure. Now matched as a standalone token. A false alarm is how an audit
289
+ stops being read at all.
290
+ - `verdictOf` returned `unknown` for a clean Gate 2 run, because Gate 2 prints
291
+ no is okay-marker at all. "Cannot read the output" and "the gate is fine" must
292
+ not look the same.
293
+ - The mutation runner spawned the test suite through a shell, so
294
+ `C:\Program Files\nodejs\node.exe` was split at the space and every mutation
295
+ reported as SURVIVED because the suite never ran. Added a distinct `ERROR`
296
+ outcome for "the runner failed", so a broken invocation is no longer
297
+ indistinguishable from a missing test.
298
+ - The mutation runner could not read CI's test output. Node picks its reporter
299
+ by whether stdout is a TTY, so a terminal prints `ℹ fail 0` and a piped run
300
+ prints TAP `# fail 0`; the runner matched only the first, so every CI run
301
+ reported "the runner failed" while the counts were right there under a
302
+ different name. The parse now lives in `lib/testreport.mjs` with tests for both
303
+ formats, instead of being a regex buried in the runner.
304
+ - `node --test "tests/*.test.mjs"` (quoted) only works on Windows: Node's test
305
+ runner expands the glob there but not on Linux, where it fails with
306
+ `Could not find '.../tests/*.test.mjs'`. Verified only on Windows before
307
+ pushing, which is exactly the gap. The glob is now unquoted so the shell
308
+ expands it, and `mutation.mjs` enumerates the files itself instead of relying
309
+ on anyone to expand anything.
310
+
311
+ ### Upstream
312
+
313
+ - Filed [xp-gate#840](https://github.com/boyingliu01/xp-gate/issues/840): on a
314
+ machine without OpenCode, `doctor` reports `✗ TUI registration: Not
315
+ registered` and exits 1, because the check never asks whether the platform
316
+ exists. Found by the new audit — it was the only FAIL on an otherwise clean
317
+ machine.
318
+
319
+ ## [1.1.1] - 2026-11-17
320
+
321
+ ### Fixed
322
+
323
+ - `tests/residue.test.mjs`: "pruneDeadRoots removes only copies identical to the
324
+ published package" asserted nothing about the hash comparison it is named
325
+ after. It deployed the untouched copy as `alpha` and the edited one as `beta`,
326
+ but `contentHashes()` only iterates names present in the package, so `beta`
327
+ was skipped before any hash was computed — the assertion held either way.
328
+
329
+ Found by mutation testing: removing the hash check from `pruneDeadRoots`
330
+ (`isDir(dest) && hashFn(dest) === expected` → `isDir(dest)`), which makes it
331
+ delete user-edited skill copies, left the suite 84/84 green. The test now
332
+ places the same skill name in two dead roots, one untouched and one edited.
333
+ The same mutation now fails one test.
334
+
335
+ ### Changed
336
+
337
+ - Extracted `tests/fixtures.mjs` with `tmpDir`, `fakePkg`, `deploySkill` and
338
+ `editSkill`, previously copy-pasted into four test files. They track the
339
+ package layout, temp-dir cleanup and drift simulation, all of which must
340
+ change together. jscpd clone pairs: 3 → 0.
341
+
342
+ ## [1.1.0] - 2026-11-17
343
+
344
+ ### Added
345
+
346
+ - 84 tests across 8 files using the built-in `node:test` runner (zero
347
+ dependencies, no `npm install`). Priority follows blast radius: the four
348
+ destructive helpers in `lib/residue.mjs` are covered first.
349
+ - `lib/residue.mjs`, extracted from `reinstall.mjs` (364 → 292 lines) so that
350
+ backup-then-delete, marker detection and dead-root pruning became testable.
351
+ - `package.json` with `test`, `install-skill`, `preflight`, `reinstall` and
352
+ `verify` scripts; `node >= 18`.
353
+
354
+ ### Changed
355
+
356
+ - Cyclomatic complexity brought below Gate 3's block threshold of 10:
357
+
358
+ | function | before | after | how |
359
+ |---|---:|---:|---|
360
+ | `probeLiveness` | 13 | 7 | split into `appEvidence` / `cliEvidence` / `idleDays` |
361
+ | `collectBaseline` | 11 | ~3 | split into `xpGateInfo` / `configInfo` / `delphiInfo` / `doctorInfo` |
362
+ | `upgradeTool` | 10 | ~2 | if-chain replaced by an `UPGRADERS` dispatch table |
363
+
364
+ Function rate 0.56 → 0.60.
365
+
366
+ ### Fixed
367
+
368
+ - `SKILL.md` gained a note on DSH erasing credential-shaped environment
369
+ variables (`KEY`/`PASSWORD`/`SECRET`/`TOKEN`) before spawning subprocesses,
370
+ which makes `delphi-external-review` report a missing API key on a machine
371
+ where it is set. It is a security design, not a misconfiguration.
372
+
373
+ ## [1.0.0] - 2026-11-16
374
+
375
+ ### Added
376
+
377
+ - Initial release: snapshot config → purge with residue cleanup → install the
378
+ latest npm release → upgrade gate tools → verify each agent's skills, plugins
379
+ and hooks.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 boyingliu01
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.