patchdrill 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.patchdrill.yml +33 -0
- package/CHANGELOG.md +150 -0
- package/CONTRIBUTING.md +59 -0
- package/LICENSE +21 -0
- package/README.md +601 -0
- package/SECURITY.md +28 -0
- package/action.yml +338 -0
- package/dist/baseline.d.ts +9 -0
- package/dist/baseline.js +38 -0
- package/dist/baseline.js.map +1 -0
- package/dist/cli.d.ts +19 -0
- package/dist/cli.js +662 -0
- package/dist/cli.js.map +1 -0
- package/dist/codeowners.d.ts +14 -0
- package/dist/codeowners.js +104 -0
- package/dist/codeowners.js.map +1 -0
- package/dist/command-plan.d.ts +3 -0
- package/dist/command-plan.js +26 -0
- package/dist/command-plan.js.map +1 -0
- package/dist/demo.d.ts +5 -0
- package/dist/demo.js +525 -0
- package/dist/demo.js.map +1 -0
- package/dist/dependency.d.ts +4 -0
- package/dist/dependency.js +1424 -0
- package/dist/dependency.js.map +1 -0
- package/dist/doctor.d.ts +26 -0
- package/dist/doctor.js +183 -0
- package/dist/doctor.js.map +1 -0
- package/dist/evidence.d.ts +64 -0
- package/dist/evidence.js +352 -0
- package/dist/evidence.js.map +1 -0
- package/dist/git.d.ts +16 -0
- package/dist/git.js +349 -0
- package/dist/git.js.map +1 -0
- package/dist/i18n-catalog.d.ts +8 -0
- package/dist/i18n-catalog.js +446 -0
- package/dist/i18n-catalog.js.map +1 -0
- package/dist/i18n.d.ts +20 -0
- package/dist/i18n.js +67 -0
- package/dist/i18n.js.map +1 -0
- package/dist/init.d.ts +13 -0
- package/dist/init.js +312 -0
- package/dist/init.js.map +1 -0
- package/dist/markdown-links.d.ts +18 -0
- package/dist/markdown-links.js +180 -0
- package/dist/markdown-links.js.map +1 -0
- package/dist/package-scripts.d.ts +3 -0
- package/dist/package-scripts.js +55 -0
- package/dist/package-scripts.js.map +1 -0
- package/dist/planner.d.ts +8 -0
- package/dist/planner.js +2351 -0
- package/dist/planner.js.map +1 -0
- package/dist/policy.d.ts +12 -0
- package/dist/policy.js +255 -0
- package/dist/policy.js.map +1 -0
- package/dist/project.d.ts +2 -0
- package/dist/project.js +1085 -0
- package/dist/project.js.map +1 -0
- package/dist/release-readiness.d.ts +25 -0
- package/dist/release-readiness.js +426 -0
- package/dist/release-readiness.js.map +1 -0
- package/dist/report-annotations.d.ts +3 -0
- package/dist/report-annotations.js +28 -0
- package/dist/report-annotations.js.map +1 -0
- package/dist/report-contract.d.ts +2 -0
- package/dist/report-contract.js +82 -0
- package/dist/report-contract.js.map +1 -0
- package/dist/report-html.d.ts +7 -0
- package/dist/report-html.js +706 -0
- package/dist/report-html.js.map +1 -0
- package/dist/report-sarif.d.ts +2 -0
- package/dist/report-sarif.js +90 -0
- package/dist/report-sarif.js.map +1 -0
- package/dist/report.d.ts +14 -0
- package/dist/report.js +310 -0
- package/dist/report.js.map +1 -0
- package/dist/risk.d.ts +19 -0
- package/dist/risk.js +1226 -0
- package/dist/risk.js.map +1 -0
- package/dist/runner.d.ts +8 -0
- package/dist/runner.js +113 -0
- package/dist/runner.js.map +1 -0
- package/dist/scan.d.ts +2 -0
- package/dist/scan.js +195 -0
- package/dist/scan.js.map +1 -0
- package/dist/schema.d.ts +12 -0
- package/dist/schema.js +30 -0
- package/dist/schema.js.map +1 -0
- package/dist/stack-coverage.d.ts +8 -0
- package/dist/stack-coverage.js +94 -0
- package/dist/stack-coverage.js.map +1 -0
- package/dist/types.d.ts +206 -0
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -0
- package/dist/verification.d.ts +11 -0
- package/dist/verification.js +108 -0
- package/dist/verification.js.map +1 -0
- package/docs/ANNOTATIONS.md +34 -0
- package/docs/ARCHITECTURE.md +79 -0
- package/docs/BASELINES.md +32 -0
- package/docs/CASE_STUDIES.md +106 -0
- package/docs/CODEOWNERS.md +23 -0
- package/docs/DASHBOARD.md +87 -0
- package/docs/EVIDENCE.md +55 -0
- package/docs/LAUNCH_PLAYBOOK.md +103 -0
- package/docs/MONOREPOS.md +74 -0
- package/docs/POLICY.md +98 -0
- package/docs/PROOF_PACKS.md +57 -0
- package/docs/PR_COMMENTS.md +56 -0
- package/docs/RELEASE.md +35 -0
- package/docs/ROADMAP.md +152 -0
- package/docs/RULE_CATALOG.md +90 -0
- package/docs/SARIF.md +74 -0
- package/docs/SCHEMAS.md +49 -0
- package/docs/SECURITY_POSTURE.md +32 -0
- package/docs/STACK_COVERAGE.md +20 -0
- package/docs/assets/patchdrill-demo.svg +21 -0
- package/docs/media/patchdrill-dashboard.png +0 -0
- package/docs/media/patchdrill-demo.gif +0 -0
- package/examples/case-studies/README.md +20 -0
- package/examples/demo/README.md +21 -0
- package/examples/demo/patchdrill-demo-summary.md +35 -0
- package/examples/demo/patchdrill-demo.html +623 -0
- package/examples/demo/patchdrill-demo.json +355 -0
- package/examples/demo/patchdrill-demo.md +120 -0
- package/examples/demo/patchdrill-demo.sarif +195 -0
- package/examples/report.md +128 -0
- package/examples/risky-agent-pr/README.md +15 -0
- package/examples/risky-agent-pr/patchdrill-demo-summary.md +41 -0
- package/examples/risky-agent-pr/patchdrill-demo.html +681 -0
- package/examples/risky-agent-pr/patchdrill-demo.json +483 -0
- package/examples/risky-agent-pr/patchdrill-demo.md +140 -0
- package/examples/risky-agent-pr/patchdrill-demo.sarif +398 -0
- package/fixtures/stacks/README.md +4 -0
- package/fixtures/stacks/android-gradle/fixture.json +33 -0
- package/fixtures/stacks/aspnet-core-service/fixture.json +36 -0
- package/fixtures/stacks/bazel-workspace/fixture.json +30 -0
- package/fixtures/stacks/buck2-workspace/fixture.json +30 -0
- package/fixtures/stacks/cargo-workspace/fixture.json +48 -0
- package/fixtures/stacks/django-app/fixture.json +25 -0
- package/fixtures/stacks/docker-compose/fixture.json +17 -0
- package/fixtures/stacks/dockerfile-service/fixture.json +17 -0
- package/fixtures/stacks/dotnet-service/fixture.json +36 -0
- package/fixtures/stacks/dotnet-solution-filter/fixture.json +62 -0
- package/fixtures/stacks/fastapi-app/fixture.json +29 -0
- package/fixtures/stacks/go-workspace/fixture.json +48 -0
- package/fixtures/stacks/java-gradle/fixture.json +29 -0
- package/fixtures/stacks/java-maven/fixture.json +32 -0
- package/fixtures/stacks/kubernetes-helm/fixture.json +25 -0
- package/fixtures/stacks/kubernetes-kustomize/fixture.json +21 -0
- package/fixtures/stacks/nested-go-workspace/fixture.json +51 -0
- package/fixtures/stacks/nextjs-app/fixture.json +34 -0
- package/fixtures/stacks/node-turbo-workspace/fixture.json +39 -0
- package/fixtures/stacks/pants-python/fixture.json +33 -0
- package/fixtures/stacks/php-composer/fixture.json +31 -0
- package/fixtures/stacks/python-service/fixture.json +21 -0
- package/fixtures/stacks/rails-app/fixture.json +25 -0
- package/fixtures/stacks/spring-boot-gradle/fixture.json +29 -0
- package/fixtures/stacks/spring-boot-maven/fixture.json +43 -0
- package/fixtures/stacks/swift-package/fixture.json +21 -0
- package/fixtures/stacks/terraform-module/fixture.json +17 -0
- package/fixtures/stacks/uv-python-service/fixture.json +47 -0
- package/fixtures/stacks/xcode-app/fixture.json +72 -0
- package/package.json +80 -0
- package/schemas/patchdrill-doctor.schema.json +171 -0
- package/schemas/patchdrill-evidence.schema.json +239 -0
- package/schemas/patchdrill-policy.schema.json +170 -0
- package/schemas/patchdrill-release-check.schema.json +78 -0
- package/schemas/patchdrill-report.schema.json +647 -0
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
# Static HTML Dashboard
|
|
2
|
+
|
|
3
|
+
PatchDrill can write a self-contained HTML dashboard for local review and CI artifacts. It has no external assets, no network calls, and uses the same deterministic report data as Markdown, JSON, and SARIF output.
|
|
4
|
+
|
|
5
|
+
Generate the dashboard during a scan:
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
patchdrill scan --base origin/main --run \
|
|
9
|
+
--evidence patchdrill-evidence.json \
|
|
10
|
+
--summary-markdown patchdrill-summary.md \
|
|
11
|
+
--markdown patchdrill-report.md \
|
|
12
|
+
--json patchdrill-report.json \
|
|
13
|
+
--sarif patchdrill.sarif \
|
|
14
|
+
--html patchdrill-dashboard.html
|
|
15
|
+
patchdrill verify --evidence patchdrill-evidence.json
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
Re-render a dashboard from a saved JSON report:
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
patchdrill dashboard --json patchdrill-report.json --output patchdrill-dashboard.html
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
Saved JSON reports must satisfy the report contract before PatchDrill renders a dashboard. This prevents old reports without required verification metadata from being repackaged as current evidence.
|
|
25
|
+
|
|
26
|
+
Render a dashboard with CI artifact history by passing reports in oldest-to-newest order. The last `--json` is the current report used for the main dashboard, and earlier reports populate the run trend table.
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
patchdrill dashboard \
|
|
30
|
+
--json reports/patchdrill-previous.json \
|
|
31
|
+
--json reports/patchdrill-current.json \
|
|
32
|
+
--output patchdrill-dashboard.html
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
The dashboard includes:
|
|
36
|
+
|
|
37
|
+
- Status, risk, confidence, changed-file, required-check, and added-line summary metrics.
|
|
38
|
+
- Multi-run risk and failed-check trends when repeated JSON reports are provided.
|
|
39
|
+
- Findings with severity, rule IDs, locations, tags, and remediation.
|
|
40
|
+
- Verification plans with per-command status, plus captured command results.
|
|
41
|
+
- Changed files, project signals, policy context, baseline context, owner context, and dependency changes.
|
|
42
|
+
|
|
43
|
+
For CI, upload the HTML alongside the JSON, Markdown, and evidence artifacts:
|
|
44
|
+
|
|
45
|
+
```yaml
|
|
46
|
+
- uses: seungdori/patchdrill@v0
|
|
47
|
+
id: patchdrill
|
|
48
|
+
with:
|
|
49
|
+
base: origin/${{ github.base_ref }}
|
|
50
|
+
evidence: patchdrill-evidence.json
|
|
51
|
+
summary: patchdrill-summary.md
|
|
52
|
+
markdown: patchdrill-report.md
|
|
53
|
+
json: patchdrill-report.json
|
|
54
|
+
sarif: patchdrill.sarif
|
|
55
|
+
html: patchdrill-dashboard.html
|
|
56
|
+
run: "true"
|
|
57
|
+
- uses: actions/upload-artifact@v7
|
|
58
|
+
if: always()
|
|
59
|
+
with:
|
|
60
|
+
name: patchdrill-report
|
|
61
|
+
path: |
|
|
62
|
+
${{ steps.patchdrill.outputs.report-evidence }}
|
|
63
|
+
${{ steps.patchdrill.outputs.report-markdown }}
|
|
64
|
+
${{ steps.patchdrill.outputs.report-html }}
|
|
65
|
+
${{ steps.patchdrill.outputs.report-json }}
|
|
66
|
+
${{ steps.patchdrill.outputs.report-sarif }}
|
|
67
|
+
${{ steps.patchdrill.outputs.report-summary }}
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
If your workflow downloads one or more previous JSON report artifacts before running PatchDrill, pass them through `dashboard-history`. PatchDrill appends the current JSON report automatically and re-renders the HTML dashboard with the trend table:
|
|
71
|
+
|
|
72
|
+
```yaml
|
|
73
|
+
- uses: seungdori/patchdrill@v0
|
|
74
|
+
id: patchdrill
|
|
75
|
+
with:
|
|
76
|
+
base: origin/${{ github.base_ref }}
|
|
77
|
+
evidence: patchdrill-evidence.json
|
|
78
|
+
summary: patchdrill-summary.md
|
|
79
|
+
markdown: patchdrill-report.md
|
|
80
|
+
json: patchdrill-report.json
|
|
81
|
+
sarif: patchdrill.sarif
|
|
82
|
+
html: patchdrill-dashboard.html
|
|
83
|
+
run: "true"
|
|
84
|
+
dashboard-history: |
|
|
85
|
+
reports/patchdrill-previous.json
|
|
86
|
+
reports/patchdrill-last-green.json
|
|
87
|
+
```
|
package/docs/EVIDENCE.md
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
# Proof Packs and Evidence Manifests
|
|
2
|
+
|
|
3
|
+
A Proof Pack is the portable evidence bundle PatchDrill creates for a patch. It can contain a compact Markdown summary, full Markdown report, JSON report, SARIF report, self-contained HTML dashboard, and a JSON evidence manifest.
|
|
4
|
+
|
|
5
|
+
The evidence manifest is the verifiable index for that bundle. It records artifact metadata and command-output digests so a reviewer or CI system can later prove which files belonged to the same scan:
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
patchdrill scan --base origin/main --run \
|
|
9
|
+
--evidence patchdrill-evidence.json \
|
|
10
|
+
--summary-markdown patchdrill-summary.md \
|
|
11
|
+
--markdown patchdrill-report.md \
|
|
12
|
+
--json patchdrill-report.json \
|
|
13
|
+
--sarif patchdrill.sarif \
|
|
14
|
+
--html patchdrill-dashboard.html
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
`scan --evidence` requires `--json` because the verifier needs a JSON report artifact to cross-check the report digest and report contract.
|
|
18
|
+
|
|
19
|
+
The manifest includes:
|
|
20
|
+
|
|
21
|
+
- The PatchDrill report SHA-256 and byte length.
|
|
22
|
+
- SHA-256 digests for generated Markdown, JSON, SARIF, HTML, and compact-summary artifacts.
|
|
23
|
+
- Command result metadata with stdout and stderr digests, not raw command output.
|
|
24
|
+
- The PatchDrill version and report schema version that produced the bundle.
|
|
25
|
+
- Local git branch, head SHA, and base SHA when available.
|
|
26
|
+
- The same summary scores used by the JSON report and dashboard.
|
|
27
|
+
|
|
28
|
+
If a scan infers or configures required verification commands but no matching command results are present, the report includes a `verification.required-not-run` finding. This keeps local scans non-mutating by default while making missing evidence visible in the same report and evidence bundle.
|
|
29
|
+
|
|
30
|
+
Human-facing reports also render a plan-to-result verification matrix. Each planned command is labeled as passed, failed, timed out, not run, or skipped optional, so reviewers do not have to manually join `commandPlan` and `commandResults` to see which evidence is present. JSON reports must include the same computed `verification` section for bots and dashboards, and `patchdrill verify --evidence` rejects a JSON report when that section is missing or drifts from the underlying command plan and command results.
|
|
31
|
+
|
|
32
|
+
Verify a saved manifest against its artifacts:
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
patchdrill verify --evidence patchdrill-evidence.json
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
Verification checks that recorded artifact SHA-256 values and byte lengths still match the files on disk. When a JSON report artifact is present, PatchDrill also cross-checks it against the manifest's report digest, verifies that the manifest summary, report counts, command result metadata, command-output digests, and required structured verification status still match the JSON report, and rejects JSON reports whose summary counts no longer match their changed files, command plan, or command results.
|
|
39
|
+
|
|
40
|
+
Regenerate a manifest after post-processing final artifacts, such as re-rendering a dashboard with trend history:
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
patchdrill evidence \
|
|
44
|
+
--json patchdrill-report.json \
|
|
45
|
+
--evidence patchdrill-evidence.json \
|
|
46
|
+
--summary-markdown patchdrill-summary.md \
|
|
47
|
+
--markdown patchdrill-report.md \
|
|
48
|
+
--sarif patchdrill.sarif \
|
|
49
|
+
--html patchdrill-dashboard.html
|
|
50
|
+
patchdrill verify --evidence patchdrill-evidence.json
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
`patchdrill evidence` validates the saved JSON report contract before writing the regenerated manifest.
|
|
54
|
+
|
|
55
|
+
This keeps the default scanner local-only and deterministic while giving CI systems one small file that can prove which Proof Pack artifacts belonged to a run.
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
# Launch Playbook
|
|
2
|
+
|
|
3
|
+
PatchDrill is designed for developers who already use AI coding agents and want a concrete, repeatable answer to "what proves this patch?"
|
|
4
|
+
|
|
5
|
+
## Positioning
|
|
6
|
+
|
|
7
|
+
One-liner:
|
|
8
|
+
|
|
9
|
+
> PatchDrill is the deterministic proof layer between code review and CI for AI-generated and human patches.
|
|
10
|
+
|
|
11
|
+
Short pitch:
|
|
12
|
+
|
|
13
|
+
> AI agents can write code quickly, but reviewers still need evidence. PatchDrill reads a git diff, infers what should be tested, flags risky areas, and writes a portable Proof Pack for local review, CI, audit trails, and model-assisted review.
|
|
14
|
+
|
|
15
|
+
Comparison:
|
|
16
|
+
|
|
17
|
+
- AI PR reviewers judge whether a patch looks right.
|
|
18
|
+
- Traditional CI runs commands that were already configured.
|
|
19
|
+
- SAST/SCA scanners match known code, dependency, and vulnerability rules.
|
|
20
|
+
- Review automation posts configured comments and annotations.
|
|
21
|
+
- PatchDrill turns the patch itself into a repeatable verification plan, risk report, policy gate, and Proof Pack.
|
|
22
|
+
|
|
23
|
+
## Launch Checklist
|
|
24
|
+
|
|
25
|
+
Done for the public repository:
|
|
26
|
+
|
|
27
|
+
- Public GitHub repository with CodeQL, OpenSSF Scorecard, Dependabot, issue forms, pull request template, and repository topics.
|
|
28
|
+
- Self-contained GitHub Action that builds from the checked-out action source before running PatchDrill.
|
|
29
|
+
- Proof Pack outputs: SARIF, Markdown, JSON, compact PR summary, static HTML dashboard, and verifiable evidence manifest.
|
|
30
|
+
- Generated PR workflow runs inferred required commands with a per-command timeout.
|
|
31
|
+
- README terminal demo asset showing the risk summary and portable report outputs.
|
|
32
|
+
- Package automation script findings for install-time hooks, removed verification scripts, no-op checks, and remote shell pipes.
|
|
33
|
+
- First-party fixtures for more than five popular stacks, including Node/Turborepo, Python, Rails, Terraform, Docker/Compose, Kubernetes, Java/Gradle, .NET, SwiftPM, Xcode, Bazel, Buck2, Pants, Cargo, and Go.
|
|
34
|
+
- Example report and release provenance documentation.
|
|
35
|
+
- `patchdrill doctor` for first-run repository readiness diagnosis.
|
|
36
|
+
- `patchdrill release-check` for static npm/GitHub Action release readiness checks.
|
|
37
|
+
- CI and release workflows dogfood `patchdrill release-check --format json`.
|
|
38
|
+
- CI/action/release workflows verify generated evidence manifests before artifacts or packages are trusted; release smoke includes required command evidence.
|
|
39
|
+
- JSON Schemas for policy, report, evidence, doctor, and release-check automation contracts.
|
|
40
|
+
- Public case-study and stack-coverage docs for launch evaluation.
|
|
41
|
+
- Release readiness checks local Markdown links across README, docs, and examples.
|
|
42
|
+
- Release readiness checks package file allowlisting and launch-discovery keywords.
|
|
43
|
+
|
|
44
|
+
Still needed for launch distribution:
|
|
45
|
+
|
|
46
|
+
- Publish npm package as `patchdrill`.
|
|
47
|
+
- Move the `v0` GitHub Action tag after each compatible 0.x action update.
|
|
48
|
+
- Dogfood on 20 external real pull requests and add anonymized example reports.
|
|
49
|
+
- Submit to GitHub Trending-adjacent communities: Hacker News Show HN, r/programming, r/ClaudeCode, r/codex, r/opensource, DevTools directories.
|
|
50
|
+
- Write a blog post: "AI made patches faster. Here is how to make review evidence faster too."
|
|
51
|
+
|
|
52
|
+
## Demo Script
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
git checkout -b demo/auth-change
|
|
56
|
+
echo "// pretend auth change" >> src/auth/session.ts
|
|
57
|
+
patchdrill scan
|
|
58
|
+
patchdrill scan --run \
|
|
59
|
+
--evidence patchdrill-evidence.json \
|
|
60
|
+
--summary-markdown patchdrill-summary.md \
|
|
61
|
+
--markdown patchdrill-report.md \
|
|
62
|
+
--json patchdrill-report.json \
|
|
63
|
+
--sarif patchdrill.sarif \
|
|
64
|
+
--html patchdrill-dashboard.html
|
|
65
|
+
patchdrill verify --evidence patchdrill-evidence.json
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
Show:
|
|
69
|
+
|
|
70
|
+
- High-impact auth finding.
|
|
71
|
+
- Missing test-change finding.
|
|
72
|
+
- Inferred commands from `package.json`.
|
|
73
|
+
- Package script findings when a patch changes install hooks or weakens test scripts.
|
|
74
|
+
- Proof Pack artifact bundle.
|
|
75
|
+
- SARIF upload in GitHub code scanning.
|
|
76
|
+
- `.patchdrill.yml` policy rule that requires owner review for a sensitive path.
|
|
77
|
+
|
|
78
|
+
## Release Gate
|
|
79
|
+
|
|
80
|
+
Run this before creating the first public release:
|
|
81
|
+
|
|
82
|
+
```bash
|
|
83
|
+
patchdrill doctor
|
|
84
|
+
patchdrill release-check
|
|
85
|
+
patchdrill release-check --format json
|
|
86
|
+
npm run check
|
|
87
|
+
node dist/cli.js scan --evidence .patchdrill/release-evidence.json --summary-markdown .patchdrill/release-summary.md --markdown .patchdrill/release.md --json .patchdrill/release.json --sarif .patchdrill/release.sarif --html .patchdrill/release-dashboard.html --run --fail-on critical
|
|
88
|
+
node dist/cli.js verify --evidence .patchdrill/release-evidence.json
|
|
89
|
+
npm pack --dry-run
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
`release-check` verifies local repository readiness, including parseable shipped JSON Schemas, matching README/SCHEMAS documentation for every public schema command, JSON-backed evidence verification in CI/action/release workflows, README and pull request Proof Pack command checklists, synchronized stack-coverage docs, stack fixture contracts, and committed demo artifact synchronization. npm Trusted Publisher configuration still has to be checked in npm account settings.
|
|
93
|
+
|
|
94
|
+
## Star Hooks
|
|
95
|
+
|
|
96
|
+
- "No LLM required."
|
|
97
|
+
- "Proof Packs over vibes."
|
|
98
|
+
- "Not another AI reviewer. A deterministic safety gate."
|
|
99
|
+
- "Works before your CI bill grows."
|
|
100
|
+
- "Review the plan before running commands."
|
|
101
|
+
- "Markdown for humans, JSON for bots, SARIF for GitHub."
|
|
102
|
+
- "Detects prompt-injection strings before agents ingest them."
|
|
103
|
+
- "Catches install-time package scripts and no-op test rewrites."
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
# Monorepo Targeting
|
|
2
|
+
|
|
3
|
+
PatchDrill detects Node, Cargo, Go, and Pants workspaces, including nested Cargo and Go workspaces inside polyglot monorepos, and reports the affected packages or native changed-target plan for a diff.
|
|
4
|
+
|
|
5
|
+
Supported Node workspace metadata:
|
|
6
|
+
|
|
7
|
+
- `package.json` with `workspaces: []`
|
|
8
|
+
- `package.json` with `workspaces.packages`
|
|
9
|
+
- `pnpm-workspace.yaml`
|
|
10
|
+
|
|
11
|
+
When a changed file sits under a workspace package, PatchDrill emits package-scoped verification commands for that package and downstream workspace packages that depend on it:
|
|
12
|
+
|
|
13
|
+
| Package manager | Example |
|
|
14
|
+
| --- | --- |
|
|
15
|
+
| npm | `npm --workspace @acme/api run test` |
|
|
16
|
+
| pnpm | `pnpm --filter @acme/api run test` |
|
|
17
|
+
| yarn | `yarn workspace @acme/api test` |
|
|
18
|
+
| bun | `bun --filter @acme/api run test` |
|
|
19
|
+
|
|
20
|
+
PatchDrill reads workspace `dependencies`, `devDependencies`, `peerDependencies`, and `optionalDependencies`, keeps only dependencies that point to other workspace packages, and expands affected packages transitively. If `@acme/web` depends on `@acme/api` and `@acme/api` depends on `@acme/shared`, a change in `@acme/shared` marks all three packages as affected.
|
|
21
|
+
|
|
22
|
+
Root-wide files such as lockfiles, root `package.json`, `pnpm-workspace.yaml`, `turbo.json`, and `nx.json` still mark all workspace packages as affected.
|
|
23
|
+
|
|
24
|
+
## Native Task Runners
|
|
25
|
+
|
|
26
|
+
PatchDrill detects `turbo.json`, `nx.json`, root `turbo`/`nx` dependencies, and root scripts that invoke `turbo` or `nx`. When a supported task runner is present, workspace plans use the native task graph:
|
|
27
|
+
|
|
28
|
+
| Runner | Example |
|
|
29
|
+
| --- | --- |
|
|
30
|
+
| Turborepo | `pnpm exec turbo run test --filter=@acme/api` |
|
|
31
|
+
| Nx | `npx nx run api:test` |
|
|
32
|
+
|
|
33
|
+
Turborepo plans still use package names from `package.json`. Nx plans use `project.json` names when present, otherwise the package name. If a package has no script but `project.json` declares a matching target, PatchDrill can still plan `test`, `build`, `lint`, or `typecheck` through Nx.
|
|
34
|
+
|
|
35
|
+
For Node package scripts, PatchDrill recognizes common aliases such as `check:types`, `test:unit`, and optional browser/e2e checks like `test:e2e`, `playwright`, and `cypress`. This keeps inferred plans useful for real front-end and full-stack repositories without forcing every package to expose only `test` and `typecheck`.
|
|
36
|
+
|
|
37
|
+
## Cargo Workspaces
|
|
38
|
+
|
|
39
|
+
PatchDrill reads `[workspace].members` from root `Cargo.toml`, expands member globs, reads each member crate name, and keeps workspace-internal crate dependencies. A change under `crates/core` marks that crate as affected and also marks downstream workspace crates that depend on it.
|
|
40
|
+
|
|
41
|
+
| Change | Example command |
|
|
42
|
+
| --- | --- |
|
|
43
|
+
| Direct crate change | `cargo test -p core-lib --all-targets` |
|
|
44
|
+
| Downstream dependent crate | `cargo test -p api-server --all-targets` |
|
|
45
|
+
| Optional lint plan | `cargo clippy -p core-lib --all-targets -- -D warnings` |
|
|
46
|
+
|
|
47
|
+
## Go Workspaces
|
|
48
|
+
|
|
49
|
+
PatchDrill reads `go.work` `use` entries, each module's `module` path, and workspace-internal `require` dependencies. A change under `modules/core` marks that module as affected and also marks downstream workspace modules that require it. If the Go workspace is nested under a polyglot root, commands run from that nested workspace root.
|
|
50
|
+
|
|
51
|
+
| Change | Example command |
|
|
52
|
+
| --- | --- |
|
|
53
|
+
| Direct module change | `go test ./modules/core/...` |
|
|
54
|
+
| Downstream dependent module | `go test ./modules/api/...` |
|
|
55
|
+
| Nested workspace module change | `cd services/go && go test ./modules/core/...` |
|
|
56
|
+
| Optional static check | `go vet ./modules/core/...` |
|
|
57
|
+
|
|
58
|
+
## Pants Repositories
|
|
59
|
+
|
|
60
|
+
PatchDrill detects `pants.toml` and uses Pants' native Git-aware target selection instead of reconstructing Pants target graphs. For local uncommitted work it plans against `HEAD`; for `patchdrill scan --base origin/main`, it plans against `origin/main`.
|
|
61
|
+
|
|
62
|
+
| Goal | Example command |
|
|
63
|
+
| --- | --- |
|
|
64
|
+
| Required tests | `pants --changed-since=origin/main --changed-dependents=transitive test` |
|
|
65
|
+
| Optional lint | `pants --changed-since=origin/main --changed-dependents=transitive lint` |
|
|
66
|
+
| Optional checks | `pants --changed-since=origin/main --changed-dependents=transitive check` |
|
|
67
|
+
|
|
68
|
+
## Why This Matters
|
|
69
|
+
|
|
70
|
+
Large repositories need targeted evidence. Running only root commands can hide which package proved the change, while running every package wastes CI time. PatchDrill keeps the plan explicit: affected package, command, and reason appear in Markdown and JSON reports.
|
|
71
|
+
|
|
72
|
+
## Current Scope
|
|
73
|
+
|
|
74
|
+
PatchDrill builds workspace impact from package manifests, then hands task execution to native graph engines when available: Turborepo, Nx, and Pants.
|
package/docs/POLICY.md
ADDED
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
# Policy-As-Code
|
|
2
|
+
|
|
3
|
+
PatchDrill reads `.patchdrill.yml`, `.patchdrill.yaml`, or `.patchdrill.json` from the repository root. You can also pass a custom path:
|
|
4
|
+
|
|
5
|
+
```bash
|
|
6
|
+
patchdrill scan --config security/patchdrill.yml
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
Policy files are validated when loaded. Invalid severities, unknown fields, malformed command entries, duplicate command IDs or command strings, conflicting aliases, and malformed rules fail the scan instead of being silently ignored.
|
|
10
|
+
|
|
11
|
+
Create a starter policy:
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
patchdrill init --policy
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
Create a stricter starter pack:
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
patchdrill init --policy-pack regulated
|
|
21
|
+
patchdrill init --policy-pack agentic
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
Built-in packs:
|
|
25
|
+
|
|
26
|
+
| Pack | Focus |
|
|
27
|
+
| --- | --- |
|
|
28
|
+
| `default` | General repo hygiene and agent instruction review. |
|
|
29
|
+
| `regulated` | Payments, identity/access, data migrations, release infrastructure, and lower default risk tolerance. |
|
|
30
|
+
| `agentic` | Agent instructions, MCP/tool configs, prompt templates, and AI workflow trust boundaries. |
|
|
31
|
+
|
|
32
|
+
## Example
|
|
33
|
+
|
|
34
|
+
```yaml
|
|
35
|
+
failOn: high
|
|
36
|
+
maxRisk: 69
|
|
37
|
+
|
|
38
|
+
ignoredPaths:
|
|
39
|
+
- generated/**
|
|
40
|
+
- dist/**
|
|
41
|
+
|
|
42
|
+
requiredCommands:
|
|
43
|
+
- id: contract-tests
|
|
44
|
+
label: API contract tests
|
|
45
|
+
command: npm run test:contracts
|
|
46
|
+
reason: API surfaces changed.
|
|
47
|
+
|
|
48
|
+
optionalCommands:
|
|
49
|
+
- id: playwright-smoke
|
|
50
|
+
label: Browser smoke test
|
|
51
|
+
command: npm run test:smoke
|
|
52
|
+
reason: UI routes changed.
|
|
53
|
+
|
|
54
|
+
rules:
|
|
55
|
+
- id: payments-owner-review
|
|
56
|
+
title: Payments owner review required
|
|
57
|
+
severity: critical
|
|
58
|
+
path: src/payments/**
|
|
59
|
+
detail: Payment logic is high-impact and needs domain-owner sign-off.
|
|
60
|
+
remediation: Add reviewer notes with test evidence, rollback notes, and owner approval.
|
|
61
|
+
tags:
|
|
62
|
+
- payments
|
|
63
|
+
- owner-review
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
## Fields
|
|
67
|
+
|
|
68
|
+
| Field | Purpose |
|
|
69
|
+
| --- | --- |
|
|
70
|
+
| `failOn` | Default CLI failure threshold when `--fail-on` is not passed. |
|
|
71
|
+
| `maxRisk` | Default numeric risk threshold when `--max-risk` is not passed. |
|
|
72
|
+
| `ignoredPaths` | Glob patterns removed from changed-file and added-line analysis. |
|
|
73
|
+
| `requiredCommands` | Commands PatchDrill runs when `--run` is set. |
|
|
74
|
+
| `optionalCommands` | Commands shown in the report and run only when both `--run` and `--run-optional` are set. |
|
|
75
|
+
| `rules` | Path-based findings with custom severity, weight, remediation, and tags. |
|
|
76
|
+
|
|
77
|
+
Policy commands are merged with inferred commands by command string and ID. If a policy `requiredCommands` entry matches an inferred optional command, PatchDrill promotes the merged command to required so repo policy cannot be weakened by a generic detector.
|
|
78
|
+
|
|
79
|
+
Within a policy file, command IDs and command strings must be unique across `requiredCommands` and `optionalCommands`. Use either `ignoredPaths` or `ignore`, not both; use either `path` or `paths` in each rule, not both.
|
|
80
|
+
|
|
81
|
+
## Glob Support
|
|
82
|
+
|
|
83
|
+
PatchDrill supports `*`, `**`, and `?` path globs.
|
|
84
|
+
|
|
85
|
+
```yaml
|
|
86
|
+
ignoredPaths:
|
|
87
|
+
- generated/**
|
|
88
|
+
- "**/*.snap"
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
## Review Guidance
|
|
92
|
+
|
|
93
|
+
Use policy for repo-specific invariants that generic tools cannot know:
|
|
94
|
+
|
|
95
|
+
- Domain-owner review for payments, permissions, or ML model policy.
|
|
96
|
+
- Extra contract tests for public API schema changes.
|
|
97
|
+
- Release-manager review for deployment and infrastructure paths.
|
|
98
|
+
- Generated-code ignore rules where source-of-truth files are reviewed elsewhere.
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
# Proof Packs
|
|
2
|
+
|
|
3
|
+
A Proof Pack is the reviewable evidence bundle PatchDrill generates for one patch. It is designed to be small enough for pull request review, structured enough for bots, and verifiable enough for audit trails.
|
|
4
|
+
|
|
5
|
+
PatchDrill does not replace reviewer judgment. It gives reviewers the same deterministic evidence every time the same diff is scanned.
|
|
6
|
+
|
|
7
|
+
## Contents
|
|
8
|
+
|
|
9
|
+
| Artifact | Audience | Use |
|
|
10
|
+
| --- | --- | --- |
|
|
11
|
+
| Compact Markdown summary | Pull request reviewers | Shows status, risk, top findings, and required commands in a short comment or step summary. |
|
|
12
|
+
| Full Markdown report | Human reviewers | Provides changed files, command plan, findings, dependency changes, package script changes, and command results. |
|
|
13
|
+
| JSON report | Bots and dashboards | Preserves the complete report contract, including required structured verification status, for policy gates and custom tooling. |
|
|
14
|
+
| SARIF report | GitHub code scanning | Turns findings into code scanning alerts with stable fingerprints. |
|
|
15
|
+
| HTML dashboard | Humans and CI artifacts | Gives a self-contained visual report, including optional trend history from prior JSON reports. |
|
|
16
|
+
| Evidence manifest | CI and audit trails | Records the PatchDrill version, report metadata, artifact digests, command metadata, and command-output digests so the bundle can be verified later. |
|
|
17
|
+
|
|
18
|
+
## Review Flow
|
|
19
|
+
|
|
20
|
+
1. Run `patchdrill scan --base origin/main` locally to see the plan without running commands.
|
|
21
|
+
2. Run `patchdrill scan --base origin/main --run` when the inferred required commands look right.
|
|
22
|
+
3. Attach or upload the Proof Pack artifacts in CI.
|
|
23
|
+
4. Review the findings and failed commands before asking an AI reviewer or human reviewer for higher-level judgment.
|
|
24
|
+
5. Verify the evidence manifest if artifacts are post-processed or audited later.
|
|
25
|
+
|
|
26
|
+
## CI Flow
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
patchdrill scan --base origin/main --run \
|
|
30
|
+
--evidence patchdrill-evidence.json \
|
|
31
|
+
--summary-markdown patchdrill-summary.md \
|
|
32
|
+
--markdown patchdrill-report.md \
|
|
33
|
+
--json patchdrill-report.json \
|
|
34
|
+
--sarif patchdrill.sarif \
|
|
35
|
+
--html patchdrill-dashboard.html \
|
|
36
|
+
--fail-on high \
|
|
37
|
+
--max-risk 69
|
|
38
|
+
|
|
39
|
+
patchdrill verify --evidence patchdrill-evidence.json
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
This keeps the scanner deterministic and local-first while still producing artifacts that CI gates, auditors, bots, and reviewers can inspect.
|
|
43
|
+
|
|
44
|
+
## Why It Matters
|
|
45
|
+
|
|
46
|
+
AI PR reviewers are useful for judgment, explanation, and design feedback. They are not a durable source of proof. A Proof Pack gives that judgment layer concrete input:
|
|
47
|
+
|
|
48
|
+
- The exact files and lines that changed.
|
|
49
|
+
- The ecosystems and workspace scopes touched by the patch.
|
|
50
|
+
- The commands PatchDrill inferred from the patch.
|
|
51
|
+
- Which required commands ran, failed, timed out, or still lack evidence.
|
|
52
|
+
- Which optional commands were skipped unless `--run-optional` was used.
|
|
53
|
+
- Which risk rules increased the score.
|
|
54
|
+
- Which artifacts belonged to the same scan.
|
|
55
|
+
- Which PatchDrill version, report metadata, and command-output digests produced the evidence bundle.
|
|
56
|
+
|
|
57
|
+
The intended workflow is not "trust PatchDrill instead of reviewers." It is "make the proof explicit before reviewers spend attention."
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
# Pull Request Comments
|
|
2
|
+
|
|
3
|
+
PatchDrill's composite GitHub Action can upsert a compact Markdown summary as a pull request comment.
|
|
4
|
+
|
|
5
|
+
```yaml
|
|
6
|
+
permissions:
|
|
7
|
+
contents: read
|
|
8
|
+
pull-requests: write
|
|
9
|
+
security-events: write
|
|
10
|
+
|
|
11
|
+
steps:
|
|
12
|
+
- uses: actions/checkout@v6
|
|
13
|
+
with:
|
|
14
|
+
fetch-depth: 0
|
|
15
|
+
- uses: seungdori/patchdrill@v0
|
|
16
|
+
id: patchdrill
|
|
17
|
+
with:
|
|
18
|
+
base: origin/${{ github.base_ref }}
|
|
19
|
+
evidence: patchdrill-evidence.json
|
|
20
|
+
summary: patchdrill-summary.md
|
|
21
|
+
markdown: patchdrill-report.md
|
|
22
|
+
json: patchdrill-report.json
|
|
23
|
+
sarif: patchdrill.sarif
|
|
24
|
+
html: patchdrill-dashboard.html
|
|
25
|
+
run: "true"
|
|
26
|
+
pr-comment: "true"
|
|
27
|
+
comment-marker: "<!-- patchdrill-report -->"
|
|
28
|
+
- uses: actions/upload-artifact@v7
|
|
29
|
+
if: always()
|
|
30
|
+
with:
|
|
31
|
+
name: patchdrill-report
|
|
32
|
+
path: |
|
|
33
|
+
${{ steps.patchdrill.outputs.report-evidence }}
|
|
34
|
+
${{ steps.patchdrill.outputs.report-markdown }}
|
|
35
|
+
${{ steps.patchdrill.outputs.report-html }}
|
|
36
|
+
${{ steps.patchdrill.outputs.report-json }}
|
|
37
|
+
${{ steps.patchdrill.outputs.report-sarif }}
|
|
38
|
+
${{ steps.patchdrill.outputs.report-summary }}
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
PatchDrill finds an existing bot comment containing the marker and updates it. If no marker is present, it creates a new comment. The comment uses the compact summary by default, while the full Markdown, JSON, SARIF, and HTML reports remain available as workflow artifacts.
|
|
42
|
+
|
|
43
|
+
Set `pr-comment: "false"` to skip comment writes while keeping the step summary, annotations, SARIF, HTML, JSON, Markdown, and evidence artifacts. The Action accepts `"true"`, `"false"`, `"1"`, `"0"`, `"yes"`, `"no"`, `"on"`, and `"off"` for boolean inputs.
|
|
44
|
+
|
|
45
|
+
To preview the comment body without opening a pull request, run:
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
patchdrill demo --scenario risky-agent-pr --output patchdrill-risky-demo
|
|
49
|
+
cat patchdrill-risky-demo/patchdrill-demo-summary.md
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
## Permissions
|
|
53
|
+
|
|
54
|
+
The workflow needs `pull-requests: write` to create or update PR comments. Keep other permissions least-privileged.
|
|
55
|
+
|
|
56
|
+
For fork pull requests where the workflow token is read-only, PatchDrill emits a warning and skips the comment instead of failing the verification run. The step summary, annotations, SARIF, HTML, JSON, Markdown, and evidence artifacts still remain available.
|
package/docs/RELEASE.md
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# Release
|
|
2
|
+
|
|
3
|
+
PatchDrill is configured for npm trusted publishing and provenance through `.github/workflows/release.yml`.
|
|
4
|
+
|
|
5
|
+
## npm Trusted Publishing
|
|
6
|
+
|
|
7
|
+
Configure the npm package as a trusted publisher for this repository and the `Release` workflow. npm trusted publishing uses OIDC from GitHub Actions and automatically produces provenance attestations when publishing from the trusted workflow.
|
|
8
|
+
|
|
9
|
+
## Release Flow
|
|
10
|
+
|
|
11
|
+
1. Update `package.json` version and `CHANGELOG.md`.
|
|
12
|
+
2. Run local verification:
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
patchdrill doctor
|
|
16
|
+
patchdrill release-check
|
|
17
|
+
patchdrill release-check --format json
|
|
18
|
+
patchdrill schema doctor
|
|
19
|
+
patchdrill schema release-check
|
|
20
|
+
npm run check
|
|
21
|
+
node dist/cli.js scan --evidence .patchdrill/release-evidence.json --summary-markdown .patchdrill/release-summary.md --markdown .patchdrill/release.md --json .patchdrill/release.json --sarif .patchdrill/release.sarif --html .patchdrill/release-dashboard.html --run --fail-on critical
|
|
22
|
+
node dist/cli.js verify --evidence .patchdrill/release-evidence.json
|
|
23
|
+
npm pack --dry-run
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
3. Create a GitHub Release for the version tag.
|
|
27
|
+
4. The `Release` workflow runs build, tests, package dry-run, and `npm publish --provenance`.
|
|
28
|
+
|
|
29
|
+
## Dry Run
|
|
30
|
+
|
|
31
|
+
Use `workflow_dispatch` to run release checks without publishing. Publishing is limited to GitHub Release events.
|
|
32
|
+
|
|
33
|
+
`patchdrill release-check` is intentionally local and static. It verifies package metadata, package file allowlisting, launch keywords, action wiring, command-backed evidence verification in CI/action/release workflows, release workflow provenance settings, README install paths, repository release files, README and pull request Proof Pack command checklists, parseable shipped JSON Schemas with matching README/SCHEMAS documentation, synchronized stack-coverage docs, stack fixture contracts, committed demo artifact synchronization, and local Markdown links across README, docs, and examples. It cannot verify the npm account-side Trusted Publisher setup; check that in npm before publishing.
|
|
34
|
+
|
|
35
|
+
CI and the release workflow both run `patchdrill release-check --format json` after `npm run check` so launch-readiness regressions fail before package publishing.
|