Class: RubynCode::CLI::Commands::Tokens

Inherits:
Base
  • Object
show all
Defined in:
lib/rubyn_code/cli/commands/tokens.rb

Defined Under Namespace

Classes: TokenStats

Constant Summary collapse

CONTEXT_WINDOW =

Claude’s context window

200_000

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

aliases, all_names, hidden?

Class Method Details

.command_nameObject



7
# File 'lib/rubyn_code/cli/commands/tokens.rb', line 7

def self.command_name = '/tokens'

.descriptionObject



8
# File 'lib/rubyn_code/cli/commands/tokens.rb', line 8

def self.description = 'Show token usage and context window estimate'

Instance Method Details

#execute(_args, ctx) ⇒ Object



19
20
21
22
23
24
# File 'lib/rubyn_code/cli/commands/tokens.rb', line 19

def execute(_args, ctx)
  stats = gather_stats(ctx)
  render_estimation(stats)
  render_actual_usage(stats)
  warn_if_near_threshold(stats, ctx.renderer)
end