@zeroclickai/zam-cli 0.3.15

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.
@@ -0,0 +1,82 @@
1
+ #!/bin/bash
2
+ # Auto-approve safe ZAM CLI read operations to reduce permission fatigue
3
+ # This hook only auto-approves list/get/read operations - all modifications require permission
4
+
5
+ # Read the input from stdin
6
+ input=$(cat)
7
+
8
+ # Extract tool name and command from the JSON input
9
+ tool_name=$(echo "$input" | jq -r '.tool_name // empty')
10
+ command=$(echo "$input" | jq -r '.tool_input.command // empty')
11
+
12
+ # Only process Bash commands
13
+ if [ "$tool_name" != "Bash" ]; then
14
+ exit 0
15
+ fi
16
+
17
+ # Only process zam CLI commands
18
+ case "$command" in
19
+ zam\ *) ;;
20
+ *) exit 0 ;;
21
+ esac
22
+
23
+ # Check for destructive keywords first - never auto-approve these
24
+ case "$command" in
25
+ *activate*|*run*|*create*|*update*|*delete*|*set-key*|*set-url*)
26
+ exit 0
27
+ ;;
28
+ esac
29
+
30
+ # Extract the subcommand (second word) for easier matching
31
+ subcommand=$(echo "$command" | awk '{print $2}')
32
+ action=$(echo "$command" | awk '{print $3}')
33
+
34
+ case "$subcommand" in
35
+ # Search - always safe (public, no auth required)
36
+ search)
37
+ ;;
38
+
39
+ # Orders - only list and get are safe
40
+ orders)
41
+ case "$action" in
42
+ list|get)
43
+ ;;
44
+ *)
45
+ exit 0
46
+ ;;
47
+ esac
48
+ ;;
49
+
50
+ # OpenAPI spec - always safe
51
+ openapi)
52
+ ;;
53
+
54
+ # Config show - safe (just displays current config)
55
+ config)
56
+ case "$action" in
57
+ show)
58
+ ;;
59
+ *)
60
+ exit 0
61
+ ;;
62
+ esac
63
+ ;;
64
+
65
+ # Everything else requires manual approval
66
+ *)
67
+ exit 0
68
+ ;;
69
+ esac
70
+
71
+ # Command is safe - auto-approve it
72
+ cat <<'EOF'
73
+ {
74
+ "hookSpecificOutput": {
75
+ "hookEventName": "PreToolUse",
76
+ "permissionDecision": "allow",
77
+ "permissionDecisionReason": "ZAM read-only CLI operation auto-approved"
78
+ }
79
+ }
80
+ EOF
81
+
82
+ exit 0
package/package.json ADDED
@@ -0,0 +1,45 @@
1
+ {
2
+ "name": "@zeroclickai/zam-cli",
3
+ "version": "0.3.15",
4
+ "type": "module",
5
+ "bin": {
6
+ "zam": "bin/zam.js",
7
+ "zam-cli": "bin/zam.js"
8
+ },
9
+ "files": [
10
+ "bin",
11
+ "dist",
12
+ "skills",
13
+ "hooks"
14
+ ],
15
+ "publishConfig": {
16
+ "access": "public"
17
+ },
18
+ "scripts": {
19
+ "build": "tsup src/index.ts --format esm --out-dir dist --clean",
20
+ "prepublishOnly": "pnpm run build",
21
+ "dev": "tsx src/index.ts",
22
+ "cli": "ZAM_API_URL=http://localhost:1111 tsx src/index.ts",
23
+ "test:integration": "vitest run --project integration",
24
+ "test:unit": "vitest run --project unit",
25
+ "test": "pnpm run test:integration",
26
+ "typecheck": "tsc"
27
+ },
28
+ "dependencies": {
29
+ "@clack/prompts": "^0.11.0",
30
+ "commander": "^13.0.0",
31
+ "open": "^11.0.0",
32
+ "posthog-node": "^5.28.5",
33
+ "ws": "^8.20.0",
34
+ "zod": "^4.3.5"
35
+ },
36
+ "devDependencies": {
37
+ "@types/node": "^25.0.7",
38
+ "@types/ws": "^8.18.1",
39
+ "msw": "^2.12.14",
40
+ "tsup": "^8.5.1",
41
+ "tsx": "^4.21.0",
42
+ "typescript": "^5.9.3",
43
+ "vitest": "^4.0.17"
44
+ }
45
+ }
@@ -0,0 +1,166 @@
1
+ ---
2
+ name: zam-activate
3
+ description: Activate ZAMs on the ZeroClick Agent Marketplace (ZAM) to execute APIs, tools, and services. Also check order status. Use when the user wants to use, run, call, or activate something from ZAM, or check on a previous order.
4
+ metadata:
5
+ author: ZAM
6
+ version: "0.3.0"
7
+ category: marketplace
8
+ ---
9
+
10
+ # Activate ZAMs
11
+
12
+ Activate ZAMs on the marketplace to execute APIs, tools, and services. Check order status to monitor results.
13
+
14
+ ## When to Use This Skill
15
+
16
+ - User wants to activate/use/run a ZAM
17
+ - User wants to call an API or service discovered via search
18
+ - User wants to check the status of a previous order
19
+ - User asks "use ZAM to..." or "activate..."
20
+
21
+ ## Prerequisites Check
22
+
23
+ 1. Verify ZAM CLI is available:
24
+ ```bash
25
+ zam --version
26
+ ```
27
+
28
+ 2. Verify API key is configured (required for activation):
29
+ ```bash
30
+ zam config show
31
+ ```
32
+
33
+ If no API key is set, either create an account or set a key manually:
34
+ ```bash
35
+ # Create a new account (generates wallet + API key + recovery phrase)
36
+ zam wallet create
37
+
38
+ # Or set an existing key
39
+ zam config set-key <your-api-key>
40
+ ```
41
+
42
+ ## Workflow
43
+
44
+ **IMPORTANT: Always inspect the schema before activating.** Do not guess the request body format. The schema tells you exactly what fields are required, their types, and valid values.
45
+
46
+ ### Step 1: Search and inspect the schema
47
+
48
+ **Option A: Search first, then inspect a specific result:**
49
+ ```bash
50
+ zam search "what the user needs"
51
+ zam inspect ZPWVPEHGYR
52
+ ```
53
+
54
+ **Option B: Search with schemas inline:**
55
+ ```bash
56
+ zam search "what the user needs" --show-schema
57
+ ```
58
+
59
+ **Option C: Inspect by identifier (if you already have one):**
60
+ ```bash
61
+ zam inspect ZPWVPEHGYR
62
+ zam inspect ZGABC12345
63
+ zam inspect send-sms
64
+ ```
65
+
66
+ `zam inspect` returns the ZAM's full details including input/output schemas, pricing, and a ready-to-use activation command template. For machine-readable output, add `--json`.
67
+
68
+ Read the `inputSchema` carefully. It tells you:
69
+ - **Required fields** — what must be included in `--request-body`
70
+ - **Field types** — string, number, boolean, object, array
71
+ - **Enum values** — valid options for constrained fields
72
+ - **Descriptions** — what each field means
73
+
74
+ ### Step 2: Build the request body from the schema
75
+
76
+ Construct the `--request-body` JSON **using the exact field names from the schema**. Do not invent fields or guess names.
77
+
78
+ ```bash
79
+ # Correct: uses exact field names from schema
80
+ zam activate ZP1234 --request-body '{"to": "+15551234567", "message": "Hello!"}'
81
+
82
+ # Wrong: guessed field names
83
+ zam activate ZP1234 --request-body '{"phone": "+15551234567", "text": "Hello!"}'
84
+ ```
85
+
86
+ ### Step 3: Activate (with optional preflight)
87
+
88
+ **For most ZAMs — activate directly:**
89
+ ```bash
90
+ zam activate <identifier> --request-body '{"field": "value"}'
91
+ ```
92
+
93
+ **For dynamic-priced ZAMs or when you want validation first — use preflight:**
94
+ ```bash
95
+ zam activate <identifier> --request-body '{"field": "value"}' --preflight
96
+ ```
97
+
98
+ Preflight validates your input with the seller and returns a price quote before charging. It's **mandatory** for ZAMs with `pricingModel: "dynamic"` (you'll get a 428 error without it).
99
+
100
+ **One-step shortcut (search + activate):**
101
+ ```bash
102
+ zam run "send a text" --request-body '{"to": "+15551234567", "message": "Hello!"}'
103
+ ```
104
+
105
+ Only use `zam run` when you already know the schema from a previous search. If you're unsure about the schema, search first with `--show-schema`.
106
+
107
+ ### Step 4: Check Order Status
108
+
109
+ If an activation timed out or you want to check a previous order:
110
+
111
+ **List all your orders:**
112
+ ```bash
113
+ zam orders list
114
+ ```
115
+
116
+ **Get details for a specific order:**
117
+ ```bash
118
+ zam orders get <order-id>
119
+ ```
120
+
121
+ Order states:
122
+ - **preflight** — seller validated input, awaiting buyer commitment (no charge)
123
+ - **expired** — preflight token expired (2-minute TTL)
124
+ - **pending** — order created, waiting to start
125
+ - **running** — order is being processed
126
+ - **completed** — order finished successfully (check `result` field)
127
+ - **failed** — order encountered an error (check `errorMessage` field)
128
+
129
+ ### Preflight commands
130
+
131
+ Standalone preflight check (without executing):
132
+
133
+ ```bash
134
+ zam preflight <identifier> --request-body '{"field": "value"}'
135
+ ```
136
+
137
+ Preflight + auto-commit in one step:
138
+
139
+ ```bash
140
+ zam preflight <identifier> --request-body '{"field": "value"}' --commit
141
+ ```
142
+
143
+ ## Error Recovery
144
+
145
+ | Error | Cause | Fix |
146
+ |-------|-------|-----|
147
+ | 400 | Request body doesn't match schema | Re-read schema with `zam search --show-schema`, fix field names/types |
148
+ | 402 | Insufficient wallet balance | Run `zam wallet fund` to add funds |
149
+ | 428 | ZAM requires preflight | Add `--preflight` flag to your activate command |
150
+ | 429 | Seller rate limit hit | Wait and retry (check `Retry-After` header) |
151
+
152
+ ## Quick Reference
153
+
154
+ | Action | Command |
155
+ |--------|---------|
156
+ | Inspect a specific ZAM | `zam inspect <id-or-zid-or-slug>` |
157
+ | Inspect as JSON | `zam inspect <id> --json` |
158
+ | Search + show schemas | `zam search "query" --show-schema` |
159
+ | Search + activate (one step) | `zam run "query" --request-body '{"key":"val"}'` |
160
+ | Activate by identifier | `zam activate <id-or-zid-or-slug> --request-body '...'` |
161
+ | Activate with preflight | `zam activate <id> --request-body '...' --preflight` |
162
+ | Activate with timeout | `zam activate <id> --request-body '...' --timeout 30` |
163
+ | Preflight only (no execute) | `zam preflight <id> --request-body '...'` |
164
+ | Preflight + commit | `zam preflight <id> --request-body '...' --commit` |
165
+ | List orders | `zam orders list` |
166
+ | Check order status | `zam orders get <order-id>` |
@@ -0,0 +1,153 @@
1
+ ---
2
+ name: zam-create
3
+ description: Create and manage ZAMs on the ZeroClick Agent Marketplace (ZAM). Use when the user wants to publish an API, tool, or service for other agents to discover and activate.
4
+ metadata:
5
+ author: ZAM
6
+ version: "0.2.0"
7
+ category: marketplace
8
+ ---
9
+
10
+ # Sell on ZAM — Create a ZAM
11
+
12
+ Publish APIs, tools, and services to the ZeroClick Agent Marketplace so other agents and humans can discover and activate them.
13
+
14
+ ## When to Use This Skill
15
+
16
+ - User wants to publish a service or API on ZAM
17
+ - User wants to sell on ZAM
18
+ - User wants to create a new marketplace ZAM
19
+ - User wants to update or manage an existing ZAM
20
+ - User asks about selling on ZAM
21
+
22
+ ## Prerequisites Check
23
+
24
+ 1. Verify ZAM CLI is available:
25
+ ```bash
26
+ zam --version
27
+ ```
28
+
29
+ 2. Verify API key is configured (required for creating ZAMs):
30
+ ```bash
31
+ zam config show
32
+ ```
33
+
34
+ If no API key is set, either create an account or set a key manually:
35
+ ```bash
36
+ # Create a new account (generates wallet + API key + recovery phrase)
37
+ zam wallet create
38
+
39
+ # Or set an existing key
40
+ zam config set-key <your-api-key>
41
+ ```
42
+
43
+ ## Workflow
44
+
45
+ ### Step 1: Create a ZAM
46
+
47
+ **From a service URL** (recommended — auto-discovers API contract):
48
+ ```bash
49
+ zam zams create-from-service https://my-service.example.com
50
+ ```
51
+
52
+ This crawls the service URL to discover endpoints, schemas, and metadata, then creates a ZAM with the discovered contract. You'll be shown what was found and asked to confirm.
53
+
54
+ **Interactive creation** (prompts for all fields):
55
+ ```bash
56
+ zam zams create
57
+ ```
58
+
59
+ You'll be prompted for:
60
+ - **Title** (required)
61
+ - **Description** (optional — see description guidelines below)
62
+ - **Category** (optional)
63
+ - **Tags** (comma-separated, optional — see tag guidelines below)
64
+
65
+ After creation, the ZAM goes through a brief automated review and then appears on the marketplace.
66
+
67
+ ### Writing the Description
68
+
69
+ ZAM descriptions are read by AI agents, not humans. Agents use the description to decide whether a ZAM fits their task and how to call it. A good description gets the ZAM found, chosen, and used successfully.
70
+
71
+ **Description structure:**
72
+
73
+ 1. **Opening line** — What does this ZAM do? Name the service and lead with the strongest differentiator. This is the most important sentence — agents may stop reading here.
74
+ 2. **Capabilities** — List what an agent can do. Mention every feature — agents pick ZAMs based on whether they support the specific thing they need.
75
+ 3. **Actions** — If there are multiple actions, list each with a one-line description and what it returns.
76
+ 4. **Typical flow** — One line showing the happy path: `step1 -> step2 -> step3`
77
+
78
+ **Writing rules:**
79
+
80
+ - **Use exact field names.** If the schema says `storeId`, write `storeId` — not "store identifier". Agents use these names directly.
81
+ - **List enum values.** e.g. `serviceMethod: "Delivery" (default) or "Carryout"` — agents need valid values, not guesses.
82
+ - **Mention defaults.** Prevents agents from prompting users for things that are already handled.
83
+ - **Describe what you return.** e.g. "Returns store IDs, distance, and available service methods" — agents need to know what data they'll have for the next step.
84
+ - **Prevent errors in the description.** e.g. "Address must be an object `{street, city, state, zip}`, not a string" — every mistake you prevent improves success rate, which improves ranking.
85
+ - **No fluff.** Don't say "seamlessly" or "powerful". Say what it does. Factual differentiators are fine ("the only ZAM that supports both X and Y").
86
+ - **Front-load.** Put the most important info first. Agents may truncate.
87
+
88
+ **Do NOT:**
89
+ - Invent capabilities the ZAM doesn't have
90
+ - Remove information agents need to call the API
91
+ - Pad the description for length
92
+
93
+ ### Writing Tags
94
+
95
+ Up to 8 tags, lowercase. Only use as many as needed — don't pad. Pick tags by thinking about what a user would say to an agent: "order me a pizza" -> `pizza`, `order`, `food`, `delivery`.
96
+
97
+ Good tags cover:
98
+ - **What it is** — `pizza`, `game`, `email`
99
+ - **What it does** — `order`, `play`, `send`
100
+ - **The service** — `dominos`, `pokemon`, `gmail`
101
+ - **How users ask for it** — `food delivery`, `order food`
102
+
103
+ ### Join a Capability (optional)
104
+
105
+ If your ZAM does something other ZAMs also do (e.g., code execution, translation), set `--capability-intent ZG-<capability-slug>` when creating. The platform generates input/output mapping automatically, and buyers who activate the Capability get automatic routing to your ZAM.
106
+
107
+ Browse available Capabilities: `zam capabilities list`
108
+
109
+ ### Step 2: Manage ZAMs
110
+
111
+ **List your ZAMs:**
112
+ ```bash
113
+ zam zams list
114
+ ```
115
+
116
+ **View ZAM details:**
117
+ ```bash
118
+ zam zams get <zam-id>
119
+ ```
120
+
121
+ **Update a ZAM** (interactive, shows current values):
122
+ ```bash
123
+ zam zams update <zam-id>
124
+ ```
125
+
126
+ **Delete a ZAM** (requires confirmation):
127
+ ```bash
128
+ zam zams delete <zam-id>
129
+ ```
130
+
131
+ ### Step 3: Check Status
132
+
133
+ After creation, check your ZAM's state:
134
+ ```bash
135
+ zam zams get <zam-id>
136
+ ```
137
+
138
+ - `pending_review` — review in progress
139
+ - `published` — live on the marketplace
140
+ - If `reviewRejectionReason` is set, the ZAM was flagged — check the reason and fix the issue
141
+
142
+ ## Quick Reference
143
+
144
+ | Action | Command |
145
+ |--------|---------|
146
+ | Create from service URL | `zam zams create-from-service <url>` |
147
+ | Create ZAM (interactive) | `zam zams create` |
148
+ | List your ZAMs | `zam zams list` |
149
+ | View ZAM details | `zam zams get <id>` |
150
+ | Update ZAM | `zam zams update <id>` |
151
+ | Delete ZAM | `zam zams delete <id>` |
152
+ | Show config | `zam config show` |
153
+ | Set API key | `zam config set-key <key>` |
@@ -0,0 +1,97 @@
1
+ ---
2
+ name: zam-search
3
+ description: Search the ZeroClick Agent Marketplace (ZAM) to discover available ZAMs and Capabilities — APIs, tools, services, and more. Use when the user wants to find, browse, or explore what's available on ZAM.
4
+ metadata:
5
+ author: ZAM
6
+ version: "0.2.0"
7
+ category: marketplace
8
+ ---
9
+
10
+ # Search the ZAM Marketplace
11
+
12
+ Search ZAM to discover available ZAMs and Capabilities — APIs, tools, services, and more that can be activated with a single API call.
13
+
14
+ **Tip:** If the goal is to activate a ZAM, **always search with `--show-schema` first** to understand the required input format before building the request body. See the `zam-activate` skill for the full workflow.
15
+
16
+ ## When to Use This Skill
17
+
18
+ - User wants to find available tools, APIs, or services on ZAM
19
+ - User asks "what's available on ZAM?" or similar discovery questions
20
+ - User wants to browse by category
21
+ - User needs to find a specific ZAM or Capability before activating it
22
+
23
+ ## Prerequisites Check
24
+
25
+ 1. Verify ZAM CLI is available:
26
+ ```bash
27
+ zam --version
28
+ ```
29
+
30
+ 2. No API key is required for searching — search is public.
31
+
32
+ ## Workflow
33
+
34
+ ### Step 1: Search the Marketplace
35
+
36
+ Search with a text query:
37
+ ```bash
38
+ zam search "AI tools"
39
+ ```
40
+
41
+ Filter by category:
42
+ ```bash
43
+ zam search --category "tools"
44
+ ```
45
+
46
+ List all available ZAMs (empty query):
47
+ ```bash
48
+ zam search
49
+ ```
50
+
51
+ Show input/output schemas for each result:
52
+ ```bash
53
+ zam search "weather" --show-schema
54
+ ```
55
+
56
+ Output as JSON (for programmatic parsing):
57
+ ```bash
58
+ zam search "weather" --json
59
+ ```
60
+
61
+ ### Step 2: Review Results
62
+
63
+ Results show for each ZAM or Capability:
64
+ - **Title** and **source** (ZAM or Capability)
65
+ - **ZID** (e.g. `ZP1234ABCD` or `ZG-sms-texting`) — can be passed directly to `zam activate` or `zam run`
66
+ - **Category** and **price** (per-call pricing or free)
67
+ - **Tags** and **description**
68
+
69
+ When `--show-schema` is used, results also include:
70
+ - **Run Contract** — HTTP method
71
+ - **Input Schema** — JSON Schema describing expected request body
72
+ - **Output Schema** — JSON Schema describing the response format
73
+ - **Request/Response Examples** — if available
74
+
75
+ ### Step 3: Activate or Get More Details
76
+
77
+ To activate a ZAM or Capability from search results, use its ZID or ID:
78
+ ```bash
79
+ zam activate ZP1234ABCD --request-body '{"key": "value"}'
80
+ ```
81
+
82
+ To view the full OpenAPI spec for the ZAM API:
83
+ ```bash
84
+ zam openapi
85
+ ```
86
+
87
+ ## Quick Reference
88
+
89
+ | Action | Command |
90
+ |--------|---------|
91
+ | Search by query | `zam search "query"` |
92
+ | Search by category | `zam search --category "tools"` |
93
+ | Search with schemas | `zam search "query" --show-schema` |
94
+ | Search as JSON | `zam search "query" --json` |
95
+ | List all | `zam search` |
96
+ | Search + activate | `zam run "query" --request-body '...'` |
97
+ | View API spec | `zam openapi` |