Skip to content

feat(framework): extend an existing project instead of rebuilding it (#185)#217

Merged
suleimansh merged 1 commit into
mainfrom
feat/existing-project-support
Jul 4, 2026
Merged

feat(framework): extend an existing project instead of rebuilding it (#185)#217
suleimansh merged 1 commit into
mainfrom
feat/existing-project-support

Conversation

@suleimansh

Copy link
Copy Markdown
Member

Makes the framework usable on projects that already exist, not just from-scratch. Closes #185 (part of #110).

Two things made an existing-project run a poor fit. Part 1 (live preset detection wired to the real workspace) was already fixed by the #190 work (cli.ts now reads readProjectSignals(cwd) for live runs). This PR does part 2: the prompts were greenfield-phrased.

driverBuild now picks framing by whether the workspace already has source:

  • empty -> the greenfield buildPrompt (scaffold from scratch), unchanged.
  • non-empty (existing project) -> a new extendPrompt: work within the codebase, read it, follow its conventions, make the smallest coherent change that adds what was asked, do not rebuild or swap the stack.

Detection reuses isWorkspaceEmpty (#182) and is gated on verifyWorkspace, so --fake always takes the greenfield path and stays deterministic. driverImprove already framed existing projects correctly (its "smallest changes" prompt), and the empty-workspace scaffold retry can't fire on a non-empty dir, so no change there.

New exports: extendPrompt, isWorkspaceEmpty. 85 tests pass (3 new; the extend path is driven directly via a FakeDriver that captures the exact prompt sent).

Note: the architect step still narrates a stack decision the same way for existing projects (it reads the files and reports the real stack, so it's informational, not a rebuild). Tightening that to explicitly "analyze, don't re-pick" is a small possible follow-up if we want it.

…185)

When the workspace already holds source, driverBuild now frames the wrapped
agent to work within the existing codebase (read it, follow its conventions,
add what was asked) via a new extendPrompt, instead of the greenfield
'scaffold from scratch' buildPrompt. Detection reuses isWorkspaceEmpty and is
gated on verifyWorkspace, so the fake driver stays greenfield and deterministic.
Greenfield (empty workspace) behavior is unchanged; improve already framed
existing projects correctly. With live preset detection already wired from the
real cwd, an existing project now detects its real stack and extends it.

New exports: extendPrompt, isWorkspaceEmpty.

Part of #110. Closes #185.
@suleimansh suleimansh added enhancement New feature or request priority: medium Worth doing, not urgent labels Jul 4, 2026
@suleimansh suleimansh self-assigned this Jul 4, 2026
@suleimansh suleimansh merged commit 97b2943 into main Jul 4, 2026
2 checks passed
@suleimansh suleimansh deleted the feat/existing-project-support branch July 4, 2026 18:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request priority: medium Worth doing, not urgent

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support running against an existing project (not just from-scratch)

1 participant