decision-memory 0.1.4 → 0.1.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/dist/index.cjs
CHANGED
|
@@ -3440,12 +3440,34 @@ function initCommand(options) {
|
|
|
3440
3440
|
} else {
|
|
3441
3441
|
fs2.writeFileSync(gitattributes, entry);
|
|
3442
3442
|
}
|
|
3443
|
+
const integrationSrc = path2.join(__dirname, "..", "integrations", "claude-code");
|
|
3444
|
+
if (fs2.existsSync(integrationSrc)) {
|
|
3445
|
+
copyIntegrationFiles(integrationSrc, dir);
|
|
3446
|
+
}
|
|
3443
3447
|
console.log(`\u2713 ${filePath} olu\u015Fturuldu.`);
|
|
3444
3448
|
console.log(`\u2713 .gitattributes g\xFCncellendi.`);
|
|
3449
|
+
console.log(`\u2713 .mcp.json, CLAUDE.md, .claude/ kopyaland\u0131.`);
|
|
3450
|
+
console.log(`
|
|
3451
|
+
Sonraki ad\u0131m: Claude Code'u yeniden ba\u015Flat\u0131n (MCP sunucusu ba\u011Flanacak).`);
|
|
3445
3452
|
console.log(`
|
|
3446
|
-
|
|
3447
|
-
console.log(` decision-memory log
|
|
3448
|
-
console.log(` decision-memory summary
|
|
3453
|
+
Komutlar:`);
|
|
3454
|
+
console.log(` decision-memory log # yeni karar ekle`);
|
|
3455
|
+
console.log(` decision-memory summary # \xF6zet g\xF6r\xFCnt\xFCle`);
|
|
3456
|
+
}
|
|
3457
|
+
function copyIntegrationFiles(src, dest) {
|
|
3458
|
+
const entries = fs2.readdirSync(src, { withFileTypes: true });
|
|
3459
|
+
for (const entry of entries) {
|
|
3460
|
+
const srcPath = path2.join(src, entry.name);
|
|
3461
|
+
const destPath = path2.join(dest, entry.name);
|
|
3462
|
+
if (entry.isDirectory()) {
|
|
3463
|
+
fs2.mkdirSync(destPath, { recursive: true });
|
|
3464
|
+
copyIntegrationFiles(srcPath, destPath);
|
|
3465
|
+
} else {
|
|
3466
|
+
if (!fs2.existsSync(destPath)) {
|
|
3467
|
+
fs2.copyFileSync(srcPath, destPath);
|
|
3468
|
+
}
|
|
3469
|
+
}
|
|
3470
|
+
}
|
|
3449
3471
|
}
|
|
3450
3472
|
|
|
3451
3473
|
// packages/cli/src/commands/log.ts
|
|
@@ -3541,7 +3563,7 @@ function summaryCommand(options) {
|
|
|
3541
3563
|
|
|
3542
3564
|
// packages/cli/src/index.ts
|
|
3543
3565
|
var program2 = new Command();
|
|
3544
|
-
program2.name("decision-memory").description("Claude Code i\xE7in karar haf\u0131zas\u0131 arac\u0131").version("0.1.
|
|
3566
|
+
program2.name("decision-memory").description("Claude Code i\xE7in karar haf\u0131zas\u0131 arac\u0131").version("0.1.6");
|
|
3545
3567
|
program2.command("init").description("Proje k\xF6k\xFCnde DECISIONS.toon dosyas\u0131 olu\u015Fturur").option("-p, --project <name>", "Proje ad\u0131").option("-d, --dir <path>", "Dizin (varsay\u0131lan: \xE7al\u0131\u015Fma dizini)").action((options) => initCommand(options));
|
|
3546
3568
|
program2.command("log").description("Yeni bir karar ekler (interaktif veya flag'lerle)").option("-t, --topic <topic>", "Konu (\xF6rn: auth, database)").option("-d, --decision <text>", "Al\u0131nan karar").option("-r, --rationale <text>", "Gerek\xE7e").option("-i, --impact <level>", "Etki: low|medium|high|critical").option("--tags <tags>", "Etiketler (virg\xFClle ayr\u0131lm\u0131\u015F)").option("-f, --file <path>", "DECISIONS.toon dosya yolu").action(async (options) => {
|
|
3547
3569
|
await logCommand(options);
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* decision-nudge.js — Claude Code PostToolUse hook
|
|
4
|
+
*
|
|
5
|
+
* Write, Edit veya MultiEdit araçları çalıştıktan sonra tetiklenir.
|
|
6
|
+
* Claude'un bağlamına kısa bir hatırlatma enjekte eder:
|
|
7
|
+
* "Mimari bir karar aldıysan log_decision çağır."
|
|
8
|
+
*
|
|
9
|
+
* Çıktı formatı: { "additionalContext": "..." }
|
|
10
|
+
* Bu, Claude'un mevcut konuşma bağlamına eklenir.
|
|
11
|
+
*
|
|
12
|
+
* ÖNEMLİ: Hook'lar çok sık tetiklenirse noise oluşturabilir.
|
|
13
|
+
* Bu yüzden mesaj kasıtlı olarak çok kısa tutulmuştur.
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
// stdin'den hook verilerini oku
|
|
17
|
+
let inputData = "";
|
|
18
|
+
process.stdin.setEncoding("utf-8");
|
|
19
|
+
process.stdin.on("data", (chunk) => {
|
|
20
|
+
inputData += chunk;
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
process.stdin.on("end", () => {
|
|
24
|
+
let toolName = "unknown";
|
|
25
|
+
|
|
26
|
+
try {
|
|
27
|
+
const data = JSON.parse(inputData);
|
|
28
|
+
toolName = data.tool_name ?? "unknown";
|
|
29
|
+
} catch {
|
|
30
|
+
// JSON parse başarısız — yine de devam et
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
// Sadece dosya değiştiren tool'larda tetikle
|
|
34
|
+
const fileModifyingTools = ["Write", "Edit", "MultiEdit"];
|
|
35
|
+
if (!fileModifyingTools.includes(toolName)) {
|
|
36
|
+
process.exit(0);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
const nudge = {
|
|
40
|
+
additionalContext:
|
|
41
|
+
"KARAR HATIRLATMA: Bu değişiklik mimari bir karar içeriyorsa (teknoloji seçimi, " +
|
|
42
|
+
"yaklaşım tercihi, API tasarımı, güvenlik kararı) `log_decision` MCP aracını hemen çağır. " +
|
|
43
|
+
"Sıradan kod değişikliklerinde çağırma.",
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
process.stdout.write(JSON.stringify(nudge));
|
|
47
|
+
process.exit(0);
|
|
48
|
+
});
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
# Karar Hafızası (Decision Memory)
|
|
2
|
+
|
|
3
|
+
Bu proje `decision-memory` sistemini kullanmaktadır. Proje kararları `DECISIONS.toon` dosyasında saklanır.
|
|
4
|
+
|
|
5
|
+
## Oturum Başında
|
|
6
|
+
|
|
7
|
+
Her oturumun başında şu aracı çağır:
|
|
8
|
+
|
|
9
|
+
```
|
|
10
|
+
get_context_summary(include_recent=true)
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Bu, önceki kararların kompakt özetini (~200 token) döndürür.
|
|
14
|
+
|
|
15
|
+
## Karar Almadan Önce
|
|
16
|
+
|
|
17
|
+
Mimari veya tasarım kararı vermeden önce:
|
|
18
|
+
|
|
19
|
+
```
|
|
20
|
+
search_decisions(keywords=["ilgili-konu"], tags=["ilgili-tag"])
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
Eğer daha önce aynı konuda karar alındıysa o karara uy veya `update_decision` ile güncelle.
|
|
24
|
+
|
|
25
|
+
## Karar Aldıktan Hemen Sonra
|
|
26
|
+
|
|
27
|
+
Önemli bir tercih yaptıktan sonra hemen kaydet:
|
|
28
|
+
|
|
29
|
+
```
|
|
30
|
+
log_decision(
|
|
31
|
+
topic="konu",
|
|
32
|
+
decision="Alınan somut karar",
|
|
33
|
+
rationale="Neden bu tercih? Alternatifler neden elendi?",
|
|
34
|
+
impact="high",
|
|
35
|
+
tags=["tag1", "tag2"]
|
|
36
|
+
)
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
**Erteleme. Kararı o an kaydet.**
|
|
40
|
+
|
|
41
|
+
## Kaydedilmesi Gereken Kararlar
|
|
42
|
+
|
|
43
|
+
- Teknoloji/kütüphane seçimi (hangi DB, hangi auth, hangi framework)
|
|
44
|
+
- Mimari yaklaşım (REST vs GraphQL, monolith vs microservice)
|
|
45
|
+
- Güvenlik kararları (şifreleme yöntemi, token stratejisi)
|
|
46
|
+
- Veri modeli değişiklikleri (yeni tablo, field kaldırma/ekleme)
|
|
47
|
+
- API tasarım kararları (endpoint yapısı, versiyonlama stratejisi)
|
|
48
|
+
- Test stratejisi (hangi test framework, coverage hedefi)
|
|
49
|
+
|
|
50
|
+
## Kaydedilmemesi Gereken Şeyler
|
|
51
|
+
|
|
52
|
+
- Değişken isimlendirme, kod formatı
|
|
53
|
+
- Küçük refactorlar (mantık değişmiyorsa)
|
|
54
|
+
- Bug düzeltmeleri (mimari etkileri yoksa)
|
|
55
|
+
- Yorum ekleme, dokümantasyon güncellemeleri
|
|
56
|
+
|
|
57
|
+
## Önceki Karar Değiştiğinde
|
|
58
|
+
|
|
59
|
+
```
|
|
60
|
+
update_decision(
|
|
61
|
+
supersedes_id="D003",
|
|
62
|
+
topic="konu",
|
|
63
|
+
decision="Yeni karar",
|
|
64
|
+
rationale="Neden değişti?",
|
|
65
|
+
impact="high",
|
|
66
|
+
tags=["tag1"]
|
|
67
|
+
)
|
|
68
|
+
```
|
package/package.json
CHANGED
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "decision-memory",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.6",
|
|
4
4
|
"description": "Claude Code için karar hafızası — CLI ve MCP server",
|
|
5
5
|
"bin": {
|
|
6
6
|
"decision-memory": "./dist/index.cjs",
|
|
7
7
|
"decision-memory-mcp": "./dist/mcp.cjs"
|
|
8
8
|
},
|
|
9
9
|
"scripts": {
|
|
10
|
-
"prepack": "node -e \"require('fs').copyFileSync('../../README.md', 'README.md')
|
|
10
|
+
"prepack": "node -e \"const fs=require('fs'); fs.copyFileSync('../../README.md', 'README.md'); fs.cpSync('../../integrations', 'integrations', {recursive: true});\""
|
|
11
11
|
},
|
|
12
12
|
"files": [
|
|
13
13
|
"dist",
|
|
14
|
+
"integrations",
|
|
14
15
|
"README.md"
|
|
15
16
|
],
|
|
16
17
|
"engines": {
|