Let any model answer, and a key be enough - #26
Merged
Conversation
Every AI feature reached PeopleWorks Copilot for its credentials -- not for a key the user had configured, but for the model's key, fetched from an account. On a public MIT project that meant no outside user could run any of them. `--enrich` refused without an API URL and token and told the reader to configure credentials for a service they had never heard of; the Description Annotator asked for COPILOT_API_TOKEN and offered nothing else. One resolver now serves both, taking the first route that is configured: `--api-key` on the command line, then OPENAI_API_KEY or ANTHROPIC_API_KEY in the environment, then a PeopleWorks Copilot account. That account keeps working untouched -- it is one option among several rather than the gate. `--ai-base-url` reaches any OpenAI-compatible endpoint, including a local one, and `--ai-model` names the model. Anthropic is reached through the same client, since it serves an OpenAI-compatible surface, so it costs a base URL and a default rather than a second SDK. Someone with none of the routes configured is now told all four. A key is never read from or written to the configuration file. The endpoint and the model name are ordinary settings; a key is a secret, and that file lives in a home directory that gets copied around. The three options are global and read once with a pre-parse rather than threaded through each handler: SetHandler takes at most eight parameters and extract already spends six, so adding three would have forced four commands onto the InvocationContext pattern to carry a setting none of them decides. The environment is read through an injected lookup so the order of the routes is tested without setting process-wide state the whole run would share. 345 tests. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This was referenced Aug 22, 2026
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.
Closes #24.
What was wrong
Every AI feature reached PeopleWorks Copilot for its credentials — not for a key the user had configured, but for the model's key, fetched from an account. On a public MIT repo published to nuget.org, that meant no outside user could run any of them.
Both name only the service the reader has no account with, and neither says another option exists — because none did.
Now
One resolver shared by the CLI and the Description Annotator, taking the first route that is configured:
--api-keyOPENAI_API_KEYANTHROPIC_API_KEYxaflogic config--ai-base-urlreaches any OpenAI-compatible endpoint including a local one, and--ai-modelnames the model. Anthropic goes through the same client — it serves an OpenAI-compatible surface, so it costs a base URL and a default model rather than a second SDK.Probed against the built binary:
And with nothing configured, through the annotator:
Two decisions worth stating
A key is never read from or written to the configuration file. The endpoint and the model name are ordinary settings; a key is a secret, and
~/.xaflogic/config.jsonis a file that gets copied between machines. The environment is where a secret belongs.The three options are global and read once with a pre-parse, rather than threaded through each handler.
SetHandlertakes at most eight parameters andextractalready spends six, so adding three would have forced four commands onto theInvocationContextpattern to carry a setting none of them decides.Tests
AiClientResolverTests— each route on its own, the two precedence rules that make the flags meaningful rather than decorative, an endpoint and model override, an empty account not counting as a configured one, and the message naming all four routes.The environment is read through an injected lookup rather than the process, so the order can be pinned without setting a variable the rest of the run would share.
345 tests, no warnings.