nex-code 0.3.0 → 0.3.1
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 +32 -7
- package/cli/index.js +14 -6
- package/cli/sub-agent.js +16 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
</p>
|
|
14
14
|
|
|
15
15
|
<p align="center">
|
|
16
|
+
<a href="https://www.npmjs.com/package/nex-code"><img src="https://img.shields.io/npm/v/nex-code.svg" alt="npm version"></a>
|
|
16
17
|
<a href="https://github.com/hybridpicker/nex-code/actions/workflows/ci.yml"><img src="https://github.com/hybridpicker/nex-code/actions/workflows/ci.yml/badge.svg" alt="CI"></a>
|
|
17
18
|
<a href="https://opensource.org/licenses/MIT"><img src="https://img.shields.io/badge/License-MIT-blue.svg" alt="License: MIT"></a>
|
|
18
19
|
<img src="https://img.shields.io/badge/node-%3E%3D18-brightgreen.svg" alt="Node >= 18">
|
|
@@ -25,10 +26,15 @@
|
|
|
25
26
|
## Quickstart
|
|
26
27
|
|
|
27
28
|
```bash
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
29
|
+
npx nex-code
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
Or install globally:
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
npm install -g nex-code
|
|
36
|
+
cd ~/your-project
|
|
37
|
+
nex-code
|
|
32
38
|
```
|
|
33
39
|
|
|
34
40
|
That's it. You'll see the banner, your project context, and the `>` prompt. Start typing.
|
|
@@ -55,10 +61,22 @@ That's it. You'll see the banner, your project context, and the `>` prompt. Star
|
|
|
55
61
|
- Node.js 18+
|
|
56
62
|
- At least one API key **or** a local [Ollama](https://ollama.com/download) server
|
|
57
63
|
|
|
58
|
-
###
|
|
64
|
+
### Install from npm
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
npm install -g nex-code
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
Or run directly without installing:
|
|
59
71
|
|
|
60
72
|
```bash
|
|
61
|
-
|
|
73
|
+
npx nex-code
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
### Install from source (for contributors)
|
|
77
|
+
|
|
78
|
+
```bash
|
|
79
|
+
git clone https://github.com/hybridpicker/nex-code.git
|
|
62
80
|
cd nex-code
|
|
63
81
|
npm install
|
|
64
82
|
cp .env.example .env
|
|
@@ -68,7 +86,7 @@ npm run install-hooks
|
|
|
68
86
|
|
|
69
87
|
### Configure a Provider
|
|
70
88
|
|
|
71
|
-
|
|
89
|
+
Create a `.env` file in your project directory (or set environment variables):
|
|
72
90
|
|
|
73
91
|
```bash
|
|
74
92
|
# Pick any — only one is required
|
|
@@ -682,6 +700,13 @@ CI runs on GitHub Actions (Node 18/20/22).
|
|
|
682
700
|
|
|
683
701
|
Everything else is Node.js built-in.
|
|
684
702
|
|
|
703
|
+
## Installation
|
|
704
|
+
|
|
705
|
+
```bash
|
|
706
|
+
npm install -g nex-code # global install
|
|
707
|
+
npx nex-code # or run without installing
|
|
708
|
+
```
|
|
709
|
+
|
|
685
710
|
## License
|
|
686
711
|
|
|
687
712
|
MIT
|
package/cli/index.js
CHANGED
|
@@ -914,18 +914,26 @@ function startREPL() {
|
|
|
914
914
|
const { execSync } = require('child_process');
|
|
915
915
|
execSync('curl -s --max-time 2 http://localhost:11434/api/tags', { encoding: 'utf-8', stdio: 'pipe' });
|
|
916
916
|
setActiveModel('local:llama3');
|
|
917
|
-
console.log(`${C.green}Local Ollama detected — using local models${C.reset}`);
|
|
918
|
-
console.log(`${C.dim}Set API keys for cloud providers
|
|
917
|
+
console.log(`${C.green}✓ Local Ollama detected — using local models${C.reset}`);
|
|
918
|
+
console.log(`${C.dim}Tip: Set API keys for cloud providers for more model options (OPENAI_API_KEY, ANTHROPIC_API_KEY, etc.)${C.reset}\n`);
|
|
919
919
|
localDetected = true;
|
|
920
920
|
} catch {
|
|
921
921
|
// Local Ollama not available
|
|
922
922
|
}
|
|
923
923
|
}
|
|
924
924
|
if (!localDetected) {
|
|
925
|
-
console.error(
|
|
926
|
-
console.error(`${C.
|
|
927
|
-
console.error(`${C.
|
|
928
|
-
console.error(`${C.gray}
|
|
925
|
+
console.error(`\n${C.red}✗ No provider configured and no local Ollama detected.${C.reset}\n`);
|
|
926
|
+
console.error(`${C.white}nex-code needs at least one LLM provider to work.${C.reset}\n`);
|
|
927
|
+
console.error(`${C.white}Option 1 — Free local models (no API key needed):${C.reset}`);
|
|
928
|
+
console.error(`${C.gray} Install Ollama: ${C.cyan}https://ollama.com/download${C.reset}`);
|
|
929
|
+
console.error(`${C.gray} Pull a model: ${C.cyan}ollama pull qwen3-coder${C.reset}`);
|
|
930
|
+
console.error(`${C.gray} Then restart: ${C.cyan}nex-code${C.reset}\n`);
|
|
931
|
+
console.error(`${C.white}Option 2 — Cloud providers (set one in .env or as env var):${C.reset}`);
|
|
932
|
+
console.error(`${C.gray} OLLAMA_API_KEY=... ${C.dim}# Ollama Cloud (free tier available)${C.reset}`);
|
|
933
|
+
console.error(`${C.gray} OPENAI_API_KEY=... ${C.dim}# OpenAI${C.reset}`);
|
|
934
|
+
console.error(`${C.gray} ANTHROPIC_API_KEY=... ${C.dim}# Anthropic${C.reset}`);
|
|
935
|
+
console.error(`${C.gray} GEMINI_API_KEY=... ${C.dim}# Google Gemini${C.reset}\n`);
|
|
936
|
+
console.error(`${C.dim}Create a .env file in your project directory or export the variable.${C.reset}`);
|
|
929
937
|
process.exit(1);
|
|
930
938
|
}
|
|
931
939
|
}
|
package/cli/sub-agent.js
CHANGED
|
@@ -48,6 +48,7 @@ function isRetryableError(err) {
|
|
|
48
48
|
return false;
|
|
49
49
|
}
|
|
50
50
|
|
|
51
|
+
<<<<<<< Updated upstream
|
|
51
52
|
async function callWithRetry(messages, tools, options) {
|
|
52
53
|
let lastError;
|
|
53
54
|
for (let attempt = 0; attempt <= MAX_CHAT_RETRIES; attempt++) {
|
|
@@ -55,6 +56,13 @@ async function callWithRetry(messages, tools, options) {
|
|
|
55
56
|
// Use callStream (stream:true) — more reliable than callChat (stream:false)
|
|
56
57
|
// with Ollama Cloud. Silently collect the full response via no-op onToken.
|
|
57
58
|
return await callStream(messages, tools, { ...options, onToken: () => {} });
|
|
59
|
+
=======
|
|
60
|
+
async function callChatWithRetry(messages, tools, options) {
|
|
61
|
+
let lastError;
|
|
62
|
+
for (let attempt = 0; attempt <= MAX_CHAT_RETRIES; attempt++) {
|
|
63
|
+
try {
|
|
64
|
+
return await callChat(messages, tools, options);
|
|
65
|
+
>>>>>>> Stashed changes
|
|
58
66
|
} catch (err) {
|
|
59
67
|
lastError = err;
|
|
60
68
|
if (attempt < MAX_CHAT_RETRIES && isRetryableError(err)) {
|
|
@@ -216,7 +224,11 @@ ERROR RECOVERY:
|
|
|
216
224
|
|
|
217
225
|
try {
|
|
218
226
|
for (let i = 0; i < maxIter; i++) {
|
|
227
|
+
<<<<<<< Updated upstream
|
|
219
228
|
const result = await callWithRetry(messages, availableTools, chatOptions);
|
|
229
|
+
=======
|
|
230
|
+
const result = await callChatWithRetry(messages, availableTools, chatOptions);
|
|
231
|
+
>>>>>>> Stashed changes
|
|
220
232
|
|
|
221
233
|
// Guard against null/undefined responses
|
|
222
234
|
if (!result || typeof result !== 'object') {
|
|
@@ -422,4 +434,8 @@ async function executeSpawnAgents(args) {
|
|
|
422
434
|
}
|
|
423
435
|
}
|
|
424
436
|
|
|
437
|
+
<<<<<<< Updated upstream
|
|
425
438
|
module.exports = { runSubAgent, executeSpawnAgents, clearAllLocks, classifyTask, pickModelForTier, resolveSubAgentModel, isRetryableError, callWithRetry };
|
|
439
|
+
=======
|
|
440
|
+
module.exports = { runSubAgent, executeSpawnAgents, clearAllLocks, classifyTask, pickModelForTier, resolveSubAgentModel, isRetryableError, callChatWithRetry };
|
|
441
|
+
>>>>>>> Stashed changes
|