|
4 | 4 | import sys |
5 | 5 | from pathlib import Path |
6 | 6 |
|
7 | | -from patchwork import inventory, feeds, scanners, report, fix |
8 | | -from patchwork.config import Config |
9 | | -from patchwork.registry import load_plugins |
| 7 | +from autopatch import inventory, feeds, scanners, report, fix |
| 8 | +from autopatch.config import Config |
| 9 | +from autopatch.registry import load_plugins |
10 | 10 |
|
11 | 11 |
|
12 | 12 | def _collect_findings(cfg: Config, cwd: str): |
13 | 13 | packages = inventory.collect(cfg.paths, cfg.sbom) |
14 | 14 | findings = feeds.match_all(packages, cfg.feeds) |
15 | 15 | findings.extend(scanners.run_all(cwd, cfg.scanners)) |
16 | | - from patchwork.models import dedupe |
| 16 | + from autopatch.models import dedupe |
17 | 17 | findings = dedupe(findings) |
18 | 18 | return [f for f in findings if f.id not in cfg.ignore] |
19 | 19 |
|
@@ -61,30 +61,30 @@ def cmd_fix(args) -> int: |
61 | 61 |
|
62 | 62 |
|
63 | 63 | def cmd_plugins(args) -> int: |
64 | | - from patchwork.feeds import BUILTIN as feed_builtins |
65 | | - from patchwork.scanners import BUILTIN as scanner_builtins |
66 | | - from patchwork.agents import BUILTIN as agent_builtins |
67 | | - print("feeds: ", sorted(load_plugins("patchwork.feeds", feed_builtins))) |
68 | | - print("scanners:", sorted(load_plugins("patchwork.scanners", scanner_builtins))) |
69 | | - print("agents: ", sorted(load_plugins("patchwork.agents", agent_builtins))) |
| 64 | + from autopatch.feeds import BUILTIN as feed_builtins |
| 65 | + from autopatch.scanners import BUILTIN as scanner_builtins |
| 66 | + from autopatch.agents import BUILTIN as agent_builtins |
| 67 | + print("feeds: ", sorted(load_plugins("autopatch.feeds", feed_builtins))) |
| 68 | + print("scanners:", sorted(load_plugins("autopatch.scanners", scanner_builtins))) |
| 69 | + print("agents: ", sorted(load_plugins("autopatch.agents", agent_builtins))) |
70 | 70 | return 0 |
71 | 71 |
|
72 | 72 |
|
73 | 73 | def build_parser() -> argparse.ArgumentParser: |
74 | | - parser = argparse.ArgumentParser(prog="patchwork") |
| 74 | + parser = argparse.ArgumentParser(prog="autopatch") |
75 | 75 | sub = parser.add_subparsers(dest="command", required=True) |
76 | 76 |
|
77 | 77 | scan = sub.add_parser("scan", help="scan for vulnerable packages") |
78 | 78 | scan.add_argument("paths", nargs="*", default=["."]) |
79 | | - scan.add_argument("--config", help="path to patchwork.toml") |
| 79 | + scan.add_argument("--config", help="path to autopatch.toml") |
80 | 80 | scan.add_argument("--format", choices=sorted(report.FORMATS), default="table") |
81 | 81 | scan.add_argument("-o", "--output", help="write report to a file instead of stdout") |
82 | 82 | scan.add_argument("--fail-on", choices=["critical", "high", "medium", "low", "none"]) |
83 | 83 | scan.set_defaults(func=cmd_scan) |
84 | 84 |
|
85 | 85 | fix_p = sub.add_parser("fix", help="open fix PRs for vulnerable packages via a coding agent") |
86 | 86 | fix_p.add_argument("paths", nargs="*", default=["."]) |
87 | | - fix_p.add_argument("--config", help="path to patchwork.toml") |
| 87 | + fix_p.add_argument("--config", help="path to autopatch.toml") |
88 | 88 | fix_p.add_argument("--agent", choices=["claude", "codex"]) |
89 | 89 | fix_p.add_argument("--max", type=int, help="max packages to fix in this run") |
90 | 90 | fix_p.add_argument("--pr", action="store_true", help="push the branch and open a PR (needs gh)") |
|
0 commit comments