feat: Add --config-path option for flexible config file management#138
feat: Add --config-path option for flexible config file management#138Shazwazza wants to merge 2 commits intomichaelshimeles:mainfrom
Conversation
|
@Shazwazza is attempting to deploy a commit to the Goshen Labs Team on Vercel. A member of the Team first needs to authorize it. |
Greptile OverviewGreptile SummaryThis PR adds a Key Changes:
Issues Found:
Confidence Score: 3/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant User
participant CLI as cli/index.ts
participant Args as cli/args.ts
participant Config as config/loader.ts
participant Run as commands/run.ts
participant Sequential as execution/sequential.ts
participant Prompt as execution/prompt.ts
participant Engine as AI Engine
User->>CLI: ralphy --config-path custom.yaml "task"
CLI->>Args: parseArgs()
Args->>Args: Parse --config-path option
Args-->>CLI: Return configPath in options
alt Single Task Mode
CLI->>Run: runTask(task, options)
Run->>Config: loadConfig(workDir, configPath)
Config-->>Run: Return config
Run->>Prompt: buildPrompt({..., configPath, config})
Prompt->>Prompt: Use pre-loaded config (avoid disk I/O)
Prompt-->>Run: Return prompt
Run->>Engine: execute(prompt)
Engine-->>Run: Task result
else Loop Mode
CLI->>Run: runLoop(options)
Run->>Config: loadConfig(workDir, configPath)
Config-->>Run: Initial config
Run->>Sequential: runSequential({..., configPath})
loop Each Task Iteration
Sequential->>Config: loadConfig(workDir, configPath)
Note over Sequential,Config: Load once per iteration (was 3x)
Config-->>Sequential: Return config
Sequential->>Prompt: buildPrompt({..., configPath, config})
Prompt->>Prompt: Use pre-loaded config
Prompt-->>Sequential: Return prompt
Sequential->>Engine: execute(prompt)
Engine-->>Sequential: Task result
end
end
|
| @@ -38,6 +38,9 @@ export async function runTask(task: string, options: RuntimeOptions): Promise<vo | |||
| logInfo("Browser automation enabled (agent-browser)"); | |||
| } | |||
|
|
|||
| // Load config once for the task | |||
| const taskConfig = loadConfig(workDir, options.configPath); | |||
There was a problem hiding this comment.
Config loaded twice unnecessarily (lines 20 and 42). Remove the first load since taskConfig at line 42 is used in buildPrompt.
| const workDir = process.cwd(); | |
| // Set verbose mode |
Prompt To Fix With AI
This is a comment left during a code review.
Path: cli/src/cli/commands/task.ts
Line: 20:42
Comment:
Config loaded twice unnecessarily (lines 20 and 42). Remove the first load since `taskConfig` at line 42 is used in `buildPrompt`.
```suggestion
const workDir = process.cwd();
// Set verbose mode
```
How can I resolve this? If you propose a fix, please make it concise.
Additional Comments (2)
The Prompt To Fix With AIThis is a comment left during a code review.
Path: cli/src/cli/args.ts
Line: 60:60
Comment:
Missing `.option()` definition for `--config-path`
The `--config-path` option is accessed at line 164 but never defined in the Commander program. Add the option definition:
```suggestion
.option("--config-path <path>", "Path to config file (default: .ralphy/config.yaml)")
.allowUnknownOption();
```
How can I resolve this? If you propose a fix, please make it concise.
The function accepts Prompt To Fix With AIThis is a comment left during a code review.
Path: cli/src/cli/commands/config.ts
Line: 73:73
Comment:
`configPath` parameter ignored when adding rule
The function accepts `configPath` parameter but always uses default path. This breaks the feature for custom config files.
```suggestion
addConfigRule(rule, workDir, configPath);
```
How can I resolve this? If you propose a fix, please make it concise. |
|
@michaelshimeles is -add-rule and --config options something you want to keep? i.e. why not just edit the file? |
Summary
Adds a --config-path CLI option that allows users to specify custom configuration file paths, enabling
flexible config management across different projects and environments.
Problem
Previously, Ralphy only supported loading configuration from a statically-defined .ralphy/config.yaml
file. This prevented users from:
Solution
Implemented a --config-path CLI option that:
config updates during execution
Usage Examples
Performance Optimization
Before: Config file was read from disk and parsed 3 times per iteration (once each for project
context, rules, and boundaries)
After: Config is loaded once at the start of each iteration and passed through to buildPrompt(). This:
Testing
Backward Compatibility
✅ Fully backward compatible - All existing usage patterns continue to work without any changes. The
--config-path option is completely optional.