@aigencydev/cli 0.3.9 → 0.5.0

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/README.md CHANGED
@@ -3,50 +3,30 @@
3
3
  Terminalden yapay zeka destekli kod üretimi, dosya yönetimi ve proje otomasyonu.
4
4
  AIGENCY hesabınla bağlanır, projende çalışır, kodu senin onayınla yazar.
5
5
 
6
- ```
7
- ┌──────────────────────────────────────────┐
8
- │ ✦ AIGENCY CLI v0.3.0 │
9
- │ ● default · AIGENCY Pro · my-app │
10
- │ │
11
- │ ▸ Sana nasıl yardımcı olabilirim? │
12
- └──────────────────────────────────────────┘
13
- ```
14
-
15
6
  ---
16
7
 
17
8
  ## Kurulum
18
9
 
19
- **npm ile (önerilen)**
20
10
  ```bash
21
11
  npm install -g @aigencydev/cli
22
12
  ```
23
13
 
24
- **macOS / Linux shell installer**
25
- ```bash
26
- curl -fsSL https://aigency.dev/cli/install.sh | bash
27
- ```
28
-
29
- **Windows — PowerShell**
30
- ```powershell
31
- irm https://aigency.dev/cli/install.ps1 | iex
32
- ```
33
-
34
- > **Not:** Node.js 18.18 veya üzeri gerekir. `node --version` ile kontrol edebilirsin.
14
+ > Node.js 18.18 veya üzeri gerekir. `node --version` ile kontrol edebilirsiniz.
35
15
 
36
16
  ---
37
17
 
38
18
  ## Hızlı Başlangıç
39
19
 
