[PR #244] [MERGED] fix(cli): make clean source checkouts start reliably #1894

Closed
opened 2026-10-16 21:12:16 +00:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/morluto/rea/pull/244
Author: @morluto
Created: 7/15/2026
Status: ✅ Merged
Merged: 7/15/2026
Merged by: @morluto

Base: main ← Head: fix/source-checkout-startup


📝 Commits (1)

  • 6ba9765 fix(cli): make clean source checkouts start reliably

📊 Changes

5 files changed (+88 additions, -10 deletions)

View changed files

📝 CONTRIBUTING.md (+10 -5)
📝 package.json (+2 -3)
📝 scripts/rea.mjs (+35 -1)
📝 tests/dispatcher.test.ts (+29 -0)
📝 tests/identity.test.ts (+12 -1)

📄 Description

Description

A clean source checkout could persist MCP registrations to scripts/rea.mjs while its required, gitignored dist/ runtime was absent. npm ci installed dependencies but did not build that runtime, and both CLI and MCP startup failed with a raw ERR_MODULE_NOT_FOUND stack.

This change:

  • builds the compiled runtime in npm's documented prepare lifecycle, which covers clean source installs and package preparation;
  • removes the duplicate prepack build now owned by prepare;
  • routes npm start through the canonical dispatcher;
  • checks the route-specific compiled entrypoints before importing them and prints exact recovery for a source checkout or damaged installation;
  • documents the clean-checkout lifecycle and adds regressions for CLI and MCP startup.

The launcher does not build at runtime. If generated output is removed after preparation, it reports the checkout path and asks the user to run npm ci or reinstall the package instead of mutating the checkout during startup.

The related startup audit found no other public dist/ consumer without an explicit build prerequisite. Real Hopper/browser verifiers and the package verifier already build before importing generated modules.

Type of Change

  • Bug fix
  • New feature
  • Documentation update
  • Performance improvement
  • Refactoring (no functional change)
  • Tool contract change (MCP schema modification)

Testing Performed

  • Unit tests added or updated
  • TypeScript typecheck passes (npm run typecheck)
  • Linting passes (npm run lint)
  • Full test suite passes (npm test)
  • Real Hopper verification performed (npm run verify:hopper) — not run; provider launch and bridge behavior are unchanged
  • Linux real Hopper verification performed (npm run verify:hopper:linux) — not run; Linux provider behavior is unchanged
  • Real browser verification performed (npm run verify:browser) — not run; browser behavior is unchanged
  • Package verification performed (npm run verify:package)

Additional proof:

  • npx vitest run tests/dispatcher.test.ts tests/identity.test.ts --coverage.enabled=false
  • removed ignored dist/, then ran npm ci --foreground-scripts; dist/main.js, dist/cli.js, and dist/cliOutput.js were recreated, and CLI/MCP startup succeeded
  • npm run check
  • npm pack --dry-run --json; the package contains the MCP entrypoint, CLI entrypoint, and dispatcher
  • autoreview against the complete local diff: no accepted/actionable findings

Tool Contract Impact

None. The 78-tool MCP inventory and every input/output schema are unchanged.

Closes #243


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/morluto/rea/pull/244 **Author:** [@morluto](https://github.com/morluto) **Created:** 7/15/2026 **Status:** ✅ Merged **Merged:** 7/15/2026 **Merged by:** [@morluto](https://github.com/morluto) **Base:** `main` ← **Head:** `fix/source-checkout-startup` --- ### 📝 Commits (1) - [`6ba9765`](https://github.com/morluto/rea/commit/6ba97656ca73e97ae1dbecc15a86a193978298b6) fix(cli): make clean source checkouts start reliably ### 📊 Changes **5 files changed** (+88 additions, -10 deletions) <details> <summary>View changed files</summary> 📝 `CONTRIBUTING.md` (+10 -5) 📝 `package.json` (+2 -3) 📝 `scripts/rea.mjs` (+35 -1) 📝 `tests/dispatcher.test.ts` (+29 -0) 📝 `tests/identity.test.ts` (+12 -1) </details> ### 📄 Description ## Description A clean source checkout could persist MCP registrations to `scripts/rea.mjs` while its required, gitignored `dist/` runtime was absent. `npm ci` installed dependencies but did not build that runtime, and both CLI and MCP startup failed with a raw `ERR_MODULE_NOT_FOUND` stack. This change: - builds the compiled runtime in npm's documented [`prepare` lifecycle](https://docs.npmjs.com/cli/using-npm/scripts/#life-cycle-scripts), which covers clean source installs and package preparation; - removes the duplicate `prepack` build now owned by `prepare`; - routes `npm start` through the canonical dispatcher; - checks the route-specific compiled entrypoints before importing them and prints exact recovery for a source checkout or damaged installation; - documents the clean-checkout lifecycle and adds regressions for CLI and MCP startup. The launcher does not build at runtime. If generated output is removed after preparation, it reports the checkout path and asks the user to run `npm ci` or reinstall the package instead of mutating the checkout during startup. The related startup audit found no other public `dist/` consumer without an explicit build prerequisite. Real Hopper/browser verifiers and the package verifier already build before importing generated modules. ## Type of Change - [x] Bug fix - [ ] New feature - [x] Documentation update - [ ] Performance improvement - [ ] Refactoring (no functional change) - [ ] Tool contract change (MCP schema modification) ## Testing Performed - [x] Unit tests added or updated - [x] TypeScript typecheck passes (`npm run typecheck`) - [x] Linting passes (`npm run lint`) - [x] Full test suite passes (`npm test`) - [ ] Real Hopper verification performed (`npm run verify:hopper`) — not run; provider launch and bridge behavior are unchanged - [ ] Linux real Hopper verification performed (`npm run verify:hopper:linux`) — not run; Linux provider behavior is unchanged - [ ] Real browser verification performed (`npm run verify:browser`) — not run; browser behavior is unchanged - [x] Package verification performed (`npm run verify:package`) Additional proof: - `npx vitest run tests/dispatcher.test.ts tests/identity.test.ts --coverage.enabled=false` - removed ignored `dist/`, then ran `npm ci --foreground-scripts`; `dist/main.js`, `dist/cli.js`, and `dist/cliOutput.js` were recreated, and CLI/MCP startup succeeded - `npm run check` - `npm pack --dry-run --json`; the package contains the MCP entrypoint, CLI entrypoint, and dispatcher - autoreview against the complete local diff: no accepted/actionable findings ## Tool Contract Impact None. The 78-tool MCP inventory and every input/output schema are unchanged. ## Related Issues Closes #243 --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-16 21:12:16 +00:00
Sign in to join this conversation.
No milestone
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
morluto/rea#1894
No description provided.