@agenticcli/shipguard 0.11.0 → 0.13.1
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/LICENSE +201 -90
- package/NOTICE +4 -0
- package/README.md +29 -17
- package/dist/checksum-manifest.json +5 -5
- package/dist/{chunk-FQY6IANN.js → chunk-4J3V4FKA.js} +2080 -153
- package/dist/chunk-4J3V4FKA.js.map +1 -0
- package/dist/chunk-IZOXM3IM.js +32 -0
- package/dist/chunk-IZOXM3IM.js.map +1 -0
- package/dist/{chunk-RVDTQ2FR.js → chunk-MPBX5W3L.js} +1 -0
- package/dist/chunk-MPBX5W3L.js.map +1 -0
- package/dist/cli-facts.json +20 -12
- package/dist/cli.js +10175 -2914
- package/dist/cli.js.map +1 -0
- package/dist/{dist-5SSCBJRC.js → dist-3XUWQFMP.js} +2 -1
- package/dist/dist-3XUWQFMP.js.map +1 -0
- package/dist/framework-EUF7YNNW.js +9 -0
- package/dist/framework-EUF7YNNW.js.map +1 -0
- package/dist/{pro-scanner-43JOEAJM.js → pro-scanner-5UJZYBZF.js} +3 -3
- package/dist/pro-scanner-5UJZYBZF.js.map +1 -0
- package/docs/llms.txt +15 -7
- package/docs/placement-kit.md +9 -6
- package/package.json +25 -18
- package/rules/free-bundle.json +307 -21
- package/dist/chunk-7NXELBFO.js +0 -904
- package/dist/chunk-NC5RELTG.js +0 -40
- package/dist/config-generator-L7VDUKDY.js +0 -74
- package/dist/framework-PA6RVE7G.js +0 -27
package/dist/chunk-NC5RELTG.js
DELETED
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
// src/utils/logger.ts
|
|
2
|
-
import chalk from "chalk";
|
|
3
|
-
var logger = {
|
|
4
|
-
info: (msg) => console.error(chalk.blue("\u2139"), msg),
|
|
5
|
-
success: (msg) => console.error(chalk.green("\u2713"), msg),
|
|
6
|
-
warn: (msg) => console.error(chalk.yellow("\u26A0"), msg),
|
|
7
|
-
error: (msg) => console.error(chalk.red("\u2717"), msg),
|
|
8
|
-
// Diagnostics that are true and worth being able to inspect, but too detailed for a
|
|
9
|
-
// normal run — e.g. "this legacy finding was superseded by a governed corpus rule on
|
|
10
|
-
// the same line". Deliberately NOT a silent drop: the information is always produced
|
|
11
|
-
// and one env var makes it visible. Stderr only, like every other logger method.
|
|
12
|
-
debug: (msg) => {
|
|
13
|
-
if (process.env.SHIPGUARD_DEBUG) console.error(chalk.gray("\xB7"), msg);
|
|
14
|
-
},
|
|
15
|
-
finding: (severity, msg) => {
|
|
16
|
-
const colors = {
|
|
17
|
-
critical: chalk.bgRed.white,
|
|
18
|
-
high: chalk.red,
|
|
19
|
-
medium: chalk.yellow,
|
|
20
|
-
low: chalk.blue,
|
|
21
|
-
info: chalk.gray
|
|
22
|
-
};
|
|
23
|
-
const colorFn = colors[severity] || chalk.white;
|
|
24
|
-
const label = severity.toUpperCase().padEnd(8);
|
|
25
|
-
console.error(` ${colorFn(label)} ${msg}`);
|
|
26
|
-
},
|
|
27
|
-
score: (score, recommendation) => {
|
|
28
|
-
const color = score <= 20 ? chalk.green : score <= 50 ? chalk.yellow : chalk.red;
|
|
29
|
-
const icon = score <= 20 ? "\u2713" : score <= 50 ? "\u26A0" : "\u2717";
|
|
30
|
-
console.error("");
|
|
31
|
-
console.error(chalk.bold("ShipGuard Scan Result"));
|
|
32
|
-
console.error(`Risk Score: ${color(`${score}/100`)}`);
|
|
33
|
-
console.error(`Status: ${color(`${icon} ${recommendation.replace(/_/g, " ")}`)}`);
|
|
34
|
-
},
|
|
35
|
-
divider: () => console.error(chalk.gray("\u2500".repeat(50)))
|
|
36
|
-
};
|
|
37
|
-
|
|
38
|
-
export {
|
|
39
|
-
logger
|
|
40
|
-
};
|
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
DEFAULT_MAX_FILES,
|
|
3
|
-
DEFAULT_MAX_FILE_SIZE_BYTES,
|
|
4
|
-
DEFAULT_MAX_TOTAL_BYTES
|
|
5
|
-
} from "./chunk-7NXELBFO.js";
|
|
6
|
-
import "./chunk-NC5RELTG.js";
|
|
7
|
-
import "./chunk-RVDTQ2FR.js";
|
|
8
|
-
|
|
9
|
-
// src/core/config-generator.ts
|
|
10
|
-
import { writeFileSync, existsSync } from "fs";
|
|
11
|
-
import { join } from "path";
|
|
12
|
-
var CONFIG_FILENAME = ".shipguard.yml";
|
|
13
|
-
function hasConfig(cwd) {
|
|
14
|
-
return existsSync(join(cwd, CONFIG_FILENAME));
|
|
15
|
-
}
|
|
16
|
-
function generateConfig(cwd, frameworks) {
|
|
17
|
-
const frameworkLines = frameworks.filter((f) => f.name !== "generic").map((f) => {
|
|
18
|
-
const version = f.version ? `
|
|
19
|
-
version: "${f.version}"` : "";
|
|
20
|
-
return ` - name: ${f.name}${version}`;
|
|
21
|
-
}).join("\n");
|
|
22
|
-
const config = `# ShipGuard configuration \u2014 auto-generated ${(/* @__PURE__ */ new Date()).toISOString().split("T")[0]}
|
|
23
|
-
# Edit to customize scanning behavior
|
|
24
|
-
configVersion: 2
|
|
25
|
-
|
|
26
|
-
project:
|
|
27
|
-
name: ${cwd.split("/").pop() || "my-app"}
|
|
28
|
-
|
|
29
|
-
stack:
|
|
30
|
-
frameworks:
|
|
31
|
-
${frameworkLines || " - name: generic"}
|
|
32
|
-
language: typescript
|
|
33
|
-
|
|
34
|
-
scan:
|
|
35
|
-
categories:
|
|
36
|
-
- auth
|
|
37
|
-
- injection
|
|
38
|
-
- supply-chain
|
|
39
|
-
- secrets
|
|
40
|
-
- deployment
|
|
41
|
-
severityThreshold: medium
|
|
42
|
-
changedOnly: false
|
|
43
|
-
rulesVersion: null
|
|
44
|
-
|
|
45
|
-
ignore:
|
|
46
|
-
paths:
|
|
47
|
-
- "**/__tests__/**"
|
|
48
|
-
- "**/test/**"
|
|
49
|
-
- "**/*.test.ts"
|
|
50
|
-
- "**/node_modules/**"
|
|
51
|
-
|
|
52
|
-
limits:
|
|
53
|
-
# Per-file size cap \u2014 files larger than this are skipped (not read into memory)
|
|
54
|
-
maxFileSizeBytes: ${DEFAULT_MAX_FILE_SIZE_BYTES}
|
|
55
|
-
# Total bytes cap across all files \u2014 scan stops if exceeded (degraded mode)
|
|
56
|
-
maxTotalBytes: ${DEFAULT_MAX_TOTAL_BYTES}
|
|
57
|
-
# Maximum number of files to scan \u2014 scan stops if exceeded (degraded mode)
|
|
58
|
-
maxFiles: ${DEFAULT_MAX_FILES}
|
|
59
|
-
|
|
60
|
-
# Pseudonymous usage ping (see \`shipguard telemetry status\`). Set enabled: false to opt out in this project.
|
|
61
|
-
telemetry:
|
|
62
|
-
enabled: true
|
|
63
|
-
|
|
64
|
-
output:
|
|
65
|
-
report: null
|
|
66
|
-
`;
|
|
67
|
-
const configPath = join(cwd, CONFIG_FILENAME);
|
|
68
|
-
writeFileSync(configPath, config, "utf-8");
|
|
69
|
-
return configPath;
|
|
70
|
-
}
|
|
71
|
-
export {
|
|
72
|
-
generateConfig,
|
|
73
|
-
hasConfig
|
|
74
|
-
};
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
// src/core/framework.ts
|
|
2
|
-
import { readFileSync, existsSync } from "fs";
|
|
3
|
-
import { join } from "path";
|
|
4
|
-
function detectFrameworks(projectDir) {
|
|
5
|
-
const pkgPath = join(projectDir, "package.json");
|
|
6
|
-
if (!existsSync(pkgPath)) return { frameworks: [{ name: "generic" }] };
|
|
7
|
-
const pkg = JSON.parse(readFileSync(pkgPath, "utf-8"));
|
|
8
|
-
const deps = { ...pkg.dependencies, ...pkg.devDependencies };
|
|
9
|
-
const frameworks = [];
|
|
10
|
-
if (deps["next"]) frameworks.push({ name: "nextjs", version: deps["next"].replace(/[\^~]/, "") });
|
|
11
|
-
if (deps["express"]) frameworks.push({ name: "express", version: deps["express"].replace(/[\^~]/, "") });
|
|
12
|
-
if (deps["fastify"]) frameworks.push({ name: "fastify", version: deps["fastify"].replace(/[\^~]/, "") });
|
|
13
|
-
if (deps["prisma"] || deps["@prisma/client"]) frameworks.push({ name: "prisma", version: (deps["prisma"] ?? deps["@prisma/client"])?.replace(/[\^~]/, "") });
|
|
14
|
-
if (deps["drizzle-orm"]) frameworks.push({ name: "drizzle", version: deps["drizzle-orm"]?.replace(/[\^~]/, "") });
|
|
15
|
-
if (deps["@supabase/supabase-js"]) frameworks.push({ name: "supabase", version: deps["@supabase/supabase-js"]?.replace(/[\^~]/, "") });
|
|
16
|
-
if (frameworks.length === 0) frameworks.push({ name: "generic" });
|
|
17
|
-
return { frameworks };
|
|
18
|
-
}
|
|
19
|
-
function detectFramework(projectDir) {
|
|
20
|
-
const { frameworks } = detectFrameworks(projectDir);
|
|
21
|
-
const primary = frameworks.find((f) => f.name !== "generic") ?? frameworks[0];
|
|
22
|
-
return { framework: primary.name, version: primary.version };
|
|
23
|
-
}
|
|
24
|
-
export {
|
|
25
|
-
detectFramework,
|
|
26
|
-
detectFrameworks
|
|
27
|
-
};
|