@agenticcli/shipguard 0.1.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 +28 -0
- package/dist/chunk-42MA7DQY.js +1444 -0
- package/dist/cli.js +908 -0
- package/dist/config-generator-EQNRHODF.js +57 -0
- package/dist/framework-PA6RVE7G.js +27 -0
- package/dist/pro-scanner-YZDS67FB.js +10 -0
- package/docs/llms.txt +31 -0
- package/package.json +63 -0
- package/templates/shipguard.policy.yml +32 -0
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
// src/core/config-generator.ts
|
|
2
|
+
import { writeFileSync, existsSync } from "fs";
|
|
3
|
+
import { join } from "path";
|
|
4
|
+
var CONFIG_FILENAME = ".shipguard.yml";
|
|
5
|
+
function hasConfig(cwd) {
|
|
6
|
+
return existsSync(join(cwd, CONFIG_FILENAME));
|
|
7
|
+
}
|
|
8
|
+
function generateConfig(cwd, frameworks) {
|
|
9
|
+
const frameworkLines = frameworks.filter((f) => f.name !== "generic").map((f) => {
|
|
10
|
+
const version = f.version ? `
|
|
11
|
+
version: "${f.version}"` : "";
|
|
12
|
+
return ` - name: ${f.name}${version}`;
|
|
13
|
+
}).join("\n");
|
|
14
|
+
const config = `# ShipGuard configuration \u2014 auto-generated ${(/* @__PURE__ */ new Date()).toISOString().split("T")[0]}
|
|
15
|
+
# Edit to customize scanning behavior
|
|
16
|
+
configVersion: 2
|
|
17
|
+
|
|
18
|
+
project:
|
|
19
|
+
name: ${cwd.split("/").pop() || "my-app"}
|
|
20
|
+
|
|
21
|
+
stack:
|
|
22
|
+
frameworks:
|
|
23
|
+
${frameworkLines || " - name: generic"}
|
|
24
|
+
language: typescript
|
|
25
|
+
|
|
26
|
+
scan:
|
|
27
|
+
categories:
|
|
28
|
+
- auth
|
|
29
|
+
- injection
|
|
30
|
+
- supply-chain
|
|
31
|
+
- secrets
|
|
32
|
+
- deployment
|
|
33
|
+
severityThreshold: medium
|
|
34
|
+
changedOnly: false
|
|
35
|
+
rulesVersion: null
|
|
36
|
+
|
|
37
|
+
ignore:
|
|
38
|
+
paths:
|
|
39
|
+
- "**/__tests__/**"
|
|
40
|
+
- "**/test/**"
|
|
41
|
+
- "**/*.test.ts"
|
|
42
|
+
- "**/node_modules/**"
|
|
43
|
+
|
|
44
|
+
telemetry:
|
|
45
|
+
enabled: true
|
|
46
|
+
|
|
47
|
+
output:
|
|
48
|
+
report: null
|
|
49
|
+
`;
|
|
50
|
+
const configPath = join(cwd, CONFIG_FILENAME);
|
|
51
|
+
writeFileSync(configPath, config, "utf-8");
|
|
52
|
+
return configPath;
|
|
53
|
+
}
|
|
54
|
+
export {
|
|
55
|
+
generateConfig,
|
|
56
|
+
hasConfig
|
|
57
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
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
|
+
};
|
package/docs/llms.txt
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# ShipGuard CLI
|
|
2
|
+
> CLI-first release gate for AI-built apps
|
|
3
|
+
|
|
4
|
+
ShipGuard checks the high-risk mistakes that AI coding agents commonly introduce before code is deployed.
|
|
5
|
+
|
|
6
|
+
## Install
|
|
7
|
+
npm install -g @agenticcli/shipguard
|
|
8
|
+
|
|
9
|
+
## Commands
|
|
10
|
+
shipguard init — initialize policy file
|
|
11
|
+
shipguard scan — scan project for risks
|
|
12
|
+
shipguard scan --changed — scan only changed files
|
|
13
|
+
shipguard scan --strict — exit code 1 on high-risk findings
|
|
14
|
+
shipguard scan --report — generate Markdown report
|
|
15
|
+
shipguard scan --json — machine-readable output
|
|
16
|
+
|
|
17
|
+
## Risk Categories
|
|
18
|
+
- Secrets: hardcoded API keys, committed .env files, frontend exposure
|
|
19
|
+
- Auth: unprotected admin routes, missing auth middleware
|
|
20
|
+
- Payments: Stripe/Razorpay webhook signature verification
|
|
21
|
+
- Database: destructive SQL migrations, schema risks
|
|
22
|
+
- Deployment: CORS misconfiguration, debug mode, missing headers
|
|
23
|
+
|
|
24
|
+
## Target Users
|
|
25
|
+
Solo SaaS founders, indie hackers, small dev teams using Claude Code, Codex, Cursor, or Lovable
|
|
26
|
+
|
|
27
|
+
## GitHub
|
|
28
|
+
https://github.com/ramxH3421/agenticcli
|
|
29
|
+
|
|
30
|
+
## npm
|
|
31
|
+
https://www.npmjs.com/package/@agenticcli/shipguard
|
package/package.json
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@agenticcli/shipguard",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "CLI-first release gate for AI-built apps",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./dist/cli.js",
|
|
7
|
+
"bin": {
|
|
8
|
+
"shipguard": "./dist/cli.js"
|
|
9
|
+
},
|
|
10
|
+
"files": [
|
|
11
|
+
"dist",
|
|
12
|
+
"templates",
|
|
13
|
+
"docs",
|
|
14
|
+
"README.md"
|
|
15
|
+
],
|
|
16
|
+
"dependencies": {
|
|
17
|
+
"@noble/hashes": "^2.2.0",
|
|
18
|
+
"chalk": "^5.4.0",
|
|
19
|
+
"commander": "^13.1.0",
|
|
20
|
+
"fast-glob": "^3.3.0",
|
|
21
|
+
"jose": "^6.2.3",
|
|
22
|
+
"minimatch": "^10.2.5",
|
|
23
|
+
"yaml": "^2.7.0"
|
|
24
|
+
},
|
|
25
|
+
"devDependencies": {
|
|
26
|
+
"@types/node": "^22.0.0",
|
|
27
|
+
"tsup": "^8.5.1",
|
|
28
|
+
"typescript": "^5.8.0",
|
|
29
|
+
"vitest": "^3.2.0",
|
|
30
|
+
"@agenticcli/shared": "0.1.0"
|
|
31
|
+
},
|
|
32
|
+
"keywords": [
|
|
33
|
+
"shipguard",
|
|
34
|
+
"agenticcli",
|
|
35
|
+
"release-gate",
|
|
36
|
+
"ai-code",
|
|
37
|
+
"security",
|
|
38
|
+
"cli"
|
|
39
|
+
],
|
|
40
|
+
"license": "MIT",
|
|
41
|
+
"author": "ramxH3421",
|
|
42
|
+
"repository": {
|
|
43
|
+
"type": "git",
|
|
44
|
+
"url": "https://github.com/ramxH3421/agenticcli"
|
|
45
|
+
},
|
|
46
|
+
"homepage": "https://agenticcli.dev/shipguard",
|
|
47
|
+
"bugs": {
|
|
48
|
+
"url": "https://github.com/ramxH3421/agenticcli/issues"
|
|
49
|
+
},
|
|
50
|
+
"engines": {
|
|
51
|
+
"node": ">=20"
|
|
52
|
+
},
|
|
53
|
+
"publishConfig": {
|
|
54
|
+
"access": "public"
|
|
55
|
+
},
|
|
56
|
+
"scripts": {
|
|
57
|
+
"build": "tsup",
|
|
58
|
+
"dev": "tsup --watch",
|
|
59
|
+
"test": "vitest run",
|
|
60
|
+
"test:watch": "vitest",
|
|
61
|
+
"clean": "rm -rf dist"
|
|
62
|
+
}
|
|
63
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
version: 1
|
|
2
|
+
project:
|
|
3
|
+
name: my-app
|
|
4
|
+
framework: auto
|
|
5
|
+
risk_profile: standard
|
|
6
|
+
scan:
|
|
7
|
+
changed_files_only: true
|
|
8
|
+
generate_report: true
|
|
9
|
+
block:
|
|
10
|
+
- exposed_env
|
|
11
|
+
- hardcoded_secret
|
|
12
|
+
- public_admin_route
|
|
13
|
+
- auth_route_without_guard
|
|
14
|
+
- payment_webhook_without_signature_check
|
|
15
|
+
- destructive_migration
|
|
16
|
+
- unsafe_deployment_config
|
|
17
|
+
warn:
|
|
18
|
+
- missing_tests_for_changed_code
|
|
19
|
+
- missing_error_handling
|
|
20
|
+
- risky_dependency_change
|
|
21
|
+
- missing_rate_limit
|
|
22
|
+
- missing_input_validation
|
|
23
|
+
ignore:
|
|
24
|
+
paths:
|
|
25
|
+
- node_modules/**
|
|
26
|
+
- dist/**
|
|
27
|
+
- build/**
|
|
28
|
+
- .next/**
|
|
29
|
+
- coverage/**
|
|
30
|
+
report:
|
|
31
|
+
output: .shipguard/reports/latest.md
|
|
32
|
+
format: markdown
|