@vaultcompass/vault-guard 1.1.1 → 1.1.2

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/dist/cli-entry.js CHANGED
@@ -9,11 +9,8 @@ if (nodeMajor < 22) {
9
9
  }
10
10
  const program = (0, cli_1.buildCli)();
11
11
  // Parse arguments and execute command
12
- program.parseAsync().then(() => {
13
- // Successful completion
14
- process.exit(0);
15
- }).catch((error) => {
12
+ program.parseAsync().catch((error) => {
16
13
  // Handle errors
17
14
  console.error(error);
18
- process.exit(1);
15
+ process.exitCode = 1;
19
16
  });
package/dist/cli.js CHANGED
@@ -52,6 +52,11 @@ function readCliVersion() {
52
52
  const raw = fs.readFileSync(pkgPath, 'utf-8');
53
53
  return JSON.parse(raw).version;
54
54
  }
55
+ function setExitCode(exitCode) {
56
+ if (exitCode !== 0) {
57
+ process.exitCode = exitCode;
58
+ }
59
+ }
55
60
  function buildCli() {
56
61
  const program = new commander_1.Command();
57
62
  program
@@ -64,8 +69,7 @@ function buildCli() {
64
69
  .description('Validate the nearest .vault-guard.json (structure + scanner load)')
65
70
  .action(async () => {
66
71
  const exitCode = await (0, config_1.configValidateCommand)(process.cwd());
67
- if (exitCode !== 0)
68
- process.exit(exitCode);
72
+ setExitCode(exitCode);
69
73
  });
70
74
  // Scan command
71
75
  program
@@ -77,9 +81,7 @@ function buildCli() {
77
81
  .action(async (path, options) => {
78
82
  const format = options.format ?? 'text';
79
83
  const exitCode = await (0, scan_1.scanCommand)(path, format, Boolean(options.staged));
80
- if (exitCode !== 0) {
81
- process.exit(exitCode);
82
- }
84
+ setExitCode(exitCode);
83
85
  });
84
86
  // Install-hook command
85
87
  program
@@ -90,7 +92,8 @@ function buildCli() {
90
92
  const m = (options.manager ?? 'native').toLowerCase();
91
93
  if (!['native', 'husky', 'lefthook', 'precommit'].includes(m)) {
92
94
  console.error(`Unknown manager: ${options.manager}`);
93
- process.exit(1);
95
+ process.exitCode = 1;
96
+ return;
94
97
  }
95
98
  await (0, install_hook_1.installHookCommand)(m);
96
99
  });
@@ -108,9 +111,7 @@ function buildCli() {
108
111
  .argument('[files...]', 'Files to check')
109
112
  .action(async (files) => {
110
113
  const exitCode = await (0, fix_1.fixCommand)(files);
111
- if (exitCode !== 0) {
112
- process.exit(exitCode);
113
- }
114
+ setExitCode(exitCode);
114
115
  });
115
116
  // Check command
116
117
  program
@@ -119,9 +120,7 @@ function buildCli() {
119
120
  .argument('[files...]', 'Files to check')
120
121
  .action(async (files) => {
121
122
  const exitCode = await (0, check_1.checkCommand)(files);
122
- if (exitCode !== 0) {
123
- process.exit(exitCode);
124
- }
123
+ setExitCode(exitCode);
125
124
  });
126
125
  program
127
126
  .command('statusline')
@@ -162,7 +161,8 @@ function buildCli() {
162
161
  const n = Number(options.maxRpm);
163
162
  if (!Number.isFinite(n) || n < 1) {
164
163
  console.error('--max-rpm must be a positive number');
165
- process.exit(1);
164
+ process.exitCode = 1;
165
+ return;
166
166
  }
167
167
  maxRpm = Math.floor(n);
168
168
  }
@@ -192,7 +192,7 @@ function buildCli() {
192
192
  }
193
193
  catch (e) {
194
194
  console.error(String(e));
195
- process.exit(1);
195
+ process.exitCode = 1;
196
196
  }
197
197
  });
198
198
  // `data` parent command — inspects, exports, and resets the local
@@ -207,8 +207,7 @@ function buildCli() {
207
207
  .option('--json', 'Print JSON', false)
208
208
  .action(async (options) => {
209
209
  const exitCode = await (0, data_1.dataStatusCommand)({ json: Boolean(options.json) });
210
- if (exitCode !== 0)
211
- process.exit(exitCode);
210
+ setExitCode(exitCode);
212
211
  });
213
212
  dataCmd
214
213
  .command('reset')
@@ -222,8 +221,7 @@ function buildCli() {
222
221
  dryRun: Boolean(options.dryRun),
223
222
  json: Boolean(options.json),
224
223
  });
225
- if (exitCode !== 0)
226
- process.exit(exitCode);
224
+ setExitCode(exitCode);
227
225
  });
228
226
  dataCmd
229
227
  .command('export')
@@ -233,8 +231,7 @@ function buildCli() {
233
231
  .action(async (options) => {
234
232
  const fmt = options.format === 'jsonl' ? 'jsonl' : 'json';
235
233
  const exitCode = await (0, data_1.dataExportCommand)({ output: options.output, format: fmt });
236
- if (exitCode !== 0)
237
- process.exit(exitCode);
234
+ setExitCode(exitCode);
238
235
  });
239
236
  return program;
240
237
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vaultcompass/vault-guard",
3
- "version": "1.1.1",
3
+ "version": "1.1.2",
4
4
  "description": "Block secrets at commit and in CI. Pre-commit hooks, SARIF output, and fast staged-file scans for AI-native workflows.",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -36,8 +36,8 @@
36
36
  "dependencies": {
37
37
  "chalk": "^4.1.2",
38
38
  "commander": "^12.0.0",
39
- "@vaultcompass/vault-guard-core": "1.1.1",
40
- "@vaultcompass/vault-guard-telemetry": "1.1.1"
39
+ "@vaultcompass/vault-guard-core": "1.1.2",
40
+ "@vaultcompass/vault-guard-telemetry": "1.1.2"
41
41
  },
42
42
  "devDependencies": {
43
43
  "@types/jest": "^30.0.0",