Skip to content

feat: build publishable Relay npm package - #47

Merged
krishna916 merged 8 commits into
mainfrom
agent/issue-40-publishable-npm-package
Aug 2, 2026
Merged

feat: build publishable Relay npm package#47
krishna916 merged 8 commits into
mainfrom
agent/issue-40-publishable-npm-package

Conversation

@krishna916

@krishna916 krishna916 commented Aug 1, 2026

Copy link
Copy Markdown
Owner

Closes #40

Summary

  • publish @krishna916/relay with one stable relay executable
  • package immutable runtime assets, migrations, skills, integrations, and version metadata
  • add cwd-independent runtime paths, CLI/MCP/UI dispatch, tarball inventory checks, and installed-prefix smoke
  • preserve MCPB metadata/native-build compatibility and document package operation

Verification

  • pnpm verify passed through formatting, lint, typecheck, coverage, build, metadata, and asset validation; final audit completed separately with registry access
  • pnpm verify:package passed from an isolated npm prefix and unrelated cwd
  • pnpm pack:tarball + pnpm verify:package:contents passed; normalized inventory contains 36 files and all four migrations
  • test suite: 570 passed, 5 skipped
  • pnpm test:mcpb:stage is skipped on Windows; Linux-only MCPB build/runtime evidence remains bounded to the supported Linux environment

Summary by CodeRabbit

  • New Features

    • Added support for publishing and installing Relay as an npm package.
    • Added packaged migrations, web assets, platform-aware database paths, and improved client-side route handling.
    • Added CLI routing for MCP, UI, task, and session commands.
  • Bug Fixes

    • Improved database path validation and packaged asset resolution.
    • Added safeguards against incomplete or unexpected package contents.
  • Documentation

    • Added npm distribution, licensing, and third-party notice documentation.
  • Tests

    • Expanded coverage for packaging, installation, runtime paths, routing, metadata, and database behavior.

@coderabbitai

coderabbitai Bot commented Aug 1, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@krishna916, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 6 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 063b5082-87ee-4595-b224-727f4dc817d3

📥 Commits

Reviewing files that changed from the base of the PR and between 8223a8e and d5dd521.

📒 Files selected for processing (11)
  • package.json
  • scripts/package/inspect-tarball.ts
  • scripts/package/verify-package-metadata.ts
  • scripts/validate-mcpb-assets.ts
  • src/interfaces/http/create-http-server.ts
  • src/interfaces/mcp/main.ts
  • tests/integration/package-tarball.test.ts
  • tests/integration/packaged-assets.test.ts
  • tests/unit/interfaces/cli/run-relay.test.ts
  • tests/unit/interfaces/http/create-http-server.test.ts
  • tests/unit/scripts/package/verify-package-metadata.test.ts
📝 Walkthrough

Walkthrough

The PR makes Relay publishable as @krishna916/relay, stages required assets, validates package contents and metadata, adds installed-package smoke tests, centralizes runtime path resolution, and wires packaged CLI, MCP, and UI execution.

Changes

npm distribution and installed runtime

