Skip to content

Phase 2: Suggest configuration system (.semfora/suggest.yaml) #140

@Kadajett

Description

@Kadajett

Context

Part of the --suggest recommendations engine (see #135). Depends on #137, #138.

What to Build

1. src/suggest/config.rsSuggestConfig

Load configuration from .semfora/suggest.yaml (fall back to defaults if absent):

pub struct SuggestConfig {
    pub rules: HashMap<String, RuleConfig>,    // per-rule enable/disable + thresholds
    pub groups: HashMap<String, bool>,          // group-level enable/disable
    pub confidence_threshold: f64,              // global minimum confidence (default: 0.0)
    pub scope: ScopeConfig,                     // include/exclude paths
    pub precommit: PrecommitConfig,             // pre-commit settings (used in Phase 4)
}

pub struct RuleConfig {
    pub enabled: bool,
    pub threshold: Option<f64>,  // rule-specific threshold override
}

pub struct ScopeConfig {
    pub include: Vec<String>,    // glob patterns
    pub exclude: Vec<String>,    // glob patterns
}

2. Config file format

.semfora/suggest.yaml:

rules:
  combine-functions: true
  dead-code: true
  complexity-reduction:
    enabled: true
    threshold: 15
  rename-for-discoverability: false

groups:
  naming: false

confidence_threshold: 0.7

scope:
  include: ["src/"]
  exclude: ["src/generated/", "vendor/"]

3. Integration

  • SuggestEngine::new() loads config from .semfora/suggest.yaml if present
  • Rules check config.rules[name].enabled and config.groups[group] before evaluating
  • Scope filtering: skip symbols outside scope.include / inside scope.exclude
  • semfora config suggest --init generates a default config file

4. CLI overrides

  • --suggest-confidence 0.8 to override confidence threshold from CLI
  • --suggest-group duplicates to run only one group

Acceptance Criteria

  • Config loads from .semfora/suggest.yaml with serde
  • Missing config file = all defaults (everything enabled, threshold 0.0)
  • Individual rule enable/disable works
  • Group enable/disable works
  • Confidence threshold filtering works
  • Scope include/exclude filters symbols correctly
  • semfora config suggest --init creates default config
  • Unit tests for config parsing, including partial configs

References

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions