@vibecheckai/cli 3.8.0 → 3.9.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/bin/runners/lib/agent-firewall/enforcement/index.js +98 -98
- package/bin/runners/lib/agent-firewall/enforcement/mode.js +318 -318
- package/bin/runners/lib/agent-firewall/enforcement/orchestrator.js +484 -484
- package/bin/runners/lib/agent-firewall/enforcement/proof-artifact.js +418 -418
- package/bin/runners/lib/agent-firewall/enforcement/verdict-v2.js +333 -333
- package/bin/runners/lib/agent-firewall/intent/alignment-engine.js +634 -622
- package/bin/runners/lib/agent-firewall/intent/index.js +102 -102
- package/bin/runners/lib/agent-firewall/intent/schema.js +352 -352
- package/bin/runners/lib/agent-firewall/intent/store.js +283 -283
- package/bin/runners/lib/agent-firewall/interceptor/base.js +7 -3
- package/bin/runners/lib/engine/ast-cache.js +210 -210
- package/bin/runners/lib/engine/auth-extractor.js +211 -211
- package/bin/runners/lib/engine/billing-extractor.js +112 -112
- package/bin/runners/lib/engine/enforcement-extractor.js +100 -100
- package/bin/runners/lib/engine/env-extractor.js +207 -207
- package/bin/runners/lib/engine/express-extractor.js +208 -208
- package/bin/runners/lib/engine/extractors.js +849 -849
- package/bin/runners/lib/engine/index.js +207 -207
- package/bin/runners/lib/engine/repo-index.js +514 -514
- package/bin/runners/lib/engine/types.js +124 -124
- package/bin/runners/lib/unified-cli-output.js +16 -0
- package/bin/runners/runCI.js +353 -0
- package/bin/runners/runCheckpoint.js +2 -2
- package/bin/runners/runIntent.js +906 -906
- package/bin/runners/runPacks.js +2089 -2089
- package/bin/runners/runReality.js +178 -1
- package/bin/runners/runShield.js +1282 -1282
- package/mcp-server/handlers/index.ts +2 -2
- package/mcp-server/handlers/tool-handler.ts +47 -8
- package/mcp-server/lib/executor.ts +5 -5
- package/mcp-server/lib/index.ts +14 -4
- package/mcp-server/lib/sandbox.test.ts +4 -4
- package/mcp-server/lib/sandbox.ts +2 -2
- package/mcp-server/package.json +1 -1
- package/mcp-server/registry.test.ts +18 -12
- package/mcp-server/tsconfig.json +1 -0
- package/package.json +2 -1
|
@@ -13,8 +13,9 @@
|
|
|
13
13
|
* 7) Return response with error envelope
|
|
14
14
|
*/
|
|
15
15
|
|
|
16
|
-
import * as fs from "fs";
|
|
17
|
-
import * as path from "path";
|
|
16
|
+
import * as fs from "node:fs";
|
|
17
|
+
import * as path from "node:path";
|
|
18
|
+
import { fileURLToPath } from "node:url";
|
|
18
19
|
import Ajv from "ajv";
|
|
19
20
|
import type {
|
|
20
21
|
RunRequest,
|
|
@@ -25,9 +26,46 @@ import type {
|
|
|
25
26
|
ToolResult,
|
|
26
27
|
ValidationError,
|
|
27
28
|
Finding,
|
|
28
|
-
} from "../lib/types";
|
|
29
|
-
import {
|
|
30
|
-
import { CliExecutor, parseCliOutput, sortFindings, buildCliArgs } from "../lib/executor";
|
|
29
|
+
} from "../lib/types.js";
|
|
30
|
+
import { resolveSandboxPath, configFromRunRequest, type SandboxConfig } from "../lib/sandbox.js";
|
|
31
|
+
import { CliExecutor, parseCliOutput, sortFindings, buildCliArgs } from "../lib/executor.js";
|
|
32
|
+
|
|
33
|
+
// ESM __dirname equivalent
|
|
34
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
35
|
+
const __dirname = path.dirname(__filename);
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Simple PathSandbox wrapper class using the sandbox functions
|
|
39
|
+
*/
|
|
40
|
+
class PathSandbox {
|
|
41
|
+
private config: SandboxConfig;
|
|
42
|
+
|
|
43
|
+
constructor(options: { projectRoot: string }) {
|
|
44
|
+
this.config = {
|
|
45
|
+
workspaceRoot: options.projectRoot,
|
|
46
|
+
includeThirdParty: false,
|
|
47
|
+
includeGenerated: false,
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
assertAllowed(inputPath: string): string {
|
|
52
|
+
const result = resolveSandboxPath(inputPath, this.config);
|
|
53
|
+
if (!result.valid) {
|
|
54
|
+
const error = new Error(result.error || "Path not allowed") as Error & { violationType?: string };
|
|
55
|
+
error.violationType = result.errorCode;
|
|
56
|
+
throw error;
|
|
57
|
+
}
|
|
58
|
+
return result.resolvedPath!;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
validate(inputPath: string): { allowed: boolean; error?: string } {
|
|
62
|
+
const result = resolveSandboxPath(inputPath, this.config);
|
|
63
|
+
return {
|
|
64
|
+
allowed: result.valid,
|
|
65
|
+
error: result.error,
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
}
|
|
31
69
|
|
|
32
70
|
// ═══════════════════════════════════════════════════════════════════════════════
|
|
33
71
|
// REGISTRY
|
|
@@ -78,7 +116,8 @@ function getToolDefinition(toolName: string): ToolDefinition | null {
|
|
|
78
116
|
// VALIDATION
|
|
79
117
|
// ═══════════════════════════════════════════════════════════════════════════════
|
|
80
118
|
|
|
81
|
-
const
|
|
119
|
+
const AjvClass = Ajv.default || Ajv;
|
|
120
|
+
const ajv = new AjvClass({ allErrors: true, strict: false });
|
|
82
121
|
|
|
83
122
|
/**
|
|
84
123
|
* Validate data against JSON schema
|
|
@@ -86,14 +125,14 @@ const ajv = new Ajv({ allErrors: true, strict: false });
|
|
|
86
125
|
function validateSchema(
|
|
87
126
|
data: unknown,
|
|
88
127
|
schema: unknown,
|
|
89
|
-
|
|
128
|
+
_schemaName: string
|
|
90
129
|
): ValidationError[] {
|
|
91
130
|
const validate = ajv.compile(schema as object);
|
|
92
131
|
const valid = validate(data);
|
|
93
132
|
|
|
94
133
|
if (valid) return [];
|
|
95
134
|
|
|
96
|
-
return (validate.errors || []).map((err) => ({
|
|
135
|
+
return (validate.errors || []).map((err: { instancePath?: string; message?: string; params?: { allowedValues?: string[] }; data?: unknown }) => ({
|
|
97
136
|
path: err.instancePath || "/",
|
|
98
137
|
message: err.message || "Validation failed",
|
|
99
138
|
expected: err.params?.allowedValues?.join(", "),
|
|
@@ -8,9 +8,9 @@
|
|
|
8
8
|
* - Output capture and parsing
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
|
-
import { spawn, SpawnOptions } from "child_process";
|
|
12
|
-
import type { ExecutorOptions, ExecutorResult, Finding, ToolResult } from "./types";
|
|
13
|
-
import { createHash } from "crypto";
|
|
11
|
+
import { spawn, SpawnOptions } from "node:child_process";
|
|
12
|
+
import type { ExecutorOptions, ExecutorResult, Finding, ToolResult } from "./types.js";
|
|
13
|
+
import { createHash } from "node:crypto";
|
|
14
14
|
|
|
15
15
|
// ═══════════════════════════════════════════════════════════════════════════════
|
|
16
16
|
// CONSTANTS
|
|
@@ -148,7 +148,7 @@ export class CliExecutor {
|
|
|
148
148
|
}, this.timeoutMs);
|
|
149
149
|
|
|
150
150
|
// Handle process exit
|
|
151
|
-
proc.on("close", (code) => {
|
|
151
|
+
proc.on("close", (code: number | null) => {
|
|
152
152
|
clearTimeout(timeoutHandle);
|
|
153
153
|
const durationMs = Date.now() - startTime;
|
|
154
154
|
|
|
@@ -162,7 +162,7 @@ export class CliExecutor {
|
|
|
162
162
|
});
|
|
163
163
|
|
|
164
164
|
// Handle spawn errors
|
|
165
|
-
proc.on("error", (err) => {
|
|
165
|
+
proc.on("error", (err: Error) => {
|
|
166
166
|
clearTimeout(timeoutHandle);
|
|
167
167
|
const durationMs = Date.now() - startTime;
|
|
168
168
|
|
package/mcp-server/lib/index.ts
CHANGED
|
@@ -3,11 +3,21 @@
|
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
5
|
// Types
|
|
6
|
-
export * from "./types";
|
|
6
|
+
export * from "./types.js";
|
|
7
7
|
|
|
8
8
|
// Sandbox
|
|
9
|
-
export {
|
|
10
|
-
|
|
9
|
+
export {
|
|
10
|
+
resolveSandboxPath,
|
|
11
|
+
validateSandboxPaths,
|
|
12
|
+
getActiveExclusions,
|
|
13
|
+
configFromRunRequest,
|
|
14
|
+
validateRunRequest,
|
|
15
|
+
createSandboxResolver,
|
|
16
|
+
DEFAULT_EXCLUSIONS,
|
|
17
|
+
THIRD_PARTY_DIRS,
|
|
18
|
+
GENERATED_DIRS,
|
|
19
|
+
} from "./sandbox.js";
|
|
20
|
+
export type { SandboxConfig, SandboxResult, RunRequest as SandboxRunRequest } from "./sandbox.js";
|
|
11
21
|
|
|
12
22
|
// Executor
|
|
13
23
|
export {
|
|
@@ -16,4 +26,4 @@ export {
|
|
|
16
26
|
sortFindings,
|
|
17
27
|
buildCliArgs,
|
|
18
28
|
generateFindingId,
|
|
19
|
-
} from "./executor";
|
|
29
|
+
} from "./executor.js";
|
|
@@ -6,9 +6,9 @@
|
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
8
|
import { describe, it, expect, beforeAll, afterAll } from 'vitest';
|
|
9
|
-
import * as path from 'path';
|
|
10
|
-
import * as fs from 'fs';
|
|
11
|
-
import * as os from 'os';
|
|
9
|
+
import * as path from 'node:path';
|
|
10
|
+
import * as fs from 'node:fs';
|
|
11
|
+
import * as os from 'node:os';
|
|
12
12
|
import {
|
|
13
13
|
resolveSandboxPath,
|
|
14
14
|
validateSandboxPaths,
|
|
@@ -18,7 +18,7 @@ import {
|
|
|
18
18
|
createSandboxResolver,
|
|
19
19
|
SandboxConfig,
|
|
20
20
|
DEFAULT_EXCLUSIONS,
|
|
21
|
-
} from './sandbox';
|
|
21
|
+
} from './sandbox.js';
|
|
22
22
|
|
|
23
23
|
// Test workspace root
|
|
24
24
|
const TEST_ROOT = path.join(os.tmpdir(), 'sandbox-test-workspace');
|
package/mcp-server/package.json
CHANGED
|
@@ -9,8 +9,9 @@
|
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
11
|
import { describe, it, expect, beforeAll } from "vitest";
|
|
12
|
-
import * as fs from "fs";
|
|
13
|
-
import * as path from "path";
|
|
12
|
+
import * as fs from "node:fs";
|
|
13
|
+
import * as path from "node:path";
|
|
14
|
+
import { fileURLToPath } from "node:url";
|
|
14
15
|
import Ajv from "ajv";
|
|
15
16
|
|
|
16
17
|
import {
|
|
@@ -20,14 +21,19 @@ import {
|
|
|
20
21
|
getToolsByTier,
|
|
21
22
|
getToolsByCategory,
|
|
22
23
|
validateRegistry,
|
|
23
|
-
} from "./handlers/tool-handler";
|
|
24
|
-
import type { ToolDefinition } from "./lib/types";
|
|
24
|
+
} from "./handlers/tool-handler.js";
|
|
25
|
+
import type { ToolDefinition } from "./lib/types.js";
|
|
26
|
+
|
|
27
|
+
// ESM __dirname equivalent
|
|
28
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
29
|
+
const __dirname = path.dirname(__filename);
|
|
25
30
|
|
|
26
31
|
// ═══════════════════════════════════════════════════════════════════════════════
|
|
27
32
|
// TEST SETUP
|
|
28
33
|
// ═══════════════════════════════════════════════════════════════════════════════
|
|
29
34
|
|
|
30
|
-
const
|
|
35
|
+
const AjvClass = Ajv.default || Ajv;
|
|
36
|
+
const ajv = new AjvClass({ allErrors: true, strict: false });
|
|
31
37
|
|
|
32
38
|
// Load registry directly for raw tests
|
|
33
39
|
const registryPath = path.join(__dirname, "registry/tools.json");
|
|
@@ -72,7 +78,7 @@ describe("Tool Definitions", () => {
|
|
|
72
78
|
expect(tools.length).toBeGreaterThan(0);
|
|
73
79
|
});
|
|
74
80
|
|
|
75
|
-
describe.each(tools.map((t) => [t.name, t]))("%s", (name, tool) => {
|
|
81
|
+
describe.each(tools.map((t) => [t.name, t] as const))("%s", (name: string, tool: ToolDefinition) => {
|
|
76
82
|
// Required Fields
|
|
77
83
|
it("should have name matching key", () => {
|
|
78
84
|
expect(tool.name).toBe(name);
|
|
@@ -180,7 +186,7 @@ describe("Tier Distribution", () => {
|
|
|
180
186
|
});
|
|
181
187
|
|
|
182
188
|
it("free tools should include scan, report, doctor, classify", () => {
|
|
183
|
-
const freeTools = getToolsByTier("free").map((t) => t.name);
|
|
189
|
+
const freeTools = getToolsByTier("free").map((t: ToolDefinition) => t.name);
|
|
184
190
|
expect(freeTools).toContain("vibecheck.scan");
|
|
185
191
|
expect(freeTools).toContain("vibecheck.report");
|
|
186
192
|
expect(freeTools).toContain("vibecheck.doctor");
|
|
@@ -188,7 +194,7 @@ describe("Tier Distribution", () => {
|
|
|
188
194
|
});
|
|
189
195
|
|
|
190
196
|
it("pro tools should include ship, fix, prove, reality", () => {
|
|
191
|
-
const proTools = getToolsByTier("pro").map((t) => t.name);
|
|
197
|
+
const proTools = getToolsByTier("pro").map((t: ToolDefinition) => t.name);
|
|
192
198
|
expect(proTools).toContain("vibecheck.ship");
|
|
193
199
|
expect(proTools).toContain("vibecheck.fix");
|
|
194
200
|
expect(proTools).toContain("vibecheck.prove");
|
|
@@ -288,8 +294,8 @@ describe("Schema Completeness", () => {
|
|
|
288
294
|
|
|
289
295
|
for (const tool of tools) {
|
|
290
296
|
const props = tool.inputSchema.properties || {};
|
|
291
|
-
for (const [
|
|
292
|
-
expect(propSchema.description).toBeDefined();
|
|
297
|
+
for (const [_propName, propSchema] of Object.entries(props)) {
|
|
298
|
+
expect((propSchema as { description?: string }).description).toBeDefined();
|
|
293
299
|
}
|
|
294
300
|
}
|
|
295
301
|
});
|
|
@@ -299,8 +305,8 @@ describe("Schema Completeness", () => {
|
|
|
299
305
|
|
|
300
306
|
for (const tool of tools) {
|
|
301
307
|
const props = tool.inputSchema.properties || {};
|
|
302
|
-
for (const [
|
|
303
|
-
expect(propSchema.type).toBeDefined();
|
|
308
|
+
for (const [_propName, propSchema] of Object.entries(props)) {
|
|
309
|
+
expect((propSchema as { type?: string }).type).toBeDefined();
|
|
304
310
|
}
|
|
305
311
|
}
|
|
306
312
|
});
|
package/mcp-server/tsconfig.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vibecheckai/cli",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.9.1",
|
|
4
4
|
"description": "Vibecheck CLI - Ship with confidence. One verdict: SHIP | WARN | BLOCK.",
|
|
5
5
|
"main": "bin/vibecheck.js",
|
|
6
6
|
"bin": {
|
|
@@ -33,6 +33,7 @@
|
|
|
33
33
|
"debug": "^4.3.4",
|
|
34
34
|
"fast-glob": "^3.3.0",
|
|
35
35
|
"js-yaml": "^4.1.0",
|
|
36
|
+
"open": "^10.0.0",
|
|
36
37
|
"ora": "^8.0.0",
|
|
37
38
|
"uuid": "^9.0.0",
|
|
38
39
|
"zod": "^3.23.0"
|