aios-core 3.7.0 → 3.9.1
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/.aios-core/core/session/context-detector.js +3 -0
- package/.aios-core/core/session/context-loader.js +154 -0
- package/.aios-core/data/learned-patterns.yaml +3 -0
- package/.aios-core/data/workflow-patterns.yaml +347 -3
- package/.aios-core/development/agents/dev.md +6 -0
- package/.aios-core/development/agents/squad-creator.md +30 -0
- package/.aios-core/development/scripts/squad/squad-analyzer.js +638 -0
- package/.aios-core/development/scripts/squad/squad-extender.js +871 -0
- package/.aios-core/development/scripts/squad/squad-generator.js +107 -19
- package/.aios-core/development/scripts/squad/squad-migrator.js +3 -5
- package/.aios-core/development/scripts/squad/squad-validator.js +98 -0
- package/.aios-core/development/tasks/next.md +294 -0
- package/.aios-core/development/tasks/patterns.md +334 -0
- package/.aios-core/development/tasks/squad-creator-analyze.md +315 -0
- package/.aios-core/development/tasks/squad-creator-create.md +26 -3
- package/.aios-core/development/tasks/squad-creator-extend.md +411 -0
- package/.aios-core/development/tasks/squad-creator-validate.md +9 -1
- package/.aios-core/development/tasks/waves.md +205 -0
- package/.aios-core/development/templates/squad/agent-template.md +69 -0
- package/.aios-core/development/templates/squad/checklist-template.md +82 -0
- package/.aios-core/development/templates/squad/data-template.yaml +105 -0
- package/.aios-core/development/templates/squad/script-template.js +179 -0
- package/.aios-core/development/templates/squad/task-template.md +125 -0
- package/.aios-core/development/templates/squad/template-template.md +97 -0
- package/.aios-core/development/templates/squad/tool-template.js +103 -0
- package/.aios-core/development/templates/squad/workflow-template.yaml +108 -0
- package/.aios-core/infrastructure/scripts/test-generator.js +8 -8
- package/.aios-core/infrastructure/scripts/test-quality-assessment.js +5 -5
- package/.aios-core/infrastructure/scripts/test-utilities.js +3 -3
- package/.aios-core/install-manifest.yaml +97 -33
- package/.aios-core/quality/metrics-collector.js +27 -0
- package/.aios-core/scripts/session-context-loader.js +13 -254
- package/.aios-core/scripts/test-template-system.js +6 -6
- package/.aios-core/utils/aios-validator.js +25 -0
- package/.aios-core/workflow-intelligence/__tests__/confidence-scorer.test.js +334 -0
- package/.aios-core/workflow-intelligence/__tests__/integration.test.js +337 -0
- package/.aios-core/workflow-intelligence/__tests__/suggestion-engine.test.js +431 -0
- package/.aios-core/workflow-intelligence/__tests__/wave-analyzer.test.js +458 -0
- package/.aios-core/workflow-intelligence/__tests__/workflow-registry.test.js +302 -0
- package/.aios-core/workflow-intelligence/engine/confidence-scorer.js +305 -0
- package/.aios-core/workflow-intelligence/engine/output-formatter.js +285 -0
- package/.aios-core/workflow-intelligence/engine/suggestion-engine.js +603 -0
- package/.aios-core/workflow-intelligence/engine/wave-analyzer.js +676 -0
- package/.aios-core/workflow-intelligence/index.js +327 -0
- package/.aios-core/workflow-intelligence/learning/capture-hook.js +147 -0
- package/.aios-core/workflow-intelligence/learning/index.js +230 -0
- package/.aios-core/workflow-intelligence/learning/pattern-capture.js +340 -0
- package/.aios-core/workflow-intelligence/learning/pattern-store.js +498 -0
- package/.aios-core/workflow-intelligence/learning/pattern-validator.js +309 -0
- package/.aios-core/workflow-intelligence/registry/workflow-registry.js +358 -0
- package/package.json +1 -1
- package/src/installer/brownfield-upgrader.js +1 -1
- package/bin/aios-init.backup-v1.1.4.js +0 -352
|
@@ -304,15 +304,27 @@ function generateSquadYaml(config) {
|
|
|
304
304
|
components.tasks = [];
|
|
305
305
|
}
|
|
306
306
|
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
307
|
+
// SQS-10: Use project configs if available, otherwise use local paths
|
|
308
|
+
let configSection;
|
|
309
|
+
if (config.configMode === 'none') {
|
|
310
|
+
configSection = {};
|
|
311
|
+
} else if (config._useProjectConfigs && config._projectConfigs) {
|
|
312
|
+
// Reference project-level config files
|
|
313
|
+
configSection = {
|
|
314
|
+
extends: config.configMode,
|
|
315
|
+
'coding-standards': config._projectConfigs['coding-standards'] || 'config/coding-standards.md',
|
|
316
|
+
'tech-stack': config._projectConfigs['tech-stack'] || 'config/tech-stack.md',
|
|
317
|
+
'source-tree': config._projectConfigs['source-tree'] || 'config/source-tree.md',
|
|
318
|
+
};
|
|
319
|
+
} else {
|
|
320
|
+
// Fallback to local config files
|
|
321
|
+
configSection = {
|
|
322
|
+
extends: config.configMode,
|
|
323
|
+
'coding-standards': 'config/coding-standards.md',
|
|
324
|
+
'tech-stack': 'config/tech-stack.md',
|
|
325
|
+
'source-tree': 'config/source-tree.md',
|
|
326
|
+
};
|
|
327
|
+
}
|
|
316
328
|
|
|
317
329
|
const yaml = `name: ${config.name}
|
|
318
330
|
version: 1.0.0
|
|
@@ -644,6 +656,53 @@ class SquadGenerator {
|
|
|
644
656
|
}
|
|
645
657
|
}
|
|
646
658
|
|
|
659
|
+
/**
|
|
660
|
+
* Detect project-level configuration files in docs/framework/
|
|
661
|
+
* Implements AC10.1: Project Config Detection
|
|
662
|
+
*
|
|
663
|
+
* @param {string} projectRoot - Project root directory
|
|
664
|
+
* @param {string} squadPath - Path to squad being created (for relative paths)
|
|
665
|
+
* @returns {Promise<Object|null>} Detected config paths (relative to squadPath) or null if not found
|
|
666
|
+
* @see Story SQS-10: Project Config Reference for Squads
|
|
667
|
+
*/
|
|
668
|
+
async detectProjectConfigs(projectRoot, squadPath) {
|
|
669
|
+
const frameworkDir = path.join(projectRoot, 'docs', 'framework');
|
|
670
|
+
|
|
671
|
+
// Check if docs/framework/ exists
|
|
672
|
+
if (!(await this.pathExists(frameworkDir))) {
|
|
673
|
+
return null;
|
|
674
|
+
}
|
|
675
|
+
|
|
676
|
+
// Config files to detect (case-insensitive variants)
|
|
677
|
+
const configFiles = {
|
|
678
|
+
'coding-standards': ['CODING-STANDARDS.md', 'coding-standards.md', 'Coding-Standards.md'],
|
|
679
|
+
'tech-stack': ['TECH-STACK.md', 'tech-stack.md', 'Tech-Stack.md'],
|
|
680
|
+
'source-tree': ['SOURCE-TREE.md', 'source-tree.md', 'Source-Tree.md'],
|
|
681
|
+
};
|
|
682
|
+
|
|
683
|
+
const detected = {};
|
|
684
|
+
|
|
685
|
+
for (const [key, variants] of Object.entries(configFiles)) {
|
|
686
|
+
for (const filename of variants) {
|
|
687
|
+
const fullPath = path.join(frameworkDir, filename);
|
|
688
|
+
if (await this.pathExists(fullPath)) {
|
|
689
|
+
// Calculate relative path from squad to project config
|
|
690
|
+
detected[key] = path.relative(squadPath, fullPath).replace(/\\/g, '/');
|
|
691
|
+
break;
|
|
692
|
+
}
|
|
693
|
+
}
|
|
694
|
+
}
|
|
695
|
+
|
|
696
|
+
// Only return if at least one config file was found
|
|
697
|
+
const foundCount = Object.keys(detected).length;
|
|
698
|
+
if (foundCount > 0) {
|
|
699
|
+
console.log(`[squad-generator] Detected ${foundCount} project config(s) in docs/framework/`);
|
|
700
|
+
return detected;
|
|
701
|
+
}
|
|
702
|
+
|
|
703
|
+
return null;
|
|
704
|
+
}
|
|
705
|
+
|
|
647
706
|
/**
|
|
648
707
|
* Validate generation configuration
|
|
649
708
|
* @param {Object} config - Configuration to validate
|
|
@@ -686,6 +745,7 @@ class SquadGenerator {
|
|
|
686
745
|
* @param {boolean} [config.includeAgent=true] - Include example agent
|
|
687
746
|
* @param {boolean} [config.includeTask=true] - Include example task
|
|
688
747
|
* @param {string} [config.aiosMinVersion] - Minimum AIOS version
|
|
748
|
+
* @param {string} [config.projectRoot] - Project root directory (for detecting project configs)
|
|
689
749
|
* @returns {Promise<Object>} Generation result with path and files
|
|
690
750
|
* @throws {SquadGeneratorError} If generation fails
|
|
691
751
|
*/
|
|
@@ -701,6 +761,7 @@ class SquadGenerator {
|
|
|
701
761
|
includeAgent: config.includeAgent !== false,
|
|
702
762
|
includeTask: config.includeTask !== false,
|
|
703
763
|
aiosMinVersion: config.aiosMinVersion || DEFAULT_AIOS_MIN_VERSION,
|
|
764
|
+
projectRoot: config.projectRoot || process.cwd(),
|
|
704
765
|
};
|
|
705
766
|
|
|
706
767
|
// Validate configuration
|
|
@@ -708,6 +769,23 @@ class SquadGenerator {
|
|
|
708
769
|
|
|
709
770
|
const squadPath = path.join(this.squadsPath, fullConfig.name);
|
|
710
771
|
|
|
772
|
+
// SQS-10: Detect project-level configs when configMode is 'extend'
|
|
773
|
+
let projectConfigs = null;
|
|
774
|
+
let useProjectConfigs = false;
|
|
775
|
+
|
|
776
|
+
if (fullConfig.configMode === 'extend') {
|
|
777
|
+
projectConfigs = await this.detectProjectConfigs(fullConfig.projectRoot, squadPath);
|
|
778
|
+
useProjectConfigs = projectConfigs !== null;
|
|
779
|
+
|
|
780
|
+
if (useProjectConfigs) {
|
|
781
|
+
console.log('[squad-generator] Using project-level configuration from docs/framework/');
|
|
782
|
+
}
|
|
783
|
+
}
|
|
784
|
+
|
|
785
|
+
// Store for use in squad.yaml generation
|
|
786
|
+
fullConfig._projectConfigs = projectConfigs;
|
|
787
|
+
fullConfig._useProjectConfigs = useProjectConfigs;
|
|
788
|
+
|
|
711
789
|
// Check if squad already exists
|
|
712
790
|
if (await this.pathExists(squadPath)) {
|
|
713
791
|
throw SquadGeneratorError.squadExists(fullConfig.name, squadPath);
|
|
@@ -734,17 +812,27 @@ class SquadGenerator {
|
|
|
734
812
|
files.push(filePath);
|
|
735
813
|
}
|
|
736
814
|
|
|
737
|
-
// Generate config files
|
|
738
|
-
|
|
739
|
-
'config
|
|
740
|
-
'config
|
|
741
|
-
'config
|
|
742
|
-
|
|
815
|
+
// Generate config files (SQS-10: skip if using project configs)
|
|
816
|
+
if (useProjectConfigs) {
|
|
817
|
+
// Don't create local config files, just add .gitkeep to config directory
|
|
818
|
+
console.log('[squad-generator] Skipping local config file creation (using project-level configs)');
|
|
819
|
+
const gitkeepPath = path.join(squadPath, 'config', '.gitkeep');
|
|
820
|
+
await fs.writeFile(gitkeepPath, '# Config files are referenced from project docs/framework/\n', 'utf-8');
|
|
821
|
+
files.push(gitkeepPath);
|
|
822
|
+
} else {
|
|
823
|
+
// Fallback: Create local config files (AC10.3)
|
|
824
|
+
console.log('[squad-generator] Creating local configuration files');
|
|
825
|
+
const configFiles = {
|
|
826
|
+
'config/coding-standards.md': generateCodingStandards(fullConfig),
|
|
827
|
+
'config/tech-stack.md': generateTechStack(fullConfig),
|
|
828
|
+
'config/source-tree.md': generateSourceTree(fullConfig),
|
|
829
|
+
};
|
|
743
830
|
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
831
|
+
for (const [filename, content] of Object.entries(configFiles)) {
|
|
832
|
+
const filePath = path.join(squadPath, filename);
|
|
833
|
+
await fs.writeFile(filePath, content, 'utf-8');
|
|
834
|
+
files.push(filePath);
|
|
835
|
+
}
|
|
748
836
|
}
|
|
749
837
|
|
|
750
838
|
// Generate example agent if requested
|
|
@@ -192,10 +192,11 @@ class SquadMigrator {
|
|
|
192
192
|
});
|
|
193
193
|
}
|
|
194
194
|
|
|
195
|
-
// Check for flat structure (missing directories)
|
|
195
|
+
// Check for flat structure (missing required directories)
|
|
196
|
+
// Note: Only 'tasks' and 'agents' are required for task-first architecture
|
|
197
|
+
// 'config' directory is optional and not checked
|
|
196
198
|
const hasTasksDir = await this._pathExists(path.join(squadPath, 'tasks'));
|
|
197
199
|
const hasAgentsDir = await this._pathExists(path.join(squadPath, 'agents'));
|
|
198
|
-
const hasConfigDir = await this._pathExists(path.join(squadPath, 'config'));
|
|
199
200
|
|
|
200
201
|
const missingDirs = [];
|
|
201
202
|
if (!hasTasksDir) {
|
|
@@ -204,9 +205,6 @@ class SquadMigrator {
|
|
|
204
205
|
if (!hasAgentsDir) {
|
|
205
206
|
missingDirs.push('agents');
|
|
206
207
|
}
|
|
207
|
-
if (!hasConfigDir) {
|
|
208
|
-
missingDirs.push('config');
|
|
209
|
-
}
|
|
210
208
|
|
|
211
209
|
if (missingDirs.length > 0) {
|
|
212
210
|
analysis.needsMigration = true;
|
|
@@ -172,6 +172,10 @@ class SquadValidator {
|
|
|
172
172
|
const agentsResult = await this.validateAgents(squadPath);
|
|
173
173
|
this._mergeResults(result, agentsResult);
|
|
174
174
|
|
|
175
|
+
// 5. Validate config references (SQS-10)
|
|
176
|
+
const configResult = await this.validateConfigReferences(squadPath);
|
|
177
|
+
this._mergeResults(result, configResult);
|
|
178
|
+
|
|
175
179
|
// In strict mode, warnings become errors
|
|
176
180
|
if (this.strict && result.warnings.length > 0) {
|
|
177
181
|
result.errors.push(...result.warnings);
|
|
@@ -381,6 +385,74 @@ class SquadValidator {
|
|
|
381
385
|
return result;
|
|
382
386
|
}
|
|
383
387
|
|
|
388
|
+
/**
|
|
389
|
+
* Validate config references in squad.yaml
|
|
390
|
+
* Implements AC10.4: Validates that referenced config files actually exist
|
|
391
|
+
*
|
|
392
|
+
* @param {string} squadPath - Path to squad directory
|
|
393
|
+
* @returns {Promise<ValidationResult>} Validation result for config references
|
|
394
|
+
* @see Story SQS-10: Project Config Reference for Squads
|
|
395
|
+
*/
|
|
396
|
+
async validateConfigReferences(squadPath) {
|
|
397
|
+
this._log(`Validating config references in: ${squadPath}`);
|
|
398
|
+
|
|
399
|
+
const result = {
|
|
400
|
+
valid: true,
|
|
401
|
+
errors: [],
|
|
402
|
+
warnings: [],
|
|
403
|
+
suggestions: [],
|
|
404
|
+
};
|
|
405
|
+
|
|
406
|
+
// Find and parse manifest
|
|
407
|
+
const manifestPath = await this._findManifest(squadPath);
|
|
408
|
+
if (!manifestPath) {
|
|
409
|
+
return result; // Already handled in manifest validation
|
|
410
|
+
}
|
|
411
|
+
|
|
412
|
+
let manifest;
|
|
413
|
+
try {
|
|
414
|
+
const content = await fs.readFile(manifestPath, 'utf-8');
|
|
415
|
+
manifest = yaml.load(content);
|
|
416
|
+
} catch {
|
|
417
|
+
return result; // Already handled in manifest validation
|
|
418
|
+
}
|
|
419
|
+
|
|
420
|
+
// Check config section
|
|
421
|
+
if (!manifest || !manifest.config) {
|
|
422
|
+
return result; // No config section to validate
|
|
423
|
+
}
|
|
424
|
+
|
|
425
|
+
const configFields = ['coding-standards', 'tech-stack', 'source-tree'];
|
|
426
|
+
|
|
427
|
+
for (const field of configFields) {
|
|
428
|
+
const configPath = manifest.config[field];
|
|
429
|
+
if (!configPath) continue;
|
|
430
|
+
|
|
431
|
+
const resolvedPath = await this._resolveConfigPath(squadPath, configPath);
|
|
432
|
+
if (!resolvedPath) {
|
|
433
|
+
// Check if this is a project-level reference that doesn't exist
|
|
434
|
+
if (configPath.includes('..') || configPath.includes('docs/framework')) {
|
|
435
|
+
result.warnings.push({
|
|
436
|
+
code: ValidationErrorCodes.FILE_NOT_FOUND,
|
|
437
|
+
message: `Config reference not found: ${configPath}`,
|
|
438
|
+
suggestion: `Create the file at ${configPath} or update squad.yaml to use local config (config/${field}.md)`,
|
|
439
|
+
});
|
|
440
|
+
} else {
|
|
441
|
+
// Local config file missing - this is an error
|
|
442
|
+
result.errors.push({
|
|
443
|
+
code: ValidationErrorCodes.FILE_NOT_FOUND,
|
|
444
|
+
message: `Local config file not found: ${configPath}`,
|
|
445
|
+
suggestion: `Create ${path.join(squadPath, configPath)} or remove from config section`,
|
|
446
|
+
});
|
|
447
|
+
result.valid = false;
|
|
448
|
+
}
|
|
449
|
+
}
|
|
450
|
+
}
|
|
451
|
+
|
|
452
|
+
this._log(`Config validation: ${result.errors.length} errors, ${result.warnings.length} warnings`);
|
|
453
|
+
return result;
|
|
454
|
+
}
|
|
455
|
+
|
|
384
456
|
/**
|
|
385
457
|
* Validate agent definitions
|
|
386
458
|
*
|
|
@@ -540,6 +612,32 @@ class SquadValidator {
|
|
|
540
612
|
}
|
|
541
613
|
}
|
|
542
614
|
|
|
615
|
+
/**
|
|
616
|
+
* Resolve config path - check both local and project-level paths
|
|
617
|
+
* Implements AC10.4: Validator Path Resolution
|
|
618
|
+
*
|
|
619
|
+
* @param {string} squadPath - Squad directory
|
|
620
|
+
* @param {string} configPath - Path from squad.yaml config section
|
|
621
|
+
* @returns {Promise<string|null>} Resolved absolute path or null if not found
|
|
622
|
+
* @see Story SQS-10: Project Config Reference for Squads
|
|
623
|
+
* @private
|
|
624
|
+
*/
|
|
625
|
+
async _resolveConfigPath(squadPath, configPath) {
|
|
626
|
+
if (!configPath) return null;
|
|
627
|
+
|
|
628
|
+
// Resolve path relative to squad directory
|
|
629
|
+
// path.resolve handles both local paths (config/file.md) and relative paths (../../docs/framework/...)
|
|
630
|
+
// Simplified from redundant path.resolve + path.join (CodeRabbit nitpick)
|
|
631
|
+
const resolvedPath = path.resolve(squadPath, configPath);
|
|
632
|
+
if (await this._pathExists(resolvedPath)) {
|
|
633
|
+
this._log(`Resolved config path: ${configPath} -> ${resolvedPath}`);
|
|
634
|
+
return resolvedPath;
|
|
635
|
+
}
|
|
636
|
+
|
|
637
|
+
this._log(`Config path not found: ${configPath}`);
|
|
638
|
+
return null;
|
|
639
|
+
}
|
|
640
|
+
|
|
543
641
|
/**
|
|
544
642
|
* Validate a single task file
|
|
545
643
|
* @private
|
|
@@ -0,0 +1,294 @@
|
|
|
1
|
+
# Next Command Suggestions
|
|
2
|
+
|
|
3
|
+
## Purpose
|
|
4
|
+
|
|
5
|
+
Suggest next commands based on current workflow context using the Workflow Intelligence System (WIS). Helps users navigate workflows efficiently without memorizing command sequences.
|
|
6
|
+
|
|
7
|
+
## Task Definition (AIOS Task Format V1.0)
|
|
8
|
+
|
|
9
|
+
```yaml
|
|
10
|
+
task: next()
|
|
11
|
+
agent: "@dev"
|
|
12
|
+
responsável: Dex (Developer)
|
|
13
|
+
responsavel_type: Agente
|
|
14
|
+
atomic_layer: Workflow
|
|
15
|
+
|
|
16
|
+
elicit: false
|
|
17
|
+
|
|
18
|
+
inputs:
|
|
19
|
+
- name: story
|
|
20
|
+
type: path
|
|
21
|
+
required: false
|
|
22
|
+
description: Explicit story path for context
|
|
23
|
+
|
|
24
|
+
- name: all
|
|
25
|
+
type: flag
|
|
26
|
+
required: false
|
|
27
|
+
default: false
|
|
28
|
+
description: Show all suggestions instead of top 3
|
|
29
|
+
|
|
30
|
+
- name: help
|
|
31
|
+
type: flag
|
|
32
|
+
required: false
|
|
33
|
+
default: false
|
|
34
|
+
description: Show usage documentation
|
|
35
|
+
|
|
36
|
+
outputs:
|
|
37
|
+
- name: suggestions
|
|
38
|
+
type: array
|
|
39
|
+
destino: Console
|
|
40
|
+
persistido: false
|
|
41
|
+
|
|
42
|
+
- name: workflow_context
|
|
43
|
+
type: object
|
|
44
|
+
destino: Console
|
|
45
|
+
persistido: false
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
---
|
|
49
|
+
|
|
50
|
+
## Pre-Conditions
|
|
51
|
+
|
|
52
|
+
```yaml
|
|
53
|
+
pre-conditions:
|
|
54
|
+
- [ ] WIS modules are available
|
|
55
|
+
tipo: pre-condition
|
|
56
|
+
blocker: false
|
|
57
|
+
validação: Check workflow-intelligence module loads
|
|
58
|
+
error_message: "WIS not available. Suggestions may be limited."
|
|
59
|
+
|
|
60
|
+
- [ ] Session state exists (optional)
|
|
61
|
+
tipo: pre-condition
|
|
62
|
+
blocker: false
|
|
63
|
+
validação: Check .aios/session-state.json exists
|
|
64
|
+
error_message: "No session history. Using project context only."
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
---
|
|
68
|
+
|
|
69
|
+
## Implementation Steps
|
|
70
|
+
|
|
71
|
+
### Step 1: Check Help Flag
|
|
72
|
+
```javascript
|
|
73
|
+
if (args.help) {
|
|
74
|
+
displayHelp();
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
### Step 2: Build Context
|
|
80
|
+
```javascript
|
|
81
|
+
const SuggestionEngine = require('.aios-core/workflow-intelligence/engine/suggestion-engine');
|
|
82
|
+
const engine = new SuggestionEngine();
|
|
83
|
+
|
|
84
|
+
// Build context from multiple sources
|
|
85
|
+
const context = await engine.buildContext({
|
|
86
|
+
storyOverride: args.story, // Explicit story path (optional)
|
|
87
|
+
autoDetect: true // Auto-detect from session/git
|
|
88
|
+
});
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
### Step 3: Get Suggestions
|
|
92
|
+
```javascript
|
|
93
|
+
const result = await engine.suggestNext(context);
|
|
94
|
+
|
|
95
|
+
// result = {
|
|
96
|
+
// workflow: 'story_development',
|
|
97
|
+
// currentState: 'in_development',
|
|
98
|
+
// confidence: 0.92,
|
|
99
|
+
// suggestions: [
|
|
100
|
+
// { command: '*review-qa', args: '${story_path}', description: '...', confidence: 0.95, priority: 1 },
|
|
101
|
+
// ...
|
|
102
|
+
// ]
|
|
103
|
+
// }
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
### Step 4: Format Output
|
|
107
|
+
```javascript
|
|
108
|
+
const formatter = require('.aios-core/workflow-intelligence/engine/output-formatter');
|
|
109
|
+
|
|
110
|
+
// Limit to top 3 unless --all flag
|
|
111
|
+
const displaySuggestions = args.all ? result.suggestions : result.suggestions.slice(0, 3);
|
|
112
|
+
|
|
113
|
+
// Display formatted output
|
|
114
|
+
formatter.displaySuggestions(result.workflow, result.currentState, result.confidence, displaySuggestions);
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
---
|
|
118
|
+
|
|
119
|
+
## Help Text
|
|
120
|
+
|
|
121
|
+
```
|
|
122
|
+
Usage: *next [options]
|
|
123
|
+
|
|
124
|
+
Suggests next commands based on current workflow context.
|
|
125
|
+
|
|
126
|
+
Options:
|
|
127
|
+
--story <path> Explicit story path for context
|
|
128
|
+
--all Show all suggestions (not just top 3)
|
|
129
|
+
--help Show this help message
|
|
130
|
+
|
|
131
|
+
Examples:
|
|
132
|
+
*next # Auto-detect context
|
|
133
|
+
*next --story docs/stories/v2.1/sprint-10/story-wis-3.md
|
|
134
|
+
*next --all # Show all suggestions
|
|
135
|
+
|
|
136
|
+
How it works:
|
|
137
|
+
1. Analyzes your recent commands and current agent
|
|
138
|
+
2. Matches to known workflow patterns (story development, epic creation, etc.)
|
|
139
|
+
3. Determines your current state in the workflow
|
|
140
|
+
4. Suggests most likely next commands with confidence scores
|
|
141
|
+
|
|
142
|
+
Workflow detection uses:
|
|
143
|
+
- Recent command history (last 10 commands)
|
|
144
|
+
- Current active agent
|
|
145
|
+
- Git branch and status
|
|
146
|
+
- Active story (if any)
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
---
|
|
150
|
+
|
|
151
|
+
## Output Format
|
|
152
|
+
|
|
153
|
+
### Standard Output
|
|
154
|
+
```
|
|
155
|
+
🧭 Workflow: story_development
|
|
156
|
+
📍 State: in_development (confidence: 92%)
|
|
157
|
+
|
|
158
|
+
Next steps:
|
|
159
|
+
1. `*review-qa docs/stories/v2.1/sprint-10/story-wis-3.md` - Run QA review
|
|
160
|
+
2. `*run-tests` - Execute test suite manually
|
|
161
|
+
3. `*pre-push-quality-gate` - Final quality checks
|
|
162
|
+
|
|
163
|
+
Type a number to execute, or press Enter to continue manually.
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
### Low Confidence Output
|
|
167
|
+
```
|
|
168
|
+
🧭 Workflow: unknown
|
|
169
|
+
📍 State: uncertain (confidence: 35%)
|
|
170
|
+
|
|
171
|
+
Possible next steps (uncertain):
|
|
172
|
+
1. `*help` - Show available commands
|
|
173
|
+
2. `*status` - Check project status
|
|
174
|
+
|
|
175
|
+
⚠️ Low confidence - context is unclear. Try providing --story flag.
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
### No Workflow Match
|
|
179
|
+
```
|
|
180
|
+
🧭 Workflow: none detected
|
|
181
|
+
📍 State: N/A
|
|
182
|
+
|
|
183
|
+
Unable to determine workflow from current context.
|
|
184
|
+
|
|
185
|
+
Try:
|
|
186
|
+
*next --story <path-to-story>
|
|
187
|
+
*help
|
|
188
|
+
|
|
189
|
+
Recent commands: *develop, *run-tests
|
|
190
|
+
Current agent: @dev
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
---
|
|
194
|
+
|
|
195
|
+
## Post-Conditions
|
|
196
|
+
|
|
197
|
+
```yaml
|
|
198
|
+
post-conditions:
|
|
199
|
+
- [ ] Suggestions displayed within 100ms
|
|
200
|
+
tipo: post-condition
|
|
201
|
+
blocker: false
|
|
202
|
+
validação: Measure execution time
|
|
203
|
+
|
|
204
|
+
- [ ] Output is properly formatted
|
|
205
|
+
tipo: post-condition
|
|
206
|
+
blocker: true
|
|
207
|
+
validação: Verify console output matches expected format
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
---
|
|
211
|
+
|
|
212
|
+
## Error Handling
|
|
213
|
+
|
|
214
|
+
| Error | Cause | Resolution |
|
|
215
|
+
|-------|-------|------------|
|
|
216
|
+
| WIS module not found | Missing dependency | Fallback to generic suggestions |
|
|
217
|
+
| Session state corrupt | Invalid JSON | Clear session, show warning |
|
|
218
|
+
| Story path invalid | File doesn't exist | Warning, use auto-detect |
|
|
219
|
+
| No workflow match | Unknown command pattern | Show "unable to determine" message |
|
|
220
|
+
|
|
221
|
+
**Error Recovery Strategy:**
|
|
222
|
+
```javascript
|
|
223
|
+
try {
|
|
224
|
+
const result = await engine.suggestNext(context);
|
|
225
|
+
formatter.displaySuggestions(result);
|
|
226
|
+
} catch (error) {
|
|
227
|
+
console.warn(`⚠️ Suggestion engine error: ${error.message}`);
|
|
228
|
+
// Fallback: show generic suggestions
|
|
229
|
+
formatter.displayFallback();
|
|
230
|
+
}
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
---
|
|
234
|
+
|
|
235
|
+
## Performance
|
|
236
|
+
|
|
237
|
+
```yaml
|
|
238
|
+
duration_expected: <100ms (target)
|
|
239
|
+
cost_estimated: $0.00 (no API calls)
|
|
240
|
+
token_usage: 0 (local processing only)
|
|
241
|
+
|
|
242
|
+
optimizations:
|
|
243
|
+
- Workflow patterns cached (5-min TTL)
|
|
244
|
+
- Lazy loading of WIS modules
|
|
245
|
+
- Session state read once per call
|
|
246
|
+
```
|
|
247
|
+
|
|
248
|
+
---
|
|
249
|
+
|
|
250
|
+
## Success Output
|
|
251
|
+
|
|
252
|
+
```
|
|
253
|
+
============================================
|
|
254
|
+
SUGGESTION ENGINE RESULTS
|
|
255
|
+
============================================
|
|
256
|
+
|
|
257
|
+
Context:
|
|
258
|
+
Agent: @dev
|
|
259
|
+
Last Command: *develop
|
|
260
|
+
Story: docs/stories/v2.1/sprint-11/story-wis-3.md
|
|
261
|
+
Branch: feature/wis-3
|
|
262
|
+
|
|
263
|
+
Workflow: story_development
|
|
264
|
+
State: in_development
|
|
265
|
+
Confidence: 92%
|
|
266
|
+
|
|
267
|
+
Suggestions:
|
|
268
|
+
1. *review-qa (confidence: 95%)
|
|
269
|
+
2. *run-tests (confidence: 80%)
|
|
270
|
+
3. *pre-push-quality-gate (confidence: 75%)
|
|
271
|
+
|
|
272
|
+
============================================
|
|
273
|
+
```
|
|
274
|
+
|
|
275
|
+
---
|
|
276
|
+
|
|
277
|
+
## Metadata
|
|
278
|
+
|
|
279
|
+
```yaml
|
|
280
|
+
story: WIS-3
|
|
281
|
+
version: 1.0.0
|
|
282
|
+
created: 2025-12-25
|
|
283
|
+
author: "@dev (Dex)"
|
|
284
|
+
dependencies:
|
|
285
|
+
modules:
|
|
286
|
+
- workflow-intelligence (from WIS-2)
|
|
287
|
+
- core/session/context-loader
|
|
288
|
+
tasks: []
|
|
289
|
+
tags:
|
|
290
|
+
- workflow-intelligence
|
|
291
|
+
- suggestions
|
|
292
|
+
- navigation
|
|
293
|
+
- context-aware
|
|
294
|
+
```
|