@tobi-or-not/quorum 0.1.0 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (40) hide show
  1. package/LICENSE +202 -0
  2. package/README.md +4 -0
  3. package/dist/cli/bin.js +9 -1
  4. package/dist/cli/main.js +49 -12
  5. package/dist/cli/print-config.js +38 -9
  6. package/dist/cli/render.js +18 -6
  7. package/dist/config/claude-code.js +42 -11
  8. package/dist/config/env.js +135 -32
  9. package/dist/config/from-config.js +43 -9
  10. package/dist/config/load.js +163 -37
  11. package/dist/config/profiles.js +87 -20
  12. package/dist/config/resolve.js +194 -47
  13. package/dist/config/schema.js +98 -23
  14. package/dist/core/diff.js +65 -17
  15. package/dist/core/errors.js +14 -5
  16. package/dist/core/flags.js +30 -6
  17. package/dist/core/output.js +49 -13
  18. package/dist/core/policy.js +6 -2
  19. package/dist/core/profile.js +42 -15
  20. package/dist/core/prompts.js +20 -5
  21. package/dist/core/quorum.js +128 -33
  22. package/dist/core/sanitize.js +3 -1
  23. package/dist/core/stages/context.js +30 -5
  24. package/dist/core/stages/panel.js +55 -9
  25. package/dist/core/stages/research.js +13 -3
  26. package/dist/core/verify.js +6 -2
  27. package/dist/index.js +5 -1
  28. package/dist/providers/anthropic.js +28 -5
  29. package/dist/providers/build.js +57 -16
  30. package/dist/providers/claude-code.js +206 -51
  31. package/dist/providers/gemini.js +61 -14
  32. package/dist/providers/http.js +32 -9
  33. package/dist/providers/messages.js +14 -2
  34. package/dist/providers/ollama.js +31 -8
  35. package/dist/providers/openai-compatible.js +51 -15
  36. package/dist/providers/options.js +120 -40
  37. package/dist/providers/presets.js +143 -16
  38. package/dist/providers/reply.js +15 -5
  39. package/dist/providers/size.js +11 -3
  40. package/package.json +5 -4
package/LICENSE ADDED
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
package/README.md CHANGED
@@ -90,3 +90,7 @@ The JSON result goes to stdout, and the exit code says what to do with it: `0` f
90
90
  - [The JSON result](./docs/95-reference/20-json-result.md) *- Every field of a result in the order it is written, the incomplete reasons, and an example*
91
91
  - [Library API](./docs/95-reference/30-library-api.md) *- `createQuorum`, its ports, the events, abort, the errors and every export*
92
92
  - [Architecture](./docs/95-reference/40-architecture.md) *- The modules, the dependency rule, the stages of a review, and how the suite runs*
93
+
94
+ ## License
95
+
96
+ quorum is released under the [Apache License 2.0](./LICENSE).
package/dist/cli/bin.js CHANGED
@@ -26,7 +26,15 @@ process.once('beforeExit', () => {
26
26
  });
27
27
  // Inside the async function, so a working directory that no longer exists fails the run with exit 3.
28
28
  async function main() {
29
- return runCli({ argv: process.argv.slice(2), cwd: process.cwd(), env: process.env, stdin: process.stdin, stdout: process.stdout, stderr: process.stderr, signal });
29
+ return runCli({
30
+ argv: process.argv.slice(2),
31
+ cwd: process.cwd(),
32
+ env: process.env,
33
+ stdin: process.stdin,
34
+ stdout: process.stdout,
35
+ stderr: process.stderr,
36
+ signal,
37
+ });
30
38
  }
31
39
  main()
