Skip to content

fix(scaffold): reconfigure .claude/upstream.json for downstream on nest-base scaffold#89

Merged
pascal-klesse merged 1 commit into
mainfrom
fix/scaffold-upstream-json
May 20, 2026
Merged

fix(scaffold): reconfigure .claude/upstream.json for downstream on nest-base scaffold#89
pascal-klesse merged 1 commit into
mainfrom
fix/scaffold-upstream-json

Conversation

@pascal-klesse
Copy link
Copy Markdown
Member

Problem

The experimental nest-base template ships .claude/upstream.json with the template-self default:

{ "isTemplate": true, "upstream": null, "syncedPaths": ["src/core/"] }

bun run rename only rewrites four files (package.json, README.md, portless.yml, docker-compose.yml) and never touches upstream.json. So every project scaffolded from nest-base keeps isTemplate: true — which makes the /upstream-pr slash command and the contributing-upstream skill 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() in src/lib/workspace-integration.ts:

  • Reads ${apiDir}/.claude/upstream.json; missing file or unparseable JSON → { updated: false } (non-fatal, no throw — older templates may not ship it).
  • Sets isTemplate: false and upstream: { repo: "lenneTech/nest-base", branch }, preserving $schema and syncedPaths. Replaces the stale template-self notes.
  • Idempotent.

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 — clean
  • npm run test — 355 passed, 1 pre-existing skip
  • npm run build — note: tsc has 2 pre-existing, unrelated errors in node_modules (electron.d.ts / @types/node noDeprecation modifier 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-pr refused because the scaffolded upstream.json still said isTemplate: true.

🤖 Generated with Claude Code

…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>
@pascal-klesse pascal-klesse merged commit be75fb7 into main May 20, 2026
1 check passed
@pascal-klesse pascal-klesse deleted the fix/scaffold-upstream-json branch May 20, 2026 18:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant