mirror of
https://github.com/yogeshojha/rengine.git
synced 2026-10-18 22:33:24 +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
72 lines
2.1 KiB
Python
Executable File
72 lines
2.1 KiB
Python
Executable File
#!/usr/bin/env python3
|
|
"""Regenerate tools/data/content.txt from SecLists' web-content discovery list."""
|
|
|
|
from __future__ import annotations
|
|
|
|
import argparse
|
|
import re
|
|
import sys
|
|
import urllib.request
|
|
from pathlib import Path
|
|
|
|
SOURCE = (
|
|
"https://raw.githubusercontent.com/danielmiessler/SecLists/master/"
|
|
"Discovery/Web-Content/raft-{size}-{kind}.txt"
|
|
)
|
|
KINDS = ("directories", "files")
|
|
SIZES = ("small", "medium", "large")
|
|
OUTPUT = Path(__file__).resolve().parent.parent / "tools" / "data" / "content.txt"
|
|
|
|
_WORD = re.compile(r"^[A-Za-z0-9._~!$&'()*+,;=:@%-]{1,100}$")
|
|
|
|
|
|
def fetch(size: str, kind: str) -> list[str]:
|
|
url = SOURCE.format(size=size, kind=kind)
|
|
with urllib.request.urlopen(url, timeout=60) as response: # noqa: S310
|
|
body = response.read().decode("utf-8", errors="replace")
|
|
out: list[str] = []
|
|
for raw in body.splitlines():
|
|
word = raw.strip().lstrip("/")
|
|
if word and not word.startswith("#") and _WORD.match(word):
|
|
out.append(word)
|
|
return out
|
|
|
|
|
|
def merge(size: str) -> list[str]:
|
|
"""Directories before files at each rank."""
|
|
seen: set[str] = set()
|
|
ranked: list[str] = []
|
|
columns = [fetch(size, kind) for kind in KINDS]
|
|
for row in range(max(len(c) for c in columns)):
|
|
for column in columns:
|
|
if row >= len(column):
|
|
continue
|
|
word = column[row]
|
|
if word.lower() in seen:
|
|
continue
|
|
seen.add(word.lower())
|
|
ranked.append(word)
|
|
return ranked
|
|
|
|
|
|
def main() -> int:
|
|
parser = argparse.ArgumentParser(description=__doc__)
|
|
parser.add_argument("--size", choices=SIZES, default="small")
|
|
parser.add_argument("--limit", type=int, default=6000)
|
|
args = parser.parse_args()
|
|
|
|
try:
|
|
words = merge(args.size)
|
|
except OSError as e:
|
|
print(f"could not fetch the wordlist: {e}", file=sys.stderr)
|
|
return 1
|
|
|
|
kept = words[: args.limit]
|
|
OUTPUT.write_text("\n".join(kept) + "\n", encoding="utf-8")
|
|
print(f"wrote {len(kept):,} words to {OUTPUT}")
|
|
return 0
|
|
|
|
|
|
if __name__ == "__main__":
|
|
raise SystemExit(main())
|