@baselineos/cli 0.1.0

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.
@@ -0,0 +1,616 @@
1
+ /**
2
+ * Baseline Command System
3
+ *
4
+ * Provides workflow execution across all Baseline Protocol layers,
5
+ * command chaining, and a queue system for orchestrating operations.
6
+ */
7
+ interface CommandState {
8
+ customContextFolder: string | null;
9
+ baselineMode: boolean;
10
+ commandQueue: string[];
11
+ executionHistory: WorkflowExecution[];
12
+ currentWorkflow: WorkflowExecution | null;
13
+ }
14
+ interface WorkflowExecution {
15
+ id: string;
16
+ startTime: Date;
17
+ endTime?: Date;
18
+ duration?: number;
19
+ options: Record<string, unknown>;
20
+ status: string;
21
+ error?: string;
22
+ }
23
+ interface LexiconEntry {
24
+ description: string;
25
+ usage: string;
26
+ category: string;
27
+ examples: string[];
28
+ }
29
+ interface SyntaxEntry {
30
+ pattern: string;
31
+ parameters: Record<string, string>;
32
+ examples: string[];
33
+ }
34
+ interface CommandEntry {
35
+ description: string;
36
+ action: string;
37
+ category: string;
38
+ }
39
+ interface LayerResult {
40
+ success: boolean;
41
+ error?: string;
42
+ [key: string]: unknown;
43
+ }
44
+ interface WorkflowResult {
45
+ success: boolean;
46
+ error?: string;
47
+ workflow?: WorkflowExecution;
48
+ results?: {
49
+ init: LayerResult;
50
+ lang: LayerResult;
51
+ frame: LayerResult;
52
+ studio: LayerResult;
53
+ govern: LayerResult;
54
+ };
55
+ }
56
+ declare class BaselineCommandSystem {
57
+ private state;
58
+ private megagem;
59
+ private contextEngine;
60
+ private baselineLang;
61
+ constructor();
62
+ /**
63
+ * Initialize the Baseline lexicon with all recognized flags and their
64
+ * descriptions, usage patterns, categories, and examples.
65
+ */
66
+ initializeBaselineLexicon(): Record<string, LexiconEntry>;
67
+ /**
68
+ * Initialize syntax patterns for the command system, defining parameter
69
+ * schemas and usage examples for each pattern.
70
+ */
71
+ initializeBaselineSyntax(): Record<string, SyntaxEntry>;
72
+ /**
73
+ * Initialize the built-in command registry with descriptions and action
74
+ * identifiers for each recognized command.
75
+ */
76
+ initializeBaselineCommands(): Record<string, CommandEntry>;
77
+ /**
78
+ * Execute the full Baseline Protocol workflow across all five layers:
79
+ * init -> lang -> frame -> studio -> govern
80
+ */
81
+ executeBaselineWorkflow(options?: Record<string, unknown>): Promise<WorkflowResult>;
82
+ private normalizeString;
83
+ private normalizeBoolean;
84
+ private resolveContext;
85
+ private loadOnboardingProfile;
86
+ private saveOnboardingProfile;
87
+ private loadBaselineConfig;
88
+ private saveBaselineConfig;
89
+ private fileExists;
90
+ private buildDefaultConfig;
91
+ private getExperienceCatalog;
92
+ private getLearningPaths;
93
+ /**
94
+ * Execute a guided onboarding flow (team, project, system) and optionally
95
+ * run the full Baseline workflow. Designed for a 20-minute quickstart.
96
+ */
97
+ executeOnboarding(options?: Record<string, unknown>): Promise<LayerResult>;
98
+ /**
99
+ * Execute an immersive experience sequence based on the selected learning path.
100
+ * Uses onboarding profile data and persists progress.
101
+ */
102
+ executeExperience(options?: Record<string, unknown>): Promise<LayerResult>;
103
+ /**
104
+ * Initialize Baseline and optionally persist config to disk.
105
+ */
106
+ executeInit(options?: Record<string, unknown>): Promise<LayerResult>;
107
+ /**
108
+ * Update or show Baseline configuration.
109
+ */
110
+ executeConfig(options?: Record<string, unknown>): Promise<LayerResult>;
111
+ private collectIndexEntries;
112
+ /**
113
+ * Index documentation/context files for retrieval.
114
+ */
115
+ executeIndex(options?: Record<string, unknown>): Promise<LayerResult>;
116
+ /**
117
+ * Placeholder for MCP server/daemon execution.
118
+ */
119
+ executeServe(options?: Record<string, unknown>): Promise<LayerResult>;
120
+ /**
121
+ * Placeholder for agent status and management.
122
+ */
123
+ executePersona(_options?: Record<string, unknown>): LayerResult;
124
+ executeAgents(options?: Record<string, unknown>): Promise<LayerResult>;
125
+ private buildBaselineOS;
126
+ executeServeWithOptions(options: Record<string, unknown>): Promise<LayerResult>;
127
+ executeAgentsWithOptions(options: Record<string, unknown>): Promise<LayerResult>;
128
+ /**
129
+ * Run diagnostics for configuration and readiness.
130
+ */
131
+ executeDoctor(options?: Record<string, unknown>): Promise<LayerResult>;
132
+ /**
133
+ * Initialize the Baseline environment, setting up context folder,
134
+ * configuration, and mode.
135
+ */
136
+ initializeBaseline(options?: Record<string, unknown>): Promise<LayerResult>;
137
+ /**
138
+ * Execute the Baseline Language layer -- parsing, validation,
139
+ * and semantic analysis of the project context.
140
+ */
141
+ executeBaselineLang(options?: Record<string, unknown>): Promise<LayerResult>;
142
+ /**
143
+ * Execute the Baseline Frame layer -- scaffolding, composition,
144
+ * and framework orchestration.
145
+ */
146
+ executeBaselineFrame(options?: Record<string, unknown>): Promise<LayerResult>;
147
+ /**
148
+ * Execute the Baseline Studio layer -- design rendering,
149
+ * preview generation, and visual asset processing.
150
+ */
151
+ executeBaselineStudio(options?: Record<string, unknown>): Promise<LayerResult>;
152
+ /**
153
+ * Execute the Baseline Govern layer -- audit, policy enforcement,
154
+ * compliance checking, and governance controls.
155
+ */
156
+ executeBaselineGovern(options?: Record<string, unknown>): Promise<LayerResult>;
157
+ /**
158
+ * Execute a chain of commands sequentially. Each command in the array
159
+ * is executed in order. If any command fails, the chain halts.
160
+ */
161
+ executeChainedCommands(commands: string[]): Promise<LayerResult>;
162
+ /**
163
+ * Add a command to the execution queue for deferred execution.
164
+ */
165
+ queueCommand(command: string): void;
166
+ /**
167
+ * Execute all commands currently in the queue, in FIFO order,
168
+ * then clear the queue.
169
+ */
170
+ executeQueue(): Promise<LayerResult>;
171
+ /**
172
+ * Execute a single command string by dispatching to the appropriate
173
+ * handler based on the command flag.
174
+ */
175
+ executeCommand(command: string): Promise<LayerResult | WorkflowResult>;
176
+ /**
177
+ * Return the current status of the Baseline system, including
178
+ * state, execution history, and queue contents.
179
+ */
180
+ getStatus(): Record<string, unknown>;
181
+ /**
182
+ * Display help information for all available commands, flags,
183
+ * and syntax patterns.
184
+ */
185
+ showHelp(): void;
186
+ /**
187
+ * Set the MEGAGEM integration instance for autonomous operations.
188
+ */
189
+ setMegagem(megagem: unknown): void;
190
+ /**
191
+ * Set the Context Engine integration instance for context management.
192
+ */
193
+ setContextEngine(contextEngine: unknown): void;
194
+ }
195
+
196
+ /**
197
+ * MEGAGEM Core System and Autonomous Agent
198
+ *
199
+ * Combined module providing the MEGAGEM core system for autonomous
200
+ * operations and the autonomous agent framework for project ownership,
201
+ * learning, and collaboration.
202
+ */
203
+ interface AutonomyLevelConfig {
204
+ name: string;
205
+ description: string;
206
+ }
207
+ interface MEGAGEMConfig {
208
+ system: {
209
+ name: string;
210
+ version: string;
211
+ description: string;
212
+ };
213
+ autonomy: {
214
+ defaultLevel: number;
215
+ maxLevel: number;
216
+ safetyThresholds: {
217
+ riskTolerance: string;
218
+ humanOversight: string;
219
+ };
220
+ };
221
+ learning: {
222
+ continuousLearning: boolean;
223
+ selfImprovement: boolean;
224
+ knowledgeSharing: boolean;
225
+ };
226
+ safety: {
227
+ riskAssessment: boolean;
228
+ boundaryEnforcement: boolean;
229
+ humanOverride: boolean;
230
+ auditLogging: boolean;
231
+ };
232
+ }
233
+ interface ProjectData {
234
+ name: string;
235
+ description: string;
236
+ type: string;
237
+ objectives?: string[];
238
+ constraints?: string[];
239
+ resources?: Record<string, unknown>;
240
+ timeline?: Record<string, unknown>;
241
+ }
242
+ interface Project {
243
+ id: string;
244
+ name: string;
245
+ description: string;
246
+ type: string;
247
+ status: string;
248
+ ownershipLevel: string;
249
+ startDate: Date;
250
+ endDate?: Date;
251
+ objectives: string[];
252
+ constraints: string[];
253
+ resources: Record<string, unknown>;
254
+ timeline: Record<string, unknown>;
255
+ team: Set<string>;
256
+ teamMembers?: unknown[];
257
+ tasks: Map<string, unknown>;
258
+ milestones: Map<string, unknown>;
259
+ risks: Map<string, unknown>;
260
+ progress: number;
261
+ plan?: Record<string, unknown>;
262
+ strategy?: Record<string, unknown>;
263
+ healthMetrics?: Record<string, unknown>;
264
+ qualityGates?: string[];
265
+ deliverables?: Record<string, unknown>;
266
+ qualityScore?: number;
267
+ error?: string;
268
+ }
269
+ interface PerformanceMetrics {
270
+ decisionsAccuracy: number;
271
+ taskCompletionRate: number;
272
+ learningRate: number;
273
+ collaborationScore: number;
274
+ safetyCompliance: number;
275
+ totalDecisions: number;
276
+ totalTasks: number;
277
+ totalCollaborations: number;
278
+ uptime: number;
279
+ startTime: Date;
280
+ }
281
+ interface AutonomyController {
282
+ currentLevel: number;
283
+ maxLevel: number;
284
+ levels: Record<number, AutonomyLevelConfig>;
285
+ escalationRules: EscalationRule[];
286
+ overrideActive: boolean;
287
+ }
288
+ interface EscalationRule {
289
+ condition: string;
290
+ action: string;
291
+ targetLevel: number;
292
+ }
293
+ interface DecisionEngine {
294
+ pendingDecisions: unknown[];
295
+ decisionHistory: unknown[];
296
+ decisionThresholds: Record<string, number>;
297
+ autoApprove: boolean;
298
+ }
299
+ interface ProjectOwner {
300
+ activeProjects: Map<string, Project>;
301
+ completedProjects: Map<string, Project>;
302
+ projectTemplates: Map<string, Record<string, unknown>>;
303
+ }
304
+ interface LearningEngine {
305
+ knowledgeBase: Map<string, unknown>;
306
+ learningHistory: unknown[];
307
+ patterns: Map<string, unknown>;
308
+ adaptationRate: number;
309
+ }
310
+ interface SafetyEngine {
311
+ riskAssessments: Map<string, unknown>;
312
+ boundaries: Map<string, unknown>;
313
+ safetyEvents: unknown[];
314
+ overrideEnabled: boolean;
315
+ }
316
+ interface CollaborationEngine {
317
+ activeCollaborations: Map<string, unknown>;
318
+ communicationLog: unknown[];
319
+ teamRegistry: Map<string, unknown>;
320
+ }
321
+ interface AgentCapabilities {
322
+ [key: string]: boolean | string | number | string[];
323
+ }
324
+ interface AgentPerformanceMetrics {
325
+ tasksCompleted: number;
326
+ tasksFailed: number;
327
+ successRate: number;
328
+ averageCompletionTime: number;
329
+ qualityScore: number;
330
+ learningProgress: number;
331
+ }
332
+ interface TaskResult {
333
+ success: boolean;
334
+ output?: unknown;
335
+ error?: string;
336
+ duration?: number;
337
+ }
338
+ interface TeamRequirements {
339
+ roles: string[];
340
+ skills: string[];
341
+ minSize: number;
342
+ maxSize: number;
343
+ }
344
+ interface HealthAssessment {
345
+ overall: string;
346
+ score: number;
347
+ timeline: string;
348
+ quality: string;
349
+ resources: string;
350
+ risks: string;
351
+ details?: Record<string, unknown>;
352
+ }
353
+ declare class MEGAGEMCoreSystem {
354
+ systemName: string;
355
+ version: string;
356
+ autonomyLevel: number;
357
+ isActive: boolean;
358
+ learningMode: boolean;
359
+ safetyMode: boolean;
360
+ autonomyController: AutonomyController;
361
+ decisionEngine: DecisionEngine;
362
+ projectOwner: ProjectOwner;
363
+ learningEngine: LearningEngine;
364
+ safetyEngine: SafetyEngine;
365
+ collaborationEngine: CollaborationEngine;
366
+ currentProjects: Map<string, Project>;
367
+ performanceMetrics: PerformanceMetrics;
368
+ learningHistory: unknown[];
369
+ safetyEvents: unknown[];
370
+ config: MEGAGEMConfig;
371
+ constructor();
372
+ /**
373
+ * Set up the autonomy controller with five operational levels
374
+ * and escalation rules.
375
+ */
376
+ initializeAutonomyController(): AutonomyController;
377
+ /**
378
+ * Set up the decision engine with thresholds and history tracking.
379
+ */
380
+ initializeDecisionEngine(): DecisionEngine;
381
+ /**
382
+ * Set up the project ownership engine with project stores and templates.
383
+ */
384
+ initializeProjectOwner(): ProjectOwner;
385
+ /**
386
+ * Set up the learning engine with knowledge base and adaptation rate.
387
+ */
388
+ initializeLearningEngine(): LearningEngine;
389
+ /**
390
+ * Set up the safety engine with risk assessment stores and boundary
391
+ * configuration.
392
+ */
393
+ initializeSafetyEngine(): SafetyEngine;
394
+ /**
395
+ * Set up the collaboration engine with registries and communication log.
396
+ */
397
+ initializeCollaborationEngine(): CollaborationEngine;
398
+ /**
399
+ * Perform full system initialization: activate learning, safety, and
400
+ * log startup information.
401
+ */
402
+ initializeSystem(): Promise<{
403
+ success: boolean;
404
+ status: Record<string, unknown>;
405
+ }>;
406
+ /**
407
+ * Set the autonomy level (1-5) and update the system behavior accordingly.
408
+ */
409
+ setAutonomyLevel(level: number): {
410
+ success: boolean;
411
+ level: number;
412
+ name: string;
413
+ error?: string;
414
+ };
415
+ /**
416
+ * Update internal system behavior based on the autonomy level.
417
+ */
418
+ updateSystemBehavior(level: number): void;
419
+ /**
420
+ * Return a comprehensive snapshot of the current system status.
421
+ */
422
+ getSystemStatus(): Record<string, unknown>;
423
+ /**
424
+ * Attempt to load a configuration file from the given path.
425
+ * Falls back to defaults if the file does not exist.
426
+ */
427
+ loadConfiguration(configPath: string): MEGAGEMConfig;
428
+ /**
429
+ * Return the default MEGAGEM configuration object.
430
+ */
431
+ getDefaultConfig(): MEGAGEMConfig;
432
+ /**
433
+ * Activate autonomous operation mode: sets the system active, starts
434
+ * performance tracking, and returns the active capabilities.
435
+ */
436
+ startAutonomousOperation(): Promise<{
437
+ success: boolean;
438
+ capabilities: string[];
439
+ error?: string;
440
+ }>;
441
+ /**
442
+ * Determine which capabilities should be active given the current
443
+ * autonomy level and return them as a list.
444
+ */
445
+ activateAutonomousCapabilities(): string[];
446
+ /**
447
+ * Return the list of capabilities currently active.
448
+ */
449
+ getActiveCapabilities(): string[];
450
+ }
451
+ declare class MEGAGEMAutonomousAgent {
452
+ agentId: string;
453
+ agentType: string;
454
+ capabilities: AgentCapabilities;
455
+ autonomyLevel: number;
456
+ isActive: boolean;
457
+ currentProjects: Map<string, Project>;
458
+ performanceMetrics: AgentPerformanceMetrics;
459
+ learningHistory: unknown[];
460
+ collaborationHistory: unknown[];
461
+ status: string;
462
+ currentTask: string | null;
463
+ teamMembers: string[];
464
+ resources: Map<string, unknown>;
465
+ knowledgeBase: Map<string, unknown>;
466
+ skillLevels: Map<string, number>;
467
+ adaptationRate: number;
468
+ constructor(agentType?: string, autonomyLevel?: number);
469
+ /**
470
+ * Generate a unique agent identifier.
471
+ */
472
+ generateAgentId(): string;
473
+ /**
474
+ * Activate the agent for autonomous operation.
475
+ */
476
+ activate(): void;
477
+ /**
478
+ * Initialize capabilities based on the agent type. Supports five
479
+ * types: project-manager, developer, designer, analyst, general.
480
+ */
481
+ initializeCapabilities(agentType: string): void;
482
+ /**
483
+ * Take ownership of a project, creating the internal project record
484
+ * and setting status to planning.
485
+ */
486
+ takeProjectOwnership(projectData: ProjectData): Promise<Project>;
487
+ /**
488
+ * Execute a project autonomously through all lifecycle phases:
489
+ * plan -> form team -> allocate resources -> execute -> monitor -> deliver.
490
+ */
491
+ executeProjectAutonomously(projectId: string): Promise<Project>;
492
+ /**
493
+ * Create a strategic plan for the project including phases, milestones,
494
+ * task breakdown, timeline, resource plan, and risk assessment.
495
+ */
496
+ planProject(project: Project): Promise<void>;
497
+ /**
498
+ * Form a team for the project by analyzing requirements and assigning roles.
499
+ */
500
+ formProjectTeam(project: Project): Promise<void>;
501
+ /**
502
+ * Allocate resources to the project based on current plan and constraints.
503
+ */
504
+ allocateResources(project: Project): Promise<void>;
505
+ /**
506
+ * Execute the project plan by iterating through all tasks.
507
+ */
508
+ executeProjectPlan(project: Project): Promise<void>;
509
+ /**
510
+ * Monitor project health and adjust the plan if deviations are detected.
511
+ */
512
+ monitorAndControl(project: Project): Promise<void>;
513
+ /**
514
+ * Deliver project outputs, perform quality checks, and prepare deliverables.
515
+ */
516
+ deliverProject(project: Project): Promise<void>;
517
+ /**
518
+ * Build a strategic plan from the project's objectives and constraints.
519
+ */
520
+ createStrategicPlan(project: Project): Record<string, unknown>;
521
+ /**
522
+ * Define project phases based on the project type.
523
+ */
524
+ defineProjectPhases(project: Project): Record<string, unknown>[];
525
+ /**
526
+ * Define milestones for the project plan.
527
+ */
528
+ defineMilestones(_project: Project): Record<string, unknown>[];
529
+ /**
530
+ * Break project objectives down into concrete tasks.
531
+ */
532
+ breakDownTasks(project: Project): Record<string, unknown>[];
533
+ /**
534
+ * Build a timeline for the project based on tasks and milestones.
535
+ */
536
+ createTimeline(project: Project): Record<string, unknown>;
537
+ /**
538
+ * Create a resource allocation plan for the project.
539
+ */
540
+ planResources(project: Project): Record<string, unknown>;
541
+ /**
542
+ * Assess potential risks for the project and return a list of risk records.
543
+ */
544
+ assessRisks(project: Project): Record<string, unknown>[];
545
+ /**
546
+ * Analyze the team requirements for a project based on its type and scope.
547
+ */
548
+ analyzeTeamRequirements(project: Project): TeamRequirements;
549
+ /**
550
+ * Return the capabilities expected for a given team role.
551
+ */
552
+ getRoleCapabilities(role: string): string[];
553
+ /**
554
+ * Execute a single task and return the result.
555
+ */
556
+ executeTask(task: Record<string, unknown>): Promise<TaskResult>;
557
+ /**
558
+ * Determine if a project phase is complete by checking task statuses.
559
+ */
560
+ isPhaseComplete(project: Project, phaseIndex: number): boolean;
561
+ /**
562
+ * Assess overall project health across timeline, quality, resources,
563
+ * and risks dimensions.
564
+ */
565
+ assessProjectHealth(project: Project): HealthAssessment;
566
+ /**
567
+ * Assess the timeline health of the project (0.0 - 1.0).
568
+ */
569
+ assessTimelineHealth(project: Project): number;
570
+ /**
571
+ * Assess the quality health of the project (0.0 - 1.0).
572
+ */
573
+ assessQualityHealth(_project: Project): number;
574
+ /**
575
+ * Assess the resource health of the project (0.0 - 1.0).
576
+ */
577
+ assessResourceHealth(project: Project): number;
578
+ /**
579
+ * Assess the risk health of the project (0.0 - 1.0).
580
+ */
581
+ assessRiskHealth(project: Project): number;
582
+ /**
583
+ * Adjust the project plan to address health assessment findings.
584
+ */
585
+ adjustProjectPlan(project: Project, health: HealthAssessment): Promise<void>;
586
+ /**
587
+ * Accelerate project execution by reprioritizing tasks.
588
+ */
589
+ accelerateProject(project: Project): void;
590
+ /**
591
+ * Improve quality by adding quality gates to the project.
592
+ */
593
+ improveQuality(project: Project): void;
594
+ /**
595
+ * Optimize resource usage by consolidating and redistributing.
596
+ */
597
+ optimizeResources(project: Project): void;
598
+ /**
599
+ * Perform a quality check on the project deliverables.
600
+ */
601
+ performQualityCheck(project: Project): Record<string, unknown>;
602
+ /**
603
+ * Prepare the final deliverables summary for the project.
604
+ */
605
+ prepareDeliverables(project: Project): Record<string, unknown>;
606
+ /**
607
+ * Return a status snapshot for this agent.
608
+ */
609
+ getAgentStatus(): Record<string, unknown>;
610
+ /**
611
+ * Generate a unique project identifier.
612
+ */
613
+ generateProjectId(): string;
614
+ }
615
+
616
+ export { type AutonomyLevelConfig, BaselineCommandSystem, type CommandEntry, type CommandState, type LayerResult, type LexiconEntry, MEGAGEMAutonomousAgent, type MEGAGEMConfig, MEGAGEMCoreSystem, type Project, type ProjectData, type SyntaxEntry, type WorkflowExecution, type WorkflowResult };