aios-core 3.4.0 → 3.5.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,243 @@
1
+ ---
2
+ task: Migrate Squad
3
+ responsável: @squad-creator
4
+ responsável_type: agent
5
+ atomic_layer: task
6
+ Entrada: |
7
+ - squad_path: Path to the squad directory to migrate (required)
8
+ - dry_run: If true, preview changes without modifying files (--dry-run)
9
+ - verbose: If true, show detailed output (--verbose)
10
+ Saída: |
11
+ - migration_result: Object with { success, actions, validation, backupPath }
12
+ - report: Formatted migration report
13
+ - exit_code: 0 if successful, 1 if failed
14
+ Checklist:
15
+ - "[ ] Analyze squad for migration needs"
16
+ - "[ ] Create backup in .backup/"
17
+ - "[ ] Execute migration actions"
18
+ - "[ ] Validate migrated squad"
19
+ - "[ ] Generate migration report"
20
+ ---
21
+
22
+ # *migrate-squad
23
+
24
+ Migrates legacy squad formats to AIOS 2.1 standard.
25
+
26
+ ## Usage
27
+
28
+ ```
29
+ @squad-creator
30
+
31
+ # Preview changes without modifying files
32
+ *migrate-squad ./squads/my-squad --dry-run
33
+
34
+ # Migrate with automatic backup
35
+ *migrate-squad ./squads/my-squad
36
+
37
+ # Migrate with detailed output
38
+ *migrate-squad ./squads/my-squad --verbose
39
+
40
+ # Migrate expansion pack
41
+ *migrate-squad ./expansion-packs/my-pack --verbose
42
+ ```
43
+
44
+ ## Parameters
45
+
46
+ | Parameter | Type | Default | Description |
47
+ |-----------|------|---------|-------------|
48
+ | `squad_path` | string | - | Full path to squad directory (required) |
49
+ | `--dry-run` | flag | false | Preview changes without modifying files |
50
+ | `--verbose` | flag | false | Show detailed migration output |
51
+
52
+ ## Migration Detection
53
+
54
+ The migrator detects the following legacy patterns:
55
+
56
+ | Pattern | Detection | Migration Action |
57
+ |---------|-----------|------------------|
58
+ | `config.yaml` | Legacy manifest name | Rename to `squad.yaml` |
59
+ | Flat structure | No `tasks/`, `agents/` dirs | Create directory structure |
60
+ | Missing `aios.type` | Field not present | Add `aios.type: squad` |
61
+ | Missing `aios.minVersion` | Field not present | Add `aios.minVersion: 2.1.0` |
62
+ | Missing `name` | Field not present | Infer from directory name |
63
+ | Missing `version` | Field not present | Add `version: 1.0.0` |
64
+
65
+ ## Flow
66
+
67
+ ```
68
+ 1. Analyze Squad
69
+ ├── Check for config.yaml vs squad.yaml
70
+ ├── Check directory structure
71
+ ├── Validate manifest schema
72
+ └── Generate action list
73
+
74
+ 2. Confirm Migration (if not --dry-run)
75
+ ├── Display issues found
76
+ ├── Display planned actions
77
+ └── Request user confirmation
78
+
79
+ 3. Create Backup
80
+ └── Copy all files to .backup/pre-migration-{timestamp}/
81
+
82
+ 4. Execute Actions
83
+ ├── RENAME_MANIFEST: config.yaml → squad.yaml
84
+ ├── CREATE_DIRECTORIES: tasks/, agents/, config/
85
+ ├── ADD_FIELD: Add missing required fields
86
+ └── MOVE_FILE: Reorganize files if needed
87
+
88
+ 5. Validate Result
89
+ ├── Run squad-validator on migrated squad
90
+ └── Report any remaining issues
91
+
92
+ 6. Generate Report
93
+ ├── Summary of changes made
94
+ ├── Backup location
95
+ └── Validation result
96
+ ```
97
+
98
+ ## Output Example
99
+
100
+ ### Analysis Phase
101
+
102
+ ```
103
+ ═══════════════════════════════════════════════════════════
104
+ SQUAD MIGRATION REPORT
105
+ ═══════════════════════════════════════════════════════════
106
+
107
+ Squad Path: ./squads/my-legacy-squad/
108
+ Needs Migration: Yes
109
+
110
+ ───────────────────────────────────────────────────────────
111
+ ISSUES FOUND:
112
+ ───────────────────────────────────────────────────────────
113
+ ⚠️ [WARNING] Uses deprecated config.yaml manifest
114
+ ⚠️ [WARNING] Missing task-first directories: tasks, agents
115
+ ❌ [ERROR] Missing required field: aios.type
116
+ ❌ [ERROR] Missing required field: aios.minVersion
117
+
118
+ ───────────────────────────────────────────────────────────
119
+ PLANNED ACTIONS:
120
+ ───────────────────────────────────────────────────────────
121
+ 1. Rename config.yaml → squad.yaml
122
+ 2. Create directories: tasks, agents
123
+ 3. Add field: aios.type = "squad"
124
+ 4. Add field: aios.minVersion = "2.1.0"
125
+
126
+ ═══════════════════════════════════════════════════════════
127
+ ```
128
+
129
+ ### Migration Result
130
+
131
+ ```
132
+ ───────────────────────────────────────────────────────────
133
+ MIGRATION RESULT:
134
+ ───────────────────────────────────────────────────────────
135
+ Status: ✅ SUCCESS
136
+ Message: Migration completed successfully
137
+ Backup: ./squads/my-legacy-squad/.backup/pre-migration-1703318400000/
138
+
139
+ Executed Actions:
140
+ ✅ Rename config.yaml → squad.yaml [success]
141
+ ✅ Create directories: tasks, agents [success]
142
+ ✅ Add field: aios.type = "squad" [success]
143
+ ✅ Add field: aios.minVersion = "2.1.0" [success]
144
+
145
+ Post-Migration Validation:
146
+ Valid: Yes
147
+
148
+ ═══════════════════════════════════════════════════════════
149
+ ```
150
+
151
+ ### Dry-Run Mode
152
+
153
+ ```
154
+ ───────────────────────────────────────────────────────────
155
+ MIGRATION RESULT:
156
+ ───────────────────────────────────────────────────────────
157
+ Status: ✅ SUCCESS
158
+ Message: Dry-run completed successfully
159
+
160
+ Executed Actions:
161
+ 🔍 Rename config.yaml → squad.yaml [dry-run]
162
+ 🔍 Create directories: tasks, agents [dry-run]
163
+ 🔍 Add field: aios.type = "squad" [dry-run]
164
+ 🔍 Add field: aios.minVersion = "2.1.0" [dry-run]
165
+
166
+ ═══════════════════════════════════════════════════════════
167
+ ```
168
+
169
+ ## Rollback Procedure
170
+
171
+ If migration fails or produces unexpected results, restore from backup:
172
+
173
+ ```bash
174
+ # List available backups
175
+ ls ./squads/my-squad/.backup/
176
+
177
+ # View backup contents
178
+ ls ./squads/my-squad/.backup/pre-migration-1703318400000/
179
+
180
+ # Restore from backup (removes current, restores backup)
181
+ rm -rf ./squads/my-squad/squad.yaml ./squads/my-squad/tasks ./squads/my-squad/agents
182
+ cp -r ./squads/my-squad/.backup/pre-migration-1703318400000/. ./squads/my-squad/
183
+
184
+ # Verify restoration
185
+ ls ./squads/my-squad/
186
+ ```
187
+
188
+ ## Error Codes
189
+
190
+ | Code | Severity | Description |
191
+ |------|----------|-------------|
192
+ | `SQUAD_NOT_FOUND` | Error | Squad directory doesn't exist |
193
+ | `NO_MANIFEST` | Error | No config.yaml or squad.yaml found |
194
+ | `BACKUP_FAILED` | Error | Failed to create backup |
195
+ | `MIGRATION_FAILED` | Error | Action execution failed |
196
+ | `VALIDATION_FAILED` | Warning | Post-migration validation found issues |
197
+ | `INVALID_PATH` | Error | Invalid squad path provided |
198
+
199
+ ## Implementation
200
+
201
+ ```javascript
202
+ const { SquadMigrator } = require('./.aios-core/development/scripts/squad');
203
+ const { SquadValidator } = require('./.aios-core/development/scripts/squad');
204
+
205
+ async function migrateSquad(options) {
206
+ const { squadPath, dryRun, verbose } = options;
207
+
208
+ // Create migrator with optional validator
209
+ const validator = new SquadValidator();
210
+ const migrator = new SquadMigrator({
211
+ dryRun,
212
+ verbose,
213
+ validator
214
+ });
215
+
216
+ // Analyze first
217
+ const analysis = await migrator.analyze(squadPath);
218
+
219
+ // Display analysis report
220
+ console.log(migrator.generateReport(analysis));
221
+
222
+ if (!analysis.needsMigration) {
223
+ console.log('Squad is already up to date. No migration needed.');
224
+ return 0;
225
+ }
226
+
227
+ // Execute migration
228
+ const result = await migrator.migrate(squadPath);
229
+
230
+ // Display final report
231
+ console.log(migrator.generateReport(analysis, result));
232
+
233
+ return result.success ? 0 : 1;
234
+ }
235
+ ```
236
+
237
+ ## Related
238
+
239
+ - **Story:** SQS-7 (Squad Migration Tool)
240
+ - **Dependencies:** squad-migrator.js, squad-validator.js
241
+ - **Schema:** .aios-core/schemas/squad-schema.json
242
+ - **Agent:** @squad-creator (Craft)
243
+ - **Similar Tasks:** *validate-squad, *create-squad
@@ -3,84 +3,227 @@ task: Publish Squad
3
3
  responsavel: "@squad-creator"
