Skip to content

feat(config): implement global config to wire up config command#1789

Draft
Hweinstock wants to merge 3 commits into
aws:refactorfrom
Hweinstock:feat/global-config
Draft

feat(config): implement global config to wire up config command#1789
Hweinstock wants to merge 3 commits into
aws:refactorfrom
Hweinstock:feat/global-config

Conversation

@Hweinstock

@Hweinstock Hweinstock commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

Problem

The CLI is missing a way to view and control global configuration. There is an existing config command, but its not wired up.

Solution

  • implement a new top level globalConfig/ module that defines an accessor for global config. The global config is decoupled from the source of the data via an injected dependency.
  • move src/router/schemas.tsx to top level /parsing directory so that logic can be re-used.
  • global config is type-safe based on the global config schema using json dot notation. For example, valid keys are telemetry, telemetry.enabled, etc. All of which are derived automatically from the schema definition.
  • wire up config command to be output JSON responses.

Testing

  • wrote unit tests at the config command level to test e2e, rather than testing implementation directly.
  • e2e testing using existing config from CLI also works.
    Ex.
> bun run start config
{
  "telemetry": {
    "enabled": false,
    "endpoint": "https://telemetry.agentcore.aws.dev"
  },
}
> bun run start config telemetry.endpoint 
"https://telemetry.agentcore.aws.dev"

> bun run start config telemetry.endpoint https://example.com
"https://example.com"

Future Work

  • add error types for telemetry, and easier reasoning (few todo comments on this).
  • add logic to setup installationId for telemetry (getOrPut).

@github-actions github-actions Bot added agentcore-harness-reviewing AgentCore Harness review in progress and removed agentcore-harness-reviewing AgentCore Harness review in progress labels Jul 17, 2026
@codecov-commenter

codecov-commenter commented Jul 17, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 95.67568% with 8 lines in your changes missing coverage. Please review.
✅ Project coverage is 93.65%. Comparing base (d4c31b1) to head (c39237b).

Files with missing lines Patch % Lines
src/globalConfig/source.tsx 92.30% 4 Missing ⚠️
src/globalConfig/schemas.tsx 92.00% 2 Missing ⚠️
src/testing/globalConfig.tsx 84.61% 2 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##           refactor    #1789      +/-   ##
============================================
+ Coverage     93.61%   93.65%   +0.03%     
============================================
  Files           117      123       +6     
  Lines          6708     6886     +178     
============================================
+ Hits           6280     6449     +169     
- Misses          428      437       +9     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@Hweinstock
Hweinstock force-pushed the feat/global-config branch 8 times, most recently from db54dba to b39f26a Compare July 17, 2026 16:53
@Hweinstock

Copy link
Copy Markdown
Contributor Author

typecheck fixed in #1756 (comment)

@Hweinstock
Hweinstock marked this pull request as ready for review July 17, 2026 16:55
@Hweinstock Hweinstock changed the title (wip)feat(config): implement global config to wire up config command feat(config): implement global config to wire up config command Jul 17, 2026
Comment thread src/globalConfig/accessor.tsx Outdated
});
}

function buildSchemas(schema: z.ZodObject, prefix: string = ""): Map<string, z.ZodType> {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

we could probably combine this with buildKeys above into a single traversal, but found it more readable this way.

expect(run([])).rejects.toThrow("unable to read");
});

test("throws clear error on invalid json", async () => {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

this test will be more useful once we have error types to signify permission issue vs parsing issue. checking the message feels flaky, so deferring this until we have error types.

Comment thread src/parsing/index.tsx Outdated
* @param schema - The zod schema to inspect.
* @returns An inspection describing the schema's structure.
*/
export function inspectZodSchema(schema: z.ZodType): ZodSchemaInspection {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

this is pretty close to a generalization of basetype helper above now that we extract inner type. I definitely think we can unify them, but left it OOS for this PR.

Comment thread src/handlers/config/handler.tsx Outdated
// print entire config when key is missing.
if (!args.key) {
const fullConfig = await globalConfigAccessor.toObject();
if (fullConfig !== undefined) jsonRenderer.renderJson(fullConfig);

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

this mirrors the behavior with git config AFAICT, if the value is unset, we don't print anything.

@Hweinstock
Hweinstock force-pushed the feat/global-config branch from b39f26a to 4b819e1 Compare July 20, 2026 13:25
@Hweinstock
Hweinstock marked this pull request as draft July 20, 2026 13:25
@Hweinstock
Hweinstock force-pushed the feat/global-config branch 4 times, most recently from d60cf0d to 7fdb445 Compare July 20, 2026 13:43
@Hweinstock
Hweinstock marked this pull request as ready for review July 20, 2026 13:46
@Hweinstock

Copy link
Copy Markdown
Contributor Author

rebased onto create command work.

@AlexanderRichey AlexanderRichey left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I feel that the level of complexity this PR introduces is out of proportion with the functionality gained. Let's sync on this and see if we can develop a simpler approach.

@AlexanderRichey

Copy link
Copy Markdown
Contributor

I have some prior art here that might be useful to look at: https://github.com/AlexanderRichey/yagss/blob/main/internal/builder/config.go

@Hweinstock
Hweinstock marked this pull request as draft July 21, 2026 00:28
@Hweinstock

Copy link
Copy Markdown
Contributor Author

converted to draft while I rework based on offline discussion from above, will take out of draft when ready for another review.

@Hweinstock
Hweinstock force-pushed the feat/global-config branch from 7fdb445 to 03b6021 Compare July 21, 2026 00:29
@Hweinstock
Hweinstock force-pushed the feat/global-config branch 4 times, most recently from 451366a to f5095a3 Compare July 21, 2026 01:32
@Hweinstock
Hweinstock force-pushed the feat/global-config branch from f5095a3 to c39237b Compare July 21, 2026 01:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants