feat(project): container template, .env.local/.gitignore scaffolding, and project resolution - #1880
Open
tejaskash wants to merge 8 commits into
Open
feat(project): container template, .env.local/.gitignore scaffolding, and project resolution#1880tejaskash wants to merge 8 commits into
tejaskash wants to merge 8 commits into
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## refactor #1880 +/- ##
============================================
+ Coverage 95.98% 96.01% +0.03%
============================================
Files 208 208
Lines 9684 9764 +80
============================================
+ Hits 9295 9375 +80
Misses 389 389 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Same agent code as the CodeZip template packaged for a Container build: a static uv-based Dockerfile (no render-time conditionals), a .dockerignore rendered from dockerignore.template via the existing ignore-file mechanism, and a Container runtime entry (with dockerfile) in agentcore.json.
Every template now gets a project-root .gitignore (env files, Python/Node artifacts, CLI state, cdk.out) and a commented agentcore/.env.local that agentcore dev will load. Both render from shared *.template assets because npm strips real dotfiles when publishing.
FsProjectManager.resolve now walks up from the given path for the agentcore/agentcore.json marker, validates the spec against the new ProjectSpecSchema (loose, so specs carrying sections we don't read yet still resolve), and returns the widened Project model (rootPath + runtimes). A missing project resolves to undefined; a present-but-broken config throws InvalidProjectConfigError instead of masquerading as 'no project'. withProject now throws a typed NoProjectError and is mounted on every project subcommand except create, which runs where no project exists yet. The search root prefers INIT_CWD since package-manager scripts change process.cwd().
pyproject.toml declares readme = README.md; without the file, uv sync fails the hatchling build inside the container image. A starter README is also just better scaffolding.
TemplateSpec.runtimes is now ProjectRuntime[] so template/schema drift is a compile error and create() returns the spec directly instead of re-parsing it through zod.
It was a private bare-Error subclass inside FsReadWriteJson (with a TODO to model it properly). It now extends AgentCoreCLIError alongside the other typed errors, and FsProjectManager.resolve catches it by type instead of sniffing error.cause.
NestedProjectError, InvalidProjectConfigError, ProjectFileExistsError, EmbeddedAssetNotFoundError, InvalidEnvironmentError, and the runtime invoke errors were defined next to their throw sites. All typed errors now live in src/errors like the telemetry model expects; the invoke errors.ts file is gone.
tejaskash
force-pushed
the
feat/project-foundation
branch
from
July 31, 2026 17:06
0fd7837 to
3c9ec6c
Compare
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.
First PR for
agentcore project dev. Before we can run anything locally, two things need to exist: a way to create a container-based project, and a way for commands to find the project they're running in. This PR does both.What changed
Added a
hello-world-python-containertemplate. It's the same Strands agent as the existing template, just built as a container instead of a CodeZip. The Dockerfile is static on purpose — no handlebars conditionals like the old CLI had, since our asset pipeline is a plain byte copy.New projects also get a root
.gitignoreand anagentcore/.env.localstarter file. The dev command will load.env.localin a later PR. These render from*.templateassets because npm strips dotfiles when publishing.While copying the template I found that
pyproject.tomlpoints at aREADME.mdwe never shipped. That silently worked for CodeZip but breaks the container build (uv syncruns hatchling, hatchling errors on the missing readme). Both templates now ship a README.FsProjectManager.resolve()is implemented: walk up from cwd looking foragentcore/agentcore.json, same as git looks for.git. The parsed spec is validated loosely, so projects from the current CLI that carry sections we don't read yet (memories, gateways) still resolve. Two failure modes are now distinct: no project found returnsundefined(the middleware turns that intoNoProjectErrorwith a hint to runproject create), while a broken config throwsInvalidProjectConfigErrorwith the zod details. The old CLI conflated these — a JSON typo showed up as "no project found".withProjectis now mounted on every project subcommand exceptcreate, so handlers just read the project off the context.Testing
The main test is a round-trip:
createa project from each template,resolveit from a nested subdirectory, and check the models match. Plus coverage for the miss/malformed/legacy cases. 554 tests pass.What's next
This is 1 of 6 planned PRs for dev: dev server core + CodeZip runner, container runner, OTLP collector, the Agent Inspector web server, and finally the
project devhandler that wires it together.