@bradygaster/squad-cli 0.9.5-insider.1 → 0.9.5-insider.2
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/dist/cli/commands/preset.d.ts +24 -0
- package/dist/cli/commands/preset.d.ts.map +1 -0
- package/dist/cli/commands/preset.js +352 -0
- package/dist/cli/commands/preset.js.map +1 -0
- package/dist/cli/commands/watch/capabilities/board.d.ts.map +1 -1
- package/dist/cli/commands/watch/capabilities/board.js +7 -10
- package/dist/cli/commands/watch/capabilities/board.js.map +1 -1
- package/dist/cli/commands/watch/capabilities/fleet-dispatch.d.ts.map +1 -1
- package/dist/cli/commands/watch/capabilities/fleet-dispatch.js +7 -13
- package/dist/cli/commands/watch/capabilities/fleet-dispatch.js.map +1 -1
- package/dist/cli/commands/watch/capabilities/self-pull.d.ts.map +1 -1
- package/dist/cli/commands/watch/capabilities/self-pull.js +9 -10
- package/dist/cli/commands/watch/capabilities/self-pull.js.map +1 -1
- package/dist/cli/commands/watch/capabilities/two-pass.d.ts.map +1 -1
- package/dist/cli/commands/watch/capabilities/two-pass.js +5 -7
- package/dist/cli/commands/watch/capabilities/two-pass.js.map +1 -1
- package/dist/cli/commands/watch/types.d.ts +1 -5
- package/dist/cli/commands/watch/types.d.ts.map +1 -1
- package/dist/cli/core/gh-cli.d.ts.map +1 -1
- package/dist/cli/core/gh-cli.js +6 -7
- package/dist/cli/core/gh-cli.js.map +1 -1
- package/dist/cli/core/init.d.ts +0 -10
- package/dist/cli/core/init.d.ts.map +1 -1
- package/dist/cli/core/init.js +0 -53
- package/dist/cli/core/init.js.map +1 -1
- package/dist/cli/index.d.ts +0 -2
- package/dist/cli/index.d.ts.map +1 -1
- package/dist/cli/index.js +0 -2
- package/dist/cli/index.js.map +1 -1
- package/dist/cli-entry.js +45 -6
- package/dist/cli-entry.js.map +1 -1
- package/package.json +4 -4
- package/dist/cli/commands/skill.d.ts +0 -31
- package/dist/cli/commands/skill.d.ts.map +0 -1
- package/dist/cli/commands/skill.js +0 -496
- package/dist/cli/commands/skill.js.map +0 -1
- package/dist/cli/commands/watch/agent-spawn.d.ts +0 -62
- package/dist/cli/commands/watch/agent-spawn.d.ts.map +0 -1
- package/dist/cli/commands/watch/agent-spawn.js +0 -127
- package/dist/cli/commands/watch/agent-spawn.js.map +0 -1
|
@@ -1,127 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Shared agent spawn utilities for watch capabilities.
|
|
3
|
-
*
|
|
4
|
-
* Centralises `buildAgentCommand()` and `spawnWithTimeout()` so every
|
|
5
|
-
* capability uses the same logic, respects `agentCmd` from config,
|
|
6
|
-
* and works on Windows (shell: true when win32).
|
|
7
|
-
*
|
|
8
|
-
* @see https://github.com/bradygaster/squad/issues/920
|
|
9
|
-
* @see https://github.com/bradygaster/squad/issues/923
|
|
10
|
-
*/
|
|
11
|
-
import { execFile, execFileSync } from 'node:child_process';
|
|
12
|
-
/** True when running on Windows — used to gate `shell: true`. */
|
|
13
|
-
export const IS_WINDOWS = process.platform === 'win32';
|
|
14
|
-
/**
|
|
15
|
-
* Cached result of copilot CLI detection.
|
|
16
|
-
* `null` means we haven't checked yet.
|
|
17
|
-
*/
|
|
18
|
-
let _copilotResolved = null;
|
|
19
|
-
/**
|
|
20
|
-
* Detect which copilot CLI is available at runtime.
|
|
21
|
-
*
|
|
22
|
-
* Tries standalone `copilot` first (modern default). If that fails,
|
|
23
|
-
* falls back to `gh copilot` (legacy). The result is cached for the
|
|
24
|
-
* lifetime of the process so we only shell-out once.
|
|
25
|
-
*
|
|
26
|
-
* @returns `{ cmd, cmdPrefix }` — e.g. `{ cmd: 'copilot', cmdPrefix: [] }`
|
|
27
|
-
* or `{ cmd: 'gh', cmdPrefix: ['copilot'] }`.
|
|
28
|
-
*/
|
|
29
|
-
export function resolveCopilotCmd() {
|
|
30
|
-
if (_copilotResolved)
|
|
31
|
-
return _copilotResolved;
|
|
32
|
-
try {
|
|
33
|
-
execFileSync('copilot', ['--version'], {
|
|
34
|
-
stdio: 'ignore',
|
|
35
|
-
timeout: 5_000,
|
|
36
|
-
shell: IS_WINDOWS,
|
|
37
|
-
});
|
|
38
|
-
_copilotResolved = { cmd: 'copilot', cmdPrefix: [] };
|
|
39
|
-
}
|
|
40
|
-
catch {
|
|
41
|
-
// Standalone copilot not found — fall back to gh copilot
|
|
42
|
-
_copilotResolved = { cmd: 'gh', cmdPrefix: ['copilot'] };
|
|
43
|
-
}
|
|
44
|
-
return _copilotResolved;
|
|
45
|
-
}
|
|
46
|
-
/**
|
|
47
|
-
* Reset the cached copilot detection. Exported for testing only.
|
|
48
|
-
* @internal
|
|
49
|
-
*/
|
|
50
|
-
export function _resetCopilotDetection() {
|
|
51
|
-
_copilotResolved = null;
|
|
52
|
-
}
|
|
53
|
-
/**
|
|
54
|
-
* Build the command + args array for an agent invocation.
|
|
55
|
-
*
|
|
56
|
-
* Resolution order:
|
|
57
|
-
* 1. `context.agentCmd` (explicit override from config / CLI)
|
|
58
|
-
* 2. Runtime detection via `resolveCopilotCmd()`:
|
|
59
|
-
* - standalone `copilot` if available on PATH
|
|
60
|
-
* - `gh copilot` as fallback
|
|
61
|
-
*/
|
|
62
|
-
export function buildAgentCommand(prompt, context) {
|
|
63
|
-
if (context.agentCmd) {
|
|
64
|
-
const parts = context.agentCmd.trim().split(/\s+/);
|
|
65
|
-
const cmd = parts[0];
|
|
66
|
-
const args = [...parts.slice(1), '--message', prompt];
|
|
67
|
-
return { cmd, args };
|
|
68
|
-
}
|
|
69
|
-
// Default: detect available copilot CLI at runtime (cached)
|
|
70
|
-
const { cmd, cmdPrefix } = resolveCopilotCmd();
|
|
71
|
-
const args = [...cmdPrefix, '--message', prompt];
|
|
72
|
-
if (context.copilotFlags) {
|
|
73
|
-
args.push(...context.copilotFlags.trim().split(/\s+/));
|
|
74
|
-
}
|
|
75
|
-
return { cmd, args };
|
|
76
|
-
}
|
|
77
|
-
/**
|
|
78
|
-
* Spawn an agent command with a timeout.
|
|
79
|
-
*
|
|
80
|
-
* Uses `shell: true` on Windows so that `.cmd`/`.bat` wrappers and
|
|
81
|
-
* PATH resolution work correctly.
|
|
82
|
-
*/
|
|
83
|
-
export function spawnWithTimeout(cmd, args, cwd, timeoutMs) {
|
|
84
|
-
return new Promise((resolve, reject) => {
|
|
85
|
-
execFile(cmd, args, {
|
|
86
|
-
cwd,
|
|
87
|
-
timeout: timeoutMs,
|
|
88
|
-
maxBuffer: 50 * 1024 * 1024,
|
|
89
|
-
shell: IS_WINDOWS,
|
|
90
|
-
}, (err) => {
|
|
91
|
-
if (err) {
|
|
92
|
-
const execErr = err;
|
|
93
|
-
reject(new Error(execErr.killed
|
|
94
|
-
? `Timed out after ${Math.round(timeoutMs / 1000)}s`
|
|
95
|
-
: execErr.message));
|
|
96
|
-
}
|
|
97
|
-
else {
|
|
98
|
-
resolve();
|
|
99
|
-
}
|
|
100
|
-
});
|
|
101
|
-
});
|
|
102
|
-
}
|
|
103
|
-
/**
|
|
104
|
-
* Spawn an agent command with a timeout, resolving with success/error
|
|
105
|
-
* instead of rejecting. Used by execute and wave-dispatch where the
|
|
106
|
-
* caller wants to handle failure without try/catch.
|
|
107
|
-
*/
|
|
108
|
-
export function spawnAgent(cmd, args, cwd, timeoutMs) {
|
|
109
|
-
return new Promise((resolve) => {
|
|
110
|
-
execFile(cmd, args, {
|
|
111
|
-
cwd,
|
|
112
|
-
timeout: timeoutMs,
|
|
113
|
-
maxBuffer: 50 * 1024 * 1024,
|
|
114
|
-
shell: IS_WINDOWS,
|
|
115
|
-
}, (err) => {
|
|
116
|
-
if (err) {
|
|
117
|
-
const execErr = err;
|
|
118
|
-
const msg = execErr.killed ? 'Timed out' : execErr.message;
|
|
119
|
-
resolve({ success: false, error: msg });
|
|
120
|
-
}
|
|
121
|
-
else {
|
|
122
|
-
resolve({ success: true });
|
|
123
|
-
}
|
|
124
|
-
});
|
|
125
|
-
});
|
|
126
|
-
}
|
|
127
|
-
//# sourceMappingURL=agent-spawn.js.map
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