@codemation/agent-skills 0.1.3 → 0.1.5

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/CHANGELOG.md CHANGED
@@ -1,5 +1,23 @@
1
1
  # @codemation/agent-skills
2
2
 
3
+ ## 0.1.5
4
+
5
+ ### Patch Changes
6
+
7
+ - [#54](https://github.com/MadeRelevant/codemation/pull/54) [`35b78bb`](https://github.com/MadeRelevant/codemation/commit/35b78bb4d8c7ee2998a8b8e51e5ffc3fd901e4c7) Thanks [@cblokland90](https://github.com/cblokland90)! - **Breaking change:** `defineNode(...)` now follows the per-item pipeline: implement **`execute(args, context)`** (optional **`inputSchema`**, **`mapInput`**, and **`TWireJson`** on the generated runnable config). Add **`defineBatchNode(...)`** with **`run(items, context)`** for plugin nodes that still require batch **`run`** semantics.
8
+
9
+ Built-in nodes and workflow DSL (`split` / `filter` / `aggregate` on the fluent chain, Switch routing, execution normalization) align with the unified runnable model.
10
+
11
+ Align documentation (site guides, repo **`AGENTS.md`**, **`strict-oop-di`** skill, **`packages/core/docs/item-node-execution.md`**) and the **plugin** starter **`AGENTS.md`** with **config** for static wiring (credentials, retry, presentation) vs **inputs** / wire JSON for per-item behavior.
12
+
13
+ ## 0.1.4
14
+
15
+ ### Patch Changes
16
+
17
+ - [#52](https://github.com/MadeRelevant/codemation/pull/52) [`bb2b3b8`](https://github.com/MadeRelevant/codemation/commit/bb2b3b89069697c6aa36aac1de7124c5eea65c3e) Thanks [@cblokland90](https://github.com/cblokland90)! - **Breaking change:** `defineNode(...)` now follows the per-item pipeline: implement **`executeOne(args, context)`** (optional **`inputSchema`**, **`mapInput`**, and **`TWireJson`** on the generated runnable config). Add **`defineBatchNode(...)`** with **`run(items, context)`** for plugin nodes that still require legacy batch **`Node.execute`** semantics.
18
+
19
+ Align documentation (site guides, repo **`AGENTS.md`**, **`strict-oop-di`** skill, **`packages/core/docs/item-node-execution.md`**) and the **plugin** starter **`AGENTS.md`** with **config** for static wiring (credentials, retry, presentation) vs **inputs** / wire JSON for per-item behavior.
20
+
3
21
  ## 0.1.3
4
22
 
5
23
  ### Patch Changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codemation/agent-skills",
3
- "version": "0.1.3",
3
+ "version": "0.1.5",
4
4
  "description": "Reusable agent skills for Codemation projects and plugin development.",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -37,6 +37,7 @@
37
37
  "skills"
38
38
  ],
39
39
  "scripts": {
40
+ "changeset:verify": "pnpm --workspace-root run changeset:verify",
40
41
  "test": "vitest run"
41
42
  }
42
43
  }
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: codemation-custom-node-development
3
- description: Guides Codemation custom node development with `defineNode(...)`, reusable node modules, credential-aware nodes, and the class-based node fallback for advanced cases. Use when creating or updating custom nodes for apps or plugin packages.
3
+ description: Guides Codemation custom node development with `defineNode(...)` (`execute` per item), `defineBatchNode(...)` (batch `run`), reusable node modules, credential-aware nodes, and the class-based node fallback for advanced cases. Use when creating or updating custom nodes for apps or plugin packages.
4
4
  compatibility: Designed for Codemation apps and plugin packages that define reusable nodes.
5
5
  ---
6
6
 
@@ -15,16 +15,18 @@ Do not use this skill for pure workflow chaining questions unless the node imple
15
15
  ## Default approach
16
16
 
17
17
  1. Start with `defineNode(...)`.
18
- 2. Keep the runtime behavior in `run(...)`.
18
+ 2. Implement **`execute(args, context)`** one mapped **input** in, one output payload per item (activations are still batch-shaped; the engine iterates items for you).
19
19
  3. Give the node a stable key and a clear title.
20
- 4. Promote callback-heavy logic into a node when the graph or tests need a stronger boundary.
20
+ 4. Optionally set **`icon`** on the `defineNode` definition so the workflow canvas shows a proper glyph (same string contract as `NodeConfigBase.icon`).
21
+ 5. Use **`defineBatchNode(...)`** with **`run(items, context)`** only when the node must process the **entire batch** at once (legacy batch semantics).
22
+ 6. Promote callback-heavy logic into a node when the graph or tests need a stronger boundary.
21
23
 
22
24
  ## Node rules
23
25
 
24
26
  1. Prefer helper-based nodes first.
25
27
  2. Keep nodes deterministic and focused.
26
28
  3. Request credentials through named slots instead of hard-coded secrets.
27
- 4. Remember that runtime execution receives batches of items.
29
+ 4. Put **static** options (credentials, retry policy, labels) on **config**; put **per-item** behavior in **inputs** / wire JSON and optional **`itemValue`** on config fields (consistent with built-in nodes).
28
30
  5. Drop to class-based node APIs only when you need constructor-injected collaborators, decorators, or deeper runtime metadata.
