@agenticcli/shipguard 0.8.1 → 0.10.0-rc.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.
@@ -2,7 +2,8 @@ import {
2
2
  DEFAULT_MAX_FILES,
3
3
  DEFAULT_MAX_FILE_SIZE_BYTES,
4
4
  DEFAULT_MAX_TOTAL_BYTES
5
- } from "./chunk-MVYY4QWT.js";
5
+ } from "./chunk-E4Z2MZ5J.js";
6
+ import "./chunk-NC5RELTG.js";
6
7
  import "./chunk-KGIK7XNK.js";
7
8
 
8
9
  // src/core/config-generator.ts
@@ -7,7 +7,8 @@ import {
7
7
  runProRules,
8
8
  runProRulesWithDispatch,
9
9
  validateBundleCompile
10
- } from "./chunk-BGWAAJ5S.js";
10
+ } from "./chunk-6XMYOF3N.js";
11
+ import "./chunk-NC5RELTG.js";
11
12
  import "./chunk-KGIK7XNK.js";
12
13
  export {
13
14
  NoRulesAppliedError,
package/docs/llms.txt CHANGED
@@ -12,7 +12,7 @@ shipguard scan — scan project for risks
12
12
  shipguard scan --changed — scan only changed files
13
13
  shipguard scan --strict — exit code 1 on high-risk findings
14
14
  shipguard scan --report — generate Markdown report
15
- shipguard scan --json — machine-readable output
15
+ shipguard scan --json — machine-readable output (schemaVersion 6; the `coverage` object says how many files were discovered, scanned and skipped, and why)
16
16
  shipguard scan --check-regressions — exit code 1 if a previously-passing rule now fails
17
17
  shipguard history — show recent local scan history for this repo (read-only)
18
18
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agenticcli/shipguard",
3
- "version": "0.8.1",
3
+ "version": "0.10.0-rc.0",
4
4
  "description": "CLI-first release gate for AI-built apps",
5
5
  "type": "module",
6
6
  "main": "./dist/cli.js",
@@ -15,14 +15,14 @@
15
15
  "README.md"
16
16
  ],
17
17
  "dependencies": {
18
- "@noble/hashes": "^2.2.0",
18
+ "@noble/hashes": "^2.4.0",
19
19
  "chalk": "^5.4.0",
20
20
  "commander": "^13.1.0",
21
21
  "fast-glob": "^3.3.0",
22
- "jose": "^6.2.3",
23
- "minimatch": "^10.2.5",
22
+ "jose": "^6.2.13",
23
+ "minimatch": "^11.0.1",
24
24
  "re2js": "2.8.3",
25
- "yaml": "^2.7.0"
25
+ "yaml": "^2.9.1"
26
26
  },
27
27
  "devDependencies": {
28
28
  "@types/node": "^22.0.0",
@@ -40,7 +40,6 @@
40
40
  "agenticcli",
41
41
  "release-gate",
42
42
  "ai-code",
43
- "security",
44
43
  "cli",
45
44
  "ai-agents",
46
45
  "claude-code",
@@ -48,11 +47,10 @@
48
47
  "codex",
49
48
  "agentic",
50
49
  "pre-deploy-check",
51
- "secrets-scanner",
52
50
  "llm-generated-code"
53
51
  ],
54
52
  "license": "Elastic-2.0",
