pr-checkmate 1.22.2 → 1.22.3
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/README.md +55 -0
- package/dist/index.d.ts +1 -0
- package/package.json +4 -2
package/README.md
CHANGED
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|

|
|
8
8
|

|
|
9
9
|

|
|
10
|
+
[](https://pr-checkmate-docs.pages.dev)
|
|
10
11
|
|
|
11
12
|
> **PR CheckMate** is a universal PR quality checker that runs as a single `npm install` and works across **TypeScript, JavaScript, Python, C++, Swift, and Android/Kotlin** repositories — no per-language toolchain setup required.
|
|
12
13
|
|
|
@@ -280,6 +281,60 @@ In GitHub Actions PR context, language checks automatically switch to **delta mo
|
|
|
280
281
|
|
|
281
282
|
---
|
|
282
283
|
|
|
284
|
+
## Programmatic API
|
|
285
|
+
|
|
286
|
+
Besides the CLI, PR CheckMate ships a typed programmatic API. Install the package and import checks directly — useful for embedding the same quality gates inside your own tooling. The full reference is published at the [API docs site](https://pr-checkmate-docs.pages.dev).
|
|
287
|
+
|
|
288
|
+
Run the built-in checks:
|
|
289
|
+
|
|
290
|
+
```ts
|
|
291
|
+
import { runChecks } from 'pr-checkmate';
|
|
292
|
+
import type { CheckReport } from 'pr-checkmate';
|
|
293
|
+
|
|
294
|
+
const report: CheckReport = await runChecks({
|
|
295
|
+
cwd: process.cwd(),
|
|
296
|
+
reporter: 'stdout', // 'none' | 'stdout' | 'github' | (report) => void
|
|
297
|
+
});
|
|
298
|
+
|
|
299
|
+
if (!report.ok) process.exit(1);
|
|
300
|
+
```
|
|
301
|
+
|
|
302
|
+
`runChecks` never throws on violations and never calls `process.exit` — the caller decides. `report.ok` is `true` when nothing failed; warnings and skips do not affect it.
|
|
303
|
+
|
|
304
|
+
Author a custom check:
|
|
305
|
+
|
|
306
|
+
```ts
|
|
307
|
+
import { runChecks, defineCheck, pass, fail } from 'pr-checkmate';
|
|
308
|
+
|
|
309
|
+
const noFixmes = defineCheck({
|
|
310
|
+
name: 'no-fixmes',
|
|
311
|
+
phase: 'lint',
|
|
312
|
+
applies: () => true,
|
|
313
|
+
run: async (ctx) => {
|
|
314
|
+
// inspect ctx (config, changed files, language, sha range) and return an outcome
|
|
315
|
+
return pass();
|
|
316
|
+
},
|
|
317
|
+
});
|
|
318
|
+
|
|
319
|
+
await runChecks({ checks: [noFixmes] }); // appended to the built-in registry by default
|
|
320
|
+
```
|
|
321
|
+
|
|
322
|
+
### Key exports
|
|
323
|
+
|
|
324
|
+
| Export | Purpose |
|
|
325
|
+
|---|---|
|
|
326
|
+
| `runChecks` | Run the check pipeline; returns a structured `CheckReport` |
|
|
327
|
+
| `buildContext` | Build the `CheckContext` (language, config, sha range) checks receive |
|
|
328
|
+
| `REGISTRY` | The array of built-in checks |
|
|
329
|
+
| `defineCheck` | Identity helper for authoring a `Check` with full type inference |
|
|
330
|
+
| `pass` / `warn` / `fail` / `skip` | Outcome constructors for check bodies |
|
|
331
|
+
| `getSourcePath` / `getPackageConfigPath` / `hasLocalConfig` | Config-path helpers |
|
|
332
|
+
| Types | `Check`, `CheckContext`, `CheckReport`, `CheckResult`, `CheckOutcome`, `CheckStatus`, `RunOptions`, `Language`, `Phase`, `ReporterKind`, `ReporterFn`, `PRCheckMateConfig` |
|
|
333
|
+
|
|
334
|
+
Regenerate the docs locally with `npm run docs` (output in `docs/api`).
|
|
335
|
+
|
|
336
|
+
---
|
|
337
|
+
|
|
283
338
|
## PR Summary Comment
|
|
284
339
|
|
|
285
340
|
After `npx pr-checkmate all`, a summary table is posted to the PR. On repeated pushes the comment is updated in place — no duplicate comments.
|
package/dist/index.d.ts
CHANGED
|
@@ -7,3 +7,4 @@ export { runChecks, buildContext, REGISTRY } from './core';
|
|
|
7
7
|
export { pass, warn, fail, skip, defineCheck } from './core';
|
|
8
8
|
export type { Check, CheckContext, CheckOutcome, CheckReport, CheckResult, CheckStatus, Language, Phase, ReporterFn, ReporterKind, RunOptions, } from './core';
|
|
9
9
|
export { getSourcePath, getPackageConfigPath, hasLocalConfig } from './config';
|
|
10
|
+
export type { PRCheckMateConfig } from './interfaces';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pr-checkmate",
|
|
3
|
-
"version": "1.22.
|
|
3
|
+
"version": "1.22.3",
|
|
4
4
|
"description": "Automated PR quality checks: linting, formatting, dependency analysis, and spellcheck",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"github-actions",
|
|
@@ -46,6 +46,7 @@
|
|
|
46
46
|
"lint": "eslint \"src/**/*.{ts,tsx}\" --fix",
|
|
47
47
|
"prettier": "prettier --write \"src/**/*.{ts,tsx,js,jsx,json,md}\"",
|
|
48
48
|
"spellcheck": "cspell '**/*.{ts,tsx,js,jsx,md,json}' --no-progress",
|
|
49
|
+
"docs": "typedoc",
|
|
49
50
|
"scan:secrets": "gitleaks-secret-scanner --diff-mode ci --html-report gitleaks-report.html",
|
|
50
51
|
"test": "echo 'Tests coming soon'",
|
|
51
52
|
"security-scan": "npx pr-checkmate security",
|
|
@@ -99,6 +100,7 @@
|
|
|
99
100
|
"typescript": "^6.0.3"
|
|
100
101
|
},
|
|
101
102
|
"devDependencies": {
|
|
102
|
-
"standard-version": "^9.5.0"
|
|
103
|
+
"standard-version": "^9.5.0",
|
|
104
|
+
"typedoc": "^0.28.20"
|
|
103
105
|
}
|
|
104
106
|
}
|