@fabriccode/cli 7.0.36 → 7.0.40
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 +82 -0
- package/bin/kilo +18 -3
- package/package.json +14 -14
- package/postinstall.mjs +111 -84
package/README.md
ADDED
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
# Kilo Code CLI
|
|
2
|
+
|
|
3
|
+
The AI coding agent built for the terminal. Generate code from natural language, automate tasks, and run terminal commands -- powered by 500+ AI models.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install -g @kilocode/cli
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
Or run directly with npx:
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
npx --package @kilocode/cli kilo
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Getting Started
|
|
18
|
+
|
|
19
|
+
Run `kilo` in any project directory to launch the interactive TUI:
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
kilo
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
Run a one-off task:
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
kilo run "add input validation to the signup form"
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## Features
|
|
32
|
+
|
|
33
|
+
- **Code generation** -- describe what you want in natural language
|
|
34
|
+
- **Terminal commands** -- the agent can run shell commands on your behalf
|
|
35
|
+
- **500+ AI models** -- use models from OpenAI, Anthropic, Google, and more
|
|
36
|
+
- **MCP servers** -- extend agent capabilities with the Model Context Protocol
|
|
37
|
+
- **Multiple modes** -- Plan with Architect, code with Coder, debug with Debugger, or create your own
|
|
38
|
+
- **Sessions** -- resume previous conversations and export transcripts
|
|
39
|
+
- **API keys optional** -- bring your own keys or use Kilo credits
|
|
40
|
+
|
|
41
|
+
## Commands
|
|
42
|
+
|
|
43
|
+
| Command | Description |
|
|
44
|
+
| --------------------- | -------------------------- |
|
|
45
|
+
| `kilo` | Launch interactive TUI |
|
|
46
|
+
| `kilo run "<task>"` | Run a one-off task |
|
|
47
|
+
| `kilo auth` | Manage authentication |
|
|
48
|
+
| `kilo models` | List available models |
|
|
49
|
+
| `kilo mcp` | Manage MCP servers |
|
|
50
|
+
| `kilo session list` | List sessions |
|
|
51
|
+
| `kilo session delete` | Delete a session |
|
|
52
|
+
| `kilo export` | Export session transcripts |
|
|
53
|
+
|
|
54
|
+
Run `kilo --help` for the full list.
|
|
55
|
+
|
|
56
|
+
## Alternative Installation
|
|
57
|
+
|
|
58
|
+
### Homebrew (macOS/Linux)
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
brew install Kilo-Org/tap/kilo
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
### GitHub Releases
|
|
65
|
+
|
|
66
|
+
Download pre-built binaries from the [Releases page](https://github.com/Kilo-Org/kilocode/releases).
|
|
67
|
+
|
|
68
|
+
## Documentation
|
|
69
|
+
|
|
70
|
+
- [Docs](https://kilo.ai/docs)
|
|
71
|
+
- [Getting Started](https://kilo.ai/docs/getting-started)
|
|
72
|
+
|
|
73
|
+
## Links
|
|
74
|
+
|
|
75
|
+
- [GitHub](https://github.com/Kilo-Org/kilocode)
|
|
76
|
+
- [Discord](https://kilo.ai/discord)
|
|
77
|
+
- [VS Code Extension](https://kilo.ai/vscode-marketplace)
|
|
78
|
+
- [Website](https://kilo.ai)
|
|
79
|
+
|
|
80
|
+
## License
|
|
81
|
+
|
|
82
|
+
MIT
|
package/bin/kilo
CHANGED
|
@@ -22,6 +22,24 @@ if (envPath) {
|
|
|
22
22
|
run(envPath)
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
+
const scriptPath = fs.realpathSync(__filename)
|
|
26
|
+
const scriptDir = path.dirname(scriptPath)
|
|
27
|
+
|
|
28
|
+
// kilocode_change start - fall through to findBinary() if cached binary fails
|
|
29
|
+
const cached = path.join(scriptDir, ".kilo")
|
|
30
|
+
if (fs.existsSync(cached)) {
|
|
31
|
+
const result = childProcess.spawnSync(cached, process.argv.slice(2), {
|
|
32
|
+
stdio: "inherit",
|
|
33
|
+
})
|
|
34
|
+
if (!result.error) {
|
|
35
|
+
const code = typeof result.status === "number" ? result.status : 0
|
|
36
|
+
process.exit(code)
|
|
37
|
+
}
|
|
38
|
+
// cached binary failed (e.g. wrong platform/arch, missing dynamic linker),
|
|
39
|
+
// fall through to findBinary() which has better variant detection
|
|
40
|
+
}
|
|
41
|
+
// kilocode_change end
|
|
42
|
+
|
|
25
43
|
const platformMap = {
|
|
26
44
|
darwin: "darwin",
|
|
27
45
|
linux: "linux",
|
|
@@ -157,9 +175,6 @@ function findBinary(startDir) {
|
|
|
157
175
|
}
|
|
158
176
|
}
|
|
159
177
|
|
|
160
|
-
const scriptPath = fs.realpathSync(__filename)
|
|
161
|
-
const scriptDir = path.dirname(scriptPath)
|
|
162
|
-
|
|
163
178
|
const resolved = findBinary(scriptDir)
|
|
164
179
|
if (!resolved) {
|
|
165
180
|
console.error(
|
package/package.json
CHANGED
|
@@ -1,26 +1,26 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fabriccode/cli",
|
|
3
3
|
"bin": {
|
|
4
|
-
"
|
|
5
|
-
"
|
|
4
|
+
"kilo": "./bin/kilo",
|
|
5
|
+
"kilocode": "./bin/kilo"
|
|
6
6
|
},
|
|
7
7
|
"scripts": {
|
|
8
8
|
"postinstall": "bun ./postinstall.mjs || node ./postinstall.mjs"
|
|
9
9
|
},
|
|
10
|
-
"version": "7.0.
|
|
10
|
+
"version": "7.0.40",
|
|
11
11
|
"license": "MIT",
|
|
12
12
|
"optionalDependencies": {
|
|
13
|
-
"@fabriccode/cli-
|
|
14
|
-
"@fabriccode/cli-linux-x64-baseline-musl": "7.0.
|
|
15
|
-
"@fabriccode/cli-linux-x64
|
|
16
|
-
"@fabriccode/cli-linux-
|
|
17
|
-
"@fabriccode/cli-darwin-arm64": "7.0.
|
|
18
|
-
"@fabriccode/cli-
|
|
19
|
-
"@fabriccode/cli-darwin-x64
|
|
20
|
-
"@fabriccode/cli-
|
|
21
|
-
"@fabriccode/cli-
|
|
22
|
-
"@fabriccode/cli-
|
|
23
|
-
"@fabriccode/cli-
|
|
13
|
+
"@fabriccode/cli-linux-arm64-musl": "7.0.40",
|
|
14
|
+
"@fabriccode/cli-linux-x64-baseline-musl": "7.0.40",
|
|
15
|
+
"@fabriccode/cli-linux-x64": "7.0.40",
|
|
16
|
+
"@fabriccode/cli-linux-arm64": "7.0.40",
|
|
17
|
+
"@fabriccode/cli-darwin-arm64": "7.0.40",
|
|
18
|
+
"@fabriccode/cli-linux-x64-baseline": "7.0.40",
|
|
19
|
+
"@fabriccode/cli-darwin-x64": "7.0.40",
|
|
20
|
+
"@fabriccode/cli-windows-x64": "7.0.40",
|
|
21
|
+
"@fabriccode/cli-darwin-x64-baseline": "7.0.40",
|
|
22
|
+
"@fabriccode/cli-windows-x64-baseline": "7.0.40",
|
|
23
|
+
"@fabriccode/cli-linux-x64-musl": "7.0.40"
|
|
24
24
|
},
|
|
25
25
|
"repository": {
|
|
26
26
|
"type": "git",
|
package/postinstall.mjs
CHANGED
|
@@ -3,123 +3,150 @@
|
|
|
3
3
|
import fs from "fs"
|
|
4
4
|
import path from "path"
|
|
5
5
|
import os from "os"
|
|
6
|
+
import childProcess from "child_process"
|
|
6
7
|
import { fileURLToPath } from "url"
|
|
7
8
|
import { createRequire } from "module"
|
|
8
9
|
|
|
9
10
|
const __dirname = path.dirname(fileURLToPath(import.meta.url))
|
|
10
11
|
const require = createRequire(import.meta.url)
|
|
11
12
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
platform = "windows"
|
|
24
|
-
break
|
|
25
|
-
default:
|
|
26
|
-
platform = os.platform()
|
|
27
|
-
break
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
// Map architecture names
|
|
31
|
-
let arch
|
|
32
|
-
switch (os.arch()) {
|
|
33
|
-
case "x64":
|
|
34
|
-
arch = "x64"
|
|
35
|
-
break
|
|
36
|
-
case "arm64":
|
|
37
|
-
arch = "arm64"
|
|
38
|
-
break
|
|
39
|
-
case "arm":
|
|
40
|
-
arch = "arm"
|
|
41
|
-
break
|
|
42
|
-
default:
|
|
43
|
-
arch = os.arch()
|
|
44
|
-
break
|
|
45
|
-
}
|
|
13
|
+
// kilocode_change start - variant detection matching bin/kilo logic
|
|
14
|
+
const platformMap = {
|
|
15
|
+
darwin: "darwin",
|
|
16
|
+
linux: "linux",
|
|
17
|
+
win32: "windows",
|
|
18
|
+
}
|
|
19
|
+
const archMap = {
|
|
20
|
+
x64: "x64",
|
|
21
|
+
arm64: "arm64",
|
|
22
|
+
arm: "arm",
|
|
23
|
+
}
|
|
46
24
|
|
|
25
|
+
function detectPlatformAndArch() {
|
|
26
|
+
const platform = platformMap[os.platform()] || os.platform()
|
|
27
|
+
const arch = archMap[os.arch()] || os.arch()
|
|
47
28
|
return { platform, arch }
|
|
48
29
|
}
|
|
49
30
|
|
|
50
|
-
function
|
|
31
|
+
function supportsAvx2() {
|
|
51
32
|
const { platform, arch } = detectPlatformAndArch()
|
|
52
|
-
|
|
53
|
-
const binaryName = platform === "windows" ? "fabric.exe" : "fabric" // kilocode_change
|
|
33
|
+
if (arch !== "x64") return false
|
|
54
34
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
if (!fs.existsSync(binaryPath)) {
|
|
62
|
-
throw new Error(`Binary not found at ${binaryPath}`)
|
|
35
|
+
if (platform === "linux") {
|
|
36
|
+
try {
|
|
37
|
+
return /(^|\s)avx2(\s|$)/i.test(fs.readFileSync("/proc/cpuinfo", "utf8"))
|
|
38
|
+
} catch {
|
|
39
|
+
return false
|
|
63
40
|
}
|
|
41
|
+
}
|
|
64
42
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
43
|
+
if (platform === "darwin") {
|
|
44
|
+
try {
|
|
45
|
+
const result = childProcess.spawnSync("sysctl", ["-n", "hw.optional.avx2_0"], {
|
|
46
|
+
encoding: "utf8",
|
|
47
|
+
timeout: 1500,
|
|
48
|
+
})
|
|
49
|
+
if (result.status !== 0) return false
|
|
50
|
+
return (result.stdout || "").trim() === "1"
|
|
51
|
+
} catch {
|
|
52
|
+
return false
|
|
53
|
+
}
|
|
68
54
|
}
|
|
69
|
-
}
|
|
70
55
|
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
const targetPath = path.join(binDir, binaryName)
|
|
56
|
+
return false
|
|
57
|
+
}
|
|
74
58
|
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
fs.
|
|
59
|
+
function isMusl() {
|
|
60
|
+
try {
|
|
61
|
+
if (fs.existsSync("/etc/alpine-release")) return true
|
|
62
|
+
} catch {
|
|
63
|
+
// ignore
|
|
78
64
|
}
|
|
79
65
|
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
66
|
+
try {
|
|
67
|
+
const result = childProcess.spawnSync("ldd", ["--version"], { encoding: "utf8" })
|
|
68
|
+
const text = ((result.stdout || "") + (result.stderr || "")).toLowerCase()
|
|
69
|
+
if (text.includes("musl")) return true
|
|
70
|
+
} catch {
|
|
71
|
+
// ignore
|
|
83
72
|
}
|
|
84
73
|
|
|
85
|
-
return
|
|
74
|
+
return false
|
|
86
75
|
}
|
|
87
76
|
|
|
88
|
-
function
|
|
89
|
-
const {
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
77
|
+
function getPackageNames() {
|
|
78
|
+
const { platform, arch } = detectPlatformAndArch()
|
|
79
|
+
const base = `@kilocode/cli-${platform}-${arch}`
|
|
80
|
+
const avx2 = supportsAvx2()
|
|
81
|
+
const baseline = arch === "x64" && !avx2
|
|
82
|
+
|
|
83
|
+
if (platform === "linux") {
|
|
84
|
+
const musl = isMusl()
|
|
85
|
+
if (musl) {
|
|
86
|
+
if (arch === "x64") {
|
|
87
|
+
if (baseline) return [`${base}-baseline-musl`, `${base}-musl`, `${base}-baseline`, base]
|
|
88
|
+
return [`${base}-musl`, `${base}-baseline-musl`, base, `${base}-baseline`]
|
|
89
|
+
}
|
|
90
|
+
return [`${base}-musl`, base]
|
|
91
|
+
}
|
|
92
|
+
if (arch === "x64") {
|
|
93
|
+
if (baseline) return [`${base}-baseline`, base, `${base}-baseline-musl`, `${base}-musl`]
|
|
94
|
+
return [base, `${base}-baseline`, `${base}-musl`, `${base}-baseline-musl`]
|
|
95
|
+
}
|
|
96
|
+
return [base, `${base}-musl`]
|
|
97
|
+
}
|
|
93
98
|
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
99
|
+
if (arch === "x64") {
|
|
100
|
+
if (baseline) return [`${base}-baseline`, base]
|
|
101
|
+
return [base, `${base}-baseline`]
|
|
97
102
|
}
|
|
103
|
+
return [base]
|
|
98
104
|
}
|
|
99
105
|
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
106
|
+
function findBinary() {
|
|
107
|
+
const { platform } = detectPlatformAndArch()
|
|
108
|
+
const binaryName = platform === "windows" ? "kilo.exe" : "kilo"
|
|
109
|
+
const names = getPackageNames()
|
|
110
|
+
|
|
111
|
+
for (const packageName of names) {
|
|
112
|
+
try {
|
|
113
|
+
const packageJsonPath = require.resolve(`${packageName}/package.json`)
|
|
114
|
+
const packageDir = path.dirname(packageJsonPath)
|
|
115
|
+
const binaryPath = path.join(packageDir, "bin", binaryName)
|
|
116
|
+
|
|
117
|
+
if (fs.existsSync(binaryPath)) {
|
|
118
|
+
return { binaryPath, binaryName }
|
|
119
|
+
}
|
|
120
|
+
} catch {
|
|
121
|
+
// package not installed, try next variant
|
|
107
122
|
}
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
throw new Error(`Could not find any binary package. Tried: ${names.map((n) => `"${n}"`).join(", ")}`)
|
|
126
|
+
}
|
|
127
|
+
// kilocode_change end
|
|
108
128
|
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
console.log(
|
|
113
|
-
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
|
|
129
|
+
function main() {
|
|
130
|
+
if (os.platform() === "win32") {
|
|
131
|
+
// On Windows, the .exe is already included in the package and bin field points to it
|
|
132
|
+
console.log("Windows detected: binary setup not needed (using packaged .exe)")
|
|
133
|
+
return
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
const { binaryPath } = findBinary()
|
|
137
|
+
const target = path.join(__dirname, "bin", ".kilo") // kilocode_change
|
|
138
|
+
if (fs.existsSync(target)) fs.unlinkSync(target)
|
|
139
|
+
try {
|
|
140
|
+
fs.linkSync(binaryPath, target)
|
|
141
|
+
} catch {
|
|
142
|
+
fs.copyFileSync(binaryPath, target)
|
|
117
143
|
}
|
|
144
|
+
fs.chmodSync(target, 0o755)
|
|
118
145
|
}
|
|
119
146
|
|
|
120
147
|
try {
|
|
121
148
|
main()
|
|
122
149
|
} catch (error) {
|
|
123
|
-
console.error("
|
|
124
|
-
process.exit(
|
|
150
|
+
console.error("Failed to setup kilo binary:", error.message)
|
|
151
|
+
process.exit(1)
|
|
125
152
|
}
|