social-agent-cli 5.0.4 → 5.0.6

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 (2) hide show
  1. package/core/screenshot.ts +10 -7
  2. package/package.json +1 -1
@@ -1,25 +1,28 @@
1
1
  import { execSync } from "node:child_process";
2
2
 
3
3
  /**
4
- * HTML dosyasını JPEG/PNG'ye çevirir
5
- * Kullanım: npx tsx core/screenshot.ts /tmp/input.html /tmp/output.jpeg 1200 675
4
+ * Screenshot al - URL veya HTML dosyasından
5
+ * Kullanım: social-agent screenshot <url-or-html> <output-path> [width] [height]
6
6
  */
7
- const [, , htmlPath, outputPath, widthStr = "1200", heightStr = "675"] = process.argv;
7
+ const [, , htmlPath, outputPath] = process.argv;
8
8
 
9
9
  if (!htmlPath || !outputPath) {
10
- console.error("Kullanım: social-agent screenshot <html-or-url> <output-path> [width] [height]");
10
+ console.error("Kullanım: social-agent screenshot <url-or-html> <output-path>");
11
11
  process.exit(1);
12
12
  }
13
13
 
14
14
  const url = htmlPath.startsWith("http") ? htmlPath : `file://${htmlPath}`;
15
+ const format = outputPath.endsWith(".png") ? "png" : "jpeg";
15
16
 
16
17
  try {
17
- execSync(`agent-browser viewport ${widthStr} ${heightStr}`, { stdio: "pipe", timeout: 5000 });
18
18
  execSync(`agent-browser open "${url}"`, { stdio: "pipe", timeout: 15000 });
19
19
  execSync(`agent-browser wait 2000`, { stdio: "pipe" });
20
- execSync(`agent-browser screenshot "${outputPath}"`, { stdio: "pipe", timeout: 10000 });
20
+ // Scrollbar'ı gizle
21
+ execSync(`agent-browser eval "document.documentElement.style.overflow='hidden'; document.body.style.overflow='hidden'; document.documentElement.style.scrollbarWidth='none';"`, { stdio: "pipe", timeout: 5000 });
22
+ execSync(`agent-browser wait 500`, { stdio: "pipe" });
23
+ execSync(`agent-browser screenshot --screenshot-format ${format} --screenshot-quality 100 "${outputPath}"`, { stdio: "pipe", timeout: 10000 });
21
24
  console.log(outputPath);
22
25
  } catch (err: any) {
23
- console.error(err.message);
26
+ console.error(err.stderr?.toString() || err.message);
24
27
  process.exit(1);
25
28
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "social-agent-cli",
3
- "version": "5.0.4",
3
+ "version": "5.0.6",
4
4
  "description": "AI-powered social media agent - free APIs + browser automation with self-healing selectors",
5
5
  "type": "module",
6
6
  "bin": {