Skip to content

refactor(app-builder): use declarative generation templates - #145

Merged
kattsushi merged 5 commits into
feat/app-builder-v1-parity-migrationfrom
refactor/app-builder-declarative-templates
Aug 13, 2026
Merged

refactor(app-builder): use declarative generation templates#145
kattsushi merged 5 commits into
feat/app-builder-v1-parity-migrationfrom
refactor/app-builder-declarative-templates

Conversation

@kattsushi

@kattsushi kattsushi commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

Closes #144

Summary

  • Replace embedded generated TypeScript and workspace-root strings with output-shaped parameterized template assets.
  • Use the mature EJS engine directly across the pure generation kernel and Nx generateFiles; no custom template parser or language subset is maintained.
  • Parameterize entity identity, package references, branding, filenames, workspace layouts, and output roots while preserving the frozen Todo v1 contract byte-for-byte.
  • Make real @nx/devkit.generateFiles staging authoritative for selected template output, including partial-evolution non-template files.

Changes

Area Change
packages/app-builder/generation/src/templates/assets/** Adds generic parameterized templates and the frozen Todo v1 18-output template tree with parameterized content and filenames.
packages/app-builder/generation/src/templates.ts Validates package-owned assets, builds immutable bounded substitutions, separates source and target directories, and renders synchronously with real EJS and filename context.
packages/app-builder/generation/src/generators/** Replaces generated-source assembly with declarative template contributions while deriving entity, package, import, brand, and root identities from render context.
packages/app-builder/nx-plugin/src/apply-plan.ts Stages selected output through real generateFiles and atomically commits generated bytes to the caller Tree.
App Builder tests Proves real EJS control flow, non-Todo Task/@acme materialization, filename substitution, partial staging authority, generated-byte precedence, CLI/Nx parity, rollback, and frozen v1 compatibility.

Test Plan

  • Latest bounded generation suite: 9 files / 35 tests
  • Latest bounded Nx plugin suite: 2 files / 15 tests
  • Focused template, frozen Todo v1, semantic compilation, apply-plan, and materialization tests: 25 tests
  • Generation and Nx plugin typecheck/build
  • Relevant lint with zero errors
  • pnpm format:check
  • git diff --check 66bfa635f
  • Independent read-only validation of all 12 template parameterization contracts
  • All 18 frozen Todo v1 paths and SHA-256 hashes remain byte-identical

Contributor Checklist

  • Linked approved issue Replace App Builder generated strings with declarative templates #144.
  • Added exactly one existing type:* label (type:chore; the repository has no type:refactor).
  • Used conventional commits without attribution trailers.
  • Shellcheck is not applicable; no shell scripts changed.
  • Documentation is not required; this refactor preserves the public generation contract.

Review Context

  • Base PR: feat(app-builder): preserve Todo v1 parity #143
  • Tracker: Deliver reusable App Builder generation kernel #131
  • Approved size:exception: one consolidated correction PR, maximum 2,000 changed lines.
  • Final diff: 1,895 changed lines (1,601 additions + 294 deletions), leaving 105 lines of margin.
  • Exception rationale: output-shaped assets must remain with the real EJS renderer, identity/root derivation, adapters, byte-authority correction, and parity proofs to preserve one reviewable source-of-truth migration.
  • EJS executes JavaScript. Only validated package-owned templates reach the rendering boundary; substitutions are immutable bounded string data.
  • .template remains canonical because Nx strips only that terminal suffix; .ejs would leak into generated filenames.
  • Bounded compatibility defaults preserve the Todo v1 source contract, while output-level tests prove non-Todo contexts contain no accidental Todo or Effectify identity leakage.
  • Runtime ownership manifests remain imperative JSON serialization because they are generated metadata, not source or workspace-root templates.
  • formatFiles is intentionally not called: committed templates define exact shared bytes, including the frozen Todo v1 digest fixture, and adapter-side formatting would introduce a second output authority.

@kattsushi kattsushi added the type:feature New feature work label Aug 12, 2026
@coderabbitai

coderabbitai Bot commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: d7b5e641-575d-4115-868f-99af87970ebd

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@kattsushi kattsushi removed the type:feature New feature work label Aug 12, 2026
@kattsushi kattsushi added the type:chore Maintenance/tooling work label Aug 12, 2026
@kattsushi
kattsushi marked this pull request as ready for review August 12, 2026 14:26
@kattsushi
kattsushi merged commit 2ad43e0 into feat/app-builder-v1-parity-migration Aug 13, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type:chore Maintenance/tooling work

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant