@ngockhoale/ukit 3.4.41 → 3.4.43

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
@@ -9,6 +9,20 @@ All notable changes to UKit are documented here.
9
9
  - New `/ukit:ci-check` command + `ci-check.mjs` helper (core pack): prechecks, fail-closed budget guard, local preflight, at most one dispatch per invocation, write-ahead run-id state, `status` (never dispatches), `--ref`, `--dry-run`, per-OS report. Never pushes, merges or publishes.
10
10
  - Default-branch bootstrap stub documented in `docs/design/CI-CROSS-PLATFORM-MATRIX.md` (requires separate approval).
11
11
 
12
+ ## 3.4.43 - 2026-10-13
13
+
14
+ **Completion Gate: an ordered `git tag` is discharged by the tag itself, so the live release Stop is accepted.**
15
+ - Live root cause (3.4.42 still blocked this session): the prompt ordered a tag, so the git-integrity goal required target `tag`. A real tag created inside a compound command (`... && git tag ...; echo $?`) is a masked mutation and records as failed, and the independent remote-parity recovery only accepted `commit`/`push` targets, so `operation-verification` stayed missing although the tag, remote and registry were all correct.
16
+ - Fix: the gate-time git authority also lists the tags that dereference to live HEAD (`git tag --points-at HEAD`, peels annotated tags). When `tag` is a required target, a tag at HEAD plus the existing remote-parity proof (remote sha == HEAD on the tracking remote, clean tree, observed after every mutation attempt) recovers it. No tag at HEAD, a diverged remote, a dirty tree or a later mutation still blocks.
17
+ - Regressions in `tests/hooks/stopHookRelease.test.js`: masked tag with an annotated tag at HEAD -> ACCEPT (fails without the fix); no tag at HEAD -> BLOCK.
18
+
19
+ ## 3.4.42 - 2026-10-13
20
+
21
+ **Completion Gate: `cd <repo>; <command>` is a checked command, so a finished release is recognized by the live Stop hook.**
22
+ - Live root cause (3.4.40/3.4.41 still blocked): agents run every Bash call as `cd <repo>; <cmd>`. The receipt classifier treated that `;` as shell masking, so `npm view`, `git ls-remote` and `git status --porcelain` minted no release/remote/clean-tree proof and Stop kept reporting `operation-verification, release-publication`. The runtime mirrors were byte-identical to the template; the evaluator was correct, the receipts never existed.
23
+ - Fix (`cron-operation-adapter.mjs`): exactly one leading `cd <dir>` followed by `;`/`&&` is dropped before classification (it prints nothing; the exit status is the next command's). Any other `;`, `||`, pipe, `echo $?` or second `cd` still masks, mints no proof, and cannot produce a false ACCEPT. A masked `npm publish > log; echo $?` still mints no publish receipt; release completion never required one: registry view == package.json version plus a tag that dereferences to HEAD plus live remote parity is the proof, so an immutable version is never republished to manufacture a receipt.
24
+ - Regressions: `tests/hooks/stopHookRelease.test.js` drives the real router, record and Stop hooks (bare, `cd ;`, `cd &&`; BLOCK then ACCEPT; wrong version, remote divergence, wrong tag, dirty tree, masked compounds, other session, runtime/template parity) and the adapter command shapes. Against the 3.4.41 adapter five of them fail.
25
+
12
26
  ## 3.4.41 - 2026-10-13
13
27
 
14
28
  **Completion Gate: a published release is recognized, and tests no longer depend on the developer's real `~/.ukit`.**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ngockhoale/ukit",
3
- "version": "3.4.41",
3
+ "version": "3.4.43",
4
4
  "description": "Install/update an index-first AI workspace for Claude Code, OpenAI Codex and omp (Oh My Pi).",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -57,12 +57,20 @@ const SERVICE_MUTATION = /^(?:docker(?:\s+compose)?|docker-compose)\s+(?:restart
57
57
  const GIT_LS_REMOTE = /^git\s+ls-remote\s+(\S+)\s+(refs\/heads\/\S+)\s*$/;
58
58
  const DRY_RUN = /(?:^|\s)(?:--dry-run|--check|--no-act|-n)(?:\s|=|$)/;
59
59
  const CURL = /^curl\s/;
60
+ // A leading `cd <dir>;` / `cd <dir> &&` only selects the working directory: it prints nothing and the shell's
61
+ // exit status is the next command's, so it must not turn an otherwise single, checked command into a "masked"
62
+ // compound. Only ONE leading cd is dropped; any other `;`, `||`, pipe or extra segment still masks.
63
+ const LEADING_CD = /^\s*cd\s+(?:"[^"\n]*"|'[^'\n]*'|[^\s;&|<>$`()]+)\s*(?:;|&&)\s*(?=\S)/;
64
+ export function stripLeadingCd(command) {
65
+ return typeof command === 'string' ? command.replace(LEADING_CD, '') : command;
66
+ }
60
67
  function requiredTargetOf(segment, required) {
61
68
  if (!required.length) return null;
62
69
  const tokens = segment.split(/\s+/);
63
70
  return required.find((name) => tokens.some((tok) => tok === name || tok.endsWith(`/${name}`))) || '(other)';
64
71
  }
65
- export function bashOperationReceipt(command, response, transportSuccess, goal, { sessionId, harness } = {}) {
72
+ export function bashOperationReceipt(rawCommand, response, transportSuccess, goal, { sessionId, harness } = {}) {
73
+ const command = stripLeadingCd(rawCommand);
66
74
  const domain = goal?.domain;
67
75
  const scope = typeof sessionId === 'string' && sessionId.trim() ? `session:${sessionId.trim()}` : null;
68
76
  if (!['git-integrity', 'service-runtime'].includes(domain) || typeof command !== 'string') return null;
@@ -134,8 +142,9 @@ export function bashOperationReceipt(command, response, transportSuccess, goal,
134
142
  const NPM_PUBLISH = /^npm\s+publish(?:\s|$)/;
135
143
  const NPM_VIEW = /^npm\s+view\s+(\S+?)(?:@\S+)?\s+version(?:\s+2>&1)?\s*$/;
136
144
  const SEMVER_LINE = /^\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?(?:\+[0-9A-Za-z.-]+)?$/;
137
- export function releaseReceipt(command, response, transportSuccess) {
138
- if (typeof command !== 'string') return null;
145
+ export function releaseReceipt(rawCommand, response, transportSuccess) {
146
+ if (typeof rawCommand !== 'string') return null;
147
+ const command = stripLeadingCd(rawCommand);
139
148
  const masked = /;|\n|\|/.test(command.replace(/'[^']*'|"[^"]*"/g, '""'));
140
149
  const segments = command.split('&&').map((seg) => seg.trim()).filter((seg) => seg && !/^cd\s+\S+$/.test(seg));
141
150
  if (segments.length !== 1) return null;
@@ -3280,7 +3280,10 @@ function gitAuthority(cwd) {
3280
3280
  if (!head || !branch) return null;
3281
3281
  const remote = gitOutput(['config', `branch.${branch}.remote`], cwd);
3282
3282
  const dirty = gitOutput(['status', '--porcelain'], cwd);
3283
- return { head, branch, remote, clean: dirty === null && gitOutput(['rev-parse', '--git-dir'], cwd) !== null };
3283
+ // Tags that dereference (`--points-at` peels annotated tags) to live HEAD: a masked `git tag` is recovered by
3284
+ // this independent local state, exactly like a masked push is recovered by remote parity.
3285
+ const tagsAtHead = (gitOutput(['tag', '--points-at', 'HEAD'], cwd) || '').split('\n').map((t) => t.trim()).filter(Boolean).slice(0, 16);
3286
+ return { head, branch, remote, tagsAtHead, clean: dirty === null && gitOutput(['rev-parse', '--git-dir'], cwd) !== null };
3284
3287
  }
3285
3288
  function withGitAuthority(ledger, cwd) {
3286
3289
  const gitAuth = ledger && Object.keys(ledger).length ? gitAuthority(cwd) : null;
@@ -95,7 +95,7 @@ export function operationEvidenceStatus(goal, ledger = {}) {
95
95
  // `ledger.gitAuthority` is the gate-time local truth; without it (or on any mismatch) nothing is proven.
96
96
  const auth = ledger.gitAuthority;
97
97
  if (goal.domain === 'git-integrity' && validRemoteSync(op.remoteSync) && auth && auth.clean === true
98
- && requiredTargets.every((t) => t === 'commit' || t === 'push')
98
+ && requiredTargets.every((t) => t === 'commit' || t === 'push' || (t === 'tag' && Array.isArray(auth.tagsAtHead) && auth.tagsAtHead.length > 0))
99
99
  && attempts.every((r) => (Number.isSafeInteger(op.remoteSync.observedSequence) ? op.remoteSync.observedSequence : observation.sequence) > r.sequence)
100
100
  && op.remoteSync.sha === auth.head && op.remoteSync.ref === `refs/heads/${auth.branch}`
101
101
  && op.remoteSync.remote === auth.remote) return { complete: true, operationProof: 'remote-parity' };