@yemi33/minions 0.1.2352 → 0.1.2353
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.
|
@@ -0,0 +1,675 @@
|
|
|
1
|
+
# `engine/shared.js` / `engine/lifecycle.js` module-boundary audit
|
|
2
|
+
|
|
3
|
+
**Status:** documentation only — no function bodies were moved or edited as part of this audit.
|
|
4
|
+
|
|
5
|
+
**Scope:** `engine/shared.js` (9,877 lines, 338 top-level functions) and `engine/lifecycle.js`
|
|
6
|
+
(6,988 lines, 121 top-level functions) as of this audit's HEAD commit. The PRD item that requested
|
|
7
|
+
this doc quoted slightly smaller line/function counts (9,334 / 335); both files have grown since the
|
|
8
|
+
PRD was written, so the numbers below are the current, re-measured counts.
|
|
9
|
+
|
|
10
|
+
## Methodology
|
|
11
|
+
|
|
12
|
+
1. Extracted every top-level `function name(...)`, `const name = (...) => {…}`, and
|
|
13
|
+
`const name = function(...) {…}` declaration from both files via a small regex-based scanner
|
|
14
|
+
(line number = declaration line; end line = the line before the next top-level declaration, or
|
|
15
|
+
the `module.exports = {` line for the last function in the file).
|
|
16
|
+
2. Captured each function's immediately-preceding contiguous comment block (JSDoc or `//` lines,
|
|
17
|
+
one blank-line gap tolerated) as the "purpose" source. Where no usable comment existed, the
|
|
18
|
+
function name was rendered as a sentence (e.g. `resolveDashboardPort` → "Resolve dashboard
|
|
19
|
+
port.") as a documentation placeholder — these are flagged in the tables below as auto-inferred
|
|
20
|
+
and should be treated as lower-confidence than a real header comment.
|
|
21
|
+
3. Determined **exported** status by checking whether the function's identifier appears in the
|
|
22
|
+
file's `module.exports = { … }` block (by text search from the `module.exports` line to EOF).
|
|
23
|
+
4. Found **callers** by scanning every `.js` file under `engine/`, `test/`, `dashboard/`, `bin/`,
|
|
24
|
+
`tools/`, `watches.d/`, and the repo root that itself `require('./shared')` or
|
|
25
|
+
`require('./lifecycle')` (directly or via a relative path ending in `/shared` / `/lifecycle`),
|
|
26
|
+
then testing each candidate file's source for a whole-word match of the function name. This is a
|
|
27
|
+
**text-based** heuristic, not an AST/call-graph analysis — it will over-report for very generic
|
|
28
|
+
names shared with unrelated local variables, and it cannot distinguish "actually invoked" from
|
|
29
|
+
"identifier appears in a comment/string." It reliably answers the question this audit needs
|
|
30
|
+
("does anything outside shared.js/lifecycle.js reference this name"), which is what matters for
|
|
31
|
+
a migration plan.
|
|
32
|
+
5. Cross-referenced exported vs. caller-found status: **every exported function in both files has
|
|
33
|
+
at least one external caller** in this scan (no dead exports found). Functions with zero
|
|
34
|
+
external callers are, without exception, also unexported — i.e. genuinely private, file-local
|
|
35
|
+
helpers.
|
|
36
|
+
6. Proposed a **target module** per function using name-based heuristics (matched against the
|
|
37
|
+
task's suggested example modules — `engine/process-utils.js`, `engine/worktree-utils.js`,
|
|
38
|
+
`engine/pr-record-store.js`, `engine/lifecycle-skills.js`, `engine/lifecycle-post-merge.js` — plus
|
|
39
|
+
a few clusters that map onto already-existing focused modules). Functions that don't match a
|
|
40
|
+
clear cluster default to "keep in place." These proposals are a **starting map for a future
|
|
41
|
+
decomposition PR**, not a final decision — see "Open questions" below for cases that need a
|
|
42
|
+
human call before any code moves.
|
|
43
|
+
|
|
44
|
+
## Headline numbers
|
|
45
|
+
|
|
46
|
+
| | `engine/shared.js` | `engine/lifecycle.js` |
|
|
47
|
+
|---|---|---|
|
|
48
|
+
| Top-level functions | 338 | 121 |
|
|
49
|
+
| Exported | 276 | 68 |
|
|
50
|
+
| Private/internal-only (unexported, 0 external callers) | 59 | 47 |
|
|
51
|
+
| Exported but 0 external callers found in this scan | 21 | 24 |
|
|
52
|
+
| File lines | 9,877 | 6,988 |
|
|
53
|
+
|
|
54
|
+
The 21 + 24 "exported but no caller found" functions are not proven dead — they may be invoked via
|
|
55
|
+
a call path this text scan can't see (e.g. dynamic property access, a caller file outside the
|
|
56
|
+
scanned directory set, or genuinely forward-looking exports). They're listed explicitly in
|
|
57
|
+
"Open questions" below as candidates for a follow-up dead-export check before any file is deleted
|
|
58
|
+
or trimmed.
|
|
59
|
+
|
|
60
|
+
## Circular-dependency risk findings
|
|
61
|
+
|
|
62
|
+
- **No load-time cycle exists today.** `engine/shared.js` only `require()`s Node built-ins
|
|
63
|
+
(`fs`, `path`, `os`, `crypto`, `child_process`, `util`) at its top level — it has zero static
|
|
64
|
+
dependency on `engine/lifecycle.js` or any other `engine/*.js` module (`engine/shared.js:6-9`,
|
|
65
|
+
`:2299-2300`). `engine/lifecycle.js` requires `./shared` at the top (`engine/lifecycle.js:9`)
|
|
66
|
+
plus several other engine modules (`./runtimes`, `./ado-git-auth`, `./queries`, `./harness`,
|
|
67
|
+
`./cooldown`, `./cleanup`, `./comment-format`) — none of which require `./lifecycle` back at load
|
|
68
|
+
time, so the current graph is acyclic.
|
|
69
|
+
- **Lazy in-function `require()`s create a soft/deferred cycle worth flagging for the migration
|
|
70
|
+
plan.** `engine/shared.js` has several functions that lazily `require('./queries')` inside their
|
|
71
|
+
bodies (e.g. around `engine/shared.js:8611`, `:8625` — cache-invalidation calls after work-item
|
|
72
|
+
writes). `engine/queries.js` in turn does `require('./shared')` at its own top level
|
|
73
|
+
(`engine/queries.js:11`) and lazily `require('./lifecycle')` inside a function
|
|
74
|
+
(`engine/queries.js:34`). So the logical dependency chain is
|
|
75
|
+
`shared.js → queries.js → shared.js` and `shared.js → queries.js → lifecycle.js → shared.js`.
|
|
76
|
+
Node's lazy `require()` inside a function body avoids a load-time crash (the module is already
|
|
77
|
+
cached by the time these functions run), but it means **any function moved out of shared.js into
|
|
78
|
+
a new module must preserve this lazy-require pattern** — a naive top-level `require('./queries')`
|
|
79
|
+
in the new module would very likely reintroduce a real load-time cycle depending on module
|
|
80
|
+
load order.
|
|
81
|
+
- **`engine/lifecycle.js:6194`** lazily does `require('../engine')` (the top-level orchestrator)
|
|
82
|
+
inside a function body. `engine.js` requires `./lifecycle` (per `CLAUDE.md`'s architecture
|
|
83
|
+
section), so this is a genuine `lifecycle.js → engine.js → lifecycle.js` cycle, again only safe
|
|
84
|
+
because the require is deferred until after both modules have finished their initial load. Any
|
|
85
|
+
future split of `lifecycle.js` needs to keep this call inside whichever new module inherits it,
|
|
86
|
+
and keep it lazy.
|
|
87
|
+
- Several other `engine/lifecycle.js` functions lazily require host-specific PR modules
|
|
88
|
+
(`./github`, `./ado`, `./gh-comment`, `./gh-token`, `./pull-requests-store`, `./meeting`,
|
|
89
|
+
`./qa-runs`, `./qa-sessions`, `./routing`, `./playbook`, `./dispatch`) — none of these appear to
|
|
90
|
+
require `./lifecycle` back, so they're one-directional and lower risk, but should still be
|
|
91
|
+
grep-verified again immediately before any actual code move (this audit is a snapshot, and other
|
|
92
|
+
agents are actively editing these files in parallel — see "Active Agents" in this session's
|
|
93
|
+
context).
|
|
94
|
+
|
|
95
|
+
## Near-duplicate / easily-confused function names
|
|
96
|
+
|
|
97
|
+
No **exact** duplicate function name exists within `shared.js`, within `lifecycle.js`, or across
|
|
98
|
+
both files (338 + 121 = 459 distinct identifiers). Normalizing away common verb prefixes
|
|
99
|
+
(`get/is/resolve/read/write/build/compute/find/check/has/ensure/normalize/parse/extract/load/save`)
|
|
100
|
+
surfaces these **read/write or parse/normalize pairs** that share a root concept — flagged here
|
|
101
|
+
because a future reader skimming the module map could reasonably confuse which one to call, not
|
|
102
|
+
because either is a bug:
|
|
103
|
+
|
|
104
|
+
| Shared root concept | Functions | File |
|
|
105
|
+
|---|---|---|
|
|
106
|
+
| minions root pointer | `readMinionsRootPointer`, `saveMinionsRootPointer` | shared.js |
|
|
107
|
+
| dashboard port file | `readDashboardPortFile`, `writeDashboardPortFile` | shared.js |
|
|
108
|
+
| agent Copilot home dir | `resolveAgentCopilotHome`, `ensureAgentCopilotHome` | shared.js |
|
|
109
|
+
| canonical PR id | `parseCanonicalPrId`, `getCanonicalPrId` | shared.js |
|
|
110
|
+
| PR record | `findPrRecord`, `normalizePrRecord` | shared.js |
|
|
111
|
+
| worktree owner marker | `writeWorktreeOwnerMarker`, `hasWorktreeOwnerMarker` | shared.js |
|
|
112
|
+
| review verdict | `parseReviewVerdict`, `normalizeReviewVerdict` | lifecycle.js |
|
|
113
|
+
|
|
114
|
+
None of these look like accidental duplication of logic (each pair does a distinct
|
|
115
|
+
read-vs-write or parse-vs-normalize job); they're flagged purely as **naming-collision risk** to
|
|
116
|
+
call out explicitly if/when either function in a pair is renamed or moved to a different target
|
|
117
|
+
module than its sibling, so the pair doesn't end up split across two modules without a clear
|
|
118
|
+
cross-reference comment.
|
|
119
|
+
|
|
120
|
+
## Proposed target-module clusters (summary)
|
|
121
|
+
|
|
122
|
+
The per-function tables below assign one of these targets to every function; this section is the
|
|
123
|
+
high-level rollup so a reviewer doesn't have to scan 459 rows to see the shape of the split:
|
|
124
|
+
|
|
125
|
+
- **`engine/process-utils.js` (new)** — spawn/exec/kill/pid/dispatch-tmp-dir lifecycle helpers
|
|
126
|
+
currently in `shared.js` (e.g. `dispatchPidCandidates`, `findDispatchPidFile`, `forEachPidFile`,
|
|
127
|
+
`createDispatchTmpDir`, `removeDispatchTmpDir`, `validateDispatchTmpDir`).
|
|
128
|
+
- **`engine/worktree-utils.js` (new)** — low-level worktree path/branch/owner-marker helpers in
|
|
129
|
+
`shared.js` that `engine/worktree-pool.js` and `engine/worktree-gc.js` currently import rather
|
|
130
|
+
than own (those two modules already exist and own *pool sizing* and *GC sweep* respectively —
|
|
131
|
+
this new module would take the shared primitives both of them currently reach into `shared.js`
|
|
132
|
+
for, e.g. `writeWorktreeOwnerMarker`, `hasWorktreeOwnerMarker`).
|
|
133
|
+
- **`engine/pr-record-store.js` (new)** — pure PR-record-shape helpers in `shared.js`
|
|
134
|
+
(`findPrRecord`, `normalizePrRecord`, `parseCanonicalPrId`, `getCanonicalPrId`,
|
|
135
|
+
`normalizePrLinkItems`, `mergePrLinkItems`, `collapseDuplicatePrRecords`, etc.). **Naming
|
|
136
|
+
collision risk to resolve before this move:** `engine/pull-requests-store.js` already exists as
|
|
137
|
+
the SQL-backed CRUD store for PR rows (per `CLAUDE.md`'s canonical-stores list). A module named
|
|
138
|
+
`pr-record-store.js` sitting next to `pull-requests-store.js` is a near-duplicate name pair by
|
|
139
|
+
construction — recommend either folding these helpers directly into
|
|
140
|
+
`engine/pull-requests-store.js` instead of creating a sibling module, or picking a visibly
|
|
141
|
+
distinct name (e.g. `engine/pr-record-shape.js`) if the PRD's own example name is kept.
|
|
142
|
+
- **`engine/lifecycle-skills.js` (new)** — skill-extraction/validation functions in `lifecycle.js`
|
|
143
|
+
(functions with `skill` in the name — see the lifecycle table's `target` column for the full
|
|
144
|
+
list).
|
|
145
|
+
- **`engine/lifecycle-post-merge.js` (new)** — post-merge / merged-PR cleanup flow functions in
|
|
146
|
+
`lifecycle.js`.
|
|
147
|
+
- Everything else defaults to **"keep in place"** — either because it's a small, self-contained
|
|
148
|
+
primitive (logging, timestamps, file I/O, dashboard-port beacon, Node/sqlite version gate) with
|
|
149
|
+
no obvious cluster partner, or because it already has a clear home in an existing module
|
|
150
|
+
(`engine/cooldown.js`, `engine/operator-identity.js`, `engine/runtimes/`).
|
|
151
|
+
|
|
152
|
+
## Open questions / needs a human decision before any code moves
|
|
153
|
+
|
|
154
|
+
1. **21 shared.js + 24 lifecycle.js exported functions had zero external callers found** by this
|
|
155
|
+
text scan (full names listed in the per-function tables' "Callers" column as
|
|
156
|
+
`_internal-only (no callers found outside …)_` despite `Exported = yes`). Before deleting or
|
|
157
|
+
demoting any of these, re-verify with a real call-graph tool or a broader grep (this audit's
|
|
158
|
+
scan covered `engine/`, `test/`, `dashboard/`, `bin/`, `tools/`, `watches.d/`, and repo-root
|
|
159
|
+
`.js` files, but not `dashboard/**/*.html` inline `<script>` blocks, external skill/playbook
|
|
160
|
+
markdown that might reference a function name in a code sample, or npm-published consumer code
|
|
161
|
+
outside this repo).
|
|
162
|
+
2. **The `pr-record-store.js` vs. `pull-requests-store.js` naming collision** (see above) needs a
|
|
163
|
+
naming decision before a PR is opened for that slice of the split.
|
|
164
|
+
3. **The lazy-require patterns documented in "Circular-dependency risk findings"** must be
|
|
165
|
+
preserved verbatim (same lazy, in-function `require()` placement) in whatever new module
|
|
166
|
+
inherits each affected function — a mechanical "cut and paste to new file, hoist requires to the
|
|
167
|
+
top" refactor would likely reintroduce a load-time cycle.
|
|
168
|
+
4. Several other agents are concurrently working in this same file pair this session (per this
|
|
169
|
+
session's "Active Agents" list — `dallas`, `ralph`, `ripley` are all touching
|
|
170
|
+
live-checkout/originalRef code that lives in these two files). **Line numbers in the tables below
|
|
171
|
+
will drift** as soon as any of those PRs merge; treat this document as a snapshot to re-baseline
|
|
172
|
+
from, not a stable line-number index to code against.
|
|
173
|
+
|
|
174
|
+
---
|
|
175
|
+
|
|
176
|
+
## `engine/shared.js` — full function inventory (338 functions)
|
|
177
|
+
|
|
178
|
+
Columns: **Function**, **Lines** (start-end at time of this audit), **Purpose** (from leading
|
|
179
|
+
comment, or auto-inferred from the name when no comment exists — auto-inferred purposes read as a
|
|
180
|
+
single short sentence and should be treated as lower-confidence), **Exported** (present in
|
|
181
|
+
`module.exports`), **Callers** (files outside `shared.js` that reference the identifier; "internal-only"
|
|
182
|
+
means zero such files were found), **Proposed target module**.
|
|
183
|
+
|
|
184
|
+
| Function | Lines | Purpose | Exported | Callers | Proposed target module |
|
|
185
|
+
|---|---|---|---|---|---|
|
|
186
|
+
| `isInstalledRoot` | 15-21 | Is installed root. | no | _internal-only (no callers found outside shared.js)_ | engine/shared.js (keep) |
|
|
187
|
+
| `isSourceCheckoutRoot` | 22-25 | Is source checkout root. | no | _internal-only (no callers found outside shared.js)_ | engine/shared.js (keep) |
|
|
188
|
+
| `readMinionsRootPointer` | 26-32 | Read minions root pointer. | no | _internal-only (no callers found outside shared.js)_ | engine/shared.js (keep) — root path resolution, foundational |
|
|
189
|
+
| `saveMinionsRootPointer` | 33-36 | Save minions root pointer. | yes | `test/unit/config-and-playbooks.test.js` | engine/shared.js (keep) — root path resolution, foundational |
|
|
190
|
+
| `resolveMinionsHome` | 37-108 | Resolve minions home. | yes | `test/unit/config-and-playbooks.test.js` | engine/shared.js (keep) — root path resolution, foundational |
|
|
191
|
+
| `_dashboardPortPath` | 109-114 | Dashboard port path. | no | _internal-only (no callers found outside shared.js)_ | engine/shared.js (keep) — dashboard port beacon file |
|
|
192
|
+
| `_validPort` | 115-124 | Valid port. | no | _internal-only (no callers found outside shared.js)_ | engine/shared.js (keep) |
|
|
193
|
+
| `readDashboardPortFile` | 125-146 | Read the runtime dashboard-port.json beacon. Returns `{port, pid, boundAt, path}` on success, or `null` when the file is missing, malformed, or contains an out-of-range port. No throw. | yes | `engine/pipeline.js`, `engine/preflight.js`, `engine/restart-health.js`, `engine/supervisor.js`, `engine/watch-actions.js`, `test/unit/dashboard-port-resolution.test.js` | engine/shared.js (keep) — dashboard port beacon file |
|
|
194
|
+
| `writeDashboardPortFile` | 147-169 | Atomically write the runtime dashboard-port.json beacon. The dashboard calls this once `server.listen` resolves so every CLI/client consumer agrees on the bound port (which may differ from the requested port after an EAD | yes | `test/unit/dashboard-port-resolution.test.js`, `dashboard.js` | engine/shared.js (keep) — dashboard port beacon file |
|
|
195
|
+
| `clearDashboardPortFile` | 170-183 | Delete the runtime dashboard-port.json beacon. Called on graceful dashboard shutdown so the next CLI status check doesn't probe a stale port. Best-effort. | yes | `test/unit/dashboard-port-resolution.test.js`, `dashboard.js` | engine/shared.js (keep) — dashboard port beacon file |
|
|
196
|
+
| `resolveDashboardPort` | 184-197 | Resolve the requested dashboard port via the precedence chain: explicit > env MINIONS_DASHBOARD_PORT > config.engine.dashboardPort > 7331 Pure — performs no IO. Callers that want the actually-bound port should prefer `re | yes | `test/unit/dashboard-port-resolution.test.js` | engine/shared.js (keep) — dashboard port beacon file |
|
|
197
|
+
| `ts` | 198-198 | ── Timestamps & Logging // Extracted from engine.js so engine modules can import directly without // circular-requiring the orchestrator. | yes | `engine/ado.js`, `engine/cleanup.js`, `engine/cli.js`, `engine/consolidation.js`, `engine/db/migrations/002-dispatches.js`, `engine/dispatch-events.js` +23 more | engine/shared.js (keep) — logging/timestamp primitives |
|
|
198
|
+
| `logTs` | 199-199 | Log ts. | yes | `engine.js` | engine/shared.js (keep) — logging/timestamp primitives |
|
|
199
|
+
| `dateStamp` | 200-215 | Date stamp. | yes | `engine/ado.js`, `engine/cli.js`, `engine/consolidation.js`, `engine/dispatch.js`, `engine/github.js`, `engine/pipeline.js` +4 more | engine/shared.js (keep) — logging/timestamp primitives |
|
|
200
|
+
| `compareDottedVersions` | 216-236 | Numeric semver-ish comparison of two dotted version strings. Compares major/minor/patch as integers so '22.5.0' sorts AFTER '22.10.0' would NOT — i.e. it does NOT lexically compare ('9' > '22' under string compare). Miss | yes | _internal-only (no callers found outside shared.js)_ | engine/shared.js (keep) — Node/sqlite version gate |
|
|
201
|
+
| `nodeSupportsBuiltinSqlite` | 237-245 | True when the given Node version (default: the running runtime) can load the built-in `node:sqlite` module — i.e. Node >= 22.5.0. Numeric comparison, so the 22.4.x → 22.5.0 boundary is handled correctly and 22.10+ / 24+ | yes | `engine/preflight.js` | engine/shared.js (keep) — Node/sqlite version gate |
|
|
202
|
+
| `nodeSqliteRemediationLine` | 246-259 | The canonical one-line remediation emitted by both `minions doctor` (as the failing Node.js check message) and the top-level CLI preflight when Node is too old for built-in node:sqlite. Keep the wording identical across | yes | `engine/preflight.js` | engine/shared.js (keep) — Node/sqlite version gate |
|
|
203
|
+
| `normalizeIsoTimestamp` | 260-289 | Normalize iso timestamp. | yes | `engine/ado.js` | engine/shared.js (keep) |
|
|
204
|
+
| `buildEditsSeen` | 290-362 | Build the F6 editsSeen dedup map for a single poll cycle. id/c.created_at/c.updated_at; ADO: c.id/c.publishedDate/ c.lastUpdatedDate). humanFeedback.editsSeen map (or empty). | yes | `engine/ado.js`, `engine/github.js` | engine/shared.js (keep) |
|
|
205
|
+
| `_escapeRegExp` | 363-366 | Escape reg exp. | no | _internal-only (no callers found outside shared.js)_ | engine/shared.js (keep) |
|
|
206
|
+
| `_redactedWithTrailingPunctuation` | 367-371 | Redacted with trailing punctuation. | no | _internal-only (no callers found outside shared.js)_ | engine/shared.js (keep) |
|
|
207
|
+
| `_redactUrlMatch` | 372-375 | Redact url match. | no | _internal-only (no callers found outside shared.js)_ | engine/shared.js (keep) |
|
|
208
|
+
| `_redactTokenBearingUrls` | 376-383 | Redact token bearing urls. | no | _internal-only (no callers found outside shared.js)_ | engine/shared.js (keep) |
|
|
209
|
+
| `_redactRepositoryUrls` | 384-391 | Redact repository urls. | no | _internal-only (no callers found outside shared.js)_ | engine/shared.js (keep) |
|
|
210
|
+
| `_redactConfiguredRepositoryIdentifiers` | 392-403 | Redact configured repository identifiers. | no | _internal-only (no callers found outside shared.js)_ | engine/shared.js (keep) |
|
|
211
|
+
| `_redactString` | 404-417 | Redact string. | no | _internal-only (no callers found outside shared.js)_ | engine/shared.js (keep) |
|
|
212
|
+
| `_redactGitError` | 418-425 | W-mqrb8okm — Redact bearer tokens from git error.message / stdout / stderr // in-place. Called from shellSafeGit / shellSafeGitSync catch paths so that ADO // -c http.extraHeader=Authorization: Bearer TOKEN args embedded | no | _internal-only (no callers found outside shared.js)_ | engine/shared.js (keep) |
|
|
213
|
+
| `redactSecrets` | 426-446 | Redact secrets. | yes | `engine/dispatch.js`, `engine/issues.js` | engine/shared.js (keep) |
|
|
214
|
+
| `redactPromptDescription` | 447-458 | Redactor applied to WI description text before it is injected into an agent // prompt. Applies the standard log redactor (_redactString) first, then catches // any remaining Authorization: Bearer header — including alrea | yes | `engine.js` | engine/shared.js (keep) |
|
|
215
|
+
| `log` | 459-531 | Log. | yes | `engine/abandoned-pr-reconciliation.js`, `engine/ado-git-auth.js`, `engine/ado-status.js`, `engine/ado.js`, `engine/cc-worker-pool.js`, `engine/check-status.js` +72 more | engine/shared.js (keep) — logging/timestamp primitives |
|
|
216
|
+
| `_currentLogPath` | 532-547 | Resolve the log file path at write time, not at module load time. `LOG_PATH` is captured eagerly when shared.js first loads. In production this is fine — there's a single shared.js instance per process. In tests the requ | no | _internal-only (no callers found outside shared.js)_ | engine/shared.js (keep) |
|
|
217
|
+
| `_currentLogDbPath` | 548-559 | Resolve the SQL state.db path at write time — same isolation contract // as _currentLogPath. MINIONS_LOG_PATH only redirects the JSON sidecar; // the SQL store stays attached to MINIONS_TEST_DIR / MINIONS_HOME because // | no | _internal-only (no callers found outside shared.js)_ | engine/shared.js (keep) |
|
|
218
|
+
| `resolveEngineCacheDir` | 560-593 | MINIONS_TEST_DIR-aware engine dir for cache files (runtime caps, models, // spawn-debug.log). Returns `<MINIONS_TEST_DIR>/engine` under tests; otherwise // the caller's source-adjacent fallback (typically `__dirname`-der | yes | `engine/runtimes/claude.js`, `engine/runtimes/codex.js`, `engine/runtimes/copilot.js` | engine/shared.js (keep) |
|
|
219
|
+
| `openUrlInBrowser` | 594-645 | Cross-platform URL opener. Uses execSync so failures fall through the // try/catch and the caller sees them. Dashboard self-open and `minions dash` // / `minions restart` post-health open all funnel through here. // // E | yes | `test/unit/dashboard-port-resolution.test.js`, `dashboard.js`, `engine.js` | engine/shared.js (keep) |
|
|
220
|
+
| `_bumpBrowserOpenMetric` | 646-662 | Bump per-reason counter under metrics._engine.browserOpens. Best-effort — // metrics.json writes must never throw out of openUrlInBrowser. Schema: // _engine.browserOpens.<reason> = { count, suppressedCount, lastAt } | no | _internal-only (no callers found outside shared.js)_ | engine/shared.js (keep) |
|
|
221
|
+
| `_flushLogBuffer` | 663-715 | Flush log buffer. | no | _internal-only (no callers found outside shared.js)_ | engine/shared.js (keep) |
|
|
222
|
+
| `flushLogs` | 716-725 | Flush buffered log entries to disk. Call during graceful shutdown to drain the buffer. | yes | `engine/cli.js`, `test/unit.test.js`, `dashboard.js` | engine/shared.js (keep) |
|
|
223
|
+
| `safeRead` | 726-734 | ── File I/O | yes | `engine/cli.js`, `engine/consolidation.js`, `engine/kb-sweep.js`, `engine/pipeline.js`, `engine/playbook.js`, `engine/queries.js` +8 more | engine/shared.js (keep) — file-IO primitives used repo-wide |
|
|
224
|
+
| `safeReadOrNull` | 735-738 | Like safeRead, but returns null when the file is missing/inaccessible so // callers can distinguish "file absent" from "file present but empty". // Used by doc-chat handlers (W-mpede4j7000ab7e4) to avoid silently overwri | yes | `engine/consolidation.js`, `engine/kb-sweep.js`, `dashboard.js` | engine/shared.js (keep) — file-IO primitives used repo-wide |
|
|
225
|
+
| `safeReadDir` | 739-765 | Safe read dir. | yes | `engine/cleanup.js`, `engine/dispatch.js`, `engine/pipeline.js`, `engine/queries.js`, `engine/steering.js`, `test/unit.test.js` +2 more | engine/shared.js (keep) — file-IO primitives used repo-wide |
|
|
226
|
+
| `sourcePlanKey` | 766-773 | Canonical association key for a plan/PRD source reference: the bare basename, stripped of any directory AND the legacy `plans/` (or `plans/archive/`) prefix some PRDs carry in their `source_plan` field. This is THE singl | yes | `dashboard.js` | engine/shared.js (keep) |
|
|
227
|
+
| `prdMatchesSourcePlan` | 774-787 | True when a PRD's `source_plan` references the given plan file, tolerant of the `plans/` prefix + directory differences. Use instead of raw `===`. | yes | `dashboard.js`, `engine.js` | engine/shared.js (keep) |
|
|
228
|
+
| `resolveSourcePlanPath` | 788-803 | Resolve a PRD's `source_plan` field to an absolute file path under `plansDir`. Tries the direct join first; falls back to plansDir/archive/<basename> when the direct path is missing. The direct join uses the canonical ke | yes | _internal-only (no callers found outside shared.js)_ | engine/shared.js (keep) |
|
|
229
|
+
| `computeSourcePlanContentHash` | 804-838 | Compute a deterministic sha256 hex digest of a source plan markdown file. Returns null when the file cannot be read. Used to gate the destructive PRD resync on actual content change rather than mtime or path drift. | yes | `engine.js` | engine/shared.js (keep) |
|
|
230
|
+
| `isSourcePlanContentStale` | 839-886 | Decide whether a PRD's source plan has actually changed since the last sync, gating the destructive diff-aware resync on content change rather than mtime or path drift. Returns: { stale: boolean, // true → callers should | yes | `engine/queries.js`, `dashboard.js`, `engine.js` | engine/shared.js (keep) |
|
|
231
|
+
| `_routeJsonReadToSql` | 887-1026 | ── SQL-routing shim for migrated state files // // Phase 9 (post-Phase 8 cleanup): every state file that has a SQL backing // (dispatches, work-items, pull-requests, metrics, watches, schedule-runs, // pipeline-runs, man | no | _internal-only (no callers found outside shared.js)_ | engine/shared.js (keep) |
|
|
232
|
+
| `_isNoBackupJsonPath` | 1027-1030 | Is no backup json path. | no | _internal-only (no callers found outside shared.js)_ | engine/shared.js (keep) |
|
|
233
|
+
| `safeJson` | 1031-1092 | Safe json. | yes | `engine/ado-status.js`, `engine/ado.js`, `engine/bridge.js`, `engine/check-status.js`, `engine/cleanup.js`, `engine/cli.js` +23 more | engine/shared.js (keep) — file-IO primitives used repo-wide |
|
|
234
|
+
| `safeJsonObj` | 1093-1095 | Null-safe safeJson wrapper — returns {} when file is missing/corrupt. | yes | `engine/cli.js`, `engine/gh-token.js`, `engine/pipeline.js`, `engine/projects.js`, `engine/queries.js`, `engine/routing.js` +2 more | engine/shared.js (keep) — file-IO primitives used repo-wide |
|
|
235
|
+
| `safeJsonArr` | 1096-1133 | Null-safe safeJson wrapper — returns [] when file is missing/corrupt. | yes | `engine/abandoned-pr-reconciliation.js`, `engine/ado-status.js`, `engine/ado.js`, `engine/cleanup.js`, `engine/cli.js`, `engine/dispatch.js` +8 more | engine/shared.js (keep) — file-IO primitives used repo-wide |
|
|
236
|
+
| `safeJsonNoRestore` | 1134-1159 | Sibling of safeJson for terminal-artifact and "missing == gone" reads (PRDs in `prd/`, archived plans, cooldowns, ephemeral session state — anything where a missing primary should NOT auto-restore from a stale `.backup` | yes | `engine/cleanup.js`, `engine/cooldown.js`, `engine/dispatch.js`, `engine/pipeline.js`, `engine/prd-store.js`, `engine/shared-branch-pr-reconcile.js` +4 more | engine/shared.js (keep) — file-IO primitives used repo-wide |
|
|
237
|
+
| `safeWrite` | 1160-1192 | Safe write. | yes | `engine/cleanup.js`, `engine/cli.js`, `engine/consolidation.js`, `engine/db/migrations/002-dispatches.js`, `engine/dispatch-store.js`, `engine/dispatch.js` +22 more | engine/shared.js (keep) — file-IO primitives used repo-wide |
|
|
238
|
+
| `mutateTextFileLocked` | 1193-1213 | Mutate text file locked. | yes | `engine/consolidation.js`, `test/unit.test.js`, `dashboard.js` | engine/shared.js (keep) — file-IO primitives used repo-wide |
|
|
239
|
+
| `safeUnlink` | 1214-1229 | Safe unlink. | yes | `engine/kb-sweep.js`, `engine/llm.js`, `engine/steering.js`, `engine/timeout.js`, `test/unit.test.js`, `dashboard.js` +1 more | engine/shared.js (keep) — file-IO primitives used repo-wide |
|
|
240
|
+
| `_dispatchTmpRoot` | 1230-1233 | Dispatch tmp root. | no | _internal-only (no callers found outside shared.js)_ | engine/shared.js (keep) |
|
|
241
|
+
| `_safeDispatchId` | 1234-1241 | Safe dispatch id. | no | _internal-only (no callers found outside shared.js)_ | engine/shared.js (keep) |
|
|
242
|
+
| `createDispatchTmpDir` | 1242-1257 | Create a unique tmp dir for a single dispatch. // engine/tmp/dispatch-<safeId>-XXXXXX/ (6-char random suffix from mkdtemp) // POSIX: chmod to 0o700 (owner-only). Windows: ACL inherits from MINIONS_DIR // (typically owner | yes | `engine/issues.js`, `engine/llm.js`, `engine.js` | engine/process-utils.js (new) — process spawn/pid/tmp-dir lifecycle helpers |
|
|
243
|
+
| `validateDispatchTmpDir` | 1258-1273 | Validate a tmpDir path before destructive ops (rmSync). Defends against a // corrupted/poisoned dispatch.json `entry.tmpDir` field pointing at an // arbitrary directory: must resolve under <MINIONS_DIR>/engine/tmp/, base | yes | `engine/cleanup.js`, `engine/dispatch.js`, `engine/meeting.js` | engine/process-utils.js (new) — process spawn/pid/tmp-dir lifecycle helpers |
|
|
244
|
+
| `removeDispatchTmpDir` | 1274-1282 | Remove dispatch tmp dir. | yes | `engine/cleanup.js`, `engine/cli.js`, `engine/dispatch.js`, `engine/issues.js`, `engine/llm.js`, `engine/meeting.js` +1 more | engine/process-utils.js (new) — process spawn/pid/tmp-dir lifecycle helpers |
|
|
245
|
+
| `readFileNoFollow` | 1283-1308 | Read a file using O_NOFOLLOW where the platform supports it. On Windows // fs.constants.O_NOFOLLOW is undefined, so the bitwise-or below is a no-op // (Windows non-junction reads don't follow symlinks the way POSIX does) | yes | `engine/spawn-agent.js` | engine/shared.js (keep) — file-IO primitives used repo-wide |
|
|
246
|
+
| `dispatchPidCandidates` | 1309-1334 | Returns absolute paths to candidate PID files for a dispatch id. Resolution // order: (1) entry.tmpDir/pid-<safeId>.pid if `entryOrId` is a dispatch entry // with a validated tmpDir; (2) engine/tmp/dispatch-<safeId>-pid- | yes | `engine.js` | engine/process-utils.js (new) — process spawn/pid/tmp-dir lifecycle helpers |
|
|
247
|
+
| `findDispatchPidFile` | 1335-1344 | Resolve the first existing PID file path for a dispatch (entry preferred, // then per-dispatch dir, then legacy). Returns null when none exist. | yes | `engine/cli.js`, `engine/dispatch.js`, `engine/meeting.js`, `engine/timeout.js`, `test/unit.test.js`, `dashboard.js` +1 more | engine/process-utils.js (new) — process spawn/pid/tmp-dir lifecycle helpers |
|
|
248
|
+
| `forEachPidFile` | 1345-1367 | Iterate every PID file under engine/tmp/ — both the new per-dispatch layout // and the legacy flat layout — invoking callback(absPath, basename, layout). // `layout` is 'dispatch-dir' or 'legacy'. Used by orphan-reap and | yes | `engine/cleanup.js`, `engine/cli.js`, `test/unit.test.js` | engine/process-utils.js (new) — process spawn/pid/tmp-dir lifecycle helpers |
|
|
249
|
+
| `neutralizeJsonBackupSidecar` | 1368-1406 | Neutralize json backup sidecar. | yes | `test/unit.test.js`, `dashboard.js`, `engine.js` | engine/shared.js (keep) — file-IO primitives used repo-wide |
|
|
250
|
+
| `_promptContextsDir` | 1407-1414 | Resolve lazily so MINIONS_TEST_DIR overrides work in tests. | no | _internal-only (no callers found outside shared.js)_ | engine/shared.js (keep) |
|
|
251
|
+
| `dispatchPromptSidecarPath` | 1415-1420 | Absolute path to the sidecar prompt file for a given dispatch id. | yes | _internal-only (no callers found outside shared.js)_ | engine/shared.js (keep) |
|
|
252
|
+
| `dispatchCompletionReportPath` | 1421-1432 | Dispatch completion report path. | yes | `engine/cleanup.js`, `engine/dispatch.js`, `engine/queries.js`, `test/unit.test.js`, `engine.js` | engine/shared.js (keep) |
|
|
253
|
+
| `sidecarDispatchPrompt` | 1433-1462 | If the dispatch item's prompt exceeds thresholdBytes, write the full prompt to engine/contexts/<id>.md and replace `item.prompt` with a short stub + `_promptFile` reference. Mutates item in place and returns true when si | yes | `engine/dispatch.js`, `engine.js` | engine/shared.js (keep) |
|
|
254
|
+
| `resolveDispatchPrompt` | 1463-1480 | Read the effective prompt for a dispatch item. Prefers the sidecar file when `_promptFile` is set so spawnAgent always sees the full prompt even though dispatch.json only stores a small stub. | yes | `engine.js` | engine/shared.js (keep) |
|
|
255
|
+
| `deleteDispatchPromptSidecar` | 1481-1517 | Remove the sidecar prompt file for a completed/cancelled dispatch. | yes | `engine/dispatch.js` | engine/shared.js (keep) |
|
|
256
|
+
| `writeStopIntent` | 1518-1527 | Write stop intent. | yes | `engine/cli.js`, `engine/supervisor.js` | engine/shared.js (keep) |
|
|
257
|
+
| `clearStopIntent` | 1528-1532 | Clear stop intent. | yes | `engine/cli.js`, `engine/supervisor.js` | engine/shared.js (keep) |
|
|
258
|
+
| `isStopIntentSet` | 1533-1536 | Is stop intent set. | yes | `engine/supervisor.js`, `dashboard.js` | engine/shared.js (keep) |
|
|
259
|
+
| `assertStateFileSize` | 1537-1555 | Assert state file size. | yes | `engine/cli.js`, `dashboard.js` | engine/shared.js (keep) |
|
|
260
|
+
| `sleepMs` | 1556-1577 | Sleep ms. | yes | `engine/projects.js`, `test/unit.test.js`, `engine.js` | engine/shared.js (keep) |
|
|
261
|
+
| `isPidAlive` | 1578-1602 | Shared.js-local PID liveness check. Avoids a circular require on engine/cli.js // (which has its own isPidAlive) and engine/timeout.js (which has // isOsPidAliveForDispatch — but that one looks up pid from a side-channel | yes | `engine/cli.js`, `engine/kb-sweep.js`, `engine/managed-spawn.js`, `engine/supervisor.js`, `test/unit/check-timeouts.test.js`, `test/unit.test.js` | engine/shared.js (keep) |
|
|
262
|
+
| `openAppendLogFd` | 1603-1664 | P-8a4d6f29 — single helper for detached-process stdio capture with // rotate-on-open. Used by bin/minions.js (engine + dashboard stdio logs) and // engine/managed-spawn.js openManagedLog. Centralising replaces the previo | yes | `engine/managed-spawn.js`, `engine/supervisor.js` | engine/shared.js (keep) |
|
|
263
|
+
| `getEngineCrashDiagnosticsEnv` | 1665-1685 | W-mr2c4i8m0004da94: proactive crash diagnostics for the engine.js node // process on Windows. Follow-up from W-mr2azk6i (2026-07-01 crash-loop // investigation): 4 silent engine.js deaths with no exception in // engine-s | yes | `engine/cleanup.js`, `engine/supervisor.js` | engine/shared.js (keep) |
|
|
264
|
+
| `pruneCrashDiagnosticsReports` | 1686-1705 | Prune `report. .json` files in CRASH_REPORTS_DIR down to the most-recent // `retainCount` (config.engine.crashDiagnostics.retainCount, default 20) by // mtime, mirroring dashboard.js's `_heapSnapshotPrune` retention patt | yes | `engine/cleanup.js` | engine/shared.js (keep) |
|
|
265
|
+
| `withFileLock` | 1706-1840 | With file lock. | yes | `engine/cleanup.js`, `engine/consolidation.js`, `engine/qa-runbooks.js`, `test/unit.test.js`, `dashboard.js`, `engine.js` | engine/shared.js (keep) |
|
|
266
|
+
| `_tryRouteMutateToSql` | 1841-1935 | Try route mutate to sql. | no | _internal-only (no callers found outside shared.js)_ | engine/shared.js (keep) |
|
|
267
|
+
| `mutateJsonFileLocked` | 1936-2011 | Mutate json file locked. | yes | `engine/ado.js`, `engine/bridge.js`, `engine/cleanup.js`, `engine/cli.js`, `engine/dispatch-store.js`, `engine/dispatch.js` +23 more | engine/shared.js (keep) — file-IO primitives used repo-wide |
|
|
268
|
+
| `mutateControl` | 2012-2043 | Mutate control. | yes | `engine/cli.js`, `engine/supervisor.js`, `test/unit.test.js`, `dashboard.js`, `engine.js` | engine/shared.js (keep) |
|
|
269
|
+
| `recordEngineRespawn` | 2044-2101 | Record engine respawn. | yes | `engine/supervisor.js`, `dashboard.js` | engine/shared.js (keep) |
|
|
270
|
+
| `mutateEngineState` | 2102-2108 | W-mp60tw0u000j3931: Lock-safe read-modify-write for engine/state.json — the // persistent cross-restart engine-level state file (migration markers, // one-shot reconciliation versions, etc.). Mirrors mutateControl's shap | yes | `engine/abandoned-pr-reconciliation.js` | engine/shared.js (keep) |
|
|
271
|
+
| `readEngineState` | 2109-2114 | Read engine state. | yes | `engine/abandoned-pr-reconciliation.js` | engine/shared.js (keep) |
|
|
272
|
+
| `mutateCooldowns` | 2115-2127 | Mutate cooldowns. | yes | `engine/cleanup.js`, `engine/cooldown.js`, `test/unit.test.js`, `dashboard.js` | engine/cooldown.js (existing) — branch-activity cooldown tracking |
|
|
273
|
+
| `mutateKbCheckpoint` | 2128-2135 | KB classification checkpoint counter (consolidation.js post-classify). | yes | `engine/consolidation.js` | engine/shared.js (keep) |
|
|
274
|
+
| `mutateKbSwept` | 2136-2145 | KB last-sweep summary (kb-sweep.js post-sweep, dashboard reader). | yes | `engine/kb-sweep.js` | engine/shared.js (keep) |
|
|
275
|
+
| `mutateKbSweepState` | 2146-2153 | KB sweep state machine. Written by BOTH the dashboard process AND the // detached kb-sweep-runner child — wrapping under mutateJsonFileLocked makes // cross-process writes file-locked (previously a real race via raw safe | yes | `engine/kb-sweep.js` | engine/shared.js (keep) |
|
|
276
|
+
| `mutateTestResults` | 2154-2166 | Test results history (capped at TEST_RESULTS_CAP by cleanup.js). | yes | `engine/cleanup.js` | engine/shared.js (keep) |
|
|
277
|
+
| `uid` | 2167-2175 | Generate a unique ID suffix: timestamp + monotonic counter + random chars. Use for filenames that could collide (dispatch IDs, temp files, etc.) | yes | `engine/cleanup.js`, `engine/cli.js`, `engine/create-pr-worktree.js`, `engine/dispatch.js`, `engine/llm.js`, `engine/meeting.js` +14 more | engine/shared.js (keep) |
|
|
278
|
+
| `uniquePath` | 2176-2202 | Return a unique filepath by appending -2, -3, etc. if the file already exists. E.g. uniquePath('/plans/foo.json') → '/plans/foo-2.json' if foo.json exists. | yes | `engine/consolidation.js`, `engine/kb-sweep.js`, `engine/note-link-backfill.js`, `engine/pipeline.js`, `test/unit.test.js`, `dashboard.js` | engine/shared.js (keep) |
|
|
279
|
+
| `moveFileNoClobber` | 2203-2210 | Move a file into `destDir` WITHOUT ever overwriting an existing file there — the canonical archive/restore data-loss guard. `fs.renameSync` clobbers its destination (silently, on Windows especially), so archiving a plan/ | yes | `engine/projects.js`, `dashboard.js` | engine/shared.js (keep) |
|
|
280
|
+
| `truncateTextBytes` | 2211-2227 | Truncate text bytes. | yes | `engine/meeting.js`, `engine/pipeline.js`, `engine/playbook.js`, `test/unit.test.js` | engine/shared.js (keep) |
|
|
281
|
+
| `tailTextBytes` | 2228-2244 | Tail text bytes. | yes | `test/unit.test.js` | engine/shared.js (keep) |
|
|
282
|
+
| `appendTextTail` | 2245-2263 | Append text tail. | yes | `engine/llm.js` | engine/shared.js (keep) |
|
|
283
|
+
| `parseNoteId` | 2264-2269 | Write a file to notes/inbox/ with slug+date-based dedup. Filename: `{agentId}-{slug}-{YYYY-MM-DD}.md` If a file with the same prefix already exists for today, skip the write. Pattern matches writeInboxAlert() in dispatch | yes | `test/unit/auto-recovery.test.js`, `test/unit.test.js`, `engine.js` | engine/shared.js (keep) |
|
|
284
|
+
| `writeToInbox` | 2270-2302 | Write to inbox. | yes | `engine/ado.js`, `engine/cleanup.js`, `engine/cli.js`, `engine/dispatch.js`, `engine/meeting.js`, `engine/spawn-phase-watchdog.js` +5 more | engine/shared.js (keep) |
|
|
285
|
+
| `exec` | 2303-2306 | Exec. | yes | `engine/ado-git-auth.js`, `engine/ado.js`, `engine/cc-worker-pool.js`, `engine/cleanup.js`, `engine/consolidation.js`, `engine/db/index.js` +28 more | engine/process-utils.js (new) — process spawn/pid/tmp-dir lifecycle helpers |
|
|
286
|
+
| `run` | 2307-2310 | Run. | yes | `engine/abandoned-pr-reconciliation.js`, `engine/ado.js`, `engine/cc-worker-pool.js`, `engine/cleanup.js`, `engine/cli.js`, `engine/consolidation.js` +72 more | engine/process-utils.js (new) — process spawn/pid/tmp-dir lifecycle helpers |
|
|
287
|
+
| `runFile` | 2311-2314 | Run file. | yes | `engine/llm.js`, `engine/spawn-agent.js`, `engine/timeout.js`, `test/unit.test.js`, `engine.js` | engine/process-utils.js (new) — process spawn/pid/tmp-dir lifecycle helpers |
|
|
288
|
+
| `execSilent` | 2315-2327 | Exec silent. | yes | `engine/cleanup.js`, `engine/worktree-gc.js`, `test/unit.test.js`, `engine.js` | engine/process-utils.js (new) — process spawn/pid/tmp-dir lifecycle helpers |
|
|
289
|
+
| `execAsync` | 2328-2359 | Async version of exec() — runs a shell command without blocking the event loop. Returns a Promise that resolves with { stdout, stderr } or rejects on error/timeout. Drop-in replacement for sync `exec()` in async contexts | yes | `engine/ado.js`, `engine/cleanup.js`, `engine/github.js`, `engine/spawn-agent.js`, `test/unit.test.js`, `dashboard.js` +1 more | engine/process-utils.js (new) — process spawn/pid/tmp-dir lifecycle helpers |
|
|
290
|
+
| `validateGitRef` | 2360-2384 | Tightened beyond the spec baseline regex to also block argument-injection // (leading dash) and unsafe ref-format quirks the shell can't help with — // `..` traversal, `@{`, ` `/`?` globs, leading/trailing/double slashes | yes | `engine/ado.js`, `engine/github.js`, `engine/live-checkout.js`, `engine/pr-devbox.js`, `engine/pr-remote-patch.js`, `engine/pr-resolve.js` +3 more | engine/shared.js (keep) |
|
|
291
|
+
| `validateGhSlug` | 2385-2411 | Validate gh slug. | yes | `engine/github.js`, `engine/pr-clone-keep.js`, `engine/pr-remote-patch.js`, `engine/pr-resolve.js`, `dashboard.js` | engine/shared.js (keep) |
|
|
292
|
+
| `validateGhEndpoint` | 2412-2425 | Allowlist mirrors the spec: only path chars + query-string punctuation that // the gh API legitimately uses. Specifically EXCLUDES shell metacharacters // (`;`, `$`, backtick, `\|`, newlines, quotes, spaces, brackets). Le | yes | `engine/github.js`, `engine/shared-branch-pr-reconcile.js` | engine/shared.js (keep) |
|
|
293
|
+
| `validateGhNumericId` | 2426-2442 | Generic positive-integer ID validator. `name` is interpolated into the // thrown error so call sites can be diagnosed from logs alone. | yes | _internal-only (no callers found outside shared.js)_ | engine/shared.js (keep) |
|
|
294
|
+
| `validatePrNum` | 2443-2443 | Thin aliases match the call-site naming in the threat model so greps for // `validatePrNum` / `validateReviewId` / `validateJobId` land on real code. | yes | `engine/github.js`, `engine/pr-resolve.js` | engine/shared.js (keep) |
|
|
295
|
+
| `validateReviewId` | 2444-2444 | Validate review id. | yes | `engine/github.js` | engine/shared.js (keep) |
|
|
296
|
+
| `validateJobId` | 2445-2475 | Validate job id. | yes | `engine/github.js` | engine/shared.js (keep) |
|
|
297
|
+
| `_probeGitAtDir` | 2476-2500 | W-mp6k7ywi000fa33c — pure helper. Returns: // { ok: boolean, // reason?: string, // exists: boolean, // whether dirPath itself exists on disk // nearestGitAncestor: string\|null, // path to nearest ancestor .git found // | no | _internal-only (no callers found outside shared.js)_ | engine/shared.js (keep) |
|
|
298
|
+
| `isValidGitWorktree` | 2501-2571 | Is valid git worktree. | yes | `engine/keep-process-sweep.js`, `engine/managed-spawn.js` | engine/worktree-utils.js (new) — general worktree path/branch/owner-marker helpers (worktree-pool.js/worktree-gc.js already own pool sizing + GC sweep; this new module would take the shared low-level helpers those two currently import from shared.js) |
|
|
299
|
+
| `shellSafeGh` | 2572-2595 | Shell safe gh. | yes | `engine/github.js`, `engine/pr-remote-patch.js`, `engine/pr-resolve.js`, `test/unit.test.js`, `dashboard.js` | engine/shared.js (keep) |
|
|
300
|
+
| `removeStaleIndexLock` | 2596-2616 | Remove stale index lock. | yes | `engine/live-checkout.js`, `test/unit/prepare-live-checkout.test.js`, `engine.js` | engine/shared.js (keep) |
|
|
301
|
+
| `shellSafeGit` | 2617-2650 | Shell safe git. | yes | `engine/ado-git-auth.js`, `engine/create-pr-worktree.js`, `engine/live-checkout.js`, `engine/pr-clone-keep.js`, `engine/pr-temp-clone.js`, `test/unit/prepare-live-checkout.test.js` +2 more | engine/shared.js (keep) |
|
|
302
|
+
| `shellSafeGitSync` | 2651-2683 | Sync argv-form helper for callers that aren't async (e.g. plan // materialization in materializePlansAsWorkItems). Uses execFileSync with // shell:false so argv elements are passed verbatim. | yes | `test/unit.test.js`, `engine.js` | engine/shared.js (keep) |
|
|
303
|
+
| `_pruneTimedMap` | 2684-2696 | Prune timed map. | no | _internal-only (no callers found outside shared.js)_ | engine/shared.js (keep) |
|
|
304
|
+
| `_setMainBranchCache` | 2697-2705 | Set main branch cache. | no | _internal-only (no callers found outside shared.js)_ | engine/shared.js (keep) |
|
|
305
|
+
| `resolveMainBranch` | 2706-2747 | Resolve main branch. | yes | `engine/cli.js`, `engine/playbook.js`, `engine/pr-action.js`, `engine/shared-branch-pr-reconcile.js`, `dashboard.js`, `engine.js` | engine/shared.js (keep) |
|
|
306
|
+
| `cleanChildEnv` | 2748-2760 | Clean child env. | yes | `engine/llm.js`, `engine/spawn-agent.js`, `test/unit.test.js`, `engine.js` | engine/shared.js (keep) |
|
|
307
|
+
| `gitEnv` | 2761-2783 | Environment for git commands — prevents credential manager from opening browser | yes | `engine/live-checkout.js`, `test/unit.test.js`, `engine.js` | engine/shared.js (keep) |
|
|
308
|
+
| `parseStreamJsonOutput` | 2784-2848 | Parse stream-json output from a CLI runtime. Returns { text, usage, sessionId, model }. As of P-7e3a8b1c this is a thin delegator over the runtime adapter registry — the actual parsing logic lives in `engine/runtimes/<na | yes | `engine/llm.js`, `engine/meeting.js`, `engine/runtimes/claude.js`, `engine/timeout.js`, `test/unit.test.js` | engine/shared.js (keep) |
|
|
309
|
+
| `isEngineSystemAlert` | 2849-2860 | Detect engine-authored system alerts (dirty-tree refusals, worktree-skip-live guard notices, blocked/conflicted live-checkout dispatches, managed-spawn failures, ADO-auth alerts, …). These are operational noise, NOT dura | yes | `engine/consolidation.js` | engine/shared.js (keep) |
|
|
310
|
+
| `classifyInboxItem` | 2861-2910 | Classify an inbox item into a knowledge base category. Single source of truth — used by consolidation.js (both LLM and regex paths). | yes | `engine/consolidation.js`, `test/unit.test.js` | engine/shared.js (keep) |
|
|
311
|
+
| `resolveCheckoutMode` | 2911-2942 | Resolve a project's effective checkout mode, honoring the legacy // `worktreeMode` field for back-compat. Reading order: // 1. canonical `project.checkoutMode` ('worktree' \| 'live') // 2. legacy `project.worktreeMode` (' | yes | `engine/live-checkout.js`, `engine/pr-action.js`, `dashboard.js`, `engine.js` | engine/shared.js (keep) |
|
|
312
|
+
| `isLiveCheckoutProject` | 2943-2956 | Convenience predicate: does this project dispatch in-place (live checkout)? | yes | `engine/cleanup.js`, `engine/worktree-pool.js` | engine/shared.js (keep) |
|
|
313
|
+
| `resolveLiveCheckoutAutoReset` | 2957-2975 | W-mqvejug6000eeb20 — resolve the effective live-checkout auto-reset decision. // Precedence: an explicit per-project boolean (`project.liveCheckoutAutoReset`) // wins; otherwise the fleet-wide `engine.liveCheckoutAutoRes | yes | `engine/live-checkout.js`, `test/unit/live-checkout-auto-reset.test.js`, `engine.js` | engine/shared.js (keep) |
|
|
314
|
+
| `resolveLiveCheckoutAutoBaseRepair` | 2976-2985 | W-mr3lunnq000o9f41 (companion to the stale-base guard) — resolve the // live-checkout auto-base-repair decision. Per-project `liveCheckoutAutoBaseRepair` // wins, else fleet-wide `engine.liveCheckoutAutoBaseRepair`, else | yes | `engine/live-checkout.js` | engine/shared.js (keep) |
|
|
315
|
+
| `validateCheckoutMode` | 2986-3029 | Validate checkout mode. | yes | `engine/project-discovery.js`, `dashboard.js` | engine/shared.js (keep) |
|
|
316
|
+
| `validateLiveValidation` | 3030-3817 | Validate + normalize a per-project `liveValidation` block (hybrid mode). // Hybrid = checkoutMode:'live' + liveValidation:{ type, autoDispatch }: coding // work items author in isolated worktrees (escaping the live cap) | yes | `dashboard.js` | engine/shared.js (keep) |
|
|
317
|
+
| `resolvePollFlag` | 3818-3859 | ── P-c4d8e1a3: granular per-poller flag resolution // // Helper for the 6 PR-poll axes + processPendingRebases. Each axis has a // granular ` Enabled` flag in ENGINE_DEFAULTS (default true) plus an // optional legacy bun | yes | `test/unit.test.js`, `engine.js` | engine/shared.js (keep) |
|
|
318
|
+
| `resolveAgentCli` | 3860-3874 | Resolve the CLI runtime for a per-agent spawn. Priority: 1. `agent.cli` — per-agent override 2. `engine.defaultCli` — fleet default 3. `ENGINE_DEFAULTS.defaultCli` ('copilot') — hardcoded fallback Does NOT fall through t | yes | `engine/cli.js`, `engine/queries.js`, `test/unit.test.js`, `dashboard.js`, `engine.js` | engine/runtimes/ (existing) — runtime adapter resolution |
|
|
319
|
+
| `resolveCcCli` | 3875-3900 | Resolve the CLI runtime for the Command Center / doc-chat. Priority: 1. `engine.ccCli` — CC-only override 2. `engine.defaultCli` — fleet default 3. `ENGINE_DEFAULTS.defaultCli` ('copilot') — hardcoded fallback Does NOT i | yes | `engine/llm.js`, `test/unit.test.js`, `dashboard.js` | engine/shared.js (keep) |
|
|
320
|
+
| `resolveCcUseWorkerPool` | 3901-3922 | Resolve whether the Command Center / doc-chat path should route through the persistent ACP worker pool. Priority: 1. CC runtime guard — pool spawns `copilot --acp` (Agent Client Protocol). Claude Code does not implement | yes | `dashboard.js` | engine/shared.js (keep) |
|
|
321
|
+
| `resolveAgentModel` | 3923-3934 | Resolve the model for a per-agent spawn. Priority: 1. `agent.model` — per-agent override 2. `engine.defaultModel` — fleet default 3. `undefined` — let the runtime adapter pick its own default Returning `undefined` is int | yes | `engine/cli.js`, `engine/playbook.js`, `engine/queries.js`, `test/unit.test.js`, `engine.js` | engine/shared.js (keep) |
|
|
322
|
+
| `resolveCcModel` | 3935-3950 | Resolve the model for the Command Center / doc-chat. Priority: 1. `engine.ccModel` — CC-only override 2. `engine.defaultModel` — fleet default (CC inherits this when ccModel unset) 3. `undefined` — let the runtime adapte | yes | `engine/llm.js`, `engine/pre-dispatch-eval.js`, `test/unit/auto-recovery.test.js`, `test/unit.test.js`, `dashboard.js` | engine/shared.js (keep) |
|
|
323
|
+
| `resolveAgentMaxBudget` | 3951-3973 | Resolve the per-spawn USD budget cap. Priority: 1. `agent.maxBudgetUsd` — per-agent override 2. `engine.maxBudgetUsd` — fleet default 3. `undefined` — no cap Uses nullish coalescing so a literal `0` is honored as a valid | yes | `test/unit.test.js`, `engine.js` | engine/shared.js (keep) |
|
|
324
|
+
| `resolveAgentBareMode` | 3974-3991 | Resolve whether this agent should run in Claude `--bare` mode. Priority: 1. `agent.bareMode` — per-agent override (boolean) 2. `engine.claudeBareMode` — fleet default 3. `false` — hardcoded fallback Strict undefined/null | yes | `test/unit.test.js`, `engine.js` | engine/shared.js (keep) |
|
|
325
|
+
| `_normalizeMcpServerList` | 3992-4005 | P-mcp-storm — Resolve the list of MCP server names to disable for spawned // Copilot agents. The engine FILTERS these out of the agent's seeded // COPILOT_HOME mcp-config (engine.js `_applyAgentCopilotHome`) — a server a | no | _internal-only (no callers found outside shared.js)_ | engine/shared.js (keep) |
|
|
326
|
+
| `resolveCopilotAgentDisabledMcpServers` | 4006-4030 | Resolve copilot agent disabled mcp servers. | yes | `test/unit/agent-copilot-home.test.js` | engine/shared.js (keep) |
|
|
327
|
+
| `resolveAgentHermeticHarness` | 4031-4062 | P-49e1c8b7 — Resolve whether this agent should run with a hermetic harness. Priority (mirrors `resolveAgentBareMode`): 1. `agent.hermeticHarness` — per-agent override (boolean) 2. `engine.hermeticHarness` — fleet default | yes | `engine/spawn-agent.js`, `engine.js` | engine/shared.js (keep) |
|
|
328
|
+
| `applyLegacyCcModelMigration` | 4063-4082 | If `config.engine.ccModel` is set but `config.engine.defaultModel` is unset, mutate the in-memory `config.engine` so `defaultModel` mirrors `ccModel` and log a one-time deprecation notice. Does NOT write to disk. Returns | yes | `engine/cli.js`, `test/unit.test.js` | engine/shared.js (keep) |
|
|
329
|
+
| `_resetLegacyCcModelMigrationFlag` | 4083-4113 | Test helper: reset the dedup flag so repeated tests can re-trigger the log. | yes | _internal-only (no callers found outside shared.js)_ | engine/shared.js (keep) |
|
|
330
|
+
| `runtimeConfigWarnings` | 4114-4194 | Inspect runtime fleet config and return warning entries for misconfiguration. Warnings emitted: - Unknown CLI: any `cli` value (per-agent, ccCli, defaultCli) not in `registeredRuntimes`. Each unknown value produces one e | yes | `engine/preflight.js` | engine/process-utils.js (new) — process spawn/pid/tmp-dir lifecycle helpers |
|
|
331
|
+
| `projectWorkSourceWarnings` | 4195-4255 | Detect projects whose discovery would silently no-op because the `workSources` block is missing or its sub-flags are disabled. Catches the common "I cloned the repo and ran it without `minions init`" footgun where `engin | yes | `engine/preflight.js` | engine/shared.js (keep) |
|
|
332
|
+
| `backfillProjectWorkSourceDefaults` | 4256-4298 | Boot-time auto-heal for the cloned-repo / hand-rolled-config footgun: any project missing a `workSources.workItems` or `workSources.pullRequests` sub-block gets the dashboard's default backfilled. We only touch missing s | yes | `engine/cli.js` | engine/shared.js (keep) |
|
|
333
|
+
| `isPrdArchived` | 4299-4320 | True when a PRD is archived — by an explicit flag or the 'archived' top-level // status. (Distinct from the directory: a PRD JSON can carry this regardless of // whether it physically sits in prd/ or prd/archive/.) | yes | `engine/queries.js`, `dashboard.js`, `engine.js` | engine/shared.js (keep) |
|
|
334
|
+
| `isDefunctPrd` | 4321-4429 | True when a PRD must NOT be (re)materialized or re-verified because it is // DEFUNCT — a dead leftover whose plan is no longer live. This is the // resurrection-re-execution guard (the "old PRDs came back" class): the // | yes | `engine.js` | engine/shared.js (keep) |
|
|
335
|
+
| `resolveWorkItemTypeFromPrdItem` | 4430-4620 | W-mpxqkkn300121d21 — Resolve the work-item `type` for a PRD missing_feature. Honor (in order): 1. A structured `item.type` (or `workType` / `work_type` alias) when it maps to a valid WORK_TYPE value. 2. A leading `Type: | yes | `dashboard.js`, `engine.js` | engine/shared.js (keep) |
|
|
336
|
+
| `_smallStateMutator` | 4621-4672 | Phase 7 — small state file mutators. Each routes through the small-state-store and mirrors back to its JSON file, then emits a topic event on real writes. SQL-canonical (Phase 9.4): SQLite failures propagate; the CLI shi | no | _internal-only (no callers found outside shared.js)_ | engine/shared.js (keep) |
|
|
337
|
+
| `_qaDualWriteEnabled` | 4673-4681 | Phase 8 — QA state mutators. Both qa-runs and qa-sessions are top-level JSON arrays (mutator receives the array; mutates in place or returns a replacement). The store diffs by `id`. Falls back to mutateJsonFileLocked on | no | _internal-only (no callers found outside shared.js)_ | engine/shared.js (keep) |
|
|
338
|
+
| `_qaMutator` | 4682-4720 | Qa mutator. | no | _internal-only (no callers found outside shared.js)_ | engine/shared.js (keep) |
|
|
339
|
+
| `mutateWatches` | 4721-4741 | Route a watches mutation through the SQL store. Same shape as mutateWorkItems / mutatePullRequests: mutator receives the watches array, mutates in place or returns a replacement, and the store diffs by id. SQL-canonical | yes | `engine/watches.js` | engine/shared.js (keep) |
|
|
340
|
+
| `mutateMetrics` | 4742-4763 | Route a metrics mutation through the SQL store with a JSON dual-write mirror. Same shape as mutateWorkItems / mutatePullRequests: mutator receives the full legacy-shape metrics object, mutates in place or returns a repla | yes | `engine/cleanup.js`, `engine/llm.js`, `test/unit/auto-recovery.test.js`, `engine.js` | engine/shared.js (keep) |
|
|
341
|
+
| `trackReviewMetric` | 4764-4784 | Update per-agent review metrics (prsApproved/prsRejected). Only writes for configured agents. | yes | `engine/ado.js`, `engine/github.js`, `engine/queries.js`, `test/unit.test.js` | engine/shared.js (keep) |
|
|
342
|
+
| `queuePlanToPrd` | 4785-4822 | Queue a plan-to-prd work item with dedup check inside lock. Returns { queued, alreadyQueued, id, item } so callers (e.g. POST /api/plans/execute) can surface the new or existing work item id back to the dashboard. Return | yes | `test/unit.test.js`, `dashboard.js` | engine/shared.js (keep) |
|
|
343
|
+
| `extractPlanDeclaredProject` | 4823-4845 | Extract plan declared project. | yes | `dashboard.js`, `engine.js` | engine/shared.js (keep) |
|
|
344
|
+
| `extractPlanTargetProjects` | 4846-4974 | P-7a3f1c08: Parse a cross-repo plan's list of target projects. // Primary signal: `<!-- minions:targetProjects=a, b, c -->` HTML comment. // Fallback (human): ` Projects: a, b \| c` markdown line in the first 80 lines. // | yes | `dashboard.js`, `engine.js` | engine/shared.js (keep) |
|
|
345
|
+
| `normalizeHarnessUsed` | 4975-5027 | normalizeHarnessUsed(raw) — validate/clamp an untrusted harnessUsed-shaped // object into the canonical { skills, mcpServers, commands, docs } form. // Drops malformed entries (non-objects, or missing the kind's required | yes | _internal-only (no callers found outside shared.js)_ | engine/shared.js (keep) |
|
|
346
|
+
| `groundHarnessUsed` | 5028-5099 | groundHarnessUsed(harnessUsed, propagated) — Stage 2 grounding cross-check // (P-c6f5e8b3). Normalizes an agent's self-reported `harnessUsed` and annotates // every surviving entry with a strict-boolean `grounded` field | yes | `engine/cli.js` | engine/shared.js (keep) |
|
|
347
|
+
| `_bumpPruneDefaultClaudeStrip` | 5100-5114 | Bump rolling-daily strip counter for docs/deprecated.json#prune-default-claude-config // removal gate (>=30 consecutive days of zero strips). Best-effort; mirrors // engine/cleanup.js:1200-1213 _engine.legacyStatusMigrat | no | _internal-only (no callers found outside shared.js)_ | engine/shared.js (keep) |
|
|
348
|
+
| `pruneDefaultClaudeConfig` | 5115-5185 | Prune default claude config. | yes | `test/unit.test.js`, `dashboard.js`, `minions.js` | engine/shared.js (keep) |
|
|
349
|
+
| `_isStringArrayOrNull` | 5186-5202 | Is string array or null. | no | _internal-only (no callers found outside shared.js)_ | engine/shared.js (keep) |
|
|
350
|
+
| `validateWorkspaceManifest` | 5203-5228 | Validate a workspace_manifest object. Returns `{ ok, errors }`. A `null`/`undefined` manifest is valid (it falls through to defaults). | yes | _internal-only (no callers found outside shared.js)_ | engine/shared.js (keep) — workspace-manifest enforcement helpers |
|
|
351
|
+
| `resolveAgentManifest` | 5229-5242 | Resolve an agent's effective workspace manifest by merging the per-agent value (if any) over `WORKSPACE_MANIFEST_DEFAULTS`. Returns a fresh copy on every call so callers can mutate the result without leaking changes back | yes | `engine.js` | engine/shared.js (keep) — workspace-manifest enforcement helpers |
|
|
352
|
+
| `_repoTargetToScopeCandidates` | 5243-5282 | Repo target to scope candidates. | no | _internal-only (no callers found outside shared.js)_ | engine/shared.js (keep) |
|
|
353
|
+
| `agentCanUseRepo` | 5283-5309 | Check whether `agent` (with its workspace_manifest) is allowed to operate against `repoTarget`. `repoTarget` may be a project object or a string (canonical `github:owner/repo` / `ado:org/proj/repo` or bare `owner/repo`). | yes | `engine.js` | engine/shared.js (keep) — workspace-manifest enforcement helpers |
|
|
354
|
+
| `mergeManifestAllowedTools` | 5310-5327 | Merge a manifest's `allowed_tools` list into the runtime adapter's existing `allowedTools` CSV baseline. Returns the merged CSV string the runtime adapter expects (Claude/Copilot/Codex all accept `--allowedTools <csv>`). | yes | `engine.js` | engine/shared.js (keep) — workspace-manifest enforcement helpers |
|
|
355
|
+
| `formatManifestRejection` | 5328-5339 | Build a human-readable rejection message describing an out-of-scope tool/repo/url call against an agent's manifest. Used by the dispatch repo gate (engine.js) and surfaced into the dispatch failure record + inbox alert. | yes | `engine.js` | engine/shared.js (keep) |
|
|
356
|
+
| `getProjects` | 5340-5365 | ── Project Helpers | yes | `engine/abandoned-pr-reconciliation.js`, `engine/ado-status.js`, `engine/ado.js`, `engine/cleanup.js`, `engine/cli.js`, `engine/dispatch.js` +15 more | engine/shared.js (keep) |
|
|
357
|
+
| `projectDisplayName` | 5366-5377 | Human-facing label for a project. Returns `project.name` unchanged for normal // names. When the name is a generic token (e.g. `src`), derives the parent // folder one level up from localPath and returns `<parentBasename | yes | `dashboard.js` | engine/shared.js (keep) |
|
|
358
|
+
| `formatUnknownProjectError` | 5378-5382 | Format unknown project error. | yes | `test/unit.test.js`, `dashboard.js`, `engine.js` | engine/shared.js (keep) |
|
|
359
|
+
| `findProjectByName` | 5383-5388 | Find project by name. | yes | `dashboard.js`, `engine.js` | engine/shared.js (keep) |
|
|
360
|
+
| `findProjectByNameOrPath` | 5389-5394 | Find project by name or path. | yes | _internal-only (no callers found outside shared.js)_ | engine/shared.js (keep) |
|
|
361
|
+
| `resolveConfiguredProject` | 5395-5412 | Resolve configured project. | yes | `engine/pipeline.js`, `engine/projects.js`, `dashboard.js`, `engine.js` | engine/shared.js (keep) |
|
|
362
|
+
| `centralWorkItemsPath` | 5413-5416 | Central work items path. | yes | `dashboard.js` | engine/shared.js (keep) |
|
|
363
|
+
| `centralPullRequestsPath` | 5417-5420 | Central pull requests path. | yes | `engine/projects.js`, `dashboard.js` | engine/shared.js (keep) |
|
|
364
|
+
| `_projectSourceRawValue` | 5421-5429 | Project source raw value. | no | _internal-only (no callers found outside shared.js)_ | engine/shared.js (keep) |
|
|
365
|
+
| `_sameSourcePath` | 5430-5436 | Same source path. | no | _internal-only (no callers found outside shared.js)_ | engine/shared.js (keep) |
|
|
366
|
+
| `_projectSourceDescriptor` | 5437-5452 | Project source descriptor. | no | _internal-only (no callers found outside shared.js)_ | engine/shared.js (keep) |
|
|
367
|
+
| `resolveProjectSource` | 5453-5520 | Resolve project source. | yes | `engine/cli.js`, `engine/dispatch.js`, `engine/queries.js`, `engine/shared-branch-pr-reconcile.js`, `test/unit.test.js`, `dashboard.js` +1 more | engine/shared.js (keep) |
|
|
368
|
+
| `projectRoot` | 5521-5533 | Project root. | yes | `engine/cleanup.js`, `engine/cli.js`, `engine/create-pr-worktree.js`, `test/unit.test.js`, `engine.js` | engine/shared.js (keep) |
|
|
369
|
+
| `projectStateDir` | 5534-5540 | All project state files live centrally in .minions/projects/{name}/ // No state files in project repos — avoids worktree/git interference. // // projectStateDir is path-only (no fs side effects) — safe to call with stale | yes | `engine/cli.js`, `engine/projects.js`, `test/unit.test.js`, `engine.js` | engine/shared.js (keep) |
|
|
370
|
+
| `projectStateDirEnsure` | 5541-5546 | Same as projectStateDir() but mkdirs the directory. Use when the caller does // raw fs ops (writeFileSync etc.) that don't already create the parent dir. | yes | `test/unit.test.js` | engine/shared.js (keep) |
|
|
371
|
+
| `projectWorkItemsPath` | 5547-5550 | Project work items path. | yes | `engine/ado.js`, `engine/cleanup.js`, `engine/cli.js`, `engine/github.js`, `engine/pipeline.js`, `engine/preflight.js` +8 more | engine/shared.js (keep) |
|
|
372
|
+
| `projectPrPath` | 5551-5554 | Project pr path. | yes | `engine/abandoned-pr-reconciliation.js`, `engine/ado-status.js`, `engine/ado.js`, `engine/cleanup.js`, `engine/cli.js`, `engine/dispatch.js` +10 more | engine/shared.js (keep) |
|
|
373
|
+
| `sameResolvedPath` | 5555-5565 | Same resolved path. | yes | `engine/projects.js`, `test/unit.test.js` | engine/shared.js (keep) |
|
|
374
|
+
| `ensureProjectStateFiles` | 5566-5582 | Ensure project state files. | yes | `engine/cli.js`, `engine/projects.js`, `test/unit.test.js`, `dashboard.js`, `minions.js` | engine/shared.js (keep) |
|
|
375
|
+
| `realPathForComparison` | 5583-5606 | Real path for comparison. | yes | _internal-only (no callers found outside shared.js)_ | engine/shared.js (keep) |
|
|
376
|
+
| `prPathComparisonCandidates` | 5607-5621 | Pr path comparison candidates. | yes | _internal-only (no callers found outside shared.js)_ | engine/shared.js (keep) |
|
|
377
|
+
| `resolveProjectForPrPath` | 5622-5635 | Resolve project for pr path. | yes | _internal-only (no callers found outside shared.js)_ | engine/shared.js (keep) |
|
|
378
|
+
| `nextWorkItemId` | 5636-5646 | ── ID Generation | yes | `test/unit.test.js` | engine/shared.js (keep) |
|
|
379
|
+
| `getProjectOrg` | 5647-5652 | Return the org/owner for a project regardless of host. Prefers host-specific field, falls back to adoOrg for backward compat. | yes | `engine/github.js`, `engine/playbook.js`, `engine.js` | engine/shared.js (keep) |
|
|
380
|
+
| `getAdoOrgBase` | 5653-5712 | Get ado org base. | yes | `engine/ado-git-auth.js`, `engine/ado.js`, `engine.js` | engine/shared.js (keep) |
|
|
381
|
+
| `describeCcProtectedPaths` | 5713-5740 | Returns the literal text used by the CC system prompt for the protected-file rule. Combines the basenames + prefixes above into a single sentence so the authored rule and the helper that enforces it can never disagree. T | yes | `test/unit.test.js` | engine/shared.js (keep) |
|
|
382
|
+
| `listCopilotSkills` | 5741-5799 | Enumerate Copilot CLI skills from the conventional install layout so the CC // system prompt can mirror the vanilla runtime's <available_skills> registry. // // The CC system prompt fully replaces Copilot CLI's default — | yes | _internal-only (no callers found outside shared.js)_ | engine/lifecycle-skills.js (new) — skill extraction/validation/write-out from agent output |
|
|
383
|
+
| `_xmlEscapeForPrompt` | 5800-5810 | Xml escape for prompt. | no | _internal-only (no callers found outside shared.js)_ | engine/shared.js (keep) |
|
|
384
|
+
| `buildAvailableSkillsBlock` | 5811-5821 | Render a list of skills as an <available_skills> XML block matching the // shape Copilot CLI's default system prompt injects. When `skills` is empty // we still emit the block (with a sentinel comment) so the agent learn | yes | `test/unit.test.js` | engine/lifecycle-skills.js (new) — skill extraction/validation/write-out from agent output |
|
|
385
|
+
| `renderCcSystemPrompt` | 5822-5868 | Render cc system prompt. | yes | `test/unit.test.js`, `dashboard.js` | engine/shared.js (keep) |
|
|
386
|
+
| `isLiveCommandCenterPath` | 5869-5905 | Is this absolute path a CC-protected file in the LIVE Minions checkout? Returns true ONLY if all three hold: 1. `absPath` resolves to something inside `liveRoot` (default: MINIONS_DIR). 2. Its relative path matches a pro | yes | `test/unit.test.js` | engine/shared.js (keep) |
|
|
387
|
+
| `sanitizePath` | 5906-5967 | Validate that a user-supplied filename stays within the given base directory. Rejects path traversal (../, encoded variants), null bytes, and absolute paths. Returns the resolved absolute path or throws with a descriptiv | yes | `test/unit/auto-recovery.test.js`, `test/unit.test.js`, `dashboard.js`, `engine.js` | engine/shared.js (keep) |
|
|
388
|
+
| `hasDangerousKey` | 5968-5999 | Detect the presence of prototype-pollution attack keys in a JSON-decoded payload. Belt-and-braces defence for endpoints that call `JSON.parse` on untrusted request bodies and then feed the result into `Object.assign`, sp | yes | `test/unit.test.js`, `dashboard.js` | engine/shared.js (keep) |
|
|
389
|
+
| `validatePid` | 6000-6009 | Validate that a PID value is a positive integer. Returns the numeric PID. Throws if the value could be used for command injection. | yes | `engine/cli.js`, `engine/dispatch.js`, `engine/meeting.js`, `test/unit/check-timeouts.test.js`, `test/unit.test.js`, `dashboard.js` | engine/shared.js (keep) |
|
|
390
|
+
| `sanitizeBranch` | 6010-6027 | ── Branch Sanitization | yes | `engine/cleanup.js`, `engine/cooldown.js`, `engine/dispatch.js`, `engine/shared-branch-pr-reconcile.js`, `test/unit.test.js`, `engine.js` | engine/shared.js (keep) |
|
|
391
|
+
| `getOperatorLogin` | 6028-6031 | ── Branch name derivation (W-mpejf0fq000e84d6) // // Single source of truth for the canonical work-item branch name. The convention // is `user/<loginname>/<wi-id-lowercased>-<title-slug>` (≤120 chars total). // // Calle | yes | `dashboard.js` | engine/operator-identity.js (existing) |
|
|
392
|
+
| `deriveWorkItemBranchName` | 6032-6046 | Derive work item branch name. | yes | `engine/live-checkout.js`, `dashboard.js`, `engine.js` | engine/shared.js (keep) |
|
|
393
|
+
| `_worktreeNameSuffix` | 6047-6056 | Worktree name suffix. | no | _internal-only (no callers found outside shared.js)_ | engine/worktree-utils.js (new) — general worktree path/branch/owner-marker helpers (worktree-pool.js/worktree-gc.js already own pool sizing + GC sweep; this new module would take the shared low-level helpers those two currently import from shared.js) |
|
|
394
|
+
| `buildWorktreeDirName` | 6057-6087 | Build worktree dir name. | yes | `engine/worktree-gc.js`, `test/unit/worktree-sweep-skip-scratch.test.js`, `test/unit.test.js`, `engine.js` | engine/worktree-utils.js (new) — general worktree path/branch/owner-marker helpers (worktree-pool.js/worktree-gc.js already own pool sizing + GC sweep; this new module would take the shared low-level helpers those two currently import from shared.js) |
|
|
395
|
+
| `isWorktreeRootInfraEntry` | 6088-6097 | Is worktree root infra entry. | yes | `engine/cleanup.js`, `engine/worktree-gc.js`, `test/unit/worktree-sweep-skip-scratch.test.js` | engine/worktree-utils.js (new) — general worktree path/branch/owner-marker helpers (worktree-pool.js/worktree-gc.js already own pool sizing + GC sweep; this new module would take the shared low-level helpers those two currently import from shared.js) |
|
|
396
|
+
| `isPathInside` | 6098-6118 | True when `childPath` is strictly nested within `parentPath` (descendant, NOT the same path). Cross-platform via `path.relative`; resilient to mixed separators. Returns false for equal paths, different roots/drives, or ` | yes | `engine/cleanup.js`, `engine/meeting.js`, `engine/playbook.js`, `test/unit.test.js` | engine/shared.js (keep) |
|
|
397
|
+
| `isPathInsideOrEqual` | 6119-6138 | Same as `isPathInside` but ALSO returns true when paths are equal. Why this helper exists: a git worktree placed at — or inside — the parent repo's working tree causes glob/grep tools running with `cwd = projectRoot` to | yes | `engine/managed-spawn.js`, `engine/preflight.js`, `test/unit.test.js`, `engine.js` | engine/shared.js (keep) |
|
|
398
|
+
| `parseWorktreePorcelain` | 6139-6169 | Parse `git worktree list --porcelain` output. Pure — callers run the subprocess (sync `execSilent` or async `execAsync`) and feed stdout in. Returns `[{path, head, branch, bare, detached, locked, prunable}]`. `branch` st | yes | `engine/cleanup.js`, `engine/worktree-gc.js`, `test/unit.test.js`, `engine.js` | engine/worktree-utils.js (new) — general worktree path/branch/owner-marker helpers (worktree-pool.js/worktree-gc.js already own pool sizing + GC sweep; this new module would take the shared low-level helpers those two currently import from shared.js) |
|
|
399
|
+
| `assertWorktreeOutsideProject` | 6170-6203 | Throws when `worktreePath` would land inside (or equal) `projectRoot`. Called by the engine spawn path before `git worktree add`, and by the cleanup sweep that audits already-registered worktrees per linked project. The | yes | `test/unit.test.js`, `dashboard.js`, `engine.js` | engine/worktree-utils.js (new) — general worktree path/branch/owner-marker helpers (worktree-pool.js/worktree-gc.js already own pool sizing + GC sweep; this new module would take the shared low-level helpers those two currently import from shared.js) |
|
|
400
|
+
| `resolveProjectRootDir` | 6204-6259 | Resolve the project root directory used as the parent for git worktree paths during dispatch. Centralizes the fallback that engine spawnAgent used to do inline (`project.localPath ? path.resolve(project.localPath) : path | yes | `engine/create-pr-worktree.js`, `test/unit.test.js`, `engine.js` | engine/shared.js (keep) |
|
|
401
|
+
| `resolveAgentCopilotHome` | 6260-6286 | Resolve a stable, repo-EXTERNAL COPILOT_HOME for spawned copilot agents. Copilot loads `$COPILOT_HOME/mcp-config.json` and SPAWNS every server in it on every process start. `--disable-mcp-server <name>` only hides a serv | yes | `test/unit/agent-copilot-home.test.js`, `engine.js` | engine/shared.js (keep) |
|
|
402
|
+
| `resolveAgentTempBaseDir` | 6287-6308 | Derive a scratch/temp base dir on the same volume agent work already lives on — the configured worktree location (engine.worktreeRoot, default `../worktrees`). Agents (copilot/node/git + JVM-based MCP servers) write heav | yes | `test/unit/agent-temp-dir.test.js`, `engine.js` | engine/shared.js (keep) |
|
|
403
|
+
| `ensureAgentCopilotHome` | 6309-6412 | Seed the agent COPILOT_HOME's mcp-config (copy of `~/.copilot/mcp-config.json` // MINUS `engine.copilotAgentDisabledMcpServers`) and return the home path. This // is the single source of truth for "what MCP servers may a | yes | `test/unit/agent-copilot-home.test.js`, `dashboard.js`, `engine.js` | engine/shared.js (keep) |
|
|
404
|
+
| `resolveSpawnPaths` | 6413-6505 | Resolve the agent's working directory and (when needed) the parent dir for git worktree placement. Decouples the two concerns that spawnAgent used to conflate (W-mp73x32w000l143d): 1. cwd — where the agent process actual | yes | `engine/live-checkout.js`, `test/unit.test.js`, `engine.js` | engine/shared.js (keep) |
|
|
405
|
+
| `_applyWorkdirOrThrow` | 6506-6518 | ── meta.workdir helpers (P-714ef144) // // Per-WI `meta.workdir` is a relative POSIX subpath under the spawn base // (project.localPath for read-only / live; worktree root for mutating). // When set, the engine lands the | no | _internal-only (no callers found outside shared.js)_ | engine/shared.js (keep) |
|
|
406
|
+
| `validateWorkItemWorkdir` | 6519-6561 | Validate work item workdir. | yes | `dashboard.js`, `engine.js` | engine/shared.js (keep) |
|
|
407
|
+
| `applyWorkdir` | 6562-6586 | Apply workdir. | yes | `engine.js` | engine/shared.js (keep) |
|
|
408
|
+
| `filterProjectHarnessDirsForWorkdir` | 6587-6650 | Filter project harness dirs for workdir. | yes | `engine.js` | engine/shared.js (keep) |
|
|
409
|
+
| `isAllowedOrigin` | 6651-6686 | Returns true if the origin-like header value (either an `Origin` header value such as `http://localhost:7331` or a full `Referer` URL) belongs to the local dashboard allowlist. Port-agnostic. Returns false for null/undef | yes | `test/unit.test.js`, `dashboard.js` | engine/shared.js (keep) |
|
|
410
|
+
| `isAllowedDashboardOrigin` | 6687-6705 | Returns true if the given `Origin` header value should receive an `Access-Control-Allow-Origin` echo on GET/HEAD responses. STRICTER than `isAllowedOrigin` — that helper is the mutating-request gate (allows any localhost | yes | `test/unit.test.js`, `dashboard.js` | engine/shared.js (keep) |
|
|
411
|
+
| `buildSecurityHeaders` | 6706-6721 | Returns the baseline set of security response headers to apply on every HTTP response from the dashboard. Values match OWASP defaults for a same-origin SPA served from 127.0.0.1. The HTML entry-point response intentional | yes | `test/unit.test.js`, `dashboard.js` | engine/shared.js (keep) |
|
|
412
|
+
| `_httpError` | 6722-6736 | Http error. | no | `engine/projects.js` | engine/shared.js (keep) |
|
|
413
|
+
| `validateProjectName` | 6737-6767 | Validate a project name against a strict allowlist before it ever reaches filesystem paths, config keys, or shell arguments. Allowlist: `/^[a-zA-Z0-9_\-]{1,64}$/` (letters, digits, underscore, hyphen). Rejects anything e | yes | `engine/projects.js`, `test/unit.test.js` | engine/shared.js (keep) |
|
|
414
|
+
| `validateProjectPath` | 6768-6792 | Validate a project path before it is persisted to config.json or used as a worktree parent. Default requires `fs.existsSync(path.join(pathStr, '.git'))` — accepts either a `.git` directory (normal repo) or a `.git` file | yes | `engine/projects.js`, `test/unit.test.js` | engine/shared.js (keep) |
|
|
415
|
+
| `parseSkillFrontmatter` | 6793-6814 | ── Skill Frontmatter Parser | yes | `engine/queries.js`, `test/unit.test.js`, `engine.js` | engine/lifecycle-skills.js (new) — skill extraction/validation/write-out from agent output |
|
|
416
|
+
| `normalizePrScopeSegment` | 6815-6818 | ── PR → PRD Links // Stable single-writer file: maps PR IDs → PRD item IDs. // Never touched by polling loops — only written when a PR is first linked to a PRD item. | yes | `test/unit.test.js` | engine/shared.js (keep) |
|
|
417
|
+
| `parseCanonicalPrId` | 6819-6827 | Parse canonical pr id. | yes | `engine/pr-resolve.js`, `engine/projects.js`, `engine/queries.js`, `test/unit.test.js`, `dashboard.js` | engine/pr-record-store.js (new) — PR-record normalization/lookup helpers (distinct from engine/pull-requests-store.js, which owns the SQL-backed CRUD store; these are pure functions operating on in-memory PR record shapes) |
|
|
418
|
+
| `parseGitHubPrUrl` | 6828-6836 | Parse git hub pr url. | yes | _internal-only (no callers found outside shared.js)_ | engine/shared.js (keep) |
|
|
419
|
+
| `parseAdoPrUrl` | 6837-6852 | Parse ado pr url. | yes | _internal-only (no callers found outside shared.js)_ | engine/shared.js (keep) |
|
|
420
|
+
| `parsePrUrl` | 6853-6877 | Parse pr url. | yes | `engine/pr-resolve.js`, `dashboard.js` | engine/shared.js (keep) |
|
|
421
|
+
| `extractPrRefFromText` | 6878-6911 | Extract pr ref from text. | yes | `engine/dispatch.js`, `dashboard.js` | engine/shared.js (keep) |
|
|
422
|
+
| `_descriptionPrScanSlice` | 6912-6936 | Description pr scan slice. | no | _internal-only (no callers found outside shared.js)_ | engine/shared.js (keep) |
|
|
423
|
+
| `extractStructuredWorkItemPrRef` | 6937-7005 | Structured-only PR-ref extraction (W-mq18ec6h000p7b87). Walks ONLY the // canonical structured sources — targetPr / pr / pr_id / prId / sourcePr / // pullRequest / prUrl / prNumber, references[ ].url, meta.pr_followup // | yes | `test/unit/pr-ref-gate.test.js`, `dashboard.js`, `engine.js` | engine/shared.js (keep) |
|
|
424
|
+
| `_artifactNoteFileToken` | 7006-7013 | Map a consolidation destination to the prefixed `file` token the work-item // artifact renderer (dashboard/js/render-work-items.js) uses for note pills: // notes/archive/<base> → 'archive:<base>' (openInboxNote resolves | yes | `engine/note-link-backfill.js` | engine/shared.js (keep) |
|
|
425
|
+
| `rewriteInboxRefsAcrossProjects` | 7014-7099 | Rewrite inbox refs across projects. | yes | `engine/consolidation.js`, `engine/note-link-backfill.js`, `dashboard.js` | engine/shared.js (keep) |
|
|
426
|
+
| `extractWorkItemPrRef` | 7100-7135 | Extract work item pr ref. | yes | `test/unit/pr-ref-gate.test.js`, `dashboard.js`, `engine.js` | engine/shared.js (keep) |
|
|
427
|
+
| `extractScopeFilePathsFromWorkItem` | 7136-7175 | Best-effort extraction of file-path-like scope hints from a work item. Prefers an explicit structured scope (`item.files` or `item.scope.files` array — either may be populated by a caller/agent that already knows the exa | yes | `engine/dispatch.js` | engine/shared.js (keep) |
|
|
428
|
+
| `scopeOverlapsPrChangedFiles` | 7176-7195 | Does `scopePaths` (from extractScopeFilePathsFromWorkItem) intersect `changedFiles` (a PR's changed-file paths)? Matches on exact path, suffix (directory-qualified scope hint vs a deeper repo path), or bare filename (bas | yes | `engine/dispatch.js` | engine/shared.js (keep) |
|
|
429
|
+
| `getProjectPrScope` | 7196-7216 | Get project pr scope. | yes | `engine/dispatch.js`, `engine/pr-fix-target.js`, `engine/projects.js`, `engine/queries.js`, `dashboard.js`, `engine.js` | engine/shared.js (keep) |
|
|
430
|
+
| `getPrNumber` | 7217-7233 | Get pr number. | yes | `engine/ado.js`, `engine/dispatch.js`, `engine/github.js`, `engine/pipeline.js`, `engine/queries.js`, `test/unit.test.js` +2 more | engine/shared.js (keep) |
|
|
431
|
+
| `getPrDisplayId` | 7234-7239 | Get pr display id. | yes | `engine/ado-status.js`, `engine/cooldown.js`, `engine/queries.js`, `engine/watches.js`, `engine.js` | engine/shared.js (keep) |
|
|
432
|
+
| `getPrScopeInfo` | 7240-7249 | Get pr scope info. | yes | `engine/queries.js`, `dashboard.js` | engine/shared.js (keep) |
|
|
433
|
+
| `getPrProjectScopeMismatch` | 7250-7265 | Get pr project scope mismatch. | yes | _internal-only (no callers found outside shared.js)_ | engine/shared.js (keep) |
|
|
434
|
+
| `isPrCompatibleWithProject` | 7266-7274 | Is pr compatible with project. | yes | `engine/ado.js`, `engine/github.js`, `test/unit.test.js`, `engine.js` | engine/shared.js (keep) |
|
|
435
|
+
| `isAdoPrScopeCompatible` | 7275-7322 | Check if a parsed ADO PR scope is compatible with a project config, considering that the repo segment in the URL might be either the friendly repoName or the repositoryId (GUID). Case-insensitive comparison. | yes | `engine/pr-fix-target.js`, `dashboard.js` | engine/shared.js (keep) |
|
|
436
|
+
| `getCanonicalPrId` | 7323-7336 | Build a canonical, repository-scoped PR identifier. Disambiguates PR numbers across hosts/repos by prefixing with the host scope derived from `url` (if it parses as a known host PR URL) or otherwise from the `project` co | yes | `engine/ado-status.js`, `engine/ado.js`, `engine/dispatch.js`, `engine/github.js`, `engine/queries.js`, `engine/shared-branch-pr-reconcile.js` +3 more | engine/pr-record-store.js (new) — PR-record normalization/lookup helpers (distinct from engine/pull-requests-store.js, which owns the SQL-backed CRUD store; these are pure functions operating on in-memory PR record shapes) |
|
|
437
|
+
| `findPrRecord` | 7337-7373 | Find pr record. | yes | `engine/dispatch.js`, `engine/pipeline.js`, `engine/shared-branch-pr-reconcile.js`, `dashboard.js`, `engine.js` | engine/pr-record-store.js (new) — PR-record normalization/lookup helpers (distinct from engine/pull-requests-store.js, which owns the SQL-backed CRUD store; these are pure functions operating on in-memory PR record shapes) |
|
|
438
|
+
| `isPlaceholderPrTitle` | 7374-7386 | Issue #289: single source of truth for "is this stored PR title a // placeholder/fallback that should be backfilled from the live platform // title on the next poll?". Recognizes: // - empty / missing titles // - the lin | yes | `engine/github.js` | engine/shared.js (keep) |
|
|
439
|
+
| `snapshotPrRecord` | 7387-7391 | Snapshot pr record. | yes | `engine/ado.js`, `engine/github.js` | engine/pr-record-store.js (new) — PR-record normalization/lookup helpers (distinct from engine/pull-requests-store.js, which owns the SQL-backed CRUD store; these are pure functions operating on in-memory PR record shapes) |
|
|
440
|
+
| `_jsonEqual` | 7392-7395 | Json equal. | no | _internal-only (no callers found outside shared.js)_ | engine/shared.js (keep) |
|
|
441
|
+
| `isPlainObject` | 7396-7401 | Is plain object. | yes | `engine/queries.js` | engine/shared.js (keep) |
|
|
442
|
+
| `applyPrFieldDelta` | 7402-7421 | Apply pr field delta. | yes | `engine/ado.js`, `engine/github.js` | engine/shared.js (keep) |
|
|
443
|
+
| `normalizePrRecord` | 7422-7448 | Normalize pr record. | yes | `test/unit.test.js` | engine/pr-record-store.js (new) — PR-record normalization/lookup helpers (distinct from engine/pull-requests-store.js, which owns the SQL-backed CRUD store; these are pure functions operating on in-memory PR record shapes) |
|
|
444
|
+
| `normalizePrRecords` | 7449-7457 | Normalize pr records. | yes | `engine/ado-status.js`, `engine/ado.js`, `engine/github.js`, `engine/queries.js`, `test/unit.test.js`, `engine.js` | engine/pr-record-store.js (new) — PR-record normalization/lookup helpers (distinct from engine/pull-requests-store.js, which owns the SQL-backed CRUD store; these are pure functions operating on in-memory PR record shapes) |
|
|
445
|
+
| `normalizePrLinkItems` | 7458-7466 | Normalize pr link items. | yes | _internal-only (no callers found outside shared.js)_ | engine/pr-record-store.js (new) — PR-record normalization/lookup helpers (distinct from engine/pull-requests-store.js, which owns the SQL-backed CRUD store; these are pure functions operating on in-memory PR record shapes) |
|
|
446
|
+
| `isContextOnlyPrRecord` | 7467-7471 | Canonical `contextOnly` gate — reads only the canonical field. // All records are expected to carry `contextOnly` after the 2026-06-24 // on-disk sweep confirmed no live `_contextOnly`/`_autoObserve`/`_manual` // keys re | yes | `engine/dispatch.js`, `engine.js` | engine/pr-record-store.js (new) — PR-record normalization/lookup helpers (distinct from engine/pull-requests-store.js, which owns the SQL-backed CRUD store; these are pure functions operating on in-memory PR record shapes) |
|
|
447
|
+
| `isAutoManagedPrRecord` | 7472-7475 | Is auto managed pr record. | yes | `dashboard.js`, `engine.js` | engine/pr-record-store.js (new) — PR-record normalization/lookup helpers (distinct from engine/pull-requests-store.js, which owns the SQL-backed CRUD store; these are pure functions operating on in-memory PR record shapes) |
|
|
448
|
+
| `mergePrLinkItems` | 7476-7481 | Merge pr link items. | yes | _internal-only (no callers found outside shared.js)_ | engine/pr-record-store.js (new) — PR-record normalization/lookup helpers (distinct from engine/pull-requests-store.js, which owns the SQL-backed CRUD store; these are pure functions operating on in-memory PR record shapes) |
|
|
449
|
+
| `getPrLinks` | 7482-7539 | Get pr links. | yes | `engine/ado.js`, `engine/github.js`, `engine/queries.js`, `test/unit.test.js`, `dashboard.js`, `engine.js` | engine/pr-record-store.js (new) — PR-record normalization/lookup helpers (distinct from engine/pull-requests-store.js, which owns the SQL-backed CRUD store; these are pure functions operating on in-memory PR record shapes) |
|
|
450
|
+
| `backfillPrPrdItems` | 7540-7556 | Backfill pr prd items. | yes | `engine/ado.js`, `engine/github.js` | engine/shared.js (keep) |
|
|
451
|
+
| `addPrLink` | 7557-7612 | Add pr link. | yes | `engine/shared-branch-pr-reconcile.js`, `test/unit.test.js` | engine/pr-record-store.js (new) — PR-record normalization/lookup helpers (distinct from engine/pull-requests-store.js, which owns the SQL-backed CRUD store; these are pure functions operating on in-memory PR record shapes) |
|
|
452
|
+
| `_pickBestPrRecord` | 7613-7623 | Pick the "most complete" record from a list of duplicates. // Preference order: // 1. merged status (most terminal / most informative) // 2. record with a URL (enables live polling) // 3. record with more own keys (riche | no | _internal-only (no callers found outside shared.js)_ | engine/pr-record-store.js (new) — PR-record normalization/lookup helpers (distinct from engine/pull-requests-store.js, which owns the SQL-backed CRUD store; these are pure functions operating on in-memory PR record shapes) |
|
|
453
|
+
| `_mergeDuplicatePrInto` | 7624-7652 | Merge non-conflicting fields from a loser duplicate into the winner. // Scalar fields are filled when winner is empty; prdItems are union-merged. | no | _internal-only (no callers found outside shared.js)_ | engine/shared.js (keep) |
|
|
454
|
+
| `collapseDuplicatePrRecords` | 7653-7692 | P-e9f0a2b4 — One-time repair helper: collapse duplicate PR records that share the same `prNumber` within a single `pull-requests.json` file. Call this at engine start for every project's PR file (and the central file). I | yes | _internal-only (no callers found outside shared.js)_ | engine/pr-record-store.js (new) — PR-record normalization/lookup helpers (distinct from engine/pull-requests-store.js, which owns the SQL-backed CRUD store; these are pure functions operating on in-memory PR record shapes) |
|
|
455
|
+
| `upsertPullRequestRecord` | 7693-7811 | Canonical PR-producing work contract helper. Dashboard rendering derives work-item PR columns from PR.prdItems (with engine/pr-links.json as a compatibility fallback). Any path that discovers or manually records a PR for | yes | `engine/ado.js`, `engine/github.js`, `engine/shared-branch-pr-reconcile.js`, `test/unit.test.js`, `dashboard.js` | engine/shared.js (keep) |
|
|
456
|
+
| `deriveUrlForPrRef` | 7812-7850 | PR Reference → URL Derivation // // W-mq5wfh1v000e0da9 — Given a PR ref (URL, canonical `host:scope#N` id, or // bare number / legacy `PR-N`), derive a usable URL. Used by the fix-WI auto- // enrollment helper below so u | yes | `test/unit/pr-autoenroll-fix-wi.test.js` | engine/shared.js (keep) |
|
|
457
|
+
| `classifyPrRefForVerification` | 7851-7889 | issue #246 — classify a PR ref into the host + identifiers needed to verify // it actually points at a PULL REQUEST (not an ISSUE, which shares the number // namespace on GitHub and is a distinct endpoint on ADO). Pure: | yes | `dashboard.js` | engine/shared.js (keep) |
|
|
458
|
+
| `autoEnrollPrFromWorkItem` | 7890-7930 | Auto enroll pr from work item. | yes | `test/unit/pr-autoenroll-fix-wi.test.js`, `dashboard.js`, `engine.js` | engine/shared.js (keep) |
|
|
459
|
+
| `normalizeKillPid` | 7931-7935 | Cross-Platform Process Kill Helpers | no | _internal-only (no callers found outside shared.js)_ | engine/shared.js (keep) |
|
|
460
|
+
| `unixChildPids` | 7936-7947 | Unix child pids. | no | _internal-only (no callers found outside shared.js)_ | engine/shared.js (keep) |
|
|
461
|
+
| `killUnixProcessTree` | 7948-7956 | Kill unix process tree. | no | _internal-only (no callers found outside shared.js)_ | engine/process-utils.js (new) — process spawn/pid/tmp-dir lifecycle helpers |
|
|
462
|
+
| `unrefTimer` | 7957-7961 | Unref timer. | no | _internal-only (no callers found outside shared.js)_ | engine/shared.js (keep) |
|
|
463
|
+
| `killGracefully` | 7962-7977 | Kill gracefully. | yes | `engine/cli.js`, `engine/dispatch.js`, `engine/meeting.js`, `engine/spawn-agent.js`, `engine/timeout.js`, `test/unit.test.js` +1 more | engine/process-utils.js (new) — process spawn/pid/tmp-dir lifecycle helpers |
|
|
464
|
+
| `killImmediate` | 7978-7995 | Kill immediate. | yes | `engine/cc-worker-pool.js`, `engine/cleanup.js`, `engine/cli.js`, `engine/llm.js`, `engine/managed-spawn.js`, `engine/spawn-agent.js` +6 more | engine/process-utils.js (new) — process spawn/pid/tmp-dir lifecycle helpers |
|
|
465
|
+
| `tasklistOutputShowsPid` | 7996-8010 | Decide whether a Windows `tasklist /FI "PID eq <pid>" /NH` output proves the // pid is alive. A bare `out.includes(String(pid))` can read a DEAD pid as alive // on a digit-substring collision — the pid appears inside ano | yes | `engine/supervisor.js`, `dashboard.js` | engine/shared.js (keep) |
|
|
466
|
+
| `getProcessCpuSeconds` | 8011-8059 | W-mq0e2dae000a003d — cross-platform CPU-seconds sampler used by the // spawn-phase watchdog to decide whether a process is genuinely wedged // vs busy. Returns the cumulative user+system CPU time in seconds, or // null w | yes | `engine/spawn-phase-watchdog.js` | engine/shared.js (keep) |
|
|
467
|
+
| `killByPidImmediate` | 8060-8072 | Single-PID kill (no /T tree walk) — used by the orphan-MCP sweep where we // already enumerated descendants ourselves and the parent is dead, so /T would // be a no-op anyway. | yes | `engine/keep-process-sweep.js`, `engine/managed-spawn.js`, `dashboard.js`, `engine.js` | engine/process-utils.js (new) — process spawn/pid/tmp-dir lifecycle helpers |
|
|
468
|
+
| `killByPidsImmediate` | 8073-8098 | Batched kill — one OS process for N PIDs. `taskkill` accepts repeated /PID // flags natively; on Unix we still loop process.kill, which is in-process and // cheap. Returns the count of successful kills. | yes | `engine/cleanup.js`, `engine/managed-spawn.js`, `engine/spawn-agent.js` | engine/process-utils.js (new) — process spawn/pid/tmp-dir lifecycle helpers |
|
|
469
|
+
| `_parseWmicCsv` | 8099-8126 | Process Table Enumeration // Cross-platform listing of every live process as { pid, ppid, name, cmd? }. // `cmd` is best-effort — included on Windows (via wmic) and Linux (/proc); may // be empty on macOS without ps -ww. | no | _internal-only (no callers found outside shared.js)_ | engine/shared.js (keep) |
|
|
470
|
+
| `_psListProcesses` | 8127-8144 | PowerShell Get-CimInstance is the modern path (wmic is removed on Win11 // 24H2+). We try it first and fall back to wmic for older Windows hosts. | no | _internal-only (no callers found outside shared.js)_ | engine/shared.js (keep) |
|
|
471
|
+
| `_winListProcesses` | 8145-8156 | Win list processes. | no | _internal-only (no callers found outside shared.js)_ | engine/shared.js (keep) |
|
|
472
|
+
| `_unixListProcesses` | 8157-8170 | Unix list processes. | no | _internal-only (no callers found outside shared.js)_ | engine/shared.js (keep) |
|
|
473
|
+
| `listAllProcesses` | 8171-8196 | List all processes. | yes | `engine/cleanup.js` | engine/shared.js (keep) |
|
|
474
|
+
| `findProcessesWithCwdInside` | 8197-8217 | W-mq6f2fe0000557fa — orphan-worktree GC: identify OS processes whose cwd // is at or inside `dir`. Cross-platform with a fail-open contract: on any // error or timeout we return [] (the caller continues with its existing | yes | `engine/worktree-gc.js` | engine/shared.js (keep) |
|
|
475
|
+
| `_findWindowsProcessesWithCwdInside` | 8218-8258 | Find windows processes with cwd inside. | no | _internal-only (no callers found outside shared.js)_ | engine/shared.js (keep) |
|
|
476
|
+
| `_findLinuxProcessesWithCwdInside` | 8259-8293 | Find linux processes with cwd inside. | no | _internal-only (no callers found outside shared.js)_ | engine/shared.js (keep) |
|
|
477
|
+
| `_findMacProcessesWithCwdInside` | 8294-8362 | Find mac processes with cwd inside. | no | _internal-only (no callers found outside shared.js)_ | engine/shared.js (keep) |
|
|
478
|
+
| `_windowsCwdProbeScript` | 8363-8405 | W-mqila0t5 — Windows-only PEB-based CWD probe used by the worktree-holder // reaper. Unlike findProcessesWithCwdInside (whose Windows path is a // CommandLine-basename heuristic — Win32_Process does NOT expose the workin | no | `engine.js` | engine/shared.js (keep) |
|
|
479
|
+
| `_parseCwdHolderLines` | 8406-8428 | Parse cwd holder lines. | no | `engine.js` | engine/shared.js (keep) |
|
|
480
|
+
| `findProcessCwdHolders` | 8429-8463 | Find process cwd holders. | yes | `engine.js` | engine/shared.js (keep) |
|
|
481
|
+
| `clearWorktreeFailureCache` | 8464-8486 | W-mq6f2fe0000557fa — clear the per-path failure cooldown entry so the // post-holder-reap retry can attempt removeWorktree even though the path // has already failed >= 3 times. Without this, the cooldown silently // sup | yes | `engine/worktree-gc.js` | engine/worktree-utils.js (new) — general worktree path/branch/owner-marker helpers (worktree-pool.js/worktree-gc.js already own pool sizing + GC sweep; this new module would take the shared low-level helpers those two currently import from shared.js) |
|
|
482
|
+
| `isProcessCommandLineMatchingAgent` | 8487-8514 | Cross-check a single PID's command line for a Minions agent invocation // (`claude` or `copilot`, including the `node spawn-agent.js --runtime <name>` // wrapper and `gh copilot` fallback). Used by orphan/recycled-PID sa | yes | `engine/cleanup.js`, `engine/timeout.js`, `test/unit.test.js` | engine/shared.js (keep) |
|
|
483
|
+
| `_buildChildMap` | 8515-8526 | Build child map. | no | _internal-only (no callers found outside shared.js)_ | engine/shared.js (keep) |
|
|
484
|
+
| `listProcessDescendants` | 8527-8551 | BFS descendants of rootPid given a process snapshot. `allProcesses` is // injectable for tests and for amortizing one snapshot across multiple // `listProcessDescendants` calls in the same tick. | yes | `engine/spawn-agent.js`, `engine.js` | engine/shared.js (keep) |
|
|
485
|
+
| `listProcessReachable` | 8552-8583 | Same BFS, but starts from any number of root PIDs and returns the full reach // set (including the roots themselves). Used by the orphan-MCP sweep to compute // "everything anchored to Minions" so non-anchored MCP node p | yes | `engine/cleanup.js` | engine/shared.js (keep) |
|
|
486
|
+
| `mutateWorkItems` | 8584-8634 | Atomic read-modify-write for work-items JSON files. Wraps mutateJsonFileLocked with defaultValue of []. | yes | `engine/cleanup.js`, `engine/cli.js`, `engine/dispatch-store.js`, `engine/dispatch.js`, `engine/meeting.js`, `engine/note-link-backfill.js` +9 more | engine/shared.js (keep) |
|
|
487
|
+
| `reopenWorkItem` | 8635-8649 | Reset a done work item for re-dispatch. Clears completion/dispatch metadata. Caller must set description/title separately. | yes | `dashboard.js`, `engine.js` | engine/shared.js (keep) |
|
|
488
|
+
| `mutatePullRequests` | 8650-8695 | Atomic read-modify-write for pull-requests JSON files. Wraps mutateJsonFileLocked with defaultValue of []. | yes | `engine/ado.js`, `engine/dispatch.js`, `engine/github.js`, `engine/meeting.js`, `engine/projects.js`, `engine/pull-requests-store.js` +3 more | engine/shared.js (keep) |
|
|
489
|
+
| `_pruneRemoveWorktreeFailures` | 8696-8735 | Prune remove worktree failures. | no | _internal-only (no callers found outside shared.js)_ | engine/worktree-utils.js (new) — general worktree path/branch/owner-marker helpers (worktree-pool.js/worktree-gc.js already own pool sizing + GC sweep; this new module would take the shared low-level helpers those two currently import from shared.js) |
|
|
490
|
+
| `_retryFsOp` | 8736-8771 | Retry helper for fs ops that can hit Windows file-lock errors. Used by `removeWorktree`'s `fs.rmSync` call so a single transient EPERM doesn't drop the worktree into the 3-attempt cooldown. - op: thunk that performs (and | yes | `engine/consolidation.js`, `engine/create-pr-worktree.js`, `engine/managed-spawn.js`, `engine/worktree-gc.js`, `engine.js` | engine/shared.js (keep) |
|
|
491
|
+
| `bumpWorktreeGcMetric` | 8772-8794 | Bump per-call counters on the `_worktreeGcOutcomes` metric. Best-effort; silent on lock contention or missing metrics file. The schema lives under a single key so all worktree-GC behavior is observable from one dashboard | yes | `engine/worktree-gc.js` | engine/worktree-utils.js (new) — general worktree path/branch/owner-marker helpers (worktree-pool.js/worktree-gc.js already own pool sizing + GC sweep; this new module would take the shared low-level helpers those two currently import from shared.js) |
|
|
492
|
+
| `getPrFixAutomationCause` | 8795-8809 | Get pr fix automation cause. | yes | `test/unit.test.js` | engine/shared.js (keep) |
|
|
493
|
+
| `_prHeadSha` | 8810-8816 | Source-branch head SHA, normalized across hosts. GitHub PRs carry // `headSha`/`headRefOid` (engine/github.js:718-742 keeps both in sync); ADO PRs // carry `_adoSourceCommit`/`headRefOid` (engine/ado.js:1083-1129) and a | no | _internal-only (no callers found outside shared.js)_ | engine/shared.js (keep) |
|
|
494
|
+
| `_prBaseSha` | 8817-8822 | Target-branch base SHA, normalized across hosts. GitHub PRs carry `baseSha` // (engine/github.js:746-749); ADO PRs carry `_adoTargetCommit` // (engine/ado.js:1168-1172, inline in pollPrStatus). | no | _internal-only (no callers found outside shared.js)_ | engine/shared.js (keep) |
|
|
495
|
+
| `_prTargetRefName` | 8823-8831 | Target ref name, normalized across hosts. GitHub PRs carry `baseRefName` // (e.g. "master"); ADO PRs carry `targetRefName` (e.g. "refs/heads/main"). | no | _internal-only (no callers found outside shared.js)_ | engine/shared.js (keep) |
|
|
496
|
+
| `prMergeConflictGuardKey` | 8832-8845 | #3079 — Composite key the engine uses to gate merge-conflict re-dispatch. // The same-head guard at engine.js:5676 previously compared only source head // SHA, missing the case where a PR is retargeted (e.g. parent branc | yes | `engine/ado.js`, `engine.js` | engine/shared.js (keep) |
|
|
497
|
+
| `resetMergeConflictStateOnRetarget` | 8846-8868 | #3079 — Helper invoked by the ADO + GitHub poller metadata-apply paths. // When the PR's target ref changes (user retargeted via gh pr edit --base or // ADO PR edit), clear the stale MERGE_CONFLICT records so the next ti | yes | `engine/ado.js`, `engine/github.js` | engine/shared.js (keep) |
|
|
498
|
+
| `prFixEvidenceFingerprint` | 8869-8925 | Pr fix evidence fingerprint. | yes | _internal-only (no callers found outside shared.js)_ | engine/shared.js (keep) |
|
|
499
|
+
| `getPrNoOpFixRecord` | 8926-8931 | Get pr no op fix record. | yes | `test/unit.test.js` | engine/shared.js (keep) |
|
|
500
|
+
| `isPrNoOpFixCausePaused` | 8932-8944 | Is pr no op fix cause paused. | yes | `engine/ado.js`, `engine/github.js`, `engine.js` | engine/shared.js (keep) |
|
|
501
|
+
| `getPrPausedCauses` | 8945-8964 | Issue #2969 / W-mpx44p05000ze8d8 — Derive the list of currently-paused // causes for surfacing on `/api/pull-requests` + the dashboard PR card. // Mirrors `isPrNoOpFixCausePaused` exactly: a cause is "paused" only when / | yes | `engine/queries.js` | engine/shared.js (keep) |
|
|
502
|
+
| `isBuildFixIneffectivePaused` | 8965-8976 | #639 — Distinct pause signal for "fix reported no branch change, but a live // re-poll proved the build is STILL failing on that exact (unchanged) head". // This is deliberately tracked separately from `_noOpFixes[BUILD_ | yes | `engine.js` | engine/shared.js (keep) |
|
|
503
|
+
| `_purgeReservedFiles` | 8977-9010 | Recursively purge Windows reserved-name pseudo-files (NUL, CON, PRN, AUX, etc.) using the \\?\ extended path prefix that bypasses reserved-name interpretation. Called before normal deletion attempts on Windows to unblock | yes | `test/unit.test.js` | engine/shared.js (keep) |
|
|
504
|
+
| `_normalizeWorktreePath` | 9011-9020 | ── Live-worktree guard (W-mq5rwwss000f30a7) // Single source of truth for "is some non-terminal dispatch currently using // this worktree?" Every code path that wants to wipe / reset / recycle / // quarantine a worktree | yes | `engine.js` | engine/worktree-utils.js (new) — general worktree path/branch/owner-marker helpers (worktree-pool.js/worktree-gc.js already own pool sizing + GC sweep; this new module would take the shared low-level helpers those two currently import from shared.js) |
|
|
505
|
+
| `isWorktreePathLive` | 9021-9069 | Is worktree path live. | yes | `engine/cleanup.js`, `engine/worktree-gc.js`, `engine.js` | engine/worktree-utils.js (new) — general worktree path/branch/owner-marker helpers (worktree-pool.js/worktree-gc.js already own pool sizing + GC sweep; this new module would take the shared low-level helpers those two currently import from shared.js) |
|
|
506
|
+
| `getWorktreeBlockingDispatchInfo` | 9070-9111 | P-1d6b1aa7 — separate, best-effort lookup of the specific dispatch row // that is blocking a wipe, so callers can fold self-diagnosing detail (id, // status, age-in-non-terminal-state) into the skip-live inbox note inste | yes | `engine/cleanup.js`, `engine.js` | engine/worktree-utils.js (new) — general worktree path/branch/owner-marker helpers (worktree-pool.js/worktree-gc.js already own pool sizing + GC sweep; this new module would take the shared low-level helpers those two currently import from shared.js) |
|
|
507
|
+
| `_writeWorktreeSkipLiveInboxNote` | 9112-9164 | Drop a deduped inbox note when a wipe site skips due to the live guard so // operators can see when the guard fires. Filename is keyed on basename + // UTC date — a single skip per worktree per day produces one note; fur | yes | `engine/cleanup.js`, `engine.js` | engine/worktree-utils.js (new) — general worktree path/branch/owner-marker helpers (worktree-pool.js/worktree-gc.js already own pool sizing + GC sweep; this new module would take the shared low-level helpers those two currently import from shared.js) |
|
|
508
|
+
| `removeWorktree` | 9165-9311 | P-c7e2b405 — INTENTIONAL divergence from worktree-gc.reapAndRemoveWorktree: // this is the low-level `git worktree remove --force` → fs.rmSync → rd /s /q // removal primitive WITH its own EBUSY/_retryFsOp backoff loop. T | yes | `engine/cleanup.js`, `engine/create-pr-worktree.js`, `engine/projects.js`, `engine/worktree-gc.js`, `test/unit/worktree-sweep-skip-scratch.test.js`, `test/unit.test.js` +1 more | engine/worktree-utils.js (new) — general worktree path/branch/owner-marker helpers (worktree-pool.js/worktree-gc.js already own pool sizing + GC sweep; this new module would take the shared low-level helpers those two currently import from shared.js) |
|
|
509
|
+
| `writeWorktreeOwnerMarker` | 9312-9332 | Best-effort stamp dropped right after a successful `git worktree add`. Never // throws — a missing marker only costs us the ability to auto-GC that dir. | yes | `engine/create-pr-worktree.js`, `engine/worktree-gc.js`, `engine.js` | engine/worktree-utils.js (new) — general worktree path/branch/owner-marker helpers (worktree-pool.js/worktree-gc.js already own pool sizing + GC sweep; this new module would take the shared low-level helpers those two currently import from shared.js) |
|
|
510
|
+
| `hasWorktreeOwnerMarker` | 9333-9349 | True only when the worktree carries the engine ownership marker. Fail-closed // (returns false) on any read error so an unreadable dir is treated as foreign // and kept, never blindly removed. | yes | `engine/cleanup.js`, `engine/create-pr-worktree.js`, `engine/worktree-gc.js`, `engine.js` | engine/worktree-utils.js (new) — general worktree path/branch/owner-marker helpers (worktree-pool.js/worktree-gc.js already own pool sizing + GC sweep; this new module would take the shared low-level helpers those two currently import from shared.js) |
|
|
511
|
+
| `isWorktreeOwnerMarkerStatusLine` | 9350-9367 | True when a `git status --porcelain` line refers ONLY to the engine's own // worktree-ownership marker (.minions-worktree) at the worktree root (#284). // The marker is gitignored in the repo's current tree, but a reused | yes | `engine.js` | engine/worktree-utils.js (new) — general worktree path/branch/owner-marker helpers (worktree-pool.js/worktree-gc.js already own pool sizing + GC sweep; this new module would take the shared low-level helpers those two currently import from shared.js) |
|
|
512
|
+
| `slugify` | 9368-9371 | Slugify. | yes | `engine/consolidation.js`, `engine/pipeline.js`, `test/unit.test.js`, `dashboard.js` | engine/shared.js (keep) |
|
|
513
|
+
| `safeSlugComponent` | 9372-9389 | Safe slug component. | yes | `engine/ado.js`, `engine/dispatch.js`, `engine/github.js`, `engine/pipeline.js`, `engine.js` | engine/shared.js (keep) |
|
|
514
|
+
| `bumpAgentRetryCount` | 9390-9399 | W-mpmwxn1j — Per-agent retry tracking. After the same agent has failed a WI // `ENGINE_DEFAULTS.maxRetriesPerAgent` times, the next dispatch must reassign // to a different eligible agent. The counter is stored on the WI | yes | `engine/dispatch.js`, `engine/timeout.js` | engine/shared.js (keep) |
|
|
515
|
+
| `getAgentRetryCount` | 9400-9406 | Get agent retry count. | yes | `engine.js` | engine/shared.js (keep) |
|
|
516
|
+
| `resolveMaxRetriesPerAgent` | 9407-9415 | Resolve max retries per agent. | yes | `engine.js` | engine/shared.js (keep) |
|
|
517
|
+
| `getPrAutomationCauses` | 9416-9420 | Get pr automation causes. | yes | _internal-only (no callers found outside shared.js)_ | engine/shared.js (keep) |
|
|
518
|
+
| `hasPrAutomationCause` | 9421-9424 | Has pr automation cause. | yes | `engine.js` | engine/shared.js (keep) |
|
|
519
|
+
| `markPrAutomationCause` | 9425-9447 | Mark pr automation cause. | yes | _internal-only (no callers found outside shared.js)_ | engine/shared.js (keep) |
|
|
520
|
+
| `formatTranscriptEntry` | 9448-9451 | Format transcript entry. | yes | `engine/pipeline.js`, `test/unit.test.js` | engine/shared.js (keep) |
|
|
521
|
+
| `getPinnedItems` | 9452-9460 | Get pinned items. | yes | `engine/consolidation.js`, `engine/kb-sweep.js`, `test/unit.test.js` | engine/shared.js (keep) |
|
|
522
|
+
| `createThrottleTracker` | 9461-9538 | ── Throttle Tracker Factory // Generic rate-limit tracker reusable by both ADO and GitHub integrations. // Returns an object with recordThrottle, recordSuccess, isThrottled, getState. | yes | `engine/ado.js`, `engine/github.js`, `test/unit.test.js` | engine/shared.js (keep) |
|
|
523
|
+
| `createBackoffTracker` | 9539-9572 | ── Backoff Tracker Factory // Generic graduated-backoff tracker for retryable acquisition failures (e.g. // ADO token minting via engine/ado-token.js). Distinct from // createThrottleTracker on three points so callers do | yes | `engine/ado.js` | engine/shared.js (keep) |
|
|
524
|
+
|
|
525
|
+
|
|
526
|
+
## `engine/lifecycle.js` — full function inventory (121 functions)
|
|
527
|
+
|
|
528
|
+
Same columns as above, relative to `lifecycle.js`.
|
|
529
|
+
|
|
530
|
+
| Function | Lines | Purpose | Exported | Callers | Proposed target module |
|
|
531
|
+
|---|---|---|---|---|---|
|
|
532
|
+
| `checkPlanCompletion` | 24-494 | Plan Completion Detection | yes | `engine/cli.js`, `test/unit/auto-recovery.test.js`, `test/unit.test.js`, `dashboard.js`, `engine.js` | engine/lifecycle.js (keep) |
|
|
533
|
+
| `archivePlan` | 495-557 | Archive Plan | yes | `engine/projects.js`, `test/unit/auto-recovery.test.js`, `test/unit.test.js` | engine/lifecycle.js (keep) |
|
|
534
|
+
| `cleanupPlanWorktrees` | 558-608 | Clean up worktrees associated with a plan's work items and PRs. Called from archivePlan() and also from plan delete/archive handlers. | yes | `engine/projects.js`, `test/unit.test.js`, `dashboard.js` | engine/worktree-utils.js (new) — general worktree path/branch/owner-marker helpers (worktree-pool.js/worktree-gc.js already own pool sizing + GC sweep; this new module would take the shared low-level helpers those two currently import from shared.js) |
|
|
535
|
+
| `resolveWorkItemPath` | 609-618 | Resolve the work-items.json path from dispatch meta. Reused by retry paths. | yes | `engine/dispatch.js`, `test/unit/auto-recovery.test.js`, `engine.js` | engine/lifecycle.js (keep) |
|
|
536
|
+
| `getWorkItemPaths` | 619-626 | Get work item paths. | no | _internal-only (no callers found outside lifecycle.js)_ | engine/lifecycle.js (keep) |
|
|
537
|
+
| `findWorkItemRecord` | 627-638 | Find work item record. | no | _internal-only (no callers found outside lifecycle.js)_ | engine/lifecycle.js (keep) |
|
|
538
|
+
| `resolveWorkItemScheduleContext` | 639-667 | Resolve work item schedule context. | no | _internal-only (no callers found outside lifecycle.js)_ | engine/lifecycle.js (keep) |
|
|
539
|
+
| `applyScheduleContextToPrEntry` | 668-677 | Apply schedule context to pr entry. | no | _internal-only (no callers found outside lifecycle.js)_ | engine/lifecycle.js (keep) |
|
|
540
|
+
| `isItemCompleted` | 678-684 | Check if a work item is in a terminal completed state. | yes | `test/unit.test.js`, `engine.js` | engine/lifecycle.js (keep) |
|
|
541
|
+
| `updateWorkItemStatus` | 685-782 | Update work item status. | yes | `engine/cli.js`, `engine/dispatch.js`, `test/unit/auto-recovery.test.js`, `test/unit.test.js`, `engine.js` | engine/lifecycle.js (keep) |
|
|
542
|
+
| `storeAffectedFilesFromCompletion` | 783-814 | P-mqyp000ab028c9d0 — persist affected_files from a completion report onto the // work item for future file-overlap checks. Runs only when the completion report // declares a non-empty string[] for `affected_files`; no-op | no | _internal-only (no callers found outside lifecycle.js)_ | engine/lifecycle.js (keep) |
|
|
543
|
+
| `syncPrdItemStatus` | 815-853 | Sync prd item status. | yes | `engine/dispatch.js`, `engine/queries.js`, `test/unit/auto-recovery.test.js`, `test/unit.test.js`, `dashboard.js`, `engine.js` | engine/lifecycle.js (keep) |
|
|
544
|
+
| `stampPrdItemWorkItemId` | 854-869 | W-mqtplpk6001oe6d5 — stamp workItemId back onto the PRD item when its // materialised WI completes. dashboard/render-prd.js reads // i.workItemId \|\| i._workItemId \|\| i.work_item_id \|\| i.id — writing this // field makes t | yes | `engine/prd-store.js` | engine/lifecycle.js (keep) |
|
|
545
|
+
| `stampPrdItemPrUrl` | 870-892 | Stamp prd item pr url. | yes | _internal-only (no callers found outside lifecycle.js)_ | engine/lifecycle.js (keep) |
|
|
546
|
+
| `reconcilePrdStatuses` | 893-945 | PRD Backward-Scan Reconciliation (#929, #984) // Proactive counterpart to syncPrdItemStatus. Scans all active PRDs and: // 1. Promotes "missing" items to "updated" when a done work item already exists (#929) // 2. Promot | yes | `test/unit.test.js`, `engine.js` | engine/lifecycle.js (keep) |
|
|
547
|
+
| `shouldSyncPrAsContextOnly` | 946-952 | Should sync pr as context only. | no | _internal-only (no callers found outside lifecycle.js)_ | engine/lifecycle.js (keep) |
|
|
548
|
+
| `syncPrsFromOutput` | 953-1248 | Sync prs from output. | yes | `engine/cli.js`, `test/unit/auto-recovery.test.js`, `test/unit.test.js`, `engine.js` | engine/lifecycle.js (keep) |
|
|
549
|
+
| `_setEnrollmentGhRunnerForTest` | 1249-1252 | Set enrollment gh runner for test. | yes | _internal-only (no callers found outside lifecycle.js)_ | engine/lifecycle.js (keep) |
|
|
550
|
+
| `_fetchGitHubPrStateForEnrollment` | 1253-1283 | Fetch git hub pr state for enrollment. | no | _internal-only (no callers found outside lifecycle.js)_ | engine/lifecycle.js (keep) |
|
|
551
|
+
| `_liveGitHubStateToPrStatus` | 1284-1291 | Live git hub state to pr status. | no | _internal-only (no callers found outside lifecycle.js)_ | engine/lifecycle.js (keep) |
|
|
552
|
+
| `_existingPrRecordForCanonicalId` | 1292-1320 | Existing pr record for canonical id. | no | _internal-only (no callers found outside lifecycle.js)_ | engine/pr-record-store.js (new) — PR-record normalization/lookup helpers (distinct from engine/pull-requests-store.js, which owns the SQL-backed CRUD store; these are pure functions operating on in-memory PR record shapes) |
|
|
553
|
+
| `enrollPrFromCanonicalId` | 1321-1454 | Enroll a PR (identified by canonical id, e.g. `github:owner/repo#123`) into the engine's pull-requests tracker if no record exists yet. Used to back-fill orphan `wi._pr` pointers from the legacy / pre-tracker era so the | yes | `engine/ado.js`, `engine/queries.js` | engine/lifecycle.js (keep) |
|
|
554
|
+
| `_ensurePrEnrollmentForCompletedItem` | 1455-1486 | Internal helper: after `syncPrsFromOutput` finishes the regex-evidence pass, // some work items still have `meta.item._pr` set without a tracker row (e.g. // the agent attached the PR via the structured-completion sideca | no | _internal-only (no callers found outside lifecycle.js)_ | engine/lifecycle.js (keep) |
|
|
555
|
+
| `stampWiPrRef` | 1487-1556 | W-mqtplpk6001oe6d5 — stamp _pr/_prUrl/_prNumber onto the WI record at // completion time so the PRD-progress view shows the linked PR and // enforceVerifyPrContract's fast-path (item._pr \|\| item._prUrl) succeeds // witho | yes | `engine.js` | engine/lifecycle.js (keep) |
|
|
556
|
+
| `isPrAttachmentRequired` | 1557-1587 | Is pr attachment required. | yes | _internal-only (no callers found outside lifecycle.js)_ | engine/lifecycle.js (keep) |
|
|
557
|
+
| `readOptionalJsonStrict` | 1588-1608 | Read optional json strict. | no | _internal-only (no callers found outside lifecycle.js)_ | engine/lifecycle.js (keep) |
|
|
558
|
+
| `hasCanonicalPrAttachment` | 1609-1621 | Has canonical pr attachment. | no | _internal-only (no callers found outside lifecycle.js)_ | engine/lifecycle.js (keep) |
|
|
559
|
+
| `resolvePrFallbackProject` | 1622-1643 | Resolve pr fallback project. | no | _internal-only (no callers found outside lifecycle.js)_ | engine/lifecycle.js (keep) |
|
|
560
|
+
| `runFileCapture` | 1644-1726 | Run file capture. | no | _internal-only (no callers found outside lifecycle.js)_ | engine/process-utils.js (new) — process spawn/pid/tmp-dir lifecycle helpers |
|
|
561
|
+
| `findOpenPrForBranch` | 1727-1778 | Find open pr for branch. | no | `test/unit.test.js` | engine/lifecycle.js (keep) |
|
|
562
|
+
| `_phantomBranchExistsOnRemote` | 1779-1800 | P-e0b4f7a5 — quick "did the agent push the branch before the runtime // crashed?" probe. `git ls-remote origin <branch>` returns a non-empty // "<sha>\trefs/heads/<branch>" line when the branch exists on the remote and / | no | _internal-only (no callers found outside lifecycle.js)_ | engine/lifecycle.js (keep) |
|
|
563
|
+
| `_attachFoundPrToWi` | 1801-1840 | P-e0b4f7a5 — extracted from enforcePrAttachmentContract so the phantom // recovery path can reuse the same canonical-attach upsert without // duplicating the entry construction. Returns null if the link succeeded, // or | no | `test/unit.test.js` | engine/lifecycle.js (keep) |
|
|
564
|
+
| `_attemptPhantomPrRecovery` | 1841-1864 | P-e0b4f7a5 — phantom-completion recovery: when the runtime crashes before // emitting its terminating result event, the agent may still have pushed // the branch (and possibly opened the PR) seconds beforehand. Verify wi | no | _internal-only (no callers found outside lifecycle.js)_ | engine/lifecycle.js (keep) |
|
|
565
|
+
| `_outputContainsPrUrl` | 1865-1876 | Lightweight probe for "did the agent's output contain ANY PR URL?". Used by // the PR-attachment contract to distinguish silent-failure (no URL anywhere) // from auto-link-miss (URL present but engine couldn't canonicall | no | `test/unit.test.js` | engine/lifecycle.js (keep) |
|
|
566
|
+
| `_outputHasRuntimeResultEvent` | 1877-1885 | Detects the phantom-completion signature in the raw runtime output: the // runtime's terminating `{"type":"result"}` event never landed. When this is // true and the PR-attachment contract is about to hard-fail for "no P | no | _internal-only (no callers found outside lifecycle.js)_ | engine/lifecycle.js (keep) |
|
|
567
|
+
| `markMissingPrAttachment` | 1886-2062 | Mark missing pr attachment. | yes | `test/unit/auto-recovery.test.js` | engine/lifecycle.js (keep) |
|
|
568
|
+
| `markPrAttachmentVerificationError` | 2063-2097 | Mark pr attachment verification error. | no | _internal-only (no callers found outside lifecycle.js)_ | engine/lifecycle.js (keep) |
|
|
569
|
+
| `enforcePrAttachmentContract` | 2098-2168 | Enforce pr attachment contract. | yes | `engine/timeout.js`, `test/unit/auto-recovery.test.js`, `test/unit.test.js` | engine/lifecycle.js (keep) |
|
|
570
|
+
| `enforceVerifyPrContract` | 2169-2253 | W-mqsk1ip00006cbae — After a verify WI transitions to done, assert that a PR // exists: either a direct reference on the item (_pr/_prUrl) or a matching // entry in pull-requests.json for the plan (by sourcePlan). If no | yes | _internal-only (no callers found outside lifecycle.js)_ | engine/lifecycle.js (keep) |
|
|
571
|
+
| `parseReviewVerdict` | 2254-2275 | Parse review verdict from agent output text. Looks for "VERDICT: APPROVE" or "VERDICT: REQUEST_CHANGES" markers that the review playbook instructs agents to include. This is the primary mechanism for GitHub repos where f | yes | `test/unit.test.js` | engine/lifecycle.js (keep) |
|
|
572
|
+
| `isReviewBailout` | 2276-2280 | Detect "idempotent bailout" output from a review agent — the agent saw a prior review on the PR (or the same dispatchKey re-fired) and chose to bail rather than spam a duplicate comment. Such output is intentionally shor | yes | `test/unit.test.js` | engine/lifecycle.js (keep) |
|
|
573
|
+
| `reviewPrRefFromCompletion` | 2281-2287 | Review pr ref from completion. | no | _internal-only (no callers found outside lifecycle.js)_ | engine/lifecycle.js (keep) |
|
|
574
|
+
| `reviewPrRefMatchesDispatchTarget` | 2288-2304 | Review pr ref matches dispatch target. | no | _internal-only (no callers found outside lifecycle.js)_ | engine/lifecycle.js (keep) |
|
|
575
|
+
| `centralPrPath` | 2305-2308 | Central pr path. | no | `engine/projects.js`, `test/unit.test.js` | engine/lifecycle.js (keep) |
|
|
576
|
+
| `resolveReviewPrContext` | 2309-2347 | Resolve review pr context. | no | _internal-only (no callers found outside lifecycle.js)_ | engine/lifecycle.js (keep) |
|
|
577
|
+
| `updatePrAfterReview` | 2348-2598 | Update pr after review. | yes | `engine/ado.js`, `test/unit.test.js`, `engine.js` | engine/lifecycle.js (keep) |
|
|
578
|
+
| `getHumanFeedbackAutomationCauseKey` | 2599-2610 | Get human feedback automation cause key. | no | _internal-only (no callers found outside lifecycle.js)_ | engine/lifecycle.js (keep) |
|
|
579
|
+
| `shouldClearHumanFeedbackPendingFix` | 2611-2617 | Should clear human feedback pending fix. | no | _internal-only (no callers found outside lifecycle.js)_ | engine/lifecycle.js (keep) |
|
|
580
|
+
| `fixCompletionChangedBranch` | 2618-2633 | Fix completion changed branch. | yes | _internal-only (no callers found outside lifecycle.js)_ | engine/lifecycle.js (keep) |
|
|
581
|
+
| `normalizePrFixBranchName` | 2634-2637 | Normalize pr fix branch name. | yes | _internal-only (no callers found outside lifecycle.js)_ | engine/lifecycle.js (keep) |
|
|
582
|
+
| `getPrFixBaselineHead` | 2638-2641 | Get pr fix baseline head. | no | _internal-only (no callers found outside lifecycle.js)_ | engine/lifecycle.js (keep) |
|
|
583
|
+
| `findPrFixWorktree` | 2642-2659 | Find pr fix worktree. | no | _internal-only (no callers found outside lifecycle.js)_ | engine/worktree-utils.js (new) — general worktree path/branch/owner-marker helpers (worktree-pool.js/worktree-gc.js already own pool sizing + GC sweep; this new module would take the shared low-level helpers those two currently import from shared.js) |
|
|
584
|
+
| `gitRevParse` | 2660-2668 | Git rev parse. | no | _internal-only (no callers found outside lifecycle.js)_ | engine/lifecycle.js (keep) |
|
|
585
|
+
| `detectPrFixBranchChange` | 2669-2721 | Detect pr fix branch change. | no | _internal-only (no callers found outside lifecycle.js)_ | engine/lifecycle.js (keep) |
|
|
586
|
+
| `githubPrModule` | 2722-2723 | Github pr module. | no | _internal-only (no callers found outside lifecycle.js)_ | engine/lifecycle.js (keep) |
|
|
587
|
+
| `adoPrModule` | 2724-2735 | Ado pr module. | no | _internal-only (no callers found outside lifecycle.js)_ | engine/lifecycle.js (keep) |
|
|
588
|
+
| `checkBuildStillFailingLive` | 2736-2766 | #639 — No-op fix detection previously only proved whether the agent pushed // a NEW commit; it never checked whether the build the fix was dispatched // against had actually turned green. That let a stuck failure get mar | yes | _internal-only (no callers found outside lifecycle.js)_ | engine/lifecycle.js (keep) |
|
|
589
|
+
| `recordBuildFixIneffective` | 2767-2832 | #639 — Records a build-fix dispatch that reported "no branch change" AND // was verified (via live re-poll) to still be failing on the same head. // Tracked deliberately separately from `_noOpFixes[BUILD_FAILURE]` — see | yes | `dashboard.js`, `engine.js` | engine/lifecycle.js (keep) |
|
|
590
|
+
| `recordPrNoOpFixAttempt` | 2833-3018 | Record pr no op fix attempt. | yes | _internal-only (no callers found outside lifecycle.js)_ | engine/lifecycle.js (keep) |
|
|
591
|
+
| `clearBuildFixIneffective` | 3019-3024 | #671 — Clears the `_buildFixIneffective` ("infra issue suspected") pause so // BUILD_FAILURE auto-fix dispatch can resume. Distinct from // `clearPrNoOpFixAttempt` (below) because this pause is headSha-keyed rather // th | yes | `dashboard.js` | engine/lifecycle.js (keep) |
|
|
592
|
+
| `clearPrNoOpFixAttempt` | 3025-3061 | Clear pr no op fix attempt. | yes | `engine/ado.js`, `engine/github.js`, `dashboard.js` | engine/lifecycle.js (keep) |
|
|
593
|
+
| `sweepStalePrNoOpFixes` | 3062-3080 | W-mpx44p05000ze8d8 — Proactive GC for stale `_noOpFixes` records. Called // from `engine/ado.js` + `engine/github.js` `pollPrStatus` after the live PR // fields (headSha, buildStatus, humanFeedback, mergeStatus, reviewSt | yes | `engine/ado.js`, `engine/github.js` | engine/lifecycle.js (keep) |
|
|
594
|
+
| `updatePrAfterFix` | 3081-3296 | Update pr after fix. | yes | `test/unit.test.js`, `engine.js` | engine/lifecycle.js (keep) |
|
|
595
|
+
| `updatePrAfterFixError` | 3297-3381 | W-mph6br6a0006a2b9 (F9): record an agent-error fix completion onto the PR // so the engine.js same-head guard relaxes for the next tick. A fix dispatch // that crashed (non-zero exit, hard contract failure, nonce mismatc | yes | _internal-only (no callers found outside lifecycle.js)_ | engine/lifecycle.js (keep) |
|
|
596
|
+
| `findDependentActivePrs` | 3382-3410 | Find active PRs whose work items depend on the just-merged item. Excludes shared-branch items (those use git pull instead). | yes | _internal-only (no callers found outside lifecycle.js)_ | engine/lifecycle.js (keep) |
|
|
597
|
+
| `rebaseBranchOntoMain` | 3411-3477 | Rebase a PR branch onto main in a temporary worktree. Returns { success: true } or { success: false, error: string }. | no | `test/unit.test.js` | engine/lifecycle.js (keep) |
|
|
598
|
+
| `queuePendingRebase` | 3478-3486 | Queue pending rebase. | no | _internal-only (no callers found outside lifecycle.js)_ | engine/lifecycle.js (keep) |
|
|
599
|
+
| `processPendingRebases` | 3487-3529 | Process pending rebases. | yes | `test/unit.test.js`, `engine.js` | engine/lifecycle.js (keep) |
|
|
600
|
+
| `handlePostMerge` | 3530-3657 | Post-Merge / Post-Close Hooks | yes | `engine/ado.js`, `engine/github.js`, `test/unit.test.js`, `engine.js` | engine/lifecycle-post-merge.js (new) — post-merge cleanup/branch-removal flow |
|
|
601
|
+
| `checkForLearnings` | 3658-3677 | Check for learnings. | yes | `test/unit.test.js`, `engine.js` | engine/lifecycle.js (keep) |
|
|
602
|
+
| `_findNearDuplicateSkill` | 3678-3704 | E2.a (W-mp7goxe4000p75f7): name-normalised dedup against the personal-scope // skill dir. Strips a trailing `-[a-z0-9]{4,8}` random-suffix on the candidate // and re-checks against existing stems; also does simple prefix | no | _internal-only (no callers found outside lifecycle.js)_ | engine/lifecycle-skills.js (new) — skill extraction/validation/write-out from agent output |
|
|
603
|
+
| `skillWriteTargets` | 3705-3717 | Skill write targets. | no | `engine/preflight.js`, `dashboard.js` | engine/lifecycle-skills.js (new) — skill extraction/validation/write-out from agent output |
|
|
604
|
+
| `extractSkillsFromOutput` | 3718-3821 | Extract skills from output. | yes | `test/unit/auto-recovery.test.js`, `test/unit.test.js`, `engine.js` | engine/lifecycle-skills.js (new) — skill extraction/validation/write-out from agent output |
|
|
605
|
+
| `updateAgentHistory` | 3822-3846 | Update agent history. | yes | `test/unit.test.js`, `engine.js` | engine/lifecycle.js (keep) |
|
|
606
|
+
| `reviewFeedbackSourceMatches` | 3847-3881 | Review feedback source matches. | no | _internal-only (no callers found outside lifecycle.js)_ | engine/lifecycle.js (keep) |
|
|
607
|
+
| `createReviewFeedbackForAuthor` | 3882-3935 | Create review feedback for author. | yes | `test/unit.test.js`, `engine.js` | engine/lifecycle.js (keep) |
|
|
608
|
+
| `updateMetrics` | 3936-4019 | Update metrics. | yes | `engine/cleanup.js`, `test/unit/auto-recovery.test.js`, `test/unit.test.js`, `engine.js` | engine/lifecycle.js (keep) |
|
|
609
|
+
| `parseAgentOutput` | 4020-4024 | Agent Output Parsing | yes | `engine/timeout.js`, `test/unit.test.js`, `engine.js` | engine/lifecycle.js (keep) |
|
|
610
|
+
| `hasActionableFailureClass` | 4025-4047 | Has actionable failure class. | no | _internal-only (no callers found outside lifecycle.js)_ | engine/lifecycle.js (keep) |
|
|
611
|
+
| `handleInjectionFlag` | 4048-4134 | F5 (W-mpeklod3000we69c): handle agent-reported injection attempts. The agent set `securityFlags.injectionAttempt: true` in its completion report after spotting attacker-controlled instructions inside an `<UNTRUSTED-INPUT | no | _internal-only (no callers found outside lifecycle.js)_ | engine/lifecycle.js (keep) |
|
|
612
|
+
| `resolveHarnessPropagated` | 4135-4149 | resolveHarnessPropagated(dispatchItem) — P-c6f5e8b3. Locate the spawn-time // `_harnessPropagated` manifest for a dispatch. The in-memory dispatchItem // (spawnAgent's closure object) normally carries it directly; after | yes | `engine.js` | engine/lifecycle.js (keep) |
|
|
613
|
+
| `parseCompletionReportFile` | 4150-4172 | Parse completion report file. | yes | `engine/timeout.js`, `test/unit.test.js` | engine/lifecycle.js (keep) |
|
|
614
|
+
| `normalizeCompletionArtifacts` | 4173-4198 | Normalize completion artifacts. | yes | _internal-only (no callers found outside lifecycle.js)_ | engine/lifecycle.js (keep) |
|
|
615
|
+
| `normalizeArtifactPath` | 4199-4212 | Normalize artifact path. | no | _internal-only (no callers found outside lifecycle.js)_ | engine/lifecycle.js (keep) |
|
|
616
|
+
| `_artifactFilesystemPath` | 4213-4218 | Artifact filesystem path. | no | _internal-only (no callers found outside lifecycle.js)_ | engine/lifecycle.js (keep) |
|
|
617
|
+
| `completionArtifactToNoteEntry` | 4219-4243 | Completion artifact to note entry. | yes | _internal-only (no callers found outside lifecycle.js)_ | engine/lifecycle.js (keep) |
|
|
618
|
+
| `mergeCompletionArtifacts` | 4244-4267 | Merge completion artifacts. | no | _internal-only (no callers found outside lifecycle.js)_ | engine/lifecycle.js (keep) |
|
|
619
|
+
| `mergeArtifactNotes` | 4268-4301 | Merge artifact notes. | yes | `engine.js` | engine/lifecycle.js (keep) |
|
|
620
|
+
| `promoteCompletionArtifacts` | 4302-4353 | Promote completion artifacts. | yes | `test/unit/auto-recovery.test.js`, `engine.js` | engine/lifecycle.js (keep) |
|
|
621
|
+
| `normalizeCompletionStatus` | 4354-4376 | Normalize completion status. | no | _internal-only (no callers found outside lifecycle.js)_ | engine/lifecycle.js (keep) |
|
|
622
|
+
| `detectNonTerminalResultSummary` | 4377-4419 | Detect non terminal result summary. | yes | `engine/timeout.js` | engine/lifecycle.js (keep) |
|
|
623
|
+
| `deferNonTerminalCompletion` | 4420-4429 | Defer non terminal completion. | yes | _internal-only (no callers found outside lifecycle.js)_ | engine/lifecycle.js (keep) |
|
|
624
|
+
| `deferPhantomCompletion` | 4430-4433 | Phantom-completion variant — uses _phantomRetryCount + maxPhantomRetries so // runtime-crash retries don't share a budget with the PR-attachment contract's // retries. Cap is independent (ENGINE_DEFAULTS.maxPhantomRetrie | yes | _internal-only (no callers found outside lifecycle.js)_ | engine/lifecycle.js (keep) |
|
|
625
|
+
| `_deferRetryWithCounter` | 4434-4550 | Defer retry with counter. | no | _internal-only (no callers found outside lifecycle.js)_ | engine/lifecycle.js (keep) |
|
|
626
|
+
| `parseCompletionBoolean` | 4551-4570 | Parse completion boolean. | no | _internal-only (no callers found outside lifecycle.js)_ | engine/lifecycle.js (keep) |
|
|
627
|
+
| `parseCompletionNoop` | 4571-4592 | Detect a deliberate no-op completion — the agent correctly declined to make // changes (work was already shipped, dispatch premise was wrong, self-authored // review with no actionable feedback, etc.) and should NOT be f | yes | _internal-only (no callers found outside lifecycle.js)_ | engine/lifecycle.js (keep) |
|
|
628
|
+
| `normalizeReviewVerdict` | 4593-4599 | Normalize review verdict. | no | _internal-only (no callers found outside lifecycle.js)_ | engine/lifecycle.js (keep) |
|
|
629
|
+
| `reviewVerdictFromCompletion` | 4600-4613 | Review verdict from completion. | no | _internal-only (no callers found outside lifecycle.js)_ | engine/lifecycle.js (keep) |
|
|
630
|
+
| `extractReviewThreadIds` | 4614-4635 | W-mpg58wv3 — Best-effort extraction of ADO/GitHub thread ids the review cited. Accepts a few common shapes the agent may emit on the structured completion: - addresses_threads: [123, 456] (canonical, matches the meta key | yes | _internal-only (no callers found outside lifecycle.js)_ | engine/lifecycle.js (keep) |
|
|
631
|
+
| `reviewContentMatchesPr` | 4636-4662 | Review content matches pr. | no | _internal-only (no callers found outside lifecycle.js)_ | engine/lifecycle.js (keep) |
|
|
632
|
+
| `writeNonCleanAgentReport` | 4663-4718 | Write non clean agent report. | yes | _internal-only (no callers found outside lifecycle.js)_ | engine/lifecycle.js (keep) |
|
|
633
|
+
| `_collectAllAssistantContent` | 4719-4765 | Permissively pull all assistant-message content out of a stream-json log. The standard runtime parsers (engine/runtimes.parseOutput) intentionally drop `assistant.message` content when the same event also carries `toolRe | no | _internal-only (no callers found outside lifecycle.js)_ | engine/lifecycle.js (keep) |
|
|
634
|
+
| `extractDecompositionJson` | 4766-4805 | Extract a decomposition object ({parent_id, sub_items}) from raw agent stdout. Strategy: 1. Try the standard runtime parser first (preserves existing behavior when the agent emits the block in a content-only turn). 2. Fa | yes | _internal-only (no callers found outside lifecycle.js)_ | engine/lifecycle.js (keep) |
|
|
635
|
+
| `processCompletionFollowups` | 4806-4886 | PR follow-up audit (W-mpej3cox00099466). Parses the optional `followups` array on the agent's completion report, logs each entry at `info` so operators can trace fan-out, and warns when a claimed `wi_id` doesn't match an | yes | _internal-only (no callers found outside lifecycle.js)_ | engine/lifecycle.js (keep) |
|
|
636
|
+
| `handleDecompositionResult` | 4887-4976 | Handle decomposition result — parse sub-items from agent output and create child work items. Called from runPostCompletionHooks when type === 'decompose'. | yes | `test/unit/auto-recovery.test.js` | engine/lifecycle.js (keep) |
|
|
637
|
+
| `handleHarnessIterationResult` | 4977-5071 | Tri-agent harness mode (W-mq07a9gf000jbc2b): when an evaluator completes, parse its verdict against the configured rubric/threshold and — if the artifact didn't pass and the iteration cap hasn't been hit — append a fresh | yes | _internal-only (no callers found outside lifecycle.js)_ | engine/lifecycle.js (keep) |
|
|
638
|
+
| `dispatchReReviewForFix` | 5072-5183 | W-mpg58wv3 — auto-dispatch a re-review WI when a fix-WI born from a minion REQUEST_CHANGES marks done. Closure-loop for the shared Yemi reviewer slot: without a re-review, the stale -5 vote sits on the PR indefinitely an | yes | _internal-only (no callers found outside lifecycle.js)_ | engine/lifecycle.js (keep) |
|
|
639
|
+
| `pickReReviewAgentHints` | 5184-5211 | Pick re review agent hints. | yes | _internal-only (no callers found outside lifecycle.js)_ | engine/lifecycle.js (keep) |
|
|
640
|
+
| `applyGoalInvalidation` | 5212-5269 | P-mqyp0009y025z6a7 — Goal invalidation. When a completing WI's report carries a non-empty `invalidates: [wi-id, …]` array, cancel each listed WI that is currently pending or queued. Rules: - Only cancels WIs in status 'p | yes | _internal-only (no callers found outside lifecycle.js)_ | engine/lifecycle.js (keep) |
|
|
641
|
+
| `runPostCompletionHooks` | 5270-6191 | Run post completion hooks. | yes | `engine/dispatch.js`, `engine/meeting.js`, `engine/scheduler.js`, `engine/timeout.js`, `test/unit/auto-recovery.test.js`, `test/unit.test.js` +1 more | engine/process-utils.js (new) — process spawn/pid/tmp-dir lifecycle helpers |
|
|
642
|
+
| `syncPrdFromPrs` | 6192-6262 | PR → PRD Status Sync // Runs every 6 ticks (~3 min). For all pending work items across all projects, // runs the reconciliation pass to catch PRs created after materialization // (e.g., manually raised PRs, cross-plan PR | yes | `test/unit/auto-recovery.test.js`, `test/unit/check-timeouts.test.js`, `test/unit.test.js`, `engine.js` | engine/lifecycle.js (keep) |
|
|
643
|
+
| `advancePrdStatusOnAllItemsDone` | 6263-6343 | PRD Top-Level Status Auto-Completion (P-d7e8f9a1) // Runs at the end of syncPrdFromPrs (same PR-poll cadence). Advances PRD // status to 'completed' when every missing_features item satisfies both: // 1. A work item with | yes | _internal-only (no callers found outside lifecycle.js)_ | engine/lifecycle.js (keep) |
|
|
644
|
+
| `_isVerifyAggregatePr` | 6344-6354 | Match the dashboard's renderE2eSection predicate (render-prd.js ~line 603). | no | _internal-only (no callers found outside lifecycle.js)_ | engine/lifecycle.js (keep) |
|
|
645
|
+
| `_verifyPrRef` | 6355-6367 | Compact, render-ready reference persisted onto prd.verifyPrs[]. | no | _internal-only (no callers found outside lifecycle.js)_ | engine/lifecycle.js (keep) |
|
|
646
|
+
| `_verifyPrsNeedUpdate` | 6368-6382 | True when persisting `refMap` would change the existing prd.verifyPrs[]. | no | _internal-only (no callers found outside lifecycle.js)_ | engine/lifecycle.js (keep) |
|
|
647
|
+
| `persistVerifyPrsToPrd` | 6383-6449 | Persist verify prs to prd. | yes | `engine/queries.js`, `engine.js` | engine/lifecycle.js (keep) |
|
|
648
|
+
| `classifyFailure` | 6450-6544 | Classify an agent failure into a FAILURE_CLASS value based on exit code and output. | yes | `engine/runtimes/claude.js`, `engine/runtimes/codex.js`, `engine/runtimes/copilot.js`, `test/unit.test.js`, `engine.js` | engine/lifecycle.js (keep) |
|
|
649
|
+
| `diagnoseEmptyOutput` | 6545-6575 | When a claude CLI agent exits in <3s with code 1 and no output, the raw EMPTY_OUTPUT class tells us "no meaningful output" but nothing about WHY. This helper detects the fast-exit pattern and returns a diagnostic hint li | yes | `engine.js` | engine/lifecycle.js (keep) |
|
|
650
|
+
| `pruneScopeMismatchDuplicatePrs` | 6576-6710 | W-mqba5ulq000nd255 / W-mr2cqq12000b04f8 — Reconciliation sweep with two // defenses against mis-scoped `_invalidProjectScope: { reason: "pr_scope_mismatch" }` // records: // // 1. PRUNE — a sibling record for the same ca | yes | `engine.js` | engine/lifecycle.js (keep) |
|
|
651
|
+
| `collapseAllDuplicatePrRecords` | 6711-6782 | Repair helper: collapse prNumber duplicates across all project-scoped and // the central pull-requests file. Called once per reconcile cycle alongside // pruneScopeMismatchDuplicatePrs so accumulated duplicates are clean | yes | `engine.js` | engine/pr-record-store.js (new) — PR-record normalization/lookup helpers (distinct from engine/pull-requests-store.js, which owns the SQL-backed CRUD store; these are pure functions operating on in-memory PR record shapes) |
|
|
652
|
+
| `autoDispatchLiveValidationWi` | 6783-6897 | M003 — After a coding WI completes successfully, auto-dispatch a live-validation // WI when project.liveValidation.autoDispatch === true and the completed item is // a coding WI (not one of the validation types itself). | yes | `engine.js` | engine/lifecycle.js (keep) |
|
|
653
|
+
|
|
654
|
+
|
|
655
|
+
---
|
|
656
|
+
|
|
657
|
+
## Recommended next steps (not performed in this task — audit only)
|
|
658
|
+
|
|
659
|
+
This task was scoped as documentation-only: no function body was moved, renamed, or edited.
|
|
660
|
+
Suggested follow-up work items, in an order that minimizes risk:
|
|
661
|
+
|
|
662
|
+
1. Resolve the `pr-record-store.js` naming question (Open question #2) before scheduling any PR
|
|
663
|
+
extraction work in that cluster.
|
|
664
|
+
2. Extract `engine/process-utils.js` first — it is the cluster with the fewest cross-file
|
|
665
|
+
dependents and no lazy-require entanglements found in this audit, making it the lowest-risk
|
|
666
|
+
first cut to validate the extraction process (tests, import updates, re-export shims) before
|
|
667
|
+
tackling the PR-record or skills clusters.
|
|
668
|
+
3. When extracting any cluster that a lazy `require()` chain touches (see "Circular-dependency
|
|
669
|
+
risk findings"), keep the lazy in-function require in the new module and re-run
|
|
670
|
+
`npm test` / `npm run test:sequential` afterward — a load-order regression from a hoisted
|
|
671
|
+
`require()` would likely show up as a `Cannot access '...' before initialization` or a partial
|
|
672
|
+
`module.exports` object at require time, not a clean stack trace at the failing call site.
|
|
673
|
+
4. Re-run this audit's extraction script (or an AST-based equivalent) immediately before each
|
|
674
|
+
individual extraction PR, since line numbers and caller lists will have drifted from concurrent
|
|
675
|
+
work on these two files (see Open question #4).
|
package/engine/live-checkout.js
CHANGED
|
@@ -1168,6 +1168,40 @@ async function prepareLiveCheckout(opts = {}) {
|
|
|
1168
1168
|
// auth-less GVFS blob fetches that fail on partial clones in headless mode.
|
|
1169
1169
|
const failedCreate = await runCheckout(['checkout', '-b', branchName], { creating: true });
|
|
1170
1170
|
if (failedCreate) return failedCreate;
|
|
1171
|
+
// ── originalRef contamination invariant (P-mrb8yg9x001gf984). ───────────
|
|
1172
|
+
// Defense-in-depth mirror of the existing-branch (4b) invariant above
|
|
1173
|
+
// (W-mrb6an8300058fd8). Ordinarily the WRONG-BASE GUARD earlier in this
|
|
1174
|
+
// path (Step 4d-i) already normalizes originalRef to mainRef whenever HEAD
|
|
1175
|
+
// started off a non-mainRef branch and !allowNonMainBase — but that
|
|
1176
|
+
// normalization only runs inside the `headBranch !== mainRef` branch of
|
|
1177
|
+
// that guard. If some future change to that guard (or to the
|
|
1178
|
+
// auto-base-repair / STALE-BASE divergence logic sitting between it and
|
|
1179
|
+
// here) leaves originalRef still pointing at a leftover engine-managed
|
|
1180
|
+
// branch instead of a sane restore target, it would otherwise flow straight
|
|
1181
|
+
// through to the return below and propagate into
|
|
1182
|
+
// restoreLiveCheckoutAtDispatchEnd at dispatch end — the exact
|
|
1183
|
+
// contamination class W-mrb6an8300058fd8 fixed on the 4b path. Apply the
|
|
1184
|
+
// SAME `_looksLikeAgentBranch` check here (same `!allowNonMainBase` gate —
|
|
1185
|
+
// an explicit PR-continuation / shared-branch dispatch still intentionally
|
|
1186
|
+
// bypasses this, exactly as it does on the 4b path) so the new-branch-fork
|
|
1187
|
+
// path can never silently regress that invariant.
|
|
1188
|
+
if (!allowNonMainBase && originalRefType === 'branch' && originalRef && originalRef !== mainRef &&
|
|
1189
|
+
_looksLikeAgentBranch(originalRef)) {
|
|
1190
|
+
logFn(
|
|
1191
|
+
`[live-checkout] originalRef anomaly: HEAD's captured originalRef '${originalRef}' still looks like an engine-managed branch after forking '${branchName}' — this looks like leftover contamination from an earlier dispatch that should have been corrected to '${mainRef}' already. Attempting to correct it now.`,
|
|
1192
|
+
'warn'
|
|
1193
|
+
);
|
|
1194
|
+
const corrected = await _resolveMainRefForRestore({ git, baseOpts, mainRef, autoBaseRepair, _resolveAutoBaseRepair, localPath, logFn });
|
|
1195
|
+
if (corrected.ref) {
|
|
1196
|
+
originalRef = corrected.ref;
|
|
1197
|
+
originalRefType = corrected.type;
|
|
1198
|
+
} else {
|
|
1199
|
+
logFn(
|
|
1200
|
+
`[live-checkout] originalRef anomaly: could not resolve '${mainRef}' as a corrected restore target (no local ref, auto-base-repair disabled, or 'origin/${mainRef}' missing) — leaving originalRef as the contaminated '${originalRef}'; a human should verify the operator checkout manually.`,
|
|
1201
|
+
'warn'
|
|
1202
|
+
);
|
|
1203
|
+
}
|
|
1204
|
+
}
|
|
1171
1205
|
return { ok: true, branch: branchName, created: true, originalRef, originalRefType };
|
|
1172
1206
|
}
|
|
1173
1207
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@yemi33/minions",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2353",
|
|
4
4
|
"description": "Multi-agent AI dev team that runs from ~/.minions/ — five autonomous agents share a single engine, dashboard, and knowledge base",
|
|
5
5
|
"bin": {
|
|
6
6
|
"minions": "bin/minions.js"
|