Skip to content

MS7 — Distribution & Release: npx nirmiqcodesensei, CHANGELOG, scaling-N/A ADR#10

Merged
SheeshDarth merged 2 commits into
masterfrom
feat/ms7-distribution
Jul 17, 2026
Merged

MS7 — Distribution & Release: npx nirmiqcodesensei, CHANGELOG, scaling-N/A ADR#10
SheeshDarth merged 2 commits into
masterfrom
feat/ms7-distribution

Conversation

@SheeshDarth

Copy link
Copy Markdown
Owner

Final megasprint of the REVIEW-011 program. Turns the repo into installable software.

cd your-project && npx nirmiqcodesensei@latest

What lands

  • npx nirmiqcodesensei — ships MS6's standalone build. scripts/pack-standalone.mjs assembles dist/ (standalone + .next/static), strips the build machine's native binaries, and hard-fails if a database, dotenv, git history or .node binary reaches the bundle.
  • One tarball, every OS — native modules resolve per-platform at install time rather than being baked in at build time.
  • MCP works from a published install — bundled with esbuild at prepack (CJS), so no dev toolchain needed.
  • CHANGELOG.md + scaling-N/A ADR (REVIEW-013).

Verified, not asserted

Installed the real tarball into an empty directory:

Check Result
/dashboard, /workspaces, /workspaces/import HTTP 200
Database location the user's cwd, not node_modules
Migrations at runtime 11 applied, 9 tables
MCP handshake 12 tools, stdout pure JSON-RPC
Tarball contents no db / dotenv / .node / .git / imported projects
Binding 127.0.0.1 only

Five ship-blockers a green build could not see

Every one was invisible to lint, typecheck, build and 24 passing tests:

  1. Privacy leak — file tracing copied data/ into the bundle: the local database and the user's imported projects, including their .git. outputFileTracingExcludes does not stop it (tried; zero effect). Publishing would have shipped a third party's source.
  2. Silent data destruction — standalone server.js chdirs to its own dir, so the DB resolved to node_modules/…/dist/data/. Every npx …@latest would have wiped the user's learning history.
  3. LAN exposureserver.js defaults HOSTNAME to 0.0.0.0 on a 127.0.0.1-only product.
  4. Installs but can't boot — the traced .gitignore made npm drop node_modules/ and .next/ from the tarball. npm publish would have succeeded.
  5. 500s every request — Turbopack requires external packages by hashed name, so removing the build machine's better-sqlite3 broke it. Replaced with a shim delegating to the platform-correct copy.

Plus: MCP banner corrupting the JSON-RPC stream, an ESM bundle crashing on __filename, %20 in install paths, and eslint OOM-crashing on dist/.

Gate

lint + typecheck + build + 24/24.

Not in this PR

The v1.0.0 tag and GitHub Release await explicit go-ahead; npm publish is the maintainer's to run.

🤖 Generated with Claude Code

SheeshDarth and others added 2 commits July 16, 2026 21:48
Turns the repo into distributable software. The old launcher assumed a repo
checkout and ran `next dev`; the package was `private: true` and MS6's
standalone build was never shipped. Verified end to end by installing the
real tarball into an empty directory: HTTP 200, runtime-migrated DB, MCP
handshake.

Design: ship the prebuilt standalone server, let npm resolve native modules
per platform. scripts/pack-standalone.mjs assembles dist/ (standalone +
.next/static), strips the build machine's native binaries, and hard-fails if
a database, dotenv, git history or .node binary reaches the bundle.

Five bugs found only by installing the tarball, each of which would have
shipped a broken or unsafe 1.0:

- File tracing copies data/ into .next/standalone — the local database *and*
  the user's imported projects, including their .git. outputFileTracingExcludes
  does not stop it (tried; zero effect), so the pack script filters at copy
  time and asserts. Publishing would have leaked third-party source.
- Standalone server.js does process.chdir(__dirname), so the DB resolved to
  node_modules/nirmiqcodesensei/dist/data/ — every `npx …@latest` would have
  silently wiped the user's learning history. The launcher now pins
  NCS_DATA_DIR to the invoking cwd (the hook lib/db/client.ts already had).
- server.js defaults HOSTNAME to 0.0.0.0, exposing a 127.0.0.1-only product
  across the LAN. Launcher pins the loopback.
- The tracer copies the repo's .gitignore into the bundle; npm honours nested
  ignore files, so node_modules/ and .next/ were dropped from the tarball —
  publish succeeds, every install boots a server with nothing behind it.
- Turbopack requires serverExternalPackages by *hashed* name
  (better-sqlite3-90e2652d…), so deleting it 500s every request. Replaced with
  a shim delegating to the platform-correct copy npm installs.

MCP now works from a published install: bundled with esbuild at prepack (CJS —
an ESM bundle crashes on typescript-estree's __filename), and its banner moved
to stderr so stdout stays pure JSON-RPC.

Also: fileURLToPath for ROOT (%20 broke "C:\Program Files"), shell:false for
direct node spawns (space-safe args), and lint ignores dist/ (eslint OOM-crashed
walking the 12 MB bundle). Version 1.0.0 across package, MCP serverInfo, manifest.

Gate: lint + typecheck + build + 24/24 green.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Completes MS7's documentation criteria and closes out the REVIEW-011
megasprint program.

- CHANGELOG.md (Keep a Changelog) — first release entry for 1.0.0, leading
  with `npx nirmiqcodesensei@latest` and naming the distribution bugs that
  would otherwise have shipped.
- REVIEW-013 — the scaling-N/A ADR REVIEW-011 asked for: load balancing,
  horizontal scaling and traffic handling are out of scope *by design*, not
  deferred. A single-user, loopback-bound tool over a single-writer embedded
  SQLite database has no traffic to distribute and no replicas to balance; a
  second instance would contend for the WAL lock or fragment the user's
  history. Scaling here means per-machine analysis performance, which is
  measured (BENCHMARKS.md). Revisit only on a move to a hosted model — and
  re-architect the data tier first, which is the actual blocker.
- README leads with the npx path; MCP config uses `npx nirmiqcodesensei mcp`
  (the old `npm run mcp` + cwd form only works from a clone).
- Roadmap MS7 → ✅; REVIEW-011 → complete.
- PROJECT_DOSSIER: MS7 outcome, status, and a new §7 subsection on the
  distribution class of bugs — none were visible to lint, typecheck, build or
  24 passing tests; all five surfaced only from installing the real tarball.
  That is now the recorded verification step for packaging changes.

Gate: lint + typecheck + build + 24/24 green.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@SheeshDarth
SheeshDarth merged commit b8ab647 into master Jul 17, 2026
2 checks passed
@SheeshDarth
SheeshDarth deleted the feat/ms7-distribution branch July 17, 2026 03:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant