kortext 1.0.0 → 2.2.3

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.
Files changed (140) hide show
  1. package/AGENTS.md +28 -0
  2. package/README.md +98 -0
  3. package/agents/backend-developer.md +132 -0
  4. package/agents/compliance-expert.md +106 -0
  5. package/agents/copywriter.md +122 -0
  6. package/agents/db-admin.md +117 -0
  7. package/agents/delivery-manager.md +121 -0
  8. package/agents/designer.md +108 -0
  9. package/agents/devops-engineer.md +141 -0
  10. package/agents/engineering-manager.md +208 -0
  11. package/agents/frontend-developer.md +174 -0
  12. package/agents/growth-expert.md +115 -0
  13. package/agents/operation-manager.md +122 -0
  14. package/agents/product-manager.md +114 -0
  15. package/agents/qa-engineer.md +126 -0
  16. package/agents/security-engineer.md +119 -0
  17. package/hooks/audit-logger.sh +25 -0
  18. package/hooks/auto-locker.sh +74 -0
  19. package/hooks/auto-unlocker.sh +17 -0
  20. package/hooks/backlog-sync-guard.sh +12 -0
  21. package/hooks/branch-guard.sh +32 -0
  22. package/hooks/commit-msg-guard.sh +43 -0
  23. package/hooks/git-pre-commit.sh +76 -0
  24. package/hooks/git-pre-push.sh +17 -0
  25. package/hooks/handover-guard.sh +33 -0
  26. package/hooks/kortext-init.sh +194 -0
  27. package/hooks/kortext-lib.sh +151 -0
  28. package/hooks/lint-guard.sh +50 -0
  29. package/hooks/secret-scanner.sh +89 -0
  30. package/hooks/size-guard.sh +48 -0
  31. package/hooks/snapshot-guard.sh +39 -0
  32. package/hooks/write-guard.sh +77 -0
  33. package/package.json +23 -6
  34. package/rules/behavior.md +252 -0
  35. package/rules/branching.md +82 -0
  36. package/rules/commands.md +112 -0
  37. package/rules/emergency.md +160 -0
  38. package/rules/mcp.md +47 -0
  39. package/rules/models.md +93 -0
  40. package/scripts/kortext-backlog-add.py +123 -0
  41. package/scripts/kortext-backlog-health.py +112 -0
  42. package/scripts/kortext-backlog-sync.py +117 -0
  43. package/scripts/kortext-bulk-plan.py +63 -0
  44. package/scripts/kortext-cli.py +376 -0
  45. package/scripts/kortext-consistency-check.py +74 -0
  46. package/scripts/kortext-context-check.py +146 -0
  47. package/scripts/kortext-handover.py +107 -0
  48. package/scripts/kortext-item-check.py +61 -0
  49. package/scripts/kortext-item-start.py +70 -0
  50. package/scripts/kortext-item-transition.py +78 -0
  51. package/scripts/kortext-lock.py +174 -0
  52. package/scripts/kortext-session-start.py +127 -0
  53. package/scripts/lock_kortext.sh +34 -0
  54. package/settings/.claude-settings.template.json +48 -0
  55. package/settings/CHANGELOG.md +176 -0
  56. package/settings/INTEGRATION-MAP.md +276 -0
  57. package/settings/README.md +255 -0
  58. package/settings/USER-GUIDE.md +502 -0
  59. package/settings/VERSION +1 -0
  60. package/settings/config.md +8 -0
  61. package/settings/runtime-adapters.md +104 -0
  62. package/skills/backend-developer/.gitkeep +0 -0
  63. package/skills/compliance-expert/.gitkeep +0 -0
  64. package/skills/copywriter/.gitkeep +0 -0
  65. package/skills/db-admin/.gitkeep +0 -0
  66. package/skills/delivery-manager/.gitkeep +0 -0
  67. package/skills/designer/.gitkeep +0 -0
  68. package/skills/devops-engineer/.gitkeep +0 -0
  69. package/skills/engineering-manager/.gitkeep +0 -0
  70. package/skills/frontend-developer/.gitkeep +0 -0
  71. package/skills/growth-expert/.gitkeep +0 -0
  72. package/skills/operation-manager/.gitkeep +0 -0
  73. package/skills/product-manager/.gitkeep +0 -0
  74. package/skills/qa-engineer/.gitkeep +0 -0
  75. package/skills/security-engineer/.gitkeep +0 -0
  76. package/workflows/00-kortext-setup.md +53 -0
  77. package/workflows/01a-analysis-pipeline.md +117 -0
  78. package/workflows/01b-onboarding-pipeline.md +110 -0
  79. package/workflows/02-planning-pipeline.md +146 -0
  80. package/workflows/02b-spike-workflow.md +120 -0
  81. package/workflows/03-environment-setup.md +99 -0
  82. package/workflows/04-development-cycle.md +203 -0
  83. package/workflows/05-test-cycle.md +123 -0
  84. package/workflows/06-deployment-cycle.md +224 -0
  85. package/workflows/07-rollback-pipeline.md +203 -0
  86. package/workflows/08-hotfix-pipeline.md +196 -0
  87. package/workflows/09-maintenance-cycle.md +133 -0
  88. package/workspace/archive/.gitkeep +0 -0
  89. package/workspace/backups/.gitkeep +0 -0
  90. package/workspace/memory/backlog/.gitkeep +0 -0
  91. package/workspace/memory/backlog/BXX-[bug-name].md +2 -0
  92. package/workspace/memory/backlog/DXX-[debt-name].md +2 -0
  93. package/workspace/memory/backlog/README.md +31 -0
  94. package/workspace/memory/backlog/TXX-[task-name].md +2 -0
  95. package/workspace/memory/backlog/debt-dashboard.md +3 -0
  96. package/workspace/memory/backlog/epic-dashboard.md +10 -0
  97. package/workspace/memory/backlog/version-dashboard.md +7 -0
  98. package/workspace/memory/context/.gitkeep +0 -0
  99. package/workspace/memory/context/README.md +35 -0
  100. package/workspace/memory/context/[agent-name]-active.md +2 -0
  101. package/workspace/memory/decisions.md +17 -0
  102. package/workspace/memory/handover.md +40 -0
  103. package/workspace/memory/learned.md +21 -0
  104. package/workspace/references/access.md +47 -0
  105. package/workspace/references/api-reference.md +59 -0
  106. package/workspace/references/blueprint.md +29 -0
  107. package/workspace/references/content-strategy.md +39 -0
  108. package/workspace/references/db-schema.md +51 -0
  109. package/workspace/references/design-system.md +107 -0
  110. package/workspace/references/dictionary.md +42 -0
  111. package/workspace/references/file-system.md +42 -0
  112. package/workspace/references/growth-strategy.md +46 -0
  113. package/workspace/references/legal-strategy.md +35 -0
  114. package/workspace/references/required-skills.md +11 -0
  115. package/workspace/references/security-rules.md +34 -0
  116. package/workspace/references/tech-stack.md +49 -0
  117. package/workspace/references/test-strategy.md +48 -0
  118. package/workspace/reports/analysis-reports.md +40 -0
  119. package/workspace/reports/content-reports.md +29 -0
  120. package/workspace/reports/delivery-reports.md +26 -0
  121. package/workspace/reports/growth-reports.md +9 -0
  122. package/workspace/reports/legal-reports.md +29 -0
  123. package/workspace/reports/product-requirements.md +28 -0
  124. package/workspace/reports/release-notes.md +20 -0
  125. package/workspace/reports/security-reports.md +27 -0
  126. package/workspace/reports/status-reports.md +48 -0
  127. package/workspace/reports/tech-requirements.md +30 -0
  128. package/workspace/reports/test-reports.md +61 -0
  129. package/workspace/templates/BXX-[bug-name].md +34 -0
  130. package/workspace/templates/DXX-[debt-name].md +35 -0
  131. package/workspace/templates/EXX-[epic-name].md +48 -0
  132. package/workspace/templates/HXX-[hotfix-name].md +73 -0
  133. package/workspace/templates/SXX-[spike-name].md +51 -0
  134. package/workspace/templates/TXX-[task-name].md +34 -0
  135. package/workspace/templates/[agent-name]-active.md +4 -0
  136. package/workspace/templates/[original-name]_[YYYY-MM-DD_HHMMSS].md +5 -0
  137. package/workspace/templates/adr-XXX.md +66 -0
  138. package/workspace/templates/debt-dashboard.md +10 -0
  139. package/workspace/templates/epic-dashboard.md +10 -0
  140. package/workspace/templates/version-dashboard.md +10 -0
@@ -0,0 +1,151 @@
1
+ #!/usr/bin/env bash
2
+ # KORTEXT MANAGED HOOK — generated/edited by kortext framework
3
+ # Shared path and config helpers for Kortext hooks.
4
+
5
+ kortext_find_root() {
6
+ local dir="${1:-$PWD}"
7
+
8
+ while [ "$dir" != "/" ]; do
9
+ if [ -d "$dir/.kortext/hooks" ]; then
10
+ printf '%s\n' "$dir"
11
+ return 0
12
+ fi
13
+ dir="$(dirname "$dir")"
14
+ done
15
+
16
+ return 1
17
+ }
18
+
19
+ KORTEXT_ROOT="${KORTEXT_ROOT:-$(kortext_find_root "$PWD" 2>/dev/null || pwd)}"
20
+
21
+ # .kortext zorunlu — çift modlu sistem kaldırıldı
22
+ KORTEXT_REL="${KORTEXT_REL:-.kortext}"
23
+ KORTEXT_DIR="${KORTEXT_DIR:-$KORTEXT_ROOT/$KORTEXT_REL}"
24
+
25
+ # Hata kontrolü: .kortext/ bulunmazsa açık hata ver
26
+ if [ ! -d "$KORTEXT_DIR/hooks" ]; then
27
+ echo "❌ HATA: .kortext/ dizini bulunamadı: $KORTEXT_DIR" >&2
28
+ return 1
29
+ fi
30
+
31
+ # KORTEXT_WORKSPACE_DIR: npm global kurulumda framework ve proje dizini ayrılır.
32
+ # Önce çalışma dizininde local workspace/ ara; yoksa framework'ün kendi workspace/'ini kullan.
33
+ if [ -z "${KORTEXT_WORKSPACE_DIR:-}" ]; then
34
+ if [ -d "$PWD/workspace" ]; then
35
+ KORTEXT_WORKSPACE_DIR="$PWD/workspace"
36
+ else
37
+ KORTEXT_WORKSPACE_DIR="$KORTEXT_DIR/workspace"
38
+ fi
39
+ fi
40
+ export KORTEXT_WORKSPACE_DIR
41
+
42
+ kortext_abs_path() {
43
+ local path="$1"
44
+ case "$path" in
45
+ /*) printf '%s\n' "$path" ;;
46
+ *) printf '%s\n' "$KORTEXT_ROOT/$path" ;;
47
+ esac
48
+ }
49
+
50
+ kortext_load_config() {
51
+ local config_file line key value
52
+ local candidates=(
53
+ "$KORTEXT_DIR/settings/config"
54
+ "$KORTEXT_DIR/settings/config.md"
55
+ "$KORTEXT_DIR/config"
56
+ "$KORTEXT_ROOT/.kortext/config"
57
+ )
58
+
59
+ for config_file in "${candidates[@]}"; do
60
+ [ -f "$config_file" ] || continue
61
+ while IFS= read -r line; do
62
+ line="${line%%#*}"
63
+ [[ "$line" =~ ^[[:space:]]*([A-Z_][A-Z0-9_]*)[[:space:]]*=[[:space:]]*(.*)[[:space:]]*$ ]] || continue
64
+ key="${BASH_REMATCH[1]}"
65
+ value="${BASH_REMATCH[2]}"
66
+ value="${value%\"}"
67
+ value="${value#\"}"
68
+ value="${value%\'}"
69
+ value="${value#\'}"
70
+ if [ -z "${!key+x}" ]; then
71
+ export "$key=$value"
72
+ fi
73
+ done < "$config_file"
74
+ return 0
75
+ done
76
+
77
+ return 0
78
+ }
79
+
80
+ kortext_is_workspace_path() {
81
+ local abs
82
+ abs="$(kortext_abs_path "$1")"
83
+
84
+ case "$abs" in
85
+ "$KORTEXT_WORKSPACE_DIR"/*|"$KORTEXT_ROOT/.kortext/workspace"/*)
86
+ return 0
87
+ ;;
88
+ *)
89
+ return 1
90
+ ;;
91
+ esac
92
+ }
93
+
94
+ kortext_is_env_path() {
95
+ local base
96
+ base="$(basename "$1")"
97
+ case "$base" in
98
+ .env|.env.*)
99
+ return 0
100
+ ;;
101
+ *)
102
+ return 1
103
+ ;;
104
+ esac
105
+ }
106
+
107
+ kortext_json_field() {
108
+ # JSON içinden bir alan çek. jq yoksa python3 fallback'ine düşer.
109
+ # query formatı: '.tool_input.file_path' gibi nokta yollu erişim.
110
+ local input="$1"
111
+ local query="$2"
112
+
113
+ if command -v jq >/dev/null 2>&1; then
114
+ printf '%s' "$input" | jq -r "$query // empty" 2>/dev/null || true
115
+ return 0
116
+ fi
117
+
118
+ if command -v python3 >/dev/null 2>&1; then
119
+ # Python fallback — '.a.b.c' yolunu dict erişimine çevirir.
120
+ printf '%s' "$input" | KORTEXT_JSON_QUERY="$query" python3 -c '
121
+ import json, os, sys
122
+ try:
123
+ data = json.load(sys.stdin)
124
+ query = os.environ.get("KORTEXT_JSON_QUERY", "").lstrip(".")
125
+ if not query:
126
+ print("")
127
+ sys.exit(0)
128
+ parts = query.split(".")
129
+ for p in parts:
130
+ if isinstance(data, dict):
131
+ data = data.get(p, "")
132
+ else:
133
+ data = ""
134
+ break
135
+ if data is None:
136
+ data = ""
137
+ print(data)
138
+ except Exception:
139
+ pass
140
+ ' 2>/dev/null || true
141
+ return 0
142
+ fi
143
+
144
+ # Hiçbir araç yoksa boş döndür.
145
+ echo ""
146
+ return 1
147
+ }
148
+
149
+ kortext_staged_files() {
150
+ git diff --cached --name-only --diff-filter=ACMR -z
151
+ }
@@ -0,0 +1,50 @@
1
+ #!/bin/bash
2
+ # KORTEXT MANAGED HOOK — generated/edited by kortext framework
3
+ # [KORTEXT] Kod Hatası Denetleyicisi (Lint-Guard)
4
+
5
+ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
6
+ # shellcheck source=kortext-lib.sh
7
+ source "$SCRIPT_DIR/kortext-lib.sh"
8
+
9
+ FILE_PATH="${KORTEXT_FILE_PATH:-${CLAUDE_FILE_PATH:-${GEMINI_FILE_PATH:-${OPENAI_FILE_PATH:-}}}}"
10
+
11
+ if [ -z "$FILE_PATH" ] || [ ! -f "$FILE_PATH" ]; then exit 0; fi
12
+
13
+ EXTENSION="${FILE_PATH##*.}"
14
+
15
+ echo "🔍 [KORTEXT LINT] Denetleniyor: $FILE_PATH"
16
+
17
+ case "$EXTENSION" in
18
+ sh)
19
+ # Shell script syntax kontrolü
20
+ bash -n "$FILE_PATH"
21
+ ;;
22
+ js)
23
+ # JavaScript syntax kontrolü (Node.js varsa)
24
+ if command -v node > /dev/null 2>&1; then
25
+ node -c "$FILE_PATH"
26
+ fi
27
+ ;;
28
+ json)
29
+ # JSON format kontrolü (Python varsa)
30
+ if command -v python3 > /dev/null 2>&1; then
31
+ python3 -m json.tool "$FILE_PATH" > /dev/null
32
+ fi
33
+ ;;
34
+ *)
35
+ # Diğer dosyalar için şimdilik pas geç
36
+ exit 0
37
+ ;;
38
+ esac
39
+
40
+ # Eğer yukarıdaki komutlardan biri hata verirse ($? 1 olursa) durdur
41
+ if [ $? -ne 0 ]; then
42
+ echo "---"
43
+ echo "❌ KORTEXT LINT HATASI"
44
+ echo "Dosya içinde yazım veya sözdizimi (syntax) hatası tespit edildi."
45
+ echo "Lütfen kodu düzeltip tekrar deneyin."
46
+ echo "---"
47
+ exit 1
48
+ fi
49
+
50
+ exit 0
@@ -0,0 +1,89 @@
1
+ #!/bin/bash
2
+ # KORTEXT MANAGED HOOK — generated/edited by kortext framework
3
+ # [KORTEXT] Gizli Bilgi ve Sızıntı Tarayıcı
4
+
5
+ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
6
+ # shellcheck source=kortext-lib.sh
7
+ source "$SCRIPT_DIR/kortext-lib.sh"
8
+
9
+ kortext_load_config
10
+ KORTEXT_HOOK_MODE="${KORTEXT_HOOK_MODE:-permissive}"
11
+
12
+ # ---- Pattern Grubu 1: Tırnaklı Atama (api_key = "...") ----
13
+ P1="(api[_-]?key|secret[_-]?key|password|token|bearer|credential|private[_-]key|access[_-]?key|auth[_-]?token)\s*[:=]\s*['\"][^'\"]{8,}['\"]"
14
+
15
+ # ---- Pattern Grubu 2: Tırnaksız Atama (API_KEY=sk-abc123) ----
16
+ P2="(API_KEY|SECRET_KEY|ACCESS_KEY|AUTH_TOKEN|DB_PASSWORD|DATABASE_URL)=[^'\"\s]{8,}"
17
+
18
+ # ---- Pattern Grubu 3: Servis Spesifik Formatlar ----
19
+ # OpenAI: sk-proj-..., Anthropic: sk-ant-..., AWS: AKIA..., GitHub: ghp_..., Slack: xox*
20
+ P3="(sk-[a-zA-Z0-9]{20,}|AKIA[0-9A-Z]{16}|ghp_[a-zA-Z0-9]{36,}|ghs_[a-zA-Z0-9]{36,}|xox[baprs]-[0-9\-a-zA-Z]{20,})"
21
+
22
+ # ---- Pattern Grubu 4: Authorization Header Değerleri ----
23
+ P4="Authorization:\s*Bearer\s+[a-zA-Z0-9._\-]{20,}"
24
+
25
+ # ---- İstisna: Env okuma ve placeholder değerler ----
26
+ EXCLUSIONS="process\.env|import\.meta\.env|os\.environ|getenv|YOUR_|<YOUR|PLACEHOLDER|example|EXAMPLE|\[VALUE\]|\[fill\]"
27
+
28
+ scan_file() {
29
+ local source_path="$1"
30
+ local display_path="${2:-$source_path}"
31
+ local pattern
32
+
33
+ # Behavior kuralı: ".env versiyon kontrolüne dahil edilmez, gizli bilgiler orada saklanır."
34
+ # Bu yüzden gerçek .env dosyalarını tarama dışı bırakıyoruz.
35
+ if [[ "$display_path" == *".env"* ]] && [[ "$display_path" != *".env.example"* ]]; then
36
+ return 0
37
+ fi
38
+
39
+ [ -f "$source_path" ] || return 0
40
+
41
+ for pattern in "$P1" "$P2" "$P3" "$P4"; do
42
+ if grep -Ei "$pattern" "$source_path" 2>/dev/null | grep -vEi "$EXCLUSIONS" > /dev/null; then
43
+ echo "---"
44
+ echo "⚠️ KORTEXT GÜVENLİK İHLALİ: SIZINTI TESPİT EDİLDİ"
45
+ echo "Hata: Dosya içinde açık bir şifre, anahtar (key) veya token tespit edildi."
46
+ echo "Kortext Behavior Kuralları gereği (Madde 38-39):"
47
+ echo "1. Gizli bilgiler asla kod içine hardcoded yazılmaz."
48
+ echo "2. Sadece .env dosyası kullanılmalı ve değerler tırnak içinde oraya taşınmalıdır."
49
+ echo ""
50
+ echo "Dosya: $display_path"
51
+ echo "---"
52
+ return 1
53
+ fi
54
+ done
55
+
56
+ return 0
57
+ }
58
+
59
+ if [ "${1:-}" = "--stdin" ]; then
60
+ DISPLAY_PATH="${2:-STDIN}"
61
+ TMP_FILE="$(mktemp)"
62
+ cat > "$TMP_FILE"
63
+ scan_file "$TMP_FILE" "$DISPLAY_PATH"
64
+ STATUS=$?
65
+ rm -f "$TMP_FILE"
66
+ exit "$STATUS"
67
+ fi
68
+
69
+ if [ "$#" -gt 0 ]; then
70
+ STATUS=0
71
+ for FILE_PATH in "$@"; do
72
+ if ! scan_file "$FILE_PATH"; then
73
+ STATUS=1
74
+ fi
75
+ done
76
+ exit "$STATUS"
77
+ fi
78
+
79
+ FILE_PATH="${KORTEXT_FILE_PATH:-${CLAUDE_FILE_PATH:-${GEMINI_FILE_PATH:-${OPENAI_FILE_PATH:-}}}}"
80
+
81
+ if [ -z "$FILE_PATH" ]; then
82
+ if [ "$KORTEXT_HOOK_MODE" = "strict" ]; then
83
+ echo "⚠️ [KORTEXT] KORTEXT_FILE_PATH tanımsız. strict modda çıkılıyor."
84
+ exit 1
85
+ fi
86
+ exit 0
87
+ fi
88
+
89
+ scan_file "$FILE_PATH"
@@ -0,0 +1,48 @@
1
+ #!/bin/bash
2
+ # KORTEXT MANAGED HOOK — generated/edited by kortext framework
3
+ # [KORTEXT] Dosya Boyutu ve Arşivleme Muhafixı
4
+
5
+ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
6
+ # shellcheck source=kortext-lib.sh
7
+ source "$SCRIPT_DIR/kortext-lib.sh"
8
+
9
+ kortext_load_config
10
+ KORTEXT_HOOK_MODE="${KORTEXT_HOOK_MODE:-permissive}"
11
+ MAX_LINES="${KORTEXT_SIZE_LIMIT:-500}"
12
+
13
+ FILE_PATH="${KORTEXT_FILE_PATH:-${CLAUDE_FILE_PATH:-${GEMINI_FILE_PATH:-${OPENAI_FILE_PATH:-}}}}"
14
+
15
+ # Eğer dosya yolu boşsa veya dosya mevcut değilse çık
16
+ if [ -z "$FILE_PATH" ] || [ ! -f "$FILE_PATH" ]; then
17
+ if [ -z "$FILE_PATH" ] && [ "$KORTEXT_HOOK_MODE" = "strict" ]; then
18
+ echo "⚠️ [KORTEXT] KORTEXT_FILE_PATH tanımsız. strict modda çıkılıyor."
19
+ exit 1
20
+ fi
21
+ exit 0
22
+ fi
23
+
24
+ # ÖZEL İSTİSNA: backlog/ dizini her zaman tam kapsamlı kalmalıdır, arşivlenmez.
25
+ if [[ "$FILE_PATH" == *"backlog/"* ]]; then
26
+ exit 0
27
+ fi
28
+
29
+ LINE_COUNT=$(wc -l < "$FILE_PATH")
30
+
31
+ if [ "$LINE_COUNT" -gt "$MAX_LINES" ]; then
32
+ echo "---"
33
+ echo "🛑 KORTEXT BOYUT SINIRI AŞILDI"
34
+ echo "Dosya: $FILE_PATH ($LINE_COUNT satır)"
35
+ echo "Limit: $MAX_LINES satır"
36
+ echo ""
37
+ echo "⚠️ ARCHIVING PROTOCOL GEREĞİ:"
38
+ echo "1. Dosyadaki eski veya tamamlanmış verileri tespit et."
39
+ echo "2. Bu verileri '$KORTEXT_REL/workspace/archive/' altına '[dosya-adi]_[YYYY-MM-DD_HHMMSS].md' formatıyla taşı."
40
+ echo "3. Ana dosyada arşivlenen bölüme bir link/not bırak."
41
+ echo "4. Ana dosyayı hafifletip işlemi tekrar dene."
42
+ echo ""
43
+ echo "Not: 'backlog/' dizinindeki dosyalar bu kuraldan muaf tutulmuştur."
44
+ echo "---"
45
+ exit 1
46
+ fi
47
+
48
+ exit 0
@@ -0,0 +1,39 @@
1
+ #!/bin/bash
2
+ # KORTEXT MANAGED HOOK — generated/edited by kortext framework
3
+ # [KORTEXT] Anlık Yedekleme Muhafızı (Snapshot-Guard)
4
+
5
+ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
6
+ # shellcheck source=kortext-lib.sh
7
+ source "$SCRIPT_DIR/kortext-lib.sh"
8
+
9
+ kortext_load_config
10
+ KORTEXT_HOOK_MODE="${KORTEXT_HOOK_MODE:-permissive}"
11
+ BACKUP_KEEP="${KORTEXT_BACKUP_KEEP:-5}"
12
+
13
+ FILE_PATH="${KORTEXT_FILE_PATH:-${CLAUDE_FILE_PATH:-${GEMINI_FILE_PATH:-${OPENAI_FILE_PATH:-}}}}"
14
+ BACKUP_DIR="$KORTEXT_WORKSPACE_DIR/backups"
15
+
16
+ # Dosya yolu yoksa veya mevcut değilse çık
17
+ if [ -z "$FILE_PATH" ] || [ ! -f "$FILE_PATH" ]; then
18
+ if [ -z "$FILE_PATH" ] && [ "$KORTEXT_HOOK_MODE" = "strict" ]; then
19
+ echo "⚠️ [KORTEXT] KORTEXT_FILE_PATH tanımsız. strict modda çıkılıyor."
20
+ exit 1
21
+ fi
22
+ exit 0
23
+ fi
24
+
25
+ # Yedekleme dizinini oluştur
26
+ mkdir -p "$BACKUP_DIR"
27
+
28
+ FILENAME=$(basename "$FILE_PATH")
29
+ TIMESTAMP=$(date "+%Y-%m-%d_%H%M%S") # Tarih-Saat-Dakika-Saniye
30
+ BACKUP_NAME="${BACKUP_DIR}/${FILENAME}_${TIMESTAMP}.bak"
31
+
32
+ # 1. Yedeği al
33
+ cp "$FILE_PATH" "$BACKUP_NAME"
34
+
35
+ # 2. Temizlik: Aynı dosya için olan yedeklerden sadece en yeni 5 tanesini tut
36
+ # (Diğerlerini silerek yer tasarrufu sağlar)
37
+ ls -t "${BACKUP_DIR}/${FILENAME}"_* 2>/dev/null | tail -n +$((BACKUP_KEEP + 1)) | xargs rm -f 2>/dev/null
38
+
39
+ exit 0
@@ -0,0 +1,77 @@
1
+ #!/bin/bash
2
+ # KORTEXT MANAGED HOOK — generated/edited by kortext framework
3
+ # [KORTEXT] Yazma Muhafızı (Gelişmiş)
4
+ # 1. Konum Kontrolü: Sadece izin verilen dizinlere yazılmasını sağlar.
5
+ # 2. Kalite Kontrolü (Tamlık Kapısı): Yarım kalmış içeriklerin yazılmasını engeller.
6
+
7
+ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
8
+ # shellcheck source=kortext-lib.sh
9
+ source "$SCRIPT_DIR/kortext-lib.sh"
10
+
11
+ kortext_load_config
12
+ KORTEXT_HOOK_MODE="${KORTEXT_HOOK_MODE:-permissive}"
13
+
14
+ # Girdiyi Oku (JSON formatında gelmesi beklenir)
15
+ INPUT=$(cat)
16
+ FILE_PATH="$(kortext_json_field "$INPUT" '.tool_input.file_path')"
17
+
18
+ # Eğer JSON'dan gelmiyorsa çevresel değişkenleri dene
19
+ if [ -z "$FILE_PATH" ]; then
20
+ FILE_PATH="${KORTEXT_FILE_PATH:-${CLAUDE_FILE_PATH:-${GEMINI_FILE_PATH:-${OPENAI_FILE_PATH:-}}}}"
21
+ fi
22
+
23
+ if [ -z "$FILE_PATH" ]; then
24
+ if [ "$KORTEXT_HOOK_MODE" = "strict" ]; then
25
+ echo "⚠️ [KORTEXT] Dosya yolu tespit edilemedi. strict modda çıkılıyor."
26
+ exit 1
27
+ fi
28
+ exit 0
29
+ fi
30
+
31
+ # 1. BÖLÜM: KONUM KONTROLÜ
32
+ ALLOWED=false
33
+ if kortext_is_workspace_path "$FILE_PATH" || kortext_is_env_path "$FILE_PATH"; then
34
+ ALLOWED=true
35
+ fi
36
+
37
+ if [ "$ALLOWED" = false ]; then
38
+ echo "---"
39
+ echo "❌ KORTEXT ERİŞİM ENGELİ"
40
+ echo "Hata: Kortext kuralları gereği Framework çekirdek dizinlerine yazma yetkiniz yoktur."
41
+ echo "Lütfen çıktılarınızı '$KORTEXT_REL/workspace/' altındaki uygun klasörlere kaydedin."
42
+ echo "Hedeflenen Dosya: $FILE_PATH"
43
+ echo "---"
44
+ exit 1
45
+ fi
46
+
47
+ # 2. BÖLÜM: TAMLIK KAPISI (KALİTE KONTROLÜ)
48
+ # Yazılacak içeriği al (Write veya Edit/MultiEdit araçları için)
49
+ CONTENT="$(kortext_json_field "$INPUT" '.tool_input.content // .tool_input.new_string')"
50
+
51
+ if [ -n "$CONTENT" ]; then
52
+ # Yarım bırakma işaretçileri (TBD, FIXME, PLACEHOLDER vb.)
53
+ # Önemli İstisna: "// todo: [tech-debt]" formatındaki teknik borçlara izin verilir.
54
+ if echo "$CONTENT" | grep -qiE '\bTBD\b|\bFIXME\b|\[PLACEHOLDER\]|\[INSERT ' || \
55
+ (echo "$CONTENT" | grep -i '\bTODO\b' | grep -vi '\[tech-debt\]' | grep -q .); then
56
+ echo "---"
57
+ echo "⚠️ TAMLIK KAPISI: EKSİK İÇERİK TESPİT EDİLDİ"
58
+ echo "Hata: Yazmaya çalıştığınız içerikte disiplinsiz (etiketsiz) yer tutucular var."
59
+ echo "Kortext Politikası: Sıradan TODO/TBD kullanımı yasaktır."
60
+ echo "İstisna: Eğer teknik borç bırakmanız gerekiyorsa '// todo: [tech-debt] açıklama' formatını kullanın."
61
+ echo "Dosya: $FILE_PATH"
62
+ echo "---"
63
+ exit 1
64
+ fi
65
+
66
+ # Kararsızlık ifadeleri
67
+ if echo "$CONTENT" | grep -qiE 'assess whether|decide later|need to determine|open question|to be decided|deferred decision'; then
68
+ echo "---"
69
+ echo "⚠️ TAMLIK KAPISI: BELİRSİZLİK TESPİT EDİLDİ"
70
+ echo "Hata: İçerikte 'sonra karar verilecek' veya 'belirlenmesi gerekiyor' gibi ucu açık ifadeler var."
71
+ echo "Kortext Politikası: Yazma işleminden önce tüm kararlar çözülmüş olmalıdır."
72
+ echo "---"
73
+ exit 1
74
+ fi
75
+ fi
76
+
77
+ exit 0
package/package.json CHANGED
@@ -1,12 +1,29 @@
1
1
  {
2
2
  "name": "kortext",
3
- "version": "1.0.0",
4
- "description": "",
5
- "license": "ISC",
6
- "author": "",
7
- "type": "commonjs",
3
+ "version": "2.2.3",
4
+ "description": "AI Agent Framework for Operational Discipline and Automated Project Management",
8
5
  "main": "index.js",
6
+ "bin": {
7
+ "kortext": "scripts/kortext-cli.py"
8
+ },
9
9
  "scripts": {
10
- "test": "echo \"Error: no test specified\" && exit 1"
10
+ "test": "python3 scripts/kortext-consistency-check.py",
11
+ "check": "python3 scripts/kortext-context-check.py",
12
+ "health": "python3 scripts/kortext-backlog-health.py"
13
+ },
14
+ "keywords": [
15
+ "ai",
16
+ "agent",
17
+ "framework",
18
+ "automation",
19
+ "project-management",
20
+ "gemini",
21
+ "claude"
22
+ ],
23
+ "author": "Eray Endes",
24
+ "license": "MIT",
25
+ "engines": {
26
+ "node": ">=14.0.0",
27
+ "python": ">=3.10.0"
11
28
  }
12
29
  }