gaunt-sloth 2.0.0-alpha.1 → 2.0.0-alpha.10

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 (83) hide show
  1. package/LICENSE +7 -0
  2. package/README.md +49 -0
  3. package/cli.js +43 -10
  4. package/dist/cli.js +9 -1
  5. package/dist/cli.js.map +1 -1
  6. package/dist/commands/askCommand.js +4 -1
  7. package/dist/commands/askCommand.js.map +1 -1
  8. package/dist/commands/commandIntrospection.d.ts +6 -6
  9. package/dist/commands/commandIntrospection.js +12 -12
  10. package/dist/commands/commandIntrospection.js.map +1 -1
  11. package/dist/commands/commandUtils.d.ts +8 -8
  12. package/dist/commands/commandUtils.js +20 -20
  13. package/dist/commands/commandUtils.js.map +1 -1
  14. package/dist/commands/configCommand.d.ts +24 -0
  15. package/dist/commands/configCommand.js +108 -0
  16. package/dist/commands/configCommand.js.map +1 -0
  17. package/dist/commands/configSetup.d.ts +1 -1
  18. package/dist/commands/configSetup.js +17 -2
  19. package/dist/commands/configSetup.js.map +1 -1
  20. package/dist/commands/execCommand.js +4 -1
  21. package/dist/commands/execCommand.js.map +1 -1
  22. package/dist/commands/firstRunDialog.d.ts +17 -3
  23. package/dist/commands/firstRunDialog.js +28 -7
  24. package/dist/commands/firstRunDialog.js.map +1 -1
  25. package/dist/commands/getCommand.js +7 -7
  26. package/dist/commands/getCommand.js.map +1 -1
  27. package/dist/commands/historyCommand.d.ts +13 -0
  28. package/dist/commands/historyCommand.js +72 -0
  29. package/dist/commands/historyCommand.js.map +1 -0
  30. package/dist/commands/initCommand.d.ts +3 -0
  31. package/dist/commands/initCommand.js +9 -4
  32. package/dist/commands/initCommand.js.map +1 -1
  33. package/dist/commands/insightsCommand.d.ts +8 -0
  34. package/dist/commands/insightsCommand.js +32 -0
  35. package/dist/commands/insightsCommand.js.map +1 -0
  36. package/dist/commands/prCommand.js +14 -15
  37. package/dist/commands/prCommand.js.map +1 -1
  38. package/dist/commands/prDiscovery.js +27 -29
  39. package/dist/commands/prDiscovery.js.map +1 -1
  40. package/dist/commands/reviewCommand.js +10 -10
  41. package/dist/commands/reviewCommand.js.map +1 -1
  42. package/dist/modules/startSession.js +9 -7
  43. package/dist/modules/startSession.js.map +1 -1
  44. package/dist/tools/gthJiraLogWorkTool.js +3 -3
  45. package/dist/tools/gthJiraLogWorkTool.js.map +1 -1
  46. package/dist/tui/components/App.js +200 -22
  47. package/dist/tui/components/App.js.map +1 -1
  48. package/dist/tui/components/ApprovalPrompt.d.ts +18 -0
  49. package/dist/tui/components/ApprovalPrompt.js +26 -0
  50. package/dist/tui/components/ApprovalPrompt.js.map +1 -0
  51. package/dist/tui/components/DebugPanel.d.ts +28 -7
  52. package/dist/tui/components/DebugPanel.js +41 -22
  53. package/dist/tui/components/DebugPanel.js.map +1 -1
  54. package/dist/tui/components/LiveTurn.d.ts +4 -4
  55. package/dist/tui/components/LiveTurn.js +60 -8
  56. package/dist/tui/components/LiveTurn.js.map +1 -1
  57. package/dist/tui/components/PromptInput.d.ts +16 -1
  58. package/dist/tui/components/PromptInput.js +67 -7
  59. package/dist/tui/components/PromptInput.js.map +1 -1
  60. package/dist/tui/components/SelectList.d.ts +28 -3
  61. package/dist/tui/components/SelectList.js +78 -7
  62. package/dist/tui/components/SelectList.js.map +1 -1
  63. package/dist/tui/components/SlashCommandMenu.d.ts +20 -0
  64. package/dist/tui/components/SlashCommandMenu.js +28 -0
  65. package/dist/tui/components/SlashCommandMenu.js.map +1 -0
  66. package/dist/tui/components/StatusBar.d.ts +7 -1
  67. package/dist/tui/components/StatusBar.js +7 -3
  68. package/dist/tui/components/StatusBar.js.map +1 -1
  69. package/dist/tui/debugRender.d.ts +14 -6
  70. package/dist/tui/debugRender.js +48 -12
  71. package/dist/tui/debugRender.js.map +1 -1
  72. package/dist/tui/markdown.js +0 -0
  73. package/dist/tui/markdown.js.map +1 -1
  74. package/dist/tui/slashCommands.d.ts +117 -1
  75. package/dist/tui/slashCommands.js +224 -1
  76. package/dist/tui/slashCommands.js.map +1 -1
  77. package/dist/tui/tuiSessionModule.js +160 -12
  78. package/dist/tui/tuiSessionModule.js.map +1 -1
  79. package/dist/tui/types.d.ts +54 -7
  80. package/dist/tui/viewModel.d.ts +20 -0
  81. package/dist/tui/viewModel.js +41 -0
  82. package/dist/tui/viewModel.js.map +1 -1
  83. package/package.json +21 -20
package/LICENSE ADDED
@@ -0,0 +1,7 @@
1
+ Copyright 2025-present Andrew Kondratev
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
4
+
5
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
6
+
7
+ THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
package/README.md CHANGED
@@ -41,6 +41,55 @@ npm install -g gaunt-sloth
41
41
 
42
42
  For full usage documentation see the [root README](../../README.md) and [docs/COMMANDS.md](../../docs/COMMANDS.md).
43
43
 
