Class: RubynCode::CLI::Commands::Goal
- Inherits:
-
Base
- Object
- Base
- RubynCode::CLI::Commands::Goal
show all
- Defined in:
- lib/rubyn_code/cli/commands/goal.rb
Overview
‘/goal` — set a session goal that Rubyn keeps working toward until it is met. Installs a Stop hook (Hooks::GoalHook) that blocks the agent from finishing while the goal is unmet; the goal auto-clears once an evaluator judges it satisfied.
/goal <condition> set a goal and start working toward it
/goal show the current goal (if any)
/goal clear cancel the active goal early
Constant Summary
collapse
- CLEAR_WORDS =
%w[clear cancel off stop].freeze
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Base
aliases, all_names, hidden?
Class Method Details
.command_name ⇒ Object
15
|
# File 'lib/rubyn_code/cli/commands/goal.rb', line 15
def self.command_name = '/goal'
|
.description ⇒ Object
16
|
# File 'lib/rubyn_code/cli/commands/goal.rb', line 16
def self.description = 'Set a goal Rubyn works toward until met (/goal clear to cancel)'
|
Instance Method Details
#execute(args, ctx) ⇒ Object
20
21
22
23
24
25
26
27
28
|
# File 'lib/rubyn_code/cli/commands/goal.rb', line 20
def execute(args, ctx)
first = args.first&.strip&.downcase
return clear_goal(ctx) if CLEAR_WORDS.include?(first)
condition = args.join(' ').strip
return show_status(ctx) if condition.empty?
set_goal(ctx, condition)
end
|