Skip to content

feat: add VPC CLI flags to create and add commands [2/3]#425

Merged
tejaskash merged 2 commits intomainfrom
feat/vpc-2-cli-commands
Feb 24, 2026
Merged

feat: add VPC CLI flags to create and add commands [2/3]#425
tejaskash merged 2 commits intomainfrom
feat/vpc-2-cli-commands

Conversation

@tejaskash
Copy link
Copy Markdown
Contributor

Summary

Add --network-mode, --subnets, and --security-groups CLI flags to both create and add agent commands. Extract shared VPC utilities and propagate VPC configuration through the generation pipeline.

Depends on #424 (schema foundation). This PR includes those schema commits as a base.

Changes

  • Shared utilities (shared/vpc-utils.ts): parseCommaSeparatedList() and validateVpcOptions() helpers, extracted to avoid duplication across commands
  • GenerateConfig + schema mapper: Add VPC fields to GenerateConfig type; update mapGenerateConfigToAgent() to produce networkConfig when VPC mode
  • Create command: Add 3 new CLI flags, validation, and passthrough to createProjectWithAgent()
  • Add command: Add 3 new CLI flags, validation, and update both template-create and BYO agent paths

Files changed (14)

Area Files
Shared src/cli/commands/shared/vpc-utils.ts (new)
Operations schema-mapper.ts, generate/types.ts
Create types.ts, command.tsx, action.ts, validate.ts
Add types.ts, command.tsx, actions.ts, validate.ts
Tests schema-mapper.test.ts, create/validate.test.ts, add/validate.test.ts

Stack

This PR and PR 3/3 are independent — reviewable and mergeable in any order after PR 1/3.

Test plan

  • All unit tests pass (npm test)
  • TypeScript compiles clean
  • Lint and prettier pass
  • agentcore create --name test --defaults --network-mode VPC --subnets subnet-xxx --security-groups sg-xxx --dry-run
  • agentcore add agent --name vpc-agent --type byo --network-mode VPC --subnets subnet-xxx --security-groups sg-xxx

Fix NetworkModeSchema enum from PUBLIC|PRIVATE to PUBLIC|VPC to match
the AWS API. Add NetworkConfigSchema for subnet and security group
validation, and networkConfig field to AgentEnvSpec with cross-field
validation requiring networkConfig when networkMode is VPC.

Changes:
- Fix NetworkModeSchema enum: PRIVATE → VPC
- Add NetworkConfigSchema (subnet/SG ID regex, min/max array bounds)
- Add networkConfig optional field to AgentEnvSpec
- Add superRefine cross-field validation
- Update LLM-compacted schema documentation
- Add 13 new unit tests for VPC schema validation
Add --network-mode, --subnets, and --security-groups flags to both
the create and add agent CLI commands. Extract shared VPC parsing
and validation utilities. Propagate VPC configuration through
GenerateConfig and schema mapper to AgentEnvSpec.

Changes:
- Add shared/vpc-utils.ts with parseCommaSeparatedList and
  validateVpcOptions helpers
- Add VPC fields to GenerateConfig and CreateOptions/AddAgentOptions
- Update schema-mapper to propagate VPC fields to AgentEnvSpec
- Add VPC flags to create command with validation
- Add VPC flags to add agent command with validation
- Update BYO agent path to support VPC configuration
- Add 13 new unit tests for CLI validation and schema mapping
@github-actions
Copy link
Copy Markdown
Contributor

Coverage Report

Status Category Percentage Covered / Total
🔵 Lines 44.06% 2987 / 6779
🔵 Statements 43.65% 3145 / 7204
🔵 Functions 45.73% 617 / 1349
🔵 Branches 48.79% 1957 / 4011
Generated in workflow #631 for commit f1ddcda by the Vitest Coverage Report Action

Copy link
Copy Markdown
Contributor

@aidandaly24 aidandaly24 left a comment

Choose a reason for hiding this comment

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

very clean PR approved

@tejaskash tejaskash merged commit c75f4cd into main Feb 24, 2026
18 of 21 checks passed
@tejaskash tejaskash deleted the feat/vpc-2-cli-commands branch February 24, 2026 23:17
tejaskash added a commit that referenced this pull request Feb 27, 2026
tejaskash added a commit that referenced this pull request Feb 27, 2026
* Revert "feat: add VPC CLI flags to create and add commands [2/3] (#425)"

This reverts commit c75f4cd.

* Revert "feat: add VPC info messages to dev and invoke commands [3/3] (#426)"

This reverts commit 7a81b02.

* Revert "feat: add VPC network mode to schema (#424)"

This reverts commit 4180646.
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.

2 participants