Commit 9e13ed4
Let any model answer, and a key be enough
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>1 parent b7ef0a6 commit 9e13ed4
7 files changed
Lines changed: 460 additions & 66 deletions
File tree
- src
- XafLogicExplainer.Cli
- XafLogicExplainer.CopilotSync/Ai
- XafLogicExplainer.DescriptionAnnotator
- tests/XafLogicExplainer.Tests
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
39 | 39 | | |
40 | 40 | | |
41 | 41 | | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
42 | 57 | | |
43 | 58 | | |
44 | | - | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
45 | 62 | | |
46 | 63 | | |
47 | 64 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
295 | 295 | | |
296 | 296 | | |
297 | 297 | | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
298 | 311 | | |
299 | 312 | | |
300 | 313 | | |
| |||
317 | 330 | | |
318 | 331 | | |
319 | 332 | | |
320 | | - | |
| 333 | + | |
321 | 334 | | |
322 | 335 | | |
323 | 336 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| 7 | + | |
7 | 8 | | |
8 | 9 | | |
9 | 10 | | |
| |||
46 | 47 | | |
47 | 48 | | |
48 | 49 | | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
49 | 57 | | |
50 | 58 | | |
51 | 59 | | |
52 | 60 | | |
53 | 61 | | |
54 | 62 | | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
55 | 78 | | |
56 | 79 | | |
57 | 80 | | |
| |||
380 | 403 | | |
381 | 404 | | |
382 | 405 | | |
383 | | - | |
| 406 | + | |
384 | 407 | | |
385 | 408 | | |
386 | 409 | | |
| |||
631 | 654 | | |
632 | 655 | | |
633 | 656 | | |
634 | | - | |
| 657 | + | |
635 | 658 | | |
636 | 659 | | |
637 | 660 | | |
| |||
1433 | 1456 | | |
1434 | 1457 | | |
1435 | 1458 | | |
1436 | | - | |
| 1459 | + | |
| 1460 | + | |
1437 | 1461 | | |
1438 | 1462 | | |
1439 | 1463 | | |
| |||
1454 | 1478 | | |
1455 | 1479 | | |
1456 | 1480 | | |
1457 | | - | |
| 1481 | + | |
| 1482 | + | |
1458 | 1483 | | |
1459 | 1484 | | |
1460 | 1485 | | |
| |||
1503 | 1528 | | |
1504 | 1529 | | |
1505 | 1530 | | |
1506 | | - | |
| 1531 | + | |
1507 | 1532 | | |
1508 | 1533 | | |
1509 | 1534 | | |
| |||
1759 | 1784 | | |
1760 | 1785 | | |
1761 | 1786 | | |
1762 | | - | |
| 1787 | + | |
| 1788 | + | |
1763 | 1789 | | |
1764 | 1790 | | |
1765 | 1791 | | |
| |||
1784 | 1810 | | |
1785 | 1811 | | |
1786 | 1812 | | |
1787 | | - | |
| 1813 | + | |
1788 | 1814 | | |
1789 | 1815 | | |
1790 | 1816 | | |
| |||
1967 | 1993 | | |
1968 | 1994 | | |
1969 | 1995 | | |
1970 | | - | |
| 1996 | + | |
| 1997 | + | |
1971 | 1998 | | |
1972 | 1999 | | |
1973 | 2000 | | |
1974 | 2001 | | |
1975 | 2002 | | |
1976 | 2003 | | |
1977 | 2004 | | |
1978 | | - | |
1979 | | - | |
1980 | | - | |
1981 | | - | |
1982 | | - | |
1983 | | - | |
| 2005 | + | |
| 2006 | + | |
| 2007 | + | |
| 2008 | + | |
1984 | 2009 | | |
1985 | | - | |
1986 | | - | |
1987 | | - | |
| 2010 | + | |
| 2011 | + | |
| 2012 | + | |
| 2013 | + | |
| 2014 | + | |
| 2015 | + | |
| 2016 | + | |
| 2017 | + | |
1988 | 2018 | | |
1989 | | - | |
1990 | | - | |
1991 | | - | |
1992 | | - | |
1993 | | - | |
1994 | | - | |
| 2019 | + | |
1995 | 2020 | | |
1996 | | - | |
| 2021 | + | |
1997 | 2022 | | |
1998 | | - | |
| 2023 | + | |
| 2024 | + | |
| 2025 | + | |
| 2026 | + | |
| 2027 | + | |
1999 | 2028 | | |
2000 | 2029 | | |
2001 | 2030 | | |
2002 | | - | |
2003 | | - | |
| 2031 | + | |
2004 | 2032 | | |
2005 | | - | |
| 2033 | + | |
2006 | 2034 | | |
2007 | 2035 | | |
2008 | | - | |
2009 | | - | |
2010 | | - | |
2011 | | - | |
2012 | | - | |
2013 | 2036 | | |
2014 | 2037 | | |
2015 | 2038 | | |
| |||
0 commit comments