Skip to content

feat(console): form editor for argus.yml (Configure screen)#264

Merged
eFAILution merged 1 commit into
feat/tui-explorer-and-scan-runnerfrom
feat/console-config-editor
Jun 13, 2026
Merged

feat(console): form editor for argus.yml (Configure screen)#264
eFAILution merged 1 commit into
feat/tui-explorer-and-scan-runnerfrom
feat/console-config-editor

Conversation

@eFAILution

Copy link
Copy Markdown
Collaborator

Description

Phase 2 of the Console roadmap: a form editor for argus.yml. The home menu's Configure entry now opens an in-app ConfigScreen instead of shelling out to $EDITOR. This PR targets the Console integration branch (feat/tui-explorer-and-scan-runner, PR #261), not main — it merges in once green so the full Console can be reviewed as one solution.

Changes Made

  • Modified existing scanner/workflow
  • Updated documentation
  • Added new scanner/workflow
  • Fixed bug
  • Other (please specify): new Console screen + UI-free edit core

Details

  • ConfigScreen (argus/viewers/terminal/console.py): lists editable settings as an OptionList with current value + a one-line description. enter cycles a value, s validates + writes, esc discards. When no argus.yml exists it nudges toward Initialize and falls back to $EDITOR/$VISUAL.
  • config_editor.py (new, argus/viewers/terminal/): UI-free, textual-free edit core so it's covered in CI without the [terminal] extra.
    • editable_rows → scanner enabled toggles + bounded choice settings (severity_threshold, execution backend/pull_policy, view cve_source/open_location).
    • set_valuecomment-preserving targeted line rewrite: walks the file indentation-aware to the matched key: value line and rewrites only its value, keeping key, indentation, and any trailing inline comment.
    • validate → re-parses and runs argus.core.schema.validate_config, refusing save on any error-level issue.
  • Roadmap decision resolved: the open "YAML write-back" question is answered in favour of targeted line edits over a ruamel.yaml round-trip — no new dependency, at the cost of only editing settings already present in the file.
  • No breaking changes. The $EDITOR path is preserved as the fallback for the no-config and free-text cases.

Testing

  • Unit tests added/updated
  • Integration tests added/updated
  • Manual testing performed

Test Results

  • test_config_editor.py (new): 22 tests covering editable-row parsing, comment-/indentation-preserving edits, toggle/enum cycling, and validation.
  • test_console.py (updated): Configure now routes through _open_config — covers both the "opens ConfigScreen when argus.yml present" and "falls back to $EDITOR when absent" paths, plus ConfigScreen construction.
  • Full suite: 4031 passed, 21 skipped, coverage 92.58% (≥80% gate met). The 3 local-only viewers/browser failures are the known pre-existing fastapi-0.136.1 template diffs (green in CI), unrelated to this change.

Security Considerations

  • No security impact

Security Details

Edits are bounded to a fixed set of toggle/enum scalars and validated against the config schema before write. No code execution; the $EDITOR fallback is unchanged from prior behaviour.

AI Context Updates (.ai/)

  • .ai/architecture.yaml updated (Configure form editor + config_editor.py noted under viewers/terminal/)
  • .ai/workflows.yaml updated
  • .ai/decisions.yaml updated
  • .ai/errors.yaml updated

Checklist

  • Code follows project style guidelines
  • Documentation updated (docs/console.md Configure section, docs/developer/CONSOLE-ROADMAP.md Phase 2 → shipped)
  • Changelog updated (handled at release)
  • All tests pass
  • Reviewed by at least one maintainer
  • Reviewed CONTRIBUTING.md guidelines

Related Issues

Part of the Console epic (docs/developer/CONSOLE-ROADMAP.md, Phase 2).

Screenshots/Logs (if applicable)

Console form editor is keyboard-driven (↑↓ move · enter change · s save · esc cancel). Home-screen + settings screenshots are in PR #261 / #262.

Phase 2 of the Console roadmap. The home menu's Configure entry now opens
a form editor (ConfigScreen) instead of shelling out to $EDITOR: scanner
on/off toggles and the bounded choice settings (severity_threshold,
execution backend/pull_policy, view cve_source/open_location) are listed
with their current value and a one-line description; enter cycles a value,
s validates + writes, esc discards.

Edits go through config_editor.py — a UI-free, textual-free module so it's
covered in CI without the [terminal] extra. Write-back is comment-preserving:
set_value walks the file indentation-aware to the matched key: value line and
rewrites only its value, keeping key, indentation, and any trailing inline
comment. This resolves the roadmap's open YAML write-back decision in favour
of targeted line edits over a ruamel.yaml round-trip — no new dependency, at
the cost of only editing settings already present in the file. Before saving,
the result is re-validated against argus.core.schema.validate_config and
refused on any error-level issue.

When no argus.yml exists, Configure nudges toward Initialize and falls back
to $EDITOR/$VISUAL so a file can still be created by hand.
@codecov

codecov Bot commented Jun 13, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 93.63636% with 7 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
argus/viewers/terminal/config_editor.py 92.78% 7 Missing ⚠️

📢 Thoughts on this report? Let us know!

@eFAILution eFAILution merged commit 5e12dc4 into feat/tui-explorer-and-scan-runner Jun 13, 2026
19 of 21 checks passed
@eFAILution eFAILution deleted the feat/console-config-editor branch June 13, 2026 12:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant