feat(trails): graduate scaffold-version sync into create surface#712
Conversation
How to use the Graphite Merge QueueAdd either label to this PR to merge it via the merge queue:
You must have a Graphite account in order to use the merge queue. Sign up using this link. An organization admin has enabled the Graphite Merge Queue in this repository. Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue. This stack of pull requests is managed by Graphite. Learn more about stacking. |
40a5bea to
142b3f4
Compare
There was a problem hiding this comment.
Your free trial has ended. If you'd like to continue receiving code reviews, you can add a payment method here.
Merge activity
|
## Summary Graduates scaffold-version sync into the `create` surface (TRL-942), applying the script-graduation doctrine from #711: the app owns `scaffold-versions.generated.ts`, so it now owns the derivation too. - New public `create.versions` trail (`trails create versions`): write mode regenerates `apps/trails/src/scaffold-versions.generated.ts` from the root `package.json` catalog/devDependencies; `--check` verifies it is current and fails actionably on drift. The `@ontrails/*` exact-pin invariant check rides along via a static import of the app's `versions.ts`. - Derivation lives in `apps/trails/src/scaffold-version-sync.ts`; the trail follows the `release.check` graduation precedent (`resolveTrailRootDir`, throw→`ValidationError`). - `scripts/sync-scaffold-versions.ts` is reduced to a thin compatibility wrapper that forwards to the trails CLI (with an inline `--permit`, the documented pattern for scripted invocations); `scaffold-versions:sync`/`:check` package scripts route through it so the wrapper stays a referenced entrypoint (knip-clean). - Test coverage moves to `apps/trails/src/__tests__/create-versions-trail.test.ts` (9 tests): the four ported pin-diagnostic cases plus write/check/drift/missing-dependency paths against temp roots. - Changeset: `@ontrails/trails` minor (new public trail). Linear: TRL-942 ## Verification - `bun test apps/trails/src/__tests__/create-versions-trail.test.ts` (9 pass), app typecheck clean - Drift end-to-end: mutated generated file → check exits 1 with regenerate guidance; restored - `bun run check`, `bun run build`, `bun run test`, `bun run publish:check`, `bun run wayfinder:dogfood`, `bun run changeset:check` green at the stack tip
6aca103 to
3f85361
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 142b3f4a60
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| cmd: [ | ||
| 'bun', | ||
| 'apps/trails/bin/trails.ts', | ||
| 'create', | ||
| 'versions', |
There was a problem hiding this comment.
Keep the repair script independent of CLI bootstrap
When apps/trails/src/scaffold-versions.generated.ts is missing or syntactically broken, this wrapper now starts the full Trails CLI before any regeneration can happen. The CLI bootstraps app, which imports trails like create-scaffold and therefore versions.ts; versions.ts imports the generated file at module load, so bun run scaffold-versions:sync exits with an import/parse error instead of repairing the file. The previous script wrote the generated file before dynamically checking versions.ts, so this turns the documented recovery command into something that cannot recover from the drift it is meant to fix.
Useful? React with 👍 / 👎.
142b3f4 to
bb5a219
Compare

Summary
Graduates scaffold-version sync into the
createsurface (TRL-942), applying the script-graduation doctrine from #711: the app ownsscaffold-versions.generated.ts, so it now owns the derivation too.create.versionstrail (trails create versions): write mode regeneratesapps/trails/src/scaffold-versions.generated.tsfrom the rootpackage.jsoncatalog/devDependencies;--checkverifies it is current and fails actionably on drift. The@ontrails/*exact-pin invariant check rides along via a static import of the app'sversions.ts.apps/trails/src/scaffold-version-sync.ts; the trail follows therelease.checkgraduation precedent (resolveTrailRootDir, throw→ValidationError).scripts/sync-scaffold-versions.tsis reduced to a thin compatibility wrapper that forwards to the trails CLI (with an inline--permit, the documented pattern for scripted invocations);scaffold-versions:sync/:checkpackage scripts route through it so the wrapper stays a referenced entrypoint (knip-clean).apps/trails/src/__tests__/create-versions-trail.test.ts(9 tests): the four ported pin-diagnostic cases plus write/check/drift/missing-dependency paths against temp roots.@ontrails/trailsminor (new public trail).Linear: TRL-942
Verification
bun test apps/trails/src/__tests__/create-versions-trail.test.ts(9 pass), app typecheck cleanbun run check,bun run build,bun run test,bun run publish:check,bun run wayfinder:dogfood,bun run changeset:checkgreen at the stack tip