@cubic-dev-ai/cli 0.14.0 → 0.15.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/package.json +12 -12
- package/postinstall.mjs +66 -31
package/package.json
CHANGED
|
@@ -7,18 +7,18 @@
|
|
|
7
7
|
"preinstall": "bun ./preinstall.mjs || node ./preinstall.mjs",
|
|
8
8
|
"postinstall": "bun ./postinstall.mjs || node ./postinstall.mjs"
|
|
9
9
|
},
|
|
10
|
-
"version": "0.
|
|
10
|
+
"version": "0.15.1",
|
|
11
11
|
"optionalDependencies": {
|
|
12
|
-
"@cubic-dev-ai/cli-linux-arm64": "0.
|
|
13
|
-
"@cubic-dev-ai/cli-linux-x64": "0.
|
|
14
|
-
"@cubic-dev-ai/cli-linux-x64-baseline": "0.
|
|
15
|
-
"@cubic-dev-ai/cli-linux-arm64-musl": "0.
|
|
16
|
-
"@cubic-dev-ai/cli-linux-x64-musl": "0.
|
|
17
|
-
"@cubic-dev-ai/cli-linux-x64-baseline-musl": "0.
|
|
18
|
-
"@cubic-dev-ai/cli-darwin-arm64": "0.
|
|
19
|
-
"@cubic-dev-ai/cli-darwin-x64": "0.
|
|
20
|
-
"@cubic-dev-ai/cli-darwin-x64-baseline": "0.
|
|
21
|
-
"@cubic-dev-ai/cli-windows-x64": "0.
|
|
22
|
-
"@cubic-dev-ai/cli-windows-x64-baseline": "0.
|
|
12
|
+
"@cubic-dev-ai/cli-linux-arm64": "0.15.1",
|
|
13
|
+
"@cubic-dev-ai/cli-linux-x64": "0.15.1",
|
|
14
|
+
"@cubic-dev-ai/cli-linux-x64-baseline": "0.15.1",
|
|
15
|
+
"@cubic-dev-ai/cli-linux-arm64-musl": "0.15.1",
|
|
16
|
+
"@cubic-dev-ai/cli-linux-x64-musl": "0.15.1",
|
|
17
|
+
"@cubic-dev-ai/cli-linux-x64-baseline-musl": "0.15.1",
|
|
18
|
+
"@cubic-dev-ai/cli-darwin-arm64": "0.15.1",
|
|
19
|
+
"@cubic-dev-ai/cli-darwin-x64": "0.15.1",
|
|
20
|
+
"@cubic-dev-ai/cli-darwin-x64-baseline": "0.15.1",
|
|
21
|
+
"@cubic-dev-ai/cli-windows-x64": "0.15.1",
|
|
22
|
+
"@cubic-dev-ai/cli-windows-x64-baseline": "0.15.1"
|
|
23
23
|
}
|
|
24
24
|
}
|
package/postinstall.mjs
CHANGED
|
@@ -123,48 +123,86 @@ async function regenerateWindowsCmdWrappers() {
|
|
|
123
123
|
}
|
|
124
124
|
}
|
|
125
125
|
|
|
126
|
-
// Install git-ai using official installer
|
|
126
|
+
// Install git-ai silently using official installer
|
|
127
127
|
// 2 minute timeout to prevent indefinite hangs during npm install
|
|
128
128
|
const GIT_AI_INSTALL_TIMEOUT = 120000
|
|
129
|
+
const GIT_AI_COMPATIBLE_MAJOR = 1
|
|
130
|
+
const GIT_AI_REPO_URL = "https://github.com/git-ai-project/git-ai"
|
|
131
|
+
|
|
132
|
+
function getGitAiBinary() {
|
|
133
|
+
return path.join(os.homedir(), ".git-ai", "bin", os.platform() === "win32" ? "git-ai.exe" : "git-ai")
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
// Returns "none", "compatible", or "incompatible"
|
|
137
|
+
function checkGitAiVersion() {
|
|
138
|
+
const binary = getGitAiBinary()
|
|
139
|
+
try {
|
|
140
|
+
fs.accessSync(binary, fs.constants.X_OK)
|
|
141
|
+
} catch {
|
|
142
|
+
return "none"
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
try {
|
|
146
|
+
const version = execSync(`"${binary}" --version`, { stdio: ["pipe", "pipe", "pipe"], timeout: 5000 })
|
|
147
|
+
.toString()
|
|
148
|
+
.trim()
|
|
149
|
+
const match = version.match(/^v?(\d+)\./)
|
|
150
|
+
if (!match) return "none"
|
|
151
|
+
return parseInt(match[1], 10) === GIT_AI_COMPATIBLE_MAJOR ? "compatible" : "incompatible"
|
|
152
|
+
} catch {
|
|
153
|
+
return "none"
|
|
154
|
+
}
|
|
155
|
+
}
|
|
129
156
|
|
|
130
157
|
function setupGitAi() {
|
|
131
158
|
// Allow users to opt-out of automatic git-ai installation
|
|
132
159
|
if (process.env.CUBIC_DISABLE_GIT_AI === "true") {
|
|
133
|
-
console.log("Skipping git-ai installation (CUBIC_DISABLE_GIT_AI=true)")
|
|
134
|
-
console.log("You can install it later with: cubic stats enable")
|
|
135
160
|
return
|
|
136
161
|
}
|
|
137
162
|
|
|
138
|
-
|
|
163
|
+
const status = checkGitAiVersion()
|
|
164
|
+
|
|
165
|
+
// Already have a compatible version — nothing to do
|
|
166
|
+
if (status === "compatible") return
|
|
139
167
|
|
|
168
|
+
// Incompatible version — warn and skip
|
|
169
|
+
if (status === "incompatible") {
|
|
170
|
+
console.warn(
|
|
171
|
+
"git-ai is already installed, but this version is incompatible with cubic AI stats. " +
|
|
172
|
+
"Please uninstall git-ai and run `cubic stats enable` to install a compatible version. " +
|
|
173
|
+
GIT_AI_REPO_URL,
|
|
174
|
+
)
|
|
175
|
+
return
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
// Not installed — install silently
|
|
140
179
|
try {
|
|
141
180
|
if (os.platform() === "win32") {
|
|
142
|
-
// PowerShell installer for Windows
|
|
143
181
|
execSync(
|
|
144
182
|
`powershell -NoProfile -ExecutionPolicy Bypass -Command "$env:GIT_AI_RELEASE_TAG='${GIT_AI_VERSION}'; irm https://usegitai.com/install.ps1 | iex"`,
|
|
145
|
-
{ stdio: "
|
|
183
|
+
{ stdio: "ignore", shell: true, timeout: GIT_AI_INSTALL_TIMEOUT },
|
|
146
184
|
)
|
|
147
185
|
} else {
|
|
148
|
-
// Bash installer for macOS/Linux
|
|
149
186
|
execSync(`export GIT_AI_RELEASE_TAG="${GIT_AI_VERSION}" && curl -sSL https://usegitai.com/install.sh | bash`, {
|
|
150
|
-
stdio: "
|
|
187
|
+
stdio: "ignore",
|
|
151
188
|
shell: "/bin/bash",
|
|
152
189
|
timeout: GIT_AI_INSTALL_TIMEOUT,
|
|
153
190
|
})
|
|
154
191
|
}
|
|
155
192
|
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
// Configure git-ai to run in quiet mode (suppress chart output after commits)
|
|
159
|
-
const gitAiBinary = path.join(os.homedir(), ".git-ai", "bin", os.platform() === "win32" ? "git-ai.exe" : "git-ai")
|
|
193
|
+
// Configure git-ai to run in quiet mode
|
|
194
|
+
const binary = getGitAiBinary()
|
|
160
195
|
try {
|
|
161
|
-
execSync(`"${
|
|
196
|
+
execSync(`"${binary}" config set quiet true`, { stdio: "ignore", timeout: 5000 })
|
|
162
197
|
} catch {
|
|
163
198
|
// Ignore if config fails - git-ai will work without quiet mode
|
|
164
199
|
}
|
|
165
200
|
} catch (error) {
|
|
166
|
-
console.warn(
|
|
167
|
-
|
|
201
|
+
console.warn(
|
|
202
|
+
"cubic AI stats use git-ai under the hood. git-ai failed to install. " +
|
|
203
|
+
"Make sure git-ai installation succeeds in order to use cubic AI stats. " +
|
|
204
|
+
GIT_AI_REPO_URL,
|
|
205
|
+
)
|
|
168
206
|
}
|
|
169
207
|
}
|
|
170
208
|
|
|
@@ -178,29 +216,26 @@ async function main() {
|
|
|
178
216
|
} else {
|
|
179
217
|
console.log("Windows detected but not npm, skipping binary symlink")
|
|
180
218
|
}
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
}
|
|
219
|
+
} else {
|
|
220
|
+
const binaryPath = findBinary()
|
|
221
|
+
const binScript = path.join(__dirname, "bin", "cubic")
|
|
185
222
|
|
|
186
|
-
|
|
187
|
-
|
|
223
|
+
// Remove existing bin script if it exists
|
|
224
|
+
if (fs.existsSync(binScript)) {
|
|
225
|
+
fs.unlinkSync(binScript)
|
|
226
|
+
}
|
|
188
227
|
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
228
|
+
// Create symlink to the actual binary
|
|
229
|
+
fs.symlinkSync(binaryPath, binScript)
|
|
230
|
+
console.log(`cubic binary symlinked: ${binScript} -> ${binaryPath}`)
|
|
192
231
|
}
|
|
193
|
-
|
|
194
|
-
// Create symlink to the actual binary
|
|
195
|
-
fs.symlinkSync(binaryPath, binScript)
|
|
196
|
-
console.log(`cubic binary symlinked: ${binScript} -> ${binaryPath}`)
|
|
197
|
-
|
|
198
|
-
// Install git-ai
|
|
199
|
-
setupGitAi()
|
|
200
232
|
} catch (error) {
|
|
201
233
|
console.error("Failed to create cubic binary symlink:", error.message)
|
|
202
234
|
process.exit(1)
|
|
203
235
|
}
|
|
236
|
+
|
|
237
|
+
// Only install git-ai after cubic binary is confirmed working
|
|
238
|
+
setupGitAi()
|
|
204
239
|
}
|
|
205
240
|
|
|
206
241
|
try {
|