29
31
 
30
32
  ## Testing with `WorkflowTestKit`
@@ -8,24 +8,31 @@ Use `defineNode(...)` when:
8
8
  - the node belongs to one app or plugin package
9
9
  - helper-based credential slots are enough
10
10
 
11
- ## Standard helper shape
11
+ ## Standard helper shape (`execute`)
12
12
 
13
13
  ```ts
14
14
  export const uppercaseNode = defineNode({
15
15
  key: "example.uppercase",
16
16
  title: "Uppercase field",
17
+ icon: "lucide:languages",
17
18
  input: {
18
19
  field: "string",
19
20
  },
20
- run(items, { config }) {
21
- return items.map((item) => ({
22
- ...item,
23
- [config.field]: String(item[config.field as keyof typeof item] ?? "").toUpperCase(),
24
- }));
21
+ execute({ input }, { config }) {
22
+ return {
23
+ ...input,
24
+ [config.field]: String(input[config.field as keyof typeof input] ?? "").toUpperCase(),
25
+ };
25
26
  },
26
27
  });
27
28
  ```
28
29
 
30
+ Optional **`icon`** is forwarded to the generated node config for the canvas (Lucide `lucide:…`, **`builtin:…`** / **`si:…`**, or image URLs). See `packages/core-nodes/src/canvasIconName.ts` and the Next host `WorkflowCanvasNodeIcon` resolver.
31
+
32
+ ## Batch helper shape (`defineBatchNode`)
33
+
34
+ When the node must see **all items in one call**, use **`defineBatchNode`** and **`run(items, { config, credentials, execution })`** returning outputs for the batch (same contract as other batch-shaped nodes such as **Aggregate**).
35
+
29
36
  ## When a custom node pays off
30
37
 
31
38
  Move from an inline callback to a custom node when:
@@ -45,6 +52,6 @@ Reach for class-based node APIs when:
45
52
 
46
53
  ## Runtime reminder
47
54
 
48
- - nodes process batches of items
49
- - keep them deterministic and testable
50
- - prefer real code paths or in-memory collaborators over heavy mocking
55
+ - **`defineNode`** runs **`execute` once per item** (with optional **`inputSchema`** and **`itemValue`** on config fields before **`execute`**)
56
+ - **`defineBatchNode`** runs **`run`** once per activation batch
57
+ - keep nodes deterministic and testable; prefer real code paths or in-memory collaborators over heavy mocking
@@ -29,7 +29,7 @@ Do not use this skill for ordinary consumer workflow-only changes unless the wor
29
29
  ## Common plugin pieces
30
30
 
31
31
  - `codemation.plugin.ts`: plugin registration and sandbox app
32
- - `src/nodes/*`: custom node definitions
32
+ - `src/nodes/*`: custom node definitions (`defineNode` → **`execute`**; `defineBatchNode` → batch **`run`**)
33
33
  - `src/credentialTypes/*`: custom credential definitions
34
34
  - `src/index.ts`: package exports
35
35
  - `test/*.test.ts` (optional): Vitest + `WorkflowTestKit` from `@codemation/core/testing` for engine-backed unit tests without starting the full host (`pnpm test`)
@@ -21,7 +21,8 @@ Use `codemation.plugin.ts` as the single place that:
21
21
 
22
22
  ## Node guidance
23
23
 
24
- - start with `defineNode(...)` for simple reusable nodes
24
+ - start with `defineNode(...)` and **`execute(...)`** for simple reusable nodes (per-item pipeline; optional **`inputSchema`** and **`itemValue`** on config fields)
25
+ - use `defineBatchNode(...)` only when the node must process the **whole activation batch** in one **`run(items, ...)`**
25
26
  - keep runtime logic close to the node definition
26
27
  - move to class-based node APIs when you need constructor-injected collaborators or deeper runtime metadata
27
28
 
@@ -17,14 +17,14 @@ Do not use this skill for CLI-only troubleshooting or deep host architecture que
17
17
  1. A workflow definition describes how items move from a trigger through downstream steps.
18
18
  2. The fluent authoring chain is the normal starting point for Codemation apps.
19
19
  3. Finish fluent workflow definitions with `.build()`.
20
- 4. Think in batches of items, not single-record callbacks.
20
+ 4. Activations are **batch-shaped** (`Items`); many steps use **per-item** execution (`execute`, including helper **`defineNode`**) with optional **`inputSchema`** and **`itemValue`** on config fields. Batch reshape steps (split/filter/aggregate, **`defineBatchNode`**) work on the whole batch.
21
21
 
22
22
  ## Authoring rules
23
23
 
24
24
  1. Prefer the fluent `workflow(...)` chain for app-local workflow files.
25
25
  2. Keep workflow files focused on orchestration and named steps.
26
26
  3. Use custom nodes when a callback grows into reusable product logic.
27
- 4. Remember that node execution receives batches of items, even when examples look single-item.
27
+ 4. Distinguish **batch activations** from **per-item node bodies**: custom nodes from **`defineNode`** implement **`execute`** per item unless you chose **`defineBatchNode`** for batch **`run`**.
28
28
 
29
29
  ## Typical flow
30
30