@noeis/noeis-cli 0.1.2 → 0.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/README.md +2 -0
  2. package/package.json +1 -1
  3. package/src/cli.js +24 -3
package/README.md CHANGED
@@ -26,6 +26,8 @@ Supported runtime names: `claude-code`, `codex`, `hermes`, `openclaw`, and `open
26
26
 
27
27
  The generated runtime MCP config calls `noeis mcp`. The raw token stays in one place: the Noeis CLI config, normally `~/.config/noeis/config.json`. Generated MCP configs should not copy `NOEIS_TOKEN`.
28
28
 
29
+ For OpenClaw, `noeis connect openclaw` writes both the XDG MCP file and `~/.openclaw/openclaw.json`, because OpenClaw installs differ in which config path they read.
30
+
29
31
  For local/self-hosted API targets, pass both URLs:
30
32
 
31
33
  ```bash
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@noeis/noeis-cli",
3
- "version": "0.1.2",
3
+ "version": "0.1.4",
4
4
  "description": "Command-line client for scripting a Noeis wiki.",
5
5
  "type": "module",
6
6
  "bin": {
package/src/cli.js CHANGED
@@ -166,8 +166,21 @@ args = ["mcp"]${envLine}
166
166
  fs.writeFileSync(filePath, `${next.trimEnd()}\n`, { mode: 0o600 });
167
167
  };
168
168
 
169
+ const writeOpenClawRootConfig = ({ filePath, server }) => {
170
+ const config = safeReadJson(filePath);
171
+ config.mcp = {
172
+ ...(config.mcp || {}),
173
+ servers: {
174
+ ...(config.mcp?.servers || {}),
175
+ 'noeis-wiki': server
176
+ }
177
+ };
178
+ writeJsonFile(filePath, config);
179
+ return filePath;
180
+ };
181
+
169
182
  const writeRuntimeMcpConfig = ({ runtime, apiUrl, configDir, env = process.env } = {}) => {
170
- const home = os.homedir();
183
+ const home = env.HOME || os.homedir();
171
184
  const server = mcpServerConfig({ configDir, apiUrl });
172
185
  if (runtime === 'codex') {
173
186
  const filePath = path.join(home, '.codex', 'config.toml');
@@ -191,6 +204,11 @@ const writeRuntimeMcpConfig = ({ runtime, apiUrl, configDir, env = process.env }
191
204
  delete config['noeis-wiki'];
192
205
  }
193
206
  writeJsonFile(filePath, config);
207
+ if (runtime === 'openclaw') {
208
+ const rootConfigPath = path.join(home, '.openclaw', 'openclaw.json');
209
+ writeOpenClawRootConfig({ filePath: rootConfigPath, server });
210
+ return [filePath, rootConfigPath];
211
+ }
194
212
  return filePath;
195
213
  };
196
214
 
@@ -349,8 +367,11 @@ const runConnect = async (args, context) => {
349
367
  io.stderr.write(`Connected, but the access check failed: ${error.message || error}\n`);
350
368
  }
351
369
  io.stdout.write(`Saved Noeis CLI config to ${configPath}\n`);
352
- if (runtimeConfigPath) io.stdout.write(`Updated ${runtimeLabel(runtime)} MCP config at ${runtimeConfigPath}\n`);
353
- if (runtimeConfigPath) io.stdout.write(`Runtime config reads the token from ${configPath}; no raw token was copied into MCP config.\n`);
370
+ const runtimeConfigPaths = Array.isArray(runtimeConfigPath) ? runtimeConfigPath : (runtimeConfigPath ? [runtimeConfigPath] : []);
371
+ runtimeConfigPaths.forEach((filePath) => {
372
+ io.stdout.write(`Updated ${runtimeLabel(runtime)} MCP config at ${filePath}\n`);
373
+ });
374
+ if (runtimeConfigPaths.length) io.stdout.write(`Runtime config reads the token from ${configPath}; no raw token was copied into MCP config.\n`);
354
375
  if (hasFlag(args, '--print-token')) io.stdout.write(`${approved.secret}\n`);
355
376
  };
356
377