Skip to content

feat(planner): add --rename and --slug naming overrides#81

Merged
dadachi merged 1 commit into
mainfrom
feat/naming-overrides
May 22, 2026
Merged

feat(planner): add --rename and --slug naming overrides#81
dadachi merged 1 commit into
mainfrom
feat/naming-overrides

Conversation

@dadachi
Copy link
Copy Markdown
Contributor

@dadachi dadachi commented May 22, 2026

What

Implements the ROADMAP "Optional explicit naming overrides" feature — flag-based, no interactive prompts (scriptable + CI/MCP-safe, per ROADMAP.md line 83). Lets a human veto the planner's noun/name choices without taking over the whole DomainSpec.

--rename From=To (repeatable)

Overrides one of the planner's domain rename targets. Keyed on the substrate token (Shop / Shopkeeper / ItemTag); semantics are "change a planned target" — an override matching no planned rename is reported and dropped, never silently added.

--slug=<kebab>

Overrides the planner's slug, which drives the project name (NativeAppTemplate → VetClinic / …Api / …App) across all three platforms, plus the output dir out/<slug>/, DB prefix, and env-bridge token. Invalid kebab-case is reported and ignored.

npx nativeapptemplate-agent "a vet clinic queue" --slug=vet-clinic --rename Shopkeeper=Provider
#  project: VetClinic (slug vet-clinic, output out/vet-clinic/)
#  override: Shopkeeper → Provider (overrode planner's "Vet")

How

Both overrides apply right after the planner in dispatch(), before the env-bridge/workers/reviewer/judge/report read domain, so every downstream consumer sees the final plan. Both are exposed on the CLI and the MCP generate_app tool.

File Change
src/rename-overrides.ts (new) pure parseRenamePair + applyRenameOverrides
src/slug.ts isValidSlug (mirrors the planner's slug contract)
src/dispatch.ts DispatchOptions.renameOverrides + slug, applied + traced; renameOverrideOutcomes on the result
src/index.ts --rename / --slug parsing, confirmations, warnings, usage
src/mcp.ts renameOverrides + slug params on generate_app
README.md, ROADMAP.md naming-flags table + status note

Testing

  • npm run build clean (strict, exactOptionalPropertyTypes).
  • npm run test68/68 pass (13 new: arg parsing, merge semantics, slug validation, end-to-end dispatch for both flags).
  • CLI smoke (stub mode): changed-target / unmatched-with-hint / malformed for --rename; valid / invalid-fallback for --slug; both together.

Notes / deliberate scope

  • --slug couples the project name to the output dir + DB prefix (one coherent rename) — the chosen behavior. A decoupled --project-name (dir ≠ code name) was considered, not built.
  • displayName override remains deferred.
  • No reserved-token guarding on override targets (e.g. --rename Shop=Task could shadow Swift's Task); these are explicit escape hatches, same as the planner's existing trust boundary. Can add a guard if wanted.

🤖 Generated with Claude Code

Implements the ROADMAP "Optional explicit naming overrides" feature
(flag-based, no interactive prompts — scriptable + CI/MCP-safe).

--rename From=To (repeatable): overrides one of the planner's domain
rename targets. Keyed on the substrate token (Shop/Shopkeeper/ItemTag);
semantics are "change a planned target" — overrides matching no planned
rename are reported and dropped, never silently added.

--slug=<kebab>: overrides the planner's slug, which drives the output
dir, DB prefix, env-bridge token, and the Pascal project name
(NativeAppTemplate -> VetClinic) across all three platforms. Invalid
kebab-case is reported and ignored.

Both apply right after the planner in dispatch() so every downstream
consumer (workers, reviewer, judge, report) sees the final plan, and
both are exposed on the CLI and the MCP generate_app tool.

- src/rename-overrides.ts: pure parseRenamePair + applyRenameOverrides
- src/slug.ts: isValidSlug (mirrors the planner's slug contract)
- src/dispatch.ts: DispatchOptions.renameOverrides + slug, applied + traced
- src/index.ts: --rename / --slug parsing, confirmations, warnings
- src/mcp.ts: renameOverrides + slug params on generate_app
- tests: 13 new (parse, merge, slug validation, end-to-end dispatch)
- README + ROADMAP updated

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@dadachi dadachi merged commit 98cdff1 into main May 22, 2026
1 check passed
@dadachi dadachi deleted the feat/naming-overrides branch May 22, 2026 22:39
dadachi added a commit that referenced this pull request May 23, 2026
Cut a release so the naming-override work reaches npx users — the
registry still serves pre-flag 0.1.2.

Since 0.1.2:
- feat: --rename From=To and --slug=<kebab> naming overrides (CLI + MCP) (#81)
- fix: sync entity names when --rename overrides a target (#82)
- fix: rename scope covers .webmanifest / .svg / .swiftformat (#83)
- fix: rename skips compiled build output (app/assets/builds, public/assets) (#84)

Minor bump: additive features, no breaking changes. Verified the
tarball ships scripts/ruby/rename.rb + dist/ via `npm pack --dry-run`.

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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