gaunt-sloth 2.0.0-alpha.2 → 2.0.0-alpha.21
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 +55 -5
- package/cli.js +43 -10
- package/dist/cli.js +33 -2
- package/dist/cli.js.map +1 -1
- package/dist/commands/adkEvalRunner.d.ts +66 -0
- package/dist/commands/adkEvalRunner.js +69 -0
- package/dist/commands/adkEvalRunner.js.map +1 -0
- package/dist/commands/agUiEvalRunner.d.ts +73 -0
- package/dist/commands/agUiEvalRunner.js +216 -0
- package/dist/commands/agUiEvalRunner.js.map +1 -0
- package/dist/commands/askCommand.d.ts +3 -2
- package/dist/commands/askCommand.js +26 -7
- package/dist/commands/askCommand.js.map +1 -1
- package/dist/commands/batchCommand.d.ts +78 -0
- package/dist/commands/batchCommand.js +245 -0
- package/dist/commands/batchCommand.js.map +1 -0
- package/dist/commands/cliOptionParsers.d.ts +12 -0
- package/dist/commands/cliOptionParsers.js +18 -0
- package/dist/commands/cliOptionParsers.js.map +1 -0
- package/dist/commands/commandIntrospection.d.ts +6 -6
- package/dist/commands/commandIntrospection.js +12 -12
- package/dist/commands/commandIntrospection.js.map +1 -1
- package/dist/commands/commandUtils.d.ts +16 -16
- package/dist/commands/commandUtils.js +20 -20
- package/dist/commands/commandUtils.js.map +1 -1
- package/dist/commands/configCommand.d.ts +24 -0
- package/dist/commands/configCommand.js +117 -0
- package/dist/commands/configCommand.js.map +1 -0
- package/dist/commands/configSetup.d.ts +1 -1
- package/dist/commands/configSetup.js +17 -2
- package/dist/commands/configSetup.js.map +1 -1
- package/dist/commands/evalCommand.d.ts +41 -0
- package/dist/commands/evalCommand.js +483 -0
- package/dist/commands/evalCommand.js.map +1 -0
- package/dist/commands/execCommand.js +4 -1
- package/dist/commands/execCommand.js.map +1 -1
- package/dist/commands/firstRunDialog.d.ts +39 -5
- package/dist/commands/firstRunDialog.js +72 -10
- package/dist/commands/firstRunDialog.js.map +1 -1
- package/dist/commands/getCommand.js +7 -7
- package/dist/commands/getCommand.js.map +1 -1
- package/dist/commands/historyCommand.d.ts +17 -0
- package/dist/commands/historyCommand.js +102 -0
- package/dist/commands/historyCommand.js.map +1 -0
- package/dist/commands/initCommand.d.ts +3 -0
- package/dist/commands/initCommand.js +9 -4
- package/dist/commands/initCommand.js.map +1 -1
- package/dist/commands/insightsCommand.d.ts +8 -0
- package/dist/commands/insightsCommand.js +32 -0
- package/dist/commands/insightsCommand.js.map +1 -0
- package/dist/commands/modelsCommand.d.ts +25 -0
- package/dist/commands/modelsCommand.js +96 -0
- package/dist/commands/modelsCommand.js.map +1 -0
- package/dist/commands/prCommand.js +14 -15
- package/dist/commands/prCommand.js.map +1 -1
- package/dist/commands/prDiscovery.d.ts +2 -2
- package/dist/commands/prDiscovery.js +27 -29
- package/dist/commands/prDiscovery.js.map +1 -1
- package/dist/commands/reviewCommand.js +15 -10
- package/dist/commands/reviewCommand.js.map +1 -1
- package/dist/commands/workflowCommand.d.ts +19 -0
- package/dist/commands/workflowCommand.js +77 -0
- package/dist/commands/workflowCommand.js.map +1 -0
- package/dist/helpers/jira/jiraLogWork.js.map +1 -1
- package/dist/modules/startSession.js +9 -7
- package/dist/modules/startSession.js.map +1 -1
- package/dist/tools/gthJiraLogWorkTool.js +3 -3
- package/dist/tools/gthJiraLogWorkTool.js.map +1 -1
- package/dist/tui/components/App.js +321 -21
- package/dist/tui/components/App.js.map +1 -1
- package/dist/tui/components/ApprovalPrompt.d.ts +18 -0
- package/dist/tui/components/ApprovalPrompt.js +26 -0
- package/dist/tui/components/ApprovalPrompt.js.map +1 -0
- package/dist/tui/components/DebugPanel.d.ts +29 -9
- package/dist/tui/components/DebugPanel.js +46 -23
- package/dist/tui/components/DebugPanel.js.map +1 -1
- package/dist/tui/components/FetchProgress.d.ts +36 -0
- package/dist/tui/components/FetchProgress.js +39 -0
- package/dist/tui/components/FetchProgress.js.map +1 -0
- package/dist/tui/components/LiveTurn.d.ts +26 -4
- package/dist/tui/components/LiveTurn.js +104 -18
- package/dist/tui/components/LiveTurn.js.map +1 -1
- package/dist/tui/components/NoticeBar.d.ts +32 -0
- package/dist/tui/components/NoticeBar.js +39 -0
- package/dist/tui/components/NoticeBar.js.map +1 -0
- package/dist/tui/components/PromptInput.d.ts +26 -1
- package/dist/tui/components/PromptInput.js +93 -7
- package/dist/tui/components/PromptInput.js.map +1 -1
- package/dist/tui/components/Rule.js.map +1 -1
- package/dist/tui/components/SelectList.d.ts +98 -9
- package/dist/tui/components/SelectList.js +209 -26
- package/dist/tui/components/SelectList.js.map +1 -1
- package/dist/tui/components/SlashCommandMenu.d.ts +20 -0
- package/dist/tui/components/SlashCommandMenu.js +28 -0
- package/dist/tui/components/SlashCommandMenu.js.map +1 -0
- package/dist/tui/components/StatusBar.d.ts +7 -1
- package/dist/tui/components/StatusBar.js +7 -3
- package/dist/tui/components/StatusBar.js.map +1 -1
- package/dist/tui/components/Transcript.js +6 -1
- package/dist/tui/components/Transcript.js.map +1 -1
- package/dist/tui/debugRender.d.ts +41 -6
- package/dist/tui/debugRender.js +126 -12
- package/dist/tui/debugRender.js.map +1 -1
- package/dist/tui/debugSearch.d.ts +40 -0
- package/dist/tui/debugSearch.js +73 -0
- package/dist/tui/debugSearch.js.map +1 -0
- package/dist/tui/markdown.js +0 -0
- package/dist/tui/markdown.js.map +1 -1
- package/dist/tui/pasteParser.d.ts +21 -0
- package/dist/tui/pasteParser.js +24 -0
- package/dist/tui/pasteParser.js.map +1 -0
- package/dist/tui/selectCancelled.d.ts +13 -0
- package/dist/tui/selectCancelled.js +17 -0
- package/dist/tui/selectCancelled.js.map +1 -0
- package/dist/tui/slashCommands.d.ts +220 -1
- package/dist/tui/slashCommands.js +408 -1
- package/dist/tui/slashCommands.js.map +1 -1
- package/dist/tui/tuiSessionModule.js +249 -24
- package/dist/tui/tuiSessionModule.js.map +1 -1
- package/dist/tui/types.d.ts +96 -7
- package/dist/tui/viewModel.d.ts +34 -0
- package/dist/tui/viewModel.js +67 -0
- package/dist/tui/viewModel.js.map +1 -1
- package/dist/utils/stdinPolicy.d.ts +31 -0
- package/dist/utils/stdinPolicy.js +37 -0
- package/dist/utils/stdinPolicy.js.map +1 -0
- package/package.json +21 -17
|
@@ -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
|
-
*
|
|
4
|
+
* Requirement sources. Aliases are mapped to actual package paths.
|
|
5
5
|
*/
|
|
6
|
-
export const
|
|
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
|
|
14
|
+
* Content sources. Aliases are mapped to actual package paths.
|
|
15
15
|
*/
|
|
16
|
-
export const
|
|
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
|
|
22
|
-
const requirements = await
|
|
23
|
-
return wrapContent(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
|
|
26
|
-
const content = await
|
|
27
|
-
return wrapContent(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
|
|
29
|
+
async function getFromSource(source, id,
|
|
30
30
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
31
|
-
config,
|
|
32
|
-
if (typeof
|
|
33
|
-
// Use one of the predefined
|
|
34
|
-
if (
|
|
35
|
-
const
|
|
36
|
-
const { get } = await import(
|
|
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
|
|
40
|
+
displayError(`Unknown source: ${source}. Continuing without it.`);
|
|
41
41
|
}
|
|
42
42
|
}
|
|
43
|
-
else if (typeof
|
|
43
|
+
else if (typeof source === 'function') {
|
|
44
44
|
// Type assertion to handle function call
|
|
45
|
-
return await
|
|
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,
|
|
1
|
+
{"version":3,"file":"commandUtils.js","sourceRoot":"","sources":["../../src/commands/commandU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sBAA4E;IAE5E,IAAI,OAAO,MAAM,KAAK,QAAQ,EAAE,CAAC;QAC/B,oCAAoC;QACpC,IAAI,sBAAsB,CAAC,MAA6C,CAAC,EAAE,CAAC;YAC1E,MAAM,UAAU,GAAG,sBAAsB,CAAC,MAA6C,CAAC,CAAC;YACzF,MAAM,EAAE,GAAG,EAAE,GAAG,MAAM,MAAM,CAAC,UAAU,CAAC,CAAC;YACzC,OAAO,MAAM,GAAG,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;QAC/B,CAAC;aAAM,CAAC;YACN,YAAY,CAAC,mBAAmB,MAAM,0BAA0B,CAAC,CAAC;QACpE,CAAC;IACH,CAAC;SAAM,IAAI,OAAO,MAAM,KAAK,UAAU,EAAE,CAAC;QACxC,yCAAyC;QACzC,OAAO,MAAO,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,117 @@
|
|
|
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
|
+
// GS2-29 — a run validates every layer (project + global), so the report carries a
|
|
92
|
+
// per-layer verdict. Prefix each warning/error with its source label so the user knows
|
|
93
|
+
// which file to fix.
|
|
94
|
+
for (const layer of report.layers) {
|
|
95
|
+
for (const warning of layer.warnings) {
|
|
96
|
+
displayWarning(`${layer.sourceLabel}: ${warning}`);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
const invalidLayers = report.layers.filter((layer) => !layer.ok);
|
|
100
|
+
if (invalidLayers.length === 0) {
|
|
101
|
+
displaySuccess(`Configuration is valid: ${report.layers.map((layer) => layer.sourceLabel).join(', ')}`);
|
|
102
|
+
return;
|
|
103
|
+
}
|
|
104
|
+
// Report EVERY failing layer, not just the first, so the user fixes all offending files.
|
|
105
|
+
for (const layer of invalidLayers) {
|
|
106
|
+
displayError(`Invalid configuration in ${layer.sourceLabel}:\n${layer.errorMessage ?? ''}`);
|
|
107
|
+
}
|
|
108
|
+
setExitCode(1);
|
|
109
|
+
}
|
|
110
|
+
catch (error) {
|
|
111
|
+
// A JSONC/module parse failure lands here — surface it as an invalid-config error.
|
|
112
|
+
displayError(`Failed to read configuration: ${error instanceof Error ? error.message : String(error)}`);
|
|
113
|
+
setExitCode(1);
|
|
114
|
+
}
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
//# 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,EAAE,WAAW,EAAE,MAAM,wCAAwC,CAAC;AAErE;;;;GAIG;AACH,MAAM,aAAa,GAAG,6EAA6E,CAAC;AACpG,MAAM,QAAQ,GAAG,gBAAgB,CAAC;AAElC;;;;;;;GAOG;AACH,MAAM,UAAU,oBAAoB,CAAC,MAAiB;IACpD,+FAA+F;IAC/F,MAAM,EACJ,GAAG,EAAE,IAAI,EACT,KAAK,EACL,UAAU,EACV,GAAG,IAAI,EACR,GAAG,MAGH,CAAC;IACF,KAAK,IAAI,CAAC;IAEV,4FAA4F;IAC5F,4FAA4F;IAC5F,gFAAgF;IAChF,IAAI,GAA4B,CAAC;IACjC,IAAI,CAAC;QACH,GAAG,GAAG,IAAI,CAAC,KAAK,CACd,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,CAAC,GAAG,EAAE,KAAK,EAAE,EAAE,CAAC,CAAC,aAAa,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CACxD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ACF,OAAO;YACT,CAAC;YAED,yFAAyF;YACzF,KAAK,MAAM,KAAK,IAAI,aAAa,EAAE,CAAC;gBAClC,YAAY,CACV,4BAA4B,KAAK,CAAC,WAAW,MAAM,KAAK,CAAC,YAAY,IAAI,EAAE,EAAE,CAC9E,CAAC;YACJ,CAAC;YACD,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(
|
|
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,GACzB,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAAE,uBAAuB,EAAmB,MAAM,6BAA6B,CAAC;AACvF,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,yCAAyC,CAAC;AACpG,OAAO,EACL,wBAAwB,EACxB,gCAAgC,GACjC,MAAM,wCAAwC,CAAC;AAChD,OAAO,EAAE,IAAI,EAAE,iBAAiB,EAAE,MAAM,wCAAwC,CAAC;AACjF,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAChD,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,MAAM,CAAC,KAAK,UAAU,mBAAmB,CAAC,UAAkB;
|
|
1
|
+
{"version":3,"file":"configSetup.js","sourceRoot":"","sources":["../../src/commands/configSetup.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EACV,kBAAkB,EAClB,2BAA2B,EAC3B,wBAAwB,GACzB,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAAE,uBAAuB,EAAmB,MAAM,6BAA6B,CAAC;AACvF,OAAO,EAAE,gBAAgB,EAAmB,MAAM,+CAA+C,CAAC;AAClG,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,yCAAyC,CAAC;AACpG,OAAO,EACL,wBAAwB,EACxB,gCAAgC,GACjC,MAAM,wCAAwC,CAAC;AAChD,OAAO,EAAE,IAAI,EAAE,iBAAiB,EAAE,MAAM,wCAAwC,CAAC;AACjF,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAChD,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,MAAM,CAAC,KAAK,UAAU,mBAAmB,CAAC,UAAkB,EAAE,KAAK,GAAG,KAAK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WAAW,CAAC,WAAW,UAAU,YAAY,CAAC,CAAC;IACjD,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"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { Command } from 'commander';
|
|
2
|
+
import { CommandLineConfigOverrides } from '@gaunt-sloth/core/config.js';
|
|
3
|
+
/** Split each collected `--reporter` value on `,`, flatten, trim, drop blanks, and de-duplicate
|
|
4
|
+
* (order-preserving), so `-r junit,text` and `-r junit -r text` both yield `['junit','text']`. */
|
|
5
|
+
export declare function normalizeReporterNames(collected: string[]): string[];
|
|
6
|
+
/** Default output dir when `-o/--output` is omitted: a timestamped dir next to other gth reports —
|
|
7
|
+
* same convention as `defaultBatchOutputDir` in `batchCommand.ts`, `_EVAL` suffix instead. */
|
|
8
|
+
export declare function defaultEvalOutputDir(): string;
|
|
9
|
+
/**
|
|
10
|
+
* Pure resolver for the judge identity profile — kept small and side-effect-free so it's unit
|
|
11
|
+
* testable in isolation. Precedence (highest first): CLI `--judge <profile>` > suite-level
|
|
12
|
+
* `judge_profile` > none. A blank/whitespace-only value at either level counts as absent (falls
|
|
13
|
+
* through to the next level). `undefined` means "no separate judge — grade with the SUT's config".
|
|
14
|
+
*/
|
|
15
|
+
export declare function resolveJudgeProfile(cliJudge: string | undefined, suiteJudgeProfile: string | undefined): string | undefined;
|
|
16
|
+
/**
|
|
17
|
+
* Adds the `eval` command to the program.
|
|
18
|
+
*
|
|
19
|
+
* `gth eval <suite.yaml> [-j 8] [-o out/]` — grades a suite of cases (deterministic checks and/or
|
|
20
|
+
* an LLM judge) against the SUT agent, the way `review` grades a diff. See
|
|
21
|
+
* docs/batch-eval-cli-surface.md and docs/batch-eval-user-requirements.md for the design; this
|
|
22
|
+
* command implements the single-`prompt`, `gth-agent`-target, `config.llm`-as-judge subset — see
|
|
23
|
+
* the BATCH-2 Task 2 brief's "Not in scope" list for what's deliberately deferred.
|
|
24
|
+
*
|
|
25
|
+
* Exit-code contract (BATCH-11 / #405 his #6 — a distinct three-way code so CI can tell a product
|
|
26
|
+
* regression from a broken harness):
|
|
27
|
+
* - `0` — every case passed (mirrors `review`; unchanged contract).
|
|
28
|
+
* - `1` — the suite **ran** but ≥1 case FAILED (a deterministic check or the judge fell below
|
|
29
|
+
* threshold). A *product* signal: real, gradeable results, some below the bar.
|
|
30
|
+
* - `2` — **harness error**: the suite couldn't be meaningfully evaluated — the suite file failed
|
|
31
|
+
* to load/parse, config failed to build, or **every** case's SUT run failed (`sutOk:false`, e.g.
|
|
32
|
+
* a transport/auth/config failure produced no answer to grade). An *environment* signal.
|
|
33
|
+
*
|
|
34
|
+
* The suite-vs-harness split is anchored on `sutOk` (see `classifyEvalExit`), not the verdict: a
|
|
35
|
+
* case that ran (`sutOk:true`) but whose judge errored, or whose answer failed a check, is still a
|
|
36
|
+
* real result → exit `1`, never `2`. Unlike `batch`, which exits 0 regardless of per-cell quality.
|
|
37
|
+
*
|
|
38
|
+
* @param program - The commander program
|
|
39
|
+
* @param commandLineConfigOverrides - command line config overrides
|
|
40
|
+
*/
|
|
41
|
+
export declare function evalCommand(program: Command, commandLineConfigOverrides: CommandLineConfigOverrides): void;
|