Skip to content

feat(project): run npm install, uv sync, and git init after scaffolding - #1872

Open
tejaskash wants to merge 8 commits into
refactorfrom
feat/project-create-post-scaffold
Open

feat(project): run npm install, uv sync, and git init after scaffolding#1872
tejaskash wants to merge 8 commits into
refactorfrom
feat/project-create-post-scaffold

Conversation

@tejaskash

@tejaskash tejaskash commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

Summary

Stacked on #1809. After writing the project tree, agentcore project create now finishes the job so the scaffolded project is immediately usable:

  1. npm install in <project>/agentcore/cdk
  2. uv sync in <project>/app/<agent> (when the template ships a pyproject.toml)
  3. git init at the project root

New flags: --skip-install (skips npm + uv) and --skip-git.

Testing

  • 516/516 bun test (7 new exec tests, 5 new manager tests, 2 new handler tests); manifest snapshot updated for the README; tsc + Prettier clean.
  • Manual verification of all paths: full create (node_modules/.venv/.git present, npm/uv chatter in the log file, absent from terminal), each skip flag alone and combined, missing npm/git/uv (right error + exit 1, scaffold kept), failing npm install (captured output + retry hint), --json (stdout empty, progress on stderr), duplicate/reserved names, --help.

@github-actions github-actions Bot added the size/m PR size: M label Jul 30, 2026
@github-actions github-actions Bot added agentcore-harness-reviewing AgentCore Harness review in progress and removed agentcore-harness-reviewing AgentCore Harness review in progress labels Jul 30, 2026
Comment thread src/assets/templates/hello-world-python/README.md
@codecov-commenter

codecov-commenter commented Jul 30, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 96.00%. Comparing base (ec57799) to head (06154dd).

Additional details and impacted files
@@             Coverage Diff              @@
##           refactor    #1872      +/-   ##
============================================
- Coverage     96.01%   96.00%   -0.01%     
============================================
  Files           211      212       +1     
  Lines          9837     9938     +101     
============================================
+ Hits           9445     9541      +96     
- Misses          392      397       +5     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@tejaskash
tejaskash force-pushed the feat/project-create-post-scaffold branch from 051a519 to 0a39922 Compare July 30, 2026 15:46
Base automatically changed from feat/asset-manager-core to refactor July 30, 2026 16:49
@tejaskash
tejaskash force-pushed the feat/project-create-post-scaffold branch 2 times, most recently from b00c46a to e52b56e Compare July 30, 2026 18:40
Comment thread src/core/project/manager.tsx Outdated
Comment thread src/io/exec.ts Outdated
Comment thread src/handlers/project/create/index.ts
Comment thread src/handlers/project/create/index.ts Outdated
Comment thread src/io/exec.ts Outdated
Comment thread src/io/exec.ts
Comment thread src/core/project/manager.test.ts
@tejaskash
tejaskash force-pushed the feat/project-create-post-scaffold branch from e52b56e to 1516d07 Compare July 31, 2026 16:51
tejaskash added a commit that referenced this pull request Jul 31, 2026
The first executable slice of agentcore project dev. CodeZipDevRunner
bootstraps a uv venv (or node_modules) on first run, then serves the
entrypoint with uvicorn --reload (or tsx watch). spawnServer owns process
lifecycle: line-streamed logs, SIGTERM->SIGKILL escalation on stop, and a
process-group reaper so a detached server can't outlive the CLI and hold
the port.

The DevRunner interface lives with its consumer (handlers/project/dev),
per the dependency-inversion convention. Command execution and server
spawning are injectable, so runner tests never start real uv or uvicorn;
process tests use real short-lived node processes because process
handling is the thing under test.

run.ts duplicates the CommandRunner shape from #1872 deliberately; fold
into src/io/exec.ts once that lands.
@tejaskash
tejaskash force-pushed the feat/project-create-post-scaffold branch from 1516d07 to aa2cb04 Compare July 31, 2026 16:56
tejaskash added a commit that referenced this pull request Jul 31, 2026
The first executable slice of agentcore project dev. CodeZipDevRunner
bootstraps a uv venv (or node_modules) on first run, then serves the
entrypoint with uvicorn --reload (or tsx watch). spawnServer owns process
lifecycle: line-streamed logs, SIGTERM->SIGKILL escalation on stop, and a
process-group reaper so a detached server can't outlive the CLI and hold
the port.

The DevRunner interface lives with its consumer (handlers/project/dev),
per the dependency-inversion convention. Command execution and server
spawning are injectable, so runner tests never start real uv or uvicorn;
process tests use real short-lived node processes because process
handling is the thing under test.

run.ts duplicates the CommandRunner shape from #1872 deliberately; fold
into src/io/exec.ts once that lands.
Hweinstock
Hweinstock previously approved these changes Jul 31, 2026
Comment thread src/core/project/manager.test.ts
Comment thread src/io/exec.ts Outdated
Comment thread src/middleware/withTuiOnEmptyFlagsAndArgs.test.tsx
Comment thread src/middleware/withTuiOnEmptyFlagsAndArgs.test.tsx Outdated
After writing the project tree, `project create` now installs CDK
dependencies (npm install), syncs Python dependencies (uv sync, when the
template ships a pyproject.toml), and initializes a git repository —
skippable via --skip-install and --skip-git.

- src/io/exec.ts: minimal subprocess runner + tool-on-PATH check with
  modeled errors (MissingToolError, CommandFailedError). Uses
  node:child_process instead of Bun.$ because the npm bundle targets
  Node, where Bun APIs are unavailable.
