nex-code 0.4.39 → 0.4.41

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 CHANGED
@@ -123,7 +123,9 @@ The verify phase catches incomplete work before reporting "done" — if tests fa
123
123
 
124
124
  **Built-in VS Code extension.** A sidebar chat panel with streaming output, collapsible tool cards, and native VS Code theme support — shipped in the same repo, no separate install.
125
125
 
126
- **Lightweight.** 2 runtime dependencies (`axios`, `dotenv`). Starts in ~100ms. No Python, no heavy runtime, no daemon process.
126
+ **Lightweight.** 2 runtime dependencies (`axios`, `dotenv`). Starts in ~100ms. No Python, no heavy runtime.
127
+
128
+ **Daemon / watch mode.** Run `nex-code --daemon` to keep the process alive and fire tasks automatically on filesystem changes, git commits, or a cron schedule — configured via `.nex/daemon.json`. No extra dependencies; uses Node's built-in `fs.watch` and `setInterval`.
127
129
 
128
130
  **Server-aware from the first message.** When your prompt contains a URL whose domain matches a configured SSH profile (e.g. `server.example.com` → profile `server`), nex-code probes the server before responding — listing ports, running processes, and data directories. The model receives this topology before its first token, so it goes straight to `ssh_exec` instead of reading local files.
129
131
 
@@ -389,6 +391,9 @@ nex-code --prompt-file /tmp/task.txt --yolo --json
389
391
  | `--auto` | Skip confirmations (non-interactive, no REPL banner) |
390
392
  | `--yolo` | Skip all confirmations including dangerous commands (also configurable via `.nex/config.json` `"yolo": true`) |
391
393
  | `--server` | Start JSON-lines IPC server (used by the VS Code extension) |
394
+ | `--daemon [config]` | Run as background watcher — fires tasks on file changes, git commits, or schedule (reads `.nex/daemon.json`) |
395
+ | `--watch [config]` | Alias for `--daemon` |
396
+ | `--flatrate` | Flatrate mode: 100 turns, 6 parallel agents, 5 retries (auto-enabled when `OLLAMA_API_KEY` is set) |
392
397
  | `--json` | Output `{"success":true,"response":"..."}` to stdout |
393
398
  | `--max-turns <n>` | Override the agentic loop iteration limit |
394
399
  | `--model <spec>` | Use a specific model (e.g. `anthropic:claude-sonnet-4-6`) |
@@ -925,6 +930,60 @@ nex-code --task "/ar-self-improve" --no-auto-orchestrate --max-turns 200
925
930
 
926
931
  > **Self-improvement history** (2026-03-31): baseline 86.7 → **92.9** (+6.2 pts) in one session. Key fix: rewording the `edit_file` tool description so models call it directly instead of first calling `read_file`. `rnj-1:8b` jumped from 77.1 → 97.9 on that change alone.
927
932
 
933
+ ### Daemon / Watch Mode
934
+
935
+ Keep nex-code running in the background and fire tasks automatically when things change. Reads config from `.nex/daemon.json` (or a path passed after the flag):
936
+
937
+ ```bash
938
+ nex-code --daemon # reads .nex/daemon.json
939
+ nex-code --daemon /path/to/config.json
940
+ nex-code --watch # alias
941
+ ```
942
+
943
+ **Example `.nex/daemon.json`:**
944
+
945
+ ```json
946
+ {
947
+ "triggers": [
948
+ {
949
+ "on": "file-change",
950
+ "glob": "**/*.{js,ts}",
951
+ "ignore": ["dist/**", "node_modules/**"],
952
+ "task": "run npm test -- --testPathPattern={changedFile} and report results",
953
+ "debounceMs": 2000,
954
+ "auto": true
955
+ },
956
+ {
957
+ "on": "git-commit",
958
+ "task": "review the last commit for bugs or security issues — commit: {commitHash} \"{commitMessage}\"",
959
+ "auto": true
960
+ },
961
+ {
962
+ "on": "schedule",
963
+ "cron": "0 8 * * *",
964
+ "task": "check npm audit and report any new vulnerabilities",
965
+ "auto": true
966
+ }
967
+ ],
968
+ "notify": ["desktop", "matrix"],
969
+ "logFile": ".nex/daemon.log"
970
+ }
971
+ ```
972
+
973
+ **Trigger types:**
974
+
975
+ | Type | Mechanism | Template vars |
976
+ |------|-----------|---------------|
977
+ | `file-change` | `fs.watch({ recursive: true })` + debounce | `{changedFile}`, `{changedFiles}` |
978
+ | `git-commit` | polls `git log` every 10 s | `{commitHash}`, `{commitMessage}` |
979
+ | `schedule` | `setInterval` — supports `*/N * * * *` and `0 H * * *` | — |
980
+
981
+ **Notifications:** `"desktop"` fires a macOS notification via `osascript`. `"matrix"` posts to the room set in `NEX_MATRIX_URL` / `NEX_MATRIX_TOKEN` / `NEX_MATRIX_ROOM`.
982
+
983
+ Each triggered task runs in its own isolated session (`clearConversation()` is called after every task). Events are appended as one-line JSON to `logFile`; the file is truncated (not deleted) when it exceeds 5 MB.
984
+
985
+ No new npm dependencies — uses only Node.js built-ins (`fs`, `https`, `child_process`).
986
+
928
987
  ### Memory
929
988
 
930
989
  Persistent project memory that survives across sessions: