fix(config): surface valid config keys in help text and invalid-key errors (#1453)#49
Draft
aidandaly24 wants to merge 1 commit into
Draft
fix(config): surface valid config keys in help text and invalid-key errors (#1453)#49aidandaly24 wants to merge 1 commit into
aidandaly24 wants to merge 1 commit into
Conversation
…rrors Enumerate the dot-notation global-config keys (derived from GlobalConfigSchemaStrict) in `agentcore config --help` via addHelpText, mirroring the telemetry command pattern, and append the valid-key list to the invalid-set error message. Adds CONFIG_KEYS constant and a unit test. Scope: unit-only; surgical DX discoverability fix — help text + error enrichment only, no behavior change to config read/write paths. Fixes aws#1453
Coverage Report
|
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.
Refs aws#1453
Issues
agentcore configcommand. aws/agentcore-cli#1453 — Nothing is broken — this is an enhancement request. Users runningagentcore config [key] [value]have no in-CLI way to discover the valid keys:agentcore config --helpshows only a generic "Config key in dot notation (e.g. telemetry.enabled)" hint,agentcore config(list) prints only keys already set so unset keys are invisible, and a badconfig setreportsInvalid value ... for key ...without listing valid keys. The only discoverable keys today are telemetry.enabled/telemetry.audit (surfaced by the separateagentcore telemetrycommand); the rest (uvDefaultIndex, uvIndex, disableTransactionSearch, transactionSearchIndexPercentage, telemetry.endpoint, installationId) exist only in the source Zod schema.Root cause
Valid global-config keys live only in the internal Zod schema GlobalConfigSchemaStrict (src/lib/schemas/io/global-config.ts:15-31) and are never enumerated to users; registerConfig (src/cli/commands/config/command.ts:20-31) has no addHelpText, handleConfigList (src/cli/commands/config/actions.ts:10-16) prints only persisted keys, and the invalid-set error (actions.ts:37) lists no valid keys. Verified at HEAD e92c79a / v0.20.2.
The fix
Surface keys from the existing schema. Add program.addHelpText('after', ...) in registerConfig (command.ts) enumerating valid dot-notation keys with type hints and examples — mirroring the existing telemetry/command.ts:13-27 pattern. Enrich the actions.ts:37 invalid-set error to append the valid key list. Optionally add a
--allflag orconfig keysaction so handleConfigList shows every valid key (set and unset). Design decision: derive the key list by reflecting over the ZodObject shape of GlobalConfigSchemaStrict (recursing into nested telemetry) vs. maintaining a hand-written KEY_DESCRIPTIONS constant; a hand-written constant with descriptions is simpler and lets each key carry a human-readable hint, which the schema alone cannot provide.Files touched: src/cli/commands/config/command.ts (registerConfig: add addHelpText/examples, mirror telemetry/command.ts pattern); src/cli/commands/config/actions.ts (handleConfigSet line 37 for richer invalid-key error; handleConfigList lines 10-16 for optional show-all); valid keys derived from GlobalConfigSchemaStrict in src/lib/schemas/io/global-config.ts:15-31; optionally a KEY_DESCRIPTIONS constant in src/cli/commands/config/ and/or update src/cli/constants.ts:41 config description; optionally add a config section to docs/commands.md
Validation evidence
The fix was verified by reproducing the original symptom and re-running after the change:
Test suite: green.
Staged on the fork as a draft for human review. Promote to aws/agentcore-cli after vetting.