@red-codes/agentguard 1.1.3 → 1.1.4

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/dist/bin.js CHANGED
@@ -9497,6 +9497,20 @@ function resolveAgentIdentity(sessionId) {
9497
9497
  }
9498
9498
  return `claude-code:${simpleHash(sessionId.trim())}`;
9499
9499
  }
9500
+ function normalizeFilePath(filePath) {
9501
+ if (!filePath)
9502
+ return filePath;
9503
+ const normalized = filePath.replace(/\\/g, "/");
9504
+ const isAbsolute = normalized.startsWith("/") || /^[a-zA-Z]:\//.test(normalized);
9505
+ if (!isAbsolute)
9506
+ return normalized;
9507
+ const cwd = process.cwd().replace(/\\/g, "/");
9508
+ if (normalized.startsWith(cwd + "/")) {
9509
+ return normalized.slice(cwd.length + 1);
9510
+ }
9511
+ const lastSlash = normalized.lastIndexOf("/");
9512
+ return lastSlash >= 0 ? normalized.slice(lastSlash + 1) : normalized;
9513
+ }
9500
9514
  function normalizeClaudeCodeAction(payload, persona) {
9501
9515
  const input = payload.tool_input || {};
9502
9516
  const agent = resolveAgentIdentity(payload.session_id);
@@ -9507,7 +9521,7 @@ function normalizeClaudeCodeAction(payload, persona) {
9507
9521
  case "Write":
9508
9522
  baseAction = {
9509
9523
  tool: "Write",
9510
- file: input.file_path,
9524
+ file: normalizeFilePath(input.file_path),
9511
9525
  content: input.content,
9512
9526
  agent,
9513
9527
  metadata: { hook: payload.hook, sessionId: payload.session_id }
@@ -9516,7 +9530,7 @@ function normalizeClaudeCodeAction(payload, persona) {
9516
9530
  case "Edit":
9517
9531
  baseAction = {
9518
9532
  tool: "Edit",
9519
- file: input.file_path,
9533
+ file: normalizeFilePath(input.file_path),
9520
9534
  content: input.new_string,
9521
9535
  agent,
9522
9536
  metadata: {
@@ -9529,7 +9543,7 @@ function normalizeClaudeCodeAction(payload, persona) {
9529
9543
  case "Read":
9530
9544
  baseAction = {
9531
9545
  tool: "Read",
9532
- file: input.file_path,
9546
+ file: normalizeFilePath(input.file_path),
9533
9547
  agent,
9534
9548
  metadata: { hook: payload.hook, sessionId: payload.session_id }
9535
9549
  };
@@ -29048,7 +29062,7 @@ async function main() {
29048
29062
  }
29049
29063
  case "--version":
29050
29064
  case "-v": {
29051
- console.log(`agentguard v${"1.1.3"}`);
29065
+ console.log(`agentguard v${"1.1.4"}`);
29052
29066
  break;
29053
29067
  }
29054
29068
  case "help":