kakaroto-config 1.0.1 → 1.0.2
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/bin/release.js +255 -0
- package/config/ARCHITECTURE.md +20 -26
- package/config/CLAUDE.md +4 -0
- package/config/agents/memory-sync.md +87 -19
- package/config/agents/test-fixer.md +24 -0
- package/config/agents/visual-validator.md +17 -0
- package/config/commands/debug/01-reproduce.md +65 -63
- package/config/commands/debug/02-investigate.md +40 -34
- package/config/commands/debug/03-fix.md +32 -45
- package/config/commands/debug/04-verify.md +108 -34
- package/config/commands/debug/05-commit.md +33 -3
- package/config/commands/debug/06-evaluate.md +137 -0
- package/config/commands/debug/playbooks/api.md +21 -0
- package/config/commands/debug/playbooks/backend.md +19 -0
- package/config/commands/debug/playbooks/infra.md +130 -0
- package/config/commands/debug/playbooks/integration.md +16 -0
- package/config/commands/debug/playbooks/job.md +19 -0
- package/config/commands/debug/playbooks/test.md +14 -0
- package/config/commands/debug/playbooks/ui.md +24 -0
- package/config/commands/debug/self-healing.md +99 -0
- package/config/commands/debug/techniques/flow-tracing.md +75 -0
- package/config/commands/debug/techniques/hypothesis-generation.md +30 -0
- package/config/commands/debug/techniques/sequential-thinking-config.md +79 -0
- package/config/commands/debug/templates/diagnosis-script.md +72 -0
- package/config/commands/debug/templates/reproduction-doc.md +60 -0
- package/config/commands/debug/templates/root-cause-doc.md +46 -0
- package/config/commands/debug/validators/criticality-gate.md +40 -0
- package/config/commands/debug/validators/evidence-requirements.md +48 -0
- package/config/commands/debug/validators/fix-permanence.md +56 -0
- package/config/commands/debug/validators/root-cause-validation.md +50 -0
- package/config/commands/debug.md +1 -1
- package/config/commands/feature/01-interview.md +82 -90
- package/config/commands/feature/02-spec.md +22 -98
- package/config/commands/feature/03-planner.md +81 -4
- package/config/commands/feature/04-implement.md +15 -8
- package/config/commands/feature/05-quality.md +23 -5
- package/config/commands/feature/06-commit.md +91 -0
- package/config/commands/feature/07-evaluate.md +129 -0
- package/config/commands/feature.md +1 -7
- package/config/templates/spec-template.md +92 -0
- package/package.json +4 -1
package/bin/release.js
ADDED
|
@@ -0,0 +1,255 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const fs = require('fs');
|
|
4
|
+
const path = require('path');
|
|
5
|
+
const os = require('os');
|
|
6
|
+
const readline = require('readline');
|
|
7
|
+
const { execFileSync } = require('child_process');
|
|
8
|
+
|
|
9
|
+
// Constants
|
|
10
|
+
const HOME_CLAUDE = path.join(os.homedir(), '.claude');
|
|
11
|
+
const PROJECT_ROOT = path.join(__dirname, '..');
|
|
12
|
+
const CONFIG_DIR = path.join(PROJECT_ROOT, 'config');
|
|
13
|
+
const PACKAGE_JSON = path.join(PROJECT_ROOT, 'package.json');
|
|
14
|
+
|
|
15
|
+
// Exclusions - personal files not to publish
|
|
16
|
+
const EXCLUDED_COMMANDS = ['audit-command', 'audit-command.md'];
|
|
17
|
+
|
|
18
|
+
// Semver validation regex
|
|
19
|
+
const SEMVER_REGEX = /^\d+\.\d+\.\d+$/;
|
|
20
|
+
|
|
21
|
+
// Readline interface
|
|
22
|
+
const rl = readline.createInterface({
|
|
23
|
+
input: process.stdin,
|
|
24
|
+
output: process.stdout
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
function question(prompt) {
|
|
28
|
+
return new Promise((resolve) => {
|
|
29
|
+
rl.question(prompt, resolve);
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
function cleanDir(dir) {
|
|
34
|
+
if (fs.existsSync(dir)) {
|
|
35
|
+
fs.rmSync(dir, { recursive: true, force: true });
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
function copyRecursive(src, dest, excludes = []) {
|
|
40
|
+
const stats = fs.statSync(src);
|
|
41
|
+
|
|
42
|
+
if (stats.isDirectory()) {
|
|
43
|
+
const baseName = path.basename(src);
|
|
44
|
+
if (excludes.includes(baseName)) {
|
|
45
|
+
return; // Skip excluded directories
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
if (!fs.existsSync(dest)) {
|
|
49
|
+
fs.mkdirSync(dest, { recursive: true });
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
const files = fs.readdirSync(src);
|
|
53
|
+
for (const file of files) {
|
|
54
|
+
if (excludes.includes(file)) {
|
|
55
|
+
continue; // Skip excluded files
|
|
56
|
+
}
|
|
57
|
+
copyRecursive(path.join(src, file), path.join(dest, file), excludes);
|
|
58
|
+
}
|
|
59
|
+
} else {
|
|
60
|
+
const baseName = path.basename(src);
|
|
61
|
+
if (excludes.includes(baseName)) {
|
|
62
|
+
return; // Skip excluded files
|
|
63
|
+
}
|
|
64
|
+
fs.copyFileSync(src, dest);
|
|
65
|
+
console.log(` + ${path.relative(CONFIG_DIR, dest)}`);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
function bumpVersion(version) {
|
|
70
|
+
if (!SEMVER_REGEX.test(version)) {
|
|
71
|
+
throw new Error(`Invalid semver format: ${version}. Expected X.Y.Z`);
|
|
72
|
+
}
|
|
73
|
+
const parts = version.split('.');
|
|
74
|
+
parts[2] = String(parseInt(parts[2], 10) + 1);
|
|
75
|
+
return parts.join('.');
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
function execCommandSafe(executable, args, description) {
|
|
79
|
+
console.log(`\n${description}...`);
|
|
80
|
+
try {
|
|
81
|
+
execFileSync(executable, args, { cwd: PROJECT_ROOT, stdio: 'inherit' });
|
|
82
|
+
return true;
|
|
83
|
+
} catch (err) {
|
|
84
|
+
console.error(`Error: ${err.message}`);
|
|
85
|
+
return false;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
function countFiles(dir, excludes = []) {
|
|
90
|
+
let count = 0;
|
|
91
|
+
if (!fs.existsSync(dir)) return 0;
|
|
92
|
+
|
|
93
|
+
const items = fs.readdirSync(dir);
|
|
94
|
+
for (const item of items) {
|
|
95
|
+
if (excludes.includes(item)) continue;
|
|
96
|
+
|
|
97
|
+
const fullPath = path.join(dir, item);
|
|
98
|
+
if (fs.statSync(fullPath).isDirectory()) {
|
|
99
|
+
count += countFiles(fullPath, excludes);
|
|
100
|
+
} else {
|
|
101
|
+
count++;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
return count;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
async function main() {
|
|
108
|
+
console.log('\n🥋 kakaroto-config - Release\n');
|
|
109
|
+
|
|
110
|
+
// Check ~/.claude exists
|
|
111
|
+
if (!fs.existsSync(HOME_CLAUDE)) {
|
|
112
|
+
console.error(`Error: ${HOME_CLAUDE} does not exist`);
|
|
113
|
+
rl.close();
|
|
114
|
+
process.exit(1);
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
// Read current version
|
|
118
|
+
let pkg;
|
|
119
|
+
try {
|
|
120
|
+
pkg = JSON.parse(fs.readFileSync(PACKAGE_JSON, 'utf8'));
|
|
121
|
+
} catch (err) {
|
|
122
|
+
console.error(`Error reading package.json: ${err.message}`);
|
|
123
|
+
rl.close();
|
|
124
|
+
process.exit(1);
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
const currentVersion = pkg.version;
|
|
128
|
+
let newVersion;
|
|
129
|
+
try {
|
|
130
|
+
newVersion = bumpVersion(currentVersion);
|
|
131
|
+
} catch (err) {
|
|
132
|
+
console.error(`Error: ${err.message}`);
|
|
133
|
+
rl.close();
|
|
134
|
+
process.exit(1);
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
// Count files to sync
|
|
138
|
+
const commandsCount = countFiles(path.join(HOME_CLAUDE, 'commands'), EXCLUDED_COMMANDS);
|
|
139
|
+
const agentsCount = countFiles(path.join(HOME_CLAUDE, 'agents'));
|
|
140
|
+
const templatesCount = countFiles(path.join(HOME_CLAUDE, 'templates'));
|
|
141
|
+
const totalFiles = commandsCount + agentsCount + templatesCount + 2; // +2 for CLAUDE.md and ARCHITECTURE.md
|
|
142
|
+
|
|
143
|
+
// Show preview
|
|
144
|
+
console.log('This will:');
|
|
145
|
+
console.log(` 1. Sync ${totalFiles} files from ~/.claude/ to config/`);
|
|
146
|
+
console.log(` - CLAUDE.md`);
|
|
147
|
+
console.log(` - ARCHITECTURE.md`);
|
|
148
|
+
console.log(` - commands/ (${commandsCount} files, excluding audit-command)`);
|
|
149
|
+
console.log(` - agents/ (${agentsCount} files)`);
|
|
150
|
+
console.log(` - templates/ (${templatesCount} files)`);
|
|
151
|
+
console.log(` 2. Bump version: ${currentVersion} → ${newVersion}`);
|
|
152
|
+
console.log(` 3. Git commit and push`);
|
|
153
|
+
console.log(` 4. Publish to npm\n`);
|
|
154
|
+
|
|
155
|
+
// Confirm
|
|
156
|
+
const answer = await question('Proceed with release? (Y/n): ');
|
|
157
|
+
if (answer.toLowerCase() === 'n') {
|
|
158
|
+
console.log('\nAborted. No changes made.');
|
|
159
|
+
rl.close();
|
|
160
|
+
process.exit(0);
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
console.log('\n--- Syncing files ---\n');
|
|
164
|
+
|
|
165
|
+
// Clean directories
|
|
166
|
+
cleanDir(path.join(CONFIG_DIR, 'commands'));
|
|
167
|
+
cleanDir(path.join(CONFIG_DIR, 'agents'));
|
|
168
|
+
cleanDir(path.join(CONFIG_DIR, 'templates'));
|
|
169
|
+
|
|
170
|
+
// Ensure config directory exists
|
|
171
|
+
if (!fs.existsSync(CONFIG_DIR)) {
|
|
172
|
+
fs.mkdirSync(CONFIG_DIR, { recursive: true });
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
// Copy files with existence check
|
|
176
|
+
const claudeMdPath = path.join(HOME_CLAUDE, 'CLAUDE.md');
|
|
177
|
+
if (fs.existsSync(claudeMdPath)) {
|
|
178
|
+
console.log('Copying CLAUDE.md...');
|
|
179
|
+
fs.copyFileSync(claudeMdPath, path.join(CONFIG_DIR, 'CLAUDE.md'));
|
|
180
|
+
console.log(' + CLAUDE.md');
|
|
181
|
+
} else {
|
|
182
|
+
console.warn('Warning: CLAUDE.md not found, skipping');
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
const archMdPath = path.join(HOME_CLAUDE, 'ARCHITECTURE.md');
|
|
186
|
+
if (fs.existsSync(archMdPath)) {
|
|
187
|
+
console.log('Copying ARCHITECTURE.md...');
|
|
188
|
+
fs.copyFileSync(archMdPath, path.join(CONFIG_DIR, 'ARCHITECTURE.md'));
|
|
189
|
+
console.log(' + ARCHITECTURE.md');
|
|
190
|
+
} else {
|
|
191
|
+
console.warn('Warning: ARCHITECTURE.md not found, skipping');
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
console.log('Copying commands/...');
|
|
195
|
+
copyRecursive(
|
|
196
|
+
path.join(HOME_CLAUDE, 'commands'),
|
|
197
|
+
path.join(CONFIG_DIR, 'commands'),
|
|
198
|
+
EXCLUDED_COMMANDS
|
|
199
|
+
);
|
|
200
|
+
|
|
201
|
+
console.log('Copying agents/...');
|
|
202
|
+
copyRecursive(
|
|
203
|
+
path.join(HOME_CLAUDE, 'agents'),
|
|
204
|
+
path.join(CONFIG_DIR, 'agents')
|
|
205
|
+
);
|
|
206
|
+
|
|
207
|
+
if (fs.existsSync(path.join(HOME_CLAUDE, 'templates'))) {
|
|
208
|
+
console.log('Copying templates/...');
|
|
209
|
+
copyRecursive(
|
|
210
|
+
path.join(HOME_CLAUDE, 'templates'),
|
|
211
|
+
path.join(CONFIG_DIR, 'templates')
|
|
212
|
+
);
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
// Update package.json
|
|
216
|
+
console.log('\n--- Updating version ---\n');
|
|
217
|
+
pkg.version = newVersion;
|
|
218
|
+
fs.writeFileSync(PACKAGE_JSON, JSON.stringify(pkg, null, 2) + '\n');
|
|
219
|
+
console.log(`Updated package.json: ${currentVersion} → ${newVersion}`);
|
|
220
|
+
|
|
221
|
+
// Git operations - use execCommandSafe for commands with user-derived values
|
|
222
|
+
if (!execCommandSafe('git', ['add', '.'], 'Staging changes')) {
|
|
223
|
+
rl.close();
|
|
224
|
+
process.exit(1);
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
// Use execCommandSafe to prevent command injection via newVersion
|
|
228
|
+
if (!execCommandSafe('git', ['commit', '-m', `release: v${newVersion}`], 'Creating commit')) {
|
|
229
|
+
rl.close();
|
|
230
|
+
process.exit(1);
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
if (!execCommandSafe('git', ['push'], 'Pushing to remote')) {
|
|
234
|
+
rl.close();
|
|
235
|
+
process.exit(1);
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
// npm publish
|
|
239
|
+
if (!execCommandSafe('npm', ['publish'], 'Publishing to npm')) {
|
|
240
|
+
rl.close();
|
|
241
|
+
process.exit(1);
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
console.log(`\n✅ Release complete! Published v${newVersion}\n`);
|
|
245
|
+
console.log('Users can update with:');
|
|
246
|
+
console.log(` npx kakaroto-config@${newVersion}\n`);
|
|
247
|
+
|
|
248
|
+
rl.close();
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
main().catch((err) => {
|
|
252
|
+
console.error(`Unexpected error: ${err.message}`);
|
|
253
|
+
rl.close();
|
|
254
|
+
process.exit(1);
|
|
255
|
+
});
|
package/config/ARCHITECTURE.md
CHANGED
|
@@ -97,11 +97,9 @@ Este documento descreve a arquitetura de configuracao do Claude Code, otimizada
|
|
|
97
97
|
│ │
|
|
98
98
|
│ ├── debug.md # /debug - orquestrador
|
|
99
99
|
│ ├── debug/
|
|
100
|
-
│ │ ├── 01-
|
|
101
|
-
│ │ ├── 02-
|
|
102
|
-
│ │
|
|
103
|
-
│ │ ├── 04-verify.md # Fase 4: confirmar fix
|
|
104
|
-
│ │ └── 05-commit.md # Fase 5: commit
|
|
100
|
+
│ │ ├── 01-investigate.md # Fase 1: 5 Whys
|
|
101
|
+
│ │ ├── 02-fix.md # Fase 2: correcao minima
|
|
102
|
+
│ │ └── 03-verify.md # Fase 3: confirmar fix
|
|
105
103
|
│ │
|
|
106
104
|
│ └── gate.md # /gate - quality gate completo
|
|
107
105
|
│
|
|
@@ -134,7 +132,8 @@ projeto/.claude/
|
|
|
134
132
|
│
|
|
135
133
|
├── settings.json # Config do Claude Code
|
|
136
134
|
├── visual-validation.json # Routes para visual-validator (opcional)
|
|
137
|
-
|
|
135
|
+
├── terraform-validation.json # Paths para terraform-validator (opcional)
|
|
136
|
+
└── debug-logs.json # Comandos para query de logs de producao (opcional)
|
|
138
137
|
```
|
|
139
138
|
|
|
140
139
|
**Personalizacoes por projeto:**
|
|
@@ -144,6 +143,7 @@ projeto/.claude/
|
|
|
144
143
|
| `commands/*.md` | Skills especificas (deploy, E2E, migrations) | Quando projeto tem workflows unicos |
|
|
145
144
|
| `visual-validation.json` | Mapeia components → routes para teste | Projetos com UI complexa |
|
|
146
145
|
| `terraform-validation.json` | Paths de env vars e terraform | Projetos com infra como codigo |
|
|
146
|
+
| `debug-logs.json` | Comandos para query de logs de producao | Projetos com logs em Cloud Logging, CloudWatch, etc. |
|
|
147
147
|
| `settings.json` | Modelo default, permissoes, etc. | Config avancada |
|
|
148
148
|
|
|
149
149
|
**CLAUDE.md do projeto deve conter:**
|
|
@@ -218,28 +218,22 @@ User: "erro ao publicar video"
|
|
|
218
218
|
│
|
|
219
219
|
▼
|
|
220
220
|
┌────────────────────────┐ ┌────────────────────────┐
|
|
221
|
-
│ 01-
|
|
222
|
-
│ -
|
|
223
|
-
│
|
|
224
|
-
│
|
|
225
|
-
└────────────────────────┘
|
|
221
|
+
│ 01-investigate.md │────►│ 02-fix.md │
|
|
222
|
+
│ - Reproduzir bug │ │ - Gate de criticidade│
|
|
223
|
+
│ - 5 Whys com │ │ - EnterPlanMode se │
|
|
224
|
+
│ EVIDENCIA │ │ path critico │
|
|
225
|
+
└────────────────────────┘ │ - Fix MINIMO │
|
|
226
|
+
│ - Testes obrigatorio │
|
|
227
|
+
└───────────┬────────────┘
|
|
226
228
|
│
|
|
227
229
|
▼
|
|
228
|
-
┌────────────────────────┐
|
|
229
|
-
│
|
|
230
|
-
│ -
|
|
231
|
-
│ -
|
|
232
|
-
│
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
▼
|
|
236
|
-
┌────────────────────────┐
|
|
237
|
-
│ 05-commit.md │
|
|
238
|
-
│ - Commit do fix │
|
|
239
|
-
│ - Padrao de mensagem │
|
|
240
|
-
│ - Memory sync se │
|
|
241
|
-
│ bug raro │
|
|
242
|
-
└────────────────────────┘
|
|
230
|
+
┌────────────────────────┐
|
|
231
|
+
│ 03-verify.md │
|
|
232
|
+
│ - Reproduzir fix │
|
|
233
|
+
│ - Quality gates │
|
|
234
|
+
│ - Salvar bug raro │
|
|
235
|
+
│ em MCP Memory │
|
|
236
|
+
└────────────────────────┘
|
|
243
237
|
```
|
|
244
238
|
|
|
245
239
|
### /gate (Quality Gate Antes de PR)
|
package/config/CLAUDE.md
CHANGED
|
@@ -22,3 +22,7 @@ Exceções: config files, .d.ts, UI puro sem lógica.
|
|
|
22
22
|
## Memory
|
|
23
23
|
Namespace: ver CLAUDE.md do projeto.
|
|
24
24
|
Sincronizar via `memory-sync` ao final de workflows.
|
|
25
|
+
|
|
26
|
+
## Auto-Avaliacao
|
|
27
|
+
Apos /feature e /debug: executar fase de avaliacao (07/06-evaluate).
|
|
28
|
+
Dual-loop sequential thinking: diagnostico → sintese → propor melhorias ao user.
|
|
@@ -15,14 +15,29 @@ Sincronizar conhecimento adquirido com MCP Memory apos desenvolvimento.
|
|
|
15
15
|
2. `git diff --stat` para entender escopo das mudancas
|
|
16
16
|
3. Identificar o prefixo do projeto via `mcp__memory__search_nodes({ query: "config" })`
|
|
17
17
|
|
|
18
|
-
## Fase 2: Verificar Entidades Existentes
|
|
18
|
+
## Fase 2: Verificar Entidades Existentes + Garbage Collection
|
|
19
19
|
|
|
20
20
|
1. `mcp__memory__read_graph()` para ver todas entidades do projeto
|
|
21
21
|
2. Filtrar entidades pelo prefixo do projeto (ex: `sm:` para social-medias)
|
|
22
|
-
3.
|
|
22
|
+
3. **CONTAR entidades do projeto atual**:
|
|
23
|
+
- Se > 50 entidades → executar Garbage Collection abaixo
|
|
24
|
+
- Se ≤ 50 → prosseguir normalmente
|
|
25
|
+
|
|
26
|
+
### Garbage Collection (se > 50 entidades)
|
|
27
|
+
|
|
28
|
+
Identificar e REMOVER:
|
|
29
|
+
|
|
30
|
+
| Candidata | Critério | Ação |
|
|
31
|
+
|-----------|----------|------|
|
|
32
|
+
| Bugs | entityType === "bug" | DELETE todos |
|
|
33
|
+
| Outros projetos | nome não começa com prefixo atual | DELETE |
|
|
34
|
+
| Versões duplicadas | nome contém "-v2", "-v3" | MERGE em original, DELETE versão |
|
|
35
|
+
| Arquivos inexistentes | observation referencia arquivo deletado | DELETE se única referência |
|
|
36
|
+
|
|
37
|
+
4. Para cada arquivo modificado/deletado:
|
|
23
38
|
- Buscar entidades que o referenciam (grep no campo observations)
|
|
24
|
-
- SE arquivo deletado -> marcar entidade para
|
|
25
|
-
- SE arquivo renomeado -> atualizar
|
|
39
|
+
- SE arquivo deletado -> marcar entidade para atualização
|
|
40
|
+
- SE arquivo renomeado -> atualizar referências
|
|
26
41
|
- SE comportamento mudou -> atualizar observations
|
|
27
42
|
|
|
28
43
|
## Fase 3: Atualizar Entidades Obsoletas
|
|
@@ -45,13 +60,15 @@ Avaliar o que foi desenvolvido e criar entidades conforme tabela:
|
|
|
45
60
|
|
|
46
61
|
| Situacao | Namespace | Criar? |
|
|
47
62
|
|----------|-----------|--------|
|
|
48
|
-
|
|
|
63
|
+
| Padrão novo implementado | `{prefix}:pattern:{nome}` | SIM |
|
|
49
64
|
| Fluxo complexo entendido | `{prefix}:fluxo:{nome}` | SIM |
|
|
50
|
-
|
|
|
51
|
-
|
|
|
52
|
-
| Tipo importante descoberto | `{prefix}:tipo:{nome}` | SE reutilizavel |
|
|
65
|
+
| Serviço novo/modificado significativamente | `{prefix}:servico:{nome}` | SE significativo |
|
|
66
|
+
| Tipo importante descoberto | `{prefix}:tipo:{nome}` | SE reutilizável |
|
|
53
67
|
| Procedimento documentado | `{prefix}:procedimento:{nome}` | SIM |
|
|
54
|
-
|
|
|
68
|
+
| Análise importante feita | `{prefix}:analise:{nome}` | SE referenciável |
|
|
69
|
+
| Config de projeto | `{prefix}:config:{nome}` | APENAS config:main |
|
|
70
|
+
|
|
71
|
+
**REMOVIDO**: `{prefix}:bug:{nome}` - bugs são efêmeros, fixes vão no código
|
|
55
72
|
|
|
56
73
|
### Criterio "Vale Salvar"
|
|
57
74
|
|
|
@@ -68,18 +85,34 @@ Avaliar o que foi desenvolvido e criar entidades conforme tabela:
|
|
|
68
85
|
- Detalhes de implementacao que mudam frequentemente
|
|
69
86
|
- Duplicatas de entidades existentes
|
|
70
87
|
|
|
88
|
+
### Pre-Flight Check (OBRIGATÓRIO antes de criar)
|
|
89
|
+
|
|
90
|
+
Antes de `mcp__memory__create_entities`, verificar:
|
|
91
|
+
|
|
92
|
+
```
|
|
93
|
+
[ ] Nome usa prefixo correto do projeto atual?
|
|
94
|
+
[ ] Nome está em kebab-case?
|
|
95
|
+
[ ] Não é um bug? (bugs não devem ser salvos)
|
|
96
|
+
[ ] Não existe entidade similar? (usar search_nodes)
|
|
97
|
+
[ ] Não é versão de entidade existente? (update, não create)
|
|
98
|
+
[ ] Máximo 10 observations?
|
|
99
|
+
[ ] Informação não é óbvia pelo código?
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
Se QUALQUER check falhar → NÃO CRIAR
|
|
103
|
+
|
|
71
104
|
### Formato de Entidade
|
|
72
105
|
|
|
73
106
|
```javascript
|
|
74
107
|
mcp__memory__create_entities({
|
|
75
108
|
entities: [{
|
|
76
109
|
name: "{prefix}:{tipo}:{nome-kebab-case}",
|
|
77
|
-
entityType: "{tipo}", // pattern,
|
|
110
|
+
entityType: "{tipo}", // pattern, fluxo, servico, etc. (NUNCA bug)
|
|
78
111
|
observations: [
|
|
79
|
-
"Primeira linha: resumo do que
|
|
112
|
+
"Primeira linha: resumo do que é",
|
|
80
113
|
"Segunda linha: arquivo principal: path/to/file.ts",
|
|
81
|
-
"Demais linhas: detalhes relevantes",
|
|
82
|
-
"
|
|
114
|
+
"Demais linhas: detalhes relevantes (max 8 linhas adicionais)",
|
|
115
|
+
"Última linha: quando/por que foi criado"
|
|
83
116
|
]
|
|
84
117
|
}]
|
|
85
118
|
})
|
|
@@ -110,13 +143,48 @@ Ao final, reportar:
|
|
|
110
143
|
- OU: Todas entidades ja estao atualizadas
|
|
111
144
|
```
|
|
112
145
|
|
|
113
|
-
## Regras
|
|
146
|
+
## Regras OBRIGATÓRIAS
|
|
147
|
+
|
|
148
|
+
### Namespace & Escopo
|
|
149
|
+
|
|
150
|
+
1. **Prefixo obrigatório**: TODA entidade DEVE usar o prefixo do projeto atual
|
|
151
|
+
2. **NUNCA criar entidades de outros projetos** (ex: `ga:`, `kk:` quando trabalhando em `sm:`)
|
|
152
|
+
3. **Validar namespace**: Antes de criar, verificar se prefixo corresponde ao projeto
|
|
153
|
+
|
|
154
|
+
### Controle de Tamanho
|
|
155
|
+
|
|
156
|
+
4. **Max 10 observations por entidade**: Se precisar de mais, dividir em entidades relacionadas
|
|
157
|
+
5. **Max 50 entidades por projeto**: Se ultrapassar, fazer garbage collection
|
|
158
|
+
6. **Nomes kebab-case**: `sm:pattern:graceful-shutdown`, não `sm:pattern:GracefulShutdown`
|
|
159
|
+
7. **Observations atômicas**: Uma informação por linha, fácil de deletar/atualizar
|
|
160
|
+
|
|
161
|
+
### O que NÃO salvar
|
|
162
|
+
|
|
163
|
+
8. **NUNCA salvar bugs como entidades** - bugs são efêmeros, fixes vão no código
|
|
164
|
+
- Exception: Bug recorrente que revela pattern arquitetural → salvar como `pattern:`
|
|
165
|
+
9. **NUNCA criar versões** (v2, v3) - ATUALIZAR a entidade existente
|
|
166
|
+
10. **NUNCA duplicar**: Buscar entidade similar antes de criar (`search_nodes`)
|
|
167
|
+
11. **Minimalismo radical**: Na dúvida, NÃO salvar
|
|
168
|
+
|
|
169
|
+
### Garbage Collection (executar se >50 entidades)
|
|
170
|
+
|
|
171
|
+
```javascript
|
|
172
|
+
// Identificar candidatas a remoção:
|
|
173
|
+
// 1. Entidades que referenciam arquivos deletados
|
|
174
|
+
// 2. Entidades com >15 observations (muito verbosas)
|
|
175
|
+
// 3. Entidades com informação duplicada de outra
|
|
176
|
+
// 4. Bugs antigos (>30 dias)
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
### Anti-Patterns a EVITAR
|
|
114
180
|
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
181
|
+
| Anti-Pattern | Exemplo | Correção |
|
|
182
|
+
|--------------|---------|----------|
|
|
183
|
+
| Bug como entidade | `sm:bug:login-error` | DELETE - fix está no código |
|
|
184
|
+
| Versões separadas | `sm:pattern:X-v2` | UPDATE `sm:pattern:X` |
|
|
185
|
+
| Cross-project | `ga:feature:Y` no sm: | DELETE - pertence a outro projeto |
|
|
186
|
+
| Observations demais | 17 observations | Condensar em 8-10 |
|
|
187
|
+
| Tipo duplicado | `pattern` + `padrao` | Usar apenas `pattern` |
|
|
120
188
|
|
|
121
189
|
---
|
|
122
190
|
|
|
@@ -58,6 +58,30 @@ npm run test
|
|
|
58
58
|
|
|
59
59
|
---
|
|
60
60
|
|
|
61
|
+
## Step Extra: CRUD Smoke Test (SE nova entidade)
|
|
62
|
+
|
|
63
|
+
**Trigger:** Arquivo em `api/handlers/` com novo endpoint POST/PUT criado.
|
|
64
|
+
|
|
65
|
+
1. Identificar endpoints novos:
|
|
66
|
+
```bash
|
|
67
|
+
git diff --name-only HEAD~1 | grep 'api/handlers/'
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
2. Para cada arquivo de handler modificado:
|
|
71
|
+
- Buscar métodos POST/PUT/DELETE
|
|
72
|
+
- Construir payload de teste válido
|
|
73
|
+
- Executar request contra servidor local (se rodando)
|
|
74
|
+
- Verificar response 200/201
|
|
75
|
+
|
|
76
|
+
3. Reportar:
|
|
77
|
+
- Endpoints testados
|
|
78
|
+
- Resultados (PASS/FAIL)
|
|
79
|
+
- Erros encontrados
|
|
80
|
+
|
|
81
|
+
**Nota:** Este step é condicional. Só executar se houver novos endpoints CRUD.
|
|
82
|
+
|
|
83
|
+
---
|
|
84
|
+
|
|
61
85
|
## Test Creation Guidelines
|
|
62
86
|
|
|
63
87
|
### File Location
|
|
@@ -138,6 +138,23 @@ For each modified component file:
|
|
|
138
138
|
|
|
139
139
|
---
|
|
140
140
|
|
|
141
|
+
### 6.5 Form Submit Test (SE form modificado)
|
|
142
|
+
|
|
143
|
+
**Trigger:** Arquivo `*FormModal.tsx` ou `*Form.tsx` modificado.
|
|
144
|
+
|
|
145
|
+
1. Identificar forms modificados via git diff
|
|
146
|
+
2. Navegar ao form (browser_navigate)
|
|
147
|
+
3. Preencher campos com dados válidos (browser_fill_form)
|
|
148
|
+
4. Clicar submit
|
|
149
|
+
5. Verificar:
|
|
150
|
+
- Sem erros de console
|
|
151
|
+
- Toast/mensagem de sucesso aparece
|
|
152
|
+
- Modal fecha ou redireciona
|
|
153
|
+
|
|
154
|
+
**Nota:** Step condicional. Só executar se form de criação/edição foi modificado.
|
|
155
|
+
|
|
156
|
+
---
|
|
157
|
+
|
|
141
158
|
### 7. Fix Loop (Max 3 Attempts)
|
|
142
159
|
|
|
143
160
|
```
|