chore: pre-shape repo into pnpm-workspace monorepo layout - #1254
Merged
Conversation
4 tasks
BYK
force-pushed
the
chore/preshape-monorepo
branch
from
July 15, 2026 14:55
20669e5 to
e11da2e
Compare
Contributor
|
BYK
added a commit
that referenced
this pull request
Jul 15, 2026
Follow-ups from the PR #1254 review (no behavior change to shipped CLI): - check-patches.ts: harden resolvePackageFile() to derive the package root from the FIRST `<pkgName>/` after the last `node_modules/` boundary, instead of `lastIndexOf('/<pkgName>/')`. A package that vendors a nested copy of itself would otherwise truncate at the wrong inner segment. Also refresh the stale `node-linker=hoisted` comment. - biome.jsonc / packages/cli/.gitignore: reconcile the contradictory comments about which .gitignore Biome reads. Biome honors the workspace-root .gitignore via `vcs.root: "../.."`; the package-level .gitignore is for plain git only. Drop the dead `!docs` ignore (no packages/cli/docs after the move). - build.ts / bundle.ts: fix comments that still claimed deps are "hoisted to the workspace-root node_modules" — under node-linker=isolated they live in the isolated store; the code (module resolution / `pnpm exec`) is unchanged and correct. - packages/cli/AGENTS.md: replace stale Bun-era guidance with the current pnpm/Node/Vitest reality — command reference, "Use Node.js APIs" section, test-runner isolation notes (VITEST_POOL_ID), vitest imports and `vi.mock`, moved docs path (apps/cli-docs), and removed the dangling `.cursor/rules/bun-cli.mdc` reference. Verified: typecheck, lint, all check:* scripts, build (+ binary smoke).
BYK
added a commit
that referenced
this pull request
Jul 30, 2026
Follow-ups from the PR #1254 review (no behavior change to shipped CLI): - check-patches.ts: harden resolvePackageFile() to derive the package root from the FIRST `<pkgName>/` after the last `node_modules/` boundary, instead of `lastIndexOf('/<pkgName>/')`. A package that vendors a nested copy of itself would otherwise truncate at the wrong inner segment. Also refresh the stale `node-linker=hoisted` comment. - biome.jsonc / packages/cli/.gitignore: reconcile the contradictory comments about which .gitignore Biome reads. Biome honors the workspace-root .gitignore via `vcs.root: "../.."`; the package-level .gitignore is for plain git only. Drop the dead `!docs` ignore (no packages/cli/docs after the move). - build.ts / bundle.ts: fix comments that still claimed deps are "hoisted to the workspace-root node_modules" — under node-linker=isolated they live in the isolated store; the code (module resolution / `pnpm exec`) is unchanged and correct. - packages/cli/AGENTS.md: replace stale Bun-era guidance with the current pnpm/Node/Vitest reality — command reference, "Use Node.js APIs" section, test-runner isolation notes (VITEST_POOL_ID), vitest imports and `vi.mock`, moved docs path (apps/cli-docs), and removed the dangling `.cursor/rules/bun-cli.mdc` reference. Verified: typecheck, lint, all check:* scripts, build (+ binary smoke).
BYK
force-pushed
the
chore/preshape-monorepo
branch
from
July 30, 2026 22:55
27b35bb to
4bd6a82
Compare
BYK
added a commit
that referenced
this pull request
Jul 30, 2026
Follow-ups from the PR #1254 review (no behavior change to shipped CLI): - check-patches.ts: harden resolvePackageFile() to derive the package root from the FIRST `<pkgName>/` after the last `node_modules/` boundary, instead of `lastIndexOf('/<pkgName>/')`. A package that vendors a nested copy of itself would otherwise truncate at the wrong inner segment. Also refresh the stale `node-linker=hoisted` comment. - biome.jsonc / packages/cli/.gitignore: reconcile the contradictory comments about which .gitignore Biome reads. Biome honors the workspace-root .gitignore via `vcs.root: "../.."`; the package-level .gitignore is for plain git only. Drop the dead `!docs` ignore (no packages/cli/docs after the move). - build.ts / bundle.ts: fix comments that still claimed deps are "hoisted to the workspace-root node_modules" — under node-linker=isolated they live in the isolated store; the code (module resolution / `pnpm exec`) is unchanged and correct. - packages/cli/AGENTS.md: replace stale Bun-era guidance with the current pnpm/Node/Vitest reality — command reference, "Use Node.js APIs" section, test-runner isolation notes (VITEST_POOL_ID), vitest imports and `vi.mock`, moved docs path (apps/cli-docs), and removed the dangling `.cursor/rules/bun-cli.mdc` reference. Verified: typecheck, lint, all check:* scripts, build (+ binary smoke).
BYK
force-pushed
the
chore/preshape-monorepo
branch
from
July 30, 2026 22:56
4bd6a82 to
faa626b
Compare
BYK
added a commit
that referenced
this pull request
Jul 31, 2026
Follow-ups from the PR #1254 review (no behavior change to shipped CLI): - check-patches.ts: harden resolvePackageFile() to derive the package root from the FIRST `<pkgName>/` after the last `node_modules/` boundary, instead of `lastIndexOf('/<pkgName>/')`. A package that vendors a nested copy of itself would otherwise truncate at the wrong inner segment. Also refresh the stale `node-linker=hoisted` comment. - biome.jsonc / packages/cli/.gitignore: reconcile the contradictory comments about which .gitignore Biome reads. Biome honors the workspace-root .gitignore via `vcs.root: "../.."`; the package-level .gitignore is for plain git only. Drop the dead `!docs` ignore (no packages/cli/docs after the move). - build.ts / bundle.ts: fix comments that still claimed deps are "hoisted to the workspace-root node_modules" — under node-linker=isolated they live in the isolated store; the code (module resolution / `pnpm exec`) is unchanged and correct. - packages/cli/AGENTS.md: replace stale Bun-era guidance with the current pnpm/Node/Vitest reality — command reference, "Use Node.js APIs" section, test-runner isolation notes (VITEST_POOL_ID), vitest imports and `vi.mock`, moved docs path (apps/cli-docs), and removed the dangling `.cursor/rules/bun-cli.mdc` reference. Verified: typecheck, lint, all check:* scripts, build (+ binary smoke).
BYK
force-pushed
the
chore/preshape-monorepo
branch
from
July 31, 2026 11:57
bc99a18 to
6e72f45
Compare
Contributor
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 3 potential issues.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 6e72f45. Configure here.
BYK
added a commit
that referenced
this pull request
Jul 31, 2026
Re-applies the three substantive commits (sync-scripts, move-eval-common,
bugbot B1+B2+B3) that the rebase dropped, plus the feedback files that
git's rename detector did not relocate on its own.
- packages/cli/package.json: take origin/main's `scripts` block verbatim
so future drift lands via rebase, not by manual sync. Rebuild root
delegating scripts from `pnpm --filter sentry run <name>`.
- Move `test/eval-common/anthropic-client.ts` into
`packages/cli/test/eval-common/anthropic-client.ts` so the importing
`packages/cli/test/script/eval-provider.test.ts` can resolve
`../eval-common/anthropic-client.js`.
- Relocate `src/commands/feedback/{index,list,utils,view}.ts` and
`test/commands/feedback/{list,utils,view}.test.ts` into
`packages/cli/`. Other feedback files (`feedback.ts` in
`src/lib/api`, `src/lib/formatters`, `src/types`, etc.) were already
in the package thanks to git's rename detection during rebase; the
remaining ones slipped through as newly added files.
- ci.yml: remove the duplicate bare `run: npm pack` step (the correct
one with `working-directory: packages/cli` at line 874 stays).
Paths-filter to `packages/cli/**` was preserved from the earlier
B1 fix.
- packages/cli/LICENSE.md: copy + extend `files` to include LICENSE.md
and README.md, so `npm pack` ships the license text and the
README `LICENSE.md` link resolves inside the package.
Verified: typecheck, lint (950 files), check:patches, check:deps,
check:errors, check:stale-refs, check:fragments, check:docs-sections,
build (0.40.0-dev.0), feedback unit tests (15 files, 156 tests pass).
Reshape the CLI repo into a pnpm workspace so it can be cleanly git-subtree-imported into the future getsentry/toolkit monorepo (#1238, part of #1248). Layout: - Move the CLI package into packages/cli/ (src, test, script, patches, plugins, install, configs, package.json). - Move docs/ into apps/cli-docs/. - Keep GitHub/Craft-read files at the repo root (.github/, .craft.yml, LICENSE, CHANGELOG, .gitignore, .nojekyll) so the repo stays fully operational (releases + nightlies) through and after the merge. - Add pnpm-workspace.yaml (packages/* + apps/*) and a thin delegating root package.json that forwards scripts to the sentry package and hoists the pnpm block (patchedDependencies now reference packages/cli/patches/**). - Add a minimal root README; the CLI README moves to packages/cli/. Internal path fixes: - Shared script/paths.ts (DOCS_ROOT etc.) for cross-package doc paths; generate/check scripts updated to use it. - Re-point apps/cli-docs public symlinks (install, skill files) to the new packages/cli/ locations. - build.ts / bundle.ts resolve @sentry/symbolic WASM via module resolution and invoke fossilize via `pnpm exec` (both hoist to the workspace root now). - biome.jsonc + packages/cli/.gitignore so Biome finds an ignore file. - .gitignore path-anchored entries updated to the nested layout. Workflows / release (kept root-relative where GitHub/Craft require it): - ci.yml, docs-preview.yml, eval-skill-fork.yml: paths-filter globs, node_modules cache paths, patches hashFiles glob, artifact paths (packages/cli/dist-bin, apps/cli-docs/dist), docs working-directory, package.json version reads, npm pack dir. - .craft.yml pre/post release commands cd into packages/cli. node-linker=isolated (was hoisted): under the workspace, hoisted mode let an unpatched transitive @sentry/core@10.65.0 (via @spotlightjs/spotlight -> @sentry/node) win the flat hoist over the patched direct @sentry/core@10.63.0, so the CLI bundled the unpatched copy (masked only by esbuild tree-shaking). isolated mode keeps per-package variants so the patched copy is used. check-patches.ts now reads patchedDependencies from the workspace root and resolves the package copy the CLI actually links via require.resolve. Verified: typecheck, lint, all check:* scripts, build (+ binary smoke, patched bundle), and the full unit suite (399 files, 8474 passed).
The check-generated job's skill/docs-section verification steps still referenced pre-move root-relative paths (plugins/, README.md, DEVELOPMENT.md, docs/src/content/docs/*). After the packages/cli + apps/cli-docs move those paths no longer exist, so `git diff --quiet <nonexistent-path>` exits 128 (fatal), failing the "Validate generated files" check even though the committed generated content is current. Repoint all three references (check-skill, check-sections, auto-commit) to: - packages/cli/plugins/sentry-cli/skills/sentry-cli/ - packages/cli/README.md, packages/cli/DEVELOPMENT.md - apps/cli-docs/src/content/docs/{contributing.md,self-hosted.md,getting-started.mdx} Verified: `pnpm --filter sentry run generate:schema && generate:docs` produces no diff against the committed files, and the git diff --quiet commands now exit 0 instead of 128.
Follow-ups from the PR #1254 review (no behavior change to shipped CLI): - check-patches.ts: harden resolvePackageFile() to derive the package root from the FIRST `<pkgName>/` after the last `node_modules/` boundary, instead of `lastIndexOf('/<pkgName>/')`. A package that vendors a nested copy of itself would otherwise truncate at the wrong inner segment. Also refresh the stale `node-linker=hoisted` comment. - biome.jsonc / packages/cli/.gitignore: reconcile the contradictory comments about which .gitignore Biome reads. Biome honors the workspace-root .gitignore via `vcs.root: "../.."`; the package-level .gitignore is for plain git only. Drop the dead `!docs` ignore (no packages/cli/docs after the move). - build.ts / bundle.ts: fix comments that still claimed deps are "hoisted to the workspace-root node_modules" — under node-linker=isolated they live in the isolated store; the code (module resolution / `pnpm exec`) is unchanged and correct. - packages/cli/AGENTS.md: replace stale Bun-era guidance with the current pnpm/Node/Vitest reality — command reference, "Use Node.js APIs" section, test-runner isolation notes (VITEST_POOL_ID), vitest imports and `vi.mock`, moved docs path (apps/cli-docs), and removed the dangling `.cursor/rules/bun-cli.mdc` reference. Verified: typecheck, lint, all check:* scripts, build (+ binary smoke).
Re-applies the three substantive commits (sync-scripts, move-eval-common,
bugbot B1+B2+B3) that the rebase dropped, plus the feedback files that
git's rename detector did not relocate on its own.
- packages/cli/package.json: take origin/main's `scripts` block verbatim
so future drift lands via rebase, not by manual sync. Rebuild root
delegating scripts from `pnpm --filter sentry run <name>`.
- Move `test/eval-common/anthropic-client.ts` into
`packages/cli/test/eval-common/anthropic-client.ts` so the importing
`packages/cli/test/script/eval-provider.test.ts` can resolve
`../eval-common/anthropic-client.js`.
- Relocate `src/commands/feedback/{index,list,utils,view}.ts` and
`test/commands/feedback/{list,utils,view}.test.ts` into
`packages/cli/`. Other feedback files (`feedback.ts` in
`src/lib/api`, `src/lib/formatters`, `src/types`, etc.) were already
in the package thanks to git's rename detection during rebase; the
remaining ones slipped through as newly added files.
- ci.yml: remove the duplicate bare `run: npm pack` step (the correct
one with `working-directory: packages/cli` at line 874 stays).
Paths-filter to `packages/cli/**` was preserved from the earlier
B1 fix.
- packages/cli/LICENSE.md: copy + extend `files` to include LICENSE.md
and README.md, so `npm pack` ships the license text and the
README `LICENSE.md` link resolves inside the package.
Verified: typecheck, lint (950 files), check:patches, check:deps,
check:errors, check:stale-refs, check:fragments, check:docs-sections,
build (0.40.0-dev.0), feedback unit tests (15 files, 156 tests pass).
`packages/cli/script/bundle.ts` used a hardcoded `./node_modules/node-sqlite3-wasm/dist/node-sqlite3-wasm.wasm` path, inconsistent with how `@sentry/symbolic/symbolic_bg.wasm` is resolved a few lines above via `createRequire(import.meta.url).resolve(...)`. Under pnpm's isolated node-linker, the package may live in the isolated store rather than this package's node_modules; the hardcoded path would crash with raw ENOENT in that case. Resolve the wasm via module resolution and add a `try/catch + existsSync` guard with a clear `Run: pnpm install` error — matching the pattern already in `script/build.ts`. Verified: `pnpm run bundle` produces both `dist/node-sqlite3-wasm.wasm` and `dist/vendor/symbolic_bg.wasm`. Typecheck clean.
BYK
force-pushed
the
chore/preshape-monorepo
branch
from
July 31, 2026 13:38
c20f606 to
30ad8b0
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Pre-shape the CLI repo into a pnpm-workspace monorepo
Part of the sentry-cli + sentry-mcp →
getsentry/toolkitmerge.Closes #1238 · Master: #1248
This reshapes the repo into a pnpm workspace so it can be cleanly
git subtree-imported into the renamedtoolkitrepo (#1239), while keepingthis repo fully operational (CI, releases, nightlies) throughout the
transition — which the dual-source CLI upgrade (#1244) depends on.
Layout
packages/cli/(src,test,script,patches,plugins,install, configs,package.json)docs/→apps/cli-docs/.github/,.craft.yml,LICENSE,CHANGELOG,.gitignore,.nojekyllpnpm-workspace.yaml(packages/*+apps/*) and a thin delegating rootpackage.jsonthat forwards scripts to thesentrypackage and hoists thepnpmblockREADME; CLI README →packages/cli/README.mdInternal path fixes
script/paths.ts(DOCS_ROOTetc.) for cross-package doc pathsapps/cli-docspublic symlinks (install, skill files) topackages/cli/build.ts/bundle.tsresolve the@sentry/symbolicWASM via module resolution and invoke fossilize viapnpm exec(both hoist to the workspace root)biome.jsonc+packages/cli/.gitignoreso Biome finds an ignore file.gitignorepath-anchored entries updated for the nested layoutWorkflows / release (root-relative where GitHub/Craft require it)
ci.yml,docs-preview.yml,eval-skill-fork.yml: paths-filter globs,node_modulescache paths, patcheshashFilesglob, artifact paths (packages/cli/dist-bin,apps/cli-docs/dist), docsworking-directory, version reads,npm packdir.craft.ymlpre/post-release commandscd packages/clinode-linker=isolated(washoisted)Under the workspace,
hoistedlet an unpatched transitive@sentry/core@10.65.0(via@spotlightjs/spotlight→@sentry/node) win theflat hoist over the patched direct
@sentry/core@10.63.0, so the CLIbundled the unpatched copy (masked only by esbuild tree-shaking).
isolatedmode (pnpm default) keeps per-package variants so the patched copy is used.
check-patches.tsnow readspatchedDependenciesfrom the workspace root andresolves the copy the CLI actually links via
require.resolve.The patch files themselves are unchanged (they apply cleanly);
catalog:-based dedup is deferred to #1240.Verification (local)
typecheck,lint, allcheck:*scriptsbuild(+ Linux binary smoke test, WASM asset loads, patched bundle verified)bundle(npm library)CI on this PR is the authoritative check for the cross-platform binary matrix
and release paths.