Run the CLI on the embedded API (one orchestration layer)#18
Merged
Conversation
The flagship follow-up from the 3.0 approval review. The CLI generated files by calling the core directly and writing with its own writer, so it was the one surface not sharing the embedded pipeline's diagnostics, collision handling, and path safety. It now resolves and generates through the embedded API: - resolveProjectConfig (new) resolves preset + overrides and returns the config plus normalization diagnostics WITHOUT generating, so the CLI can still do its Node-floor check and remote resolution on the resolved config before generating. - createProjectFromResolvedConfig (new) builds the project from that config (after the CLI sets things like repo), carrying the diagnostics. - writeGeneratedProject replaces the CLI's direct writeProject; --merge maps to the 'skip' collision policy. The side effects the embedded API deliberately never performs — git init, install, creating the remote — stay in the CLI adapter, unchanged. Behavior verified identical: exact file parity on ts-lib; --merge keeps existing files and reports them; the non-empty abort still fires; the --git-remote path still inits git, writes the lockfile, and pushes; and install still runs and the project builds. The CLI additionally now surfaces coercion warnings it previously swallowed (e.g. "Storybook was disabled because it only applies to a component library"). Also: removed a dead reactEntry() reference in meta.js (unreachable — libraryEntry only runs for non-framework libraries; a --checkJs pass surfaced it), and wrote ARCHITECTURE.md codifying the six layering principles from the review. 87 tests pass (2 new for the two-phase entry points); CLI, web, MCP all verified unchanged. Co-Authored-By: Claude Opus 4.8 <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.
The flagship follow-up from the 3.0 approval review: "make the CLI consume the embedded API… everything else becomes adapters."
Before this, the CLI was the one surface not sharing the embedded pipeline — it called the core's
generatedirectly and wrote with its own writer, so its diagnostics, collision handling, and path safety could drift from what host apps, and even the CLI's own MCP sibling, get.What changed
Generation and resolution are split so the CLI can keep doing its pre-generation work (Node-floor check, remote resolution) on the resolved config:
resolveProjectConfig(input)(new, public) — resolves preset + overrides, returns{ config, diagnostics }without generating.createProjectFromResolvedConfig(config, { diagnostics })(new, public) — builds the project from that config after the CLI has set fields likerepo, carrying the resolution diagnostics through.writeGeneratedProjectinstead of its ownwriteProject;--mergemaps to theskipcollision policy.The side effects the embedded API deliberately never performs —
git init, install, creating the remote — stay in the CLI adapter, untouched.Behavior preserved — verified, not assumed
ts-lib -yfile set--mergeinto a non-empty dir--merge--git-remoteAnd a genuine improvement falls out of the unification: the CLI now surfaces coercion warnings it used to swallow — e.g.
⚠ Storybook was disabled because it only applies to a component library.Also in here
ARCHITECTURE.md— the six layering principles from the review, written down as rules.reactEntry()reference inmeta.js(unreachable:libraryEntryonly runs for non-framework libraries). A--checkJspass surfaced it — which is the kind of thing the next follow-up (self-enforcement) will catch automatically.87 tests pass (2 new covering the two-phase entry points and that a post-resolution
repostill bakes in). Web configurator and MCP verified unchanged.🤖 Generated with Claude Code