@agenticcli/shipguard 0.10.0 → 0.12.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
@@ -1,6 +1,8 @@
1
1
  # @agenticcli/shipguard
2
2
 
3
- CLI-first release gate for AI-built apps.
3
+ **The security scanner your coding agent runs before every commit. On your machine. Flat price, no seats.**
4
+
5
+ Same code, same answer: same diff, same verdict, a real exit code your agent can read.
4
6
 
5
7
  Checks for leaked secrets, auth gaps, payment webhook risks, destructive migrations, and deployment misconfigurations — before your code ships.
6
8
 
@@ -20,6 +22,8 @@ shipguard scan
20
22
  > **PATH gotcha:** `npm install` (without `-g`) does NOT put `shipguard` on your PATH.
21
23
  > Use `npx @agenticcli/shipguard scan` or install with `npm install -g @agenticcli/shipguard`.
22
24
 
25
+ ShipGuard is the deterministic check that runs inside your agent loop (it also works as a release gate in CI), not a code reviewer and not a general security scanner. It runs on your machine, uses plain pattern rules (no AI model), and your code never leaves your computer. Source: [github.com/agenticcli/shipguard](https://github.com/agenticcli/shipguard).
26
+
23
27
  ## Usage
24
28
 
25
29
  ```bash
@@ -47,6 +51,8 @@ shipguard hook --target ci # GitHub Actions verdict job
47
51
 
48
52
  Copy-paste snippets for `AGENTS.md`, `CLAUDE.md` and CI: [docs/placement-kit.md](docs/placement-kit.md).
49
53
 
54
+ The CLI downloads rules from the rulebook; your code never leaves your machine; only usage telemetry is sent (off with the opt-outs below).
55
+
50
56
  ## Exit codes
51
57
 
52
58
  ShipGuard is triggered by an agent; output is read machine-readably (`--json`).
@@ -57,11 +63,13 @@ and `degraded`/`degradedReasons` fields for that.
57
63
 
58
64
  | Code | Meaning |
59
65
  |------|---------|
60
- | `0` | Scan completed — verdict is in the JSON `recommendation` field. Returned even if findings are blocking, and even if the scan is degraded/partial. |
66
+ | `0` | Scan completed — verdict is in the JSON `recommendation` field. Returned even if findings are blocking, and even if the scan is degraded/partial. **Not "safe".** |
61
67
  | `1` | Blocked — **only** with `--strict`, and then on either a blocking finding **or** a scan that did not finish (`degraded: true`). An unfinished scan cannot clear a hard gate. |
62
68
  | `2` | Config error, strictly (bad policy file, bad flags, non-project directory). Never doubles as "degraded scan." |
63
69
  | `3` | Runtime error — the scan could not meaningfully run at all. |
64
70
 
71
+ So that a `0` is never read as "passed": when blocking findings exist and `--strict` is off, the terminal output ends with `exit 0 = scan finished, not safe. Add --strict to fail on blocking findings.`, and `--json` carries the same sentence in `exitMeaning`. `shipguard --help` lists the codes too.
72
+
65
73
  A degraded/partial scan (e.g. pro rules unavailable, an oversized file skipped)
66
74
  is exit `0` with `degraded: true` and a `degradedReasons[]` array in `--json`
67
75
  output — it never hijacks exit `2`, which is reserved for genuine config errors.
@@ -76,15 +84,17 @@ Every `--json` result (schemaVersion 6) has a `coverage` object: files discovere
76
84
  and skipped, with the reason for each skip (real binary, too large, symlink, unknown binary,
77
85
  invalid text, unreadable, special file), plus text read as UTF-16 or with stray NUL bytes
78
86
  turned into spaces. Real binaries (images, fonts, archives) are counted and are not a
79
- problem. A scan that read **nothing** (`NO_FILES_SCANNED`, for example an empty folder or
80
- `--changed` on a clean checkout), an unknown binary blob (`UNSCANNED_UNKNOWN_BINARY`), and a
87
+ problem. A scan that read **nothing** (`NO_FILES_SCANNED`, for example an empty folder or a
88
+ `--changed` scan where every changed file was ignored), an unknown binary blob (`UNSCANNED_UNKNOWN_BINARY`), and a
81
89
  truncated scan are `degraded` and so `DO_NOT_SHIP`. To clear a blob you trust, add its path to
82
- `ignore.paths`. Some formats are counted but their contents are not scanned: SQLite files
90
+ `ignore.paths`. `--changed` when nothing changed at all is the same: nothing was scanned, so it is `degraded`
91
+ (`NO_FILES_SCANNED`, `DO_NOT_SHIP`, `--strict` exits `1`) and also sets `coverage.changed.nothingToCheck: true`
92
+ (`filesScanned` is `0`). It is never a pass: run a full `shipguard scan` for that. Some formats are counted but their contents are not scanned: SQLite files
83
93
  outside the ASCII reading, compressed archives, and string tables inside ELF, PE, class and WASM files.
84
94
 
85
95
  ## Telemetry
86
96
 
87
- Published ShipGuard builds send one pseudonymous usage ping after each scan, plus a one-off ping on the first run on an install and one after a successful `shipguard login` (7 keys: `schema`, `event`, `eventId`, `installId`, `cliVersion`, `provenance`, `ci`; the first-run ping is never sent in CI). A scan ping carries 8 keys: `schema`, `eventId`, `installId` (random pseudonym), `cliVersion`, `provenance` (build type), `verdict` (safe / review / blocked / error), `durationBucket` and `ci`. An optional `traffic` key (`test` or `internal`) is added only if you set `SHIPGUARD_TRAFFIC`; any other value is ignored. The install id is a pseudonym stored in `~/.config/shipguard/telemetry.json`; not created or sent in CI, never linked to an account. Never file contents, paths, repo names, branches or commits, or user identity. `shipguard telemetry status` shows what is set, `shipguard telemetry reset` forgets the id (earlier pings can be deleted on request), `SHIPGUARD_TELEMETRY_DEBUG=1` prints the exact payload without sending. Builds from a source checkout never send anything.
97
+ **The CLI downloads rules from the rulebook; your code never leaves your machine; only usage telemetry is sent (off with the opt-outs below).** Published ShipGuard builds send one pseudonymous usage ping after each scan, plus a one-off ping on the first run on an install and one after a successful `shipguard login` (7 keys: `schema`, `event`, `eventId`, `installId`, `cliVersion`, `provenance`, `ci`; the first-run ping is never sent in CI). A scan ping carries 11 keys: `schema` (`4`), `eventId`, `installId` (random pseudonym), `cliVersion`, `provenance` (build type), `verdict` (safe / review / blocked / error), `durationBucket`, `ci`, and three about how ShipGuard was run: `agent` (`claude_code`, `codex`, `cursor`, `gemini_cli`, `copilot`, `opencode`, `other_agent` or `none`, from the variables the agent itself sets in your environment; only the label is sent, never a value), `interactive` (is the output a terminal) and `output` (`json`, `human` or `sarif`). Pings go to `agenticcli.dev/api/cli-telemetry` (host agenticcli.dev). Every `--json` result shows `"telemetry": "on"` or `"off"`. An optional `traffic` key (`test` or `internal`) is added only if you set `SHIPGUARD_TRAFFIC`; any other value is ignored. The install id is a pseudonym stored in `~/.config/shipguard/telemetry.json`; not created or sent in CI, never linked to an account. Never file contents, paths, repo names, branches or commits, or user identity. `shipguard telemetry status` shows what is set, `shipguard telemetry reset` forgets the id (earlier pings can be deleted on request), `SHIPGUARD_TELEMETRY_DEBUG=1` prints the exact payload without sending. Builds from a source checkout never send anything.
88
98
 
89
99
  Before the first ping on a machine, ShipGuard prints a one-line notice to stderr (in every mode, including `--json` and CI, so stdout stays clean). Turn pings off any of these ways:
90
100
 
@@ -1,7 +1,7 @@
1
1
  {
2
- "secrets": "8c4d51457fcd41a20e4863b4d3a3ad4437754237515abc2ba8f3c3b229d2c6da",
3
- "auth": "8c4d51457fcd41a20e4863b4d3a3ad4437754237515abc2ba8f3c3b229d2c6da",
4
- "database": "8c4d51457fcd41a20e4863b4d3a3ad4437754237515abc2ba8f3c3b229d2c6da",
5
- "deployment": "8c4d51457fcd41a20e4863b4d3a3ad4437754237515abc2ba8f3c3b229d2c6da",
6
- "payments": "8c4d51457fcd41a20e4863b4d3a3ad4437754237515abc2ba8f3c3b229d2c6da"
2
+ "secrets": "3a385cd0a01454b8f7aa46686083033060dee3b722903f6b1047a892aaa4ca23",
3
+ "auth": "3a385cd0a01454b8f7aa46686083033060dee3b722903f6b1047a892aaa4ca23",
4
+ "database": "3a385cd0a01454b8f7aa46686083033060dee3b722903f6b1047a892aaa4ca23",
5
+ "deployment": "3a385cd0a01454b8f7aa46686083033060dee3b722903f6b1047a892aaa4ca23",
6
+ "payments": "3a385cd0a01454b8f7aa46686083033060dee3b722903f6b1047a892aaa4ca23"
7
7
  }
@@ -6,7 +6,7 @@ import {
6
6
  detectBinary,
7
7
  normalizeNewlines,
8
8
  stripBom
9
- } from "./chunk-KGIK7XNK.js";
9
+ } from "./chunk-RVDTQ2FR.js";
10
10
 
11
11
  // src/utils/fs.ts
12
12
  import fg from "fast-glob";
@@ -298,6 +298,18 @@ function effectiveRecommendation(result) {
298
298
  return result.recommendation ?? result.riskScore.recommendation;
299
299
  }
300
300
 
301
+ // src/utils/cwd-guard.ts
302
+ import { realpathSync } from "fs";
303
+ function assertCwdAlive() {
304
+ try {
305
+ realpathSync.native(".");
306
+ } catch (err) {
307
+ throw new Error(
308
+ `The folder being scanned no longer exists (removed or moved during the scan): ${err instanceof Error ? err.message : String(err)}`
309
+ );
310
+ }
311
+ }
312
+
301
313
  // src/core/report.ts
302
314
  function severitySection(title, findings) {
303
315
  if (findings.length === 0) {
@@ -445,6 +457,7 @@ async function generateReport(result, outputPath, elapsedMs) {
445
457
  runJson: runJsonName,
446
458
  runMarkdown: runMdName
447
459
  };
460
+ assertCwdAlive();
448
461
  await mkdir(dir, { recursive: true });
449
462
  await mkdir(join(dir, RUNS_SUBDIR), { recursive: true });
450
463
  await Promise.all([
@@ -888,6 +901,7 @@ export {
888
901
  computeVerdict,
889
902
  applyVerdict,
890
903
  effectiveRecommendation,
904
+ assertCwdAlive,
891
905
  generateReport,
892
906
  buildIgnoreRules,
893
907
  classifyIgnored,
@@ -446,7 +446,7 @@ function resolveExitCode(outcome, strict) {
446
446
  }
447
447
 
448
448
  // ../matcher-contract/dist/engine-meta.js
449
- var RE2JS_VERSION = "2.8.3";
449
+ var RE2JS_VERSION = "2.8.7";
450
450
  var SUPPORTED_NODE_VERSIONS = ["20", "22"];
451
451
  function makeNativeEngineMeta(nodeVersion) {
452
452
  return {
@@ -1935,8 +1935,8 @@ function re2jsTestPattern(pattern, input) {
1935
1935
  const compiled = RE2JS.compile(pattern);
1936
1936
  return compiled.matcher(input).find();
1937
1937
  }
1938
- var RE2JS_V1_ADAPTER_IMPL_HASH = "5b277d6a183d640ac9b8ebc0dc01d292101a6e577603c5cd7c6ab360263964d9";
1939
- var RE2JS_V1_RUNTIME_ID = "971fab9b230f60a1b663c7f9a888769e9a2d6ace58fa150e8ee574a3fc3c91d7";
1938
+ var RE2JS_V1_ADAPTER_IMPL_HASH = "02e0f86920548addd8135a4391b29d34870263ec9ba61941a9fb964be8189006";
1939
+ var RE2JS_V1_RUNTIME_ID = "a780cc8e55ccc838940b9d8de644463fd41faca4ed51a7d68839e100a6800cd2";
1940
1940
 
1941
1941
  // ../matcher-contract/dist/executable-hash.js
1942
1942
  import { createHash as createHash3 } from "crypto";