32
40
  .then((code) => {
package/dist/cli/main.js CHANGED
@@ -10,7 +10,14 @@ import { inertJson, inertLine } from "../core/sanitize.js";
10
10
  import { printConfig } from "./print-config.js";
11
11
  import { bannerLines, progressSink } from "./render.js";
12
12
  /** Exit codes (ADR-0008, amended by ADR-0012). */
13
- export const EXIT = { ok: 0, finding: 1, usage: 2, runtime: 3, incomplete: 4, interrupted: 130 };
13
+ export const EXIT = {
14
+ ok: 0,
15
+ finding: 1,
16
+ usage: 2,
17
+ runtime: 3,
18
+ incomplete: 4,
19
+ interrupted: 130,
20
+ };
14
21
  /** The most diff the CLI reads, from stdin or a file, in bytes: a larger one is refused and reading stops there. */
15
22
  export const MAX_DIFF_BYTES = 16 * 1024 * 1024;
16
23
  const USAGE = [
@@ -81,8 +88,11 @@ export async function runCli(io) {
81
88
  const printing = values['print-config'] === true;
82
89
  let diff = '';
83
90
  try {
84
- if (values.config === '')
85
- throw new ConfigError([{ path: '--config', message: 'must name a file' }]);
91
+ if (values.config === '') {
92
+ throw new ConfigError([
93
+ { path: '--config', message: 'must name a file' },
94
+ ]);
95
+ }
86
96
  if (printing && positionals.length > 0)
87
97
  throw new Error('--print-config takes no diff file');
88
98
  if (!printing)
@@ -93,9 +103,19 @@ export async function runCli(io) {
93
103
  }
94
104
  let quorum;
95
105
  try {
96
- const selection = values.profile === undefined ? undefined : { ids: values.profile, path: '--profile' };
97
- const { config, source } = await loadConfig({ cwd: io.cwd, env: io.env, configPath: values.config, selection });
98
- quorum = await fromConfig(config, { env: io.env, events: progressSink(line => io.stderr.write(`${line}\n`)) });
106
+ const selection = values.profile === undefined
107
+ ? undefined
108
+ : { ids: values.profile, path: '--profile' };
109
+ const { config, source } = await loadConfig({
110
+ cwd: io.cwd,
111
+ env: io.env,
112
+ configPath: values.config,
113
+ selection,
114
+ });
115
+ quorum = await fromConfig(config, {
116
+ env: io.env,
117
+ events: progressSink(line => io.stderr.write(`${line}\n`)),
118
+ });
99
119
  if (printing) {
100
120
  io.stdout.write(printConfig(config, source));
101
121
  return EXIT.ok;
@@ -117,7 +137,9 @@ export async function runCli(io) {
117
137
  if (error instanceof ConfigError && quorum === undefined)
118
138
  writeWarnings(io, readEnv(io.env).warnings);
119
139
  io.stderr.write(`${errorLines(error)}\n`);
120
- return error instanceof ConfigError ? EXIT.usage : EXIT.runtime;
140
+ return error instanceof ConfigError
141
+ ? EXIT.usage
142
+ : EXIT.runtime;
121
143
  }
122
144
  }
123
145
  /** Write each warning as an inert `warning:` line. */
@@ -163,12 +185,19 @@ export function exitCodeFor(result, options = {}) {
163
185
  if (result.meta.incomplete.some(entry => entry.reason === 'request-too-large' && gates(entry.profile)))
164
186
  return EXIT.incomplete;
165
187
  const incomplete = result.unreviewed.some(verdict => gates(verdict.profile)) || result.meta.incomplete.some(entry => gates(entry.profile));
166
- return incomplete && options.allowIncomplete !== true ? EXIT.incomplete : EXIT.ok;
188
+ return incomplete && options.allowIncomplete !== true
189
+ ? EXIT.incomplete
190
+ : EXIT.ok;
167
191
  }
168
192
  /** The flags of `argv` and its positional arguments; a usage error of `parseArgs` is raised as a `ConfigError`, one issue per line of its message. */
169
193
  function parseFlags(argv) {
170
194
  try {
171
- return parseArgs({ args: [...argv], options: OPTIONS, strict: true, allowPositionals: true });
195
+ return parseArgs({
196
+ args: [...argv],
197
+ options: OPTIONS,
198
+ strict: true,
199
+ allowPositionals: true,
200
+ });
172
201
  }
173
202
  catch (error) {
174
203
  if (!(error instanceof Error) || !error.code?.startsWith('ERR_PARSE_ARGS_'))
@@ -204,7 +233,9 @@ async function readCapped(chunks) {
204
233
  let bytes = 0;
205
234
  let text = '';
206
235
  for await (const chunk of chunks) {
207
- const data = typeof chunk === 'string' ? encoder.encode(chunk) : chunk;
236
+ const data = typeof chunk === 'string'
237
+ ? encoder.encode(chunk)
238
+ : chunk;
208
239
  bytes += data.byteLength;
209
240
  if (bytes > MAX_DIFF_BYTES)
210
241
  throw new Error('the diff is over 16 MiB, the most quorum reads');
@@ -218,8 +249,14 @@ async function readCapped(chunks) {
218
249
  * a server sent cannot start a line of its own.
219
250
  */
220
251
  function errorLines(error) {
221
- const lines = error instanceof ConfigError ? error.message.split('\n') : [errorMessage(error)];
222
- return lines.map((line, index) => inertLine(index === 0 ? `Error: ${line}` : line)).join('\n');
252
+ const lines = error instanceof ConfigError
253
+ ? error.message.split('\n')
254
+ : [
255
+ errorMessage(error),
256
+ ];
257
+ return lines.map((line, index) => inertLine(index === 0
258
+ ? `Error: ${line}`
259
+ : line)).join('\n');
223
260
  }
224
261
  /**
225
262
  * The text of a failure, for any value a promise can reject with: an `Error`'s message, else the
@@ -16,17 +16,26 @@ function sha256(text) {
16
16
  }
17
17
  /** The keys of a record, each with the redacted word: a header, query or body value can be a credential. */
18
18
  function redactedValues(record) {
19
- return record === undefined ? undefined : Object.fromEntries(Object.keys(record).map(key => [key, REDACTED]));
19
+ return record === undefined
20
+ ? undefined
21
+ : Object.fromEntries(Object.keys(record).map(key => [key, REDACTED]));
20
22
  }
21
23
  /** The auth style as set: a name, or the header and the prefix a key is sent with. Neither holds the key. */
22
24
  function authView(auth) {
23
- return typeof auth === 'object' ? { header: own(auth, 'header'), prefix: own(auth, 'prefix') } : auth;
25
+ return typeof auth === 'object'
26
+ ? {
27
+ header: own(auth, 'header'),
28
+ prefix: own(auth, 'prefix'),
29
+ }
30
+ : auth;
24
31
  }
25
32
  /** Where the instructions go (`native` or `inline`), the only values a spec accepts; any other value is a prompt, so it prints as its hash. */
26
33
  function systemPromptView(value) {
27
34
  if (value === undefined || value === 'native' || value === 'inline')
28
35
  return value;
29
- return typeof value === 'string' ? sha256(value) : REDACTED;
36
+ return typeof value === 'string'
37
+ ? sha256(value)
38
+ : REDACTED;
30
39
  }
31
40
  /**
32
41
  * A provider defined as data, field by field: a field of a spec that is not listed here prints nothing.
@@ -39,10 +48,14 @@ function specView(spec) {
39
48
  preset: own(spec, 'preset'),
40
49
  protocol: own(spec, 'protocol'),
41
50
  command: own(spec, 'command'),
42
- origin: cli ? undefined : providerOrigin(spec),
51
+ origin: cli
52
+ ? undefined
53
+ : providerOrigin(spec),
43
54
  model: own(spec, 'model'),
44
55
  contextTokens: own(spec, 'contextTokens'),
45
- apiKey: own(spec, 'apiKey') === undefined ? undefined : REDACTED,
56
+ apiKey: own(spec, 'apiKey') === undefined
57
+ ? undefined
58
+ : REDACTED,
46
59
  auth: authView(own(spec, 'auth') ?? (cli ? 'inherit' : undefined)),
47
60
  args: own(spec, 'args'),
48
61
  headers: redactedValues(own(spec, 'headers')),
@@ -58,7 +71,12 @@ function specView(spec) {
58
71
  /** A provider object by what it implements and its model, when that is a string; never its function. */
59
72
  function objectView(provider) {
60
73
  const model = own(provider, 'model');
61
- return { implements: 'Provider', model: typeof model === 'string' ? model : undefined };
74
+ return {
75
+ implements: 'Provider',
76
+ model: typeof model === 'string'
77
+ ? model
78
+ : undefined,
79
+ };
62
80
  }
63
81
  /** A profile that runs: its providers, the votes its policy needs, and each prompt as its hash. */
64
82
  function profileView({ profile, research, voters }) {
@@ -67,7 +85,10 @@ function profileView({ profile, research, voters }) {
67
85
  research,
68
86
  lenses: { ...voters },
69
87
  thresholds: thresholdsFor(profile),
70
- prompts: { research: sha256(profile.prompts.research), vote: sha256(profile.prompts.vote) },
88
+ prompts: {
89
+ research: sha256(profile.prompts.research),
90
+ vote: sha256(profile.prompts.vote),
91
+ },
71
92
  };
72
93
  }
73
94
  /**
@@ -85,8 +106,16 @@ function profileView({ profile, research, voters }) {
85
106
  export function printConfig(config, source) {
86
107
  const view = {
87
108
  source: source ?? null,
88
- providers: Object.fromEntries(Object.entries(config.providers).map(([name, provider]) => [name, isProvider(provider) ? objectView(provider) : specView(provider)])),
89
- profiles: Object.fromEntries(config.profiles.map(resolved => [resolved.profile.id, profileView(resolved)])),
109
+ providers: Object.fromEntries(Object.entries(config.providers).map(([name, provider]) => [
110
+ name,
111
+ isProvider(provider)
112
+ ? objectView(provider)
113
+ : specView(provider),
114
+ ])),
115
+ profiles: Object.fromEntries(config.profiles.map(resolved => [
116
+ resolved.profile.id,
117
+ profileView(resolved),
118
+ ])),
90
119
  concurrency: config.concurrency ?? DEFAULT_CONCURRENCY,
91
120
  maxFindings: config.maxFindings ?? DEFAULT_MAX_FINDINGS,
92
121
  warnings: [...config.warnings],
@@ -14,14 +14,20 @@ import { presetOf } from "../providers/presets.js";
14
14
  */
15
15
  export function renderEvent(event, prefixed = false) {
16
16
  const line = progressLine(event, prefixed);
17
- return line === undefined ? undefined : inertLine(line);
17
+ return line === undefined
18
+ ? undefined
19
+ : inertLine(line);
18
20
  }
19
21
  const profilePrefix = (profile) => `[${profile}] `;
20
22
  function progressLine(event, prefixed) {
21
- const of = (profile, line) => prefixed ? `${profilePrefix(profile)}${line}` : line;
23
+ const of = (profile, line) => prefixed
24
+ ? `${profilePrefix(profile)}${line}`
25
+ : line;
22
26
  switch (event.type) {
23
27
  case 'stage:end':
24
- return event.stage === 'dedup' ? of(event.profile, `${event.count} candidate(s) after dedup`) : undefined;
28
+ return event.stage === 'dedup'
29
+ ? of(event.profile, `${event.count} candidate(s) after dedup`)
30
+ : undefined;
25
31
  case 'finding:invalid':
26
32
  return of(event.profile, `invalid finding dropped: ${event.reason}`);
27
33
  case 'incomplete':
@@ -69,13 +75,17 @@ export function providerOrigin(spec) {
69
75
  }
70
76
  /** Where a provider defined as data is reached, as the banner names it: its origin, or `claude-code` for the CLI, which has none. */
71
77
  function endpointOf(spec) {
72
- return isClaudeCode(own(spec, 'protocol')) ? 'claude-code' : providerOrigin(spec);
78
+ return isClaudeCode(own(spec, 'protocol'))
79
+ ? 'claude-code'
80
+ : providerOrigin(spec);
73
81
  }
74
82
  /** What a provider reads as in the banner: its model and where it is reached, a provider object by its config key. */
75
83
  function providerLabel(providers, name) {
76
84
  // Resolution bound every profile to providers it kept, so each name is found.
77
85
  const entry = own(providers, name);
78
- return isProvider(entry) ? `${entry.model} @ the provider object ${name}` : `${own(entry, 'model')} @ ${endpointOf(entry)}`;
86
+ return isProvider(entry)
87
+ ? `${entry.model} @ the provider object ${name}`
88
+ : `${own(entry, 'model')} @ ${endpointOf(entry)}`;
79
89
  }
80
90
  /** The banner of one profile: its research provider, then its panel, one provider for every lens when they share it. */
81
91
  function profileBanner({ research, voters }, providers) {
@@ -96,7 +106,9 @@ function profileBanner({ research, voters }, providers) {
96
106
  export function bannerLines(config) {
97
107
  const prefixed = config.profiles.length > 1;
98
108
  return config.profiles.flatMap((resolved) => {
99
- const prefix = prefixed ? profilePrefix(resolved.profile.id) : '';
109
+ const prefix = prefixed
110
+ ? profilePrefix(resolved.profile.id)
111
+ : '';
100
112
  return profileBanner(resolved, config.providers).map(line => inertLine(`${prefix}${line}`));
101
113
  });
102
114
  }
@@ -29,8 +29,12 @@ function isExecutableFile(path, platform) {
29
29
  }
30
30
  /** The `PATH` of the environment: its own variable, in the letter case Windows gives its name, else undefined. */
31
31
  function searchPath(env, platform) {
32
- const name = platform === 'win32' ? Object.keys(env).find(key => key.toUpperCase() === 'PATH') : 'PATH';
33
- return name === undefined ? undefined : envValue(env, name);
32
+ const name = platform === 'win32'
33
+ ? Object.keys(env).find(key => key.toUpperCase() === 'PATH')
34
+ : 'PATH';
35
+ return name === undefined
36
+ ? undefined
37
+ : envValue(env, name);
34
38
  }
35
39
  /**
36
40
  * The executable `command` names: an absolute path as it is, a bare name in the first absolute entry of the
@@ -43,10 +47,17 @@ function searchPath(env, platform) {
43
47
  export function findCommand(command, env, platform = process.platform) {
44
48
  if (commandProblem(command) !== undefined)
45
49
  return undefined;
46
- if (isAbsolute(command))
47
- return isExecutableFile(command, platform) ? command : undefined;
48
- const file = platform === 'win32' && extname(command) === '' ? `${command}.exe` : command;
49
- const entries = (searchPath(env, platform) ?? '').split(platform === 'win32' ? ';' : ':').filter(entry => isAbsolute(entry));
50
+ if (isAbsolute(command)) {
51
+ return isExecutableFile(command, platform)
52
+ ? command
53
+ : undefined;
54
+ }
55
+ const file = platform === 'win32' && extname(command) === ''
56
+ ? `${command}.exe`
57
+ : command;
58
+ const entries = (searchPath(env, platform) ?? '').split(platform === 'win32'
59
+ ? ';'
60
+ : ':').filter(entry => isAbsolute(entry));
50
61
  return entries.map(entry => join(entry, file)).find(candidate => isExecutableFile(candidate, platform));
51
62
  }
52
63
  /**
@@ -62,11 +73,31 @@ export function claudeCodeCommand(name, settings, variable, env) {
62
73
  const found = findCommand(variable ?? named ?? DEFAULT_COMMAND, env);
63
74
  if (found !== undefined)
64
75
  return { command: found, issues: [] };
65
- if (variable !== undefined)
66
- return { issues: [{ path: CLAUDE_CODE_COMMAND, message: NO_EXECUTABLE }] };
67
- if (named !== undefined)
68
- return { issues: [{ path: configPath(['providers', name, 'command']), message: NO_EXECUTABLE }] };
69
- return { issues: [{ path: configPath(['providers', name]), message: CLAUDE_NOT_FOUND }] };
76
+ if (variable !== undefined) {
77
+ return {
78
+ issues: [
79
+ { path: CLAUDE_CODE_COMMAND, message: NO_EXECUTABLE },
80
+ ],
81
+ };
82
+ }
83
+ if (named !== undefined) {
84
+ return {
85
+ issues: [
86
+ {
87
+ path: configPath(['providers', name, 'command']),
88
+ message: NO_EXECUTABLE,
89
+ },
90
+ ],
91
+ };
92
+ }
93
+ return {
94
+ issues: [
95
+ {
96
+ path: configPath(['providers', name]),
97
+ message: CLAUDE_NOT_FOUND,
98
+ },
99
+ ],
100
+ };
70
101
  }
71
102
  /**
72
103
  * The warning of a provider that runs under `inherit` (or sets no `auth`) while `ANTHROPIC_API_KEY` is set: