Skip to content

feat: add target type picker to gateway target wizard#496

Merged
aidandaly24 merged 7 commits intoaws:feat/add-new-gateway-targetsfrom
aidandaly24:target-type-picker
Mar 5, 2026
Merged

feat: add target type picker to gateway target wizard#496
aidandaly24 merged 7 commits intoaws:feat/add-new-gateway-targetsfrom
aidandaly24:target-type-picker

Conversation

@aidandaly24
Copy link
Contributor

Description

Add a target type selection step to the agentcore add gateway-target TUI wizard and make --type a required flag in the CLI path. This is a prerequisite for adding new gateway target types (API Gateway, OpenAPI, etc.) — the picker infrastructure needs to exist before new options can be added to it.

What changed:

  • TUI wizard: New "Target Type" selection step after the name step. The wizard now uses dynamic steps (via useMemo with config.targetType dependency) so future target types can have different step sequences. Also fixes a pre-existing bug where goBack() called getSteps() directly instead of using the memoized steps array.
  • CLI path: --type mcp-server is now required (kebab-case, mapped to mcpServer internally). --source flag removed entirely (was dead code — only existing-endpoint was supported and hardcoded everywhere).
  • Routing: All creation flow routing changed from config.source === 'existing-endpoint' to config.targetType === 'mcpServer' across both TUI (AddGatewayTargetFlow.tsx) and CLI (GatewayTargetPrimitive.ts).
  • Dead code removal: SOURCE_OPTIONS constant, source field on AddGatewayTargetConfig, and 'source' wizard step type all removed.

Currently ships with one target type option: MCP Server endpoint. Adding a new type (e.g., API Gateway) requires adding an entry to TARGET_TYPE_OPTIONS, a case in the wizard's dynamic steps switch, and a creation function — the plumbing is in place.

Related Issue

Closes #

Documentation PR

N/A — docs updated in this PR (commands.md, gateway.md, local-development.md)

Type of Change

  • Bug fix
  • New feature
  • Breaking change
  • Documentation update
  • Other (please describe):

Breaking change: --type mcp-server is now required for agentcore add gateway-target CLI invocations. --source is removed. Users/scripts must update from:

agentcore add gateway-target --name foo --endpoint https://... --gateway bar

to:

agentcore add gateway-target --type mcp-server --name foo --endpoint https://... --gateway bar

Testing

How have you tested the change?

  • I ran npm run test:unit and npm run test:integ
  • I ran npm run typecheck
  • I ran npm run lint
  • If I modified src/assets/, I ran npm run test:update-snapshots and committed the updated snapshots

Test changes:

  • Updated all gateway-target test fixtures to use type: 'mcp-server' / targetType: 'mcpServer'
  • Added new tests: --type required validation, invalid type rejection
  • Replaced SOURCE_OPTIONS test with TARGET_TYPE_OPTIONS test
  • Fixed shared fixture mutation bug in validate.test.ts (spread before passing to validation)

Checklist

  • I have read the CONTRIBUTING document
  • I have added any necessary tests that prove my fix is effective or my feature works
  • I have updated the documentation accordingly
  • I have added an appropriate example to the documentation to outline the feature, or no new docs are needed
  • My changes generate no new warnings
  • Any dependent changes have been merged and published

- Add targetType field to AddGatewayTargetConfig and 'target-type' wizard step
- Convert wizard from static to dynamic steps (useMemo with config.targetType dep)
- Fix goBack() to use memoized steps instead of stale getSteps() call
- Add TARGET_TYPE_OPTIONS with mcpServer as initial option
- Add WizardSelect UI for target type selection in AddGatewayTargetScreen
- Route flow on config.targetType instead of config.source
- Remove source field, SOURCE_OPTIONS, and 'source' step (dead code)
- Make --type required with kebab-case input (mcp-server -> mcpServer)
- Remove --source option entirely (was dead code, only existing-endpoint worked)
- Wire options.type through buildGatewayTargetConfig to config.targetType
- Route handleAddGatewayTarget on config.targetType instead of config.source
- Use config.targetType in createExternalGatewayTarget instead of hardcoding
- Replace source: 'existing-endpoint' with type: 'mcp-server' in all fixtures
- Add type: 'mcpServer' to ValidatedAddGatewayTargetOptions test objects
- Add tests for --type required validation and invalid type rejection
- Replace SOURCE_OPTIONS test with TARGET_TYPE_OPTIONS test
- Fix shared fixture mutation bug (spread before passing to validation)
- Add --type mcp-server to CLI integration test args
- Replace --source existing-endpoint with --type mcp-server in all examples
- Update flags table: --source -> --type (required)
- Update commands.md, gateway.md, and local-development.md
@aidandaly24 aidandaly24 marked this pull request as draft March 5, 2026 02:47
These files were incorrectly carried from our pre-rebase branch during
conflict resolution (--theirs/--ours reversed in rebase context).
The modular primitive PR moved their contents to GatewayTargetPrimitive.ts.
@aidandaly24 aidandaly24 marked this pull request as ready for review March 5, 2026 02:59
@aidandaly24 aidandaly24 changed the base branch from feat/add-new-gateway-targets to main March 5, 2026 14:35
@aidandaly24 aidandaly24 requested a review from a team March 5, 2026 14:35
@aidandaly24 aidandaly24 marked this pull request as draft March 5, 2026 14:36
@aidandaly24 aidandaly24 marked this pull request as ready for review March 5, 2026 14:36
@aidandaly24
Copy link
Contributor Author

