Skip to content

feat(project): tree-based scaffolding for agentcore project create - #1809

Merged
tejaskash merged 8 commits into
refactorfrom
feat/asset-manager-core
Jul 30, 2026
Merged

feat(project): tree-based scaffolding for agentcore project create#1809
tejaskash merged 8 commits into
refactorfrom
feat/asset-manager-core

Conversation

@tejaskash

@tejaskash tejaskash commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

Summary

Implements agentcore project create with a tree-based scaffolding subsystem. A project is modeled as a file tree (dir/file nodes) . The writer is unaware of the underlying runtime, but here's where files are actually read from:

  • Node / dev / npm dist → reads assets from src/assets/ on disk
  • compiled standalone binary → reads from Bun.embeddedFiles

scripts/build.ts embeds assets by naming (agentcore-assets/[dir]/[name].[ext]) via a file-loader plugin, so no per-file with { type: "file" } import attributes are needed.

Testing

  • bun run typecheck — clean
  • oxlint — clean
  • bun test — 263 pass
  • Verified end to end on both the compiled binary (embedded assets) and the node bundle (mirrored dist/assets/): project create --project-name MyAgent scaffolds ./MyAgent/, and a re-run refuses to overwrite

@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 22, 2026
@tejaskash
tejaskash force-pushed the feat/asset-manager-core branch 2 times, most recently from 7a9663a to 15433db Compare July 22, 2026 20:38
@codecov-commenter

codecov-commenter commented Jul 22, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 96.28099% with 9 lines in your changes missing coverage. Please review.
✅ Project coverage is 95.65%. Comparing base (872fa2c) to head (d1a704f).

Files with missing lines Patch % Lines
src/core/project/source.ts 82.60% 8 Missing ⚠️
src/core/project/compose.ts 98.03% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##           refactor    #1809      +/-   ##
============================================
+ Coverage     95.64%   95.65%   +0.01%     
============================================
  Files           187      192       +5     
  Lines          8912     9147     +235     
============================================
+ Hits           8524     8750     +226     
- Misses          388      397       +9     

☔ 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/asset-manager-core branch from cafb131 to 356105c Compare July 22, 2026 21:06
Comment thread src/assets/cdk/README.md
Comment thread src/assets/cdk/lib/cdk-stack.ts
Comment thread src/assets/cdk/package.json
Comment thread src/io/atomicWrite.test.ts
Comment thread src/assetManager/types.ts Outdated
Comment thread src/assetManager/manager.ts Outdated
Comment thread src/assetManager/manager.ts Outdated
Comment thread src/assetManager/manager.ts Outdated
Hweinstock
Hweinstock previously approved these changes Jul 24, 2026
Comment thread src/assetManager/manager.ts Outdated
Comment thread src/assets/cdk/bin/cdk.ts Outdated

@AlexanderRichey AlexanderRichey 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.

I didn't see any blocking issues in this PR, but I have a number of questions whose answers I'd like to understand before approving.

Comment thread src/assetManager/manager.ts Outdated
Comment thread src/assetManager/manager.ts Outdated
Comment thread src/assetManager/manager.ts Outdated
Comment thread src/assetManager/types.ts Outdated
Comment thread src/assets/cdk/bin/cdk.ts Outdated
Comment thread src/assets/cdk/bin/cdk.ts Outdated
Comment thread src/assets/cdk/bin/cdk.ts
Comment thread src/assets/cdk/bin/cdk.ts
Comment thread src/assets/cdk/lib/cdk-stack.ts
Comment thread src/io/atomicWrite.test.ts
@tejaskash tejaskash changed the title feat(assets): add AssetManager and CDK scaffold templates feat(project): tree-based scaffolding for agentcore project create Jul 28, 2026

@aidandaly24 aidandaly24 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.

A few comments:

Comment thread src/project/compose.ts Outdated
Comment thread src/project/templates.ts Outdated
Comment thread src/handlers/project/types.ts
Comment thread scripts/build.ts Outdated
Comment thread scripts/build.ts Outdated
Comment thread src/project/compose.test.ts Outdated
Comment thread src/project/source.ts Outdated
Comment thread src/project/source.ts Outdated
Comment thread src/project/tree.ts Outdated
Comment thread src/core/project/tree.ts
Comment thread .gitignore
Comment thread src/project/source.test.ts Outdated
Comment thread scripts/build.ts Outdated
Comment thread src/core/project/source.ts Outdated
Comment thread src/core/project/templates.ts Outdated
Comment thread src/core/project/tree.ts Outdated
Comment thread src/io/atomicWrite.ts
Comment thread src/handlers/project/types.ts
tejaskash and others added 8 commits July 30, 2026 11:29
Introduce the asset embedding + rendering subsystem: AssetManager renders
asset trees from either Bun.embeddedFiles (compiled binary) or the source
filesystem (dev/node), applying Handlebars templating with HTML escaping
disabled and atomic writes.

