nexum-code 0.7.0 → 0.7.9
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 +118 -118
- package/dist/{app-DDsPnVUr.mjs → app-ZXJgoL2e.mjs} +3071 -494
- package/dist/{esm-RYfZ46Tf.mjs → esm-BUC7tIMB.mjs} +1 -1
- package/dist/main.mjs +1 -1
- package/package.json +92 -88
- package/scripts/postinstall.mjs +102 -115
- package/dist/pdf-F2kQiIQy.mjs +0 -26642
- package/dist/pdf.worker-ByxNbF6P.mjs +0 -82061
- package/dist/{index.min-D4utBuC7.mjs → index.min-DtYFUEA3.mjs} +1 -1
- package/dist/{src-BxVYaO-v.mjs → src-C6XAfwit.mjs} +1 -1
|
@@ -4,7 +4,7 @@ import { dirname as __cjsShimDirname } from 'node:path';
|
|
|
4
4
|
const __filename = __cjsShimFileURLToPath(import.meta.url);
|
|
5
5
|
const __dirname = __cjsShimDirname(__filename);
|
|
6
6
|
import { a as __toESM, i as __require, t as __commonJSMin } from "./chunk-apG1qJts.mjs";
|
|
7
|
-
import { t as uo } from "./index.min-
|
|
7
|
+
import { t as uo } from "./index.min-DtYFUEA3.mjs";
|
|
8
8
|
import fs from "fs";
|
|
9
9
|
import https from "https";
|
|
10
10
|
import path from "path";
|
package/dist/main.mjs
CHANGED
|
@@ -6,7 +6,7 @@ const __dirname = __cjsShimDirname(__filename);
|
|
|
6
6
|
import "./suppress-sqlite-warning-C2VB0doZ.mjs";
|
|
7
7
|
//#region src/main.ts
|
|
8
8
|
try {
|
|
9
|
-
(await import("./app-
|
|
9
|
+
(await import("./app-ZXJgoL2e.mjs")).main();
|
|
10
10
|
} catch (error) {
|
|
11
11
|
process.stderr.write(`${error instanceof Error ? error.stack ?? error.message : String(error)}\n`);
|
|
12
12
|
process.exit(1);
|
package/package.json
CHANGED
|
@@ -1,88 +1,92 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "nexum-code",
|
|
3
|
-
"version": "0.7.
|
|
4
|
-
"description": "A terminal-native AI agent for builders",
|
|
5
|
-
"license": "MIT",
|
|
6
|
-
"author": "NexumCli",
|
|
7
|
-
"homepage": "https://github.com/Hsssliu/nexum-code/tree/main/apps/nexum-code#readme",
|
|
8
|
-
"repository": {
|
|
9
|
-
"type": "git",
|
|
10
|
-
"url": "git+https://github.com/Hsssliu/nexum-code.git",
|
|
11
|
-
"directory": "apps/nexum-code"
|
|
12
|
-
},
|
|
13
|
-
"bugs": {
|
|
14
|
-
"url": "https://github.com/Hsssliu/nexum-code/issues"
|
|
15
|
-
},
|
|
16
|
-
"keywords": [
|
|
17
|
-
"nexum",
|
|
18
|
-
"nexum-code",
|
|
19
|
-
"cli",
|
|
20
|
-
"agent",
|
|
21
|
-
"coding-agent",
|
|
22
|
-
"ai",
|
|
23
|
-
"tui"
|
|
24
|
-
],
|
|
25
|
-
"bin": {
|
|
26
|
-
"nexum": "dist/main.mjs"
|
|
27
|
-
},
|
|
28
|
-
"files": [
|
|
29
|
-
"dist",
|
|
30
|
-
"icon.ico",
|
|
31
|
-
"scripts/postinstall.mjs",
|
|
32
|
-
"scripts/postinstall"
|
|
33
|
-
],
|
|
34
|
-
"type": "module",
|
|
35
|
-
"imports": {
|
|
36
|
-
"#*": [
|
|
37
|
-
"./src/*.ts",
|
|
38
|
-
"./src/*/index.ts"
|
|
39
|
-
],
|
|
40
|
-
"#constant/app": "./src/constant/app.ts",
|
|
41
|
-
"#constant/*": "./src/constant/*.ts"
|
|
42
|
-
},
|
|
43
|
-
"publishConfig": {
|
|
44
|
-
"access": "public",
|
|
45
|
-
"provenance": true
|
|
46
|
-
},
|
|
47
|
-
"
|
|
48
|
-
"
|
|
49
|
-
"
|
|
50
|
-
"
|
|
51
|
-
"
|
|
52
|
-
"
|
|
53
|
-
"
|
|
54
|
-
"
|
|
55
|
-
"
|
|
56
|
-
"
|
|
57
|
-
"
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
"@
|
|
64
|
-
"@
|
|
65
|
-
"
|
|
66
|
-
"@
|
|
67
|
-
"
|
|
68
|
-
"
|
|
69
|
-
"
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
"
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
"
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
"
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
"
|
|
82
|
-
"
|
|
83
|
-
"
|
|
84
|
-
"
|
|
85
|
-
"
|
|
86
|
-
"
|
|
87
|
-
|
|
88
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "nexum-code",
|
|
3
|
+
"version": "0.7.9",
|
|
4
|
+
"description": "A terminal-native AI agent for builders",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"author": "NexumCli",
|
|
7
|
+
"homepage": "https://github.com/Hsssliu/nexum-code/tree/main/apps/nexum-code#readme",
|
|
8
|
+
"repository": {
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "git+https://github.com/Hsssliu/nexum-code.git",
|
|
11
|
+
"directory": "apps/nexum-code"
|
|
12
|
+
},
|
|
13
|
+
"bugs": {
|
|
14
|
+
"url": "https://github.com/Hsssliu/nexum-code/issues"
|
|
15
|
+
},
|
|
16
|
+
"keywords": [
|
|
17
|
+
"nexum",
|
|
18
|
+
"nexum-code",
|
|
19
|
+
"cli",
|
|
20
|
+
"agent",
|
|
21
|
+
"coding-agent",
|
|
22
|
+
"ai",
|
|
23
|
+
"tui"
|
|
24
|
+
],
|
|
25
|
+
"bin": {
|
|
26
|
+
"nexum": "dist/main.mjs"
|
|
27
|
+
},
|
|
28
|
+
"files": [
|
|
29
|
+
"dist",
|
|
30
|
+
"icon.ico",
|
|
31
|
+
"scripts/postinstall.mjs",
|
|
32
|
+
"scripts/postinstall"
|
|
33
|
+
],
|
|
34
|
+
"type": "module",
|
|
35
|
+
"imports": {
|
|
36
|
+
"#*": [
|
|
37
|
+
"./src/*.ts",
|
|
38
|
+
"./src/*/index.ts"
|
|
39
|
+
],
|
|
40
|
+
"#constant/app": "./src/constant/app.ts",
|
|
41
|
+
"#constant/*": "./src/constant/*.ts"
|
|
42
|
+
},
|
|
43
|
+
"publishConfig": {
|
|
44
|
+
"access": "public",
|
|
45
|
+
"provenance": true
|
|
46
|
+
},
|
|
47
|
+
"scripts": {
|
|
48
|
+
"build": "tsdown",
|
|
49
|
+
"dev": "node scripts/dev.mjs",
|
|
50
|
+
"dev:cli-only": "tsx --import ../../build/register-raw-text-loader.mjs ./src/main.ts",
|
|
51
|
+
"dev:prod": "node dist/main.mjs",
|
|
52
|
+
"clean": "rm -rf dist",
|
|
53
|
+
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
54
|
+
"test": "pnpm -w run build:packages && vitest run",
|
|
55
|
+
"e2e": "pnpm -w run build:packages && NEXUM_E2E=1 vitest run test/e2e",
|
|
56
|
+
"e2e:real": "pnpm -w run build:packages && NEXUM_E2E_REAL=1 vitest run test/e2e/real-llm-smoke.e2e.test.ts",
|
|
57
|
+
"preinstall": "node -e \"console.log('\\n正在安装 nexum-code,请稍候...\\n')\"",
|
|
58
|
+
"postinstall": "node scripts/postinstall.mjs",
|
|
59
|
+
"smoke": "node dist/main.mjs --version"
|
|
60
|
+
},
|
|
61
|
+
"dependencies": {
|
|
62
|
+
"@earendil-works/pi-tui": "^0.80.2",
|
|
63
|
+
"@mariozechner/clipboard": "^0.3.2",
|
|
64
|
+
"@napi-rs/canvas": "1.0.1",
|
|
65
|
+
"@tesseract.js-data/chi_sim": "^1.0.0",
|
|
66
|
+
"@tesseract.js-data/eng": "^1.0.0",
|
|
67
|
+
"chalk": "^5.4.1",
|
|
68
|
+
"cli-highlight": "^2.1.11",
|
|
69
|
+
"commander": "^13.1.0",
|
|
70
|
+
"diff": "^9.0.0",
|
|
71
|
+
"pdfjs-dist": "^5.3.0",
|
|
72
|
+
"semver": "^7.7.4",
|
|
73
|
+
"smol-toml": "^1.6.1",
|
|
74
|
+
"tesseract.js": "^7.0.0",
|
|
75
|
+
"zod": "^4.3.6"
|
|
76
|
+
},
|
|
77
|
+
"optionalDependencies": {
|
|
78
|
+
"canvas": "3.2.0"
|
|
79
|
+
},
|
|
80
|
+
"devDependencies": {
|
|
81
|
+
"@modelcontextprotocol/sdk": "^1.29.0",
|
|
82
|
+
"@nexum-cli/config": "workspace:^",
|
|
83
|
+
"@nexum-cli/migration-legacy": "workspace:^",
|
|
84
|
+
"@nexum-cli/nexum-code-sdk": "workspace:^",
|
|
85
|
+
"@nexum-code/memory": "workspace:*",
|
|
86
|
+
"@types/semver": "^7.7.0",
|
|
87
|
+
"tsx": "^4.22.4"
|
|
88
|
+
},
|
|
89
|
+
"engines": {
|
|
90
|
+
"node": ">=22.19.0"
|
|
91
|
+
}
|
|
92
|
+
}
|
package/scripts/postinstall.mjs
CHANGED
|
@@ -100,15 +100,15 @@
|
|
|
100
100
|
* of the migration.
|
|
101
101
|
*/
|
|
102
102
|
|
|
103
|
-
import {
|
|
104
|
-
detectPackageManager,
|
|
105
|
-
findFirstResolvableNexum,
|
|
106
|
-
isGlobalInstall,
|
|
107
|
-
ownPackageRoot,
|
|
108
|
-
postinstallPaths,
|
|
109
|
-
} from './postinstall/reach.mjs';
|
|
110
|
-
import { execFile } from 'node:child_process';
|
|
111
|
-
import { access } from 'node:fs/promises';
|
|
103
|
+
import {
|
|
104
|
+
detectPackageManager,
|
|
105
|
+
findFirstResolvableNexum,
|
|
106
|
+
isGlobalInstall,
|
|
107
|
+
ownPackageRoot,
|
|
108
|
+
postinstallPaths,
|
|
109
|
+
} from './postinstall/reach.mjs';
|
|
110
|
+
import { execFile } from 'node:child_process';
|
|
111
|
+
import { access } from 'node:fs/promises';
|
|
112
112
|
import {
|
|
113
113
|
classifyShim,
|
|
114
114
|
deleteShim,
|
|
@@ -124,15 +124,15 @@ import {
|
|
|
124
124
|
notify,
|
|
125
125
|
} from './postinstall/ui.mjs';
|
|
126
126
|
|
|
127
|
-
async function main() {
|
|
127
|
+
async function main() {
|
|
128
128
|
// Step 1: skip non-global installs (npx, local project deps,
|
|
129
129
|
// workspace bootstraps). Windows is supported natively; the
|
|
130
130
|
// platform-specific bits (PATHEXT-aware PATH walk, whole-file
|
|
131
131
|
// marker sniff for uv's launcher .exe, extension-preserving
|
|
132
132
|
// rename) live in the helpers.
|
|
133
|
-
if (!isGlobalInstall()) return;
|
|
134
|
-
|
|
135
|
-
await ensureDocumentOcrRuntime();
|
|
133
|
+
if (!isGlobalInstall()) return;
|
|
134
|
+
|
|
135
|
+
await ensureDocumentOcrRuntime();
|
|
136
136
|
|
|
137
137
|
// Step 2: locate our own installed package root once and share it
|
|
138
138
|
// with both detection (skip files inside our package) and
|
|
@@ -266,108 +266,95 @@ async function main() {
|
|
|
266
266
|
},
|
|
267
267
|
pm,
|
|
268
268
|
);
|
|
269
|
-
}
|
|
270
|
-
|
|
271
|
-
async function ensureDocumentOcrRuntime() {
|
|
272
|
-
if (process.env.NEXUM_DOC_SKIP_OCR_SETUP === '1') return;
|
|
273
|
-
|
|
274
|
-
try {
|
|
275
|
-
|
|
276
|
-
if (executable === undefined
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
'
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
}
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
}
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
return new Promise((resolve, reject) => {
|
|
359
|
-
execFile(command, args, { windowsHide: true, maxBuffer: 16 * 1024 * 1024 }, (error, stdout, stderr) => {
|
|
360
|
-
if (error) {
|
|
361
|
-
reject(new Error(stderr || error.message));
|
|
362
|
-
return;
|
|
363
|
-
}
|
|
364
|
-
resolve({ stdout, stderr });
|
|
365
|
-
});
|
|
366
|
-
});
|
|
367
|
-
}
|
|
368
|
-
|
|
369
|
-
try {
|
|
370
|
-
createDesktopShortcut();
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
async function ensureDocumentOcrRuntime() {
|
|
272
|
+
if (process.env.NEXUM_DOC_SKIP_OCR_SETUP === '1') return;
|
|
273
|
+
|
|
274
|
+
try {
|
|
275
|
+
const executable = await findTesseractExecutable();
|
|
276
|
+
if (executable === undefined) {
|
|
277
|
+
return;
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
const languages = await listTesseractLanguages(executable);
|
|
281
|
+
if (!languages.includes('chi_sim')) {
|
|
282
|
+
notify(
|
|
283
|
+
'[nexum-code] /doc OCR note: Tesseract is installed, but chi_sim language data was not found. ' +
|
|
284
|
+
'Nexum will fall back to bundled npm OCR data for Chinese OCR.',
|
|
285
|
+
);
|
|
286
|
+
}
|
|
287
|
+
} catch (error) {
|
|
288
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
289
|
+
notify(`[nexum-code] /doc OCR setup warning: ${message}`);
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
async function findTesseractExecutable() {
|
|
294
|
+
const configured = process.env.NEXUM_TESSERACT_PATH;
|
|
295
|
+
if (configured !== undefined && configured.length > 0 && await fileExists(configured)) {
|
|
296
|
+
return configured;
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
if (await commandWorks('tesseract', ['--version'])) {
|
|
300
|
+
return 'tesseract';
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
if (process.platform === 'win32') {
|
|
304
|
+
const candidates = [
|
|
305
|
+
'C:\\Program Files\\Tesseract-OCR\\tesseract.exe',
|
|
306
|
+
'C:\\Program Files (x86)\\Tesseract-OCR\\tesseract.exe',
|
|
307
|
+
];
|
|
308
|
+
for (const candidate of candidates) {
|
|
309
|
+
if (await fileExists(candidate)) {
|
|
310
|
+
return candidate;
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
return undefined;
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
async function listTesseractLanguages(executable) {
|
|
319
|
+
const { stdout } = await execFileQuiet(executable, ['--list-langs']);
|
|
320
|
+
return stdout
|
|
321
|
+
.split(/\r?\n/g)
|
|
322
|
+
.map((line) => line.trim())
|
|
323
|
+
.filter((line) => line.length > 0 && !line.startsWith('List of available languages'));
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
async function commandWorks(command, args) {
|
|
327
|
+
try {
|
|
328
|
+
await execFileQuiet(command, args);
|
|
329
|
+
return true;
|
|
330
|
+
} catch {
|
|
331
|
+
return false;
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
async function fileExists(filePath) {
|
|
336
|
+
try {
|
|
337
|
+
await access(filePath);
|
|
338
|
+
return true;
|
|
339
|
+
} catch {
|
|
340
|
+
return false;
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
function execFileQuiet(command, args) {
|
|
345
|
+
return new Promise((resolve, reject) => {
|
|
346
|
+
execFile(command, args, { windowsHide: true, maxBuffer: 16 * 1024 * 1024 }, (error, stdout, stderr) => {
|
|
347
|
+
if (error) {
|
|
348
|
+
reject(new Error(stderr || error.message));
|
|
349
|
+
return;
|
|
350
|
+
}
|
|
351
|
+
resolve({ stdout, stderr });
|
|
352
|
+
});
|
|
353
|
+
});
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
try {
|
|
357
|
+
createDesktopShortcut();
|
|
371
358
|
} catch {
|
|
372
359
|
// Never fail the install over a shortcut.
|
|
373
360
|
}
|