feat: interface registry for cross-IU contract consistency#11
Open
feat: interface registry for cross-IU contract consistency#11
Conversation
Users with a Claude Pro/Max subscription but no API key can now use Phoenix code generation via the `claude` CLI. The provider auto-detects when the CLI is available and falls back to it when no ANTHROPIC_API_KEY or OPENAI_API_KEY is set. - New `ClaudeCliProvider` in `src/llm/claude-cli.ts` pipes prompts via stdin to `claude -p` with `--system-prompt` for system messages - Provider resolution auto-detects `claude` CLI as third-priority fallback - Also adds missing `@types/node` dev dependency needed for build Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
IUs that depend on each other (e.g., Web Experience calling the Tasks API) previously derived mount paths independently in the scaffold and prompt builder, leading to mismatches like /todos vs /tasks. The LLM could also ignore path instructions entirely. This adds an interface registry — a single source of truth for how each IU is exposed at the architecture level: - New `InterfaceEntry` type and `deriveInterfaces()` in scaffold.ts, computed from the IU plan and canonical nodes - Resource field descriptions extracted from canonical "has" statements so consumer IUs know the provider's data shape - Both scaffold (server.ts mount paths) and prompt builder read from the same registry instead of deriving paths independently - Post-processing step in regen.ts rewrites any fetch() paths that don't match the registry, using stem/synonym matching - Claude CLI provider timeout increased to 10 minutes for large UIs Co-Authored-By: Claude Opus 4.6 (1M context) <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.
Summary
/todoswhen tasks are mounted at/tasks)Problem
Two IUs that need to interact (Web Experience consuming the Tasks API) were generated independently with no shared contract. The mount path was derived separately in the scaffold generator and the prompt builder using the same heuristic — but the LLM could ignore the prompt instruction entirely and invent its own paths. This caused 404s at runtime.
Approach
The architecture target computes the interface registry from the IU plan — this is an internal compilation artifact, not a conservation layer. Both the scaffold (server.ts mount paths) and the prompt builder read from the same registry. A post-processing step in regen.ts rewrites any
fetch()paths that don't match the registry using stem/synonym matching (todo→task, etc.).Resource field descriptions are extracted from canonical "has" statements (e.g., "a project has a name and a color") and included in the prompt so consumer IUs know the provider's data shape.
Changes
src/scaffold.ts: NewInterfaceEntrytype,deriveInterfaces()function,extractResourceFields().generateScaffold()uses registry for mount paths instead of inline derivation.src/llm/prompt.ts:buildPrompt()acceptsInterfaceEntry[]instead ofstring[]. Includes resource shape in sibling module context.src/regen.ts:RegenContextcarriesinterfaces. NewrepairFetchPaths()post-processor withresourceSimilarity()scoring.src/cli.ts: Both bootstrap and regen computederiveInterfaces()once and pass to RegenContext + scaffold.Test plan
/tasksand/projects(matching mount paths)/todos→/taskswhen LLM ignores instructions🤖 Generated with Claude Code