Update cli to handle multi-file optimization#112
Merged
aliroberts merged 1 commit intodevfrom Feb 17, 2026
Merged
Conversation
f1f67db to
b6ffcb2
Compare
b6ffcb2 to
2124adb
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Multi-file optimization support
Extends the CLI to optimize across multiple source files in a single run, while remaining fully backwards-compatible with the existing single-file (
-s/--source) workflow.Changes
CLI (
cli.py)--sourcesflag (mutually exclusive with-s/--source) accepting multiple file paths.list[str]before passing downstream.Optimizer (
optimizer.py)dict[str, str](path -> content) throughout the optimization loop and resume flow.RunArtifactsmanager._offer_apply_best_solutionwrites back all modified files and displays which paths changed.Artifacts (
artifacts.py) — newRunArtifactsclass that owns the on-disk layout under.runs/<run_id>/.steps/<n>/files/+manifest.json), best snapshot (best/), and execution output (outputs/+exec_output.jsonl)._sanitize_artifact_path) strips traversal components, absolute prefixes, and Windows drive letters.Utils (
utils.py)run_evaluation_with_files_swap()— atomically swaps multiple files before evaluation and restores originals in afinallyblock.Validation (
validation.py)validate_source_files()with per-file size (200 KB), total size (500 KB), file count (10), and duplicate-path checks.validate_sources()dispatcher that routes single vs. multi-file input.API (
api.py)start_optimization_runsignature:source_codeacceptsstr | dict[str, str],source_pathacceptsstr | None.Tests (
test_artifacts.py) — new