44
+ ## ACP server (editor integration)
45
+
46
+ Gaunt Sloth can run as an [Agent Client Protocol](https://agentclientprotocol.com/) (ACP)
47
+ server, so an ACP host — Zed, JetBrains, a future Pukeko client — can spawn it as a coding
48
+ agent. It speaks ACP JSON-RPC over **stdio** (no port, no flags beyond the switch below); the
49
+ host launches it as a subprocess.
50
+
51
+ Run it through this package:
52
+
53
+ ```bash
54
+ npm install -g gaunt-sloth@alpha
55
+ gaunt-sloth --acp-agent
56
+ ```
57
+
58
+ **Install the app (`gaunt-sloth`), not `@gaunt-sloth/agent`.** The agent package also ships a
59
+ standalone `gaunt-sloth-acp` binary, but the LLM providers (`@langchain/anthropic`, `openai`,
60
+ `google`, …) are `peerDependencies` of `@gaunt-sloth/core` that **only this app package
61
+ declares as real dependencies**. A bare `@gaunt-sloth/agent` install leaves those peers unmet,
62
+ so its ACP server has no provider to build a model from. `gaunt-sloth --acp-agent` runs the
63
+ exact same ACP server but resolves providers out of the app's dependency tree, so every
64
+ configured provider works. (`stdout` is the protocol channel and is kept clean — gsloth's
65
+ status/config output is redirected to `stderr`.)
66
+
67
+ Provider credentials and model selection come from your usual gsloth config
68
+ (`.gsloth.config.*` / env vars such as `ANTHROPIC_API_KEY`); the ACP server reads them via the
69
+ same `initConfig` path as the CLI. Run the host from your project directory (or set its `cwd`)
70
+ so config and the per-session workspace resolve correctly.
71
+
72
+ ### Zed
73
+
74
+ Add to Zed `settings.json` (or Settings -> External Agents -> Add Agent -> Custom Agent):
75
+
76
+ ```json
77
+ {
78
+ "agent_servers": {
79
+ "Gaunt Sloth": {
80
+ "type": "custom",
81
+ "command": "gaunt-sloth",
82
+ "args": ["--acp-agent"],
83
+ "env": {}
84
+ }
85
+ }
86
+ }
87
+ ```
88
+
89
+ Point `command` at the global `gaunt-sloth` binary (after `npm install -g gaunt-sloth@alpha`),
90
+ or at an absolute path to `cli.js` for a local build. Other ACP hosts (JetBrains, etc.) take
91
+ the same `command` + `args` pair.
92
+
44
93
  ## Related packages
45
94
 
46
95
  - [`@gaunt-sloth/core`](../core) — Core utilities, config, and agent infrastructure
package/cli.js CHANGED
@@ -9,15 +9,48 @@ process.on('warning', (warning) => {
9
9
  console.warn(warning);
10
10
  });
11
11
 
12
- // This is a minimalistic entry point that sets the installDir in systemUtils
13
- // and delegates to the compiled TypeScript code in dist/cli.js
14
- import { setEntryPoint } from './dist/utils/systemUtils.js';
12
+ // --- ACP server bypass -----------------------------------------------------
13
+ // `gaunt-sloth --acp-agent` runs the Agent Client Protocol (ACP) server instead
14
+ // of the normal CLI, so an ACP host (Zed, JetBrains, a future Pukeko client) can
15
+ // spawn the fat `gaunt-sloth` package as a coding-agent subprocess.
16
+ //
17
+ // Why route ACP through the app rather than the standalone `gaunt-sloth-acp`
18
+ // binary in @gaunt-sloth/agent: the LLM providers (@langchain/anthropic, openai,
19
+ // google, …) are peerDependencies of @gaunt-sloth/core, and only this app package
20
+ // declares them as real dependencies. A bare `@gaunt-sloth/agent` install leaves
21
+ // those peers unmet, so its ACP server has no providers to construct a model from.
22
+ // Starting the same ACP server from here resolves providers out of the app's tree.
23
+ //
24
+ // ACP speaks JSON-RPC over stdio, so stdout MUST stay a clean protocol channel:
25
+ // redirect console.log/info (used by initConfig/status output) to stderr BEFORE
26
+ // touching config, exactly as the standalone `gaunt-sloth-acp` entry does.
27
+ if (process.argv.includes('--acp-agent')) {
28
+ for (const method of ['log', 'info']) {
29
+ console[method] = (...args) => process.stderr.write(args.join(' ') + '\n');
30
+ }
31
+ const [{ initConfig }, { displayError }, { startAcpServer }] = await Promise.all([
32
+ import('@gaunt-sloth/core/config.js'),
33
+ import('@gaunt-sloth/core/utils/consoleUtils.js'),
34
+ import('@gaunt-sloth/agent'),
35
+ ]);
36
+ try {
37
+ const config = await initConfig({});
38
+ await startAcpServer(config);
39
+ } catch (err) {
40
+ displayError(`ACP server failed: ${err instanceof Error ? err.message : String(err)}`);
41
+ process.exit(1);
42
+ }
43
+ } else {
44
+ // This is a minimalistic entry point that sets the installDir in systemUtils
45
+ // and delegates to the compiled TypeScript code in dist/cli.js
46
+ const { setEntryPoint } = await import('./dist/utils/systemUtils.js');
15
47
 
16
- // Set the installation directory in systemUtils
17
- setEntryPoint(import.meta.url);
48
+ // Set the installation directory in systemUtils
49
+ setEntryPoint(import.meta.url);
18
50
 
19
- // Import and run the compiled TypeScript code
20
- import('./dist/cli.js').catch((err) => {
21
- console.error('Failed to load application:', err);
22
- process.exit(1);
23
- });
51
+ // Import and run the compiled TypeScript code
52
+ import('./dist/cli.js').catch((err) => {
53
+ console.error('Failed to load application:', err);
54
+ process.exit(1);
55
+ });
56
+ }
package/dist/cli.js CHANGED
@@ -8,12 +8,15 @@ import { chatCommand } from '#src/commands/chatCommand.js';
8
8
  import { codeCommand } from '#src/commands/codeCommand.js';
9
9
  import { apiCommand } from '#src/commands/apiCommand.js';
10
10
  import { getCommand } from '#src/commands/getCommand.js';
11
+ import { configCommand } from '#src/commands/configCommand.js';
12
+ import { historyCommand } from '#src/commands/historyCommand.js';
13
+ import { insightsCommand } from '#src/commands/insightsCommand.js';
11
14
  import { argv, getSlothVersion, readStdin } from '@gaunt-sloth/core/utils/systemUtils.js';
12
15
  import { coerceBooleanOrString } from '@gaunt-sloth/core/utils/consoleUtils.js';
13
16
  const program = new Command();
14
17
  program
15
18
  .name('gsloth')
16
- .description('Gaunt Sloth Assistant reviewing your PRs')
19
+ .description('Gaunt Sloth reviewing your PRs')
17
20
  .version(getSlothVersion())
18
21
  .option('--verbose', 'Set LangChain/LangGraph to verbose mode, ' +
19
22
  'causing LangChain/LangGraph to log many details to the console. ' +
@@ -66,5 +69,10 @@ chatCommand(program, cliConfigOverrides);
66
69
  codeCommand(program, cliConfigOverrides);
67
70
  apiCommand(program, cliConfigOverrides);
68
71
  getCommand(program, cliConfigOverrides);
72
+ configCommand(program, cliConfigOverrides);
73
+ // GS2-7 (B20) — read-only, local history/insights surfaces. They resolve their own DB path (global
74
+ // default or --db) and do not build the LLM, so they stay decoupled from config/provider setup.
75
+ historyCommand(program);
76
+ insightsCommand(program);
69
77
  await readStdin(program);
70
78
  //# sourceMappingURL=cli.js.map
package/dist/cli.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE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,mBAAmB,CAAC,CAAC;AAEhE,qEAAqE;AACrE,oEAAoE;AACpE,6EAA6E;AAC7E,MAAM,OAAO,GAAG,qBAAqB,CAAC,WAAW,CAAC,CAAC;AACnD,IAAI,OAAO,KAAK,SAAS,EAAE,CAAC;IAC1B,kBAAkB,CAAC,iBAAiB,GAAG,OAAO,CAAC;AACjD,CAAC;AAED,sEAAsE;AACtE,WAAW,CAAC,OAAO,CAAC,CAAC;AACrB,aAAa,CAAC,OAAO,EAAE,kBAAkB,CAAC,CAAC;AAC3C,SAAS,CAAC,OAAO,EAAE,kBAAkB,CAAC,CAAC;AACvC,UAAU,CAAC,OAAO,EAAE,kBAAkB,CAAC,CAAC;AACxC,WAAW,CAAC,OAAO,EAAE,kBAAkB,CAAC,CAAC;AACzC,WAAW,CAAC,OAAO,EAAE,kBAAkB,CAAC,CAAC;AACzC,WAAW,CAAC,OAAO,EAAE,kBAAkB,CAAC,CAAC;AACzC,UAAU,CAAC,OAAO,EAAE,kBAAkB,CAAC,CAAC;AACxC,UAAU,CAAC,OAAO,EAAE,kBAAkB,CAAC,CAAC;AACxC,aAAa,CAAC,OAAO,EAAE,kBAAkB,CAAC,CAAC;AAC3C,mGAAmG;AACnG,gGAAgG;AAChG,cAAc,CAAC,OAAO,CAAC,CAAC;AACxB,eAAe,CAAC,OAAO,CAAC,CAAC;AAEzB,MAAM,SAAS,CAAC,OAAO,CAAC,CAAC"}
@@ -67,7 +67,10 @@ export function askCommand(program, commandLineConfigOverrides) {
67
67
  }
68
68
  const { runSingleShot } = await import('@gaunt-sloth/core/runtime/singleShot.js');
69
69
  const { createResolvers } = await import('@gaunt-sloth/agent/resolvers.js');
70
- await runSingleShot('ASK', getAskSystemPrompt(config), content.join('\n'), config, createResolvers());
70
+ const { resolveAgentFactory } = await import('@gaunt-sloth/agent/core/resolveAgentFactory.js');
71
+ await runSingleShot('ASK', getAskSystemPrompt(config), content.join('\n'), config, createResolvers(), 'ask',
72
+ // ask defaults to the lean backend; an explicit config.agent.backend overrides it.
73
+ resolveAgentFactory(config, 'lean'));
71
74
  });
