calllint 0.9.2 → 0.9.3

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.
Files changed (2) hide show
  1. package/dist/index.js +55 -14
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -4473,7 +4473,7 @@ function receiptCommand(args, deps) {
4473
4473
  }
4474
4474
 
4475
4475
  // src/commands/action.ts
4476
- import { readFileSync as readFileSync9 } from "node:fs";
4476
+ import { readFileSync as readFileSync9, writeFileSync as writeFileSync6 } from "node:fs";
4477
4477
  import { resolve as resolve5 } from "node:path";
4478
4478
 
4479
4479
  // ../../packages/action-analyzer/src/types.ts
@@ -4963,21 +4963,28 @@ Expected: calllint.action.v0`,
4963
4963
  const policy = loadPolicyOrDefault(policyPath ? resolve5(deps.cwd, policyPath) : void 0);
4964
4964
  const findings = analyzeAction(descriptor);
4965
4965
  const verdict = computeActionVerdict(findings, policy);
4966
+ const actionReport = {
4967
+ schema_version: "calllint.action-report.v0",
4968
+ verdict,
4969
+ findings,
4970
+ target: {
4971
+ type: "action",
4972
+ kind: descriptor.kind,
4973
+ schema_version: descriptor.schema_version
4974
+ },
4975
+ policy_applied: "default",
4976
+ scan_timestamp: deps.generatedAt || (/* @__PURE__ */ new Date()).toISOString(),
4977
+ counts: {
4978
+ SAFE: findings.filter((f) => !f.blocker && f.severity !== "high").length === 0 ? 1 : 0,
4979
+ REVIEW: findings.some((f) => f.severity === "high") ? 1 : 0,
4980
+ BLOCK: findings.some((f) => f.blocker || f.severity === "critical") ? 1 : 0,
4981
+ UNKNOWN: 0
4982
+ },
4983
+ reports: [{ findings }]
4984
+ };
4966
4985
  let stdout = "";
4967
4986
  if (args.flags["json"]) {
4968
- const report = {
4969
- schema_version: "calllint.action-report.v0",
4970
- verdict,
4971
- findings,
4972
- target: {
4973
- type: "action",
4974
- kind: descriptor.kind,
4975
- schema_version: descriptor.schema_version
4976
- },
4977
- policy_applied: "default",
4978
- scan_timestamp: (/* @__PURE__ */ new Date()).toISOString()
4979
- };
4980
- stdout = JSON.stringify(report, null, 2);
4987
+ stdout = JSON.stringify(actionReport, null, 2);
4981
4988
  } else {
4982
4989
  const header = `
4983
4990
  \u{1F50D} Action: ${descriptor.kind}
@@ -4997,6 +5004,12 @@ Expected: calllint.action.v0`,
4997
5004
  }
4998
5005
  stdout = header + body;
4999
5006
  }
5007
+ if (args.flags["receipt"]) {
5008
+ const receiptError = writeActionReceipt(descriptor, content, actionReport, policy, args, deps);
5009
+ if (receiptError) {
5010
+ return { stdout: "", stderr: receiptError, exitCode: 2 };
5011
+ }
5012
+ }
5000
5013
  return {
5001
5014
  stdout,
5002
5015
  stderr: "",
@@ -5034,11 +5047,14 @@ COMMANDS
5034
5047
  OPTIONS
5035
5048
  --json Output JSON report
5036
5049
  --policy <file> Use custom policy file
5050
+ --receipt Generate a calllint.receipt.v0 file
5051
+ --receipt-out <file> Receipt output path (default: calllint-action-receipt.json)
5037
5052
  --no-emoji Disable emoji in output
5038
5053
 
5039
5054
  EXAMPLE
5040
5055
  calllint action inspect payment.json
5041
5056
  calllint action inspect email-reply.json --json
5057
+ calllint action inspect payment.json --receipt
5042
5058
 
5043
5059
  See: https://calllint.com/docs/action-inspect (ADR 0029)
5044
5060
  `;
@@ -5057,6 +5073,31 @@ function computeActionVerdict(findings, policy) {
5057
5073
  }
5058
5074
  return "REVIEW";
5059
5075
  }
5076
+ function writeActionReceipt(descriptor, rawContent, actionReport, policy, args, deps) {
5077
+ const toolVersion = deps.toolVersion ?? "0.0.0-dev";
5078
+ const receipt = createReceipt(
5079
+ {
5080
+ toolVersion,
5081
+ subject: { type: "action", target: descriptor.kind },
5082
+ inputForHash: rawContent,
5083
+ effectivePolicyForHash: policy ?? { policy: "default" },
5084
+ scanReport: actionReport,
5085
+ rulesetForHash: { tool: "calllint", version: toolVersion },
5086
+ networkUsed: false
5087
+ },
5088
+ deps.generatedAt || (/* @__PURE__ */ new Date()).toISOString()
5089
+ );
5090
+ const outPath = resolve5(
5091
+ deps.cwd,
5092
+ args.flags["receipt-out"] ?? "calllint-action-receipt.json"
5093
+ );
5094
+ try {
5095
+ writeFileSync6(outPath, JSON.stringify(receipt, null, 2) + "\n", "utf8");
5096
+ } catch (e) {
5097
+ return `Could not write action receipt to ${outPath}: ${e instanceof Error ? e.message : String(e)}`;
5098
+ }
5099
+ return void 0;
5100
+ }
5060
5101
 
5061
5102
  // src/run.ts
5062
5103
  function run(argv, deps) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "calllint",
3
- "version": "0.9.2",
3
+ "version": "0.9.3",
4
4
  "description": "Evidence-backed security verdicts for MCP servers and agent tools. Lint agent tool-call risk before tools run — SAFE / REVIEW / BLOCK / UNKNOWN, with evidence. Never executes the server it judges.",
5
5
  "keywords": [
6
6
  "mcp",