nex-code 0.3.22 → 0.3.24

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.
Files changed (3) hide show
  1. package/README.md +167 -5
  2. package/dist/nex-code.js +397 -196
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -22,7 +22,7 @@
22
22
  <img src="https://img.shields.io/badge/Ollama_Cloud-supported-brightgreen.svg" alt="Ollama Cloud: supported">
23
23
  <img src="https://img.shields.io/badge/node-%3E%3D18-brightgreen.svg" alt="Node >= 18">
24
24
  <img src="https://img.shields.io/badge/dependencies-2-green.svg" alt="Dependencies: 2">
25
- <img src="https://img.shields.io/badge/tests-1855-blue.svg" alt="Tests: 1855">
25
+ <img src="https://img.shields.io/badge/tests-1944-blue.svg" alt="Tests: 1944">
26
26
  </p>
27
27
 
28
28
  ---
@@ -81,6 +81,9 @@ npm update -g nex-code
81
81
  | **Browser agent (headless)** | ✅ Playwright-based | ❌ | ⚠️ Experimental | ❌ |
82
82
  | **Grounded web search** | ✅ Perplexity/DDG | ❌ | ✅ Google grounded | ❌ |
83
83
  | **GitHub Actions tools** | ✅ native | ❌ | ❌ | ❌ |
84
+ | **SSH server management** | ✅ native (AlmaLinux/macOS) | ❌ | ❌ | ❌ |
85
+ | **Docker tools** | ✅ local + remote via SSH | ❌ | ❌ | ❌ |
86
+ | **Deploy tool (rsync)** | ✅ named configs | ❌ | ❌ | ❌ |
84
87
  | **Open-source** | ✅ MIT | ❌ | ✅ Apache 2.0 | ✅ |
85
88
  | **Runtime dependencies** | **2** (axios, dotenv) | Many | Many | Heavy (Python) |
86
89
  | **Startup time** | **~100ms** | ~400ms | ~300ms | Slow |
@@ -154,6 +157,7 @@ DEFAULT_MODEL=qwen3-coder:480b # Active model on startup
154
157
  FALLBACK_CHAIN=anthropic,openai # Providers tried on failure (comma-separated)
155
158
  NEX_STALE_WARN_MS=60000 # Warn if no tokens received for N ms (default: 60000)
156
159
  NEX_STALE_ABORT_MS=120000 # Abort and retry stream after N ms of silence (default: 120000)