40
20
  ```bash
41
- # 1) Hesabına bağlan (tarayıcı açılır)
21
+ # 1) Hesabınıza bağlanın (tarayıcı açılır)
42
22
  aigency login
43
23
 
44
- # 2) Bir proje dizinine gir ve .aigency/ iskeletini oluştur
24
+ # 2) Proje dizinine girin ve .aigency/ iskeletini oluşturun
45
25
  cd ~/projects/my-app
46
26
  aigency init
47
27
 
48
- # 3) Ajanla konuşmaya başla
49
- aigency "bana bir Next.js CV sitesi oluştur, Apple tarzı"
28
+ # 3) Ajanla konuşmaya başlayın
29
+ aigency "bana bir Next.js CV sitesi oluştur"
50
30
 
51
31
  # ya da interaktif modda
52
32
  aigency
@@ -58,32 +38,31 @@ aigency
58
38
 
59
39
  | Komut | Açıklama |
60
40
  |---|---|
61
- | `aigency` | İnteraktif sohbet modu (varsayılan) |
41
+ | `aigency` | İnteraktif sohbet modu |
62
42
  | `aigency "<prompt>"` | Tek seferlik prompt çalıştır |
63
- | `aigency login` | AIGENCY hesabına OAuth ile bağlan |
64
- | `aigency logout` | Oturumu kapat, yerel token'ları sil |
65
- | `aigency init` | Mevcut dizinde `.aigency/` yapısını kur |
43
+ | `aigency login` | AIGENCY hesabına bağlan |
44
+ | `aigency logout` | Oturumu kapat |
45
+ | `aigency init` | Mevcut dizinde `.aigency/` kur |
66
46
  | `aigency usage` | Aylık token kullanımını göster |
67
- | `aigency update` | En son sürümü kontrol et |
68
- | `aigency help` | Komut yardımı |
47
+ | `aigency update` | Sürüm kontrolü |
48
+ | `aigency help` | Yardım |
69
49
  | `aigency --version` | Sürümü göster |
70
-
71
- **Flag'ler:**
72
- - `--mode <default\|plan\|accept_edits\|auto>` — başlangıç izin modu
73
- - `--model <pro\|max>` — AIGENCY paket seviyesi
50
+ | `aigency --mode plan` | Plan modunda başlat (dry-run) |
51
+ | `aigency --mode accept_edits` | Düzenlemeleri otomatik kabul |
74
52
 
75
53
  ---
76
54
 
77
- ## İzin Modları
55
+ ## Slash Komutları
78
56
 
79
- | Mod | Davranış |
57
+ | Komut | İşlev |
80
58
  |---|---|
81
- | `default` | Dosya okuma otomatik, yazma ve komut için onay sorulur |
82
- | `plan` | Dry-run hiçbir şey yazılmaz, sadece yapılacakların planı gösterilir |
83
- | `accept_edits` | Dosya yazma otomatik, shell komutları hâlâ onay ister |
84
- | `auto` | Sınıflandırıcı destekli tam otomatik (yalnızca **Max** tier) |
85
-
86
- Mod'u çalışırken değiştirmek için **Shift+Tab** bas.
59
+ | `/help` | Komut listesi |
60
+ | `/clear` | Sohbet geçmişini temizle |
61
+ | `/mode [mod]` | İzin modunu değiştir veya göster |
62
+ | `/cost` | Bu oturumda kullanılan token |
63
+ | `/undo` | Son dosya düzenlemesini geri al |
64
+ | `/continue` | Kaldığın yerden devam et |
65
+ | `/exit` | Çıkış |
87
66
 
88
67
  ---
89
68
 
@@ -91,109 +70,75 @@ Mod'u çalışırken değiştirmek için **Shift+Tab** bas.
91
70
 
92
71
  | Tuş | İşlev |
93
72
  |---|---|
94
- | `Shift+Tab` | İzin modlarını döngüle (default → plan → accept_edits → auto) |
95
- | `ESC` | Aktif ajan işlemini iptal et |
73
+ | `Shift+Tab` | İzin modlarını döngüle |
74
+ | `ESC` | Aktif işlemi iptal et |
96
75
  | `Ctrl+C` | Çalışıyorsa iptal, boştaysa çıkış |
97
- | `/` | Slash komut başlat |
98
76
 
99
77
  ---
100
78
 
101
- ## Slash Komutları
79
+ ## İzin Modları
102
80
 
103
- | Komut | İşlev |
81
+ | Mod | Davranış |
104
82
  |---|---|
105
- | `/help` | Komut listesi |
106
- | `/clear` | Sohbet geçmişini ve onay cache'ini temizle |
107
- | `/mode [default\|plan\|accept_edits\|auto]` | Modu değiştir veya göster |
108
- | `/cost` | Bu oturumda kullanılan token sayısı |
109
- | `/undo` | Son dosya düzenlemesini geri al (checkpoint'ten) |
110
- | `/exit` veya `/quit` | Çıkış |
83
+ | `default` | Okuma otomatik, yazma ve komut için onay sorulur |
84
+ | `plan` | Dry-run hiçbir şey yazılmaz, sadece plan gösterilir |
85
+ | `accept_edits` | Dosya yazma otomatik, komutlar onay ister |
86
+ | `auto` | Tam otomatik (yalnızca Max paket) |
111
87
 
112
88
  ---
113
89
 
114
- ## Araçlar (Ajanın Kullanabildiği Tool'lar)
90
+ ## Araçlar
91
+
92
+ Ajan projenizde aşağıdaki işlemleri yapabilir:
93
+
94
+ **Dosya sistemi:** `read_file` · `list_files` · `search_files` · `write_file` · `edit_file` · `edit_file_multi`
115
95
 
116
- Ajan projenizde aşağıdaki işlemleri yapabilir (izin modunuza göre onay ister):
96
+ **Shell:** `bash_execute` interaktif olmayan komutlar, 5 dk timeout, canlı çıktı
117
97
 
118
- **Dosya sistemi**
119
- - `read_file` — Dosya içeriği okur
120
- - `list_files` — Dizin listeler (gitignore'a saygı duyar)
121
- - `search_files` — Regex ile içerik arar
122
- - `write_file` — Yeni dosya yazar veya tamamen değiştirir
123
- - `edit_file` — Mevcut dosyada cerrahi değişiklik yapar
98
+ **Doğrulama:** `verify_project` — proje sağlık kontrolü (package.json, scripts, node_modules)
124
99
 
125
- **Shell**
126
- - `bash_execute` — İnteraktif olmayan shell komutu çalıştırır (5 dk timeout, canlı çıktı akışı)
100
+ **Hafıza:** `save_memory` · `read_memory` · `delete_memory` — oturumlar arası kalıcı
127
101
 
128
- **Hafıza (kalıcı, makineye özel)**
129
- - `save_memory` — Önemli bilgiyi oturumlar arası sakla
130
- - `read_memory` — Detay hafıza dosyasını oku
131
- - `delete_memory` — Artık geçerli olmayan bilgiyi sil
102
+ **Görev planlama:** `write_tasks` · `read_tasks` — canlı ilerleme göstergesi
132
103
 
133
- **Görev planlama**
134
- - `write_tasks` — Büyük görevleri adımlara böl, ilerlemeyi canlı göster
135
- - `read_tasks` — Mevcut görev listesini oku
104
+ **Self-check:** `assert_done` — görev tamamlama doğrulaması
136
105
 
137
- **Sandbox:** `.git/`, `.env*`, `~/.ssh/`, `node_modules/`, `.next/` gibi hassas yollar
138
- otomatik reddedilir. `sudo`, `rm -rf /`, `curl | sh` gibi tehlikeli komutlar
139
- engellenir.
106
+ **Güvenlik:** `.git/`, `.env*`, `~/.ssh/`, `node_modules/` yazma yasak. `sudo`, `rm -rf /`, `curl | sh` otomatik engellenir.
140
107
 
141
108
  ---
142
109
 
143
- ## Proje Yapılandırması (`.aigency/`)
110
+ ## Proje Yapılandırması
144
111
 
145
- `aigency init` çalıştırdığında projenizde aşağıdaki yapı oluşturulur:
112
+ `aigency init` ile projenizde oluşturulur:
146
113
 
147
114
  ```
