Skip to content

feat(appstash): add multi-target context support#64

Merged
pyramation merged 1 commit intomainfrom
devin/1771360954-appstash-multi-target
Feb 17, 2026
Merged

feat(appstash): add multi-target context support#64
pyramation merged 1 commit intomainfrom
devin/1771360954-appstash-multi-target

Conversation

@pyramation
Copy link
Contributor

feat(appstash): add multi-target context support

Summary

Extends ContextConfig with an optional targets map so a single context can store per-API endpoint overrides (e.g., auth, members, app each pointing to different GraphQL endpoints). Adds getTargetEndpoint(targetName, contextName?) to resolve the correct endpoint for a given target, falling back to the context's main endpoint when no target-specific override exists.

This is a prerequisite for unified multi-target CLI generation in @constructive-io/graphql-codegen, where a single codegen config can define multiple API endpoints that share one set of credentials.

New types:

  • ContextTargetEndpoint{ endpoint: string } (extensible for future per-target config)

Changed types:

  • ContextConfig.targets? — optional Record<string, ContextTargetEndpoint>
  • ConfigStore.createContext() — accepts optional targets in options
  • ConfigStore.getTargetEndpoint() — new method

Fully backward compatible — existing single-endpoint contexts work identically.

Review & Testing Checklist for Human

  • Fallback behavior for getTargetEndpoint: When a target name is not found in ctx.targets, it silently falls back to ctx.endpoint rather than returning null. Verify this is the desired behavior — a misspelled target name in a multi-target context would silently route to the wrong endpoint. Consider whether this should be configurable or at least log a warning.
  • Run pnpm test in packages/appstash to confirm all 54 tests pass (46 existing + 8 new).

Notes

- Add ContextTargetEndpoint interface
- Add optional targets field to ContextConfig
- Add getTargetEndpoint() method to ConfigStore
- createContext() accepts optional targets map
- getTargetEndpoint() resolves: target-specific endpoint → fallback to main endpoint
- Fully backward compatible with single-target contexts
- 8 new tests for multi-target functionality
@devin-ai-integration
Copy link

🤖 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 b94fe00 into main Feb 17, 2026
36 checks passed
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

Comments