mirror of
https://github.com/yogeshojha/rengine.git
synced 2026-10-20 23:31:31 +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
76 lines
2.2 KiB
Python
76 lines
2.2 KiB
Python
import uuid
|
|
from datetime import datetime
|
|
|
|
from pydantic import BaseModel
|
|
from pydantic import Field as PydanticField
|
|
from sqlmodel import Field, SQLModel
|
|
|
|
from shared.definitions.wordlists import (
|
|
MAX_SLUG_LENGTH,
|
|
MAX_WORDLIST_UPLOAD,
|
|
WordlistKind,
|
|
WordlistOrigin,
|
|
)
|
|
from shared.utils.datetime import utc_now
|
|
|
|
|
|
class Wordlist(SQLModel, table=True):
|
|
"""One list a guessing stage can read."""
|
|
|
|
__tablename__ = "wordlists"
|
|
|
|
id: uuid.UUID = Field(default_factory=uuid.uuid4, primary_key=True)
|
|
slug: str = Field(max_length=MAX_SLUG_LENGTH, unique=True, index=True)
|
|
name: str = Field(max_length=200)
|
|
description: str = Field(default="", max_length=1000)
|
|
origin: str = Field(default=WordlistOrigin.CUSTOM.value, max_length=16, index=True)
|
|
kind: str = Field(default=WordlistKind.SUBDOMAIN.value, max_length=16, index=True)
|
|
filename: str = Field(max_length=200)
|
|
words: int = Field(default=0)
|
|
bytes: int = Field(default=0)
|
|
uploaded_by: uuid.UUID | None = Field(default=None)
|
|
created_at: datetime = Field(default_factory=utc_now)
|
|
updated_at: datetime = Field(default_factory=utc_now)
|
|
|
|
|
|
class WordlistRead(BaseModel):
|
|
id: uuid.UUID
|
|
slug: str
|
|
name: str
|
|
description: str
|
|
origin: str
|
|
kind: str
|
|
words: int
|
|
bytes: int
|
|
created_at: datetime
|
|
updated_at: datetime
|
|
|
|
|
|
class WordlistUpdate(BaseModel):
|
|
name: str | None = PydanticField(default=None, max_length=200)
|
|
description: str | None = PydanticField(default=None, max_length=1000)
|
|
|
|
|
|
class WordlistFile(BaseModel):
|
|
filename: str = PydanticField(max_length=200)
|
|
content: str
|
|
name: str | None = PydanticField(default=None, max_length=200)
|
|
description: str | None = PydanticField(default=None, max_length=1000)
|
|
|
|
|
|
class WordlistUploadRequest(BaseModel):
|
|
kind: str = WordlistKind.SUBDOMAIN.value
|
|
files: list[WordlistFile] = PydanticField(
|
|
default_factory=list, max_length=MAX_WORDLIST_UPLOAD
|
|
)
|
|
|
|
|
|
class WordlistRejection(BaseModel):
|
|
filename: str
|
|
reason: str
|
|
|
|
|
|
class WordlistUploadResult(BaseModel):
|
|
stored: list[WordlistRead] = PydanticField(default_factory=list)
|
|
rejected: list[WordlistRejection] = PydanticField(default_factory=list)
|