@catp-protocol/cli 0.1.0 → 0.1.1
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/cli.js +7 -0
- package/dist/cli.js.map +1 -1
- package/dist/commands/anchor.d.ts +7 -0
- package/dist/commands/anchor.d.ts.map +1 -0
- package/dist/commands/anchor.js +122 -0
- package/dist/commands/anchor.js.map +1 -0
- package/package.json +20 -9
package/dist/cli.js
CHANGED
|
@@ -5,6 +5,7 @@ import { runPostHook } from "./hook/post.js";
|
|
|
5
5
|
import { cmdInit } from "./commands/init.js";
|
|
6
6
|
import { cmdValidate } from "./commands/validate.js";
|
|
7
7
|
import { cmdLogShow, cmdLogVerify } from "./commands/log.js";
|
|
8
|
+
import { cmdAnchor } from "./commands/anchor.js";
|
|
8
9
|
const program = new Command();
|
|
9
10
|
program
|
|
10
11
|
.name("catp")
|
|
@@ -40,6 +41,12 @@ log
|
|
|
40
41
|
.description("Verify commitment chain integrity")
|
|
41
42
|
.option("--agent <id>", "agent id (default: from policy file)")
|
|
42
43
|
.action(cmdLogVerify);
|
|
44
|
+
program
|
|
45
|
+
.command("anchor")
|
|
46
|
+
.description("Batch audit commitments into a Merkle root and submit on-chain")
|
|
47
|
+
.option("--agent <id>", "agent id (default: from policy file)")
|
|
48
|
+
.option("--dry-run", "compute and print the Merkle root without submitting")
|
|
49
|
+
.action(cmdAnchor);
|
|
43
50
|
program.parseAsync(process.argv).catch((err) => {
|
|
44
51
|
process.stderr.write(`catp: ${err.message}\n`);
|
|
45
52
|
process.exit(1);
|
package/dist/cli.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB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AC1D,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare function readCommitments(agentId: string): string[];
|
|
2
|
+
export declare function merkleRoot(commitments: string[]): `0x${string}`;
|
|
3
|
+
export declare function cmdAnchor(opts: {
|
|
4
|
+
agent?: string;
|
|
5
|
+
dryRun?: boolean;
|
|
6
|
+
}): Promise<void>;
|
|
7
|
+
//# sourceMappingURL=anchor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"anchor.d.ts","sourceRoot":"","sources":["../../src/commands/anchor.ts"],"names":[],"mappings":"AAgCA,wBAAgB,eAAe,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,EAAE,CAoBzD;AAED,wBAAgB,UAAU,CAAC,WAAW,EAAE,MAAM,EAAE,GAAG,KAAK,MAAM,EAAE,CAwB/D;AAmCD,wBAAsB,SAAS,CAAC,IAAI,EAAE;IACpC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB,GAAG,OAAO,CAAC,IAAI,CAAC,CAgChB"}
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import { createHash } from "node:crypto";
|
|
2
|
+
import { readFileSync, readdirSync, existsSync } from "node:fs";
|
|
3
|
+
import { join } from "node:path";
|
|
4
|
+
import { homedir } from "node:os";
|
|
5
|
+
import { findPolicyFile, loadPolicy } from "../policy/loader.js";
|
|
6
|
+
const REGISTER_POLICY_ABI = [
|
|
7
|
+
{
|
|
8
|
+
name: "registerPolicy",
|
|
9
|
+
type: "function",
|
|
10
|
+
inputs: [{ name: "policyCommitment", type: "bytes32" }],
|
|
11
|
+
outputs: [],
|
|
12
|
+
stateMutability: "nonpayable",
|
|
13
|
+
},
|
|
14
|
+
];
|
|
15
|
+
function resolveAgentId(opts) {
|
|
16
|
+
if (opts.agent)
|
|
17
|
+
return opts.agent;
|
|
18
|
+
const policyPath = findPolicyFile();
|
|
19
|
+
if (policyPath) {
|
|
20
|
+
try {
|
|
21
|
+
return loadPolicy(policyPath).agent.id;
|
|
22
|
+
}
|
|
23
|
+
catch {
|
|
24
|
+
// fall through
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
throw new Error("Could not determine agent ID. Specify --agent <id> or run from a directory with catp-policy.toml.");
|
|
28
|
+
}
|
|
29
|
+
export function readCommitments(agentId) {
|
|
30
|
+
const baseDir = join(homedir(), ".catp", "audit", agentId);
|
|
31
|
+
if (!existsSync(baseDir))
|
|
32
|
+
return [];
|
|
33
|
+
const commitments = [];
|
|
34
|
+
const dates = readdirSync(baseDir).sort();
|
|
35
|
+
for (const date of dates) {
|
|
36
|
+
const file = join(baseDir, date, "actions.jsonl");
|
|
37
|
+
if (!existsSync(file))
|
|
38
|
+
continue;
|
|
39
|
+
const lines = readFileSync(file, "utf8").trimEnd().split("\n").filter(Boolean);
|
|
40
|
+
for (const line of lines) {
|
|
41
|
+
try {
|
|
42
|
+
const entry = JSON.parse(line);
|
|
43
|
+
if (entry.commitment)
|
|
44
|
+
commitments.push(entry.commitment);
|
|
45
|
+
}
|
|
46
|
+
catch {
|
|
47
|
+
// skip malformed lines
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
return commitments;
|
|
52
|
+
}
|
|
53
|
+
export function merkleRoot(commitments) {
|
|
54
|
+
if (commitments.length === 0) {
|
|
55
|
+
return `0x${"00".repeat(32)}`;
|
|
56
|
+
}
|
|
57
|
+
let layer = commitments.map((c) => {
|
|
58
|
+
const b = Buffer.from(c, "hex");
|
|
59
|
+
return b.length === 32 ? b : createHash("sha256").update(c).digest();
|
|
60
|
+
});
|
|
61
|
+
while (layer.length > 1) {
|
|
62
|
+
if (layer.length % 2 !== 0) {
|
|
63
|
+
layer.push(layer[layer.length - 1]);
|
|
64
|
+
}
|
|
65
|
+
const next = [];
|
|
66
|
+
for (let i = 0; i < layer.length; i += 2) {
|
|
67
|
+
next.push(createHash("sha256").update(layer[i]).update(layer[i + 1]).digest());
|
|
68
|
+
}
|
|
69
|
+
layer = next;
|
|
70
|
+
}
|
|
71
|
+
return `0x${layer[0].toString("hex")}`;
|
|
72
|
+
}
|
|
73
|
+
async function submitOnChain(root, rpcUrl, privateKey, contractAddress) {
|
|
74
|
+
const { createPublicClient, createWalletClient, http, defineChain } = await import("viem");
|
|
75
|
+
const { privateKeyToAccount } = await import("viem/accounts");
|
|
76
|
+
const publicClient = createPublicClient({ transport: http(rpcUrl) });
|
|
77
|
+
const chainId = await publicClient.getChainId();
|
|
78
|
+
const chain = defineChain({
|
|
79
|
+
id: chainId,
|
|
80
|
+
name: "catp-network",
|
|
81
|
+
nativeCurrency: { name: "Ether", symbol: "ETH", decimals: 18 },
|
|
82
|
+
rpcUrls: { default: { http: [rpcUrl] } },
|
|
83
|
+
});
|
|
84
|
+
const account = privateKeyToAccount(privateKey);
|
|
85
|
+
const walletClient = createWalletClient({ account, chain, transport: http(rpcUrl) });
|
|
86
|
+
const hash = await walletClient.writeContract({
|
|
87
|
+
address: contractAddress,
|
|
88
|
+
abi: REGISTER_POLICY_ABI,
|
|
89
|
+
functionName: "registerPolicy",
|
|
90
|
+
args: [root],
|
|
91
|
+
});
|
|
92
|
+
await publicClient.waitForTransactionReceipt({ hash });
|
|
93
|
+
return hash;
|
|
94
|
+
}
|
|
95
|
+
export async function cmdAnchor(opts) {
|
|
96
|
+
const agentId = resolveAgentId(opts);
|
|
97
|
+
const commitments = readCommitments(agentId);
|
|
98
|
+
const root = merkleRoot(commitments);
|
|
99
|
+
process.stdout.write(`Agent: ${agentId}\n`);
|
|
100
|
+
process.stdout.write(`Commitments: ${commitments.length}\n`);
|
|
101
|
+
process.stdout.write(`Merkle root: ${root}\n`);
|
|
102
|
+
if (commitments.length === 0) {
|
|
103
|
+
process.stdout.write("No audit entries found — nothing to anchor.\n");
|
|
104
|
+
return;
|
|
105
|
+
}
|
|
106
|
+
const rpcUrl = process.env.CATP_RPC_URL;
|
|
107
|
+
const privateKey = process.env.CATP_PRIVATE_KEY;
|
|
108
|
+
const contractAddress = process.env.CATP_CONTRACT_ADDRESS;
|
|
109
|
+
if (opts.dryRun || !rpcUrl || !privateKey || !contractAddress) {
|
|
110
|
+
if (!opts.dryRun) {
|
|
111
|
+
process.stdout.write("\nSet CATP_RPC_URL, CATP_PRIVATE_KEY, and CATP_CONTRACT_ADDRESS to submit on-chain.\n");
|
|
112
|
+
}
|
|
113
|
+
else {
|
|
114
|
+
process.stdout.write("\nDry run — skipping on-chain submission.\n");
|
|
115
|
+
}
|
|
116
|
+
return;
|
|
117
|
+
}
|
|
118
|
+
process.stdout.write("Submitting to chain...\n");
|
|
119
|
+
const txHash = await submitOnChain(root, rpcUrl, privateKey, contractAddress);
|
|
120
|
+
process.stdout.write(`Transaction: ${txHash}\n`);
|
|
121
|
+
}
|
|
122
|
+
//# sourceMappingURL=anchor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"anchor.js","sourceRoot":"","sources":["../../src/commands/anchor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAChE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAGjE,MAAM,mBAAmB,GAAG;IAC1B;QACE,IAAI,EAAE,gBAAgB;QACtB,IAAI,EAAE,UAAU;QAChB,MAAM,EAAE,CAAC,EAAE,IAAI,EAAE,kBAAkB,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC;QACvD,OAAO,EAAE,EAAE;QACX,eAAe,EAAE,YAAY;KAC9B;CACO,CAAC;AAEX,SAAS,cAAc,CAA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a,CAAC,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE,eAAe,CAAC,CAAC;IAC9E,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,gBAAgB,MAAM,IAAI,CAAC,CAAC;AACnD,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,37 +1,48 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@catp-protocol/cli",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"description": "Cryptographic Agent Trust Protocol — local enforcement plugin for Claude Code with TOML policy and tamper-evident audit log",
|
|
5
|
-
"keywords": [
|
|
5
|
+
"keywords": [
|
|
6
|
+
"claude-code",
|
|
7
|
+
"ai-agents",
|
|
8
|
+
"policy",
|
|
9
|
+
"audit",
|
|
10
|
+
"hooks",
|
|
11
|
+
"trust",
|
|
12
|
+
"zk"
|
|
13
|
+
],
|
|
6
14
|
"license": "MIT",
|
|
7
15
|
"homepage": "https://github.com/lfzkoala/catp#readme",
|
|
8
16
|
"bugs": "https://github.com/lfzkoala/catp/issues",
|
|
9
17
|
"repository": {
|
|
10
18
|
"type": "git",
|
|
11
|
-
"url": "https://github.com/lfzkoala/catp.git"
|
|
19
|
+
"url": "git+https://github.com/lfzkoala/catp.git"
|
|
12
20
|
},
|
|
13
21
|
"type": "module",
|
|
14
22
|
"bin": {
|
|
15
|
-
"catp": "
|
|
23
|
+
"catp": "dist/cli.js"
|
|
16
24
|
},
|
|
17
|
-
"files": [
|
|
25
|
+
"files": [
|
|
26
|
+
"dist"
|
|
27
|
+
],
|
|
18
28
|
"engines": {
|
|
19
29
|
"node": ">=20"
|
|
20
30
|
},
|
|
21
31
|
"scripts": {
|
|
22
32
|
"build": "tsc",
|
|
23
33
|
"typecheck": "tsc --noEmit",
|
|
24
|
-
"test": "node --experimental-vm-modules node_modules/.bin/jest",
|
|
25
|
-
"test:coverage": "node --experimental-vm-modules node_modules/.bin/jest --coverage --ci"
|
|
34
|
+
"test": "node --experimental-vm-modules ../node_modules/.bin/jest --config jest.config.cjs",
|
|
35
|
+
"test:coverage": "node --experimental-vm-modules ../node_modules/.bin/jest --config jest.config.cjs --coverage --ci"
|
|
26
36
|
},
|
|
27
37
|
"dependencies": {
|
|
28
38
|
"commander": "^12.0.0",
|
|
29
39
|
"micromatch": "^4.0.5",
|
|
30
|
-
"smol-toml": "^1.3.0"
|
|
40
|
+
"smol-toml": "^1.3.0",
|
|
41
|
+
"viem": "^2"
|
|
31
42
|
},
|
|
32
43
|
"devDependencies": {
|
|
33
44
|
"@types/micromatch": "^4.0.6",
|
|
34
|
-
"@types/node": "^20.
|
|
45
|
+
"@types/node": "^20.19.39",
|
|
35
46
|
"jest": "^29.0.0",
|
|
36
47
|
"ts-jest": "^29.0.0",
|
|
37
48
|
"typescript": "^5.4.0"
|