feat(appstash): add per-context vars, getClientConfig with 3-tier resolution#70
Merged
pyramation merged 1 commit intomainfrom Mar 13, 2026
Conversation
…olution - Add setVar/getVar/deleteVar/listVars for per-context key-value storage - Add getClientConfig(targetName) with 3-tier resolution: store → env vars → throw - Export ClientConfig type - Fix readJson shared-reference mutation bug (DEFAULT_SETTINGS was being mutated across stores) - Add comprehensive tests for vars and getClientConfig (31 new test cases)
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
devin-ai-integration bot
pushed a commit
to constructive-io/constructive
that referenced
this pull request
Mar 13, 2026
…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)
5 tasks
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.
feat(appstash): add per-context vars and getClientConfig with 3-tier resolution
Summary
Extends
ConfigStorewith two new capabilities for CLI credential bridging and local key-value config:Per-context key-value vars (
setVar/getVar/deleteVar/listVars) — stored in~/.toolname/config/vars/<context>.json, scoped per-context so different environments can have different values (e.g.orgId,defaultDatabase).getClientConfig(targetName, contextName?)— returns{ endpoint, headers }using 3-tier resolution following the AWS SDK pattern:TOOLNAME_TOKEN,TOOLNAME_TARGET_ENDPOINT,TOOLNAME_ENDPOINT)Also fixes a pre-existing bug: the module-level
DEFAULT_SETTINGSobject was shared by reference across all store instances viareadJson. WhensetCurrentContextmutated the returned settings object, it polluted the default for all subsequent stores. Fixed by deep-cloning fallback values inreadJson.Review & Testing Checklist for Human
deleteContextdoes NOT clean upvars/<name>.json. Verify this is acceptable or if cleanup should be added.readJsondeep-clone viaJSON.parse(JSON.stringify(...)): Works for JSON-serializable fallbacks (which is all current usage), but would silently drop non-serializable values if ever used with them. Confirm this is acceptable.getClientConfigreturns endpoint without auth when credentials are missing/expired: Tier 1 intentionally returns the endpoint with empty headers if no valid credentials exist. Verify SDK consumers handle unauthenticated responses gracefully.TOOLNAME_TARGET_ENDPOINT): This convention will need to be matched by the constructive codegen in Phase 2. Verify the naming pattern is what you want before publishing.npm testinpackages/appstash— all 75 tests should pass (31 new).Notes