Layer / File(s) Summary
Package contract and asset staging
package.json, scripts/package/*, scripts/mcpb/*, scripts/validate-*, tsup.config.ts, README.md, docs/distribution/*
Relay now has publishable MIT metadata, one relay executable, deterministic asset staging, package allowlists, tarball validation, native-build constraints, and distribution documentation.
Tarball inspection and installed-package verification
scripts/package/inspect-tarball.ts, scripts/package/smoke-installed-package.ts, tests/integration/package-tarball.test.ts, tests/integration/installed-package.test.ts
The PR inspects archive inventories and verifies installed CLI, database, MCP, UI, version, cleanup, and isolated-prefix behavior.
Runtime paths and packaged assets
src/distribution/*, src/database/*, src/shared/package-metadata.ts, tests/unit/distribution/*, tests/integration/packaged-assets.test.ts
Runtime paths use platform defaults and validated database-path precedence. Package assets, versions, and migrations resolve from the installed package.
CLI, MCP, and UI command wiring
src/interfaces/cli/*, src/interfaces/mcp/*, src/interfaces/http/*, src/interfaces/production-dependencies.ts, tests/unit/interfaces/*, tests/integration/http-health.test.ts
The CLI dispatches task, session, MCP, and UI commands. MCP and UI startup is guarded, and extensionless UI routes fall back to the web shell.

Estimated code review effort: 4 (Complex) | ~60 minutes

Possibly related issues

  • #40: The PR implements the publishable npm package, stable relay executable, asset allowlisting, runtime paths, and installed-package verification.
  • #44: The PR adds the automated installed-package, persistence, UI/MCP, and package verification described by this issue.
  • #43: The PR adds package metadata checks, tarball inspection, installation smoke tests, and verification gates.

Possibly related PRs

  • krishna916/relay#31: Shares the CLI entrypoint, package binary, and build configuration areas.
  • krishna916/relay#34: Shares package verification, runtime database paths, MCP/CLI entrypoints, and integration infrastructure.
  • krishna916/relay#45: Shares package and MCPB configuration for pnpm.onlyBuiltDependencies and the tmp override.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly describes the primary change: building a publishable Relay npm package.
Linked Issues check ✅ Passed The changes implement the package, stable relay command, asset resolution, allowlisting, metadata checks, and isolated smoke tests required by [#40].
Out of Scope Changes check ✅ Passed The changes support packaging, runtime resolution, verification, documentation, licensing, and review fixes without unrelated code changes.
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch agent/issue-40-publishable-npm-package

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@krishna916 krishna916 left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review verdict: Changes required before merge

The implementation is broadly well structured and CI is green, but one packaging-safety requirement is not met.

High — Tarball validation is not a positive allowlist

inspectTarball() only checks that required entries exist and that entries do not match a small forbidden-pattern list. Any unexpected file that does not match those patterns is accepted. For example, an accidentally committed file under integrations/, skills/, or dist/ would be published without failing package verification.

Issue #40 explicitly requires package-content allowlisting and inspection, and the implementation plan calls for rejecting every unapproved tarball path. Please define the complete expected inventory (allowing only intentional hashed web filenames through a narrowly bounded pattern) and fail when entries contains anything outside that allowlist.

The check should report three categories independently:

  • missing required entries
  • unexpected/unapproved entries
  • explicitly forbidden sensitive entries

Add a regression test that injects an otherwise harmless unexpected path such as package/integrations/internal-notes.txt or package/dist/debug.txt and proves inspection fails.

Medium — Avoid hard-coded application version in installed smoke

scripts/package/smoke-installed-package.ts compares MCP and HTTP health against the literal 0.1.0. This will make the package smoke fail on the first version bump even when all shipped components correctly use the new package version. Read the expected version from the source/tarball package metadata once and compare every runtime against that value. This also better verifies the issue requirement that one application version covers CLI, MCP, UI, and assets.

Medium — Do not accept RELAY_DB_PATH=:memory: in installed operation

resolveRuntimePaths() exempts :memory: regardless of whether the value came from explicit in-process injection or RELAY_DB_PATH. The approved #39 contract permits test/internal injection but requires installed environment overrides to be absolute. Preserve :memory: only for explicitDatabasePath; reject it when supplied through RELAY_DB_PATH.

After these changes, rerun pnpm verify, tarball inspection, installed-prefix smoke, and the MCPB staging regression checks.

Comment thread scripts/package/inspect-tarball.ts Outdated
const forbidden = entries.filter((path) =>
FORBIDDEN_PACKAGE_PATTERNS.some((pattern) => pattern.test(path)),
);
const webAssets = entries.filter((path) =>

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a denylist plus required-file check, not the exact positive allowlist required by #40. Compute unexpected = entries.filter(entry => !isApproved(entry)) and fail for every unapproved path. Keep the web hashed-asset allowance narrow, and add a regression test using an unexpected file under an otherwise published directory.

env: { ...process.env, RELAY_DB_PATH: databasePath },
stderr: 'pipe',
});
const client = new Client({ name: 'relay-installed-package-smoke', version: '1.0.0' });

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The expected application version should come from package metadata, not the literal 0.1.0. Otherwise the smoke test becomes stale on every release and does not prove cross-component version consistency against the package being tested.

const candidate = input.explicitDatabasePath ?? env.RELAY_DB_PATH;
if (candidate !== undefined) {
const normalized = candidate.trim();
if (!normalized)

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This exception also permits RELAY_DB_PATH=:memory:. The #39 contract allows internal/test injection precedence but requires the installed environment override to be absolute. Apply the :memory: exception only when explicitDatabasePath supplied the candidate.

Copy link
Copy Markdown
Owner Author

Luna review-fix implementation plan

I added an execution-ready Superpowers plan directly to this PR branch:

docs/superpowers/plans/2026-08-01-pr-47-review-fixes.md

Commit: 1d96b42a457f8603429b56e0f8e48bb6c5cdb905

Luna should execute it task-by-task with superpowers:executing-plans.

The plan is intentionally limited to the three review findings:

  1. replace the tarball denylist/required-file check with a fail-closed positive allowlist and regression tests
  2. derive MCP/UI smoke-test version expectations from the package metadata being packed
  3. allow :memory: only through explicit internal/test injection, never through RELAY_DB_PATH

It includes exact file changes, test cases, implementation sketches, focused verification commands, commit boundaries, review-thread reply text, and a final human verification gate. Do not broaden the PR into setup, doctor, release, or packaging architecture redesign.

@krishna916 krishna916 left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-review complete.

The three requested changes are correctly addressed:

  • tarball inventory now fails closed through isApprovedPackagePath, with narrow generated Vite-asset patterns and regression tests for unexpected files;
  • installed MCP/UI version checks derive the expected version from package metadata rather than hard-coding 0.1.0;
  • :memory: is accepted only for explicit internal/test injection, while RELAY_DB_PATH=:memory: is rejected as non-absolute.

I found no remaining issue in those fixes.

One merge blocker remains: CI run 30708321527 is failing in tests/integration/mcpb-stage.test.ts because it asserts that staging must emit a chunk-*.js file. The same run proves the staged MCPB server starts successfully with native SQLite, so this appears to be a brittle build-shape assertion rather than a runtime failure. Update the test to verify required staged runtime behavior/files without requiring a chunk filename, then rerun the full CI gate. After CI is green, this is ready from my review perspective.

Copy link
Copy Markdown
Owner Author

MCPB CI assertion fix

Root cause: the current tsup.config.ts uses bundle: true and splitting: false, so the Linux build legitimately emits a single bundled MCP entry at dist/mcp/main.js and no top-level chunk-*.js files. The MCPB stage copies optional chunks when present; requiring one in the integration test was a brittle bundler-shape assertion, not a staging defect.

Files changed:

  • tests/integration/mcpb-stage.test.ts

The test now verifies behavior and required artifacts: server/main.js exists, the staged better-sqlite3 addon resolves inside the stage and loads, transitive dependencies remain materialized without archive-fragile symlinks, the server starts from an unrelated working directory, MCP stdout remains protocol-only, and startup failures are reported through stderr. It no longer requires optional chunk naming or code-splitting output. An incomplete stage still fails when the entry point or native addon is missing, when dependencies are symlinks, or when runtime/startup behavior breaks.

Verification:

  • Local pnpm test:mcpb:stage: exit 0; 4 Linux-only tests skipped on Windows.
  • Local pnpm verify:mcpb:stage: correctly blocked by the Windows platform guard; Linux-only.
  • Local pnpm verify: exit 0; 51 test files passed, 577 tests passed, coverage thresholds passed.
  • GitHub Actions run 30710360807, job 91396624391: green. Linux MCPB staging, staged integration tests, validation, runtime verification, and pack/inspect all passed.

@krishna916 krishna916 left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-review complete. The brittle chunk-*.js assertion has been removed and replaced with behavior-relevant checks for the staged MCP entry point and loadable native better-sqlite3 dependency. The existing tests continue to verify dependency materialization, unrelated-CWD startup, protocol-clean stdout, and stderr startup failures. The latest CI run is green. I found no remaining correctness blockers from this review cycle.

Before merge, complete the issue #40 human gate: inspect the final tarball inventory and manually run the installed command outside the checkout. The PR is also still marked draft, and its verification summary/test counts should be refreshed before marking it ready.

@krishna916
krishna916 marked this pull request as ready for review August 1, 2026 17:32

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

🧹 Nitpick comments (5)
scripts/validate-mcpb-assets.ts (1)

100-109: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Reuse the shared pnpm constants instead of hardcoding them again.

REQUIRED_PNPM_OVERRIDES and REQUIRED_ONLY_BUILT_DEPENDENCIES are already exported from scripts/package/verify-package-metadata.ts and imported by scripts/mcpb/model.ts. This file re-hardcodes the same values ({ tmp: '0.2.7' } and ['better-sqlite3', 'esbuild']) instead of importing the constants. If the required override or build-approval list changes, one call site can be updated while this one silently drifts out of sync, weakening the check.

♻️ Proposed fix to import shared constants
+import {
+  REQUIRED_ONLY_BUILT_DEPENDENCIES,
+  REQUIRED_PNPM_OVERRIDES,
+} from '../package/verify-package-metadata.js';
+
   const rootPnpm = (
     root as { pnpm?: { overrides?: Record<string, string>; onlyBuiltDependencies?: string[] } }
   ).pnpm;
-  if (JSON.stringify(rootPnpm?.overrides) !== JSON.stringify({ tmp: '0.2.7' }))
+  if (JSON.stringify(rootPnpm?.overrides) !== JSON.stringify(REQUIRED_PNPM_OVERRIDES))
     fail('Root pnpm metadata must preserve the tmp 0.2.7 override.');
   if (
     JSON.stringify(rootPnpm?.onlyBuiltDependencies) !==
-    JSON.stringify(['better-sqlite3', 'esbuild'])
+    JSON.stringify(REQUIRED_ONLY_BUILT_DEPENDENCIES)
   )
     fail('Root pnpm metadata must approve better-sqlite3 and esbuild builds.');
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@scripts/validate-mcpb-assets.ts` around lines 100 - 109, Update the pnpm
metadata checks in the validation flow to import and reuse
REQUIRED_PNPM_OVERRIDES and REQUIRED_ONLY_BUILT_DEPENDENCIES from
scripts/package/verify-package-metadata.ts instead of hardcoding the object and
array literals. Keep the existing JSON comparisons and failure messages while
referencing the shared constants.
scripts/package/verify-package-metadata.ts (1)

21-49: 🔒 Security & Privacy | 🔵 Trivial | ⚡ Quick win

Add dedicated unit tests for the duplicate-key scanner.

countTopLevelKey is a hand-rolled JSON scanner that gates a supply-chain-relevant check: it detects a duplicate top-level "pnpm" key that JSON.parse would otherwise silently resolve to the last occurrence. This guard is the kind of logic that most needs direct test coverage, since a subtle bug in it (for example, around escaped quotes or nested arrays) would silently weaken the anti-tampering check it exists to provide.

No dedicated unit test file for this module appears in the reviewed files. Add unit tests that cover: single vs. duplicate top-level pnpm keys, a nested (non-top-level) key named pnpm, and escaped quotes inside string values near the key.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@scripts/package/verify-package-metadata.ts` around lines 21 - 49, Add a
dedicated unit test suite for countTopLevelKey covering one versus multiple
top-level "pnpm" keys, nested "pnpm" keys that must not count, and escaped
quotes in nearby string values. Keep the tests focused on the scanner’s returned
count and ensure duplicate detection remains reliable for valid JSON-like input.
scripts/package/inspect-tarball.ts (1)

11-25: 🔒 Security & Privacy | 🔵 Trivial | ⚡ Quick win

Harden readTarEntries against extended tar headers.

readTarEntries parses only USTAR name, prefix, and size without reading the header typeflag or handling GNU long-name ('L') / PAX extended-header ('x' or 'g') entries. A future tarball with paths above the plain header limits would be parsed as the wrong file instead of failing early, which weakens this fail-closed inventory check. Add an unsupported typeflag guard or switch to an existing tar parser.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@scripts/package/inspect-tarball.ts` around lines 11 - 25, Harden
readTarEntries by inspecting each tar header’s typeflag and rejecting
unsupported GNU long-name ('L') and PAX extended-header ('x' or 'g') entries
instead of treating them as regular files. Preserve normal USTAR name, prefix,
size parsing, and fail closed with a clear error when these extended headers are
encountered.
tests/unit/distribution/package-metadata.test.ts (1)

1-32: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Test file location does not mirror the source it tests.

This file lives at tests/unit/distribution/package-metadata.test.ts, but it tests scripts/package/verify-package-metadata.ts. Move it to tests/unit/scripts/package/verify-package-metadata.test.ts to mirror the source area.

As per coding guidelines, tests/unit/**/*.test.ts: "Place backend unit tests under tests/unit/, mirroring their source area."

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@tests/unit/distribution/package-metadata.test.ts` around lines 1 - 32, Move
the package metadata test containing describe and verifyPackageMetadata to
tests/unit/scripts/package/verify-package-metadata.test.ts so its location
mirrors scripts/package/verify-package-metadata.ts. Preserve the existing test
cases and imports unchanged.

Source: Coding guidelines

tests/integration/packaged-assets.test.ts (1)

7-25: 🩺 Stability & Availability | 🔵 Trivial | ⚡ Quick win

Stage assets into an isolated directory instead of the live repo checkout.

This test calls stagePackageAssets() without a rootDir, so it writes assets/migrations directly into the project checkout, per stagePackageAssets's resolve(options.rootDir ?? process.cwd()) behavior. Other packaging tests in this PR use isolated fixtures (for example tests/fixtures/package-root/package.json) for the same kind of validation.

Running this test concurrently with other integration tests that touch assets/ risks file collisions, and a process crash before afterEach runs would leave staged files in the repository checkout. Pass an isolated rootDir (with the required prerequisite files staged) instead of relying on process.cwd().

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@tests/integration/packaged-assets.test.ts` around lines 7 - 25, Update the
test around stagePackageAssets to create and use an isolated fixture rootDir
containing the required package prerequisites, then pass that rootDir explicitly
when staging assets. Update the staged migration and relay database assertions
to resolve paths under the isolated root, and retain cleanup for the temporary
fixture.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@package.json`:
- Around line 2-22: Add a publishConfig entry in package.json for the scoped
package `@krishna916/relay`, setting its npm access to public so the standard npm
publish command succeeds with the intended visibility.

In `@src/interfaces/http/create-http-server.ts`:
- Around line 43-46: Change createHttpServer so the default web root from
resolvePackageAssets() is resolved once during server initialization, then pass
that captured directory into getStaticAsset or resolveStaticAsset for every
request. Remove the per-request default evaluation in resolveStaticAsset and
preserve the supplied options.assets override behavior.

In `@src/interfaces/mcp/main.ts`:
- Around line 6-9: Update runMcpServer to preserve the boolean result from
runMcpServerWithDependencies and return the corresponding numeric exit code,
yielding success for a true result and failure for a false startup result.
Ensure this value propagates through runRelay without allowing the MCP wrapper
to default failures to zero.

---

Nitpick comments:
In `@scripts/package/inspect-tarball.ts`:
- Around line 11-25: Harden readTarEntries by inspecting each tar header’s
typeflag and rejecting unsupported GNU long-name ('L') and PAX extended-header
('x' or 'g') entries instead of treating them as regular files. Preserve normal
USTAR name, prefix, size parsing, and fail closed with a clear error when these
extended headers are encountered.

In `@scripts/package/verify-package-metadata.ts`:
- Around line 21-49: Add a dedicated unit test suite for countTopLevelKey
covering one versus multiple top-level "pnpm" keys, nested "pnpm" keys that must
not count, and escaped quotes in nearby string values. Keep the tests focused on
the scanner’s returned count and ensure duplicate detection remains reliable for
valid JSON-like input.

In `@scripts/validate-mcpb-assets.ts`:
- Around line 100-109: Update the pnpm metadata checks in the validation flow to
import and reuse REQUIRED_PNPM_OVERRIDES and REQUIRED_ONLY_BUILT_DEPENDENCIES
from scripts/package/verify-package-metadata.ts instead of hardcoding the object
and array literals. Keep the existing JSON comparisons and failure messages
while referencing the shared constants.

In `@tests/integration/packaged-assets.test.ts`:
- Around line 7-25: Update the test around stagePackageAssets to create and use
an isolated fixture rootDir containing the required package prerequisites, then
pass that rootDir explicitly when staging assets. Update the staged migration
and relay database assertions to resolve paths under the isolated root, and
retain cleanup for the temporary fixture.

In `@tests/unit/distribution/package-metadata.test.ts`:
- Around line 1-32: Move the package metadata test containing describe and
verifyPackageMetadata to
tests/unit/scripts/package/verify-package-metadata.test.ts so its location
mirrors scripts/package/verify-package-metadata.ts. Preserve the existing test
cases and imports unchanged.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: def6d850-aa5d-44b4-9af5-5d7edba7653b

📥 Commits

Reviewing files that changed from the base of the PR and between fed818a and 8223a8e.

📒 Files selected for processing (45)
  • .gitignore
  • .prettierignore
  • LICENSE
  • README.md
  • THIRD_PARTY_NOTICES.md
  • docs/distribution/npm-package.md
  • docs/superpowers/plans/2026-08-01-pr-47-review-fixes.md
  • package.json
  • scripts/mcpb/model.ts
  • scripts/mcpb/stage-linux-mcpb.ts
  • scripts/package/inspect-tarball.ts
  • scripts/package/package-files.ts
  • scripts/package/smoke-installed-package.ts
  • scripts/package/stage-package-assets.ts
  • scripts/package/verify-package-metadata.ts
  • scripts/validate-mcpb-assets.ts
  • scripts/validate-repository-assets.ts
  • src/database/database-config.ts
  • src/database/migrate.ts
  • src/distribution/package-assets.ts
  • src/distribution/package-version.ts
  • src/distribution/platform-paths.ts
  • src/distribution/resolve-runtime-paths.ts
  • src/interfaces/cli/main.ts
  • src/interfaces/cli/run-relay.ts
  • src/interfaces/http/create-http-server.ts
  • src/interfaces/http/http-router.ts
  • src/interfaces/http/main.ts
  • src/interfaces/mcp/main.ts
  • src/interfaces/production-dependencies.ts
  • src/shared/package-metadata.ts
  • tests/fixtures/package-root/package.json
  • tests/fixtures/package-smoke/README.md
  • tests/integration/http-health.test.ts
  • tests/integration/installed-package.test.ts
  • tests/integration/mcpb-stage.test.ts
  • tests/integration/package-tarball.test.ts
  • tests/integration/packaged-assets.test.ts
  • tests/unit/database/connection.test.ts
  • tests/unit/distribution/package-assets.test.ts
  • tests/unit/distribution/package-metadata.test.ts
  • tests/unit/distribution/runtime-paths.test.ts
  • tests/unit/interfaces/cli/run-relay.test.ts
  • tests/unit/scripts/mcpb/stage-linux-mcpb.test.ts
  • tsup.config.ts

Comment thread package.json
Comment thread src/interfaces/http/create-http-server.ts Outdated
Comment thread src/interfaces/mcp/main.ts Outdated

Copy link
Copy Markdown
Owner Author

Addressed the remaining review findings in commit d5dd521.

Root cause: the package metadata and packaging helpers had a few independent correctness/maintainability gaps. HTTP asset resolution evaluated the default package root per request, the MCP wrapper discarded the startup boolean so runRelay could convert failure to exit code 0, tar inspection accepted unsupported GNU/PAX extended headers as ordinary entries, and the package metadata/staging tests were not fully aligned with the scripts they exercise.

Files changed:

  • package.json
  • src/interfaces/http/create-http-server.ts
  • src/interfaces/mcp/main.ts
  • scripts/package/inspect-tarball.ts
  • scripts/package/verify-package-metadata.ts
  • scripts/validate-mcpb-assets.ts
  • tests/integration/package-tarball.test.ts
  • tests/integration/packaged-assets.test.ts
  • tests/unit/interfaces/cli/run-relay.test.ts
  • tests/unit/interfaces/http/create-http-server.test.ts
  • moved tests/unit/distribution/package-metadata.test.ts to tests/unit/scripts/package/verify-package-metadata.test.ts

The assertions are behavior-oriented: packaged-assets tests stage into an isolated fixture root; tar tests verify unsupported headers fail closed; the metadata scanner tests verify top-level counting while ignoring nested keys and escaped strings; HTTP tests use an explicit captured root; and runRelay tests verify non-zero MCP exit propagation. No artificial bundler chunks were added.

Verification:

  • Focused suite: 5 files passed, 29 tests passed.
  • pnpm test:mcpb:stage: exit 0; 1 file and 4 tests skipped by the Windows platform guard.
  • pnpm verify: passed; 51 files passed, 1 skipped; 585 tests passed, 5 skipped; coverage 88.71% statements, 80.83% branches, 88.99% functions, 91.03% lines; build, metadata, assets, and high-severity audit checks passed.
  • pnpm verify:mcpb:stage: not executable on this Windows checkout because the script explicitly requires Linux; local WSL enumeration was unavailable. The Linux-only CI job remains the authoritative MCPB verification.

@krishna916
krishna916 merged commit 941dab2 into main Aug 2, 2026
2 checks passed
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.

Build the publishable Relay npm package and stable executable

1 participant