issue-88: Implement git pull and npm install steps in scripts/local-install.mjs #96
No reviewers
Labels
No labels
bug
chore
documentation
enhancement
feature
ready
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
david/pi-extensions-and-skills!96
Loading…
Reference in a new issue
No description provided.
Delete branch "feature/issue-88/implement-git-pull-and-npm-install-steps-in-script"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
88: Implement git pull and npm install steps in scripts/local-install.mjs
Implements 88.
Generated in 34m 00s.
Review findings
Now let me check the CHANGELOG and docs referenced by the findings:
The working tree is clean (changes committed on the feature branch), and
npm testis the only gate. Let me check the docs that pin down the failure-message formats before changing them:The grep tool mangled the multi-word pattern. Let me use bash directly:
The inline format is pinned in both CHANGELOG.md:11 and docs/IMPLEMENTATION_PLAN.md:42,45. Let me see the plan doc context:
I now have the full picture. Applying fixes highest severity first:
Medium — test coverage for
failureDetail()fallback branches: add a silent-fail pull shim mode + test.Low — multi-line failure messages: restructure
gitPull/npmInstallfail messages, and update CHANGELOG + plan doc which pin the format.Low — blank line on empty output: guard the
console.log.Now update the docs that pin the message format (CHANGELOG per the finding, plus the plan doc for consistency):
Now the test file — extract the shared
withMockedExithelper (Low finding), add the silent-fail shim mode + exit-status test (Medium finding), and pin the new multi-line message layout:Now run the project's test gate (only
testscript exists in package.json — no build/lint):One regression: in my edit of
runMainAndCaptureAbortI droppednpmFailsfrom themakeShimDircall. Fixing:All 35 tests pass (34 prior + 1 new). Final sanity check — verify the working-tree diff and that no stale references to the old inline format remain:
The README hit is just a preflight remediation table row (advice, not message format) — fine. But
package.json/package-lock.jsonshow unexpected changes I didn't make. Let me inspect:I found that my earlier grep command with unquoted patterns accidentally executed
npm install failedin the repo, adding an unwanted dependency. I'll revert those changes now.Working tree now contains only the four intended files. Re-running the gate once more to confirm green state:
All gates green (35/35, up from 34 with the new test). All four findings are resolved; here is the annotated findings document.
Review Findings — 88
Summary
All four findings fixed in a single pass: (1) added a
pullSilentFailshim mode (pull case body is justexit 1) plus a test covering thefailureDetail()exit-status fallback; (2) failure details now print on their own line(s) below thepull failed:/npm install failed:header, with CHANGELOG.md and docs/IMPLEMENTATION_PLAN.md updated to match; (3) empty step output no longer prints a blank line (if (out)guard in both steps); (4) extracted a sharedwithMockedExit(fn)helper reused byrunPreflightAndCaptureAbort,runMainAndCaptureAbort, and the "main warns and continues" test. Gate:npm testpasses 35/35 (incl. 1 new test). No build/lint scripts exist at repo root. Nothing remains unresolved.Critical
(empty)
High
(empty)
Medium
failureDetail()helper (scripts/local-install.mjs:241) has four branches but only the stderr branch is exercised; the fallbacks (non-zero exit with no output →exit status N, spawn error → ENOENT message, which I verified are reachable viaspawnSync) have no test coverage. Suggested fix: add a shim mode where thepullcase body is justexit 1(no stderr), then assert the captured abort message matches/pull failed: exit status 1/.Low
Aborted:message, so the trailing hint lands mid-block on the last line of stderr (git/npm failures are typically multi-line), e.g.Aborted: pull failed: line1\nline2 — check your network/credentials. Suggested fix: put the detail on its own line(s), e.g.fail(\pull failed:\n${failureDetail(result)}\nCheck your network/credentials`)`; note CHANGELOG.md documents the current inline format, so update it if changed.console.log(combinedOutput(result))prints a blank line when the step produced no output (same at :355 for npm install). Suggested fix: guard withconst out = combinedOutput(result); if (out) console.log(out);.runMainAndCaptureAbortduplicates the env-patch +process.exit/console.errormock scaffolding already present inrunPreflightAndCaptureAbort(~line 108) and inline in the "main warns and continues" test. Suggested fix: extract a shared helper (e.g.withMockedExit(fn)) returning{ stderr, aborted }and reuse it in all three places.