cc-safety-net 2.3.4 → 2.4.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/dist/api.d.ts CHANGED
@@ -9,10 +9,4 @@ export type CheckCommandResult = Readonly<{
9
9
  reason: string;
10
10
  ruleId?: string;
11
11
  }>;
12
- /**
13
- * Checks one shell command against the current CC Safety Net policy without
14
- * executing it, writing audit data, or touching the network. Reads local
15
- * policy and filesystem facts on every call. If this function throws, the
16
- * caller must not execute the command.
17
- */
18
12
  export declare function checkCommand(input: CheckCommandInput): CheckCommandResult;
package/dist/api.js CHANGED
@@ -1 +1 @@
1
- import{Se,he,c,d,Fe}from"./chunks/index-e7vaxtyk.js";import{isAbsolute as r,resolve as n}from"node:path";function f(e){if(typeof e!=="object"||e===null)throw TypeError("checkCommand requires an input object with command and cwd");if(typeof e.command!=="string"||e.command.trim()==="")throw TypeError("command must be a non-empty string");if(typeof e.cwd!=="string"||e.cwd.trim()===""||!r(e.cwd))throw TypeError("cwd must be an absolute directory path");let o=n(e.cwd);if(!Se(o))return{kind:"deny",reason:he};return a(t(c("library-api",{command:e.command},{kind:"command",shell:"auto"},{configCwd:o,executionCwd:o},e.command)))}function t(e){try{return Fe(e).decision}catch(o){if(!(o instanceof d))throw o;return o.evaluation.decision}}function a(e){if(e.kind==="allow")return{kind:"allow"};return{kind:"deny",reason:e.reason,...e.ruleId===void 0?{}:{ruleId:e.ruleId}}}export{f as checkCommand};
1
+ import{re,l,de,u,p,V}from"./chunks/index-chc1n91k.js";import{isAbsolute as r,resolve as n}from"node:path";function w(e){if(typeof e!=="object"||e===null)throw TypeError("checkCommand requires an input object with command and cwd");if(typeof e.command!=="string"||e.command.trim()==="")throw TypeError("command must be a non-empty string");if(typeof e.cwd!=="string"||e.cwd.trim()===""||!r(e.cwd))throw TypeError("cwd must be an absolute directory path");let o=n(e.cwd);if(!de(o))return{kind:"deny",reason:re};return a(t(u("library-api",{command:e.command},{kind:"command",shell:"auto"},{configCwd:o,executionCwd:o},e.command)))}function t(e){try{return V(e,{environment:l()}).decision}catch(o){if(!(o instanceof p))throw o;return o.evaluation.decision}}function a(e){if(e.kind==="allow")return{kind:"allow"};return{kind:"deny",reason:e.reason,...e.ruleId===void 0?{}:{ruleId:e.ruleId}}}export{w as checkCommand};