chore(PLA-118): migrate to pnpm workspace (packages/cli, packages/types, packages/web)#14
Conversation
…es, packages/web) Restructure stage-cli into a pnpm workspace mirroring diffity's layout. Drops the @cli/types path-alias indirection in favor of a real workspace package (@stage-cli/types) that tsdown inlines into the published bundle and vite resolves natively for the SPA. Pure structural change — every gate that passed before still passes (typecheck, lint, test, build, and publish --dry-run).
There was a problem hiding this comment.
Code Review
This pull request migrates the project from a single-package repository to a pnpm workspace, organizing the codebase into three distinct packages: packages/cli, packages/web, and packages/types. The changes include restructuring the directory layout, updating build scripts, and adjusting configuration files like tsconfig.json and vite.config.ts to handle workspace dependencies. Feedback focuses on ensuring the integrity of the published CLI package by verifying the location of runtime assets and the inclusion of a license file. Additionally, there are recommendations to fix type-resolution issues caused by the new moduleResolution settings and to expand TypeScript's scope to include configuration files.
The reference to "@stage-cli/cli" was a non-existent package name; the strict ingestion schema lives at packages/cli/src/schema.ts.
pnpm publish rewrites workspace:* to a literal version, so the published manifest listed @stage-cli/types@0.1.0 as a runtime dep — but that package is private and never reaches npm, breaking consumer installs with ERR_PNPM_FETCH_404. tsdown already inlines the package via deps.alwaysBundle so it's only needed at build time.
…ed stage Drops the back-compat `HunkRef as HunkReference` re-export alias from packages/cli/src/schema.ts. Hosted stage uses HunkReference as the canonical name; aligning here lets the DB schema import HunkReference through the existing schema.ts re-export without an alias.
Update agent guidance files that referenced removed scripts and pre-migration paths: - frontend-error-fixer drops `pnpm build:web` (folded into `pnpm build`) - auto-error-resolver replaces `tsc -p web/tsconfig.json` with the per-package `pnpm typecheck` filters and corrects the "single Node package" framing - code-architecture-reviewer points at `packages/cli/` and `packages/web/` and adds `packages/types` to the package-placement rubric
Revert the rename to stagereview-monorepo. The root is private (private: true), so pnpm doesn't enforce uniqueness, and `pnpm --filter stagereview` still resolves to packages/cli alone (pnpm 10 excludes the workspace root from filter matches).
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f7bfaea829
ℹ️ 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".
| "build": "tsdown", | ||
| "build:web": "vite build --config web/vite.config.ts", | ||
| "dev:web": "vite --config web/vite.config.ts", | ||
| "build": "pnpm --filter @stage-cli/web build && pnpm --filter stagereview build", |
There was a problem hiding this comment.
Disambiguate pnpm filter target for CLI package scripts
The workspace now has two packages named stagereview (/package.json and packages/cli/package.json), but these scripts still use pnpm --filter stagereview .... Per pnpm’s filtering docs, when multiple workspace packages share the same name, an unscoped name filter matches nothing; and pnpm-workspace.yaml docs state the root package is always included in the workspace. This means build (and similarly db:generate) can silently skip the CLI package, so CI/local runs may pass without actually building packages/cli or regenerating migrations.
Useful? React with 👍 / 👎.
Summary
Restructure stage-cli into a pnpm workspace mirroring diffity's layout, replacing the
@cli/typestsconfig path-alias with a real workspace package (@stage-cli/types). Pure structural change — every gate that passed before still passes.Changes
pnpm-workspace.yamldeclarespackages/*and ownsonlyBuiltDependencies(better-sqlite3, esbuild). Rootpackage.jsonkeeps Biome/husky/lint-staged/vitest and delegates package-level scripts topnpm --filter/pnpm -r.packages/cli(stagereview, the published npm package): movedsrc/,drizzle/,drizzle.config.ts,tsdown.config.ts,tsconfig.jsonintopackages/cli/. tsdown'sdeps.alwaysBundle: [/^@stage-cli\//]inlines workspace deps into the bundle so end users never see a runtime@stage-cli/typesrequire.prepackcopies the root README into the package so the npm tarball still includes it.packages/types(@stage-cli/types, private, TS-native): new package with exports map for.,./chapters,./view-state. HostsHunkRef/LineRef/DIFF_SIDEso the SPA wire-format and the CLI's strict ingestion schema share one source of truth.packages/web(@stage-cli/web, private): movedweb/src/,vite.config.ts,tsconfig.json,components.json. Vite outputs the SPA into../cli/web-dist. Droppedvite-tsconfig-paths;@/*is now a plainresolve.aliasand@cli/types/*is gone entirely..github/workflows/ci.ymluses one combinedpnpm build, the drizzle-drift check points atpackages/cli/drizzle/, andbiome.jsonuses**/drizzleso the relocated migrations stay excluded.AGENTS.mdandTESTING.mdrewritten with the new directory map and command references.Testing
pnpm typecheck(per-package viapnpm -r) — greenpnpm test— 65/65 across both CLI and web testspnpm lint— clean (74 files)pnpm build— producespackages/cli/dist/index.js(22.7 kB, no@stage-cli/typesruntime imports) andpackages/cli/web-dist/*pnpm publish --dry-run --filter stagereview— tarball containsLICENSE,README.md,dist/,drizzle/,web-dist/,package.jsonpnpm db:generate— no schema changes detected (config resolves correctly frompackages/cli/)