An on-demand CLI + GUI tool that turns a local codebase into modular text packages optimized for NotebookLM and similar LLM workflows.
Spec: srs.txt (SRS v8.0) · License: MIT · Türkçe kılavuz ↓
Smart Codebase Bundler scans a project in your local development environment (Cursor / VS Code / any repo) and splits the source into orderly .txt packages that large language models can ingest efficiently.
| Problem | Solution |
|---|---|
| Dumping an entire repo into an LLM wastes tokens and loses context | Code is packed per module (bundle_lib, bundle_web, …) |
| Binaries / large files add noise | Text allow-list + 500 KB hard size cap |
| Re-packing from scratch every time is slow | MD5 + token cache rebuilds only what changed |
| Partial / corrupted packages when writing to Drive | All-or-nothing transfer + rollback |
| Manifest syncing too early (Google Drive race) | 5-second delay after all packages, then bundle_manifest.json |
In short: you trigger the tool (CLI or GUI) → it produces safe packages → if the output folder is a Google Drive sync path, Drive uploads them so NotebookLM can use them as sources.
⚠️ This tool does not call the Google Drive API. PointSMART_BUNDLER_OUTPUTat Drive’s local sync folder and let the desktop client handle upload.
- On-demand runs — terminal (
main.py) or graphical UI (gui.py) --dry-run/-d— report which modules would rebuild and estimate tokens; write nothing--force/-f— ignore cache and rebuild the whole project- Graceful shutdown — CLI:
Ctrl+C(SIGINT) / SIGTERM; GUI: on window close, wait for the worker thencleanup()(TEMP removal, FR-1.2) - GUI safety — action buttons locked while a job runs; work on a background thread; ANSI stripped from logs; calls
run_pipeline(nevermain(), which raisesSystemExit); closing mid-run usesrequest_cancelso TEMP is not deleted under an active writer
- Hierarchical
.gitignorestack (push on enter directory, pop on leave) - Virtual Smartignore — paths chosen in the GUI / set via env are ignored in RAM only (no ignore file written to disk; FR-4.1)
- Windows MAX_PATH handled via
\\?\path normalization (pathlib) - Symlinks are never followed; inode keys guard against cycles
- Broad text allow-list (
.py,.dart,.toml,Dockerfile,Podfile,.env.example, …) - Binary / archive rejection (extension + byte sniff)
- Files over 500 KB are skipped (yellow:
Skipped (exceeds 500 KB limit): …)
- Module model: first-level folders under the project root →
bundle_<folder>.txt; loose root files →bundle_general.txt - Empty modules are not emitted
- Hybrid tokens: fast
chars/4; tiktoken (cl100k_base) near capacity / for exact cache counts - Individual files are never split; overflow opens a new
_partN - Directory tree appears only in Part 1
- Each package starts with a NotebookLM-oriented SYSTEM NOTE
- Soft packing limit ≈ 100k tokens per part (
TOKEN_LIMITinbundler/tokenizer.py)
.bundle_cache.jsonlives outside the source tree:%APPDATA%/smart_bundler/(Windows) or~/.config/smart_bundler/- Portable cache fingerprint = folder name + sorted top-level child names (relocating the same tree reduces pointless full rebuilds; legacy path-hash caches migrate once)
- Per-file MD5 + exact token count; unchanged content skips tiktoken recompute
- Missing output parts force a mandatory rebuild (desync protection)
- One changed file rebuilds all parts of that module
- Sources streamed in 64 KB chunks; token probe uses
SpooledTemporaryFile(memory-friendly, FR-4.1 / NFR-1.2) - Write to TEMP → MD5 compare → transfer only changed files
- Failure on a multi-part module → rollback (previous good version kept)
- Orphan
bundle_*.txtcleanup — only files with the Smart BundlerSYSTEM NOTEheader are deleted (personalbundle_notes.txt-style files are left alone) - After transfer, 5-second wait → write
bundle_manifest.json(Drive race mitigation)
This repository is a Python CLI + tkinter GUI project (not a Flutter / Firebase app).
| Layer | Technology | Role |
|---|---|---|
| Language | Python 3.10+ | Runtime |
| CLI | argparse, signal |
Flags & signal handlers |
| GUI | tkinter (stdlib) | Folder pickers, action buttons, log pane |
| Filesystem | pathlib, tempfile, shutil |
Paths, TEMP, atomic moves |
| Tokens | tiktoken (cl100k_base) |
Exact token counts |
| Terminal | colorama | Colored status / warnings (ANSI stripped in GUI) |
| Hashing | hashlib (MD5) |
Change & desync detection |
| Stdlib | json, threading, io / spool |
Manifest, timed reads, streaming, GUI worker |
| Spec | srs.txt (SRS v8.0) |
Requirements source of truth |
External dependencies (requirements.txt):
tiktoken>=0.7.0
colorama>=0.4.6
- Windows 10/11 (Linux / macOS supported; adjust paths for your OS)
- Python 3.10+ — on Windows, the
py -3launcher is recommended - (Optional) Google Drive desktop app — if you want output under a Drive sync folder
- (Optional) Git
# 1) Clone
git clone https://github.com/<username>/notebook_script.git
cd notebook_script
# 2) Install deps (once)
py -3 -m pip install -r requirements.txtRun from the project you want to pack, and pass the full path to the bundler script:
# Project to pack
cd C:\Users\<username>\Documents\GitHub\<your-project-folder>
# Output (e.g. Google Drive local folder)
$env:SMART_BUNDLER_OUTPUT = "G:\My Drive\NotebookLM_Bundles"
# Preview (no writes)
py -3 C:\Users\<username>\Documents\GitHub\notebook_script\main.py -d
# Real pack
py -3 C:\Users\<username>\Documents\GitHub\notebook_script\main.py| Variable | Meaning | Default |
|---|---|---|
SMART_BUNDLER_OUTPUT |
Folder where packages are written | <project>/bundles |
SMART_BUNDLER_ROOT |
Project root to scan | Current working directory (cwd) |
SMART_BUNDLER_VIRTUAL_IGNORE |
Absolute paths to exclude (comma-separated) | empty (none) |
💡 In PowerShell,
$env:...lasts only for that terminal session. Set it again in a new window.
py -3 ...\main.py # Normal (changed modules only)
py -3 ...\main.py -d # Dry-run / preview
py -3 ...\main.py -f # Force — rebuild everything
py -3 ...\main.py -h # Help
| Flag | Equivalent | Behavior |
|---|---|---|
| (none) | Bundle | Write; rebuild only modules that need it |
-d |
Token cost / dry-run | No write; show rebuild plan + ~tokens |
-f |
Force run | Write; ignore cache |
-d -f |
Full dry-run | No write; treat everything as REBUILD for preview |
No extra GUI dependency (tkinter ships with Python).
| Method | How |
|---|---|
| Desktop shortcut | Smart Codebase Bundler.lnk (once: powershell -ExecutionPolicy Bypass -File .\create_desktop_shortcut.ps1) |
| Double-click | gui.bat in the repo root |
| Terminal | py -3 gui.py |
cd C:\Users\<username>\Documents\GitHub\notebook_script
py -3 gui.py
# or
.\gui.bat| Region | What it does |
|---|---|
| Source / Output + Browse | Sets scan root and output folder → SMART_BUNDLER_ROOT / SMART_BUNDLER_OUTPUT |
| Virtual Ignore | Add files / Add folder / Clear → SMART_BUNDLER_VIRTUAL_IGNORE (RAM only; nothing written to disk) |
| 1 · Token cost | main.py -d — no write; ~tokens for modules that would change |
| 2 · Dry run | main.py -d -f — no write; preview all modules as REBUILD |
| 3 · Force run | main.py -f — write; ignore cache; rebuild everything |
| 4 · Bundle | main.py — write; rebuild changed modules only |
| Log | Live stdout/stderr (colorama ANSI stripped) |
| Window close (X) | After the worker finishes: cleanup() (FR-1.2 / TEMP). TEMP is not deleted while a write is in progress |
The GUI does not modify
bundler/internals and does not callmain()(SystemExitwould kill the window). It sets env vars and runsrun_pipelineon a worker thread. All four action buttons stay disabled until the job ends. Virtual Ignore paths become root-anchored gitignore-style rules in memory. Orphan cleanup only deletesbundle_*.txtfiles that carry the Smart BundlerSYSTEM NOTEheader.
There are two entry points: CLI (main.py) and GUI (gui.py).
- Install dependencies (
pip install -r requirements.txt). cdinto the repo you want to pack.- Set
SMART_BUNDLER_OUTPUTto your Drive folder (or use the defaultbundles). - Run with
-dand readREBUILD/skip (cache)lines. - Run without flags → look for
Done.andManifest: .... - After Drive finishes syncing, add
bundle_*.txt+bundle_manifest.jsonas NotebookLM sources.
cd C:\Users\<username>\Documents\GitHub\<your-project-folder>
$env:SMART_BUNDLER_OUTPUT = "G:\My Drive\NotebookLM_Bundles"
py -3 C:\Users\<username>\Documents\GitHub\notebook_script\main.pyDecision matrix:
| Situation | Behavior |
|---|---|
| File content unchanged + output present | skip (cache) — no rewrite |
| File changed | That module REBUILD |
A bundle_*.txt was deleted from the output/Drive folder |
Desync → regenerate |
You passed -f |
All modules rebuild |
- Cyan
Dry-run— simulation mode; nothing written to disk (same text in the GUI, without color codes) [REBUILD]/[skip (cache)]— which packages will refresh- Yellow
Skipped (exceeds 500 KB limit): ...— large file intentionally dropped (not an error) - Yellow
Skipping unreadable file...— locked / unreadable file; an error marker is left in the package - Yellow
Orphan skip (not a Smart Bundler artifact)— name matchesbundle_*.txtbut no our header → not deleted - Green
Done.— success; transferred file count and manifest path
- Upload first:
bundle_lib,bundle_backend, core domain packages,bundle_general,bundle_manifest.json - Add when needed:
web/ UI sources - Often defer:
android,ios,windowsand other native scaffold-heavy trees (high noise / token cost)
cd C:\Users\<username>\Documents\GitHub\<your-project-folder>
$env:SMART_BUNDLER_OUTPUT = "G:\My Drive\NotebookLM_Bundles"
py -3 C:\Users\<username>\Documents\GitHub\notebook_script\main.py -d
py -3 C:\Users\<username>\Documents\GitHub\notebook_script\main.pyForce:
py -3 C:\Users\<username>\Documents\GitHub\notebook_script\main.py -f1. CLI + signal handlers
2. Scan with gitignore stack (+ virtual ignore)
3. Cache / desync analysis
4. Stream-pack modules that need rebuild
5. All-or-nothing transfer (+ MD5 skip)
6. Orphan cleanup → 5 s delay → manifest → TEMP cleanup
notebook_script/
├── main.py # 🚪 CLI entry — 6-stage pipeline
├── gui.py # 🖼️ tkinter GUI — run_pipeline + cleanup
├── gui.bat # ▶️ Double-click GUI launcher (Windows)
├── create_desktop_shortcut.ps1 # 🔗 Desktop .lnk helper
├── .gitignore # 🚫 bundles/, venv/, __pycache__, …
├── LICENSE # ⚖️ MIT
├── requirements.txt # 📦 tiktoken, colorama
├── srs.txt # 📋 Software requirements (SRS v8.0)
├── README.md # 📘 This document
├── bundles/ # 📤 Default output (local tests; gitignored)
│ ├── bundle_*.txt
│ └── bundle_manifest.json
└── bundler/ # 🧩 Packing core
├── __init__.py
├── cli.py # argparse, SIGINT/SIGTERM
├── scanner.py # scan, gitignore, filters, MAX_PATH
├── cache.py # AppData cache, MD5, desync
├── tokenizer.py # hybrid tokens + tiktoken
└── writer.py # stream pack, transfer, rollback, manifest
| File | Responsibility |
|---|---|
main.py |
Orchestration, dry-run report, cleanup / cancel registration |
gui.py |
tkinter UI; env paths; virtual ignore; threaded run_pipeline; X → deferred cleanup |
bundler/cli.py |
-f / -d, signals → cleanup |
bundler/scanner.py |
Discovery, gitignore stack, virtual ignore, filters |
bundler/cache.py |
Persistent cache path, rebuild decisions, identity fingerprint |
bundler/tokenizer.py |
Token limit (~100k) and hybrid counting |
bundler/writer.py |
Module grouping, stream write, transfer, orphan gate, manifest |
- Single part:
bundle_<module>.txt - Multi-part:
bundle_<module>_part1.txt,_part2.txt, … - Root-level files:
bundle_general.txt - Roadmap / index:
bundle_manifest.json
- Windows:
%APPDATA%\smart_bundler\<fingerprint>\.bundle_cache.json - Linux/macOS:
~/.config/smart_bundler/<fingerprint>/.bundle_cache.json
fingerprint = MD5(folder name + top-level child names). Moving the project to another path with the same name/structure keeps the cache; older absolute-path digests are migrated once on load.
Contributions are welcome. Short guide:
- Follow the SRS — for behavior changes, use
srs.txt(v8.0) as the reference. - Keep the memory / path / rollback rules described in
srs.txtand the packing core intact. - Fork → feature branch → PR.
- After changes, at least:
py -3 main.py -d py -3 main.py py -3 gui.py # confirm GUI path still works
- Regression-check large-file filtering, stream writes, and all-or-nothing transfer.
- Avoid new dependencies; the stack is intentionally minimal (
gui.pyuses stdlibtkinteronly).
- Token limits:
bundler/tokenizer.py→TOKEN_LIMIT,CHAR_LIMIT - Size filter:
bundler/scanner.py→MAX_FILE_SIZE - Manifest delay:
bundler/writer.py→MANIFEST_DELAY_SEC = 5
- Bugs / features: GitHub Issues (this repository)
- Requirements discussion: align via
srs.txt
| Goal | Command |
|---|---|
| Install deps | py -3 -m pip install -r requirements.txt |
| Open GUI | py -3 gui.py or gui.bat / desktop shortcut |
| Preview | py -3 ...\main.py -d |
| Pack | py -3 ...\main.py |
| Force rebuild | py -3 ...\main.py -f |
| Output path | $env:SMART_BUNDLER_OUTPUT = "G:\My Drive\..." |
| Source root | $env:SMART_BUNDLER_ROOT = "C:\...\project" |
| Virtual ignore | $env:SMART_BUNDLER_VIRTUAL_IGNORE = "C:\...\skip,D:\...\dir" |
Kaynak kodunu NotebookLM (ve benzeri LLM araçları) için optimize edilmiş, modüler metin paketlerine dönüştüren on-demand CLI + GUI aracı.
Smart Codebase Bundler, yerel geliştirme ortamındaki (Cursor / VS Code / herhangi bir repo) proje kodunu tarayıp, büyük dil modellerinin kolayca okuyabileceği düzenli .txt paketlerine ayırır.
| Sorun | Çözüm |
|---|---|
| Tüm repoyu tek seferde LLM’e yüklemek token israfı ve bağlam kaybı yaratır | Kod modül bazlı (bundle_lib, bundle_web, …) paketlenir |
| Binary / büyük dosyalar gürültü üretir | Metin filtre + 500 KB üst sınırı |
| Her seferinde sıfırdan paketlemek zaman kaybı | MD5 + token önbelleği ile yalnızca değişenler yenilenir |
| Drive’a yazarken yarım kalan / bozulmuş paket riski | All-or-nothing transfer + rollback |
| Manifest’in erken senkron olması (Google Drive race) | Tüm paketlerden sonra 5 sn bekleme, sonra bundle_manifest.json |
Özet: Geliştirici komutu veya GUI ile tetikler → script güvenli paketler üretir → çıktıyı Google Drive klasörüne yazarsanız Drive senkronu NotebookLM kaynağına taşır.
⚠️ Bu araç Google Drive API’sine doğrudan yükleme yapmaz.SMART_BUNDLER_OUTPUTile Drive’ın yerel senkron klasörünü hedeflemeniz yeterlidir.
- On-demand çalıştırma — terminal (
main.py) veya grafik arayüz (gui.py) --dry-run/-d— hiçbir dosya yazmadan hangi modüllerin yenileneceğini ve tahmini token’ı gösterir--force/-f— önbelleği yok sayıp tüm projeyi sıfırdan paketler- Graceful shutdown — CLI’de
Ctrl+C(SIGINT) / SIGTERM; GUI’de pencere kapatırken worker bitincecleanup()ile geçici klasör temizliği - GUI güvenlikleri — işlem süresince tüm aksiyon butonları kilitli, arka planda thread, ANSI’siz log,
main()yerinerun_pipeline; X sırasında TEMP race yok
- Hiyerarşik
.gitignoreyığını (dizine girince push, çıkınca pop) - Virtual Smartignore — GUI/env ile seçilen yolları RAM’de ignore et (diske yazılmaz)
- Windows MAX_PATH aşımı için
\\?\yol normalizasyonu (pathlib) - Symlink takip edilmez; inode ile döngü koruması
- Geniş metin allow-list (
.py,.dart,.toml,Dockerfile,Podfile,.env.example, …) - Binary / arşiv eleme (uzantı + byte sniff)
- 500 KB üzeri dosyalar atlanır (sarı uyarı:
Skipped (exceeds 500 KB limit): …)
- Modül modeli: kökteki ilk seviye klasörler →
bundle_<klasör>.txt; kökteki tekil dosyalar →bundle_general.txt - Boş modül üretilmez
- Hibrit token: hızlı
karakter/4; kritik dolulukta tiktoken (cl100k_base) - Bireysel dosyalar bölünmez; sınır aşılınca yeni
_partNaçılır - Dizin ağacı yalnızca Part 1’de
- Her paketin başında NotebookLM için SYSTEM NOTE yönergesi
.bundle_cache.jsonkaynak ağacında değil;%APPDATA%/smart_bundler/(Windows) veya~/.config/smart_bundler/- Cache fingerprint = klasör adı + üst seviye çocuklar (taşıma sonrası gereksiz REBUILD azalır)
- Dosya başına MD5 + tam token saklanır; içerik aynıysa tiktoken tekrarlanmaz
- Çıktıda eksik paket varsa zorunlu yeniden üretim (desync koruması)
- Bir dosya değişince ilgili modülün tüm part’ları baştan üretilir
- Kaynaklar 64 KB chunk ile stream edilir;
SpooledTemporaryFileile bellek dostu probe - TEMP’e yazım → MD5 karşılaştırma → yalnızca değişenler taşınır
- Çok parçalı modüllerde hata → rollback (eski sağlam sürüm korunur)
- Yetim
bundle_*.txttemizliği — yalnızca Smart BundlerSYSTEM NOTEbaşlıklı dosyalar - Transfer sonrası 5 saniye bekleme →
bundle_manifest.json
Bu depo bir Python CLI + tkinter GUI projesidir (Flutter / Firebase uygulaması değildir).
| Katman | Teknoloji | Rol |
|---|---|---|
| Dil | Python 3.10+ | Ana çalışma zamanı |
| CLI | argparse, signal |
Argümanlar & sinyal yönetimi |
| GUI | tkinter (stdlib) | Klasör seçimi, aksiyon butonları, log ekranı |
| Dosya sistemi | pathlib, tempfile, shutil |
Yol, TEMP, atomik taşıma |
| Token | tiktoken (cl100k_base) |
Tam token sayısı |
| Terminal | colorama | Renkli uyarı / durum çıktısı (GUI’de ANSI temizlenir) |
| Hash | hashlib (MD5) |
Değişiklik & desync tespiti |
| Standart kütüphane | json, threading, io / spool |
Manifest, timeout okuma, stream, GUI worker |
| Spesifikasyon | srs.txt (SRS v8.0) |
Gereksinim kaynağı |
Harici bağımlılıklar (requirements.txt):
tiktoken>=0.7.0
colorama>=0.4.6
- Windows 10/11 (Linux / macOS da desteklenir; yollar OS’e göre değişir)
- Python 3.10+ — Windows’ta
py -3launcher önerilir - (İsteğe bağlı) Google Drive masaüstü uygulaması — çıktıyı Drive klasörüne yazmak için
- (İsteğe bağlı) Git
# 1) Repoyu klonla
git clone https://github.com/<username>/notebook_script.git
cd notebook_script
# 2) Bağımlılıkları kur (bir kez)
py -3 -m pip install -r requirements.txtBu aracı paketlemek istediğiniz projenin klasöründen çalıştırın; script yolunu tam verin:
# Paketlenecek proje
cd C:\Users\<username>\Documents\GitHub\<your-project-folder>
# Çıktı (ör. Google Drive yerel klasörü)
$env:SMART_BUNDLER_OUTPUT = "G:\My Drive\NotebookLM_Paketler"
# Önizleme (yazmaz)
py -3 C:\Users\<username>\Documents\GitHub\notebook_script\main.py -d
# Gerçek paketleme
py -3 C:\Users\<username>\Documents\GitHub\notebook_script\main.py| Değişken | Anlamı | Varsayılan |
|---|---|---|
SMART_BUNDLER_OUTPUT |
Paketlerin yazılacağı klasör | <proje>/bundles |
SMART_BUNDLER_ROOT |
Taranacak proje kökü | Şu anki çalışma dizini (cwd) |
SMART_BUNDLER_VIRTUAL_IGNORE |
Paket dışı bırakılacak mutlak yollar (virgülle) | boş (yok) |
💡 PowerShell’de
$env:...ataması yalnızca o terminal oturumu için geçerlidir. Yeni pencerede tekrar yazmanız gerekir.
py -3 ...\main.py # Normal (yalnızca değişenler)
py -3 ...\main.py -d # Dry-run / önizleme
py -3 ...\main.py -f # Force — her şeyi yeniden paketle
py -3 ...\main.py -h # Yardım
Ek bağımlılık yok (tkinter Python ile gelir).
Başlatma
| Yol | Nasıl |
|---|---|
| Masaüstü kısayolu | Smart Codebase Bundler.lnk (bir kez: powershell -ExecutionPolicy Bypass -File .\create_desktop_shortcut.ps1) |
| Çift tık | Repo kökündeki gui.bat |
| Terminal | py -3 gui.py |
cd C:\Users\<username>\Documents\GitHub\notebook_script
py -3 gui.py
# veya
.\gui.bat| Bölüm | Ne yapar |
|---|---|
| Source / Output + Browse | Taranacak proje ve çıktı klasörü → SMART_BUNDLER_ROOT / SMART_BUNDLER_OUTPUT |
| Virtual Ignore | Add files / folder / Clear → SMART_BUNDLER_VIRTUAL_IGNORE (RAM; diske yazılmaz) |
| 1 · Token cost | main.py -d — yazmaz; değişenlerin ~token tahmini |
| 2 · Dry run | main.py -d -f — yazmaz; her şeyi REBUILD gibi önizler |
| 3 · Force run | main.py -f — yazar; önbelleği yok sayıp hepsini paketler |
| 4 · Bundle | main.py — yazar; yalnızca değişenleri paketler |
| Log | Terminal çıktısını anlık gösterir (colorama ANSI kodları temizlenir) |
| Window close (X) | Worker bitince cleanup() (FR-1.2 / TEMP); yazma sırasında TEMP silinmez |
GUI,
bundler/çekirdeğine dokunmaz;main()çağırmaz (SystemExitpencereyi kapatırdı). Doğrudanrun_pipelinekullanır. İşlem bitene kadar dört buton da kilitlidir. Virtual Ignore seçimleri tarayıcıda kök-göreli gitignore kurallarına çevrilir; geçici ignore dosyası oluşturulmaz (FR-4.1). Orphan temizliği yalnızca Smart BundlerSYSTEM NOTEbaşlıklı dosyaları siler.
İki giriş noktası vardır: terminal CLI (main.py) ve GUI (gui.py). Tipik CLI akışı:
notebook_scriptbağımlılıklarını kurun (pip install -r requirements.txt).- Paketlemek istediğiniz repoya
cdyapın. - Drive klasörünüzü
SMART_BUNDLER_OUTPUTile verin (veya varsayılanbundleskullanın). -dile önizleyin →REBUILD/skip (cache)satırlarını okuyun.- Parametresiz çalıştırın → bitince
Done.veManifest: ...görünür. - Çıktı klasöründeki
bundle_*.txt+bundle_manifest.jsondosyalarını NotebookLM’e kaynak olarak ekleyin (Drive senkronu tamamlandıktan sonra).
cd C:\Users\<username>\Documents\GitHub\<your-project-folder>
$env:SMART_BUNDLER_OUTPUT = "G:\My Drive\NotebookLM_Paketler"
py -3 C:\Users\<username>\Documents\GitHub\notebook_script\main.pyScript otomatik karar verir:
| Durum | Davranış |
|---|---|
| Dosya içeriği aynı + çıktı yerinde | skip (cache) — yeniden yazmaz |
| Dosya değişti | İlgili modül REBUILD |
Drive’daki bundle_*.txt silindi |
Desync → yeniden üretir |
-f verdiniz |
Tüm modüller yeniden |
- Cyan
Dry-run— deneme modu; disk yazılmaz (GUI’de renk kodu olmadan aynı metin) [REBUILD]/[skip (cache)]— hangi paketlerin yenileneceği- Sarı
Skipped (exceeds 500 KB limit): ...— büyük dosya bilinçli elendi (hata değil) - Sarı
Skipping unreadable file...— kilitli / okunamayan dosya; pakette hata notu bırakılır - Sarı
Orphan skip (not a Smart Bundler artifact)—bundle_*.txtama bizim header yok → silinmez - Yeşil
Done.— başarı; transfer edilen dosya sayısı ve manifest yolu
py -3 gui.pyile pencereyi açın.- Source folder = paketlenecek repo; Output folder = Drive /
bundlesvb. - İsteğe bağlı: Virtual Ignore → Add files / Add folder.
- Önce Token cost veya Dry run → logda yazmadan önizleme.
- Sonra Bundle (yalnızca değişenler) veya Force run (hepsi) → gerçek yazım.
- İşlem sürerken dört buton kilitlidir; X ile kapatınca worker bitince TEMP temizlenir.
- Öncelikli yükle:
bundle_lib,bundle_backend, asıl iş mantığı paketleri,bundle_general,bundle_manifest.json - İhtiyaç olunca ekle:
web/ UI kaynakları - Çoğu zaman ertele:
android,ios,windowsgibi native şablon ağırlıklı klasörler (gürültü / token maliyeti yüksek olabilir)
cd C:\Users\<username>\Documents\GitHub\<your-project-folder>
$env:SMART_BUNDLER_OUTPUT = "G:\My Drive\NotebookLM_Paketler"
py -3 C:\Users\<username>\Documents\GitHub\notebook_script\main.py -d
py -3 C:\Users\<username>\Documents\GitHub\notebook_script\main.pyForce:
py -3 C:\Users\<username>\Documents\GitHub\notebook_script\main.py -f1. CLI + sinyal handler
2. Gitignore stack ile tarama
3. Cache / desync analizi
4. Değişen modülleri stream ile paketle
5. All-or-nothing transfer (+ MD5 skip)
6. Orphan temizlik → 5 sn → manifest → TEMP temizlik
notebook_script/
├── main.py # 🚪 CLI giriş — 6 aşamalı pipeline
├── gui.py # 🖼️ tkinter GUI — run_pipeline + cleanup
├── gui.bat # ▶️ GUI çift tık başlatıcı (Windows)
├── create_desktop_shortcut.ps1 # 🔗 Masaüstü .lnk oluşturucu
├── .gitignore # 🚫 bundles/, venv/, __pycache__, …
├── LICENSE # ⚖️ MIT
├── requirements.txt # 📦 tiktoken, colorama
├── srs.txt # 📋 Yazılım gereksinimleri (SRS v8.0)
├── README.md # 📘 Bu doküman
├── bundles/ # 📤 Varsayılan çıktı (yerel test)
│ ├── bundle_*.txt
│ └── bundle_manifest.json
└── bundler/ # 🧩 Paket çekirdeği
├── __init__.py
├── cli.py # argparse, SIGINT/SIGTERM
├── scanner.py # tarama, gitignore, filtreler, MAX_PATH
├── cache.py # AppData cache, MD5, desync
├── tokenizer.py # hibrit token + tiktoken
└── writer.py # stream paketleme, transfer, rollback, manifest
| Dosya | Sorumluluk |
|---|---|
main.py |
Orkestrasyon, dry-run raporu, cleanup kaydı |
gui.py |
tkinter arayüz; env yolları; virtual ignore; thread’de run_pipeline; X → cleanup |
bundler/cli.py |
-f / -d, sinyal → cleanup |
bundler/scanner.py |
Dosya keşfi, gitignore stack, virtual ignore, filtreleme |
bundler/cache.py |
Kalıcı önbellek yolu ve rebuild kararı |
bundler/tokenizer.py |
Token limiti (~100k) ve hibrit sayım |
bundler/writer.py |
Modül gruplama, stream yazım, transfer, orphan, manifest |
- Tek parça:
bundle_<modul>.txt - Çok parça:
bundle_<modul>_part1.txt,_part2.txt, … - Kök dosyalar:
bundle_general.txt - Yol haritası:
bundle_manifest.json
- Windows:
%APPDATA%\smart_bundler\<fingerprint>\.bundle_cache.json - Linux/macOS:
~/.config/smart_bundler/<fingerprint>/.bundle_cache.json
fingerprint = MD5(klasör adı + üst seviye çocuk isimleri). Projeyi başka diske aynı isim/yapıyla taşıyınca cache korunur; eski yol-hash cache bir kez yeni konuma migrate edilir.
Katkılar memnuniyetle karşılanır. Kısa rehber:
- SRS’ye uyun — davranış değişikliklerinde
srs.txt(v8.0) referans alın. srs.txtve paketleme çekirdeğindeki bellek / yol / rollback kurallarını bozmayın.- Fork → özellik dalı → PR.
- Değişiklik sonrası en azından:
py -3 main.py -d py -3 main.py py -3 gui.py # GUI yolu bozulmadıysa
- Büyük dosya filtresi, stream yazım ve all-or-nothing transfer’i regresyon testleriyle doğrulayın.
- Gereksiz bağımlılık eklemeyin; stack bilerek minimal tutuluyor (
gui.pyyalnızca stdlibtkinter).
- Token sınırları:
bundler/tokenizer.py→TOKEN_LIMIT,CHAR_LIMIT - Boyut filtresi:
bundler/scanner.py→MAX_FILE_SIZE - Manifest gecikmesi:
bundler/writer.py→MANIFEST_DELAY_SEC = 5
- Sorun / özellik: GitHub Issues (bu depo)
- Gereksinim tartışması:
srs.txtüzerinden hizalama
| Amaç | Komut |
|---|---|
| Bağımlılık kur | py -3 -m pip install -r requirements.txt |
| GUI aç | py -3 gui.py veya gui.bat / masaüstü kısayolu |
| Önizle | py -3 ...\main.py -d |
| Paketle | py -3 ...\main.py |
| Zorla yenile | py -3 ...\main.py -f |
| Çıktı yolu | $env:SMART_BUNDLER_OUTPUT = "G:\My Drive\..." |
| Kaynak kökü | $env:SMART_BUNDLER_ROOT = "C:\...\proje" |
| Virtual ignore | $env:SMART_BUNDLER_VIRTUAL_IGNORE = "C:\...\skip,D:\...\dir" |
Smart Codebase Bundler · SRS v8.0 · MIT · NotebookLM-ready modular packing