nexum-code 0.6.16 → 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.
@@ -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-D4utBuC7.mjs";
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-0T4efY5b.mjs")).main();
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.6.16",
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.78.1",
63
- "@mariozechner/clipboard": "^0.3.2",
64
- "@napi-rs/canvas": "1.0.1",
65
- "chalk": "^5.4.1",
66
- "cli-highlight": "^2.1.11",
67
- "commander": "^13.1.0",
68
- "semver": "^7.7.4",
69
- "smol-toml": "^1.6.1",
70
- "zod": "^4.3.6"
71
- },
72
- "optionalDependencies": {
73
- "canvas": "3.2.0"
74
- },
75
- "devDependencies": {
76
- "@modelcontextprotocol/sdk": "^1.29.0",
77
- "@nexum-cli/agent-core": "workspace:^",
78
- "@nexum-cli/config": "workspace:^",
79
- "@nexum-cli/migration-legacy": "workspace:^",
80
- "@nexum-cli/nexum-code-sdk": "workspace:^",
81
- "@nexum-code/memory": "workspace:*",
82
- "@types/semver": "^7.7.0",
83
- "tsx": "^4.22.4"
84
- },
85
- "engines": {
86
- "node": ">=22.19.0"
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
+ }
@@ -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
- let executable = await findTesseractExecutable();
276
- if (executable === undefined && process.platform === 'win32' && await commandWorks('winget', ['--version'])) {
277
- await execFileQuiet('winget', [
278
- 'install',
279
- '--id',
280
- 'UB-Mannheim.TesseractOCR',
281
- '-e',
282
- '--accept-package-agreements',
283
- '--accept-source-agreements',
284
- ]);
285
- executable = await findTesseractExecutable();
286
- }
287
-
288
- if (executable === undefined) {
289
- notify('[nexum-code] /doc OCR note: scanned images need Tesseract OCR. Text PDF, DOCX, and Excel still work.');
290
- return;
291
- }
292
-
293
- const languages = await listTesseractLanguages(executable);
294
- if (!languages.includes('chi_sim')) {
295
- notify(
296
- '[nexum-code] /doc OCR note: Tesseract is installed, but chi_sim language data was not found. ' +
297
- 'Chinese OCR needs chi_sim.traineddata or NEXUM_OCR_LANGUAGE=eng for English-only OCR.',
298
- );
299
- }
300
- } catch (error) {
301
- const message = error instanceof Error ? error.message : String(error);
302
- notify(`[nexum-code] /doc OCR setup warning: ${message}`);
303
- }
304
- }
305
-
306
- async function findTesseractExecutable() {
307
- const configured = process.env.NEXUM_TESSERACT_PATH;
308
- if (configured !== undefined && configured.length > 0 && await fileExists(configured)) {
309
- return configured;
310
- }
311
-
312
- if (await commandWorks('tesseract', ['--version'])) {
313
- return 'tesseract';
314
- }
315
-
316
- if (process.platform === 'win32') {
317
- const candidates = [
318
- 'C:\\Program Files\\Tesseract-OCR\\tesseract.exe',
319
- 'C:\\Program Files (x86)\\Tesseract-OCR\\tesseract.exe',
320
- ];
321
- for (const candidate of candidates) {
322
- if (await fileExists(candidate)) {
323
- return candidate;
324
- }
325
- }
326
- }
327
-
328
- return undefined;
329
- }
330
-
331
- async function listTesseractLanguages(executable) {
332
- const { stdout } = await execFileQuiet(executable, ['--list-langs']);
333
- return stdout
334
- .split(/\r?\n/g)
335
- .map((line) => line.trim())
336
- .filter((line) => line.length > 0 && !line.startsWith('List of available languages'));
337
- }
338
-
339
- async function commandWorks(command, args) {
340
- try {
341
- await execFileQuiet(command, args);
342
- return true;
343
- } catch {
344
- return false;
345
- }
346
- }
347
-
348
- async function fileExists(filePath) {
349
- try {
350
- await access(filePath);
351
- return true;
352
- } catch {
353
- return false;
354
- }
355
- }
356
-
357
- function execFileQuiet(command, args) {
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
  }