aios-core 3.4.0 → 3.6.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/development/agents/architect.md +4 -0
- package/.aios-core/development/agents/squad-creator.md +11 -0
- package/.aios-core/development/scripts/squad/index.js +48 -0
- package/.aios-core/development/scripts/squad/squad-downloader.js +510 -0
- package/.aios-core/development/scripts/squad/squad-migrator.js +634 -0
- package/.aios-core/development/scripts/squad/squad-publisher.js +629 -0
- package/.aios-core/development/tasks/add-mcp.md +124 -13
- package/.aios-core/development/tasks/analyze-project-structure.md +621 -0
- package/.aios-core/development/tasks/setup-mcp-docker.md +46 -6
- package/.aios-core/development/tasks/squad-creator-download.md +135 -33
- package/.aios-core/development/tasks/squad-creator-migrate.md +243 -0
- package/.aios-core/development/tasks/squad-creator-publish.md +190 -47
- package/.aios-core/development/tasks/squad-creator-sync-synkra.md +280 -48
- package/.aios-core/install-manifest.yaml +39 -19
- package/.claude/rules/mcp-usage.md +62 -2
- package/package.json +1 -1
|
@@ -3,84 +3,227 @@ task: Publish Squad
|
|
|
3
3
|
responsavel: "@squad-creator"
|
|
4
4
|
responsavel_type: agent
|
|
5
5
|
atomic_layer: task
|
|
6
|
-
status:
|
|
6
|
+
status: active
|
|
7
7
|
sprint: 8
|
|
8
|
+
story: SQS-6
|
|
8
9
|
Entrada: |
|
|
9
|
-
-
|
|
10
|
-
-
|
|
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
|
|
13
|
-
-
|
|
14
|
-
-
|
|
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
|
-
- "[ ]
|
|
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
|
-
|
|
30
|
+
Publishes a local squad to the aios-squads GitHub repository via Pull Request.
|
|
22
31
|
|
|
23
|
-
##
|
|
32
|
+
## Prerequisites
|
|
24
33
|
|
|
25
|
-
|
|
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
|
-
##
|
|
38
|
+
## Usage
|
|
28
39
|
|
|
29
|
-
```
|
|
40
|
+
```bash
|
|
30
41
|
@squad-creator
|
|
31
42
|
|
|
32
|
-
|
|
33
|
-
|
|
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
|
-
|
|
60
|
+
[SquadPublisher] Dry run mode
|
|
40
61
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
- Verify license and author info
|
|
62
|
+
Squad: my-squad
|
|
63
|
+
Version: 1.0.0
|
|
64
|
+
Author: developer-name
|
|
45
65
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
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
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
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
|
|
62
|
-
└──
|
|
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
|
-
|
|
65
|
-
├──
|
|
66
|
-
|
|
67
|
-
└── Generate changelog
|
|
143
|
+
8. Update registry.json
|
|
144
|
+
├── Add to community section
|
|
145
|
+
└── Sort alphabetically
|
|
68
146
|
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
└── If synkra-api → Upload via API
|
|
147
|
+
9. Commit and push
|
|
148
|
+
└── Include metadata in commit message
|
|
72
149
|
|
|
73
|
-
|
|
74
|
-
|
|
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
|
-
##
|
|
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
|
-
|
|
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
|
-
##
|
|
196
|
+
## Requirements
|
|
82
197
|
|
|
83
|
-
|
|
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
|
-
|
|
86
|
-
- https://github.com/SynkraAI/aios-squads
|
|
229
|
+
- **SQS-6:** Download & Publish Tasks (Sprint 8)
|
|
@@ -3,81 +3,313 @@ task: Sync Squad to Synkra
|
|
|
3
3
|
responsavel: "@squad-creator"
|
|
4
4
|
responsavel_type: agent
|
|
5
5
|
atomic_layer: task
|
|
6
|
-
status:
|
|
6
|
+
status: active
|
|
7
7
|
sprint: 8
|
|
8
|
+
story: SQS-5
|
|
9
|
+
version: 1.0.0
|
|
8
10
|
Entrada: |
|
|
9
|
-
-
|
|
10
|
-
-
|
|
11
|
+
- squad_path: Caminho do squad para sincronizar (obrigatório)
|
|
12
|
+
- visibility: public | private (default: private)
|
|
13
|
+
- official: Flag para marcar como oficial (--official, apenas SynkraAI)
|
|
14
|
+
- dry_run: Preview sem sincronizar (--dry-run)
|
|
11
15
|
Saida: |
|
|
12
|
-
-
|
|
13
|
-
-
|
|
14
|
-
-
|
|
16
|
+
- sync_result: Resultado do sync (created | updated | skipped)
|
|
17
|
+
- squad_url: URL do squad no marketplace (quando público)
|
|
18
|
+
- squad_id: ID único do squad
|
|
19
|
+
- checksum: Checksum do squad sincronizado
|
|
15
20
|
Checklist:
|
|
16
|
-
- "[
|
|
21
|
+
- "[x] Validar squad localmente"
|
|
22
|
+
- "[x] Obter token de autenticação"
|
|
23
|
+
- "[x] Calcular checksum"
|
|
24
|
+
- "[x] Enviar para Synkra API"
|
|
25
|
+
- "[x] Exibir URL do marketplace"
|
|
17
26
|
---
|
|
18
27
|
|
|
19
28
|
# *sync-squad-synkra
|
|
20
29
|
|
|
21
|
-
|
|
30
|
+
Sincroniza um squad local para o Synkra API marketplace.
|
|
22
31
|
|
|
23
|
-
##
|
|
32
|
+
## Uso
|
|
24
33
|
|
|
25
|
-
|
|
34
|
+
```bash
|
|
35
|
+
@squad-creator
|
|
36
|
+
|
|
37
|
+
# Sync privado (apenas workspace)
|
|
38
|
+
*sync-squad-synkra ./squads/meu-squad
|
|
39
|
+
|
|
40
|
+
# Sync público (visível para todos)
|
|
41
|
+
*sync-squad-synkra ./squads/meu-squad --public
|
|
42
|
+
|
|
43
|
+
# Preview sem sincronizar
|
|
44
|
+
*sync-squad-synkra ./squads/meu-squad --dry-run
|
|
45
|
+
|
|
46
|
+
# Sync com verbosidade
|
|
47
|
+
*sync-squad-synkra ./squads/meu-squad --verbose
|
|
48
|
+
```
|
|
26
49
|
|
|
27
|
-
##
|
|
50
|
+
## Autenticação
|
|
51
|
+
|
|
52
|
+
Requer autenticação com Synkra API:
|
|
28
53
|
|
|
29
54
|
```bash
|
|
30
|
-
|
|
55
|
+
export SYNKRA_API_TOKEN="seu-token"
|
|
56
|
+
```
|
|
31
57
|
|
|
32
|
-
|
|
33
|
-
# → Syncs to api.synkra.dev/squads (free tier)
|
|
58
|
+
Ou configure em `.env`:
|
|
34
59
|
|
|
35
|
-
|
|
36
|
-
|
|
60
|
+
```env
|
|
61
|
+
SYNKRA_API_URL=https://api.synkra.dev/api
|
|
62
|
+
SYNKRA_API_TOKEN=seu-token
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
Para obter um token:
|
|
66
|
+
1. Acesse https://synkra.dev/settings/api-keys
|
|
67
|
+
2. Crie uma nova API key com permissões de sync
|
|
68
|
+
3. Configure a variável de ambiente
|
|
69
|
+
|
|
70
|
+
## Output Exemplo
|
|
37
71
|
|
|
38
|
-
*sync-squad-synkra meu-squad --update
|
|
39
|
-
# → Updates existing squad in marketplace
|
|
40
72
|
```
|
|
73
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
74
|
+
*sync-squad-synkra
|
|
75
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
76
|
+
|
|
77
|
+
📦 Squad: ./squads/meu-squad/
|
|
41
78
|
|
|
42
|
-
|
|
79
|
+
Step 1: Local Validation
|
|
80
|
+
✓ Found squad.yaml
|
|
81
|
+
✓ Name: meu-squad
|
|
82
|
+
✓ Version: 1.0.0
|
|
83
|
+
✓ Schema validation: PASSED
|
|
43
84
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
- Validate account permissions
|
|
47
|
-
- Support team accounts
|
|
85
|
+
Step 2: Calculate Checksum
|
|
86
|
+
✓ Checksum: a1b2c3d4e5f6...
|
|
48
87
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
- Subscription: Monthly/yearly
|
|
88
|
+
Step 3: Sync to Synkra API
|
|
89
|
+
✓ Visibility: private
|
|
90
|
+
✓ API URL: https://api.synkra.dev/api
|
|
53
91
|
|
|
54
|
-
|
|
55
|
-
- Semantic versioning
|
|
56
|
-
- Changelog generation
|
|
57
|
-
- Update existing squads
|
|
92
|
+
Syncing to Synkra API...
|
|
58
93
|
|
|
59
|
-
|
|
60
|
-
- Download statistics
|
|
61
|
-
- Revenue tracking (for paid)
|
|
62
|
-
- User feedback
|
|
94
|
+
✅ Squad synced successfully!
|
|
63
95
|
|
|
64
|
-
|
|
96
|
+
Status: created
|
|
97
|
+
ID: 550e8400-e29b-41d4-a716-446655440000
|
|
98
|
+
Checksum: a1b2c3d4e5f6...
|
|
65
99
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
GET /api/v1/squads/{id} # Get squad info
|
|
70
|
-
DELETE /api/v1/squads/{id} # Remove squad
|
|
71
|
-
GET /api/v1/squads/me # List my squads
|
|
100
|
+
Next steps:
|
|
101
|
+
- View squad: *describe-squad meu-squad
|
|
102
|
+
- Make public: *sync-squad-synkra ./squads/meu-squad --public
|
|
72
103
|
```
|
|
73
104
|
|
|
74
|
-
##
|
|
105
|
+
## Flags
|
|
106
|
+
|
|
107
|
+
| Flag | Descrição | Default |
|
|
108
|
+
|------|-----------|---------|
|
|
109
|
+
| `--public` | Torna o squad visível no marketplace público | false |
|
|
110
|
+
| `--private` | Mantém squad privado (apenas workspace) | true |
|
|
111
|
+
| `--dry-run` | Preview sem enviar para API | false |
|
|
112
|
+
| `--verbose` | Output detalhado | false |
|
|
113
|
+
| `--official` | Marca como squad oficial (apenas SynkraAI team) | false |
|
|
114
|
+
| `--force` | Ignora warnings e força sync | false |
|
|
115
|
+
|
|
116
|
+
## Workflow
|
|
117
|
+
|
|
118
|
+
```
|
|
119
|
+
┌──────────────────────────────────────────────────┐
|
|
120
|
+
│ *sync-squad-synkra │
|
|
121
|
+
├──────────────────────────────────────────────────┤
|
|
122
|
+
│ │
|
|
123
|
+
│ 1. Parse Arguments │
|
|
124
|
+
│ ↓ │
|
|
125
|
+
│ 2. Find squad.yaml │
|
|
126
|
+
│ ↓ │
|
|
127
|
+
│ 3. Validate with squad-validator.js │
|
|
128
|
+
│ ↓ (fail → abort) │
|
|
129
|
+
│ 4. Calculate SHA-256 checksum │
|
|
130
|
+
│ ↓ │
|
|
131
|
+
│ 5. Check SYNKRA_API_TOKEN │
|
|
132
|
+
│ ↓ (missing → abort) │
|
|
133
|
+
│ 6. If --dry-run: show preview and exit │
|
|
134
|
+
│ ↓ │
|
|
135
|
+
│ 7. POST to /api/squads/sync │
|
|
136
|
+
│ ↓ │
|
|
137
|
+
│ 8. Display result and marketplace URL │
|
|
138
|
+
│ │
|
|
139
|
+
└──────────────────────────────────────────────────┘
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
## API Integration
|
|
143
|
+
|
|
144
|
+
### Request
|
|
145
|
+
|
|
146
|
+
```javascript
|
|
147
|
+
POST ${SYNKRA_API_URL}/squads/sync
|
|
148
|
+
Authorization: Bearer ${SYNKRA_API_TOKEN}
|
|
149
|
+
Content-Type: application/json
|
|
150
|
+
|
|
151
|
+
{
|
|
152
|
+
"squadData": {
|
|
153
|
+
"name": "meu-squad",
|
|
154
|
+
"version": "1.0.0",
|
|
155
|
+
"description": "...",
|
|
156
|
+
"author": "...",
|
|
157
|
+
"license": "MIT",
|
|
158
|
+
"components": {...},
|
|
159
|
+
"tags": [...]
|
|
160
|
+
},
|
|
161
|
+
"isPublic": false,
|
|
162
|
+
"isOfficial": false
|
|
163
|
+
}
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
### Response (Success)
|
|
167
|
+
|
|
168
|
+
```json
|
|
169
|
+
{
|
|
170
|
+
"success": true,
|
|
171
|
+
"data": {
|
|
172
|
+
"action": "created",
|
|
173
|
+
"squad_id": "meu-squad",
|
|
174
|
+
"id": "550e8400-e29b-41d4-a716-446655440000",
|
|
175
|
+
"version": "1.0.0"
|
|
176
|
+
},
|
|
177
|
+
"duration_ms": 150
|
|
178
|
+
}
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
### Response (Error)
|
|
182
|
+
|
|
183
|
+
```json
|
|
184
|
+
{
|
|
185
|
+
"success": false,
|
|
186
|
+
"error": "Validation failed: Missing required field: version"
|
|
187
|
+
}
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
## Implementation Guide
|
|
191
|
+
|
|
192
|
+
### For Agent Execution
|
|
193
|
+
|
|
194
|
+
```javascript
|
|
195
|
+
// 1. Parse squad path from arguments
|
|
196
|
+
const squadPath = args[0] || '.';
|
|
197
|
+
const flags = parseFlags(args);
|
|
198
|
+
|
|
199
|
+
// 2. Find and read squad.yaml
|
|
200
|
+
const squadYamlPath = path.join(squadPath, 'squad.yaml');
|
|
201
|
+
if (!fs.existsSync(squadYamlPath)) {
|
|
202
|
+
error(`squad.yaml not found in ${squadPath}`);
|
|
203
|
+
return;
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
// 3. Validate with squad-validator.js
|
|
207
|
+
const { validateSquad } = await import('.aios-core/development/scripts/squad/squad-validator.js');
|
|
208
|
+
const validation = await validateSquad(squadYamlPath);
|
|
209
|
+
|
|
210
|
+
if (!validation.valid) {
|
|
211
|
+
error(`Validation failed: ${validation.errors.join(', ')}`);
|
|
212
|
+
return;
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
if (validation.warnings.length > 0 && !flags.force) {
|
|
216
|
+
warn(`Warnings: ${validation.warnings.join(', ')}`);
|
|
217
|
+
// Consider prompting user to continue
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
// 4. Read and parse squad data
|
|
221
|
+
const squadContent = fs.readFileSync(squadYamlPath, 'utf8');
|
|
222
|
+
const squadData = parseYaml(squadContent);
|
|
223
|
+
|
|
224
|
+
// 5. Calculate checksum
|
|
225
|
+
const checksum = crypto.createHash('sha256')
|
|
226
|
+
.update(squadContent)
|
|
227
|
+
.digest('hex');
|
|
228
|
+
|
|
229
|
+
// 6. Check authentication
|
|
230
|
+
const apiToken = process.env.SYNKRA_API_TOKEN;
|
|
231
|
+
const apiUrl = process.env.SYNKRA_API_URL || 'https://api.synkra.dev/api';
|
|
75
232
|
|
|
76
|
-
|
|
233
|
+
if (!apiToken) {
|
|
234
|
+
error('SYNKRA_API_TOKEN not set. See task docs for authentication.');
|
|
235
|
+
return;
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
// 7. Dry run check
|
|
239
|
+
if (flags.dryRun) {
|
|
240
|
+
output(`
|
|
241
|
+
DRY RUN - Would sync:
|
|
242
|
+
Squad: ${squadData.name}
|
|
243
|
+
Version: ${squadData.version}
|
|
244
|
+
Checksum: ${checksum}
|
|
245
|
+
Visibility: ${flags.public ? 'public' : 'private'}
|
|
246
|
+
`);
|
|
247
|
+
return;
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
// 8. Call Synkra API
|
|
251
|
+
const response = await fetch(`${apiUrl}/squads/sync`, {
|
|
252
|
+
method: 'POST',
|
|
253
|
+
headers: {
|
|
254
|
+
'Authorization': `Bearer ${apiToken}`,
|
|
255
|
+
'Content-Type': 'application/json'
|
|
256
|
+
},
|
|
257
|
+
body: JSON.stringify({
|
|
258
|
+
squadData: {
|
|
259
|
+
...squadData,
|
|
260
|
+
checksum,
|
|
261
|
+
raw_content: squadContent
|
|
262
|
+
},
|
|
263
|
+
isPublic: flags.public,
|
|
264
|
+
isOfficial: flags.official
|
|
265
|
+
})
|
|
266
|
+
});
|
|
267
|
+
|
|
268
|
+
const result = await response.json();
|
|
269
|
+
|
|
270
|
+
// 9. Display result
|
|
271
|
+
if (result.success) {
|
|
272
|
+
output(`
|
|
273
|
+
✅ Squad synced successfully!
|
|
274
|
+
|
|
275
|
+
Status: ${result.data.action}
|
|
276
|
+
ID: ${result.data.id}
|
|
277
|
+
Squad ID: ${result.data.squad_id}
|
|
278
|
+
`);
|
|
279
|
+
|
|
280
|
+
if (flags.public) {
|
|
281
|
+
output(` URL: https://synkra.dev/squads/${result.data.squad_id}`);
|
|
282
|
+
}
|
|
283
|
+
} else {
|
|
284
|
+
error(`Sync failed: ${result.error}`);
|
|
285
|
+
}
|
|
286
|
+
```
|
|
287
|
+
|
|
288
|
+
## Error Handling
|
|
289
|
+
|
|
290
|
+
| Error | Causa | Solução |
|
|
291
|
+
|-------|-------|---------|
|
|
292
|
+
| `squad.yaml not found` | Caminho inválido | Verifique o path do squad |
|
|
293
|
+
| `Validation failed` | Squad não passa na validação | Execute `*validate-squad` primeiro |
|
|
294
|
+
| `SYNKRA_API_TOKEN not set` | Token não configurado | Configure a variável de ambiente |
|
|
295
|
+
| `401 Unauthorized` | Token inválido ou expirado | Gere novo token em synkra.dev |
|
|
296
|
+
| `403 Forbidden` | Sem permissão para operação | Verifique permissões da API key |
|
|
297
|
+
| `Squad not found or not owned` | Tentando atualizar squad de outro workspace | Verifique ownership |
|
|
298
|
+
|
|
299
|
+
## Related Tasks
|
|
300
|
+
|
|
301
|
+
- `*create-squad` - Criar novo squad local
|
|
302
|
+
- `*validate-squad` - Validar squad antes de sync
|
|
303
|
+
- `*describe-squad` - Ver detalhes do squad
|
|
304
|
+
- `*list-squads` - Listar squads disponíveis
|
|
305
|
+
|
|
306
|
+
## Related Story
|
|
77
307
|
|
|
78
|
-
|
|
308
|
+
- **SQS-5:** SquadSyncService for Synkra API (Sprint 8)
|
|
79
309
|
|
|
80
|
-
|
|
310
|
+
## Changelog
|
|
81
311
|
|
|
82
|
-
|
|
83
|
-
|
|
312
|
+
| Version | Date | Description |
|
|
313
|
+
|---------|------|-------------|
|
|
314
|
+
| 1.0.0 | 2025-12-23 | Full implementation (Story SQS-5) |
|
|
315
|
+
| 0.1.0 | 2025-12-18 | Initial placeholder |
|