160
+ NEX_LANGUAGE=auto # Response language: "auto" (mirrors user's language, default) or e.g. "English", "Deutsch"
157
161
  ```
158
162
 
159
163
  ### Verify
@@ -319,6 +323,17 @@ Type `/` to see inline suggestions as you type. Tab completion is supported for
319
323
  | `/remember <text>` | Save a memory (persists across sessions) |
320
324
  | `/forget <key>` | Delete a memory |
321
325
  | `/memory` | Show all memories |
326
+ | `/brain add <name>` | Add a document to the knowledge base |
327
+ | `/brain list` | List all brain documents |
328
+ | `/brain search <query>` | Search the knowledge base |
329
+ | `/brain show <name>` | Show a brain document |
330
+ | `/brain remove <name>` | Remove a brain document |
331
+ | `/brain rebuild` | Rebuild keyword index |
332
+ | `/brain embed` | Build/rebuild embedding index |
333
+ | `/brain status` | Show brain status (docs, index, embeddings) |
334
+ | `/brain review` | Review pending brain changes (git diff) |
335
+ | `/brain undo` | Undo last brain write |
336
+ | `/learn` | Reflect on session and auto-update memory + NEX.md |
322
337
  | `/permissions` | Show tool permissions |
323
338
  | `/allow <tool>` | Auto-allow a tool |
324
339
  | `/deny <tool>` | Block a tool |
@@ -335,14 +350,16 @@ Type `/` to see inline suggestions as you type. Tab completion is supported for
335
350
  | `/redo` | Redo last undone change |
336
351
  | `/history` | Show file change history |
337
352
  | `/review [file]` | Code review on current diff or a specific file |
353
+ | `/k8s [user@host]` | Kubernetes overview: namespaces + pod health (remote via SSH optional) |
338
354
  | `/exit` | Quit |
339
355
 
340
356
  ---
341
357
 
342
358
  ## Tools
343
359
 
344
- The agent has 17 built-in tools:
360
+ The agent has 39 built-in tools:
345
361
 
362
+ ### Core & File System
346
363
  | Tool | Description |
347
364
  |------|-------------|
348
365
  | `bash` | Execute shell commands (90s timeout, 5MB buffer) |
@@ -354,21 +371,67 @@ The agent has 17 built-in tools:
354
371
  | `search_files` | Regex search across files (like grep) |
355
372
  | `glob` | Fast file search by name/extension pattern |
356
373
  | `grep` | Content search with regex and line numbers |
374
+
375
+ ### Git & Web
376
+ | Tool | Description |
377
+ |------|-------------|
357
378
  | `git_status` | Git working tree status |
358
379
  | `git_diff` | Git diff with optional path filter |
359
380
  | `git_log` | Git commit history with configurable count |
360
381
  | `web_fetch` | Fetch content from a URL |
361
382
  | `web_search` | Grounded search via Perplexity (if `PERPLEXITY_API_KEY` set) or DuckDuckGo |
383
+
384
+ ### Interaction & Agents
385
+ | Tool | Description |
386
+ |------|-------------|
362
387
  | `ask_user` | Ask the user a question and wait for input |
363
388
  | `task_list` | Create and manage task lists for multi-step operations |
364
389
  | `spawn_agents` | Run parallel sub-agents with auto model routing |
390
+ | `switch_model` | Switch active model mid-conversation |
391
+
392
+ ### Browser (optional — requires Playwright)
393
+ | Tool | Description |
394
+ |------|-------------|
365
395
  | `browser_open` | Open URL in headless browser, return text + links (JS-heavy pages) |
366
396
  | `browser_screenshot` | Screenshot a URL → saved file + vision-ready path |
367
397
  | `browser_click` | Click element by CSS selector or visible text |
368
398
  | `browser_fill` | Fill form field and optionally submit |
399
+
400
+ ### GitHub Actions
401
+ | Tool | Description |
402
+ |------|-------------|
369
403
  | `gh_run_list` | List GitHub Actions workflow runs |
370
404
  | `gh_run_view` | View run details and step logs |
371
405
  | `gh_workflow_trigger` | Trigger a workflow dispatch event |
406
+ | `k8s_pods` | List Kubernetes pods (local kubectl or remote via SSH) |
407
+ | `k8s_logs` | Fetch pod logs with `--tail` / `--since` filtering |
408
+ | `k8s_exec` | Run a command inside a pod (with confirmation) |
409
+ | `k8s_apply` | Apply a manifest file — `dry_run` mode supported (with confirmation) |
410
+ | `k8s_rollout` | Rollout status / restart / history / undo for deployments |
411
+
412
+ ### SSH & Server Management
413
+ Requires `.nex/servers.json` — run `/init` to configure. See [Server Management](#server-management).
414
+
415
+ | Tool | Description |
416
+ |------|-------------|
417
+ | `ssh_exec` | Execute a command on a remote server via SSH |
418
+ | `ssh_upload` | Upload a file or directory via SCP |
419
+ | `ssh_download` | Download a file or directory via SCP |
420
+ | `service_manage` | Start/stop/restart/reload/enable/disable a systemd service (local or remote) |
421
+ | `service_logs` | Fetch journalctl logs (local or remote, with `--since` support) |
422
+
423
+ ### Docker
424
+ | Tool | Description |
425
+ |------|-------------|
426
+ | `container_list` | List Docker containers (local or remote via SSH) |
427
+ | `container_logs` | Fetch Docker container logs (`--tail`, `--since`) |
428
+ | `container_exec` | Execute a command inside a running container |
429
+ | `container_manage` | Start/stop/restart/remove/inspect a container |
430
+
431
+ ### Deploy
432
+ | Tool | Description |
433
+ |------|-------------|
434
+ | `deploy` | rsync files to a remote server + optional post-deploy script. Supports named configs from `.nex/deploy.json`. |
372
435
 
373
436
  **Interactive commands** (vim, top, htop, ssh, tmux, fzf, etc.) are automatically detected and spawned with full TTY passthrough — no separate handling required.
374
437
 
@@ -378,6 +441,87 @@ Additional tools can be added via [MCP servers](#mcp) or [Skills](#skills).
378
441
 
379
442
  ---
380
443
 
444
+ ## Server Management
445
+
446
+ nex-code has first-class support for remote server management via SSH, optimised for **AlmaLinux 9** and **macOS**.
447
+
448
+ ### Setup
449
+
450
+ Run `/init` inside nex-code to interactively configure your servers:
451
+
452
+ ```
453
+ > /init
454
+ ```
455
+
456
+ Or create `.nex/servers.json` manually:
457
+
458
+ ```json
459
+ {
460
+ "prod": {
461
+ "host": "94.130.37.43",
462
+ "user": "jarvis",
463
+ "port": 22,
464
+ "key": "~/.ssh/id_rsa",
465
+ "os": "almalinux9",
466
+ "sudo": true
467
+ },
468
+ "macbook": {
469
+ "host": "192.168.1.10",
470
+ "user": "lukas",
471
+ "os": "macos"
472
+ }
473
+ }
474
+ ```
475
+
476
+ **OS values**: `almalinux9`, `almalinux8`, `ubuntu`, `debian`, `macos`
477
+
478
+ When `.nex/servers.json` exists, the agent automatically receives OS-aware context:
479
+ - **AlmaLinux 9**: `dnf`, `firewalld`, `systemctl`, SELinux hints
480
+ - **macOS**: `brew`, `launchctl`, `log show` instead of `journalctl`
481
+
482
+ ### Slash Commands
483
+
484
+ | Command | Description |
485
+ |---------|-------------|
486
+ | `/servers` | List all configured server profiles |
487
+ | `/servers ping` | Check SSH connectivity for all servers in parallel |
488
+ | `/servers ping <name>` | Check a specific server |
489
+ | `/docker` | List running containers across all servers + local |
490
+ | `/docker -a` | Include stopped containers |
491
+ | `/deploy` | List all named deploy configs |
492
+ | `/deploy <name>` | Run a named deploy (with confirmation) |
493
+ | `/deploy <name> --dry-run` | Preview without syncing |
494
+ | `/init` | Interactive wizard: create `.nex/servers.json` |
495
+ | `/init deploy` | Interactive wizard: create `.nex/deploy.json` |
496
+
497
+ ### Named Deploy Configs
498
+
499
+ Create `.nex/deploy.json` (or use `/init deploy`):
500
+
501
+ ```json
502
+ {
503
+ "prod": {
504
+ "server": "prod",
505
+ "local_path": "dist/",
506
+ "remote_path": "/var/www/app",
507
+ "exclude": ["node_modules", ".env"],
508
+ "deploy_script": "systemctl restart gunicorn"
509
+ }
510
+ }
511
+ ```
512
+
513
+ Then deploy with:
514
+ ```
515
+ > /deploy prod
516
+ ```
517
+
518
+ Or from within a conversation:
519
+ ```
520
+ deploy the latest build to prod
521
+ ```
522
+
523
+ ---
524
+
381
525
  ## Features
382
526
 
383
527
  ### Compact Output
@@ -401,6 +545,10 @@ When the model runs tools but produces no visible text, an automatic nudge force
401
545
  ### Response Quality
402
546
  The system prompt enforces substantive responses: the model always presents findings as formatted text after using tools (users only see 1-line tool summaries). Responses use markdown with headers, bullet lists, and code blocks. The model states its approach before non-trivial tasks and summarizes results after completing work.
403
547
 
548
+ **Language:** By default (`NEX_LANGUAGE=auto`), the model mirrors the language of the user's message — write in German, get a German response; write in English, get an English response. Set `NEX_LANGUAGE=English` (or any language) to force a fixed response language.
549
+
550
+ **Code examples:** The model is instructed to always show actual, working code — never pseudocode or placeholder snippets.
551
+
404
552
  ### Performance
405
553
  - **Asynchronous I/O**: The entire CLI is built on non-blocking I/O. File reads, writes, and git operations never block the main thread, keeping the UI responsive even during heavy tasks.
406
554
  - **Fast Startup**: Pre-bundled with `esbuild` to minimize module loading overhead, achieving sub-100ms startup times.
@@ -470,6 +618,20 @@ Persistent project memory that survives across sessions:
470
618
 
471
619
  Also loads `NEX.md` from project root for project-level instructions.
472
620
 
621
+ ### Brain — Persistent Knowledge Base
622
+ A project-scoped knowledge base stored in `.nex/brain/`. The agent automatically retrieves relevant documents for each query and can write new entries as it discovers useful patterns, decisions, or context:
623
+ ```
624
+ /brain add auth-flow # add a document (prompted for content)
625
+ /brain search "jwt token" # keyword + semantic search
626
+ /brain list # list all documents
627
+ /brain show auth-flow # display a document
628
+ /brain remove auth-flow # delete a document
629
+ /brain status # index health (docs, keywords, embeddings)
630
+ /brain review # git diff of recent brain writes
631
+ /brain undo # undo last brain write
632
+ ```
633
+ The agent uses the `brain_write` tool to save discoveries automatically. All writes are tracked in git so you can review, revert, or audit what the agent has stored.
634
+
473
635
  ### Plan Mode
474
636
  Analyze before executing — the agent explores the codebase with read-only tools, produces a structured plan, then you approve before any changes are made:
475
637
  ```
