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
|
@@ -0,0 +1,285 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module OutputFormatter
|
|
3
|
+
* @description CLI output formatting for *next task suggestions
|
|
4
|
+
* @story WIS-3 - *next Task Implementation
|
|
5
|
+
* @version 1.0.0
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
'use strict';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* ANSI color codes for terminal output
|
|
12
|
+
* Falls back gracefully if terminal doesn't support colors
|
|
13
|
+
*/
|
|
14
|
+
const colors = {
|
|
15
|
+
reset: '\x1b[0m',
|
|
16
|
+
bold: '\x1b[1m',
|
|
17
|
+
dim: '\x1b[2m',
|
|
18
|
+
green: '\x1b[32m',
|
|
19
|
+
yellow: '\x1b[33m',
|
|
20
|
+
blue: '\x1b[34m',
|
|
21
|
+
magenta: '\x1b[35m',
|
|
22
|
+
cyan: '\x1b[36m',
|
|
23
|
+
white: '\x1b[37m',
|
|
24
|
+
gray: '\x1b[90m'
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Check if terminal supports colors
|
|
29
|
+
* @returns {boolean} True if colors are supported
|
|
30
|
+
*/
|
|
31
|
+
function supportsColors() {
|
|
32
|
+
// Check for NO_COLOR environment variable (standard)
|
|
33
|
+
if (process.env.NO_COLOR !== undefined) {
|
|
34
|
+
return false;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
// Check for FORCE_COLOR
|
|
38
|
+
if (process.env.FORCE_COLOR !== undefined) {
|
|
39
|
+
return true;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
// Check if stdout is a TTY
|
|
43
|
+
if (process.stdout && typeof process.stdout.isTTY !== 'undefined') {
|
|
44
|
+
return process.stdout.isTTY;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
return false;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Apply color to text (if supported)
|
|
52
|
+
* @param {string} text - Text to color
|
|
53
|
+
* @param {string} color - Color name
|
|
54
|
+
* @returns {string} Colored text
|
|
55
|
+
*/
|
|
56
|
+
function colorize(text, color) {
|
|
57
|
+
if (!supportsColors() || !colors[color]) {
|
|
58
|
+
return text;
|
|
59
|
+
}
|
|
60
|
+
return `${colors[color]}${text}${colors.reset}`;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* Format confidence score for display
|
|
65
|
+
* @param {number} confidence - Confidence value 0-1
|
|
66
|
+
* @returns {string} Formatted confidence string
|
|
67
|
+
*/
|
|
68
|
+
function formatConfidence(confidence) {
|
|
69
|
+
const percent = Math.round(confidence * 100);
|
|
70
|
+
let color = 'green';
|
|
71
|
+
|
|
72
|
+
if (percent < 50) {
|
|
73
|
+
color = 'yellow';
|
|
74
|
+
} else if (percent < 30) {
|
|
75
|
+
color = 'gray';
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
return colorize(`${percent}%`, color);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* Format workflow name for display
|
|
83
|
+
* @param {string} workflow - Workflow name
|
|
84
|
+
* @returns {string} Formatted workflow name
|
|
85
|
+
*/
|
|
86
|
+
function formatWorkflowName(workflow) {
|
|
87
|
+
if (!workflow) {
|
|
88
|
+
return colorize('none detected', 'gray');
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
// Convert snake_case to Title Case
|
|
92
|
+
return workflow
|
|
93
|
+
.split('_')
|
|
94
|
+
.map(word => word.charAt(0).toUpperCase() + word.slice(1))
|
|
95
|
+
.join(' ');
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* Display suggestions in formatted CLI output
|
|
100
|
+
* @param {Object} result - Suggestion result from SuggestionEngine
|
|
101
|
+
*/
|
|
102
|
+
function displaySuggestions(result) {
|
|
103
|
+
const output = [];
|
|
104
|
+
|
|
105
|
+
// Header with workflow info
|
|
106
|
+
output.push('');
|
|
107
|
+
output.push(colorize(' Workflow: ', 'cyan') + formatWorkflowName(result.workflow));
|
|
108
|
+
|
|
109
|
+
if (result.currentState) {
|
|
110
|
+
const stateDisplay = result.currentState.replace(/_/g, ' ');
|
|
111
|
+
output.push(colorize(' State: ', 'cyan') + stateDisplay + ` (confidence: ${formatConfidence(result.confidence)})`);
|
|
112
|
+
} else {
|
|
113
|
+
output.push(colorize(' State: ', 'cyan') + colorize('N/A', 'gray'));
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
output.push('');
|
|
117
|
+
|
|
118
|
+
// Suggestions
|
|
119
|
+
if (result.suggestions && result.suggestions.length > 0) {
|
|
120
|
+
const header = result.isUncertain
|
|
121
|
+
? colorize('Possible next steps (uncertain):', 'yellow')
|
|
122
|
+
: colorize('Next steps:', 'bold');
|
|
123
|
+
output.push(header);
|
|
124
|
+
output.push('');
|
|
125
|
+
|
|
126
|
+
result.suggestions.forEach((suggestion, index) => {
|
|
127
|
+
const num = colorize(` ${index + 1}.`, 'cyan');
|
|
128
|
+
const cmd = colorize(suggestion.command, 'green');
|
|
129
|
+
const args = suggestion.args ? ` ${colorize(suggestion.args, 'gray')}` : '';
|
|
130
|
+
const desc = suggestion.description ? colorize(` - ${suggestion.description}`, 'dim') : '';
|
|
131
|
+
|
|
132
|
+
output.push(`${num} \`${cmd}${args}\`${desc}`);
|
|
133
|
+
});
|
|
134
|
+
|
|
135
|
+
output.push('');
|
|
136
|
+
|
|
137
|
+
// Confidence note for uncertain suggestions
|
|
138
|
+
if (result.isUncertain) {
|
|
139
|
+
output.push(colorize(' Low confidence - context is unclear. Try providing --story flag.', 'yellow'));
|
|
140
|
+
output.push('');
|
|
141
|
+
}
|
|
142
|
+
} else {
|
|
143
|
+
output.push(colorize('Unable to determine workflow from current context.', 'yellow'));
|
|
144
|
+
output.push('');
|
|
145
|
+
output.push('Try:');
|
|
146
|
+
output.push(` ${colorize('*next --story <path-to-story>', 'cyan')}`);
|
|
147
|
+
output.push(` ${colorize('*help', 'cyan')}`);
|
|
148
|
+
output.push('');
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
console.log(output.join('\n'));
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
/**
|
|
155
|
+
* Display fallback suggestions when WIS is unavailable
|
|
156
|
+
* @param {Object} result - Fallback result
|
|
157
|
+
*/
|
|
158
|
+
function displayFallback(result) {
|
|
159
|
+
const output = [];
|
|
160
|
+
|
|
161
|
+
output.push('');
|
|
162
|
+
output.push(colorize(' Workflow Intelligence unavailable', 'yellow'));
|
|
163
|
+
output.push('');
|
|
164
|
+
|
|
165
|
+
if (result && result.suggestions && result.suggestions.length > 0) {
|
|
166
|
+
output.push(colorize('Generic suggestions:', 'bold'));
|
|
167
|
+
output.push('');
|
|
168
|
+
|
|
169
|
+
result.suggestions.forEach((suggestion, index) => {
|
|
170
|
+
const num = colorize(` ${index + 1}.`, 'cyan');
|
|
171
|
+
const cmd = colorize(suggestion.command, 'green');
|
|
172
|
+
const desc = suggestion.description ? colorize(` - ${suggestion.description}`, 'dim') : '';
|
|
173
|
+
|
|
174
|
+
output.push(`${num} \`${cmd}\`${desc}`);
|
|
175
|
+
});
|
|
176
|
+
|
|
177
|
+
output.push('');
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
if (result && result.message) {
|
|
181
|
+
output.push(colorize(` ${result.message}`, 'gray'));
|
|
182
|
+
output.push('');
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
console.log(output.join('\n'));
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
/**
|
|
189
|
+
* Display help text for *next command
|
|
190
|
+
*/
|
|
191
|
+
function displayHelp() {
|
|
192
|
+
const output = [];
|
|
193
|
+
|
|
194
|
+
output.push('');
|
|
195
|
+
output.push(colorize('Usage:', 'bold') + ' *next [options]');
|
|
196
|
+
output.push('');
|
|
197
|
+
output.push('Suggests next commands based on current workflow context.');
|
|
198
|
+
output.push('');
|
|
199
|
+
output.push(colorize('Options:', 'bold'));
|
|
200
|
+
output.push(` ${colorize('--story <path>', 'cyan')} Explicit story path for context`);
|
|
201
|
+
output.push(` ${colorize('--all', 'cyan')} Show all suggestions (not just top 3)`);
|
|
202
|
+
output.push(` ${colorize('--help', 'cyan')} Show this help message`);
|
|
203
|
+
output.push('');
|
|
204
|
+
output.push(colorize('Examples:', 'bold'));
|
|
205
|
+
output.push(` ${colorize('*next', 'green')} ${colorize('# Auto-detect context', 'dim')}`);
|
|
206
|
+
output.push(` ${colorize('*next --story docs/stories/v2.1/sprint-10/story-wis-3.md', 'green')}`);
|
|
207
|
+
output.push(` ${colorize('*next --all', 'green')} ${colorize('# Show all suggestions', 'dim')}`);
|
|
208
|
+
output.push('');
|
|
209
|
+
output.push(colorize('How it works:', 'bold'));
|
|
210
|
+
output.push(' 1. Analyzes your recent commands and current agent');
|
|
211
|
+
output.push(' 2. Matches to known workflow patterns (story development, epic creation, etc.)');
|
|
212
|
+
output.push(' 3. Determines your current state in the workflow');
|
|
213
|
+
output.push(' 4. Suggests most likely next commands with confidence scores');
|
|
214
|
+
output.push('');
|
|
215
|
+
output.push(colorize('Workflow detection uses:', 'bold'));
|
|
216
|
+
output.push(' - Recent command history (last 10 commands)');
|
|
217
|
+
output.push(' - Current active agent');
|
|
218
|
+
output.push(' - Git branch and status');
|
|
219
|
+
output.push(' - Active story (if any)');
|
|
220
|
+
output.push('');
|
|
221
|
+
|
|
222
|
+
console.log(output.join('\n'));
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
/**
|
|
226
|
+
* Display context information (debug mode)
|
|
227
|
+
* @param {Object} context - Built context object
|
|
228
|
+
*/
|
|
229
|
+
function displayContext(context) {
|
|
230
|
+
const output = [];
|
|
231
|
+
|
|
232
|
+
output.push('');
|
|
233
|
+
output.push(colorize('Context Information:', 'bold'));
|
|
234
|
+
output.push(` ${colorize('Agent:', 'cyan')} @${context.agentId || 'unknown'}`);
|
|
235
|
+
output.push(` ${colorize('Last Command:', 'cyan')} ${context.lastCommand || 'none'}`);
|
|
236
|
+
|
|
237
|
+
if (context.lastCommands && context.lastCommands.length > 0) {
|
|
238
|
+
output.push(` ${colorize('Recent Commands:', 'cyan')} ${context.lastCommands.slice(-5).join(', ')}`);
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
output.push(` ${colorize('Story:', 'cyan')} ${context.storyPath || 'none'}`);
|
|
242
|
+
output.push(` ${colorize('Branch:', 'cyan')} ${context.branch || 'none'}`);
|
|
243
|
+
|
|
244
|
+
if (context.projectState) {
|
|
245
|
+
output.push(` ${colorize('Workflow Phase:', 'cyan')} ${context.projectState.workflowPhase || 'unknown'}`);
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
output.push('');
|
|
249
|
+
|
|
250
|
+
console.log(output.join('\n'));
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
/**
|
|
254
|
+
* Display error message
|
|
255
|
+
* @param {string} message - Error message
|
|
256
|
+
*/
|
|
257
|
+
function displayError(message) {
|
|
258
|
+
console.log('');
|
|
259
|
+
console.log(colorize(` Error: ${message}`, 'yellow'));
|
|
260
|
+
console.log('');
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
/**
|
|
264
|
+
* Display success message after executing a suggestion
|
|
265
|
+
* @param {string} command - Command that was executed
|
|
266
|
+
*/
|
|
267
|
+
function displayExecuting(command) {
|
|
268
|
+
console.log('');
|
|
269
|
+
console.log(colorize(` Executing: ${command}`, 'green'));
|
|
270
|
+
console.log('');
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
module.exports = {
|
|
274
|
+
displaySuggestions,
|
|
275
|
+
displayFallback,
|
|
276
|
+
displayHelp,
|
|
277
|
+
displayContext,
|
|
278
|
+
displayError,
|
|
279
|
+
displayExecuting,
|
|
280
|
+
formatConfidence,
|
|
281
|
+
formatWorkflowName,
|
|
282
|
+
colorize,
|
|
283
|
+
supportsColors,
|
|
284
|
+
colors
|
|
285
|
+
};
|