@eventmodelers/cli 0.0.8 → 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 +44 -6
  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
@@ -636,7 +636,7 @@ async function installStack(stackKey, stackCfg, options = {}) {
636
636
  // `overrides` are values passed directly on the command line (--token, --board-id,
637
637
  // --organization-id, --base-url) — the most explicit source available, so they
638
638
  // win over both the config file and env vars before we even check what's missing.
639
- async function configureCredentials({ config, configPath, targetDir, requiredFields, boardIdOptional, overrides = {}, print, skipGitignore = false }) {
639
+ async function configureCredentials({ config, configPath, targetDir, requiredFields, boardIdOptional, overrides = {}, print, skipGitignore = false, force = false }) {
640
640
  config = { ...config };
641
641
  for (const [field, value] of Object.entries(overrides)) {
642
642
  if (value) config[field] = value;
@@ -661,7 +661,7 @@ async function configureCredentials({ config, configPath, targetDir, requiredFie
661
661
  }
662
662
  }
663
663
 
664
- const stillMissing = requiredFields.some((f) => !config[f]);
664
+ const stillMissing = force || requiredFields.some((f) => !config[f]);
665
665
  if (stillMissing && print) {
666
666
  console.log('\n ℹ️ --print — skipping credential prompt, missing fields must be set via flags, EVENTMODELERS_* env vars, or config.json');
667
667
  } else if (stillMissing) {
@@ -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
@@ -1009,6 +1026,7 @@ credentialFlags(program
1009
1026
  overrides: {},
1010
1027
  print: globalOpts.print,
1011
1028
  skipGitignore: true,
1029
+ force: true,
1012
1030
  });
1013
1031
 
1014
1032
  // configureCredentials' generic paste/manual flow may have picked up
@@ -1030,6 +1048,7 @@ credentialFlags(program
1030
1048
  boardIdOptional: true,
1031
1049
  overrides,
1032
1050
  print: globalOpts.print,
1051
+ force: true,
1033
1052
  });
1034
1053
  }
1035
1054
  });
@@ -1043,10 +1062,6 @@ program
1043
1062
  .action(async (opts) => {
1044
1063
  const cwd = process.cwd();
1045
1064
  const kitDir = findInstalledKitDir(cwd);
1046
- if (!kitDir) {
1047
- console.error(`❌ No installed kit dir found (checked: ${KIT_DIR_NAMES.join(', ')}) — run \`eventmodelers init\` first.`);
1048
- process.exit(1);
1049
- }
1050
1065
 
1051
1066
  const pickedCount = [opts.bash, opts.ollama, opts.realTime].filter(Boolean).length;
1052
1067
  if (pickedCount > 1) {
@@ -1085,6 +1100,29 @@ program
1085
1100
  }
1086
1101
  });
1087
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
+
1088
1126
  program
1089
1127
  .command('stacks')
1090
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.8",
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": {