Class: SpaceArchitect::Harness::ClaudeCodeHarness
- Inherits:
-
Object
- Object
- SpaceArchitect::Harness::ClaudeCodeHarness
- Defined in:
- lib/space_architect/harness.rb
Constant Summary collapse
- ALLOWED_TOOLS =
"Read,Edit,Write,Grep,Glob,Bash,WebSearch,WebFetch"- DISALLOWED_TOOLS =
[ "Bash(git commit:*)", "Bash(git push:*)", "Bash(git reset:*)", "Bash(git merge:*)", "Bash(git rebase:*)", "Bash(git checkout:*)", "Bash(git branch:*)" ].join(",")
Instance Method Summary collapse
-
#initialize(model:, max_turns:, bin: nil) ⇒ ClaudeCodeHarness
constructor
A new instance of ClaudeCodeHarness.
- #run(prompt_path:, run_log_path:, chdir:) ⇒ Object
Constructor Details
#initialize(model:, max_turns:, bin: nil) ⇒ ClaudeCodeHarness
Returns a new instance of ClaudeCodeHarness.
44 45 46 47 48 |
# File 'lib/space_architect/harness.rb', line 44 def initialize(model:, max_turns:, bin: nil) @model = model @max_turns = max_turns @bin = bin || ENV.fetch("ARCHITECT_CLAUDE_BIN", "claude") end |
Instance Method Details
#run(prompt_path:, run_log_path:, chdir:) ⇒ Object
50 51 52 53 54 55 56 57 58 59 60 61 62 |
# File 'lib/space_architect/harness.rb', line 50 def run(prompt_path:, run_log_path:, chdir:) prompt_path = Pathname.new(prompt_path) run_log_path = Pathname.new(run_log_path) File.open(prompt_path, "r") do |prompt_io| File.open(run_log_path, "w") do |log| status = Sync do Async::Process.spawn(*argv, chdir: chdir.to_s, in: prompt_io, out: log, err: log) end status.exitstatus end end end |