@llm4ts/shell 3.2.6 → 3.4.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.
- package/README.md +36 -0
- package/dist/Cli.d.ts +11 -3
- package/dist/Cli.d.ts.map +1 -1
- package/dist/Cli.js +127 -39
- package/dist/Cli.js.map +1 -1
- package/dist/CoderChoice.d.ts +2 -4
- package/dist/CoderChoice.d.ts.map +1 -1
- package/dist/CoderChoice.js +8 -12
- package/dist/CoderChoice.js.map +1 -1
- package/dist/Config.d.ts +238 -0
- package/dist/Config.d.ts.map +1 -0
- package/dist/Config.js +594 -0
- package/dist/Config.js.map +1 -0
- package/dist/ConfigCommand.d.ts +180 -0
- package/dist/ConfigCommand.d.ts.map +1 -0
- package/dist/ConfigCommand.js +903 -0
- package/dist/ConfigCommand.js.map +1 -0
- package/dist/ConfigEdit.d.ts +79 -0
- package/dist/ConfigEdit.d.ts.map +1 -0
- package/dist/ConfigEdit.js +110 -0
- package/dist/ConfigEdit.js.map +1 -0
- package/dist/ConfigTrust.d.ts +45 -0
- package/dist/ConfigTrust.d.ts.map +1 -0
- package/dist/ConfigTrust.js +72 -0
- package/dist/ConfigTrust.js.map +1 -0
- package/dist/FlowLaunch.d.ts +2 -3
- package/dist/FlowLaunch.d.ts.map +1 -1
- package/dist/FlowLaunch.js +1 -5
- package/dist/FlowLaunch.js.map +1 -1
- package/dist/FlowProcess.d.ts +3 -1
- package/dist/FlowProcess.d.ts.map +1 -1
- package/dist/FlowProcess.js.map +1 -1
- package/dist/Menu.d.ts +1 -1
- package/dist/Menu.d.ts.map +1 -1
- package/dist/Menu.js +33 -6
- package/dist/Menu.js.map +1 -1
- package/dist/OperatorConfig.d.ts.map +1 -1
- package/dist/OperatorConfig.js +2 -1
- package/dist/OperatorConfig.js.map +1 -1
- package/dist/OperatorTools.d.ts +2 -0
- package/dist/OperatorTools.d.ts.map +1 -1
- package/dist/Refine.d.ts.map +1 -1
- package/dist/Refine.js +3 -2
- package/dist/Refine.js.map +1 -1
- package/dist/RunSupervisor.d.ts +4 -3
- package/dist/RunSupervisor.d.ts.map +1 -1
- package/dist/RunSupervisor.js +26 -13
- package/dist/RunSupervisor.js.map +1 -1
- package/flows/epic-design.js +7 -5
- package/flows/epic-retro.js +3 -2
- package/flows/implement.js +3 -2
- package/flows/issue-pr.js +3 -2
- package/flows/judge-suite.js +2 -2
- package/flows/lib/debt.js +2 -2
- package/flows/lib/epic-retro.js +3 -6
- package/flows/lib/epic-stories.js +54 -115
- package/flows/lib/modernize-extract.js +3 -6
- package/flows/lib/pack-fork.js +8 -10
- package/flows/lib/port.js +8 -10
- package/flows/local.js +3 -2
- package/flows/modernize-bench.js +5 -5
- package/flows/modernize-extract.js +8 -7
- package/flows/modernize-implement.js +4 -6
- package/flows/modernize-pack-check.js +2 -1
- package/flows/modernize-pack-upgrade.js +2 -1
- package/flows/modernize-refine.js +6 -5
- package/flows/modernize-review.js +2 -2
- package/flows/modernize-seed.js +8 -8
- package/flows/modernize-survey.js +4 -7
- package/flows/modernize-verify.js +2 -2
- package/flows/pack-fork.js +4 -3
- package/flows/port-compile.js +4 -3
- package/flows/port-files.js +2 -2
- package/flows/port-guide.js +5 -4
- package/flows/port-ledger.js +2 -2
- package/flows/port-tests.js +5 -4
- package/flows/roundtable.js +2 -2
- package/flows/sdd.js +8 -13
- package/flows/taskforce.js +5 -4
- package/kits/j2ee-nextjs/README.md +2 -1
- package/kits/j2ee-nextjs/fixtures/demo-bank/RUNBOOK.md +32 -14
- package/kits/j2ee-nextjs/fixtures/demo-bank/reset-demo.mjs +3 -1
- package/kits/j2ee-nextjs/flows/convert-all.js +8 -7
- package/kits/j2ee-nextjs/flows/convert-feature.js +2 -2
- package/kits/j2ee-nextjs/flows/convert-page.js +2 -2
- package/kits/j2ee-nextjs/flows/lib/convert.js +7 -10
- package/kits/soap-ace/flows/soap-design.js +5 -8
- package/kits/soap-ace/flows/soap-discover.js +4 -3
- package/kits/soap-ace/flows/soap-epic.js +4 -7
- package/kits/soap-ace/flows/soap-explore.js +8 -7
- package/kits/soap-ace/flows/soap-sample.js +10 -10
- package/kits/soap-ace/tools/soap-call.js +3 -2
- package/package.json +8 -4
- package/src/Cli.ts +176 -46
- package/src/CoderChoice.ts +10 -16
- package/src/Config.ts +868 -0
- package/src/ConfigCommand.ts +1423 -0
- package/src/ConfigEdit.ts +180 -0
- package/src/ConfigTrust.ts +145 -0
- package/src/FlowLaunch.ts +3 -8
- package/src/FlowProcess.ts +3 -1
- package/src/Menu.ts +40 -7
- package/src/OperatorConfig.ts +2 -1
- package/src/Refine.ts +3 -2
- package/src/RunSupervisor.ts +26 -14
package/src/Cli.ts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { homedir } from "node:os"
|
|
2
|
-
import {
|
|
2
|
+
import { join, resolve } from "node:path"
|
|
3
3
|
import { fileURLToPath } from "node:url"
|
|
4
4
|
import * as Console from "effect/Console"
|
|
5
5
|
import * as DateTime from "effect/DateTime"
|
|
6
6
|
import * as Effect from "effect/Effect"
|
|
7
7
|
import * as Option from "effect/Option"
|
|
8
|
+
import * as Result from "effect/Result"
|
|
8
9
|
import { FileSystem } from "effect/FileSystem"
|
|
9
10
|
import * as Schema from "effect/Schema"
|
|
10
11
|
import { Argument, Command, Flag } from "effect/cli"
|
|
@@ -49,6 +50,16 @@ import {
|
|
|
49
50
|
type DiscoveredFlow,
|
|
50
51
|
type FlowTierPaths
|
|
51
52
|
} from "./FlowCatalog.ts"
|
|
53
|
+
import {
|
|
54
|
+
flowEnvironment,
|
|
55
|
+
flowNameOf,
|
|
56
|
+
loadConfig,
|
|
57
|
+
prepareLaunch,
|
|
58
|
+
resolvedEnvironment,
|
|
59
|
+
type FlagAssignment
|
|
60
|
+
} from "./Config.ts"
|
|
61
|
+
import { settingValue } from "@llm4ts/flow/Settings"
|
|
62
|
+
import { configCommand, configView, parseAssignment, renderDoctorConfig } from "./ConfigCommand.ts"
|
|
52
63
|
import { launchFlow } from "./FlowLaunch.ts"
|
|
53
64
|
import { mcpOptionsFrom } from "./OperatorConfig.ts"
|
|
54
65
|
import { nodeOperatorRuntime, nodeRead, runMcp } from "./OperatorNode.ts"
|
|
@@ -192,31 +203,81 @@ export interface RunFlags {
|
|
|
192
203
|
readonly roster: Option.Option<string>
|
|
193
204
|
readonly executors: Option.Option<string>
|
|
194
205
|
readonly pack: Option.Option<string>
|
|
206
|
+
readonly coder: Option.Option<string>
|
|
195
207
|
readonly ui: "classic" | "tree"
|
|
196
208
|
readonly transcript: boolean
|
|
197
209
|
readonly otel: boolean
|
|
198
210
|
readonly otelContent: Option.Option<"off" | "on" | "full">
|
|
211
|
+
readonly set: ReadonlyArray<string>
|
|
199
212
|
}
|
|
200
213
|
|
|
201
|
-
/**
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
214
|
+
/**
|
|
215
|
+
* The `run` flags as the config's flag layer: each named flag is its
|
|
216
|
+
* setting, each `--set` its `NAME=value`. Fails on a `--set` that is no
|
|
217
|
+
* assignment; whether a name or a value is acceptable is the resolver's call.
|
|
218
|
+
*/
|
|
219
|
+
export const runFlagAssignments = (
|
|
220
|
+
flags: RunFlags
|
|
221
|
+
): Result.Result<ReadonlyArray<FlagAssignment>, string> => {
|
|
222
|
+
const named: ReadonlyArray<FlagAssignment> = [
|
|
223
|
+
...(flags.verbose ? [{ name: "LLM4TS_VERBOSITY", value: "verbose", flag: "--verbose" }] : []),
|
|
224
|
+
...(Option.isSome(flags.roster)
|
|
225
|
+
? [{ name: "LLM4TS_ROSTER", value: flags.roster.value, flag: "--roster" }]
|
|
226
|
+
: []),
|
|
227
|
+
...(Option.isSome(flags.executors)
|
|
228
|
+
? [{ name: "LLM4TS_EXECUTORS", value: flags.executors.value, flag: "--executors" }]
|
|
229
|
+
: []),
|
|
230
|
+
...(Option.isSome(flags.pack)
|
|
231
|
+
? [{ name: "LLM4TS_PACK", value: flags.pack.value, flag: "--pack" }]
|
|
232
|
+
: []),
|
|
233
|
+
...(Option.isSome(flags.coder)
|
|
234
|
+
? [{ name: "LLM4TS_CODER", value: flags.coder.value, flag: "--coder" }]
|
|
235
|
+
: []),
|
|
236
|
+
...(flags.ui === "tree" ? [{ name: "LLM4TS_UI", value: "tree", flag: "--ui" }] : []),
|
|
237
|
+
...(flags.transcript ? [{ name: "LLM4TS_TRANSCRIPT", value: "on", flag: "--transcript" }] : []),
|
|
238
|
+
...(flags.otel ? [{ name: "LLM4TS_OTEL", value: "on", flag: "--otel" }] : []),
|
|
239
|
+
...(Option.isSome(flags.otelContent)
|
|
240
|
+
? [{ name: "LLM4TS_OTEL_CONTENT", value: flags.otelContent.value, flag: "--otel-content" }]
|
|
241
|
+
: [])
|
|
242
|
+
]
|
|
243
|
+
const sets: Array<FlagAssignment> = []
|
|
244
|
+
for (const text of flags.set) {
|
|
245
|
+
const parsed = parseAssignment(text)
|
|
246
|
+
if (Result.isFailure(parsed)) {
|
|
247
|
+
return Result.fail(`--set: ${parsed.failure}`)
|
|
248
|
+
}
|
|
249
|
+
sets.push({ ...parsed.success, flag: "--set" })
|
|
250
|
+
}
|
|
251
|
+
return Result.succeed([...named, ...sets])
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
const launchDeps = { files: nodePlainFileStore }
|
|
255
|
+
|
|
256
|
+
/**
|
|
257
|
+
* What an in-process verb reads its settings from: the process environment
|
|
258
|
+
* plus the config files' values for `repo`. A file problem is printed and
|
|
259
|
+
* the value it concerns left out, and so is a project file that is not
|
|
260
|
+
* trusted; neither stops a read-only verb.
|
|
261
|
+
*/
|
|
262
|
+
const verbEnvironment = Effect.fn("@llm4ts/shell/Cli.verbEnvironment")(function* (repo: string) {
|
|
263
|
+
const { resolution } = yield* loadConfig({
|
|
264
|
+
repo,
|
|
265
|
+
environment: process.env,
|
|
266
|
+
flags: [],
|
|
267
|
+
...launchDeps
|
|
268
|
+
}).pipe(Effect.mapError((error) => new ShellUsageError({ message: error.message })))
|
|
269
|
+
const said = resolution.problems.filter(
|
|
270
|
+
(problem) => problem.severity === "error" || problem.kind === "untrusted"
|
|
271
|
+
)
|
|
272
|
+
for (const problem of said) {
|
|
273
|
+
yield* Console.error(`llm4ts config: ${problem.message}`)
|
|
274
|
+
}
|
|
275
|
+
return resolvedEnvironment(resolution, process.env)
|
|
218
276
|
})
|
|
219
277
|
|
|
278
|
+
const repoOr = (repo: Option.Option<string>): string =>
|
|
279
|
+
resolve(Option.getOrElse(repo, () => process.cwd()))
|
|
280
|
+
|
|
220
281
|
const runCommand = Command.make(
|
|
221
282
|
"run",
|
|
222
283
|
{
|
|
@@ -239,6 +300,18 @@ const runCommand = Command.make(
|
|
|
239
300
|
"Pack for the modernization flows, forwarded as LLM4TS_PACK: a kit pack name from `llm4ts kits`, kit/pack, or a directory holding pack.md"
|
|
240
301
|
)
|
|
241
302
|
),
|
|
303
|
+
coder: Flag.String("coder").pipe(
|
|
304
|
+
Flag.optional,
|
|
305
|
+
Flag.withDescription(
|
|
306
|
+
"Coding agent for this run (claude, codex, gemini, pi, …), forwarded as LLM4TS_CODER"
|
|
307
|
+
)
|
|
308
|
+
),
|
|
309
|
+
set: Flag.String("set").pipe(
|
|
310
|
+
Flag.atLeast(0),
|
|
311
|
+
Flag.withDescription(
|
|
312
|
+
"NAME=value: any LLM4TS_* setting for this run only, repeatable; wins over the environment and the config files (llm4ts config show lists them)"
|
|
313
|
+
)
|
|
314
|
+
),
|
|
242
315
|
verbose: Flag.Boolean("verbose").pipe(
|
|
243
316
|
Flag.withDefault(false),
|
|
244
317
|
Flag.withDescription("Stream verbose flow output")
|
|
@@ -284,14 +357,25 @@ const runCommand = Command.make(
|
|
|
284
357
|
Effect.gen(function* () {
|
|
285
358
|
const tiers = shellTierPaths()
|
|
286
359
|
const flowPath = yield* resolveFlow(config.flow, tiers)
|
|
287
|
-
const
|
|
360
|
+
const flags = runFlagAssignments(config)
|
|
361
|
+
if (Result.isFailure(flags)) {
|
|
362
|
+
return yield* new ShellUsageError({ message: flags.failure })
|
|
363
|
+
}
|
|
364
|
+
const plan = yield* prepareLaunch({
|
|
365
|
+
repo: repoOr(config.repo),
|
|
366
|
+
flow: flowNameOf(flowPath),
|
|
367
|
+
base: process.env,
|
|
368
|
+
flags: flags.success,
|
|
369
|
+
...launchDeps
|
|
370
|
+
})
|
|
371
|
+
yield* Effect.forEach(plan.notices, (notice) => Console.error(notice), { discard: true })
|
|
288
372
|
const exitCode = yield* launchFlow({
|
|
289
373
|
flowPath,
|
|
290
374
|
taskArgs: [
|
|
291
375
|
...(config.repo._tag === "Some" ? ["--repo", config.repo.value] : []),
|
|
292
376
|
...config.task
|
|
293
377
|
],
|
|
294
|
-
environment
|
|
378
|
+
environment: plan.environment
|
|
295
379
|
})
|
|
296
380
|
yield* Effect.sync(() => {
|
|
297
381
|
process.exitCode = exitCode
|
|
@@ -421,21 +505,39 @@ const refineCommand = Command.make(
|
|
|
421
505
|
}
|
|
422
506
|
const repo = resolve(config.repo._tag === "Some" ? config.repo.value : process.cwd())
|
|
423
507
|
const flowPath = yield* resolveFlow("modernize-refine", shellTierPaths())
|
|
424
|
-
const
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
508
|
+
const flow = flowNameOf(flowPath)
|
|
509
|
+
const plan = yield* prepareLaunch({
|
|
510
|
+
repo,
|
|
511
|
+
flow,
|
|
512
|
+
base: process.env,
|
|
513
|
+
flags: [
|
|
514
|
+
...(config.pack._tag === "Some"
|
|
515
|
+
? [{ name: "LLM4TS_PACK", value: config.pack.value, flag: "--pack" }]
|
|
516
|
+
: []),
|
|
517
|
+
...(config.target._tag === "Some"
|
|
518
|
+
? [
|
|
519
|
+
{
|
|
520
|
+
name: "LLM4TS_TARGET_REPO",
|
|
521
|
+
value: resolve(config.target.value),
|
|
522
|
+
flag: "--target"
|
|
523
|
+
}
|
|
524
|
+
]
|
|
525
|
+
: [])
|
|
526
|
+
],
|
|
527
|
+
...launchDeps
|
|
528
|
+
})
|
|
529
|
+
yield* Effect.forEach(plan.notices, (notice) => Console.error(notice), { discard: true })
|
|
431
530
|
yield* refineSession({
|
|
432
531
|
modDir: join(repo, ModDir),
|
|
433
|
-
environment,
|
|
532
|
+
environment: plan.environment,
|
|
434
533
|
launch: (extra) =>
|
|
435
534
|
launchFlow({
|
|
436
535
|
flowPath,
|
|
437
536
|
taskArgs: ["--repo", repo],
|
|
438
|
-
environment:
|
|
537
|
+
environment: flowEnvironment(plan.resolution, process.env, {
|
|
538
|
+
...extra,
|
|
539
|
+
LLM4TS_FLOW: flow
|
|
540
|
+
})
|
|
439
541
|
}).pipe(Effect.catch((error) => Console.error(error.message).pipe(Effect.as(1))))
|
|
440
542
|
})
|
|
441
543
|
})
|
|
@@ -598,7 +700,7 @@ const watchCommand = Command.make(
|
|
|
598
700
|
Effect.gen(function* () {
|
|
599
701
|
const options = yield* watchOptionsFrom(config)
|
|
600
702
|
yield* makeWatchProgram(
|
|
601
|
-
{ ...options, idleAfterMs: idleAfterFrom(
|
|
703
|
+
{ ...options, idleAfterMs: idleAfterFrom(yield* verbEnvironment(options.repo)) },
|
|
602
704
|
nodeWatchDependencies()
|
|
603
705
|
)
|
|
604
706
|
})
|
|
@@ -676,11 +778,12 @@ const profileCommand = Command.make(
|
|
|
676
778
|
)
|
|
677
779
|
)
|
|
678
780
|
|
|
679
|
-
const rosterSource = (repo: Option.Option<string>) =>
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
781
|
+
const rosterSource = (repo: Option.Option<string>) =>
|
|
782
|
+
Effect.map(verbEnvironment(repoOr(repo)), (environment) => ({
|
|
783
|
+
files: nodePlainFileStore,
|
|
784
|
+
environment,
|
|
785
|
+
workDir: repoOr(repo)
|
|
786
|
+
}))
|
|
684
787
|
|
|
685
788
|
const rosterRepo = Flag.String("repo").pipe(
|
|
686
789
|
Flag.optional,
|
|
@@ -700,7 +803,7 @@ const rosterPauseCommand = Command.make(
|
|
|
700
803
|
(config) =>
|
|
701
804
|
Effect.gen(function* () {
|
|
702
805
|
const exclusion = yield* pauseExecutor(
|
|
703
|
-
rosterSource(config.repo),
|
|
806
|
+
yield* rosterSource(config.repo),
|
|
704
807
|
config.id,
|
|
705
808
|
Option.getOrUndefined(config.for)
|
|
706
809
|
)
|
|
@@ -716,14 +819,14 @@ const rosterResumeCommand = Command.make(
|
|
|
716
819
|
},
|
|
717
820
|
(config) =>
|
|
718
821
|
Effect.gen(function* () {
|
|
719
|
-
yield* resumeExecutor(rosterSource(config.repo), config.id)
|
|
822
|
+
yield* resumeExecutor(yield* rosterSource(config.repo), config.id)
|
|
720
823
|
yield* Console.log(`${config.id} back in the round`)
|
|
721
824
|
})
|
|
722
825
|
).pipe(Command.withDescription("Put an executor back in the pick-up round"))
|
|
723
826
|
|
|
724
827
|
const rosterCommand = Command.make("roster", { repo: rosterRepo }, (config) =>
|
|
725
828
|
Effect.gen(function* () {
|
|
726
|
-
const report = yield* rosterReport(rosterSource(config.repo))
|
|
829
|
+
const report = yield* rosterReport(yield* rosterSource(config.repo))
|
|
727
830
|
yield* Console.log(renderRosterReport(report))
|
|
728
831
|
})
|
|
729
832
|
).pipe(
|
|
@@ -862,7 +965,10 @@ const runGraph = (sub: GraphSubcommand, flags: GraphFlags) =>
|
|
|
862
965
|
Effect.gen(function* () {
|
|
863
966
|
const command = yield* graphCommandFrom(sub, flags)
|
|
864
967
|
yield* Console.log(
|
|
865
|
-
yield* makeGraphProgram(
|
|
968
|
+
yield* makeGraphProgram(
|
|
969
|
+
command,
|
|
970
|
+
nodeGraphDependencies(yield* verbEnvironment(command.repo), shellTierPaths())
|
|
971
|
+
)
|
|
866
972
|
)
|
|
867
973
|
})
|
|
868
974
|
|
|
@@ -934,7 +1040,8 @@ export const geminiBridgeOptionsFrom = (
|
|
|
934
1040
|
message: `--mode is "${mode}"; use model (OpenAI chat completions) or acp (Anthropic Messages)`
|
|
935
1041
|
})
|
|
936
1042
|
}
|
|
937
|
-
const token =
|
|
1043
|
+
const token =
|
|
1044
|
+
Option.getOrUndefined(flags.token) ?? settingValue("LLM4TS_GEMINI_BRIDGE_TOKEN", environment)
|
|
938
1045
|
return {
|
|
939
1046
|
port,
|
|
940
1047
|
mode,
|
|
@@ -969,7 +1076,7 @@ const geminiBridgeCommand = Command.make(
|
|
|
969
1076
|
},
|
|
970
1077
|
(flags) =>
|
|
971
1078
|
Effect.gen(function* () {
|
|
972
|
-
const options = yield* geminiBridgeOptionsFrom(flags)
|
|
1079
|
+
const options = yield* geminiBridgeOptionsFrom(flags, yield* verbEnvironment(process.cwd()))
|
|
973
1080
|
yield* makeGeminiBridgeProgram(options, {
|
|
974
1081
|
executor: nodeProcessExecutor,
|
|
975
1082
|
temporaryFiles: nodeTemporaryFiles,
|
|
@@ -1042,11 +1149,33 @@ const mcpCommand = Command.make(
|
|
|
1042
1149
|
)
|
|
1043
1150
|
)
|
|
1044
1151
|
|
|
1045
|
-
const doctorCommand = Command.make(
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1152
|
+
const doctorCommand = Command.make(
|
|
1153
|
+
"doctor",
|
|
1154
|
+
{
|
|
1155
|
+
repo: Flag.String("repo").pipe(
|
|
1156
|
+
Flag.optional,
|
|
1157
|
+
Flag.withDescription(
|
|
1158
|
+
"Repository whose .llm4ts/config.env applies (defaults to the current directory)"
|
|
1159
|
+
)
|
|
1160
|
+
)
|
|
1161
|
+
},
|
|
1162
|
+
(config) =>
|
|
1163
|
+
Effect.gen(function* () {
|
|
1164
|
+
const view = yield* configView(
|
|
1165
|
+
{
|
|
1166
|
+
...launchDeps,
|
|
1167
|
+
executor: nodeProcessExecutor,
|
|
1168
|
+
environment: process.env,
|
|
1169
|
+
cwd: process.cwd()
|
|
1170
|
+
},
|
|
1171
|
+
repoOr(config.repo)
|
|
1172
|
+
)
|
|
1173
|
+
const report = yield* makeDoctorProgram(
|
|
1174
|
+
undefined,
|
|
1175
|
+
resolvedEnvironment(view.loaded.resolution, process.env)
|
|
1176
|
+
)
|
|
1177
|
+
yield* Console.log(`${report.trimEnd()}\n\n${renderDoctorConfig(view)}`)
|
|
1178
|
+
})
|
|
1050
1179
|
).pipe(Command.withDescription("Report available connectors and credentials"))
|
|
1051
1180
|
|
|
1052
1181
|
export const shellCommand = Command.make("llm4ts", {}, () =>
|
|
@@ -1077,6 +1206,7 @@ export const shellCommand = Command.make("llm4ts", {}, () =>
|
|
|
1077
1206
|
geminiBridgeCommand,
|
|
1078
1207
|
mcpCommand,
|
|
1079
1208
|
toolCommand,
|
|
1209
|
+
configCommand,
|
|
1080
1210
|
doctorCommand
|
|
1081
1211
|
])
|
|
1082
1212
|
)
|
package/src/CoderChoice.ts
CHANGED
|
@@ -1,27 +1,21 @@
|
|
|
1
1
|
import { accessSync, constants } from "node:fs"
|
|
2
2
|
import { delimiter, join } from "node:path"
|
|
3
|
+
import { connectorTable, offeredCoders } from "@llm4ts/core/Models"
|
|
4
|
+
import { settingValue } from "@llm4ts/flow/Settings"
|
|
3
5
|
|
|
4
6
|
/**
|
|
5
|
-
* The
|
|
6
|
-
* the executable
|
|
7
|
-
* the connector identity vocabulary of `@llm4ts/core/Models` narrowed to the
|
|
8
|
-
* CLI coding agents the runner exposes.
|
|
7
|
+
* The coding agents a menu offers: the name written as `LLM4TS_CODER`, and
|
|
8
|
+
* the executable its connector spawns. Both come from core's connector table.
|
|
9
9
|
*/
|
|
10
10
|
export interface CoderChoice {
|
|
11
11
|
readonly token: string
|
|
12
12
|
readonly executable: string
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
-
export const coderChoices: ReadonlyArray<CoderChoice> =
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
{ token: "pi", executable: "pi" },
|
|
20
|
-
{ token: "agy", executable: "agy" },
|
|
21
|
-
{ token: "grok", executable: "grok" },
|
|
22
|
-
{ token: "cursor", executable: "cursor-agent" },
|
|
23
|
-
{ token: "opencode", executable: "opencode" }
|
|
24
|
-
]
|
|
15
|
+
export const coderChoices: ReadonlyArray<CoderChoice> = offeredCoders.map((name) => ({
|
|
16
|
+
token: connectorTable[name].names[0],
|
|
17
|
+
executable: connectorTable[name].executable
|
|
18
|
+
}))
|
|
25
19
|
|
|
26
20
|
/**
|
|
27
21
|
* Locates an executable on `PATH` without spawning a process. Decoration
|
|
@@ -53,6 +47,6 @@ export const findOnPath = (
|
|
|
53
47
|
export const resolvedCoderToken = (
|
|
54
48
|
environment: Readonly<Record<string, string | undefined>> = process.env
|
|
55
49
|
): string => {
|
|
56
|
-
const token =
|
|
57
|
-
return coderChoices.
|
|
50
|
+
const token = settingValue("LLM4TS_CODER", environment)
|
|
51
|
+
return coderChoices.find((choice) => choice.token === token)?.token ?? "claude"
|
|
58
52
|
}
|