pr-checkmate 4.1.2 → 4.2.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/README.md CHANGED
@@ -17,12 +17,21 @@
17
17
  > [VirusTotal scan](https://github.com/Mybono/pr_checkmate_public/releases/latest) of the
18
18
  > exact published tarball on every release — plus 54 code-quality checks across 11
19
19
  > languages, bundled. One npm package, one `pr-checkmate.json`, no per-language toolchain
20
- > setup for the bundled ones. Also an [MCP server](#ai-agents-mcp): your AI coding agent runs the
21
- > same gate while it writes code.
20
+ > setup for the bundled ones. Also an [MCP server](#ai-agents-mcp) and a
21
+ > [Claude Code plugin](#ai-agents-mcp): your AI coding agent runs the same gate while it writes code.
22
22
 
23
23
  Language is auto-detected. Checks run in parallel phases, results post as one PR comment
24
24
  that updates in place, and formatter fixes are committed back to the branch.
25
25
 
26
+ **Using Claude Code?** Install it as a plugin, one command, no `npm install` needed to start:
27
+
28
+ ```text
29
+ /plugin install pr-checkmate --marketplace Mybono/pr_checkmate_public
30
+ ```
31
+
32
+ It connects the MCP server and adds a skill that sets the package up in your repository when you
33
+ agree. [Details below](#ai-agents-mcp).
34
+
26
35
  ## Quickstart
27
36
 
28
37
  **1. Install.**
@@ -84,6 +93,12 @@ your `PATH`). To stop Claude Code asking before every call, allow `mcp__pr-check
84
93
  `permissions.allow`
85
94
  ([details](https://github.com/Mybono/pr_checkmate_public/blob/main/documentation/ai-agents.md#after-installing)).
86
95
 
96
+ **Claude Code plugin.** The one-command install at the top of this page replaces the two commands
97
+ above. It runs the MCP server with `npx`, pinned to the released version, and adds a skill that
98
+ offers to install the npm package if it is missing. The tools are named
99
+ `mcp__plugin_pr-checkmate_mcp__*`, so allow that prefix instead of `mcp__pr-checkmate`. Claude
100
+ Code still asks before the first call of each tool.
101
+
87
102
  | Tool | The agent calls it |
88
103
  |---|---|
89
104
  | `get_rules` | before writing — what blocks a PR, what only warns, your custom rules and banned imports |
package/dist/cjs/cli.js CHANGED
@@ -29,6 +29,12 @@ const argv = process.argv.slice(2);
29
29
  const flags = argv.filter(arg => arg.startsWith('-'));
30
30
  const args = argv.filter(arg => !arg.startsWith('-'));
31
31
  const cmd = args[0];
32
+ const WITH_AGENT = '--with-agent';
33
+ const NO_HOOK = '--no-hook';
34
+ /** Runs `agent-setup`; the commit hook is on unless `--no-hook` was passed. */
35
+ function runAgentSetup() {
36
+ (0, setup_js_1.reportSetup)((0, setup_js_1.setupAgent)(process.cwd(), { hook: !flags.includes(NO_HOOK) }));
37
+ }
32
38
  /**
33
39
  * An unrecognised flag aborts the run. Ignoring it would report success for a scope
34
40
  * the user did not ask for: a misspelling of `--full` must not quietly review the
@@ -55,8 +61,13 @@ function rejectConflictingScope() {
55
61
  index_js_2.logger.error('[cli]: "precommit --full" is contradictory — precommit reviews the staged changes. Run "pr-checkmate all --full" for a whole-repo review.');
56
62
  process.exit(1);
57
63
  }
58
- if (cmd === 'init' && flags.length > 0) {
59
- index_js_2.logger.error(`[cli]: "init" takes no flags, got: ${flags.join(', ')}.`);
64
+ const initFlags = flags.filter(flag => flag !== WITH_AGENT && flag !== NO_HOOK);
65
+ if (cmd === 'init' && initFlags.length > 0) {
66
+ index_js_2.logger.error(`[cli]: "init" takes only "--with-agent", got: ${initFlags.join(', ')}.`);
67
+ process.exit(1);
68
+ }
69
+ if (flags.includes(WITH_AGENT) && cmd !== 'init') {
70
+ index_js_2.logger.error('[cli]: "--with-agent" applies only to "init".');
60
71
  process.exit(1);
61
72
  }
62
73
  // `--all` belongs to `install` alone. Accepting it elsewhere would look like a
@@ -80,8 +91,9 @@ function rejectConflictingScope() {
80
91
  index_js_2.logger.error('[cli]: "--sarif" applies only to commands that run checks.');
81
92
  process.exit(1);
82
93
  }
83
- if (flags.includes('--no-hook') && cmd !== 'agent-setup') {
84
- index_js_2.logger.error('[cli]: "--no-hook" applies only to "agent-setup".');
94
+ const agentSetupInInit = cmd === 'init' && flags.includes(WITH_AGENT);
95
+ if (flags.includes(NO_HOOK) && cmd !== 'agent-setup' && !agentSetupInInit) {
96
+ index_js_2.logger.error('[cli]: "--no-hook" applies only to "agent-setup" or "init --with-agent".');
85
97
  process.exit(1);
86
98
  }
87
99
  if (flags.includes('--full') && commands_js_1.AGENT_COMMANDS.includes(cmd ?? '')) {
@@ -153,7 +165,7 @@ async function runAgentCommand() {
153
165
  process.exit(verdict.exitCode);
154
166
  }
155
167
  if (cmd === 'agent-setup') {
156
- (0, setup_js_1.reportSetup)((0, setup_js_1.setupAgent)(process.cwd(), { hook: !flags.includes('--no-hook') }));
168
+ runAgentSetup();
157
169
  process.exit(0);
158
170
  }
159
171
  return false;
@@ -165,6 +177,8 @@ void (async () => {
165
177
  rejectExtraArgs();
166
178
  if (cmd === 'init') {
167
179
  await (0, init_js_1.init)();
180
+ if (flags.includes(WITH_AGENT))
181
+ runAgentSetup();
168
182
  process.exit(0);
169
183
  }
170
184
  if (await runAgentCommand())
@@ -98,5 +98,6 @@ exports.FLAGS = {
98
98
  '--full': 'review every tracked file instead of the diff (the default outside CI)',
99
99
  '--all': 'with "install": fetch every profile, not only the ones this repository needs',
100
100
  '--sarif': 'write findings as SARIF 2.1.0 to pr-checkmate.sarif (check-running commands only)',
101
- '--no-hook': 'with "agent-setup": skip the git-commit gate for Claude Code',
101
+ '--no-hook': 'with "agent-setup" or "init --with-agent": skip the git-commit gate for Claude Code',
102
+ '--with-agent': 'with "init": also run "agent-setup" (MCP server, agent instructions, hook)',
102
103
  };
package/dist/esm/cli.js CHANGED
@@ -24,6 +24,12 @@ const argv = process.argv.slice(2);
24
24
  const flags = argv.filter(arg => arg.startsWith('-'));
25
25
  const args = argv.filter(arg => !arg.startsWith('-'));
26
26
  const cmd = args[0];
27
+ const WITH_AGENT = '--with-agent';
28
+ const NO_HOOK = '--no-hook';
29
+ /** Runs `agent-setup`; the commit hook is on unless `--no-hook` was passed. */
30
+ function runAgentSetup() {
31
+ reportSetup(setupAgent(process.cwd(), { hook: !flags.includes(NO_HOOK) }));
32
+ }
27
33
  /**
28
34
  * An unrecognised flag aborts the run. Ignoring it would report success for a scope
29
35
  * the user did not ask for: a misspelling of `--full` must not quietly review the
@@ -50,8 +56,13 @@ function rejectConflictingScope() {
50
56
  logger.error('[cli]: "precommit --full" is contradictory — precommit reviews the staged changes. Run "pr-checkmate all --full" for a whole-repo review.');
51
57
  process.exit(1);
52
58
  }
53
- if (cmd === 'init' && flags.length > 0) {
54
- logger.error(`[cli]: "init" takes no flags, got: ${flags.join(', ')}.`);
59
+ const initFlags = flags.filter(flag => flag !== WITH_AGENT && flag !== NO_HOOK);
60
+ if (cmd === 'init' && initFlags.length > 0) {
61
+ logger.error(`[cli]: "init" takes only "--with-agent", got: ${initFlags.join(', ')}.`);
62
+ process.exit(1);
63
+ }
64
+ if (flags.includes(WITH_AGENT) && cmd !== 'init') {
65
+ logger.error('[cli]: "--with-agent" applies only to "init".');
55
66
  process.exit(1);
56
67
  }
57
68
  // `--all` belongs to `install` alone. Accepting it elsewhere would look like a
@@ -75,8 +86,9 @@ function rejectConflictingScope() {
75
86
  logger.error('[cli]: "--sarif" applies only to commands that run checks.');
76
87
  process.exit(1);
77
88
  }
78
- if (flags.includes('--no-hook') && cmd !== 'agent-setup') {
79
- logger.error('[cli]: "--no-hook" applies only to "agent-setup".');
89
+ const agentSetupInInit = cmd === 'init' && flags.includes(WITH_AGENT);
90
+ if (flags.includes(NO_HOOK) && cmd !== 'agent-setup' && !agentSetupInInit) {
91
+ logger.error('[cli]: "--no-hook" applies only to "agent-setup" or "init --with-agent".');
80
92
  process.exit(1);
81
93
  }
82
94
  if (flags.includes('--full') && AGENT_COMMANDS.includes(cmd ?? '')) {
@@ -148,7 +160,7 @@ async function runAgentCommand() {
148
160
  process.exit(verdict.exitCode);
149
161
  }
150
162
  if (cmd === 'agent-setup') {
151
- reportSetup(setupAgent(process.cwd(), { hook: !flags.includes('--no-hook') }));
163
+ runAgentSetup();
152
164
  process.exit(0);
153
165
  }
154
166
  return false;
@@ -160,6 +172,8 @@ void (async () => {
160
172
  rejectExtraArgs();
161
173
  if (cmd === 'init') {
162
174
  await init();
175
+ if (flags.includes(WITH_AGENT))
176
+ runAgentSetup();
163
177
  process.exit(0);
164
178
  }
165
179
  if (await runAgentCommand())
@@ -95,5 +95,6 @@ export const FLAGS = {
95
95
  '--full': 'review every tracked file instead of the diff (the default outside CI)',
96
96
  '--all': 'with "install": fetch every profile, not only the ones this repository needs',
97
97
  '--sarif': 'write findings as SARIF 2.1.0 to pr-checkmate.sarif (check-running commands only)',
98
- '--no-hook': 'with "agent-setup": skip the git-commit gate for Claude Code',
98
+ '--no-hook': 'with "agent-setup" or "init --with-agent": skip the git-commit gate for Claude Code',
99
+ '--with-agent': 'with "init": also run "agent-setup" (MCP server, agent instructions, hook)',
99
100
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pr-checkmate",
3
- "version": "4.1.2",
3
+ "version": "4.2.0",
4
4
  "description": "Security-first PR gate for CI: secret scanning, grype dependency scanning, SBOM — plus linting and formatting across 11 languages",
5
5
  "keywords": [
6
6
  "github-actions",