nemu-cli 1.0.0 → 1.1.0
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/CHANGELOG.md +19 -0
- package/README.md +54 -1
- package/dist/auth/token.js +115 -0
- package/dist/clients/hooks.js +131 -0
- package/dist/clients/paths.js +17 -0
- package/dist/clients/registry.js +74 -0
- package/dist/commands/client.js +19 -0
- package/dist/commands/context.js +65 -0
- package/dist/commands/hook.js +312 -0
- package/dist/commands/load.js +328 -0
- package/dist/commands/login.js +14 -1
- package/dist/commands/mcp.js +210 -0
- package/dist/commands/settings.js +23 -0
- package/dist/commands/setup.js +104 -0
- package/dist/commands/status.js +63 -0
- package/dist/commands/token.js +16 -0
- package/dist/commands/uninstall.js +34 -0
- package/dist/config.js +48 -20
- package/dist/context/api.js +99 -0
- package/dist/context/project.js +58 -0
- package/dist/context/redact.js +32 -0
- package/dist/context/snapshot.js +85 -0
- package/dist/context/stale.js +70 -0
- package/dist/device.js +43 -0
- package/dist/errors.js +24 -0
- package/dist/git.js +39 -0
- package/dist/http.js +61 -0
- package/dist/index.js +68 -9
- package/dist/report.js +79 -0
- package/dist/session.js +11 -6
- package/dist/system.js +50 -0
- package/dist/ui.js +20 -0
- package/dist/version.js +1 -0
- package/package.json +9 -4
package/dist/system.js
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { execFile, spawn } from "node:child_process";
|
|
2
|
+
import { access, constants } from "node:fs/promises";
|
|
3
|
+
import { delimiter, join } from "node:path";
|
|
4
|
+
export function run(command, args, options = {}) {
|
|
5
|
+
return new Promise((resolve) => {
|
|
6
|
+
execFile(command, args, {
|
|
7
|
+
env: options.env ?? process.env,
|
|
8
|
+
cwd: options.cwd,
|
|
9
|
+
timeout: options.timeout_ms ?? 30_000,
|
|
10
|
+
maxBuffer: 4 * 1024 * 1024,
|
|
11
|
+
windowsHide: true,
|
|
12
|
+
shell: process.platform === "win32",
|
|
13
|
+
}, (error, stdout, stderr) => {
|
|
14
|
+
const code = error === null
|
|
15
|
+
? 0
|
|
16
|
+
: typeof error.code === "number"
|
|
17
|
+
? (error.code)
|
|
18
|
+
: 127;
|
|
19
|
+
resolve({ code, stdout: stdout.toString(), stderr: stderr.toString() });
|
|
20
|
+
});
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
export function launch(command, args) {
|
|
24
|
+
return new Promise((resolve) => {
|
|
25
|
+
const child = spawn(command, args, {
|
|
26
|
+
stdio: "inherit",
|
|
27
|
+
shell: process.platform === "win32",
|
|
28
|
+
});
|
|
29
|
+
child.on("error", () => resolve(127));
|
|
30
|
+
child.on("exit", (code, signal) => resolve(code ?? (signal !== null ? 1 : 0)));
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
export async function which(name) {
|
|
34
|
+
const extensions = process.platform === "win32" ? (process.env.PATHEXT ?? ".EXE;.CMD;.BAT").split(";") : [""];
|
|
35
|
+
for (const directory of (process.env.PATH ?? "").split(delimiter)) {
|
|
36
|
+
if (directory.length === 0)
|
|
37
|
+
continue;
|
|
38
|
+
for (const extension of extensions) {
|
|
39
|
+
const candidate = join(directory, `${name}${extension.toLowerCase()}`);
|
|
40
|
+
try {
|
|
41
|
+
await access(candidate, constants.X_OK);
|
|
42
|
+
return candidate;
|
|
43
|
+
}
|
|
44
|
+
catch {
|
|
45
|
+
continue;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
return null;
|
|
50
|
+
}
|
package/dist/ui.js
CHANGED
|
@@ -53,3 +53,23 @@ export function open_browser(url) {
|
|
|
53
53
|
return;
|
|
54
54
|
}
|
|
55
55
|
}
|
|
56
|
+
export function is_interactive() {
|
|
57
|
+
return process.stdin.isTTY === true && process.stdout.isTTY === true;
|
|
58
|
+
}
|
|
59
|
+
export async function confirm(question, fallback) {
|
|
60
|
+
if (!is_interactive())
|
|
61
|
+
return fallback;
|
|
62
|
+
const { createInterface } = await import("node:readline/promises");
|
|
63
|
+
const reader = createInterface({ input: process.stdin, output: process.stdout });
|
|
64
|
+
try {
|
|
65
|
+
const answer = (await reader.question(` ${question} ${fallback ? "[Y/n]" : "[y/N]"} `))
|
|
66
|
+
.trim()
|
|
67
|
+
.toLowerCase();
|
|
68
|
+
if (answer.length === 0)
|
|
69
|
+
return fallback;
|
|
70
|
+
return answer === "y" || answer === "yes";
|
|
71
|
+
}
|
|
72
|
+
finally {
|
|
73
|
+
reader.close();
|
|
74
|
+
}
|
|
75
|
+
}
|
package/dist/version.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const VERSION = "1.1.0";
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nemu-cli",
|
|
3
|
-
"version": "1.
|
|
4
|
-
"description": "Command line access to Nemu
|
|
3
|
+
"version": "1.1.0",
|
|
4
|
+
"description": "Command line access to Nemu, and portable project memory for Claude Code, Codex and any MCP client.",
|
|
5
5
|
"bin": {
|
|
6
6
|
"nemu": "./dist/index.js"
|
|
7
7
|
},
|
|
@@ -22,7 +22,11 @@
|
|
|
22
22
|
"ai",
|
|
23
23
|
"cli",
|
|
24
24
|
"oauth",
|
|
25
|
-
"device-flow"
|
|
25
|
+
"device-flow",
|
|
26
|
+
"mcp",
|
|
27
|
+
"claude-code",
|
|
28
|
+
"codex",
|
|
29
|
+
"memory"
|
|
26
30
|
],
|
|
27
31
|
"author": "hiraeeth",
|
|
28
32
|
"license": "MIT",
|
|
@@ -35,6 +39,7 @@
|
|
|
35
39
|
},
|
|
36
40
|
"homepage": "https://docs.nemu.cc",
|
|
37
41
|
"dependencies": {
|
|
38
|
-
"@nemu-ai/sdk": "^1.1.0"
|
|
42
|
+
"@nemu-ai/sdk": "^1.1.0",
|
|
43
|
+
"zod": "^4.1.0"
|
|
39
44
|
}
|
|
40
45
|
}
|