terry-core 0.1.0 → 0.1.2

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.
@@ -1,11 +1,11 @@
1
1
  const TOOL_HINTS = [
2
- { tool: "listDirectory", match: /\b(list|ls|folders?|files?)\b/i },
3
- { tool: "readFile", match: /\b(read|open|show)\b.*\b(file|md|json|ts|js)\b/i },
4
2
  { tool: "writeFile", match: /\b(write|create|update|edit|save)\b.*\b(file|doc|readme|json|ts|js)\b/i },
3
+ { tool: "readFile", match: /\b(read|open|show)\b.*\b(file|md|json|ts|js|readme)\b/i },
5
4
  { tool: "searchInFiles", match: /\b(search|find|grep|look for)\b/i },
6
5
  { tool: "gitStatus", match: /\bgit status|repo status|what changed\b/i },
7
6
  { tool: "gitDiff", match: /\bgit diff|show diff|changes\b/i },
8
- { tool: "runCommand", match: /\brun|execute|command|npm|pnpm|yarn|test|build\b/i }
7
+ { tool: "runCommand", match: /\b(run|execute|command|npm|pnpm|yarn|test|build)\b/i },
8
+ { tool: "listDirectory", match: /\b(list|ls|folders?|directories?)\b/i }
9
9
  ];
10
10
  function inferTool(content) {
11
11
  for (const hint of TOOL_HINTS) {
@@ -1,6 +1,6 @@
1
1
  import type { PermissionLevel, ToolName, WorkspaceSettings } from "./types.js";
2
2
  export declare function getToolPermission(settings: WorkspaceSettings, tool: ToolName): PermissionLevel;
3
- export declare function shouldAskEveryTime(tool: ToolName): tool is "writeFile" | "runCommand";
3
+ export declare function shouldAskEveryTime(settings: WorkspaceSettings, tool: ToolName): boolean;
4
4
  export declare function isToolAllowedWithoutPrompt(settings: WorkspaceSettings, tool: ToolName): boolean;
5
5
  export declare function isToolEnabled(settings: WorkspaceSettings, tool: ToolName): boolean;
6
6
  export declare function toolRiskLevel(tool: ToolName): "low" | "medium" | "high";
@@ -1,12 +1,16 @@
1
1
  export function getToolPermission(settings, tool) {
2
2
  return settings.tools[tool] ?? "disabled";
3
3
  }
4
- export function shouldAskEveryTime(tool) {
5
- return tool === "runCommand" || tool === "writeFile";
4
+ export function shouldAskEveryTime(settings, tool) {
5
+ if (tool === "runCommand")
6
+ return true;
7
+ if (tool === "writeFile")
8
+ return getToolPermission(settings, tool) !== "enabled";
9
+ return false;
6
10
  }
7
11
  export function isToolAllowedWithoutPrompt(settings, tool) {
8
12
  const level = getToolPermission(settings, tool);
9
- return level === "enabled" && !shouldAskEveryTime(tool);
13
+ return level === "enabled" && !shouldAskEveryTime(settings, tool);
10
14
  }
11
15
  export function isToolEnabled(settings, tool) {
12
16
  return getToolPermission(settings, tool) !== "disabled";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "terry-core",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "description": "Core policy, tooling, and orchestration modules for Terry Agent.",
5
5
  "license": "MIT",
6
6
  "author": "ELEVAREL",