aided-dev 1.0.1 → 1.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/bmad/loader.js
CHANGED
|
@@ -2,9 +2,11 @@ import fs from 'fs-extra';
|
|
|
2
2
|
import path from 'path';
|
|
3
3
|
import yaml from 'js-yaml';
|
|
4
4
|
export function findBMADPath() {
|
|
5
|
+
const packageDir = path.resolve(path.dirname(new URL(import.meta.url).pathname), '../..');
|
|
5
6
|
const possiblePaths = [
|
|
7
|
+
path.join(packageDir, 'node_modules/bmad-method'),
|
|
6
8
|
path.resolve(process.cwd(), 'node_modules/bmad-method'),
|
|
7
|
-
path.resolve(
|
|
9
|
+
path.resolve(packageDir, '../bmad-method'),
|
|
8
10
|
path.resolve(process.cwd(), '../BMAD-METHOD'),
|
|
9
11
|
process.env.BMAD_PATH,
|
|
10
12
|
].filter(Boolean);
|
|
@@ -5,6 +5,7 @@ export interface OrchestratorOptions {
|
|
|
5
5
|
model?: string;
|
|
6
6
|
verbose?: boolean;
|
|
7
7
|
skipPlanning?: boolean;
|
|
8
|
+
outputDir?: string;
|
|
8
9
|
}
|
|
9
10
|
export interface WorkflowState {
|
|
10
11
|
task: string;
|
|
@@ -21,6 +22,7 @@ export declare class Orchestrator {
|
|
|
21
22
|
private repoPath;
|
|
22
23
|
private verbose;
|
|
23
24
|
private skipPlanning;
|
|
25
|
+
private outputDir;
|
|
24
26
|
private bmadLoader;
|
|
25
27
|
private agents;
|
|
26
28
|
private planner;
|
|
@@ -36,5 +38,6 @@ export declare class Orchestrator {
|
|
|
36
38
|
private formatOutputTitle;
|
|
37
39
|
private buildStepPrompt;
|
|
38
40
|
private extractTextContent;
|
|
41
|
+
private saveOutputs;
|
|
39
42
|
private printSummary;
|
|
40
43
|
}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import Anthropic from '@anthropic-ai/sdk';
|
|
2
2
|
import ora from 'ora';
|
|
3
3
|
import chalk from 'chalk';
|
|
4
|
+
import * as fs from 'fs';
|
|
5
|
+
import * as path from 'path';
|
|
4
6
|
import { discoverProjectDocuments, detectStack, formatDocumentsForPrompt, formatStack, } from '../discovery/index.js';
|
|
5
7
|
import { getLoader } from '../bmad/index.js';
|
|
6
8
|
import { getApiKey } from '../config.js';
|
|
@@ -11,19 +13,21 @@ export class Orchestrator {
|
|
|
11
13
|
repoPath;
|
|
12
14
|
verbose;
|
|
13
15
|
skipPlanning;
|
|
16
|
+
outputDir;
|
|
14
17
|
bmadLoader;
|
|
15
18
|
agents = new Map();
|
|
16
19
|
planner = null;
|
|
17
20
|
constructor(options) {
|
|
18
21
|
const apiKey = getApiKey();
|
|
19
22
|
if (!apiKey) {
|
|
20
|
-
throw new Error('Anthropic API key not found. Run `
|
|
23
|
+
throw new Error('Anthropic API key not found. Run `aided config --api-key <key>` or set ANTHROPIC_API_KEY environment variable.');
|
|
21
24
|
}
|
|
22
25
|
this.client = new Anthropic({ apiKey });
|
|
23
26
|
this.model = options.model || 'claude-sonnet-4-20250514';
|
|
24
27
|
this.repoPath = options.repoPath;
|
|
25
28
|
this.verbose = options.verbose || false;
|
|
26
29
|
this.skipPlanning = options.skipPlanning || false;
|
|
30
|
+
this.outputDir = options.outputDir || path.join(options.repoPath, '.aided-output');
|
|
27
31
|
this.bmadLoader = getLoader();
|
|
28
32
|
}
|
|
29
33
|
async loadAgents() {
|
|
@@ -70,16 +74,16 @@ export class Orchestrator {
|
|
|
70
74
|
await this.loadAgents();
|
|
71
75
|
await this.phaseDiscover(state);
|
|
72
76
|
if (state.errors.length > 0) {
|
|
73
|
-
this.printSummary(state);
|
|
77
|
+
await this.printSummary(state);
|
|
74
78
|
return state;
|
|
75
79
|
}
|
|
76
80
|
await this.phasePlanning(state);
|
|
77
81
|
if (state.errors.length > 0 || !state.plan) {
|
|
78
|
-
this.printSummary(state);
|
|
82
|
+
await this.printSummary(state);
|
|
79
83
|
return state;
|
|
80
84
|
}
|
|
81
85
|
await this.executeplan(state);
|
|
82
|
-
this.printSummary(state);
|
|
86
|
+
await this.printSummary(state);
|
|
83
87
|
return state;
|
|
84
88
|
}
|
|
85
89
|
async phaseDiscover(state) {
|
|
@@ -358,7 +362,44 @@ Provide your output in a clear, structured format.`;
|
|
|
358
362
|
.map((block) => block.text)
|
|
359
363
|
.join('\n');
|
|
360
364
|
}
|
|
361
|
-
|
|
365
|
+
async saveOutputs(state) {
|
|
366
|
+
if (state.outputs.size === 0)
|
|
367
|
+
return undefined;
|
|
368
|
+
if (!fs.existsSync(this.outputDir)) {
|
|
369
|
+
fs.mkdirSync(this.outputDir, { recursive: true });
|
|
370
|
+
}
|
|
371
|
+
const timestamp = new Date().toISOString().replace(/[:.]/g, '-').slice(0, 19);
|
|
372
|
+
const runDir = path.join(this.outputDir, timestamp);
|
|
373
|
+
fs.mkdirSync(runDir, { recursive: true });
|
|
374
|
+
const summaryContent = `# Aided Output - ${timestamp}
|
|
375
|
+
|
|
376
|
+
## Task
|
|
377
|
+
${state.task}
|
|
378
|
+
|
|
379
|
+
## Task Type
|
|
380
|
+
${state.plan?.taskType || 'unknown'}
|
|
381
|
+
|
|
382
|
+
## Complexity
|
|
383
|
+
${state.plan?.estimatedComplexity || 'unknown'}
|
|
384
|
+
|
|
385
|
+
## Outputs Generated
|
|
386
|
+
${Array.from(state.outputs.keys()).map(k => `- ${this.formatOutputTitle(k)}`).join('\n')}
|
|
387
|
+
|
|
388
|
+
---
|
|
389
|
+
|
|
390
|
+
`;
|
|
391
|
+
fs.writeFileSync(path.join(runDir, 'README.md'), summaryContent);
|
|
392
|
+
for (const [key, content] of state.outputs) {
|
|
393
|
+
const filename = `${key.replace(/_/g, '-')}.md`;
|
|
394
|
+
const fileContent = `# ${this.formatOutputTitle(key)}
|
|
395
|
+
|
|
396
|
+
${content}
|
|
397
|
+
`;
|
|
398
|
+
fs.writeFileSync(path.join(runDir, filename), fileContent);
|
|
399
|
+
}
|
|
400
|
+
return runDir;
|
|
401
|
+
}
|
|
402
|
+
async printSummary(state) {
|
|
362
403
|
console.log('');
|
|
363
404
|
if (state.errors.length > 0) {
|
|
364
405
|
console.log(chalk.red('Workflow completed with errors:'));
|
|
@@ -370,11 +411,16 @@ Provide your output in a clear, structured format.`;
|
|
|
370
411
|
console.log(chalk.green('✓ Workflow complete!'));
|
|
371
412
|
}
|
|
372
413
|
if (state.outputs.size > 0) {
|
|
414
|
+
const outputPath = await this.saveOutputs(state);
|
|
373
415
|
console.log('');
|
|
374
416
|
console.log(chalk.dim('Outputs generated:'));
|
|
375
417
|
for (const key of state.outputs.keys()) {
|
|
376
418
|
console.log(chalk.dim(` - ${this.formatOutputTitle(key)}`));
|
|
377
419
|
}
|
|
420
|
+
if (outputPath) {
|
|
421
|
+
console.log('');
|
|
422
|
+
console.log(chalk.cyan(`📁 Outputs saved to: ${outputPath}`));
|
|
423
|
+
}
|
|
378
424
|
}
|
|
379
425
|
if (state.plan) {
|
|
380
426
|
console.log('');
|