@brainforge/core 3.1.4 → 3.1.6
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/index.d.ts +651 -3
- package/dist/index.js +5611 -278
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
import { EventEmitter } from 'events';
|
|
2
2
|
|
|
3
|
-
type ProjectType = 'student' | 'junior' | 'solo';
|
|
3
|
+
type ProjectType = 'student' | 'junior' | 'solo' | 'personal' | 'pro';
|
|
4
4
|
type StudentLevel = 'beginner' | 'intermediate' | 'advanced';
|
|
5
|
-
type Language = 'typescript' | 'javascript' | 'python' | 'java' | 'go' | 'php';
|
|
5
|
+
type Language = 'typescript' | 'javascript' | 'python' | 'java' | 'go' | 'php' | 'rust' | 'csharp' | 'ruby';
|
|
6
6
|
type PhaseStatus = 'pending' | 'active' | 'completed' | 'blocked';
|
|
7
7
|
type TaskStatus = 'todo' | 'in-progress' | 'done' | 'skipped';
|
|
8
|
+
type TaskPriority = 'low' | 'medium' | 'high' | 'critical';
|
|
9
|
+
type TaskType = 'backend' | 'frontend' | 'database' | 'devops' | 'security' | 'test' | 'docs' | 'general';
|
|
10
|
+
type BugSeverity = 'blocker' | 'high' | 'medium' | 'low';
|
|
11
|
+
type AgentId = 'orchestrator' | 'researcher' | 'codebase-mapper' | 'requirements-analyst' | 'architect' | 'planner' | 'backend-engineer' | 'frontend-engineer' | 'fullstack-engineer' | 'database-engineer' | 'devops-engineer' | 'security-reviewer' | 'test-engineer' | 'ui-reviewer' | 'debugger' | 'verifier' | 'docs-writer' | 'professor' | 'student-explainer' | 'ship-manager';
|
|
8
12
|
interface ProjectConfig {
|
|
9
13
|
name: string;
|
|
10
14
|
description: string;
|
|
@@ -19,11 +23,61 @@ interface Task {
|
|
|
19
23
|
title: string;
|
|
20
24
|
description: string;
|
|
21
25
|
status: TaskStatus;
|
|
26
|
+
priority: TaskPriority;
|
|
27
|
+
type?: TaskType;
|
|
22
28
|
files?: string[];
|
|
29
|
+
agent?: AgentId;
|
|
30
|
+
parallelGroup?: string;
|
|
31
|
+
dependsOn?: string[];
|
|
32
|
+
acceptanceCriteria?: string[];
|
|
33
|
+
verificationCommands?: string[];
|
|
34
|
+
riskLevel?: 'low' | 'medium' | 'high';
|
|
23
35
|
context?: Record<string, unknown>;
|
|
24
36
|
createdAt: string;
|
|
25
37
|
updatedAt: string;
|
|
26
38
|
}
|
|
39
|
+
interface BugReport {
|
|
40
|
+
id: string;
|
|
41
|
+
phaseId: string;
|
|
42
|
+
title: string;
|
|
43
|
+
description: string;
|
|
44
|
+
severity: BugSeverity;
|
|
45
|
+
likelyFiles: string[];
|
|
46
|
+
suggestedFix: string;
|
|
47
|
+
status: 'open' | 'in-progress' | 'fixed' | 'wont-fix';
|
|
48
|
+
createdAt: string;
|
|
49
|
+
resolvedAt?: string;
|
|
50
|
+
}
|
|
51
|
+
interface AcceptanceCriterionResult {
|
|
52
|
+
criterion: string;
|
|
53
|
+
passed: boolean;
|
|
54
|
+
note?: string;
|
|
55
|
+
}
|
|
56
|
+
interface VerificationResult {
|
|
57
|
+
phaseId: string;
|
|
58
|
+
verifiedAt: string;
|
|
59
|
+
passed: boolean;
|
|
60
|
+
acceptanceCriteria: AcceptanceCriterionResult[];
|
|
61
|
+
bugs: BugReport[];
|
|
62
|
+
testsPassed: boolean;
|
|
63
|
+
buildPassed: boolean;
|
|
64
|
+
summary: string;
|
|
65
|
+
}
|
|
66
|
+
interface WaveGroup {
|
|
67
|
+
wave: number;
|
|
68
|
+
taskIds: string[];
|
|
69
|
+
canRunParallel: boolean;
|
|
70
|
+
conflicts: string[][];
|
|
71
|
+
}
|
|
72
|
+
interface RunRecord {
|
|
73
|
+
id: string;
|
|
74
|
+
phaseId?: string;
|
|
75
|
+
command: string;
|
|
76
|
+
startedAt: string;
|
|
77
|
+
completedAt?: string;
|
|
78
|
+
status: 'running' | 'completed' | 'failed';
|
|
79
|
+
dir: string;
|
|
80
|
+
}
|
|
27
81
|
interface Phase {
|
|
28
82
|
id: string;
|
|
29
83
|
name: string;
|
|
@@ -53,6 +107,46 @@ interface BrainforgeState {
|
|
|
53
107
|
};
|
|
54
108
|
}
|
|
55
109
|
|
|
110
|
+
type WorkflowMode = 'student' | 'simple' | 'pro';
|
|
111
|
+
type RuntimeName = 'claude-code' | 'codex' | 'opencode' | 'gemini-cli' | 'cursor' | 'windsurf' | 'copilot' | 'vscode' | 'cline' | 'generic';
|
|
112
|
+
interface BrainForgeConfig {
|
|
113
|
+
version: number;
|
|
114
|
+
mode: WorkflowMode;
|
|
115
|
+
runtime: RuntimeName;
|
|
116
|
+
parallelization: {
|
|
117
|
+
enabled: boolean;
|
|
118
|
+
maxAgents: number;
|
|
119
|
+
};
|
|
120
|
+
automation: {
|
|
121
|
+
autoCommit: boolean;
|
|
122
|
+
verifyEachPhase: boolean;
|
|
123
|
+
shipEachPhase: boolean;
|
|
124
|
+
stopOnFailure: boolean;
|
|
125
|
+
};
|
|
126
|
+
memory: {
|
|
127
|
+
contextPacketMaxTokens: number;
|
|
128
|
+
summarizeAfterEachRun: boolean;
|
|
129
|
+
keepRawLogs: boolean;
|
|
130
|
+
};
|
|
131
|
+
student: {
|
|
132
|
+
enabled: boolean;
|
|
133
|
+
level: 'beginner' | 'intermediate' | 'advanced';
|
|
134
|
+
professorMode: boolean;
|
|
135
|
+
};
|
|
136
|
+
safety: {
|
|
137
|
+
redactSecrets: boolean;
|
|
138
|
+
requireCleanGit: boolean;
|
|
139
|
+
dryRunByDefault: boolean;
|
|
140
|
+
};
|
|
141
|
+
dashboard: {
|
|
142
|
+
enabled: boolean;
|
|
143
|
+
port: number;
|
|
144
|
+
};
|
|
145
|
+
}
|
|
146
|
+
declare const DEFAULT_CONFIG: BrainForgeConfig;
|
|
147
|
+
declare function loadConfig(cwd: string): Promise<BrainForgeConfig>;
|
|
148
|
+
declare function saveConfig(cwd: string, config: BrainForgeConfig): Promise<void>;
|
|
149
|
+
|
|
56
150
|
declare class StateManager {
|
|
57
151
|
private readonly workingDir;
|
|
58
152
|
private statePath;
|
|
@@ -61,6 +155,8 @@ declare class StateManager {
|
|
|
61
155
|
load(): Promise<BrainforgeState>;
|
|
62
156
|
save(): Promise<void>;
|
|
63
157
|
init(project: ProjectConfig): Promise<BrainforgeState>;
|
|
158
|
+
loadWorkspaceConfig(): Promise<BrainForgeConfig>;
|
|
159
|
+
saveWorkspaceConfig(config: BrainForgeConfig): Promise<void>;
|
|
64
160
|
get(): BrainforgeState;
|
|
65
161
|
set(updater: (state: BrainforgeState) => void): void;
|
|
66
162
|
configureAI(config: AIConfig): Promise<void>;
|
|
@@ -72,7 +168,50 @@ declare class StateManager {
|
|
|
72
168
|
private writeStateMd;
|
|
73
169
|
}
|
|
74
170
|
|
|
171
|
+
declare class Workspace {
|
|
172
|
+
private readonly cwd;
|
|
173
|
+
readonly brainforgeDir: string;
|
|
174
|
+
constructor(cwd: string);
|
|
175
|
+
ensureDirectories(): Promise<void>;
|
|
176
|
+
loadConfig(): Promise<BrainForgeConfig>;
|
|
177
|
+
saveConfig(config: BrainForgeConfig): Promise<void>;
|
|
178
|
+
initConfig(overrides?: Partial<BrainForgeConfig>): Promise<BrainForgeConfig>;
|
|
179
|
+
configExists(): Promise<boolean>;
|
|
180
|
+
stateExists(): Promise<boolean>;
|
|
181
|
+
phasePath(phaseId: string): string;
|
|
182
|
+
memoryPath(): string;
|
|
183
|
+
codebasePath(): string;
|
|
184
|
+
runsPath(): string;
|
|
185
|
+
runPath(runId: string): string;
|
|
186
|
+
skillsPath(): string;
|
|
187
|
+
forensicsPath(): string;
|
|
188
|
+
ensurePhaseDir(phaseId: string): Promise<void>;
|
|
189
|
+
ensureRunDir(runId: string): Promise<void>;
|
|
190
|
+
private ensureInitialFiles;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
interface MigrationResult {
|
|
194
|
+
ran: boolean;
|
|
195
|
+
actions: string[];
|
|
196
|
+
}
|
|
197
|
+
declare function detectAndMigrate(cwd: string): Promise<MigrationResult>;
|
|
198
|
+
|
|
199
|
+
interface ValidationResult {
|
|
200
|
+
valid: boolean;
|
|
201
|
+
errors: string[];
|
|
202
|
+
warnings: string[];
|
|
203
|
+
}
|
|
204
|
+
declare function validateConfig(config: unknown): ValidationResult;
|
|
205
|
+
declare function validatePhase(phase: unknown): ValidationResult;
|
|
206
|
+
declare function validateTask(task: unknown): ValidationResult;
|
|
207
|
+
declare function validateProjectConfig(config: unknown): ValidationResult;
|
|
208
|
+
|
|
75
209
|
type StateAction = {
|
|
210
|
+
type: 'ADD_PHASE';
|
|
211
|
+
phase: Omit<Phase, 'completedAt' | 'description'> & {
|
|
212
|
+
description?: string;
|
|
213
|
+
};
|
|
214
|
+
} | {
|
|
76
215
|
type: 'SET_ACTIVE_PHASE';
|
|
77
216
|
phaseId: string;
|
|
78
217
|
} | {
|
|
@@ -82,6 +221,10 @@ type StateAction = {
|
|
|
82
221
|
type: 'UPDATE_TASK';
|
|
83
222
|
taskId: string;
|
|
84
223
|
updates: Partial<Task>;
|
|
224
|
+
} | {
|
|
225
|
+
type: 'UPDATE_TASK_STATUS';
|
|
226
|
+
taskId: string;
|
|
227
|
+
status: Task['status'];
|
|
85
228
|
} | {
|
|
86
229
|
type: 'SET_CONTEXT';
|
|
87
230
|
key: string;
|
|
@@ -392,4 +535,509 @@ declare class DeepSeekAdapter implements AIAdapter {
|
|
|
392
535
|
complete(prompt: string, options?: CompletionOptions): Promise<string>;
|
|
393
536
|
}
|
|
394
537
|
|
|
395
|
-
|
|
538
|
+
type RuntimeId = 'claude-code' | 'codex' | 'opencode' | 'gemini-cli' | 'cursor' | 'windsurf' | 'copilot' | 'vscode' | 'generic';
|
|
539
|
+
type RuntimeCapability = 'slash-commands' | 'rules' | 'snippets' | 'instructions';
|
|
540
|
+
interface RuntimeDefinition {
|
|
541
|
+
id: RuntimeId;
|
|
542
|
+
name: string;
|
|
543
|
+
commandPrefix: string;
|
|
544
|
+
globalConfigPath: string;
|
|
545
|
+
localConfigPath: string;
|
|
546
|
+
commandFileExt: string;
|
|
547
|
+
capabilities: RuntimeCapability[];
|
|
548
|
+
notes: string;
|
|
549
|
+
supportLevel: 'full' | 'partial' | 'fallback';
|
|
550
|
+
}
|
|
551
|
+
declare const RUNTIME_REGISTRY: RuntimeDefinition[];
|
|
552
|
+
declare function getRuntime(id: RuntimeId): RuntimeDefinition | undefined;
|
|
553
|
+
declare function listRuntimes(): RuntimeDefinition[];
|
|
554
|
+
|
|
555
|
+
interface DetectionResult {
|
|
556
|
+
id: RuntimeId;
|
|
557
|
+
name: string;
|
|
558
|
+
detected: boolean;
|
|
559
|
+
method?: string;
|
|
560
|
+
configPath?: string;
|
|
561
|
+
supportLevel: 'full' | 'partial' | 'fallback';
|
|
562
|
+
}
|
|
563
|
+
declare function detectRuntimes(cwd: string): Promise<DetectionResult[]>;
|
|
564
|
+
|
|
565
|
+
interface InstallResult {
|
|
566
|
+
runtimeId: RuntimeId;
|
|
567
|
+
runtimeName: string;
|
|
568
|
+
filesWritten: string[];
|
|
569
|
+
targetDir: string;
|
|
570
|
+
commandCount: number;
|
|
571
|
+
}
|
|
572
|
+
declare function installRuntime(runtimeId: RuntimeId, opts: {
|
|
573
|
+
global: boolean;
|
|
574
|
+
cwd: string;
|
|
575
|
+
}): Promise<InstallResult>;
|
|
576
|
+
|
|
577
|
+
interface CommandDef {
|
|
578
|
+
name: string;
|
|
579
|
+
description: string;
|
|
580
|
+
cliCommand: string;
|
|
581
|
+
instruction: string;
|
|
582
|
+
}
|
|
583
|
+
declare const COMMAND_DEFINITIONS: CommandDef[];
|
|
584
|
+
declare const COMMANDS_BY_NAME: Map<string, CommandDef>;
|
|
585
|
+
|
|
586
|
+
interface AgentContract {
|
|
587
|
+
id: AgentId;
|
|
588
|
+
name: string;
|
|
589
|
+
purpose: string;
|
|
590
|
+
inputs: string[];
|
|
591
|
+
outputs: string[];
|
|
592
|
+
forbidden: string[];
|
|
593
|
+
qualityChecks: string[];
|
|
594
|
+
taskTypes: string[];
|
|
595
|
+
}
|
|
596
|
+
|
|
597
|
+
declare const AGENT_REGISTRY: AgentContract[];
|
|
598
|
+
declare function getAgent(id: AgentId): AgentContract | undefined;
|
|
599
|
+
declare function listAgents(): AgentContract[];
|
|
600
|
+
|
|
601
|
+
interface Wave {
|
|
602
|
+
index: number;
|
|
603
|
+
label: string;
|
|
604
|
+
tasks: Task[];
|
|
605
|
+
canParallelize: boolean;
|
|
606
|
+
}
|
|
607
|
+
declare class WavePlanner {
|
|
608
|
+
plan(tasks: Task[]): Wave[];
|
|
609
|
+
assignAgents(tasks: Task[]): Map<string, AgentId>;
|
|
610
|
+
}
|
|
611
|
+
|
|
612
|
+
interface StackInfo {
|
|
613
|
+
language: string;
|
|
614
|
+
secondaryLanguages: string[];
|
|
615
|
+
framework?: string;
|
|
616
|
+
runtime?: string;
|
|
617
|
+
buildTool?: string;
|
|
618
|
+
linter?: string;
|
|
619
|
+
formatter?: string;
|
|
620
|
+
packageManager?: string;
|
|
621
|
+
cssFramework?: string;
|
|
622
|
+
}
|
|
623
|
+
declare function detectStack(cwd: string): Promise<StackInfo>;
|
|
624
|
+
|
|
625
|
+
interface OrchestratorResult {
|
|
626
|
+
waves: number;
|
|
627
|
+
totalTasks: number;
|
|
628
|
+
files: string[];
|
|
629
|
+
waveDir: string;
|
|
630
|
+
}
|
|
631
|
+
declare class ParallelOrchestrator {
|
|
632
|
+
private readonly cwd;
|
|
633
|
+
private readonly phasesDir;
|
|
634
|
+
constructor(cwd: string);
|
|
635
|
+
orchestrate(phase: Phase, stack?: StackInfo): Promise<OrchestratorResult>;
|
|
636
|
+
}
|
|
637
|
+
|
|
638
|
+
interface ConflictWarning {
|
|
639
|
+
taskA: string;
|
|
640
|
+
taskB: string;
|
|
641
|
+
reason: string;
|
|
642
|
+
filePaths?: string[];
|
|
643
|
+
}
|
|
644
|
+
declare function detectConflicts(tasks: Task[]): ConflictWarning[];
|
|
645
|
+
|
|
646
|
+
interface WaveResult {
|
|
647
|
+
waveIndex: number;
|
|
648
|
+
completedTaskIds: string[];
|
|
649
|
+
failedTaskIds: string[];
|
|
650
|
+
blockers: string[];
|
|
651
|
+
}
|
|
652
|
+
interface MergeReport {
|
|
653
|
+
totalWaves: number;
|
|
654
|
+
totalTasks: number;
|
|
655
|
+
completed: number;
|
|
656
|
+
failed: number;
|
|
657
|
+
blocked: boolean;
|
|
658
|
+
summary: string;
|
|
659
|
+
}
|
|
660
|
+
declare function mergeResults(waves: Wave[], results: WaveResult[]): MergeReport;
|
|
661
|
+
declare function buildMergeReport(tasks: Task[], results: WaveResult[]): string;
|
|
662
|
+
|
|
663
|
+
interface AgentPromptContext {
|
|
664
|
+
projectName: string;
|
|
665
|
+
phaseName: string;
|
|
666
|
+
stack?: StackInfo;
|
|
667
|
+
phaseGoal?: string;
|
|
668
|
+
}
|
|
669
|
+
declare function buildAgentPrompt(agent: AgentContract, task: Task, ctx: AgentPromptContext): string;
|
|
670
|
+
declare function buildWaveSummary(wave: number, tasks: Task[], phase: Phase, ctx: AgentPromptContext): string;
|
|
671
|
+
|
|
672
|
+
interface CreatePhaseInput {
|
|
673
|
+
id: string;
|
|
674
|
+
name: string;
|
|
675
|
+
description?: string;
|
|
676
|
+
tasks: Omit<Task, 'status'>[];
|
|
677
|
+
}
|
|
678
|
+
declare class WorkflowEngine {
|
|
679
|
+
buildCreatePhaseAction(input: CreatePhaseInput): StateAction;
|
|
680
|
+
buildSwitchPhaseAction(phaseId: string): StateAction;
|
|
681
|
+
buildStartTaskAction(taskId: string): StateAction;
|
|
682
|
+
buildCompleteTaskAction(taskId: string): StateAction;
|
|
683
|
+
buildCompletePhaseAction(phaseId: string): StateAction;
|
|
684
|
+
isPhaseComplete(phase: Phase): boolean;
|
|
685
|
+
getNextAction(state: BrainforgeState): string;
|
|
686
|
+
slugify(name: string): string;
|
|
687
|
+
generatePhaseId(name: string, existingIds: string[]): string;
|
|
688
|
+
}
|
|
689
|
+
|
|
690
|
+
interface PhaseStepStatus {
|
|
691
|
+
phaseId: string;
|
|
692
|
+
step: 'discussion' | 'plan' | 'execution' | 'verification' | 'shipped';
|
|
693
|
+
updatedAt: string;
|
|
694
|
+
}
|
|
695
|
+
declare class PhaseEngine {
|
|
696
|
+
private readonly cwd;
|
|
697
|
+
constructor(cwd: string);
|
|
698
|
+
phaseDir(phaseId: string): string;
|
|
699
|
+
ensurePhaseDir(phaseId: string): Promise<void>;
|
|
700
|
+
writeStatus(phaseId: string, step: PhaseStepStatus['step']): Promise<void>;
|
|
701
|
+
readStatus(phaseId: string): Promise<PhaseStepStatus | null>;
|
|
702
|
+
writeArtifact(phaseId: string, filename: string, content: string): Promise<string>;
|
|
703
|
+
readArtifact(phaseId: string, filename: string): Promise<string | null>;
|
|
704
|
+
listArtifacts(phaseId: string): Promise<string[]>;
|
|
705
|
+
relPath(phaseId: string, filename: string): string;
|
|
706
|
+
}
|
|
707
|
+
|
|
708
|
+
interface ConventionInfo {
|
|
709
|
+
namingStyle: 'camelCase' | 'snake_case' | 'kebab-case' | 'PascalCase' | 'mixed';
|
|
710
|
+
folderPattern: string;
|
|
711
|
+
moduleStyle: 'esm' | 'cjs' | 'mixed' | 'unknown';
|
|
712
|
+
typescriptStrict: boolean;
|
|
713
|
+
hasEditorConfig: boolean;
|
|
714
|
+
hasHusky: boolean;
|
|
715
|
+
hasLintStaged: boolean;
|
|
716
|
+
entryPoint?: string;
|
|
717
|
+
}
|
|
718
|
+
declare function detectConventions(cwd: string, files: string[]): Promise<ConventionInfo>;
|
|
719
|
+
|
|
720
|
+
interface ExecutionContext {
|
|
721
|
+
projectName: string;
|
|
722
|
+
stack?: StackInfo;
|
|
723
|
+
conventions?: ConventionInfo;
|
|
724
|
+
phaseGoal?: string;
|
|
725
|
+
}
|
|
726
|
+
interface TaskPrompt {
|
|
727
|
+
taskId: string;
|
|
728
|
+
taskTitle: string;
|
|
729
|
+
content: string;
|
|
730
|
+
}
|
|
731
|
+
declare class ExecutionEngine {
|
|
732
|
+
buildTaskPrompt(phase: Phase, task: Task, ctx: ExecutionContext): TaskPrompt;
|
|
733
|
+
buildPhasePrompt(phase: Phase, ctx: ExecutionContext): string;
|
|
734
|
+
buildDryRunSummary(phase: Phase): string;
|
|
735
|
+
}
|
|
736
|
+
|
|
737
|
+
interface BugEntry {
|
|
738
|
+
id: string;
|
|
739
|
+
title: string;
|
|
740
|
+
severity: 'critical' | 'major' | 'minor';
|
|
741
|
+
taskId?: string;
|
|
742
|
+
description?: string;
|
|
743
|
+
}
|
|
744
|
+
interface VerifyResult {
|
|
745
|
+
phaseId: string;
|
|
746
|
+
phaseName: string;
|
|
747
|
+
checkedAt: string;
|
|
748
|
+
totalCriteria: number;
|
|
749
|
+
passed: number;
|
|
750
|
+
bugs: BugEntry[];
|
|
751
|
+
blocked: boolean;
|
|
752
|
+
}
|
|
753
|
+
declare class VerificationEngine {
|
|
754
|
+
buildVerifyPrompt(phase: Phase, stack?: StackInfo): string;
|
|
755
|
+
buildVerifyMd(phase: Phase, bugs?: BugEntry[]): string;
|
|
756
|
+
buildBugsMd(bugs: BugEntry[]): string;
|
|
757
|
+
}
|
|
758
|
+
|
|
759
|
+
interface ShipResult {
|
|
760
|
+
phaseId: string;
|
|
761
|
+
phaseName: string;
|
|
762
|
+
shippedAt: string;
|
|
763
|
+
tasksCompleted: number;
|
|
764
|
+
memorySummary: string;
|
|
765
|
+
changelogEntry: string;
|
|
766
|
+
}
|
|
767
|
+
declare class ShipEngine {
|
|
768
|
+
build(phase: Phase, verifyPassed: boolean): ShipResult;
|
|
769
|
+
buildShipMd(phase: Phase, result: ShipResult): string;
|
|
770
|
+
buildMemorySummary(phase: Phase, shippedAt: string): string;
|
|
771
|
+
private buildChangelogEntry;
|
|
772
|
+
}
|
|
773
|
+
|
|
774
|
+
interface BugContext {
|
|
775
|
+
description: string;
|
|
776
|
+
errorMessage?: string;
|
|
777
|
+
reproSteps?: string;
|
|
778
|
+
expectedBehavior?: string;
|
|
779
|
+
actualBehavior?: string;
|
|
780
|
+
phaseId?: string;
|
|
781
|
+
}
|
|
782
|
+
interface DebugPlan {
|
|
783
|
+
bugId: string;
|
|
784
|
+
title: string;
|
|
785
|
+
hypotheses: string[];
|
|
786
|
+
filesToInspect: string[];
|
|
787
|
+
diagnosticCommands: string[];
|
|
788
|
+
prompt: string;
|
|
789
|
+
fixPlanPrompt: string;
|
|
790
|
+
}
|
|
791
|
+
declare class DebugEngine {
|
|
792
|
+
build(ctx: BugContext, phase: Phase | undefined, stack?: StackInfo): DebugPlan;
|
|
793
|
+
buildDebugsMd(plans: DebugPlan[]): string;
|
|
794
|
+
private buildDebugPrompt;
|
|
795
|
+
private buildFixPlanPrompt;
|
|
796
|
+
private generateHypotheses;
|
|
797
|
+
private inferRelevantFiles;
|
|
798
|
+
private buildDiagnosticCommands;
|
|
799
|
+
}
|
|
800
|
+
|
|
801
|
+
interface AutoStep {
|
|
802
|
+
step: number;
|
|
803
|
+
phaseId: string;
|
|
804
|
+
phaseName: string;
|
|
805
|
+
action: 'map' | 'execute' | 'verify' | 'ship';
|
|
806
|
+
description: string;
|
|
807
|
+
blocked: boolean;
|
|
808
|
+
blockReason?: string;
|
|
809
|
+
}
|
|
810
|
+
interface AutoPlan {
|
|
811
|
+
steps: AutoStep[];
|
|
812
|
+
totalPhases: number;
|
|
813
|
+
phasesToRun: number;
|
|
814
|
+
canRun: boolean;
|
|
815
|
+
blockers: string[];
|
|
816
|
+
estimatedPrompts: number;
|
|
817
|
+
}
|
|
818
|
+
interface AutoGates {
|
|
819
|
+
requireCleanGit: boolean;
|
|
820
|
+
stopOnFailure: boolean;
|
|
821
|
+
verifyEachPhase: boolean;
|
|
822
|
+
shipEachPhase: boolean;
|
|
823
|
+
}
|
|
824
|
+
declare class AutoEngine {
|
|
825
|
+
buildPlan(state: BrainforgeState, opts: {
|
|
826
|
+
fromPhaseId?: string;
|
|
827
|
+
toPhaseId?: string;
|
|
828
|
+
gates: AutoGates;
|
|
829
|
+
}): AutoPlan;
|
|
830
|
+
buildDryRunOutput(plan: AutoPlan): string;
|
|
831
|
+
buildAutoSummaryPrompt(plan: AutoPlan, state: BrainforgeState): string;
|
|
832
|
+
}
|
|
833
|
+
|
|
834
|
+
interface Dependency {
|
|
835
|
+
name: string;
|
|
836
|
+
version: string;
|
|
837
|
+
dev: boolean;
|
|
838
|
+
}
|
|
839
|
+
interface DependencyInfo {
|
|
840
|
+
runtime: Dependency[];
|
|
841
|
+
dev: Dependency[];
|
|
842
|
+
total: number;
|
|
843
|
+
manifestType: string;
|
|
844
|
+
highlights: string[];
|
|
845
|
+
}
|
|
846
|
+
declare function analyzeDependencies(cwd: string): Promise<DependencyInfo>;
|
|
847
|
+
|
|
848
|
+
type RiskLevel = 'high' | 'medium' | 'low';
|
|
849
|
+
interface RiskItem {
|
|
850
|
+
level: RiskLevel;
|
|
851
|
+
category: string;
|
|
852
|
+
message: string;
|
|
853
|
+
file?: string;
|
|
854
|
+
}
|
|
855
|
+
interface RiskInfo {
|
|
856
|
+
items: RiskItem[];
|
|
857
|
+
summary: {
|
|
858
|
+
high: number;
|
|
859
|
+
medium: number;
|
|
860
|
+
low: number;
|
|
861
|
+
};
|
|
862
|
+
}
|
|
863
|
+
declare function detectRisks(cwd: string, files: string[], fileContents: Map<string, string>): Promise<RiskInfo>;
|
|
864
|
+
declare function loadFileContents(cwd: string, files: string[], maxLines?: number): Promise<Map<string, string>>;
|
|
865
|
+
|
|
866
|
+
interface TestInfo {
|
|
867
|
+
framework?: string;
|
|
868
|
+
testFiles: string[];
|
|
869
|
+
testCount: number;
|
|
870
|
+
sourceFileCount: number;
|
|
871
|
+
coverageRatio: number;
|
|
872
|
+
hasConfig: boolean;
|
|
873
|
+
coverageEnabled: boolean;
|
|
874
|
+
testCommand?: string;
|
|
875
|
+
}
|
|
876
|
+
declare function detectTests(files: string[], deps: Record<string, string>, scripts?: Record<string, string>): TestInfo;
|
|
877
|
+
|
|
878
|
+
interface FileEntry {
|
|
879
|
+
path: string;
|
|
880
|
+
size: number;
|
|
881
|
+
lines: number;
|
|
882
|
+
role: string;
|
|
883
|
+
}
|
|
884
|
+
interface CodebaseMapResult {
|
|
885
|
+
generatedAt: string;
|
|
886
|
+
projectName: string;
|
|
887
|
+
stack: StackInfo;
|
|
888
|
+
dependencies: DependencyInfo;
|
|
889
|
+
conventions: ConventionInfo;
|
|
890
|
+
risks: RiskInfo;
|
|
891
|
+
tests: TestInfo;
|
|
892
|
+
files: FileEntry[];
|
|
893
|
+
totalFiles: number;
|
|
894
|
+
totalLines: number;
|
|
895
|
+
}
|
|
896
|
+
declare class CodebaseScanner {
|
|
897
|
+
private readonly cwd;
|
|
898
|
+
private readonly codebaseDir;
|
|
899
|
+
constructor(cwd: string);
|
|
900
|
+
scan(deep?: boolean): Promise<CodebaseMapResult>;
|
|
901
|
+
save(result: CodebaseMapResult): Promise<void>;
|
|
902
|
+
loadLatest(): Promise<CodebaseMapResult | null>;
|
|
903
|
+
private toMapMd;
|
|
904
|
+
private toConventionsMd;
|
|
905
|
+
private toRisksMd;
|
|
906
|
+
private toTestsMd;
|
|
907
|
+
private buildFileInventory;
|
|
908
|
+
private walkFiles;
|
|
909
|
+
private readProjectName;
|
|
910
|
+
}
|
|
911
|
+
|
|
912
|
+
type MemoryEntryType = 'decision' | 'summary' | 'gotcha' | 'pattern';
|
|
913
|
+
interface MemoryEntry {
|
|
914
|
+
id: string;
|
|
915
|
+
type: MemoryEntryType;
|
|
916
|
+
title: string;
|
|
917
|
+
content: string;
|
|
918
|
+
tags: string[];
|
|
919
|
+
phaseId?: string;
|
|
920
|
+
createdAt: string;
|
|
921
|
+
}
|
|
922
|
+
declare class MemoryStore {
|
|
923
|
+
private readonly cwd;
|
|
924
|
+
private readonly memoryDir;
|
|
925
|
+
constructor(cwd: string);
|
|
926
|
+
append(entry: Omit<MemoryEntry, 'id' | 'createdAt'> & {
|
|
927
|
+
id?: string;
|
|
928
|
+
createdAt?: string;
|
|
929
|
+
}): Promise<MemoryEntry>;
|
|
930
|
+
readAll(type?: MemoryEntryType): Promise<MemoryEntry[]>;
|
|
931
|
+
recent(type?: MemoryEntryType, limit?: number): Promise<MemoryEntry[]>;
|
|
932
|
+
search(query: string): Promise<MemoryEntry[]>;
|
|
933
|
+
count(): Promise<Record<MemoryEntryType, number>>;
|
|
934
|
+
overwrite(type: MemoryEntryType, entries: MemoryEntry[]): Promise<void>;
|
|
935
|
+
private readFile;
|
|
936
|
+
private updateIndex;
|
|
937
|
+
}
|
|
938
|
+
|
|
939
|
+
interface Decision {
|
|
940
|
+
title: string;
|
|
941
|
+
description: string;
|
|
942
|
+
rationale: string;
|
|
943
|
+
consequences?: string;
|
|
944
|
+
phaseId?: string;
|
|
945
|
+
tags?: string[];
|
|
946
|
+
}
|
|
947
|
+
declare class DecisionLogger {
|
|
948
|
+
private readonly store;
|
|
949
|
+
constructor(store: MemoryStore);
|
|
950
|
+
log(decision: Decision): Promise<MemoryEntry>;
|
|
951
|
+
list(): Promise<MemoryEntry[]>;
|
|
952
|
+
recent(limit?: number): Promise<MemoryEntry[]>;
|
|
953
|
+
}
|
|
954
|
+
|
|
955
|
+
interface Gotcha {
|
|
956
|
+
title: string;
|
|
957
|
+
description: string;
|
|
958
|
+
solution: string;
|
|
959
|
+
phaseId?: string;
|
|
960
|
+
tags?: string[];
|
|
961
|
+
}
|
|
962
|
+
declare class GotchaLogger {
|
|
963
|
+
private readonly store;
|
|
964
|
+
constructor(store: MemoryStore);
|
|
965
|
+
log(gotcha: Gotcha): Promise<MemoryEntry>;
|
|
966
|
+
list(): Promise<MemoryEntry[]>;
|
|
967
|
+
recent(limit?: number): Promise<MemoryEntry[]>;
|
|
968
|
+
}
|
|
969
|
+
|
|
970
|
+
interface CompactionResult {
|
|
971
|
+
type: MemoryEntryType;
|
|
972
|
+
before: number;
|
|
973
|
+
kept: number;
|
|
974
|
+
compacted: number;
|
|
975
|
+
}
|
|
976
|
+
interface CompactionReport {
|
|
977
|
+
ranAt: string;
|
|
978
|
+
results: CompactionResult[];
|
|
979
|
+
totalBefore: number;
|
|
980
|
+
totalAfter: number;
|
|
981
|
+
}
|
|
982
|
+
declare function compact(store: MemoryStore, keepLast?: number): Promise<CompactionReport>;
|
|
983
|
+
|
|
984
|
+
interface ContextPacket {
|
|
985
|
+
version: number;
|
|
986
|
+
generatedAt: string;
|
|
987
|
+
project: {
|
|
988
|
+
name: string;
|
|
989
|
+
language: string;
|
|
990
|
+
framework?: string;
|
|
991
|
+
type: string;
|
|
992
|
+
};
|
|
993
|
+
workflow: {
|
|
994
|
+
mode: string;
|
|
995
|
+
runtime: string;
|
|
996
|
+
};
|
|
997
|
+
phases: {
|
|
998
|
+
total: number;
|
|
999
|
+
completed: number;
|
|
1000
|
+
pending: number;
|
|
1001
|
+
activeId?: string;
|
|
1002
|
+
activeName?: string;
|
|
1003
|
+
};
|
|
1004
|
+
currentPhase?: {
|
|
1005
|
+
id: string;
|
|
1006
|
+
name: string;
|
|
1007
|
+
status: string;
|
|
1008
|
+
tasksTotal: number;
|
|
1009
|
+
tasksDone: number;
|
|
1010
|
+
tasksInProgress: number;
|
|
1011
|
+
nextTask?: string;
|
|
1012
|
+
};
|
|
1013
|
+
recentDecisions: Array<{
|
|
1014
|
+
title: string;
|
|
1015
|
+
content: string;
|
|
1016
|
+
createdAt: string;
|
|
1017
|
+
}>;
|
|
1018
|
+
knownGotchas: Array<{
|
|
1019
|
+
title: string;
|
|
1020
|
+
content: string;
|
|
1021
|
+
}>;
|
|
1022
|
+
recentSummaries: Array<{
|
|
1023
|
+
title: string;
|
|
1024
|
+
content: string;
|
|
1025
|
+
createdAt: string;
|
|
1026
|
+
}>;
|
|
1027
|
+
nextActions: string[];
|
|
1028
|
+
resumeCommands: string[];
|
|
1029
|
+
}
|
|
1030
|
+
declare class ContextPacketBuilder {
|
|
1031
|
+
private readonly cwd;
|
|
1032
|
+
private readonly packetDir;
|
|
1033
|
+
constructor(cwd: string);
|
|
1034
|
+
build(): Promise<ContextPacket>;
|
|
1035
|
+
save(packet: ContextPacket): Promise<{
|
|
1036
|
+
jsonPath: string;
|
|
1037
|
+
mdPath: string;
|
|
1038
|
+
}>;
|
|
1039
|
+
loadLatest(): Promise<ContextPacket | null>;
|
|
1040
|
+
toMarkdown(p: ContextPacket): string;
|
|
1041
|
+
}
|
|
1042
|
+
|
|
1043
|
+
export { AGENT_REGISTRY, type AIAdapter, type AIConfig, type AIProvider, type AcceptanceCriterionResult, AdapterManager, type AgentContract, type AgentId, type AgentPromptContext, AutoEngine, type AutoGates, type AutoPlan, type AutoStep, BUILT_IN_SKILLS, type BrainForgeConfig, BrainForgeServer, type BrainforgeState, type BugContext, type BugEntry, type BugReport, type BugSeverity, COMMANDS_BY_NAME, COMMAND_DEFINITIONS, type ClassInfo, ClaudeAdapter, type CodebaseMap, type CodebaseMapResult, CodebaseMapper, CodebaseScanner, type CommandDef, type CompactionReport, type CompactionResult, type CompletionOptions, type ConflictWarning, type ContextField, type ContextPacket, ContextPacketBuilder, type ConventionInfo, type CreatePhaseInput, DEFAULT_CONFIG, DebugEngine, type DebugPlan, type Decision, DecisionLogger, DeepSeekAdapter, type DefenseAnswer, type DefenseSession, type Dependency, type DependencyInfo, type DetectionResult, type DynamicQuestion, type ExecutionContext, ExecutionEngine, type FileChangeEvent, type FileEntry, type FileNode, FileWatcher, type FunctionInfo, GeminiAdapter, type Gotcha, GotchaLogger, type HeuristicPattern, type InstallResult, type Language, type MemoryEntry, type MemoryEntryType, MemoryStore, type MergeReport, type MigrationResult, MockDefense, OpenAIAdapter, type OrchestratorResult, ParallelOrchestrator, type PatternMatch, type Phase, PhaseEngine, type PhaseStatus, type PhaseStepStatus, type PlanAction, type PlanStep, ProfessorScanner, type ProjectConfig, type ProjectType, PromptEngine, type Question, RUNTIME_REGISTRY, type RiskInfo, type RiskItem, type RiskLevel, type RunRecord, type RuntimeCapability, type RuntimeDefinition, type RuntimeId, type RuntimeName, type ScanReport, type Severity, ShipEngine, type ShipResult, type Skill, type SkillCategory, type SkillContext, SkillRegistry, type StackInfo, type StateAction, StateManager, type StudentLevel, type Task, type TaskPlan, TaskPlanner, type TaskPriority, type TaskPrompt, type TaskStatus, type TaskType, type TestInfo, type ValidationResult, VerificationEngine, type VerificationResult, type VerifyResult, type Wave, type WaveGroup, WavePlanner, type WaveResult, WorkflowEngine, type WorkflowMode, Workspace, analyzeDependencies, buildAgentPrompt, buildMergeReport, buildQuestionSet, buildWaveSummary, compact, detectAndMigrate, detectConflicts, detectConventions, detectRisks, detectRuntimes, detectStack, detectTests, getAgent, getRuntime, installRuntime, listAgents, listRuntimes, loadConfig, loadFileContents, mergeResults, reduce, saveConfig, validateConfig, validatePhase, validateProjectConfig, validateTask };
|