feat: add npm-package-bundler-guard persona - #15
Conversation
Encodes hard-won lessons from repeated Turbopack deploy failures caused by misconfigured npm package exports (raw .ts in exports, missing dist in files, barrel re-export chains pulling unresolvable transitive deps). Catches: exports → .ts source, missing dist in files, file: deps, barrel chains with heavy deps, missing subpath exports for zero-dep utility modules, and missing bundler build steps in CI. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 8ddc6d700c
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| @@ -0,0 +1,25 @@ | |||
| { | |||
| "id": "npm-package-bundler-guard", | |||
| "intent": "npm-package-compat", | |||
There was a problem hiding this comment.
Register new persona intent in router wiring
Adding this intent in JSON alone does not make the persona usable: there are no other references to npm-package-compat/npm-package-bundler-guard in the repo, packages/workload-router/scripts/generate-personas.mjs only emits personas present in exportNameMap (this id is missing there, so generation skips it), and packages/workload-router/src/index.ts does not include this intent in PERSONA_INTENTS or personaCatalog. In practice, resolvePersona can never select this persona, so this commit is a functional no-op.
Useful? React with 👍 / 👎.
Encodes hard-won lessons from repeated Turbopack deploy failures caused by misconfigured npm package exports (raw .ts in exports, missing dist in files, barrel re-export chains pulling unresolvable transitive deps). Registers the persona across all four integration points: - personas/npm-package-bundler-guard.json (definition) - generate-personas.mjs exportNameMap - PERSONA_INTENTS + personaCatalog in index.ts - default routing profile (best-value tier) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
Adds a new npm-package-bundler-guard persona and wires it into the workload router under the npm-package-compat intent to flag npm package configurations that commonly break bundlers.
Changes:
- Adds
personas/npm-package-bundler-guard.jsondefining the new persona and tiered runtime config. - Wires the new persona into the workload-router intent catalog, default routing profile, and persona generation script.
- Updates routing profile tests/fixtures to include the new intent.
Reviewed changes
Copilot reviewed 5 out of 6 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| personas/npm-package-bundler-guard.json | Introduces the new persona definition and prompts for bundler/package.json compatibility auditing. |
| packages/workload-router/src/index.ts | Registers the new npm-package-compat intent and maps it to the generated persona spec. |
| packages/workload-router/src/index.test.ts | Updates the custom routing profile fixture to include the new intent. |
| packages/workload-router/src/generated/personas.ts | Adds the generated npmPackageBundlerGuard export used by the router. |
| packages/workload-router/scripts/generate-personas.mjs | Wires the new persona filename/id to an export name so it is included in generation output. |
| packages/workload-router/routing-profiles/default.json | Adds a default tier/rationale for the new npm-package-compat intent. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| }, | ||
| 'npm-package-compat': { | ||
| tier: 'best-value', | ||
| rationale: 'mechanical package.json audits' | ||
| } |
There was a problem hiding this comment.
A new intent/persona is introduced (npm-package-compat → npm-package-bundler-guard), but the tests never assert that resolvePersona('npm-package-compat') (or personaCatalog['npm-package-compat']) resolves to the expected persona/runtime from the default routing profile. Add a focused assertion to ensure this wiring doesn’t regress (e.g., personaId, tier, harness).
…, fix CI
- Add all missing intents to routing-profiles/schema.json (sage-slack-egress-migration, sage-proactive-rewire, cloud-slack-proxy-guard, sage-cloud-e2e-conduction, capability-discovery, npm-package-compat, posthog, persona-authoring, agent-relay-workflow, slop-audit, api-contract-review, local-stack-orchestration, e2e-validation, write-integration-tests)
- Add missing 'agent-relay-workflow' to custom routing profile in test fixture (fixes TS2741 CI failure)
- Add focused test asserting resolvePersona('npm-package-compat') resolves to npm-package-bundler-guard
Co-Authored-By: Khaliq Gant <khaliqgant@gmail.com>
- Remove duplicate agent-relay-workflow.json entry in README - Add missing persona files to README (api-contract-reviewer, docker-stack-wrangler, e2e-validator, integration-test-author, npm-package-bundler-guard) - Replace tautological skills.length >= 0 assertion with specific check (3 skills, first is skill.sh/writing-agent-relay-workflows) Co-Authored-By: Khaliq Gant <khaliqgant@gmail.com>
Summary
Adds a new persona that catches npm package misconfigurations that break bundlers (Turbopack, webpack, esbuild).
Born from repeated deploy failures where:
exportspointed to raw.tssource files — Turbopack can't handle.tsfromnode_modulesfilesonly includedsrc, notdist— published packages had no compiled output@relayfile/adapter-core→SchemaAdapter) that couldn't resolve outside the monorepotsc --noEmit, missing bundler resolution failures that only surface duringnext buildThe persona audits
package.jsonconfigs and flags:file:deps, barrel chains with unresolvable deps./path-mappersubpath exports for zero-dep modules, missing bundler build CI stepTest plan
npm-package-compatintent🤖 Generated with Claude Code