rafcode 3.0.0 → 3.8.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/.claude/settings.local.json +3 -1
- package/CLAUDE.md +0 -1
- package/RAF/38-dual-wielder/decisions.md +9 -0
- package/RAF/38-dual-wielder/input.md +6 -1
- package/RAF/38-dual-wielder/outcomes/8-e2e-test-codex-provider.md +139 -0
- package/RAF/38-dual-wielder/plans/8-e2e-test-codex-provider.md +95 -0
- package/RAF/39-pathless-rover/decisions.md +16 -0
- package/RAF/39-pathless-rover/input.md +2 -0
- package/RAF/39-pathless-rover/outcomes/1-fix-codex-stream-renderer.md +21 -0
- package/RAF/39-pathless-rover/outcomes/2-wire-provider-flag.md +28 -0
- package/RAF/39-pathless-rover/outcomes/3-remove-worktree-flag-do.md +41 -0
- package/RAF/39-pathless-rover/outcomes/4-remove-worktree-flag-plan-amend.md +30 -0
- package/RAF/39-pathless-rover/outcomes/5-update-prompts-and-docs.md +26 -0
- package/RAF/39-pathless-rover/plans/1-fix-codex-stream-renderer.md +43 -0
- package/RAF/39-pathless-rover/plans/2-wire-provider-flag.md +48 -0
- package/RAF/39-pathless-rover/plans/3-remove-worktree-flag-do.md +41 -0
- package/RAF/39-pathless-rover/plans/4-remove-worktree-flag-plan-amend.md +43 -0
- package/RAF/39-pathless-rover/plans/5-update-prompts-and-docs.md +31 -0
- package/RAF/40-numeric-order-fix/decisions.md +7 -0
- package/RAF/40-numeric-order-fix/input.md +19 -0
- package/RAF/40-numeric-order-fix/outcomes/1-fix-numeric-sort-order.md +18 -0
- package/RAF/40-numeric-order-fix/outcomes/2-add-npm-keywords.md +10 -0
- package/RAF/40-numeric-order-fix/plans/1-fix-numeric-sort-order.md +48 -0
- package/RAF/40-numeric-order-fix/plans/2-add-npm-keywords.md +23 -0
- package/RAF/41-echo-chamber/decisions.md +13 -0
- package/RAF/41-echo-chamber/input.md +4 -0
- package/RAF/41-echo-chamber/outcomes/1-update-codex-model-defaults.md +24 -0
- package/RAF/41-echo-chamber/outcomes/2-e2e-test-codex-provider.md +74 -0
- package/RAF/41-echo-chamber/plans/1-update-codex-model-defaults.md +28 -0
- package/RAF/41-echo-chamber/plans/2-e2e-test-codex-provider.md +103 -0
- package/RAF/42-patch-parade/decisions.md +29 -0
- package/RAF/42-patch-parade/input.md +9 -0
- package/RAF/42-patch-parade/outcomes/1-fix-codex-model-resolution.md +36 -0
- package/RAF/42-patch-parade/outcomes/2-fix-provider-aware-name-generation.md +31 -0
- package/RAF/42-patch-parade/outcomes/3-fix-codex-error-event-rendering.md +32 -0
- package/RAF/42-patch-parade/outcomes/4-update-cli-help-docs.md +28 -0
- package/RAF/42-patch-parade/outcomes/5-update-default-codex-models-to-gpt-5-4.md +33 -0
- package/RAF/42-patch-parade/outcomes/6-unify-model-config-schema.md +89 -0
- package/RAF/42-patch-parade/plans/1-fix-codex-model-resolution.md +35 -0
- package/RAF/42-patch-parade/plans/2-fix-provider-aware-name-generation.md +38 -0
- package/RAF/42-patch-parade/plans/3-fix-codex-error-event-rendering.md +32 -0
- package/RAF/42-patch-parade/plans/4-update-cli-help-docs.md +31 -0
- package/RAF/42-patch-parade/plans/5-update-default-codex-models-to-gpt-5-4.md +35 -0
- package/RAF/42-patch-parade/plans/6-unify-model-config-schema.md +46 -0
- package/RAF/43-swiss-army/decisions.md +34 -0
- package/RAF/43-swiss-army/input.md +7 -0
- package/RAF/43-swiss-army/outcomes/1-fix-model-validation.md +21 -0
- package/RAF/43-swiss-army/outcomes/2-update-commit-format.md +31 -0
- package/RAF/43-swiss-army/outcomes/3-wire-reasoning-effort.md +28 -0
- package/RAF/43-swiss-army/outcomes/4-remove-provider-flag.md +27 -0
- package/RAF/43-swiss-army/outcomes/5-config-wizard-validation.md +23 -0
- package/RAF/43-swiss-army/outcomes/6-add-fast-mode.md +32 -0
- package/RAF/43-swiss-army/outcomes/7-config-preset.md +31 -0
- package/RAF/43-swiss-army/plans/1-fix-model-validation.md +38 -0
- package/RAF/43-swiss-army/plans/2-update-commit-format.md +46 -0
- package/RAF/43-swiss-army/plans/3-wire-reasoning-effort.md +39 -0
- package/RAF/43-swiss-army/plans/4-remove-provider-flag.md +43 -0
- package/RAF/43-swiss-army/plans/5-config-wizard-validation.md +42 -0
- package/RAF/43-swiss-army/plans/6-add-fast-mode.md +46 -0
- package/RAF/43-swiss-army/plans/7-config-preset.md +51 -0
- package/RAF/44-config-api-change/decisions.md +22 -0
- package/RAF/44-config-api-change/input.md +5 -0
- package/RAF/44-config-api-change/outcomes/1-restructure-config-subcommands.md +19 -0
- package/RAF/44-config-api-change/outcomes/2-move-preset-under-config.md +17 -0
- package/RAF/44-config-api-change/outcomes/3-update-existing-tests-for-config-api.md +14 -0
- package/RAF/44-config-api-change/outcomes/4-update-config-command-docs.md +11 -0
- package/RAF/44-config-api-change/outcomes/5-fix-codex-name-generation.md +18 -0
- package/RAF/44-config-api-change/plans/1-restructure-config-subcommands.md +37 -0
- package/RAF/44-config-api-change/plans/2-move-preset-under-config.md +38 -0
- package/RAF/44-config-api-change/plans/3-update-existing-tests-for-config-api.md +38 -0
- package/RAF/44-config-api-change/plans/4-update-config-command-docs.md +36 -0
- package/RAF/44-config-api-change/plans/5-fix-codex-name-generation.md +49 -0
- package/RAF/45-signal-cairn/decisions.md +7 -0
- package/RAF/45-signal-cairn/input.md +2 -0
- package/RAF/45-signal-cairn/outcomes/1-rename-provider-to-harness.md +19 -0
- package/RAF/45-signal-cairn/outcomes/2-normalize-model-display-names.md +18 -0
- package/RAF/45-signal-cairn/plans/1-rename-provider-to-harness.md +40 -0
- package/RAF/45-signal-cairn/plans/2-normalize-model-display-names.md +41 -0
- package/RAF/45-signal-lantern/decisions.md +10 -0
- package/RAF/45-signal-lantern/input.md +2 -0
- package/RAF/45-signal-lantern/outcomes/1-add-effort-and-fast-to-do-model-display.md +15 -0
- package/RAF/45-signal-lantern/outcomes/2-capture-codex-post-run-token-usage.md +15 -0
- package/RAF/45-signal-lantern/outcomes/3-show-codex-token-summaries-without-fake-cost.md +14 -0
- package/RAF/45-signal-lantern/plans/1-add-effort-and-fast-to-do-model-display.md +38 -0
- package/RAF/45-signal-lantern/plans/2-capture-codex-post-run-token-usage.md +37 -0
- package/RAF/45-signal-lantern/plans/3-show-codex-token-summaries-without-fake-cost.md +40 -0
- package/RAF/46-lantern-arc/decisions.md +19 -0
- package/RAF/46-lantern-arc/input.md +6 -0
- package/RAF/46-lantern-arc/outcomes/1-remove-spark-alias.md +16 -0
- package/RAF/46-lantern-arc/outcomes/2-clean-up-worktree-plan-command.md +30 -0
- package/RAF/46-lantern-arc/outcomes/3-fix-token-usage-accumulation.md +32 -0
- package/RAF/46-lantern-arc/outcomes/4-display-effort-in-compact-mode.md +22 -0
- package/RAF/46-lantern-arc/outcomes/5-codex-fast-mode-research.md +38 -0
- package/RAF/46-lantern-arc/outcomes/6-optimize-llm-prompts.md +39 -0
- package/RAF/46-lantern-arc/plans/1-remove-spark-alias.md +38 -0
- package/RAF/46-lantern-arc/plans/2-clean-up-worktree-plan-command.md +33 -0
- package/RAF/46-lantern-arc/plans/3-fix-token-usage-accumulation.md +33 -0
- package/RAF/46-lantern-arc/plans/4-display-effort-in-compact-mode.md +28 -0
- package/RAF/46-lantern-arc/plans/5-codex-fast-mode-research.md +34 -0
- package/RAF/46-lantern-arc/plans/6-optimize-llm-prompts.md +48 -0
- package/RAF/47-signal-trim/decisions.md +13 -0
- package/RAF/47-signal-trim/input.md +2 -0
- package/RAF/47-signal-trim/plans/1-remove-cache-from-status.md +73 -0
- package/README.md +50 -63
- package/dist/commands/config.d.ts.map +1 -1
- package/dist/commands/config.js +47 -49
- package/dist/commands/config.js.map +1 -1
- package/dist/commands/do.d.ts +2 -0
- package/dist/commands/do.d.ts.map +1 -1
- package/dist/commands/do.js +91 -230
- package/dist/commands/do.js.map +1 -1
- package/dist/commands/plan.d.ts.map +1 -1
- package/dist/commands/plan.js +54 -259
- package/dist/commands/plan.js.map +1 -1
- package/dist/commands/preset.d.ts +3 -0
- package/dist/commands/preset.d.ts.map +1 -0
- package/dist/commands/preset.js +158 -0
- package/dist/commands/preset.js.map +1 -0
- package/dist/core/claude-runner.d.ts +2 -0
- package/dist/core/claude-runner.d.ts.map +1 -1
- package/dist/core/claude-runner.js +36 -12
- package/dist/core/claude-runner.js.map +1 -1
- package/dist/core/codex-runner.d.ts +1 -0
- package/dist/core/codex-runner.d.ts.map +1 -1
- package/dist/core/codex-runner.js +26 -7
- package/dist/core/codex-runner.js.map +1 -1
- package/dist/core/failure-analyzer.js +2 -1
- package/dist/core/failure-analyzer.js.map +1 -1
- package/dist/core/git.d.ts +2 -2
- package/dist/core/git.d.ts.map +1 -1
- package/dist/core/git.js +53 -3
- package/dist/core/git.js.map +1 -1
- package/dist/core/project-manager.d.ts.map +1 -1
- package/dist/core/project-manager.js +2 -2
- package/dist/core/project-manager.js.map +1 -1
- package/dist/core/pull-request.js +5 -5
- package/dist/core/pull-request.js.map +1 -1
- package/dist/core/runner-factory.d.ts +4 -4
- package/dist/core/runner-factory.d.ts.map +1 -1
- package/dist/core/runner-factory.js +8 -8
- package/dist/core/runner-factory.js.map +1 -1
- package/dist/core/runner-interface.d.ts +1 -1
- package/dist/core/runner-types.d.ts +17 -4
- package/dist/core/runner-types.d.ts.map +1 -1
- package/dist/core/state-derivation.js +3 -3
- package/dist/core/state-derivation.js.map +1 -1
- package/dist/parsers/codex-stream-renderer.d.ts +28 -4
- package/dist/parsers/codex-stream-renderer.d.ts.map +1 -1
- package/dist/parsers/codex-stream-renderer.js +110 -0
- package/dist/parsers/codex-stream-renderer.js.map +1 -1
- package/dist/prompts/amend.d.ts +0 -1
- package/dist/prompts/amend.d.ts.map +1 -1
- package/dist/prompts/amend.js +31 -104
- package/dist/prompts/amend.js.map +1 -1
- package/dist/prompts/execution.d.ts.map +1 -1
- package/dist/prompts/execution.js +17 -34
- package/dist/prompts/execution.js.map +1 -1
- package/dist/prompts/planning.d.ts.map +1 -1
- package/dist/prompts/planning.js +23 -123
- package/dist/prompts/planning.js.map +1 -1
- package/dist/types/config.d.ts +33 -32
- package/dist/types/config.d.ts.map +1 -1
- package/dist/types/config.js +14 -28
- package/dist/types/config.js.map +1 -1
- package/dist/utils/config.d.ts +36 -16
- package/dist/utils/config.d.ts.map +1 -1
- package/dist/utils/config.js +209 -104
- package/dist/utils/config.js.map +1 -1
- package/dist/utils/name-generator.d.ts.map +1 -1
- package/dist/utils/name-generator.js +25 -12
- package/dist/utils/name-generator.js.map +1 -1
- package/dist/utils/paths.d.ts +5 -0
- package/dist/utils/paths.d.ts.map +1 -1
- package/dist/utils/paths.js +9 -0
- package/dist/utils/paths.js.map +1 -1
- package/dist/utils/terminal-symbols.d.ts +15 -2
- package/dist/utils/terminal-symbols.d.ts.map +1 -1
- package/dist/utils/terminal-symbols.js +36 -4
- package/dist/utils/terminal-symbols.js.map +1 -1
- package/dist/utils/token-tracker.d.ts +6 -1
- package/dist/utils/token-tracker.d.ts.map +1 -1
- package/dist/utils/token-tracker.js +84 -51
- package/dist/utils/token-tracker.js.map +1 -1
- package/dist/utils/validation.d.ts +1 -2
- package/dist/utils/validation.d.ts.map +1 -1
- package/dist/utils/validation.js +4 -25
- package/dist/utils/validation.js.map +1 -1
- package/package.json +7 -2
- package/src/commands/config.ts +60 -63
- package/src/commands/do.ts +96 -262
- package/src/commands/plan.ts +55 -279
- package/src/commands/preset.ts +186 -0
- package/src/core/claude-runner.ts +45 -5
- package/src/core/codex-runner.ts +32 -7
- package/src/core/failure-analyzer.ts +2 -1
- package/src/core/git.ts +57 -3
- package/src/core/project-manager.ts +2 -1
- package/src/core/pull-request.ts +5 -5
- package/src/core/runner-factory.ts +9 -9
- package/src/core/runner-interface.ts +1 -1
- package/src/core/runner-types.ts +17 -4
- package/src/core/state-derivation.ts +3 -3
- package/src/parsers/codex-stream-renderer.ts +149 -4
- package/src/prompts/amend.ts +30 -105
- package/src/prompts/config-docs.md +206 -62
- package/src/prompts/execution.ts +17 -34
- package/src/prompts/planning.ts +23 -124
- package/src/types/config.ts +47 -59
- package/src/utils/config.ts +248 -115
- package/src/utils/name-generator.ts +29 -13
- package/src/utils/paths.ts +10 -0
- package/src/utils/terminal-symbols.ts +46 -6
- package/src/utils/token-tracker.ts +96 -57
- package/src/utils/validation.ts +5 -30
- package/tests/unit/amend-prompt.test.ts +3 -2
- package/tests/unit/claude-runner-interactive.test.ts +21 -3
- package/tests/unit/claude-runner.test.ts +39 -0
- package/tests/unit/codex-runner.test.ts +163 -0
- package/tests/unit/codex-stream-renderer.test.ts +127 -0
- package/tests/unit/command-output.test.ts +57 -0
- package/tests/unit/commit-planning-artifacts-worktree.test.ts +24 -7
- package/tests/unit/commit-planning-artifacts.test.ts +26 -4
- package/tests/unit/config-command.test.ts +215 -303
- package/tests/unit/config.test.ts +319 -235
- package/tests/unit/dependency-integration.test.ts +27 -1
- package/tests/unit/do-model-display.test.ts +35 -0
- package/tests/unit/execution-prompt.test.ts +49 -19
- package/tests/unit/name-generator.test.ts +82 -12
- package/tests/unit/plan-command-auto-flag.test.ts +7 -10
- package/tests/unit/plan-command.test.ts +14 -17
- package/tests/unit/planning-prompt.test.ts +9 -8
- package/tests/unit/terminal-symbols.test.ts +94 -3
- package/tests/unit/token-tracker.test.ts +180 -1
- package/tests/unit/validation.test.ts +9 -41
- package/tests/unit/worktree-flag-override.test.ts +0 -186
package/src/commands/config.ts
CHANGED
|
@@ -8,9 +8,10 @@ import { shutdownHandler } from '../core/shutdown-handler.js';
|
|
|
8
8
|
import { logger } from '../utils/logger.js';
|
|
9
9
|
import {
|
|
10
10
|
getConfigPath,
|
|
11
|
+
formatModelDisplay,
|
|
11
12
|
getModel,
|
|
12
|
-
getModelShortName,
|
|
13
13
|
validateConfig,
|
|
14
|
+
collectConfigValidationWarnings,
|
|
14
15
|
ConfigValidationError,
|
|
15
16
|
resetConfigCache,
|
|
16
17
|
resolveConfig,
|
|
@@ -18,12 +19,7 @@ import {
|
|
|
18
19
|
} from '../utils/config.js';
|
|
19
20
|
import { DEFAULT_CONFIG } from '../types/config.js';
|
|
20
21
|
import type { UserConfig } from '../types/config.js';
|
|
21
|
-
|
|
22
|
-
interface ConfigCommandOptions {
|
|
23
|
-
reset?: boolean;
|
|
24
|
-
get?: true | string; // true when --get with no key, string when --get <key>
|
|
25
|
-
set?: string[]; // [key, value]
|
|
26
|
-
}
|
|
22
|
+
import { createPresetCommand } from './preset.js';
|
|
27
23
|
|
|
28
24
|
/**
|
|
29
25
|
* Load the config documentation markdown from src/prompts/config-docs.md.
|
|
@@ -92,10 +88,10 @@ function postSessionValidation(configPath: string): void {
|
|
|
92
88
|
} catch (error) {
|
|
93
89
|
if (error instanceof ConfigValidationError) {
|
|
94
90
|
logger.warn(`Config validation warning: ${error.message}`);
|
|
95
|
-
logger.warn('The file was not deleted — you can fix it manually or run `raf config` again.');
|
|
91
|
+
logger.warn('The file was not deleted — you can fix it manually or run `raf config wizard` again.');
|
|
96
92
|
} else if (error instanceof SyntaxError) {
|
|
97
93
|
logger.warn('Config file contains invalid JSON.');
|
|
98
|
-
logger.warn('The file was not deleted — you can fix it manually or run `raf config` again.');
|
|
94
|
+
logger.warn('The file was not deleted — you can fix it manually or run `raf config wizard` again.');
|
|
99
95
|
} else {
|
|
100
96
|
logger.warn(`Could not validate config: ${error}`);
|
|
101
97
|
}
|
|
@@ -242,18 +238,16 @@ function formatValue(value: unknown): string {
|
|
|
242
238
|
// ---- Config get/set handlers ----
|
|
243
239
|
|
|
244
240
|
/**
|
|
245
|
-
*
|
|
241
|
+
* Print config value(s).
|
|
246
242
|
*/
|
|
247
|
-
function handleGet(key
|
|
243
|
+
function handleGet(key?: string): void {
|
|
248
244
|
const config = resolveConfig();
|
|
249
245
|
|
|
250
|
-
if (key ===
|
|
251
|
-
// No key specified: print full config
|
|
246
|
+
if (key === undefined) {
|
|
252
247
|
console.log(JSON.stringify(config, null, 2));
|
|
253
248
|
return;
|
|
254
249
|
}
|
|
255
250
|
|
|
256
|
-
// Specific key requested
|
|
257
251
|
const value = getNestedValue(config, key);
|
|
258
252
|
|
|
259
253
|
if (value === undefined) {
|
|
@@ -265,15 +259,9 @@ function handleGet(key: true | string): void {
|
|
|
265
259
|
}
|
|
266
260
|
|
|
267
261
|
/**
|
|
268
|
-
*
|
|
262
|
+
* Update config file with a new value.
|
|
269
263
|
*/
|
|
270
|
-
function handleSet(
|
|
271
|
-
if (args.length !== 2) {
|
|
272
|
-
logger.error('--set requires exactly 2 arguments: key and value');
|
|
273
|
-
process.exit(1);
|
|
274
|
-
}
|
|
275
|
-
|
|
276
|
-
const [key, rawValue] = args as [string, string];
|
|
264
|
+
function handleSet(key: string, rawValue: string): void {
|
|
277
265
|
const value = parseValue(rawValue);
|
|
278
266
|
const configPath = getConfigPath();
|
|
279
267
|
|
|
@@ -312,7 +300,10 @@ function handleSet(args: string[]): void {
|
|
|
312
300
|
|
|
313
301
|
// Validate the resulting config
|
|
314
302
|
try {
|
|
315
|
-
validateConfig(userConfig);
|
|
303
|
+
const validated = validateConfig(userConfig);
|
|
304
|
+
for (const warning of collectConfigValidationWarnings(validated)) {
|
|
305
|
+
logger.warn(`Config validation warning: ${warning}`);
|
|
306
|
+
}
|
|
316
307
|
} catch (error) {
|
|
317
308
|
if (error instanceof ConfigValidationError) {
|
|
318
309
|
logger.error(`Validation error: ${error.message}`);
|
|
@@ -336,41 +327,47 @@ function handleSet(args: string[]): void {
|
|
|
336
327
|
|
|
337
328
|
export function createConfigCommand(): Command {
|
|
338
329
|
const command = new Command('config')
|
|
339
|
-
.description('
|
|
340
|
-
.
|
|
341
|
-
|
|
342
|
-
.option('--get [key]', 'Show config value (all config if no key, or specific dot-notation key)')
|
|
343
|
-
.option('--set <items...>', 'Set a config value using dot-notation key and value')
|
|
344
|
-
.action(async (promptParts: string[], options: ConfigCommandOptions) => {
|
|
345
|
-
// --reset takes precedence
|
|
346
|
-
if (options.reset) {
|
|
347
|
-
await handleReset();
|
|
348
|
-
return;
|
|
349
|
-
}
|
|
350
|
-
|
|
351
|
-
// --get and --set are mutually exclusive
|
|
352
|
-
if (options.get !== undefined && options.set !== undefined) {
|
|
353
|
-
logger.error('Cannot use --get and --set together');
|
|
354
|
-
process.exit(1);
|
|
355
|
-
}
|
|
356
|
-
|
|
357
|
-
// Handle --get
|
|
358
|
-
if (options.get !== undefined) {
|
|
359
|
-
handleGet(options.get);
|
|
360
|
-
return;
|
|
361
|
-
}
|
|
362
|
-
|
|
363
|
-
// Handle --set
|
|
364
|
-
if (options.set !== undefined) {
|
|
365
|
-
handleSet(options.set);
|
|
366
|
-
return;
|
|
367
|
-
}
|
|
368
|
-
|
|
369
|
-
// Default: run interactive session
|
|
370
|
-
const initialPrompt = promptParts.length > 0 ? promptParts.join(' ') : undefined;
|
|
371
|
-
await runConfigSession(initialPrompt);
|
|
330
|
+
.description('Manage RAF configuration with get, set, reset, wizard, and preset subcommands')
|
|
331
|
+
.action(function(this: Command) {
|
|
332
|
+
this.outputHelp();
|
|
372
333
|
});
|
|
373
334
|
|
|
335
|
+
command
|
|
336
|
+
.addCommand(
|
|
337
|
+
new Command('get')
|
|
338
|
+
.description('Print the resolved config or one resolved dot-notation value')
|
|
339
|
+
.argument('[key]', 'Optional dot-notation key to read')
|
|
340
|
+
.action((key?: string) => {
|
|
341
|
+
handleGet(key);
|
|
342
|
+
})
|
|
343
|
+
)
|
|
344
|
+
.addCommand(
|
|
345
|
+
new Command('set')
|
|
346
|
+
.description('Write a config value using a dot-notation key')
|
|
347
|
+
.argument('<key>', 'Dot-notation key to write')
|
|
348
|
+
.argument('<value>', 'Value to write; parsed as JSON when possible')
|
|
349
|
+
.action((key: string, value: string) => {
|
|
350
|
+
handleSet(key, value);
|
|
351
|
+
})
|
|
352
|
+
)
|
|
353
|
+
.addCommand(
|
|
354
|
+
new Command('reset')
|
|
355
|
+
.description('Delete the config file and restore all defaults')
|
|
356
|
+
.action(async () => {
|
|
357
|
+
await handleReset();
|
|
358
|
+
})
|
|
359
|
+
)
|
|
360
|
+
.addCommand(
|
|
361
|
+
new Command('wizard')
|
|
362
|
+
.description('Launch the interactive config editor session')
|
|
363
|
+
.argument('[prompt...]', 'Optional initial prompt for the config session')
|
|
364
|
+
.action(async (promptParts: string[]) => {
|
|
365
|
+
const initialPrompt = promptParts.length > 0 ? promptParts.join(' ') : undefined;
|
|
366
|
+
await runConfigSession(initialPrompt);
|
|
367
|
+
})
|
|
368
|
+
)
|
|
369
|
+
.addCommand(createPresetCommand());
|
|
370
|
+
|
|
374
371
|
return command;
|
|
375
372
|
}
|
|
376
373
|
|
|
@@ -399,16 +396,16 @@ async function runConfigSession(initialPrompt?: string): Promise<void> {
|
|
|
399
396
|
const configPath = getConfigPath();
|
|
400
397
|
|
|
401
398
|
// Try to load config, but fall back to defaults if it's broken
|
|
402
|
-
// This allows raf config to be used to fix a broken config file
|
|
403
|
-
let
|
|
399
|
+
// This allows raf config wizard to be used to fix a broken config file
|
|
400
|
+
let modelEntry: import('../types/config.js').ModelEntry;
|
|
404
401
|
let configError: Error | null = null;
|
|
405
402
|
|
|
406
403
|
try {
|
|
407
|
-
|
|
404
|
+
modelEntry = getModel('config');
|
|
408
405
|
} catch (error) {
|
|
409
406
|
// Config file has errors - fall back to defaults so the session can launch
|
|
410
407
|
configError = error instanceof Error ? error : new Error(String(error));
|
|
411
|
-
|
|
408
|
+
modelEntry = DEFAULT_CONFIG.models.config;
|
|
412
409
|
// Clear the cached config so subsequent calls don't use the broken cache
|
|
413
410
|
resetConfigCache();
|
|
414
411
|
}
|
|
@@ -416,7 +413,7 @@ async function runConfigSession(initialPrompt?: string): Promise<void> {
|
|
|
416
413
|
// Warn user if config has errors, before starting the session
|
|
417
414
|
if (configError) {
|
|
418
415
|
logger.warn(`Config file has errors, using defaults: ${configError.message}`);
|
|
419
|
-
logger.warn('Fix the config in this session or run `raf config
|
|
416
|
+
logger.warn('Fix the config in this session or run `raf config reset` to start fresh.');
|
|
420
417
|
logger.newline();
|
|
421
418
|
}
|
|
422
419
|
|
|
@@ -438,11 +435,11 @@ async function runConfigSession(initialPrompt?: string): Promise<void> {
|
|
|
438
435
|
?? 'Show me my current config and help me make changes.';
|
|
439
436
|
|
|
440
437
|
// Set up runner
|
|
441
|
-
const claudeRunner = createRunner({ model });
|
|
438
|
+
const claudeRunner = createRunner({ model: modelEntry.model, harness: modelEntry.harness, reasoningEffort: modelEntry.reasoningEffort, fast: modelEntry.fast });
|
|
442
439
|
shutdownHandler.init();
|
|
443
440
|
shutdownHandler.registerClaudeRunner(claudeRunner);
|
|
444
441
|
|
|
445
|
-
const configModel =
|
|
442
|
+
const configModel = formatModelDisplay(modelEntry.model);
|
|
446
443
|
logger.info(`Starting config session with ${configModel}...`);
|
|
447
444
|
logger.newline();
|
|
448
445
|
|