4
4
  responsavel_type: agent
5
5
  atomic_layer: task
6
- status: placeholder
6
+ status: active
7
7
  sprint: 8
8
+ story: SQS-6
8
9
  Entrada: |
9
- - name: Nome do squad para publicar
10
- - target: Destino (aios-squads | synkra-api)
10
+ - squad_path: Caminho do squad para publicar (obrigatório)
11
+ - dry_run: Flag para simular sem criar PR (--dry-run)
12
+ - category: Categoria do squad (community | official)
11
13
  Saida: |
12
- - pr_url: URL do PR criado (para aios-squads)
13
- - api_url: URL na API (para synkra-api)
14
- - status: Sucesso ou erro
14
+ - pr_url: URL do Pull Request criado
15
+ - branch: Nome do branch criado
16
+ - validation_result: Resultado da validação pré-publish
15
17
  Checklist:
16
- - "[ ] Implementar em Sprint 8 (SQS-6)"
18
+ - "[ ] Validar squad (deve passar sem errors)"
19
+ - "[ ] Verificar autenticação GitHub"
20
+ - "[ ] Verificar se squad já existe no registry"
21
+ - "[ ] Criar branch no fork/clone"
22
+ - "[ ] Copiar arquivos do squad"
23
+ - "[ ] Atualizar registry.json"
24
+ - "[ ] Criar Pull Request"
25
+ - "[ ] Exibir URL do PR"
17
26
  ---
18
27
 
19
28
  # *publish-squad
20
29
 
21
- > **PLACEHOLDER** - Implementation scheduled for Sprint 8 (Story SQS-6)
30
+ Publishes a local squad to the aios-squads GitHub repository via Pull Request.
22
31
 
23
- ## Planned Functionality
32
+ ## Prerequisites
24
33
 
25
- Publishes a local squad to the aios-squads repository (via PR) or Synkra API marketplace.
34
+ - GitHub CLI installed and authenticated: `gh auth login`
35
+ - Squad must pass validation with no errors
36
+ - Squad must have required manifest fields (name, version)
26
37
 
27
- ## Planned Usage
38
+ ## Usage
28
39
 
29
- ```
40
+ ```bash
30
41
  @squad-creator
31
42
 
32
- *publish-squad meu-squad
33
- # → Creates PR to github.com/SynkraAI/aios-squads
43
+ # Publish squad (creates PR)
44
+ *publish-squad ./squads/my-squad
45
+
46
+ # Preview without creating PR
47
+ *publish-squad ./squads/my-squad --dry-run
48
+
49
+ # Verbose output
50
+ *publish-squad ./squads/my-squad --verbose
51
+ ```
52
+
53
+ ## Examples
54
+
55
+ ### Dry Run (Preview)
34
56
 
35
- *publish-squad meu-squad --target synkra-api
36
- # → Publishes to api.synkra.dev/squads (requires auth)
37
57
  ```
58
+ *publish-squad ./squads/my-squad --dry-run
38
59
 
39
- ## Planned Features
60
+ [SquadPublisher] Dry run mode
40
61
 
41
- 1. **Pre-publish Validation**
42
- - Run *validate-squad before publishing
43
- - Check required fields in squad.yaml
44
- - Verify license and author info
62
+ Squad: my-squad
63
+ Version: 1.0.0
64
+ Author: developer-name
45
65
 
46
- 2. **GitHub Repository (Default)**
47
- - Fork aios-squads if needed
48
- - Copy squad to squads/{name}/
49
- - Create PR with description
50
- - Add appropriate labels
66
+ PR Preview:
67
+ Title: Add squad: my-squad
68
+ Branch: squad/my-squad
69
+ Target: SynkraAI/aios-squads
51
70
 
52
- 3. **Synkra API**
53
- - Upload to api.synkra.dev/squads
54
- - Support pricing configuration
55
- - Manage versions and updates
71
+ Components:
72
+ - Tasks: 5
73
+ - Agents: 2
74
+ - Workflows: 1
75
+
76
+ ✓ Validation passed
77
+ ✓ Ready to publish
78
+
79
+ Run without --dry-run to create the actual PR.
80
+ ```
81
+
82
+ ### Publish (Create PR)
83
+
84
+ ```
85
+ *publish-squad ./squads/my-squad
86
+
87
+ Publishing: my-squad@1.0.0
88
+ Source: ./squads/my-squad/
89
+ Target: github.com/SynkraAI/aios-squads
90
+
91
+ ✓ Validated successfully
92
+ ✓ GitHub auth verified (user: your-username)
93
+ ✓ Fork ready
94
+ ✓ Files copied to packages/my-squad/
95
+ ✓ registry.json updated
96
+ ✓ Committed changes
97
+ ✓ Pushed to fork
98
+
99
+ Pull Request Created!
100
+ URL: https://github.com/SynkraAI/aios-squads/pull/42
101
+ Branch: squad/my-squad
102
+
103
+ Next steps:
104
+ 1. Review the PR: gh pr view 42
105
+ 2. Wait for maintainer review
106
+ 3. Address any feedback
107
+ ```
108
+
109
+ ## Options
110
+
111
+ | Option | Description |
112
+ |--------|-------------|
113
+ | `--dry-run` | Preview publish without creating PR |
114
+ | `--verbose` | Show detailed progress |
115
+ | `--category` | Squad category (default: community) |
56
116
 
57
117
  ## Workflow
58
118
 
59
119
  ```
60
120
  1. Validate squad
61
- ├── Run *validate-squad
62
- └── Ensure no errors
121
+ ├── Run SquadValidator
122
+ └── Must pass with 0 errors
123
+
124
+ 2. Load manifest
125
+ ├── Extract name, version, author
126
+ └── Extract components list
127
+
128
+ 3. Check GitHub auth
129
+ └── Verify gh auth status
130
+
131
+ 4. Create/check fork
132
+ └── Fork SynkraAI/aios-squads if needed
133
+
134
+ 5. Clone fork to temp directory
135
+ └── Shallow clone for speed
136
+
137
+ 6. Create branch
138
+ └── squad/{squad-name}
139
+
140
+ 7. Copy squad files
141
+ └── To packages/{squad-name}/
63
142
 
64
- 2. Prepare for publishing
65
- ├── Check license
66
- ├── Check author
67
- └── Generate changelog
143
+ 8. Update registry.json
144
+ ├── Add to community section
145
+ └── Sort alphabetically
68
146
 
69
- 3. Publish
70
- ├── If aios-squads Create PR
71
- └── If synkra-api → Upload via API
147
+ 9. Commit and push
148
+ └── Include metadata in commit message
72
149
 
73
- 4. Display result
74
- └── Show URL and next steps
150
+ 10. Create PR
151
+ ├── Generate PR body from manifest
152
+ └── Target main branch
153
+
154
+ 11. Cleanup
155
+ └── Remove temp directory
75
156
  ```
76
157
 
77
- ## Related Story
158
+ ## PR Body Template
159
+
160
+ The generated PR body includes:
161
+
162
+ ```markdown
163
+ ## New Squad: {name}
164
+
165
+ **Version:** {version}
166
+ **Author:** {author}
167
+ **Category:** community
168
+ **Description:** {description}
169
+
170
+ ### Components
171
+
172
+ | Type | Count |
173
+ |------|-------|
174
+ | Tasks | {n} |
175
+ | Agents | {n} |
176
+ | Workflows | {n} |
177
+
178
+ ### Pre-submission Checklist
179
+
180
+ - [x] Squad follows AIOS task-first architecture
181
+ - [x] Documentation is complete
182
+ - [x] Squad validated locally
183
+ - [ ] No sensitive data included
184
+ ```
185
+
186
+ ## Error Handling
78
187
 
79
- - **SQS-6:** Registry Integration (Sprint 8)
188
+ | Error | Cause | Solution |
189
+ |-------|-------|----------|
190
+ | `AUTH_REQUIRED` | Not authenticated | Run `gh auth login` |
191
+ | `VALIDATION_FAILED` | Squad has errors | Fix errors with `*validate-squad` |
192
+ | `SQUAD_NOT_FOUND` | Invalid path | Check squad path exists |
193
+ | `MANIFEST_ERROR` | Missing name/version | Update squad.yaml |
194
+ | `PR_ERROR` | GitHub CLI error | Check `gh` is working |
80
195
 
81
- ## Current Status
196
+ ## Requirements
82
197
 
83
- This task is a placeholder. The full implementation will be done in Sprint 8.
198
+ ### Manifest Fields
199
+
200
+ Required for publishing:
201
+ ```yaml
202
+ # squad.yaml
203
+ name: my-squad # Required
204
+ version: 1.0.0 # Required
205
+ description: "..." # Recommended
206
+ author: your-name # Recommended
207
+ ```
208
+
209
+ ### Validation Rules
210
+
211
+ Squad must pass validation:
212
+ - Valid squad.yaml with required fields
213
+ - Task files in tasks/ directory
214
+ - No critical errors
215
+
216
+ ## Implementation
217
+
218
+ Uses `SquadPublisher` class from:
219
+ - `.aios-core/development/scripts/squad/squad-publisher.js`
220
+
221
+ ## Related Tasks
222
+
223
+ - `*validate-squad` - Validate before publishing
224
+ - `*download-squad` - Download published squads
225
+ - `*create-squad` - Create new local squad
226
+
227
+ ## Related Story
84
228
 
85
- For now, manually create PRs at:
86
- - https://github.com/SynkraAI/aios-squads
229
+ - **SQS-6:** Download & Publish Tasks (Sprint 8)