148
- <proje>/.aigency/
149
- ├── AIGENCY.md # Proje talimatları (ajan her oturum başında okur)
150
- ├── PROGRESS.md # İlerleme takibi (opsiyonel)
151
- ├── settings.json # İzin modu, allow/deny listeleri
152
- ├── settings.local.json # Kişisel override (gitignored)
153
- ├── rules/ # Path-scoped kurallar
154
- │ └── example.md
155
- ├── hooks/ # PreToolUse/PostToolUse script'leri
156
- │ ├── hooks.json
157
- │ └── README.md
158
- ├── logs/ # Günlük JSONL logları (gitignored)
115
+ .aigency/
116
+ ├── AIGENCY.md # Proje talimatları (her oturumda okunur)
117
+ ├── settings.json # İzin modu, allow/deny listeleri
118
+ ├── rules/ # Dosya bazlı kurallar
119
+ ├── hooks/ # PreToolUse/PostToolUse script'leri
159
120
  └── .gitignore
160
121
  ```
161
122
 
162
- **AIGENCY.md** en önemli dosyadırprojenizin teknoloji yığını, kodlama kuralları,
163
- stil tercihleri ve "dokunulmaması gereken yerler"i buraya yazın. Ajan her oturum
164
- başında bu dosyayı okur ve yazdığı kod bunlarla hizalanır.
123
+ **AIGENCY.md** projenizin kurallarını tanımlar — teknoloji yığını, kodlama standartları, dokunulmaması gereken yerler.
165
124
 
166
125
  ---
167
126
 
168
- ## Kalıcı Hafıza ve Oturum Verileri
169
-
170
- AIGENCY CLI, **makineye özel** veriler için kullanıcının home dizininde ayrı
171
- bir alan kullanır:
127
+ ## Kalıcı Veriler
172
128
 
173
129
  ```
174
130
  ~/.aigency/