72
75
  }
73
76
  //# sourceMappingURL=askCommand.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"askCommand.js","sourceRoot":"","sources":["../../src/commands/askCommand.ts"],"names":[],"mappings":"AACA,OAAO,EAA8B,UAAU,EAAE,MAAM,6BAA6B,CAAC;AAErF,OAAO,EAAE,kBAAkB,EAAE,MAAM,uCAAuC,CAAC;AAC3E,OAAO,EAAE,kBAAkB,EAAE,MAAM,wCAAwC,CAAC;AAC5E,OAAO,EAAE,cAAc,EAAE,MAAM,yCAAyC,CAAC;AACzE,OAAO,EAAE,WAAW,EAAE,MAAM,qCAAqC,CAAC;AAElE,OAAO,EAAE,+BAA+B,EAAE,MAAM,sCAAsC,CAAC;AAYvF;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,iBAAiB,CAAC,MAAiB,EAAE,OAA0B;IAC7E,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC;QACnB,OAAO,MAAM,CAAC;IAChB,CAAC;IACD,cAAc,CACZ,iGAAiG,CAClG,CAAC;IACF,MAAM,WAAW,GAAG,MAAM,CAAC,QAAQ,EAAE,IAAI,EAAE,QAAQ,IAAI,MAAM,CAAC,QAAQ,EAAE,IAAI,EAAE,QAAQ,CAAC;IACvF,OAAO;QACL,GAAG,MAAM;QACT,YAAY,EAAE,IAAI;QAClB,QAAQ,EAAE;YACR,GAAG,MAAM,CAAC,QAAQ;YAClB,GAAG,EAAE;gBACH,GAAG,MAAM,CAAC,QAAQ,EAAE,GAAG;gBACvB,UAAU,EAAE,KAAK;gBACjB,GAAG,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,WAAW,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;aAClD;SACF;KACF,CAAC;AACJ,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,UAAU,CACxB,OAAgB,EAChB,0BAAsD;IAEtD,OAAO;SACJ,OAAO,CAA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B,MAAM,EACN,eAAe,EAAE,EACjB,KAAK;QACL,mFAAmF;QACnF,mBAAmB,CAAC,MAAM,EAAE,MAAM,CAAC,CACpC,CAAC;IACJ,CAAC,CAAC,CAAC;AACP,CAAC"}
