social-agent-cli 1.2.1 → 1.2.2

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.
Files changed (3) hide show
  1. package/ai/runner.ts +32 -0
  2. package/cli.ts +2 -2
  3. package/package.json +1 -1
package/ai/runner.ts CHANGED
@@ -77,8 +77,10 @@ export async function runCommand(
77
77
  for (let r = 0; r < repeatCount; r++) {
78
78
  if (repeatCount > 1) console.log(` [${r + 1}/${repeatCount}]`);
79
79
 
80
+ const imageParam = step.parameters["{{IMAGE}}"] || step.parameters["IMAGE"] || "";
80
81
  const post: Post = {
81
82
  content: step.parameters["{{CONTENT}}"] || step.parameters["CONTENT"] || "",
83
+ images: imageParam ? [imageParam] : undefined,
82
84
  platform,
83
85
  };
84
86
 
@@ -94,6 +96,36 @@ export async function runCommand(
94
96
  }
95
97
 
96
98
  let steps = [...map.steps];
99
+
100
+ // IMAGE parametresi var ama map'te upload step'i yok → gönder butonundan önce upload ekle
101
+ if (imageParam && !steps.some(s => s.action === "upload")) {
102
+ // Gönder butonunun index'ini bul (genelde son click)
103
+ const sendIdx = steps.findLastIndex((s: any) => s.action === "click" && s.description?.toLowerCase().match(/gönder|post|tweet|paylaş|send|submit/));
104
+ if (sendIdx > -1) {
105
+ steps.splice(sendIdx, 0,
106
+ {
107
+ action: "upload" as const,
108
+ description: "Görsel yükle",
109
+ selector: "input[type='file']",
110
+ value: "{{IMAGE}}",
111
+ fallbackSelectors: ["[data-testid='fileInput']", "input[accept*='image']", "input[type='file'][accept]"],
112
+ },
113
+ {
114
+ action: "wait" as const,
115
+ description: "Görsel yüklenmesini bekle",
116
+ waitMs: 2000,
117
+ }
118
+ );
119
+ console.log(` [auto] Görsel yükleme adımı eklendi (map'e kaydedilecek)`);
120
+
121
+ // Map'i güncelle - sonraki isteklerde de kullanılsın
122
+ const { saveMap } = await import("./mapper.js");
123
+ map.steps = steps;
124
+ map.parameters = [...(map.parameters || []), "{{IMAGE}}"];
125
+ map.version++;
126
+ saveMap(map);
127
+ }
128
+ }
97
129
  let stepIdx = 0;
98
130
  let healAttempt = 0;
99
131
 
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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "social-agent-cli",
3
- "version": "1.2.1",
3
+ "version": "1.2.2",
4
4
  "description": "AI-powered social media agent - free APIs + browser automation with self-healing selectors",
5
5
  "type": "module",
6
6
  "bin": {