{"_id":"@darth_sith_99/pr-checker","name":"@darth_sith_99/pr-checker","dist-tags":{"latest":"1.0.0"},"versions":{"1.0.0":{"name":"@darth_sith_99/pr-checker","version":"1.0.0","description":"A configurable tool to fetch and monitor pull requests, detect unreviewed and stale PRs, and help teams prioritize reviews and merges.","main":"index.js","devDependencies":{"@cashbound-id/compiler":"^1.0.2","@cashbound-id/eslint":"^1.1.2","@eslint/js":"^9.39.4","@rollup/plugin-commonjs":"^28.0.0","@rollup/plugin-node-resolve":"^16.0.1","@rollup/plugin-swc":"^0.4.0","@rollup/plugin-terser":"^1.0.0","@rollup/plugin-typescript":"^12.0.0","@swc/cli":"^0.6.0","@swc/core":"^1.11.0","@types/node":"^22.14.0","eslint":"^9.39.4","eslint-config-prettier":"^10.1.8","eslint-plugin-jest":"^28.14.0","eslint-plugin-jsx-a11y":"^6.10.2","eslint-plugin-prettier":"^5.5.5","eslint-plugin-react":"^7.37.5","eslint-plugin-react-hooks":"^5.2.0","eslint-plugin-simple-import-sort":"^12.1.1","eslint-plugin-sort-destructure-keys":"^2.0.0","eslint-plugin-sort-keys-fix":"^1.1.2","eslint-plugin-typescript-sort-keys":"^3.3.0","jest":"^29.7.0","prettier":"^3.8.1","react":"^19.2.4","rollup":"^4.0.0","rollup-plugin-dts":"^6.4.1","rollup-plugin-visualizer":"^5.14.0","typescript":"^5.9.3","typescript-eslint":"^8.58.0","typescript-transform-paths":"^3.5.6"},"peerDependencies":{"date-fns":"^4.1.0"},"type":"commonjs","license":"ISC","scripts":{"lint":"eslint","prebuild":"rm -rf dist","build":"pnpm rollup -c --bundleConfigAsCjs --silent"},"_id":"@darth_sith_99/pr-checker@1.0.0","_integrity":"sha512-Mw57tD9aBsQ0lCLJm4xZaAhCIt4qU0hJDAk9eEQ/eo5nDmR8rzrBlr7XNn0skbRYfSfwHcBOVRjRBIwa+0xfCg==","_resolved":"/private/var/folders/90/dwmvjp2x58lcvfqbq1f1nvj00000gp/T/22206d021dff9a53832245b2c22a57cf/darth_sith_99-pr-checker-1.0.0.tgz","_from":"file:darth_sith_99-pr-checker-1.0.0.tgz","_nodeVersion":"20.19.0","_npmVersion":"10.8.2","dist":{"integrity":"sha512-Mw57tD9aBsQ0lCLJm4xZaAhCIt4qU0hJDAk9eEQ/eo5nDmR8rzrBlr7XNn0skbRYfSfwHcBOVRjRBIwa+0xfCg==","shasum":"08f2a113c1e17915b8e05633ee71a3b8cdfeeca2","tarball":"https://registry.npmjs.org/@darth_sith_99/pr-checker/-/pr-checker-1.0.0.tgz","fileCount":7,"unpackedSize":50145,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQCEOFza47xzjdb1XdSpjogboyAVhMdufY7dgmZwb+239QIhAJZWVfw0mpykzcB/aYSt6Ldq3uT+jZ7k4uilEnhPYV73"}]},"_npmUser":{"name":"darth_sith_99","email":"irfanandriansyah10@gmail.com"},"directories":{},"maintainers":[{"name":"darth_sith_99","email":"irfanandriansyah10@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/pr-checker_1.0.0_1775470374900_0.714526054414707"},"_hasShrinkwrap":false}},"time":{"created":"2026-04-06T10:12:54.782Z","1.0.0":"2026-04-06T10:12:55.049Z","modified":"2026-04-06T10:12:55.298Z"},"maintainers":[{"name":"darth_sith_99","email":"irfanandriansyah10@gmail.com"}],"description":"A configurable tool to fetch and monitor pull requests, detect unreviewed and stale PRs, and help teams prioritize reviews and merges.","license":"ISC","readme":"# PR Checker\n\nA configurable tool to fetch and monitor pull requests, detect unreviewed and stale PRs, and help teams prioritize reviews and merges.\n\n## Installation\n\n```bash\npnpm add @darth_sith_99/pr-checker $(pnpm info @darth_sith_99/pr-checker peerDependencies --json  | jq -r 'keys[]')\n```\n\n## Usage\n\n```typescript\nimport { getPendingPRs } from \"@darth_sith_99/pr-checker\";\n\nconst result = await getPendingPRs({\n  githubCredential: {\n    githubToken: \"ghp_xxxxxxxxxxxx\",\n    orgName: \"your-org\",\n    repositoryName: \"your-repo\",\n  },\n  defaultReviewers: [\"reviewer-1\", \"reviewer-2\"],\n  excludedLabels: [\"draft\", \"still-in-progress\", \"skip-pr-checker\"],\n  excludedReviewers: [\"cursor[bot]\"],\n  pendingPRConfig: {\n    needReviewDeadline: 1, // days (default: 1)\n    escalationReviewDeadline: 3, // days (default: 3)\n    approvedNotMergedDeadline: 2, // min approvals (default: 2)\n  },\n});\n```\n\n## Arguments\n\n`getPendingPRs` accepts a single object with the following properties:\n\n| Argument            | Type                   | Required | Description                                                                       |\n| ------------------- | ---------------------- | -------- | --------------------------------------------------------------------------------- |\n| `githubCredential`  | `GithubCredentialType` | Yes      | GitHub authentication and repository info                                         |\n| `defaultReviewers`  | `string[]`             | Yes      | List of default reviewer usernames to assign when a PR has no requested reviewers |\n| `excludedLabels`    | `string[]`             | Yes      | PRs with any of these labels will be skipped entirely                             |\n| `excludedReviewers` | `string[]`             | Yes      | Reviews from these users (e.g. bots) are ignored when counting approvals          |\n| `pendingPRConfig`   | `PendingPRConfigType`  | No       | Custom thresholds for categorizing PRs (see below)                                |\n\n### `githubCredential`\n\n| Field            | Type     | Description                                        |\n| ---------------- | -------- | -------------------------------------------------- |\n| `githubToken`    | `string` | GitHub personal access token with repo read access |\n| `orgName`        | `string` | GitHub organization or user name                   |\n| `repositoryName` | `string` | Repository name                                    |\n\n### `pendingPRConfig`\n\nAll fields are optional and fall back to sensible defaults if not provided.\n\n| Field                       | Type     | Default | Description                                                               |\n| --------------------------- | -------- | ------- | ------------------------------------------------------------------------- |\n| `needReviewDeadline`        | `number` | `1`     | Minimum age in days before a PR appears in `needsReview`                  |\n| `escalationReviewDeadline`  | `number` | `3`     | Minimum age in days before a PR appears in `escalationReview`             |\n| `approvedNotMergedDeadline` | `number` | `2`     | Minimum number of approvals required for a PR to appear in `approvedNotMerged` |\n\n## Output\n\n`getPendingPRs` returns a `Promise` that resolves to an object with three categorized arrays:\n\n```typescript\ninterface GetPendingPRsResultType {\n  needsReview: GithubReviewedPRType[];\n  escalationReview: GithubReviewedPRType[];\n  approvedNotMerged: GithubReviewedPRType[];\n}\n```\n\n### Categories\n\n| Category            | Condition                                                                                                    | Description                                                                                                                                                             |\n| ------------------- | ------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| `needsReview`       | Age > `needReviewDeadline` days (default 1), not yet commented/approved, or fewer than required approvals     | PRs that need attention from reviewers. Either no engineer has reviewed yet, or the PR hasn't reached the minimum approval threshold.                                   |\n| `escalationReview`  | Age > `escalationReviewDeadline` days (default 3), not yet commented/approved, or fewer than required approvals | Same criteria as `needsReview` but the PR has been open longer and requires escalation. Takes priority over `needsReview` (a PR appears in one or the other, not both). |\n| `approvedNotMerged` | Has >= `approvedNotMergedDeadline` approvals (default 2) but still open                                       | PRs that have met the approval threshold and should be merged.                                                                                                          |\n\n### PR Item Shape\n\nEach item in the output arrays has the following shape:\n\n| Field                | Type       | Description                                                                      |\n| -------------------- | ---------- | -------------------------------------------------------------------------------- |\n| `title`              | `string`   | PR title                                                                         |\n| `url`                | `string`   | Link to the PR on GitHub                                                         |\n| `author`             | `string`   | GitHub username of the PR author                                                 |\n| `createdDate`        | `Date`     | When the PR was created                                                          |\n| `ageDays`            | `string`   | Human-readable age (e.g. `\"2 days ago\"`, `\"about 1 month ago\"`)                  |\n| `labels`             | `string[]` | Labels attached to the PR                                                        |\n| `number`             | `number`   | PR number                                                                        |\n| `requestedReviewers` | `string[]` | Reviewers who haven't taken action yet (already-reviewed users are filtered out) |\n| `approvers`          | `string[]` | Usernames of engineers whose latest review state is `APPROVED`                   |\n\n## Approval Logic\n\n- Only **unique approvers** are counted (one approval per engineer).\n- A reviewer's approval is invalidated if their latest review state is `CHANGES_REQUESTED`.\n- If any review has state `DISMISSED`, **all prior approvals are reset to zero**. Approvals submitted after the dismissal still count.\n- Reviews from users in `excludedReviewers` (e.g. `cursor[bot]`) are completely ignored for both approval counting and review detection.\n- `COMMENTED` reviews do not change a reviewer's approval state.\n","readmeFilename":"README.md","_rev":"1-110b0c0d6f4865d884997bed6ec4612c"}