aidandaly24 commented Mar 5, 2026

For some reason CodeQL won't run

@github-actions github-actions bot added the size/m PR size: M label Mar 5, 2026
@aidandaly24 aidandaly24 changed the base branch from main to feat/add-new-gateway-targets March 5, 2026 15:37
@aidandaly24 aidandaly24 changed the base branch from feat/add-new-gateway-targets to main March 5, 2026 15:40
@github-actions github-actions bot added size/m PR size: M and removed size/m PR size: M labels Mar 5, 2026
Copy link
Contributor

@jesseturner21 jesseturner21 left a comment

Choose a reason for hiding this comment

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

lgtm

@aidandaly24 aidandaly24 changed the base branch from main to feat/add-new-gateway-targets March 5, 2026 16:05
@aidandaly24 aidandaly24 merged commit f85b666 into aws:feat/add-new-gateway-targets Mar 5, 2026
15 checks passed
aidandaly24 added a commit that referenced this pull request Mar 6, 2026
* feat: add target type picker to gateway target wizard

- Add targetType field to AddGatewayTargetConfig and 'target-type' wizard step
- Convert wizard from static to dynamic steps (useMemo with config.targetType dep)
- Fix goBack() to use memoized steps instead of stale getSteps() call
- Add TARGET_TYPE_OPTIONS with mcpServer as initial option
- Add WizardSelect UI for target type selection in AddGatewayTargetScreen
- Route flow on config.targetType instead of config.source
- Remove source field, SOURCE_OPTIONS, and 'source' step (dead code)

* feat: make --type required and remove --source for gateway-target CLI

- Make --type required with kebab-case input (mcp-server -> mcpServer)
- Remove --source option entirely (was dead code, only existing-endpoint worked)
- Wire options.type through buildGatewayTargetConfig to config.targetType
- Route handleAddGatewayTarget on config.targetType instead of config.source
- Use config.targetType in createExternalGatewayTarget instead of hardcoding

* test: update gateway-target tests for target type picker

- Replace source: 'existing-endpoint' with type: 'mcp-server' in all fixtures
- Add type: 'mcpServer' to ValidatedAddGatewayTargetOptions test objects
- Add tests for --type required validation and invalid type rejection
- Replace SOURCE_OPTIONS test with TARGET_TYPE_OPTIONS test
- Fix shared fixture mutation bug (spread before passing to validation)
- Add --type mcp-server to CLI integration test args

* docs: update gateway-target examples to use --type mcp-server

- Replace --source existing-endpoint with --type mcp-server in all examples
- Update flags table: --source -> --type (required)
- Update commands.md, gateway.md, and local-development.md

* fix: reset command.tsx and create-mcp.test.ts to main versions

These files were incorrectly carried from our pre-rebase branch during
conflict resolution (--theirs/--ours reversed in rebase context).
The modular primitive PR moved their contents to GatewayTargetPrimitive.ts.

* ci: retrigger checks

* test: add missing --type flag to remove gateway-target tests
aidandaly24 added a commit that referenced this pull request Mar 6, 2026
* feat: add target type picker to gateway target wizard

- Add targetType field to AddGatewayTargetConfig and 'target-type' wizard step
- Convert wizard from static to dynamic steps (useMemo with config.targetType dep)
- Fix goBack() to use memoized steps instead of stale getSteps() call
- Add TARGET_TYPE_OPTIONS with mcpServer as initial option
- Add WizardSelect UI for target type selection in AddGatewayTargetScreen
- Route flow on config.targetType instead of config.source
- Remove source field, SOURCE_OPTIONS, and 'source' step (dead code)

* feat: make --type required and remove --source for gateway-target CLI

- Make --type required with kebab-case input (mcp-server -> mcpServer)
- Remove --source option entirely (was dead code, only existing-endpoint worked)
- Wire options.type through buildGatewayTargetConfig to config.targetType
- Route handleAddGatewayTarget on config.targetType instead of config.source
- Use config.targetType in createExternalGatewayTarget instead of hardcoding

* test: update gateway-target tests for target type picker

- Replace source: 'existing-endpoint' with type: 'mcp-server' in all fixtures
- Add type: 'mcpServer' to ValidatedAddGatewayTargetOptions test objects
- Add tests for --type required validation and invalid type rejection
- Replace SOURCE_OPTIONS test with TARGET_TYPE_OPTIONS test
- Fix shared fixture mutation bug (spread before passing to validation)
- Add --type mcp-server to CLI integration test args

* docs: update gateway-target examples to use --type mcp-server

- Replace --source existing-endpoint with --type mcp-server in all examples
- Update flags table: --source -> --type (required)
- Update commands.md, gateway.md, and local-development.md

* fix: reset command.tsx and create-mcp.test.ts to main versions

These files were incorrectly carried from our pre-rebase branch during
conflict resolution (--theirs/--ours reversed in rebase context).
The modular primitive PR moved their contents to GatewayTargetPrimitive.ts.

* ci: retrigger checks

* test: add missing --type flag to remove gateway-target tests
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