@@ -1,12 +1,12 @@
1
1
  import type { GthConfig } from '@gaunt-sloth/core/config.js';
2
- import { type ContentProviderType, type RequirementsProviderType } from '#src/commands/commandUtils.js';
2
+ import { type ContentSourceType, type RequirementSourceType } from '#src/commands/commandUtils.js';
3
3
  export type PromptCommandType = 'ask' | 'review' | 'pr' | 'pr-discovery' | 'chat' | 'code' | 'exec';
4
- export type ProviderCommandType = 'review' | 'pr';
5
- export type ProviderInputType = 'content' | 'requirements';
4
+ export type SourceCommandType = 'review' | 'pr';
5
+ export type SourceInputType = 'content' | 'requirements';
6
6
  export declare function getAskSystemPrompt(config: GthConfig): string;
7
7
  export declare function getExecSystemPrompt(config: GthConfig): string;
8
8
  export declare function getReviewSystemPrompt(config: GthConfig): string;
9
9
  export declare function getCommandSystemPrompt(command: PromptCommandType, config: GthConfig): string;
10
- export declare function getEffectiveRequirementsProvider(command: ProviderCommandType, config: GthConfig, cliProvider?: RequirementsProviderType): RequirementsProviderType | undefined;
11
- export declare function getEffectiveContentProvider(command: ProviderCommandType, config: GthConfig, cliProvider?: ContentProviderType): ContentProviderType | undefined;
12
- export declare function getCommandProviderInput(command: ProviderCommandType, inputType: ProviderInputType, id: string | undefined, config: GthConfig, cliProvider?: RequirementsProviderType | ContentProviderType): Promise<string>;
10
+ export declare function getEffectiveRequirementSource(command: SourceCommandType, config: GthConfig, cliSource?: RequirementSourceType): RequirementSourceType | undefined;
11
+ export declare function getEffectiveContentSource(command: SourceCommandType, config: GthConfig, cliSource?: ContentSourceType): ContentSourceType | undefined;
12
+ export declare function getCommandSourceInput(command: SourceCommandType, inputType: SourceInputType, id: string | undefined, config: GthConfig, cliSource?: RequirementSourceType | ContentSourceType): Promise<string>;
@@ -1,4 +1,4 @@
1
- import { getContentFromProvider, getRequirementsFromProvider, } from '#src/commands/commandUtils.js';
1
+ import { getContentFromSource, getRequirementsFromSource, } from '#src/commands/commandUtils.js';
2
2
  import { buildSystemMessages, readBackstory, readChatPrompt, readCodePrompt, readExecPrompt, readGuidelines, readReviewInstructions, readSystemPrompt, } from '@gaunt-sloth/core/utils/llmUtils.js';
3
3
  import { readPrDiscoveryPrompt } from '#src/commands/prDiscovery.js';
4
4
  export function getAskSystemPrompt(config) {
@@ -50,21 +50,21 @@ function flattenSystemMessageContent(config, modePrompt) {
50
50
  }
51
51
  return '';
52
52
  }
