@codemation/agent-skills 0.1.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/CHANGELOG.md +13 -0
- package/LICENSE +37 -0
- package/README.md +29 -0
- package/bin/codemation-agent-skills.mjs +173 -0
- package/package.json +42 -0
- package/skills/codemation-cli/SKILL.md +40 -0
- package/skills/codemation-cli/references/command-map.md +62 -0
- package/skills/codemation-credential-development/SKILL.md +36 -0
- package/skills/codemation-credential-development/references/credential-patterns.md +47 -0
- package/skills/codemation-custom-node-development/SKILL.md +32 -0
- package/skills/codemation-custom-node-development/references/node-patterns.md +50 -0
- package/skills/codemation-framework-concepts/SKILL.md +40 -0
- package/skills/codemation-framework-concepts/references/architecture-map.md +47 -0
- package/skills/codemation-plugin-development/SKILL.md +38 -0
- package/skills/codemation-plugin-development/references/plugin-structure.md +38 -0
- package/skills/codemation-workflow-dsl/SKILL.md +39 -0
- package/skills/codemation-workflow-dsl/references/builder-patterns.md +44 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# @codemation/agent-skills
|
|
2
|
+
|
|
3
|
+
## 0.1.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#24](https://github.com/MadeRelevant/codemation/pull/24) [`cf5026a`](https://github.com/MadeRelevant/codemation/commit/cf5026a7c83353bb52d67a17d0b8a9ebceb91704) Thanks [@cblokland90](https://github.com/cblokland90)! - Add a publishable Codemation agent skills package and wire the default and plugin starters to extract the shared skills after install.
|
|
8
|
+
|
|
9
|
+
## 0.0.18
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- f0c6878: Introduce Changesets, a single CI status check for branch protection, and the Codemation pre-stable license across published packages.
|
package/LICENSE
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
Codemation Pre-Stable License
|
|
2
|
+
|
|
3
|
+
Copyright (c) Made Relevant B.V. All rights reserved.
|
|
4
|
+
|
|
5
|
+
1. Definitions
|
|
6
|
+
|
|
7
|
+
"Software" means the Codemation source code, documentation, and artifacts in this repository and any published npm packages in the Codemation monorepo.
|
|
8
|
+
|
|
9
|
+
"Stable Version" means the first published release of the package `@codemation/core` on the public npm registry with version 1.0.0 or higher.
|
|
10
|
+
|
|
11
|
+
2. Permitted use (before Stable Version)
|
|
12
|
+
|
|
13
|
+
Until a Stable Version exists, you may use, copy, modify, and distribute the Software only for non-commercial purposes, including personal learning, research, evaluation, and internal use within your organization that does not charge third parties for access to the Software or a product or service whose primary value is the Software.
|
|
14
|
+
|
|
15
|
+
3. Restrictions (before Stable Version)
|
|
16
|
+
|
|
17
|
+
Until a Stable Version exists, you must not:
|
|
18
|
+
|
|
19
|
+
a) Sell, rent, lease, or sublicense the Software or a derivative work for a fee;
|
|
20
|
+
|
|
21
|
+
b) Offer the Software or a derivative work as part of a paid product or service (including hosting, support, or consulting) where the Software is a material part of the offering;
|
|
22
|
+
|
|
23
|
+
c) Use the Software or a derivative work primarily to generate revenue or commercial advantage for you or others.
|
|
24
|
+
|
|
25
|
+
These restrictions apply to all versions published before a Stable Version, even if a later Stable Version is released under different terms.
|
|
26
|
+
|
|
27
|
+
4. After Stable Version
|
|
28
|
+
|
|
29
|
+
The maintainers may publish a Stable Version under different license terms. If they do, those terms apply only to that Stable Version and subsequent releases they designate; they do not automatically apply to earlier pre-stable versions.
|
|
30
|
+
|
|
31
|
+
5. No warranty
|
|
32
|
+
|
|
33
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
34
|
+
|
|
35
|
+
6. Third-party components
|
|
36
|
+
|
|
37
|
+
The Software may include third-party components under their own licenses. Those licenses govern those components.
|
package/README.md
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# `@codemation/agent-skills`
|
|
2
|
+
|
|
3
|
+
Publishable Codemation agent skills packaged as `SKILL.md` directories.
|
|
4
|
+
|
|
5
|
+
## What this package contains
|
|
6
|
+
|
|
7
|
+
- shared Codemation skills for CLI usage, workflow authoring, plugin development, credentials, and framework concepts
|
|
8
|
+
- a small extraction CLI that copies the packaged skills into a project-local `.agents/skills` directory
|
|
9
|
+
|
|
10
|
+
## Install in a project
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
pnpm add -D @codemation/agent-skills
|
|
14
|
+
codemation-agent-skills extract --output .agents/skills/extracted
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
The starter templates call the extractor automatically after `pnpm install`.
|
|
18
|
+
|
|
19
|
+
## Published layout
|
|
20
|
+
|
|
21
|
+
```text
|
|
22
|
+
skills/
|
|
23
|
+
codemation-cli/
|
|
24
|
+
codemation-workflow-dsl/
|
|
25
|
+
codemation-custom-node-development/
|
|
26
|
+
codemation-plugin-development/
|
|
27
|
+
codemation-credential-development/
|
|
28
|
+
codemation-framework-concepts/
|
|
29
|
+
```
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
import path from "node:path";
|
|
4
|
+
import process from "node:process";
|
|
5
|
+
import { cp, mkdir, readdir, rm, stat } from "node:fs/promises";
|
|
6
|
+
import { fileURLToPath } from "node:url";
|
|
7
|
+
|
|
8
|
+
export class CommandError extends Error {}
|
|
9
|
+
|
|
10
|
+
export class FileSystemGateway {
|
|
11
|
+
async copyDirectory(sourcePath, destinationPath) {
|
|
12
|
+
await cp(sourcePath, destinationPath, { force: true, recursive: true });
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
async createDirectory(targetPath) {
|
|
16
|
+
await mkdir(targetPath, { recursive: true });
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
async listDirectoryEntries(targetPath) {
|
|
20
|
+
return readdir(targetPath, { withFileTypes: true });
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
async removePath(targetPath) {
|
|
24
|
+
await rm(targetPath, { force: true, recursive: true });
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
async statPath(targetPath) {
|
|
28
|
+
return stat(targetPath);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export class SkillExtractor {
|
|
33
|
+
constructor(fileSystem, packageRoot, cwd, stdout) {
|
|
34
|
+
this.fileSystem = fileSystem;
|
|
35
|
+
this.packageRoot = packageRoot;
|
|
36
|
+
this.cwd = cwd;
|
|
37
|
+
this.stdout = stdout;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
async extract(outputArgument) {
|
|
41
|
+
const outputPath = path.resolve(this.cwd, outputArgument);
|
|
42
|
+
const skillsRoot = path.join(this.packageRoot, "skills");
|
|
43
|
+
|
|
44
|
+
await this.fileSystem.createDirectory(outputPath);
|
|
45
|
+
const packagedEntries = await this.fileSystem.listDirectoryEntries(skillsRoot);
|
|
46
|
+
const packagedSkillNames = new Set(
|
|
47
|
+
packagedEntries.filter((entry) => entry.isDirectory()).map((entry) => entry.name),
|
|
48
|
+
);
|
|
49
|
+
|
|
50
|
+
await this.#removeStaleSkillDirectories(outputPath, packagedSkillNames);
|
|
51
|
+
|
|
52
|
+
for (const skillName of packagedSkillNames) {
|
|
53
|
+
const sourcePath = path.join(skillsRoot, skillName);
|
|
54
|
+
const destinationPath = path.join(outputPath, skillName);
|
|
55
|
+
await this.fileSystem.removePath(destinationPath);
|
|
56
|
+
await this.fileSystem.copyDirectory(sourcePath, destinationPath);
|
|
57
|
+
this.stdout.write(`[codemation-agent-skills] extracted ${skillName}\n`);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
async #removeStaleSkillDirectories(outputPath, packagedSkillNames) {
|
|
62
|
+
let existingEntries;
|
|
63
|
+
try {
|
|
64
|
+
existingEntries = await this.fileSystem.listDirectoryEntries(outputPath);
|
|
65
|
+
} catch {
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
for (const entry of existingEntries) {
|
|
70
|
+
if (!entry.isDirectory()) {
|
|
71
|
+
continue;
|
|
72
|
+
}
|
|
73
|
+
if (!entry.name.startsWith("codemation-")) {
|
|
74
|
+
continue;
|
|
75
|
+
}
|
|
76
|
+
if (packagedSkillNames.has(entry.name)) {
|
|
77
|
+
continue;
|
|
78
|
+
}
|
|
79
|
+
await this.fileSystem.removePath(path.join(outputPath, entry.name));
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
export class CommandLineParser {
|
|
85
|
+
constructor(argv) {
|
|
86
|
+
this.argv = argv;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
parse() {
|
|
90
|
+
const [command, ...rest] = this.argv;
|
|
91
|
+
if (!command || command === "--help" || command === "-h") {
|
|
92
|
+
return { command: "help" };
|
|
93
|
+
}
|
|
94
|
+
if (command !== "extract") {
|
|
95
|
+
throw new CommandError(`Unknown command "${command}".`);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
let output = ".agents/skills/extracted";
|
|
99
|
+
for (let index = 0; index < rest.length; index += 1) {
|
|
100
|
+
const argument = rest[index];
|
|
101
|
+
if (argument === "--output") {
|
|
102
|
+
const value = rest[index + 1];
|
|
103
|
+
if (!value) {
|
|
104
|
+
throw new CommandError("Missing value for --output.");
|
|
105
|
+
}
|
|
106
|
+
output = value;
|
|
107
|
+
index += 1;
|
|
108
|
+
continue;
|
|
109
|
+
}
|
|
110
|
+
if (argument === "--help" || argument === "-h") {
|
|
111
|
+
return { command: "help" };
|
|
112
|
+
}
|
|
113
|
+
throw new CommandError(`Unknown argument "${argument}".`);
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
return { command: "extract", output };
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
export class CodemationAgentSkillsCli {
|
|
121
|
+
constructor(argv, cwd, stdout, stderr) {
|
|
122
|
+
this.argv = argv;
|
|
123
|
+
this.cwd = cwd;
|
|
124
|
+
this.stdout = stdout;
|
|
125
|
+
this.stderr = stderr;
|
|
126
|
+
this.fileSystem = new FileSystemGateway();
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
async run() {
|
|
130
|
+
try {
|
|
131
|
+
const parsed = new CommandLineParser(this.argv).parse();
|
|
132
|
+
if (parsed.command === "help") {
|
|
133
|
+
this.#writeHelp();
|
|
134
|
+
return;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
const packageRoot = path.resolve(import.meta.dirname, "..");
|
|
138
|
+
const extractor = new SkillExtractor(this.fileSystem, packageRoot, this.cwd, this.stdout);
|
|
139
|
+
await extractor.extract(parsed.output);
|
|
140
|
+
} catch (error) {
|
|
141
|
+
if (error instanceof CommandError) {
|
|
142
|
+
this.stderr.write(`${error.message}\n\n`);
|
|
143
|
+
this.#writeHelp();
|
|
144
|
+
process.exitCode = 1;
|
|
145
|
+
return;
|
|
146
|
+
}
|
|
147
|
+
this.stderr.write(`${error instanceof Error ? error.message : String(error)}\n`);
|
|
148
|
+
process.exitCode = 1;
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
#writeHelp() {
|
|
153
|
+
this.stdout.write(
|
|
154
|
+
[
|
|
155
|
+
"codemation-agent-skills",
|
|
156
|
+
"",
|
|
157
|
+
"Usage:",
|
|
158
|
+
" codemation-agent-skills extract [--output <path>]",
|
|
159
|
+
"",
|
|
160
|
+
"Commands:",
|
|
161
|
+
" extract Copy packaged Codemation skills into a project directory.",
|
|
162
|
+
"",
|
|
163
|
+
"Options:",
|
|
164
|
+
" --output Destination directory. Defaults to .agents/skills/extracted.",
|
|
165
|
+
"",
|
|
166
|
+
].join("\n"),
|
|
167
|
+
);
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
if (process.argv[1] && path.resolve(process.argv[1]) === fileURLToPath(import.meta.url)) {
|
|
172
|
+
await new CodemationAgentSkillsCli(process.argv.slice(2), process.cwd(), process.stdout, process.stderr).run();
|
|
173
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@codemation/agent-skills",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Reusable agent skills for Codemation projects and plugin development.",
|
|
5
|
+
"publishConfig": {
|
|
6
|
+
"access": "public"
|
|
7
|
+
},
|
|
8
|
+
"author": "Made Relevant B.V.",
|
|
9
|
+
"homepage": "https://www.maderelevant.com",
|
|
10
|
+
"repository": {
|
|
11
|
+
"type": "git",
|
|
12
|
+
"url": "https://github.com/MadeRelevant/codemation",
|
|
13
|
+
"directory": "packages/agent-skills"
|
|
14
|
+
},
|
|
15
|
+
"license": "SEE LICENSE IN LICENSE",
|
|
16
|
+
"type": "module",
|
|
17
|
+
"bin": {
|
|
18
|
+
"codemation-agent-skills": "./bin/codemation-agent-skills.mjs"
|
|
19
|
+
},
|
|
20
|
+
"scripts": {
|
|
21
|
+
"test": "vitest run"
|
|
22
|
+
},
|
|
23
|
+
"keywords": [
|
|
24
|
+
"codemation",
|
|
25
|
+
"agent",
|
|
26
|
+
"skills",
|
|
27
|
+
"cursor",
|
|
28
|
+
"copilot"
|
|
29
|
+
],
|
|
30
|
+
"devDependencies": {
|
|
31
|
+
"@types/node": "^25.3.5",
|
|
32
|
+
"typescript": "^5.9.3",
|
|
33
|
+
"vitest": "4.0.18"
|
|
34
|
+
},
|
|
35
|
+
"files": [
|
|
36
|
+
"LICENSE",
|
|
37
|
+
"README.md",
|
|
38
|
+
"CHANGELOG.md",
|
|
39
|
+
"bin",
|
|
40
|
+
"skills"
|
|
41
|
+
]
|
|
42
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: codemation-cli
|
|
3
|
+
description: Guides Codemation CLI work for consumer apps and framework-author development. Use when the user asks about `codemation dev`, `build`, `serve web`, `serve worker`, `user create`, `user list`, `--consumer-root`, `.codemation/output`, or consumer versus framework-author mode.
|
|
4
|
+
compatibility: Designed for Codemation repositories and projects that use the Codemation CLI.
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Codemation CLI
|
|
8
|
+
|
|
9
|
+
## Use this skill when
|
|
10
|
+
|
|
11
|
+
Use this skill for command selection, local development flow, and CLI troubleshooting in a Codemation app or monorepo.
|
|
12
|
+
|
|
13
|
+
Do not use this skill for workflow graph design, custom node implementation, or credential modeling unless the CLI command flow is the main question.
|
|
14
|
+
|
|
15
|
+
## Default approach
|
|
16
|
+
|
|
17
|
+
1. Confirm whether the user is in a standalone consumer project or the Codemation monorepo.
|
|
18
|
+
2. Prefer `codemation --help` or `codemation <command> --help` before guessing flags.
|
|
19
|
+
3. Explain the shortest command path first, then mention framework-author alternatives only if they matter.
|
|
20
|
+
4. Keep the CLI thin in your mental model: it orchestrates host and runtime packages instead of owning workflow logic itself.
|
|
21
|
+
|
|
22
|
+
## Command map
|
|
23
|
+
|
|
24
|
+
- `codemation dev`: default consumer development flow with packaged UI and a stable CLI-owned dev gateway.
|
|
25
|
+
- `codemation dev --watch-framework`: framework-author mode for monorepo work and `next-host` UI HMR.
|
|
26
|
+
- `codemation build`: emits production-oriented consumer output under `.codemation/output/build`.
|
|
27
|
+
- `codemation serve web`: runs the packaged web host for a built or configured consumer app.
|
|
28
|
+
- `codemation serve worker`: starts the queue-backed worker runtime when execution is separated.
|
|
29
|
+
- `codemation user create` and `codemation user list`: local-auth bootstrap and inspection commands.
|
|
30
|
+
|
|
31
|
+
## Working rules
|
|
32
|
+
|
|
33
|
+
1. Treat `codemation.config.ts` as the consumer entrypoint.
|
|
34
|
+
2. Mention `.codemation/output` only when build artifacts or runtime bootstrap details matter.
|
|
35
|
+
3. When the user is in the monorepo, distinguish framework-author mode from normal consumer mode explicitly.
|
|
36
|
+
4. When Redis-backed execution is involved, mention the shared PostgreSQL requirement instead of assuming PGlite still fits.
|
|
37
|
+
|
|
38
|
+
## Read next when needed
|
|
39
|
+
|
|
40
|
+
- Read `references/command-map.md` for command responsibilities and development-mode guidance.
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
# Command Map
|
|
2
|
+
|
|
3
|
+
## Mental model
|
|
4
|
+
|
|
5
|
+
- `@codemation/cli` is a thin orchestration layer.
|
|
6
|
+
- It wires command objects and runtime helpers.
|
|
7
|
+
- It does not own workflow definitions, the Next UI implementation, or the engine itself.
|
|
8
|
+
|
|
9
|
+
## Pick the right mode
|
|
10
|
+
|
|
11
|
+
### Consumer mode
|
|
12
|
+
|
|
13
|
+
Use `codemation dev` for a standalone Codemation app.
|
|
14
|
+
|
|
15
|
+
- The CLI starts the packaged `@codemation/next-host` UI.
|
|
16
|
+
- The CLI owns a stable development gateway.
|
|
17
|
+
- The CLI hot-swaps the in-process API runtime when consumer files change.
|
|
18
|
+
|
|
19
|
+
### Framework-author mode
|
|
20
|
+
|
|
21
|
+
Use `codemation dev --watch-framework` when working inside the Codemation monorepo.
|
|
22
|
+
|
|
23
|
+
- The CLI starts `next dev` for `@codemation/next-host`.
|
|
24
|
+
- The CLI still owns the stable gateway and runtime swapping.
|
|
25
|
+
- This mode is for framework package work, not normal consumer usage.
|
|
26
|
+
|
|
27
|
+
## Command responsibilities
|
|
28
|
+
|
|
29
|
+
### `codemation dev`
|
|
30
|
+
|
|
31
|
+
- default local development flow
|
|
32
|
+
- best for consumer projects
|
|
33
|
+
|
|
34
|
+
### `codemation build`
|
|
35
|
+
|
|
36
|
+
- emits build output under `.codemation/output/build`
|
|
37
|
+
- use for production-oriented packaging flows
|
|
38
|
+
|
|
39
|
+
### `codemation serve web`
|
|
40
|
+
|
|
41
|
+
- runs the packaged web surface
|
|
42
|
+
- useful when validating runtime wiring outside the dev hot-swap flow
|
|
43
|
+
|
|
44
|
+
### `codemation serve worker`
|
|
45
|
+
|
|
46
|
+
- starts the queue-backed worker runtime
|
|
47
|
+
- use when web and worker processes are separated
|
|
48
|
+
|
|
49
|
+
### `codemation user create`
|
|
50
|
+
|
|
51
|
+
- creates or updates a local-auth bootstrap user
|
|
52
|
+
- requires local auth and database access
|
|
53
|
+
|
|
54
|
+
### `codemation user list`
|
|
55
|
+
|
|
56
|
+
- lists known users through the host query flow
|
|
57
|
+
|
|
58
|
+
## Environment notes
|
|
59
|
+
|
|
60
|
+
- PGlite is the zero-setup default for starter apps.
|
|
61
|
+
- When `REDIS_URL` is set, use a shared PostgreSQL `DATABASE_URL`; BullMQ cannot run on PGlite.
|
|
62
|
+
- Use `--consumer-root` when commands need to target a different consumer app root.
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: codemation-credential-development
|
|
3
|
+
description: Guides Codemation custom credential development with `defineCredential(...)`, typed sessions, credential testing, and node credential slots. Use when creating or updating custom credentials, credential registrations, or credential-aware custom nodes.
|
|
4
|
+
compatibility: Designed for Codemation apps and plugins that register typed credentials.
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Codemation Credential Development
|
|
8
|
+
|
|
9
|
+
## Use this skill when
|
|
10
|
+
|
|
11
|
+
Use this skill for defining new credential types, wiring them into apps or plugins, and teaching nodes to request typed credential sessions.
|
|
12
|
+
|
|
13
|
+
Do not use this skill for general workflow authoring unless credential slots or runtime sessions are the core problem.
|
|
14
|
+
|
|
15
|
+
## Core mental model
|
|
16
|
+
|
|
17
|
+
1. A credential type defines public config, secret material, session creation, and health testing.
|
|
18
|
+
2. Nodes request credentials through named slots instead of hard-coded secrets.
|
|
19
|
+
3. Operators configure concrete credential instances in the UI and bind them to those slots.
|
|
20
|
+
|
|
21
|
+
## Authoring rules
|
|
22
|
+
|
|
23
|
+
1. Start with `defineCredential(...)`.
|
|
24
|
+
2. Keep `public` versus `secret` fields intentional.
|
|
25
|
+
3. Make `createSession(...)` return the typed runtime object the node actually needs.
|
|
26
|
+
4. Implement `test(...)` so failure states are explicit before workflow activation.
|
|
27
|
+
5. Register credential types at the app or plugin boundary, not inside random workflow files.
|
|
28
|
+
|
|
29
|
+
## Node integration
|
|
30
|
+
|
|
31
|
+
- helper-defined nodes can declare credentials directly in `credentials`
|
|
32
|
+
- class-based nodes can use lower-level credential requirement APIs when needed
|
|
33
|
+
|
|
34
|
+
## Read next when needed
|
|
35
|
+
|
|
36
|
+
- Read `references/credential-patterns.md` for schema, registration, and slot guidance.
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
# Credential Patterns
|
|
2
|
+
|
|
3
|
+
## Standard shape
|
|
4
|
+
|
|
5
|
+
Use `defineCredential(...)` to declare:
|
|
6
|
+
|
|
7
|
+
- `key`
|
|
8
|
+
- `label`
|
|
9
|
+
- optional `description`
|
|
10
|
+
- `public` fields
|
|
11
|
+
- `secret` fields
|
|
12
|
+
- `createSession(...)`
|
|
13
|
+
- `test(...)`
|
|
14
|
+
|
|
15
|
+
## Registration
|
|
16
|
+
|
|
17
|
+
Register the credential type from the app or plugin boundary:
|
|
18
|
+
|
|
19
|
+
- `defineCodemationApp({ credentials: [...] })`
|
|
20
|
+
- `definePlugin({ credentials: [...] })`
|
|
21
|
+
|
|
22
|
+
## Node slots
|
|
23
|
+
|
|
24
|
+
Helper-defined nodes can request credentials directly:
|
|
25
|
+
|
|
26
|
+
```ts
|
|
27
|
+
credentials: {
|
|
28
|
+
myService: myServiceCredential,
|
|
29
|
+
}
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
Then the runtime can supply a typed session through the named slot.
|
|
33
|
+
|
|
34
|
+
## Health and activation
|
|
35
|
+
|
|
36
|
+
- deploy the workflow and credential type
|
|
37
|
+
- configure a concrete credential instance in the UI
|
|
38
|
+
- run the credential test until it is healthy
|
|
39
|
+
- activate the workflow only when the required slots can resolve correctly
|
|
40
|
+
|
|
41
|
+
## When to drop lower
|
|
42
|
+
|
|
43
|
+
Reach for lower-level credential APIs when:
|
|
44
|
+
|
|
45
|
+
- a class-based node already needs the explicit runtime contract
|
|
46
|
+
- you need advanced host registry behavior
|
|
47
|
+
- helper-based declarations are no longer expressive enough
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
---
|
|
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.
|
|
4
|
+
compatibility: Designed for Codemation apps and plugin packages that define reusable nodes.
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Codemation Custom Node Development
|
|
8
|
+
|
|
9
|
+
## Use this skill when
|
|
10
|
+
|
|
11
|
+
Use this skill for reusable custom node work, whether the node lives inside an app or a published plugin package.
|
|
12
|
+
|
|
13
|
+
Do not use this skill for pure workflow chaining questions unless the node implementation itself is changing.
|
|
14
|
+
|
|
15
|
+
## Default approach
|
|
16
|
+
|
|
17
|
+
1. Start with `defineNode(...)`.
|
|
18
|
+
2. Keep the runtime behavior in `run(...)`.
|
|
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.
|
|
21
|
+
|
|
22
|
+
## Node rules
|
|
23
|
+
|
|
24
|
+
1. Prefer helper-based nodes first.
|
|
25
|
+
2. Keep nodes deterministic and focused.
|
|
26
|
+
3. Request credentials through named slots instead of hard-coded secrets.
|
|
27
|
+
4. Remember that runtime execution receives batches of items.
|
|
28
|
+
5. Drop to class-based node APIs only when you need constructor-injected collaborators, decorators, or deeper runtime metadata.
|
|
29
|
+
|
|
30
|
+
## Read next when needed
|
|
31
|
+
|
|
32
|
+
- Read `references/node-patterns.md` for `defineNode(...)` patterns and packaging guidance.
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
# Node Patterns
|
|
2
|
+
|
|
3
|
+
## Start here
|
|
4
|
+
|
|
5
|
+
Use `defineNode(...)` when:
|
|
6
|
+
|
|
7
|
+
- the node logic is straightforward
|
|
8
|
+
- the node belongs to one app or plugin package
|
|
9
|
+
- helper-based credential slots are enough
|
|
10
|
+
|
|
11
|
+
## Standard helper shape
|
|
12
|
+
|
|
13
|
+
```ts
|
|
14
|
+
export const uppercaseNode = defineNode({
|
|
15
|
+
key: "example.uppercase",
|
|
16
|
+
title: "Uppercase field",
|
|
17
|
+
input: {
|
|
18
|
+
field: "string",
|
|
19
|
+
},
|
|
20
|
+
run(items, { config }) {
|
|
21
|
+
return items.map((item) => ({
|
|
22
|
+
...item,
|
|
23
|
+
[config.field]: String(item[config.field as keyof typeof item] ?? "").toUpperCase(),
|
|
24
|
+
}));
|
|
25
|
+
},
|
|
26
|
+
});
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## When a custom node pays off
|
|
30
|
+
|
|
31
|
+
Move from an inline callback to a custom node when:
|
|
32
|
+
|
|
33
|
+
- the workflow graph needs a clear reusable step
|
|
34
|
+
- the logic is shared across workflows
|
|
35
|
+
- tests need a stable module boundary
|
|
36
|
+
- credential or dependency boundaries should be explicit
|
|
37
|
+
|
|
38
|
+
## Advanced fallback
|
|
39
|
+
|
|
40
|
+
Reach for class-based node APIs when:
|
|
41
|
+
|
|
42
|
+
- constructor-injected collaborators are required
|
|
43
|
+
- plugin packaging needs the lower-level runtime contract
|
|
44
|
+
- decorators or persisted metadata need tighter control
|
|
45
|
+
|
|
46
|
+
## Runtime reminder
|
|
47
|
+
|
|
48
|
+
- nodes process batches of items
|
|
49
|
+
- keep them deterministic and testable
|
|
50
|
+
- prefer real code paths or in-memory collaborators over heavy mocking
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: codemation-framework-concepts
|
|
3
|
+
description: Explains Codemation package boundaries, runtime concepts, and the normal consumer mental model. Use when the user asks where code belongs across `@codemation/core`, `@codemation/host`, `@codemation/next-host`, `@codemation/cli`, workflows, plugins, credentials, activation, or runtime modes.
|
|
4
|
+
compatibility: Designed for Codemation apps, plugins, and framework contributors.
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Codemation Framework Concepts
|
|
8
|
+
|
|
9
|
+
## Use this skill when
|
|
10
|
+
|
|
11
|
+
Use this skill to explain package ownership, runtime shape, and the boundary between consumer code and framework code.
|
|
12
|
+
|
|
13
|
+
Do not use this skill as a substitute for detailed CLI, workflow DSL, or plugin implementation guidance when the user already knows the concept they need.
|
|
14
|
+
|
|
15
|
+
## Core map
|
|
16
|
+
|
|
17
|
+
1. `@codemation/core` owns the engine, runtime contracts, and workflow DSL foundations.
|
|
18
|
+
2. `@codemation/host` adds config loading, persistence, credentials, APIs, and scheduler wiring.
|
|
19
|
+
3. `@codemation/next-host` owns the framework UI.
|
|
20
|
+
4. `@codemation/cli` runs local development, build, serve, and user commands.
|
|
21
|
+
5. Consumer apps define `codemation.config.ts` and workflow files.
|
|
22
|
+
|
|
23
|
+
## Important concepts
|
|
24
|
+
|
|
25
|
+
- workflows define behavior
|
|
26
|
+
- triggers start runs
|
|
27
|
+
- nodes process items
|
|
28
|
+
- items carry workflow data
|
|
29
|
+
- credentials provide typed runtime resources
|
|
30
|
+
- activation is framework-managed and happens in the UI
|
|
31
|
+
|
|
32
|
+
## Runtime rule of thumb
|
|
33
|
+
|
|
34
|
+
1. Start with the minimum setup.
|
|
35
|
+
2. Move to shared PostgreSQL and Redis when execution needs separate worker infrastructure.
|
|
36
|
+
3. Keep workflow code stable while the runtime shape grows around it.
|
|
37
|
+
|
|
38
|
+
## Read next when needed
|
|
39
|
+
|
|
40
|
+
- Read `references/architecture-map.md` for package ownership and runtime-mode guidance.
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
# Architecture Map
|
|
2
|
+
|
|
3
|
+
## Main packages
|
|
4
|
+
|
|
5
|
+
- `@codemation/core`: engine, workflow DSL foundations, runtime contracts, planning, execution
|
|
6
|
+
- `@codemation/host`: config loading, persistence, credentials, scheduler wiring, API surface
|
|
7
|
+
- `@codemation/next-host`: framework-owned operator UI
|
|
8
|
+
- `@codemation/cli`: `dev`, `build`, `serve web`, `serve worker`, and user commands
|
|
9
|
+
|
|
10
|
+
## Where app code lives
|
|
11
|
+
|
|
12
|
+
In a normal Codemation app, most user code lives in:
|
|
13
|
+
|
|
14
|
+
- `codemation.config.ts`
|
|
15
|
+
- `src/workflows/**/*.ts`
|
|
16
|
+
- optional custom node modules or packages
|
|
17
|
+
- optional credential registrations
|
|
18
|
+
|
|
19
|
+
## Minimum setup
|
|
20
|
+
|
|
21
|
+
Use the minimum setup when:
|
|
22
|
+
|
|
23
|
+
- you are starting a new app
|
|
24
|
+
- one process is enough
|
|
25
|
+
- local PGlite is fine
|
|
26
|
+
- fast local iteration matters more than shared worker infrastructure
|
|
27
|
+
|
|
28
|
+
## Production setup
|
|
29
|
+
|
|
30
|
+
Move to the production shape when:
|
|
31
|
+
|
|
32
|
+
- web and worker processes should be separate
|
|
33
|
+
- workflows are long-running or bursty
|
|
34
|
+
- you need shared staging or production infrastructure
|
|
35
|
+
- queue-backed execution is a better fit than inline execution
|
|
36
|
+
|
|
37
|
+
That usually means:
|
|
38
|
+
|
|
39
|
+
- PostgreSQL instead of embedded PGlite
|
|
40
|
+
- Redis for queue-backed execution
|
|
41
|
+
- BullMQ-backed scheduling
|
|
42
|
+
|
|
43
|
+
## Activation flow
|
|
44
|
+
|
|
45
|
+
- deploy the workflow definition and any supporting plugin changes
|
|
46
|
+
- configure and test credentials in the UI
|
|
47
|
+
- activate the workflow only when the environment is ready
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: codemation-plugin-development
|
|
3
|
+
description: Guides Codemation plugin package development, including `definePlugin(...)`, plugin sandboxes, custom nodes, custom credentials, and publishable plugin package structure. Use when building or updating a Codemation plugin package or the plugin starter template.
|
|
4
|
+
compatibility: Designed for Codemation plugin packages and the Codemation plugin starter template.
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Codemation Plugin Development
|
|
8
|
+
|
|
9
|
+
## Use this skill when
|
|
10
|
+
|
|
11
|
+
Use this skill for published plugin packages, plugin starter work, and sandbox-driven plugin development.
|
|
12
|
+
|
|
13
|
+
Do not use this skill for ordinary consumer workflow-only changes unless the work needs plugin packaging or reusable extension boundaries.
|
|
14
|
+
|
|
15
|
+
## Default approach
|
|
16
|
+
|
|
17
|
+
1. Treat `codemation.plugin.ts` as the plugin composition root.
|
|
18
|
+
2. Register custom credentials and custom nodes from explicit modules.
|
|
19
|
+
3. Keep the sandbox app small and useful so plugin behavior is testable immediately.
|
|
20
|
+
4. Prefer helper-based node and credential definitions first, then drop to class-based APIs only when needed.
|
|
21
|
+
|
|
22
|
+
## Plugin rules
|
|
23
|
+
|
|
24
|
+
1. Export a plugin with `definePlugin(...)`.
|
|
25
|
+
2. Keep plugin registration separate from node and credential implementation modules.
|
|
26
|
+
3. Use the sandbox app to exercise the plugin right away.
|
|
27
|
+
4. Keep the package publishable like a normal npm package.
|
|
28
|
+
|
|
29
|
+
## Common plugin pieces
|
|
30
|
+
|
|
31
|
+
- `codemation.plugin.ts`: plugin registration and sandbox app
|
|
32
|
+
- `src/nodes/*`: custom node definitions
|
|
33
|
+
- `src/credentialTypes/*`: custom credential definitions
|
|
34
|
+
- `src/index.ts`: package exports
|
|
35
|
+
|
|
36
|
+
## Read next when needed
|
|
37
|
+
|
|
38
|
+
- Read `references/plugin-structure.md` for package layout and node-versus-credential guidance.
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
# Plugin Structure
|
|
2
|
+
|
|
3
|
+
## Minimal package shape
|
|
4
|
+
|
|
5
|
+
```text
|
|
6
|
+
codemation.plugin.ts
|
|
7
|
+
src/
|
|
8
|
+
credentialTypes/
|
|
9
|
+
nodes/
|
|
10
|
+
index.ts
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Composition root
|
|
14
|
+
|
|
15
|
+
Use `codemation.plugin.ts` as the single place that:
|
|
16
|
+
|
|
17
|
+
- calls `definePlugin(...)`
|
|
18
|
+
- registers the plugin's credentials
|
|
19
|
+
- registers the plugin's nodes
|
|
20
|
+
- defines a small sandbox app through `defineCodemationApp(...)`
|
|
21
|
+
|
|
22
|
+
## Node guidance
|
|
23
|
+
|
|
24
|
+
- start with `defineNode(...)` for simple reusable nodes
|
|
25
|
+
- keep runtime logic close to the node definition
|
|
26
|
+
- move to class-based node APIs when you need constructor-injected collaborators or deeper runtime metadata
|
|
27
|
+
|
|
28
|
+
## Credential guidance
|
|
29
|
+
|
|
30
|
+
- start with `defineCredential(...)`
|
|
31
|
+
- build typed sessions in `createSession(...)`
|
|
32
|
+
- implement `test(...)` so operators can validate configuration before activation
|
|
33
|
+
|
|
34
|
+
## Publishability
|
|
35
|
+
|
|
36
|
+
- keep the package build output and plugin entry explicit
|
|
37
|
+
- treat the plugin as a normal npm package
|
|
38
|
+
- installing the package in a Codemation app should be enough for the common auto-discovery flow
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: codemation-workflow-dsl
|
|
3
|
+
description: Guides Codemation workflow authoring with the fluent Workflow DSL. Use when creating or updating `workflow("...")` definitions, triggers, `.map(...)`, `.node(...)`, branch flow, item handling, or `.build()` chains in `src/workflows`.
|
|
4
|
+
compatibility: Designed for Codemation apps and plugins that author workflows with the fluent DSL.
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Codemation Workflow DSL
|
|
8
|
+
|
|
9
|
+
## Use this skill when
|
|
10
|
+
|
|
11
|
+
Use this skill for authoring or reviewing workflow definitions built with `workflow("...")`.
|
|
12
|
+
|
|
13
|
+
Do not use this skill for CLI-only troubleshooting or deep host architecture questions unless they directly affect workflow authoring.
|
|
14
|
+
|
|
15
|
+
## Core mental model
|
|
16
|
+
|
|
17
|
+
1. A workflow definition describes how items move from a trigger through downstream steps.
|
|
18
|
+
2. The fluent authoring chain is the normal starting point for Codemation apps.
|
|
19
|
+
3. Finish fluent workflow definitions with `.build()`.
|
|
20
|
+
4. Think in batches of items, not single-record callbacks.
|
|
21
|
+
|
|
22
|
+
## Authoring rules
|
|
23
|
+
|
|
24
|
+
1. Prefer the fluent `workflow(...)` chain for app-local workflow files.
|
|
25
|
+
2. Keep workflow files focused on orchestration and named steps.
|
|
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.
|
|
28
|
+
|
|
29
|
+
## Typical flow
|
|
30
|
+
|
|
31
|
+
1. Start with `workflow("wf.example.id")`.
|
|
32
|
+
2. Name the workflow with `.name(...)`.
|
|
33
|
+
3. Add a trigger such as `.manualTrigger(...)`.
|
|
34
|
+
4. Add transformations or nodes in execution order.
|
|
35
|
+
5. End with `.build()`.
|
|
36
|
+
|
|
37
|
+
## Read next when needed
|
|
38
|
+
|
|
39
|
+
- Read `references/builder-patterns.md` for item-flow rules and fluent authoring patterns.
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
# Builder Patterns
|
|
2
|
+
|
|
3
|
+
## Standard workflow shape
|
|
4
|
+
|
|
5
|
+
```ts
|
|
6
|
+
export default workflow("wf.example.id")
|
|
7
|
+
.name("Example")
|
|
8
|
+
.manualTrigger("Start", {
|
|
9
|
+
step: "start",
|
|
10
|
+
})
|
|
11
|
+
.map("Transform", (item) => ({
|
|
12
|
+
...item,
|
|
13
|
+
transformed: true,
|
|
14
|
+
}))
|
|
15
|
+
.build();
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## Use the fluent DSL by default
|
|
19
|
+
|
|
20
|
+
- import `workflow` from `@codemation/host`
|
|
21
|
+
- keep the file under `src/workflows`
|
|
22
|
+
- export the built workflow definition as the default export when following starter patterns
|
|
23
|
+
|
|
24
|
+
## Item rules
|
|
25
|
+
|
|
26
|
+
- workflow data flows as items
|
|
27
|
+
- items usually carry `json` data and optional `binary` data
|
|
28
|
+
- runtime nodes receive batches of items, not just one record
|
|
29
|
+
- author workflow steps with batching in mind
|
|
30
|
+
|
|
31
|
+
## When to move beyond callbacks
|
|
32
|
+
|
|
33
|
+
Promote inline callbacks into custom nodes when:
|
|
34
|
+
|
|
35
|
+
- the logic is reused across workflows
|
|
36
|
+
- the workflow graph needs clearer names
|
|
37
|
+
- credentials or collaborators need explicit boundaries
|
|
38
|
+
- the callback has become hard to test in isolation
|
|
39
|
+
|
|
40
|
+
## Relationship to the engine
|
|
41
|
+
|
|
42
|
+
- the fluent DSL is the friendly authoring surface
|
|
43
|
+
- `@codemation/core` still owns planning, execution, continuation, and runtime contracts
|
|
44
|
+
- host and node packages add the surrounding product capabilities
|