nexum-code 0.7.0 → 0.7.10

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.
@@ -88,7 +88,7 @@ var require_tokenizers = /* @__PURE__ */ __commonJSMin(((exports, module) => {
88
88
  localFileExisted = existsSync(join(__dirname, "tokenizers.darwin-universal.node"));
89
89
  try {
90
90
  if (localFileExisted) nativeBinding = __require("./tokenizers.darwin-universal.node");
91
- else nativeBinding = __require("@anush008/tokenizers-darwin-universal");
91
+ else nativeBinding = __require("./assets/tokenizers.darwin-universal-BJ7w7c9-.node");
92
92
  break;
93
93
  } catch {}
94
94
  switch (arch) {
@@ -138,7 +138,7 @@ var require_tokenizers = /* @__PURE__ */ __commonJSMin(((exports, module) => {
138
138
  localFileExisted = existsSync(join(__dirname, "tokenizers.linux-x64-gnu.node"));
139
139
  try {
140
140
  if (localFileExisted) nativeBinding = __require("./tokenizers.linux-x64-gnu.node");
141
- else nativeBinding = __require("@anush008/tokenizers-linux-x64-gnu");
141
+ else nativeBinding = __require("./assets/tokenizers.linux-x64-gnu-BGGFQRsL.node");
142
142
  } catch (e) {
143
143
  loadError = e;
144
144
  }
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-DDsPnVUr.mjs")).main();
9
+ (await import("./app-MzrtWfvw.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,91 @@
1
- {
2
- "name": "nexum-code",
3
- "version": "0.7.0",
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
- "dependencies": {
48
- "@earendil-works/pi-tui": "^0.80.2",
49
- "@mariozechner/clipboard": "^0.3.2",
50
- "@napi-rs/canvas": "1.0.1",
51
- "chalk": "^5.4.1",
52
- "cli-highlight": "^2.1.11",
53
- "commander": "^13.1.0",
54
- "diff": "^9.0.0",
55
- "semver": "^7.7.4",
56
- "smol-toml": "^1.6.1",
57
- "zod": "^4.3.6"
58
- },
59
- "optionalDependencies": {
60
- "canvas": "3.2.0"
61
- },
62
- "devDependencies": {
63
- "@modelcontextprotocol/sdk": "^1.29.0",
64
- "@types/semver": "^7.7.0",
65
- "tsx": "^4.22.4",
66
- "@nexum-cli/migration-legacy": "^0.7.0",
67
- "@nexum-cli/config": "^0.7.0",
68
- "@nexum-cli/nexum-code-sdk": "^0.7.0",
69
- "@nexum-code/memory": "0.7.0"
70
- },
71
- "engines": {
72
- "node": ">=22.19.0"
73
- },
74
- "scripts": {
75
- "build": "tsdown",
76
- "dev": "node scripts/dev.mjs",
77
- "dev:cli-only": "tsx --import ../../build/register-raw-text-loader.mjs ./src/main.ts",
78
- "dev:prod": "node dist/main.mjs",
79
- "clean": "rm -rf dist",
80
- "typecheck": "tsc -p tsconfig.json --noEmit",
81
- "test": "pnpm -w run build:packages && vitest run",
82
- "e2e": "pnpm -w run build:packages && NEXUM_E2E=1 vitest run test/e2e",
83
- "e2e:real": "pnpm -w run build:packages && NEXUM_E2E_REAL=1 vitest run test/e2e/real-llm-smoke.e2e.test.ts",
84
- "preinstall": "node -e \"console.log('\\n正在安装 nexum-code,请稍候...\\n')\"",
85
- "postinstall": "node scripts/postinstall.mjs",
86
- "smoke": "node dist/main.mjs --version"
87
- }
88
- }
1
+ {
2
+ "name": "nexum-code",
3
+ "version": "0.7.10",
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
+ },
46
+ "scripts": {
47
+ "build": "tsdown",
48
+ "dev": "node scripts/dev.mjs",
49
+ "dev:cli-only": "tsx --import ../../build/register-raw-text-loader.mjs ./src/main.ts",
50
+ "dev:prod": "node dist/main.mjs",
51
+ "clean": "rm -rf dist",
52
+ "typecheck": "tsc -p tsconfig.json --noEmit",
53
+ "test": "pnpm -w run build:packages && vitest run",
54
+ "e2e": "pnpm -w run build:packages && NEXUM_E2E=1 vitest run test/e2e",
55
+ "e2e:real": "pnpm -w run build:packages && NEXUM_E2E_REAL=1 vitest run test/e2e/real-llm-smoke.e2e.test.ts",
56
+ "preinstall": "node -e \"console.log('\\n正在安装 nexum-code,请稍候...\\n')\"",
57
+ "postinstall": "node scripts/postinstall.mjs",
58
+ "smoke": "node dist/main.mjs --version"
59
+ },
60
+ "dependencies": {
61
+ "@earendil-works/pi-tui": "^0.80.2",
62
+ "@mariozechner/clipboard": "^0.3.2",
63
+ "@napi-rs/canvas": "1.0.1",
64
+ "@tesseract.js-data/chi_sim": "^1.0.0",
65
+ "@tesseract.js-data/eng": "^1.0.0",
66
+ "chalk": "^5.4.1",
67
+ "cli-highlight": "^2.1.11",
68
+ "commander": "^13.1.0",
69
+ "diff": "^9.0.0",
70
+ "pdfjs-dist": "^5.3.0",
71
+ "semver": "^7.7.4",
72
+ "smol-toml": "^1.6.1",
73
+ "tesseract.js": "^7.0.0",
74
+ "zod": "^4.3.6"
75
+ },
76
+ "optionalDependencies": {
77
+ "canvas": "3.2.0"
78
+ },
79
+ "devDependencies": {
80
+ "@modelcontextprotocol/sdk": "^1.29.0",
81
+ "@nexum-cli/config": "workspace:^",
82
+ "@nexum-cli/migration-legacy": "workspace:^",
83
+ "@nexum-cli/nexum-code-sdk": "workspace:^",
84
+ "@nexum-code/memory": "workspace:*",
85
+ "@types/semver": "^7.7.0",
86
+ "tsx": "^4.22.4"
87
+ },
88
+ "engines": {
89
+ "node": ">=22.19.0"
90
+ }
91
+ }
@@ -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,27 +266,14 @@ async function main() {
266
266
  },
267
267
  pm,
268
268
  );
269
- }
270
-
269
+ }
270
+
271
271
  async function ensureDocumentOcrRuntime() {
272
272
  if (process.env.NEXUM_DOC_SKIP_OCR_SETUP === '1') return;
273
273
 
274
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
-
275
+ const executable = await findTesseractExecutable();
288
276
  if (executable === undefined) {
289
- notify('[nexum-code] /doc OCR note: scanned images need Tesseract OCR. Text PDF, DOCX, and Excel still work.');
290
277
  return;
291
278
  }
292
279
 
@@ -294,80 +281,80 @@ async function ensureDocumentOcrRuntime() {
294
281
  if (!languages.includes('chi_sim')) {
295
282
  notify(
296
283
  '[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.',
284
+ 'Nexum will fall back to bundled npm OCR data for Chinese OCR.',
298
285
  );
299
286
  }
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();
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
  }