@codyswann/lisa 4.96.2 → 4.97.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (175) hide show
  1. package/README.md +7 -0
  2. package/all/copy-overwrite/scripts/lisa-audit.mjs +59 -0
  3. package/all/copy-overwrite/scripts/lisa-gates.mjs +30 -13
  4. package/all/copy-overwrite/scripts/npm-updater-helper-graph.json +1 -1
  5. package/dist/cli/doctor-readiness-audit-allowlist.d.ts +19 -2
  6. package/dist/cli/doctor-readiness-audit-allowlist.d.ts.map +1 -1
  7. package/dist/cli/doctor-readiness-audit-allowlist.js +70 -17
  8. package/dist/cli/doctor-readiness-audit-allowlist.js.map +1 -1
  9. package/dist/cli/doctor-readiness-audit-scope.d.ts +24 -0
  10. package/dist/cli/doctor-readiness-audit-scope.d.ts.map +1 -0
  11. package/dist/cli/doctor-readiness-audit-scope.js +165 -0
  12. package/dist/cli/doctor-readiness-audit-scope.js.map +1 -0
  13. package/dist/cli/doctor-readiness-supply-chain-scan.js +1 -1
  14. package/dist/cli/doctor-readiness-supply-chain-scan.js.map +1 -1
  15. package/dist/cli/doctor-readiness-supply-chain.d.ts.map +1 -1
  16. package/dist/cli/doctor-readiness-supply-chain.js +4 -2
  17. package/dist/cli/doctor-readiness-supply-chain.js.map +1 -1
  18. package/dist/core/audit-capture.d.ts +31 -0
  19. package/dist/core/audit-capture.d.ts.map +1 -0
  20. package/dist/core/audit-capture.js +82 -0
  21. package/dist/core/audit-capture.js.map +1 -0
  22. package/dist/core/audit-exclusions.d.ts +32 -0
  23. package/dist/core/audit-exclusions.d.ts.map +1 -0
  24. package/dist/core/audit-exclusions.js +109 -0
  25. package/dist/core/audit-exclusions.js.map +1 -0
  26. package/dist/core/audit-field-names.d.ts +32 -0
  27. package/dist/core/audit-field-names.d.ts.map +1 -0
  28. package/dist/core/audit-field-names.js +107 -0
  29. package/dist/core/audit-field-names.js.map +1 -0
  30. package/dist/core/audit-lockfile.d.ts +9 -0
  31. package/dist/core/audit-lockfile.d.ts.map +1 -0
  32. package/dist/core/audit-lockfile.js +197 -0
  33. package/dist/core/audit-lockfile.js.map +1 -0
  34. package/dist/core/audit-manager.d.ts +8 -0
  35. package/dist/core/audit-manager.d.ts.map +1 -0
  36. package/dist/core/audit-manager.js +94 -0
  37. package/dist/core/audit-manager.js.map +1 -0
  38. package/dist/core/audit-matcher.d.ts +10 -0
  39. package/dist/core/audit-matcher.d.ts.map +1 -0
  40. package/dist/core/audit-matcher.js +103 -0
  41. package/dist/core/audit-matcher.js.map +1 -0
  42. package/dist/core/audit-report.d.ts +9 -0
  43. package/dist/core/audit-report.d.ts.map +1 -0
  44. package/dist/core/audit-report.js +132 -0
  45. package/dist/core/audit-report.js.map +1 -0
  46. package/dist/core/audit-types.d.ts +31 -0
  47. package/dist/core/audit-types.d.ts.map +1 -0
  48. package/dist/core/audit-types.js +2 -0
  49. package/dist/core/audit-types.js.map +1 -0
  50. package/dist/core/audit.d.ts +25 -0
  51. package/dist/core/audit.d.ts.map +1 -0
  52. package/dist/core/audit.js +53 -0
  53. package/dist/core/audit.js.map +1 -0
  54. package/dist/core/lisa-owned-hash-ledger.d.ts.map +1 -1
  55. package/dist/core/lisa-owned-hash-ledger.js +40 -0
  56. package/dist/core/lisa-owned-hash-ledger.js.map +1 -1
  57. package/dist/core/nightly-e2e-guard-behavior-certificate.js +2 -2
  58. package/dist/core/upstream-evidence-manifest.d.ts.map +1 -1
  59. package/dist/core/upstream-evidence-manifest.js +89 -14
  60. package/dist/core/upstream-evidence-manifest.js.map +1 -1
  61. package/package.json +11 -6
  62. package/plugins/lisa/.claude-plugin/plugin.json +1 -1
  63. package/plugins/lisa/.codex-plugin/plugin.json +1 -1
  64. package/plugins/lisa/.codex-plugin/skills/lisa-github-build-intake/SKILL.md +1 -1
  65. package/plugins/lisa/.codex-plugin/skills/lisa-implement/SKILL.md +12 -1
  66. package/plugins/lisa/.codex-plugin/skills/lisa-track/SKILL.md +25 -2
  67. package/plugins/lisa/rules/eager/security-audit-handling.md +2 -2
  68. package/plugins/lisa/rules/reference/rejection-detection.md +2 -2
  69. package/plugins/lisa/rules/reference/security-audit-handling.md +9 -0
  70. package/plugins/lisa/skills/lisa-github-build-intake/SKILL.md +1 -1
  71. package/plugins/lisa/skills/lisa-implement/SKILL.md +12 -1
  72. package/plugins/lisa/skills/lisa-track/SKILL.md +25 -2
  73. package/plugins/lisa-agy/plugin.json +1 -1
  74. package/plugins/lisa-agy/skills/lisa-github-build-intake/SKILL.md +1 -1
  75. package/plugins/lisa-agy/skills/lisa-implement/SKILL.md +12 -1
  76. package/plugins/lisa-agy/skills/lisa-track/SKILL.md +25 -2
  77. package/plugins/lisa-cdk/.claude-plugin/plugin.json +1 -1
  78. package/plugins/lisa-cdk/.codex-plugin/plugin.json +1 -1
  79. package/plugins/lisa-cdk-agy/plugin.json +1 -1
  80. package/plugins/lisa-cdk-copilot/.claude-plugin/plugin.json +1 -1
  81. package/plugins/lisa-cdk-cursor/.claude-plugin/plugin.json +1 -1
  82. package/plugins/lisa-cdk-devin/.claude-plugin/plugin.json +1 -1
  83. package/plugins/lisa-cdk-devin/.devin-plugin/plugin.json +1 -1
  84. package/plugins/lisa-copilot/.claude-plugin/plugin.json +1 -1
  85. package/plugins/lisa-copilot/rules/eager/security-audit-handling.md +2 -2
  86. package/plugins/lisa-copilot/rules/reference/rejection-detection.md +2 -2
  87. package/plugins/lisa-copilot/rules/reference/security-audit-handling.md +9 -0
  88. package/plugins/lisa-copilot/skills/lisa-github-build-intake/SKILL.md +1 -1
  89. package/plugins/lisa-copilot/skills/lisa-implement/SKILL.md +12 -1
  90. package/plugins/lisa-copilot/skills/lisa-track/SKILL.md +25 -2
  91. package/plugins/lisa-cursor/.claude-plugin/plugin.json +1 -1
  92. package/plugins/lisa-cursor/rules/rejection-detection-reference.mdc +2 -2
  93. package/plugins/lisa-cursor/rules/security-audit-handling-reference.mdc +9 -0
  94. package/plugins/lisa-cursor/rules/security-audit-handling.mdc +2 -2
  95. package/plugins/lisa-cursor/skills/lisa-github-build-intake/SKILL.md +1 -1
  96. package/plugins/lisa-cursor/skills/lisa-implement/SKILL.md +12 -1
  97. package/plugins/lisa-cursor/skills/lisa-track/SKILL.md +25 -2
  98. package/plugins/lisa-devin/.claude-plugin/plugin.json +1 -1
  99. package/plugins/lisa-devin/.devin-plugin/plugin.json +1 -1
  100. package/plugins/lisa-devin/rules/eager/security-audit-handling.md +2 -2
  101. package/plugins/lisa-devin/rules/reference/rejection-detection.md +2 -2
  102. package/plugins/lisa-devin/rules/reference/security-audit-handling.md +9 -0
  103. package/plugins/lisa-devin/skills/lisa-github-build-intake/SKILL.md +1 -1
  104. package/plugins/lisa-devin/skills/lisa-implement/SKILL.md +12 -1
  105. package/plugins/lisa-devin/skills/lisa-track/SKILL.md +25 -2
  106. package/plugins/lisa-expo/.claude-plugin/plugin.json +1 -1
  107. package/plugins/lisa-expo/.codex-plugin/plugin.json +1 -1
  108. package/plugins/lisa-expo-agy/plugin.json +1 -1
  109. package/plugins/lisa-expo-copilot/.claude-plugin/plugin.json +1 -1
  110. package/plugins/lisa-expo-cursor/.claude-plugin/plugin.json +1 -1
  111. package/plugins/lisa-expo-devin/.claude-plugin/plugin.json +1 -1
  112. package/plugins/lisa-expo-devin/.devin-plugin/plugin.json +1 -1
  113. package/plugins/lisa-harper-fabric/.claude-plugin/plugin.json +1 -1
  114. package/plugins/lisa-harper-fabric/.codex-plugin/plugin.json +1 -1
  115. package/plugins/lisa-harper-fabric-agy/plugin.json +1 -1
  116. package/plugins/lisa-harper-fabric-copilot/.claude-plugin/plugin.json +1 -1
  117. package/plugins/lisa-harper-fabric-cursor/.claude-plugin/plugin.json +1 -1
  118. package/plugins/lisa-harper-fabric-devin/.claude-plugin/plugin.json +1 -1
  119. package/plugins/lisa-harper-fabric-devin/.devin-plugin/plugin.json +1 -1
  120. package/plugins/lisa-nestjs/.claude-plugin/plugin.json +1 -1
  121. package/plugins/lisa-nestjs/.codex-plugin/plugin.json +1 -1
  122. package/plugins/lisa-nestjs-agy/plugin.json +1 -1
  123. package/plugins/lisa-nestjs-copilot/.claude-plugin/plugin.json +1 -1
  124. package/plugins/lisa-nestjs-cursor/.claude-plugin/plugin.json +1 -1
  125. package/plugins/lisa-nestjs-devin/.claude-plugin/plugin.json +1 -1
  126. package/plugins/lisa-nestjs-devin/.devin-plugin/plugin.json +1 -1
  127. package/plugins/lisa-openclaw/.claude-plugin/plugin.json +1 -1
  128. package/plugins/lisa-openclaw/.codex-plugin/plugin.json +1 -1
  129. package/plugins/lisa-openclaw-agy/plugin.json +1 -1
  130. package/plugins/lisa-openclaw-copilot/.claude-plugin/plugin.json +1 -1
  131. package/plugins/lisa-openclaw-cursor/.claude-plugin/plugin.json +1 -1
  132. package/plugins/lisa-openclaw-devin/.claude-plugin/plugin.json +1 -1
  133. package/plugins/lisa-openclaw-devin/.devin-plugin/plugin.json +1 -1
  134. package/plugins/lisa-phaser/.claude-plugin/plugin.json +1 -1
  135. package/plugins/lisa-phaser/.codex-plugin/plugin.json +1 -1
  136. package/plugins/lisa-phaser-agy/plugin.json +1 -1
  137. package/plugins/lisa-phaser-copilot/.claude-plugin/plugin.json +1 -1
  138. package/plugins/lisa-phaser-cursor/.claude-plugin/plugin.json +1 -1
  139. package/plugins/lisa-phaser-devin/.claude-plugin/plugin.json +1 -1
  140. package/plugins/lisa-phaser-devin/.devin-plugin/plugin.json +1 -1
  141. package/plugins/lisa-rails/.claude-plugin/plugin.json +1 -1
  142. package/plugins/lisa-rails/.codex-plugin/plugin.json +1 -1
  143. package/plugins/lisa-rails-agy/plugin.json +1 -1
  144. package/plugins/lisa-rails-copilot/.claude-plugin/plugin.json +1 -1
  145. package/plugins/lisa-rails-cursor/.claude-plugin/plugin.json +1 -1
  146. package/plugins/lisa-rails-devin/.claude-plugin/plugin.json +1 -1
  147. package/plugins/lisa-rails-devin/.devin-plugin/plugin.json +1 -1
  148. package/plugins/lisa-typescript/.claude-plugin/plugin.json +1 -1
  149. package/plugins/lisa-typescript/.codex-plugin/plugin.json +1 -1
  150. package/plugins/lisa-typescript-agy/plugin.json +1 -1
  151. package/plugins/lisa-typescript-copilot/.claude-plugin/plugin.json +1 -1
  152. package/plugins/lisa-typescript-cursor/.claude-plugin/plugin.json +1 -1
  153. package/plugins/lisa-typescript-devin/.claude-plugin/plugin.json +1 -1
  154. package/plugins/lisa-typescript-devin/.devin-plugin/plugin.json +1 -1
  155. package/plugins/lisa-wiki/.claude-plugin/plugin.json +1 -1
  156. package/plugins/lisa-wiki/.codex-plugin/plugin.json +1 -1
  157. package/plugins/lisa-wiki-agy/plugin.json +1 -1
  158. package/plugins/lisa-wiki-copilot/.claude-plugin/plugin.json +1 -1
  159. package/plugins/lisa-wiki-cursor/.claude-plugin/plugin.json +1 -1
  160. package/plugins/lisa-wiki-devin/.claude-plugin/plugin.json +1 -1
  161. package/plugins/lisa-wiki-devin/.devin-plugin/plugin.json +1 -1
  162. package/plugins/src/base/rules/eager/security-audit-handling.md +2 -2
  163. package/plugins/src/base/rules/reference/rejection-detection.md +2 -2
  164. package/plugins/src/base/rules/reference/security-audit-handling.md +9 -0
  165. package/plugins/src/base/skills/lisa-github-build-intake/SKILL.md +1 -1
  166. package/plugins/src/base/skills/lisa-implement/SKILL.md +12 -1
  167. package/plugins/src/base/skills/lisa-track/SKILL.md +25 -2
  168. package/scripts/lisa-audit.mjs +59 -0
  169. package/scripts/lisa-ci-failure-redispatch.mjs +30 -12
  170. package/scripts/lisa-ci-rework-route.mjs +380 -0
  171. package/scripts/two-channel-couplings.json +2 -2
  172. package/typescript/copy-contents/.husky/pre-push +5 -124
  173. package/typescript/copy-overwrite/.prettierignore +1 -0
  174. package/typescript/copy-overwrite/audit.ignore.config.json +6 -6
  175. package/typescript/package-lisa/package.lisa.json +4 -2
