Skip to content

Commit 9783cf7

Browse files
authored
fix(cli): correct inaccurate --help text across all commands (#695)
* fix(cli): correct inaccurate --help text across all commands Audit and fix help text for all CLI commands and primitives: - Fix agent name constraints: "max 64 chars" → "max 48 chars", add "underscores" to allowed characters - Fix project name constraint: "max 36 chars" → "max 23 chars" - Remove CrewAI from framework lists (not user-accessible) - Fix "Remove a agent" → "Remove an agent" grammar - Add missing resource types (evaluator, online-eval) to status --type - Remove phantom 'edit' command from COMMAND_DESCRIPTIONS - Remove false --agent-arn claim from evals description - Add [non-interactive] markers to all options missing them in EvaluatorPrimitive, GatewayPrimitive, GatewayTargetPrimitive, and PolicyEnginePrimitive - Improve gateway and gateway-target help descriptions for clarity - Update AGENTS.md to match current CLI reality Constraint: Help text and Zod schemas are defined in separate files with no shared constant Confidence: high Scope-risk: narrow Not-tested: Interactive TUI mode (only CLI --help verified) * fix(cli): add [non-interactive] markers to new upstream options Fix help text for options added in upstream PRs #652, #653, #657, #620: - dev: add [non-interactive] to --tool, --input, -H/--header - invoke: add [non-interactive] to -H/--header - fetch access: add [non-interactive] to --name, --type, --target, --json - copy.ts: add missing 'import' command description Confidence: high Scope-risk: narrow * docs(AGENTS.md): add Global Options section and update command list - Add Global Options section documenting -h/--help and --version - Add missing 'import' command to CLI Commands list - Update 'fetch access' description to include agent support Confidence: high Scope-risk: narrow
1 parent 2f1d59f commit 9783cf7

12 files changed

Lines changed: 125 additions & 84 deletions

File tree

AGENTS.md

Lines changed: 22 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -21,17 +21,28 @@ src/
2121

2222
Note: CDK L3 constructs are in a separate package `@aws/agentcore-cdk`.
2323

24+
## Global Options
25+
26+
These options are available on all commands:
27+
28+
- `-h, --help` - Show help for any command
29+
- `--version` - Print CLI version (root command only)
30+
2431
## CLI Commands
2532

2633
- `create` - Create new AgentCore project
27-
- `add` - Add resources (agent, memory, identity, evaluator, online-eval, target)
28-
- `remove` - Remove resources (agent, memory, identity, evaluator, online-eval, target, all)
34+
- `add` - Add resources (agent, memory, identity, evaluator, online-eval, gateway, gateway-target, policy-engine,
35+
policy)
36+
- `remove` - Remove resources (agent, memory, identity, evaluator, online-eval, gateway, gateway-target, policy-engine,
37+
policy, all)
2938
- `deploy` - Deploy infrastructure to AWS
3039
- `status` - Check deployment status
3140
- `dev` - Local development server (CodeZip: uvicorn with hot-reload; Container: Docker build + run with volume mount)
3241
- `invoke` - Invoke agents (local or deployed)
3342
- `run eval` - Run on-demand evaluation against agent sessions
3443
- `evals history` - View past eval run results
44+
- `fetch access` - Fetch access info for a deployed gateway or agent
45+
- `import` - Import resources from a Bedrock AgentCore Starter Toolkit project
3546
- `pause online-eval` - Pause (disable) a deployed online eval config
3647
- `resume online-eval` - Resume (enable) a paused online eval config
3748
- `logs` - Stream or search agent runtime logs
@@ -45,8 +56,7 @@ Note: CDK L3 constructs are in a separate package `@aws/agentcore-cdk`.
4556

4657
### Agent Types
4758

48-
- **Template agents**: Created from framework templates (Strands, LangChain_LangGraph, CrewAI, GoogleADK, OpenAIAgents,
49-
AutoGen)
59+
- **Template agents**: Created from framework templates (Strands, LangChain_LangGraph, GoogleADK, OpenAIAgents)
5060
- **BYO agents**: Bring your own code with `agentcore add agent --type byo`
5161
- **Imported agents**: Import from Bedrock Agents with `agentcore add agent --type import`
5262

@@ -58,10 +68,10 @@ Note: CDK L3 constructs are in a separate package `@aws/agentcore-cdk`.
5868

5969
## Primitives Architecture
6070

61-
All resource types (agent, memory, identity, evaluator, online-eval, gateway, mcp-tool) are modeled as **primitives** --
62-
self-contained classes in `src/cli/primitives/` that own the full add/remove lifecycle for their resource type.
63-
Resources support config-driven tagging via `agentcore.json` and `mcp.json`, with tags flowing through to deployed
64-
CloudFormation resources.
71+
All resource types (agent, memory, identity, evaluator, online-eval, gateway, gateway-target, policy-engine, policy) are
72+
modeled as **primitives** -- self-contained classes in `src/cli/primitives/` that own the full add/remove lifecycle for
73+
their resource type. Resources support config-driven tagging via `agentcore.json` and `mcp.json`, with tags flowing
74+
through to deployed CloudFormation resources.
6575

6676
Each primitive extends `BasePrimitive` and implements: `add()`, `remove()`, `previewRemove()`, `getRemovable()`,
6777
`registerCommands()`, and `addScreen()`.
@@ -73,8 +83,10 @@ Current primitives:
7383
- `CredentialPrimitive` — credential/identity creation, .env management, removal
7484
- `EvaluatorPrimitive` — custom evaluator creation/removal with cross-reference validation
7585
- `OnlineEvalConfigPrimitive` — online eval config creation/removal
76-
- `GatewayPrimitive` — MCP gateway creation/removal
77-
- `GatewayTargetPrimitive` — MCP tool creation/removal with code generation
86+
- `GatewayPrimitive` — gateway creation/removal
87+
- `GatewayTargetPrimitive` — gateway target creation/removal with code generation
88+
- `PolicyEnginePrimitive` — Cedar policy engine creation/removal
89+
- `PolicyPrimitive` — Cedar policy creation/removal within policy engines
7890

7991
Singletons are created in `registry.ts` and wired into CLI commands via `cli.ts`. See `src/cli/AGENTS.md` for details on
8092
adding new primitives.

src/cli/commands/create/command.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -159,14 +159,14 @@ export const registerCreate = (program: Command) => {
159159
program
160160
.command('create')
161161
.description(COMMAND_DESCRIPTIONS.create)
162-
.option('--name <name>', 'Project name (start with letter, alphanumeric only, max 36 chars) [non-interactive]')
162+
.option('--name <name>', 'Project name (start with letter, alphanumeric only, max 23 chars) [non-interactive]')
163163
.option('--no-agent', 'Skip agent creation [non-interactive]')
164164
.option('--defaults', 'Use defaults (Python, Strands, Bedrock, no memory) [non-interactive]')
165165
.option('--build <type>', 'Build type: CodeZip or Container (default: CodeZip) [non-interactive]')
166166
.option('--language <language>', 'Target language (default: Python) [non-interactive]')
167167
.option(
168168
'--framework <framework>',
169-
'Agent framework (Strands, LangChain_LangGraph, CrewAI, GoogleADK, OpenAIAgents) [non-interactive]'
169+
'Agent framework (Strands, LangChain_LangGraph, GoogleADK, OpenAIAgents) [non-interactive]'
170170
)
171171
.option('--model-provider <provider>', 'Model provider (Bedrock, Anthropic, OpenAI, Gemini) [non-interactive]')
172172
.option('--api-key <key>', 'API key for non-Bedrock providers [non-interactive]')

src/cli/commands/dev/command.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -142,11 +142,11 @@ export const registerDev = (program: Command) => {
142142
.option('-i, --invoke <prompt>', 'Invoke running dev server (use --agent if multiple) [non-interactive]')
143143
.option('-s, --stream', 'Stream response when using --invoke [non-interactive]')
144144
.option('-l, --logs', 'Run dev server with logs to stdout [non-interactive]')
145-
.option('--tool <name>', 'MCP tool name (used with --invoke call-tool)')
146-
.option('--input <json>', 'MCP tool arguments as JSON (used with --invoke call-tool)')
145+
.option('--tool <name>', 'MCP tool name (used with --invoke call-tool) [non-interactive]')
146+
.option('--input <json>', 'MCP tool arguments as JSON (used with --invoke call-tool) [non-interactive]')
147147
.option(
148148
'-H, --header <header>',
149-
'Custom header to forward to the agent (format: "Name: Value", repeatable)',
149+
'Custom header to forward to the agent (format: "Name: Value", repeatable) [non-interactive]',
150150
(val: string, prev: string[]) => [...prev, val],
151151
[] as string[]
152152
)

src/cli/commands/fetch/command.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@ export const registerFetch = (program: Command) => {
1313
fetchCmd
1414
.command('access')
1515
.description('Fetch access info (URL, token, auth guidance) for a deployed gateway or agent.')
16-
.option('--name <resource>', 'Gateway or agent name')
17-
.option('--type <type>', 'Resource type: gateway (default) or agent', 'gateway')
18-
.option('--target <target>', 'Deployment target')
19-
.option('--json', 'Output as JSON')
16+
.option('--name <resource>', 'Gateway or agent name [non-interactive]')
17+
.option('--type <type>', 'Resource type: gateway (default) or agent [non-interactive]', 'gateway')
18+
.option('--target <target>', 'Deployment target [non-interactive]')
19+
.option('--json', 'Output as JSON [non-interactive]')
2020
.action(async (cliOptions: Record<string, unknown>) => {
2121
const options = cliOptions as unknown as FetchAccessOptions;
2222
requireProject();

src/cli/commands/invoke/command.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ export const registerInvoke = (program: Command) => {
106106
.option('--input <json>', 'MCP tool arguments as JSON (use with --tool) [non-interactive]')
107107
.option(
108108
'-H, --header <header>',
109-
'Custom header to forward to the agent (format: "Name: Value", repeatable)',
109+
'Custom header to forward to the agent (format: "Name: Value", repeatable) [non-interactive]',
110110
(val: string, prev: string[]) => [...prev, val],
111111
[] as string[]
112112
)

src/cli/commands/status/command.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,10 @@ export const registerStatus = (program: Command) => {
5656
.description(COMMAND_DESCRIPTIONS.status)
5757
.option('--agent-runtime-id <id>', 'Look up a specific agent runtime by ID')
5858
.option('--target <name>', 'Select deployment target')
59-
.option('--type <type>', 'Filter by resource type (agent, memory, credential, gateway, policy-engine, policy)')
59+
.option(
60+
'--type <type>',
61+
'Filter by resource type (agent, memory, credential, gateway, evaluator, online-eval, policy-engine, policy)'
62+
)
6063
.option('--state <state>', 'Filter by deployment state (deployed, local-only, pending-removal)')
6164
.option('--agent <name>', 'Filter to a specific agent')
6265
.option('--json', 'Output as JSON')

src/cli/primitives/AgentPrimitive.tsx

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ export interface AddAgentOptions extends VpcOptions {
7575
export class AgentPrimitive extends BasePrimitive<AddAgentOptions, RemovableResource> {
7676
readonly kind = 'agent';
7777
readonly label = 'Agent';
78+
protected override readonly article = 'an';
7879
readonly primitiveSchema = AgentEnvSpecSchema;
7980

8081
/** Local instance to avoid circular dependency with registry. */
@@ -195,14 +196,14 @@ export class AgentPrimitive extends BasePrimitive<AddAgentOptions, RemovableReso
195196
addCmd
196197
.command('agent')
197198
.description('Add an agent to the project')
198-
.option('--name <name>', 'Agent name (start with letter, alphanumeric only, max 64 chars) [non-interactive]')
199+
.option(
200+
'--name <name>',
201+
'Agent name (start with letter, alphanumeric and underscores only, max 48 chars) [non-interactive]'
202+
)
199203
.option('--type <type>', 'Agent type: create, byo, or import [non-interactive]', 'create')
200204
.option('--build <type>', 'Build type: CodeZip or Container (default: CodeZip) [non-interactive]')
201205
.option('--language <lang>', 'Language: Python (create), or Python/TypeScript/Other (BYO) [non-interactive]')
202-
.option(
203-
'--framework <fw>',
204-
'Framework: Strands, LangChain_LangGraph, CrewAI, GoogleADK, OpenAIAgents [non-interactive]'
205-
)
206+
.option('--framework <fw>', 'Framework: Strands, LangChain_LangGraph, GoogleADK, OpenAIAgents [non-interactive]')
206207
.option('--model-provider <provider>', 'Model provider: Bedrock, Anthropic, OpenAI, Gemini [non-interactive]')
207208
.option('--api-key <key>', 'API key for non-Bedrock providers [non-interactive]')
208209
.option('--memory <mem>', 'Memory: none, shortTerm, longAndShortTerm (create path only) [non-interactive]')

src/cli/primitives/EvaluatorPrimitive.ts

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -124,19 +124,22 @@ export class EvaluatorPrimitive extends BasePrimitive<AddEvaluatorOptions, Remov
124124
addCmd
125125
.command(this.kind)
126126
.description('Add a custom evaluator to the project')
127-
.option('--name <name>', 'Evaluator name')
128-
.option('--level <level>', 'Evaluation level: SESSION, TRACE, TOOL_CALL')
129-
.option('--model <model>', 'Bedrock model ID for LLM-as-a-Judge')
127+
.option('--name <name>', 'Evaluator name [non-interactive]')
128+
.option('--level <level>', 'Evaluation level: SESSION, TRACE, TOOL_CALL [non-interactive]')
129+
.option('--model <model>', 'Bedrock model ID for LLM-as-a-Judge [non-interactive]')
130130
.option(
131131
'--instructions <text>',
132-
'Evaluation prompt instructions (must include level-appropriate placeholders, e.g. {context})'
132+
'Evaluation prompt instructions (must include level-appropriate placeholders, e.g. {context}) [non-interactive]'
133+
)
134+
.option(
135+
'--rating-scale <preset>',
136+
`Rating scale preset: ${presetIds.join(', ')} (default: 1-5-quality) [non-interactive]`
133137
)
134-
.option('--rating-scale <preset>', `Rating scale preset: ${presetIds.join(', ')} (default: 1-5-quality)`)
135138
.option(
136139
'--config <path>',
137-
'Path to evaluator config JSON file (overrides --model, --instructions, --rating-scale)'
140+
'Path to evaluator config JSON file (overrides --model, --instructions, --rating-scale) [non-interactive]'
138141
)
139-
.option('--json', 'Output as JSON')
142+
.option('--json', 'Output as JSON [non-interactive]')
140143
.action(
141144
async (cliOptions: {
142145
name?: string;

src/cli/primitives/GatewayPrimitive.ts

Lines changed: 24 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -158,23 +158,27 @@ export class GatewayPrimitive extends BasePrimitive<AddGatewayOptions, Removable
158158
registerCommands(addCmd: Command, removeCmd: Command): void {
159159
addCmd
160160
.command('gateway')
161-
.description('Add a gateway to the project')
162-
.option('--name <name>', 'Gateway name')
163-
.option('--description <desc>', 'Gateway description')
164-
.option('--authorizer-type <type>', 'Authorizer type: NONE or CUSTOM_JWT')
165-
.option('--discovery-url <url>', 'OIDC discovery URL (for CUSTOM_JWT)')
166-
.option('--allowed-audience <audience>', 'Comma-separated allowed audiences (for CUSTOM_JWT)')
167-
.option('--allowed-clients <clients>', 'Comma-separated allowed client IDs (for CUSTOM_JWT)')
168-
.option('--allowed-scopes <scopes>', 'Comma-separated allowed scopes (for CUSTOM_JWT)')
169-
.option('--custom-claims <json>', 'Custom claim validations as JSON array (for CUSTOM_JWT)')
170-
.option('--client-id <id>', 'OAuth client ID for gateway bearer token')
171-
.option('--client-secret <secret>', 'OAuth client secret')
172-
.option('--agents <agents>', 'Comma-separated agent names')
173-
.option('--no-semantic-search', 'Disable semantic search for tool discovery')
174-
.option('--exception-level <level>', 'Exception verbosity level', 'NONE')
175-
.option('--policy-engine <name>', 'Policy engine name for Cedar-based authorization')
176-
.option('--policy-engine-mode <mode>', 'Policy engine mode: LOG_ONLY or ENFORCE')
177-
.option('--json', 'Output as JSON')
161+
.description('Add an API gateway that routes requests to agent targets')
162+
.option('--name <name>', 'Gateway name [non-interactive]')
163+
.option('--description <desc>', 'Gateway description [non-interactive]')
164+
.option('--agents <agents>', 'Comma-separated agent names to expose through this gateway [non-interactive]')
165+
.option('--authorizer-type <type>', 'Authorizer type: NONE or CUSTOM_JWT [non-interactive]')
166+
.option('--discovery-url <url>', 'OIDC discovery URL (for CUSTOM_JWT) [non-interactive]')
167+
.option('--allowed-audience <audience>', 'Comma-separated allowed audiences (for CUSTOM_JWT) [non-interactive]')
168+
.option('--allowed-clients <clients>', 'Comma-separated allowed client IDs (for CUSTOM_JWT) [non-interactive]')
169+
.option('--allowed-scopes <scopes>', 'Comma-separated allowed scopes (for CUSTOM_JWT) [non-interactive]')
170+
.option('--custom-claims <json>', 'Custom claim validations as JSON array (for CUSTOM_JWT) [non-interactive]')
171+
.option('--client-id <id>', 'OAuth client ID for fetching gateway bearer tokens [non-interactive]')
172+
.option('--client-secret <secret>', 'OAuth client secret for fetching gateway bearer tokens [non-interactive]')
173+
.option('--no-semantic-search', 'Disable semantic search for gateway target tool discovery [non-interactive]')
174+
.option(
175+
'--exception-level <level>',
176+
'Exception detail level in error responses: NONE, ALL [non-interactive]',
177+
'NONE'
178+
)
179+
.option('--policy-engine <name>', 'Policy engine name for Cedar-based authorization [non-interactive]')
180+
.option('--policy-engine-mode <mode>', 'Policy engine mode: LOG_ONLY or ENFORCE [non-interactive]')
181+
.option('--json', 'Output as JSON [non-interactive]')
178182
.action(async (rawOptions: Record<string, string | boolean | undefined>) => {
179183
const cliOptions = rawOptions as unknown as CLIAddGatewayOptions;
180184
try {
@@ -238,9 +242,9 @@ export class GatewayPrimitive extends BasePrimitive<AddGatewayOptions, Removable
238242
removeCmd
239243
.command('gateway')
240244
.description('Remove a gateway from the project')
241-
.option('--name <name>', 'Name of resource to remove')
242-
.option('--force', 'Skip confirmation prompt')
243-
.option('--json', 'Output as JSON')
245+
.option('--name <name>', 'Name of resource to remove [non-interactive]')
246+
.option('--force', 'Skip confirmation prompt [non-interactive]')
247+
.option('--json', 'Output as JSON [non-interactive]')
244248
.action(async (cliOptions: { name?: string; force?: boolean; json?: boolean }) => {
245249
try {
246250
if (!findConfigRoot()) {

0 commit comments

Comments
 (0)