Consolidate Container-only fields (dockerfile, buildContextPath, customDockerBuildArgs) into a containerConfig object

Open
#1,703 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
48/100
Issue type
Refactor
Clarity
Mostly clear
Activity status
Quiet
Tech stack
typescript
Domain
cli, tooling

Research direction

Read the two AgentEnvSpec schema files and the existing networkConfig pattern first, then trace the listed CLI and CDK consumers: packaging/container.ts, dev/config.ts, dev/container-dev-server.ts, deploy/preflight.ts, AgentEnvironment, and ContainerSourceAsset. Done means the container-only fields are grouped consistently, docs and asset snapshots are updated, and the migration note or back-compat decision is addressed.

Written by the indexing model from the issue text.

Description

Summary

With aws/agentcore-cli#1284, Container agents now have three flat, Container-only fields on AgentEnvSpec: dockerfile, buildContextPath, and customDockerBuildArgs — plus cross-cutting "only allowed for Container builds" validators for each.

Both AgentEnvSpecSchema copies (CLI and @aws/agentcore-cdk) already carry a standing comment near the validators:

If adding more Container-specific fields, consider consolidating into a containerConfig object (see networkConfig pattern)

We've now hit that threshold. This tracks grouping them under a single optional object:

containerConfig?: {
  dockerfile?: string;
  buildContextPath?: string;
  customDockerBuildArgs?: Record<string, string>;
}
Benefits
  • One build !== 'Container' && data.containerConfig check instead of three per-field validators.
  • Future container-only options land inside containerConfig with no new cross-cutting validators.
  • Clearer grouping in the schema and docs (mirrors the existing networkConfig pattern).
Why it's deferred

This is a breaking schema change: it moves the already-shipped dockerfile field, touches every consumer, existing user agentcore.json files, and asset snapshots — and would have ballooned a contributor PR. Better as its own scoped change (with a migration note / back-compat shim if we want to keep accepting the flat form for a release).

Scope
  • CLI: src/schema/schemas/agent-env.ts (+ compacted mirror), consumers (packaging/container.ts, dev/config.ts, dev/container-dev-server.ts, deploy/preflight.ts), docs, snapshots.
  • @aws/agentcore-cdk: src/schema/schemas/agent-env.ts (+ compacted mirror), AgentEnvironment, ContainerSourceAsset.

Ref: review comment on aws/agentcore-cli#1284.

Dominant language
TypeScript
Stars
339
Forks
129
Avg merge
19h 21m
Merged PRs (30d)
125

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from aws/agentcore-cli

All issues in aws/agentcore-cli

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.