Implement git pull and npm install steps in scripts/local-install.mjs #88

Closed
opened 2026-08-27 23:59:07 +00:00 by david · 1 comment
Owner

Summary

Implement Step 1 (git pull --ff-only) and Step 2 (npm install) in scripts/local-install.mjs so the script brings the checkout up to date before registering with pi, with actionable failure handling.

Background

Continues scripts/local-install.mjs, which was created with orchestration + Step 0 preflight in an earlier step of this plan. Once preflight passes (clean main in the right repo), the script must pull the latest code and install dependencies before registering with pi. Step 3 (pi registration) is implemented by the next step of this plan — keep its stub.

Depends on: #91 (Implement preflight checks and step orchestration in scripts/local-install.mjs).

Implementation Details

  • Step 1 — git pull: run git pull --ff-only in the repo root via spawnSync. On failure (offline, auth, or merge conflict) print to stderr: pull failed: <stderr> — check your network/credentials and exit non-zero.
  • Step 2 — npm install: run npm install in the repo root via spawnSync. On failure print to stderr: npm install failed: <stderr> and exit non-zero.
  • Preserve ordering (pull before install); proceed to Step 3 only on success (the Step-3 stub still exits non-zero with its "not yet implemented" message).
  • Capture child stdout/stderr so error detail can be included in the failure messages.

Acceptance Criteria

  • On an up-to-date clean main in this repo, the script completes Steps 1–2 without error and reaches the Step-3 stub.
  • The pull failure path prints pull failed: including the underlying stderr detail and exits non-zero.
  • The npm-install failure path prints npm install failed: including the underlying stderr detail and exits non-zero.
  • git pull runs before npm install.
  • The script does not proceed to Step 3 when either Step 1 or Step 2 fails.

Test Plan

  • Happy path: on an up-to-date clean main, run node scripts/local-install.mjs → pull and npm install complete without error; script stops at the Step-3 stub.
  • Failure paths: covered by the unit tests (later step of this plan) via a mocked/injected command runner. Manually, simulate: make the remote unreachable (e.g. temporarily point origin at an invalid URL) to force a pull failure; or temporarily break package.json (invalid JSON) to force an npm-install failure — restore afterwards.
## Summary Implement Step 1 (`git pull --ff-only`) and Step 2 (`npm install`) in `scripts/local-install.mjs` so the script brings the checkout up to date before registering with pi, with actionable failure handling. ## Background Continues `scripts/local-install.mjs`, which was created with orchestration + Step 0 preflight in an earlier step of this plan. Once preflight passes (clean `main` in the right repo), the script must pull the latest code and install dependencies before registering with pi. Step 3 (pi registration) is implemented by the next step of this plan — keep its stub. **Depends on:** #91 (Implement preflight checks and step orchestration in scripts/local-install.mjs). ## Implementation Details - **Step 1 — git pull**: run `git pull --ff-only` in the repo root via `spawnSync`. On failure (offline, auth, or merge conflict) print to stderr: `pull failed: <stderr> — check your network/credentials` and exit non-zero. - **Step 2 — npm install**: run `npm install` in the repo root via `spawnSync`. On failure print to stderr: `npm install failed: <stderr>` and exit non-zero. - Preserve ordering (pull before install); proceed to Step 3 only on success (the Step-3 stub still exits non-zero with its "not yet implemented" message). - Capture child stdout/stderr so error detail can be included in the failure messages. ## Acceptance Criteria - [ ] On an up-to-date clean `main` in this repo, the script completes Steps 1–2 without error and reaches the Step-3 stub. - [ ] The pull failure path prints `pull failed:` including the underlying stderr detail and exits non-zero. - [ ] The npm-install failure path prints `npm install failed:` including the underlying stderr detail and exits non-zero. - [ ] `git pull` runs before `npm install`. - [ ] The script does not proceed to Step 3 when either Step 1 or Step 2 fails. ## Test Plan - Happy path: on an up-to-date clean `main`, run `node scripts/local-install.mjs` → pull and npm install complete without error; script stops at the Step-3 stub. - Failure paths: covered by the unit tests (later step of this plan) via a mocked/injected command runner. Manually, simulate: make the remote unreachable (e.g. temporarily point `origin` at an invalid URL) to force a pull failure; or temporarily break `package.json` (invalid JSON) to force an npm-install failure — restore afterwards.
david closed this issue 2026-08-28 00:57:35 +00:00
Author
Owner

pi-loop opened and merged a pull request for this issue: #96

pi-loop opened and merged a pull request for this issue: https://git.excelera.net/david/pi-extensions-and-skills/pulls/96
Sign in to join this conversation.
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
david/pi-extensions-and-skills#88
No description provided.