Skip to content

Commit 315f55d

Browse files
committed
feat(init): pre-read common config files to reduce round-trips
After computing the directory listing, pre-read common config files if they exist. Send the results as fileCache in the startAsync input data. Workflow steps already check fileCache before suspending for read-files, so this eliminates 1-3 HTTP round-trips. Covers all supported ecosystems: JavaScript/TypeScript (Next, Nuxt, Angular, Astro, Svelte, Remix, React Native, Electron, Cloudflare, Bun, serverless), Python (Django, Flask, FastAPI), PHP (Laravel, Symfony, WordPress), .NET (AspNetCore), Java/Android (Spring Boot, Gradle), Go (Gin), Ruby (Rails), Rust, Dart/Flutter, Elixir, Cocoa, and native (CMake). Capped at 512KB total. Made-with: Cursor
2 parents 7ad2970 + db8f92e commit 315f55d

Some content is hidden

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

54 files changed

+5878
-344
lines changed

.github/workflows/ci.yml

Lines changed: 40 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -142,61 +142,6 @@ jobs:
142142
echo "::error::Skill files are out of date. Run 'bun run generate:docs' locally and commit the result."
143143
exit 1
144144
145-
eval-skill:
146-
name: Eval SKILL.md
147-
needs: [changes]
148-
if: needs.changes.outputs.skill == 'true'
149-
runs-on: ubuntu-latest
150-
steps:
151-
# For fork PRs: check if eval has already passed via commit status
152-
- name: Detect fork
153-
id: detect-fork
154-
run: |
155-
if [[ "${{ github.event_name }}" == "pull_request" && "${{ github.event.pull_request.head.repo.full_name }}" != "${{ github.repository }}" ]]; then
156-
echo "is_fork=true" >> "$GITHUB_OUTPUT"
157-
fi
158-
- name: Check fork eval status
159-
if: steps.detect-fork.outputs.is_fork == 'true'
160-
env:
161-
GH_TOKEN: ${{ github.token }}
162-
run: |
163-
SHA="${{ github.event.pull_request.head.sha }}"
164-
STATUS=$(gh api "repos/${{ github.repository }}/commits/$SHA/statuses" \
165-
--jq '[.[] | select(.context == "eval-skill/fork")] | first | .state // "none"')
166-
if [[ "$STATUS" != "success" ]]; then
167-
echo "::error::Fork PR modifies skill files but eval has not passed for commit $SHA."
168-
echo "::error::A maintainer must review the code and add the 'eval-skill' label."
169-
exit 1
170-
fi
171-
echo "Fork eval passed for $SHA"
172-
# For internal PRs: run the eval directly
173-
- uses: actions/checkout@v6
174-
if: steps.detect-fork.outputs.is_fork != 'true'
175-
- uses: oven-sh/setup-bun@v2
176-
if: steps.detect-fork.outputs.is_fork != 'true'
177-
- uses: actions/cache@v5
178-
if: steps.detect-fork.outputs.is_fork != 'true'
179-
id: cache
180-
with:
181-
path: node_modules
182-
key: node-modules-${{ hashFiles('bun.lock', 'patches/**') }}
183-
- if: steps.detect-fork.outputs.is_fork != 'true' && steps.cache.outputs.cache-hit != 'true'
184-
run: bun install --frozen-lockfile
185-
- name: Generate docs and skill files
186-
if: steps.detect-fork.outputs.is_fork != 'true'
187-
run: bun run generate:schema && bun run generate:docs
188-
- name: Eval SKILL.md
189-
if: steps.detect-fork.outputs.is_fork != 'true'
190-
run: bun run eval:skill
191-
env:
192-
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
193-
- name: Upload eval results
194-
if: always() && steps.detect-fork.outputs.is_fork != 'true'
195-
uses: actions/upload-artifact@v7
196-
with:
197-
name: skill-eval-results
198-
path: test/skill-eval/results.json
199-
200145
lint:
201146
name: Lint & Typecheck
202147
needs: [changes]
@@ -597,7 +542,7 @@ jobs:
597542
598543
test-e2e:
599544
name: E2E Tests
600-
needs: [build-binary]
545+
needs: [build-binary, changes]
601546
runs-on: ubuntu-latest
602547
steps:
603548
- uses: actions/checkout@v6
@@ -621,6 +566,9 @@ jobs:
621566
- name: E2E Tests
622567
env:
623568
SENTRY_CLI_BINARY: ${{ github.workspace }}/dist-bin/sentry-linux-x64
569+
# Pass API key only when skill files changed — the skill-eval e2e test
570+
# auto-skips when the key is absent, so non-skill PRs aren't affected.
571+
ANTHROPIC_API_KEY: ${{ needs.changes.outputs.skill == 'true' && secrets.ANTHROPIC_API_KEY || '' }}
624572
run: bun run test:e2e
625573