53
- export function getEffectiveRequirementsProvider(command, config, cliProvider) {
54
- return (cliProvider ??
55
- config?.commands?.[command]?.requirementsProvider ??
56
- config?.requirementsProvider);
53
+ export function getEffectiveRequirementSource(command, config, cliSource) {
54
+ return (cliSource ??
55
+ config?.commands?.[command]?.requirementSource ??
56
+ config?.requirementSource);
57
57
  }
58
- export function getEffectiveContentProvider(command, config, cliProvider) {
59
- return (cliProvider ??
60
- config?.commands?.[command]?.contentProvider ??
61
- config?.contentProvider ??
58
+ export function getEffectiveContentSource(command, config, cliSource) {
59
+ return (cliSource ??
60
+ config?.commands?.[command]?.contentSource ??
61
+ config?.contentSource ??
62
62
  (command === 'pr' ? 'github' : undefined));
63
63
  }
64
- export async function getCommandProviderInput(command, inputType, id, config, cliProvider) {
64
+ export async function getCommandSourceInput(command, inputType, id, config, cliSource) {
65
65
  if (inputType === 'requirements') {
66
- return getRequirementsFromProvider(getEffectiveRequirementsProvider(command, config, cliProvider), id, config);
66
+ return getRequirementsFromSource(getEffectiveRequirementSource(command, config, cliSource), id, config);
67
67
  }
68
- return getContentFromProvider(getEffectiveContentProvider(command, config, cliProvider), id, config);
68
+ return getContentFromSource(getEffectiveContentSource(command, config, cliSource), id, config);
69
69
  }
70
70
  //# sourceMappingURL=commandIntrospection.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"commandIntrospection.js","sourceRoot":"","sources":["../../src/commands/commandIntrospection.ts"],"names":[],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,EACjB,WAAsC;IAEtC,OAAO,CACL,WAAW;QACV,MAAM,EAAE,QAAQ,EAAE,CAAC,OAAO,CAAC,EAAE,oBAA6D;QAC1F,MAAM,EAAE,oBAA6D,CACvE,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,2BAA2B,CACzC,OAA4B,EAC5B,MAAiB,EACjB,WAAiC;IAEjC,OAAO,CACL,WAAW;QACV,MAAM,EAAE,QAAQ,EAAE,CAAC,OAAO,CAAC,EAAE,eAAmD;QAChF,MAAM,EAAE,eAAmD;QAC5D,CAAC,OAAO,KAAK,IAAI,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,SAAS,CAAC,CAC1C,CAAC;AACJ,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,uBAAuB,CAC3C,OAA4B,EAC5B,SAA4B,EAC5B,EAAsB,EACtB,MAAiB,EACjB,WAA4D;IAE5D,IAAI,SAAS,KAAK,cAAc,EAAE,CAAC;QACjC,OAAO,2BAA2B,CAChC,gCAAgC,CAAC,OAAO,EAAE,MAAM,EAAE,WAAuC,CAAC,EAC1F,EAAE,EACF,MAAM,CACP,CAAC;IACJ,CAAC;IAED,OAAO,sBAAsB,CAC3B,2BAA2B,CAAC,OAAO,EAAE,MAAM,EAAE,WAAkC,CAAC,EAChF,EAAE,EACF,MAAM,CACP,CAAC;AACJ,CAAC"}
1
+ {"version":3,"file":"commandIntrospection.js","sourceRoot":"","sources":["../../src/commands/commandIntrospection.ts"],"names":[],"mappings":"AACA,OAAO,EACL,oBAAoB,EACpB,yBAAyB,GAG1B,MAAM,+BAA+B,CAAC;AACvC,OAAO,EACL,mBAAmB,EACnB,aAAa,EACb,cAAc,EACd,cAAc,EACd,cAAc,EACd,cAAc,EACd,sBAAsB,EACtB,gBAAgB,GACjB,MAAM,qCAAqC,CAAC;AAC7C,OAAO,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AAMrE,MAAM,UAAU,kBAAkB,CAAC,MAAiB;IAClD,MAAM,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,EAAE,aAA+C;QACxD,CAAC,OAAO,KAAK,IAAI,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,SAAS,CAAC,CAC1C,CAAC;AACJ,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,qBAAqB,CACzC,OAA0B,EAC1B,SAA0B,EAC1B,EAAsB,EACtB,MAAiB,EACjB,SAAqD;IAErD,IAAI,SAAS,KAAK,cAAc,EAAE,CAAC;QACjC,OAAO,yBAAyB,CAC9B,6BAA6B,CAAC,OAAO,EAAE,MAAM,EAAE,SAAkC,CAAC,EAClF,EAAE,EACF,MAAM,CACP,CAAC;IACJ,CAAC;IAED,OAAO,oBAAoB,CACzB,yBAAyB,CAAC,OAAO,EAAE,MAAM,EAAE,SAA8B,CAAC,EAC1E,EAAE,EACF,MAAM,CACP,CAAC;AACJ,CAAC"}
@@ -1,23 +1,23 @@
1
1
  import type { GthConfig } from '@gaunt-sloth/core/config.js';
2
2
  /**
3
- * Requirements providers. Aliases are mapped to actual package paths.
3
+ * Requirement sources. Aliases are mapped to actual package paths.
4
4
  */
5
- export declare const REQUIREMENTS_PROVIDERS: {
5
+ export declare const REQUIREMENTS_SOURCES: {
6
6
  readonly 'jira-legacy': "@gaunt-sloth/review/sources/jiraIssueLegacySource.js";
7
7
  readonly jira: "@gaunt-sloth/review/sources/jiraIssueSource.js";
8
8
  readonly github: "@gaunt-sloth/review/sources/ghIssueSource.js";
9
9
  readonly text: "@gaunt-sloth/review/sources/textSource.js";
10
10
  readonly file: "@gaunt-sloth/review/sources/fileSource.js";
11
11
  };
12
- export type RequirementsProviderType = keyof typeof REQUIREMENTS_PROVIDERS;
12
+ export type RequirementSourceType = keyof typeof REQUIREMENTS_SOURCES;
13
13
  /**
14
- * Content providers. Aliases are mapped to actual package paths.
14
+ * Content sources. Aliases are mapped to actual package paths.
15
15
  */
16
- export declare const CONTENT_PROVIDERS: {
16
+ export declare const CONTENT_SOURCES: {
17
17
  readonly github: "@gaunt-sloth/review/sources/ghPrDiffSource.js";
18
18
  readonly text: "@gaunt-sloth/review/sources/textSource.js";
19
19
  readonly file: "@gaunt-sloth/review/sources/fileSource.js";
20
20
  };
21
- export type ContentProviderType = keyof typeof CONTENT_PROVIDERS;
22
- export declare function getRequirementsFromProvider(requirementsProvider: RequirementsProviderType | undefined, requirementsId: string | undefined, config: GthConfig): Promise<string>;
23
- export declare function getContentFromProvider(contentProvider: ContentProviderType | undefined, contentId: string | undefined, config: GthConfig): Promise<string>;
21
+ export type ContentSourceType = keyof typeof CONTENT_SOURCES;
22
+ export declare function getRequirementsFromSource(requirementSource: RequirementSourceType | undefined, requirementsId: string | undefined, config: GthConfig): Promise<string>;
23
+ export declare function getContentFromSource(contentSource: ContentSourceType | undefined, contentId: string | undefined, config: GthConfig): Promise<string>;
@@ -1,9 +1,9 @@
1
1
  import { displayError } from '@gaunt-sloth/core/utils/consoleUtils.js';
2
2
  import { wrapContent } from '@gaunt-sloth/core/utils/llmUtils.js';
3
3
  /**
4
- * Requirements providers. Aliases are mapped to actual package paths.
4
+ * Requirement sources. Aliases are mapped to actual package paths.
5
5
  */
6
- export const REQUIREMENTS_PROVIDERS = {
6
+ export const REQUIREMENTS_SOURCES = {
7
7
  'jira-legacy': '@gaunt-sloth/review/sources/jiraIssueLegacySource.js',
8
8
  jira: '@gaunt-sloth/review/sources/jiraIssueSource.js',
9
9
  github: '@gaunt-sloth/review/sources/ghIssueSource.js',
@@ -11,38 +11,38 @@ export const REQUIREMENTS_PROVIDERS = {
11
11
  file: '@gaunt-sloth/review/sources/fileSource.js',
12
12
  };
13
13
  /**
14
- * Content providers. Aliases are mapped to actual package paths.
14
+ * Content sources. Aliases are mapped to actual package paths.
15
15
  */
16
- export const CONTENT_PROVIDERS = {
16
+ export const CONTENT_SOURCES = {
17
17
  github: '@gaunt-sloth/review/sources/ghPrDiffSource.js',
18
18
  text: '@gaunt-sloth/review/sources/textSource.js',
19
19
  file: '@gaunt-sloth/review/sources/fileSource.js',
20
20
  };
21
- export async function getRequirementsFromProvider(requirementsProvider, requirementsId, config) {
22
- const requirements = await getFromProvider(requirementsProvider, requirementsId, (config?.requirementsProviderConfig ?? {})[requirementsProvider], REQUIREMENTS_PROVIDERS);
23
- return wrapContent(requirements, requirementsProvider, 'requirements');
21
+ export async function getRequirementsFromSource(requirementSource, requirementsId, config) {
22
+ const requirements = await getFromSource(requirementSource, requirementsId, (config?.requirementSourceConfig ?? {})[requirementSource], REQUIREMENTS_SOURCES);
23
+ return wrapContent(requirements, requirementSource, 'requirements');
24
24
  }
25
- export async function getContentFromProvider(contentProvider, contentId, config) {
26
- const content = await getFromProvider(contentProvider, contentId, (config?.contentProviderConfig ?? {})[contentProvider], CONTENT_PROVIDERS);
27
- return wrapContent(content, contentProvider, contentProvider === 'github' ? 'GitHub diff' : 'content');
25
+ export async function getContentFromSource(contentSource, contentId, config) {
26
+ const content = await getFromSource(contentSource, contentId, (config?.contentSourceConfig ?? {})[contentSource], CONTENT_SOURCES);
27
+ return wrapContent(content, contentSource, contentSource === 'github' ? 'GitHub diff' : 'content');
28
28
  }
29
- async function getFromProvider(provider, id,
29
+ async function getFromSource(source, id,
30
30
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
31
- config, legitPredefinedProviders) {
32
- if (typeof provider === 'string') {
33
- // Use one of the predefined providers
34
- if (legitPredefinedProviders[provider]) {
35
- const providerPath = legitPredefinedProviders[provider];
36
- const { get } = await import(providerPath);
31
+ config, legitPredefinedSources) {
32
+ if (typeof source === 'string') {
33
+ // Use one of the predefined sources
34
+ if (legitPredefinedSources[source]) {
35
+ const sourcePath = legitPredefinedSources[source];
36
+ const { get } = await import(sourcePath);
37
37
  return await get(config, id);
38
38
  }
39
39
  else {
40
- displayError(`Unknown provider: ${provider}. Continuing without it.`);
40
+ displayError(`Unknown source: ${source}. Continuing without it.`);
41
41
  }
42
42
  }
43
- else if (typeof provider === 'function') {
43
+ else if (typeof source === 'function') {
44
44
  // Type assertion to handle function call
45
- return await provider(id);
45
+ return await source(id);
46
46
  }
47
47
  return '';
48
48
  }
@@ -1 +1 @@
1
- {"version":3,"file":"commandUtils.js","sourceRoot":"","sources":["../../src/commands/commandUtils.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,yCAAyC,CAAC;AAEvE,OAAO,EAAE,WAAW,EAAE,MAAM,qCAAqC,CAAC;AAElE;;GAEG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG;IACpC,aAAa,EAAE,sDAAsD;IACrE,IAAI,EAAE,gDAAgD;IACtD,MAAM,EAAE,8CAA8C;IACtD,IAAI,EAAE,2CAA2C;IACjD,IAAI,EAAE,2CAA2C;CACzC,CAAC;AAIX;;GAEG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG;IAC/B,MAAM,EAAE,+CAA+C;IACvD,IAAI,EAAE,2CAA2C;IACjD,IAAI,EAAE,2CAA2C;CACzC,CAAC;AAIX,MAAM,CAAC,KAAK,UAAU,2BAA2B,CAC/C,oBAA0D,EAC1D,cAAkC,EAClC,MAAiB;IAEjB,MAAM,YAAY,GAAG,MAAM,eAAe,CACxC,oBAAoB,EACpB,cAAc,EACd,CAAC,MAAM,EAAE,0BAA0B,IAAI,EAAE,CAAC,CAAC,oBAA8B,CAAC,EAC1E,sBAAsB,CACvB,CAAC;IACF,OAAO,WAAW,CAAC,YAAY,EAAE,oBAAoB,EAAE,cAAc,CAAC,CAAC;AACzE,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,sBAAsB,CAC1C,eAAgD,EAChD,SAA6B,EAC7B,MAAiB;IAEjB,MAAM,OAAO,GAAG,MAAM,eAAe,CACnC,eAAe,EACf,SAAS,EACT,CAAC,MAAM,EAAE,qBAAqB,IAAI,EAAE,CAAC,CAAC,eAAyB,CAAC,EAChE,iBAAiB,CAClB,CAAC;IACF,OAAO,WAAW,CAChB,OAAO,EACP,eAAe,EACf,eAAe,KAAK,QAAQ,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,SAAS,CACzD,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AAO,MAAsD,CAAC,EAAE,CAAC,CAAC;IAC3E,CAAC;IACD,OAAO,EAAE,CAAC;AACZ,CAAC"}
@@ -0,0 +1,24 @@
1
+ import { Command } from 'commander';
2
+ import { type CommandLineConfigOverrides, type GthConfig } from '@gaunt-sloth/core/config.js';
3
+ /**
4
+ * Produce a plain, printable, secret-free view of a fully-resolved {@link GthConfig}.
5
+ *
6
+ * The resolved config carries live, non-serializable objects (the instantiated `llm`, tool
7
+ * instances, middleware); those are replaced with short descriptors so the output is readable
8
+ * and JSON-safe. Every value under a secret-looking key is redacted. Pure — returns a fresh
9
+ * object and never mutates the input.
10
+ */
11
+ export declare function redactConfigForPrint(config: GthConfig): Record<string, unknown>;
12
+ /**
13
+ * Adds the `config` command group (GS2-1 read-side):
14
+ *
15
+ * - `gth config print [--json]` — resolve the config exactly as a run would (up-tree discovery
16
+ * + global base + defaults merge) and print it, with secrets redacted. `--json` emits only the
17
+ * JSON object (machine-readable); the default adds a source header.
18
+ * - `gth config validate` — validate the effective raw config against the schema WITHOUT building
19
+ * the LLM. Unknown keys warn; a schema violation prints a path-scoped message and exits non-zero.
20
+ *
21
+ * Both honour the global `--config` / `--identity-profile` overrides via
22
+ * `commandLineConfigOverrides`.
23
+ */
24
+ export declare function configCommand(program: Command, commandLineConfigOverrides: CommandLineConfigOverrides): void;
@@ -0,0 +1,108 @@
1
+ import { initConfig, validateConfig, } from '@gaunt-sloth/core/config.js';
2
+ import { display, displayError, displayInfo, displaySuccess, displayWarning, } from '@gaunt-sloth/core/utils/consoleUtils.js';
3
+ import { setExitCode } from '@gaunt-sloth/core/utils/systemUtils.js';
4
+ /**
5
+ * Config keys whose VALUES must never be printed. Matched case-insensitively against the key
6
+ * name at any depth, so an accidental inline secret (an API key pasted into `configuration`,
7
+ * a bearer token, …) is redacted rather than echoed by `gth config print`.
8
+ */
9
+ const SECRET_KEY_RE = /(api[-_]?key|secret|token|password|passwd|authorization|bearer|credential)/i;
10
+ const REDACTED = '***REDACTED***';
11
+ /**
12
+ * Produce a plain, printable, secret-free view of a fully-resolved {@link GthConfig}.
13
+ *
14
+ * The resolved config carries live, non-serializable objects (the instantiated `llm`, tool
15
+ * instances, middleware); those are replaced with short descriptors so the output is readable
16
+ * and JSON-safe. Every value under a secret-looking key is redacted. Pure — returns a fresh
17
+ * object and never mutates the input.
18
+ */
19
+ export function redactConfigForPrint(config) {
20
+ // `llm` (the live BaseChatModel) is intentionally stripped and re-added below as a descriptor.
21
+ const { llm: _llm, tools, middleware, ...rest } = config;
22
+ void _llm;
23
+ // Deep-clone the JSON-safe remainder through a redacting replacer. Functions are dropped by
24
+ // JSON.stringify (fine — a printed config is documentation, not an executable). A defensive
25
+ // fallback keeps `print` working even if some exotic value is not serializable.
26
+ let out;
27
+ try {
28
+ out = JSON.parse(JSON.stringify(rest, (key, value) => (SECRET_KEY_RE.test(key) ? REDACTED : value)));
29
+ }
30
+ catch {
31
+ out = {};
32
+ }
33
+ // Reinstate the stripped live fields as human descriptors (never the instances themselves).
34
+ out.llm = config.modelDisplayName ? `[chat model: ${config.modelDisplayName}]` : '[chat model]';
35
+ if (Array.isArray(tools))
36
+ out.tools = `[${tools.length} tool instance(s)]`;
37
+ if (Array.isArray(middleware))
38
+ out.middleware = `[${middleware.length} middleware]`;
39
+ return out;
40
+ }
41
+ /**
42
+ * Adds the `config` command group (GS2-1 read-side):
43
+ *
44
+ * - `gth config print [--json]` — resolve the config exactly as a run would (up-tree discovery
45
+ * + global base + defaults merge) and print it, with secrets redacted. `--json` emits only the
46
+ * JSON object (machine-readable); the default adds a source header.
47
+ * - `gth config validate` — validate the effective raw config against the schema WITHOUT building
48
+ * the LLM. Unknown keys warn; a schema violation prints a path-scoped message and exits non-zero.
49
+ *
50
+ * Both honour the global `--config` / `--identity-profile` overrides via
51
+ * `commandLineConfigOverrides`.
52
+ */
53
+ export function configCommand(program, commandLineConfigOverrides) {
54
+ const config = program
55
+ .command('config')
56
+ .description('Inspect and validate the resolved Gaunt Sloth configuration');
57
+ config
58
+ .command('print')
59
+ .description('Print the fully-resolved configuration (secrets redacted)')
60
+ .option('--json', 'Emit only the JSON object (machine-readable), no header')
61
+ .action(async (options) => {
62
+ try {
63
+ const resolved = await initConfig(commandLineConfigOverrides);
64
+ const printable = redactConfigForPrint(resolved);
65
+ const json = JSON.stringify(printable, null, 2);
66
+ if (options.json) {
67
+ display(json);
68
+ }
69
+ else {
70
+ displayInfo('Resolved Gaunt Sloth configuration (secrets redacted):');
71
+ display(json);
72
+ }
73
+ }
74
+ catch (error) {
75
+ displayError(error instanceof Error ? error.message : String(error));
76
+ setExitCode(1);
77
+ }
78
+ });
79
+ config
80
+ .command('validate')
81
+ .description('Validate the configuration against the schema; exits non-zero when invalid')
82
+ .action(async () => {
83
+ try {
84
+ const report = await validateConfig(commandLineConfigOverrides);
85
+ if (!report.found) {
86
+ displayError('No configuration file found to validate. Run `gth init` to create one, ' +
87
+ 'or pass --config <path>.');
88
+ setExitCode(1);
89
+ return;
90
+ }
91
+ for (const warning of report.warnings) {
92
+ displayWarning(warning);
93
+ }
94
+ if (report.ok) {
95
+ displaySuccess(`Configuration is valid: ${report.sourceLabel}`);
96
+ return;
97
+ }
98
+ displayError(`Invalid configuration in ${report.sourceLabel}:\n${report.errorMessage ?? ''}`);
99
+ setExitCode(1);
100
+ }
101
+ catch (error) {
102
+ // A JSONC/module parse failure lands here — surface it as an invalid-config error.
103
+ displayError(`Failed to read configuration: ${error instanceof Error ? error.message : String(error)}`);
104
+ setExitCode(1);
105
+ }
106
+ });
107
+ }
108
+ //# sourceMappingURL=configCommand.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"configCommand.js","sourceRoot":"","sources":["../../src/commands/configCommand.ts"],"names":[],"mappings":"AACA,OAAO,EAGL,UAAU,EACV,cAAc,GACf,MAAM,6BAA6B,CAAC;AACrC,OAAO,EACL,OAAO,EACP,YAAY,EACZ,WAAW,EACX,cAAc,EACd,cAAc,GACf,MAAM,yCAAyC,CAAC;AACjD,OAAO,E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AAC;gBACf,OAAO;YACT,CAAC;YAED,KAAK,MAAM,OAAO,IAAI,MAAM,CAAC,QAAQ,EAAE,CAAC;gBACtC,cAAc,CAAC,OAAO,CAAC,CAAC;YAC1B,CAAC;YAED,IAAI,MAAM,CAAC,EAAE,EAAE,CAAC;gBACd,cAAc,CAAC,2BAA2B,MAAM,CAAC,WAAW,EAAE,CAAC,CAAC;gBAChE,OAAO;YACT,CAAC;YAED,YAAY,CACV,4BAA4B,MAAM,CAAC,WAAW,MAAM,MAAM,CAAC,YAAY,IAAI,EAAE,EAAE,CAChF,CAAC;YACF,WAAW,CAAC,CAAC,CAAC,CAAC;QACjB,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,mFAAmF;YACnF,YAAY,CACV,iCAAiC,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAC1F,CAAC;YACF,WAAW,CAAC,CAAC,CAAC,CAAC;QACjB,CAAC;IACH,CAAC,CAAC,CAAC;AACP,CAAC"}
@@ -1,4 +1,4 @@
1
- export declare function createProjectConfig(configType: string): Promise<void>;
1
+ export declare function createProjectConfig(configType: string, force?: boolean): Promise<void>;
2
2
  /**
3
3
  * Ensures that the .gsloth directory exists in the project root.
4
4
  * Creates it if it does not exist.
@@ -1,11 +1,12 @@
1
1
  import { GSLOTH_DIR, PROJECT_GUIDELINES, PROJECT_REVIEW_INSTRUCTIONS, USER_PROJECT_CONFIG_JSON, } from '@gaunt-sloth/core/constants.js';
2
2
  import { availableDefaultConfigs } from '@gaunt-sloth/core/config.js';
3
+ import { resolveInitModel } from '@gaunt-sloth/core/providers/modelDiscovery.js';
3
4
  import { displayError, displayInfo, displayWarning } from '@gaunt-sloth/core/utils/consoleUtils.js';
4
5
  import { getGslothConfigWritePath, writeFileIfNotExistsWithMessages, } from '@gaunt-sloth/review/utils/fileUtils.js';
5
6
  import { exit, getCurrentWorkDir } from '@gaunt-sloth/core/utils/systemUtils.js';
6
7
  import { existsSync, mkdirSync } from 'node:fs';
7
8
  import { resolve } from 'node:path';
8
- export async function createProjectConfig(configType) {
9
+ export async function createProjectConfig(configType, force = false) {
9
10
  if (!availableDefaultConfigs.includes(configType)) {
10
11
  displayError(`Unknown config type: ${configType}. Available options: ${availableDefaultConfigs.join(', ')}`);
11
12
  exit(1);
@@ -14,9 +15,23 @@ export async function createProjectConfig(configType) {
14
15
  displayInfo(`Setting up your project\n`);
15
16
  writeProjectReviewPreamble();
16
17
  displayWarning(`Make sure you add as much detail as possible to your ${PROJECT_GUIDELINES}.\n`);
18
+ // The config file is the only artefact that gets an overwrite path; the preamble files above stay
19
+ // no-clobber. Without --force, keep an existing config (and say so honestly) rather than running
20
+ // the provider init, whose no-clobber write would silently skip and leave a misleading trail.
21
+ const configPath = getGslothConfigWritePath(USER_PROJECT_CONFIG_JSON);
22
+ if (!force && existsSync(configPath)) {
23
+ displayWarning(`${configPath} already exists and was kept (not overwritten). Re-run with --force to overwrite it.`);
24
+ return;
25
+ }
17
26
  displayInfo(`Creating project config for ${configType}`);
27
+ // CFG-14: resolve the model to write from live `/v1/models` discovery when a key/daemon is
28
+ // present (a verified-present id, never a speculative literal). When live discovery is
29
+ // impossible this returns undefined and `init` omits `model`, deferring to the provider's
30
+ // single curated run-time fallback (getCuratedFallbackModel) rather than baking a stale id that
31
+ // 404s once the model is retired.
32
+ const model = await resolveInitModel(configType);
18
33
  const vendorConfig = await import(`@gaunt-sloth/core/providers/${configType}.js`);
19
- vendorConfig.init(getGslothConfigWritePath(USER_PROJECT_CONFIG_JSON));
34
+ vendorConfig.init(configPath, force, model);
20
35
  }
21
36
  /**
22
37
  * Ensures that the .gsloth directory exists in the project root.
@@ -1 +1 @@
1
- {"version":3,"file":"configSetup.js","sourceRoot":"","sources":["../../src/commands/configSetup.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EACV,kBAAkB,EAClB,2BAA2B,EAC3B,wBAAwB,G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,CAAC;AACH,CAAC;AAED,MAAM,UAAU,0BAA0B;IACxC,MAAM,cAAc,GAAG,wBAAwB,CAAC,kBAAkB,CAAC,CAAC;IACpE,MAAM,UAAU,GAAG,wBAAwB,CAAC,2BAA2B,CAAC,CAAC;IAEzE,MAAM,kBAAkB,GAAG;;;;2EAI8C,kBAAkB;;qBAExE,kBAAkB;CACtC,CAAC;IAEA,MAAM,cAAc,GAAG;;;;;;;;;;;;;;;CAexB,CAAC;IAEA,gCAAgC,CAAC,cAAc,EAAE,kBAAkB,CAAC,CAAC;IACrE,gCAAgC,CAAC,UAAU,EAAE,cAAc,CAAC,CAAC;AAC/D,CAAC"}
@@ -94,9 +94,12 @@ export function execCommand(program, commandLineConfigOverrides) {
94
94
  const execConfig = buildExecConfig(config, options);
95
95
  const { runSingleShot } = await import('@gaunt-sloth/core/runtime/singleShot.js');
96
96
  const { createResolvers } = await import('@gaunt-sloth/agent/resolvers.js');
97
+ const { resolveAgentFactory } = await import('@gaunt-sloth/agent/core/resolveAgentFactory.js');
97
98
  let ok = false;
98
99
  try {
99
- ok = await runSingleShot('EXEC', getExecSystemPrompt(execConfig), content.join('\n'), execConfig, createResolvers(), 'exec');
100
+ ok = await runSingleShot('EXEC', getExecSystemPrompt(execConfig), content.join('\n'), execConfig, createResolvers(), 'exec',
101
+ // exec defaults to the lean backend; an explicit config.agent.backend overrides it.
102
+ resolveAgentFactory(execConfig, 'lean'));
100
103
  }
101
104
  catch (error) {
102
105
  displayError(error instanceof Error ? error.message : String(error));