[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-108025":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":10,"language":11,"languages":10,"totalLinesOfCode":10,"stars":12,"forks":13,"watchers":14,"openIssues":15,"contributorsCount":15,"subscribersCount":15,"size":15,"stars1d":16,"stars7d":17,"stars30d":18,"stars90d":15,"forks30d":15,"starsTrendScore":19,"compositeScore":20,"rankGlobal":10,"rankLanguage":10,"license":21,"archived":22,"fork":22,"defaultBranch":23,"hasWiki":24,"hasPages":24,"topics":25,"createdAt":10,"pushedAt":34,"updatedAt":35,"readmeContent":36,"aiSummary":37,"trendingCount":15,"starSnapshotCount":15,"syncStatus":38,"lastSyncTime":39,"discoverSource":40},108025,"patchscope","brunnojob\u002Fpatchscope","brunnojob","GitHub Action for Git diff review: flag risky changes, removed tests and CI permissions. Export Markdown, JSON and SARIF checklists. Free, local-first, no AI keys.","https:\u002F\u002Fbrunnojob.github.io\u002Fpatchscope\u002F",null,"JavaScript",314,100,13,0,11,64,248,37,96.01,"MIT License",false,"main",true,[26,27,28,29,30,31,32,33],"code-review","developer-tools","git-diff","github-actions","javascript","local-first","privacy","static-site","2026-11-23 19:52:17","2026-11-23 19:51:16","\u003Cdiv align=\"center\">\n\n\u003Cimg src=\"docs\u002Ficon.svg\" width=\"64\" alt=\"PatchScope\">\n\n# PatchScope\n\n### Big diff? Know where to look.\n\n**Turn a Git patch into an actionable review checklist — in your browser, terminal or GitHub Actions.**\n\n[Try the live demo](https:\u002F\u002Fbrunnojob.github.io\u002Fpatchscope\u002F) · [CLI quick start](#cli-quick-start) · [GitHub Actions](#github-actions) · [Contribute a rule](CONTRIBUTING.md)\n\n![Validation](https:\u002F\u002Fgithub.com\u002Fbrunnojob\u002Fpatchscope\u002Factions\u002Fworkflows\u002Fci.yml\u002Fbadge.svg)\n\n\u003C\u002Fdiv>\n\n![PatchScope review map with five prompts and a file diff](docs\u002Fpreview.jpg)\n\n---\n\nReviewing a change is easier when you know where to start. PatchScope reads a unified diff and highlights concrete reasons to take a closer look: removed tests, broad workflow permissions, destructive SQL, dependency changes and more.\n\nEvery prompt explains **what matched, why it matters and what to check next**. The same dependency-free engine powers the web app, CLI and reusable GitHub Action.\n\n**No API keys. No model calls. No code uploads. No account.**\n\n## Try it in 30 seconds\n\n1. Open **[PatchScope](https:\u002F\u002Fbrunnojob.github.io\u002Fpatchscope\u002F)**.\n2. Click **Explore the example**, or paste `git diff --no-ext-diff --no-color HEAD` output.\n3. Filter prompts, inspect changed lines and export a Markdown checklist for your pull request.\n\nThe bundled example has **4 changed files and 5 review prompts**. Also try the skipped-test example or a documentation-only patch with no matched rules.\n\n## From patch to review plan\n\nA release patch changes a workflow, drops a SQL table, removes tests and updates a dependency manifest. PatchScope turns those changes into a prioritized checklist:\n\n```text\n4 files · 5 review prompts\nHIGH    Review this workflow privilege boundary\nHIGH    Potentially destructive SQL\nHIGH    A test file was removed\nMEDIUM  GitHub Actions behavior changed\nMEDIUM  Check dependency reproducibility\n```\n\nEach prompt includes its file, a line number when available, the reason it matched and a concrete action. Export the checklist to your PR, then use the diff viewer to inspect the context. Run `npm run demo` to reproduce this example locally.\n\n## Choose your workflow\n\n| Where you review | Start here | Result |\n| --- | --- | --- |\n| Browser | [Open the workspace](https:\u002F\u002Fbrunnojob.github.io\u002Fpatchscope\u002F) | Interactive file map, filters and checklist |\n| Terminal | Pipe `git diff` into the CLI | Markdown, JSON or SARIF on stdout |\n| CI | Add the composite Action | Job summary and downloadable reports |\n| CI with an explicit threshold | CLI `--fail-on high` | Full report plus exit code `2` for high-priority prompts |\n\n## What it catches\n\n| Signal | Review prompt |\n| --- | --- |\n| Private-key headers or credential-like literals | Verify values and replace real credentials with secret references |\n| `permissions: write-all` or `pull_request_target` | Review the workflow privilege boundary |\n| `DROP` or `TRUNCATE` SQL | Confirm environment, backups and recovery |\n| Deleted test files | Confirm replacement coverage |\n| Skipped or exclusive test markers | Check which tests actually run |\n| Known TLS verification bypass patterns | Restore certificate verification |\n| Dynamic `eval` \u002F `exec` calls | Trace input and execution context |\n| Dependency manifest without a compatible same-directory lockfile in the patch | Check the project’s dependency policy |\n| Source changes without changed tests | Confirm existing coverage or add a regression test |\n| Binary changes or large file changes | Make space for a separate review |\n\nThese are **heuristics, not a security audit**. A match can be intentional; no matches do not establish safety. Dependency and test prompts describe the patch, not the whole repository. There is no invented risk percentage or claim that the tool understands an entire application.\n\n## Browser workspace\n\nPaste or drop a patch, explore files with old\u002Fnew line numbers, filter severity and check off review actions. Copy Markdown or download Markdown\u002FJSON. `Ctrl+Enter` \u002F `Command+Enter` analyzes; **Clear** removes the patch and results from memory.\n\nPatches stay in page memory. The app uses no localStorage, analytics, third-party fonts or remote processing. Reports contain file names, metrics and prompts, **not raw source lines or detected credential values**. File names can themselves be sensitive: inspect reports before sharing. GitHub Pages applies its own infrastructure privacy policies.\n\nLimits: **2 MB, 500 file sections and 60,000 input lines**. The file preview displays at most 1,500 lines; the engine analyzes all supported lines within those limits.\n\n## CLI quick start\n\nRequires Node.js 22+. No `npm install` needed.\n\n```sh\ngit clone https:\u002F\u002Fgithub.com\u002Fbrunnojob\u002Fpatchscope.git\ncd patchscope\nnpm run demo\nnode scripts\u002Fcli.mjs docs\u002Fexample.diff --format json\n```\n\nReview your own patch:\n\n```sh\ngit diff --no-ext-diff --no-color HEAD > change.diff\nnode \u002Fpath\u002Fto\u002Fpatchscope\u002Fscripts\u002Fcli.mjs change.diff --format markdown > review.md\n```\n\nOr use stdin:\n\n```sh\ngit diff --no-ext-diff --no-color HEAD | node \u002Fpath\u002Fto\u002Fpatchscope\u002Fscripts\u002Fcli.mjs - --format json\n```\n\nBy default, findings do not fail the command. For a review workflow that needs an explicit priority threshold:\n\n```sh\nnode scripts\u002Fcli.mjs change.diff --format json --fail-on high > review.json\n```\n\nThe full report is still written to stdout. `high` matches high-priority prompts; `medium` includes high and medium; `info` includes every prompt. Treat a threshold match as a request for human review, not proof of a vulnerability.\n\n| Exit code | Meaning |\n| --- | --- |\n| `0` | Analysis completed and no requested threshold matched |\n| `1` | Invalid options, missing file, malformed or oversized input |\n| `2` | A prompt met the explicitly requested `--fail-on` threshold |\n\nUse `--help` for options. Without `--fail-on`, analysis exits `0` even when prompts are found.\n\n## Configure rules and explain exceptions\n\nPass an explicit JSON file with `--config`; PatchScope never discovers or executes repository configuration automatically. This config customizes the built-in rules, not arbitrary executable plugins.\n\n```json\n{\n  \"rules\": {\n    \"large-file\": \"info\",\n    \"test-coverage\": \"off\"\n  },\n  \"suppressions\": [\n    {\n      \"rule\": \"destructive-sql\",\n      \"path\": \"src\u002Fdb\u002Fmigrate.sql\",\n      \"line\": 1,\n      \"reason\": \"Disposable fixture database; reviewed in issue 42.\"\n    }\n  ]\n}\n```\n\n```sh\nnode scripts\u002Fcli.mjs change.diff --config patchscope.json --format json\nnode scripts\u002Fcli.mjs change.diff --config patchscope.json --format sarif > review.sarif\n```\n\nRule settings accept `high`, `medium`, `info` or `off`. Omitted rules keep their defaults. Unknown keys, rules, severities and invalid suppressions fail explicitly. Configuration files are limited to 256 KB and 1,000 suppressions.\n\nSuppressions match an **exact rule and patch path**, with an optional positive new-line number. Omit `line` to cover that rule throughout the named file, including file-level prompts. Paths are case-sensitive, use `\u002F`, and have no glob syntax. Each suppression requires a reason of up to 500 characters. Only the first matching suppression applies; unmatched entries have no effect.\n\nSuppressed prompts stay in JSON (`suppressed`), Markdown and SARIF with their justification. They do not contribute to active counts or `--fail-on`. Rules set to `off` do not emit prompts; disabled rule IDs are disclosed in report metadata and Markdown. Severity overrides apply before thresholds. Keep reasons free of credentials or private source: supplied justifications are exported verbatim in JSON\u002FSARIF and escaped in Markdown.\n\nAvailable rule IDs: `binary`, `deleted-tests`, `environment`, `large-file`, `workflow`, `private-key`, `credential`, `destructive-sql`, `test-scope`, `workflow-privilege`, `tls`, `dynamic-code`, `lockfile`, `test-coverage`.\n\nThe engine API accepts the same object: `analyzeDiff(patch, config)`. The browser workspace uses the default rules; configuration is currently exposed through the CLI, engine API and Action.\n\n## SARIF export\n\n`--format sarif` produces SARIF 2.1.0 with rule IDs, encoded file paths, new-line locations when available and priorities mapped to `error` \u002F `warning` \u002F `note`. File-level prompts have no invented line number. Explained exceptions use external suppressions. Raw diff lines and detected credential values are not included.\n\nThe Action also writes a SARIF report. Export is local: publishing a report to a code-scanning service is a separate workflow step with that service's permissions and availability requirements. SARIF priorities still describe heuristic review prompts, not confirmed vulnerabilities.\n\n## GitHub Actions\n\nThe composite action accepts an existing patch, writes a job summary and creates Markdown, JSON and SARIF report files. It does not post comments, request an API token, contact an AI service or modify the repository.\n\n```yaml\nname: Patch review\non: pull_request\npermissions:\n  contents: read\njobs:\n  review:\n    runs-on: ubuntu-latest\n    steps:\n      - uses: actions\u002Fcheckout@v4\n        with:\n          fetch-depth: 0\n      - name: Create review patch\n        env:\n          BASE_SHA: ${{ github.event.pull_request.base.sha }}\n          HEAD_SHA: ${{ github.event.pull_request.head.sha }}\n        run: git diff --no-ext-diff --no-color \"$BASE_SHA...$HEAD_SHA\" > review.diff\n      - uses: brunnojob\u002Fpatchscope@main\n        id: scope\n        with:\n          diff-file: review.diff\n      - uses: actions\u002Fupload-artifact@v4\n        with:\n          name: patchscope-review\n          path: |\n            ${{ steps.scope.outputs.report-json }}\n            ${{ steps.scope.outputs.report-markdown }}\n            ${{ steps.scope.outputs.report-sarif }}\n```\n\nUse `@main` for a first experiment. In production, pin this and other third-party actions to reviewed full commit SHAs. The composite action declares `actions\u002Fsetup-node@v4` to provide Node.js 22.\n\n| Input \u002F output | Meaning |\n| --- | --- |\n| `diff-file` | Required path to an existing unified diff |\n| `config-file` | Optional explicit JSON configuration path; no auto-discovery |\n| `summary` | `true` by default; `false` disables the job summary |\n| `report-json` | Output path to the JSON report |\n| `report-markdown` | Output path to the Markdown report |\n| `report-sarif` | Output path to the SARIF 2.1.0 report |\n| `suppressed-count` | Number of prompts with explained suppressions |\n| `high-count` | Output count of high-priority heuristic prompts |\n\nAdd `config-file: patchscope.json` under the Action’s `with:` block to apply a reviewed policy. On pull requests, choose a trusted policy file if these settings influence your review decisions. The Action reports active counts and remains non-blocking; CLI thresholds are opt-in.\n\nAction summaries and artifacts follow your repository’s access and retention settings. Browser code is not uploaded; your configured workflow can publish its report.\n\n## Why this exists\n\nPatchScope is a small review tool you can inspect, run locally and adapt without an account, backend or model subscription. It helps prepare the human review instead of assigning an opaque score.\n\nIf it saves you review time, **[a star helps others find it](https:\u002F\u002Fgithub.com\u002Fbrunnojob\u002Fpatchscope)**. A reproducible edge case or carefully scoped rule is just as useful.\n\n## Development\n\n```sh\nnpm run dev\nnpm run check\nnpm test\n```\n\nOpen `http:\u002F\u002Flocalhost:4173`. ES modules need HTTP; opening the HTML with `file:\u002F\u002F` is unsupported.\n\n| Module | Responsibility |\n| --- | --- |\n| `src\u002Fengine.js` | Diff parsing, heuristics and Markdown generation |\n| `src\u002Fconfig.js` | Built-in rule settings, validation and explained suppressions |\n| `src\u002Fsarif.js` | SARIF 2.1.0 export |\n| `src\u002Fapp.js` | Browser interactions and downloads |\n| `src\u002Fexamples.js` | Synthetic offline examples |\n| `scripts\u002Fcli.mjs` | File\u002Fstdin CLI |\n| `scripts\u002Faction.mjs` | Job summary and report outputs |\n| `action.yml` | Reusable composite action |\n| `tests\u002F` | Parser, rules, report privacy, CLI and Action integration |\n\nTests cover quoted\u002FUTF-8 names, renames, line numbers, binary changes, deleted tests, placeholder credentials, escaping, limits, stdin and actual output files. CI runs on Linux\u002FWindows with Node.js 22\u002F24 and smoke-tests the composite action.\n\n## Dependency checks in monorepos\n\nA lockfile only suppresses a manifest prompt when it belongs to a compatible ecosystem and is in the same directory. Changing `apps\u002Fapi\u002Fpackage-lock.json` does not hide a prompt for `apps\u002Fweb\u002Fpackage.json`; changing `go.sum` does not cover an npm manifest. npm shrinkwrap, pnpm, Yarn and Bun lockfile names are recognized alongside the existing Python, Go, Rust and Ruby formats.\n\nShared workspace lockfiles can live above a package. PatchScope does not read workspace configuration or unchanged files, so it keeps the prompt and asks you to confirm the workspace policy. A prompt does not mean a lockfile is missing from your repository.\n\n## Limits and next steps\n\nRecognizes unified text diffs and basic Git file metadata. Combined merge diffs, AST analysis, full secret scanning and whole-repository context are outside this version. Comments, multiline constructs, unusual languages and test-file naming conventions can produce false negatives. Binary content is not inspected.\n\nNext steps: additional parser fixtures, richer workspace-aware dependency checks and browser controls for configuration. Rule settings, explained suppressions and SARIF export are implemented in the engine, CLI and Action.\n\n## Credits and license\n\nCreated by **[brunnodev](https:\u002F\u002Fbrunnodev.store)** on **[brunnojob](https:\u002F\u002Fgithub.com\u002Fbrunnojob)**. MIT licensed; see [LICENSE](LICENSE).\n","PatchScope 是一个本地优先的 Git 差异审查辅助工具，将 patch 转化为结构化、可操作的代码评审检查清单。它基于静态规则引擎分析 unified diff，识别高风险信号（如删除测试、破坏性 SQL、宽泛工作流权限、敏感凭证泄露等），为每项匹配生成含上下文、影响说明和具体动作建议的提示；零依赖、无网络请求、不上传代码，支持浏览器交互界面、CLI 命令行及 GitHub Actions 集成。适用于开源协作、企业 CI\u002FCD 流水线中的自动化初步代码审查与 PR 质量预检。",2,"2026-11-24 04:33:18","CREATED_QUERY"]