Skip to content

Commit 31ce517

Browse files
committed
chore: pre-shape repo into pnpm-workspace monorepo layout
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).
1 parent 96cd99d commit 31ce517

1,122 files changed

Lines changed: 4651 additions & 865 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.craft.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ changelog:
33
policy: auto
44
versioning:
55
policy: auto
6-
preReleaseCommand: node --experimental-strip-types script/bump-version.ts --pre
7-
postReleaseCommand: node --experimental-strip-types script/bump-version.ts --post
6+
preReleaseCommand: bash -c 'cd packages/cli && node --experimental-strip-types script/bump-version.ts --pre'
7+
postReleaseCommand: bash -c 'cd packages/cli && node --experimental-strip-types script/bump-version.ts --post'
88
artifactProvider:
99
name: github
1010
config:

.github/workflows/ci.yml

Lines changed: 75 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -67,24 +67,24 @@ jobs:
6767
with:
6868
filters: |
6969
skill:
70-
- 'src/**'
71-
- 'docs/**'
72-
- 'package.json'
73-
- 'README.md'
74-
- 'DEVELOPMENT.md'
75-
- 'script/generate-skill.ts'
76-
- 'script/generate-command-docs.ts'
77-
- 'script/generate-docs-sections.ts'
78-
- 'script/eval-skill.ts'
79-
- 'test/skill-eval/**'
70+
- 'packages/cli/src/**'
71+
- 'apps/cli-docs/**'
72+
- 'packages/cli/package.json'
73+
- 'packages/cli/README.md'
74+
- 'packages/cli/DEVELOPMENT.md'
75+
- 'packages/cli/script/generate-skill.ts'
76+
- 'packages/cli/script/generate-command-docs.ts'
77+
- 'packages/cli/script/generate-docs-sections.ts'
78+
- 'packages/cli/script/eval-skill.ts'
79+
- 'packages/cli/test/skill-eval/**'
8080
code:
81-
- 'src/**'
82-
- 'test/**'
83-
- 'script/**'
84-
- 'patches/**'
85-
- 'docs/**'
86-
- 'plugins/**'
87-
- 'package.json'
81+
- 'packages/cli/src/**'
82+
- 'packages/cli/test/**'
83+
- 'packages/cli/script/**'
84+
- 'packages/cli/patches/**'
85+
- 'apps/cli-docs/**'
86+
- 'packages/cli/plugins/**'
87+
- 'packages/cli/package.json'
8888
- 'pnpm-lock.yaml'
8989
- '.github/workflows/ci.yml'
9090
codemod:
@@ -119,7 +119,7 @@ jobs:
119119
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
120120
run: |
121121
TS=$(date -d "$COMMIT_TIMESTAMP" +%s)
122-
CURRENT=$(jq -r .version package.json)
122+
CURRENT=$(jq -r .version packages/cli/package.json)
123123
VERSION=$(echo "$CURRENT" | sed "s/-dev\.[0-9]*$/-dev.${TS}/")
124124
echo "version=${VERSION}" >> "$GITHUB_OUTPUT"
125125
echo "Nightly version: ${VERSION}"
@@ -169,8 +169,11 @@ jobs:
169169
- uses: actions/cache@v5
170170
id: cache
171171
with:
172-
path: node_modules
173-
key: node-modules-${{ hashFiles('pnpm-lock.yaml', '.npmrc', 'patches/**') }}
172+
path: |
173+
node_modules
174+
packages/*/node_modules
175+
apps/*/node_modules
176+
key: node-modules-${{ hashFiles('pnpm-lock.yaml', '.npmrc', 'packages/cli/patches/**') }}
174177
- if: steps.cache.outputs.cache-hit != 'true'
175178
run: pnpm install --frozen-lockfile
176179
- name: Generate API Schema
@@ -224,8 +227,11 @@ jobs:
224227
- uses: actions/cache@v5
225228
id: cache
226229
with:
227-
path: node_modules
228-
key: node-modules-${{ hashFiles('pnpm-lock.yaml', '.npmrc', 'patches/**') }}
230+
path: |
231+
node_modules
232+
packages/*/node_modules
233+
apps/*/node_modules
234+
key: node-modules-${{ hashFiles('pnpm-lock.yaml', '.npmrc', 'packages/cli/patches/**') }}
229235
- if: steps.cache.outputs.cache-hit != 'true'
230236
run: pnpm install --frozen-lockfile
231237
- run: pnpm run generate:schema
@@ -255,8 +261,11 @@ jobs:
255261
- uses: actions/cache@v5
256262
id: cache
257263
with:
258-
path: node_modules
259-
key: node-modules-${{ hashFiles('pnpm-lock.yaml', '.npmrc', 'patches/**') }}
264+
path: |
265+
node_modules
266+
packages/*/node_modules
267+
apps/*/node_modules
268+
key: node-modules-${{ hashFiles('pnpm-lock.yaml', '.npmrc', 'packages/cli/patches/**') }}
260269
- if: steps.cache.outputs.cache-hit != 'true'
261270
run: pnpm install --frozen-lockfile
262271
- name: Generate API Schema
@@ -290,8 +299,11 @@ jobs:
290299
- uses: actions/cache@v5
291300
id: cache
292301
with:
293-
path: node_modules
294-
key: node-modules-${{ matrix.os }}-${{ hashFiles('pnpm-lock.yaml', '.npmrc', 'patches/**') }}
302+
path: |
303+
node_modules
304+
packages/*/node_modules
305+
apps/*/node_modules
306+
key: node-modules-${{ matrix.os }}-${{ hashFiles('pnpm-lock.yaml', '.npmrc', 'packages/cli/patches/**') }}
295307
- name: Install dependencies
296308
if: steps.cache.outputs.cache-hit != 'true'
297309
shell: bash
@@ -337,8 +349,8 @@ jobs:
337349
if: needs.changes.outputs.nightly-version != ''
338350
shell: bash
339351
run: |
340-
jq --arg v "${{ needs.changes.outputs.nightly-version }}" '.version = $v' package.json > package.json.tmp
341-
mv package.json.tmp package.json
352+
jq --arg v "${{ needs.changes.outputs.nightly-version }}" '.version = $v' packages/cli/package.json > packages/cli/package.json.tmp
353+
mv packages/cli/package.json.tmp packages/cli/package.json
342354
- name: Build
343355
env:
344356
# Environment-scoped (production) — must be set at step level to
@@ -357,9 +369,9 @@ jobs:
357369
shell: bash
358370
run: |
359371
if [[ "${{ matrix.target }}" == "windows-x64" ]]; then
360-
./dist-bin/sentry-windows-x64.exe --help
372+
./packages/cli/dist-bin/sentry-windows-x64.exe --help
361373
else
362-
./dist-bin/sentry-${{ matrix.target }} --help
374+
./packages/cli/dist-bin/sentry-${{ matrix.target }} --help
363375
fi
364376
- name: Smoke test (deep — SQLite, telemetry, auth DB)
365377
if: matrix.can-test
@@ -369,9 +381,9 @@ jobs:
369381
SENTRY_TOKEN: ""
370382
run: |
371383
if [[ "${{ matrix.target }}" == "windows-x64" ]]; then
372-
BIN=./dist-bin/sentry-windows-x64.exe
384+
BIN=./packages/cli/dist-bin/sentry-windows-x64.exe
373385
else
374-
BIN=./dist-bin/sentry-${{ matrix.target }}
386+
BIN=./packages/cli/dist-bin/sentry-${{ matrix.target }}
375387
fi
376388
# auth status without a token exercises SQLite init, schema
377389
# migrations, telemetry lazy import, and the CJS require chain.
@@ -397,23 +409,23 @@ jobs:
397409
(github.ref_name == 'main' || startsWith(github.ref_name, 'release/'))
398410
shell: bash
399411
run: |
400-
BIN=./dist-bin/sentry-${{ matrix.target }}
412+
BIN=./packages/cli/dist-bin/sentry-${{ matrix.target }}
401413
echo "Verifying code signature on $BIN..."
402414
rcodesign verify "$BIN"
403415
- name: Upload binary artifact
404416
uses: actions/upload-artifact@v7
405417
with:
406418
name: sentry-${{ matrix.target }}
407419
path: |
408-
dist-bin/sentry-*
409-
!dist-bin/*.gz
420+
packages/cli/dist-bin/sentry-*
421+
!packages/cli/dist-bin/*.gz
410422
411423
- name: Upload compressed artifact
412424
if: github.event_name != 'pull_request'
413425
uses: actions/upload-artifact@v7
414426
with:
415427
name: sentry-${{ matrix.target }}-gz
416-
path: dist-bin/*.gz
428+
path: packages/cli/dist-bin/*.gz
417429

418430
generate-patches:
419431
name: Generate Delta Patches
@@ -754,8 +766,11 @@ jobs:
754766
- uses: actions/cache@v5
755767
id: cache
756768
with:
757-
path: node_modules
758-
key: node-modules-${{ hashFiles('pnpm-lock.yaml', '.npmrc', 'patches/**') }}
769+
path: |
770+
node_modules
771+
packages/*/node_modules
772+
apps/*/node_modules
773+
key: node-modules-${{ hashFiles('pnpm-lock.yaml', '.npmrc', 'packages/cli/patches/**') }}
759774
- if: steps.cache.outputs.cache-hit != 'true'
760775
run: pnpm install --frozen-lockfile
761776
- name: Download Linux binary
@@ -801,8 +816,11 @@ jobs:
801816
- uses: actions/cache@v5
802817
id: cache
803818
with:
804-
path: node_modules
805-
key: node-modules-${{ hashFiles('pnpm-lock.yaml', '.npmrc', 'patches/**') }}
819+
path: |
820+
node_modules
821+
packages/*/node_modules
822+
apps/*/node_modules
823+
key: node-modules-${{ hashFiles('pnpm-lock.yaml', '.npmrc', 'packages/cli/patches/**') }}
806824
- if: steps.cache.outputs.cache-hit != 'true'
807825
run: pnpm install --frozen-lockfile
808826
- name: Bundle
@@ -831,7 +849,7 @@ jobs:
831849
# create and open the database reliably. The runner's ~/.sentry
832850
# may not exist under the switched Node 20 runtime.
833851
SENTRY_CONFIG_DIR: ${{ runner.temp }}/.sentry-smoke
834-
run: node dist/bin.cjs --help
852+
run: node packages/cli/dist/bin.cjs --help
835853
- name: Smoke test (Node.js — deep)
836854
shell: bash
837855
env:
@@ -843,7 +861,7 @@ jobs:
843861
# migrations, telemetry lazy import, and the CJS require chain.
844862
# On Node 20 this runs entirely through the bundled WASM SQLite
845863
# driver. Expected: exit 10 (AUTH_NOT_AUTHENTICATED), NOT a crash.
846-
OUTPUT=$(node dist/bin.cjs auth status 2>&1) && EXIT_CODE=$? || EXIT_CODE=$?
864+
OUTPUT=$(node packages/cli/dist/bin.cjs auth status 2>&1) && EXIT_CODE=$? || EXIT_CODE=$?
847865
if [[ $EXIT_CODE -ne 10 ]]; then
848866
echo "::error::Expected exit code 10 (not authenticated), got $EXIT_CODE"
849867
echo "$OUTPUT"
@@ -854,12 +872,14 @@ jobs:
854872
echo "$OUTPUT"
855873
exit 1
856874
fi
875+
- run: npm pack
876+
working-directory: packages/cli
857877
- name: Upload artifact
858878
if: matrix.node == '22'
859879
uses: actions/upload-artifact@v7
860880
with:
861881
name: npm-package
862-
path: "*.tgz"
882+
path: "packages/cli/*.tgz"
863883

864884
build-docs:
865885
name: Build Docs
@@ -885,13 +905,16 @@ jobs:
885905
- uses: actions/cache@v5
886906
id: cache
887907
with:
888-
path: node_modules
889-
key: node-modules-${{ hashFiles('pnpm-lock.yaml', '.npmrc', 'patches/**') }}
908+
path: |
909+
node_modules
910+
packages/*/node_modules
911+
apps/*/node_modules
912+
key: node-modules-${{ hashFiles('pnpm-lock.yaml', '.npmrc', 'packages/cli/patches/**') }}
890913
- if: steps.cache.outputs.cache-hit != 'true'
891914
run: pnpm install --frozen-lockfile
892915
- name: Get CLI version
893916
id: version
894-
run: echo "version=$(node -p 'require("./package.json").version')" >> "$GITHUB_OUTPUT"
917+
run: echo "version=$(node -p 'require("./packages/cli/package.json").version')" >> "$GITHUB_OUTPUT"
895918
- name: Download compiled CLI binary
896919
uses: actions/download-artifact@v8
897920
with:
@@ -902,7 +925,7 @@ jobs:
902925
- name: Generate docs content
903926
run: pnpm run generate:schema && pnpm run generate:docs
904927
- name: Build Docs
905-
working-directory: docs
928+
working-directory: apps/cli-docs
906929
env:
907930
PUBLIC_SENTRY_ENVIRONMENT: production
908931
SENTRY_RELEASE: ${{ steps.version.outputs.version }}
@@ -919,18 +942,18 @@ jobs:
919942
SENTRY_ORG: sentry
920943
SENTRY_PROJECT: cli-website
921944
run: |
922-
./dist-bin/sentry-linux-x64 sourcemap inject docs/dist/
923-
./dist-bin/sentry-linux-x64 sourcemap upload docs/dist/ \
945+
./dist-bin/sentry-linux-x64 sourcemap inject apps/cli-docs/dist/
946+
./dist-bin/sentry-linux-x64 sourcemap upload apps/cli-docs/dist/ \
924947
--release "${{ steps.version.outputs.version }}" \
925948
--url-prefix "~/"
926949
# Remove .map files — they were uploaded to Sentry but shouldn't
927950
# be deployed to production.
928951
- name: Remove sourcemaps from output
929-
run: find docs/dist -name '*.map' -delete
952+
run: find apps/cli-docs/dist -name '*.map' -delete
930953
- name: Package Docs
931954
run: |
932-
cp .nojekyll docs/dist/
933-
cd docs/dist && zip -r ../../gh-pages.zip .
955+
cp .nojekyll apps/cli-docs/dist/
956+
cd apps/cli-docs/dist && zip -r "$GITHUB_WORKSPACE/gh-pages.zip" .
934957
- name: Upload docs artifact
935958
uses: actions/upload-artifact@v7
936959
with:

.github/workflows/docs-preview.yml

Lines changed: 21 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@ on:
44
push:
55
branches: [main]
66
paths:
7-
- 'docs/**'
8-
- 'src/**'
9-
- 'script/generate-command-docs.ts'
10-
- 'script/generate-skill.ts'
11-
- 'install'
7+
- 'apps/cli-docs/**'
8+
- 'packages/cli/src/**'
9+
- 'packages/cli/script/generate-command-docs.ts'
10+
- 'packages/cli/script/generate-skill.ts'
11+
- 'packages/cli/install'
1212
- '.github/workflows/docs-preview.yml'
1313
pull_request:
1414
# No paths filter here: the 'closed' event must ALWAYS fire so
@@ -48,11 +48,11 @@ jobs:
4848
with:
4949
filters: |
5050
docs:
51-
- 'docs/**'
52-
- 'src/**'
53-
- 'script/generate-command-docs.ts'
54-
- 'script/generate-skill.ts'
55-
- 'install'
51+
- 'apps/cli-docs/**'
52+
- 'packages/cli/src/**'
53+
- 'packages/cli/script/generate-command-docs.ts'
54+
- 'packages/cli/script/generate-skill.ts'
55+
- 'packages/cli/install'
5656
- '.github/workflows/docs-preview.yml'
5757
5858
# Central gate. `build` = produce the site (push, or a docs PR being
@@ -93,24 +93,27 @@ jobs:
9393
id: cache
9494
if: steps.gate.outputs.build == 'true'
9595
with:
96-
path: node_modules
97-
key: node-modules-${{ hashFiles('pnpm-lock.yaml', '.npmrc', 'patches/**') }}
96+
path: |
97+
node_modules
98+
packages/*/node_modules
99+
apps/*/node_modules
100+
key: node-modules-${{ hashFiles('pnpm-lock.yaml', '.npmrc', 'packages/cli/patches/**') }}
98101

99102
- if: steps.gate.outputs.build == 'true' && steps.cache.outputs.cache-hit != 'true'
100103
run: pnpm install --frozen-lockfile
101104

102105
- name: Get CLI version
103106
id: version
104107
if: steps.gate.outputs.build == 'true'
105-
run: echo "version=$(node -p 'require("./package.json").version')" >> "$GITHUB_OUTPUT"
108+
run: echo "version=$(node -p 'require("./packages/cli/package.json").version')" >> "$GITHUB_OUTPUT"
106109

107110
- name: Generate docs content
108111
if: steps.gate.outputs.build == 'true'
109112
run: pnpm run generate:schema && pnpm run generate:docs
110113

111114
- name: Build Docs for Preview
112115
if: steps.gate.outputs.build == 'true'
113-
working-directory: docs
116+
working-directory: apps/cli-docs
114117
env:
115118
DOCS_BASE_PATH: ${{ github.event_name == 'push'
116119
&& '/_preview/pr-main'
@@ -129,15 +132,15 @@ jobs:
129132
SENTRY_ORG: sentry
130133
SENTRY_PROJECT: cli-website
131134
run: |
132-
pnpm run cli sourcemap inject docs/dist/
133-
pnpm run cli sourcemap upload docs/dist/ \
135+
pnpm run cli sourcemap inject "$GITHUB_WORKSPACE/apps/cli-docs/dist/"
136+
pnpm run cli sourcemap upload "$GITHUB_WORKSPACE/apps/cli-docs/dist/" \
134137
--release "${{ steps.version.outputs.version }}" \
135138
--url-prefix "~/"
136139
137140
# Remove .map files — uploaded to Sentry but shouldn't be deployed.
138141
- name: Remove sourcemaps from output
139142
if: steps.gate.outputs.build == 'true'
140-
run: find docs/dist -name '*.map' -delete
143+
run: find apps/cli-docs/dist -name '*.map' -delete
141144

142145
- name: Ensure .nojekyll at gh-pages root
143146
# Runs whenever we deploy (build or a 'closed' cleanup), but never for
@@ -180,7 +183,7 @@ jobs:
180183
if: steps.gate.outputs.deploy == 'true'
181184
uses: rossjrw/pr-preview-action@v1
182185
with:
183-
source-dir: docs/dist/
186+
source-dir: apps/cli-docs/dist/
184187
preview-branch: gh-pages
185188
umbrella-dir: _preview
186189
pages-base-url: cli.sentry.dev

0 commit comments

Comments
 (0)