@@ -593,8 +755,8 @@ Four features that make Nex Code significantly more reliable with open-source mo
593
755
 
594
756
  **Tool Tiers** — Dynamically reduces the tool set based on model capability:
595
757
  - **essential** (5 tools): bash, read_file, write_file, edit_file, list_directory
596
- - **standard** (13 tools): + search_files, glob, grep, ask_user, git_status, git_diff, git_log, task_list
597
- - **full** (17 tools): all tools
758
+ - **standard** (21 tools): + search_files, glob, grep, ask_user, git_status, git_diff, git_log, task_list, ssh_exec, service_manage, service_logs, container_list, container_logs, container_exec, container_manage, deploy
759
+ - **full** (33 tools): all tools
598
760
 
599
761
  Models are auto-classified, or override per-model in `.nex/config.json`:
600
762
  ```json
@@ -719,7 +881,7 @@ Or place executable scripts in `.nex/hooks/`:
719
881
  ```
720
882
  bin/nex-code.js # Entrypoint (shebang, .env, startREPL)
721
883
  cli/
722
- ├── index.js # REPL + ~38 slash commands + history persistence + AbortController
884
+ ├── index.js # REPL + ~39 slash commands + history persistence + AbortController
723
885
  ├── agent.js # Agentic loop + conversation state + compact output + résumé + abort handling
724
886
  ├── providers/ # Multi-provider abstraction
725
887
  │ ├── base.js # Abstract provider interface