@eventmodelers/cli 0.0.9 → 0.0.10

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.
Files changed (3) hide show
  1. package/README.md +4 -0
  2. package/cli.js +40 -4
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -199,6 +199,8 @@ npx @eventmodelers/cli init-config --global # same, but writes organizat
199
199
  npx @eventmodelers/cli run # start the agent loop (ralph-claude.js) from the installed kit dir
200
200
  npx @eventmodelers/cli run --ollama # same, via local Ollama (ralph-ollama.js)
201
201
  npx @eventmodelers/cli run --bash # bash-only loop, no realtime (ralph.sh)
202
+ npx @eventmodelers/cli listen # start the code-export listener (code-export.mjs) from the installed kit dir
203
+ npx @eventmodelers/cli listen --port 4000 # same, on a different port
202
204
  npx @eventmodelers/cli stacks # list available stacks
203
205
  npx @eventmodelers/cli status # check what's installed
204
206
  npx @eventmodelers/cli config # print the fully resolved config (file + env), token masked
@@ -207,6 +209,8 @@ npx @eventmodelers/cli uninstall # remove everything init/ini
207
209
 
208
210
  `run` is a thin dispatcher — it just finds the installed kit dir (whatever it's named for the stack) and execs the runner file already sitting in it. The agent loop's actual logic stays in the scaffolded `<kit-dir>/`, not in this package, since you (and the agent itself, via `AGENT.md`) may customize those files per project.
209
211
 
212
+ `listen` is the same kind of dispatcher, but for `<kit-dir>/code-export.mjs` — a local HTTP server (port 3001 by default) that the eventmodelers board UI posts slice/screen data to, which then gets written under `<kit-dir>/.slices/`.
213
+
210
214
  ### Uninstall
211
215
 
212
216
  Every `init`/`init-modeling` run writes an install manifest into `<kit-dir>/.eventmodelers/install-manifest.json` recording exactly what it put down. `uninstall` reads that manifest back and removes only:
package/cli.js CHANGED
@@ -909,6 +909,23 @@ program
909
909
  .option('--config <path>', 'Path to an explicit config.json, overriding directory-based resolution (individual fields can also be set via EVENTMODELERS_* env vars, which always win)')
910
910
  .option('--print', 'Print follow-up commands (e.g. claude mcp add) instead of prompting to run them');
911
911
 
912
+ // Commands exempt from the "is a kit installed here?" gate below: init/init-modeling
913
+ // are what installs one in the first place, init-config only ever touches credentials,
914
+ // and stacks/status/config/uninstall are read-only or cleanup commands that are
915
+ // meant to work — and report something useful — whether or not a kit is present.
916
+ const NO_INIT_REQUIRED = new Set(['init', 'init-modeling', 'init-config', 'stacks', 'status', 'config', 'uninstall']);
917
+
918
+ program.hook('preAction', (_thisCommand, actionCommand) => {
919
+ if (NO_INIT_REQUIRED.has(actionCommand.name())) return;
920
+ if (findInstalledKitDir(process.cwd())) return;
921
+
922
+ console.error(`❌ No eventmodelers kit installed in this directory (checked: ${KIT_DIR_NAMES.join(', ')}).`);
923
+ console.error(' Run one of these first:');
924
+ console.error(` npx @eventmodelers/cli init --stack <name> (${Object.keys(STACKS).join(', ')})`);
925
+ console.error(' npx @eventmodelers/cli init-modeling');
926
+ process.exit(1);
927
+ });
928
+
912
929
  // Shared by init/init-modeling/init-config: direct command-line credentials,
913
930
  // Protractor-style (--base-url=..., not a generic --param key=value passthrough) —
914
931
  // self-documenting in --help and typo-safe. These win over both the config file
@@ -1045,10 +1062,6 @@ program
1045
1062
  .action(async (opts) => {
1046
1063
  const cwd = process.cwd();
1047
1064
  const kitDir = findInstalledKitDir(cwd);
1048
- if (!kitDir) {
1049
- console.error(`❌ No installed kit dir found (checked: ${KIT_DIR_NAMES.join(', ')}) — run \`eventmodelers init\` first.`);
1050
- process.exit(1);
1051
- }
1052
1065
 
1053
1066
  const pickedCount = [opts.bash, opts.ollama, opts.realTime].filter(Boolean).length;
1054
1067
  if (pickedCount > 1) {
@@ -1087,6 +1100,29 @@ program
1087
1100
  }
1088
1101
  });
1089
1102
 
1103
+ program
1104
+ .command('listen')
1105
+ .description('Start the code-export listener (code-export.mjs) from the installed kit dir — receives slice/screen data pushed from the eventmodelers board UI and writes it into .slices/')
1106
+ .option('--port <port>', 'Port to listen on (default 3001, or $PORT)')
1107
+ .action((opts) => {
1108
+ const cwd = process.cwd();
1109
+ const kitDir = findInstalledKitDir(cwd);
1110
+
1111
+ const serverPath = join(kitDir, 'code-export.mjs');
1112
+ if (!existsSync(serverPath)) {
1113
+ console.error(`❌ ${relative(cwd, serverPath)} not found.`);
1114
+ process.exit(1);
1115
+ }
1116
+
1117
+ console.log(`▶ Starting ${relative(cwd, serverPath)}...\n`);
1118
+ const env = opts.port ? { ...process.env, PORT: opts.port } : process.env;
1119
+ try {
1120
+ execSync(`node "${serverPath}"`, { cwd: kitDir, stdio: 'inherit', env });
1121
+ } catch (err) {
1122
+ process.exit(err.status || 1);
1123
+ }
1124
+ });
1125
+
1090
1126
  program
1091
1127
  .command('stacks')
1092
1128
  .description('List available stacks (for `init --stack`)')
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eventmodelers/cli",
3
- "version": "0.0.9",
3
+ "version": "0.0.10",
4
4
  "description": "Eventmodelers CLI — real-time Claude agent + skills for Claude Code, for any stack (Node, Supabase, Axon, Cratis, or modeling-only)",
5
5
  "type": "module",
6
6
  "bin": {