mirror of
https://github.com/yogeshojha/rengine.git
synced 2026-10-20 15:21:30 +02:00
The comment rule in CLAUDE.md is one line maximum, never narration: no multi-line blocks, no module-header explainers, no sentences that explain or justify the code to the reader. The tree had drifted a long way from it, and most of the drift is mine. Removed: 232 lines of multi-line comment blocks 203 single-line comments that argued instead of stating 154 comments joined by so/because/otherwise/rather-than 143 narrating comments in the frontend 112 test docstrings (the test name already says what it asserts) 25 test module docstrings and 25 decorative section dividers Collapsed: 324 multi-line docstrings to one factual line 271 one-line docstrings that had a justifying clause bolted on Kept: functional directives, section dividers, short field labels, alembic revision headers, and the eight FastAPI route docstrings that render in /docs. Where a fact was load-bearing it is in CLAUDE.md, which is where it belongs. 284 python tests and 34 frontend tests pass, ruff and ruff-format clean across ten packages, svelte-check 0 errors, prettier and eslint clean, app.main imports. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013dKUV96WkQQETZBMoAG98C
49 lines
1.6 KiB
Python
49 lines
1.6 KiB
Python
from __future__ import annotations
|
|
|
|
from collections.abc import Mapping
|
|
from dataclasses import dataclass, field
|
|
|
|
from shared.definitions.constants import DEFAULT_GLOBAL_THREADS
|
|
from shared.definitions.launch import (
|
|
DEFAULT_LAUNCH_INTENSITY,
|
|
MAX_LABEL_STAGES,
|
|
QUICK_SCAN_LABEL,
|
|
)
|
|
from shared.services.scan_resolve import ResolvedScanConfig
|
|
|
|
|
|
@dataclass(frozen=True)
|
|
class AdHocEngine:
|
|
"""Engine-shaped defaults for a launch that names no saved engine."""
|
|
|
|
name: str = QUICK_SCAN_LABEL
|
|
intensity: str = DEFAULT_LAUNCH_INTENSITY
|
|
global_threads: int = DEFAULT_GLOBAL_THREADS
|
|
global_http_crawl: bool = True
|
|
global_headers: tuple[str, ...] = ()
|
|
stages: Mapping[str, dict] = field(default_factory=dict)
|
|
tool_options: Mapping[str, str] = field(default_factory=dict)
|
|
id: None = None
|
|
|
|
|
|
def plan_label(resolved: ResolvedScanConfig) -> str:
|
|
"""Name an ad hoc run after the capabilities it runs."""
|
|
from shared.enums.scan import StageRole # noqa: PLC0415
|
|
from stages.registry import stages # noqa: PLC0415
|
|
|
|
running = [
|
|
spec
|
|
for spec in stages()
|
|
if resolved.target_type in spec.applies_to
|
|
and resolved.stage(spec.name).get("enabled")
|
|
]
|
|
picked = [s for s in running if s.role == StageRole.CAPABILITY.value]
|
|
titles = [spec.title for spec in (picked or running)]
|
|
if not titles:
|
|
return QUICK_SCAN_LABEL
|
|
if len(titles) == 1:
|
|
return titles[0]
|
|
if len(titles) <= MAX_LABEL_STAGES:
|
|
return f"{', '.join(titles[:-1])} and {titles[-1]}"
|
|
return f"{QUICK_SCAN_LABEL} · {len(titles)} stages"
|