- Progress steps and the success message stream to stderr through the
  injected AppIO; subprocess output streams to the file logger and is
  surfaced in the terminal only on failure, with a retry hint.
- A failed step keeps the scaffolded files (crash-only): the error tells
  the user how to rerun the step manually.
- Template gains a README (getting-started guide recommending Strands)
  wired through pyproject.toml — uv sync previously failed on hatchling
  metadata validation because the declared README did not exist.
…t PATH

CI runners don't have uv installed; FsProjectManager's requireTool calls
ran against the real PATH even with the fake command runner. checkTool is
now injectable alongside runner, defaulting to the real requireTool.
runCommand spawns through cmd.exe on Windows (shell: true for PATHEXT
resolution), which mangles the quoting of node -e one-liners — the
'boom; exit 3' script never ran, so the process exited 0 and the
rejection assertion failed. Write the scripts to temp files instead.
…ents

- Rename CommandRunner/runCommand/CommandFailedError to
  ProcessRunner/runProcess/ProcessFailedError: 'command' collides with
  the CLI's own command vocabulary; 'process' mirrors child_process.
- Replace the PATH-probing toolOnPath with toolAvailable, which runs
  '<tool> --version' — simpler and more reliable than reimplementing
  PATH/PATHEXT resolution.
- onProgress now emits a structured CreateProgressEvent instead of a
  bare string, leaving room for richer step info without a breaking
  change.
The emptiness check counted the parsed flags object, where schema and
Commander boolean defaults arrive as defined values — a leaf with any
defaulted flag (list --max-results, create --template/--skip-*) could
never open the TUI on a bare invocation. Use Commander's
getOptionValueSource to count only flags the user actually passed, so
mounting withTuiOnEmptyFlagsAndArgs on the project router later works
with the defaulted create flags.
Routes a real command tree with fully-defaulted flags: bare invocation
opens the TUI (TTY error under testIO), explicitly passed defaulted or
value flags and --json run the handler.
@tejaskash
tejaskash force-pushed the feat/project-create-post-scaffold branch from 7d9f510 to cf22add Compare July 31, 2026 20:19
- toolAvailable/requireTool take probeArgs (default --version) for
  tools like ssh that only support -V.
- Collapse the three headless-branch middleware tests into test.each
  and drop the over-explaining harness comment.
tejaskash added a commit that referenced this pull request Aug 3, 2026
The first executable slice of agentcore project dev. CodeZipDevRunner
bootstraps a uv venv (or node_modules) on first run, then serves the
entrypoint with uvicorn --reload (or tsx watch). spawnServer owns process
lifecycle: line-streamed logs, SIGTERM->SIGKILL escalation on stop, and a
process-group reaper so a detached server can't outlive the CLI and hold
the port.

The DevRunner interface lives with its consumer (handlers/project/dev),
per the dependency-inversion convention. Command execution and server
spawning are injectable, so runner tests never start real uv or uvicorn;
process tests use real short-lived node processes because process
handling is the thing under test.

run.ts duplicates the CommandRunner shape from #1872 deliberately; fold
into src/io/exec.ts once that lands.
tejaskash added a commit that referenced this pull request Aug 3, 2026
The first executable slice of agentcore project dev. CodeZipDevRunner
bootstraps a uv venv (or node_modules) on first run, then serves the
entrypoint with uvicorn --reload (or tsx watch). spawnServer owns process
lifecycle: line-streamed logs, SIGTERM->SIGKILL escalation on stop, and a
process-group reaper so a detached server can't outlive the CLI and hold
the port.

The DevRunner interface lives with its consumer (handlers/project/dev),
per the dependency-inversion convention. Command execution and server
spawning are injectable, so runner tests never start real uv or uvicorn;
process tests use real short-lived node processes because process
handling is the thing under test.

run.ts duplicates the CommandRunner shape from #1872 deliberately; fold
into src/io/exec.ts once that lands.
tejaskash added a commit that referenced this pull request Aug 3, 2026
The first executable slice of agentcore project dev. CodeZipDevRunner
bootstraps a uv venv (or node_modules) on first run, then serves the
entrypoint with uvicorn --reload (or tsx watch). spawnServer owns process
lifecycle: line-streamed logs, SIGTERM->SIGKILL escalation on stop, and a
process-group reaper so a detached server can't outlive the CLI and hold
the port.

The DevRunner interface lives with its consumer (handlers/project/dev),
per the dependency-inversion convention. Command execution and server
spawning are injectable, so runner tests never start real uv or uvicorn;
process tests use real short-lived node processes because process
handling is the thing under test.

run.ts duplicates the CommandRunner shape from #1872 deliberately; fold
into src/io/exec.ts once that lands.
tejaskash added a commit that referenced this pull request Aug 3, 2026
The first executable slice of agentcore project dev. CodeZipDevRunner
bootstraps a uv venv (or node_modules) on first run, then serves the
entrypoint with uvicorn --reload (or tsx watch). spawnServer owns process
lifecycle: line-streamed logs, SIGTERM->SIGKILL escalation on stop, and a
process-group reaper so a detached server can't outlive the CLI and hold
the port.

The DevRunner interface lives with its consumer (handlers/project/dev),
per the dependency-inversion convention. Command execution and server
spawning are injectable, so runner tests never start real uv or uvicorn;
process tests use real short-lived node processes because process
handling is the thing under test.

run.ts duplicates the CommandRunner shape from #1872 deliberately; fold
into src/io/exec.ts once that lands.

@notgitika notgitika left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good to me thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/m PR size: M

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants