@dirxai/cli 0.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 +101 -0
- package/install.js +92 -0
- package/package.json +40 -0
package/README.md
ADDED
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
# DirX — Unified Gateway & CLI for Agents
|
|
2
|
+
|
|
3
|
+
DirX provides a single CLI that lets AI agents **discover**, **navigate**, and **execute** across any API — GitHub, OpenAI, custom services, and more.
|
|
4
|
+
|
|
5
|
+
```
|
|
6
|
+
dirx ls / # discover registered services
|
|
7
|
+
dirx cat /net/api.github.com # read service info
|
|
8
|
+
dirx grep "issues" api.github.com # search endpoints
|
|
9
|
+
dirx write /net/api.github.com/owner/repo/issues --json '{"title":"Bug"}'
|
|
10
|
+
dirx bash 'cat /net | cat /net/api.github.com'
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Install
|
|
14
|
+
|
|
15
|
+
### npm (recommended)
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
npm install -g @dirxai/cli
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
### Homebrew (macOS/Linux)
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
brew tap dirxai/dirx
|
|
25
|
+
brew install dirx
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
### Binary download
|
|
29
|
+
|
|
30
|
+
Download from [Releases](https://github.com/dirxai/dirx/releases) and add to your PATH.
|
|
31
|
+
|
|
32
|
+
| Platform | Archive |
|
|
33
|
+
|----------|---------|
|
|
34
|
+
| macOS ARM64 | `dirx-aarch64-apple-darwin.tar.gz` |
|
|
35
|
+
| macOS x86_64 | `dirx-x86_64-apple-darwin.tar.gz` |
|
|
36
|
+
| Linux x86_64 | `dirx-x86_64-unknown-linux-gnu.tar.gz` |
|
|
37
|
+
|
|
38
|
+
Install:
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
tar xzf dirx-*.tar.gz
|
|
42
|
+
sudo mv dirx /usr/local/bin/
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
## Quick Start
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
# 1. Authenticate
|
|
49
|
+
dirx auth --server https://api.dirx.ai --json '{}'
|
|
50
|
+
|
|
51
|
+
# 2. Browse
|
|
52
|
+
dirx ls /
|
|
53
|
+
dirx ls /net
|
|
54
|
+
|
|
55
|
+
# 3. Read
|
|
56
|
+
dirx cat /net/api.github.com
|
|
57
|
+
|
|
58
|
+
# 4. Search
|
|
59
|
+
dirx grep "pull requests"
|
|
60
|
+
|
|
61
|
+
# 5. Manage API keys (BYOK)
|
|
62
|
+
dirx keys set api.github.com --token ghp_your_token
|
|
63
|
+
dirx keys list
|
|
64
|
+
|
|
65
|
+
# 6. Pipeline
|
|
66
|
+
dirx bash 'cat /net/api.github.com | write /log'
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
## For Service Developers
|
|
70
|
+
|
|
71
|
+
Register your API with DirX:
|
|
72
|
+
|
|
73
|
+
```bash
|
|
74
|
+
dirx init my-service/ # generate DIR.md + dir.json
|
|
75
|
+
dirx claim api.example.com # start domain verification
|
|
76
|
+
dirx claim api.example.com --verify # complete verification
|
|
77
|
+
dirx register --domain api.example.com # publish to registry
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
## Architecture
|
|
81
|
+
|
|
82
|
+
```
|
|
83
|
+
CLI (Rust) ──HTTP──▶ DirX Server (Go) ──▶ Adapters ──▶ External APIs
|
|
84
|
+
│ Registry │ GitHub
|
|
85
|
+
│ Router │ OpenAI
|
|
86
|
+
│ Auth (JWKS) │ Custom...
|
|
87
|
+
│ Policy
|
|
88
|
+
│ Audit
|
|
89
|
+
│ BYOK
|
|
90
|
+
│ Search
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
## Documentation
|
|
94
|
+
|
|
95
|
+
- [dirx.ai](https://dirx.ai) — official site
|
|
96
|
+
- [API Reference](https://dirx.ai/docs/api)
|
|
97
|
+
- [Developer Guide](https://dirx.ai/docs/developers)
|
|
98
|
+
|
|
99
|
+
## License
|
|
100
|
+
|
|
101
|
+
MIT
|
package/install.js
ADDED
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const https = require("https");
|
|
4
|
+
const http = require("http");
|
|
5
|
+
const fs = require("fs");
|
|
6
|
+
const os = require("os");
|
|
7
|
+
const path = require("path");
|
|
8
|
+
const { execSync } = require("child_process");
|
|
9
|
+
|
|
10
|
+
const VERSION = require("./package.json").version;
|
|
11
|
+
const REPO = "dirxai/dirx";
|
|
12
|
+
const BIN_DIR = path.join(__dirname, "bin");
|
|
13
|
+
|
|
14
|
+
const PLATFORM_MAP = {
|
|
15
|
+
darwin: "apple-darwin",
|
|
16
|
+
linux: "unknown-linux-gnu",
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
const ARCH_MAP = {
|
|
20
|
+
x64: "x86_64",
|
|
21
|
+
arm64: "aarch64",
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
function getArchiveName() {
|
|
25
|
+
const platform = PLATFORM_MAP[process.platform];
|
|
26
|
+
const arch = ARCH_MAP[process.arch];
|
|
27
|
+
if (!platform || !arch) {
|
|
28
|
+
throw new Error(
|
|
29
|
+
`Unsupported platform: ${process.platform}-${process.arch}`
|
|
30
|
+
);
|
|
31
|
+
}
|
|
32
|
+
return `dirx-${arch}-${platform}.tar.gz`;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
function getDownloadUrl(archiveName) {
|
|
36
|
+
return `https://github.com/${REPO}/releases/download/v${VERSION}/${archiveName}`;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
function download(url) {
|
|
40
|
+
return new Promise((resolve, reject) => {
|
|
41
|
+
const client = url.startsWith("https") ? https : http;
|
|
42
|
+
client.get(url, { headers: { "User-Agent": "dirx-npm-installer" } }, (res) => {
|
|
43
|
+
if (res.statusCode >= 300 && res.statusCode < 400 && res.headers.location) {
|
|
44
|
+
return download(res.headers.location).then(resolve).catch(reject);
|
|
45
|
+
}
|
|
46
|
+
if (res.statusCode !== 200) {
|
|
47
|
+
return reject(new Error(`Download failed: HTTP ${res.statusCode} from ${url}`));
|
|
48
|
+
}
|
|
49
|
+
const chunks = [];
|
|
50
|
+
res.on("data", (chunk) => chunks.push(chunk));
|
|
51
|
+
res.on("end", () => resolve(Buffer.concat(chunks)));
|
|
52
|
+
res.on("error", reject);
|
|
53
|
+
}).on("error", reject);
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
async function main() {
|
|
58
|
+
const archiveName = getArchiveName();
|
|
59
|
+
const url = getDownloadUrl(archiveName);
|
|
60
|
+
const archivePath = path.join(os.tmpdir(), archiveName);
|
|
61
|
+
const binPath = path.join(BIN_DIR, "dirx");
|
|
62
|
+
|
|
63
|
+
console.log(`Downloading DirX v${VERSION} for ${process.platform}-${process.arch}...`);
|
|
64
|
+
console.log(` ${url}`);
|
|
65
|
+
|
|
66
|
+
fs.mkdirSync(BIN_DIR, { recursive: true });
|
|
67
|
+
|
|
68
|
+
try {
|
|
69
|
+
const data = await download(url);
|
|
70
|
+
fs.writeFileSync(archivePath, data);
|
|
71
|
+
|
|
72
|
+
execSync(`tar xzf "${archivePath}" -C "${BIN_DIR}"`, { stdio: "inherit" });
|
|
73
|
+
fs.chmodSync(binPath, 0o755);
|
|
74
|
+
fs.unlinkSync(archivePath);
|
|
75
|
+
|
|
76
|
+
console.log(`DirX v${VERSION} installed to ${binPath}`);
|
|
77
|
+
|
|
78
|
+
try {
|
|
79
|
+
const version = execSync(`"${binPath}" --version`, { encoding: "utf8" }).trim();
|
|
80
|
+
console.log(` ${version}`);
|
|
81
|
+
} catch {
|
|
82
|
+
// binary works but --version might not exist yet
|
|
83
|
+
}
|
|
84
|
+
} catch (err) {
|
|
85
|
+
console.error(`Failed to install DirX: ${err.message}`);
|
|
86
|
+
console.error("You can download manually from:");
|
|
87
|
+
console.error(` https://github.com/${REPO}/releases/tag/v${VERSION}`);
|
|
88
|
+
process.exit(1);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
main();
|
package/package.json
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@dirxai/cli",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "DirX — Unified Gateway & CLI for Agents",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "https://github.com/dirxai/dirx"
|
|
9
|
+
},
|
|
10
|
+
"homepage": "https://dirx.ai",
|
|
11
|
+
"keywords": [
|
|
12
|
+
"dirx",
|
|
13
|
+
"agent",
|
|
14
|
+
"cli",
|
|
15
|
+
"gateway",
|
|
16
|
+
"api"
|
|
17
|
+
],
|
|
18
|
+
"bin": {
|
|
19
|
+
"dirx": "bin/dirx"
|
|
20
|
+
},
|
|
21
|
+
"scripts": {
|
|
22
|
+
"postinstall": "node install.js"
|
|
23
|
+
},
|
|
24
|
+
"files": [
|
|
25
|
+
"bin/",
|
|
26
|
+
"install.js",
|
|
27
|
+
"README.md"
|
|
28
|
+
],
|
|
29
|
+
"os": [
|
|
30
|
+
"darwin",
|
|
31
|
+
"linux"
|
|
32
|
+
],
|
|
33
|
+
"cpu": [
|
|
34
|
+
"x64",
|
|
35
|
+
"arm64"
|
|
36
|
+
],
|
|
37
|
+
"engines": {
|
|
38
|
+
"node": ">=16"
|
|
39
|
+
}
|
|
40
|
+
}
|