@@ -87,7 +87,7 @@ The input-resolver invokes `lisa-track $ARGUMENTS` (with `managedBy=` already st
87
87
  Require a successful readback of that worktree-local binding. On detached HEAD, `branch: null` is the expected pending binding; after branch creation the mandatory `attach-branch` step below must replace it before any commit. Tracker or binding failure stops the flow; never continue untracked.
88
88
  - **Persist the bundle verbatim to `.lisa/work-item-context.md`.** **Ignore guard before any write.** A host can receive these skills before its shipped `.gitignore` entry, so prove the path is ignored first, from the worktree root: `git check-ignore -q .lisa/work-item-context.md || printf '%s\n' '.lisa/work-item-context.md' >> "$(git rev-parse --git-common-dir)/info/exclude"`, then re-run `git check-ignore -q .lisa/work-item-context.md`. If it is still not ignored, stop and report — do not write the bundle. If an `.easignore` exists and `grep -qxF '.lisa/work-item-context.md' .easignore` fails, stop and report instead of writing: EAS uploads read `.easignore`, which is derived from `.gitignore`, not from `info/exclude`. There is one writer order. `lisa-track` has already written its live read, unedited, to `<worktree root>/.lisa/work-item-context.md`. With no `caller_bundle_path`, keep that file as written. With a `caller_bundle_path`, `lisa-track` leaves an existing file untouched, and this step persists the caller-supplied bundle instead of discarding it: refuse a `caller_bundle_path` that does not end in `/.lisa/work-item-context.md` — do not read it, report the refusal to the lead, and keep the live read as the file; otherwise read the file at that path and keep it as the base (copy it verbatim to the worktree's `.lisa/work-item-context.md` first if the path differs), then append under `## Added by live read` only what the live read carries that the caller bundle lacks (newer comments, changed status or graph). Either way the live validation and claim still run exactly as above. Never summarize, trim, or paraphrase the bundle; downstream agents act on this file, so anything left out of it is lost to them. The file is worktree-local and git-ignored; never stage it.
89
89
  - **Append the per-comment inventory to the file.** Finish the file with a trailing `## Comment inventory` section: one line per comment with author, date, one-line gist, and flags from `decision|constraint|credential|repro` for each decision, constraint, credential/access note, or reproduction step it carries. The inventory indexes the bundle above it; it never replaces it. **A `credential` gist names only the kind and the location** — for example `staging API token — see comment 4 in the context file` — never the secret value or identifier. The value stays only in the git-ignored context file: never copy it into task descriptions, teammate prompts, plan or roster files, tracker comments, or PR text.
90
- - Return `work_item_context: <absolute path of the file>`, the same per-comment inventory, `tracker_provider`, canonical `work_item_ref`, resolution outcome, claim outcome, and verified binding to the team lead, who then proceeds to roster selection.
90
+ - Return `work_item_context: <absolute path of the file>`, the same per-comment inventory, `tracker_provider`, canonical `work_item_ref`, resolution outcome, claim outcome, verified binding, and `lisa-track`'s `route` (with `failing_checks` and `head_ref`) to the team lead, who then proceeds to roster selection — or, for `route: ci-rework` or `route: blocked`, to the CI-rework route below.
91
91
 
92
92
  The input resolver may perform these tracker and local-binding operations before the Roster Decision because they are the mandatory gate that establishes what work the team is allowed to do. No project source, documentation, plan artifact, branch, or task may be created or changed before this transaction succeeds. Read-only discussion/orientation outside an Implement flow remains exempt per the `tracked-work` rule.
93
93
 
@@ -95,6 +95,17 @@ The input resolver is the only teammate that may be spawned before the Roster De
95
95
 
96
96
  **Rejection evidence in the claim handoff.** When this flow was dispatched from a build-intake claim that classified the item as a `rejection-reclaim` (per the `rejection-detection` rule), the context bundle carries a **rejection evidence summary** (what was rejected, the defect the QA comment named, the approach named as wrong). The plan MUST explicitly address that rejection evidence and MUST NOT re-propose the specific approach the rejection named as wrong — a bounced item must come back fixed, not re-bounced. `lisa-implement` cannot fetch this itself (it never sees the claim); it consumes what the handoff carries. Absence of rejection evidence never blocks — plan and implement normally.
97
97
 
98
+ **CI-rework route.** `lisa-track` decides the route from the item's comments before it writes anything, ignoring claim comments so a claim (including the session manager's earlier one) never hides the `[lisa-ci-failed]` marker, using the same shared helper (`scripts/lisa-ci-rework-route.mjs`) as build intake 3b. With `route: implement` nothing changes. With `route: ci-rework pr=<n>`, a required check failed on this item's existing pull request, so the work goes back to that pull request — never a new branch or a second pull request for the same item (CodySwannGT/lisa#4677). Skip the full build: no planning, research or implementation specialists, no claim-time archaeology or triage — the item was already triaged and built, and only its PR's checks are red. The lead runs this in-session instead:
99
+
100
+ 1. Put the PR's head branch (`head_ref`, or `gh pr view <n> --repo <org>/<repo> --json headRefName`) in a dedicated worktree bound to the item. If `git worktree list` already shows a worktree with `<headRefName>` checked out, reuse it (pull it up to `origin/<headRefName>` first). Otherwise run `git fetch origin <headRefName>`, then check for a local `<headRefName>` branch. If one exists and `git rev-list --count origin/<headRefName>..<headRefName>` is greater than zero, it holds a prior agent's unpushed commits: add the worktree on that local branch with `git worktree add <path> <headRefName>`, then merge `origin/<headRefName>` into it and push, so that work is published rather than discarded. Use `git worktree add -B <headRefName> <path> origin/<headRefName>` only when the local branch is absent or has nothing unpushed. Then run `node scripts/lisa-work-item.mjs link <canonical-ref>` from inside it and read it back through `node scripts/lisa-work-item.mjs current`. Run the ignore guard above there and copy the resolver's `.lisa/work-item-context.md` into that worktree unchanged. Only after that copy, and only when the resolver's worktree is a different worktree, clean the resolver's worktree up: run `node scripts/lisa-work-item.mjs clear` there and delete its `.lisa/work-item-context.md`, so no stale binding and no secret-bearing copy of the bundle are left behind.
101
+ 2. In the PR worktree's `.lisa/work-item-context.md`, append the marker comment's failing check names under `## CI failure`. Pass no rejection evidence, because nobody rejected the work.
102
+ 3. From that worktree, invoke `lisa-drive-pr-to-merge pr=<n>`, naming the failing checks: it fixes them on the existing branch and drives the pull request to merge. If that work needs specialist teammates, record the Roster Decision first as usual.
103
+ 4. Record no rejection learning: no `lisa-persist-learning` candidate and no `[lisa-rejection-candidate]` marker (the `rejection-detection` rule's CI-rework exemption). The item is not complete while the marker is uncleared: record no success outcome, done role or close until the pull request merges with every required check green. The producer's next all-green run clears the marker, and a merged or closed pull request's marker counts as cleared. On merge, finish as a build success does (tracker sync, evidence, lifecycle transition). If the pull request cannot be driven green, leave the item claimed and report why. Under `managedBy=`, the terminal `DONE:` / `FAILED:` line is sent exactly as for a build.
104
+
105
+ With `route: blocked pr=<n>`, the pull request has failed its required checks 3 or more times: `lisa-track` already moved the item from whichever lane it was in (ready or claimed) to the blocked role and the `human_needed` label, and wrote no binding, so stop and report that a person needs to look at the pull request (under `managedBy=`, an exit to the blocked role is `FAILED`).
106
+
107
+ The route is runtime-neutral text: every agent that runs this skill reads the same `route` field, and the helper is a plain Node script. The session manager dispatch path it exists for is Claude Code only (see the Runtime parity table in `lisa-session-manager`); agents without a background worker reach a CI-bounced item through build intake or a direct `/lisa-implement <ref>` invocation, which take this same route.
108
+
98
109
  ## Select the agent roster
99
110
 
100
111
  Before spawning any teammate beyond the bounded input resolver, record a **Roster Decision** artifact. It must enumerate every agent or specialist type exposed by the current runtime's delegation tool and record one line per type:
@@ -76,6 +76,26 @@ This is intentionally conservative: ambiguity creates one explicit work item ins
76
76
 
77
77
  ## Phase 3 — Claim and bind
78
78
 
79
+ ### CI-rework route (first, before any claim write)
80
+
81
+ Decide the dispatch route from the item's comments as they stand **before** this phase writes anything (CodySwannGT/lisa#4677). When the configured tracker is `github` **and** `scripts/lisa-ci-rework-route.mjs` exists at the repository root, run it from the repository root:
82
+
83
+ ```bash
84
+ node scripts/lisa-ci-rework-route.mjs --item <canonical-ref>
85
+ ```
86
+
87
+ It only reads, and prints one JSON object. It is the one place the trust rules live, shared with `lisa-github-build-intake` 3b so the two dispatch paths cannot disagree: the newest counted Lisa marker must be an uncleared `[lisa-ci-failed]` marker authored by `github-actions[bot]` — claim comments and session-manager notes (`[lisa-tracker-claim]`, `[claude-build-intake]`, `[lisa-session-manager]`) and failure markers from anyone other than `github-actions[bot]` do not count as Lisa markers for this purpose — and the pull request it names must be open, from this repository rather than a fork, and bound to this item by its `Work-Item:` line. Act on its `route`:
88
+
89
+ - When `route` is `implement` (any `reason`): resolve and claim the item the normal way below, and return `route: implement`.
90
+ - When `route` is `ci-rework`: return `route: ci-rework pr=<n>`, `failing_checks` and `head_ref` (the JSON's `pr`, `failingChecks` and `headRefName`). Continue through the hold check and the claim below unchanged: the claim is what moves the item from the ready lane back to the claimed lane, the same re-claim build intake 3b performs, and the binding names the same item. A ci-rework item is CI rework, not a rejection: it takes no rejection detection and records no rejection learning (the `rejection-detection` rule's CI-rework exemption).
91
+ - When `route` is `blocked` (`reason: ci-loop-bound`, 3 or more bot-authored `[lisa-ci-failed]` markers for the same PR): first run the hold check below; if the item is held, return its `held-by-gate` outcome and stop without changing labels or posting anything. Otherwise do not claim and write no binding — the same loop bound build intake 3b applies. Move the item to the configured blocked role from whichever lane it is in: remove the configured ready and claimed labels if present (`github.labels.build.ready`, `github.labels.build.claimed` — on the session-manager path the item is already claimed), then apply the configured blocked role and the `human_needed` label (`github.labels.build.blocked` and `github.labels.build.human_needed`, per `config-resolution`), post a plain-English comment naming the PR and its failing checks (for example: "Pull request #<n> has failed its required checks <k> times (<check names>). Lisa has stopped retrying; a person needs to look at why it keeps failing."), return `route: blocked pr=<n>`, `claim_outcome: blocked-ci-loop` and `binding_outcome: skipped-ci-loop`, then stop.
92
+
93
+ Skip this step silently and return `route: implement` when the tracker is Jira or Linear (only this repository's GitHub workflow writes the marker) or when the script is absent: `scripts/` at the Lisa repository root is not shipped to host projects, so a host never has the helper and never receives the marker. A non-zero exit or output that is not one JSON object is also `route: implement` — falling back to the normal path is always recoverable. A held item still stops at the hold check below, whatever its route.
94
+
95
+ **Why claim comments are ignored.** On the session-manager path the manager has already claimed the item before the worker starts, so the helper runs after a claim and the claim below comes back `reused`; a re-claim can also post another claim comment. Claim comments are ignored for exactly that reason: an uncleared marker on an open, bound pull request still means that pull request is red, whoever has claimed the item since.
96
+
97
+ ### Hold check and claim
98
+
79
99
  The work item is **held** when the caller declared a `human_gate`, independently of any item history,
80
100
  or `classifyReadyCandidate({ labels, body, comments, trustedHumanActorIds, humanNeededLabel, humanOnly })` from the shipped
81
101
  `scripts/intake-blocker-reprobe.mjs` returns `claimable: false`. Pass the complete live comment
@@ -114,8 +134,11 @@ Otherwise:
114
134
  readiness_declaration: build-ready|human-gate
115
135
  held_by: none|caller-declaration|item-marker
116
136
  gate_reason: <the act a person must perform>|null
117
- claim_outcome: claimed|reused|held-by-gate
118
- binding_outcome: verified|skipped-human-gate
137
+ claim_outcome: claimed|reused|held-by-gate|blocked-ci-loop
138
+ binding_outcome: verified|skipped-human-gate|skipped-ci-loop
139
+ route: implement|ci-rework pr=<n>|blocked pr=<n>
140
+ failing_checks: <comma-separated check names from the marker comment>|none
141
+ head_ref: <the pull request's head branch>|null
119
142
  work_item_context: <absolute path to .lisa/work-item-context.md>
120
143
  ```
121
144
 
@@ -0,0 +1,59 @@
1
+ #!/usr/bin/env node
2
+ // This file is managed by Lisa and IS replaced on each `lisa` run.
3
+ // Do not edit directly — durable changes belong upstream in Lisa.
4
+
5
+ /** Resolve the current Lisa package's canonical audit implementation. */
6
+ import { readFileSync } from "node:fs";
7
+ import { pathToFileURL } from "node:url";
8
+ import { resolve } from "node:path";
9
+
10
+ try {
11
+ const root = process.cwd();
12
+ const manifest = JSON.parse(
13
+ readFileSync(resolve(root, "package.json"), "utf8")
14
+ );
15
+ const source =
16
+ manifest.name === "@codyswann/lisa"
17
+ ? pathToFileURL(resolve(root, "dist/core/audit.js")).href
18
+ : "@codyswann/lisa/audit";
19
+ const { evaluateAuditReport, runDependencyAudit, detectAuditManager } =
20
+ await import(source);
21
+ const managerIndex = process.argv.indexOf("--manager");
22
+ const manager =
23
+ managerIndex < 0
24
+ ? detectAuditManager(root)
25
+ : process.argv[managerIndex + 1];
26
+ if (!["bun", "npm", "yarn"].includes(manager))
27
+ throw new Error("Unsupported audit package manager");
28
+ const verdict = process.argv.includes("--stdin")
29
+ ? evaluateAuditReport(root, manager, readFileSync(0, "utf8"))
30
+ : await runDependencyAudit(root, manager, {
31
+ attempts: process.env.LISA_AUDIT_ATTEMPTS,
32
+ retryDelay: process.env.LISA_AUDIT_RETRY_DELAY,
33
+ });
34
+ for (const message of verdict.messages) console.log(message);
35
+ console.log(
36
+ verdict.passed
37
+ ? "✅ No high or critical vulnerabilities found in production dependencies (excluding documented exceptions)"
38
+ : "❌ High or critical vulnerabilities found in production dependencies"
39
+ );
40
+ if (!verdict.passed)
41
+ console.log(
42
+ " Next step: upgrade or override the named copy; if it is dev-only and reviewed, add its lockfile path to `paths` in audit.ignore.local.json — see https://github.com/CodySwannGT/lisa/blob/main/docs/dependency-audit-exclusions.md"
43
+ );
44
+ process.exitCode = verdict.passed ? 0 : 1;
45
+ } catch (error) {
46
+ // Two different failures, worded so a gate runner can tell them apart. A
47
+ // capture that produced no usable report audited nothing: re-run it. Any
48
+ // other error is the project's own exclusion or lockfile input, which no
49
+ // re-run will fix, so it is reported as an invalid configuration.
50
+ console.error(
51
+ error?.name === "AuditCaptureError" ||
52
+ ["ERR_MODULE_NOT_FOUND", "ERR_PACKAGE_PATH_NOT_EXPORTED"].includes(
53
+ error?.code
54
+ )
55
+ ? `❌ Security audit failed closed: ${error.message}`
56
+ : `❌ Security audit configuration invalid: ${error.message}`
57
+ );
58
+ process.exitCode = 1;
59
+ }
@@ -51,11 +51,18 @@ import {
51
51
  } from "../all/copy-overwrite/scripts/lisa-work-item.mjs";
52
52
 
53
53
  const SHA = /^[0-9a-f]{40}$/u;
54
- const FAILURE_MARKER =
54
+ /**
55
+ * The failure marker; captures the PR number and head SHA. Exported with the
56
+ * other marker patterns and predicates below so the dispatch-side reader
57
+ * (`scripts/lisa-ci-rework-route.mjs`, CodySwannGT/lisa#4677) shares one
58
+ * definition with the producer instead of a copy that could drift.
59
+ */
60
+ export const FAILURE_MARKER =
55
61
  /<!-- \[lisa-ci-failed\] pr=(\d+) sha=([0-9a-f]{40}) -->/u;
56
- const CLEARED_MARKER = /<!-- \[lisa-ci-cleared\] run=\d+ -->/u;
62
+ /** The line a later all-green run appends to a failure marker's comment. */
63
+ export const CLEARED_MARKER = /<!-- \[lisa-ci-cleared\] run=\d+ -->/u;
57
64
  /** Any Lisa lifecycle marker — the claim, attempt, and CI markers alike. */
58
- const LISA_MARKER = /\[(?:lisa-[a-z0-9-]+|claude-build-intake)\]/u;
65
+ export const LISA_MARKER = /\[(?:lisa-[a-z0-9-]+|claude-build-intake)\]/u;
59
66
  const NO_REQUIRED = /no (?:required )?checks reported/iu;
60
67
  /** Read every page of a REST list as one array of pages. */
61
68
  const PAGINATE = Object.freeze(["--paginate", "--slurp"]);
@@ -284,22 +291,33 @@ function readItem(item, repo, gh) {
284
291
  "--json",
285
292
  "state,labels",
286
293
  ]);
294
+ return {
295
+ number,
296
+ open: view.state === "OPEN",
297
+ labels: view.labels.map(l => l.name),
298
+ comments: readItemComments(number, repo, gh),
299
+ };
300
+ }
301
+
302
+ /**
303
+ * Read every comment on an issue, oldest first. Throws naming the call when
304
+ * the read fails. Shared with `scripts/lisa-ci-rework-route.mjs`.
305
+ * @param {string} number - Issue number.
306
+ * @param {string} repo - Repository.
307
+ * @param {Function} gh - Runner.
308
+ * @returns {object[]} Comments sorted by `created_at`.
309
+ */
310
+ export function readItemComments(number, repo, gh) {
287
311
  const pages = readJson(gh, [
288
312
  "api",
289
313
  `repos/${repo}/issues/${number}/comments`,
290
314
  ...PAGINATE,
291
315
  ]);
292
- const comments = pages
316
+ return pages
293
317
  .flat()
294
318
  .toSorted((a, b) =>
295
319
  String(a.created_at).localeCompare(String(b.created_at))
296
320
  );
297
- return {
298
- number,
299
- open: view.state === "OPEN",
300
- labels: view.labels.map(l => l.name),
301
- comments,
302
- };
303
321
  }
304
322
 
305
323
  /**
@@ -364,7 +382,7 @@ function markerPr(comment) {
364
382
  * @param {object} comment - Item comment.
365
383
  * @returns {boolean} Whether its markers are trusted.
366
384
  */
367
- function trustedAuthor(comment) {
385
+ export function trustedAuthor(comment) {
368
386
  return MARKER_AUTHORS.includes(comment.user?.login ?? "");
369
387
  }
370
388
 
@@ -409,7 +427,7 @@ function readEvents(number, repo, gh) {
409
427
  * @param {object} comment - The marker comment.
410
428
  * @returns {boolean} Whether it is the newest.
411
429
  */
412
- function isNewestLisaMarker(comments, comment) {
430
+ export function isNewestLisaMarker(comments, comment) {
413
431
  // A forged failure marker counts for nothing, including as "something newer".
414
432
  const marked = comments.filter(
415
433
  c =>
@@ -0,0 +1,380 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * Decide whether a dispatched work item goes back to its existing PR.
4
+ *
5
+ * The gap (CodySwannGT/lisa#4677): when a required check fails on an agent's
6
+ * PR, `lisa-ci-failure-redispatch` posts a bot-authored
7
+ * `<!-- [lisa-ci-failed] pr=<n> sha=<head> -->` marker on the work item and
8
+ * moves it back to the ready lane. Build intake reads that marker and sends the
9
+ * agent back to the PR, but the session manager dispatches through
10
+ * `lisa-implement` → `lisa-track`, which never looked — so a bounced item was
11
+ * rebuilt from scratch and could open a second PR for the same work.
12
+ *
13
+ * This script is the one place the trust rules live, so both dispatch paths
14
+ * (`lisa-track` Phase 3 and `lisa-github-build-intake` 3b) reach the same
15
+ * answer. It reads the item's comments — which the caller must do BEFORE it
16
+ * posts its own claim comment, a newer Lisa marker that would hide the signal —
17
+ * and, when the newest counted marker is an uncleared failure marker, verifies
18
+ * the PR it names. The marker patterns, the trusted-author predicate, the
19
+ * newest-marker predicate and the comment reader are imported from the
20
+ * producer script so the two cannot drift.
21
+ *
22
+ * Read-only: it never writes to the tracker. Every failed read routes to the
23
+ * normal path, because building again is recoverable and a wrong route is not.
24
+ *
25
+ * Repo-only: like its producer, it lives in this repository's `scripts/` and
26
+ * is NOT shipped to host projects; `lisa-track` runs it only when it exists.
27
+ * @module scripts/lisa-ci-rework-route
28
+ */
29
+ import { readFileSync } from "node:fs";
30
+ import process from "node:process";
31
+
32
+ import { invokedAsScript } from "../all/copy-overwrite/scripts/lib/invoked-as-script.mjs";
33
+ import {
34
+ soleWorkItem,
35
+ trackerContract,
36
+ workItemLines,
37
+ } from "../all/copy-overwrite/scripts/lisa-work-item.mjs";
38
+ import {
39
+ CLEARED_MARKER,
40
+ FAILURE_MARKER,
41
+ MARKER_AUTHORS,
42
+ LISA_MARKER,
43
+ isNewestLisaMarker,
44
+ liveGh,
45
+ readItemComments,
46
+ recordedGh,
47
+ trustedAuthor,
48
+ } from "./lisa-ci-failure-redispatch.mjs";
49
+
50
+ /**
51
+ * Bot-authored failure markers for one PR at which dispatch stops retrying and
52
+ * blocks for a person. Mirrors build intake 3b's "3 or more" loop bound: every
53
+ * bounce gives the item a fresh ready-lane entry, so without a bound a PR that
54
+ * keeps failing would be re-dispatched forever.
55
+ */
56
+ export const CI_LOOP_BOUND = 3;
57
+
58
+ /**
59
+ * The one decision the CLI prints. `ci-rework` carries the PR to drive;
60
+ * `blocked` is the loop bound; `implement` carries why the marker was ignored.
61
+ * @typedef {object} RouteDecision
62
+ * @property {"ci-rework"|"blocked"|"implement"} route - Where the work goes.
63
+ * @property {string} [reason] - Reason code for `implement` and `blocked`.
64
+ * @property {string} [detail] - Plain-language reason.
65
+ * @property {string} [item] - Canonical work item.
66
+ * @property {number} [pr] - The marker's pull request.
67
+ * @property {string} [sha] - The head the failure was observed on.
68
+ * @property {string} [headRefName] - The pull request's head branch.
69
+ * @property {string[]} [failingChecks] - Failing check names from the marker comment.
70
+ * @property {number} [markerCount] - Bot-authored failure markers for this PR.
71
+ */
72
+
73
+ /** The first line the producer writes on a failure comment. */
74
+ const FAILURE_LINE =
75
+ /^A required check failed on pull request #\d+ at commit [0-9a-f]{40}: (.+)\.$/mu;
76
+ const ITEM_NUMBER = /^[1-9]\d*$/u;
77
+ const ITEM_REF = /^([A-Za-z0-9_.-]+\/[A-Za-z0-9_.-]+)#([1-9]\d*)$/u;
78
+ const REPO = /^[A-Za-z0-9_.-]+\/[A-Za-z0-9_.-]+$/u;
79
+ /**
80
+ * Dispatch-bookkeeping markers: the lifecycle claim, build intake's legacy
81
+ * claim, and the session manager's own notes (stop, release, worker failed,
82
+ * answer delivered). None of them says anything about the PR's checks.
83
+ */
84
+ const CLAIM_MARKERS =
85
+ /\[(?:lisa-tracker-claim|claude-build-intake|lisa-session-manager)\]/gu;
86
+
87
+ /**
88
+ * A decision to resolve and implement the item the normal way.
89
+ * @param {string} reason - Short reason code.
90
+ * @param {string} detail - Plain-language reason.
91
+ * @returns {RouteDecision} Decision.
92
+ */
93
+ function implement(reason, detail) {
94
+ return { route: "implement", reason, detail };
95
+ }
96
+
97
+ /**
98
+ * The failing check names on a failure comment's first line.
99
+ * @param {string} body - Comment body.
100
+ * @returns {string[]} Check names; empty when the line is not the producer's.
101
+ */
102
+ export function failingChecksFrom(body) {
103
+ const match = FAILURE_LINE.exec(String(body ?? ""));
104
+ return match === null ? [] : match[1].split(", ");
105
+ }
106
+
107
+ /**
108
+ * True when the comment carries a failure marker, whoever wrote it.
109
+ * @param {object} comment - Item comment.
110
+ * @returns {boolean} Whether it carries one.
111
+ */
112
+ function carriesFailure(comment) {
113
+ return FAILURE_MARKER.test(comment.body ?? "");
114
+ }
115
+
116
+ /**
117
+ * True when every Lisa marker the comment carries is a claim marker.
118
+ * @param {object} comment - Item comment.
119
+ * @returns {boolean} Whether it is a claim-only comment.
120
+ */
121
+ function claimOnly(comment) {
122
+ const body = String(comment.body ?? "");
123
+ return (
124
+ LISA_MARKER.test(body) &&
125
+ !LISA_MARKER.test(body.replaceAll(CLAIM_MARKERS, ""))
126
+ );
127
+ }
128
+
129
+ /**
130
+ * The producer's newest-marker test with claim comments left out. The
131
+ * session manager claims an item before its worker runs this helper, and a
132
+ * re-claim can post another claim comment, so a claim posted after the
133
+ * failure marker must not hide it: an uncleared marker on an open, bound PR
134
+ * still means the PR is red, whoever claimed the item since. Forged failure
135
+ * markers are already left out by the producer's predicate.
136
+ * @param {object[]} comments - Item comments, oldest first.
137
+ * @param {object} marker - The failure marker comment.
138
+ * @returns {boolean} Whether it is the newest counted marker.
139
+ */
140
+ function isNewestCountedMarker(comments, marker) {
141
+ return isNewestLisaMarker(
142
+ comments.filter(c => c === marker || !claimOnly(c)),
143
+ marker
144
+ );
145
+ }
146
+
147
+ /**
148
+ * Pick the failure marker that could count, or say why none does.
149
+ * @param {object[]} comments - Item comments, oldest first.
150
+ * @returns {{marker?: object, decision?: object}} The marker or a decision.
151
+ */
152
+ function judgeMarker(comments) {
153
+ const marker = comments
154
+ .filter(c => carriesFailure(c) && trustedAuthor(c))
155
+ .at(-1);
156
+ if (marker === undefined) {
157
+ const forged = comments.findLast(carriesFailure);
158
+ if (forged === undefined)
159
+ return {
160
+ decision: implement(
161
+ "no-marker",
162
+ "the item carries no [lisa-ci-failed] marker"
163
+ ),
164
+ };
165
+ return {
166
+ decision: implement(
167
+ "untrusted-author",
168
+ `the [lisa-ci-failed] marker was posted by ${forged.user?.login ?? "an unknown author"}, not ${MARKER_AUTHORS.join(" or ")}; ignored`
169
+ ),
170
+ };
171
+ }
172
+ if (!isNewestCountedMarker(comments, marker))
173
+ return {
174
+ decision: implement(
175
+ "not-newest",
176
+ "a newer Lisa marker (not a claim) was posted after the [lisa-ci-failed] marker, so it no longer describes the item"
177
+ ),
178
+ };
179
+ if (CLEARED_MARKER.test(marker.body))
180
+ return {
181
+ decision: implement(
182
+ "cleared",
183
+ "the [lisa-ci-failed] marker is cleared: a later run passed every required check"
184
+ ),
185
+ };
186
+ return { marker };
187
+ }
188
+
189
+ /**
190
+ * Check the named PR is open, same-repository and bound to this item.
191
+ * @param {object} view - `gh pr view` JSON.
192
+ * @param {string} item - Canonical `owner/repo#n`.
193
+ * @param {object} contract - Tracker contract scoped to the item's repository.
194
+ * @returns {RouteDecision|null} An implement decision, or null when the PR checks out.
195
+ */
196
+ function judgePull(view, item, contract) {
197
+ if (view.state !== "OPEN")
198
+ return implement(
199
+ "pull-request-not-open",
200
+ `the marker's pull request is ${view.state}`
201
+ );
202
+ if (view.isCrossRepository)
203
+ return implement(
204
+ "fork-pull-request",
205
+ "the marker's pull request comes from a fork"
206
+ );
207
+ let bound;
208
+ try {
209
+ bound = soleWorkItem(view.body ?? "", contract, "pull-request body");
210
+ } catch (error) {
211
+ // Exactly one declared value that still fails names something else (an
212
+ // item in another repository); zero or several declarations bind nothing.
213
+ const declared = new Set(workItemLines(view.body ?? ""));
214
+ const reason =
215
+ declared.size === 1 ? "other-work-item" : "unbound-pull-request";
216
+ return implement(reason, String(error.message));
217
+ }
218
+ if (bound.toLowerCase() !== item.toLowerCase())
219
+ return implement(
220
+ "other-work-item",
221
+ `the marker's pull request is bound to ${bound}, not ${item}`
222
+ );
223
+ return null;
224
+ }
225
+
226
+ /**
227
+ * Read one gh JSON answer, or throw naming the call.
228
+ * @param {Function} gh - Runner.
229
+ * @param {string[]} args - Arguments.
230
+ * @returns {any} Parsed stdout.
231
+ */
232
+ function readJson(gh, args) {
233
+ const result = gh(args);
234
+ if (!result.ok)
235
+ throw new Error(`gh ${args.join(" ")} failed: ${result.stderr}`);
236
+ return JSON.parse(result.stdout);
237
+ }
238
+
239
+ /**
240
+ * Route a counted marker: verify its PR, then apply the loop bound.
241
+ * @param {{marker: object, comments: object[], item: string, repository: string, contract: object, gh: Function}} ctx - Context.
242
+ * @returns {RouteDecision} Decision.
243
+ */
244
+ function routeMarker({ marker, comments, item, repository, contract, gh }) {
245
+ const [, prText, sha] = FAILURE_MARKER.exec(marker.body);
246
+ const pr = Number(prText);
247
+ const view = readJson(gh, [
248
+ "pr",
249
+ "view",
250
+ prText,
251
+ "--repo",
252
+ repository,
253
+ "--json",
254
+ "state,isCrossRepository,body,headRefName",
255
+ ]);
256
+ const refused = judgePull(view, item, { ...contract, repository });
257
+ if (refused) return refused;
258
+ const markerCount = comments.filter(
259
+ c =>
260
+ trustedAuthor(c) && Number(FAILURE_MARKER.exec(c.body ?? "")?.[1]) === pr
261
+ ).length;
262
+ const failingChecks = failingChecksFrom(marker.body);
263
+ if (markerCount >= CI_LOOP_BOUND)
264
+ return {
265
+ route: "blocked",
266
+ reason: "ci-loop-bound",
267
+ detail: `pull request #${pr} has failed its required checks ${markerCount} times; stop retrying and ask a person`,
268
+ item,
269
+ pr,
270
+ sha,
271
+ failingChecks,
272
+ markerCount,
273
+ };
274
+ return {
275
+ route: "ci-rework",
276
+ item,
277
+ pr,
278
+ sha,
279
+ headRefName: view.headRefName,
280
+ failingChecks,
281
+ markerCount,
282
+ };
283
+ }
284
+
285
+ /**
286
+ * Decide the dispatch route for one GitHub work item. Reads only.
287
+ * @param {{item: string, contract: object, gh: Function, repository?: string}} input - Item number, contract, runner.
288
+ * @returns {RouteDecision} `ci-rework`, `blocked`, or `implement` decision.
289
+ */
290
+ export function decideRoute({ item, contract, gh, repository }) {
291
+ if (contract?.provider !== "github")
292
+ return implement(
293
+ "tracker-not-github",
294
+ "only the GitHub tracker carries [lisa-ci-failed] markers"
295
+ );
296
+ const repo = repository ?? contract.repository;
297
+ const ref = `${repo}#${item}`;
298
+ try {
299
+ const comments = readItemComments(String(item), repo, gh);
300
+ const { marker, decision } = judgeMarker(comments);
301
+ if (decision) return decision;
302
+ return routeMarker({
303
+ marker,
304
+ comments,
305
+ item: ref,
306
+ repository: repo,
307
+ contract,
308
+ gh,
309
+ });
310
+ } catch (error) {
311
+ return implement(
312
+ "read-failed",
313
+ `could not read the item or its pull request: ${error.message}`
314
+ );
315
+ }
316
+ }
317
+
318
+ /**
319
+ * Decide the route from a recorded fixture: the gh answers it recorded.
320
+ * @param {{gh: object}} fixture - Recorded fixture.
321
+ * @param {string} item - Item number.
322
+ * @param {object} contract - Tracker contract.
323
+ * @returns {RouteDecision} Decision.
324
+ */
325
+ export function routeFromFixture(fixture, item, contract) {
326
+ return decideRoute({ item, contract, gh: recordedGh(fixture.gh) });
327
+ }
328
+
329
+ /**
330
+ * Parse CLI flags.
331
+ * @param {string[]} argv - Arguments.
332
+ * @returns {{item: string, repository?: string, payload?: string}} Options.
333
+ */
334
+ function parseArgs(argv) {
335
+ const flags = {};
336
+ for (let i = 0; i < argv.length; i += 2) {
337
+ const [flag, value] = [argv[i], argv[i + 1]];
338
+ if (!["--item", "--repo", "--payload"].includes(flag))
339
+ throw new Error(`unknown argument: ${flag}`);
340
+ if (value === undefined) throw new Error(`${flag} needs a value`);
341
+ flags[flag.slice(2)] = value;
342
+ }
343
+ const ref = ITEM_REF.exec(flags.item ?? "");
344
+ if (ref === null && !ITEM_NUMBER.test(flags.item ?? ""))
345
+ throw new Error("pass --item <n> or --item <owner>/<repo>#<n>");
346
+ if (flags.repo !== undefined && !REPO.test(flags.repo))
347
+ throw new Error(`--repo must be <owner>/<repo>, got '${flags.repo}'`);
348
+ if (ref && flags.repo && ref[1].toLowerCase() !== flags.repo.toLowerCase())
349
+ throw new Error(`--item ${flags.item} is not in --repo ${flags.repo}`);
350
+ return {
351
+ item: ref ? ref[2] : flags.item,
352
+ repository: flags.repo ?? ref?.[1],
353
+ payload: flags.payload,
354
+ };
355
+ }
356
+
357
+ /**
358
+ * CLI entry: print one JSON decision line.
359
+ * @param {string[]} argv - Arguments.
360
+ * @param {{gh?: Function, write?: Function, contract?: object}} [deps] - Injectables.
361
+ * @returns {number} Exit code: 0 decided (any route), 2 bad usage or configuration.
362
+ */
363
+ export function main(argv, deps = {}) {
364
+ const write = deps.write ?? (line => process.stdout.write(`${line}\n`));
365
+ try {
366
+ const options = parseArgs(argv);
367
+ const contract = deps.contract ?? trackerContract();
368
+ const gh = options.payload
369
+ ? recordedGh(JSON.parse(readFileSync(options.payload, "utf8")).gh)
370
+ : (deps.gh ?? liveGh);
371
+ write(JSON.stringify(decideRoute({ ...options, contract, gh })));
372
+ return 0;
373
+ } catch (error) {
374
+ write(`lisa-ci-rework-route: ${error.message}`);
375
+ return 2;
376
+ }
377
+ }
378
+
379
+ if (invokedAsScript(import.meta.url))
380
+ process.exitCode = main(process.argv.slice(2));
@@ -120,9 +120,9 @@
120
120
  },
121
121
  "inspected": {
122
122
  "workflows": 26,
123
- "steps": 834,
123
+ "steps": 835,
124
124
  "couplings": 40,
125
- "inventory": 212
125
+ "inventory": 213
126
126
  },
127
127
  "counts": {
128
128
  "package-backed": 11,