Skip to content

[FEATURE] Configuration system overhaul — multi-layer YAML + .codelensignore + multi-format #55

Description

@Wolfvin

Summary

Replace flat JSON config (.codelens/codelens.config.json) with a 6-layer YAML system (global → CLI → project → local → context → mode), add .codelensignore (gitignore-style), and support multiple config formats (YAML/TOML/JSON5/Python). Auto-migrate from existing JSON.

Worker consensus (6 reports)

Worker Source Contribution
Serena update!/CodeLens_vs_Serena_Upgrade_Analysis.md S11 6-layer config: global (~/.codelens/config.yml) → CLI flags → project (.codelens/project.yml) → local override (.codelens/project.local.yml, gitignored) → context (per-AI-client) → mode (composable fragment). YAML format (comments, multi-line strings). codelens config show (effective merged), --source (per-key source).
Serena same file S7 Modes system — 9 composable YAML fragments: onboarding, editing, planning, interactive, one-shot, no-memories, etc. codelens mode <name,list>. Affects command availability + system prompt.
Serena same file S8 Contexts system — 14 per-AI-client YAML: claude-code, codex, cursor, vscode, etc. Auto-detect from env vars.
Emerge update!/CodeLens_Upgrade_Issues_from_Emerge.md CL-023 YAML project config with multi-analysis: analyses: [analysis_name, source_directory, only_permit_languages, ...]. 6 templates: security-audit, quality-gate, architecture-review, ai-onboarding, ci-minimal, full-scan. codelens migrate-config converts JSON.
Repomix update!/CodeLens_vs_Repomix_Upgrade_Analysis.md R13 Multi-format config: codelens.config.{jsonc,json5,toml,py} with priority .py > .toml > .json5 > .jsonc > .json. define_config() Python helper. --trust-python-config flag for security.
UBS update!/CodeLens_UBS_Upgrade_Analysis.md #2 .codelensignore gitignore-style file — 3-tier: workspace .codelensignore → user ~/.codelensignore → builtin scripts/data/default-codelensignore. ** recursive, */? wildcards, ! negation. --suggest-ignore flag.
Opengrep update!/CodeLens_Opengrep_Upgrade_Analysis.md #52 .codelensignore (same as UBS #2). Use pathspec PyPI package.
CodeGraph update!/CodeLens_CodeGraph_Upgrade_Analysis.md #25 codelens.json config with exclude (gitignore-style) + extensions (custom file extension → language mapping).

Proposed scope (P1, 4-6 weeks total)

Phase 1 — .codelensignore (P1, 3-5 days, quick win)

  • 3-tier: workspace .codelensignore → user ~/.codelensignore → builtin scripts/data/default-codelensignore
  • Use pathspec PyPI package (gitignore-spec compliant)
  • Replace hardcoded DEFAULT_IGNORE_DIRS in utils.py
  • --codelensignore-filename <name> flag for custom filename
  • --suggest-ignore flag prints top-10 largest directories that might need ignoring
  • New file: scripts/codelensignore.py, scripts/data/default-codelensignore

Phase 2 — Multi-format config loader (P1, 1-2 weeks)

  • Support: .codelens/codelens.config.{yml,yaml,jsonc,json5,toml,py} (priority: .py > .toml > .json5 > .jsonc > .json > .yml)
  • tomllib (Python 3.11+ stdlib) or tomli for TOML
  • json5 package for JSON5
  • importlib.util.spec_from_file_location() for .py config (requires --trust-python-config flag for security)
  • Auto-migrate existing .codelens/codelens.config.json to YAML on first codelens init after upgrade

Phase 3 — Multi-layer merge (P1, 2 weeks)

  • 6 layers (Serena S11): global → CLI → project → local → context → mode
  • codelens config show (effective merged config)
  • codelens config show --source (per-key source attribution)
  • codelens config init --global (initialize global config)
  • Backward compat: existing .codelens/codelens.config.json auto-loaded as project layer

Phase 4 — Modes system (P2, 1-2 weeks, depends on Phase 3)

  • 9 built-in modes: onboarding, editing, planning, interactive, one-shot, no-memories, no-onboarding, query-projects, mode.template
  • Each mode YAML has: description, prompt, excluded_commands, included_optional_commands
  • codelens mode <name> / codelens mode list / codelens mode show <name>
  • Composable: codelens mode onboarding,interactive
  • Custom mode at .codelens/modes/custom.yml

Phase 5 — Contexts system (P2, 2 weeks, depends on Phase 3)

  • 14 built-in contexts: claude-code, codex, cursor, vscode, ide, copilot-cli, chatgpt, antigravity, jb-ai-assistant, jb-copilot-plugin, junie, agent, oaicompat-agent, desktop-app
  • Auto-detect from env vars (CLAUDE_CODE=true, CURSOR=true, etc.)
  • Custom context at .codelens/contexts/custom.yml

Phase 6 — Multi-analysis config (P2, 1-2 weeks, depends on Phase 3)

  • analyses: field in project config
  • 6 templates: security-audit, quality-gate, architecture-review, ai-onboarding, ci-minimal, full-scan
  • codelens analyze -c <yaml> (all analyses) or --analysis-name <name> (single)
  • codelens init --template <name> scaffolds from template

Acceptance criteria

  • .codelensignore works with all gitignore syntax (**, *, ?, !, #)
  • Config can be in any of 6 formats, auto-detected by extension
  • 6-layer merge produces correct effective config
  • codelens config show --source shows which layer each key came from
  • Modes affect command availability (e.g. no-memories mode hides memory commands)
  • Contexts auto-detect from env vars
  • Existing JSON config auto-migrated without data loss

Files

  • New: scripts/codelensignore.py, scripts/config_loader.py, scripts/mode_manager.py, scripts/context_manager.py, scripts/data/default-codelensignore, scripts/modes/*.yml, scripts/contexts/*.yml, scripts/configs/templates/*.yml
  • Update: scripts/utils.py (remove DEFAULT_IGNORE_DIRS), scripts/commands/init.py, references/configuration.md

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions