@noeis/noeis-cli 0.1.1 → 0.1.3
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 +6 -7
- package/package.json +2 -2
- package/src/cli.js +48 -4
- package/src/config.js +1 -1
package/README.md
CHANGED
|
@@ -1,17 +1,14 @@
|
|
|
1
|
-
# @noeis/cli
|
|
1
|
+
# @noeis/noeis-cli
|
|
2
2
|
|
|
3
3
|
Command-line client for scripting a Noeis wiki without an MCP-speaking agent.
|
|
4
4
|
|
|
5
5
|
## Install
|
|
6
6
|
|
|
7
|
-
Current internal build:
|
|
8
|
-
|
|
9
7
|
```bash
|
|
10
|
-
|
|
11
|
-
npm i -g ./packages/cli
|
|
8
|
+
npm i -g @noeis/noeis-cli
|
|
12
9
|
```
|
|
13
10
|
|
|
14
|
-
|
|
11
|
+
This installs the `noeis` command.
|
|
15
12
|
|
|
16
13
|
## Connect an agent
|
|
17
14
|
|
|
@@ -29,6 +26,8 @@ Supported runtime names: `claude-code`, `codex`, `hermes`, `openclaw`, and `open
|
|
|
29
26
|
|
|
30
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`.
|
|
31
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
|
+
|
|
32
31
|
For local/self-hosted API targets, pass both URLs:
|
|
33
32
|
|
|
34
33
|
```bash
|
|
@@ -62,7 +61,7 @@ noeis login --token ntk_at_... --api-url http://localhost:5500
|
|
|
62
61
|
You can also skip stored config and use environment variables:
|
|
63
62
|
|
|
64
63
|
```bash
|
|
65
|
-
NOEIS_TOKEN=ntk_at_... NOEIS_API_URL=https://
|
|
64
|
+
NOEIS_TOKEN=ntk_at_... NOEIS_API_URL=https://note-taker-3-unrg.onrender.com noeis pages list
|
|
66
65
|
```
|
|
67
66
|
|
|
68
67
|
Manual environment variables are useful for scripts. Runtime MCP configs should prefer `noeis mcp` so secrets remain centralized.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@noeis/noeis-cli",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.3",
|
|
4
4
|
"description": "Command-line client for scripting a Noeis wiki.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
],
|
|
24
24
|
"license": "ISC",
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@noeis/wiki-mcp": "^0.1.
|
|
26
|
+
"@noeis/wiki-mcp": "^0.1.1"
|
|
27
27
|
},
|
|
28
28
|
"engines": {
|
|
29
29
|
"node": ">=18.17"
|
package/src/cli.js
CHANGED
|
@@ -13,7 +13,7 @@ const HELP = `Noeis CLI
|
|
|
13
13
|
Usage:
|
|
14
14
|
noeis connect [claude-code|codex|hermes|openclaw|opencode] [--label name] [--no-browser]
|
|
15
15
|
noeis mcp [--help]
|
|
16
|
-
noeis login [--token ntk_at_...] [--api-url https://
|
|
16
|
+
noeis login [--token ntk_at_...] [--api-url https://note-taker-3-unrg.onrender.com]
|
|
17
17
|
noeis pages list [--query text] [--status draft|published|archived] [--page-type type] [--limit n] [--json]
|
|
18
18
|
noeis pages get <id> [--json]
|
|
19
19
|
noeis ingest <url|file> [--title title] [--json]
|
|
@@ -27,6 +27,25 @@ Environment:
|
|
|
27
27
|
NOEIS_TOKEN, NOEIS_API_URL, NOEIS_APP_URL, NOEIS_CONFIG_DIR
|
|
28
28
|
`;
|
|
29
29
|
|
|
30
|
+
const CONNECT_HELP = `Noeis agent connect
|
|
31
|
+
|
|
32
|
+
Usage:
|
|
33
|
+
noeis connect [claude-code|codex|hermes|openclaw|opencode] [options]
|
|
34
|
+
|
|
35
|
+
Options:
|
|
36
|
+
--label <name> Label shown on the Noeis browser approval screen
|
|
37
|
+
--api-url <url> API URL, defaults to ${DEFAULT_API_URL}
|
|
38
|
+
--app-url <url> Browser approval app URL, defaults to ${DEFAULT_APP_URL}
|
|
39
|
+
--no-browser Print the approval URL without opening a browser
|
|
40
|
+
--no-config Save Noeis CLI config but do not write runtime MCP config
|
|
41
|
+
--timeout <seconds> Wait time for browser approval, defaults to 300
|
|
42
|
+
|
|
43
|
+
Examples:
|
|
44
|
+
noeis connect openclaw
|
|
45
|
+
noeis connect hermes
|
|
46
|
+
noeis connect codex --no-browser
|
|
47
|
+
`;
|
|
48
|
+
|
|
30
49
|
const optionValue = (args, name, fallback = '') => {
|
|
31
50
|
const index = args.indexOf(name);
|
|
32
51
|
if (index === -1) return fallback;
|
|
@@ -147,8 +166,21 @@ args = ["mcp"]${envLine}
|
|
|
147
166
|
fs.writeFileSync(filePath, `${next.trimEnd()}\n`, { mode: 0o600 });
|
|
148
167
|
};
|
|
149
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': { transport: 'stdio', ...server }
|
|
176
|
+
}
|
|
177
|
+
};
|
|
178
|
+
writeJsonFile(filePath, config);
|
|
179
|
+
return filePath;
|
|
180
|
+
};
|
|
181
|
+
|
|
150
182
|
const writeRuntimeMcpConfig = ({ runtime, apiUrl, configDir, env = process.env } = {}) => {
|
|
151
|
-
const home = os.homedir();
|
|
183
|
+
const home = env.HOME || os.homedir();
|
|
152
184
|
const server = mcpServerConfig({ configDir, apiUrl });
|
|
153
185
|
if (runtime === 'codex') {
|
|
154
186
|
const filePath = path.join(home, '.codex', 'config.toml');
|
|
@@ -172,6 +204,11 @@ const writeRuntimeMcpConfig = ({ runtime, apiUrl, configDir, env = process.env }
|
|
|
172
204
|
delete config['noeis-wiki'];
|
|
173
205
|
}
|
|
174
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
|
+
}
|
|
175
212
|
return filePath;
|
|
176
213
|
};
|
|
177
214
|
|
|
@@ -254,6 +291,10 @@ const runLogin = async (args, context) => {
|
|
|
254
291
|
};
|
|
255
292
|
|
|
256
293
|
const runConnect = async (args, context) => {
|
|
294
|
+
if (args.includes('--help') || args.includes('-h')) {
|
|
295
|
+
context.io.stdout.write(CONNECT_HELP);
|
|
296
|
+
return;
|
|
297
|
+
}
|
|
257
298
|
const auth = resolveAuth(context);
|
|
258
299
|
const positional = compactArgs(args);
|
|
259
300
|
const runtime = normalizeRuntime(positional[0] || optionValue(args, '--runtime'));
|
|
@@ -326,8 +367,11 @@ const runConnect = async (args, context) => {
|
|
|
326
367
|
io.stderr.write(`Connected, but the access check failed: ${error.message || error}\n`);
|
|
327
368
|
}
|
|
328
369
|
io.stdout.write(`Saved Noeis CLI config to ${configPath}\n`);
|
|
329
|
-
|
|
330
|
-
|
|
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`);
|
|
331
375
|
if (hasFlag(args, '--print-token')) io.stdout.write(`${approved.secret}\n`);
|
|
332
376
|
};
|
|
333
377
|
|
package/src/config.js
CHANGED
|
@@ -2,7 +2,7 @@ import fs from 'node:fs';
|
|
|
2
2
|
import os from 'node:os';
|
|
3
3
|
import path from 'node:path';
|
|
4
4
|
|
|
5
|
-
export const DEFAULT_API_URL = 'https://
|
|
5
|
+
export const DEFAULT_API_URL = 'https://note-taker-3-unrg.onrender.com';
|
|
6
6
|
export const DEFAULT_APP_URL = 'https://www.noeis.io';
|
|
7
7
|
|
|
8
8
|
export const resolveConfigDir = ({ env = process.env } = {}) => (
|