mirror of
https://github.com/yogeshojha/rengine.git
synced 2026-10-20 23:31:31 +02:00
Tool descriptions were rhetorical questions and three-part rhythm, section
headings were "Where it lives" and "In your scans", empty states narrated
the absence to the reader, and values carried voice ("answers directly",
"a privacy service, not the owner", "none exists"). Rewritten as plain
declarative statements, noun-phrase headings and factual empty states.
Two structural fixes fell out of the pass. An unknown CVE stacked four
"No X cached" sections; it now prints the single note instead, because an
empty section is only worth showing when the sections around it have
content to contrast it with. The DNS answer code was stated twice, as a
fact row and again as a note; the note is gone.
GROUP_HELP was three narrated sentences that nothing rendered. Deleted
rather than reworded — unrendered copy is still copy that has to be right.
Docstrings and comments across the same files were swept in the same
register.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CtRcxFCPSYxW5sXam3SUWB
36 lines
1.0 KiB
Python
36 lines
1.0 KiB
Python
"""Links a result to the target reNgine already tracks for that value."""
|
|
|
|
from __future__ import annotations
|
|
|
|
from sqlmodel import select
|
|
|
|
from shared.definitions.toolbox import Pivot
|
|
from shared.models.target import Target
|
|
from toolbox.base import ToolContext
|
|
|
|
|
|
def _query(ctx: ToolContext, value: str):
|
|
return select(Target).where(
|
|
Target.project_id == ctx.project_id, Target.target_value == value
|
|
)
|
|
|
|
|
|
def _pivot(row: Target | None, value: str) -> Pivot | None:
|
|
if row is None:
|
|
return None
|
|
return Pivot(label=f"{value} is a target", href=f"/targets/{row.id}")
|
|
|
|
|
|
async def target_pivot(ctx: ToolContext, value: str) -> Pivot | None:
|
|
if ctx.project_id is None or not value:
|
|
return None
|
|
row = (await ctx.session.execute(_query(ctx, value))).scalars().first()
|
|
return _pivot(row, value)
|
|
|
|
|
|
def target_pivot_sync(ctx: ToolContext, value: str) -> Pivot | None:
|
|
if ctx.project_id is None or not value:
|
|
return None
|
|
row = ctx.session.execute(_query(ctx, value)).scalars().first()
|
|
return _pivot(row, value)
|