Class: RubynCode::CLI::Commands::Loop
- Inherits:
-
Base
- Object
- Base
- RubynCode::CLI::Commands::Loop
show all
- Defined in:
- lib/rubyn_code/cli/commands/loop.rb
Overview
‘/loop` — run a prompt or slash command repeatedly, mirroring Claude Code’s /loop. Either on a fixed interval, or self-paced (the agent decides when the recurring task is done).
/loop 5m /review run /review every 5 minutes
/loop 30s check the deploy send a prompt every 30 seconds
/loop x10 5m /babysit-prs ...at most 10 times
/loop keep triaging issues self-paced (until the agent emits LOOP_DONE)
Returns a :run_loop action; the REPL owns the actual loop so Ctrl-C stops it cleanly and slash payloads can be re-dispatched.
Constant Summary
collapse
- MAX_TOKEN =
/\Ax(\d+)\z/i
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Base
aliases, all_names, hidden?
Class Method Details
.command_name ⇒ Object
18
|
# File 'lib/rubyn_code/cli/commands/loop.rb', line 18
def self.command_name = '/loop'
|
.description ⇒ Object
19
|
# File 'lib/rubyn_code/cli/commands/loop.rb', line 19
def self.description = 'Repeat a prompt or slash command on an interval (/loop 5m /review)'
|
Instance Method Details
#execute(args, ctx) ⇒ Object
23
24
25
26
27
28
29
30
31
32
|
# File 'lib/rubyn_code/cli/commands/loop.rb', line 23
def execute(args, ctx)
return usage(ctx) if args.empty?
max, rest = (args)
interval = LoopRunner.parse_interval(rest.first)
payload = (interval ? rest[1..] : rest).join(' ').strip
return usage(ctx) if payload.empty?
{ action: :run_loop, interval: interval, max: max, payload: payload }
end
|