@cluesmith/codev 2.0.0-rc.72 → 2.0.0-rc.73
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/dashboard/dist/assets/{index-C7FtNK6Y.css → index-4n9zpWLY.css} +1 -1
- package/dashboard/dist/assets/{index-CDAINZKT.js → index-CH_utkcW.js} +32 -27
- package/dashboard/dist/assets/index-CH_utkcW.js.map +1 -0
- package/dashboard/dist/index.html +2 -2
- package/dist/agent-farm/commands/spawn-roles.d.ts +80 -0
- package/dist/agent-farm/commands/spawn-roles.d.ts.map +1 -0
- package/dist/agent-farm/commands/spawn-roles.js +278 -0
- package/dist/agent-farm/commands/spawn-roles.js.map +1 -0
- package/dist/agent-farm/commands/spawn-worktree.d.ts +96 -0
- package/dist/agent-farm/commands/spawn-worktree.d.ts.map +1 -0
- package/dist/agent-farm/commands/spawn-worktree.js +305 -0
- package/dist/agent-farm/commands/spawn-worktree.js.map +1 -0
- package/dist/agent-farm/commands/spawn.d.ts +5 -1
- package/dist/agent-farm/commands/spawn.d.ts.map +1 -1
- package/dist/agent-farm/commands/spawn.js +65 -725
- package/dist/agent-farm/commands/spawn.js.map +1 -1
- package/dist/agent-farm/servers/tower-instances.d.ts +82 -0
- package/dist/agent-farm/servers/tower-instances.d.ts.map +1 -0
- package/dist/agent-farm/servers/tower-instances.js +441 -0
- package/dist/agent-farm/servers/tower-instances.js.map +1 -0
- package/dist/agent-farm/servers/tower-routes.d.ts +34 -0
- package/dist/agent-farm/servers/tower-routes.d.ts.map +1 -0
- package/dist/agent-farm/servers/tower-routes.js +1445 -0
- package/dist/agent-farm/servers/tower-routes.js.map +1 -0
- package/dist/agent-farm/servers/tower-server.d.ts +5 -2
- package/dist/agent-farm/servers/tower-server.d.ts.map +1 -1
- package/dist/agent-farm/servers/tower-server.js +74 -2860
- package/dist/agent-farm/servers/tower-server.js.map +1 -1
- package/dist/agent-farm/servers/tower-terminals.d.ts +119 -0
- package/dist/agent-farm/servers/tower-terminals.d.ts.map +1 -0
- package/dist/agent-farm/servers/tower-terminals.js +629 -0
- package/dist/agent-farm/servers/tower-terminals.js.map +1 -0
- package/dist/agent-farm/servers/tower-tunnel.d.ts +34 -0
- package/dist/agent-farm/servers/tower-tunnel.d.ts.map +1 -0
- package/dist/agent-farm/servers/tower-tunnel.js +299 -0
- package/dist/agent-farm/servers/tower-tunnel.js.map +1 -0
- package/dist/agent-farm/servers/tower-types.d.ts +85 -0
- package/dist/agent-farm/servers/tower-types.d.ts.map +1 -0
- package/dist/agent-farm/servers/tower-types.js +6 -0
- package/dist/agent-farm/servers/tower-types.js.map +1 -0
- package/dist/agent-farm/servers/tower-utils.d.ts +51 -0
- package/dist/agent-farm/servers/tower-utils.d.ts.map +1 -0
- package/dist/agent-farm/servers/tower-utils.js +161 -0
- package/dist/agent-farm/servers/tower-utils.js.map +1 -0
- package/dist/agent-farm/servers/tower-websocket.d.ts +25 -0
- package/dist/agent-farm/servers/tower-websocket.d.ts.map +1 -0
- package/dist/agent-farm/servers/tower-websocket.js +171 -0
- package/dist/agent-farm/servers/tower-websocket.js.map +1 -0
- package/package.json +1 -1
- package/dashboard/dist/assets/index-CDAINZKT.js.map +0 -1
|
@@ -0,0 +1,305 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Git worktree management, session creation, and pre-spawn utilities.
|
|
3
|
+
* Spec 0105: Tower Server Decomposition — Phase 7
|
|
4
|
+
*
|
|
5
|
+
* Handles worktree creation, dependency checking, porch initialization,
|
|
6
|
+
* bugfix collision detection, GitHub issue fetching, pre-spawn hooks,
|
|
7
|
+
* and terminal session creation via the Tower REST API.
|
|
8
|
+
*/
|
|
9
|
+
import { resolve } from 'node:path';
|
|
10
|
+
import { existsSync, writeFileSync, chmodSync, symlinkSync } from 'node:fs';
|
|
11
|
+
import { logger, fatal } from '../utils/logger.js';
|
|
12
|
+
import { run, commandExists } from '../utils/shell.js';
|
|
13
|
+
// Tower port — the single HTTP server since Spec 0090
|
|
14
|
+
export const DEFAULT_TOWER_PORT = 4100;
|
|
15
|
+
// =============================================================================
|
|
16
|
+
// Dependency Checks
|
|
17
|
+
// =============================================================================
|
|
18
|
+
/**
|
|
19
|
+
* Check for required dependencies
|
|
20
|
+
*/
|
|
21
|
+
export async function checkDependencies() {
|
|
22
|
+
if (!(await commandExists('git'))) {
|
|
23
|
+
fatal('git not found');
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
// =============================================================================
|
|
27
|
+
// Git Worktree Management
|
|
28
|
+
// =============================================================================
|
|
29
|
+
/**
|
|
30
|
+
* Create git branch and worktree
|
|
31
|
+
*/
|
|
32
|
+
export async function createWorktree(config, branchName, worktreePath) {
|
|
33
|
+
logger.info('Creating branch...');
|
|
34
|
+
try {
|
|
35
|
+
await run(`git branch ${branchName}`, { cwd: config.projectRoot });
|
|
36
|
+
}
|
|
37
|
+
catch (error) {
|
|
38
|
+
// Branch might already exist, that's OK
|
|
39
|
+
logger.debug(`Branch creation: ${error}`);
|
|
40
|
+
}
|
|
41
|
+
logger.info('Creating worktree...');
|
|
42
|
+
try {
|
|
43
|
+
await run(`git worktree add "${worktreePath}" ${branchName}`, { cwd: config.projectRoot });
|
|
44
|
+
}
|
|
45
|
+
catch (error) {
|
|
46
|
+
fatal(`Failed to create worktree: ${error}`);
|
|
47
|
+
}
|
|
48
|
+
// Symlink .env from project root into worktree (if it exists)
|
|
49
|
+
const rootEnvPath = resolve(config.projectRoot, '.env');
|
|
50
|
+
const worktreeEnvPath = resolve(worktreePath, '.env');
|
|
51
|
+
if (existsSync(rootEnvPath) && !existsSync(worktreeEnvPath)) {
|
|
52
|
+
try {
|
|
53
|
+
symlinkSync(rootEnvPath, worktreeEnvPath);
|
|
54
|
+
logger.info('Linked .env from project root');
|
|
55
|
+
}
|
|
56
|
+
catch (error) {
|
|
57
|
+
logger.debug(`Failed to symlink .env: ${error}`);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Pre-initialize porch in a worktree so the builder doesn't need to self-correct.
|
|
63
|
+
* Non-fatal: logs a warning on failure since the builder can still init manually.
|
|
64
|
+
*/
|
|
65
|
+
export async function initPorchInWorktree(worktreePath, protocol, projectId, projectName) {
|
|
66
|
+
logger.info('Initializing porch...');
|
|
67
|
+
try {
|
|
68
|
+
// Sanitize inputs to prevent shell injection (defense-in-depth;
|
|
69
|
+
// callers already use slugified names, but be safe)
|
|
70
|
+
const safeName = projectName.replace(/[^a-z0-9_-]/gi, '-');
|
|
71
|
+
const safeProto = protocol.replace(/[^a-z0-9_-]/gi, '');
|
|
72
|
+
const safeId = projectId.replace(/[^a-z0-9_-]/gi, '');
|
|
73
|
+
await run(`porch init ${safeProto} ${safeId} "${safeName}"`, { cwd: worktreePath });
|
|
74
|
+
logger.info(`Porch initialized: ${projectId}`);
|
|
75
|
+
}
|
|
76
|
+
catch (error) {
|
|
77
|
+
logger.warn(`Warning: Failed to initialize porch (builder can init manually): ${error}`);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Generate a slug from an issue title (max 30 chars, lowercase, alphanumeric + hyphens)
|
|
82
|
+
*/
|
|
83
|
+
export function slugify(title) {
|
|
84
|
+
return title
|
|
85
|
+
.toLowerCase()
|
|
86
|
+
.replace(/[^a-z0-9]+/g, '-') // Replace non-alphanumeric with hyphens
|
|
87
|
+
.replace(/-+/g, '-') // Collapse multiple hyphens
|
|
88
|
+
.replace(/^-|-$/g, '') // Trim leading/trailing hyphens
|
|
89
|
+
.slice(0, 30); // Max 30 chars
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Fetch a GitHub issue via gh CLI
|
|
93
|
+
*/
|
|
94
|
+
export async function fetchGitHubIssue(issueNumber) {
|
|
95
|
+
try {
|
|
96
|
+
const result = await run(`gh issue view ${issueNumber} --json title,body,state,comments`);
|
|
97
|
+
return JSON.parse(result.stdout);
|
|
98
|
+
}
|
|
99
|
+
catch (error) {
|
|
100
|
+
fatal(`Failed to fetch issue #${issueNumber}. Ensure 'gh' CLI is installed and authenticated.`);
|
|
101
|
+
throw error; // TypeScript doesn't know fatal() never returns
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
// =============================================================================
|
|
105
|
+
// Bugfix Collision Detection
|
|
106
|
+
// =============================================================================
|
|
107
|
+
/**
|
|
108
|
+
* Check for collision conditions before spawning bugfix
|
|
109
|
+
*/
|
|
110
|
+
export async function checkBugfixCollisions(issueNumber, worktreePath, issue, force) {
|
|
111
|
+
// 1. Check if worktree already exists
|
|
112
|
+
if (existsSync(worktreePath)) {
|
|
113
|
+
fatal(`Worktree already exists at ${worktreePath}\nRun: af cleanup --issue ${issueNumber}`);
|
|
114
|
+
}
|
|
115
|
+
// 2. Check for recent "On it" comments (< 24h old)
|
|
116
|
+
const onItComments = issue.comments.filter((c) => c.body.toLowerCase().includes('on it'));
|
|
117
|
+
if (onItComments.length > 0) {
|
|
118
|
+
const lastComment = onItComments[onItComments.length - 1];
|
|
119
|
+
const age = Date.now() - new Date(lastComment.createdAt).getTime();
|
|
120
|
+
const hoursAgo = Math.round(age / (1000 * 60 * 60));
|
|
121
|
+
if (hoursAgo < 24) {
|
|
122
|
+
if (!force) {
|
|
123
|
+
fatal(`Issue #${issueNumber} has "On it" comment from ${hoursAgo}h ago (by @${lastComment.author.login}).\nSomeone may already be working on this. Use --force to override.`);
|
|
124
|
+
}
|
|
125
|
+
logger.warn(`Warning: "On it" comment from ${hoursAgo}h ago - proceeding with --force`);
|
|
126
|
+
}
|
|
127
|
+
else {
|
|
128
|
+
logger.warn(`Warning: Stale "On it" comment (${hoursAgo}h ago). Proceeding.`);
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
// 3. Check for open PRs referencing this issue
|
|
132
|
+
try {
|
|
133
|
+
const prResult = await run(`gh pr list --search "in:body #${issueNumber}" --json number,title --limit 5`);
|
|
134
|
+
const openPRs = JSON.parse(prResult.stdout);
|
|
135
|
+
if (openPRs.length > 0) {
|
|
136
|
+
if (!force) {
|
|
137
|
+
const prList = openPRs.map((pr) => ` - PR #${pr.number}: ${pr.title}`).join('\n');
|
|
138
|
+
fatal(`Found ${openPRs.length} open PR(s) referencing issue #${issueNumber}:\n${prList}\nUse --force to proceed anyway.`);
|
|
139
|
+
}
|
|
140
|
+
logger.warn(`Warning: Found ${openPRs.length} open PR(s) referencing issue - proceeding with --force`);
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
catch {
|
|
144
|
+
// Non-fatal: continue if PR check fails
|
|
145
|
+
}
|
|
146
|
+
// 4. Warn if issue is already closed
|
|
147
|
+
if (issue.state === 'CLOSED') {
|
|
148
|
+
logger.warn(`Warning: Issue #${issueNumber} is already closed`);
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
// =============================================================================
|
|
152
|
+
// Pre-Spawn Hooks
|
|
153
|
+
// =============================================================================
|
|
154
|
+
/**
|
|
155
|
+
* Execute pre-spawn hooks defined in protocol.json
|
|
156
|
+
* Hooks are data-driven but reuse existing implementation logic
|
|
157
|
+
*/
|
|
158
|
+
export async function executePreSpawnHooks(protocol, context) {
|
|
159
|
+
if (!protocol?.hooks?.['pre-spawn'])
|
|
160
|
+
return;
|
|
161
|
+
const hooks = protocol.hooks['pre-spawn'];
|
|
162
|
+
// collision-check: reuses existing checkBugfixCollisions() logic
|
|
163
|
+
if (hooks['collision-check'] && context.issueNumber && context.issue && context.worktreePath) {
|
|
164
|
+
await checkBugfixCollisions(context.issueNumber, context.worktreePath, context.issue, !!context.force);
|
|
165
|
+
}
|
|
166
|
+
// comment-on-issue: posts comment to GitHub issue
|
|
167
|
+
if (hooks['comment-on-issue'] && context.issueNumber && !context.noComment) {
|
|
168
|
+
const message = hooks['comment-on-issue'];
|
|
169
|
+
logger.info('Commenting on issue...');
|
|
170
|
+
try {
|
|
171
|
+
await run(`gh issue comment ${context.issueNumber} --body "${message}"`);
|
|
172
|
+
}
|
|
173
|
+
catch {
|
|
174
|
+
logger.warn('Warning: Failed to comment on issue (continuing anyway)');
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
// =============================================================================
|
|
179
|
+
// Resume Validation
|
|
180
|
+
// =============================================================================
|
|
181
|
+
/**
|
|
182
|
+
* Validate that a worktree exists and is valid for resuming
|
|
183
|
+
*/
|
|
184
|
+
export function validateResumeWorktree(worktreePath) {
|
|
185
|
+
if (!existsSync(worktreePath)) {
|
|
186
|
+
fatal(`Cannot resume: worktree does not exist at ${worktreePath}`);
|
|
187
|
+
}
|
|
188
|
+
if (!existsSync(resolve(worktreePath, '.git'))) {
|
|
189
|
+
fatal(`Cannot resume: ${worktreePath} is not a valid git worktree`);
|
|
190
|
+
}
|
|
191
|
+
logger.info('Resuming existing worktree (skipping creation)');
|
|
192
|
+
}
|
|
193
|
+
// =============================================================================
|
|
194
|
+
// Terminal Session Creation
|
|
195
|
+
// =============================================================================
|
|
196
|
+
/**
|
|
197
|
+
* Create a terminal session via the Tower REST API.
|
|
198
|
+
* The Tower server must be running (port 4100).
|
|
199
|
+
*/
|
|
200
|
+
export async function createPtySession(config, command, args, cwd, registration) {
|
|
201
|
+
const body = { command, args, cwd, cols: 200, rows: 50, persistent: true };
|
|
202
|
+
if (registration) {
|
|
203
|
+
body.projectPath = registration.projectPath;
|
|
204
|
+
body.type = registration.type;
|
|
205
|
+
body.roleId = registration.roleId;
|
|
206
|
+
}
|
|
207
|
+
const response = await fetch(`http://localhost:${DEFAULT_TOWER_PORT}/api/terminals`, {
|
|
208
|
+
method: 'POST',
|
|
209
|
+
headers: { 'Content-Type': 'application/json' },
|
|
210
|
+
body: JSON.stringify(body),
|
|
211
|
+
});
|
|
212
|
+
if (!response.ok) {
|
|
213
|
+
const text = await response.text();
|
|
214
|
+
throw new Error(`Failed to create PTY session: ${response.status} ${text}`);
|
|
215
|
+
}
|
|
216
|
+
const result = await response.json();
|
|
217
|
+
return { terminalId: result.id };
|
|
218
|
+
}
|
|
219
|
+
/**
|
|
220
|
+
* Start a terminal session for a builder
|
|
221
|
+
*/
|
|
222
|
+
export async function startBuilderSession(config, builderId, worktreePath, baseCmd, prompt, roleContent, roleSource) {
|
|
223
|
+
logger.info('Creating terminal session...');
|
|
224
|
+
// Write initial prompt to a file for reference
|
|
225
|
+
const promptFile = resolve(worktreePath, '.builder-prompt.txt');
|
|
226
|
+
writeFileSync(promptFile, prompt);
|
|
227
|
+
// Build the start script with role if provided
|
|
228
|
+
const scriptPath = resolve(worktreePath, '.builder-start.sh');
|
|
229
|
+
let scriptContent;
|
|
230
|
+
if (roleContent) {
|
|
231
|
+
// Write role to a file and use $(cat) to avoid shell escaping issues
|
|
232
|
+
const roleFile = resolve(worktreePath, '.builder-role.md');
|
|
233
|
+
// Inject the actual dashboard port into the role prompt
|
|
234
|
+
const roleWithPort = roleContent.replace(/\{PORT\}/g, String(DEFAULT_TOWER_PORT));
|
|
235
|
+
writeFileSync(roleFile, roleWithPort);
|
|
236
|
+
logger.info(`Loaded role (${roleSource})`);
|
|
237
|
+
scriptContent = `#!/bin/bash
|
|
238
|
+
cd "${worktreePath}"
|
|
239
|
+
while true; do
|
|
240
|
+
${baseCmd} --append-system-prompt "$(cat '${roleFile}')" "$(cat '${promptFile}')"
|
|
241
|
+
echo ""
|
|
242
|
+
echo "Claude exited. Restarting in 2 seconds... (Ctrl+C to quit)"
|
|
243
|
+
sleep 2
|
|
244
|
+
done
|
|
245
|
+
`;
|
|
246
|
+
}
|
|
247
|
+
else {
|
|
248
|
+
scriptContent = `#!/bin/bash
|
|
249
|
+
cd "${worktreePath}"
|
|
250
|
+
while true; do
|
|
251
|
+
${baseCmd} "$(cat '${promptFile}')"
|
|
252
|
+
echo ""
|
|
253
|
+
echo "Claude exited. Restarting in 2 seconds... (Ctrl+C to quit)"
|
|
254
|
+
sleep 2
|
|
255
|
+
done
|
|
256
|
+
`;
|
|
257
|
+
}
|
|
258
|
+
writeFileSync(scriptPath, scriptContent);
|
|
259
|
+
chmodSync(scriptPath, '755');
|
|
260
|
+
// Create PTY session via Tower REST API (shepherd for persistence)
|
|
261
|
+
logger.info('Creating PTY terminal session...');
|
|
262
|
+
const { terminalId } = await createPtySession(config, '/bin/bash', [scriptPath], worktreePath, { projectPath: config.projectRoot, type: 'builder', roleId: builderId });
|
|
263
|
+
logger.info(`Terminal session created: ${terminalId}`);
|
|
264
|
+
return { terminalId };
|
|
265
|
+
}
|
|
266
|
+
/**
|
|
267
|
+
* Start a shell session (no worktree, just node-pty)
|
|
268
|
+
*/
|
|
269
|
+
export async function startShellSession(config, shellId, baseCmd) {
|
|
270
|
+
// Create PTY session via REST API
|
|
271
|
+
logger.info('Creating PTY terminal session for shell...');
|
|
272
|
+
const { terminalId } = await createPtySession(config, '/bin/bash', ['-c', baseCmd], config.projectRoot, { projectPath: config.projectRoot, type: 'shell', roleId: shellId });
|
|
273
|
+
logger.info(`Shell terminal session created: ${terminalId}`);
|
|
274
|
+
return { terminalId };
|
|
275
|
+
}
|
|
276
|
+
/**
|
|
277
|
+
* Build a launch script for worktree mode (no initial prompt)
|
|
278
|
+
*/
|
|
279
|
+
export function buildWorktreeLaunchScript(worktreePath, baseCmd, role) {
|
|
280
|
+
if (role) {
|
|
281
|
+
const roleFile = resolve(worktreePath, '.builder-role.md');
|
|
282
|
+
const roleWithPort = role.content.replace(/\{PORT\}/g, String(DEFAULT_TOWER_PORT));
|
|
283
|
+
writeFileSync(roleFile, roleWithPort);
|
|
284
|
+
logger.info(`Loaded role (${role.source})`);
|
|
285
|
+
return `#!/bin/bash
|
|
286
|
+
cd "${worktreePath}"
|
|
287
|
+
while true; do
|
|
288
|
+
${baseCmd} --append-system-prompt "$(cat '${roleFile}')"
|
|
289
|
+
echo ""
|
|
290
|
+
echo "Claude exited. Restarting in 2 seconds... (Ctrl+C to quit)"
|
|
291
|
+
sleep 2
|
|
292
|
+
done
|
|
293
|
+
`;
|
|
294
|
+
}
|
|
295
|
+
return `#!/bin/bash
|
|
296
|
+
cd "${worktreePath}"
|
|
297
|
+
while true; do
|
|
298
|
+
${baseCmd}
|
|
299
|
+
echo ""
|
|
300
|
+
echo "Claude exited. Restarting in 2 seconds... (Ctrl+C to quit)"
|
|
301
|
+
sleep 2
|
|
302
|
+
done
|
|
303
|
+
`;
|
|
304
|
+
}
|
|
305
|
+
//# sourceMappingURL=spawn-worktree.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"spawn-worktree.js","sourceRoot":"","sources":["../../../src/agent-farm/commands/spawn-worktree.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAE5E,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,GAAG,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAEvD,sDAAsD;AACtD,MAAM,CAAC,MAAM,kBAAkB,GAAG,IAAI,CAAC;AAEvC,gFAAgF;AAChF,oBAAoB;AACpB,gFAAgF;AAEhF;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,iBAAiB;IACrC,IAAI,CAAC,CAAC,MAAM,aAAa,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC;QAClC,KAAK,CAAC,eAAe,CAAC,CAAC;IACzB,CAAC;AACH,CAAC;AAED,gFAAgF;AAChF,0BAA0B;AAC1B,gFAAgF;AAEhF;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,cAAc,CAAC,MAAc,EAAE,UAAkB,EAAE,YAAoB;IAC3F,MAAM,CAAC,IAAI,CAAC,oBAAoB,CAAC,CAAC;IAClC,IAAI,CAAC;QACH,MAAM,GAAG,CAAC,cAAc,UAAU,EAAE,EAAE,EAAE,GAAG,EAAE,MAAM,CAAC,WAAW,EAAE,CAAC,CAAC;IACrE,CAAC;IAAC,OAAO,KA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AAC,EACf,MAAM,CAAC,WAAW,EAClB,EAAE,WAAW,EAAE,MAAM,CAAC,WAAW,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,CACpE,CAAC;IACF,MAAM,CAAC,IAAI,CAAC,mCAAmC,UAAU,EAAE,CAAC,CAAC;IAC7D,OAAO,EAAE,UAAU,EAAE,CAAC;AACxB,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,yBAAyB,CACvC,YAAoB,EACpB,OAAe,EACf,IAAgD;IAEhD,IAAI,IAAI,EAAE,CAAC;QACT,MAAM,QAAQ,GAAG,OAAO,CAAC,YAAY,EAAE,kBAAkB,CAAC,CAAC;QAC3D,MAAM,YAAY,GAAG,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,WAAW,EAAE,MAAM,CAAC,kBAAkB,CAAC,CAAC,CAAC;QACnF,aAAa,CAAC,QAAQ,EAAE,YAAY,CAAC,CAAC;QACtC,MAAM,CAAC,IAAI,CAAC,gBAAgB,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC;QAC5C,OAAO;MACL,YAAY;;IAEd,OAAO,mCAAmC,QAAQ;;;;;CAKrD,CAAC;IACA,CAAC;IACD,OAAO;MACH,YAAY;;IAEd,OAAO;;;;;CAKV,CAAC;AACF,CAAC"}
|
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Spawn command
|
|
2
|
+
* Spawn command — orchestrator module.
|
|
3
|
+
* Spec 0105: Tower Server Decomposition — Phase 7
|
|
3
4
|
*
|
|
4
5
|
* Modes:
|
|
5
6
|
* - spec: --project/-p Spawn for a spec file (existing behavior)
|
|
6
7
|
* - task: --task Spawn with an ad-hoc task description
|
|
7
8
|
* - protocol: --protocol Spawn to run a protocol (cleanup, experiment, etc.)
|
|
8
9
|
* - shell: --shell Bare Claude session (no prompt, no worktree)
|
|
10
|
+
*
|
|
11
|
+
* Role/prompt logic extracted to spawn-roles.ts.
|
|
12
|
+
* Worktree/git logic extracted to spawn-worktree.ts.
|
|
9
13
|
*/
|
|
10
14
|
import type { SpawnOptions } from '../types.js';
|
|
11
15
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"spawn.d.ts","sourceRoot":"","sources":["../../../src/agent-farm/commands/spawn.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"spawn.d.ts","sourceRoot":"","sources":["../../../src/agent-farm/commands/spawn.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAIH,OAAO,KAAK,EAAE,YAAY,EAAgC,MAAM,aAAa,CAAC;AAyf9E;;GAEG;AACH,wBAAsB,KAAK,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CA6ChE"}
|