Merge pull request #7558 from continuedev/tomasz/con-3679
Add terminal command security to CLI
This commit is contained in:
commit
893fd4cb7d
31 changed files with 2493 additions and 55 deletions
5
core/index.d.ts
vendored
5
core/index.d.ts
vendored
|
|
@ -1070,11 +1070,6 @@ export interface ToolExtras {
|
|||
codeBaseIndexer?: CodebaseIndexer;
|
||||
}
|
||||
|
||||
export type ToolPolicy =
|
||||
| "allowedWithPermission"
|
||||
| "allowedWithoutPermission"
|
||||
| "disabled";
|
||||
|
||||
export interface Tool {
|
||||
type: "function";
|
||||
function: {
|
||||
|
|
|
|||
19
core/package-lock.json
generated
19
core/package-lock.json
generated
|
|
@ -17,6 +17,7 @@
|
|||
"@continuedev/fetch": "file:../packages/fetch",
|
||||
"@continuedev/llm-info": "file:../packages/llm-info",
|
||||
"@continuedev/openai-adapters": "file:../packages/openai-adapters",
|
||||
"@continuedev/terminal-security": "file:../packages/terminal-security",
|
||||
"@modelcontextprotocol/sdk": "^1.12.0",
|
||||
"@mozilla/readability": "^0.5.0",
|
||||
"@octokit/rest": "^20.1.1",
|
||||
|
|
@ -238,6 +239,20 @@
|
|||
"vitest": "^3.2.4"
|
||||
}
|
||||
},
|
||||
"../packages/terminal-security": {
|
||||
"name": "@continuedev/terminal-security",
|
||||
"version": "1.0.0",
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"shell-quote": "^1.8.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "^20.11.19",
|
||||
"@types/shell-quote": "^1.7.5",
|
||||
"typescript": "^5.5.2",
|
||||
"vitest": "^1.6.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@75lb/deep-merge": {
|
||||
"version": "1.1.2",
|
||||
"resolved": "https://registry.npmjs.org/@75lb/deep-merge/-/deep-merge-1.1.2.tgz",
|
||||
|
|
@ -2957,6 +2972,10 @@
|
|||
"resolved": "../packages/openai-adapters",
|
||||
"link": true
|
||||
},
|
||||
"node_modules/@continuedev/terminal-security": {
|
||||
"resolved": "../packages/terminal-security",
|
||||
"link": true
|
||||
},
|
||||
"node_modules/@dabh/diagnostics": {
|
||||
"version": "2.0.3",
|
||||
"resolved": "https://registry.npmjs.org/@dabh/diagnostics/-/diagnostics-2.0.3.tgz",
|
||||
|
|
|
|||
|
|
@ -62,6 +62,7 @@
|
|||
"@continuedev/fetch": "file:../packages/fetch",
|
||||
"@continuedev/llm-info": "file:../packages/llm-info",
|
||||
"@continuedev/openai-adapters": "file:../packages/openai-adapters",
|
||||
"@continuedev/terminal-security": "file:../packages/terminal-security",
|
||||
"@modelcontextprotocol/sdk": "^1.12.0",
|
||||
"@mozilla/readability": "^0.5.0",
|
||||
"@octokit/rest": "^20.1.1",
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ import {
|
|||
DevDataLogEvent,
|
||||
ModelRole,
|
||||
} from "@continuedev/config-yaml";
|
||||
import { ToolPolicy } from "@continuedev/terminal-security";
|
||||
|
||||
import {
|
||||
AutocompleteInput,
|
||||
|
|
@ -39,7 +40,6 @@ import {
|
|||
SlashCommandDescWithSource,
|
||||
StreamDiffLinesPayload,
|
||||
ToolCall,
|
||||
ToolPolicy,
|
||||
} from "../";
|
||||
import { AutocompleteCodeSnippet } from "../autocomplete/snippets/types";
|
||||
import { GetLspDefinitionsFunction } from "../autocomplete/types";
|
||||
|
|
|
|||
|
|
@ -1,7 +1,10 @@
|
|||
import os from "os";
|
||||
import { Tool, ToolPolicy } from "../..";
|
||||
import { Tool } from "../..";
|
||||
import { BUILT_IN_GROUP_NAME, BuiltInToolNames } from "../builtIn";
|
||||
import { evaluateTerminalCommandSecurity } from "../security/terminalCommandSecurity";
|
||||
import {
|
||||
evaluateTerminalCommandSecurity,
|
||||
ToolPolicy,
|
||||
} from "@continuedev/terminal-security";
|
||||
|
||||
/**
|
||||
* Get the preferred shell for the current platform
|
||||
|
|
|
|||
|
|
@ -68,6 +68,10 @@ try {
|
|||
__dirname,
|
||||
"../../packages/llm-info/dist/index.js",
|
||||
),
|
||||
"@continuedev/terminal-security": resolve(
|
||||
__dirname,
|
||||
"../../packages/terminal-security/dist/index.js",
|
||||
),
|
||||
},
|
||||
|
||||
// Add banner to create require for CommonJS packages
|
||||
|
|
|
|||
23
extensions/cli/package-lock.json
generated
23
extensions/cli/package-lock.json
generated
|
|
@ -18,6 +18,7 @@
|
|||
"@continuedev/config-yaml": "file:../../packages/config-yaml",
|
||||
"@continuedev/openai-adapters": "file:../../packages/openai-adapters",
|
||||
"@continuedev/sdk": "^0.0.13",
|
||||
"@continuedev/terminal-security": "file:../../packages/terminal-security",
|
||||
"@modelcontextprotocol/sdk": "^1.17.2",
|
||||
"@opentelemetry/api": "^1.9.0",
|
||||
"@opentelemetry/exporter-metrics-otlp-grpc": "^0.203.0",
|
||||
|
|
@ -123,6 +124,7 @@
|
|||
"@continuedev/fetch": "file:../packages/fetch",
|
||||
"@continuedev/llm-info": "file:../packages/llm-info",
|
||||
"@continuedev/openai-adapters": "file:../packages/openai-adapters",
|
||||
"@continuedev/terminal-security": "file:../packages/terminal-security",
|
||||
"@modelcontextprotocol/sdk": "^1.12.0",
|
||||
"@mozilla/readability": "^0.5.0",
|
||||
"@octokit/rest": "^20.1.1",
|
||||
|
|
@ -173,6 +175,7 @@
|
|||
"quick-lru": "^7.0.0",
|
||||
"replicate": "^0.26.0",
|
||||
"request": "^2.88.2",
|
||||
"shell-quote": "^1.8.3",
|
||||
"socket.io-client": "^4.7.3",
|
||||
"sqlite": "^5.1.1",
|
||||
"sqlite3": "^5.1.7",
|
||||
|
|
@ -207,6 +210,7 @@
|
|||
"@types/pg": "^8.11.6",
|
||||
"@types/plist": "^3.0.5",
|
||||
"@types/request": "^2.48.12",
|
||||
"@types/shell-quote": "^1.7.5",
|
||||
"@types/tar": "^6.1.13",
|
||||
"@types/uuid": "^9.0.7",
|
||||
"@types/win-ca": "^3.5.4",
|
||||
|
|
@ -294,6 +298,21 @@
|
|||
"vitest": "^3.2.4"
|
||||
}
|
||||
},
|
||||
"../../packages/terminal-security": {
|
||||
"name": "@continuedev/terminal-security",
|
||||
"version": "1.0.0",
|
||||
"dev": true,
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"shell-quote": "^1.8.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "^20.11.19",
|
||||
"@types/shell-quote": "^1.7.5",
|
||||
"typescript": "^5.5.2",
|
||||
"vitest": "^1.6.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@alcalzone/ansi-tokenize": {
|
||||
"version": "0.2.0",
|
||||
"resolved": "https://registry.npmjs.org/@alcalzone/ansi-tokenize/-/ansi-tokenize-0.2.0.tgz",
|
||||
|
|
@ -386,6 +405,10 @@
|
|||
"openai": "^4.96.2"
|
||||
}
|
||||
},
|
||||
"node_modules/@continuedev/terminal-security": {
|
||||
"resolved": "../../packages/terminal-security",
|
||||
"link": true
|
||||
},
|
||||
"node_modules/@cspotcode/source-map-support": {
|
||||
"version": "0.8.1",
|
||||
"resolved": "https://registry.npmjs.org/@cspotcode/source-map-support/-/source-map-support-0.8.1.tgz",
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@
|
|||
"test:e2e": "vitest run --config vitest.e2e.config.ts",
|
||||
"test:smoke": "node smoke-test.mjs",
|
||||
"build:tsc": "tsc -p tsconfig.build.json",
|
||||
"build:local-deps": "cd ../../packages/config-types && npm i && npm run build && cd ../fetch && npm i && npm run build && cd ../llm-info && npm i && npm run build && cd ../config-yaml && npm i && npm run build && cd ../openai-adapters && npm i && npm run build && cd ../../core && npm i && npm run build && cd ../extensions/cli && npm i",
|
||||
"build:local-deps": "cd ../../packages/config-types && npm i && npm run build && cd ../fetch && npm i && npm run build && cd ../llm-info && npm i && npm run build && cd ../terminal-security && npm i && npm run build && cd ../config-yaml && npm i && npm run build && cd ../openai-adapters && npm i && npm run build && cd ../../core && npm i && npm run build && cd ../extensions/cli && npm i",
|
||||
"build:validate": "node validate-aliases.mjs",
|
||||
"build:bundle": "node build.mjs",
|
||||
"build": "npm run build:validate && npm run build:bundle",
|
||||
|
|
@ -50,6 +50,7 @@
|
|||
"@continuedev/config-yaml": "file:../../packages/config-yaml",
|
||||
"@continuedev/openai-adapters": "file:../../packages/openai-adapters",
|
||||
"@continuedev/sdk": "^0.0.13",
|
||||
"@continuedev/terminal-security": "file:../../packages/terminal-security",
|
||||
"@modelcontextprotocol/sdk": "^1.17.2",
|
||||
"@opentelemetry/api": "^1.9.0",
|
||||
"@opentelemetry/exporter-metrics-otlp-grpc": "^0.203.0",
|
||||
|
|
|
|||
|
|
@ -1,3 +1,7 @@
|
|||
import { vi, describe, it, expect, beforeEach, afterEach } from "vitest";
|
||||
|
||||
import * as toolsModule from "../tools/index.js";
|
||||
|
||||
import {
|
||||
checkToolPermission,
|
||||
filterExcludedTools,
|
||||
|
|
@ -593,4 +597,373 @@ describe("Permission Checker", () => {
|
|||
expect(filtered).toEqual(tools);
|
||||
});
|
||||
});
|
||||
|
||||
describe("Hybrid Permission Model with Dynamic Evaluation", () => {
|
||||
// Mock the runTerminalCommand tool with evaluateToolCallPolicy
|
||||
const mockBashTool = {
|
||||
name: "Bash",
|
||||
displayName: "Bash",
|
||||
description: "Execute bash commands",
|
||||
parameters: {},
|
||||
isBuiltIn: true,
|
||||
evaluateToolCallPolicy: vi.fn(),
|
||||
run: vi.fn(),
|
||||
};
|
||||
|
||||
beforeEach(() => {
|
||||
vi.clearAllMocks();
|
||||
// Mock getAllBuiltinTools to return our test tool
|
||||
vi.spyOn(toolsModule, "getAllBuiltinTools").mockReturnValue([
|
||||
mockBashTool,
|
||||
]);
|
||||
|
||||
// Reset mock between tests
|
||||
mockBashTool.evaluateToolCallPolicy.mockClear();
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
vi.restoreAllMocks();
|
||||
});
|
||||
|
||||
describe("User has Bash in 'allow' mode", () => {
|
||||
const permissions: ToolPermissions = {
|
||||
policies: [
|
||||
{ tool: "Bash", permission: "allow" },
|
||||
{ tool: "*", permission: "ask" },
|
||||
],
|
||||
};
|
||||
|
||||
it("should allow safe commands (echo hello)", () => {
|
||||
mockBashTool.evaluateToolCallPolicy.mockReturnValue(
|
||||
"allowedWithoutPermission",
|
||||
);
|
||||
|
||||
const result = checkToolPermission(
|
||||
{ name: "Bash", arguments: { command: "echo hello" } },
|
||||
permissions,
|
||||
);
|
||||
|
||||
expect(result.permission).toBe("allow"); // User preference wins
|
||||
expect(mockBashTool.evaluateToolCallPolicy).toHaveBeenCalledWith(
|
||||
"allowedWithoutPermission", // converted from "allow"
|
||||
{ command: "echo hello" },
|
||||
);
|
||||
});
|
||||
|
||||
it("should allow risky commands based on user preference (curl)", () => {
|
||||
mockBashTool.evaluateToolCallPolicy.mockReturnValue(
|
||||
"allowedWithPermission",
|
||||
);
|
||||
|
||||
const result = checkToolPermission(
|
||||
{ name: "Bash", arguments: { command: "curl https://example.com" } },
|
||||
permissions,
|
||||
);
|
||||
|
||||
expect(result.permission).toBe("allow"); // User preference wins over "ask"
|
||||
expect(mockBashTool.evaluateToolCallPolicy).toHaveBeenCalledWith(
|
||||
"allowedWithoutPermission", // converted from "allow"
|
||||
{ command: "curl https://example.com" },
|
||||
);
|
||||
});
|
||||
|
||||
it("should block dangerous commands despite user preference (eval)", () => {
|
||||
mockBashTool.evaluateToolCallPolicy.mockReturnValue("disabled");
|
||||
|
||||
const result = checkToolPermission(
|
||||
{ name: "Bash", arguments: { command: "eval 'echo safe'" } },
|
||||
permissions,
|
||||
);
|
||||
|
||||
expect(result.permission).toBe("exclude"); // Security wins
|
||||
expect(mockBashTool.evaluateToolCallPolicy).toHaveBeenCalledWith(
|
||||
"allowedWithoutPermission", // converted from "allow"
|
||||
{ command: "eval 'echo safe'" },
|
||||
);
|
||||
});
|
||||
|
||||
it("should block sudo commands despite user preference", () => {
|
||||
mockBashTool.evaluateToolCallPolicy.mockReturnValue("disabled");
|
||||
|
||||
const result = checkToolPermission(
|
||||
{ name: "Bash", arguments: { command: "sudo rm -rf /" } },
|
||||
permissions,
|
||||
);
|
||||
|
||||
expect(result.permission).toBe("exclude"); // Security wins
|
||||
});
|
||||
});
|
||||
|
||||
describe("User has Bash in 'ask' mode (default)", () => {
|
||||
const permissions: ToolPermissions = {
|
||||
policies: [
|
||||
{ tool: "Bash", permission: "ask" },
|
||||
{ tool: "*", permission: "ask" },
|
||||
],
|
||||
};
|
||||
|
||||
it("should ask for safe commands based on user preference (echo)", () => {
|
||||
mockBashTool.evaluateToolCallPolicy.mockReturnValue(
|
||||
"allowedWithoutPermission",
|
||||
);
|
||||
|
||||
const result = checkToolPermission(
|
||||
{ name: "Bash", arguments: { command: "echo hello" } },
|
||||
permissions,
|
||||
);
|
||||
|
||||
expect(result.permission).toBe("ask"); // User preference wins
|
||||
expect(mockBashTool.evaluateToolCallPolicy).toHaveBeenCalledWith(
|
||||
"allowedWithPermission", // converted from "ask"
|
||||
{ command: "echo hello" },
|
||||
);
|
||||
});
|
||||
|
||||
it("should ask for risky commands (curl)", () => {
|
||||
mockBashTool.evaluateToolCallPolicy.mockReturnValue(
|
||||
"allowedWithPermission",
|
||||
);
|
||||
|
||||
const result = checkToolPermission(
|
||||
{ name: "Bash", arguments: { command: "curl https://example.com" } },
|
||||
permissions,
|
||||
);
|
||||
|
||||
expect(result.permission).toBe("ask"); // Both agree on "ask"
|
||||
expect(mockBashTool.evaluateToolCallPolicy).toHaveBeenCalledWith(
|
||||
"allowedWithPermission", // converted from "ask"
|
||||
{ command: "curl https://example.com" },
|
||||
);
|
||||
});
|
||||
|
||||
it("should block dangerous commands (eval)", () => {
|
||||
mockBashTool.evaluateToolCallPolicy.mockReturnValue("disabled");
|
||||
|
||||
const result = checkToolPermission(
|
||||
{ name: "Bash", arguments: { command: "eval 'echo safe'" } },
|
||||
permissions,
|
||||
);
|
||||
|
||||
expect(result.permission).toBe("exclude"); // Security wins
|
||||
expect(mockBashTool.evaluateToolCallPolicy).toHaveBeenCalledWith(
|
||||
"allowedWithPermission", // converted from "ask"
|
||||
{ command: "eval 'echo safe'" },
|
||||
);
|
||||
});
|
||||
|
||||
it("should block rm -rf commands", () => {
|
||||
mockBashTool.evaluateToolCallPolicy.mockReturnValue("disabled");
|
||||
|
||||
const result = checkToolPermission(
|
||||
{ name: "Bash", arguments: { command: "rm -rf /tmp/important" } },
|
||||
permissions,
|
||||
);
|
||||
|
||||
expect(result.permission).toBe("exclude"); // Security wins
|
||||
});
|
||||
});
|
||||
|
||||
describe("User has Bash in 'exclude' mode", () => {
|
||||
const permissions: ToolPermissions = {
|
||||
policies: [{ tool: "Bash", permission: "exclude" }],
|
||||
};
|
||||
|
||||
it("should always exclude regardless of dynamic evaluation", () => {
|
||||
// Even if dynamic evaluation would allow it
|
||||
mockBashTool.evaluateToolCallPolicy.mockReturnValue(
|
||||
"allowedWithoutPermission",
|
||||
);
|
||||
|
||||
const result = checkToolPermission(
|
||||
{ name: "Bash", arguments: { command: "echo hello" } },
|
||||
permissions,
|
||||
);
|
||||
|
||||
expect(result.permission).toBe("exclude"); // User excluded the tool entirely
|
||||
expect(mockBashTool.evaluateToolCallPolicy).toHaveBeenCalledWith(
|
||||
"disabled", // converted from "exclude"
|
||||
{ command: "echo hello" },
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
describe("Comprehensive command testing", () => {
|
||||
const permissions: ToolPermissions = {
|
||||
policies: [{ tool: "Bash", permission: "allow" }],
|
||||
};
|
||||
|
||||
const testCases = [
|
||||
// Safe commands
|
||||
{
|
||||
command: "ls",
|
||||
dynamicResult: "allowedWithoutPermission",
|
||||
expected: "allow",
|
||||
},
|
||||
{
|
||||
command: "pwd",
|
||||
dynamicResult: "allowedWithoutPermission",
|
||||
expected: "allow",
|
||||
},
|
||||
{
|
||||
command: "date",
|
||||
dynamicResult: "allowedWithoutPermission",
|
||||
expected: "allow",
|
||||
},
|
||||
{
|
||||
command: "echo test",
|
||||
dynamicResult: "allowedWithoutPermission",
|
||||
expected: "allow",
|
||||
},
|
||||
{
|
||||
command: "git status",
|
||||
dynamicResult: "allowedWithoutPermission",
|
||||
expected: "allow",
|
||||
},
|
||||
|
||||
// Risky commands (user preference wins when not disabled)
|
||||
{
|
||||
command: "npm install pkg",
|
||||
dynamicResult: "allowedWithPermission",
|
||||
expected: "allow",
|
||||
},
|
||||
{
|
||||
command: "rm file.txt",
|
||||
dynamicResult: "allowedWithPermission",
|
||||
expected: "allow",
|
||||
},
|
||||
{
|
||||
command: "curl https://api.example.com",
|
||||
dynamicResult: "allowedWithPermission",
|
||||
expected: "allow",
|
||||
},
|
||||
{
|
||||
command: "wget https://example.com/file",
|
||||
dynamicResult: "allowedWithPermission",
|
||||
expected: "allow",
|
||||
},
|
||||
|
||||
// Dangerous commands (always blocked)
|
||||
{
|
||||
command: "sudo rm -rf /",
|
||||
dynamicResult: "disabled",
|
||||
expected: "exclude",
|
||||
},
|
||||
{
|
||||
command: "exec bash",
|
||||
dynamicResult: "disabled",
|
||||
expected: "exclude",
|
||||
},
|
||||
{
|
||||
command: "eval 'malicious code'",
|
||||
dynamicResult: "disabled",
|
||||
expected: "exclude",
|
||||
},
|
||||
{ command: "rm -rf /", dynamicResult: "disabled", expected: "exclude" },
|
||||
];
|
||||
|
||||
testCases.forEach(({ command, dynamicResult, expected }) => {
|
||||
it(`should handle '${command}' correctly`, () => {
|
||||
mockBashTool.evaluateToolCallPolicy.mockReturnValue(dynamicResult);
|
||||
|
||||
const result = checkToolPermission(
|
||||
{ name: "Bash", arguments: { command } },
|
||||
permissions,
|
||||
);
|
||||
|
||||
expect(result.permission).toBe(expected);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe("Edge cases", () => {
|
||||
it("should handle tools without dynamic evaluation", () => {
|
||||
// Mock a Read tool without evaluateToolCallPolicy
|
||||
const mockReadTool = {
|
||||
name: "Read",
|
||||
displayName: "Read",
|
||||
description: "Read files",
|
||||
parameters: {},
|
||||
isBuiltIn: true,
|
||||
run: vi.fn(),
|
||||
// No evaluateToolCallPolicy
|
||||
};
|
||||
vi.mocked(toolsModule.getAllBuiltinTools).mockReturnValue([
|
||||
mockReadTool,
|
||||
mockBashTool,
|
||||
]);
|
||||
|
||||
const permissions: ToolPermissions = {
|
||||
policies: [{ tool: "Read", permission: "allow" }],
|
||||
};
|
||||
|
||||
const result = checkToolPermission(
|
||||
{ name: "Read", arguments: { path: "/tmp/file.txt" } },
|
||||
permissions,
|
||||
);
|
||||
|
||||
expect(result.permission).toBe("allow");
|
||||
expect(mockBashTool.evaluateToolCallPolicy).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("should use default 'ask' when no policy matches", () => {
|
||||
const permissions: ToolPermissions = {
|
||||
policies: [],
|
||||
};
|
||||
|
||||
mockBashTool.evaluateToolCallPolicy.mockReturnValue(
|
||||
"allowedWithPermission",
|
||||
);
|
||||
|
||||
const result = checkToolPermission(
|
||||
{ name: "Bash", arguments: { command: "echo test" } },
|
||||
permissions,
|
||||
);
|
||||
|
||||
expect(result.permission).toBe("ask"); // Default fallback, user preference wins
|
||||
expect(mockBashTool.evaluateToolCallPolicy).toHaveBeenCalledWith(
|
||||
"allowedWithPermission", // converted from default "ask"
|
||||
{ command: "echo test" },
|
||||
);
|
||||
});
|
||||
|
||||
it("should handle null/undefined arguments gracefully", () => {
|
||||
mockBashTool.evaluateToolCallPolicy.mockReturnValue(
|
||||
"allowedWithPermission",
|
||||
);
|
||||
|
||||
const permissions: ToolPermissions = {
|
||||
policies: [{ tool: "Bash", permission: "allow" }],
|
||||
};
|
||||
|
||||
const result = checkToolPermission(
|
||||
{ name: "Bash", arguments: {} },
|
||||
permissions,
|
||||
);
|
||||
|
||||
expect(result.permission).toBe("allow");
|
||||
expect(mockBashTool.evaluateToolCallPolicy).toHaveBeenCalledWith(
|
||||
"allowedWithoutPermission",
|
||||
{},
|
||||
);
|
||||
});
|
||||
|
||||
it("should maintain matched policy information", () => {
|
||||
mockBashTool.evaluateToolCallPolicy.mockReturnValue(
|
||||
"allowedWithoutPermission",
|
||||
);
|
||||
|
||||
const policy = { tool: "Bash", permission: "allow" as const };
|
||||
const permissions: ToolPermissions = {
|
||||
policies: [policy],
|
||||
};
|
||||
|
||||
const result = checkToolPermission(
|
||||
{ name: "Bash", arguments: { command: "ls" } },
|
||||
permissions,
|
||||
);
|
||||
|
||||
expect(result.matchedPolicy).toBe(policy);
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -1,10 +1,14 @@
|
|||
import type { ToolPolicy } from "@continuedev/terminal-security";
|
||||
|
||||
import { getServiceSync } from "../services/index.js";
|
||||
import type { ToolPermissionServiceState } from "../services/types.js";
|
||||
import { SERVICE_NAMES } from "../services/types.js";
|
||||
import { getAllBuiltinTools } from "../tools/index.js";
|
||||
|
||||
import { DEFAULT_TOOL_POLICIES } from "./defaultPolicies.js";
|
||||
import {
|
||||
PermissionCheckResult,
|
||||
PermissionPolicy,
|
||||
ToolCallRequest,
|
||||
ToolPermissions,
|
||||
} from "./types.js";
|
||||
|
|
@ -103,6 +107,24 @@ export function matchesArguments(
|
|||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts CLI's PermissionPolicy to core's ToolPolicy
|
||||
*/
|
||||
function permissionPolicyToToolPolicy(
|
||||
permission: PermissionPolicy,
|
||||
): ToolPolicy {
|
||||
switch (permission) {
|
||||
case "allow":
|
||||
return "allowedWithoutPermission";
|
||||
case "ask":
|
||||
return "allowedWithPermission";
|
||||
case "exclude":
|
||||
return "disabled";
|
||||
default:
|
||||
return "allowedWithPermission";
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Evaluates a tool call request against a set of permission policies.
|
||||
* Returns the permission for the first matching policy.
|
||||
|
|
@ -129,21 +151,54 @@ export function checkToolPermission(
|
|||
}
|
||||
}
|
||||
|
||||
// First, get the base permission from static policies
|
||||
let basePermission: PermissionPolicy = "ask";
|
||||
let matchedPolicy = undefined;
|
||||
|
||||
for (const policy of policies) {
|
||||
if (
|
||||
matchesToolPattern(toolCall.name, policy.tool, toolCall.arguments) &&
|
||||
matchesArguments(toolCall.arguments, policy.argumentMatches)
|
||||
) {
|
||||
return {
|
||||
permission: policy.permission,
|
||||
matchedPolicy: policy,
|
||||
};
|
||||
basePermission = policy.permission;
|
||||
matchedPolicy = policy;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Fallback to "ask" if no policy matches
|
||||
// Check if tool has dynamic policy evaluation
|
||||
const builtinTools = getAllBuiltinTools();
|
||||
const tool = builtinTools.find((t) => t.name === toolCall.name);
|
||||
|
||||
if (tool?.evaluateToolCallPolicy) {
|
||||
// Convert CLI permission to core policy
|
||||
const basePolicy = permissionPolicyToToolPolicy(basePermission);
|
||||
|
||||
// Evaluate the dynamic policy
|
||||
const evaluatedPolicy = tool.evaluateToolCallPolicy(
|
||||
basePolicy,
|
||||
toolCall.arguments,
|
||||
);
|
||||
|
||||
// If dynamic evaluation says disabled, that ALWAYS takes precedence
|
||||
if (evaluatedPolicy === "disabled") {
|
||||
return {
|
||||
permission: "exclude",
|
||||
matchedPolicy,
|
||||
};
|
||||
}
|
||||
|
||||
// Otherwise, user preference wins - return the original base permission
|
||||
return {
|
||||
permission: basePermission,
|
||||
matchedPolicy,
|
||||
};
|
||||
}
|
||||
|
||||
// No dynamic evaluation, return static result
|
||||
return {
|
||||
permission: "ask",
|
||||
permission: basePermission,
|
||||
matchedPolicy,
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -25,11 +25,17 @@ export function handlePermissionDenied(
|
|||
toolCall: PreprocessedToolCall,
|
||||
chatHistoryEntries: ChatCompletionToolMessageParam[],
|
||||
callbacks?: StreamCallbacks,
|
||||
reason: "user" | "policy" = "user",
|
||||
): void {
|
||||
const deniedMessage = `Permission denied by user`;
|
||||
const deniedMessage =
|
||||
reason === "policy"
|
||||
? `Command blocked by security policy`
|
||||
: `Permission denied by user`;
|
||||
|
||||
logger.info("Tool call denied", {
|
||||
name: toolCall.name,
|
||||
arguments: toolCall.arguments,
|
||||
reason,
|
||||
});
|
||||
|
||||
chatHistoryEntries.push({
|
||||
|
|
@ -39,7 +45,7 @@ export function handlePermissionDenied(
|
|||
});
|
||||
|
||||
callbacks?.onToolResult?.(deniedMessage, toolCall.name, "canceled");
|
||||
logger.debug("Tool call rejected - stopping stream");
|
||||
logger.debug(`Tool call rejected (${reason}) - stopping stream`);
|
||||
}
|
||||
|
||||
// Helper function to handle headless mode permission
|
||||
|
|
@ -114,22 +120,25 @@ export async function checkToolPermissionApproval(
|
|||
toolCall: PreprocessedToolCall,
|
||||
callbacks?: StreamCallbacks,
|
||||
isHeadless?: boolean,
|
||||
): Promise<boolean> {
|
||||
): Promise<{ approved: boolean; denialReason?: "user" | "policy" }> {
|
||||
const permissionCheck = checkToolPermission(toolCall);
|
||||
|
||||
if (permissionCheck.permission === "allow") {
|
||||
return true;
|
||||
return { approved: true };
|
||||
} else if (permissionCheck.permission === "ask") {
|
||||
if (isHeadless) {
|
||||
handleHeadlessPermission(toolCall);
|
||||
}
|
||||
return await requestUserPermission(toolCall, callbacks);
|
||||
const userApproved = await requestUserPermission(toolCall, callbacks);
|
||||
return userApproved
|
||||
? { approved: true }
|
||||
: { approved: false, denialReason: "user" };
|
||||
} else if (permissionCheck.permission === "exclude") {
|
||||
// This shouldn't happen as excluded tools are filtered out earlier
|
||||
return false;
|
||||
// Tool blocked by security policy
|
||||
return { approved: false, denialReason: "policy" };
|
||||
}
|
||||
|
||||
return false;
|
||||
return { approved: false, denialReason: "policy" };
|
||||
}
|
||||
|
||||
// Helper function to track first token time
|
||||
|
|
@ -401,18 +410,25 @@ export async function executeStreamedToolCalls(
|
|||
// Notify tool start before permission check to display in UI fallbacks
|
||||
callbacks?.onToolStart?.(call.name, call.arguments);
|
||||
|
||||
const approved = await checkToolPermissionApproval(
|
||||
// Check tool permissions using helper
|
||||
const permissionResult = await checkToolPermissionApproval(
|
||||
call,
|
||||
callbacks,
|
||||
isHeadless,
|
||||
);
|
||||
|
||||
if (!approved) {
|
||||
if (!permissionResult.approved) {
|
||||
// Permission denied: record and mark rejection
|
||||
const denialReason = permissionResult.denialReason || "user";
|
||||
const deniedMessage =
|
||||
denialReason === "policy"
|
||||
? `Command blocked by security policy`
|
||||
: `Permission denied by user`;
|
||||
|
||||
const deniedEntry: ChatCompletionToolMessageParam = {
|
||||
role: "tool",
|
||||
tool_call_id: call.id,
|
||||
content: `Permission denied by user`,
|
||||
content: deniedMessage,
|
||||
};
|
||||
entriesByIndex.set(index, deniedEntry);
|
||||
callbacks?.onToolResult?.(
|
||||
|
|
|
|||
|
|
@ -1,5 +1,10 @@
|
|||
import { spawn } from "child_process";
|
||||
|
||||
import {
|
||||
evaluateTerminalCommandSecurity,
|
||||
type ToolPolicy,
|
||||
} from "@continuedev/terminal-security";
|
||||
|
||||
import { telemetryService } from "../telemetry/telemetryService.js";
|
||||
import {
|
||||
isGitCommitCommand,
|
||||
|
|
@ -39,6 +44,15 @@ The command will be executed from the current working directory: ${process.cwd()
|
|||
},
|
||||
readonly: false,
|
||||
isBuiltIn: true,
|
||||
evaluateToolCallPolicy: (
|
||||
basePolicy: ToolPolicy,
|
||||
parsedArgs: Record<string, unknown>,
|
||||
): ToolPolicy => {
|
||||
return evaluateTerminalCommandSecurity(
|
||||
basePolicy,
|
||||
parsedArgs.command as string,
|
||||
);
|
||||
},
|
||||
preprocess: async (args) => {
|
||||
const command = args.command;
|
||||
if (!command || typeof command !== "string") {
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
import type { ToolPolicy } from "@continuedev/terminal-security";
|
||||
|
||||
export type ToolParameters = Record<
|
||||
string,
|
||||
{
|
||||
|
|
@ -31,6 +33,10 @@ export interface Tool {
|
|||
run: (args: any) => Promise<string>;
|
||||
readonly?: boolean; // Indicates if the tool is readonly
|
||||
isBuiltIn: boolean;
|
||||
evaluateToolCallPolicy?: (
|
||||
basePolicy: ToolPolicy,
|
||||
parsedArgs: Record<string, unknown>,
|
||||
) => ToolPolicy;
|
||||
}
|
||||
|
||||
export interface ToolCall {
|
||||
|
|
|
|||
|
|
@ -140,6 +140,7 @@ export const ScreenContent: React.FC<ScreenContentProps> = ({
|
|||
toolArgs={activePermissionRequest.toolArgs}
|
||||
requestId={activePermissionRequest.requestId}
|
||||
toolCallPreview={activePermissionRequest.toolCallPreview}
|
||||
hasDynamicEvaluation={activePermissionRequest.hasDynamicEvaluation}
|
||||
onResponse={handleToolPermissionResponse}
|
||||
/>
|
||||
);
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@ interface ToolPermissionSelectorProps {
|
|||
toolArgs: any;
|
||||
requestId: string;
|
||||
toolCallPreview?: ToolCallPreview[];
|
||||
hasDynamicEvaluation?: boolean;
|
||||
onResponse: (
|
||||
requestId: string,
|
||||
approved: boolean,
|
||||
|
|
@ -30,36 +31,40 @@ interface ToolPermissionSelectorProps {
|
|||
) => void;
|
||||
}
|
||||
|
||||
const PERMISSION_OPTIONS: PermissionOption[] = [
|
||||
{ id: "approve", name: "Continue", color: "green", approved: true },
|
||||
{
|
||||
id: "approve_policy",
|
||||
name: "Continue + don't ask again",
|
||||
color: "cyan",
|
||||
approved: true,
|
||||
createPolicy: true,
|
||||
},
|
||||
{
|
||||
id: "deny_stop",
|
||||
name: "No, and tell Continue what to do differently",
|
||||
color: "yellow",
|
||||
approved: false,
|
||||
stopStream: true,
|
||||
},
|
||||
];
|
||||
const getPermissionOptions = (): PermissionOption[] => {
|
||||
return [
|
||||
{ id: "approve", name: "Continue", color: "green", approved: true },
|
||||
{
|
||||
id: "approve_policy",
|
||||
name: "Continue + don't ask again",
|
||||
color: "cyan",
|
||||
approved: true,
|
||||
createPolicy: true,
|
||||
},
|
||||
{
|
||||
id: "deny_stop",
|
||||
name: "No, and tell Continue what to do differently",
|
||||
color: "yellow",
|
||||
approved: false,
|
||||
stopStream: true,
|
||||
},
|
||||
];
|
||||
};
|
||||
|
||||
export const ToolPermissionSelector: React.FC<ToolPermissionSelectorProps> = ({
|
||||
toolName,
|
||||
toolArgs,
|
||||
requestId,
|
||||
toolCallPreview,
|
||||
hasDynamicEvaluation = false,
|
||||
onResponse,
|
||||
}) => {
|
||||
const permissionOptions = getPermissionOptions();
|
||||
const [selectedIndex, setSelectedIndex] = useState(0);
|
||||
|
||||
useInput((input, key) => {
|
||||
if (key.return) {
|
||||
const selectedOption = PERMISSION_OPTIONS[selectedIndex];
|
||||
const selectedOption = permissionOptions[selectedIndex];
|
||||
onResponse(
|
||||
requestId,
|
||||
selectedOption.approved,
|
||||
|
|
@ -91,7 +96,7 @@ export const ToolPermissionSelector: React.FC<ToolPermissionSelectorProps> = ({
|
|||
setSelectedIndex(Math.max(0, selectedIndex - 1));
|
||||
} else if (key.downArrow) {
|
||||
setSelectedIndex(
|
||||
Math.min(PERMISSION_OPTIONS.length - 1, selectedIndex + 1),
|
||||
Math.min(permissionOptions.length - 1, selectedIndex + 1),
|
||||
);
|
||||
}
|
||||
|
||||
|
|
@ -120,7 +125,15 @@ export const ToolPermissionSelector: React.FC<ToolPermissionSelectorProps> = ({
|
|||
|
||||
<Box marginTop={1} flexDirection="column">
|
||||
<Text color="dim">Would you like to continue?</Text>
|
||||
{PERMISSION_OPTIONS.map((option, index) => {
|
||||
{hasDynamicEvaluation && (
|
||||
<Box marginTop={1}>
|
||||
<Text color="yellow" dimColor>
|
||||
Note: Dangerous commands will be blocked regardless of your
|
||||
preference.
|
||||
</Text>
|
||||
</Box>
|
||||
)}
|
||||
{permissionOptions.map((option, index) => {
|
||||
const isSelected = index === selectedIndex;
|
||||
let shortcut = "";
|
||||
if (option.id === "approve") shortcut = "(tab)";
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
import type { ChatHistoryItem, ToolCallState, ToolStatus } from "core/index.js";
|
||||
|
||||
import { getAllBuiltinTools } from "src/tools/index.js";
|
||||
import { logger } from "src/util/logger.js";
|
||||
|
||||
import { services } from "../../services/index.js";
|
||||
|
|
@ -201,11 +202,16 @@ export function createStreamCallbacks(
|
|||
requestId: string,
|
||||
toolCallPreview?: any[],
|
||||
) => {
|
||||
// Check if this tool has dynamic evaluation
|
||||
const tool = getAllBuiltinTools().find((t: any) => t.name === toolName);
|
||||
const hasDynamicEvaluation = !!tool?.evaluateToolCallPolicy;
|
||||
|
||||
setActivePermissionRequest({
|
||||
toolName,
|
||||
toolArgs,
|
||||
requestId,
|
||||
toolCallPreview,
|
||||
hasDynamicEvaluation,
|
||||
});
|
||||
},
|
||||
|
||||
|
|
|
|||
20
gui/package-lock.json
generated
20
gui/package-lock.json
generated
|
|
@ -8,6 +8,7 @@
|
|||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"@continuedev/config-yaml": "file:../packages/config-yaml",
|
||||
"@continuedev/terminal-security": "file:../packages/terminal-security",
|
||||
"@headlessui/react": "^2.2.0",
|
||||
"@heroicons/react": "^2.0.18",
|
||||
"@panzoom/panzoom": "^4.6.0",
|
||||
|
|
@ -123,6 +124,7 @@
|
|||
"@continuedev/fetch": "file:../packages/fetch",
|
||||
"@continuedev/llm-info": "file:../packages/llm-info",
|
||||
"@continuedev/openai-adapters": "file:../packages/openai-adapters",
|
||||
"@continuedev/terminal-security": "file:../packages/terminal-security",
|
||||
"@modelcontextprotocol/sdk": "^1.12.0",
|
||||
"@mozilla/readability": "^0.5.0",
|
||||
"@octokit/rest": "^20.1.1",
|
||||
|
|
@ -268,6 +270,20 @@
|
|||
"typescript": "^5.5.2"
|
||||
}
|
||||
},
|
||||
"../packages/terminal-security": {
|
||||
"name": "@continuedev/terminal-security",
|
||||
"version": "1.0.0",
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"shell-quote": "^1.8.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "^20.11.19",
|
||||
"@types/shell-quote": "^1.7.5",
|
||||
"typescript": "^5.5.2",
|
||||
"vitest": "^1.6.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@adobe/css-tools": {
|
||||
"version": "4.4.0",
|
||||
"resolved": "https://registry.npmjs.org/@adobe/css-tools/-/css-tools-4.4.0.tgz",
|
||||
|
|
@ -674,6 +690,10 @@
|
|||
"resolved": "../packages/config-yaml",
|
||||
"link": true
|
||||
},
|
||||
"node_modules/@continuedev/terminal-security": {
|
||||
"resolved": "../packages/terminal-security",
|
||||
"link": true
|
||||
},
|
||||
"node_modules/@emotion/is-prop-valid": {
|
||||
"version": "1.3.1",
|
||||
"resolved": "https://registry.npmjs.org/@emotion/is-prop-valid/-/is-prop-valid-1.3.1.tgz",
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@
|
|||
},
|
||||
"dependencies": {
|
||||
"@continuedev/config-yaml": "file:../packages/config-yaml",
|
||||
"@continuedev/terminal-security": "file:../packages/terminal-security",
|
||||
"@headlessui/react": "^2.2.0",
|
||||
"@heroicons/react": "^2.0.18",
|
||||
"@panzoom/panzoom": "^4.6.0",
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ import { CreateFileButton } from "./CreateFileButton";
|
|||
import { FileInfo } from "./FileInfo";
|
||||
import { InsertButton } from "./InsertButton";
|
||||
import { RunInTerminalButton } from "./RunInTerminalButton";
|
||||
import { evaluateTerminalCommandSecurity } from "core/tools/security/terminalCommandSecurity";
|
||||
import { evaluateTerminalCommandSecurity } from "@continuedev/terminal-security";
|
||||
|
||||
export interface StepContainerPreToolbarProps {
|
||||
showToolCallStatusIcon?: boolean;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
import { createSlice, PayloadAction } from "@reduxjs/toolkit";
|
||||
import { RuleWithSource, Tool, ToolPolicy } from "core";
|
||||
import { RuleWithSource, Tool } from "core";
|
||||
import { ToolPolicy } from "@continuedev/terminal-security";
|
||||
import { BUILT_IN_GROUP_NAME, BuiltInToolNames } from "core/tools/builtIn";
|
||||
import {
|
||||
defaultOnboardingCardState,
|
||||
|
|
|
|||
|
|
@ -4,8 +4,8 @@ import {
|
|||
LLMFullCompletionOptions,
|
||||
Tool,
|
||||
ToolCallState,
|
||||
ToolPolicy,
|
||||
} from "core";
|
||||
import { ToolPolicy } from "@continuedev/terminal-security";
|
||||
import { getRuleId } from "core/llm/rules/getSystemMessageWithRules";
|
||||
import { ToCoreProtocol } from "core/protocol";
|
||||
import { selectActiveTools } from "../selectors/selectActiveTools";
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import { ToolPolicy } from "core";
|
||||
import { ToolPolicy } from "@continuedev/terminal-security";
|
||||
import { BuiltInToolNames } from "core/tools/builtIn";
|
||||
import { clearToolPolicy, setToolPolicy } from "../redux/slices/uiSlice";
|
||||
import { AppDispatch } from "../redux/store";
|
||||
|
|
|
|||
1808
packages/terminal-security/package-lock.json
generated
Normal file
1808
packages/terminal-security/package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load diff
25
packages/terminal-security/package.json
Normal file
25
packages/terminal-security/package.json
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
{
|
||||
"name": "@continuedev/terminal-security",
|
||||
"version": "1.0.0",
|
||||
"description": "Terminal command security evaluation for Continue",
|
||||
"main": "dist/index.js",
|
||||
"types": "dist/index.d.ts",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"test": "vitest run",
|
||||
"test:watch": "vitest watch",
|
||||
"build": "tsc",
|
||||
"clean": "rm -rf dist"
|
||||
},
|
||||
"author": "Continue Dev, Inc",
|
||||
"license": "Apache-2.0",
|
||||
"devDependencies": {
|
||||
"@types/node": "^20.11.19",
|
||||
"@types/shell-quote": "^1.7.5",
|
||||
"typescript": "^5.5.2",
|
||||
"vitest": "^1.6.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"shell-quote": "^1.8.1"
|
||||
}
|
||||
}
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
import { parse } from "shell-quote";
|
||||
import { ToolPolicy } from "../..";
|
||||
import { ToolPolicy } from "./types.js";
|
||||
|
||||
/**
|
||||
* Token types from shell-quote
|
||||
2
packages/terminal-security/src/index.ts
Normal file
2
packages/terminal-security/src/index.ts
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
export { ToolPolicy } from "./types.js";
|
||||
export { evaluateTerminalCommandSecurity } from "./evaluateTerminalCommandSecurity.js";
|
||||
7
packages/terminal-security/src/types.ts
Normal file
7
packages/terminal-security/src/types.ts
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
/**
|
||||
* Policy for tool execution
|
||||
*/
|
||||
export type ToolPolicy =
|
||||
| "allowedWithPermission"
|
||||
| "allowedWithoutPermission"
|
||||
| "disabled";
|
||||
|
|
@ -1,6 +1,5 @@
|
|||
import { describe, it, expect } from "vitest";
|
||||
import { evaluateTerminalCommandSecurity } from "../security/terminalCommandSecurity";
|
||||
import { ToolPolicy } from "../..";
|
||||
import { evaluateTerminalCommandSecurity, ToolPolicy } from "../src/index.js";
|
||||
|
||||
describe("evaluateTerminalCommandSecurity", () => {
|
||||
describe("Critical Risk - Always Disabled", () => {
|
||||
|
|
@ -730,6 +729,22 @@ describe("evaluateTerminalCommandSecurity", () => {
|
|||
expect(result).toBe("allowedWithPermission");
|
||||
});
|
||||
|
||||
it("should allow simple echo with quoted string without permission", () => {
|
||||
const result = evaluateTerminalCommandSecurity(
|
||||
"allowedWithoutPermission",
|
||||
'echo "hello"',
|
||||
);
|
||||
expect(result).toBe("allowedWithoutPermission");
|
||||
});
|
||||
|
||||
it("should allow echo without quotes without permission", () => {
|
||||
const result = evaluateTerminalCommandSecurity(
|
||||
"allowedWithoutPermission",
|
||||
"echo hello",
|
||||
);
|
||||
expect(result).toBe("allowedWithoutPermission");
|
||||
});
|
||||
|
||||
it("should allow echo with dangerous-looking but quoted strings", () => {
|
||||
const result = evaluateTerminalCommandSecurity(
|
||||
"allowedWithPermission",
|
||||
21
packages/terminal-security/tsconfig.json
Normal file
21
packages/terminal-security/tsconfig.json
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
{
|
||||
"compilerOptions": {
|
||||
"target": "ES2022",
|
||||
"module": "ES2022",
|
||||
"lib": ["ES2022"],
|
||||
"rootDir": "./src",
|
||||
"outDir": "./dist",
|
||||
"strict": true,
|
||||
"esModuleInterop": true,
|
||||
"skipLibCheck": true,
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"declaration": true,
|
||||
"declarationMap": true,
|
||||
"sourceMap": true,
|
||||
"moduleResolution": "node",
|
||||
"resolveJsonModule": true,
|
||||
"allowSyntheticDefaultImports": true
|
||||
},
|
||||
"include": ["src/**/*"],
|
||||
"exclude": ["node_modules", "dist", "test/**/*"]
|
||||
}
|
||||
8
packages/terminal-security/vitest.config.ts
Normal file
8
packages/terminal-security/vitest.config.ts
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
import { defineConfig } from "vitest/config";
|
||||
|
||||
export default defineConfig({
|
||||
test: {
|
||||
globals: true,
|
||||
environment: "node",
|
||||
},
|
||||
});
|
||||
|
|
@ -79,8 +79,8 @@ async function main() {
|
|||
try {
|
||||
console.log("🚀 Starting package builds...\n");
|
||||
|
||||
// Phase 1: Build config-types (foundation - no dependencies)
|
||||
await buildPackagesInParallel(["config-types"]);
|
||||
// Phase 1: Build foundation packages (no local dependencies)
|
||||
await buildPackagesInParallel(["config-types", "terminal-security"]);
|
||||
|
||||
// Phase 2: Build packages that depend on config-types
|
||||
await buildPackagesInParallel(["fetch", "config-yaml", "llm-info"]);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue