You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
perf(init): pre-compute dir listing and send _prevPhases for cross-phase caching (#307)
## Summary
Two optimizations to reduce round-trips during the init wizard:
1. **Pre-computed directory listing** — sends a pre-computed directory
listing with the first API call so the server can skip its initial
`list-dir` suspend. Saves one full HTTP round-trip in the
`discover-context` step.
2. **`_prevPhases` for cross-phase caching** — tracks per-step result
history (`stepHistory`) and sends `_prevPhases` with each resume
payload. This lets the server reuse results from earlier phases (e.g.
the `read-files` phase can reuse data from `analyze`) without
re-requesting them.
## Changes
- Exports `precomputeDirListing` from `local-ops.ts` — reuses the
existing `listDir` function with the same params the server would
request (recursive, maxDepth 3, maxEntries 500). The wizard runner calls
it before `startAsync` and includes the result as `dirListing` in
`inputData`.
- Adds a `stepHistory` map to track accumulated local-op results per
step. Each resume payload now includes `_prevPhases` containing results
from prior phases of the same step.
Companion server change: getsentry/cli-init-api#16
## Test plan
- [x] Init tests pass (`bun test test/lib/init/`)
- [x] Lint passes
- [ ] End-to-end with local dev server
🤖 Generated with [Claude Code](https://claude.com/claude-code)
---------
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
0 commit comments