Module: Crimson

Defined in:
lib/crimson.rb,
lib/crimson/repl.rb,
lib/crimson/agent.rb,
lib/crimson/setup.rb,
lib/crimson/config.rb,
lib/crimson/message.rb,
lib/crimson/version.rb,
lib/crimson/compactor.rb,
lib/crimson/formatter.rb,
lib/crimson/providers.rb,
lib/crimson/tools/glob.rb,
lib/crimson/client/base.rb,
lib/crimson/tools/index.rb,
lib/crimson/agent/events.rb,
lib/crimson/cost_tracker.rb,
lib/crimson/skill_router.rb,
lib/crimson/tools/schema.rb,
lib/crimson/retry_handler.rb,
lib/crimson/session_entry.rb,
lib/crimson/token_counter.rb,
lib/crimson/tool_registry.rb,
lib/crimson/trust_manager.rb,
lib/crimson/agent/steering.rb,
lib/crimson/client/factory.rb,
lib/crimson/output_handler.rb,
lib/crimson/project_context.rb,
lib/crimson/session_manager.rb,
lib/crimson/tools/diff_util.rb,
lib/crimson/tools/edit_file.rb,
lib/crimson/tools/read_file.rb,
lib/crimson/tools/truncator.rb,
lib/crimson/tools/write_file.rb,
lib/crimson/tools/run_command.rb,
lib/crimson/tools/search_files.rb,
lib/crimson/agent/event_emitter.rb,
lib/crimson/agent/tool_executor.rb,
lib/crimson/tools/list_directory.rb,
lib/crimson/client/openai_adapter.rb,
lib/crimson/client/anthropic_adapter.rb,
lib/crimson/tools/file_mutation_queue.rb

Defined Under Namespace

Modules: Client, Formatter, Message, RetryHandler, Tools Classes: AbortSignal, Agent, Compactor, Config, CostTracker, Error, OutputHandler, ProjectContext, Repl, SessionEntry, SessionManager, SessionMeta, Setup, SkillRouter, TokenCounter, ToolRegistry, TrustManager

Constant Summary collapse

CONFIG_DIR =

Directory for Crimson configuration files.

File.join(Dir.home, ".crimson")
CONFIG_FILE =

Path to the JSON configuration file.

File.join(CONFIG_DIR, "config.json")
SKILLS_DIR =

Directory for user skill markdown files.

File.join(CONFIG_DIR, "skills")
VERSION =

Current version of the Crimson gem.

"0.1.1"
PROVIDERS =

Provider definitions including base URLs, SDK type, and auth header builders. Each entry maps a provider symbol to its configuration hash.

Hash[Symbol, Hash]
MODELS_ENDPOINT =

Endpoint path suffix appended to provider base URLs to fetch available models.

"/models"
MODEL_PRICING =

Model pricing in USD per million tokens.

Hash[String, Hash]

Class Method Summary collapse

Class Method Details

.configConfig

Returns the global configuration (loaded once, cached).

Returns:

  • (Config)

    the global configuration (loaded once, cached)



42
43
44
# File 'lib/crimson.rb', line 42

def self.config
  @config ||= Crimson::Config.load
end

.config_dirString

Returns path to the config directory.

Returns:

  • (String)

    path to the config directory



47
48
49
# File 'lib/crimson.rb', line 47

def self.config_dir
  CONFIG_DIR
end

.configured?Boolean

Returns whether the config file exists.

Returns:

  • (Boolean)

    whether the config file exists



52
53
54
# File 'lib/crimson.rb', line 52

def self.configured?
  File.exist?(CONFIG_FILE)
end