175
- ├── cli.json # Auth metadata
176
- ├── credentials.enc # AES-256-GCM şifreli token'lar
177
- ├── settings.json # Kullanıcı seviyesi ayarlar
178
- ├── AIGENCY.md # Tüm projelerde geçerli global talimatlar
179
- ├── cli.log # Rotating log (5 MB × 3 yedek)
180
- ├── cache/ # LLM response, hash cache
181
- ├── temp/ # Oturum scratch alanı
182
- └── projects/
183
- └── <proje-hash>/ # Git remote veya yola göre hash
184
- ├── memory/
185
- │ ├── MEMORY.md # Hafıza index'i
186
- │ ├── user_*.md # Kullanıcı hakkında
187
- │ ├── feedback_*.md # Davranış kuralları
188
- │ ├── project_*.md # Proje bağlamı
189
- │ └── reference_*.md # Harici kaynak pointer'ları
190
- ├── sessions/
191
- │ └── <id>.jsonl # Oturum transkriptleri
192
- └── checkpoints/ # Dosya edit snapshot'ları (undo için)
131
+ ├── cli.json # Auth metadata
132
+ ├── credentials.enc # Şifreli token'lar (AES-256-GCM)
133
+ ├── settings.json # Global ayarlar
134
+ ├── cli.log # Rotating log
135
+ └── projects/<hash>/
136
+ ├── memory/ # Kalıcı hafıza (MEMORY.md + topic dosyaları)
137
+ ├── sessions/ # Oturum transkriptleri (JSONL)
138
+ └── checkpoints/ # Dosya edit snapshot'ları (/undo için)
193
139
  ```
194
140
 
195
- Bu alan **git'e commit edilmez** ve senkronize de olmaz — her makinede ayrı.
196
- `.aigency/` (proje klasörü) ise git'e eklenebilir, takımla paylaşılır.
141
+ Makineye özel, git'e eklenmez.
197
142
 
198
143
  ---
199
144
 
@@ -201,80 +146,207 @@ Bu alan **git'e commit edilmez** ve senkronize de olmaz — her makinede ayrı.
201
146
 
202
147
  | Paket | Fiyat | Aylık Token | Ek Özellikler |
203
148
  |---|---|---|---|
204
- | **AIGENCY CLI Pro** | 1.500 ₺/ay | 100.000.000 | Standart |
205
- | **AIGENCY CLI Max** | 3.000 ₺/ay | 500.000.000 | Öncelikli kuyruk, Auto mode |
149
+ | **CLI Pro** | 1.500 ₺/ay | 100.000.000 | Standart |
150
+ | **CLI Max** | 3.000 ₺/ay | 500.000.000 | Öncelikli kuyruk, Auto mode |
206
151
 
207
- Paketleri [aigency.dev/developer/cli](https://aigency.dev/developer/cli) üzerinden
208
- yönetebilir, kullanımınızı canlı izleyebilirsiniz.
152
+ Paket yönetimi: [aigency.dev/developer/cli](https://aigency.dev/developer/cli)
209
153
 
210
154
  ---
211
155
 
212
156
  ## Yapılandırma
213
157
 
214
- ### Ortam değişkenleri
215
-
216
158
  | Değişken | Açıklama |
217
159
  |---|---|
218
- | `AIGENCY_CLI_API_URL` | API sunucu adresi (varsayılan `https://aigency.dev`) |
219
- | `AIGENCY_CLI_DEBUG` | `1` verilirse ayrıntılı debug log'lar |
220
-
221
- ### `.aigency/settings.json` Örneği
222
-
223
- ```json
224
- {
225
- "permissions": {
226
- "defaultMode": "default",
227
- "allow": [
228
- "Read(**/*)",
229
- "Bash(npm run *)",
230
- "Bash(git status)"
231
- ],
232
- "ask": [
233
- "Write(**/*)",
234
- "Edit(**/*)",
235
- "Bash(*)"
236
- ],
237
- "deny": [
238
- "Read(.env)",
239
- "Write(.git/**)",
240
- "Bash(rm -rf *)",
241
- "Bash(sudo *)"
242
- ]
243
- },
244
- "memory": {
245
- "enabled": true
246
- },
247
- "hooks": {
248
- "enabled": false
249
- }
250
- }
160
+ | `AIGENCY_CLI_API_URL` | API adresi (varsayılan: `https://aigency.dev`) |
161
+ | `AIGENCY_CLI_DEBUG` | `1` ile debug loglar |
162
+
163
+ ---
164
+
165
+ ## Destek
166
+
167
+ - [aigency.dev/developer/cli](https://aigency.dev/developer/cli) — Yönetim paneli
168
+ - [aigency.dev/forge](https://aigency.dev/forge) — Tanıtım ve SSS
169
+ - [aigency.dev/contact](https://aigency.dev/contact) — İletişim
170
+
171
+ ---
172
+
173
+ ## Lisans
174
+
175
+ Özel lisans — AIGENCY. Tüm hakları saklıdır.
176
+
177
+ ---
178
+
179
+ # AIGENCY CLI (English)
180
+
181
+ AI-powered code generation, file management and project automation from your terminal.
182
+ Connect with your AIGENCY account, work in your project, code is written with your approval.
183
+
184
+ ---
185
+
186
+ ## Installation
187
+
188
+ ```bash
189
+ npm install -g @aigencydev/cli
251
190
  ```
252
191
 
192
+ > Requires Node.js 18.18 or higher.
193
+
253
194
  ---
254
195
 
255
- ## Geliştirme (Contributing)
196
+ ## Quick Start
256
197
 
257
198
  ```bash
258
- git clone https://github.com/aigencydev/cli.git
259
- cd cli
260
- npm install
261
-
262
- npm run dev -- help # tsx ile direkt çalıştır
263
- npm run typecheck # TypeScript tip kontrolü
264
- npm run test # Vitest
265
- npm run build # dist/ üret
199
+ # 1) Sign in (opens browser)
200
+ aigency login
201
+
202
+ # 2) Navigate to your project and create .aigency/ scaffold
203
+ cd ~/projects/my-app
204
+ aigency init
205
+
206
+ # 3) Start chatting with the agent
207
+ aigency "create a Next.js CV site for me"
208
+
209
+ # or interactive mode
210
+ aigency
266
211
  ```
267
212
 
268
213
  ---
269
214
 
270
- ## Destek
215
+ ## Commands
271
216
 
272
- - **Web**: [aigency.dev/developer/cli](https://aigency.dev/developer/cli)
273
- - **Tanıtım**: [aigency.dev/forge](https://aigency.dev/forge)
274
- - **Sorun / öneri**: [aigency.dev/contact](https://aigency.dev/contact)
217
+ | Command | Description |
218
+ |---|---|
219
+ | `aigency` | Interactive chat mode |
220
+ | `aigency "<prompt>"` | One-shot prompt |
221
+ | `aigency login` | Sign in to AIGENCY |
222
+ | `aigency logout` | Sign out |
223
+ | `aigency init` | Create `.aigency/` scaffold |
224
+ | `aigency usage` | Show monthly token usage |
225
+ | `aigency update` | Check for updates |
226
+ | `aigency help` | Help |
227
+ | `aigency --version` | Show version |
228
+ | `aigency --mode plan` | Start in plan mode (dry-run) |
275
229
 
276
230
  ---
277
231
 
278
- ## Lisans
232
+ ## Slash Commands
233
+
234
+ | Command | Action |
235
+ |---|---|
236
+ | `/help` | Command list |
237
+ | `/clear` | Clear chat history |
238
+ | `/mode [mode]` | Change or show permission mode |
239
+ | `/cost` | Tokens used this session |
240
+ | `/undo` | Revert last file edit |
241
+ | `/continue` | Resume from where you left off |
242
+ | `/exit` | Exit |
243
+
244
+ ---
245
+
246
+ ## Keyboard Shortcuts
247
+
248
+ | Key | Action |
249
+ |---|---|
250
+ | `Shift+Tab` | Cycle permission modes |
251
+ | `ESC` | Cancel active operation |
252
+ | `Ctrl+C` | Cancel if busy, exit if idle |
253
+
254
+ ---
255
+
256
+ ## Permission Modes
257
+
258
+ | Mode | Behavior |
259
+ |---|---|
260
+ | `default` | Reads automatic, writes and commands prompt for approval |
261
+ | `plan` | Dry-run — no writes, only shows the plan |
262
+ | `accept_edits` | Writes automatic, commands still require approval |
263
+ | `auto` | Full automation (Max tier only) |
264
+
265
+ ---
266
+
267
+ ## Tools
268
+
269
+ The agent can perform the following operations in your project:
270
+
271
+ **Filesystem:** `read_file` · `list_files` · `search_files` · `write_file` · `edit_file` · `edit_file_multi`
272
+
273
+ **Shell:** `bash_execute` — non-interactive commands, 5 min timeout, live output streaming
274
+
275
+ **Verification:** `verify_project` — project health check (package.json, scripts, node_modules)
276
+
277
+ **Memory:** `save_memory` · `read_memory` · `delete_memory` — persistent across sessions
278
+
279
+ **Task planning:** `write_tasks` · `read_tasks` — live progress indicator
280
+
281
+ **Self-check:** `assert_done` — task completion verification
282
+
283
+ **Security:** `.git/`, `.env*`, `~/.ssh/`, `node_modules/` are write-protected. `sudo`, `rm -rf /`, `curl | sh` are automatically blocked.
284
+
285
+ ---
286
+
287
+ ## Project Configuration
288
+
289
+ Created by `aigency init`:
290
+
291
+ ```
292
+ .aigency/
293
+ ├── AIGENCY.md # Project instructions (read every session)
294
+ ├── settings.json # Permission mode, allow/deny lists
295
+ ├── rules/ # Path-scoped rules
296
+ ├── hooks/ # PreToolUse/PostToolUse scripts
297
+ └── .gitignore
298
+ ```
299
+
300
+ **AIGENCY.md** defines your project rules — tech stack, coding standards, protected areas.
301
+
302
+ ---
303
+
304
+ ## Persistent Data
305
+
306
+ ```
307
+ ~/.aigency/
308
+ ├── cli.json # Auth metadata
309
+ ├── credentials.enc # Encrypted tokens (AES-256-GCM)
310
+ ├── settings.json # Global settings
311
+ ├── cli.log # Rotating log
312
+ └── projects/<hash>/
313
+ ├── memory/ # Persistent memory (MEMORY.md + topic files)
314
+ ├── sessions/ # Session transcripts (JSONL)
315
+ └── checkpoints/ # File edit snapshots (for /undo)
316
+ ```
317
+
318
+ Machine-local, never committed to git.
319
+
320
+ ---
321
+
322
+ ## Plans
323
+
324
+ | Plan | Price | Monthly Tokens | Extras |
325
+ |---|---|---|---|
326
+ | **CLI Pro** | 1,500 ₺/mo | 100,000,000 | Standard |
327
+ | **CLI Max** | 3,000 ₺/mo | 500,000,000 | Priority queue, Auto mode |
328
+
329
+ Manage plans at [aigency.dev/developer/cli](https://aigency.dev/developer/cli)
330
+
331
+ ---
332
+
333
+ ## Configuration
334
+
335
+ | Variable | Description |
336
+ |---|---|
337
+ | `AIGENCY_CLI_API_URL` | API address (default: `https://aigency.dev`) |
338
+ | `AIGENCY_CLI_DEBUG` | Set `1` for debug logs |
339
+
340
+ ---
341
+
342
+ ## Support
343
+
344
+ - [aigency.dev/developer/cli](https://aigency.dev/developer/cli) — Dashboard
345
+ - [aigency.dev/forge](https://aigency.dev/forge) — Product page & FAQ
346
+ - [aigency.dev/contact](https://aigency.dev/contact) — Contact
347
+
348
+ ---
349
+
350
+ ## License
279
351
 
280
- Özel — AIGENCY. Tüm hakları saklıdır.
352
+ Proprietary — AIGENCY. All rights reserved.
@@ -18,9 +18,22 @@ export function prepareChunk(prompt, history, options = {}) {
18
18
  warning: `Prompt tek başına ${promptTokens} token — context limiti (${available}) aşılıyor. Komutunuzu kısaltın.`,
19
19
  };
20
20
  }
21
- const reversed = [...history].reverse();
22
- const selected = [];
21
+ const pinned = [];
22
+ let remaining = [...history];
23
23
  let total = promptTokens;
24
+ if (remaining.length > 0) {
25
+ const first = remaining[0];
26
+ if (first.role === "user") {
27
+ const firstTokens = first.approxTokens ?? approxTokens(first.content || "");
28
+ if (total + firstTokens <= available) {
29
+ pinned.push(first);
30
+ total += firstTokens;
31
+ remaining = remaining.slice(1);
32
+ }
33
+ }
34
+ }
35
+ const reversed = [...remaining].reverse();
36
+ const selected = [];
24
37
  for (const msg of reversed) {
25
38
  const msgTokens = msg.approxTokens ?? approxTokens(msg.content || "");
26
39
  if (total + msgTokens > available)
@@ -28,12 +41,13 @@ export function prepareChunk(prompt, history, options = {}) {
28
41
  total += msgTokens;
29
42
  selected.unshift(msg);
30
43
  }
31
- const droppedCount = history.length - selected.length;
44
+ const finalHistory = [...pinned, ...selected];
45
+ const droppedCount = history.length - finalHistory.length;
32
46
  const warning = droppedCount > 0
33
47
  ? `Geçmiş kırpıldı: ${droppedCount} eski mesaj atlandı (bağlam limiti)`
34
48
  : null;
35
49
  return {
36
- history: selected,
50
+ history: finalHistory,
37
51
  inputTokens: total,
38
52
  droppedCount,
39
53
  warning,
@@ -0,0 +1,23 @@
1
+ export function checkTokenBudget(sessionTokens, softWarningSent, assertDonePassed) {
2
+ const TOKEN_SOFT_LIMIT = 500_000;
3
+ const TOKEN_HARD_LIMIT = 800_000;
4
+ if (sessionTokens > TOKEN_HARD_LIMIT) {
5
+ return {
6
+ action: "hard_stop",
7
+ message: "Bu istek için token bütçesi aşıldı (800K). " +
8
+ "Çalışma durduruluyor — tamamlanmamış adımlar varsa yeni bir istekle devam edebilirsiniz.",
9
+ };
10
+ }
11
+ if (sessionTokens > TOKEN_SOFT_LIMIT && !assertDonePassed && !softWarningSent) {
12
+ return {
13
+ action: "soft_warn",
14
+ message: "DİKKAT: Bu istek için 500K token harcandı. Token bütçesi azalıyor. " +
15
+ "Kalan işleri öncelendir, gereksiz dosya okuma/yazma yapma. " +
16
+ "En kritik işleri bitir ve assert_done ile tamamla.",
17
+ };
18
+ }
19
+ return { action: "continue" };
20
+ }
21
+ export function shouldForceNoTools(toolName, success, gatePassed) {
22
+ return toolName === "assert_done" && success && gatePassed === true;
23
+ }
package/dist/cli.js CHANGED
@@ -82,11 +82,15 @@ export async function runCli(argv) {
82
82
  }
83
83
  const modeFromFlag = parseModeFlag(parsed.flags.mode);
84
84
  const modelFromFlag = parseModelFlag(parsed.flags.model);
85
+ const continueFlag = parsed.flags.continue === true;
86
+ const resumeId = typeof parsed.flags.resume === "string" ? parsed.flags.resume : undefined;
85
87
  try {
86
88
  if (!parsed.command && !parsed.firstPositional) {
87
89
  await runChatCommand({
88
90
  mode: modeFromFlag,
89
91
  model: modelFromFlag,
92
+ continueLastSession: continueFlag,
93
+ resumeSessionId: resumeId,
90
94
  });
91
95
  return 0;
92
96
  }
@@ -98,6 +102,8 @@ export async function runCli(argv) {
98
102
  prompt,
99
103
  mode: modeFromFlag,
100
104
  model: modelFromFlag,
105
+ continueLastSession: continueFlag,
106
+ resumeSessionId: resumeId,
101
107
  });
102
108
  return 0;
103
109
  }
@@ -122,6 +128,9 @@ export async function runCli(argv) {
122
128
  case "init":
123
129
  await runInitCommand({ force: parsed.flags.force === true });
124
130
  return 0;
131
+ case "mcp":
132
+ await (await import("./commands/mcp-server.js")).runMcpServerCommand();
133
+ return 0;
125
134
  case "chat": {
126
135
  const prompt = parsed.positional.join(" ") || undefined;
127
136
  await runChatCommand({