626574
build-npm:
@@ -662,7 +610,7 @@ jobs:
662610

663611
build-docs:
664612
name: Build Docs
665-
needs: [lint]
613+
needs: [lint, build-binary]
666614
runs-on: ubuntu-latest
667615
steps:
668616
- uses: actions/checkout@v6
@@ -674,18 +622,50 @@ jobs:
674622
key: node-modules-${{ hashFiles('bun.lock', 'patches/**') }}
675623
- if: steps.cache.outputs.cache-hit != 'true'
676624
run: bun install --frozen-lockfile
625+
- name: Get CLI version
626+
id: version
627+
run: echo "version=$(node -p 'require("./package.json").version')" >> "$GITHUB_OUTPUT"
628+
- name: Download compiled CLI binary
629+
uses: actions/download-artifact@v8
630+
with:
631+
name: sentry-linux-x64
632+
path: dist-bin
633+
- name: Make binary executable
634+
run: chmod +x dist-bin/sentry-linux-x64
677635
- name: Generate docs content
678636
run: bun run generate:schema && bun run generate:docs
679637
- name: Build Docs
680638
working-directory: docs
639+
env:
640+
PUBLIC_SENTRY_ENVIRONMENT: production
641+
SENTRY_RELEASE: ${{ steps.version.outputs.version }}
642+
PUBLIC_SENTRY_RELEASE: ${{ steps.version.outputs.version }}
681643
run: |
682644
bun install --frozen-lockfile
683645
bun run build
646+
# Inject debug IDs and upload sourcemaps. The inject step adds
647+
# //# debugId= and the _sentryDebugIds IIFE to deployed JS files.
648+
# Both steps require SENTRY_AUTH_TOKEN (the CLI checks auth on startup).
649+
- name: Inject debug IDs and upload sourcemaps
650+
if: github.event_name == 'push' && env.SENTRY_AUTH_TOKEN != ''
651+
env:
652+
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
653+
SENTRY_ORG: sentry
654+
SENTRY_PROJECT: cli-website
655+
run: |
656+
./dist-bin/sentry-linux-x64 sourcemap inject docs/dist/
657+
./dist-bin/sentry-linux-x64 sourcemap upload docs/dist/ \
658+
--release "${{ steps.version.outputs.version }}" \
659+
--url-prefix "~/"
660+
# Remove .map files — they were uploaded to Sentry but shouldn't
661+
# be deployed to production.
662+
- name: Remove sourcemaps from output
663+
run: find docs/dist -name '*.map' -delete
684664
- name: Package Docs
685665
run: |
686666
cp .nojekyll docs/dist/
687667
cd docs/dist && zip -r ../../gh-pages.zip .
688-
- name: Upload artifact
668+
- name: Upload docs artifact
689669
uses: actions/upload-artifact@v7
690670
with:
691671
name: gh-pages
@@ -694,15 +674,15 @@ jobs:
694674
ci-status:
695675
name: CI Status
696676
if: always()
697-
needs: [changes, check-generated, eval-skill, build-binary, build-npm, build-docs, test-e2e, generate-patches, publish-nightly]
677+
needs: [changes, check-generated, build-binary, build-npm, build-docs, test-e2e, generate-patches, publish-nightly]
698678
runs-on: ubuntu-latest
699679
permissions: {}
700680
steps:
701681
- name: Check CI status
702682
run: |
703683
# Check for explicit failures or cancellations in all jobs
704684
# generate-patches and publish-nightly are skipped on PRs — that's expected
705-
results="${{ needs.check-generated.result }} ${{ needs.eval-skill.result }} ${{ needs.build-binary.result }} ${{ needs.build-npm.result }} ${{ needs.build-docs.result }} ${{ needs.test-e2e.result }} ${{ needs.generate-patches.result }} ${{ needs.publish-nightly.result }}"
685+
results="${{ needs.check-generated.result }} ${{ needs.build-binary.result }} ${{ needs.build-npm.result }} ${{ needs.build-docs.result }} ${{ needs.test-e2e.result }} ${{ needs.generate-patches.result }} ${{ needs.publish-nightly.result }}"
706686
for result in $results; do
707687
if [[ "$result" == "failure" || "$result" == "cancelled" ]]; then
708688
echo "::error::CI failed"
@@ -720,9 +700,4 @@ jobs:
720700
echo "::error::CI failed - upstream job failed causing check-generated to be skipped"
721701
exit 1
722702
fi
723-
if [[ "${{ needs.changes.outputs.skill }}" == "true" && "${{ needs.eval-skill.result }}" == "skipped" ]]; then
724-
echo "::error::CI failed - upstream job failed causing eval-skill to be skipped"
725-
exit 1
726-
fi
727-
728703
echo "CI passed"

