Repository navigation
feat(targets): allow hyphens in target names - #2577
Merged
Merged
Conversation
Contributor
|
Claude Security Review: no high-confidence findings. (run) |
Contributor
There was a problem hiding this comment.
AgentCore Harness Review
Verdict: Looks good
The change is tightly scoped and the risk model is well captured in the PR description:
DeploymentTargetNameSchemais relaxed from alphanumeric-only to^[a-zA-Z][a-zA-Z0-9-]*$, matching the v0 CLI's exact rule so existing projects with names likeprod-uskeep validating.requireDeployedNameFitsinsrc/handlers/project/add/shared.tsis the only place where the CLI composes a physical name from a target, and it now mirrors the L3 behavior (hyphens stay for-//-separated resources, hyphens become underscores for_-separated resources). Length is preserved under the transform, so the add-time check stays accurate.- Tests exercise both separators with a hyphenated target and use real on-disk
aws-targets.jsoninstead of mocking (good). - The dependency on
agentcore-l3-cdk-constructs#421is called out in the description, and the deliberate decision not to add a cross-target collision check is explained.
A few things I verified that are not blockers, just noting so the author knows they were considered:
- The regex permits trailing hyphens (e.g.
trailing-). This flows into the CFN stack nameAgentCore-<project>-<target>, which CFN permits, and does not reach ECR (which composes${project}/${agentName}without the target). So this is fine, and it matches v0 behavior. - The error message in
requireDeployedNameFitsreports the raw target (prod-us1) as "longest declared target" while the composed deployed name showsprod_us1. Slight UX asymmetry, but the composed name is right there in the same message, so a user can see what happened.
No telemetry additions needed — this is a validation plumbing change with no new user-facing feature surface.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## refactor #2577 +/- ##
=========================================
Coverage 97.54% 97.54%
=========================================
Files 657 657
Lines 48779 48780 +1
=========================================
+ Hits 47580 47581 +1
Misses 1199 1199 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
notgitika
marked this pull request as ready for review
October 13, 2026 07:19
nborges-aws
approved these changes
Oct 13, 2026
notgitika
pushed a commit
to notgitika/agentcore-cli
that referenced
this pull request
Oct 13, 2026
aws#2575 and aws#2577 agentcore migrate replaces the preview and apply subcommands, following the Terraform apply model: it checks the project and prints the plan, then applies it. Applying lands next, so for now it prints the plan, says applying isn't available yet, and exits 0 when the plan is ready and 1 when it isn't. With aws#2575 merged, agentcore deploy deploys a v0 project with the v0 CLI, so the steps the plan suggests use it instead of npx @aws/agentcore@0. With aws#2577 merged, hyphenated target names are valid in v1, so they no longer block a migration.
10 of 18 tasks
notgitika
pushed a commit
to notgitika/agentcore-cli
that referenced
this pull request
Oct 13, 2026
aws#2575 and aws#2577 agentcore migrate replaces the preview and apply subcommands, following the Terraform apply model: it checks the project and prints the plan, then applies it. Applying lands next, so for now it prints the plan, says applying isn't available yet, and exits 0 when the plan is ready and 1 when it isn't. With aws#2575 merged, agentcore deploy deploys a v0 project with the v0 CLI, so the steps the plan suggests use it instead of npx @aws/agentcore@0. With aws#2577 merged, hyphenated target names are valid in v1, so they no longer block a migration.
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.
Description
Deployment target names can now contain hyphens (for example
prod-us), using the exact v0 rule^[a-zA-Z][a-zA-Z0-9-]*$. v0 projects already have names like this and can't rename them, because the stack name depends on them.The add-time length check (
requireDeployedNameFits) now predicts the name the way the L3 composes it: with the_separator the target's hyphens become underscores;-and/keep them. That's the only place the CLI builds a physical name from a target. Deployed lookups read the real stack name from CloudFormation, and credential provider names allow-.Depends on aws/agentcore-l3-cdk-constructs#421. Without it, a v1 project with a hyphenated target passes validation but fails at synth. Land that first and bump the library.
There's deliberately no collision check across targets (see the L3 PR).
Type of Change
Testing
bun testbun run typecheckbun run lint:checkbun run format:checkChecklist
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the
terms of your choice.