@dewtech/dare-cli 2.14.0 → 2.16.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,197 @@
1
+ # /dare-dag-viz — Visualizar DAG com Excalidraw
2
+
3
+ Gera diagrama interativo `.excalidraw` a partir do `dare-dag.yaml` atual, com cores semânticas por complexidade e status visual das tasks.
4
+
5
+ ## O que faz
6
+
7
+ 1. **Lê** `DARE/dare-dag.yaml` (grafo de tasks + dependências)
8
+ 2. **Mapeia** cada task para um retângulo Excalidraw com:
9
+ - Cor baseada em `complexity` (LOW=azul, MED=laranja, HIGH=rosa)
10
+ - Status visual (PENDING/RUNNING/DONE/FAILED)
11
+ - ID + nome da task
12
+ 3. **Agrupa** tasks por `rank` em colunas verticais (swim lanes)
13
+ 4. **Cria** setas para cada dependência (`depends_on`)
14
+ 5. **Salva** em `DARE/dag-graph.excalidraw`
15
+
16
+ Output é um arquivo **editável e interativo** — abre direto em https://excalidraw.com.
17
+
18
+ ## Convenções visuais
19
+
20
+ Referência: `/docs/DESIGN-TOKENS-EXCALIDRAW.md`
21
+
22
+ **Cores por complexidade:**
23
+ - 🔵 **Azul** (#e3f2fd) = LOW
24
+ - 🟠 **Laranja** (#fff3e0) = MEDIUM
25
+ - 🔴 **Rosa** (#fce4ec) = HIGH
26
+
27
+ **Status:**
28
+ - ⏳ PENDING = cinza, stroke normal
29
+ - ⚙️ RUNNING = azul, stroke pontilhado
30
+ - ✅ DONE = verde
31
+ - ❌ FAILED = vermelho
32
+
33
+ **Posicionamento:**
34
+ - Cada task ocupa 120×60px
35
+ - Tasks no mesmo rank ficam lado a lado (swim lane)
36
+ - Setas conectam dependências
37
+
38
+ ## Exemplo de output
39
+
40
+ Arquivo `DARE/dag-graph.excalidraw` com estrutura:
41
+
42
+ ```
43
+ Rank 1
44
+ ├── task-001 (LOW, DONE)
45
+ ├── task-002 (HIGH, PENDING)
46
+
47
+ Rank 2
48
+ ├── task-003 (MEDIUM, RUNNING) ← depende de task-001
49
+ ├── task-004 (LOW, PENDING) ← depende de task-001
50
+
51
+ Rank 3
52
+ └── task-005 (HIGH, PENDING) ← depende de task-003 e task-004
53
+ ```
54
+
55
+ ## Como usar
56
+
57
+ ### Primeira vez
58
+
59
+ ```bash
60
+ /dare-dag-viz
61
+ ```
62
+
63
+ Claude Code vai:
64
+ 1. Ler `DARE/dare-dag.yaml`
65
+ 2. Gerar JSON `.excalidraw`
66
+ 3. Salvar em `DARE/dag-graph.excalidraw`
67
+ 4. Output: "✅ DAG gerado — abra em https://excalidraw.com"
68
+
69
+ ### Atualizar após mudanças
70
+
71
+ Sempre que você atualiza `dare-dag.yaml`:
72
+
73
+ ```bash
74
+ /dare-dag-viz
75
+ ```
76
+
77
+ Isso regenera o diagrama com as novas tasks/dependências.
78
+
79
+ ### Abrir e editar
80
+
81
+ 1. Acesse https://excalidraw.com
82
+ 2. File → Open → selecione `DARE/dag-graph.excalidraw`
83
+ 3. Edite livremente:
84
+ - Mova elementos
85
+ - Customize cores/textos
86
+ - Adicione anotações
87
+ 4. Salve no mesmo arquivo
88
+
89
+ Dica: Se editou manualmente e quer regenerar com `dare-dag-viz` de novo, faça backup antes.
90
+
91
+ ## Detalhes técnicos
92
+
93
+ ### Estrutura do JSON gerado
94
+
95
+ ```json
96
+ {
97
+ "elements": [
98
+ {
99
+ "id": "task-001",
100
+ "type": "rectangle",
101
+ "x": 20, "y": 20,
102
+ "width": 120, "height": 60,
103
+ "backgroundColor": "#e3f2fd",
104
+ "stroke": "#1976d2",
105
+ "text": "task-001\nSetup Auth\n[LOW]",
106
+ "fontSize": 12,
107
+ "roundness": { "type": 2, "value": 6 }
108
+ },
109
+ {
110
+ "type": "arrow",
111
+ "startBinding": { "elementId": "task-001" },
112
+ "endBinding": { "elementId": "task-003" },
113
+ "stroke": "#999"
114
+ }
115
+ ],
116
+ "appState": {
117
+ "gridMode": "grid",
118
+ "gridSize": 20
119
+ }
120
+ }
121
+ ```
122
+
123
+ ### Algoritmo de posicionamento
124
+
125
+ 1. **Calcular ranks** — depth-first do DAG
126
+ ```
127
+ rank = 1 + max(rank of dependencies)
128
+ ```
129
+
130
+ 2. **Agrupar por rank**
131
+ ```
132
+ Rank 1: [task-001, task-002]
133
+ Rank 2: [task-003, task-004]
134
+ ```
135
+
136
+ 3. **Posicionar**
137
+ ```
138
+ x = 20 + (taskIndex * 140)
139
+ y = 20 + (rank - 1) * 160
140
+ ```
141
+
142
+ 4. **Desenhar setas**
143
+ ```
144
+ Para cada depends_on: arrow(source → target)
145
+ ```
146
+
147
+ ## Campos esperados em dare-dag.yaml
148
+
149
+ ```yaml
150
+ tasks:
151
+ task-001:
152
+ name: "Setup Auth"
153
+ complexity: "LOW" # ← determina cor
154
+ rank: 1 # ← se não existir, é calculado
155
+ depends_on: [] # ← usada para setas
156
+ status: "DONE" # ← determina stroke/fill
157
+ subtask_prompt: "..." # ← (opcional)
158
+ ```
159
+
160
+ **Campos obrigatórios:** `name`, `complexity`
161
+ **Campos opcionais:** `rank` (calculado), `status` (default PENDING), `depends_on` (default [])
162
+
163
+ ## Troubleshooting
164
+
165
+ ### "File not found: DARE/dare-dag.yaml"
166
+ Certifique-se de que está em um projeto DARE. Se não, rode:
167
+ ```bash
168
+ dare discover
169
+ ```
170
+
171
+ ### "JSON inválido"
172
+ Valide seu `dare-dag.yaml`:
173
+ ```bash
174
+ dare dag validate
175
+ ```
176
+
177
+ ### Diagrama muito grande/pequeno
178
+ Abra em Excalidraw e ajuste com Ctrl+Mouse ou pinch zoom.
179
+
180
+ ## Próximos passos
181
+
182
+ - 🎨 Customize as cores em `docs/DESIGN-TOKENS-EXCALIDRAW.md`
183
+ - 📤 Exporte para PNG com botão "Export to Image" no Excalidraw
184
+ - 🔄 Atualize após cada `dare design` ou `dare execute`
185
+ - 📊 Compartilhe com stakeholders (Excalidraw é colaborativo)
186
+
187
+ ## Referência de design
188
+
189
+ Ver `/docs/DESIGN-TOKENS-EXCALIDRAW.md` para detalhes de cores, fonts, tamanhos, e créditos.
190
+
191
+ ## Licença
192
+
193
+ Esta skill é parte do DARE CLI e está sob AGPL v3.
194
+
195
+ Você pode usar, modificar e compartilhar — mas contribuições voltam ao DARE.
196
+
197
+ Créditos: Inspiração na [Excalidraw Diagram Skill](https://github.com/coleam00/excalidraw-diagram-skill) por Cole Medin.