aios-core 3.6.0 → 3.8.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.
- 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 +13 -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/create-service.md +391 -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/service-template/README.md.hbs +158 -0
- package/.aios-core/development/templates/service-template/__tests__/index.test.ts.hbs +237 -0
- package/.aios-core/development/templates/service-template/client.ts.hbs +403 -0
- package/.aios-core/development/templates/service-template/errors.ts.hbs +182 -0
- package/.aios-core/development/templates/service-template/index.ts.hbs +120 -0
- package/.aios-core/development/templates/service-template/jest.config.js +89 -0
- package/.aios-core/development/templates/service-template/package.json.hbs +87 -0
- package/.aios-core/development/templates/service-template/tsconfig.json +45 -0
- package/.aios-core/development/templates/service-template/types.ts.hbs +145 -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/ide-sync/agent-parser.js +45 -1
- package/.aios-core/infrastructure/scripts/ide-sync/transformers/antigravity.js +6 -6
- package/.aios-core/infrastructure/scripts/ide-sync/transformers/cursor.js +5 -4
- package/.aios-core/infrastructure/scripts/ide-sync/transformers/trae.js +3 -3
- package/.aios-core/infrastructure/scripts/ide-sync/transformers/windsurf.js +3 -3
- package/.aios-core/install-manifest.yaml +139 -35
- package/.aios-core/quality/metrics-collector.js +27 -0
- package/.aios-core/scripts/session-context-loader.js +13 -254
- 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
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* {{COMPONENTNAME}} Script
|
|
5
|
+
*
|
|
6
|
+
* {{DESCRIPTION}}
|
|
7
|
+
*
|
|
8
|
+
* Squad: {{SQUADNAME}}
|
|
9
|
+
* Created: {{CREATEDAT}}
|
|
10
|
+
*
|
|
11
|
+
* Usage:
|
|
12
|
+
* node {{COMPONENTNAME}}.js [options]
|
|
13
|
+
*
|
|
14
|
+
* Options:
|
|
15
|
+
* --help, -h Show this help message
|
|
16
|
+
* --verbose, -v Enable verbose output
|
|
17
|
+
* --dry-run Preview changes without applying
|
|
18
|
+
*
|
|
19
|
+
* @module {{COMPONENTNAME}}
|
|
20
|
+
* @version 1.0.0
|
|
21
|
+
* @see {{STORYID}}
|
|
22
|
+
*/
|
|
23
|
+
|
|
24
|
+
'use strict';
|
|
25
|
+
|
|
26
|
+
const fs = require('fs').promises;
|
|
27
|
+
const path = require('path');
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Script configuration
|
|
31
|
+
*/
|
|
32
|
+
const CONFIG = {
|
|
33
|
+
name: '{{COMPONENTNAME}}',
|
|
34
|
+
version: '1.0.0',
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Parse command line arguments
|
|
39
|
+
*
|
|
40
|
+
* @param {string[]} args - Command line arguments
|
|
41
|
+
* @returns {Object} Parsed options
|
|
42
|
+
*/
|
|
43
|
+
function parseArgs(args) {
|
|
44
|
+
const options = {
|
|
45
|
+
help: false,
|
|
46
|
+
verbose: false,
|
|
47
|
+
dryRun: false,
|
|
48
|
+
args: [],
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
for (let i = 0; i < args.length; i++) {
|
|
52
|
+
const arg = args[i];
|
|
53
|
+
|
|
54
|
+
if (arg === '--help' || arg === '-h') {
|
|
55
|
+
options.help = true;
|
|
56
|
+
} else if (arg === '--verbose' || arg === '-v') {
|
|
57
|
+
options.verbose = true;
|
|
58
|
+
} else if (arg === '--dry-run') {
|
|
59
|
+
options.dryRun = true;
|
|
60
|
+
} else if (!arg.startsWith('-')) {
|
|
61
|
+
options.args.push(arg);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
return options;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Show help message
|
|
70
|
+
*/
|
|
71
|
+
function showHelp() {
|
|
72
|
+
console.log(`
|
|
73
|
+
${CONFIG.name} v${CONFIG.version}
|
|
74
|
+
|
|
75
|
+
{{DESCRIPTION}}
|
|
76
|
+
|
|
77
|
+
Usage:
|
|
78
|
+
node ${CONFIG.name}.js [options] [arguments]
|
|
79
|
+
|
|
80
|
+
Options:
|
|
81
|
+
--help, -h Show this help message
|
|
82
|
+
--verbose, -v Enable verbose output
|
|
83
|
+
--dry-run Preview changes without applying
|
|
84
|
+
|
|
85
|
+
Examples:
|
|
86
|
+
node ${CONFIG.name}.js
|
|
87
|
+
node ${CONFIG.name}.js --verbose
|
|
88
|
+
node ${CONFIG.name}.js --dry-run
|
|
89
|
+
`);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* Log message if verbose mode is enabled
|
|
94
|
+
*
|
|
95
|
+
* @param {string} message - Message to log
|
|
96
|
+
* @param {boolean} verbose - Verbose mode flag
|
|
97
|
+
*/
|
|
98
|
+
function log(message, verbose) {
|
|
99
|
+
if (verbose) {
|
|
100
|
+
console.log(`[${CONFIG.name}] ${message}`);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* Main script execution
|
|
106
|
+
*
|
|
107
|
+
* @param {Object} options - Script options
|
|
108
|
+
* @returns {Promise<Object>} Execution result
|
|
109
|
+
*/
|
|
110
|
+
async function execute(options) {
|
|
111
|
+
log('Starting execution...', options.verbose);
|
|
112
|
+
|
|
113
|
+
// Implementation here
|
|
114
|
+
const result = {
|
|
115
|
+
success: true,
|
|
116
|
+
message: 'Script completed successfully',
|
|
117
|
+
data: {},
|
|
118
|
+
};
|
|
119
|
+
|
|
120
|
+
// Step 1: Initialize
|
|
121
|
+
log('Step 1: Initializing...', options.verbose);
|
|
122
|
+
|
|
123
|
+
// Step 2: Process
|
|
124
|
+
log('Step 2: Processing...', options.verbose);
|
|
125
|
+
|
|
126
|
+
if (options.dryRun) {
|
|
127
|
+
log('Dry run mode - no changes applied', options.verbose);
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
// Step 3: Complete
|
|
131
|
+
log('Step 3: Completing...', options.verbose);
|
|
132
|
+
|
|
133
|
+
return result;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* Main entry point
|
|
138
|
+
*
|
|
139
|
+
* @param {string[]} args - Command line arguments
|
|
140
|
+
*/
|
|
141
|
+
async function main(args) {
|
|
142
|
+
const options = parseArgs(args);
|
|
143
|
+
|
|
144
|
+
if (options.help) {
|
|
145
|
+
showHelp();
|
|
146
|
+
return;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
console.log(`${CONFIG.name} v${CONFIG.version}`);
|
|
150
|
+
console.log('');
|
|
151
|
+
|
|
152
|
+
try {
|
|
153
|
+
const result = await execute(options);
|
|
154
|
+
|
|
155
|
+
if (result.success) {
|
|
156
|
+
console.log('Success:', result.message);
|
|
157
|
+
} else {
|
|
158
|
+
console.error('Failed:', result.message);
|
|
159
|
+
process.exit(1);
|
|
160
|
+
}
|
|
161
|
+
} catch (error) {
|
|
162
|
+
console.error('Error:', error.message);
|
|
163
|
+
if (options.verbose) {
|
|
164
|
+
console.error(error.stack);
|
|
165
|
+
}
|
|
166
|
+
process.exit(1);
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
// Run if called directly
|
|
171
|
+
if (require.main === module) {
|
|
172
|
+
main(process.argv.slice(2));
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
module.exports = {
|
|
176
|
+
main,
|
|
177
|
+
execute,
|
|
178
|
+
parseArgs,
|
|
179
|
+
};
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
---
|
|
2
|
+
task: {{COMPONENTNAME}}
|
|
3
|
+
responsavel: "@{{AGENTID}}"
|
|
4
|
+
responsavel_type: Agent
|
|
5
|
+
atomic_layer: Task
|
|
6
|
+
elicit: false
|
|
7
|
+
|
|
8
|
+
Entrada:
|
|
9
|
+
- campo: input_param
|
|
10
|
+
tipo: string
|
|
11
|
+
origem: User Input
|
|
12
|
+
obrigatorio: true
|
|
13
|
+
validacao: "Describe validation rules"
|
|
14
|
+
|
|
15
|
+
Saida:
|
|
16
|
+
- campo: result
|
|
17
|
+
tipo: object
|
|
18
|
+
destino: Return value
|
|
19
|
+
persistido: false
|
|
20
|
+
|
|
21
|
+
Checklist:
|
|
22
|
+
- "[ ] Step 1: Describe first step"
|
|
23
|
+
- "[ ] Step 2: Describe second step"
|
|
24
|
+
- "[ ] Step 3: Describe third step"
|
|
25
|
+
---
|
|
26
|
+
|
|
27
|
+
# {{COMPONENTNAME}}
|
|
28
|
+
|
|
29
|
+
## Purpose
|
|
30
|
+
|
|
31
|
+
{{DESCRIPTION}}
|
|
32
|
+
|
|
33
|
+
{{#IF STORYID}}
|
|
34
|
+
## Story Reference
|
|
35
|
+
|
|
36
|
+
- **Story:** {{STORYID}}
|
|
37
|
+
- **Squad:** {{SQUADNAME}}
|
|
38
|
+
{{/IF}}
|
|
39
|
+
|
|
40
|
+
## Pre-Conditions
|
|
41
|
+
|
|
42
|
+
```yaml
|
|
43
|
+
pre-conditions:
|
|
44
|
+
- [ ] Pre-condition 1
|
|
45
|
+
tipo: pre-condition
|
|
46
|
+
blocker: true
|
|
47
|
+
validacao: |
|
|
48
|
+
Describe what to validate
|
|
49
|
+
error_message: "Error message if pre-condition fails"
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
## Execution Steps
|
|
53
|
+
|
|
54
|
+
### Step 1: Initialize
|
|
55
|
+
|
|
56
|
+
```javascript
|
|
57
|
+
// Implementation here
|
|
58
|
+
const { Dependency } = require('./path/to/dependency');
|
|
59
|
+
|
|
60
|
+
async function step1() {
|
|
61
|
+
// Step 1 logic
|
|
62
|
+
}
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
### Step 2: Process
|
|
66
|
+
|
|
67
|
+
```javascript
|
|
68
|
+
async function step2() {
|
|
69
|
+
// Step 2 logic
|
|
70
|
+
}
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
### Step 3: Complete
|
|
74
|
+
|
|
75
|
+
```javascript
|
|
76
|
+
async function step3() {
|
|
77
|
+
// Step 3 logic
|
|
78
|
+
return {
|
|
79
|
+
success: true,
|
|
80
|
+
data: {},
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
## Error Handling
|
|
86
|
+
|
|
87
|
+
### Error 1: Description
|
|
88
|
+
|
|
89
|
+
```yaml
|
|
90
|
+
error: ERROR_CODE
|
|
91
|
+
cause: Description of cause
|
|
92
|
+
resolution: How to resolve
|
|
93
|
+
recovery: Suggested recovery action
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
## Post-Conditions
|
|
97
|
+
|
|
98
|
+
```yaml
|
|
99
|
+
post-conditions:
|
|
100
|
+
- [ ] Result is valid
|
|
101
|
+
tipo: post-condition
|
|
102
|
+
blocker: true
|
|
103
|
+
validacao: |
|
|
104
|
+
Describe validation
|
|
105
|
+
error_message: "Error message if post-condition fails"
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
## Metadata
|
|
109
|
+
|
|
110
|
+
```yaml
|
|
111
|
+
{{#IF STORYID}}
|
|
112
|
+
story: {{STORYID}}
|
|
113
|
+
{{/IF}}
|
|
114
|
+
version: 1.0.0
|
|
115
|
+
created: {{CREATEDAT}}
|
|
116
|
+
updated: {{CREATEDAT}}
|
|
117
|
+
author: squad-creator
|
|
118
|
+
tags:
|
|
119
|
+
- {{SQUADNAME}}
|
|
120
|
+
- {{COMPONENTNAME}}
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
---
|
|
124
|
+
|
|
125
|
+
*Task definition created by squad-creator*
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
# {{COMPONENTNAME}} Template
|
|
2
|
+
|
|
3
|
+
> {{DESCRIPTION}}
|
|
4
|
+
> Squad: {{SQUADNAME}}
|
|
5
|
+
> Created: {{CREATEDAT}}
|
|
6
|
+
{{#IF STORYID}}
|
|
7
|
+
> Story: {{STORYID}}
|
|
8
|
+
{{/IF}}
|
|
9
|
+
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
## Template Variables
|
|
13
|
+
|
|
14
|
+
| Variable | Type | Required | Description |
|
|
15
|
+
|----------|------|----------|-------------|
|
|
16
|
+
| `{{VAR1}}` | string | Yes | Description of variable 1 |
|
|
17
|
+
| `{{VAR2}}` | string | No | Description of variable 2 |
|
|
18
|
+
| `{{VAR3}}` | date | No | Description of variable 3 |
|
|
19
|
+
|
|
20
|
+
---
|
|
21
|
+
|
|
22
|
+
## Usage
|
|
23
|
+
|
|
24
|
+
```javascript
|
|
25
|
+
const { renderTemplate } = require('.aios-core/infrastructure/scripts/template-engine');
|
|
26
|
+
|
|
27
|
+
const result = await renderTemplate('{{COMPONENTNAME}}.md', {
|
|
28
|
+
VAR1: 'value1',
|
|
29
|
+
VAR2: 'value2',
|
|
30
|
+
VAR3: new Date().toISOString(),
|
|
31
|
+
});
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
---
|
|
35
|
+
|
|
36
|
+
## Template Content
|
|
37
|
+
|
|
38
|
+
<!-- BEGIN TEMPLATE -->
|
|
39
|
+
|
|
40
|
+
# {{VAR1}}
|
|
41
|
+
|
|
42
|
+
> Created: {{VAR3}}
|
|
43
|
+
|
|
44
|
+
## Section 1
|
|
45
|
+
|
|
46
|
+
{{VAR2}}
|
|
47
|
+
|
|
48
|
+
### Subsection 1.1
|
|
49
|
+
|
|
50
|
+
Content here...
|
|
51
|
+
|
|
52
|
+
### Subsection 1.2
|
|
53
|
+
|
|
54
|
+
Content here...
|
|
55
|
+
|
|
56
|
+
## Section 2
|
|
57
|
+
|
|
58
|
+
Additional content...
|
|
59
|
+
|
|
60
|
+
## Section 3
|
|
61
|
+
|
|
62
|
+
Final content...
|
|
63
|
+
|
|
64
|
+
---
|
|
65
|
+
|
|
66
|
+
*Generated from {{COMPONENTNAME}} template*
|
|
67
|
+
|
|
68
|
+
<!-- END TEMPLATE -->
|
|
69
|
+
|
|
70
|
+
---
|
|
71
|
+
|
|
72
|
+
## Examples
|
|
73
|
+
|
|
74
|
+
### Example 1: Basic Usage
|
|
75
|
+
|
|
76
|
+
```javascript
|
|
77
|
+
const result = await renderTemplate('{{COMPONENTNAME}}.md', {
|
|
78
|
+
VAR1: 'My Document',
|
|
79
|
+
VAR2: 'This is the introduction text.',
|
|
80
|
+
VAR3: '2025-01-01',
|
|
81
|
+
});
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
### Example 2: With Conditionals
|
|
85
|
+
|
|
86
|
+
```javascript
|
|
87
|
+
const result = await renderTemplate('{{COMPONENTNAME}}.md', {
|
|
88
|
+
VAR1: 'My Document',
|
|
89
|
+
VAR2: 'Introduction',
|
|
90
|
+
VAR3: new Date().toISOString(),
|
|
91
|
+
INCLUDE_EXTRA: true,
|
|
92
|
+
});
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
---
|
|
96
|
+
|
|
97
|
+
*Template created by squad-creator*
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* {{COMPONENTNAME}} Tool
|
|
3
|
+
*
|
|
4
|
+
* {{DESCRIPTION}}
|
|
5
|
+
*
|
|
6
|
+
* Squad: {{SQUADNAME}}
|
|
7
|
+
* Created: {{CREATEDAT}}
|
|
8
|
+
*
|
|
9
|
+
* @module {{COMPONENTNAME}}
|
|
10
|
+
* @version 1.0.0
|
|
11
|
+
* @see {{STORYID}}
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
'use strict';
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Configuration for the tool
|
|
18
|
+
* @constant {Object}
|
|
19
|
+
*/
|
|
20
|
+
const CONFIG = {
|
|
21
|
+
name: '{{COMPONENTNAME}}',
|
|
22
|
+
version: '1.0.0',
|
|
23
|
+
description: '{{DESCRIPTION}}',
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Main function for {{COMPONENTNAME}}
|
|
28
|
+
*
|
|
29
|
+
* @param {Object} input - Input parameters
|
|
30
|
+
* @param {string} input.param1 - First parameter
|
|
31
|
+
* @param {Object} [options={}] - Optional configuration
|
|
32
|
+
* @returns {Object} Result object with success status and data
|
|
33
|
+
*
|
|
34
|
+
* @example
|
|
35
|
+
* const result = await {{CAMELCASE_NAME}}({
|
|
36
|
+
* param1: 'value1',
|
|
37
|
+
* });
|
|
38
|
+
* console.log(result.data);
|
|
39
|
+
*/
|
|
40
|
+
async function {{CAMELCASE_NAME}}(input, options = {}) {
|
|
41
|
+
// Validate input
|
|
42
|
+
if (!input || typeof input !== 'object') {
|
|
43
|
+
return {
|
|
44
|
+
success: false,
|
|
45
|
+
error: 'Invalid input: expected object',
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
try {
|
|
50
|
+
// Implementation here
|
|
51
|
+
const result = {
|
|
52
|
+
// Process input and generate output
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
return {
|
|
56
|
+
success: true,
|
|
57
|
+
data: result,
|
|
58
|
+
};
|
|
59
|
+
} catch (error) {
|
|
60
|
+
return {
|
|
61
|
+
success: false,
|
|
62
|
+
error: error.message,
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* Helper function 1
|
|
69
|
+
*
|
|
70
|
+
* @private
|
|
71
|
+
* @param {*} value - Value to process
|
|
72
|
+
* @returns {*} Processed value
|
|
73
|
+
*/
|
|
74
|
+
function _helperFunction1(value) {
|
|
75
|
+
// Helper implementation
|
|
76
|
+
return value;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* Helper function 2
|
|
81
|
+
*
|
|
82
|
+
* @private
|
|
83
|
+
* @param {Object} data - Data to transform
|
|
84
|
+
* @returns {Object} Transformed data
|
|
85
|
+
*/
|
|
86
|
+
function _helperFunction2(data) {
|
|
87
|
+
// Helper implementation
|
|
88
|
+
return data;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* Get tool information
|
|
93
|
+
*
|
|
94
|
+
* @returns {Object} Tool configuration
|
|
95
|
+
*/
|
|
96
|
+
function getInfo() {
|
|
97
|
+
return CONFIG;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
module.exports = {
|
|
101
|
+
{{CAMELCASE_NAME}},
|
|
102
|
+
getInfo,
|
|
103
|
+
};
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
# {{COMPONENTNAME}} Workflow
|
|
2
|
+
#
|
|
3
|
+
# {{DESCRIPTION}}
|
|
4
|
+
#
|
|
5
|
+
# Created: {{CREATEDAT}}
|
|
6
|
+
# Story: {{STORYID}}
|
|
7
|
+
|
|
8
|
+
name: {{COMPONENTNAME}}
|
|
9
|
+
version: 1.0.0
|
|
10
|
+
description: {{DESCRIPTION}}
|
|
11
|
+
squad: {{SQUADNAME}}
|
|
12
|
+
|
|
13
|
+
# Metadata
|
|
14
|
+
metadata:
|
|
15
|
+
created: {{CREATEDAT}}
|
|
16
|
+
author: squad-creator
|
|
17
|
+
tags:
|
|
18
|
+
- workflow
|
|
19
|
+
- {{SQUADNAME}}
|
|
20
|
+
|
|
21
|
+
# Trigger conditions
|
|
22
|
+
triggers:
|
|
23
|
+
- type: manual
|
|
24
|
+
command: "*{{COMPONENTNAME}}"
|
|
25
|
+
# - type: event
|
|
26
|
+
# event: some-event-name
|
|
27
|
+
# - type: schedule
|
|
28
|
+
# cron: "0 0 * * *"
|
|
29
|
+
|
|
30
|
+
# Input parameters
|
|
31
|
+
inputs:
|
|
32
|
+
- name: param1
|
|
33
|
+
type: string
|
|
34
|
+
required: true
|
|
35
|
+
description: "Description of parameter 1"
|
|
36
|
+
- name: param2
|
|
37
|
+
type: string
|
|
38
|
+
required: false
|
|
39
|
+
default: "default-value"
|
|
40
|
+
description: "Description of parameter 2"
|
|
41
|
+
|
|
42
|
+
# Workflow steps
|
|
43
|
+
steps:
|
|
44
|
+
- id: step-1
|
|
45
|
+
name: "Step 1: Initialize"
|
|
46
|
+
description: "Initialize the workflow"
|
|
47
|
+
action: task
|
|
48
|
+
task: task-name-1
|
|
49
|
+
inputs:
|
|
50
|
+
param: "{{inputs.param1}}"
|
|
51
|
+
on_error: abort
|
|
52
|
+
|
|
53
|
+
- id: step-2
|
|
54
|
+
name: "Step 2: Process"
|
|
55
|
+
description: "Main processing step"
|
|
56
|
+
action: task
|
|
57
|
+
task: task-name-2
|
|
58
|
+
depends_on:
|
|
59
|
+
- step-1
|
|
60
|
+
inputs:
|
|
61
|
+
data: "{{steps.step-1.output}}"
|
|
62
|
+
on_error: retry
|
|
63
|
+
retry:
|
|
64
|
+
max_attempts: 3
|
|
65
|
+
delay: 1000
|
|
66
|
+
|
|
67
|
+
- id: step-3
|
|
68
|
+
name: "Step 3: Finalize"
|
|
69
|
+
description: "Finalize the workflow"
|
|
70
|
+
action: task
|
|
71
|
+
task: task-name-3
|
|
72
|
+
depends_on:
|
|
73
|
+
- step-2
|
|
74
|
+
condition: "{{steps.step-2.success}}"
|
|
75
|
+
|
|
76
|
+
# Conditional branches (optional)
|
|
77
|
+
# branches:
|
|
78
|
+
# - condition: "{{steps.step-2.output.type == 'a'}}"
|
|
79
|
+
# steps:
|
|
80
|
+
# - id: branch-a-step
|
|
81
|
+
# name: "Branch A Step"
|
|
82
|
+
# action: task
|
|
83
|
+
# task: branch-a-task
|
|
84
|
+
|
|
85
|
+
# Output definition
|
|
86
|
+
outputs:
|
|
87
|
+
- name: result
|
|
88
|
+
from: "{{steps.step-3.output}}"
|
|
89
|
+
description: "Final workflow result"
|
|
90
|
+
|
|
91
|
+
# Completion handlers
|
|
92
|
+
completion:
|
|
93
|
+
on_success:
|
|
94
|
+
message: "Workflow '{{COMPONENTNAME}}' completed successfully"
|
|
95
|
+
notify: false
|
|
96
|
+
on_failure:
|
|
97
|
+
message: "Workflow '{{COMPONENTNAME}}' failed"
|
|
98
|
+
notify: true
|
|
99
|
+
rollback: true
|
|
100
|
+
|
|
101
|
+
# Validation
|
|
102
|
+
validation:
|
|
103
|
+
pre_run:
|
|
104
|
+
- "Check all required inputs are provided"
|
|
105
|
+
- "Validate input formats"
|
|
106
|
+
post_run:
|
|
107
|
+
- "Verify output is valid"
|
|
108
|
+
- "Log completion metrics"
|
|
@@ -209,6 +209,46 @@ function parseAllAgents(agentsDir) {
|
|
|
209
209
|
return agents;
|
|
210
210
|
}
|
|
211
211
|
|
|
212
|
+
/**
|
|
213
|
+
* Normalize commands to consistent format
|
|
214
|
+
* Handles both { name, description } and { "cmd-name": "description" } formats
|
|
215
|
+
* @param {object[]} commands - Array of command objects (may be in various formats)
|
|
216
|
+
* @returns {object[]} - Normalized command objects with name, description, visibility
|
|
217
|
+
*/
|
|
218
|
+
function normalizeCommands(commands) {
|
|
219
|
+
if (!Array.isArray(commands)) return [];
|
|
220
|
+
|
|
221
|
+
return commands.map(cmd => {
|
|
222
|
+
// Already in proper format with name property
|
|
223
|
+
if (cmd.name && typeof cmd.name === 'string') {
|
|
224
|
+
return {
|
|
225
|
+
name: cmd.name,
|
|
226
|
+
description: cmd.description || 'No description',
|
|
227
|
+
visibility: cmd.visibility || ['full', 'quick'],
|
|
228
|
+
};
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
// Shorthand format: { "cmd-name": "description text" }
|
|
232
|
+
const keys = Object.keys(cmd);
|
|
233
|
+
if (keys.length === 1) {
|
|
234
|
+
const name = keys[0];
|
|
235
|
+
const description = cmd[name];
|
|
236
|
+
return {
|
|
237
|
+
name: name,
|
|
238
|
+
description: typeof description === 'string' ? description : 'No description',
|
|
239
|
+
visibility: ['full', 'quick'],
|
|
240
|
+
};
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
// Unknown format - try to extract what we can
|
|
244
|
+
return {
|
|
245
|
+
name: cmd.name || 'unknown',
|
|
246
|
+
description: cmd.description || 'No description',
|
|
247
|
+
visibility: cmd.visibility || ['full', 'quick'],
|
|
248
|
+
};
|
|
249
|
+
});
|
|
250
|
+
}
|
|
251
|
+
|
|
212
252
|
/**
|
|
213
253
|
* Get visibility-filtered commands
|
|
214
254
|
* @param {object[]} commands - Array of command objects
|
|
@@ -218,7 +258,10 @@ function parseAllAgents(agentsDir) {
|
|
|
218
258
|
function getVisibleCommands(commands, visibility) {
|
|
219
259
|
if (!Array.isArray(commands)) return [];
|
|
220
260
|
|
|
221
|
-
|
|
261
|
+
// First normalize the commands to ensure consistent format
|
|
262
|
+
const normalized = normalizeCommands(commands);
|
|
263
|
+
|
|
264
|
+
return normalized.filter(cmd => {
|
|
222
265
|
if (!cmd.visibility) return true; // Include if no visibility defined
|
|
223
266
|
return cmd.visibility.includes(visibility);
|
|
224
267
|
});
|
|
@@ -246,6 +289,7 @@ module.exports = {
|
|
|
246
289
|
extractSection,
|
|
247
290
|
parseAgentFile,
|
|
248
291
|
parseAllAgents,
|
|
292
|
+
normalizeCommands,
|
|
249
293
|
getVisibleCommands,
|
|
250
294
|
formatCommandsList,
|
|
251
295
|
};
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* Target: .antigravity/rules/agents/*.md
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
const { getVisibleCommands } = require('../agent-parser');
|
|
9
|
+
const { getVisibleCommands, normalizeCommands } = require('../agent-parser');
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
12
|
* Transform agent data to Antigravity format
|
|
@@ -23,9 +23,10 @@ function transform(agentData) {
|
|
|
23
23
|
const whenToUse = agent.whenToUse || 'Use this agent for specific tasks';
|
|
24
24
|
const archetype = persona.archetype || '';
|
|
25
25
|
|
|
26
|
-
// Get quick visibility commands
|
|
27
|
-
const
|
|
28
|
-
const
|
|
26
|
+
// Get quick visibility commands (normalized to consistent format)
|
|
27
|
+
const allCommands = normalizeCommands(agentData.commands || []);
|
|
28
|
+
const quickCommands = getVisibleCommands(allCommands, 'quick');
|
|
29
|
+
const keyCommands = getVisibleCommands(allCommands, 'key');
|
|
29
30
|
|
|
30
31
|
// Build content (similar to Cursor)
|
|
31
32
|
let content = `# ${name} (@${agentData.id})
|
|
@@ -61,8 +62,7 @@ ${icon} **${title}**${archetype ? ` | ${archetype}` : ''}
|
|
|
61
62
|
content += '\n';
|
|
62
63
|
}
|
|
63
64
|
|
|
64
|
-
// Add all commands for reference
|
|
65
|
-
const allCommands = agentData.commands || [];
|
|
65
|
+
// Add all commands for reference (allCommands already normalized above)
|
|
66
66
|
if (allCommands.length > quickCommands.length + keyOnlyCommands.length) {
|
|
67
67
|
content += `## All Commands
|
|
68
68
|
|