55
- "author": "agenticcli",
53
+ "author": "AgenticCLI",
56
54
  "repository": {
57
55
  "type": "git",
58
56
  "url": "git+https://github.com/agenticcli/shipguard.git"
@@ -1,176 +0,0 @@
1
- import {
2
- decodeUtf8Strict,
3
- detectBinary,
4
- normalizeNewlines,
5
- stripBom
6
- } from "./chunk-KGIK7XNK.js";
7
-
8
- // src/utils/fs.ts
9
- import fg from "fast-glob";
10
- import { readFile, stat } from "fs/promises";
11
- import { join } from "path";
12
- var DEFAULT_MAX_FILE_SIZE_BYTES = 512 * 1024;
13
- var DEFAULT_MAX_TOTAL_BYTES = 256 * 1024 * 1024;
14
- var DEFAULT_MAX_FILES = 5e3;
15
- var DEFAULT_IGNORE = [
16
- "node_modules/**",
17
- "dist/**",
18
- "build/**",
19
- ".next/**",
20
- "coverage/**",
21
- ".git/**",
22
- "*.lock",
23
- "pnpm-lock.yaml",
24
- "package-lock.json",
25
- // Extended — large artifact directories
26
- ".cache/**",
27
- ".turbo/**",
28
- ".venv/**",
29
- "venv/**",
30
- "vendor/**",
31
- "tmp/**",
32
- "out/**",
33
- // Large file extensions — binary and generated
34
- "*.log",
35
- "*.min.js",
36
- "*.map",
37
- "*.png",
38
- "*.jpg",
39
- "*.jpeg",
40
- "*.gif",
41
- "*.webp",
42
- "*.ico",
43
- "*.pdf",
44
- "*.zip",
45
- "*.gz",
46
- "*.tar",
47
- "*.mp4",
48
- "*.mov",
49
- "*.wasm",
50
- "*.node",
51
- ".DS_Store",
52
- // ShipGuard's own report output — never scan the tool's own artifacts
53
- ".shipguard/**"
54
- ];
55
- var MAX_SKIPPED_NAMES = 50;
56
- function compareScanPaths(a, b) {
57
- return a < b ? -1 : a > b ? 1 : 0;
58
- }
59
- async function readFiles(rootDir, patterns = ["**/*"], ignorePatterns = [], options = {}) {
60
- const maxFileSizeBytes = options.maxFileSizeBytes ?? DEFAULT_MAX_FILE_SIZE_BYTES;
61
- const maxTotalBytes = options.maxTotalBytes ?? DEFAULT_MAX_TOTAL_BYTES;
62
- const maxFiles = options.maxFiles ?? DEFAULT_MAX_FILES;
63
- const { onProgress } = options;
64
- const allIgnore = [...DEFAULT_IGNORE, ...ignorePatterns];
65
- const filePaths = await fg(patterns, {
66
- cwd: rootDir,
67
- ignore: allIgnore,
68
- dot: true,
69
- absolute: false,
70
- onlyFiles: true,
71
- // Privacy moat: NEVER follow symlinks. A symlink inside
72
- // the project pointing out of the root (e.g. `ln -s /home escape`) would
73
- // otherwise cause the scan to descend out-of-tree, reading and reporting
74
- // files the user never intended to scan (and risking a hang on huge external
75
- // trees). The user's code must never leave their machine; out-of-tree files
76
- // must never enter the scan. fast-glob defaults this to true, so it is
77
- // load-bearing that we set it false explicitly.
78
- followSymbolicLinks: false
79
- });
80
- filePaths.sort(compareScanPaths);
81
- const symlinkProbeEntries = await fg(patterns, {
82
- cwd: rootDir,
83
- ignore: allIgnore,
84
- dot: true,
85
- absolute: false,
86
- onlyFiles: false,
87
- followSymbolicLinks: false,
88
- objectMode: true
89
- });
90
- const allSkippedSymlinkPaths = symlinkProbeEntries.filter((entry) => entry.dirent.isSymbolicLink()).map((entry) => entry.path).sort(compareScanPaths);
91
- const skippedSymlinks = allSkippedSymlinkPaths.length;
92
- const skippedSymlinkFiles = allSkippedSymlinkPaths.slice(0, MAX_SKIPPED_NAMES);
93
- if (skippedSymlinks > 0) {
94
- const named = skippedSymlinkFiles.join(", ");
95
- const more = skippedSymlinks > skippedSymlinkFiles.length ? " (and others)" : "";
96
- console.warn(
97
- `[shipguard] Scan INCOMPLETE: ${skippedSymlinks} symlink(s) not followed (privacy protection) and NOT scanned: ${named}${more}`
98
- );
99
- }
100
- const total = filePaths.length;
101
- const files = [];
102
- let skippedTooLarge = 0;
103
- const skippedTooLargeFiles = [];
104
- let skippedBinary = 0;
105
- const skippedBinaryFiles = [];
106
- let truncated = false;
107
- let totalBytes = 0;
108
- let processed = 0;
109
- const invalidUtf8Files = [];
110
- const unreadableFiles = [];
111
- for (const fp of filePaths) {
112
- if (files.length >= maxFiles || totalBytes >= maxTotalBytes) {
113
- truncated = true;
114
- break;
115
- }
116
- const fullPath = join(rootDir, fp);
117
- try {
118
- const fileStat = await stat(fullPath);
119
- if (fileStat.size > maxFileSizeBytes) {
120
- skippedTooLarge++;
121
- if (skippedTooLargeFiles.length < MAX_SKIPPED_NAMES) {
122
- skippedTooLargeFiles.push(fp);
123
- }
124
- onProgress?.(++processed, total, fp);
125
- continue;
126
- }
127
- const buffer = await readFile(fullPath);
128
- if (detectBinary(new Uint8Array(buffer))) {
129
- skippedBinary++;
130
- if (skippedBinaryFiles.length < MAX_SKIPPED_NAMES) {
131
- skippedBinaryFiles.push(fp);
132
- }
133
- onProgress?.(++processed, total, fp);
134
- continue;
135
- }
136
- const decoded = decodeUtf8Strict(new Uint8Array(buffer));
137
- if (!decoded.ok) {
138
- invalidUtf8Files.push({ relativePath: fp, reason: decoded.reason });
139
- onProgress?.(++processed, total, fp);
140
- continue;
141
- }
142
- const content = normalizeNewlines(stripBom(decoded.text));
143
- totalBytes += buffer.length;
144
- files.push({
145
- path: fullPath,
146
- content,
147
- relativePath: fp
148
- });
149
- } catch (err) {
150
- const detail = err instanceof Error ? err.message : String(err);
151
- console.warn(`[shipguard] Could not read file ${fp}: ${detail}`);
152
- unreadableFiles.push(fp);
153
- }
154
- onProgress?.(++processed, total, fp);
155
- }
156
- return {
157
- files,
158
- skippedTooLarge,
159
- skippedTooLargeFiles,
160
- skippedBinary,
161
- skippedBinaryFiles,
162
- skippedSymlinks,
163
- skippedSymlinkFiles,
164
- truncated,
165
- invalidUtf8Files,
166
- unreadableFiles
167
- };
168
- }
169
-
170
- export {
171
- DEFAULT_MAX_FILE_SIZE_BYTES,
172
- DEFAULT_MAX_TOTAL_BYTES,
173
- DEFAULT_MAX_FILES,
174
- compareScanPaths,
175
- readFiles
176
- };