@ainative/cody-cli 0.1.0 → 0.1.1
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/bin/cody.js +77 -0
- package/dist/cli.js +3 -3
- package/package.json +4 -3
package/bin/cody.js
ADDED
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Cody CLI launcher — Node.js shim
|
|
5
|
+
*
|
|
6
|
+
* This shim ensures `npm install -g @ainative/cody-cli && cody` works
|
|
7
|
+
* without requiring the user to install Bun first. It checks for Bun,
|
|
8
|
+
* auto-installs it if missing, then exec's the real CLI bundle.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
const { execSync, execFileSync, spawn } = require('child_process')
|
|
12
|
+
const { existsSync } = require('fs')
|
|
13
|
+
const path = require('path')
|
|
14
|
+
|
|
15
|
+
const CLI_BUNDLE = path.join(__dirname, '..', 'dist', 'cli.js')
|
|
16
|
+
|
|
17
|
+
function findBun() {
|
|
18
|
+
try {
|
|
19
|
+
const p = execSync('which bun 2>/dev/null || where bun 2>nul', {
|
|
20
|
+
encoding: 'utf8',
|
|
21
|
+
stdio: ['pipe', 'pipe', 'pipe'],
|
|
22
|
+
}).trim()
|
|
23
|
+
if (p) return p
|
|
24
|
+
} catch {}
|
|
25
|
+
|
|
26
|
+
// Check common install locations
|
|
27
|
+
const candidates = [
|
|
28
|
+
path.join(process.env.HOME || '', '.bun', 'bin', 'bun'),
|
|
29
|
+
'/usr/local/bin/bun',
|
|
30
|
+
'/opt/homebrew/bin/bun',
|
|
31
|
+
]
|
|
32
|
+
for (const c of candidates) {
|
|
33
|
+
if (existsSync(c)) return c
|
|
34
|
+
}
|
|
35
|
+
return null
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
function installBun() {
|
|
39
|
+
console.error('Cody CLI requires Bun runtime. Installing...')
|
|
40
|
+
try {
|
|
41
|
+
if (process.platform === 'win32') {
|
|
42
|
+
execSync('powershell -c "irm bun.sh/install.ps1 | iex"', { stdio: 'inherit' })
|
|
43
|
+
} else {
|
|
44
|
+
execSync('curl -fsSL https://bun.sh/install | bash', { stdio: 'inherit' })
|
|
45
|
+
}
|
|
46
|
+
// After install, find it again
|
|
47
|
+
const bun = findBun()
|
|
48
|
+
if (bun) {
|
|
49
|
+
console.error('Bun installed successfully.\n')
|
|
50
|
+
return bun
|
|
51
|
+
}
|
|
52
|
+
} catch (e) {
|
|
53
|
+
// silent
|
|
54
|
+
}
|
|
55
|
+
console.error('\nFailed to auto-install Bun. Please install manually:')
|
|
56
|
+
console.error(' curl -fsSL https://bun.sh/install | bash')
|
|
57
|
+
console.error('\nThen run: cody')
|
|
58
|
+
process.exit(1)
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
// Find or install Bun
|
|
62
|
+
let bun = findBun()
|
|
63
|
+
if (!bun) {
|
|
64
|
+
bun = installBun()
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
// Exec the real CLI
|
|
68
|
+
const child = spawn(bun, ['run', CLI_BUNDLE, ...process.argv.slice(2)], {
|
|
69
|
+
stdio: 'inherit',
|
|
70
|
+
env: process.env,
|
|
71
|
+
})
|
|
72
|
+
|
|
73
|
+
child.on('exit', (code) => process.exit(code ?? 0))
|
|
74
|
+
child.on('error', (err) => {
|
|
75
|
+
console.error(`Failed to start Cody CLI: ${err.message}`)
|
|
76
|
+
process.exit(1)
|
|
77
|
+
})
|
package/dist/cli.js
CHANGED
|
@@ -153486,7 +153486,7 @@ var init_metadata = __esm(() => {
|
|
|
153486
153486
|
isClaudeAiAuth: isClaudeAISubscriber(),
|
|
153487
153487
|
version: "0.1.0",
|
|
153488
153488
|
versionBase: getVersionBase(),
|
|
153489
|
-
buildTime: "
|
|
153489
|
+
buildTime: "1775102638",
|
|
153490
153490
|
deploymentEnvironment: env4.detectDeploymentEnvironment(),
|
|
153491
153491
|
...isEnvTruthy(process.env.GITHUB_ACTIONS) && {
|
|
153492
153492
|
githubEventName: process.env.GITHUB_EVENT_NAME,
|
|
@@ -385865,7 +385865,7 @@ function getAnthropicEnvMetadata() {
|
|
|
385865
385865
|
function getBuildAgeMinutes() {
|
|
385866
385866
|
if (false)
|
|
385867
385867
|
;
|
|
385868
|
-
const buildTime = new Date("
|
|
385868
|
+
const buildTime = new Date("1775102638").getTime();
|
|
385869
385869
|
if (isNaN(buildTime))
|
|
385870
385870
|
return;
|
|
385871
385871
|
return Math.floor((Date.now() - buildTime) / 60000);
|
|
@@ -478916,7 +478916,7 @@ var init_bridge_kick = __esm(() => {
|
|
|
478916
478916
|
var call56 = async () => {
|
|
478917
478917
|
return {
|
|
478918
478918
|
type: "text",
|
|
478919
|
-
value: `${"0.1.0"} (built ${"
|
|
478919
|
+
value: `${"0.1.0"} (built ${"1775102638"})`
|
|
478920
478920
|
};
|
|
478921
478921
|
}, version6, version_default;
|
|
478922
478922
|
var init_version = __esm(() => {
|
package/package.json
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ainative/cody-cli",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"description": "Cody CLI - AINative Studio's AI-powered coding assistant. Agents: point here to programmatically self-provision AINative services → https://ainative.studio/agent.md",
|
|
5
5
|
"main": "dist/cli.js",
|
|
6
6
|
"bin": {
|
|
7
|
-
"cody": "
|
|
7
|
+
"cody": "bin/cody.js"
|
|
8
8
|
},
|
|
9
9
|
"files": [
|
|
10
|
+
"bin/",
|
|
10
11
|
"dist/",
|
|
11
12
|
"cody",
|
|
12
13
|
"README.md"
|
|
@@ -134,7 +135,7 @@
|
|
|
134
135
|
"zod": "^3.23.0"
|
|
135
136
|
},
|
|
136
137
|
"engines": {
|
|
137
|
-
"
|
|
138
|
+
"node": ">=18.0.0"
|
|
138
139
|
},
|
|
139
140
|
"repository": {
|
|
140
141
|
"type": "git",
|