Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ uv run braindump --repo owner/repo run [--from STAGE] [--skip STAGE ...] [--sinc
- `--from`: Start from a specific stage (e.g. `--from synthesize`)
- `--skip`: Skip stages (repeatable, e.g. `--skip download --skip extract`)
- `--since`: Date filter for download (YYYY-MM-DD)
- `--authors`: Author filter for extract (default: `all`)
- `--authors`: Author filter for extract, comma-separated (default: `all`)
- `--min-score`: Override rule score threshold (default: 0.5)
- `--max-rules N`: Cap the number of rules in group stage (top-scored)
- `--fresh`: Wipe all stage outputs and start from scratch
Expand Down
18 changes: 10 additions & 8 deletions src/braindump/commands/extract.py
Original file line number Diff line number Diff line change
Expand Up @@ -218,10 +218,10 @@ def filter_bots(comments: list[dict]) -> list[dict]:
]


def filter_by_author(comments: list[dict], author: str | None) -> list[dict]:
if author is None:
def filter_by_author(comments: list[dict], authors: set[str] | None) -> list[dict]:
if authors is None:
return comments
return [c for c in comments if c.get("user", {}).get("login") == author]
return [c for c in comments if c.get("user", {}).get("login") in authors]


def build_thread_map(comments: list[dict]) -> dict[int, list[dict]]:
Expand Down Expand Up @@ -528,10 +528,10 @@ def _run(
f"Filtered to {len(all_comments)} comments from PRs: {sorted(pr_numbers)}"
)

author = None if authors == "all" else authors
if not is_pipeline and author:
console.print(f"Filtering to {author} comments...")
filtered_comments = filter_by_author(all_comments, author)
author_set = None if authors == "all" else {a.strip() for a in authors.split(",")}
if not is_pipeline and author_set:
console.print(f"Filtering to {', '.join(sorted(author_set))} comments...")
filtered_comments = filter_by_author(all_comments, author_set)
if not is_pipeline:
console.print(f"Found {len(filtered_comments)} comments to process")

Expand Down Expand Up @@ -574,7 +574,9 @@ def _run(

def extract(
ctx: typer.Context,
authors: str = typer.Option("all", help="Filter to specific author, or 'all'"),
authors: str = typer.Option(
"all", help="Filter to specific author(s), comma-separated, or 'all'"
),
limit: int | None = typer.Option(None, help="Limit number of comments to process"),
random_sample: bool = typer.Option(False, "--random", help="Randomly sample comments"),
seed: int = typer.Option(42, help="Random seed for reproducible sampling"),
Expand Down
2 changes: 1 addition & 1 deletion src/braindump/commands/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def run(
None, "--from", help=f"Start from this stage ({', '.join(STAGES)})"
),
skip: list[str] | None = typer.Option(None, help="Skip specific stages (repeatable)"),
authors: str = typer.Option("all", help="Author filter for extract stage"),
authors: str = typer.Option("all", help="Author filter for extract stage, comma-separated"),
since: str | None = typer.Option(None, help="Date filter for download stage (YYYY-MM-DD)"),
min_score: float | None = typer.Option(None, help="Minimum rule score (default: 0.5)"),
max_rules: int | None = typer.Option(
Expand Down