up-cc 0.4.5 → 0.4.6
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/commands/testar.md +287 -0
- package/package.json +1 -1
|
@@ -0,0 +1,287 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: up:testar
|
|
3
|
+
description: Testar projeto completo — descobre todas paginas e APIs, clica em tudo, testa tudo, corrige o que puder
|
|
4
|
+
argument-hint: "[url ou porta] [--no-fix] [--report-only]"
|
|
5
|
+
allowed-tools:
|
|
6
|
+
- Read
|
|
7
|
+
- Write
|
|
8
|
+
- Edit
|
|
9
|
+
- Glob
|
|
10
|
+
- Grep
|
|
11
|
+
- Bash
|
|
12
|
+
- Task
|
|
13
|
+
- mcp__plugin_playwright_playwright__*
|
|
14
|
+
---
|
|
15
|
+
<objective>
|
|
16
|
+
Testar um projeto existente de forma exaustiva. Descobre TODAS as paginas e APIs pelo codigo fonte, roda os 3 detectores DCRV (Visual Critic, Exhaustive Tester, API Tester), corrige issues encontradas, e gera relatorio completo.
|
|
17
|
+
|
|
18
|
+
NAO planeja, NAO cria features, NAO faz auditoria de codigo. Apenas TESTA e CORRIGE.
|
|
19
|
+
|
|
20
|
+
**Standalone:** Funciona em qualquer projeto, qualquer momento. NAO requer .plano/ ou /up:novo-projeto.
|
|
21
|
+
**Diferencial:** Teste objetivo — clica em tudo, testa todo endpoint, verifica visual. Nao opina sobre UX.
|
|
22
|
+
|
|
23
|
+
**Output:** `.plano/teste/` com DCRV-REPORT.md, issues resolvidas, screenshots.
|
|
24
|
+
</objective>
|
|
25
|
+
|
|
26
|
+
<execution_context>
|
|
27
|
+
@~/.claude/up/workflows/dcrv.md
|
|
28
|
+
@~/.claude/up/references/engineering-principles.md
|
|
29
|
+
</execution_context>
|
|
30
|
+
|
|
31
|
+
<context>
|
|
32
|
+
$ARGUMENTS
|
|
33
|
+
|
|
34
|
+
**Argumentos opcionais:**
|
|
35
|
+
- URL ou porta: `http://localhost:3000` ou `3000` (default: detecta automaticamente)
|
|
36
|
+
- `--no-fix`: Apenas gerar relatorio, NAO corrigir issues
|
|
37
|
+
- `--report-only`: Alias para --no-fix
|
|
38
|
+
|
|
39
|
+
**Se sem argumentos:** Detecta stack, sobe dev server automaticamente, usa porta padrao.
|
|
40
|
+
**Se .plano/ existe:** Usa PROJECT.md para entender o projeto.
|
|
41
|
+
**Se .plano/ NAO existe:** Descobre tudo pelo codigo fonte.
|
|
42
|
+
</context>
|
|
43
|
+
|
|
44
|
+
<process>
|
|
45
|
+
|
|
46
|
+
## Passo 1: Setup
|
|
47
|
+
|
|
48
|
+
### 1.1 Detectar Stack e Dev Server
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
# Detectar stack
|
|
52
|
+
if [ -f package.json ]; then
|
|
53
|
+
node -e "const p=require('./package.json'); console.log(JSON.stringify({name: p.name, scripts: p.scripts, deps: Object.keys(p.dependencies||{}).slice(0,20)}))"
|
|
54
|
+
fi
|
|
55
|
+
if [ -f requirements.txt ] || [ -f pyproject.toml ]; then
|
|
56
|
+
echo "Python project detected"
|
|
57
|
+
fi
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
Definir $PORT a partir dos argumentos ou detectar automaticamente.
|
|
61
|
+
|
|
62
|
+
### 1.2 Subir Dev Server
|
|
63
|
+
|
|
64
|
+
```bash
|
|
65
|
+
# Verificar se ja esta rodando
|
|
66
|
+
curl -s http://localhost:${PORT:-3000} > /dev/null 2>&1
|
|
67
|
+
if [ $? -ne 0 ]; then
|
|
68
|
+
# Detectar comando de dev
|
|
69
|
+
if [ -f package.json ]; then
|
|
70
|
+
npm run dev > /tmp/up-testar-server.log 2>&1 &
|
|
71
|
+
TESTAR_DEV_PID=$!
|
|
72
|
+
elif [ -f manage.py ]; then
|
|
73
|
+
python manage.py runserver > /tmp/up-testar-server.log 2>&1 &
|
|
74
|
+
TESTAR_DEV_PID=$!
|
|
75
|
+
fi
|
|
76
|
+
|
|
77
|
+
# Esperar ficar pronto (max 30s)
|
|
78
|
+
for i in $(seq 1 30); do
|
|
79
|
+
curl -s http://localhost:${PORT:-3000} > /dev/null 2>&1 && break
|
|
80
|
+
sleep 1
|
|
81
|
+
done
|
|
82
|
+
fi
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
Se nao subir: ERRO — informar usuario.
|
|
86
|
+
|
|
87
|
+
### 1.3 Descobrir TODAS as Paginas
|
|
88
|
+
|
|
89
|
+
```bash
|
|
90
|
+
echo "=== Descobrindo paginas ==="
|
|
91
|
+
|
|
92
|
+
# Next.js App Router
|
|
93
|
+
find app -name "page.tsx" -o -name "page.ts" 2>/dev/null | grep -v node_modules | sort
|
|
94
|
+
|
|
95
|
+
# Next.js Pages Router
|
|
96
|
+
find pages -name "*.tsx" -o -name "*.ts" 2>/dev/null | grep -v node_modules | grep -v "_app\|_document\|api/" | sort
|
|
97
|
+
|
|
98
|
+
# React Router (Vite/CRA) — extrair paths
|
|
99
|
+
grep -rn "path:" src/ --include="*.tsx" --include="*.ts" --include="*.jsx" --include="*.js" 2>/dev/null | grep -v node_modules | head -30
|
|
100
|
+
|
|
101
|
+
# Python (Django)
|
|
102
|
+
grep -rn "path(" */urls.py 2>/dev/null | head -20
|
|
103
|
+
|
|
104
|
+
# Python (FastAPI) com templates
|
|
105
|
+
grep -rn "templates.TemplateResponse\|return.*html" . --include="*.py" 2>/dev/null | head -20
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
Converter caminhos de arquivo para URLs:
|
|
109
|
+
- `app/page.tsx` → `/`
|
|
110
|
+
- `app/dashboard/page.tsx` → `/dashboard`
|
|
111
|
+
- `app/settings/[tab]/page.tsx` → `/settings/general` (usar primeiro valor provavel)
|
|
112
|
+
- `pages/about.tsx` → `/about`
|
|
113
|
+
|
|
114
|
+
Montar lista `$ROUTES_UI`.
|
|
115
|
+
|
|
116
|
+
### 1.4 Descobrir TODAS as APIs
|
|
117
|
+
|
|
118
|
+
```bash
|
|
119
|
+
echo "=== Descobrindo APIs ==="
|
|
120
|
+
|
|
121
|
+
# Next.js App Router API routes
|
|
122
|
+
find app -path "*/api/*" -name "route.ts" -o -name "route.js" 2>/dev/null | grep -v node_modules | sort
|
|
123
|
+
|
|
124
|
+
# Para cada route.ts, extrair metodos exportados
|
|
125
|
+
for route in $(find app -path "*/api/*" -name "route.ts" 2>/dev/null); do
|
|
126
|
+
methods=$(grep -oE "export.*(async )?(function )?(GET|POST|PUT|PATCH|DELETE)" "$route" | grep -oE "GET|POST|PUT|PATCH|DELETE")
|
|
127
|
+
echo "$route: $methods"
|
|
128
|
+
done
|
|
129
|
+
|
|
130
|
+
# Next.js Pages Router API
|
|
131
|
+
find pages/api -name "*.ts" -o -name "*.js" 2>/dev/null | sort
|
|
132
|
+
|
|
133
|
+
# Express/Fastify
|
|
134
|
+
grep -rn "app\.\(get\|post\|put\|patch\|delete\)\|router\.\(get\|post\|put\|patch\|delete\)" src/ --include="*.ts" --include="*.js" 2>/dev/null | head -30
|
|
135
|
+
|
|
136
|
+
# FastAPI (Python)
|
|
137
|
+
grep -rn "@app\.\(get\|post\|put\|patch\|delete\)\|@router\.\(get\|post\|put\|patch\|delete\)" . --include="*.py" 2>/dev/null | head -30
|
|
138
|
+
|
|
139
|
+
# tRPC
|
|
140
|
+
grep -rn "\.query\|\.mutation" src/ --include="*.ts" 2>/dev/null | grep -i "router\|procedure" | head -20
|
|
141
|
+
|
|
142
|
+
# Supabase Edge Functions
|
|
143
|
+
ls supabase/functions/*/index.ts 2>/dev/null
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
Montar lista `$ROUTES_API` com metodo + path.
|
|
147
|
+
|
|
148
|
+
### 1.5 Classificar Projeto e Reportar
|
|
149
|
+
|
|
150
|
+
```
|
|
151
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
152
|
+
UP > TESTAR — DESCOBERTA COMPLETA
|
|
153
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
154
|
+
|
|
155
|
+
Projeto: [nome do package.json ou diretorio]
|
|
156
|
+
Stack: [Next.js / Vite / FastAPI / etc.]
|
|
157
|
+
Dev server: http://localhost:{PORT}
|
|
158
|
+
|
|
159
|
+
Paginas encontradas: {N}
|
|
160
|
+
[lista de URLs]
|
|
161
|
+
|
|
162
|
+
APIs encontradas: {N}
|
|
163
|
+
[lista de METHOD /path]
|
|
164
|
+
|
|
165
|
+
Detectores a rodar:
|
|
166
|
+
[x] Visual Critic ({N} paginas × 3 viewports)
|
|
167
|
+
[x] Exhaustive Tester ({N} paginas, todos elementos)
|
|
168
|
+
[x] API Tester ({N} endpoints, bateria completa)
|
|
169
|
+
|
|
170
|
+
Iniciando testes...
|
|
171
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
### 1.6 Criar Diretorio de Resultados
|
|
175
|
+
|
|
176
|
+
```bash
|
|
177
|
+
mkdir -p .plano/teste
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
## Passo 2: Rodar DCRV Global
|
|
181
|
+
|
|
182
|
+
**Referencia:** `@~/.claude/up/workflows/dcrv.md`
|
|
183
|
+
|
|
184
|
+
Determinar AUTO_FIX baseado nas flags:
|
|
185
|
+
- Se `--no-fix` ou `--report-only`: AUTO_FIX=false
|
|
186
|
+
- Senao: AUTO_FIX=true
|
|
187
|
+
|
|
188
|
+
Executar workflow DCRV com parametros:
|
|
189
|
+
```
|
|
190
|
+
SCOPE=global
|
|
191
|
+
PORT={porta do dev server}
|
|
192
|
+
MAX_CYCLES=3
|
|
193
|
+
MAX_ISSUES_PER_CYCLE=20
|
|
194
|
+
AUTO_FIX={true ou false baseado nas flags}
|
|
195
|
+
ROUTES_UI={lista de paginas descobertas}
|
|
196
|
+
ROUTES_API={lista de APIs descobertas}
|
|
197
|
+
DCRV_DIR=.plano/teste
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
O DCRV cuida de:
|
|
201
|
+
1. Rodar Visual Critic em todas paginas (3 viewports, CSS extraction, screenshots)
|
|
202
|
+
2. Rodar API Tester em todas rotas (happy path, payloads invalidos, auth, edge cases)
|
|
203
|
+
3. Rodar Exhaustive Tester em todas paginas (clicar em CADA elemento)
|
|
204
|
+
4. Consolidar issues
|
|
205
|
+
5. Se AUTO_FIX: dispatcher roteia para especialistas corrigirem
|
|
206
|
+
6. Re-verificar correcoes
|
|
207
|
+
7. Loop ate resolver ou max ciclos
|
|
208
|
+
|
|
209
|
+
## Passo 3: Carregar Design Tokens (se existir)
|
|
210
|
+
|
|
211
|
+
```bash
|
|
212
|
+
# Checar se projeto tem design tokens definidos
|
|
213
|
+
cat .plano/DESIGN-TOKENS.md 2>/dev/null
|
|
214
|
+
# Ou inferir do Tailwind config
|
|
215
|
+
cat tailwind.config.ts tailwind.config.js 2>/dev/null | head -50
|
|
216
|
+
# Ou de globals.css
|
|
217
|
+
cat app/globals.css src/globals.css styles/globals.css 2>/dev/null | head -50
|
|
218
|
+
```
|
|
219
|
+
|
|
220
|
+
Passar como referencia para o Visual Critic.
|
|
221
|
+
|
|
222
|
+
## Passo 4: Cleanup
|
|
223
|
+
|
|
224
|
+
```bash
|
|
225
|
+
# Matar dev server se nos que subimos
|
|
226
|
+
if [ -n "$TESTAR_DEV_PID" ]; then
|
|
227
|
+
kill $TESTAR_DEV_PID 2>/dev/null
|
|
228
|
+
fi
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
Fechar browser se aberto.
|
|
232
|
+
|
|
233
|
+
## Passo 5: Apresentar Resultado
|
|
234
|
+
|
|
235
|
+
```
|
|
236
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
237
|
+
UP > TESTE COMPLETO
|
|
238
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
239
|
+
|
|
240
|
+
## Scores
|
|
241
|
+
|
|
242
|
+
| Detector | Score | Detalhes |
|
|
243
|
+
|----------|-------|----------|
|
|
244
|
+
| Visual | {N}/10 | {issues} issues em {paginas} paginas |
|
|
245
|
+
| Interacao | {N}% pass | {passed}/{total} elementos funcionam |
|
|
246
|
+
| API | {N}% pass | {passed}/{total} testes passaram |
|
|
247
|
+
|
|
248
|
+
## Issues
|
|
249
|
+
|
|
250
|
+
| Severidade | Encontradas | Corrigidas | Pendentes |
|
|
251
|
+
|-----------|-------------|-----------|-----------|
|
|
252
|
+
| Critical | {N} | {N} | {N} |
|
|
253
|
+
| High | {N} | {N} | {N} |
|
|
254
|
+
| Medium | {N} | {N} | {N} |
|
|
255
|
+
| Low | {N} | — | {N} |
|
|
256
|
+
|
|
257
|
+
## Top Issues Pendentes (se houver)
|
|
258
|
+
|
|
259
|
+
[Lista das issues nao corrigidas com descricao]
|
|
260
|
+
|
|
261
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
262
|
+
|
|
263
|
+
Relatorio completo: .plano/teste/DCRV-REPORT.md
|
|
264
|
+
Screenshots: .plano/teste/
|
|
265
|
+
|
|
266
|
+
Proximos passos:
|
|
267
|
+
- /up:ux-tester — avaliar experiencia do usuario
|
|
268
|
+
- /up:melhorias — auditoria de codigo
|
|
269
|
+
- /up:modo-builder "nova feature" — adicionar funcionalidade
|
|
270
|
+
|
|
271
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
272
|
+
```
|
|
273
|
+
|
|
274
|
+
</process>
|
|
275
|
+
|
|
276
|
+
<success_criteria>
|
|
277
|
+
- [ ] Stack detectada e dev server rodando
|
|
278
|
+
- [ ] TODAS paginas descobertas pelo codigo fonte
|
|
279
|
+
- [ ] TODAS APIs descobertas pelo codigo fonte
|
|
280
|
+
- [ ] Visual Critic rodou em todas paginas (3 viewports)
|
|
281
|
+
- [ ] Exhaustive Tester clicou em todos elementos de todas paginas
|
|
282
|
+
- [ ] API Tester testou todos endpoints com bateria completa
|
|
283
|
+
- [ ] Issues consolidadas com severidade
|
|
284
|
+
- [ ] Issues corrigidas (se nao --no-fix)
|
|
285
|
+
- [ ] DCRV-REPORT.md gerado em .plano/teste/
|
|
286
|
+
- [ ] Resumo apresentado com scores
|
|
287
|
+
</success_criteria>
|