@calimero-network/agent-skills 0.3.0 → 0.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/README.md +137 -17
- package/SKILL.md +31 -28
- package/package.json +1 -1
- package/scripts/install.js +3 -3
- package/scripts/test.js +6 -15
- package/skills/calimero-abi-codegen/SKILL.md +121 -22
- package/skills/calimero-abi-codegen/references/abi-format.md +3 -5
- package/skills/calimero-abi-codegen/references/generated-output.md +12 -4
- package/skills/calimero-abi-codegen/rules/schema-version.md +11 -4
- package/skills/calimero-abi-codegen/rules/unique-names.md +2 -6
- package/skills/calimero-client-js/SKILL.md +126 -31
- package/skills/calimero-client-js/references/auth.md +18 -10
- package/skills/calimero-client-js/references/rpc-calls.md +15 -21
- package/skills/calimero-client-js/references/sso.md +9 -9
- package/skills/calimero-client-js/references/websocket-events.md +73 -92
- package/skills/calimero-client-js/rules/camelcase-api.md +10 -7
- package/skills/calimero-client-js/rules/token-refresh.md +11 -11
- package/skills/calimero-client-py/SKILL.md +25 -13
- package/skills/calimero-client-py/references/api.md +41 -43
- package/skills/calimero-client-py/references/auth.md +7 -7
- package/skills/calimero-client-py/rules/async-usage.md +27 -31
- package/skills/calimero-client-py/rules/stable-node-name.md +7 -7
- package/skills/calimero-core/SKILL.md +135 -0
- package/skills/calimero-core/references/architecture.md +101 -0
- package/skills/calimero-core/references/jsonrpc-protocol.md +192 -0
- package/skills/calimero-core/references/namespaces-groups.md +94 -0
- package/skills/calimero-core/references/storage-types.md +118 -0
- package/skills/calimero-core/references/websocket-events.md +142 -0
- package/skills/calimero-core/rules/context-is-not-app.md +35 -0
- package/skills/calimero-core/rules/crdt-types-only.md +55 -0
- package/skills/calimero-desktop/SKILL.md +24 -19
- package/skills/calimero-desktop/references/sso-integration.md +2 -2
- package/skills/calimero-desktop/rules/sso-fallback.md +3 -2
- package/skills/calimero-merobox/SKILL.md +255 -28
- package/skills/calimero-merobox/references/ci-integration.md +3 -2
- package/skills/calimero-merobox/references/workflow-files.md +7 -5
- package/skills/calimero-merobox/rules/docker-required.md +7 -6
- package/skills/calimero-meroctl/SKILL.md +68 -0
- package/skills/calimero-meroctl/references/commands.md +177 -0
- package/skills/calimero-meroctl/references/scripting.md +80 -0
- package/skills/calimero-meroctl/rules/call-view-flag.md +28 -0
- package/skills/calimero-meroctl/rules/register-node-once.md +34 -0
- package/skills/calimero-merod/SKILL.md +49 -0
- package/skills/calimero-merod/references/health-endpoints.md +90 -0
- package/skills/calimero-merod/references/init-flags.md +84 -0
- package/skills/calimero-merod/rules/init-before-run.md +40 -0
- package/skills/calimero-merod/rules/port-assignments.md +33 -0
- package/skills/calimero-node/SKILL.md +50 -39
- package/skills/calimero-node/references/context-lifecycle.md +34 -17
- package/skills/calimero-node/references/meroctl-commands.md +89 -99
- package/skills/calimero-node/rules/app-vs-context.md +4 -4
- package/skills/calimero-registry/SKILL.md +110 -31
- package/skills/calimero-registry/references/bundle-and-push.md +99 -34
- package/skills/calimero-registry/references/manifest-format.md +56 -35
- package/skills/calimero-registry/references/mero-sign.md +10 -9
- package/skills/calimero-registry/rules/key-security.md +3 -2
- package/skills/calimero-registry/rules/sign-before-pack.md +5 -5
- package/skills/calimero-rust-sdk/SKILL.md +154 -44
- package/skills/calimero-rust-sdk/references/blob-api.md +119 -0
- package/skills/calimero-rust-sdk/references/event-handlers.md +122 -0
- package/skills/calimero-rust-sdk/references/events.md +2 -1
- package/skills/calimero-rust-sdk/references/examples.md +81 -29
- package/skills/calimero-rust-sdk/references/migrations.md +123 -0
- package/skills/calimero-rust-sdk/references/nested-crdts.md +113 -0
- package/skills/calimero-rust-sdk/references/private-storage.md +76 -34
- package/skills/calimero-rust-sdk/references/state-collections.md +106 -21
- package/skills/calimero-rust-sdk/references/user-and-frozen-storage.md +169 -0
- package/skills/calimero-rust-sdk/rules/app-macro-placement.md +5 -2
- package/skills/calimero-rust-sdk/rules/no-std-collections.md +5 -2
- package/skills/calimero-rust-sdk/rules/state-derives.md +9 -10
- package/skills/calimero-rust-sdk/rules/wasm-constraints.md +12 -10
- package/skills/calimero-sdk-js/SKILL.md +34 -26
- package/skills/calimero-sdk-js/references/build-pipeline.md +6 -6
- package/skills/calimero-sdk-js/references/collections.md +11 -11
- package/skills/calimero-sdk-js/references/events.md +7 -3
- package/skills/calimero-sdk-js/rules/crdt-only-state.md +18 -18
- package/skills/calimero-sdk-js/rules/no-console-log.md +6 -6
- package/skills/calimero-sdk-js/rules/view-decorator.md +6 -4
package/README.md
CHANGED
|
@@ -8,16 +8,20 @@ hallucinating APIs that don't exist.
|
|
|
8
8
|
|
|
9
9
|
## Skills
|
|
10
10
|
|
|
11
|
-
| Skill
|
|
12
|
-
|
|
|
13
|
-
| [`calimero-
|
|
14
|
-
| [`calimero-
|
|
15
|
-
| [`calimero-
|
|
16
|
-
| [`calimero-
|
|
17
|
-
| [`calimero-
|
|
18
|
-
| [`calimero-
|
|
19
|
-
| [`calimero-
|
|
20
|
-
| [`calimero-
|
|
11
|
+
| Skill | When to use |
|
|
12
|
+
| ----------------------------------------------- | --------------------------------------------------------- |
|
|
13
|
+
| [`calimero-core`](#calimero-core) | Understanding the runtime model, protocol, and CRDT types |
|
|
14
|
+
| [`calimero-rust-sdk`](#calimero-rust-sdk) | Building Rust WASM applications |
|
|
15
|
+
| [`calimero-sdk-js`](#calimero-sdk-js) | Building TypeScript WASM applications |
|
|
16
|
+
| [`calimero-client-js`](#calimero-client-js) | Frontend / Node.js clients connecting to a node |
|
|
17
|
+
| [`calimero-client-py`](#calimero-client-py) | Python client for node automation and backend services |
|
|
18
|
+
| [`calimero-desktop`](#calimero-desktop) | Integrating apps with Calimero Desktop SSO |
|
|
19
|
+
| [`calimero-node`](#calimero-node) | Node operator quick-start (merod + meroctl overview) |
|
|
20
|
+
| [`calimero-merod`](#calimero-merod) | merod daemon deep-dive — init, config, health |
|
|
21
|
+
| [`calimero-meroctl`](#calimero-meroctl) | Complete meroctl CLI reference and scripting |
|
|
22
|
+
| [`calimero-merobox`](#calimero-merobox) | Local multi-node dev environments and CI |
|
|
23
|
+
| [`calimero-registry`](#calimero-registry) | Signing and publishing apps to the registry |
|
|
24
|
+
| [`calimero-abi-codegen`](#calimero-abi-codegen) | Generate TypeScript clients from WASM ABI manifests |
|
|
21
25
|
|
|
22
26
|
## Install
|
|
23
27
|
|
|
@@ -35,10 +39,10 @@ npx @calimero-network/agent-skills --list
|
|
|
35
39
|
|
|
36
40
|
### Where skill files are written
|
|
37
41
|
|
|
38
|
-
| Flag
|
|
39
|
-
|
|
|
40
|
-
| (default)
|
|
41
|
-
| `--cursor`
|
|
42
|
+
| Flag | File |
|
|
43
|
+
| ----------- | --------------------------------- |
|
|
44
|
+
| (default) | `CLAUDE.md` |
|
|
45
|
+
| `--cursor` | `.cursorrules` |
|
|
42
46
|
| `--copilot` | `.github/copilot-instructions.md` |
|
|
43
47
|
|
|
44
48
|
Running the install again updates the existing block without duplicating it.
|
|
@@ -47,11 +51,37 @@ Running the install again updates the existing block without duplicating it.
|
|
|
47
51
|
|
|
48
52
|
## Skill reference
|
|
49
53
|
|
|
54
|
+
### calimero-core
|
|
55
|
+
|
|
56
|
+
The foundational skill for **any Calimero development**. Install this alongside a language-specific
|
|
57
|
+
skill to give the AI full-stack context.
|
|
58
|
+
|
|
59
|
+
Covers:
|
|
60
|
+
|
|
61
|
+
- Context / Application / Identity mental model
|
|
62
|
+
- Full JSON-RPC protocol and endpoint list (`/api/v0/context/{id}/execute`, etc.)
|
|
63
|
+
- WebSocket event schema (`ExecutionEvent`, `StateMutation`) with decoding examples
|
|
64
|
+
- CRDT storage type taxonomy (`UnorderedMap`, `Vector`, `LwwRegister`, `Counter`, etc.)
|
|
65
|
+
- Namespace and group model for multi-node participation
|
|
66
|
+
- Authentication flow (login, refresh, JWT lifespan)
|
|
67
|
+
|
|
68
|
+
Key rules included:
|
|
69
|
+
|
|
70
|
+
- Application ≠ Context — installing an app does not create a context
|
|
71
|
+
- CRDT types only for shared state — no `std::collections`, no plain `Map`/`Array`
|
|
72
|
+
|
|
73
|
+
```bash
|
|
74
|
+
npx @calimero-network/agent-skills calimero-core
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
---
|
|
78
|
+
|
|
50
79
|
### calimero-rust-sdk
|
|
51
80
|
|
|
52
81
|
For developers building **Calimero WASM applications** in Rust.
|
|
53
82
|
|
|
54
83
|
Covers:
|
|
84
|
+
|
|
55
85
|
- App skeleton with `#[app]` macros
|
|
56
86
|
- CRDT state collections (`UnorderedMap`, `Vector`, `Set`)
|
|
57
87
|
- Event emission with `app::emit!()`
|
|
@@ -60,6 +90,7 @@ Covers:
|
|
|
60
90
|
- Reference examples (kv-store, collaborative-editor)
|
|
61
91
|
|
|
62
92
|
Key rules included:
|
|
93
|
+
|
|
63
94
|
- Never use `std::collections` for state — CRDT collections only
|
|
64
95
|
- `#[app]` macro goes on the `impl` block, not the struct
|
|
65
96
|
- No `println!` — use `env::log()`
|
|
@@ -70,17 +101,44 @@ npx @calimero-network/agent-skills calimero-rust-sdk
|
|
|
70
101
|
|
|
71
102
|
---
|
|
72
103
|
|
|
104
|
+
### calimero-sdk-js
|
|
105
|
+
|
|
106
|
+
For developers building **Calimero WASM applications in TypeScript**.
|
|
107
|
+
|
|
108
|
+
Covers:
|
|
109
|
+
|
|
110
|
+
- `@State` class with CRDT collection fields
|
|
111
|
+
- `@Logic(StateClass)` class with callable methods
|
|
112
|
+
- `@Init` static method for seeding initial state
|
|
113
|
+
- `@View()` annotation for read-only query methods
|
|
114
|
+
- `calimero-cli-js` build tool (`pnpm build`, `pnpm deploy`)
|
|
115
|
+
- WASM runtime constraints (no async in state methods, CRDT types only)
|
|
116
|
+
|
|
117
|
+
Key rules included:
|
|
118
|
+
|
|
119
|
+
- State fields must be CRDT types — do not use plain `Map`, `Set`, or arrays for persistent state
|
|
120
|
+
- `@Logic` class must extend the `@State` class
|
|
121
|
+
- `@Init` must be a `static` method returning the state class
|
|
122
|
+
|
|
123
|
+
```bash
|
|
124
|
+
npx @calimero-network/agent-skills calimero-sdk-js
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
---
|
|
128
|
+
|
|
73
129
|
### calimero-client-js
|
|
74
130
|
|
|
75
131
|
For developers building **frontends or Node.js services** that connect to a Calimero node.
|
|
76
132
|
|
|
77
133
|
Covers:
|
|
134
|
+
|
|
78
135
|
- Authentication and token storage
|
|
79
136
|
- JSON-RPC calls (mutations and views)
|
|
80
137
|
- WebSocket event subscriptions
|
|
81
138
|
- SSO token reading from URL hash
|
|
82
139
|
|
|
83
140
|
Key rules included:
|
|
141
|
+
|
|
84
142
|
- `mero-js` v2 uses camelCase (`contextId`, not `context_id`)
|
|
85
143
|
- Always handle 401 with token refresh before surfacing errors
|
|
86
144
|
|
|
@@ -95,6 +153,7 @@ npx @calimero-network/agent-skills calimero-client-js
|
|
|
95
153
|
For developers **publishing apps** to the Calimero App Registry.
|
|
96
154
|
|
|
97
155
|
Covers:
|
|
156
|
+
|
|
98
157
|
- `mero-sign` installation (crates.io and from source)
|
|
99
158
|
- Key generation and security
|
|
100
159
|
- `manifest.json` format and required fields
|
|
@@ -103,6 +162,7 @@ Covers:
|
|
|
103
162
|
- Team / org signing patterns
|
|
104
163
|
|
|
105
164
|
Key rules included:
|
|
165
|
+
|
|
106
166
|
- Sign the manifest **before** bundling — not after
|
|
107
167
|
- Never commit `key.json` to version control
|
|
108
168
|
|
|
@@ -117,11 +177,13 @@ npx @calimero-network/agent-skills calimero-registry
|
|
|
117
177
|
For developers **integrating their app frontend** with Calimero Desktop SSO.
|
|
118
178
|
|
|
119
179
|
Covers:
|
|
180
|
+
|
|
120
181
|
- Hash params passed by Desktop (`access_token`, `refresh_token`, `node_url`, `application_id`)
|
|
121
182
|
- Full startup integration pattern (React and vanilla JS)
|
|
122
183
|
- How Desktop discovers the app's frontend URL (`manifest.json` `links.frontend`)
|
|
123
184
|
|
|
124
185
|
Key rules included:
|
|
186
|
+
|
|
125
187
|
- Always fall back to manual login when hash params are absent
|
|
126
188
|
|
|
127
189
|
```bash
|
|
@@ -135,11 +197,13 @@ npx @calimero-network/agent-skills calimero-desktop
|
|
|
135
197
|
For **node operators** and developers scripting against a live node.
|
|
136
198
|
|
|
137
199
|
Covers:
|
|
200
|
+
|
|
138
201
|
- `merod` startup and configuration
|
|
139
202
|
- Full `meroctl` command reference (app, context, identity, call)
|
|
140
203
|
- Context lifecycle (app install → context create → invite → join → sync)
|
|
141
204
|
|
|
142
205
|
Key rules included:
|
|
206
|
+
|
|
143
207
|
- Application and context are different — installing an app does not create a context
|
|
144
208
|
|
|
145
209
|
```bash
|
|
@@ -148,17 +212,68 @@ npx @calimero-network/agent-skills calimero-node
|
|
|
148
212
|
|
|
149
213
|
---
|
|
150
214
|
|
|
215
|
+
### calimero-merod
|
|
216
|
+
|
|
217
|
+
For developers and operators who need deep knowledge of the **`merod` daemon** — init options,
|
|
218
|
+
configuration, health checking, and Docker deployment.
|
|
219
|
+
|
|
220
|
+
Covers:
|
|
221
|
+
|
|
222
|
+
- `merod init` — all flags, data directory layout
|
|
223
|
+
- `merod run` — startup flags and background execution
|
|
224
|
+
- Config file schema (`config.toml`) and defaults
|
|
225
|
+
- Health endpoint (`GET /health` returns `{ "status": "alive" }`)
|
|
226
|
+
- Docker and Docker Compose health check patterns
|
|
227
|
+
- Multiple nodes on one machine (port management)
|
|
228
|
+
|
|
229
|
+
Key rules included:
|
|
230
|
+
|
|
231
|
+
- Always run `merod init` before `merod run` on a new home directory
|
|
232
|
+
- Never re-init a production node — it destroys the keypair and breaks existing contexts
|
|
233
|
+
- Ports are set at init time; server-port and swarm-port have different consumers
|
|
234
|
+
|
|
235
|
+
```bash
|
|
236
|
+
npx @calimero-network/agent-skills calimero-merod
|
|
237
|
+
```
|
|
238
|
+
|
|
239
|
+
---
|
|
240
|
+
|
|
241
|
+
### calimero-meroctl
|
|
242
|
+
|
|
243
|
+
Complete **`meroctl` CLI reference** for developers and operators scripting against a running node.
|
|
244
|
+
|
|
245
|
+
Covers:
|
|
246
|
+
|
|
247
|
+
- All subcommand groups: `node`, `app`, `context`, `call`, `identity`, `namespace`, `group`
|
|
248
|
+
- Every flag for each command
|
|
249
|
+
- Scripting patterns for CI/CD pipelines
|
|
250
|
+
- Multi-node setup with namespace invite + group join-context
|
|
251
|
+
- Dev-mode hot reload (`context create --watch`)
|
|
252
|
+
|
|
253
|
+
Key rules included:
|
|
254
|
+
|
|
255
|
+
- Register a node once with `meroctl node add` + `meroctl node use`; omit `--node` after
|
|
256
|
+
- Always pass `--view` for read-only method calls
|
|
257
|
+
|
|
258
|
+
```bash
|
|
259
|
+
npx @calimero-network/agent-skills calimero-meroctl
|
|
260
|
+
```
|
|
261
|
+
|
|
262
|
+
---
|
|
263
|
+
|
|
151
264
|
### calimero-merobox
|
|
152
265
|
|
|
153
266
|
For developers setting up **local multi-node environments** or CI pipelines.
|
|
154
267
|
|
|
155
268
|
Covers:
|
|
269
|
+
|
|
156
270
|
- Merobox installation
|
|
157
271
|
- Workflow YAML format
|
|
158
272
|
- Multi-node setup with app deployment and context creation
|
|
159
273
|
- GitHub Actions integration template
|
|
160
274
|
|
|
161
275
|
Key rules included:
|
|
276
|
+
|
|
162
277
|
- Docker must be running before any merobox command
|
|
163
278
|
|
|
164
279
|
```bash
|
|
@@ -172,11 +287,13 @@ npx @calimero-network/agent-skills calimero-merobox
|
|
|
172
287
|
For developers using the **Python client** to automate or script against a Calimero node.
|
|
173
288
|
|
|
174
289
|
Covers:
|
|
290
|
+
|
|
175
291
|
- Full async API (contexts, apps, identities, blobs, aliases, proposals)
|
|
176
292
|
- Authentication and token caching (`~/.merobox/auth_cache/`)
|
|
177
293
|
- First-time token seeding and CI/CD patterns
|
|
178
294
|
|
|
179
295
|
Key rules included:
|
|
296
|
+
|
|
180
297
|
- `node_name` must be stable and unique per node — changing it loses cached tokens
|
|
181
298
|
- All client methods are async and must be awaited
|
|
182
299
|
|
|
@@ -191,6 +308,7 @@ npx @calimero-network/agent-skills calimero-client-py
|
|
|
191
308
|
For developers **generating typed TypeScript clients** from a Calimero app's ABI manifest.
|
|
192
309
|
|
|
193
310
|
Covers:
|
|
311
|
+
|
|
194
312
|
- CLI usage (`npx calimero-abi-codegen -i abi.json -o src/generated`)
|
|
195
313
|
- ABI manifest format (`wasm-abi/1` schema, types, methods, events)
|
|
196
314
|
- Generated output shape (`types.ts` + `{ClientName}.ts`)
|
|
@@ -198,6 +316,7 @@ Covers:
|
|
|
198
316
|
- Integrating codegen into your build script
|
|
199
317
|
|
|
200
318
|
Key rules included:
|
|
319
|
+
|
|
201
320
|
- ABI must have `"schema_version": "wasm-abi/1"` — other values are rejected
|
|
202
321
|
- Method, event, and type names must all be unique; map keys must be string
|
|
203
322
|
|
|
@@ -211,21 +330,22 @@ npx @calimero-network/agent-skills calimero-abi-codegen
|
|
|
211
330
|
|
|
212
331
|
Each skill follows this layout:
|
|
213
332
|
|
|
214
|
-
```
|
|
333
|
+
```text
|
|
215
334
|
skills/<skill-name>/
|
|
216
335
|
├── SKILL.md # Agent instructions: what to know, what to avoid
|
|
217
336
|
├── references/ # Detailed API guides with real code examples
|
|
218
337
|
└── rules/ # Hard rules: one file per rule, named after the rule
|
|
219
338
|
```
|
|
220
339
|
|
|
221
|
-
The install script appends skill content to your editor's context file, wrapped in
|
|
222
|
-
|
|
340
|
+
The install script appends skill content to your editor's context file, wrapped in markers so
|
|
341
|
+
re-running updates the block cleanly.
|
|
223
342
|
|
|
224
343
|
## Contributing
|
|
225
344
|
|
|
226
345
|
See [CONTRIBUTING.md](CONTRIBUTING.md) for how to add or update a skill.
|
|
227
346
|
|
|
228
347
|
Skills should be:
|
|
348
|
+
|
|
229
349
|
- Based on real API surfaces, not pseudocode
|
|
230
350
|
- Focused on code examples over prose
|
|
231
351
|
- Kept up to date with library releases
|
package/SKILL.md
CHANGED
|
@@ -4,45 +4,48 @@ This package provides AI agent skills for building on the Calimero Network stack
|
|
|
4
4
|
|
|
5
5
|
## Available Skills
|
|
6
6
|
|
|
7
|
-
| Skill
|
|
8
|
-
|
|
|
9
|
-
| `calimero-rust-sdk`
|
|
10
|
-
| `calimero-sdk-js`
|
|
11
|
-
| `calimero-client-js`
|
|
12
|
-
| `calimero-registry`
|
|
13
|
-
| `calimero-desktop`
|
|
14
|
-
| `calimero-node`
|
|
15
|
-
| `calimero-merobox`
|
|
16
|
-
| `calimero-client-py`
|
|
17
|
-
| `calimero-abi-codegen` | `npx @calimero-network/agent-skills calimero-abi-codegen` | Generate TypeScript clients from WASM ABI manifests
|
|
7
|
+
| Skill | Install command | When to use |
|
|
8
|
+
| ---------------------- | --------------------------------------------------------- | ------------------------------------------------------------------ |
|
|
9
|
+
| `calimero-rust-sdk` | `npx @calimero-network/agent-skills calimero-rust-sdk` | Building Rust WASM applications that run on a node |
|
|
10
|
+
| `calimero-sdk-js` | `npx @calimero-network/agent-skills calimero-sdk-js` | Building TypeScript/JS WASM applications that run on a node |
|
|
11
|
+
| `calimero-client-js` | `npx @calimero-network/agent-skills calimero-client-js` | Browser/Node.js frontends connecting to a node (not building apps) |
|
|
12
|
+
| `calimero-registry` | `npx @calimero-network/agent-skills calimero-registry` | Signing and publishing apps to the registry |
|
|
13
|
+
| `calimero-desktop` | `npx @calimero-network/agent-skills calimero-desktop` | Integrating apps with Calimero Desktop SSO |
|
|
14
|
+
| `calimero-node` | `npx @calimero-network/agent-skills calimero-node` | Node operators and meroctl scripting |
|
|
15
|
+
| `calimero-merobox` | `npx @calimero-network/agent-skills calimero-merobox` | Local multi-node dev environments and CI |
|
|
16
|
+
| `calimero-client-py` | `npx @calimero-network/agent-skills calimero-client-py` | Python client for node automation and backend services |
|
|
17
|
+
| `calimero-abi-codegen` | `npx @calimero-network/agent-skills calimero-abi-codegen` | Generate TypeScript clients from WASM ABI manifests |
|
|
18
18
|
|
|
19
19
|
## Auto-Detection
|
|
20
20
|
|
|
21
21
|
Skills should be loaded when the following are detected in the project:
|
|
22
22
|
|
|
23
|
-
| Signal
|
|
24
|
-
|
|
|
25
|
-
| `calimero-sdk` in `Cargo.toml`
|
|
26
|
-
| `@calimero-network/calimero-sdk-js` in `package.json`
|
|
27
|
-
| `@State` / `@Logic` decorators in TypeScript source
|
|
28
|
-
| `calimero-sdk build` in any script
|
|
29
|
-
| `@calimero-network/calimero-client` in `package.json`
|
|
30
|
-
| `@calimero-network/mero-js` in `package.json`
|
|
31
|
-
| `mero-sign` in any script or Makefile
|
|
32
|
-
| `calimero-registry` CLI usage
|
|
33
|
-
| `access_token` read from `window.location.hash`
|
|
34
|
-
| `readDesktopSSO` / `hash.get('access_token')` pattern in frontend code | `calimero-desktop`
|
|
35
|
-
| `merobox` in `package.json` or `requirements.txt`
|
|
36
|
-
| `calimero-client-py` in `requirements.txt` or `pyproject.toml`
|
|
37
|
-
| `calimero-abi-codegen` or `abi.json` in project
|
|
23
|
+
| Signal | Load skill |
|
|
24
|
+
| ---------------------------------------------------------------------- | ---------------------- |
|
|
25
|
+
| `calimero-sdk` in `Cargo.toml` | `calimero-rust-sdk` |
|
|
26
|
+
| `@calimero-network/calimero-sdk-js` in `package.json` | `calimero-sdk-js` |
|
|
27
|
+
| `@State` / `@Logic` decorators in TypeScript source | `calimero-sdk-js` |
|
|
28
|
+
| `calimero-sdk build` in any script | `calimero-sdk-js` |
|
|
29
|
+
| `@calimero-network/calimero-client` in `package.json` | `calimero-client-js` |
|
|
30
|
+
| `@calimero-network/mero-js` in `package.json` | `calimero-client-js` |
|
|
31
|
+
| `mero-sign` in any script or Makefile | `calimero-registry` |
|
|
32
|
+
| `calimero-registry` CLI usage | `calimero-registry` |
|
|
33
|
+
| `access_token` read from `window.location.hash` | `calimero-desktop` |
|
|
34
|
+
| `readDesktopSSO` / `hash.get('access_token')` pattern in frontend code | `calimero-desktop` |
|
|
35
|
+
| `merobox` in `package.json` or `requirements.txt` | `calimero-merobox` |
|
|
36
|
+
| `calimero-client-py` in `requirements.txt` or `pyproject.toml` | `calimero-client-py` |
|
|
37
|
+
| `calimero-abi-codegen` or `abi.json` in project | `calimero-abi-codegen` |
|
|
38
38
|
|
|
39
39
|
## About Calimero
|
|
40
40
|
|
|
41
|
-
Calimero is a framework for distributed, peer-to-peer applications with automatic CRDT-based data
|
|
41
|
+
Calimero is a framework for distributed, peer-to-peer applications with automatic CRDT-based data
|
|
42
|
+
synchronization, user-owned data, and verifiable off-chain computing.
|
|
42
43
|
|
|
43
44
|
Core concepts:
|
|
45
|
+
|
|
44
46
|
- **Context** — an isolated application instance with its own state, members, and storage
|
|
45
47
|
- **Application** — WASM code deployed to a node; each context runs one application
|
|
46
48
|
- **Node** (`merod`) — the runtime that hosts apps, syncs state, and exposes JSON-RPC/WebSocket
|
|
47
49
|
- **Identity** — root key → client keys per device; JWT tokens for API auth
|
|
48
|
-
- **CRDT state** — conflict-free replicated data; state lives on node storage, synced across context
|
|
50
|
+
- **CRDT state** — conflict-free replicated data; state lives on node storage, synced across context
|
|
51
|
+
members
|
package/package.json
CHANGED
package/scripts/install.js
CHANGED
|
@@ -5,9 +5,9 @@ const fs = require('fs');
|
|
|
5
5
|
const path = require('path');
|
|
6
6
|
|
|
7
7
|
const SKILLS_DIR = path.join(__dirname, '..', 'skills');
|
|
8
|
-
const VALID_SKILLS = fs
|
|
9
|
-
|
|
10
|
-
);
|
|
8
|
+
const VALID_SKILLS = fs
|
|
9
|
+
.readdirSync(SKILLS_DIR)
|
|
10
|
+
.filter((f) => fs.statSync(path.join(SKILLS_DIR, f)).isDirectory());
|
|
11
11
|
|
|
12
12
|
const TARGETS = {
|
|
13
13
|
claude: 'CLAUDE.md',
|
package/scripts/test.js
CHANGED
|
@@ -18,9 +18,9 @@ function assert(condition, message) {
|
|
|
18
18
|
}
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
-
const skills = fs
|
|
22
|
-
|
|
23
|
-
);
|
|
21
|
+
const skills = fs
|
|
22
|
+
.readdirSync(SKILLS_DIR)
|
|
23
|
+
.filter((f) => fs.statSync(path.join(SKILLS_DIR, f)).isDirectory());
|
|
24
24
|
|
|
25
25
|
console.log(`\nChecking ${skills.length} skills...\n`);
|
|
26
26
|
|
|
@@ -28,18 +28,9 @@ for (const skill of skills) {
|
|
|
28
28
|
console.log(`[${skill}]`);
|
|
29
29
|
const skillDir = path.join(SKILLS_DIR, skill);
|
|
30
30
|
|
|
31
|
-
assert(
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
);
|
|
35
|
-
assert(
|
|
36
|
-
fs.existsSync(path.join(skillDir, 'references')),
|
|
37
|
-
'references/ directory exists'
|
|
38
|
-
);
|
|
39
|
-
assert(
|
|
40
|
-
fs.existsSync(path.join(skillDir, 'rules')),
|
|
41
|
-
'rules/ directory exists'
|
|
42
|
-
);
|
|
31
|
+
assert(fs.existsSync(path.join(skillDir, 'SKILL.md')), 'SKILL.md exists');
|
|
32
|
+
assert(fs.existsSync(path.join(skillDir, 'references')), 'references/ directory exists');
|
|
33
|
+
assert(fs.existsSync(path.join(skillDir, 'rules')), 'rules/ directory exists');
|
|
43
34
|
|
|
44
35
|
const skillMd = path.join(skillDir, 'SKILL.md');
|
|
45
36
|
if (fs.existsSync(skillMd)) {
|
|
@@ -1,16 +1,18 @@
|
|
|
1
1
|
# calimero-abi-codegen — Agent Instructions
|
|
2
2
|
|
|
3
|
-
You are helping a developer use **`calimero-abi-codegen`** to generate typed TypeScript
|
|
4
|
-
|
|
3
|
+
You are helping a developer use **`calimero-abi-codegen`** to generate typed TypeScript clients from
|
|
4
|
+
a Calimero WASM application's ABI manifest.
|
|
5
5
|
|
|
6
6
|
## What it does
|
|
7
7
|
|
|
8
|
-
Takes an `abi.json` file (exported by the
|
|
9
|
-
- `types.ts` — all TypeScript type definitions matching the app's Rust types
|
|
10
|
-
- `{ClientName}.ts` — a typed client class with methods for every app function
|
|
8
|
+
Takes an `abi.json` file (exported by `calimero-wasm-abi` during the Rust build) and generates:
|
|
11
9
|
|
|
12
|
-
|
|
13
|
-
|
|
10
|
+
- TypeScript type definitions matching all Rust types (structs, enums)
|
|
11
|
+
- A typed client class with methods for every app function
|
|
12
|
+
- A `CalimeroBytes` class for handling `Vec<u8>` / byte array types
|
|
13
|
+
- An `AbiEvent` union type listing all events
|
|
14
|
+
|
|
15
|
+
Generated client imports from `@calimero-network/mero-react` by default.
|
|
14
16
|
|
|
15
17
|
## Install & run
|
|
16
18
|
|
|
@@ -25,14 +27,14 @@ calimero-abi-codegen -i abi.json -o src/generated
|
|
|
25
27
|
|
|
26
28
|
## CLI flags
|
|
27
29
|
|
|
28
|
-
| Flag
|
|
29
|
-
|
|
|
30
|
-
| `-i, --input <file>`
|
|
31
|
-
| `-o, --outDir <dir>`
|
|
32
|
-
| `--client-name <Name>` | `Client`
|
|
33
|
-
| `--name-from <path>`
|
|
34
|
-
| `--import-path <path>` | `@calimero-network/
|
|
35
|
-
| `--validate`
|
|
30
|
+
| Flag | Default | Description |
|
|
31
|
+
| ---------------------- | ------------------------------ | -------------------------------------- |
|
|
32
|
+
| `-i, --input <file>` | `abi.json` | Input ABI JSON file |
|
|
33
|
+
| `-o, --outDir <dir>` | `src` | Output directory |
|
|
34
|
+
| `--client-name <Name>` | `Client` | Class name for generated client |
|
|
35
|
+
| `--name-from <path>` | — | Derive class name from a WASM filename |
|
|
36
|
+
| `--import-path <path>` | `@calimero-network/mero-react` | Import for `MeroJs` |
|
|
37
|
+
| `--validate` | — | Validate ABI only, no code generation |
|
|
36
38
|
|
|
37
39
|
## Quick examples
|
|
38
40
|
|
|
@@ -43,19 +45,116 @@ npx calimero-abi-codegen -i abi.json -o src/generated
|
|
|
43
45
|
# Custom class name
|
|
44
46
|
npx calimero-abi-codegen -i abi.json -o src/generated --client-name KvStoreClient
|
|
45
47
|
|
|
46
|
-
# Derive
|
|
48
|
+
# Derive from WASM filename (kv_store.wasm → KvStore)
|
|
47
49
|
npx calimero-abi-codegen -i abi.json -o src/generated --name-from kv_store.wasm
|
|
48
|
-
# → generates class KvStore
|
|
49
50
|
|
|
50
|
-
# Just validate
|
|
51
|
+
# Just validate
|
|
51
52
|
npx calimero-abi-codegen --validate -i abi.json
|
|
52
53
|
```
|
|
53
54
|
|
|
54
|
-
##
|
|
55
|
+
## Generated output shape
|
|
56
|
+
|
|
57
|
+
```typescript
|
|
58
|
+
/** @generated by @calimero/abi-codegen — DO NOT EDIT. */
|
|
59
|
+
import { MeroJs } from '@calimero-network/mero-react';
|
|
60
|
+
|
|
61
|
+
// Rust structs → TS interfaces
|
|
62
|
+
export interface Post {
|
|
63
|
+
id: number;
|
|
64
|
+
title: string;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
// Rust enums → discriminated unions
|
|
68
|
+
export type StatusPayload = { name: 'Active' } | { name: 'Archived' };
|
|
69
|
+
export const Status = {
|
|
70
|
+
Active: (): StatusPayload => ({ name: 'Active' }),
|
|
71
|
+
Archived: (): StatusPayload => ({ name: 'Archived' }),
|
|
72
|
+
} as const;
|
|
73
|
+
|
|
74
|
+
// AbiEvent union (all events the app emits)
|
|
75
|
+
export type AbiEvent =
|
|
76
|
+
| { name: 'Inserted'; payload: Event_Inserted }
|
|
77
|
+
| { name: 'Removed'; payload: Event_Removed };
|
|
78
|
+
|
|
79
|
+
// The generated client class
|
|
80
|
+
export class KvClient {
|
|
81
|
+
constructor(
|
|
82
|
+
private mero: MeroJs,
|
|
83
|
+
private contextId: string,
|
|
84
|
+
private executorPublicKey: string
|
|
85
|
+
) {}
|
|
86
|
+
|
|
87
|
+
async set(params: { key: string; value: string }): Promise<void> {
|
|
88
|
+
const response = await this.mero.rpc.execute({
|
|
89
|
+
contextId: this.contextId,
|
|
90
|
+
method: 'set',
|
|
91
|
+
argsJson: params,
|
|
92
|
+
executorPublicKey: this.executorPublicKey,
|
|
93
|
+
});
|
|
94
|
+
return response as void;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
async get(params: { key: string }): Promise<string | null> {
|
|
98
|
+
const response = await this.mero.rpc.execute({
|
|
99
|
+
contextId: this.contextId,
|
|
100
|
+
method: 'get',
|
|
101
|
+
argsJson: params,
|
|
102
|
+
executorPublicKey: this.executorPublicKey,
|
|
103
|
+
});
|
|
104
|
+
return response as string | null;
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
## Using the generated client in React
|
|
110
|
+
|
|
111
|
+
```typescript
|
|
112
|
+
import { useMeroJs } from '@calimero-network/mero-react';
|
|
113
|
+
import { KvClient } from './generated/KvClient';
|
|
114
|
+
|
|
115
|
+
function MyComponent({ contextId, executorKey }) {
|
|
116
|
+
const mero = useMeroJs();
|
|
117
|
+
const client = useMemo(
|
|
118
|
+
() => new KvClient(mero, contextId, executorKey),
|
|
119
|
+
[mero, contextId, executorKey]
|
|
120
|
+
);
|
|
121
|
+
|
|
122
|
+
const handleSet = async () => {
|
|
123
|
+
await client.set({ key: 'hello', value: 'world' });
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
## CalimeroBytes
|
|
129
|
+
|
|
130
|
+
When a Rust method uses `Vec<u8>` or `[u8; N]`, the generator emits `CalimeroBytes`. The class
|
|
131
|
+
handles hex strings, number arrays, and Uint8Array transparently:
|
|
132
|
+
|
|
133
|
+
```typescript
|
|
134
|
+
// WASM returns byte arrays as number[] — convertWasmResultToCalimeroBytes handles this
|
|
135
|
+
const board = await client.getOwnBoard({ match_id: id });
|
|
136
|
+
// board.board is CalimeroBytes
|
|
137
|
+
const bytes: Uint8Array = board.board.toUint8Array();
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
## ABI schema version
|
|
141
|
+
|
|
142
|
+
The input JSON must have `"schema_version": "wasm-abi/1"`. This is produced automatically by the
|
|
143
|
+
`calimero-wasm-abi` build dependency — just add it to `build.rs`:
|
|
144
|
+
|
|
145
|
+
```rust
|
|
146
|
+
fn main() {
|
|
147
|
+
calimero_wasm_abi::export().unwrap();
|
|
148
|
+
}
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
## Related skills
|
|
55
152
|
|
|
56
|
-
|
|
153
|
+
- **`calimero-rust-sdk`** — building the WASM app that produces the `abi.json` file
|
|
154
|
+
- **`calimero-client-js`** — using the generated TypeScript client in a browser/React frontend
|
|
155
|
+
- **`calimero-core`** — JSON-RPC protocol that generated clients call underneath
|
|
57
156
|
|
|
58
157
|
## References
|
|
59
158
|
|
|
60
|
-
See `references/` for ABI format, generated output shape, and programmatic API.
|
|
61
|
-
|
|
159
|
+
See `references/` for ABI format, generated output shape, and programmatic API. See `rules/` for
|
|
160
|
+
schema version and unique name requirements.
|
|
@@ -22,7 +22,7 @@ The input `abi.json` follows the `wasm-abi/1` schema.
|
|
|
22
22
|
"Entry": {
|
|
23
23
|
"kind": "record",
|
|
24
24
|
"fields": [
|
|
25
|
-
{ "name": "key",
|
|
25
|
+
{ "name": "key", "type": { "kind": "string" } },
|
|
26
26
|
{ "name": "value", "type": { "kind": "string" } }
|
|
27
27
|
]
|
|
28
28
|
}
|
|
@@ -31,15 +31,13 @@ The input `abi.json` follows the `wasm-abi/1` schema.
|
|
|
31
31
|
{
|
|
32
32
|
"name": "set",
|
|
33
33
|
"params": [
|
|
34
|
-
{ "name": "key",
|
|
34
|
+
{ "name": "key", "type": { "kind": "string" } },
|
|
35
35
|
{ "name": "value", "type": { "kind": "string" } }
|
|
36
36
|
]
|
|
37
37
|
},
|
|
38
38
|
{
|
|
39
39
|
"name": "get",
|
|
40
|
-
"params": [
|
|
41
|
-
{ "name": "key", "type": { "kind": "string" } }
|
|
42
|
-
],
|
|
40
|
+
"params": [{ "name": "key", "type": { "kind": "string" } }],
|
|
43
41
|
"returns": { "kind": "string" },
|
|
44
42
|
"returns_nullable": true
|
|
45
43
|
},
|