@agentuity/cli 0.0.84 → 0.0.86
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/cli.ts +2 -0
- package/dist/bun-path.d.ts +9 -0
- package/dist/bun-path.d.ts.map +1 -0
- package/dist/bun-path.js +26 -0
- package/dist/bun-path.js.map +1 -0
- package/dist/cmd/build/bundler.d.ts +1 -1
- package/dist/cmd/build/bundler.d.ts.map +1 -1
- package/dist/cmd/build/bundler.js +89 -81
- package/dist/cmd/build/bundler.js.map +1 -1
- package/dist/cmd/dev/index.d.ts.map +1 -1
- package/dist/cmd/dev/index.js +6 -1
- package/dist/cmd/dev/index.js.map +1 -1
- package/dist/cmd/project/download.d.ts.map +1 -1
- package/dist/cmd/project/download.js +5 -15
- package/dist/cmd/project/download.js.map +1 -1
- package/dist/download.d.ts.map +1 -1
- package/dist/download.js +1 -6
- package/dist/download.js.map +1 -1
- package/dist/git-helper.d.ts +22 -0
- package/dist/git-helper.d.ts.map +1 -0
- package/dist/git-helper.js +71 -0
- package/dist/git-helper.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
- package/src/bun-path.ts +28 -0
- package/src/cmd/build/bundler.ts +103 -94
- package/src/cmd/dev/index.ts +6 -1
- package/src/cmd/project/download.ts +6 -14
- package/src/download.ts +1 -7
- package/src/git-helper.ts +74 -0
- package/src/index.ts +2 -0
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Git helper utilities for detecting and using git safely.
|
|
3
|
+
*
|
|
4
|
+
* On macOS, git may be a stub that triggers Xcode Command Line Tools installation popup.
|
|
5
|
+
* This helper detects the real git binary and provides safe wrappers.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Check if git is available and is the real git binary (not the macOS stub).
|
|
10
|
+
*
|
|
11
|
+
* On macOS without Xcode CLT installed, /usr/bin/git exists but it's a stub that
|
|
12
|
+
* triggers a popup asking to install developer tools. We detect this by checking
|
|
13
|
+
* if Xcode Command Line Tools are installed using `xcode-select -p`.
|
|
14
|
+
*
|
|
15
|
+
* @returns true if git is available and functional, false otherwise
|
|
16
|
+
*/
|
|
17
|
+
export async function isGitAvailable(): Promise<boolean> {
|
|
18
|
+
const gitPath = Bun.which('git');
|
|
19
|
+
if (!gitPath) {
|
|
20
|
+
return false;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
// On macOS, check if Xcode Command Line Tools are installed
|
|
24
|
+
// xcode-select -p returns 0 if tools are installed, non-zero otherwise
|
|
25
|
+
if (process.platform === 'darwin') {
|
|
26
|
+
try {
|
|
27
|
+
const result = Bun.spawnSync(['xcode-select', '-p'], {
|
|
28
|
+
stdout: 'pipe',
|
|
29
|
+
stderr: 'pipe',
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
// If xcode-select -p fails, CLT are not installed, git is just a stub
|
|
33
|
+
if (result.exitCode !== 0) {
|
|
34
|
+
return false;
|
|
35
|
+
}
|
|
36
|
+
} catch {
|
|
37
|
+
// xcode-select not found or error - assume git is not available
|
|
38
|
+
return false;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
// On other platforms, just verify git works
|
|
43
|
+
try {
|
|
44
|
+
const result = Bun.spawnSync(['git', '--version'], {
|
|
45
|
+
stdout: 'pipe',
|
|
46
|
+
stderr: 'pipe',
|
|
47
|
+
});
|
|
48
|
+
return result.exitCode === 0;
|
|
49
|
+
} catch {
|
|
50
|
+
return false;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Get the default branch name from git config, or 'main' as fallback.
|
|
56
|
+
* Returns null if git is not available.
|
|
57
|
+
*/
|
|
58
|
+
export async function getDefaultBranch(): Promise<string | null> {
|
|
59
|
+
if (!(await isGitAvailable())) {
|
|
60
|
+
return null;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
try {
|
|
64
|
+
const result = Bun.spawnSync(['git', 'config', '--global', 'init.defaultBranch']);
|
|
65
|
+
if (result.exitCode === 0) {
|
|
66
|
+
const branch = result.stdout.toString().trim();
|
|
67
|
+
return branch || 'main';
|
|
68
|
+
}
|
|
69
|
+
} catch {
|
|
70
|
+
// Ignore errors
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
return 'main';
|
|
74
|
+
}
|
package/src/index.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
export { createCLI, registerCommands } from './cli';
|
|
2
2
|
export { validateRuntime, isBun } from './runtime';
|
|
3
|
+
export { ensureBunOnPath } from './bun-path';
|
|
4
|
+
export { isGitAvailable, getDefaultBranch } from './git-helper';
|
|
3
5
|
export {
|
|
4
6
|
generateCLISchema,
|
|
5
7
|
type CLISchema,
|