Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 15 additions & 6 deletions REFACTOR_INDEX.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,15 @@ Bu belge, GitArc projesinin kod tabanı sağlığını, modül sınırlarını,

| Katman | Dosya | Satır | Sorumluluk | Durum / Hedef |
|---|---|---|---|---|
| **Web Frontend** | `web/app.js` | 3.470 | Monolitik UI/SVG/State/Inspector/Modal orkestratörü | 🚨 **Modüler ES6 Modüllerine bölünecek** (Hedef: ~200 satır ana giriş) |
| **Web Frontend** | `web/app.js` | 494 | Ana orkestratör ve yaşam döngüsü | ✅ 3.470 satırdan 494 satıra düşürüldü |
| **Web Frontend** | `web/modules/canvas.js` | 756 | SVG paraboller, koordinatlar ve kapsül çizimleri | ✅ Modüler ayrıldı |
| **Web Frontend** | `web/modules/inspector.js` | 708 | Sağ detay paneli, formlar ve PR açıklama kartları | ✅ Modüler ayrıldı |
| **Web Frontend** | `web/modules/modals.js` | 327 | Çakışma stüdyosu, proje yöneticisi ve kokpit turu | ✅ Modüler ayrıldı |
| **Web Frontend** | `web/modules/dock.js` | 261 | PocketUI alt çekmece, radar ve log akışı | ✅ Modüler ayrıldı |
| **Web Frontend** | `web/modules/utils.js` | 215 | `esc`, `truncate`, zaman ve güvenlik yardımcıları | ✅ Modüler ayrıldı |
| **Web Frontend** | `web/modules/state.js` | 144 | Reaktif durum mağazası ve DOM kayıt defteri | ✅ Modüler ayrıldı |
| **Web Frontend** | `web/modules/api.js` | 25 | REST API istemcisi ve hata yönetimi | ✅ Modüler ayrıldı |
| **Web Frontend** | `web/modules/constants.js` | 16 | Layout ve geometri sabitleri | ✅ Modüler ayrıldı |
| **Web Frontend** | `web/fallback.js` | 672 | Tarayıcı çevrimdışı (offline) simülasyon motoru | ✅ İyi durumda (Tri-Mode parity korunuyor) |
| **Web Frontend** | `web/tasarim.css` | 2.931 | Tasarım sistemi, tema, PocketUI, animasyonlar | ✅ Düzenli, Strict CSP uyumlu |
| **Go Engine** | `internal/gitengine/simulation.go` | 1.423 | In-memory simülasyon repo yöneticisi | ✅ `simulation_enterprise_mock.go` (523 satır) ayrıldı |
Expand Down Expand Up @@ -62,8 +70,9 @@ Bu belge, GitArc projesinin kod tabanı sağlığını, modül sınırlarını,
- [x] **Adım 1:** Go - `simulation.go` içinden `buildEnterpriseSimulation` -> `simulation_enterprise_mock.go` ayrımı
- [x] **Adım 2:** Go - `collector.go` içinden GitHub CLI/API fonksiyonları -> `collector_github.go` ayrımı
- [x] **Adım 3:** Go testlerinin ve binary derlemesinin doğrulanması (`go test -v ./... && go build`) (25/25 PASS)
- [ ] **Adım 4:** JS - `web/modules/utils.js` ve `web/modules/state.js` / `api.js` temel altyapısının kurulması
- [ ] **Adım 5:** JS - `web/modules/canvas.js` (SVG render motoru) ayrımı
- [ ] **Adım 6:** JS - `web/modules/inspector.js` ve `web/modules/dock.js` ayrımı
- [ ] **Adım 7:** JS - `web/modules/modals.js` ayrımı
- [ ] **Adım 8:** `TestWebAssetsStrictCSPCompliance` ve tam sistem entegrasyon doğrulaması
- [x] **Adım 4:** JS - `web/modules/utils.js`, `constants.js`, `state.js` ve `api.js` altyapısının kurulması
- [x] **Adım 5:** JS - `web/modules/canvas.js` (SVG render motoru) ayrımı
- [x] **Adım 6:** JS - `web/modules/inspector.js` ve `web/modules/dock.js` ayrımı
- [x] **Adım 7:** JS - `web/modules/modals.js` ayrımı
- [x] **Adım 8:** JS - Üst/Alt Ray Popover (`renderRayPopovers`) ve etkileşim entegrasyonu tamamlandı
- [x] **Adım 9:** `TestWebAssetsStrictCSPCompliance`, `node --check` ve tam sistem entegrasyon doğrulaması (25/25 PASS)
38 changes: 20 additions & 18 deletions internal/gitengine/live_mutations.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,10 +125,28 @@ func (m *Manager) commitWorkingTreeLive(live *repoEntry, branchName, commitMsg,
curOut, _, _ := runCmd(ctx, live.path, "git", "branch", "--show-current")
curBranch := strings.TrimSpace(curOut)

if branchName != "" && branchName != curBranch {
if pushAndPR && branchName == defBranch {
targetBranch := branchName
if targetBranch == "" {
targetBranch = curBranch
}

if pushAndPR {
if targetBranch == "" || targetBranch == defBranch {
return model.CockpitSnapshot{}, fmt.Errorf("PR açmak için %s dışında yeni bir özellik dalı adı girin", defBranch)
}
// Block pushing to an already merged branch BEFORE switching
snap, _ := m.Snapshot()
for _, b := range snap.Branches {
if strings.EqualFold(b.Name, targetBranch) {
if b.State == "merged" || b.OriginGone || (b.PR != nil && b.PR.ReviewState == "MERGED") {
return model.CockpitSnapshot{}, fmt.Errorf("'%s' dalı zaten birleşmiş (merged/gone). Birleşmiş bir dalın üzerine push yapılamaz, lütfen yeni bir dal açın", targetBranch)
}
break
}
}
}

if branchName != "" && branchName != curBranch {
if _, _, err := runCmd(ctx, live.path, "git", "show-ref", "--verify", "--quiet", "refs/heads/"+branchName); err == nil {
if out, _, swErr := runCmd(ctx, live.path, "git", "switch", branchName); swErr != nil {
return model.CockpitSnapshot{}, fmt.Errorf("%s dalına geçilemedi: %s", branchName, strings.TrimSpace(out))
Expand All @@ -142,22 +160,6 @@ func (m *Manager) commitWorkingTreeLive(live *repoEntry, branchName, commitMsg,
curBranch = branchName
}

if pushAndPR {
if curBranch == "" || curBranch == defBranch {
return model.CockpitSnapshot{}, fmt.Errorf("PR açmak için %s dışında bir özellik dalı adı girin", defBranch)
}
// Block pushing to an already merged branch
snap, _ := m.Snapshot()
for _, b := range snap.Branches {
if b.Name == curBranch {
if b.State == "merged" || b.OriginGone || (b.PR != nil && b.PR.ReviewState == "MERGED") {
return model.CockpitSnapshot{}, fmt.Errorf("'%s' dalı zaten birleşmiş (merged/gone). Birleşmiş bir dalın üzerine push yapılamaz, lütfen yeni bir dal açın", curBranch)
}
break
}
}
}

cfg := LoadGuardConfig(live.path)
stagedFiles, err := StageSafeFiles(ctx, live.path, explicitFiles, cfg)
if err != nil {
Expand Down
4 changes: 4 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -178,14 +178,18 @@ func (a *App) routes() http.Handler {
mux.HandleFunc("/api/branch/fix-ci", a.guard(a.handleFixCI))
mux.HandleFunc("/api/branch/delete", a.guard(a.handleDeleteBranch))
mux.HandleFunc("/api/branch/prune", a.guard(a.handlePruneGone))
mux.HandleFunc("/api/branch/prune-gone", a.guard(a.handlePruneGone))
mux.HandleFunc("/api/pr/edit", a.guard(a.handleEditPR))
mux.HandleFunc("/api/commit/amend", a.guard(a.handleAmendCommit))
mux.HandleFunc("/api/spine/sync", a.guard(a.handleSyncSpine))
mux.HandleFunc("/api/sync-spine", a.guard(a.handleSyncSpine))
mux.HandleFunc("/api/logs/clear", a.guard(a.handleClearLogs))
mux.HandleFunc("/api/system/update-check", a.guard(a.handleUpdateCheck))
mux.HandleFunc("/api/repo/protect", a.guard(a.handleProtectBranch))
mux.HandleFunc("/api/simulation/reset", a.guard(a.handleResetSimulation))
mux.HandleFunc("/api/reset", a.guard(a.handleResetSimulation))
mux.HandleFunc("/api/test/run", a.guard(a.handleRunLocalTest))
mux.HandleFunc("/api/run-local", a.guard(a.handleRunLocalTest))
return mux
}

Expand Down
Loading
Loading