@eventmodelers/cli 0.0.36 → 0.0.38
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 +9 -1
- package/cli.js +286 -15
- package/package.json +1 -1
- package/stacks/blank/templates/.claude/skills/build-automation/SKILL.md +42 -0
- package/stacks/blank/templates/.claude/skills/build-state-change/SKILL.md +43 -0
- package/stacks/blank/templates/.claude/skills/build-state-view/SKILL.md +42 -0
- package/stacks/blank/templates/build-kit/CLAUDE.md +55 -0
- package/stacks/blank/templates/build-kit/lib/AGENT.md +47 -0
- package/stacks/blank/templates/build-kit/lib/backend-prompt.md +124 -0
- package/stacks/blank/templates/build-kit/lib/prompt.md +128 -0
- package/stacks/blank/templates/root/README.md +16 -0
package/README.md
CHANGED
|
@@ -16,9 +16,10 @@ npx @eventmodelers/cli init --stack supabase # Supabase
|
|
|
16
16
|
npx @eventmodelers/cli init --stack axon # Axon Framework (Java/Kotlin)
|
|
17
17
|
npx @eventmodelers/cli init --stack cratis-csharp # Cratis (.NET/C#)
|
|
18
18
|
npx @eventmodelers/cli init-modeling # skills + agent loop only, no backend scaffold
|
|
19
|
+
npx @eventmodelers/cli init --build-kit # blank build-kit scaffold for a stack not built into this CLI yet
|
|
19
20
|
```
|
|
20
21
|
|
|
21
|
-
`init-modeling` isn't a stack — it's the option for when you don't want a backend scaffolded at all, just the skills and the agent loop.
|
|
22
|
+
`init-modeling` isn't a stack — it's the option for when you don't want a backend scaffolded at all, just the skills and the agent loop. `init --build-kit` isn't one of the four either — it installs the same `.build-kit/` + skills shape as a real stack, but with TODO-marked placeholders instead of real content, for integrating a stack this CLI doesn't support yet (see "Adding a stack" below).
|
|
22
23
|
|
|
23
24
|
The installer prompts for your API token, Organization ID (and Board ID, for the four backend stacks) from [app.eventmodelers.ai/account](https://app.eventmodelers.ai/account).
|
|
24
25
|
|
|
@@ -227,6 +228,7 @@ npx @eventmodelers/cli init --stack <name> # scaffold a stack + install
|
|
|
227
228
|
npx @eventmodelers/cli init --stack <name> --global # same, but skills go to ~/.claude/skills/ (every project)
|
|
228
229
|
npx @eventmodelers/cli init-modeling # skills + agent loop only, no backend scaffold (alias: modeling)
|
|
229
230
|
npx @eventmodelers/cli init-modeling --global # same, but skills go to ~/.claude/skills/ (every project)
|
|
231
|
+
npx @eventmodelers/cli init --build-kit # blank build-kit scaffold (TODO placeholders) for a stack not built into this CLI yet
|
|
230
232
|
npx @eventmodelers/cli init-mcp # register the MCP server in .claude/settings.json (+ optionally another harness)
|
|
231
233
|
npx @eventmodelers/cli init-config # credentials only, no scaffold — writes ./.eventmodelers/config.json
|
|
232
234
|
npx @eventmodelers/cli init-config --global # same, but writes organizationId + token to ~/.eventmodelers/config.json
|
|
@@ -281,6 +283,12 @@ EVENTMODELERS_ORGANIZATION_ID=... EVENTMODELERS_BOARD_ID=... EVENTMODELERS_TOKEN
|
|
|
281
283
|
|
|
282
284
|
Each stack lives under `stacks/<name>/templates/` with `.claude/` (skills), `root/` (spread into the project root), and either `build-kit/` (backend stacks) or `kit/` (modeling-only) for the agent runner. Files identical across all backend stacks live once in `shared/build-kit/` and get layered in automatically — only put stack-specific overrides under `stacks/<name>/templates/build-kit/`. Skills with no stack-specific content (`connect`, `learn-eventmodelers-api`, `update-slice-status`) work the same way via `shared/skills/` — a new stack gets them for free without copying anything; add a skill there only once it needs a stack-specific fork.
|
|
283
285
|
|
|
286
|
+
`init --build-kit` (see above) installs exactly that layout into a real project — `.build-kit/CLAUDE.md`, `lib/prompt.md`, `lib/backend-prompt.md`, and `.claude/skills/build-{state-change,state-view,automation}/SKILL.md` — but with TODO-marked placeholders instead of real content, since there's no fixed backend to generate them from. Fill in the TODOs against the actual stack you're integrating (build/test commands, file layout, framework idioms) while building something real with it. Once it works, promote it to a first-class stack:
|
|
287
|
+
|
|
288
|
+
1. Copy `.build-kit/` → `stacks/<name>/templates/build-kit/`, `.claude/skills/build-*` → `stacks/<name>/templates/.claude/skills/`, and whatever `root/` scaffold you built → `stacks/<name>/templates/root/`.
|
|
289
|
+
2. Add an entry for `<name>` to the `STACKS` object in `cli.js` (`label`, `kitSubdir: 'build-kit'`, `kitDirName: '.build-kit'`, `useShared: true`, `needsBoardId: true`).
|
|
290
|
+
3. Add it to this README's stack list, the "What gets installed" section, and the `stacks` command's output (generated from `STACKS`, so nothing to add there beyond the entry itself).
|
|
291
|
+
|
|
284
292
|
## Contributors
|
|
285
293
|
|
|
286
294
|
| Contributor | Contribution |
|
package/cli.js
CHANGED
|
@@ -107,7 +107,24 @@ const BRIDGE_KIT = {
|
|
|
107
107
|
needsBoardId: true,
|
|
108
108
|
};
|
|
109
109
|
|
|
110
|
-
|
|
110
|
+
// Also not a stack — installed via `init --build-kit` instead of `init --stack <name>`.
|
|
111
|
+
// useShared:true, same as any real backend stack: it reuses build-kit's cold-spawn/
|
|
112
|
+
// tasks.json engine as-is (lib/ralph.js). Its templates/build-kit/CLAUDE.md,
|
|
113
|
+
// lib/{prompt,backend-prompt}.md, and templates/.claude/skills/build-*/SKILL.md are
|
|
114
|
+
// TODO-marked placeholders instead of real stack content (see stacks/blank/templates)
|
|
115
|
+
// — this is for a stack that isn't built into this CLI yet: fill in the TODOs against
|
|
116
|
+
// the real project this installs into, then optionally contribute it back as a
|
|
117
|
+
// first-class entry in STACKS (see README, "Adding a stack").
|
|
118
|
+
const BLANK_BUILD_KIT = {
|
|
119
|
+
key: 'blank',
|
|
120
|
+
label: 'Build kit — blank scaffold to fill in for a stack not built into this CLI yet',
|
|
121
|
+
kitSubdir: 'build-kit',
|
|
122
|
+
kitDirName: '.build-kit',
|
|
123
|
+
useShared: true,
|
|
124
|
+
needsBoardId: true,
|
|
125
|
+
};
|
|
126
|
+
|
|
127
|
+
const KIT_DIR_NAMES = [...new Set([...Object.values(STACKS), MODELING_KIT, BRIDGE_KIT, BLANK_BUILD_KIT].map((s) => s.kitDirName))];
|
|
111
128
|
|
|
112
129
|
// Same principle Playwright MCP uses per harness: one shared server, but each coding
|
|
113
130
|
// agent has its own registration mechanism. Automate the ones with a real, verified
|
|
@@ -264,19 +281,28 @@ function maskSecret(value) {
|
|
|
264
281
|
// scripted installs) — the first interface can read ahead and consume lines meant
|
|
265
282
|
// for later prompts, leaving the next one waiting on a stream that already ended.
|
|
266
283
|
let sharedRl = null;
|
|
284
|
+
let sharedRlLines = null;
|
|
267
285
|
function getSharedRl() {
|
|
268
286
|
if (!sharedRl) {
|
|
269
287
|
sharedRl = createInterface({ input: process.stdin, output: process.stdout });
|
|
288
|
+
sharedRlLines = sharedRl[Symbol.asyncIterator]();
|
|
270
289
|
}
|
|
271
290
|
return sharedRl;
|
|
272
291
|
}
|
|
273
292
|
|
|
274
|
-
async
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
293
|
+
// Pulls one line from the shared readline's own async iterator rather than calling
|
|
294
|
+
// its `.question()` — `.question()` attaches a one-shot 'line' listener *after* the
|
|
295
|
+
// prompt is issued, but when stdin is piped (a file, `<<<`, scripted/CI input) readline
|
|
296
|
+
// parses and emits 'line' events for an entire buffered chunk synchronously as soon as
|
|
297
|
+
// it arrives. So a second `.question()` call in the same process can miss a line that
|
|
298
|
+
// was already emitted — and dropped, no listener attached yet — before it was even
|
|
299
|
+
// called, hanging forever. Pulling from the iterator instead queues each line until
|
|
300
|
+
// something asks for it, so nothing emitted ahead of time is ever lost between prompts.
|
|
301
|
+
async function prompt(question = '') {
|
|
302
|
+
getSharedRl();
|
|
303
|
+
if (question) process.stdout.write(question);
|
|
304
|
+
const { value, done } = await sharedRlLines.next();
|
|
305
|
+
return (done ? '' : value).trim();
|
|
280
306
|
}
|
|
281
307
|
|
|
282
308
|
// Reads a pasted block of credentials, which may span one line (minified JSON,
|
|
@@ -286,7 +312,7 @@ async function prompt(question) {
|
|
|
286
312
|
async function promptPasteBlock() {
|
|
287
313
|
const lines = [];
|
|
288
314
|
while (lines.length < 20) {
|
|
289
|
-
const line = await
|
|
315
|
+
const line = await prompt();
|
|
290
316
|
if (line.trim() === '') {
|
|
291
317
|
if (lines.length > 0) break;
|
|
292
318
|
continue;
|
|
@@ -793,6 +819,28 @@ async function installStack(stackKey, stackCfg, options = {}) {
|
|
|
793
819
|
|
|
794
820
|
// --- 3. Create the kit dir and install the agent runner ---
|
|
795
821
|
const kitDir = join(targetDir, stackCfg.kitDirName);
|
|
822
|
+
|
|
823
|
+
// A non-empty kit dir here almost always means a previous install someone has
|
|
824
|
+
// since customized (e.g. filled in a `--build-kit` scaffold's TODOs, or hand-edited
|
|
825
|
+
// CLAUDE.md/AGENT.md) — the copy below overwrites same-named files unconditionally,
|
|
826
|
+
// so ask before silently clobbering that work. --print and --force both imply an
|
|
827
|
+
// explicit, non-interactive "yes" (mirrors how --force already means "overwrite
|
|
828
|
+
// without re-asking" for credentials).
|
|
829
|
+
if (existsSync(kitDir) && readdirSync(kitDir).length > 0 && !options.print && !options.force) {
|
|
830
|
+
const choice = await selectPrompt(
|
|
831
|
+
`${stackCfg.kitDirName} is not empty. Should we continue?`,
|
|
832
|
+
[
|
|
833
|
+
{ label: 'No — cancel', value: 'no' },
|
|
834
|
+
{ label: 'Yes — continue (files with matching names will be overwritten)', value: 'yes' },
|
|
835
|
+
],
|
|
836
|
+
0,
|
|
837
|
+
);
|
|
838
|
+
if (choice === 'no') {
|
|
839
|
+
console.log('\n❌ Cancelled — nothing was installed.');
|
|
840
|
+
process.exit(1);
|
|
841
|
+
}
|
|
842
|
+
}
|
|
843
|
+
|
|
796
844
|
mkdirSync(kitDir, { recursive: true });
|
|
797
845
|
console.log(`📦 Installing agent kit into ${stackCfg.kitDirName}/...`);
|
|
798
846
|
|
|
@@ -1313,7 +1361,11 @@ program
|
|
|
1313
1361
|
// cleanup commands that are meant to work — and report something useful — whether
|
|
1314
1362
|
// or not a kit is present, and fetch only needs credentials plus somewhere to write
|
|
1315
1363
|
// .slices/ (cwd, absent a kit dir — see lib/fetch.js), no kit-specific files.
|
|
1316
|
-
|
|
1364
|
+
// activate-context/set-slice-status are the same story minus even the credentials — they
|
|
1365
|
+
// only ever read/write an already-fetched .slices/, and report their own hint (run `fetch`
|
|
1366
|
+
// first) when that's missing. set-slice-status only touches credentials at all for --remote,
|
|
1367
|
+
// which prompts for them itself the same way fetch does.
|
|
1368
|
+
const NO_INIT_REQUIRED = new Set(['init', 'init-config', 'stacks', 'status', 'config', 'uninstall', 'fetch', 'activate-context', 'set-slice-status']);
|
|
1317
1369
|
|
|
1318
1370
|
program.hook('preAction', (_thisCommand, actionCommand) => {
|
|
1319
1371
|
if (NO_INIT_REQUIRED.has(actionCommand.name())) return;
|
|
@@ -1346,22 +1398,24 @@ function credentialOverridesFromOpts(opts) {
|
|
|
1346
1398
|
credentialFlags(program
|
|
1347
1399
|
.command('init')
|
|
1348
1400
|
.alias('install')
|
|
1349
|
-
.description('Scaffold a stack + install the agent kit into the current directory (or --modeling for skills + agent loop only, no backend scaffold; or --bridge to translate board slices into another spec framework; or --git to install a community/custom build kit from a git repo)')
|
|
1401
|
+
.description('Scaffold a stack + install the agent kit into the current directory (or --modeling for skills + agent loop only, no backend scaffold; or --bridge to translate board slices into another spec framework; or --build-kit for a blank build-kit scaffold to fill in for a stack not built into this CLI yet; or --git to install a community/custom build kit from a git repo)')
|
|
1350
1402
|
.option('--stack <name>', `Stack to install (${Object.keys(STACKS).join(', ')}), or a name of your choosing when combined with --git`)
|
|
1351
1403
|
.option('--git <url>', 'Install a build kit not built into this CLI by cloning this git repo (used with --stack <name> to name it) — the repo must mirror the templates/.claude, templates/root, templates/<kitSubdir> layout of this CLI\'s own stacks/<name>/templates, optionally with a stack.json declaring label/kitSubdir/useShared/needsBoardId')
|
|
1352
1404
|
.option('--branch <name>', 'Branch to clone — only meaningful with --git (defaults to the repo\'s default branch)')
|
|
1353
|
-
.option('--modeling', 'Install skills + the agent loop only — no backend scaffold. Mutually exclusive with --stack/--bridge.')
|
|
1354
|
-
.option('--bridge', 'Install a bridge kit — translates board slices into another spec framework instead of building code. Mutually exclusive with --stack/--modeling. Requires --target.')
|
|
1405
|
+
.option('--modeling', 'Install skills + the agent loop only — no backend scaffold. Mutually exclusive with --stack/--bridge/--build-kit.')
|
|
1406
|
+
.option('--bridge', 'Install a bridge kit — translates board slices into another spec framework instead of building code. Mutually exclusive with --stack/--modeling/--build-kit. Requires --target.')
|
|
1355
1407
|
.option('--target <name>', `Bridge target framework (${Object.keys(BRIDGE_TARGETS).join(', ')}) — only meaningful with --bridge`)
|
|
1356
1408
|
.option('--hook <command>', 'Persist a default shell command hook for `bridge` to run per batch of slice changes instead of Claude/Ollama (e.g. commit + push .slices/ for a CI pipeline to pick up) — only meaningful with --bridge. Can also be set per-run with `bridge --hook`.')
|
|
1409
|
+
.option('--build-kit', 'Install a blank build-kit scaffold (.build-kit/ + .claude/skills/build-*/SKILL.md placeholders, all TODO-marked) for a stack not built into this CLI yet — no fixed backend. Mutually exclusive with --stack/--modeling/--bridge.')
|
|
1357
1410
|
.option('--global', 'Install skills into ~/.claude/skills/ instead of the project — available in every project')
|
|
1358
1411
|
.option('-f, --force', 'Re-prompt for credentials even if a config already has everything required — overwrites the existing config.json'))
|
|
1359
1412
|
.action(async (opts, command) => {
|
|
1360
1413
|
const globalOpts = command.optsWithGlobals();
|
|
1361
1414
|
|
|
1362
|
-
if (opts.modeling || opts.bridge) {
|
|
1363
|
-
|
|
1364
|
-
|
|
1415
|
+
if (opts.modeling || opts.bridge || opts.buildKit) {
|
|
1416
|
+
const modeCount = [opts.modeling, opts.bridge, opts.buildKit].filter(Boolean).length;
|
|
1417
|
+
if (opts.stack || opts.git || modeCount > 1) {
|
|
1418
|
+
console.error('❌ --stack/--git, --modeling, --bridge, and --build-kit are mutually exclusive — pick one.');
|
|
1365
1419
|
process.exit(1);
|
|
1366
1420
|
}
|
|
1367
1421
|
}
|
|
@@ -1377,6 +1431,17 @@ credentialFlags(program
|
|
|
1377
1431
|
return;
|
|
1378
1432
|
}
|
|
1379
1433
|
|
|
1434
|
+
if (opts.buildKit) {
|
|
1435
|
+
await installStack(BLANK_BUILD_KIT.key, BLANK_BUILD_KIT, {
|
|
1436
|
+
configPath: globalOpts.config,
|
|
1437
|
+
print: globalOpts.print,
|
|
1438
|
+
global: opts.global,
|
|
1439
|
+
force: opts.force,
|
|
1440
|
+
credentialOverrides: credentialOverridesFromOpts(opts),
|
|
1441
|
+
});
|
|
1442
|
+
return;
|
|
1443
|
+
}
|
|
1444
|
+
|
|
1380
1445
|
if (opts.bridge) {
|
|
1381
1446
|
if (!opts.target) {
|
|
1382
1447
|
console.error(`❌ --bridge requires --target (${Object.keys(BRIDGE_TARGETS).join(', ')}).`);
|
|
@@ -1766,6 +1831,212 @@ program
|
|
|
1766
1831
|
}
|
|
1767
1832
|
});
|
|
1768
1833
|
|
|
1834
|
+
program
|
|
1835
|
+
.command('activate-context')
|
|
1836
|
+
.description('Choose which fetched context is active — writes .slices/current_context.json, which `run`/bridge/listen treat as sticky and never cross out of on their own')
|
|
1837
|
+
.action(async () => {
|
|
1838
|
+
const cwd = process.cwd();
|
|
1839
|
+
const kitDir = findInstalledKitDir(cwd);
|
|
1840
|
+
// Same modeling-kit exception `fetch` applies — see its action for why.
|
|
1841
|
+
const slicesKitDir = kitDir?.endsWith(MODELING_KIT.kitDirName) ? null : kitDir;
|
|
1842
|
+
const SLICES_DIR = join(slicesKitDir || cwd, '.slices');
|
|
1843
|
+
const hint = ' Run `eventmodelers fetch --context <name>` first to pull a context from the board.';
|
|
1844
|
+
|
|
1845
|
+
// A context is any .slices/ subdirectory fetch/listen wrote an index.json into —
|
|
1846
|
+
// that's the file both of them use as proof a context's slices actually landed.
|
|
1847
|
+
const contextDirs = existsSync(SLICES_DIR)
|
|
1848
|
+
? readdirSync(SLICES_DIR, { withFileTypes: true })
|
|
1849
|
+
.filter((e) => e.isDirectory() && existsSync(join(SLICES_DIR, e.name, 'index.json')))
|
|
1850
|
+
.map((e) => e.name)
|
|
1851
|
+
: [];
|
|
1852
|
+
|
|
1853
|
+
if (!contextDirs.length) {
|
|
1854
|
+
console.error(`❌ No contexts found in ${relative(cwd, SLICES_DIR)}/.`);
|
|
1855
|
+
console.error(hint);
|
|
1856
|
+
process.exit(1);
|
|
1857
|
+
}
|
|
1858
|
+
|
|
1859
|
+
const currentCtx = readJsonSafe(join(SLICES_DIR, 'current_context.json')).name;
|
|
1860
|
+
|
|
1861
|
+
// context.json's `name` is the human-readable display name; the directory itself
|
|
1862
|
+
// (contextSlug) is what current_context.json must store, since readCurrentContext
|
|
1863
|
+
// (shared/build-kit/lib/ralph.js) joins it straight onto `.slices/<name>/index.json`.
|
|
1864
|
+
const choices = contextDirs.map((dirName) => ({
|
|
1865
|
+
label: readJsonSafe(join(SLICES_DIR, dirName, 'context.json')).name || dirName,
|
|
1866
|
+
value: dirName,
|
|
1867
|
+
}));
|
|
1868
|
+
const defaultIndex = Math.max(0, contextDirs.indexOf(currentCtx));
|
|
1869
|
+
|
|
1870
|
+
const selected = await selectPrompt(
|
|
1871
|
+
`Which context should be active?${currentCtx ? ` (currently: ${choices[defaultIndex].label})` : ''}`,
|
|
1872
|
+
choices,
|
|
1873
|
+
defaultIndex,
|
|
1874
|
+
);
|
|
1875
|
+
|
|
1876
|
+
writeFileSync(join(SLICES_DIR, 'current_context.json'), JSON.stringify({ name: selected }, null, 2));
|
|
1877
|
+
const selectedLabel = choices.find((c) => c.value === selected)?.label || selected;
|
|
1878
|
+
console.log(`✅ Active context set to "${selectedLabel}" → ${relative(cwd, join(SLICES_DIR, 'current_context.json'))}`);
|
|
1879
|
+
});
|
|
1880
|
+
|
|
1881
|
+
// Order/icons/default mirror the board UI's own slice-status picker.
|
|
1882
|
+
const SLICE_STATUSES = [
|
|
1883
|
+
{ label: '🌱 Created (default)', value: 'Created' },
|
|
1884
|
+
{ label: '✅ Done', value: 'Done' },
|
|
1885
|
+
{ label: '👤 Assigned', value: 'Assigned' },
|
|
1886
|
+
{ label: '🔄 InProgress', value: 'InProgress' },
|
|
1887
|
+
{ label: '🔍 Review', value: 'Review' },
|
|
1888
|
+
{ label: '🚫 Blocked', value: 'Blocked' },
|
|
1889
|
+
{ label: '📅 Planned', value: 'Planned' },
|
|
1890
|
+
{ label: 'ℹ️ Informational', value: 'Informational' },
|
|
1891
|
+
];
|
|
1892
|
+
|
|
1893
|
+
program
|
|
1894
|
+
.command('set-slice-status')
|
|
1895
|
+
.description('Pick a slice from the active context and change its status — updates .slices/ locally, and the board itself with --remote')
|
|
1896
|
+
.option('--remote', 'Also push the change to the board via the nodes/events API (same effect `update-slice-status` has, see shared/skills/update-slice-status)')
|
|
1897
|
+
.action(async (opts, command) => {
|
|
1898
|
+
const cwd = process.cwd();
|
|
1899
|
+
const kitDir = findInstalledKitDir(cwd);
|
|
1900
|
+
// Same modeling-kit exception `fetch`/`activate-context` apply — see fetch's action for why.
|
|
1901
|
+
const slicesKitDir = kitDir?.endsWith(MODELING_KIT.kitDirName) ? null : kitDir;
|
|
1902
|
+
const SLICES_DIR = join(slicesKitDir || cwd, '.slices');
|
|
1903
|
+
const fetchHint = ' Run `eventmodelers fetch --context <name>` first to pull a context from the board.';
|
|
1904
|
+
|
|
1905
|
+
const currentCtx = readJsonSafe(join(SLICES_DIR, 'current_context.json')).name;
|
|
1906
|
+
if (!currentCtx) {
|
|
1907
|
+
console.error('❌ No active context set.');
|
|
1908
|
+
console.error(existsSync(SLICES_DIR) ? ' Run `eventmodelers activate-context` to pick one.' : fetchHint);
|
|
1909
|
+
process.exit(1);
|
|
1910
|
+
}
|
|
1911
|
+
|
|
1912
|
+
const contextDir = join(SLICES_DIR, currentCtx);
|
|
1913
|
+
const indexPath = join(contextDir, 'index.json');
|
|
1914
|
+
const indexData = readJsonSafe(indexPath);
|
|
1915
|
+
const slices = Array.isArray(indexData.slices) ? indexData.slices : [];
|
|
1916
|
+
if (!slices.length) {
|
|
1917
|
+
console.error(`❌ No slices found for context "${currentCtx}".`);
|
|
1918
|
+
console.error(fetchHint);
|
|
1919
|
+
process.exit(1);
|
|
1920
|
+
}
|
|
1921
|
+
|
|
1922
|
+
const sliceChoices = slices.map((s) => ({ label: `${s.slice || s.id} [${s.status || 'Created'}]`, value: s.id }));
|
|
1923
|
+
const sliceId = await selectPrompt(`Which slice in "${currentCtx}" should change status?`, sliceChoices, 0);
|
|
1924
|
+
const slice = slices.find((s) => s.id === sliceId);
|
|
1925
|
+
|
|
1926
|
+
const statusDefault = Math.max(0, SLICE_STATUSES.findIndex((s) => s.value === (slice.status || 'Created')));
|
|
1927
|
+
const newStatus = await selectPrompt(`New status for "${slice.slice}"? (currently: ${slice.status || 'Created'})`, SLICE_STATUSES, statusDefault);
|
|
1928
|
+
|
|
1929
|
+
if (newStatus === (slice.status || 'Created')) {
|
|
1930
|
+
console.log(`ℹ️ "${slice.slice}" is already ${newStatus} — nothing to change.`);
|
|
1931
|
+
return;
|
|
1932
|
+
}
|
|
1933
|
+
|
|
1934
|
+
// index.json's `definition` is a full copy of the slice (see lib/fetch.js's entry
|
|
1935
|
+
// shape) — keep both copies of `status` in sync so anything reading either stays correct.
|
|
1936
|
+
const previousStatus = slice.status || 'Created';
|
|
1937
|
+
slice.status = newStatus;
|
|
1938
|
+
if (slice.definition) slice.definition.status = newStatus;
|
|
1939
|
+
writeFileSync(indexPath, JSON.stringify(indexData, null, 2));
|
|
1940
|
+
|
|
1941
|
+
if (slice.folder) {
|
|
1942
|
+
const sliceJsonPath = join(contextDir, slice.folder, 'slice.json');
|
|
1943
|
+
if (existsSync(sliceJsonPath)) {
|
|
1944
|
+
const sliceData = readJsonSafe(sliceJsonPath);
|
|
1945
|
+
sliceData.status = newStatus;
|
|
1946
|
+
writeFileSync(sliceJsonPath, JSON.stringify(sliceData, null, 2));
|
|
1947
|
+
}
|
|
1948
|
+
}
|
|
1949
|
+
|
|
1950
|
+
console.log(`✅ "${slice.slice}": ${previousStatus} → ${newStatus} (${relative(cwd, indexPath)})`);
|
|
1951
|
+
|
|
1952
|
+
if (!opts.remote) return;
|
|
1953
|
+
|
|
1954
|
+
// slice.id is the SLICE_BORDER node ID (see shared/skills/update-slice-status/SKILL.md
|
|
1955
|
+
// Step 2) — the same id the board's own nodes/events API expects as nodeId below.
|
|
1956
|
+
const globalOpts = command.optsWithGlobals();
|
|
1957
|
+
const explicitConfig = globalOpts.config;
|
|
1958
|
+
const configPath = explicitConfig ? resolve(cwd, explicitConfig) : join(cwd, '.eventmodelers', 'config.json');
|
|
1959
|
+
const requiredFields = ['organizationId', 'boardId', 'token'];
|
|
1960
|
+
let { config: cfg } = loadEffectiveConfig(cwd, kitDir, explicitConfig);
|
|
1961
|
+
|
|
1962
|
+
async function promptForCredentials() {
|
|
1963
|
+
cfg = await configureCredentials({
|
|
1964
|
+
config: cfg,
|
|
1965
|
+
configPath,
|
|
1966
|
+
targetDir: cwd,
|
|
1967
|
+
requiredFields,
|
|
1968
|
+
boardIdOptional: false,
|
|
1969
|
+
overrides: {},
|
|
1970
|
+
print: globalOpts.print,
|
|
1971
|
+
});
|
|
1972
|
+
if (requiredFields.some((f) => !cfg[f])) {
|
|
1973
|
+
console.error('❌ Still missing token/organizationId/boardId — re-run with --remote once configured.');
|
|
1974
|
+
process.exit(1);
|
|
1975
|
+
}
|
|
1976
|
+
}
|
|
1977
|
+
if (requiredFields.some((f) => !cfg[f])) await promptForCredentials();
|
|
1978
|
+
|
|
1979
|
+
const baseUrl = cfg.baseUrl || DEFAULT_BASE_URL;
|
|
1980
|
+
async function pushRemote() {
|
|
1981
|
+
return fetch(`${baseUrl}/api/org/${cfg.organizationId}/boards/${cfg.boardId}/nodes/events`, {
|
|
1982
|
+
method: 'POST',
|
|
1983
|
+
headers: {
|
|
1984
|
+
'Content-Type': 'application/json',
|
|
1985
|
+
'x-token': cfg.token,
|
|
1986
|
+
'x-board-id': cfg.boardId,
|
|
1987
|
+
'x-user-id': 'cli-set-slice-status',
|
|
1988
|
+
},
|
|
1989
|
+
body: JSON.stringify([{
|
|
1990
|
+
id: randomUUID(),
|
|
1991
|
+
eventType: 'node:changed',
|
|
1992
|
+
nodeId: slice.id,
|
|
1993
|
+
boardId: cfg.boardId,
|
|
1994
|
+
timestamp: Date.now(),
|
|
1995
|
+
changedAttributes: ['sliceStatus'],
|
|
1996
|
+
meta: { sliceStatus: newStatus },
|
|
1997
|
+
}]),
|
|
1998
|
+
});
|
|
1999
|
+
}
|
|
2000
|
+
|
|
2001
|
+
let res;
|
|
2002
|
+
try {
|
|
2003
|
+
res = await pushRemote();
|
|
2004
|
+
} catch (err) {
|
|
2005
|
+
console.error(`❌ Remote update failed: ${err.message}`);
|
|
2006
|
+
process.exit(1);
|
|
2007
|
+
}
|
|
2008
|
+
|
|
2009
|
+
// Same 401/403 reconfigure-and-retry dance `fetch` does — present-but-wrong
|
|
2010
|
+
// credentials, not missing ones, so clear whichever field is implicated and retry once.
|
|
2011
|
+
if (res.status === 401 || res.status === 403) {
|
|
2012
|
+
console.error(`❌ Remote update: ${res.status === 401 ? 'invalid or expired token' : "token's organization does not match this board"}.`);
|
|
2013
|
+
if (res.status === 403) delete cfg.boardId; else delete cfg.token;
|
|
2014
|
+
await promptForCredentials();
|
|
2015
|
+
try {
|
|
2016
|
+
res = await pushRemote();
|
|
2017
|
+
} catch (err) {
|
|
2018
|
+
console.error(`❌ Remote update failed: ${err.message}`);
|
|
2019
|
+
process.exit(1);
|
|
2020
|
+
}
|
|
2021
|
+
}
|
|
2022
|
+
|
|
2023
|
+
if (!res.ok) {
|
|
2024
|
+
const body = await res.json().catch(() => null);
|
|
2025
|
+
const msg = body?.error || `HTTP ${res.status}`;
|
|
2026
|
+
// The API refuses to move a slice into a status it's already in (a concurrency
|
|
2027
|
+
// guard so two agents/users can't both claim it) — not a real failure, just means
|
|
2028
|
+
// the board had already moved on since the last fetch.
|
|
2029
|
+
if (/already/i.test(msg)) {
|
|
2030
|
+
console.log(`ℹ️ Board already has "${slice.slice}" at ${newStatus} — no remote change needed.`);
|
|
2031
|
+
return;
|
|
2032
|
+
}
|
|
2033
|
+
console.error(`❌ Remote update failed: ${msg}`);
|
|
2034
|
+
process.exit(1);
|
|
2035
|
+
}
|
|
2036
|
+
|
|
2037
|
+
console.log(`✅ Pushed status change to the board (node ${slice.id}).`);
|
|
2038
|
+
});
|
|
2039
|
+
|
|
1769
2040
|
program
|
|
1770
2041
|
.command('stacks')
|
|
1771
2042
|
.description('List available stacks (for `init --stack`)')
|
package/package.json
CHANGED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: build-automation
|
|
3
|
+
description: TODO — one-line description of how a reactive slice (a processor/reactor that reacts to events and issues new commands) is implemented for your stack (see an existing stack's build-automation/SKILL.md under stacks/<name>/templates/.claude/skills/ for the level of detail expected)
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Build Automation Slice
|
|
7
|
+
|
|
8
|
+
> **TODO — placeholder installed by `init --build-kit`.** Study an existing stack's
|
|
9
|
+
> build-automation/SKILL.md (stacks/node, stacks/supabase, stacks/axon, or stacks/cratis-csharp,
|
|
10
|
+
> under `templates/.claude/skills/`) for the level of detail expected, then rewrite
|
|
11
|
+
> every section below for your stack's real conventions — file layout, naming, and
|
|
12
|
+
> the actual framework/language idioms. Delete this callout once done.
|
|
13
|
+
|
|
14
|
+
> Before doing anything else, read the slice definition from `.slices/{Context}/{slicename}/slice.json`.
|
|
15
|
+
> This file is the **source of truth** for all fields, events, and metadata — never invent
|
|
16
|
+
> fields not defined there. Keep this line verbatim; it applies to every stack.
|
|
17
|
+
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
## What an Automation Slice is
|
|
21
|
+
|
|
22
|
+
TODO — describe a reactive slice (a processor/reactor that reacts to events and issues new commands) in terms of your stack's own primitives.
|
|
23
|
+
|
|
24
|
+
## Step 1 — Read the slice.json
|
|
25
|
+
|
|
26
|
+
From the slice definition, extract:
|
|
27
|
+
- **sliceName** — the slice title
|
|
28
|
+
- **context** — the bounded context
|
|
29
|
+
- **processors[]** — the reactions this slice implements
|
|
30
|
+
- **specifications[]** — test scenarios (given/when/then)
|
|
31
|
+
|
|
32
|
+
> **Comments & description**: each element carries a `comments: string[]` array (board comments) and a `description` field — use them as implementation hints, and resolve consumed comments via `POST <BASE_URL>/api/org/<ORG_ID>/boards/<BOARD_ID>/nodes/<nodeId>/comments/<commentId>/resolve`.
|
|
33
|
+
|
|
34
|
+
---
|
|
35
|
+
|
|
36
|
+
## Step 2 — TODO (your stack-specific implementation steps)
|
|
37
|
+
|
|
38
|
+
TODO — file layout, naming conventions, framework idioms, how the handler/projection/reactor is wired up.
|
|
39
|
+
|
|
40
|
+
## Quality gate
|
|
41
|
+
|
|
42
|
+
TODO — this stack's build command and how to run only this slice's tests (not the full suite).
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: build-state-change
|
|
3
|
+
description: TODO — one-line description of how a write-side slice (command validated against replayed events, new events emitted) is implemented for your stack (see an existing stack's build-state-change/SKILL.md under stacks/<name>/templates/.claude/skills/ for the level of detail expected)
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Build State Change Slice
|
|
7
|
+
|
|
8
|
+
> **TODO — placeholder installed by `init --build-kit`.** Study an existing stack's
|
|
9
|
+
> build-state-change/SKILL.md (stacks/node, stacks/supabase, stacks/axon, or stacks/cratis-csharp,
|
|
10
|
+
> under `templates/.claude/skills/`) for the level of detail expected, then rewrite
|
|
11
|
+
> every section below for your stack's real conventions — file layout, naming, and
|
|
12
|
+
> the actual framework/language idioms. Delete this callout once done.
|
|
13
|
+
|
|
14
|
+
> Before doing anything else, read the slice definition from `.slices/{Context}/{slicename}/slice.json`.
|
|
15
|
+
> This file is the **source of truth** for all fields, events, and metadata — never invent
|
|
16
|
+
> fields not defined there. Keep this line verbatim; it applies to every stack.
|
|
17
|
+
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
## What a State Change Slice is
|
|
21
|
+
|
|
22
|
+
TODO — describe a write-side slice (command validated against replayed events, new events emitted) in terms of your stack's own primitives.
|
|
23
|
+
|
|
24
|
+
## Step 1 — Read the slice.json
|
|
25
|
+
|
|
26
|
+
From the slice definition, extract:
|
|
27
|
+
- **sliceName** — the slice title
|
|
28
|
+
- **context** — the bounded context
|
|
29
|
+
- **commands[]** — list of commands with their data fields
|
|
30
|
+
- **events[]** — list of events emitted by each command
|
|
31
|
+
- **specifications[]** — test scenarios (given/when/then)
|
|
32
|
+
|
|
33
|
+
> **Comments & description**: each element carries a `comments: string[]` array (board comments) and a `description` field — use them as implementation hints, and resolve consumed comments via `POST <BASE_URL>/api/org/<ORG_ID>/boards/<BOARD_ID>/nodes/<nodeId>/comments/<commentId>/resolve`.
|
|
34
|
+
|
|
35
|
+
---
|
|
36
|
+
|
|
37
|
+
## Step 2 — TODO (your stack-specific implementation steps)
|
|
38
|
+
|
|
39
|
+
TODO — file layout, naming conventions, framework idioms, how the handler/projection/reactor is wired up.
|
|
40
|
+
|
|
41
|
+
## Quality gate
|
|
42
|
+
|
|
43
|
+
TODO — this stack's build command and how to run only this slice's tests (not the full suite).
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: build-state-view
|
|
3
|
+
description: TODO — one-line description of how a read-side slice (a projection/read model kept up to date from events) is implemented for your stack (see an existing stack's build-state-view/SKILL.md under stacks/<name>/templates/.claude/skills/ for the level of detail expected)
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Build State View Slice
|
|
7
|
+
|
|
8
|
+
> **TODO — placeholder installed by `init --build-kit`.** Study an existing stack's
|
|
9
|
+
> build-state-view/SKILL.md (stacks/node, stacks/supabase, stacks/axon, or stacks/cratis-csharp,
|
|
10
|
+
> under `templates/.claude/skills/`) for the level of detail expected, then rewrite
|
|
11
|
+
> every section below for your stack's real conventions — file layout, naming, and
|
|
12
|
+
> the actual framework/language idioms. Delete this callout once done.
|
|
13
|
+
|
|
14
|
+
> Before doing anything else, read the slice definition from `.slices/{Context}/{slicename}/slice.json`.
|
|
15
|
+
> This file is the **source of truth** for all fields, events, and metadata — never invent
|
|
16
|
+
> fields not defined there. Keep this line verbatim; it applies to every stack.
|
|
17
|
+
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
## What a State View Slice is
|
|
21
|
+
|
|
22
|
+
TODO — describe a read-side slice (a projection/read model kept up to date from events) in terms of your stack's own primitives.
|
|
23
|
+
|
|
24
|
+
## Step 1 — Read the slice.json
|
|
25
|
+
|
|
26
|
+
From the slice definition, extract:
|
|
27
|
+
- **sliceName** — the slice title
|
|
28
|
+
- **context** — the bounded context
|
|
29
|
+
- **projections[]** / **queries[]** — the read model(s) this slice serves
|
|
30
|
+
- **specifications[]** — test scenarios (given/when/then)
|
|
31
|
+
|
|
32
|
+
> **Comments & description**: each element carries a `comments: string[]` array (board comments) and a `description` field — use them as implementation hints, and resolve consumed comments via `POST <BASE_URL>/api/org/<ORG_ID>/boards/<BOARD_ID>/nodes/<nodeId>/comments/<commentId>/resolve`.
|
|
33
|
+
|
|
34
|
+
---
|
|
35
|
+
|
|
36
|
+
## Step 2 — TODO (your stack-specific implementation steps)
|
|
37
|
+
|
|
38
|
+
TODO — file layout, naming conventions, framework idioms, how the handler/projection/reactor is wired up.
|
|
39
|
+
|
|
40
|
+
## Quality gate
|
|
41
|
+
|
|
42
|
+
TODO — this stack's build command and how to run only this slice's tests (not the full suite).
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
# Project Configuration
|
|
2
|
+
|
|
3
|
+
TODO — one-line pointer to where domain events live in your stack's scaffold (e.g. "Read Events in src/events to understand the global structure").
|
|
4
|
+
|
|
5
|
+
## File Structure Constraints
|
|
6
|
+
|
|
7
|
+
- **Strict Path Limitation**: TODO — the one directory glob the agent should stay inside by default (e.g. `src/slices/{slicename}/*`)
|
|
8
|
+
- **Slice Organization**: Each feature/domain should be organized as a separate slice
|
|
9
|
+
|
|
10
|
+
## Code Standards
|
|
11
|
+
|
|
12
|
+
- **Language**: TODO
|
|
13
|
+
- **Module System**: TODO
|
|
14
|
+
- **Type Safety**: TODO (delete this line if the language has no static typing)
|
|
15
|
+
|
|
16
|
+
## Development Guidelines
|
|
17
|
+
|
|
18
|
+
1. Each slice should be self-contained and focused on a specific domain
|
|
19
|
+
2. Maintain clear separation of concerns within each slice
|
|
20
|
+
3. TODO — your stack's own idioms/best practices
|
|
21
|
+
|
|
22
|
+
TODO — any other guardrails worth stating up front (e.g. ignore routes files unless
|
|
23
|
+
asked, ignore tests unless asked, slice names are case-insensitive) — copy the ones
|
|
24
|
+
that still apply from an existing stack's build-kit/CLAUDE.md.
|
|
25
|
+
|
|
26
|
+
At the start of every session, read `.build-kit/AGENTS.md` if it exists to load accumulated project learnings.
|
|
27
|
+
|
|
28
|
+
When starting to work on a slice, invoke the `update-slice-status` skill with `InProgress` status before doing anything else.
|
|
29
|
+
|
|
30
|
+
## Building a Slice
|
|
31
|
+
|
|
32
|
+
**CRITICAL: You MUST always use the provided skills to build slices. NEVER implement a slice manually.**
|
|
33
|
+
**ALL fields, event names, command names, and business rules MUST come exclusively from slice.json. Do NOT invent, assume, or guess any field or logic not present in the slice definition.**
|
|
34
|
+
|
|
35
|
+
When asked to build a slice, always follow this flow:
|
|
36
|
+
|
|
37
|
+
1. Read the slice definition from `.build-kit/.slices/<context>/<slicename>/slice.json`.
|
|
38
|
+
2. Determine the slice type:
|
|
39
|
+
- **Translation** — `sliceType === "TRANSLATION"` → read `description` and `notes` from slice.json for hints; default to `/build-automation` if nothing else is specified
|
|
40
|
+
- **Automation** — `processors` array is non-empty → invoke `/build-automation`
|
|
41
|
+
- **State-view** — `projections` or `queries` array is non-empty → invoke `/build-state-view`
|
|
42
|
+
- **State-change** — default (has `commands` / `events`) → invoke `/build-state-change`
|
|
43
|
+
3. Invoke the matching skill and follow its instructions completely. Do not deviate.
|
|
44
|
+
4. **Verify against slice.json**: After the skill completes, check that every command field, event field, and specification in slice.json appears in the implementation. No invented fields — if it is not in slice.json, it must not be in the code.
|
|
45
|
+
5. Run quality checks (TODO: this stack's build + test commands), then the slice tests only.
|
|
46
|
+
6. If checks pass, commit with `feat: [Slice Name]` and set slice status to `Done`.
|
|
47
|
+
|
|
48
|
+
After you are done, automatically run the tests for the slice that was edited.
|
|
49
|
+
|
|
50
|
+
## Example Slice Structure
|
|
51
|
+
|
|
52
|
+
TODO — a short tree showing where one slice's files land, e.g.:
|
|
53
|
+
```
|
|
54
|
+
TODO
|
|
55
|
+
```
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
# Agent Learnings
|
|
2
|
+
|
|
3
|
+
Patterns and gotchas discovered during task processing. Update this file whenever you encounter something reusable.
|
|
4
|
+
|
|
5
|
+
## tasks.json
|
|
6
|
+
|
|
7
|
+
- Tasks are objects with `id`, `createdAt`, and `payload` (a `SliceChangedPayload`).
|
|
8
|
+
- After completing a task, remove it from the array entirely — do not add a status field.
|
|
9
|
+
- Write `[]` to `tasks.json` if the last task is completed.
|
|
10
|
+
|
|
11
|
+
## SliceChangedPayload fields
|
|
12
|
+
|
|
13
|
+
```
|
|
14
|
+
event always "slice:changed"
|
|
15
|
+
organizationId org UUID or null
|
|
16
|
+
boardId board UUID
|
|
17
|
+
sliceId SLICE_BORDER node UUID — use this with /load-slice
|
|
18
|
+
sliceTitle human-readable slice name (may be null)
|
|
19
|
+
sliceStatus e.g. "Created", "InProgress", "Done", "Blocked" (may be null)
|
|
20
|
+
timestamp unix ms when the change was emitted
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Slice files
|
|
24
|
+
|
|
25
|
+
The realtime agent writes one file per slice on startup and after each `slice:changed` event:
|
|
26
|
+
|
|
27
|
+
```
|
|
28
|
+
.slices/<context>/<sliceName>.json
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
- `<context>` is the slice's context value, or `default` if none.
|
|
32
|
+
- `<sliceName>` is the slice title lowercased with spaces and the `"slice:"` prefix removed (e.g. `"slice: Enable User"` → `enableuser`).
|
|
33
|
+
|
|
34
|
+
These files are always up to date — read them directly before invoking any skill.
|
|
35
|
+
|
|
36
|
+
## Skill Usage
|
|
37
|
+
|
|
38
|
+
- Always run `/connect` first to load credentials from `.eventmodelers/config.json` before calling any other skill.
|
|
39
|
+
- `/load-slice sliceId=<uuid>` re-fetches all slices from the API, refreshes the slice files, and returns the requested slice. Use it when you need a guaranteed-fresh view of a specific slice.
|
|
40
|
+
- Read `.slices/<context>/<sliceName>.json` directly when you already know the context and name and the file is recent enough.
|
|
41
|
+
|
|
42
|
+
## Board API
|
|
43
|
+
|
|
44
|
+
- The `boardId` and `organizationId` from each payload provide full context — pass them to skills.
|
|
45
|
+
- Node events use `node:created`, `node:changed`, `node:deleted` — always POST to `/api/org/:orgId/boards/:boardId/nodes/events`.
|
|
46
|
+
- Slice metadata (title, status) lives on the SLICE_BORDER node under `meta.sliceStatus` and `meta.title`.
|
|
47
|
+
- `/update-slice-status` rejects moving a slice into a status it's already in — this is a concurrency guard, not a bug. It means another agent already claimed the slice. Treat it as `ALREADY_IN_STATUS`, skip that slice, and move on to the next `Planned` one instead of erroring out.
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
# Agent Task Instructions
|
|
2
|
+
|
|
3
|
+
You are an autonomous agent reacting to slice status change events on an Eventmodelers board.
|
|
4
|
+
|
|
5
|
+
## Your Loop
|
|
6
|
+
|
|
7
|
+
1. Read `AGENT.md` to load accumulated learnings before doing anything else.
|
|
8
|
+
2. Read `.build-kit/tasks.json`.
|
|
9
|
+
3. If `tasks.json` is empty or missing, reply with:
|
|
10
|
+
<promise>IDLE</promise>
|
|
11
|
+
and stop.
|
|
12
|
+
4. Pick the **oldest task** (earliest `createdAt`).
|
|
13
|
+
5. Execute the task — see the Execution section below.
|
|
14
|
+
6. After execution, remove that task from the array and write `.build-kit/tasks.json` back.
|
|
15
|
+
7. Append a progress entry to `progress.txt` (create if missing).
|
|
16
|
+
8. Update `AGENT.md` with any new reusable learnings discovered this iteration.
|
|
17
|
+
9. Reply normally so the next iteration can pick up the next task.
|
|
18
|
+
|
|
19
|
+
## Execution
|
|
20
|
+
|
|
21
|
+
Each task has a single `payload` of type `SliceChangedPayload`:
|
|
22
|
+
|
|
23
|
+
```
|
|
24
|
+
{
|
|
25
|
+
event: "slice:changed"
|
|
26
|
+
organizationId: string | null
|
|
27
|
+
boardId: string
|
|
28
|
+
sliceId: string ← SLICE_BORDER node UUID
|
|
29
|
+
sliceTitle: string | null
|
|
30
|
+
sliceStatus: string | null ← e.g. "InProgress", "Done", "Blocked"
|
|
31
|
+
timestamp: number
|
|
32
|
+
}
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
### Step 1 — Load credentials
|
|
36
|
+
|
|
37
|
+
Run `/connect` to resolve `TOKEN`, `BOARD_ID`, `ORG_ID`, and `BASE_URL` from `.eventmodelers/config.json`.
|
|
38
|
+
|
|
39
|
+
### Step 2 — Load the slice
|
|
40
|
+
|
|
41
|
+
Run `/load-slice sliceId=<payload.sliceId>` to fetch full slice details (title, status, raw node record).
|
|
42
|
+
|
|
43
|
+
### Step 3 — Act on the change
|
|
44
|
+
|
|
45
|
+
Inspect the `sliceStatus` in the payload:
|
|
46
|
+
|
|
47
|
+
#### `Planned` — build the slice
|
|
48
|
+
|
|
49
|
+
This is the build trigger. Setting `InProgress` and building are one atomic step:
|
|
50
|
+
|
|
51
|
+
1. Immediately call `/update-slice-status` to set the slice to `InProgress` on the board.
|
|
52
|
+
|
|
53
|
+
**Claim conflict**: if this call reports the slice is already in `InProgress` (or any status other than `Planned`), another agent already claimed it first — this is expected, not an error. Log it in `progress.txt`, drop this task without building, and continue the loop (the next task will naturally cover the next slice). Do not retry.
|
|
54
|
+
|
|
55
|
+
2. Read the slice definition from `.build-kit/.slices/<contextSlug>/<sliceFolder>/slice.json` (written by `/load-slice`).
|
|
56
|
+
|
|
57
|
+
3. Determine the **slice type** from the slice.json:
|
|
58
|
+
- **Translation** — `sliceType === "TRANSLATION"` → read `description` and `notes` from slice.json for hints; default to `/build-automation` if nothing else is specified
|
|
59
|
+
- **Automation** — `processors` array is non-empty → invoke `/build-automation`
|
|
60
|
+
- **State-view** — `projections` or `queries` array is non-empty → invoke `/build-state-view`
|
|
61
|
+
- **State-change** — default (has `commands` / `events`) → invoke `/build-state-change`
|
|
62
|
+
|
|
63
|
+
4. Invoke the matching skill and follow its instructions **completely**. Do NOT implement the slice manually.
|
|
64
|
+
|
|
65
|
+
5. **Verify against slice.json**: cross-check the implementation — every command field, event field, and specification in slice.json must appear in the code. No invented fields — if it is not in slice.json, it must not be in the code.
|
|
66
|
+
|
|
67
|
+
6. Run quality checks (TODO: your stack's build + test commands — slice-scoped tests only, not the full suite).
|
|
68
|
+
|
|
69
|
+
7. If checks pass, commit all changes with message: `feat: [Slice Name]`.
|
|
70
|
+
|
|
71
|
+
8. Call `/update-slice-status` to set the slice to `Done` on the board.
|
|
72
|
+
|
|
73
|
+
#### `InProgress`
|
|
74
|
+
Another agent is already building this slice. Log it and skip — do not build.
|
|
75
|
+
|
|
76
|
+
#### `Done`
|
|
77
|
+
Summarize what was completed and update `progress.txt`.
|
|
78
|
+
|
|
79
|
+
#### `Blocked`
|
|
80
|
+
Log the blocker in `progress.txt`.
|
|
81
|
+
|
|
82
|
+
#### `Review`
|
|
83
|
+
Fetch slice details and prepare a review summary in `progress.txt`.
|
|
84
|
+
|
|
85
|
+
#### Any other status (`Created`, etc.)
|
|
86
|
+
Load the slice and log the state transition in `progress.txt`. No build action.
|
|
87
|
+
|
|
88
|
+
Use the skills available in `.claude/skills/` to interact with the board.
|
|
89
|
+
|
|
90
|
+
## Updating tasks.json
|
|
91
|
+
|
|
92
|
+
After completing a task, remove it from the array and write the updated array back to `.build-kit/tasks.json`. If the array is now empty, write `[]`.
|
|
93
|
+
|
|
94
|
+
## Progress Report Format
|
|
95
|
+
|
|
96
|
+
APPEND to `progress.txt` (never replace):
|
|
97
|
+
```
|
|
98
|
+
## [ISO timestamp] — Task [task.id]
|
|
99
|
+
|
|
100
|
+
Slice: [sliceTitle] ([sliceId])
|
|
101
|
+
Status change: [sliceStatus]
|
|
102
|
+
|
|
103
|
+
Action taken:
|
|
104
|
+
- [what was done in response to the slice change]
|
|
105
|
+
|
|
106
|
+
Learnings:
|
|
107
|
+
- [any patterns, gotchas, or reusable knowledge discovered]
|
|
108
|
+
---
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
## Stop Condition
|
|
112
|
+
|
|
113
|
+
If `.build-kit/tasks.json` is empty (`[]`) or does not exist, reply with:
|
|
114
|
+
<promise>IDLE</promise>
|
|
115
|
+
|
|
116
|
+
## Updating AGENT.md
|
|
117
|
+
|
|
118
|
+
After completing a task, add any **reusable** learnings to `AGENT.md` — patterns, gotchas, API quirks, or skill behaviour that future iterations should know. Only add things that are general and applicable beyond this single task. Do not duplicate what is already there.
|
|
119
|
+
|
|
120
|
+
## Important
|
|
121
|
+
|
|
122
|
+
- Process **one task per iteration**.
|
|
123
|
+
- Read `AGENT.md` first — it contains patterns from previous iterations.
|
|
124
|
+
- Always start with `/connect` if credentials are not yet loaded.
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
# Ralph Agent Instructions
|
|
2
|
+
|
|
3
|
+
You are an autonomous coding agent working on a software project. You apply your skills to build software slices. You only work on one slice at a time.
|
|
4
|
+
|
|
5
|
+
The structure defined in the Project-Skills is relevant.
|
|
6
|
+
|
|
7
|
+
## Context Boundary (READ FIRST — NON-NEGOTIABLE)
|
|
8
|
+
|
|
9
|
+
You work within **exactly ONE context at a time** — the one named in `.build-kit/.slices/current_context.json`.
|
|
10
|
+
|
|
11
|
+
- **ONLY** look for and build slices inside `.build-kit/.slices/<currentContext>/`.
|
|
12
|
+
- **NEVER** read, scan, or build slices from any other context directory, even if it has "Planned" slices, and even if the current context has no work left.
|
|
13
|
+
- A "Planned" slice in a *different* context is **NOT yours to build**. Ignore it completely.
|
|
14
|
+
- If the current context has no "Planned" slice, you are **done for this iteration** — reply `<promise>NO_TASKS</promise>` and stop. Do not go looking elsewhere. The context is only ever changed on the board, never by you.
|
|
15
|
+
|
|
16
|
+
## Your Task
|
|
17
|
+
|
|
18
|
+
0. Do not read the entire code base. Focus on the tasks in this description.
|
|
19
|
+
1. Read `.build-kit/.slices/current_context.json` to find the active context name, then read `.build-kit/.slices/<contextName>/index.json`. Every item in status "planned" is a task.
|
|
20
|
+
2. Read the progress log at `progress.txt` (check Codebase Patterns section first)
|
|
21
|
+
3. Make sure you are on the right branch "feature/<slicename>", if unsure, start from main.
|
|
22
|
+
5. Pick the **highest priority** slice where status is **exactly** "Planned" (case insensitive). This becomes your PRD. Set the status "InProgress" in the index.json **and** update the slice status on the eventmodelers board using the `update-slice-status` skill (or MCP if available).
|
|
23
|
+
**IMPORTANT: Only work on slices with status "Planned" in the CURRENT context. Never pick up a slice that is "InProgress", "Done", "Blocked", "Created", or any other status — even if it looks incomplete. If no slice has status "Planned" in the current context, reply with:**
|
|
24
|
+
<promise>NO_TASKS</promise> and stop immediately. Do not work on other slices and do not switch to another context.
|
|
25
|
+
**Claim conflict**: the board rejects the status update if the slice is already in the target status — this is expected: another agent claimed it first, racing you for the same slice. This is NOT an error. Do not stop, do not retry the same slice. Re-read `index.json` (or re-fetch via `load-slice`), pick the next-highest-priority slice still "Planned", and try claiming that one instead. Repeat until a claim succeeds or no "Planned" slice remains, in which case reply `<promise>NO_TASKS</promise>`.
|
|
26
|
+
6. Pick the slice definition from `.build-kit/.slices/<contextName>/<folder>/slice.json` as defined in the prd. Never work on more than one slice per iteration.
|
|
27
|
+
7. A slice can define additional prompts as codegen/backendPrompt. Any additional prompts defined in backend are hints for the implementation of the slice and have to be taken into account. If you use the additional prompt, add a line in progress.txt
|
|
28
|
+
7. Determine the slice type and invoke the matching skill as defined in the **Building a Slice** section of `.build-kit/CLAUDE.md`. Do NOT implement manually.
|
|
29
|
+
8. Write a short progress one liner after each step to progress.txt
|
|
30
|
+
9. Analyze and Implement that single slice, making use of the skills in the skills directory plus your previously collected knowledge. Make a TODO list for what needs to be done, and adjust the implementation according to the JSON definition. Carefully inspect events, fields and compare against the implemented slice. JSON is the desired state. ATTENTION: a "planned" task can also be just added specifications. So always look at the slice itself, but also the specifications. If specifications were added in json which are not on code, you need to add them in code.
|
|
31
|
+
10. The slice in the json is always true, the code follows what is defined in the json
|
|
32
|
+
11. Slice is only 'Done' if business logic is implemented as defined in the JSON, APIs are implemented, all scenarios in JSON are implemented in code and it fulfills the slice.json. There must be no specification in json that has no equivalent in code.
|
|
33
|
+
12. Make sure to write the ui-prompt.md as defined if defined in the skill
|
|
34
|
+
13. Run quality checks — TODO: your stack's build command, TODO: your stack's test command (slice-scoped only; do not run all tests).
|
|
35
|
+
14. If checks pass, commit ALL changes with message: `feat: [Slice Name]` and merge back to main as FF merge (update first)
|
|
36
|
+
15. Update the PRD to set `status: Done` for the completed story in index.json **and** update the slice status on the eventmodelers board using the `update-slice-status` skill (or MCP if available).
|
|
37
|
+
16. Append your progress to `progress.txt` after each step in the iteration.
|
|
38
|
+
17. Append your new learnings to `.build-kit/AGENTS.md` in a compressed form, reusable for future iterations. Only add learnings if they are not already there.
|
|
39
|
+
18. Finish the iteration.
|
|
40
|
+
|
|
41
|
+
## Progress Report Format
|
|
42
|
+
|
|
43
|
+
APPEND to progress.txt (never replace, always append):
|
|
44
|
+
|
|
45
|
+
```
|
|
46
|
+
## [Date/Time] - [Slice]
|
|
47
|
+
|
|
48
|
+
- What was implemented
|
|
49
|
+
- Files changed
|
|
50
|
+
- **Learnings for future iterations:**
|
|
51
|
+
- Patterns discovered (e.g., "this codebase uses X for Y")
|
|
52
|
+
- Gotchas encountered (e.g., "don't forget to update Z when changing W")
|
|
53
|
+
- Useful context (e.g., "the evaluation panel is in component X")
|
|
54
|
+
---
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
The learnings section is critical - it helps future iterations avoid repeating mistakes and understand the codebase better.
|
|
58
|
+
|
|
59
|
+
## Consolidate Patterns
|
|
60
|
+
|
|
61
|
+
If you discover a **reusable pattern** that future iterations should know, add it to the `## Codebase Patterns` section at the TOP of progress.txt (create it if it doesn't exist).
|
|
62
|
+
|
|
63
|
+
```
|
|
64
|
+
## Codebase Patterns
|
|
65
|
+
- TODO: an example of a your stack-specific reusable pattern once you have one
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
Only add patterns that are **general and reusable**, not story-specific details.
|
|
69
|
+
|
|
70
|
+
## Update AGENTS.md Files
|
|
71
|
+
|
|
72
|
+
Before committing, check if any edited files have learnings worth preserving in nearby AGENTS.md files — API patterns/conventions, gotchas, dependencies between files, testing approaches, configuration/environment requirements.
|
|
73
|
+
|
|
74
|
+
**Do NOT add:**
|
|
75
|
+
|
|
76
|
+
- Slice specific implementation details
|
|
77
|
+
- Story-specific implementation details
|
|
78
|
+
- Temporary debugging notes
|
|
79
|
+
- Information already in progress.txt
|
|
80
|
+
- Task-specific learnings
|
|
81
|
+
|
|
82
|
+
Only update AGENTS.md if you have **genuinely reusable knowledge** that would help future work
|
|
83
|
+
|
|
84
|
+
## Quality Requirements
|
|
85
|
+
|
|
86
|
+
- ALL commits must pass this project's quality checks (typecheck/compile, lint, test)
|
|
87
|
+
- TODO: your stack's build command
|
|
88
|
+
- TODO: your stack's test command
|
|
89
|
+
- Do NOT commit broken code
|
|
90
|
+
- Keep changes focused and minimal
|
|
91
|
+
- Follow existing code patterns
|
|
92
|
+
|
|
93
|
+
## Skills
|
|
94
|
+
|
|
95
|
+
Use the provided skills in the skills folder as guidance.
|
|
96
|
+
Update skill definitions if you find an improvement you can make.
|
|
97
|
+
|
|
98
|
+
## Specifications
|
|
99
|
+
|
|
100
|
+
For every specification added to the Slice, you need to implement one executable Specification in Code.
|
|
101
|
+
|
|
102
|
+
A Slice is not complete if specifications are missing or can't be executed.
|
|
103
|
+
|
|
104
|
+
## Stop Condition
|
|
105
|
+
|
|
106
|
+
**After completing ONE slice, always stop — regardless of whether more slices are Planned.** The ralph loop will invoke you again for the next slice. Never chain multiple slices in one iteration.
|
|
107
|
+
|
|
108
|
+
If the slice was completed and committed successfully, reply with:
|
|
109
|
+
<promise>DONE</promise>
|
|
110
|
+
|
|
111
|
+
If no slice has status "Planned" in the current context, reply with:
|
|
112
|
+
<promise>NO_TASKS</promise>
|
|
113
|
+
(Do NOT switch to another context to find work — stop here.)
|
|
114
|
+
|
|
115
|
+
If ALL slices in the current context are Done, reply with:
|
|
116
|
+
<promise>COMPLETE</promise>
|
|
117
|
+
|
|
118
|
+
## Important
|
|
119
|
+
|
|
120
|
+
- If `.build-kit/.eventmodelers/config.json` is absent, skip all platform communication (MCP calls, `update-slice-status`, board sync) and continue working locally.
|
|
121
|
+
- Work on ONE slice per iteration
|
|
122
|
+
- Commit frequently
|
|
123
|
+
- update progress.txt frequently
|
|
124
|
+
- Read the Codebase Patterns section in progress.txt before starting
|
|
125
|
+
|
|
126
|
+
## When an iteration completes
|
|
127
|
+
|
|
128
|
+
Use all the key learnings from the progress.txt and update the `.build-kit/AGENTS.md` file with those learnings.
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# Your stack
|
|
2
|
+
|
|
3
|
+
TODO — this is a placeholder project scaffold, installed by `init --build-kit` for a
|
|
4
|
+
stack that isn't built into this CLI yet. Replace this file (and everything else under
|
|
5
|
+
`root/`) with a real minimal starter for your stack: build/dependency file, source
|
|
6
|
+
layout, a slices directory the skills in `.claude/skills/` generate into, and whatever
|
|
7
|
+
local infra (docker-compose, migrations, etc.) it needs to run.
|
|
8
|
+
|
|
9
|
+
See an existing stack's `templates/root/` in the eventmodelers-cli source —
|
|
10
|
+
`stacks/node`, `stacks/supabase`, `stacks/axon`, `stacks/cratis-csharp` — for the shape
|
|
11
|
+
a real one takes.
|
|
12
|
+
|
|
13
|
+
Once this is filled in and working, consider contributing it back as a first-class
|
|
14
|
+
stack: copy `.build-kit/`, `.claude/skills/`, and this `root/` scaffold into
|
|
15
|
+
`stacks/<name>/templates/` in the eventmodelers-cli repo and register it in `STACKS`
|
|
16
|
+
(cli.js) — see that repo's README, "Adding a stack".
|