feat(init): rewrite init CLI transport for Vercel Workflows#779
Draft
feat(init): rewrite init CLI transport for Vercel Workflows#779
Conversation
Contributor
Semver Impact of This PR🟡 Minor (new features) 📋 Changelog PreviewThis is how your changes will appear in the changelog. New Features ✨
Bug Fixes 🐛Init
Other
Internal Changes 🔧
Other
🤖 This preview updates automatically when you update the PR. |
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.
Summary
This rewrites the
sentry initCLI transport to talk to the new Vercel Workflows backend.Instead of the old Mastra
createRun/startAsync/resumeAsyncflow, the CLI now starts a Workflow run, reads a resumable NDJSON stream, dispatches local prompt/tool actions, posts hook results back to the API, and reconnects withstartIndexwhen needed.This intentionally does not preserve the old Mastra client contract.
Why
cli-init-apiWhat Changed
POST /api/initGET /api/init/:runId/streamPOST /api/init/actions/:actionIdstartIndexaction_requestevents so reconnects do not rerun local mutationsauthToken,dirListing, andfileCachefrom the initial workflow payloadMASTRA_API_URLfallback and uses the new init transport directlyPaired Change
Paired API PR: getsentry/cli-init-api#100
These two PRs are a pair.
How To Run Locally
Check out this PR and the paired API PR together.
cli-init-apicheckout:cd /path/to/cli-init-api/apps/server bun run devexport INIT_API_URL=http://localhost:3000sentry initfrom this checkout:cd /path/to/target-app bun run /path/to/cli/src/bin.ts initVerification
bun test test/lib/init/transport.test.ts test/lib/init/wizard-runner.test.ts test/commands/init.test.tsbun run typecheckNotes