nex-code 0.3.5 → 0.3.7

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/package.json CHANGED
@@ -1,13 +1,12 @@
1
1
  {
2
2
  "name": "nex-code",
3
- "version": "0.3.5",
3
+ "version": "0.3.7",
4
4
  "description": "Nex Code — Agentic Coding CLI with Multi-Provider Support",
5
5
  "bin": {
6
- "nex-code": "./bin/nex-code.js"
6
+ "nex-code": "./dist/nex-code.js"
7
7
  },
8
8
  "files": [
9
- "bin/",
10
- "cli/",
9
+ "dist/",
11
10
  "README.md",
12
11
  "LICENSE"
13
12
  ],
@@ -15,12 +14,14 @@
15
14
  "node": ">=18.0.0"
16
15
  },
17
16
  "scripts": {
18
- "start": "node bin/nex-code.js",
17
+ "start": "node dist/nex-code.js",
18
+ "build": "esbuild bin/nex-code.js --bundle --platform=node --target=node18 --outfile=dist/nex-code.js --minify --external:axios --external:dotenv",
19
19
  "test": "jest --coverage",
20
20
  "test:watch": "jest --watch",
21
21
  "format": "prettier --write .",
22
22
  "install-hooks": "ln -sf ../../hooks/pre-push .git/hooks/pre-push && chmod +x .git/hooks/pre-push && ln -sf ../../hooks/post-merge .git/hooks/post-merge && chmod +x .git/hooks/post-merge && echo 'Hooks installed (pre-push, post-merge).'",
23
- "prepublishOnly": "npm test"
23
+ "prepublishOnly": "npm run build && npm test",
24
+ "release": "npm version patch && git push --follow-tags && npm publish"
24
25
  },
25
26
  "keywords": [
26
27
  "cli",
@@ -49,6 +50,7 @@
49
50
  "dotenv": "^16.4.0"
50
51
  },
51
52
  "devDependencies": {
53
+ "esbuild": "^0.27.3",
52
54
  "jest": "^29.7.0"
53
55
  }
54
56
  }
package/bin/nex-code.js DELETED
@@ -1,99 +0,0 @@
1
- #!/usr/bin/env node
2
- /**
3
- * Nex Code — Agentic Coding CLI
4
- * Entrypoint: loads .env, parses CLI flags, starts REPL or headless mode.
5
- */
6
-
7
- const path = require('path');
8
-
9
- // Load .env from CLI install dir (fallback) and project dir
10
- require('dotenv').config({ path: path.join(__dirname, '..', '.env') });
11
- require('dotenv').config(); // Also check CWD
12
-
13
- const args = process.argv.slice(2);
14
-
15
- // ─── --help / -h ──────────────────────────────────────────────
16
- if (args.includes('--help') || args.includes('-h')) {
17
- console.log(`Usage: nex-code [options]
18
-
19
- Options:
20
- --task <prompt> Run a single task and exit (headless mode)
21
- --auto Skip all confirmations (implies --task)
22
- --yolo, -yolo Skip all confirmations (interactive YOLO mode)
23
- --model <spec> Set model (e.g. openai:gpt-4o)
24
- --max-turns <n> Max agentic loop iterations (default: 50)
25
- --json Output result as JSON (for CI parsing)
26
- -h, --help Show this help
27
- -v, --version Show version
28
- `);
29
- process.exit(0);
30
- }
31
-
32
- // ─── --version / -v ───────────────────────────────────────────
33
- if (args.includes('-v') || args.includes('--version')) {
34
- const pkg = require('../package.json');
35
- console.log(pkg.version);
36
- process.exit(0);
37
- }
38
-
39
- // ─── --yolo / -yolo ──────────────────────────────────────────
40
- const yoloMode = args.includes('--yolo') || args.includes('-yolo');
41
- if (yoloMode) {
42
- const { setAutoConfirm } = require('../cli/safety');
43
- setAutoConfirm(true);
44
- }
45
-
46
- // ─── --model ──────────────────────────────────────────────────
47
- const modelIdx = args.indexOf('--model');
48
- if (modelIdx !== -1 && args[modelIdx + 1]) {
49
- const { setActiveModel } = require('../cli/providers/registry');
50
- setActiveModel(args[modelIdx + 1]);
51
- }
52
-
53
- // ─── --max-turns ─────────────────────────────────────────────
54
- const maxTurnsIdx = args.indexOf('--max-turns');
55
- if (maxTurnsIdx !== -1 && args[maxTurnsIdx + 1]) {
56
- const n = parseInt(args[maxTurnsIdx + 1], 10);
57
- if (n > 0) {
58
- const { setMaxIterations } = require('../cli/agent');
59
- setMaxIterations(n);
60
- }
61
- }
62
-
63
- // ─── --task (headless mode) ──────────────────────────────────
64
- const taskIdx = args.indexOf('--task');
65
- if (taskIdx !== -1) {
66
- const task = args[taskIdx + 1];
67
- if (!task || task.startsWith('--')) {
68
- console.error('--task requires a prompt');
69
- process.exit(1);
70
- }
71
-
72
- // Auto-confirm when --auto
73
- if (args.includes('--auto')) {
74
- const { setAutoConfirm } = require('../cli/safety');
75
- setAutoConfirm(true);
76
- }
77
-
78
- // Execute task
79
- const { processInput, getConversationMessages } = require('../cli/agent');
80
- processInput(task).then(() => {
81
- if (args.includes('--json')) {
82
- const msgs = getConversationMessages();
83
- const lastAssistant = msgs.filter((m) => m.role === 'assistant').pop();
84
- console.log(JSON.stringify({ success: true, response: lastAssistant?.content || '' }));
85
- }
86
- process.exit(0);
87
- }).catch((err) => {
88
- if (args.includes('--json')) {
89
- console.log(JSON.stringify({ success: false, error: err.message }));
90
- } else {
91
- console.error(err.message);
92
- }
93
- process.exit(1);
94
- });
95
- } else {
96
- // Normal REPL mode
97
- const { startREPL } = require('../cli/index');
98
- startREPL();
99
- }