social-agent-cli 1.2.1 → 1.3.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/ai/mapper.ts CHANGED
@@ -86,7 +86,6 @@ function claude(opts: ClaudeOptions): Promise<any> {
86
86
  proc.stdout.on("data", (chunk: Buffer) => {
87
87
  const text = chunk.toString();
88
88
  stdout += text;
89
- if (stream) process.stdout.write(text);
90
89
  });
91
90
 
92
91
  proc.stderr.on("data", (chunk: Buffer) => {
@@ -230,7 +229,7 @@ Kurallar:
230
229
  prompt,
231
230
  jsonSchema: SELECTOR_MAP_SCHEMA,
232
231
  imagePath: screenshotPath,
233
- stream: true,
232
+ stream: false,
234
233
  effort: "low",
235
234
  });
236
235
  } catch (err: any) {
@@ -328,7 +327,7 @@ GÖREV: Ekranın mevcut durumunu analiz et. Amaca ulaşmak için kalan adımlar
328
327
  prompt,
329
328
  jsonSchema: REMAINING_STEPS_SCHEMA,
330
329
  imagePath: screenshotPath,
331
- stream: true,
330
+ stream: false,
332
331
  effort,
333
332
  });
334
333
 
package/ai/planner.ts CHANGED
@@ -28,7 +28,7 @@ function claudeJSON(prompt: string, schema: string): Promise<any> {
28
28
  proc.stdout.on("data", (chunk: Buffer) => {
29
29
  const text = chunk.toString();
30
30
  stdout += text;
31
- process.stdout.write(text);
31
+ // stream gizli
32
32
  });
33
33
 
34
34
  proc.on("close", () => {
package/ai/runner.ts CHANGED
@@ -30,21 +30,8 @@ export async function runCommand(
30
30
  const plan = await createPlan(platform, command);
31
31
 
32
32
  // 2. Onay al
33
- if (!autoConfirm) {
34
- console.log("");
35
- const { createInterface } = await import("node:readline");
36
- const rl = createInterface({ input: process.stdin, output: process.stdout });
37
- const answer = await new Promise<string>((resolve) => {
38
- rl.question("Bu planı çalıştırayım mı? (E/h): ", (a) => { rl.close(); resolve(a.trim()); });
39
- });
40
-
41
- if (answer && answer.toLowerCase() !== "e") {
42
- console.log("İptal edildi.");
43
- process.exit(0);
44
- }
45
- } else {
46
- console.log("\n[runner] Otomatik onay (--yes)\n");
47
- }
33
+ // Onay sormadan çalıştır - Claude Code zaten kullanıcıdan onay almıştır
34
+ console.log("");
48
35
 
49
36
  // 3. Adımları çalıştır
50
37
  console.log("\n[runner] Plan çalıştırılıyor...\n");
@@ -77,8 +64,10 @@ export async function runCommand(
77
64
  for (let r = 0; r < repeatCount; r++) {
78
65
  if (repeatCount > 1) console.log(` [${r + 1}/${repeatCount}]`);
79
66
 
67
+ const imageParam = step.parameters["{{IMAGE}}"] || step.parameters["IMAGE"] || "";
80
68
  const post: Post = {
81
69
  content: step.parameters["{{CONTENT}}"] || step.parameters["CONTENT"] || "",
70
+ images: imageParam ? [imageParam] : undefined,
82
71
  platform,
83
72
  };
84
73
 
@@ -94,6 +83,36 @@ export async function runCommand(
94
83
  }
95
84
 
96
85
  let steps = [...map.steps];
86
+
87
+ // IMAGE parametresi var ama map'te upload step'i yok → gönder butonundan önce upload ekle
88
+ if (imageParam && !steps.some(s => s.action === "upload")) {
89
+ // Gönder butonunun index'ini bul (genelde son click)
90
+ const sendIdx = steps.findLastIndex((s: any) => s.action === "click" && s.description?.toLowerCase().match(/gönder|post|tweet|paylaş|send|submit/));
91
+ if (sendIdx > -1) {
92
+ steps.splice(sendIdx, 0,
93
+ {
94
+ action: "upload" as const,
95
+ description: "Görsel yükle",
96
+ selector: "input[type='file']",
97
+ value: "{{IMAGE}}",
98
+ fallbackSelectors: ["[data-testid='fileInput']", "input[accept*='image']", "input[type='file'][accept]"],
99
+ },
100
+ {
101
+ action: "wait" as const,
102
+ description: "Görsel yüklenmesini bekle",
103
+ waitMs: 2000,
104
+ }
105
+ );
106
+ console.log(` [auto] Görsel yükleme adımı eklendi (map'e kaydedilecek)`);
107
+
108
+ // Map'i güncelle - sonraki isteklerde de kullanılsın
109
+ const { saveMap } = await import("./mapper.js");
110
+ map.steps = steps;
111
+ map.parameters = [...(map.parameters || []), "{{IMAGE}}"];
112
+ map.version++;
113
+ saveMap(map);
114
+ }
115
+ }
97
116
  let stepIdx = 0;
98
117
  let healAttempt = 0;
99
118
 
@@ -129,8 +148,8 @@ export async function runCommand(
129
148
  const efforts = ["low", "medium", "medium"];
130
149
  const effort = efforts[Math.min(healAttempt - 1, efforts.length - 1)];
131
150
 
132
- console.log(` ✗ Hata: ${err.message}`);
133
- console.log(` [heal] AI devreye giriyor (effort: ${effort}, deneme: ${healAttempt}/3)...`);
151
+ console.log(` ✗ ${err.message}`);
152
+ console.log(` AI düzeltiyor (deneme ${healAttempt}/3)...`);
134
153
 
135
154
  if (healAttempt > 3) {
136
155
  console.log(` [heal] 3 denemede çözülemedi, atlanıyor.`);
package/cli.ts CHANGED
@@ -129,9 +129,9 @@ async function cmdTest(platform: string) {
129
129
  }
130
130
  }
131
131
 
132
- function cmdStatus() {
132
+ async function cmdStatus() {
133
133
  const config = loadConfig();
134
- const { getSavedProfile } = require("./core/profiles.js");
134
+ const { getSavedProfile } = await import("./core/profiles.js");
135
135
 
136
136
  console.log("\n Platform Durumu\n ───────────────");
137
137
 
package/install.ts CHANGED
@@ -21,27 +21,13 @@ function ask(rl: ReturnType<typeof createInterface>, question: string, defaultVa
21
21
  async function main() {
22
22
  const rl = createInterface({ input: process.stdin, output: process.stdout });
23
23
 
24
- console.log(`
25
- ╔═══════════════════════════════════════╗
26
- ║ SOCIAL AGENT - KURULUM ║
27
- ╚═══════════════════════════════════════╝
28
- `);
29
-
30
- // 1. Kişisel bilgiler
31
- console.log(" 1. Kişisel Bilgiler\n ───────────────────");
24
+ console.log(`\n Social Agent Setup\n ──────────────────\n`);
32
25
  const name = await ask(rl, "Adın");
33
26
  const language = await ask(rl, "Post dili", "tr");
34
27
  const style = await ask(rl, "Post stili (developer/casual/professional)", "developer");
35
28
 
36
- console.log(`
37
- Öneri hassasiyeti (1-5) - bir oturum içinde ne kadar sık öneri yapılsın:
38
- 1 = Çok nadir - sadece release veya milestone gibi büyük anlar
39
- 2 = Az - büyük özellik veya önemli fix tamamlandığında
40
- 3 = Dengeli - kayda değer her çalışmada (önerilen)
41
- 4 = Sık - küçük özellikler dahil çoğu değişiklikte
42
- 5 = Çok sık - neredeyse her kayda değer commit sonrası
43
- `);
44
- const sensitivity = await ask(rl, "Öneri hassasiyeti (1-5)", "3");
29
+ console.log(" Öneri hassasiyeti: 1=nadir 3=dengeli 5=sık");
30
+ const sensitivity = await ask(rl, "Hassasiyet (1-5)", "3");
45
31
 
46
32
  const sensitivityRules: Record<string, string> = {
47
33
  "1": "Çok seçici ol. Oturumda en fazla 1 kez öner. Sadece release, milestone veya gerçekten büyük bir özellik tamamlandığında öner. Küçük ve orta işler için asla önerme.",
@@ -95,14 +81,13 @@ Kullanıcı onaylarsa şu akışı takip et:
95
81
  5. Görselin dosya yolunu göster
96
82
  6. Son onayı al ve arka planda gönder
97
83
 
98
- Gönderme komutları:
99
- - Mastodon: cd ${ROOT} && npx tsx cli.ts post "İÇERİK" --platforms mastodon --image IMAGE_PATH
100
- - X: cd ${ROOT} && npx tsx cli.ts run x "şu mesajı tweetle: İÇERİK"
101
- - LinkedIn: cd ${ROOT} && npx tsx cli.ts run linkedin "şu mesajı paylaş: İÇERİK"
102
-
103
- Screenshot: cd ${ROOT} && npx tsx core/screenshot.ts HTML_PATH OUTPUT_PATH WIDTH HEIGHT
104
-
105
- Bu dosyayı düzenlemek için: ${promptPath}
84
+ Gönderme komutları (HER ZAMAN bu komutları kullan, asla cd veya npx tsx kullanma):
85
+ - Mastodon: social-agent post "İÇERİK" --platforms mastodon --image IMAGE_PATH
86
+ - X: social-agent run x "şu mesajı tweetle: İÇERİK" --yes
87
+ - LinkedIn: social-agent run linkedin "şu mesajı paylaş: İÇERİK" --yes
88
+ - Screenshot: social-agent screenshot HTML_PATH OUTPUT_PATH WIDTH HEIGHT
89
+ - Durum: social-agent status
90
+ - Geçmiş: social-agent history
106
91
  `;
107
92
 
108
93
  writeFileSync(promptPath, prompt);
@@ -150,22 +135,11 @@ Bu dosyayı düzenlemek için: ${promptPath}
150
135
  mkdirSync(join(ROOT, dir), { recursive: true });
151
136
  }
152
137
 
153
- // 5. npm install
154
- console.log("\n 4. Bağımlılıklar\n ─────────────────");
138
+ // Sessiz kurulumlar
155
139
  if (!existsSync(join(PKG_DIR, "node_modules"))) {
156
- console.log(" Yükleniyor...");
157
- execSync("npm install", { cwd: PKG_DIR, stdio: "inherit" });
158
- } else {
159
- console.log(" ✓ Bağımlılıklar zaten yüklü");
160
- }
161
-
162
- // 6. Playwright
163
- try {
164
- execSync("npx playwright install chromium", { cwd: ROOT, stdio: "pipe" });
165
- console.log(" ✓ Playwright chromium yüklü");
166
- } catch {
167
- console.log(" ⚠ Playwright chromium yüklenemedi, sonra yükleyebilirsin: npx playwright install chromium");
140
+ execSync("npm install", { cwd: PKG_DIR, stdio: "pipe" });
168
141
  }
142
+ try { execSync("npx playwright install chromium", { cwd: ROOT, stdio: "pipe" }); } catch {}
169
143
 
170
144
  // 7. Git hook
171
145
  console.log("\n 5. Git Hook\n ───────────");
@@ -219,19 +193,14 @@ Bu dosyayı düzenlemek için: ${promptPath}
219
193
 
220
194
  ## 1. Analiz Et
221
195
 
222
- **Konuşma geçmişinden:**
223
- - Bu oturumda ne yaptın, hangi dosyalar değişti, hangi bug'lar çözüldü
224
- - İlginç teknik zorluklar, alınan kararlar
225
- - Paylaşılmaya değer hikaye ne?
196
+ **Zaten bildiğin şeyler (en önemli):**
197
+ - Sen zaten bu projede çalışıyorsun, hangi dosyalar değişti biliyorsun
198
+ - Konuşma geçmişinden: ne yaptın, hangi kararlar alındı, teknik zorluklar
199
+ - Projenin yapısını, tech stack'ini, amacını zaten biliyorsun
226
200
 
227
- **Git geçmişinden:**
228
- - \`git log --oneline -10\` ve \`git diff --stat HEAD~3..HEAD\`
229
-
230
- **Post geçmişinden (üslup analizi için):**
231
- - \`social-agent history\` ile önceki postlara bak ve aynı tonda yaz
232
-
233
- **Proje bilgisinden:**
234
- - README.md veya package.json
201
+ **Ek bilgi için (gerekirse):**
202
+ - \`git log --oneline -5\`
203
+ - \`social-agent history\` (önceki postların üslubuna bak)
235
204
 
236
205
  ## 2. Platform Seçimi
237
206
 
@@ -331,39 +300,11 @@ Kullanıcıya "Arka planda gönderiliyor" de ve diğer işlere devam et.
331
300
  rl.close();
332
301
 
333
302
  console.log(`
334
- ╔═══════════════════════════════════════╗
335
- ║ HER ŞEY HAZIR! ║
336
- ╚═══════════════════════════════════════╝
337
-
338
- Merhaba ${name}! Social Agent kuruldu.
339
-
340
- Nasıl kullanılır:
341
- ─────────────────
342
-
343
- Post at:
344
- social-agent run x "şu mesajı tweetle: Yeni proje yayında!"
345
- social-agent run linkedin "şu mesajı paylaş: Yeni proje!"
346
- social-agent post "Mesaj" --platforms mastodon
347
-
348
- Beğen / Takip et / Bağlantı isteği:
349
- social-agent run x "şu tweeti beğen: https://x.com/user/status/123"
350
- social-agent run x "şu kişiyi takip et: @username"
351
- social-agent run linkedin "3 insana bağlantı isteği gönder"
352
-
353
- Yeni aksiyon öğret:
354
- social-agent learn "retweet yapmayı öğren" x
355
- social-agent learn "yorum yapmayı öğren" linkedin
356
-
357
- Geçmiş ve durum:
358
- social-agent history
359
- social-agent status
360
-
361
- Claude Code ile:
362
- claude-social → çalışırken AI milestone'larda post önerir
363
- /social → elle post oluştur (git + konuşma analizi)
303
+ ✓ Hazır, ${name}!
364
304
 
365
- Profil ayarlarını düzenle:
366
- nano ~/.social-agent/social-mode-prompt.md
305
+ Claude Code ile: claude-social (öneri modu) veya /social (elle post)
306
+ Terminal ile: sa run x "mesaj" | sa help
307
+ Ayarlar: sa config
367
308
  `);
368
309
  }
369
310
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "social-agent-cli",
3
- "version": "1.2.1",
3
+ "version": "1.3.0",
4
4
  "description": "AI-powered social media agent - free APIs + browser automation with self-healing selectors",
5
5
  "type": "module",
6
6
  "bin": {