.github/workflows/docs-preview.yml

Lines changed: 44 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,32 @@
11
name: Docs Preview
22

33
on:
4+
push:
5+
branches: [main]
6+
paths:
7+
- 'docs/**'
8+
- 'src/**'
9+
- 'script/generate-command-docs.ts'
10+
- 'script/generate-skill.ts'
11+
- 'install'
12+
- '.github/workflows/docs-preview.yml'
413
pull_request:
514
paths:
615
- 'docs/**'
716
- 'src/**'
817
- 'script/generate-command-docs.ts'
918
- 'script/generate-skill.ts'
19+
- 'install'
1020
- '.github/workflows/docs-preview.yml'
1121

1222
permissions:
1323
contents: write
1424
pull-requests: write
1525

26+
concurrency:
27+
group: docs-preview-${{ github.ref }}
28+
cancel-in-progress: true
29+
1630
jobs:
1731
preview:
1832
runs-on: ubuntu-latest
@@ -30,18 +44,42 @@ jobs:
3044
- if: steps.cache.outputs.cache-hit != 'true'
3145
run: bun install --frozen-lockfile
3246

47+
- name: Get CLI version
48+
id: version
49+
run: echo "version=$(node -p 'require("./package.json").version')" >> "$GITHUB_OUTPUT"
50+
3351
- name: Generate docs content
3452
run: bun run generate:schema && bun run generate:docs
3553

3654
- name: Build Docs for Preview
3755
working-directory: docs
3856
env:
39-
# Override base path for PR preview (no /cli prefix since preview domain is different)
40-
DOCS_BASE_PATH: /pr-preview/pr-${{ github.event.pull_request.number }}
57+
DOCS_BASE_PATH: ${{ github.event_name == 'push'
58+
&& '/_preview/pr-main'
59+
|| format('/_preview/pr-{0}', github.event.pull_request.number) }}
60+
PUBLIC_SENTRY_ENVIRONMENT: staging
61+
SENTRY_RELEASE: ${{ steps.version.outputs.version }}
62+
PUBLIC_SENTRY_RELEASE: ${{ steps.version.outputs.version }}
4163
run: |
4264
bun install --frozen-lockfile
4365
bun run build
4466
67+
- name: Inject debug IDs and upload sourcemaps
68+
if: env.SENTRY_AUTH_TOKEN != ''
69+
env:
70+
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
71+
SENTRY_ORG: sentry
72+
SENTRY_PROJECT: cli-website
73+
run: |
74+
bun run --bun src/bin.ts sourcemap inject docs/dist/
75+
bun run --bun src/bin.ts sourcemap upload docs/dist/ \
76+
--release "${{ steps.version.outputs.version }}" \
77+
--url-prefix "~/"
78+
79+
# Remove .map files — uploaded to Sentry but shouldn't be deployed.
80+
- name: Remove sourcemaps from output
81+
run: find docs/dist -name '*.map' -delete
82+
4583
- name: Ensure .nojekyll at gh-pages root
4684
run: |
4785
git config user.name "github-actions[bot]"
@@ -78,6 +116,8 @@ jobs:
78116
with:
79117
source-dir: docs/dist/
80118
preview-branch: gh-pages
81-
umbrella-dir: pr-preview
119+
umbrella-dir: _preview
82120
pages-base-url: cli.sentry.dev
83-
action: auto
121+
action: ${{ github.event_name == 'push' && 'deploy' || 'auto' }}
122+
pr-number: ${{ github.event_name == 'push' && 'main' || github.event.pull_request.number }}
123+
comment: ${{ github.event_name != 'push' }}

.github/workflows/eval-skill-fork.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,9 @@ jobs:
4646
- if: steps.cache.outputs.cache-hit != 'true'
4747
run: bun install --frozen-lockfile
4848

49+
- name: Generate docs and skill files
50+
run: bun run generate:schema && bun run generate:docs
51+
4952
- name: Eval SKILL.md
5053
id: eval
5154
run: bun run eval:skill

.github/workflows/sentry-release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ jobs:
4747
# The org/ prefix is how org is specified — it is NOT part of the version.
4848
# The version portion must match Sentry.init({ release }) exactly.
4949
- name: Create release
50-
run: sentry release create "sentry/${VERSION}" --project cli
50+
run: sentry release create "sentry/${VERSION}" --project cli,cli-website
5151

5252
# --auto matches the local origin remote against Sentry repo integrations.
5353
# continue-on-error: integration may not be configured for all orgs.

0 commit comments

Comments
 (0)