social-agent-cli 1.0.7 → 1.0.9

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
@@ -332,7 +332,12 @@ GÖREV: Ekranın mevcut durumunu analiz et. Amaca ulaşmak için kalan adımlar
332
332
  effort,
333
333
  });
334
334
 
335
- console.log(`\n[heal] Analiz: ${result.analysis}`);
335
+ if (!result || !result.remainingSteps) {
336
+ console.log(`\n[heal] AI geçerli bir plan döndüremedi, orijinal adımlarla devam ediliyor.`);
337
+ return originalSteps.slice(failedStepIndex);
338
+ }
339
+
340
+ console.log(`\n[heal] Analiz: ${result.analysis || "?"}`);
336
341
  console.log(`[heal] ${result.remainingSteps.length} yeni adım planlandı`);
337
342
 
338
343
  // Map'i güncelle: tamamlanan adımlar + yeni kalan adımlar
package/ai/runner.ts CHANGED
@@ -81,6 +81,13 @@ export async function runCommand(
81
81
  const page = await driver.launch();
82
82
 
83
83
  try {
84
+ // Map'in ilk adımı goto değilse platform ana sayfasına git
85
+ if (map.steps[0]?.action !== "goto") {
86
+ console.log(` [${platform}] ${url} açılıyor...`);
87
+ await page.goto(url, { waitUntil: "domcontentloaded", timeout: 30000 });
88
+ await page.waitForTimeout(3000);
89
+ }
90
+
84
91
  let steps = [...map.steps];
85
92
  let stepIdx = 0;
86
93
  let healAttempt = 0;
package/install.ts CHANGED
@@ -6,7 +6,8 @@ import { execSync } from "node:child_process";
6
6
  import { homedir } from "node:os";
7
7
 
8
8
  const __dirname = dirname(fileURLToPath(import.meta.url));
9
- const ROOT = __dirname;
9
+ const PKG_DIR = __dirname;
10
+ const ROOT = process.env.SOCIAL_AGENT_DATA || join(homedir(), ".social-agent");
10
11
 
11
12
  function ask(rl: ReturnType<typeof createInterface>, question: string, defaultVal = ""): Promise<string> {
12
13
  const suffix = defaultVal ? ` (${defaultVal})` : "";
@@ -29,9 +30,6 @@ async function main() {
29
30
  // 1. Kişisel bilgiler
30
31
  console.log(" 1. Kişisel Bilgiler\n ───────────────────");
31
32
  const name = await ask(rl, "Adın");
32
- const xHandle = await ask(rl, "X (Twitter) kullanıcı adın (@olmadan)");
33
- const linkedinHandle = await ask(rl, "LinkedIn kullanıcı adın (URL'deki /in/ sonrası)");
34
- const mastodonHandle = await ask(rl, "Mastodon kullanıcı adın (ör: user@mastodon.social, boş bırakılabilir)");
35
33
  const language = await ask(rl, "Post dili", "tr");
36
34
  const style = await ask(rl, "Post stili (developer/casual/professional)", "developer");
37
35
 
@@ -61,9 +59,6 @@ async function main() {
61
59
  const prompt = `Sen normal bir Claude Code asistanısın ama ek olarak sosyal medya farkındalığın var.
62
60
 
63
61
  Kullanıcının adı: ${name}
64
- X: @${xHandle}
65
- ${linkedinHandle ? `LinkedIn: /in/${linkedinHandle}` : ""}
66
- ${mastodonHandle ? `Mastodon: @${mastodonHandle}` : ""}
67
62
  Post dili: ${language}
68
63
  Post stili: ${style}
69
64
 
@@ -120,13 +115,14 @@ Bu dosyayı düzenlemek için: ${promptPath}
120
115
  const configPath = join(ROOT, "config.json");
121
116
  const config: any = {};
122
117
 
123
- if (mastodonHandle) {
124
- const [, instance] = mastodonHandle.split("@").filter(Boolean);
125
- if (instance) {
126
- const mastodonToken = await ask(rl, `Mastodon access token (${instance}/settings/applications'dan al)`);
118
+ const wantMastodon = await ask(rl, "Mastodon hesabın var mı? (e/h)", "h");
119
+ if (wantMastodon.toLowerCase() === "e") {
120
+ const mastodonInstance = await ask(rl, "Mastodon sunucu adresi (ör: mastodon.social)");
121
+ if (mastodonInstance) {
122
+ const mastodonToken = await ask(rl, `Access token (https://${mastodonInstance}/settings/applications'dan al)`);
127
123
  if (mastodonToken) {
128
124
  config.mastodon = {
129
- instanceUrl: `https://${instance}`,
125
+ instanceUrl: `https://${mastodonInstance}`,
130
126
  accessToken: mastodonToken,
131
127
  };
132
128
  }
@@ -156,9 +152,9 @@ Bu dosyayı düzenlemek için: ${promptPath}
156
152
 
157
153
  // 5. npm install
158
154
  console.log("\n 4. Bağımlılıklar\n ─────────────────");
159
- if (!existsSync(join(ROOT, "node_modules"))) {
155
+ if (!existsSync(join(PKG_DIR, "node_modules"))) {
160
156
  console.log(" Yükleniyor...");
161
- execSync("npm install", { cwd: ROOT, stdio: "inherit" });
157
+ execSync("npm install", { cwd: PKG_DIR, stdio: "inherit" });
162
158
  } else {
163
159
  console.log(" ✓ Bağımlılıklar zaten yüklü");
164
160
  }
@@ -175,7 +171,7 @@ Bu dosyayı düzenlemek için: ${promptPath}
175
171
  console.log("\n 5. Git Hook\n ───────────");
176
172
  const gitHooksDir = join(homedir(), ".git-hooks");
177
173
  mkdirSync(gitHooksDir, { recursive: true });
178
- const hookSrc = join(ROOT, "hooks", "post-push");
174
+ const hookSrc = join(PKG_DIR, "hooks", "post-push");
179
175
  const hookDest = join(gitHooksDir, "post-push");
180
176
 
181
177
  if (existsSync(hookSrc)) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "social-agent-cli",
3
- "version": "1.0.7",
3
+ "version": "1.0.9",
4
4
  "description": "AI-powered social media agent - free APIs + browser automation with self-healing selectors",
5
5
  "type": "module",
6
6
  "bin": {