sessioncast-cli 2.0.1 → 2.0.3
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/agent/runner.js +23 -0
- package/dist/agent/session-handler.d.ts +1 -2
- package/dist/agent/session-handler.js +32 -77
- package/dist/agent/tmux-executor.d.ts +3 -33
- package/dist/agent/tmux-executor.js +3 -50
- package/dist/agent/tmux.d.ts +2 -6
- package/dist/agent/tmux.js +2 -9
- package/dist/agent/types.d.ts +0 -10
- package/dist/agent/websocket.d.ts +2 -18
- package/dist/agent/websocket.js +9 -26
- package/dist/commands/agent.js +3 -0
- package/dist/index.js +14 -0
- package/dist/sentry.d.ts +4 -0
- package/dist/sentry.js +87 -0
- package/package.json +2 -1
- package/dist/autopilot/index.d.ts +0 -94
- package/dist/autopilot/index.js +0 -322
- package/dist/autopilot/mission-analyzer.d.ts +0 -27
- package/dist/autopilot/mission-analyzer.js +0 -232
- package/dist/autopilot/project-detector.d.ts +0 -12
- package/dist/autopilot/project-detector.js +0 -326
- package/dist/autopilot/source-scanner.d.ts +0 -26
- package/dist/autopilot/source-scanner.js +0 -285
- package/dist/autopilot/speckit-generator.d.ts +0 -60
- package/dist/autopilot/speckit-generator.js +0 -511
- package/dist/autopilot/types.d.ts +0 -110
- package/dist/autopilot/types.js +0 -6
- package/dist/autopilot/workflow-generator.d.ts +0 -33
- package/dist/autopilot/workflow-generator.js +0 -278
- package/dist/commands/autopilot.d.ts +0 -30
- package/dist/commands/autopilot.js +0 -262
- package/dist/commands/project.d.ts +0 -33
- package/dist/commands/project.js +0 -350
- package/dist/project/executor.d.ts +0 -73
- package/dist/project/executor.js +0 -437
- package/dist/project/index.d.ts +0 -4
- package/dist/project/index.js +0 -20
- package/dist/project/manager.d.ts +0 -66
- package/dist/project/manager.js +0 -290
- package/dist/project/relay-client.d.ts +0 -37
- package/dist/project/relay-client.js +0 -204
- package/dist/project/types.d.ts +0 -48
- package/dist/project/types.js +0 -3
- package/dist/utils/fileUtils.d.ts +0 -28
- package/dist/utils/fileUtils.js +0 -159
|
@@ -1,511 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Speckit Generator - Convert AutoPilot workflow to Speckit format
|
|
4
|
-
*
|
|
5
|
-
* Speckit is a structured markdown format for development plans:
|
|
6
|
-
* - plan.md: Technical context, goals, architecture decisions
|
|
7
|
-
* - tasks.md: Step-by-step task list with T-x.y IDs, dependencies, validation
|
|
8
|
-
*
|
|
9
|
-
* Reference: https://github.com/devload/claude-planflow-skills
|
|
10
|
-
*/
|
|
11
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
12
|
-
if (k2 === undefined) k2 = k;
|
|
13
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
14
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
15
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
16
|
-
}
|
|
17
|
-
Object.defineProperty(o, k2, desc);
|
|
18
|
-
}) : (function(o, m, k, k2) {
|
|
19
|
-
if (k2 === undefined) k2 = k;
|
|
20
|
-
o[k2] = m[k];
|
|
21
|
-
}));
|
|
22
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
23
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
24
|
-
}) : function(o, v) {
|
|
25
|
-
o["default"] = v;
|
|
26
|
-
});
|
|
27
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
28
|
-
var ownKeys = function(o) {
|
|
29
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
30
|
-
var ar = [];
|
|
31
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
32
|
-
return ar;
|
|
33
|
-
};
|
|
34
|
-
return ownKeys(o);
|
|
35
|
-
};
|
|
36
|
-
return function (mod) {
|
|
37
|
-
if (mod && mod.__esModule) return mod;
|
|
38
|
-
var result = {};
|
|
39
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
40
|
-
__setModuleDefault(result, mod);
|
|
41
|
-
return result;
|
|
42
|
-
};
|
|
43
|
-
})();
|
|
44
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
45
|
-
exports.generateSpeckit = generateSpeckit;
|
|
46
|
-
exports.saveSpeckit = saveSpeckit;
|
|
47
|
-
exports.generateQuickSpeckit = generateQuickSpeckit;
|
|
48
|
-
const fs = __importStar(require("fs"));
|
|
49
|
-
const path = __importStar(require("path"));
|
|
50
|
-
/**
|
|
51
|
-
* Generate Speckit files from AutoPilot context
|
|
52
|
-
*/
|
|
53
|
-
function generateSpeckit(context) {
|
|
54
|
-
const featureName = sanitizeFeatureName(context.mission);
|
|
55
|
-
const timestamp = formatDate(new Date());
|
|
56
|
-
// Convert workflow steps to Speckit tasks
|
|
57
|
-
const phases = convertToPhases(context);
|
|
58
|
-
// Generate plan.md
|
|
59
|
-
const planMd = generatePlanMd({
|
|
60
|
-
featureName,
|
|
61
|
-
timestamp,
|
|
62
|
-
mission: context.mission,
|
|
63
|
-
projectType: context.projectType,
|
|
64
|
-
projectName: context.projectName,
|
|
65
|
-
projectStructure: context.projectStructure,
|
|
66
|
-
analysis: context.analysis,
|
|
67
|
-
workflow: context.workflow
|
|
68
|
-
});
|
|
69
|
-
// Generate tasks.md
|
|
70
|
-
const tasksMd = generateTasksMd({
|
|
71
|
-
featureName,
|
|
72
|
-
timestamp,
|
|
73
|
-
phases,
|
|
74
|
-
workflow: context.workflow
|
|
75
|
-
});
|
|
76
|
-
const outputDir = path.join(context.workingDir, '.sessioncast', 'specs', featureName);
|
|
77
|
-
return {
|
|
78
|
-
featureName,
|
|
79
|
-
planMd,
|
|
80
|
-
tasksMd,
|
|
81
|
-
outputDir
|
|
82
|
-
};
|
|
83
|
-
}
|
|
84
|
-
/**
|
|
85
|
-
* Save Speckit files to disk
|
|
86
|
-
*/
|
|
87
|
-
function saveSpeckit(speckit) {
|
|
88
|
-
// Ensure directory exists
|
|
89
|
-
if (!fs.existsSync(speckit.outputDir)) {
|
|
90
|
-
fs.mkdirSync(speckit.outputDir, { recursive: true });
|
|
91
|
-
}
|
|
92
|
-
const planPath = path.join(speckit.outputDir, 'plan.md');
|
|
93
|
-
const tasksPath = path.join(speckit.outputDir, 'tasks.md');
|
|
94
|
-
fs.writeFileSync(planPath, speckit.planMd, 'utf-8');
|
|
95
|
-
fs.writeFileSync(tasksPath, speckit.tasksMd, 'utf-8');
|
|
96
|
-
return { planPath, tasksPath };
|
|
97
|
-
}
|
|
98
|
-
/**
|
|
99
|
-
* Convert workflow steps to Speckit phases
|
|
100
|
-
*/
|
|
101
|
-
function convertToPhases(context) {
|
|
102
|
-
const workflow = context.workflow;
|
|
103
|
-
const analysis = context.analysis;
|
|
104
|
-
if (!workflow) {
|
|
105
|
-
// No workflow, create single phase with mission
|
|
106
|
-
return [{
|
|
107
|
-
number: 1,
|
|
108
|
-
name: 'Implementation',
|
|
109
|
-
tasks: [{
|
|
110
|
-
id: 'T-1.1',
|
|
111
|
-
phase: 1,
|
|
112
|
-
sequence: 1,
|
|
113
|
-
title: 'Execute mission',
|
|
114
|
-
description: context.mission,
|
|
115
|
-
files: [],
|
|
116
|
-
dependencies: [],
|
|
117
|
-
validation: 'Task completed successfully',
|
|
118
|
-
parallel: false
|
|
119
|
-
}]
|
|
120
|
-
}];
|
|
121
|
-
}
|
|
122
|
-
// Group steps by type for phase organization
|
|
123
|
-
const phases = [];
|
|
124
|
-
const stepsByPhase = groupStepsByPhase(workflow.steps, analysis);
|
|
125
|
-
let phaseNumber = 1;
|
|
126
|
-
for (const [phaseName, steps] of stepsByPhase) {
|
|
127
|
-
const tasks = [];
|
|
128
|
-
let sequence = 1;
|
|
129
|
-
for (const step of steps) {
|
|
130
|
-
const taskId = `T-${phaseNumber}.${sequence}`;
|
|
131
|
-
// Determine if task can run in parallel
|
|
132
|
-
const canParallel = canRunInParallel(step, steps);
|
|
133
|
-
// Convert dependencies to task IDs
|
|
134
|
-
const deps = convertDependencies(step.dependsOn || [], workflow.steps, stepsByPhase);
|
|
135
|
-
// Infer files from step description/name
|
|
136
|
-
const files = inferFiles(step, context);
|
|
137
|
-
// Generate validation criteria
|
|
138
|
-
const validation = generateValidation(step, context);
|
|
139
|
-
tasks.push({
|
|
140
|
-
id: taskId,
|
|
141
|
-
phase: phaseNumber,
|
|
142
|
-
sequence,
|
|
143
|
-
title: step.name,
|
|
144
|
-
description: step.description || step.prompt,
|
|
145
|
-
files,
|
|
146
|
-
dependencies: deps,
|
|
147
|
-
validation,
|
|
148
|
-
parallel: canParallel
|
|
149
|
-
});
|
|
150
|
-
sequence++;
|
|
151
|
-
}
|
|
152
|
-
phases.push({
|
|
153
|
-
number: phaseNumber,
|
|
154
|
-
name: phaseName,
|
|
155
|
-
tasks
|
|
156
|
-
});
|
|
157
|
-
phaseNumber++;
|
|
158
|
-
}
|
|
159
|
-
return phases;
|
|
160
|
-
}
|
|
161
|
-
/**
|
|
162
|
-
* Group workflow steps into logical phases
|
|
163
|
-
*/
|
|
164
|
-
function groupStepsByPhase(steps, analysis) {
|
|
165
|
-
const phases = new Map();
|
|
166
|
-
if (steps.length === 1) {
|
|
167
|
-
// Single step = single phase
|
|
168
|
-
phases.set('Implementation', steps);
|
|
169
|
-
return phases;
|
|
170
|
-
}
|
|
171
|
-
// Try to group by step type or dependencies
|
|
172
|
-
// Phase 1: Setup/Foundation (no dependencies)
|
|
173
|
-
// Phase 2: Core Implementation (has dependencies)
|
|
174
|
-
// Phase 3: Testing/Integration (test-related)
|
|
175
|
-
const setup = [];
|
|
176
|
-
const core = [];
|
|
177
|
-
const testing = [];
|
|
178
|
-
for (const step of steps) {
|
|
179
|
-
const lowerName = step.name.toLowerCase();
|
|
180
|
-
const lowerDesc = (step.description || '').toLowerCase();
|
|
181
|
-
if (lowerName.includes('test') || lowerDesc.includes('test')) {
|
|
182
|
-
testing.push(step);
|
|
183
|
-
}
|
|
184
|
-
else if (!step.dependsOn || step.dependsOn.length === 0) {
|
|
185
|
-
setup.push(step);
|
|
186
|
-
}
|
|
187
|
-
else {
|
|
188
|
-
core.push(step);
|
|
189
|
-
}
|
|
190
|
-
}
|
|
191
|
-
if (setup.length > 0)
|
|
192
|
-
phases.set('Setup', setup);
|
|
193
|
-
if (core.length > 0)
|
|
194
|
-
phases.set('Core Implementation', core);
|
|
195
|
-
if (testing.length > 0)
|
|
196
|
-
phases.set('Testing & Validation', testing);
|
|
197
|
-
// If all in one phase, use generic name
|
|
198
|
-
if (phases.size === 0) {
|
|
199
|
-
phases.set('Implementation', steps);
|
|
200
|
-
}
|
|
201
|
-
return phases;
|
|
202
|
-
}
|
|
203
|
-
/**
|
|
204
|
-
* Check if a step can run in parallel with others in same phase
|
|
205
|
-
*/
|
|
206
|
-
function canRunInParallel(step, phaseSteps) {
|
|
207
|
-
// If no dependencies within this phase, can potentially run in parallel
|
|
208
|
-
if (!step.dependsOn || step.dependsOn.length === 0) {
|
|
209
|
-
// Check if other steps depend on this one
|
|
210
|
-
const dependents = phaseSteps.filter(s => s.dependsOn?.includes(step.id));
|
|
211
|
-
return dependents.length === 0;
|
|
212
|
-
}
|
|
213
|
-
return false;
|
|
214
|
-
}
|
|
215
|
-
/**
|
|
216
|
-
* Convert step-id dependencies to T-x.y format
|
|
217
|
-
*/
|
|
218
|
-
function convertDependencies(deps, allSteps, stepsByPhase) {
|
|
219
|
-
const result = [];
|
|
220
|
-
for (const depId of deps) {
|
|
221
|
-
const depStep = allSteps.find(s => s.id === depId);
|
|
222
|
-
if (!depStep)
|
|
223
|
-
continue;
|
|
224
|
-
// Find which phase this dependency is in
|
|
225
|
-
let phaseNum = 1;
|
|
226
|
-
let seqNum = 1;
|
|
227
|
-
for (const [phaseName, phaseSteps] of stepsByPhase) {
|
|
228
|
-
const idx = phaseSteps.findIndex(s => s.id === depId);
|
|
229
|
-
if (idx !== -1) {
|
|
230
|
-
seqNum = idx + 1;
|
|
231
|
-
break;
|
|
232
|
-
}
|
|
233
|
-
phaseNum++;
|
|
234
|
-
}
|
|
235
|
-
result.push(`T-${phaseNum}.${seqNum}`);
|
|
236
|
-
}
|
|
237
|
-
return result;
|
|
238
|
-
}
|
|
239
|
-
/**
|
|
240
|
-
* Infer affected files from step
|
|
241
|
-
*/
|
|
242
|
-
function inferFiles(step, context) {
|
|
243
|
-
const files = [];
|
|
244
|
-
const text = `${step.name} ${step.description || ''} ${step.prompt}`.toLowerCase();
|
|
245
|
-
// Common patterns
|
|
246
|
-
const patterns = [
|
|
247
|
-
{ regex: /\.tsx?\b/g, ext: '.ts' },
|
|
248
|
-
{ regex: /\.jsx?\b/g, ext: '.js' },
|
|
249
|
-
{ regex: /component/g, ext: '.tsx' },
|
|
250
|
-
{ regex: /service/g, ext: '.ts' },
|
|
251
|
-
{ regex: /test/g, ext: '.test.ts' },
|
|
252
|
-
{ regex: /api|endpoint|route/g, ext: '.ts' },
|
|
253
|
-
{ regex: /schema|model/g, ext: '.prisma' },
|
|
254
|
-
{ regex: /config/g, ext: '.json' },
|
|
255
|
-
];
|
|
256
|
-
// Check project sources for matches
|
|
257
|
-
const sources = context.sources || [];
|
|
258
|
-
for (const source of sources) {
|
|
259
|
-
const relPath = source.relativePath.toLowerCase();
|
|
260
|
-
if (text.includes(path.basename(relPath, path.extname(relPath)))) {
|
|
261
|
-
files.push(source.relativePath);
|
|
262
|
-
}
|
|
263
|
-
}
|
|
264
|
-
// Limit to 3 files
|
|
265
|
-
return files.slice(0, 3);
|
|
266
|
-
}
|
|
267
|
-
/**
|
|
268
|
-
* Generate validation criteria for a step
|
|
269
|
-
*/
|
|
270
|
-
function generateValidation(step, context) {
|
|
271
|
-
const lowerName = step.name.toLowerCase();
|
|
272
|
-
const lowerDesc = (step.description || '').toLowerCase();
|
|
273
|
-
// Common validation patterns
|
|
274
|
-
if (lowerName.includes('test') || lowerDesc.includes('test')) {
|
|
275
|
-
return 'All tests pass (`npm test` or equivalent)';
|
|
276
|
-
}
|
|
277
|
-
if (lowerName.includes('build') || lowerDesc.includes('compile')) {
|
|
278
|
-
return 'Build completes without errors';
|
|
279
|
-
}
|
|
280
|
-
if (lowerName.includes('setup') || lowerName.includes('init')) {
|
|
281
|
-
return 'Dependencies installed and configuration files created';
|
|
282
|
-
}
|
|
283
|
-
if (lowerName.includes('api') || lowerDesc.includes('endpoint')) {
|
|
284
|
-
return 'API endpoint responds correctly (manual or automated verification)';
|
|
285
|
-
}
|
|
286
|
-
if (lowerName.includes('ui') || lowerName.includes('component')) {
|
|
287
|
-
return 'Component renders correctly without console errors';
|
|
288
|
-
}
|
|
289
|
-
// Default
|
|
290
|
-
return 'Implementation complete and functioning as expected';
|
|
291
|
-
}
|
|
292
|
-
/**
|
|
293
|
-
* Generate plan.md content
|
|
294
|
-
*/
|
|
295
|
-
function generatePlanMd(params) {
|
|
296
|
-
const { featureName, timestamp, mission, projectType, projectName, projectStructure, analysis, workflow } = params;
|
|
297
|
-
const lines = [];
|
|
298
|
-
// Header
|
|
299
|
-
lines.push(`# Plan: ${featureName}`);
|
|
300
|
-
lines.push('');
|
|
301
|
-
lines.push(`- **Branch**: feature/${featureName}`);
|
|
302
|
-
lines.push(`- **Date**: ${timestamp}`);
|
|
303
|
-
lines.push(`- **Spec**: specs/${featureName}/tasks.md`);
|
|
304
|
-
lines.push('');
|
|
305
|
-
// Summary
|
|
306
|
-
lines.push('## Summary');
|
|
307
|
-
lines.push('');
|
|
308
|
-
lines.push(mission);
|
|
309
|
-
lines.push('');
|
|
310
|
-
// Technical Context
|
|
311
|
-
lines.push('## Technical Context');
|
|
312
|
-
lines.push('');
|
|
313
|
-
lines.push('| Aspect | Value |');
|
|
314
|
-
lines.push('|--------|-------|');
|
|
315
|
-
lines.push(`| Project Type | ${projectType} |`);
|
|
316
|
-
lines.push(`| Project Name | ${projectName} |`);
|
|
317
|
-
if (analysis) {
|
|
318
|
-
lines.push(`| Complexity | ${analysis.complexity} |`);
|
|
319
|
-
lines.push(`| Estimated Steps | ${analysis.steps.length} |`);
|
|
320
|
-
}
|
|
321
|
-
if (workflow) {
|
|
322
|
-
lines.push(`| Agents | ${workflow.agents.length} |`);
|
|
323
|
-
}
|
|
324
|
-
lines.push('');
|
|
325
|
-
// Project Structure (if available)
|
|
326
|
-
if (projectStructure) {
|
|
327
|
-
lines.push('## Project Structure');
|
|
328
|
-
lines.push('');
|
|
329
|
-
lines.push('```');
|
|
330
|
-
// Limit to first 20 lines
|
|
331
|
-
const structLines = projectStructure.split('\n').slice(0, 20);
|
|
332
|
-
lines.push(structLines.join('\n'));
|
|
333
|
-
if (projectStructure.split('\n').length > 20) {
|
|
334
|
-
lines.push('...');
|
|
335
|
-
}
|
|
336
|
-
lines.push('```');
|
|
337
|
-
lines.push('');
|
|
338
|
-
}
|
|
339
|
-
// Architecture Notes
|
|
340
|
-
lines.push('## Architecture Notes');
|
|
341
|
-
lines.push('');
|
|
342
|
-
if (workflow && workflow.agents.length > 0) {
|
|
343
|
-
lines.push('### Agents');
|
|
344
|
-
lines.push('');
|
|
345
|
-
for (const agent of workflow.agents) {
|
|
346
|
-
lines.push(`- **${agent.name}** (${agent.id})`);
|
|
347
|
-
lines.push(` - Role: ${agent.role}`);
|
|
348
|
-
lines.push(` - Working Dir: ${agent.workingDir}`);
|
|
349
|
-
}
|
|
350
|
-
lines.push('');
|
|
351
|
-
}
|
|
352
|
-
if (analysis && analysis.steps.length > 0) {
|
|
353
|
-
lines.push('### Implementation Approach');
|
|
354
|
-
lines.push('');
|
|
355
|
-
for (let i = 0; i < analysis.steps.length && i < 5; i++) {
|
|
356
|
-
const step = analysis.steps[i];
|
|
357
|
-
lines.push(`${i + 1}. **${step.name}**: ${step.description}`);
|
|
358
|
-
}
|
|
359
|
-
if (analysis.steps.length > 5) {
|
|
360
|
-
lines.push(`... and ${analysis.steps.length - 5} more steps`);
|
|
361
|
-
}
|
|
362
|
-
lines.push('');
|
|
363
|
-
}
|
|
364
|
-
// Notes section
|
|
365
|
-
lines.push('## Notes');
|
|
366
|
-
lines.push('');
|
|
367
|
-
lines.push('- Generated by SessionCast AutoPilot');
|
|
368
|
-
lines.push(`- Workflow: ${workflow?.name || 'N/A'}`);
|
|
369
|
-
lines.push('');
|
|
370
|
-
return lines.join('\n');
|
|
371
|
-
}
|
|
372
|
-
/**
|
|
373
|
-
* Generate tasks.md content
|
|
374
|
-
*/
|
|
375
|
-
function generateTasksMd(params) {
|
|
376
|
-
const { featureName, timestamp, phases, workflow } = params;
|
|
377
|
-
const lines = [];
|
|
378
|
-
// Header
|
|
379
|
-
lines.push(`# Tasks: ${featureName}`);
|
|
380
|
-
lines.push('');
|
|
381
|
-
lines.push(`Generated by: SessionCast AutoPilot`);
|
|
382
|
-
lines.push(`Date: ${timestamp}`);
|
|
383
|
-
lines.push(`Workflow: ${workflow?.name || 'quick'}`);
|
|
384
|
-
lines.push('');
|
|
385
|
-
// Phases and Tasks
|
|
386
|
-
for (const phase of phases) {
|
|
387
|
-
lines.push(`## Phase ${phase.number}: ${phase.name}`);
|
|
388
|
-
lines.push('');
|
|
389
|
-
for (const task of phase.tasks) {
|
|
390
|
-
// Task header with optional [P] marker
|
|
391
|
-
const parallelMarker = task.parallel ? ' [P]' : '';
|
|
392
|
-
lines.push(`### ${task.id}: ${task.title}${parallelMarker}`);
|
|
393
|
-
lines.push('');
|
|
394
|
-
lines.push(`- **Description**: ${task.description}`);
|
|
395
|
-
if (task.files.length > 0) {
|
|
396
|
-
lines.push(`- **Files**: ${task.files.map(f => `\`${f}\``).join(', ')}`);
|
|
397
|
-
}
|
|
398
|
-
else {
|
|
399
|
-
lines.push('- **Files**: (to be determined)');
|
|
400
|
-
}
|
|
401
|
-
if (task.dependencies.length > 0) {
|
|
402
|
-
lines.push(`- **Dependencies**: ${task.dependencies.join(', ')}`);
|
|
403
|
-
}
|
|
404
|
-
else {
|
|
405
|
-
lines.push('- **Dependencies**: None');
|
|
406
|
-
}
|
|
407
|
-
lines.push(`- **Validation**: ${task.validation}`);
|
|
408
|
-
lines.push('');
|
|
409
|
-
}
|
|
410
|
-
lines.push('---');
|
|
411
|
-
lines.push('');
|
|
412
|
-
}
|
|
413
|
-
// Checklist
|
|
414
|
-
lines.push('## Checklist');
|
|
415
|
-
lines.push('');
|
|
416
|
-
for (const phase of phases) {
|
|
417
|
-
for (const task of phase.tasks) {
|
|
418
|
-
lines.push(`- [ ] ${task.id}: ${task.title}`);
|
|
419
|
-
}
|
|
420
|
-
}
|
|
421
|
-
lines.push('');
|
|
422
|
-
// Notes
|
|
423
|
-
lines.push('## Notes');
|
|
424
|
-
lines.push('');
|
|
425
|
-
lines.push('- Tasks marked with `[P]` can run in parallel when dependencies allow');
|
|
426
|
-
lines.push('- Update checklist as tasks are completed');
|
|
427
|
-
lines.push('- Use `git commit` after completing each phase');
|
|
428
|
-
lines.push('');
|
|
429
|
-
return lines.join('\n');
|
|
430
|
-
}
|
|
431
|
-
/**
|
|
432
|
-
* Sanitize feature name for directory/file names
|
|
433
|
-
*/
|
|
434
|
-
function sanitizeFeatureName(mission) {
|
|
435
|
-
return mission
|
|
436
|
-
.toLowerCase()
|
|
437
|
-
.replace(/[^a-z0-9가-힣\s-]/g, '') // Keep Korean characters
|
|
438
|
-
.replace(/\s+/g, '-')
|
|
439
|
-
.replace(/-+/g, '-')
|
|
440
|
-
.replace(/^-|-$/g, '')
|
|
441
|
-
.substring(0, 50); // Limit length
|
|
442
|
-
}
|
|
443
|
-
/**
|
|
444
|
-
* Format date as YYYY-MM-DD
|
|
445
|
-
*/
|
|
446
|
-
function formatDate(date) {
|
|
447
|
-
return date.toISOString().split('T')[0];
|
|
448
|
-
}
|
|
449
|
-
/**
|
|
450
|
-
* Quick Speckit generation from just a prompt (without full analysis)
|
|
451
|
-
*/
|
|
452
|
-
function generateQuickSpeckit(prompt, context) {
|
|
453
|
-
const featureName = sanitizeFeatureName(prompt);
|
|
454
|
-
const timestamp = formatDate(new Date());
|
|
455
|
-
const planMd = `# Plan: ${featureName}
|
|
456
|
-
|
|
457
|
-
- **Branch**: feature/${featureName}
|
|
458
|
-
- **Date**: ${timestamp}
|
|
459
|
-
- **Spec**: specs/${featureName}/tasks.md
|
|
460
|
-
|
|
461
|
-
## Summary
|
|
462
|
-
|
|
463
|
-
${prompt}
|
|
464
|
-
|
|
465
|
-
## Technical Context
|
|
466
|
-
|
|
467
|
-
| Aspect | Value |
|
|
468
|
-
|--------|-------|
|
|
469
|
-
| Project Type | ${context.projectType} |
|
|
470
|
-
| Project Name | ${context.projectName} |
|
|
471
|
-
|
|
472
|
-
## Architecture Notes
|
|
473
|
-
|
|
474
|
-
Single-agent quick execution workflow.
|
|
475
|
-
|
|
476
|
-
## Notes
|
|
477
|
-
|
|
478
|
-
- Generated by SessionCast AutoPilot (Quick Mode)
|
|
479
|
-
`;
|
|
480
|
-
const tasksMd = `# Tasks: ${featureName}
|
|
481
|
-
|
|
482
|
-
Generated by: SessionCast AutoPilot (Quick Mode)
|
|
483
|
-
Date: ${timestamp}
|
|
484
|
-
|
|
485
|
-
## Phase 1: Implementation
|
|
486
|
-
|
|
487
|
-
### T-1.1: Execute mission
|
|
488
|
-
- **Description**: ${prompt}
|
|
489
|
-
- **Files**: (to be determined during implementation)
|
|
490
|
-
- **Dependencies**: None
|
|
491
|
-
- **Validation**: Implementation complete and functioning as expected
|
|
492
|
-
|
|
493
|
-
---
|
|
494
|
-
|
|
495
|
-
## Checklist
|
|
496
|
-
|
|
497
|
-
- [ ] T-1.1: Execute mission
|
|
498
|
-
|
|
499
|
-
## Notes
|
|
500
|
-
|
|
501
|
-
- Quick mode generates a single-task workflow
|
|
502
|
-
- For detailed task breakdown, use full analysis mode
|
|
503
|
-
`;
|
|
504
|
-
const outputDir = path.join(context.workingDir, '.sessioncast', 'specs', featureName);
|
|
505
|
-
return {
|
|
506
|
-
featureName,
|
|
507
|
-
planMd,
|
|
508
|
-
tasksMd,
|
|
509
|
-
outputDir
|
|
510
|
-
};
|
|
511
|
-
}
|
|
@@ -1,110 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* AutoPilot Types
|
|
3
|
-
* Single-prompt execution layer for SessionCast
|
|
4
|
-
*/
|
|
5
|
-
export type ProjectType = 'android' | 'ios' | 'react' | 'next' | 'vue' | 'node' | 'python' | 'spring' | 'go' | 'rust' | 'unknown';
|
|
6
|
-
export type StepType = 'frontend' | 'backend' | 'fullstack' | 'mobile' | 'infra' | 'test';
|
|
7
|
-
export type Complexity = 'simple' | 'medium' | 'complex';
|
|
8
|
-
export interface SourceInfo {
|
|
9
|
-
path: string;
|
|
10
|
-
relativePath: string;
|
|
11
|
-
type: 'code' | 'config' | 'doc' | 'test';
|
|
12
|
-
language?: string;
|
|
13
|
-
size: number;
|
|
14
|
-
}
|
|
15
|
-
export interface ProjectDetectionResult {
|
|
16
|
-
type: ProjectType;
|
|
17
|
-
name: string;
|
|
18
|
-
confidence: number;
|
|
19
|
-
configFiles: string[];
|
|
20
|
-
mainLanguage?: string;
|
|
21
|
-
}
|
|
22
|
-
export interface MissionAnalysis {
|
|
23
|
-
mission: string;
|
|
24
|
-
complexity: Complexity;
|
|
25
|
-
steps: AnalyzedStep[];
|
|
26
|
-
requiredAgents: string[];
|
|
27
|
-
estimatedFiles: string[];
|
|
28
|
-
}
|
|
29
|
-
export interface AnalyzedStep {
|
|
30
|
-
name: string;
|
|
31
|
-
description: string;
|
|
32
|
-
type: StepType;
|
|
33
|
-
prompt: string;
|
|
34
|
-
dependsOn?: string[];
|
|
35
|
-
}
|
|
36
|
-
export interface WorkflowStep {
|
|
37
|
-
id: string;
|
|
38
|
-
name: string;
|
|
39
|
-
description: string;
|
|
40
|
-
agentId: string;
|
|
41
|
-
prompt: string;
|
|
42
|
-
dependsOn?: string[];
|
|
43
|
-
status?: 'pending' | 'running' | 'completed' | 'error';
|
|
44
|
-
}
|
|
45
|
-
export interface AgentConfig {
|
|
46
|
-
id: string;
|
|
47
|
-
name: string;
|
|
48
|
-
role: string;
|
|
49
|
-
workingDir: string;
|
|
50
|
-
}
|
|
51
|
-
export interface GeneratedWorkflow {
|
|
52
|
-
name: string;
|
|
53
|
-
mission: string;
|
|
54
|
-
agents: AgentConfig[];
|
|
55
|
-
steps: WorkflowStep[];
|
|
56
|
-
}
|
|
57
|
-
export interface AutoPilotContext {
|
|
58
|
-
prompt: string;
|
|
59
|
-
workingDir: string;
|
|
60
|
-
projectType: ProjectType;
|
|
61
|
-
projectName: string;
|
|
62
|
-
sources: SourceInfo[];
|
|
63
|
-
projectStructure: string;
|
|
64
|
-
mission: string;
|
|
65
|
-
analysis?: MissionAnalysis;
|
|
66
|
-
workflow?: GeneratedWorkflow;
|
|
67
|
-
status: AutoPilotStatus;
|
|
68
|
-
error?: string;
|
|
69
|
-
}
|
|
70
|
-
export type AutoPilotStatus = 'idle' | 'detecting' | 'scanning' | 'analyzing' | 'generating' | 'ready' | 'running' | 'completed' | 'error';
|
|
71
|
-
export interface AutoPilotOptions {
|
|
72
|
-
workingDir: string;
|
|
73
|
-
relayUrl?: string;
|
|
74
|
-
token?: string;
|
|
75
|
-
verbose?: boolean;
|
|
76
|
-
dryRun?: boolean;
|
|
77
|
-
skipConfirm?: boolean;
|
|
78
|
-
}
|
|
79
|
-
export interface AutoPilotEvents {
|
|
80
|
-
onStatusChange?: (status: AutoPilotStatus, message?: string) => void;
|
|
81
|
-
onStepStart?: (step: WorkflowStep) => void;
|
|
82
|
-
onStepComplete?: (step: WorkflowStep) => void;
|
|
83
|
-
onError?: (error: Error) => void;
|
|
84
|
-
}
|
|
85
|
-
/**
|
|
86
|
-
* Speckit Types
|
|
87
|
-
* Structured markdown format for development plans
|
|
88
|
-
*/
|
|
89
|
-
export interface SpeckitTask {
|
|
90
|
-
id: string;
|
|
91
|
-
phase: number;
|
|
92
|
-
sequence: number;
|
|
93
|
-
title: string;
|
|
94
|
-
description: string;
|
|
95
|
-
files: string[];
|
|
96
|
-
dependencies: string[];
|
|
97
|
-
validation: string;
|
|
98
|
-
parallel: boolean;
|
|
99
|
-
}
|
|
100
|
-
export interface SpeckitPhase {
|
|
101
|
-
number: number;
|
|
102
|
-
name: string;
|
|
103
|
-
tasks: SpeckitTask[];
|
|
104
|
-
}
|
|
105
|
-
export interface SpeckitOutput {
|
|
106
|
-
featureName: string;
|
|
107
|
-
planMd: string;
|
|
108
|
-
tasksMd: string;
|
|
109
|
-
outputDir: string;
|
|
110
|
-
}
|
package/dist/autopilot/types.js
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* WorkflowGenerator - Convert mission analysis into executable workflow
|
|
3
|
-
*/
|
|
4
|
-
import { MissionAnalysis, ProjectType, GeneratedWorkflow } from './types';
|
|
5
|
-
interface GeneratorContext {
|
|
6
|
-
projectType: ProjectType;
|
|
7
|
-
projectName: string;
|
|
8
|
-
workingDir: string;
|
|
9
|
-
}
|
|
10
|
-
/**
|
|
11
|
-
* Generate workflow from mission analysis
|
|
12
|
-
*/
|
|
13
|
-
export declare function generateWorkflow(analysis: MissionAnalysis, context: GeneratorContext): GeneratedWorkflow;
|
|
14
|
-
/**
|
|
15
|
-
* Convert GeneratedWorkflow to existing Workflow format
|
|
16
|
-
*/
|
|
17
|
-
export declare function toExecutableWorkflow(generated: GeneratedWorkflow): {
|
|
18
|
-
name: string;
|
|
19
|
-
mission: string;
|
|
20
|
-
created: string;
|
|
21
|
-
agents: Array<{
|
|
22
|
-
id: string;
|
|
23
|
-
name: string;
|
|
24
|
-
workDir: string;
|
|
25
|
-
tasks: string[];
|
|
26
|
-
dependsOn: string[];
|
|
27
|
-
}>;
|
|
28
|
-
};
|
|
29
|
-
/**
|
|
30
|
-
* Create a simple single-agent workflow for quick execution
|
|
31
|
-
*/
|
|
32
|
-
export declare function createQuickWorkflow(prompt: string, context: GeneratorContext): GeneratedWorkflow;
|
|
33
|
-
export {};
|