fix(scaffold): reconfigure .claude/upstream.json for downstream on nest-base scaffold#89
Merged
Merged
Conversation
…st-base scaffold
The nest-base template ships `.claude/upstream.json` with `isTemplate: true`
and `upstream: null` (the template-self default). `bun run rename` only
rewrites four files and never touches it, so every scaffolded project kept
the template default — which makes `/upstream-pr` and the contributing-upstream
skill refuse to open core-fix PRs back to nest-base ("this repo IS the template").
Add `reconfigureUpstreamForDownstream()` which flips `isTemplate` to false and
fills `upstream` with `{ repo: "lenneTech/nest-base", branch }`, preserving
`$schema` and `syncedPaths`. Idempotent; non-fatal when the file is absent.
Wired into all three nest-base scaffold paths: `fullstack add-api --next`,
`fullstack init --next`, and `server create --next`.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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.
Problem
The experimental nest-base template ships
.claude/upstream.jsonwith the template-self default:{ "isTemplate": true, "upstream": null, "syncedPaths": ["src/core/"] }bun run renameonly rewrites four files (package.json, README.md, portless.yml, docker-compose.yml) and never touchesupstream.json. So every project scaffolded from nest-base keepsisTemplate: true— which makes the/upstream-prslash command and thecontributing-upstreamskill refuse to open core-fix PRs back to nest-base ("this repo IS the template"). Downstream projects could never contribute fixes upstream without a manual edit nobody remembers.Fix
New helper
reconfigureUpstreamForDownstream()insrc/lib/workspace-integration.ts:${apiDir}/.claude/upstream.json; missing file or unparseable JSON →{ updated: false }(non-fatal, no throw — older templates may not ship it).isTemplate: falseandupstream: { repo: "lenneTech/nest-base", branch }, preserving$schemaandsyncedPaths. Replaces the stale template-self notes.Wired into all three nest-base scaffold paths:
lt fullstack add-api --next(src/commands/fullstack/add-api.ts)lt fullstack init --next(src/commands/fullstack/init.ts)lt server create --next(src/commands/server/create.ts, standalone clone at project root)Each surfaces a one-line info on success; absence is silent and non-fatal.
Tests
New
describe('reconfigureUpstreamForDownstream')block in__tests__/workspace-integration.test.ts(5 tests, gluegun real filesystem + temp dir): flips isTemplate + fills upstream; preserves syncedPaths/$schema; honours custom repo/branch; missing file → no-op; idempotent.Test plan
npm run lint— cleannpm run test— 355 passed, 1 pre-existing skipnpm run build— note:tschas 2 pre-existing, unrelated errors innode_modules(electron.d.ts/@types/nodenoDeprecationmodifier conflict), verified identical on a clean tree. The changed source compiles clean.Origin
Discovered while contributing a
src/core/fix back from a downstream consumer project (see lenneTech/nest-base#155) —/upstream-prrefused because the scaffoldedupstream.jsonstill saidisTemplate: true.🤖 Generated with Claude Code