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
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
---
|
|
2
|
+
effort: medium
|
|
3
|
+
---
|
|
4
|
+
# Task: Display effort level in compact mode task status
|
|
5
|
+
|
|
6
|
+
## Objective
|
|
7
|
+
Show the frontmatter effort level (low/medium/high) in the compact task status line during `raf do`.
|
|
8
|
+
|
|
9
|
+
## Context
|
|
10
|
+
The compact display during `raf do` shows model and fast flag in parentheses but not the effort level from the plan frontmatter. The `formatModelMetadata` function in `terminal-symbols.ts` already supports an `effort` option, and `do.ts` already passes `effort: currentModelReasoningEffort` — but `currentModelReasoningEffort` comes from `modelResolution.entry.reasoningEffort` (the model's reasoning effort parameter), NOT the frontmatter's effort field (low/medium/high). These are different concepts: frontmatter effort selects the model tier, while reasoningEffort is a runtime model parameter.
|
|
11
|
+
|
|
12
|
+
## Requirements
|
|
13
|
+
- Pass the frontmatter effort (low/medium/high) to the compact display
|
|
14
|
+
- Show it inside parentheses: `(sonnet, medium, fast)`
|
|
15
|
+
- Don't confuse it with `reasoningEffort` (model parameter)
|
|
16
|
+
|
|
17
|
+
## Implementation Steps
|
|
18
|
+
1. In `src/commands/do.ts`, add a variable to track the frontmatter effort level:
|
|
19
|
+
- Add `let currentEffort: string | undefined;` alongside the existing `currentModelReasoningEffort` tracking
|
|
20
|
+
- After `resolveTaskModel`, set `currentEffort = task.frontmatter?.effort;`
|
|
21
|
+
2. Update the three display call sites (running ~line 827, completed ~line 1034, failed ~line 1069) to pass `effort: currentEffort` instead of `effort: currentModelReasoningEffort`
|
|
22
|
+
3. Decide what to do with `currentModelReasoningEffort` — if it's not displayed anywhere else, it can be removed. If it serves another purpose, keep both.
|
|
23
|
+
|
|
24
|
+
## Acceptance Criteria
|
|
25
|
+
- [ ] Running task status shows effort: `● 01-task-name (sonnet, medium) 12s`
|
|
26
|
+
- [ ] Effort displays correctly for low, medium, and high values
|
|
27
|
+
- [ ] Tasks without effort frontmatter don't show a blank entry
|
|
28
|
+
- [ ] TypeScript compiles without errors
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
---
|
|
2
|
+
effort: medium
|
|
3
|
+
---
|
|
4
|
+
# Task: Research and wire fast mode for Codex harness
|
|
5
|
+
|
|
6
|
+
## Objective
|
|
7
|
+
Determine if the Codex CLI supports fast mode, and either wire it up or remove fast mode from Codex config paths entirely.
|
|
8
|
+
|
|
9
|
+
## Context
|
|
10
|
+
The config wizard says "RAF only applies fast mode on Claude runners" and config-docs.md states "Codex does not support fast mode." The user wants to know if this is actually true, and if Codex does support fast mode, wire it. If not, clean up by removing the fast setting from Codex-related paths rather than just warning.
|
|
11
|
+
|
|
12
|
+
## Requirements
|
|
13
|
+
- Research whether `codex exec` supports any fast mode flag (check `codex --help`, `codex exec --help`, or similar)
|
|
14
|
+
- If supported: wire `fast: true` in `CodexRunner` similar to how `ClaudeRunner` does it
|
|
15
|
+
- If NOT supported:
|
|
16
|
+
- Update `config-docs.md` to clarify fast mode is Claude-only (already says this - verify)
|
|
17
|
+
- Consider if validation should warn/strip `fast: true` from codex harness entries
|
|
18
|
+
- Update the config wizard prompt/docs to reflect this clearly
|
|
19
|
+
|
|
20
|
+
## Implementation Steps
|
|
21
|
+
1. Run `codex --help` and `codex exec --help` (or equivalent) to check for fast mode flags
|
|
22
|
+
2. Search the codex-runner.ts for any existing fast mode references
|
|
23
|
+
3. Based on findings:
|
|
24
|
+
- **If supported**: Add fast mode flag to `CodexRunner.run()` and `CodexRunner.runInteractive()` similar to `ClaudeRunner`
|
|
25
|
+
- **If NOT supported**:
|
|
26
|
+
- Verify config-docs.md accurately reflects this
|
|
27
|
+
- Add validation in `src/utils/config.ts` that warns if `fast: true` is set with codex harness
|
|
28
|
+
- Update any config wizard messaging
|
|
29
|
+
|
|
30
|
+
## Acceptance Criteria
|
|
31
|
+
- [ ] Fast mode either works with Codex or is explicitly unsupported with clear messaging
|
|
32
|
+
- [ ] Config validation warns if user sets fast: true on a codex harness entry
|
|
33
|
+
- [ ] config-docs.md is accurate
|
|
34
|
+
- [ ] TypeScript compiles without errors
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
---
|
|
2
|
+
effort: high
|
|
3
|
+
---
|
|
4
|
+
# Task: Optimize LLM prompts for clarity and conciseness
|
|
5
|
+
|
|
6
|
+
## Objective
|
|
7
|
+
Review and optimize the three main prompt files (planning.ts, execution.ts, amend.ts) to remove redundancy, clarify confusing statements, and reduce verbosity while preserving clarity for LLMs.
|
|
8
|
+
|
|
9
|
+
## Dependencies
|
|
10
|
+
1, 2
|
|
11
|
+
|
|
12
|
+
## Context
|
|
13
|
+
The prompts in this project are sent to LLMs and should be optimized for how LLMs process instructions. Common issues include: repeated instructions across sections, contradictory or confusing statements, unnecessary verbosity that wastes tokens without adding clarity, and instructions that could be consolidated.
|
|
14
|
+
|
|
15
|
+
## Requirements
|
|
16
|
+
- Review all three prompt files: `src/prompts/planning.ts`, `src/prompts/execution.ts`, `src/prompts/amend.ts`
|
|
17
|
+
- Identify and remove redundant/repeated instructions
|
|
18
|
+
- Clarify confusing or ambiguous statements
|
|
19
|
+
- Reduce verbosity where possible without losing meaning
|
|
20
|
+
- Preserve all functional requirements — don't remove instructions that change behavior
|
|
21
|
+
- Keep the prompts well-structured and scannable
|
|
22
|
+
|
|
23
|
+
## Implementation Steps
|
|
24
|
+
1. Read `src/prompts/planning.ts` carefully and note:
|
|
25
|
+
- Repeated instructions (same thing said in multiple places)
|
|
26
|
+
- Confusing/contradictory statements
|
|
27
|
+
- Overly verbose sections that could be tightened
|
|
28
|
+
2. Do the same for `src/prompts/execution.ts`
|
|
29
|
+
3. Do the same for `src/prompts/amend.ts`
|
|
30
|
+
4. Apply edits to each file:
|
|
31
|
+
- Consolidate repeated instructions into a single clear statement
|
|
32
|
+
- Rewrite confusing passages
|
|
33
|
+
- Trim verbose sections while preserving intent
|
|
34
|
+
- Ensure cross-references between prompts still make sense
|
|
35
|
+
5. After editing, re-read each prompt end-to-end to verify coherence
|
|
36
|
+
6. Note: Tasks 1 and 2 may have changed content in these files (spark alias removal, worktree cleanup from planning prompt). Work with the current state of the files.
|
|
37
|
+
|
|
38
|
+
## Acceptance Criteria
|
|
39
|
+
- [ ] No redundant/repeated instructions across sections within each prompt
|
|
40
|
+
- [ ] No confusing or contradictory statements
|
|
41
|
+
- [ ] Prompts are noticeably more concise
|
|
42
|
+
- [ ] All functional requirements are preserved
|
|
43
|
+
- [ ] TypeScript compiles without errors
|
|
44
|
+
|
|
45
|
+
## Notes
|
|
46
|
+
- This task depends on tasks 1 and 2 because those tasks modify content within the prompt files. This task should work with the already-cleaned-up versions.
|
|
47
|
+
- Focus on LLM readability, not human readability. LLMs process instructions differently — clear structure and non-redundancy matter more than prose style.
|
|
48
|
+
- Be conservative with the execution prompt — it's the most critical for correct task completion.
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# Project Decisions
|
|
2
|
+
|
|
3
|
+
## For removing cache from status: should the cache fields be removed from UsageData/ModelTokenUsage interfaces entirely, or just hidden from display?
|
|
4
|
+
Remove everything — delete cache fields from interfaces, tracking, display code, and the showCacheTokens config key.
|
|
5
|
+
|
|
6
|
+
## What should the final status output look like?
|
|
7
|
+
Compact single line: tokens in / out + cost (e.g., `12,345 in / 6,789 out — $0.42`).
|
|
8
|
+
|
|
9
|
+
## For adding preset docs to the config wizard: what specific info should be included?
|
|
10
|
+
Docs + wizard actions — add docs AND teach the wizard to run preset save/load/list/delete during the session.
|
|
11
|
+
|
|
12
|
+
## What should the preset docs cover?
|
|
13
|
+
Just the basics — storage path, CLI commands, name validation rules. Keep it minimal.
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
---
|
|
2
|
+
effort: medium
|
|
3
|
+
---
|
|
4
|
+
# Task: Remove Cache From Status Display
|
|
5
|
+
|
|
6
|
+
## Objective
|
|
7
|
+
Remove all cache token tracking (read/created) from the `raf do` status output, interfaces, and config — leaving only tokens in/out and cost.
|
|
8
|
+
|
|
9
|
+
## Context
|
|
10
|
+
The cache token display (cache read / cache created counts) adds noise to the status output without providing actionable information. The user wants a cleaner, compact output showing only input tokens, output tokens, and dollar cost.
|
|
11
|
+
|
|
12
|
+
## Requirements
|
|
13
|
+
- Remove `cacheReadInputTokens` and `cacheCreationInputTokens` fields from `UsageData` and `ModelTokenUsage` interfaces
|
|
14
|
+
- Remove `DisplayConfig` interface and `display` field from `RafConfig` / `DEFAULT_CONFIG`
|
|
15
|
+
- Remove all cache display logic from `formatTokenLine()` in `terminal-symbols.ts`
|
|
16
|
+
- Remove the `showCacheTokens` option / `TokenSummaryOptions` type if it becomes empty
|
|
17
|
+
- Remove cache accumulation from `token-tracker.ts` (`mergeUsageData`, `accumulateUsage`, default objects)
|
|
18
|
+
- Remove cache fields from stream parsers that populate `UsageData` (`stream-renderer.ts`, `codex-stream-renderer.ts`)
|
|
19
|
+
- Remove `display` validation from config validator (`src/utils/config.ts`)
|
|
20
|
+
- Remove `display` section from config docs (`src/prompts/config-docs.md`)
|
|
21
|
+
- Remove `display` references from all example configs in docs
|
|
22
|
+
- Update `getShowCacheTokens()` call sites in `do.ts` — remove the option passing entirely
|
|
23
|
+
|
|
24
|
+
## Implementation Steps
|
|
25
|
+
1. **Update interfaces** (`src/types/config.ts`):
|
|
26
|
+
- Remove `cacheReadInputTokens` and `cacheCreationInputTokens` from `UsageData` interface
|
|
27
|
+
- Remove `cacheReadInputTokens` and `cacheCreationInputTokens` from `ModelTokenUsage` interface
|
|
28
|
+
- Remove `DisplayConfig` interface
|
|
29
|
+
- Remove `display` from `RafConfig` interface and `DEFAULT_CONFIG`
|
|
30
|
+
|
|
31
|
+
2. **Update token tracker** (`src/utils/token-tracker.ts`):
|
|
32
|
+
- Remove all `cacheReadInputTokens` and `cacheCreationInputTokens` references from `mergeUsageData()`
|
|
33
|
+
- Remove from `accumulateUsage()` default return
|
|
34
|
+
- Remove from `getTotals()` default return
|
|
35
|
+
|
|
36
|
+
3. **Update display formatting** (`src/utils/terminal-symbols.ts`):
|
|
37
|
+
- Remove cache display block from `formatTokenLine()` (lines 209-220)
|
|
38
|
+
- Remove `showCacheTokens` from `TokenSummaryOptions` — if it becomes empty, remove the type entirely
|
|
39
|
+
- Update JSDoc comments that reference cache display
|
|
40
|
+
|
|
41
|
+
4. **Update stream parsers** (`src/parsers/stream-renderer.ts`, `src/parsers/codex-stream-renderer.ts`):
|
|
42
|
+
- Remove cache field population when building `UsageData` objects
|
|
43
|
+
|
|
44
|
+
5. **Update do.ts** (`src/commands/do.ts`):
|
|
45
|
+
- Remove `getShowCacheTokens()` calls and the `showCacheTokens` option passing to formatters
|
|
46
|
+
- Remove any import of display config helpers
|
|
47
|
+
|
|
48
|
+
6. **Update claude-runner.ts** (`src/core/claude-runner.ts`):
|
|
49
|
+
- Remove any cache-related usage data handling
|
|
50
|
+
|
|
51
|
+
7. **Update config validator** (`src/utils/config.ts`):
|
|
52
|
+
- Remove `display` key validation
|
|
53
|
+
- Remove `showCacheTokens` validation
|
|
54
|
+
|
|
55
|
+
8. **Update config docs** (`src/prompts/config-docs.md`):
|
|
56
|
+
- Remove the `### display` section entirely
|
|
57
|
+
- Remove `display` from all example configs (especially the "Full" example)
|
|
58
|
+
- Remove `display.showCacheTokens` from the validation rules list
|
|
59
|
+
|
|
60
|
+
9. **Build and verify** — run `npm run build` to confirm no type errors remain
|
|
61
|
+
|
|
62
|
+
## Acceptance Criteria
|
|
63
|
+
- [ ] `UsageData` and `ModelTokenUsage` no longer contain cache fields
|
|
64
|
+
- [ ] `DisplayConfig` and `display` removed from config types and defaults
|
|
65
|
+
- [ ] Token summary output shows only: `Tokens: X in / Y out | Cost: $Z`
|
|
66
|
+
- [ ] No references to `cacheReadInputTokens`, `cacheCreationInputTokens`, or `showCacheTokens` remain in `src/`
|
|
67
|
+
- [ ] Config validator no longer accepts or validates a `display` key
|
|
68
|
+
- [ ] Config docs have no mention of cache tokens or `display` section
|
|
69
|
+
- [ ] Project builds cleanly (`npm run build`)
|
|
70
|
+
|
|
71
|
+
## Notes
|
|
72
|
+
- The cache fields originally came from Claude API responses. When removing them from the interfaces, the parsers that read API output will simply stop extracting those fields — the API may still return them but they'll be ignored.
|
|
73
|
+
- There are 9 files that reference cache/display fields. All must be updated in a single coherent pass.
|
package/README.md
CHANGED
|
@@ -48,14 +48,14 @@ That's it! RAF will guide you through breaking down your task and then execute i
|
|
|
48
48
|
## Requirements
|
|
49
49
|
|
|
50
50
|
- Node.js 20+
|
|
51
|
-
- Claude Code CLI installed and configured
|
|
52
|
-
- Or: OpenAI Codex CLI installed and configured (
|
|
51
|
+
- Claude Code CLI installed and configured
|
|
52
|
+
- Or: OpenAI Codex CLI installed and configured (set `harness` per model entry in config)
|
|
53
53
|
|
|
54
54
|
## Features
|
|
55
55
|
|
|
56
56
|
- **Interactive Planning**: Interviews you to break down complex tasks into structured plans
|
|
57
57
|
- **Smart Execution**: Automatic model selection, retry with escalation, and progress tracking
|
|
58
|
-
- **Multi-
|
|
58
|
+
- **Multi-Harness**: Use Claude Code CLI or OpenAI Codex CLI via per-model harness config
|
|
59
59
|
- **Resume & Amend**: Continue interrupted sessions or extend existing projects
|
|
60
60
|
- **Git Integration**: Automatic commits, worktree isolation, and PR generation
|
|
61
61
|
- **Task Dependencies**: Dependency tracking with automatic blocking on failure
|
|
@@ -71,7 +71,6 @@ Opens your `$EDITOR` to write a project description, then Claude will interview
|
|
|
71
71
|
raf plan # Create a new project
|
|
72
72
|
raf plan my-feature # Create with a specific name
|
|
73
73
|
raf plan --amend abcdef # Add tasks to existing project
|
|
74
|
-
raf plan --worktree # Plan in an isolated git worktree
|
|
75
74
|
```
|
|
76
75
|
|
|
77
76
|
#### `--amend` vs `--resume`
|
|
@@ -85,14 +84,16 @@ raf plan --worktree # Plan in an isolated git worktree
|
|
|
85
84
|
Execute project tasks. Without arguments, shows a picker to select a pending project.
|
|
86
85
|
|
|
87
86
|
```bash
|
|
88
|
-
raf do # Interactive picker
|
|
87
|
+
raf do # Interactive picker (includes worktree projects)
|
|
89
88
|
raf do abcdef # Execute by project ID
|
|
90
89
|
raf do my-project # Execute by name
|
|
91
|
-
raf do --worktree # Pick and execute a worktree project
|
|
92
|
-
raf do my-feature -w # Execute in worktree (picker will ask what to do after)
|
|
93
90
|
```
|
|
94
91
|
|
|
95
|
-
Note: In non-verbose mode, the
|
|
92
|
+
Note: In non-verbose mode, task lines show the resolved model in the existing parentheses slot and append reasoning effort and `fast` when configured, for example `● 01-auth-login (sonnet, low, fast) 12s`. Fast mode is Claude-only; if set on a Codex entry, RAF warns and ignores it.
|
|
93
|
+
|
|
94
|
+
Note: The completion summary reflects the tasks executed in that run (the remaining tasks at start), so the elapsed time maps to those tasks.
|
|
95
|
+
|
|
96
|
+
Note: Post-run token summaries now show exact input/output token counts for both Claude and Codex runs. Dollar cost is shown only when the provider reports an exact value, so current Codex summaries are token-only.
|
|
96
97
|
|
|
97
98
|
### `raf status`
|
|
98
99
|
|
|
@@ -105,12 +106,20 @@ raf status abcdef # Show details for a project (shows both main and worktree
|
|
|
105
106
|
|
|
106
107
|
### `raf config`
|
|
107
108
|
|
|
108
|
-
|
|
109
|
+
Read, write, reset, and edit RAF configuration. Configuration is stored at `~/.raf/raf.config.json`. All settings are optional — only set what you want to change.
|
|
109
110
|
|
|
110
111
|
```bash
|
|
111
|
-
raf config
|
|
112
|
-
raf config
|
|
113
|
-
raf config
|
|
112
|
+
raf config # Show config subcommands
|
|
113
|
+
raf config get # Print resolved config
|
|
114
|
+
raf config get models.execute # Print one resolved value
|
|
115
|
+
raf config set timeout 45 # Write a value
|
|
116
|
+
raf config reset # Reset config to defaults
|
|
117
|
+
raf config wizard # Interactive config editor
|
|
118
|
+
raf config wizard "use haiku for name generation" # Start with a specific request
|
|
119
|
+
raf config preset save claude-setup # Save current config as "claude-setup"
|
|
120
|
+
raf config preset load claude-setup # Restore "claude-setup" (overwrites current config)
|
|
121
|
+
raf config preset list # Show all saved presets
|
|
122
|
+
raf config preset delete claude-setup # Remove a preset
|
|
114
123
|
```
|
|
115
124
|
|
|
116
125
|
**Precedence**: CLI flags > config file > built-in defaults
|
|
@@ -119,51 +128,30 @@ Example `~/.raf/raf.config.json`:
|
|
|
119
128
|
|
|
120
129
|
```json
|
|
121
130
|
{
|
|
122
|
-
"provider": "claude",
|
|
123
131
|
"models": {
|
|
124
|
-
"execute": "sonnet",
|
|
125
|
-
"nameGeneration": "haiku"
|
|
132
|
+
"execute": { "model": "sonnet", "harness": "claude" },
|
|
133
|
+
"nameGeneration": { "model": "haiku", "harness": "claude" }
|
|
126
134
|
},
|
|
127
135
|
"worktree": true,
|
|
128
136
|
"timeout": 45
|
|
129
137
|
}
|
|
130
138
|
```
|
|
131
139
|
|
|
132
|
-
Run `raf config`
|
|
133
|
-
|
|
134
|
-
## Provider Configuration
|
|
135
|
-
|
|
136
|
-
RAF supports multiple LLM providers. The default is `claude` (Claude Code CLI). To use OpenAI Codex CLI, set `provider: "codex"` in your config or pass `--provider codex` on the command line.
|
|
140
|
+
Run `raf config wizard` and ask what's available — the session has full knowledge of every configurable option.
|
|
137
141
|
|
|
138
|
-
|
|
139
|
-
raf plan --provider codex # Plan using Codex
|
|
140
|
-
raf do --provider codex # Execute using Codex
|
|
141
|
-
```
|
|
142
|
+
## Harness Configuration
|
|
142
143
|
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
Models can be specified as plain aliases or with a provider prefix (`<provider>/<alias>`):
|
|
146
|
-
|
|
147
|
-
```bash
|
|
148
|
-
raf do -m opus # Claude: resolves to claude-opus-4-6
|
|
149
|
-
raf do -m claude/opus # Same as above, explicit prefix
|
|
150
|
-
raf do -m codex/gpt54 # Codex: resolves to gpt-5.4
|
|
151
|
-
raf do -m codex/gpt-5.4 # Codex: raw model ID
|
|
152
|
-
```
|
|
153
|
-
|
|
154
|
-
### Codex config
|
|
144
|
+
RAF supports multiple LLM harnesses per scenario. Each model entry in `models` and `effortMapping` specifies its own `harness`, so you can mix Claude and Codex freely:
|
|
155
145
|
|
|
156
146
|
```json
|
|
157
147
|
{
|
|
158
|
-
"
|
|
159
|
-
|
|
160
|
-
"execute": "codex"
|
|
161
|
-
"plan": "gpt54"
|
|
148
|
+
"models": {
|
|
149
|
+
"plan": { "model": "opus", "harness": "claude" },
|
|
150
|
+
"execute": { "model": "gpt-5.4", "harness": "codex" }
|
|
162
151
|
},
|
|
163
|
-
"
|
|
164
|
-
"low": "
|
|
165
|
-
"
|
|
166
|
-
"high": "gpt54"
|
|
152
|
+
"effortMapping": {
|
|
153
|
+
"low": { "model": "sonnet", "harness": "claude" },
|
|
154
|
+
"high": { "model": "gpt-5.4", "harness": "codex" }
|
|
167
155
|
}
|
|
168
156
|
}
|
|
169
157
|
```
|
|
@@ -171,6 +159,7 @@ raf do -m codex/gpt-5.4 # Codex: raw model ID
|
|
|
171
159
|
**Codex limitations:**
|
|
172
160
|
- `--resume` is not supported (Codex CLI has no session resume)
|
|
173
161
|
- System prompt is prepended to the user message rather than passed separately
|
|
162
|
+
- Post-run summaries currently include exact token counts but omit USD cost because Codex CLI does not provide an exact per-run price
|
|
174
163
|
|
|
175
164
|
## Status Symbols
|
|
176
165
|
|
|
@@ -205,11 +194,11 @@ Worktree mode runs planning and execution in an isolated git worktree, keeping y
|
|
|
205
194
|
### Basic workflow
|
|
206
195
|
|
|
207
196
|
```bash
|
|
208
|
-
# Plan in a worktree (
|
|
209
|
-
raf plan my-feature
|
|
197
|
+
# Plan in a worktree (enabled via config: "worktree": true)
|
|
198
|
+
raf plan my-feature
|
|
210
199
|
|
|
211
|
-
# Execute tasks in the worktree
|
|
212
|
-
raf do my-feature
|
|
200
|
+
# Execute tasks in the worktree (auto-detected, no flag needed)
|
|
201
|
+
raf do my-feature
|
|
213
202
|
```
|
|
214
203
|
|
|
215
204
|
### Post-execution picker
|
|
@@ -236,12 +225,12 @@ If `gh` is missing or unauthenticated, the option falls back to "Leave branch" w
|
|
|
236
225
|
|
|
237
226
|
### How it works
|
|
238
227
|
|
|
239
|
-
-
|
|
228
|
+
- When `worktree: true` is set in config, `raf plan` creates a git worktree at `~/.raf/worktrees/<repo>/<project>/` with a new branch named after the project folder (e.g., `abcdef-my-feature`)
|
|
240
229
|
- All planning artifacts, code changes, and commits happen in the worktree branch
|
|
230
|
+
- `raf do` auto-detects whether a project lives in a worktree — no flag needed
|
|
241
231
|
- After successful post-actions (merge, PR, or leave), the worktree directory is cleaned up automatically — the git branch is preserved
|
|
242
232
|
- On merge conflicts, the merge is aborted and you get instructions for manual resolution
|
|
243
233
|
- If tasks fail, the worktree is kept for inspection
|
|
244
|
-
- Use `--no-worktree` to disable worktree mode for a single invocation (useful when `worktree: true` is set in config)
|
|
245
234
|
|
|
246
235
|
## Command Reference
|
|
247
236
|
|
|
@@ -251,10 +240,6 @@ If `gh` is missing or unauthenticated, the option falls back to "Leave branch" w
|
|
|
251
240
|
|--------|-------------|
|
|
252
241
|
| `--amend <id>` | Add tasks to existing project |
|
|
253
242
|
| `-y, --auto` | Skip permission prompts (runs in dangerous mode) |
|
|
254
|
-
| `-p, --provider <name>` | LLM provider to use (`claude`, `codex`) |
|
|
255
|
-
| `-m, --model <name>` | Model to use (e.g. `opus`, `codex/gpt54`) |
|
|
256
|
-
| `-w, --worktree` | Create a git worktree for isolated planning |
|
|
257
|
-
| `--no-worktree` | Disable worktree mode (overrides config) |
|
|
258
243
|
|
|
259
244
|
### `raf do [project]`
|
|
260
245
|
|
|
@@ -263,21 +248,23 @@ If `gh` is missing or unauthenticated, the option falls back to "Leave branch" w
|
|
|
263
248
|
| `-t, --timeout <min>` | Timeout per task (default: 60) |
|
|
264
249
|
| `-f, --force` | Re-run all tasks regardless of status |
|
|
265
250
|
| `-d, --debug` | Save all logs and show debug output |
|
|
266
|
-
| `-p, --provider <name>` | LLM provider to use (`claude`, `codex`) |
|
|
267
|
-
| `-m, --model <name>` | Model to use (e.g. `sonnet`, `codex/gpt54`) |
|
|
268
|
-
| `--sonnet` | Shorthand for `--model sonnet` |
|
|
269
|
-
| `-w, --worktree` | Execute tasks in a git worktree |
|
|
270
|
-
| `--no-worktree` | Disable worktree mode (overrides config) |
|
|
271
251
|
|
|
272
252
|
Alias: `raf act`
|
|
273
253
|
|
|
274
254
|
> **Note:** `raf do` and `raf plan -y` run the CLI with skip-permissions flags for fully automated execution without interactive prompts.
|
|
275
255
|
|
|
276
|
-
### `raf config
|
|
256
|
+
### `raf config`
|
|
277
257
|
|
|
278
|
-
|
|
|
279
|
-
|
|
280
|
-
|
|
|
258
|
+
| Subcommand | Description |
|
|
259
|
+
|------------|-------------|
|
|
260
|
+
| `get [key]` | Show the resolved config or one resolved dot-notation value |
|
|
261
|
+
| `set <key> <value>` | Write a config value using a dot-notation key |
|
|
262
|
+
| `reset` | Delete the config file and restore defaults after confirmation |
|
|
263
|
+
| `wizard [prompt]` | Launch the interactive config editor |
|
|
264
|
+
| `preset save <name>` | Save current config as a named preset |
|
|
265
|
+
| `preset load <name>` | Load a preset (overwrites current config) |
|
|
266
|
+
| `preset list` | List all saved presets |
|
|
267
|
+
| `preset delete <name>` | Delete a preset |
|
|
281
268
|
|
|
282
269
|
### `raf status [identifier]`
|
|
283
270
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/commands/config.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/commands/config.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAmUpC,wBAAgB,mBAAmB,IAAI,OAAO,CA4C7C"}
|
package/dist/commands/config.js
CHANGED
|
@@ -6,8 +6,9 @@ import { Command } from 'commander';
|
|
|
6
6
|
import { createRunner } from '../core/runner-factory.js';
|
|
7
7
|
import { shutdownHandler } from '../core/shutdown-handler.js';
|
|
8
8
|
import { logger } from '../utils/logger.js';
|
|
9
|
-
import { getConfigPath,
|
|
9
|
+
import { getConfigPath, formatModelDisplay, getModel, validateConfig, collectConfigValidationWarnings, ConfigValidationError, resetConfigCache, resolveConfig, saveConfig, } from '../utils/config.js';
|
|
10
10
|
import { DEFAULT_CONFIG } from '../types/config.js';
|
|
11
|
+
import { createPresetCommand } from './preset.js';
|
|
11
12
|
/**
|
|
12
13
|
* Load the config documentation markdown from src/prompts/config-docs.md.
|
|
13
14
|
* Resolved relative to this file's location in the dist/ tree.
|
|
@@ -72,11 +73,11 @@ function postSessionValidation(configPath) {
|
|
|
72
73
|
catch (error) {
|
|
73
74
|
if (error instanceof ConfigValidationError) {
|
|
74
75
|
logger.warn(`Config validation warning: ${error.message}`);
|
|
75
|
-
logger.warn('The file was not deleted — you can fix it manually or run `raf config` again.');
|
|
76
|
+
logger.warn('The file was not deleted — you can fix it manually or run `raf config wizard` again.');
|
|
76
77
|
}
|
|
77
78
|
else if (error instanceof SyntaxError) {
|
|
78
79
|
logger.warn('Config file contains invalid JSON.');
|
|
79
|
-
logger.warn('The file was not deleted — you can fix it manually or run `raf config` again.');
|
|
80
|
+
logger.warn('The file was not deleted — you can fix it manually or run `raf config wizard` again.');
|
|
80
81
|
}
|
|
81
82
|
else {
|
|
82
83
|
logger.warn(`Could not validate config: ${error}`);
|
|
@@ -205,16 +206,14 @@ function formatValue(value) {
|
|
|
205
206
|
}
|
|
206
207
|
// ---- Config get/set handlers ----
|
|
207
208
|
/**
|
|
208
|
-
*
|
|
209
|
+
* Print config value(s).
|
|
209
210
|
*/
|
|
210
211
|
function handleGet(key) {
|
|
211
212
|
const config = resolveConfig();
|
|
212
|
-
if (key ===
|
|
213
|
-
// No key specified: print full config
|
|
213
|
+
if (key === undefined) {
|
|
214
214
|
console.log(JSON.stringify(config, null, 2));
|
|
215
215
|
return;
|
|
216
216
|
}
|
|
217
|
-
// Specific key requested
|
|
218
217
|
const value = getNestedValue(config, key);
|
|
219
218
|
if (value === undefined) {
|
|
220
219
|
logger.error(`Config key not found: ${key}`);
|
|
@@ -223,14 +222,9 @@ function handleGet(key) {
|
|
|
223
222
|
console.log(formatValue(value));
|
|
224
223
|
}
|
|
225
224
|
/**
|
|
226
|
-
*
|
|
225
|
+
* Update config file with a new value.
|
|
227
226
|
*/
|
|
228
|
-
function handleSet(
|
|
229
|
-
if (args.length !== 2) {
|
|
230
|
-
logger.error('--set requires exactly 2 arguments: key and value');
|
|
231
|
-
process.exit(1);
|
|
232
|
-
}
|
|
233
|
-
const [key, rawValue] = args;
|
|
227
|
+
function handleSet(key, rawValue) {
|
|
234
228
|
const value = parseValue(rawValue);
|
|
235
229
|
const configPath = getConfigPath();
|
|
236
230
|
// Read current user config (or start with empty)
|
|
@@ -265,7 +259,10 @@ function handleSet(args) {
|
|
|
265
259
|
}
|
|
266
260
|
// Validate the resulting config
|
|
267
261
|
try {
|
|
268
|
-
validateConfig(userConfig);
|
|
262
|
+
const validated = validateConfig(userConfig);
|
|
263
|
+
for (const warning of collectConfigValidationWarnings(validated)) {
|
|
264
|
+
logger.warn(`Config validation warning: ${warning}`);
|
|
265
|
+
}
|
|
269
266
|
}
|
|
270
267
|
catch (error) {
|
|
271
268
|
if (error instanceof ConfigValidationError) {
|
|
@@ -289,36 +286,37 @@ function handleSet(args) {
|
|
|
289
286
|
}
|
|
290
287
|
export function createConfigCommand() {
|
|
291
288
|
const command = new Command('config')
|
|
292
|
-
.description('
|
|
289
|
+
.description('Manage RAF configuration with get, set, reset, wizard, and preset subcommands')
|
|
290
|
+
.action(function () {
|
|
291
|
+
this.outputHelp();
|
|
292
|
+
});
|
|
293
|
+
command
|
|
294
|
+
.addCommand(new Command('get')
|
|
295
|
+
.description('Print the resolved config or one resolved dot-notation value')
|
|
296
|
+
.argument('[key]', 'Optional dot-notation key to read')
|
|
297
|
+
.action((key) => {
|
|
298
|
+
handleGet(key);
|
|
299
|
+
}))
|
|
300
|
+
.addCommand(new Command('set')
|
|
301
|
+
.description('Write a config value using a dot-notation key')
|
|
302
|
+
.argument('<key>', 'Dot-notation key to write')
|
|
303
|
+
.argument('<value>', 'Value to write; parsed as JSON when possible')
|
|
304
|
+
.action((key, value) => {
|
|
305
|
+
handleSet(key, value);
|
|
306
|
+
}))
|
|
307
|
+
.addCommand(new Command('reset')
|
|
308
|
+
.description('Delete the config file and restore all defaults')
|
|
309
|
+
.action(async () => {
|
|
310
|
+
await handleReset();
|
|
311
|
+
}))
|
|
312
|
+
.addCommand(new Command('wizard')
|
|
313
|
+
.description('Launch the interactive config editor session')
|
|
293
314
|
.argument('[prompt...]', 'Optional initial prompt for the config session')
|
|
294
|
-
.
|
|
295
|
-
.option('--get [key]', 'Show config value (all config if no key, or specific dot-notation key)')
|
|
296
|
-
.option('--set <items...>', 'Set a config value using dot-notation key and value')
|
|
297
|
-
.action(async (promptParts, options) => {
|
|
298
|
-
// --reset takes precedence
|
|
299
|
-
if (options.reset) {
|
|
300
|
-
await handleReset();
|
|
301
|
-
return;
|
|
302
|
-
}
|
|
303
|
-
// --get and --set are mutually exclusive
|
|
304
|
-
if (options.get !== undefined && options.set !== undefined) {
|
|
305
|
-
logger.error('Cannot use --get and --set together');
|
|
306
|
-
process.exit(1);
|
|
307
|
-
}
|
|
308
|
-
// Handle --get
|
|
309
|
-
if (options.get !== undefined) {
|
|
310
|
-
handleGet(options.get);
|
|
311
|
-
return;
|
|
312
|
-
}
|
|
313
|
-
// Handle --set
|
|
314
|
-
if (options.set !== undefined) {
|
|
315
|
-
handleSet(options.set);
|
|
316
|
-
return;
|
|
317
|
-
}
|
|
318
|
-
// Default: run interactive session
|
|
315
|
+
.action(async (promptParts) => {
|
|
319
316
|
const initialPrompt = promptParts.length > 0 ? promptParts.join(' ') : undefined;
|
|
320
317
|
await runConfigSession(initialPrompt);
|
|
321
|
-
})
|
|
318
|
+
}))
|
|
319
|
+
.addCommand(createPresetCommand());
|
|
322
320
|
return command;
|
|
323
321
|
}
|
|
324
322
|
async function handleReset() {
|
|
@@ -338,23 +336,23 @@ async function handleReset() {
|
|
|
338
336
|
async function runConfigSession(initialPrompt) {
|
|
339
337
|
const configPath = getConfigPath();
|
|
340
338
|
// Try to load config, but fall back to defaults if it's broken
|
|
341
|
-
// This allows raf config to be used to fix a broken config file
|
|
342
|
-
let
|
|
339
|
+
// This allows raf config wizard to be used to fix a broken config file
|
|
340
|
+
let modelEntry;
|
|
343
341
|
let configError = null;
|
|
344
342
|
try {
|
|
345
|
-
|
|
343
|
+
modelEntry = getModel('config');
|
|
346
344
|
}
|
|
347
345
|
catch (error) {
|
|
348
346
|
// Config file has errors - fall back to defaults so the session can launch
|
|
349
347
|
configError = error instanceof Error ? error : new Error(String(error));
|
|
350
|
-
|
|
348
|
+
modelEntry = DEFAULT_CONFIG.models.config;
|
|
351
349
|
// Clear the cached config so subsequent calls don't use the broken cache
|
|
352
350
|
resetConfigCache();
|
|
353
351
|
}
|
|
354
352
|
// Warn user if config has errors, before starting the session
|
|
355
353
|
if (configError) {
|
|
356
354
|
logger.warn(`Config file has errors, using defaults: ${configError.message}`);
|
|
357
|
-
logger.warn('Fix the config in this session or run `raf config
|
|
355
|
+
logger.warn('Fix the config in this session or run `raf config reset` to start fresh.');
|
|
358
356
|
logger.newline();
|
|
359
357
|
}
|
|
360
358
|
// Load config docs
|
|
@@ -373,10 +371,10 @@ async function runConfigSession(initialPrompt) {
|
|
|
373
371
|
const userMessage = initialPrompt
|
|
374
372
|
?? 'Show me my current config and help me make changes.';
|
|
375
373
|
// Set up runner
|
|
376
|
-
const claudeRunner = createRunner({ model });
|
|
374
|
+
const claudeRunner = createRunner({ model: modelEntry.model, harness: modelEntry.harness, reasoningEffort: modelEntry.reasoningEffort, fast: modelEntry.fast });
|
|
377
375
|
shutdownHandler.init();
|
|
378
376
|
shutdownHandler.registerClaudeRunner(claudeRunner);
|
|
379
|
-
const configModel =
|
|
377
|
+
const configModel = formatModelDisplay(modelEntry.model);
|
|
380
378
|
logger.info(`Starting config session with ${configModel}...`);
|
|
381
379
|
logger.newline();
|
|
382
380
|
try {
|