Skip to content

feat(codegen): add config command, helpers.ts generation, and collision handling#802

Merged
pyramation merged 1 commit intomainfrom
devin/1773363268-constructive-config-helpers-codegen
Mar 13, 2026
Merged

feat(codegen): add config command, helpers.ts generation, and collision handling#802
pyramation merged 1 commit intomainfrom
devin/1773363268-constructive-config-helpers-codegen

Conversation

@pyramation
Copy link
Contributor

feat(codegen): add config command, helpers.ts generation, and collision handling

Summary

Phase 2 of the credential management and config system (builds on appstash@0.6.0, published via constructive-io/dev-utils#70).

Adds three capabilities to the constructive codegen:

  1. Config command generation — generates config get/set/list/delete commands wired to appstash's per-context key-value store
  2. Helpers.ts generation — generates typed per-target client factories (createAuthClient(), createMembersClient(), etc.) with 3-tier credential resolution (store → env vars → throw)
  3. Collision handling — extends existing BuiltinNames pattern to handle config collisions (renames to vars if a target is named config)

Key Files

  • New: config-command-generator.ts — Babel AST generator for config command
  • New: helpers-generator.ts — Babel AST generator for helpers.ts with typed client factories
  • Modified: index.ts — wires new generators, updates resolveBuiltinNames() for config collision
  • Modified: command-map-generator.ts — includes config in command map and usage
  • Modified: config.ts (types) — adds config?: string to BuiltinNames interface
  • Updated: package.json files — appstash ^0.5.0 → ^0.6.0
  • Test coverage: 59 tests passing, including 3 new tests for config collision handling + config/helpers generation

Review & Testing Checklist for Human

  • Verify appstash@0.6.0 API surface — The generated code imports createConfigStore, ClientConfig, getClientConfig from appstash. Double-check these exports exist in appstash@0.6.0 (published in dev-utils#70)
  • Test generated config command end-to-end — Run constructive config set foo bar, constructive config get foo, constructive config list, constructive config delete foo against a real generated CLI to verify store integration works
  • Test generated helpers.ts end-to-end — Import createAuthClient() from the generated helpers in a TS script and verify it creates a working client with proper credential resolution
  • Check generated import paths — The helpers.ts imports ORM clients from ../../generated/{target}/orm. Verify this path matches your actual project structure
  • Single-target CLI intentionally excluded? — Only generateMultiTargetCli generates config/helpers. If single-target CLIs also need these, that's a gap

Notes

  • The pnpm-lock.yaml has large formatting changes due to pnpm version differences, but the only actual dependency change is appstash 0.5.0 → 0.6.0
  • ESLint not run due to pre-existing ESLint v9 config migration issue in this package (unrelated to this PR)
  • All 232 existing tests pass; 6 test suites fail due to pre-existing module resolution issues (pg-env, @pgpmjs/core, etc.) unrelated to these changes
  • The generated config command has a String.call(undefined, value) pattern in the set handler — this works but is an artifact of Babel AST generation and could be simplified to String(value)

Link to Devin Session: https://app.devin.ai/sessions/6f16c8a57231488085f04a68be7d599b
Requested by: @pyramation

…on handling

Phase 2 of credential management and config system:

- Add config to BuiltinNames interface with collision handling (renames to 'vars' if target named 'config')
- Generate helpers.ts with typed per-target client factories using 3-tier credential resolution
- Generate config command (get/set/list/delete) wired to appstash store.getVar/setVar/deleteVar/listVars
- Update command map generator to include config built-in command
- Update appstash dependency to ^0.6.0
- Add comprehensive tests for new functionality (59 tests passing)

Builds on appstash@0.6.0 (published via constructive-io/dev-utils#70)
@devin-ai-integration
Copy link
Contributor

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

@pyramation pyramation merged commit f0bbe71 into main Mar 13, 2026
43 checks passed
@pyramation pyramation deleted the devin/1773363268-constructive-config-helpers-codegen branch March 13, 2026 01:12
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.

1 participant