@cadreen/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 +66 -0
- package/install.js +115 -0
- package/package.json +25 -0
package/README.md
ADDED
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
# @cadreen/cli
|
|
2
|
+
|
|
3
|
+
Cadreen CLI — intelligence infrastructure for developers.
|
|
4
|
+
|
|
5
|
+
Cadreen remembers things, follows rules, connects to services, and heals itself when things go wrong. All governed. All observable.
|
|
6
|
+
|
|
7
|
+
## Install
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install -g @cadreen/cli
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Quick Start
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
cadreen init # Set up your account
|
|
17
|
+
cadreen ask "what can you do?" # Ask a question
|
|
18
|
+
cadreen chat # Interactive chat
|
|
19
|
+
cadreen doctor # Check readiness
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## Commands
|
|
23
|
+
|
|
24
|
+
| Command | What it does |
|
|
25
|
+
|---------|-------------|
|
|
26
|
+
| `cadreen init` | Set up your account |
|
|
27
|
+
| `cadreen login` | Authenticate |
|
|
28
|
+
| `cadreen ask "..."` | One-shot question |
|
|
29
|
+
| `cadreen chat` | Interactive chat |
|
|
30
|
+
| `cadreen status` | System health |
|
|
31
|
+
| `cadreen doctor` | Readiness check |
|
|
32
|
+
| `cadreen memory list` | What Cadreen knows |
|
|
33
|
+
| `cadreen memory add "..."` | Teach something |
|
|
34
|
+
| `cadreen policies list` | Active rules |
|
|
35
|
+
| `cadreen policies evaluate "..."` | Test an action |
|
|
36
|
+
| `cadreen tools` | Available tools |
|
|
37
|
+
| `cadreen traces` | What happened |
|
|
38
|
+
| `cadreen config` | Local settings |
|
|
39
|
+
| `cadreen update` | Update CLI |
|
|
40
|
+
|
|
41
|
+
## Other Install Methods
|
|
42
|
+
|
|
43
|
+
**Homebrew:**
|
|
44
|
+
```bash
|
|
45
|
+
brew tap timothy-billingrails/cadreen-sdks
|
|
46
|
+
brew install cadreen
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
**curl:**
|
|
50
|
+
```bash
|
|
51
|
+
curl -fsSL https://raw.githubusercontent.com/timothy-billingrails/cadreen-sdks/main/install.sh | sh
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
**Go:**
|
|
55
|
+
```bash
|
|
56
|
+
go install github.com/timothy-billingrails/cadreen-sdks/go/cmd/cadreen@latest
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
## Links
|
|
60
|
+
|
|
61
|
+
- [Docs](https://accomplishanything.today/infra/docs)
|
|
62
|
+
- [GitHub](https://github.com/timothy-billingrails/cadreen-sdks)
|
|
63
|
+
|
|
64
|
+
## License
|
|
65
|
+
|
|
66
|
+
UNLICENSED
|
package/install.js
ADDED
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const https = require("https");
|
|
4
|
+
const fs = require("fs");
|
|
5
|
+
const path = require("path");
|
|
6
|
+
|
|
7
|
+
const REPO = "timothy-billingrails/cadreen-sdks";
|
|
8
|
+
const BINARY = "cadreen";
|
|
9
|
+
const VERSION = require("./package.json").version;
|
|
10
|
+
const MAX_REDIRECTS = 5;
|
|
11
|
+
|
|
12
|
+
function getPlatform() {
|
|
13
|
+
const platform = process.platform;
|
|
14
|
+
switch (platform) {
|
|
15
|
+
case "darwin":
|
|
16
|
+
return "darwin";
|
|
17
|
+
case "linux":
|
|
18
|
+
return "linux";
|
|
19
|
+
case "win32":
|
|
20
|
+
return "windows";
|
|
21
|
+
default:
|
|
22
|
+
throw new Error(`Unsupported platform: ${platform}`);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
function getArch() {
|
|
27
|
+
const arch = process.arch;
|
|
28
|
+
switch (arch) {
|
|
29
|
+
case "x64":
|
|
30
|
+
return "amd64";
|
|
31
|
+
case "arm64":
|
|
32
|
+
return "arm64";
|
|
33
|
+
default:
|
|
34
|
+
throw new Error(`Unsupported architecture: ${arch}`);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
function getDownloadURL() {
|
|
39
|
+
const platform = getPlatform();
|
|
40
|
+
const arch = getArch();
|
|
41
|
+
const ext = platform === "windows" ? ".exe" : "";
|
|
42
|
+
return `https://github.com/${REPO}/releases/download/cli-v${VERSION}/cadreen_${platform}_${arch}${ext}`;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
function download(url, redirects) {
|
|
46
|
+
redirects = redirects || 0;
|
|
47
|
+
return new Promise((resolve, reject) => {
|
|
48
|
+
if (redirects > MAX_REDIRECTS) {
|
|
49
|
+
reject(new Error("Too many redirects"));
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
const request = https.get(url, { timeout: 30000 }, (response) => {
|
|
54
|
+
if (
|
|
55
|
+
response.statusCode === 302 ||
|
|
56
|
+
response.statusCode === 301 ||
|
|
57
|
+
response.statusCode === 307 ||
|
|
58
|
+
response.statusCode === 308
|
|
59
|
+
) {
|
|
60
|
+
return download(response.headers.location, redirects + 1).then(
|
|
61
|
+
resolve,
|
|
62
|
+
reject
|
|
63
|
+
);
|
|
64
|
+
}
|
|
65
|
+
if (response.statusCode !== 200) {
|
|
66
|
+
reject(new Error(`Download failed: HTTP ${response.statusCode}`));
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
const chunks = [];
|
|
71
|
+
response.on("data", (chunk) => chunks.push(chunk));
|
|
72
|
+
response.on("end", () => resolve(Buffer.concat(chunks)));
|
|
73
|
+
response.on("error", reject);
|
|
74
|
+
});
|
|
75
|
+
request.on("error", reject);
|
|
76
|
+
request.on("timeout", () => {
|
|
77
|
+
request.destroy();
|
|
78
|
+
reject(new Error("Download timed out"));
|
|
79
|
+
});
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
async function install() {
|
|
84
|
+
const binDir = path.join(__dirname, "bin");
|
|
85
|
+
if (!fs.existsSync(binDir)) {
|
|
86
|
+
fs.mkdirSync(binDir, { recursive: true });
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
const ext = process.platform === "win32" ? ".exe" : "";
|
|
90
|
+
const binPath = path.join(binDir, `${BINARY}${ext}`);
|
|
91
|
+
|
|
92
|
+
console.log(`Downloading Cadreen CLI v${VERSION}...`);
|
|
93
|
+
|
|
94
|
+
const url = getDownloadURL();
|
|
95
|
+
console.log(` URL: ${url}`);
|
|
96
|
+
|
|
97
|
+
try {
|
|
98
|
+
const data = await download(url);
|
|
99
|
+
fs.writeFileSync(binPath, data);
|
|
100
|
+
fs.chmodSync(binPath, 0o755);
|
|
101
|
+
console.log(` Installed to: ${binPath}`);
|
|
102
|
+
console.log("");
|
|
103
|
+
console.log("Next steps:");
|
|
104
|
+
console.log(" cadreen init — Set up your account");
|
|
105
|
+
console.log(" cadreen --help — See all commands");
|
|
106
|
+
} catch (error) {
|
|
107
|
+
console.error(` Download failed: ${error.message}`);
|
|
108
|
+
console.error("");
|
|
109
|
+
console.error("Install manually:");
|
|
110
|
+
console.error(` ${url}`);
|
|
111
|
+
process.exit(1);
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
install();
|
package/package.json
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@cadreen/cli",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Cadreen CLI — intelligence infrastructure for developers",
|
|
5
|
+
"keywords": ["cadreen", "cli", "governance", "memory"],
|
|
6
|
+
"homepage": "https://accomplishanything.today",
|
|
7
|
+
"license": "UNLICENSED",
|
|
8
|
+
"author": "Timothy Billingrails",
|
|
9
|
+
"repository": {
|
|
10
|
+
"type": "git",
|
|
11
|
+
"url": "https://github.com/timothy-billingrails/cadreen-sdks.git"
|
|
12
|
+
},
|
|
13
|
+
"files": ["bin/", "install.js", "package.json"],
|
|
14
|
+
"bin": {
|
|
15
|
+
"cadreen": "bin/cadreen"
|
|
16
|
+
},
|
|
17
|
+
"scripts": {
|
|
18
|
+
"postinstall": "node install.js"
|
|
19
|
+
},
|
|
20
|
+
"engines": {
|
|
21
|
+
"node": ">=16"
|
|
22
|
+
},
|
|
23
|
+
"os": ["darwin", "linux", "win32"],
|
|
24
|
+
"cpu": ["x64", "arm64"]
|
|
25
|
+
}
|