- src/fs/atomicWrite: central temp-file + rename write util
- src/assetManager: AssetManager, types, barrel, tests, snapshot baseline
- src/assets/cdk: CDK project scaffold templates (payload, not source)
- tsconfig/bunfig/oxlint/prettier: exclude src/assets from all tooling
- add handlebars dependency
Remove comment about directory injection for testability.
Address review feedback on the AssetManager:
- Handlebars strict mode: a template referencing an undefined variable
  now throws instead of silently rendering an empty string into a
  generated project file.
- drop the speculative `docker` branch from the ignore-template rename;
  only git/npm ignores ship as assets today.
- use code-unit ordering for embedded files so both list paths
  (embedded and filesystem) sort identically and deterministically.
Address review feedback from @Hweinstock:
- rename AssetManager.ts -> manager.ts (only non-React .ts in the repo
  with an uppercase name; feature dirs use role-named lowercase files
  like core/project/manager.tsx).
- document AssetFile vs EmbeddedFile so the distinction between a
  resolved tree entry and a raw Bun.embeddedFiles blob is explicit.
- sync src/assets/cdk/package.json to the minor-version pins landed in
  #1777 (aws-cdk-lib ~2.261.0, @aws/agentcore-cdk 0.1.0-alpha.45, etc.).
Add a source-only TODO (HTML comment, invisible in the rendered README
shipped to generated projects) flagging that the agentcore deploy/status
commands may need a project prefix once the project CLI surface is final.
…urce

Replace AssetManager/render with a project tree: a runtime-blind writer
(writeTree over dir/file nodes) fed by a single asset-access seam (Source)
that reads from disk under Node and from Bun.embeddedFiles in the compiled
executable. scripts/build.ts embeds assets by naming so no per-file import
attributes are needed.

- project create takes a required --project-name and scaffolds into a fresh
  ./<name>/ directory (writeTree refuses to clobber existing files)
- Template carries a spec fragment spread over the fixed base, so a new
  template (runtimes/memories/harnesses) is a pure-data entry
- write agentcore.json inside agentcore/ so ConfigIO project discovery finds it
- mirror the CDK schema's reserved-name validation on --project-name
- rename the hello world runtime to hello_world (AgentNameSchema forbids hyphens)
- keep identifiers un-minified in builds so stack traces stay readable
- rebuild scripts/build.ts on runWithExitCode; Bun.build already throws on
  failure so reportAndExit was dead code
- rename Source to AssetSource; read() returns data, laziness moved to compose
- add modeled ProjectFileExistsError
- move src/project under src/core/project; test through FsProjectManager.create
- extract config resolvers in the vended bin/cdk.ts and fail early on zero
  targets (typechecked against the built @aws/agentcore-cdk)
Address review feedback:
- AssetSource implementations are now classes (EmbeddedAssetSource,
  FsAssetSource) matching how interfaces are implemented elsewhere
- TemplateSpec, Template, DirNode, and FileNode are types since they model
  concrete data, not extendable behavior
- ProjectFileExistsError extends AgentCoreCLIError with a user error source
  so it participates in error classification and exit codes
- atomicWrite moved from src/fs into the shared src/io module
@tejaskash
tejaskash force-pushed the feat/asset-manager-core branch from fd67b7c to d1a704f Compare July 30, 2026 15:31

@Hweinstock Hweinstock 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.

LGTM! one small error comment, but we can take that as a follow-up. I don't think its blocking

I also found one small edge case when manually testing, that could be addressed as a followup. If I create a project within a project, it appears to lift the child up to the root. For example,

bun run start project create --project-name root
cd root 
bun run start project create --project-name child
cd .. 

I see both root and child at the same level. I would have expected child inside root.

Comment thread src/assets/templates/hello-world-python/pyproject.toml
Comment thread src/core/project/source.ts
@tejaskash
tejaskash merged commit 8e2cecf into refactor Jul 30, 2026
8 checks passed
@tejaskash
tejaskash deleted the feat/asset-manager-core branch July 30, 2026 16:49
tejaskash added a commit that referenced this pull request Jul 30, 2026
… error

Post-review follow-ups from #1809:
- EmbeddedAssetSource.read now throws a modeled EmbeddedAssetNotFoundError
  instead of a bare Error.
- project create now walks up from cwd for an agentcore/agentcore.json
  marker and throws a modeled NestedProjectError (USER source) instead of
  scaffolding a project inside an existing one.
tejaskash added a commit that referenced this pull request Jul 30, 2026
… error (#1875)

Post-review follow-ups from #1809:
- EmbeddedAssetSource.read now throws a modeled EmbeddedAssetNotFoundError
  instead of a bare Error.
- project create now walks up from cwd for an agentcore/agentcore.json
  marker and throws a modeled NestedProjectError (USER source) instead of
  scaffolding a project inside an existing one.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants