MertCapkin-GraphStack 4.5.1__py3-none-any.whl

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 (57) hide show
  1. graphstack/__init__.py +12 -0
  2. graphstack/__main__.py +10 -0
  3. graphstack/assets/docs/CURSOR_PROMPTS.md +215 -0
  4. graphstack/assets/handoff/BOOTSTRAP.md +73 -0
  5. graphstack/assets/handoff/BRIEF.md +66 -0
  6. graphstack/assets/handoff/REVIEW.md +7 -0
  7. graphstack/assets/handoff/board/README.md +60 -0
  8. graphstack/assets/orchestrator/ORCHESTRATOR.md +416 -0
  9. graphstack/assets/orchestrator/TOKEN_OPTIMIZER.md +319 -0
  10. graphstack/assets/scripts/board.ps1 +37 -0
  11. graphstack/assets/scripts/board.sh +22 -0
  12. graphstack/assets/scripts/gate-hook.ps1 +41 -0
  13. graphstack/assets/scripts/gate-hook.sh +26 -0
  14. graphstack/assets/scripts/post-commit +20 -0
  15. graphstack/assets/scripts/post-commit.ps1 +44 -0
  16. graphstack/board.py +361 -0
  17. graphstack/bootstrap.py +50 -0
  18. graphstack/cli.py +99 -0
  19. graphstack/compact/__init__.py +9 -0
  20. graphstack/compact/__pycache__/__init__.cpython-311.pyc +0 -0
  21. graphstack/compact/__pycache__/base.cpython-311.pyc +0 -0
  22. graphstack/compact/__pycache__/generic.cpython-311.pyc +0 -0
  23. graphstack/compact/__pycache__/git.cpython-311.pyc +0 -0
  24. graphstack/compact/__pycache__/registry.cpython-311.pyc +0 -0
  25. graphstack/compact/base.py +115 -0
  26. graphstack/compact/generic.py +90 -0
  27. graphstack/compact/git.py +167 -0
  28. graphstack/compact/registry.py +47 -0
  29. graphstack/constants.py +38 -0
  30. graphstack/gate.py +429 -0
  31. graphstack/graph.py +143 -0
  32. graphstack/hook.py +144 -0
  33. graphstack/init_cmd.py +113 -0
  34. graphstack/installer.py +366 -0
  35. graphstack/platform_utils.py +127 -0
  36. graphstack/run.py +103 -0
  37. graphstack/state.py +117 -0
  38. graphstack/tests/__init__.py +0 -0
  39. graphstack/tests/conftest.py +30 -0
  40. graphstack/tests/test_assets.py +35 -0
  41. graphstack/tests/test_board.py +166 -0
  42. graphstack/tests/test_compact.py +93 -0
  43. graphstack/tests/test_gate.py +406 -0
  44. graphstack/tests/test_graph.py +60 -0
  45. graphstack/tests/test_hook.py +57 -0
  46. graphstack/tests/test_init.py +58 -0
  47. graphstack/tests/test_installer.py +73 -0
  48. graphstack/tests/test_platform_utils.py +69 -0
  49. graphstack/tests/test_state.py +56 -0
  50. graphstack/tests/test_validate.py +204 -0
  51. graphstack/validate.py +469 -0
  52. mertcapkin_graphstack-4.5.1.dist-info/METADATA +720 -0
  53. mertcapkin_graphstack-4.5.1.dist-info/RECORD +57 -0
  54. mertcapkin_graphstack-4.5.1.dist-info/WHEEL +5 -0
  55. mertcapkin_graphstack-4.5.1.dist-info/entry_points.txt +2 -0
  56. mertcapkin_graphstack-4.5.1.dist-info/licenses/LICENSE +21 -0
  57. mertcapkin_graphstack-4.5.1.dist-info/top_level.txt +1 -0
graphstack/__init__.py ADDED
@@ -0,0 +1,12 @@
1
+ """GraphStack — cross-platform Python core.
2
+
3
+ This package replaces the bash/PowerShell scripts with a single Python
4
+ implementation that works identically on Windows, macOS, and Linux.
5
+
6
+ Entry point: ``python -m graphstack <command>``
7
+ Commands: ``board``, ``install``, ``init``, ``hook``, ``validate``, ``doctor``, ``run``,
8
+ ``gate``, ``state``, ``graph``
9
+ """
10
+
11
+ __version__ = "4.5.1"
12
+ __all__ = ["__version__"]
graphstack/__main__.py ADDED
@@ -0,0 +1,10 @@
1
+ """Allow ``python -m graphstack`` to invoke the CLI."""
2
+
3
+ from __future__ import annotations
4
+
5
+ import sys
6
+
7
+ from .cli import main
8
+
9
+ if __name__ == "__main__":
10
+ sys.exit(main())
@@ -0,0 +1,215 @@
1
+ # GraphStack v4 — Cursor Prompts & Setup Guide
2
+
3
+ ---
4
+
5
+ ## 🔧 Cursor'a Kurulum (İlk Kez)
6
+
7
+ ### Adım 1 — GraphStack'i projeye yükle
8
+
9
+ Terminalden (projenin kök dizininde). İşletim sistemine göre üç eşdeğer yol var:
10
+
11
+ **macOS / Linux (bash):**
12
+ ```bash
13
+ git clone https://github.com/MertCapkin/graphstack /tmp/graphstack
14
+ bash /tmp/graphstack/install.sh
15
+ ```
16
+
17
+ **Windows (PowerShell — Git Bash gerekmez):**
18
+ ```powershell
19
+ git clone https://github.com/MertCapkin/graphstack $env:TEMP\graphstack
20
+ & $env:TEMP\graphstack\install.ps1 .
21
+ ```
22
+
23
+ **Her platform (Python — shell tercihinden bağımsız):**
24
+ ```bash
25
+ git clone https://github.com/MertCapkin/graphstack /path/to/graphstack
26
+ python -m graphstack install . --non-interactive
27
+ ```
28
+
29
+ Bu komut şunları yapar:
30
+ - `.cursor/rules/graphstack.mdc` → Cursor her açılışta bunu otomatik okur
31
+ - `.cursor/skills/` → tüm rol dosyaları
32
+ - `orchestrator/` → Orchestrator ve Token Optimizer
33
+ - `handoff/` + `scripts/` → board ve state dosyaları
34
+ - `scripts/graphstack/` → Python helper paketi (bash ve PowerShell shim'leri buna delege eder)
35
+ - `.cursor/commands/graphstack.md` → Slash menüsünde `/graphstack` komutu
36
+
37
+ ### Adım 2 — Graphify'ı yükle ve grafiği oluştur
38
+
39
+ ```bash
40
+ pip install -r requirements.txt
41
+ # veya doğrudan aynı pin ile:
42
+ pip install "graphifyy>=0.7,<0.9"
43
+ ```
44
+
45
+ Cursor'da projeyi aç, chat'e yaz:
46
+ ```
47
+ /graphify .
48
+ ```
49
+
50
+ Bu işlem `graphify-out/GRAPH_REPORT.md` ve `graph.json` dosyalarını oluşturur.
51
+ Büyük projelerde 1-2 dakika sürebilir, sonrası anında.
52
+
53
+ ### Adım 3 — Başla
54
+
55
+ **Önerilen (en az sürtünme):** Cursor'da projeyle birlikte yeni Composer/Agent aç —
56
+ `graphstack.mdc` `alwaysApply: true` olduğu için Kurallar zaten yüklü. Direkt olarak
57
+ hedefini yaz (**Türkçe veya İngilizce**). Asistanın ilk işi olarak yine Orchestrator Activation
58
+ (okuma + TOKEN_OPTIMIZER + graf) çalıştırması gerekir; senin her seferinde
59
+ `Read orchestrator/...` kopyalamana gerek yok.
60
+
61
+ **Slash komutu (istersen daha net başlatmak için):** Sohbete `/` yaz → **`graphstack`**
62
+ dosyası `.cursor/commands/graphstack.md` içeriğini enjekte eder (`/graphstack` çıkmıyorsa
63
+ Cursor'ı yeniden başlat).
64
+
65
+ **İsteğe bağlı klasik satır *(başka editör ya da garanti için):*** aşağıdaki blok hâlen geçerlidir.
66
+
67
+ ```
68
+ Read orchestrator/ORCHESTRATOR.md and follow it exactly.
69
+ [Hedefini yaz]
70
+ ```
71
+
72
+ > **Not:** `.cursor/rules/graphstack.mdc` her oturumda otomatik yüklenir; bu satır fazladan garanti için.
73
+
74
+ ---
75
+
76
+ ## ⚡ Örnek hedef yazıları (klasik bloğu atlarsan bile)
77
+
78
+ Orchestrator yine graf + handoff yüklemesini yapmak zorunda; senden sadece amaç gerek:
79
+
80
+ ```
81
+ Kayıtta e-posta doğrulaması eklemek istiyorum.
82
+ ```
83
+ ```
84
+ Login endpoint çok yavaş — performansı bul ve düzelt.
85
+ ```
86
+ ```
87
+ Resume from last session.
88
+ ```
89
+
90
+ Architect → Builder → Reviewer → QA → Ship zinciri kullanıcı etkileşimi olmadan yürür.
91
+
92
+ ---
93
+
94
+ ## 🚀 Sıfırdan Yeni Proje (Bootstrap Modu)
95
+
96
+ Henüz kod yoksa **sırf hedef yazman yeter**: `alwaysApply` kuralları etkin.
97
+ İstersen garanti olarak `/graphstack` komutunun ardından açıklamayı yaz.
98
+
99
+ ```
100
+ Boş bir repo için REST API yazıyorum: kullanıcılar proje oluşturup görev atayabilecek.
101
+ TypeScript + Node + Express + PostgreSQL istiyorum. İlk fazda önce authentication.
102
+ ```
103
+
104
+ **Klasik tam blok (yedek)**
105
+
106
+ ```
107
+ Read orchestrator/ORCHESTRATOR.md and follow it exactly.
108
+ This is a new project with no existing codebase.
109
+ [Projeyi tanımla: amaç, kullanıcı, teknoloji]
110
+ ```
111
+
112
+ Bootstrapper tüm modülleri planlar, bağımlılık sırasını belirler,
113
+ her döngü için brief yazar; her döngü sonunda güncellenmiş graf gerekli.
114
+
115
+ ---
116
+
117
+ ## 🔄 Oturum Devam Ettirme
118
+
119
+ Cursor'ı yeniden açtıktan sonra sadece:
120
+
121
+ ```
122
+ Önceki GraphStack oturumundan devam et.
123
+ STATE.md ile board'daki yapılacaklara uy.
124
+ ```
125
+
126
+ Gerekli güvence için hâlen şu blok kullanılabilir:
127
+
128
+ ```
129
+ Read orchestrator/ORCHESTRATOR.md and follow it exactly.
130
+ Resume from last session.
131
+ ```
132
+
133
+ ---
134
+
135
+ ## 🎭 Manuel Rol Aktivasyonu (İleri Düzey)
136
+
137
+ Belirli bir rolü elle çalıştırmak için:
138
+
139
+ ### Architect (planlama)
140
+ ```
141
+ Read .cursor/skills/architect/ARCHITECT.md and follow it exactly.
142
+ Read orchestrator/TOKEN_OPTIMIZER.md for token rules.
143
+ [Ne planlamak istediğini yaz]
144
+ ```
145
+
146
+ ### Builder (doğrudan build)
147
+ ```
148
+ Read .cursor/skills/builder/BUILDER.md and follow it exactly.
149
+ Read orchestrator/TOKEN_OPTIMIZER.md for token rules.
150
+ Brief is in handoff/BRIEF.md. Start building.
151
+ ```
152
+
153
+ ### Reviewer (kod inceleme)
154
+ ```
155
+ Read .cursor/skills/reviewer/REVIEWER.md and follow it exactly.
156
+ Read orchestrator/TOKEN_OPTIMIZER.md for token rules.
157
+ Review the changes in [dosya adı veya "the last git diff"].
158
+ ```
159
+
160
+ ### QA (davranış doğrulama)
161
+ ```
162
+ Read .cursor/skills/qa/QA.md and follow it exactly.
163
+ Read orchestrator/TOKEN_OPTIMIZER.md for token rules.
164
+ Trace and verify [özellik adı].
165
+ ```
166
+
167
+ ### Ship (deploy hazırlığı)
168
+ ```
169
+ Read .cursor/skills/ship/SHIP.md and follow it exactly.
170
+ Run the pre-ship checklist for task [task-id].
171
+ ```
172
+
173
+ ---
174
+
175
+ ## 📋 Board Komutları (Terminal)
176
+
177
+ Üç biçim de eşdeğerdir. Shell tercihinize göre seçin.
178
+
179
+ **macOS / Linux (bash):**
180
+ ```bash
181
+ bash scripts/board.sh status
182
+ bash scripts/board.sh new my-feature Add OAuth login support
183
+ bash scripts/board.sh claim my-feature builder
184
+ bash scripts/board.sh complete my-feature
185
+ bash scripts/board.sh log
186
+ ```
187
+
188
+ **Windows (PowerShell):**
189
+ ```powershell
190
+ .\scripts\board.ps1 status
191
+ .\scripts\board.ps1 new my-feature Add OAuth login support
192
+ .\scripts\board.ps1 claim my-feature builder
193
+ .\scripts\board.ps1 complete my-feature
194
+ .\scripts\board.ps1 log
195
+ ```
196
+
197
+ **Cross-platform (Python):**
198
+ ```bash
199
+ python -m graphstack board status
200
+ python -m graphstack board new my-feature Add OAuth login support
201
+ python -m graphstack board claim my-feature builder
202
+ python -m graphstack board complete my-feature
203
+ python -m graphstack board log
204
+ ```
205
+
206
+ ---
207
+
208
+ ## 💡 İpuçları
209
+
210
+ - Her Orchestrator döngüsünde mümkünse **yeni bir Cursor chat** aç — context temiz kalır
211
+ - Cursor slash menüsünde **`/graphstack`** kullanarak Orchestrator açılışını netleştir
212
+ - `.cursor/rules/graphstack.mdc` otomatik yüklenir, elle okutman gerekmiyor
213
+ - Grafı büyük değişikliklerden sonra güncelle: `/graphify --update`
214
+ - `handoff/STATE.md` dosyasını silme — oturum geçmişin orada
215
+ - `handoff/board/` klasörünü commit'le — ekip arkadaşların board'u görsün
@@ -0,0 +1,73 @@
1
+ # Bootstrap Plan: [Project Name]
2
+
3
+ **Date:** YYYY-MM-DD
4
+ **Status:** Draft | Active | Complete
5
+ **Cycles completed:** 0 / [N]
6
+
7
+ ---
8
+
9
+ ## Project Summary
10
+
11
+ > 2-3 sentences: what it is, who uses it, core value.
12
+
13
+ ---
14
+
15
+ ## Tech Stack
16
+
17
+ - **Language:**
18
+ - **Runtime:**
19
+ - **Framework:**
20
+ - **Database:**
21
+ - **Testing:**
22
+ - **Key libraries:**
23
+
24
+ ---
25
+
26
+ ## Module Map
27
+
28
+ ```
29
+ [Project Name]
30
+ ├── [module-1] → [what it does]
31
+ ├── [module-2] → [what it does] (depends on 1)
32
+ ├── [module-3] → [what it does] (depends on 1, 2)
33
+ └── [module-4] → [what it does] (depends on 1, 2, 3)
34
+ ```
35
+
36
+ ---
37
+
38
+ ## Cycle Sequence
39
+
40
+ | Cycle | Module | Key files (estimated) | Depends on | Graph action | Status |
41
+ |-------|--------|-----------------------|------------|--------------|--------|
42
+ | 1 | | | — | `/graphify .` | ⬜ pending |
43
+ | 2 | | | cycle 1 | `/graphify --update` | ⬜ pending |
44
+ | 3 | | | cycles 1-2 | `/graphify --update` | ⬜ pending |
45
+
46
+ > Update Status: ⬜ pending → 🔄 in progress → ✅ complete
47
+
48
+ ---
49
+
50
+ ## Cross-Cutting Concerns
51
+
52
+ > Decided once, followed everywhere. Builder reads this every cycle.
53
+
54
+ - **Error handling:**
55
+ - **Logging:**
56
+ - **Config:**
57
+ - **Testing:**
58
+ - **Auth:**
59
+ - **Code style:**
60
+
61
+ ---
62
+
63
+ ## Known Risks
64
+
65
+ -
66
+
67
+ ---
68
+
69
+ ## Cycle Log
70
+
71
+ > Bootstrapper appends here after each cycle completes.
72
+
73
+ <!-- Cycle 1 — [date] — [brief summary of what was built] -->
@@ -0,0 +1,66 @@
1
+ # Brief: [Feature/Change Name]
2
+
3
+ **Date:** YYYY-MM-DD
4
+ **Architect:** Claude (Architect role)
5
+ **Status:** Draft | Ready for Builder | In Review | Complete
6
+
7
+ ---
8
+
9
+ ## Objective
10
+
11
+ > One sentence. What outcome does the user want?
12
+
13
+ ---
14
+
15
+ ## Scope
16
+
17
+ ### In Scope
18
+ -
19
+
20
+ ### Out of Scope
21
+ -
22
+
23
+ ---
24
+
25
+ ## Graph Context
26
+
27
+ **Relevant modules:**
28
+ -
29
+
30
+ **Blast radius** (modules affected by this change):
31
+ -
32
+
33
+ **Risk nodes** (god nodes or high-degree nodes in path):
34
+ -
35
+
36
+ **Graph last updated:** YYYY-MM-DD
37
+
38
+ ---
39
+
40
+ ## Implementation Hints
41
+
42
+ > Suggested approach. Not prescriptive — Builder may deviate with good reason.
43
+
44
+ -
45
+
46
+ **Files Builder must read before starting:**
47
+ -
48
+
49
+ **Patterns to follow** (from graph clusters):
50
+ -
51
+
52
+ ---
53
+
54
+ ## Acceptance Criteria
55
+
56
+ - [ ]
57
+
58
+ ---
59
+
60
+ ## Handoff Note
61
+
62
+ > Any special context Builder needs that isn't in the above.
63
+
64
+ ---
65
+
66
+ *— Architect handoff complete. Start Builder role in a new Cursor chat.*
@@ -0,0 +1,7 @@
1
+ # Review Log
2
+
3
+ > This file is append-only. Each cycle adds a new section. Never delete history.
4
+
5
+ ---
6
+
7
+ <!-- Reviewer and QA append their results below, newest at top -->
@@ -0,0 +1,60 @@
1
+ # GraphStack GNAP Board
2
+
3
+ Git-native task coordination. No server. No database. Just files.
4
+
5
+ ```
6
+ board/
7
+ todo/ ← Architect creates tasks here
8
+ doing/ ← Role "claims" a task by moving it here
9
+ done/ ← Completed tasks land here
10
+ ```
11
+
12
+ ## How It Works
13
+
14
+ 1. Architect writes `handoff/BRIEF.md` as usual
15
+ 2. Architect also creates `board/todo/<task-id>.json`
16
+ 3. Builder moves the file to `board/doing/` when starting
17
+ 4. On completion, moves to `board/done/`
18
+ 5. Git history = full audit trail of who did what, when
19
+
20
+ ## Why Git?
21
+
22
+ - Cursor kapatsan bile board persist eder
23
+ - Ekip arkadaşın `git pull` yapınca board'u görür
24
+ - `git log board/` = tam denetim izi
25
+ - Sunucu yok, veritabanı yok, kurulum yok
26
+
27
+ ## Task File Format
28
+
29
+ Create `board/todo/<task-id>.json` (filename must match `id`):
30
+
31
+ ```json
32
+ {
33
+ "id": "add-rate-limiting",
34
+ "title": "Add rate limiting to login endpoint",
35
+ "created_at": "2026-05-04T10:00:00Z",
36
+ "created_by": "architect",
37
+ "brief": "handoff/BRIEF.md",
38
+ "graph_nodes": [],
39
+ "criteria_count": 0,
40
+ "priority": "normal",
41
+ "status": "todo",
42
+ "assigned_to": null,
43
+ "started_at": null,
44
+ "completed_at": null,
45
+ "notes": ""
46
+ }
47
+ ```
48
+
49
+ Or use the CLI:
50
+
51
+ ```bash
52
+ python -m graphstack board new <task-id> "Task title here"
53
+ python -m graphstack board claim <task-id> builder
54
+ python -m graphstack board complete <task-id>
55
+ python -m graphstack board reopen <task-id> --to todo # done → todo
56
+ python -m graphstack board list-done --limit 10
57
+ python -m graphstack board status
58
+ ```
59
+
60
+ Required fields: `id`, `title`, `status`, `created_at`.