@axisagent/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 CHANGED
@@ -23,13 +23,36 @@ function printHelp() {
23
23
  Commands:
24
24
  list [--chain Base] [--json]
25
25
  inspect <skill-id> [--json]
26
- install <skill-id> [--target .axis/skills]
27
- scan <skill-dir>
26
+ install <skill-id> [--target .axis/skills] [--scan] [--json]
27
+ scan <skill-dir> [--json]
28
28
  validate
29
29
  connect [--pair AXIS-4821] [--api https://api.axisagent.xyz] [--once]
30
30
  serve [--port 8788]
31
31
  `);
32
32
  }
33
+ function severityIcon(severity) {
34
+ if (severity === "safe")
35
+ return "OK";
36
+ if (severity === "warning")
37
+ return "REVIEW";
38
+ return "BLOCKED";
39
+ }
40
+ function formatScanReport(skillDir, result) {
41
+ const lines = [
42
+ `Axis Scan ${result.ok ? "passed" : "blocked"}`,
43
+ `Path: ${skillDir}`,
44
+ ""
45
+ ];
46
+ if (result.policy) {
47
+ lines.push("Policy", ` Skill: ${result.policy.id ?? "unknown"}`, ` Risk: ${result.policy.risk ?? "unknown"}`, ` Mode: ${result.policy.executionMode ?? "unknown"}`, ` Approval: ${result.policy.requiresApproval ? "required" : "not required"}`, ` Wallet write: ${result.policy.walletWrite ? "declared" : "none"}`, ` Max spend: ${result.policy.maxSpendUsd == null ? "none" : `$${result.policy.maxSpendUsd}`}`, ` Permissions: ${(result.policy.permissions ?? []).join(", ") || "none"}`, "");
48
+ }
49
+ lines.push("Checks");
50
+ for (const finding of result.findings) {
51
+ lines.push(` [${severityIcon(finding.severity)}] ${finding.label}: ${finding.value}`);
52
+ }
53
+ lines.push("", "Next", result.ok ? " Return to Axis and review the Axis Check before execution." : " Fix blocked checks before using this skill.", " Never approve wallet or market actions without reading the preview.");
54
+ return lines.join("\n");
55
+ }
33
56
  async function run() {
34
57
  if (command === "help" || command === "--help" || command === "-h") {
35
58
  printHelp();
@@ -64,17 +87,36 @@ async function run() {
64
87
  const target = resolve(userCwd, getOption("--target", ".axis/skills") ?? ".axis/skills");
65
88
  await mkdir(target, { recursive: true });
66
89
  const result = await writeSkillPackage(id, target);
67
- console.log(`Installed ${result.skill.id}`);
90
+ const scan = hasFlag("--scan") ? await scanSkillPackage(result.skillDir) : null;
91
+ if (hasFlag("--json")) {
92
+ console.log(JSON.stringify({ installed: result.skill.id, path: result.skillDir, files: result.files, scan }, null, 2));
93
+ if (scan && !scan.ok)
94
+ process.exitCode = 1;
95
+ return;
96
+ }
97
+ console.log(`Axis Install complete`);
98
+ console.log(`Skill: ${result.skill.id}`);
68
99
  console.log(`Path: ${result.skillDir}`);
69
100
  console.log(`Files: ${result.files.join(", ")}`);
101
+ if (scan) {
102
+ console.log("");
103
+ console.log(formatScanReport(result.skillDir, scan));
104
+ if (!scan.ok)
105
+ process.exitCode = 1;
106
+ }
107
+ else {
108
+ console.log("");
109
+ console.log(`Next: npx @axisagent/cli scan ${result.skillDir}`);
110
+ }
70
111
  return;
71
112
  }
72
113
  if (command === "scan") {
73
114
  const target = args[1];
74
115
  if (!target)
75
116
  throw new Error("Missing skill directory.");
76
- const result = await scanSkillPackage(resolve(userCwd, target));
77
- console.log(JSON.stringify(result, null, 2));
117
+ const skillDir = resolve(userCwd, target);
118
+ const result = await scanSkillPackage(skillDir);
119
+ console.log(hasFlag("--json") ? JSON.stringify(result, null, 2) : formatScanReport(skillDir, result));
78
120
  if (!result.ok)
79
121
  process.exitCode = 1;
80
122
  return;
@@ -1,3 +1,20 @@
1
+ export type ScanResult = {
2
+ ok: boolean;
3
+ findings: Array<{
4
+ label: string;
5
+ severity: "safe" | "warning" | "blocked";
6
+ value: string;
7
+ }>;
8
+ policy?: {
9
+ id?: string;
10
+ risk?: string;
11
+ executionMode?: string;
12
+ permissions?: string[];
13
+ requiresApproval?: boolean;
14
+ walletWrite?: boolean;
15
+ maxSpendUsd?: number | null;
16
+ };
17
+ };
1
18
  export declare function writeSkillPackage(skillId: string, targetDir: string): Promise<{
2
19
  skill: {
3
20
  id: string;
@@ -31,11 +48,4 @@ export declare function writeSkillPackage(skillId: string, targetDir: string): P
31
48
  skillDir: string;
32
49
  files: string[];
33
50
  }>;
34
- export declare function scanSkillPackage(skillDir: string): Promise<{
35
- ok: boolean;
36
- findings: {
37
- label: string;
38
- severity: "safe" | "warning" | "blocked";
39
- value: string;
40
- }[];
41
- }>;
51
+ export declare function scanSkillPackage(skillDir: string): Promise<ScanResult>;
@@ -43,6 +43,15 @@ export async function scanSkillPackage(skillDir) {
43
43
  }
44
44
  return {
45
45
  ok: findings.every((finding) => finding.severity !== "blocked"),
46
- findings
46
+ findings,
47
+ policy: {
48
+ id: policyJson.id,
49
+ risk: policyJson.risk,
50
+ executionMode: policyJson.executionMode,
51
+ permissions: policyJson.permissions ?? [],
52
+ requiresApproval: policyJson.policy?.requiresApproval,
53
+ walletWrite: policyJson.policy?.walletWrite,
54
+ maxSpendUsd: policyJson.policy?.maxSpendUsd
55
+ }
47
56
  };
48
57
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@axisagent/cli",
3
3
  "private": false,
4
- "version": "0.1.0",
4
+ "version": "0.1.1",
5
5
  "type": "module",
6
6
  "description": "Local Axis runtime, skill registry, policy validator, and CLI.",
7
7
  "license": "MIT",