@codemation/agent-skills 0.1.1 → 0.1.4
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 +20 -0
- package/package.json +1 -1
- package/skills/codemation-custom-node-development/SKILL.md +10 -4
- package/skills/codemation-custom-node-development/references/node-patterns.md +16 -9
- package/skills/codemation-plugin-development/SKILL.md +6 -1
- package/skills/codemation-plugin-development/references/plugin-structure.md +2 -1
- package/skills/codemation-workflow-dsl/SKILL.md +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,25 @@
|
|
|
1
1
|
# @codemation/agent-skills
|
|
2
2
|
|
|
3
|
+
## 0.1.4
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#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.
|
|
8
|
+
|
|
9
|
+
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.
|
|
10
|
+
|
|
11
|
+
## 0.1.3
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- [#41](https://github.com/MadeRelevant/codemation/pull/41) [`a72444e`](https://github.com/MadeRelevant/codemation/commit/a72444e25c4e744a9a90e231a59c93f8d90346e5) Thanks [@cblokland90](https://github.com/cblokland90)! - Add `WorkflowTestKit` and related engine test harness exports on `@codemation/core/testing`, with create-codemation templates and agent skills updated to document plugin unit tests.
|
|
16
|
+
|
|
17
|
+
## 0.1.2
|
|
18
|
+
|
|
19
|
+
### Patch Changes
|
|
20
|
+
|
|
21
|
+
- [#39](https://github.com/MadeRelevant/codemation/pull/39) [`cbfe843`](https://github.com/MadeRelevant/codemation/commit/cbfe843ef2363e400a219f4d0bcd05b091ab83b4) Thanks [@cblokland90](https://github.com/cblokland90)! - Add `WorkflowTestKit` and related engine test harness exports on `@codemation/core/testing`, with create-codemation templates and agent skills updated to document plugin unit tests.
|
|
22
|
+
|
|
3
23
|
## 0.1.1
|
|
4
24
|
|
|
5
25
|
### Patch Changes
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: codemation-custom-node-development
|
|
3
|
-
description: Guides Codemation custom node development with `defineNode(...)
|
|
3
|
+
description: Guides Codemation custom node development with `defineNode(...)` (`executeOne` 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,18 +15,24 @@ 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.
|
|
18
|
+
2. Implement **`executeOne(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.
|
|
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.
|
|
29
|
+
4. Put **static** options (credentials, retry policy, labels) on **config**; put **per-item** behavior in **inputs** / wire JSON and optional **`mapInput`** (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
|
|
|
32
|
+
## Testing with `WorkflowTestKit`
|
|
33
|
+
|
|
34
|
+
For engine-backed tests without the host, use **`WorkflowTestKit`** from **`@codemation/core/testing`**: **`registerDefinedNodes([...])`**, then **`runNode`** or **`run`**. See the plugin development doc and `@codemation/core` tests for examples.
|
|
35
|
+
|
|
30
36
|
## Read next when needed
|
|
31
37
|
|
|
32
38
|
- Read `references/node-patterns.md` for `defineNode(...)` patterns and packaging guidance.
|
|
@@ -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 (`executeOne`)
|
|
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
|
-
|
|
21
|
-
return
|
|
22
|
-
...
|
|
23
|
-
[config.field]: String(
|
|
24
|
-
}
|
|
21
|
+
executeOne({ 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 **`Items`** per port (same as class-based **`Node.execute`**).
|
|
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
|
-
-
|
|
49
|
-
-
|
|
50
|
-
- prefer real code paths or in-memory collaborators over heavy mocking
|
|
55
|
+
- **`defineNode`** runs **`executeOne` once per item** (with optional **`mapInput`** / **`inputSchema`** before enqueue)
|
|
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,9 +29,14 @@ 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` → **`executeOne`**; `defineBatchNode` → batch **`run`**)
|
|
33
33
|
- `src/credentialTypes/*`: custom credential definitions
|
|
34
34
|
- `src/index.ts`: package exports
|
|
35
|
+
- `test/*.test.ts` (optional): Vitest + `WorkflowTestKit` from `@codemation/core/testing` for engine-backed unit tests without starting the full host (`pnpm test`)
|
|
36
|
+
|
|
37
|
+
## Unit tests (`WorkflowTestKit`)
|
|
38
|
+
|
|
39
|
+
Import **`WorkflowTestKit`** from **`@codemation/core/testing`**. Use **`registerDefinedNodes([...])`** for `defineNode` packages, then **`runNode({ node: yourNode.create(...), items })`** or **`run({ workflow, items })`** for fuller graphs. Prefer this for fast node tests; use **`codemation dev:plugin`** when you need the UI and persistence.
|
|
35
40
|
|
|
36
41
|
## Read next when needed
|
|
37
42
|
|
|
@@ -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 **`executeOne(...)`** for simple reusable nodes (per-item pipeline; optional **`mapInput`** / **`inputSchema`**)
|
|
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.
|
|
20
|
+
4. Activations are **batch-shaped** (`Items`); many steps use **per-item** execution (`executeOne`, including helper **`defineNode`**) with optional **`mapInput`** / **`inputSchema`**. 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.
|
|
27
|
+
4. Distinguish **batch activations** from **per-item node bodies**: custom nodes from **`defineNode`** implement **`executeOne`** per item unless you chose **`defineBatchNode`** for batch **`run`**.
|
|
28
28
|
|
|
29
29
|
## Typical flow
|
|
30
30
|
|