@souhengai/naxos 2.1.0
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 +71 -0
- package/bin/cli.js +38 -0
- package/lib/postinstall.js +156 -0
- package/package.json +29 -0
package/README.md
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
# Naxos
|
|
2
|
+
|
|
3
|
+
**SouhengAI Autonomous Coding Agent** — Use AI right from your terminal.
|
|
4
|
+
|
|
5
|
+
Naxos can understand your codebase, edit files, run commands, search the web, and handle entire workflows for you.
|
|
6
|
+
|
|
7
|
+
## Installation
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install -g @souhengai/naxos
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Then run:
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
naxos setup
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Usage
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
# Start interactive session
|
|
23
|
+
naxos
|
|
24
|
+
|
|
25
|
+
# Start with a prompt
|
|
26
|
+
naxos "fix the bug in auth.ts"
|
|
27
|
+
|
|
28
|
+
# Resume last session
|
|
29
|
+
naxos -c
|
|
30
|
+
|
|
31
|
+
# Override model
|
|
32
|
+
naxos -m gpt-4o "explain this code"
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## Commands
|
|
36
|
+
|
|
37
|
+
| Command | Description |
|
|
38
|
+
|---------|-------------|
|
|
39
|
+
| `/help` | Show available commands |
|
|
40
|
+
| `/clear` | Clear conversation |
|
|
41
|
+
| `/compact` | Summarize conversation to save context |
|
|
42
|
+
| `/history` | List saved sessions |
|
|
43
|
+
| `/stats` | Show token usage and session stats |
|
|
44
|
+
| `/model` | Show or change model |
|
|
45
|
+
| `/config` | Show configuration |
|
|
46
|
+
| `exit` | End session |
|
|
47
|
+
|
|
48
|
+
## Tools
|
|
49
|
+
|
|
50
|
+
Naxos has built-in tools for:
|
|
51
|
+
|
|
52
|
+
- **bash** — Run shell commands
|
|
53
|
+
- **file_read** / **file_write** / **file_edit** — File operations
|
|
54
|
+
- **glob** / **grep** — Search files and content
|
|
55
|
+
- **web_search** / **web_fetch** — Search and read the web
|
|
56
|
+
- **list_dir** — Browse directories
|
|
57
|
+
|
|
58
|
+
## Configuration
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
naxos config api-key <key> # Set API key
|
|
62
|
+
naxos config api-url <url> # Set server URL
|
|
63
|
+
naxos config model <name> # Set default model
|
|
64
|
+
naxos config permissions bypass # Enable full autonomy
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
Environment variables: `NAXOS_API_KEY`, `NAXOS_API_URL`
|
|
68
|
+
|
|
69
|
+
## License
|
|
70
|
+
|
|
71
|
+
MIT — SouhengAI
|
package/bin/cli.js
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Naxos CLI shim.
|
|
5
|
+
* Finds and executes the platform-specific binary.
|
|
6
|
+
* This file is the npm bin entry point.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
const { existsSync } = require("fs");
|
|
10
|
+
const { join } = require("path");
|
|
11
|
+
const { execFileSync } = require("child_process");
|
|
12
|
+
|
|
13
|
+
const BINARY_NAME = process.platform === "win32" ? "naxos.exe" : "naxos";
|
|
14
|
+
const BINARY_PATH = join(__dirname, BINARY_NAME);
|
|
15
|
+
|
|
16
|
+
if (!existsSync(BINARY_PATH)) {
|
|
17
|
+
console.error("");
|
|
18
|
+
console.error(" \x1b[31m✗\x1b[0m Naxos binary not found.");
|
|
19
|
+
console.error(" Run: npm rebuild @souhengai/naxos");
|
|
20
|
+
console.error("");
|
|
21
|
+
process.exit(1);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
// Pass through all arguments to the native binary
|
|
25
|
+
try {
|
|
26
|
+
execFileSync(BINARY_PATH, process.argv.slice(2), {
|
|
27
|
+
stdio: "inherit",
|
|
28
|
+
env: process.env,
|
|
29
|
+
});
|
|
30
|
+
} catch (err) {
|
|
31
|
+
// execFileSync throws on non-zero exit code — that's fine, just propagate
|
|
32
|
+
if (err.status != null) {
|
|
33
|
+
process.exit(err.status);
|
|
34
|
+
}
|
|
35
|
+
// Actual error (binary not executable, etc.)
|
|
36
|
+
console.error(` Error running naxos: ${err.message}`);
|
|
37
|
+
process.exit(1);
|
|
38
|
+
}
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Naxos postinstall script.
|
|
5
|
+
* Downloads the platform-specific binary from the CDN.
|
|
6
|
+
* Runs automatically after `npm install -g @souhengai/naxos`.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
const { existsSync, mkdirSync, chmodSync, renameSync, unlinkSync, createWriteStream } = require("fs");
|
|
10
|
+
const { join, dirname } = require("path");
|
|
11
|
+
const https = require("https");
|
|
12
|
+
const http = require("http");
|
|
13
|
+
|
|
14
|
+
const BASE_URL = "https://mineify.de/naxos";
|
|
15
|
+
const VERSION = require("../package.json").version;
|
|
16
|
+
|
|
17
|
+
// Where to put the binary — next to this script's package
|
|
18
|
+
const BIN_DIR = join(__dirname, "..", "bin");
|
|
19
|
+
const BINARY_NAME = process.platform === "win32" ? "naxos.exe" : "naxos";
|
|
20
|
+
const BINARY_PATH = join(BIN_DIR, BINARY_NAME);
|
|
21
|
+
|
|
22
|
+
function getPlatformBinary() {
|
|
23
|
+
const platform = process.platform;
|
|
24
|
+
const arch = process.arch;
|
|
25
|
+
|
|
26
|
+
const map = {
|
|
27
|
+
"darwin-x64": "naxos-darwin-x64",
|
|
28
|
+
"darwin-arm64": "naxos-darwin-arm64",
|
|
29
|
+
"linux-x64": "naxos-linux-x64",
|
|
30
|
+
"win32-x64": "naxos-win-x64.exe",
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
const key = `${platform}-${arch}`;
|
|
34
|
+
const binary = map[key];
|
|
35
|
+
|
|
36
|
+
if (!binary) {
|
|
37
|
+
console.error(` Unsupported platform: ${key}`);
|
|
38
|
+
console.error(` Supported: ${Object.keys(map).join(", ")}`);
|
|
39
|
+
process.exit(1);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
return binary;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
function download(url, dest) {
|
|
46
|
+
return new Promise((resolve, reject) => {
|
|
47
|
+
const file = createWriteStream(dest);
|
|
48
|
+
const client = url.startsWith("https") ? https : http;
|
|
49
|
+
|
|
50
|
+
function doRequest(requestUrl, redirectCount) {
|
|
51
|
+
if (redirectCount > 5) {
|
|
52
|
+
reject(new Error("Too many redirects"));
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
client
|
|
57
|
+
.get(requestUrl, (res) => {
|
|
58
|
+
// Handle redirects
|
|
59
|
+
if (res.statusCode >= 300 && res.statusCode < 400 && res.headers.location) {
|
|
60
|
+
res.resume();
|
|
61
|
+
doRequest(res.headers.location, redirectCount + 1);
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
if (res.statusCode !== 200) {
|
|
66
|
+
res.resume();
|
|
67
|
+
reject(new Error(`Download failed: HTTP ${res.statusCode}`));
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
const totalBytes = parseInt(res.headers["content-length"] || "0", 10);
|
|
72
|
+
let downloaded = 0;
|
|
73
|
+
let lastPercent = -1;
|
|
74
|
+
|
|
75
|
+
res.on("data", (chunk) => {
|
|
76
|
+
downloaded += chunk.length;
|
|
77
|
+
if (totalBytes > 0) {
|
|
78
|
+
const percent = Math.floor((downloaded / totalBytes) * 100);
|
|
79
|
+
if (percent !== lastPercent && percent % 10 === 0) {
|
|
80
|
+
process.stdout.write(`\r Downloading... ${percent}%`);
|
|
81
|
+
lastPercent = percent;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
res.pipe(file);
|
|
87
|
+
|
|
88
|
+
file.on("finish", () => {
|
|
89
|
+
file.close();
|
|
90
|
+
if (totalBytes > 0) {
|
|
91
|
+
process.stdout.write(`\r Downloading... done \n`);
|
|
92
|
+
}
|
|
93
|
+
resolve();
|
|
94
|
+
});
|
|
95
|
+
})
|
|
96
|
+
.on("error", (err) => {
|
|
97
|
+
file.close();
|
|
98
|
+
try { unlinkSync(dest); } catch {}
|
|
99
|
+
reject(err);
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
doRequest(url, 0);
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
async function main() {
|
|
108
|
+
console.log("");
|
|
109
|
+
console.log(" \x1b[35mNaxos\x1b[0m v" + VERSION + " — Installing...");
|
|
110
|
+
console.log("");
|
|
111
|
+
|
|
112
|
+
const binaryName = getPlatformBinary();
|
|
113
|
+
const url = `${BASE_URL}/${binaryName}`;
|
|
114
|
+
|
|
115
|
+
// Ensure bin dir exists
|
|
116
|
+
if (!existsSync(BIN_DIR)) {
|
|
117
|
+
mkdirSync(BIN_DIR, { recursive: true });
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
// Download to temp file first (atomic)
|
|
121
|
+
const tmpPath = BINARY_PATH + ".tmp";
|
|
122
|
+
|
|
123
|
+
try {
|
|
124
|
+
await download(url, tmpPath);
|
|
125
|
+
|
|
126
|
+
// Atomic replace
|
|
127
|
+
if (existsSync(BINARY_PATH)) {
|
|
128
|
+
try { unlinkSync(BINARY_PATH); } catch {}
|
|
129
|
+
}
|
|
130
|
+
renameSync(tmpPath, BINARY_PATH);
|
|
131
|
+
|
|
132
|
+
// Make executable on Unix
|
|
133
|
+
if (process.platform !== "win32") {
|
|
134
|
+
chmodSync(BINARY_PATH, 0o755);
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
console.log(" \x1b[32m✓\x1b[0m Installed successfully!");
|
|
138
|
+
console.log("");
|
|
139
|
+
console.log(" Run \x1b[1mnaxos setup\x1b[0m to get started.");
|
|
140
|
+
console.log("");
|
|
141
|
+
} catch (err) {
|
|
142
|
+
// Clean up temp file
|
|
143
|
+
try { unlinkSync(tmpPath); } catch {}
|
|
144
|
+
|
|
145
|
+
console.error("");
|
|
146
|
+
console.error(` \x1b[31m✗\x1b[0m Download failed: ${err.message}`);
|
|
147
|
+
console.error("");
|
|
148
|
+
console.error(" You can manually download from:");
|
|
149
|
+
console.error(` ${url}`);
|
|
150
|
+
console.error(` and place it at: ${BINARY_PATH}`);
|
|
151
|
+
console.error("");
|
|
152
|
+
process.exit(1);
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
main();
|
package/package.json
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@souhengai/naxos",
|
|
3
|
+
"version": "2.1.0",
|
|
4
|
+
"description": "Naxos — SouhengAI Autonomous Coding Agent",
|
|
5
|
+
"bin": {
|
|
6
|
+
"naxos": "bin/cli.js"
|
|
7
|
+
},
|
|
8
|
+
"scripts": {
|
|
9
|
+
"postinstall": "node lib/postinstall.js"
|
|
10
|
+
},
|
|
11
|
+
"files": [
|
|
12
|
+
"bin/",
|
|
13
|
+
"lib/",
|
|
14
|
+
"README.md"
|
|
15
|
+
],
|
|
16
|
+
"os": ["darwin", "linux", "win32"],
|
|
17
|
+
"cpu": ["x64", "arm64"],
|
|
18
|
+
"engines": {
|
|
19
|
+
"node": ">=18.0.0"
|
|
20
|
+
},
|
|
21
|
+
"license": "MIT",
|
|
22
|
+
"author": "SouhengAI",
|
|
23
|
+
"homepage": "https://souheng.ai",
|
|
24
|
+
"repository": {
|
|
25
|
+
"type": "git",
|
|
26
|
+
"url": "https://github.com/souhengai/naxos"
|
|
27
|
+
},
|
|
28
|
+
"keywords": ["ai", "coding-agent", "cli", "terminal", "souhengai", "naxos"]
|
|
29
|
+
}
|