Class: Rigor::CLI::ProjectStateProbe

Inherits:
Object
  • Object
show all
Defined in:
lib/rigor/cli/skill_describe.rb

Overview

The presence-only project-state probe behind ‘rigor skill describe` (ADR-73 WD2). It stats files and opens only config / CI / lockfiles — it runs no analysis — so it is cheap and side-effect-free, and an agent can run it freely at any point. Split from SkillDescribe so the routing/rendering class stays focused.

Constant Summary collapse

CONFIG_FILENAMES =

Config / baseline filenames the probe stats for. ‘CONFIG_FILENAMES` mirrors `Configuration::DISCOVERY_ORDER` (developer-local override first, committed default second) so the probe agrees with what `rigor check` would auto-discover.

%w[.rigor.yml .rigor.dist.yml].freeze
BASELINE_FILENAME =
".rigor-baseline.yml"
RBS_COLLECTION_LOCKFILE =

‘rbs collection install`’s lockfile — Rigor auto-detects it at the project root and feeds each gem’s community RBS into the signature paths, so its presence is the signal that the gem-RBS gap has been addressed.

"rbs_collection.lock.yaml"
RAILS_LOCK_MARKERS =

‘Gemfile.lock` substrings that mark a Rails app, and the bundled Rails-family plugin ids — used to spot a configured Rails project that has not enabled any Rails plugin (a `rigor-plugin-tune` cue).

%w[railties actionpack activerecord actioncable].freeze
RAILS_PLUGIN_MARKERS =
%w[
  rigor-activerecord rigor-actionpack rigor-actionmailer rigor-activejob
  rigor-rails-routes rigor-rails-i18n rigor-actioncable rigor-activestorage rigor-rails
].freeze

Instance Method Summary collapse

Constructor Details

#initialize(root) ⇒ ProjectStateProbe

Returns a new instance of ProjectStateProbe.



34
35
36
# File 'lib/rigor/cli/skill_describe.rb', line 34

def initialize(root)
  @root = root
end

Instance Method Details

#to_hHash

Returns the presence-only state the recommendation routes on.

Returns:

  • (Hash)

    the presence-only state the recommendation routes on.



39
40
41
42
43
44
45
46
47
48
49
50
51
52
# File 'lib/rigor/cli/skill_describe.rb', line 39

def to_h
  config = CONFIG_FILENAMES.find { |name| File.file?(File.join(@root, name)) }
  {
    config: config,
    baseline: File.file?(File.join(@root, BASELINE_FILENAME)),
    sig: File.directory?(File.join(@root, "sig")),
    gems: File.file?(File.join(@root, "Gemfile.lock")),
    rbs_collection: File.file?(File.join(@root, RBS_COLLECTION_LOCKFILE)),
    rails_unconfigured: rails_unconfigured?(config),
    ci: ci_state,
    editor: editor_state,
    mcp: mcp_state
  }
end