@auscera/socialscrape 0.0.0-stage → 2.0.1

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 (63) hide show
  1. package/README.md +111 -2
  2. package/bin/socialscrape.mjs +115 -0
  3. package/engine/README.md +243 -0
  4. package/engine/SKILL.md +194 -0
  5. package/engine/agent.py +665 -0
  6. package/engine/batch_manager.py +622 -0
  7. package/engine/cli.py +23 -0
  8. package/engine/handlers.py +1109 -0
  9. package/engine/plugins/__init__.py +77 -0
  10. package/engine/plugins/instagram-scrape/README.md +164 -0
  11. package/engine/plugins/instagram-scrape/SKILL.md +53 -0
  12. package/engine/plugins/instagram-scrape/cli.py +176 -0
  13. package/engine/plugins/instagram-scrape/core.py +408 -0
  14. package/engine/plugins/instagram-scrape/plugin.json +42 -0
  15. package/engine/plugins/linkedin-scrape/README.md +143 -0
  16. package/engine/plugins/linkedin-scrape/SKILL.md +47 -0
  17. package/engine/plugins/linkedin-scrape/cli.py +126 -0
  18. package/engine/plugins/linkedin-scrape/core.py +188 -0
  19. package/engine/plugins/linkedin-scrape/plugin.json +36 -0
  20. package/engine/plugins/meta-ad-library-scraper/README.md +127 -0
  21. package/engine/plugins/meta-ad-library-scraper/SKILL.md +44 -0
  22. package/engine/plugins/meta-ad-library-scraper/cli.py +161 -0
  23. package/engine/plugins/meta-ad-library-scraper/core.py +348 -0
  24. package/engine/plugins/meta-ad-library-scraper/plugin.json +44 -0
  25. package/engine/plugins/pinterest-scraper/README.md +150 -0
  26. package/engine/plugins/pinterest-scraper/SKILL.md +45 -0
  27. package/engine/plugins/pinterest-scraper/cli.py +193 -0
  28. package/engine/plugins/pinterest-scraper/core.py +420 -0
  29. package/engine/plugins/pinterest-scraper/plugin.json +40 -0
  30. package/engine/plugins/reddit-discussion-scraper/README.md +162 -0
  31. package/engine/plugins/reddit-discussion-scraper/SKILL.md +52 -0
  32. package/engine/plugins/reddit-discussion-scraper/cli.py +218 -0
  33. package/engine/plugins/reddit-discussion-scraper/core.py +546 -0
  34. package/engine/plugins/reddit-discussion-scraper/plugin.json +46 -0
  35. package/engine/plugins/shared/__init__.py +15 -0
  36. package/engine/plugins/shared/paths.py +90 -0
  37. package/engine/plugins/shared/process_runner.py +169 -0
  38. package/engine/plugins/shared/session_manager.py +287 -0
  39. package/engine/plugins/threads-scraper/README.md +139 -0
  40. package/engine/plugins/threads-scraper/SKILL.md +43 -0
  41. package/engine/plugins/threads-scraper/cli.py +178 -0
  42. package/engine/plugins/threads-scraper/core.py +460 -0
  43. package/engine/plugins/threads-scraper/plugin.json +40 -0
  44. package/engine/plugins/tiktok-scrape/README.md +158 -0
  45. package/engine/plugins/tiktok-scrape/SKILL.md +51 -0
  46. package/engine/plugins/tiktok-scrape/cli.py +163 -0
  47. package/engine/plugins/tiktok-scrape/core.py +313 -0
  48. package/engine/plugins/tiktok-scrape/plugin.json +40 -0
  49. package/engine/plugins/twitter-scrape/README.md +158 -0
  50. package/engine/plugins/twitter-scrape/SKILL.md +50 -0
  51. package/engine/plugins/twitter-scrape/cli.py +153 -0
  52. package/engine/plugins/twitter-scrape/core.py +254 -0
  53. package/engine/plugins/twitter-scrape/plugin.json +40 -0
  54. package/engine/plugins/youtube-scrape/README.md +199 -0
  55. package/engine/plugins/youtube-scrape/SKILL.md +115 -0
  56. package/engine/plugins/youtube-scrape/cli.py +340 -0
  57. package/engine/plugins/youtube-scrape/core.py +829 -0
  58. package/engine/plugins/youtube-scrape/plugin.json +48 -0
  59. package/engine/requirements.txt +8 -0
  60. package/engine/socialscrape_cli.py +500 -0
  61. package/engine/storage.py +570 -0
  62. package/engine/ui.py +690 -0
  63. package/package.json +27 -3
@@ -0,0 +1,48 @@
1
+ {
2
+ "name": "youtube-scrape",
3
+ "version": "1.1.0",
4
+ "description": "Zero-cookie YouTube scraper & downloader for transcripts, video metadata, comments, and media files across videos, live streams, shorts, and channels.",
5
+ "author": "SocialScrape",
6
+ "main": "cli.py",
7
+ "display_name": "YouTube Scraper",
8
+ "command": "/youtube",
9
+ "command_description": "transcripts, metadata, comments & 4K video",
10
+ "aliases": ["/youtube"],
11
+ "cli_aliases": ["youtube"],
12
+ "url_patterns": ["youtube.com", "youtu.be"],
13
+ "tool_schema": {
14
+ "name": "youtube_scrape",
15
+ "description": "Scrapes transcripts, metadata, comments, or downloads video/audio/thumbnails from YouTube URLs, video IDs, channel handles, or bulk input files.",
16
+ "parameters": {
17
+ "type": "object",
18
+ "properties": {
19
+ "url": {"type": "string", "description": "YouTube video, short, or stream URL / video ID."},
20
+ "channel": {"type": "string", "description": "YouTube channel URL or handle."},
21
+ "input_file": {"type": "string", "description": "Path to .txt or .csv file containing multiple URLs/targets for batch processing."},
22
+ "type": {"type": "string", "enum": ["videos", "streams", "live", "shorts", "all"]},
23
+ "limit": {"type": "integer", "description": "Maximum videos to scrape."},
24
+ "extract_metadata": {"type": "boolean"},
25
+ "extract_comments": {"type": "boolean"},
26
+ "download_video": {"type": "boolean"},
27
+ "download_thumbnail": {"type": "boolean"},
28
+ "quality": {"type": "string", "enum": ["360p", "480p", "720p", "1080p", "1440p", "2160p", "4k", "best"]},
29
+ "extract_all": {"type": "boolean"}
30
+ }
31
+ }
32
+ },
33
+ "flag_mapping": {
34
+ "positional": ["url"],
35
+ "flags": {
36
+ "channel": "-c",
37
+ "input_file": "--input-file",
38
+ "type": "-t",
39
+ "limit": "-l",
40
+ "extract_metadata": "-m",
41
+ "extract_comments": "--comments",
42
+ "download_video": "--download-video",
43
+ "download_thumbnail": "--download-thumb",
44
+ "quality": "-q",
45
+ "extract_all": "-a"
46
+ }
47
+ }
48
+ }
@@ -0,0 +1,8 @@
1
+ rich>=13.0.0
2
+ prompt-toolkit>=3.0.0
3
+ art>=6.0
4
+ requests>=2.28.0
5
+ yt-dlp>=2024.0.0
6
+ youtube-transcript-api>=1.0.0
7
+ python-dotenv>=1.0.0
8
+ platformdirs>=3.0.0
@@ -0,0 +1,500 @@
1
+ """
2
+ SocialScrape Master TUI & Interactive Hub CLI (`socialscrape_cli.py`).
3
+ Controller Layer coordinating Presentation (`ui.py`), AI Agent (`agent.py`),
4
+ Command Handlers (`handlers.py`), Batch Engine (`batch_manager.py`), and Storage Engine (`storage.py`).
5
+ """
6
+
7
+ import os
8
+ import sys
9
+ import time
10
+ from functools import partial
11
+ from pathlib import Path
12
+ from typing import List, Dict, Any, Optional, Tuple
13
+
14
+ from prompt_toolkit import PromptSession
15
+ from prompt_toolkit.formatted_text import HTML
16
+ from prompt_toolkit.completion import Completer, Completion, CompleteEvent
17
+ from prompt_toolkit.shortcuts import CompleteStyle
18
+ from prompt_toolkit.history import FileHistory
19
+ from prompt_toolkit.document import Document
20
+ from prompt_toolkit.key_binding import KeyBindings
21
+
22
+ __version__ = "2.0.1"
23
+
24
+ # Ensure package directory is prioritized in sys.path and conflicting modules evicted
25
+ _PACKAGE_DIR = str(Path(__file__).parent.resolve())
26
+ if _PACKAGE_DIR in sys.path:
27
+ sys.path.remove(_PACKAGE_DIR)
28
+ sys.path.insert(0, _PACKAGE_DIR)
29
+
30
+ # Evict conflicting modules loaded from external packages (e.g., gscrape in shared venvs)
31
+ _EVICT_MODULES = ["storage", "ui", "handlers", "agent", "batch_manager", "plugins"]
32
+ for _mod in _EVICT_MODULES:
33
+ if _mod in sys.modules and getattr(sys.modules[_mod], "__file__", ""):
34
+ _mod_file = str(Path(sys.modules[_mod].__file__).resolve())
35
+ if not _mod_file.startswith(_PACKAGE_DIR):
36
+ del sys.modules[_mod]
37
+
38
+ # Force UTF-8 on Windows console
39
+ if sys.platform == "win32":
40
+ sys.stdout.reconfigure(encoding="utf-8")
41
+
42
+ from storage import (
43
+ get_data_dir,
44
+ get_root_dir,
45
+ get_plugins_dir,
46
+ get_env_file,
47
+ get_chats_dir,
48
+ load_config,
49
+ bootstrap_global_storage,
50
+ is_local_mode,
51
+ plugin_registry,
52
+ )
53
+
54
+ from ui import (
55
+ console,
56
+ COLOR_TEXT,
57
+ COLOR_MUTED,
58
+ COLOR_PRIMARY,
59
+ COLOR_ACCENT,
60
+ COLOR_SECONDARY,
61
+ COLOR_BORDER,
62
+ COLOR_BG_POPUP,
63
+ COLOR_BG_SELECT,
64
+ tui_style,
65
+ render_opencode_banner,
66
+ display_home_screen,
67
+ render_user_message,
68
+ render_ai_response,
69
+ render_action_card,
70
+ render_plugin_features,
71
+ open_command_modal,
72
+ get_git_branch,
73
+ get_active_plugins,
74
+ build_bottom_toolbar_html,
75
+ reset_terminal_mouse_mode,
76
+ )
77
+
78
+ from agent import (
79
+ ALLOWED_OPENROUTER_MODELS,
80
+ DEFAULT_OPENROUTER_MODEL,
81
+ get_openrouter_api_key,
82
+ save_openrouter_api_key,
83
+ get_openrouter_model,
84
+ save_openrouter_model,
85
+ fetch_openrouter_models,
86
+ init_new_chat_session,
87
+ save_chat_session,
88
+ get_current_session_id,
89
+ set_current_session_id,
90
+ get_conversation_history,
91
+ set_conversation_history,
92
+ register_tool_handlers,
93
+ run_openrouter_agent,
94
+ )
95
+
96
+ from batch_manager import get_incomplete_batches
97
+
98
+ from handlers import (
99
+ router,
100
+ get_agent_mode,
101
+ set_agent_mode,
102
+ handle_plugin_command,
103
+ resolve_plugin_folder,
104
+ handle_batch_command,
105
+ handle_resume_batch_command,
106
+ handle_plugins_command,
107
+ handle_outputs_command,
108
+ handle_readme_command,
109
+ handle_skill_command,
110
+ handle_skills_list_command,
111
+ handle_fix_command,
112
+ handle_new_command,
113
+ handle_history_command,
114
+ handle_clear_command,
115
+ handle_resume_command,
116
+ handle_delete_command,
117
+ handle_update_command,
118
+ handle_config_command,
119
+ handle_uninstall_command,
120
+ handle_models_command,
121
+ handle_agent_command,
122
+ handle_manual_command,
123
+ handle_help_command,
124
+ handle_doctor,
125
+ )
126
+
127
+ # Purge sticky terminal mouse tracking immediately on load
128
+ reset_terminal_mouse_mode()
129
+
130
+ ROOT_DIR = get_root_dir()
131
+ PLUGINS_DIR = get_plugins_dir()
132
+ ENV_FILE = get_env_file()
133
+ CHATS_DIR = get_chats_dir()
134
+
135
+
136
+ def cleanup_terminal_on_exit() -> None:
137
+ """Restores terminal to a pristine state upon exiting SocialScrape."""
138
+ try:
139
+ reset_terminal_mouse_mode()
140
+ sys.stdout.write("\033[2J\033[H")
141
+ sys.stdout.flush()
142
+ if os.name == "nt":
143
+ os.system("cls")
144
+ except Exception:
145
+ pass
146
+
147
+
148
+ def build_hub_tool_handlers() -> Dict[str, Any]:
149
+ """Dynamically maps active plugins and Hub commands to execution handlers."""
150
+ handlers: Dict[str, Any] = {
151
+ "batch": handle_batch_command,
152
+ "resume_batch": handle_resume_batch_command,
153
+ "plugins": handle_plugins_command,
154
+ "outputs": handle_outputs_command,
155
+ }
156
+ for p in get_active_plugins():
157
+ p_name = p.get("name", "")
158
+ cli_alias = p.get("cli_aliases", [p_name])[0] if p.get("cli_aliases") else p_name
159
+ handlers[cli_alias] = partial(handle_plugin_command, p_name)
160
+ handlers[p_name] = partial(handle_plugin_command, p_name)
161
+ return handlers
162
+
163
+
164
+ # Wire dynamic tool handlers into the Agent module
165
+ register_tool_handlers(build_hub_tool_handlers())
166
+
167
+
168
+ # ==============================================================================
169
+ # 1. PERSISTENT AUTOCOMPLETE ENGINE
170
+ # ==============================================================================
171
+
172
+ class PersistentSlashCompleter(Completer):
173
+ """
174
+ OpenCode-identical slash completer:
175
+ - ONLY triggers when text starts with a slash ('/').
176
+ - If user types regular non-slash text, dropdown stays completely hidden.
177
+ - Matches prefixes and fuzzy substrings while user is typing slash commands.
178
+ - Dynamically populated from router command metadata.
179
+ """
180
+ def __init__(self):
181
+ self.commands: List[Tuple[str, str]] = []
182
+ self.refresh()
183
+
184
+ def refresh(self) -> None:
185
+ """Refreshes command list dynamically from router metadata."""
186
+ meta = router.get_command_metadata()
187
+ self.commands = list(meta.items())
188
+
189
+ def get_completions(self, document: Document, complete_event: CompleteEvent):
190
+ text = document.text_before_cursor
191
+
192
+ # ONLY show completions if text starts with '/'
193
+ if not text.startswith("/"):
194
+ return
195
+
196
+ # If user typed just '/', show all available slash commands
197
+ if text == "/":
198
+ for cmd, desc in self.commands:
199
+ yield Completion(
200
+ cmd,
201
+ start_position=-len(document.text_before_cursor),
202
+ display=cmd,
203
+ display_meta=desc,
204
+ )
205
+ return
206
+
207
+ # Otherwise match against slash command names or descriptions
208
+ query = text.lower()
209
+ for cmd, desc in self.commands:
210
+ if cmd.lower().startswith(query) or (len(query) > 1 and query[1:] in cmd.lower()):
211
+ yield Completion(
212
+ cmd,
213
+ start_position=-len(document.text_before_cursor),
214
+ display=cmd,
215
+ display_meta=desc,
216
+ )
217
+
218
+
219
+ tui_keybindings = KeyBindings()
220
+
221
+ @tui_keybindings.add("backspace")
222
+ def _(event):
223
+ buf = event.current_buffer
224
+ buf.delete_before_cursor(count=1)
225
+ if buf.text.startswith("/"):
226
+ buf.start_completion()
227
+ else:
228
+ buf.cancel_completion()
229
+
230
+ @tui_keybindings.add("escape")
231
+ def _(event):
232
+ buf = event.app.current_buffer
233
+ if buf.text.strip():
234
+ buf.text = ""
235
+ else:
236
+ event.app.exit(result=None)
237
+
238
+ @tui_keybindings.add("c-x", "a")
239
+ def _(event):
240
+ handle_agent_command()
241
+ event.app.current_buffer.text = ""
242
+
243
+ @tui_keybindings.add("c-x", "m")
244
+ def _(event):
245
+ handle_manual_command()
246
+ event.app.current_buffer.text = ""
247
+
248
+ @tui_keybindings.add("c-x", "h")
249
+ def _(event):
250
+ handle_help_command()
251
+ event.app.current_buffer.text = ""
252
+
253
+ @tui_keybindings.add("c-x", "p")
254
+ def _(event):
255
+ handle_plugins_command()
256
+ event.app.current_buffer.text = ""
257
+
258
+ @tui_keybindings.add("c-x", "o")
259
+ def _(event):
260
+ handle_models_command()
261
+ event.app.current_buffer.text = ""
262
+
263
+ @tui_keybindings.add("c-x", "d")
264
+ def _(event):
265
+ handle_outputs_command()
266
+ event.app.current_buffer.text = ""
267
+
268
+ @tui_keybindings.add("c-x", "n")
269
+ def _(event):
270
+ handle_new_command()
271
+ event.app.current_buffer.text = ""
272
+
273
+ @tui_keybindings.add("c-x", "r")
274
+ def _(event):
275
+ handle_resume_command()
276
+ event.app.current_buffer.text = ""
277
+
278
+ @tui_keybindings.add("c-l")
279
+ def _(event):
280
+ handle_clear_command()
281
+ event.app.current_buffer.text = ""
282
+
283
+ @tui_keybindings.add("pageup")
284
+ def _(event):
285
+ handle_history_command()
286
+
287
+ @tui_keybindings.add("c-u")
288
+ def _(event):
289
+ handle_history_command()
290
+
291
+ @tui_keybindings.add("c-x", "s")
292
+ def _(event):
293
+ handle_history_command()
294
+
295
+
296
+ def get_toolbar_html():
297
+ """Adapter for docked bottom toolbar."""
298
+ return build_bottom_toolbar_html(
299
+ version=__version__,
300
+ root_dir=ROOT_DIR,
301
+ active_model=get_openrouter_model(),
302
+ allowed_models=ALLOWED_OPENROUTER_MODELS,
303
+ agent_mode=get_agent_mode(),
304
+ )
305
+
306
+
307
+ # Backward compatibility reference for legacy dispatch tests
308
+ HUB_COMMAND_DISPATCHER: Dict[str, Any] = router._handlers
309
+
310
+
311
+ # ==============================================================================
312
+ # 2. CLI APP CONTROLLER & TUI REPL LIFECYCLE
313
+ # ==============================================================================
314
+
315
+ class CLIApp:
316
+ """Master Interactive TUI Application for SocialScrape."""
317
+
318
+ def __init__(self, version: str = __version__):
319
+ self.version = version
320
+ self.running = True
321
+ self.session: Optional[PromptSession] = None
322
+ self.completer: Optional[PersistentSlashCompleter] = None
323
+ self.use_alt_screen: bool = False
324
+
325
+ def setup(self) -> None:
326
+ """Initializes global storage, plugin command registry, and PromptSession."""
327
+ bootstrap_global_storage()
328
+ router.register_plugin_commands()
329
+ self.completer = PersistentSlashCompleter()
330
+ history_file = str(get_data_dir() / "history.txt")
331
+ try:
332
+ self.session = PromptSession(
333
+ history=FileHistory(history_file),
334
+ completer=self.completer,
335
+ complete_while_typing=True,
336
+ complete_style=CompleteStyle.COLUMN,
337
+ style=tui_style,
338
+ key_bindings=tui_keybindings,
339
+ bottom_toolbar=get_toolbar_html,
340
+ mouse_support=False,
341
+ )
342
+ except Exception:
343
+ from prompt_toolkit.output import DummyOutput
344
+ self.session = PromptSession(
345
+ history=FileHistory(history_file),
346
+ completer=self.completer,
347
+ complete_while_typing=True,
348
+ complete_style=CompleteStyle.COLUMN,
349
+ style=tui_style,
350
+ key_bindings=tui_keybindings,
351
+ bottom_toolbar=get_toolbar_html,
352
+ mouse_support=False,
353
+ output=DummyOutput(),
354
+ )
355
+
356
+ def dispatch(self, user_input: str) -> bool:
357
+ """Dispatches user input to the unified CommandRouter. Returns False on exit."""
358
+ return router.dispatch(user_input, app=self)
359
+
360
+ def exit(self) -> None:
361
+ """Signals the interactive loop to terminate."""
362
+ self.running = False
363
+
364
+ def run(self) -> None:
365
+ """Main interactive REPL loop powered by prompt_toolkit."""
366
+ reset_terminal_mouse_mode()
367
+ self.setup()
368
+
369
+ cfg = load_config()
370
+ self.use_alt_screen = cfg.get("alternate_screen_buffer", False)
371
+ if "--no-alt-screen" in sys.argv or "--inline" in sys.argv:
372
+ self.use_alt_screen = False
373
+ elif "--alt-screen" in sys.argv or "--fullscreen" in sys.argv:
374
+ self.use_alt_screen = True
375
+
376
+ if self.use_alt_screen:
377
+ # Opt-in Alternate Screen Buffer
378
+ sys.stdout.write("\033[?1049h\033[?1007h\033[2J\033[H")
379
+ else:
380
+ # Default: Clean Viewport Reset (100% Native Terminal Scrollback Preserved)
381
+ reset_terminal_mouse_mode()
382
+ sys.stdout.write("\033[2J\033[H")
383
+ sys.stdout.flush()
384
+
385
+ try:
386
+ display_home_screen(self.version)
387
+
388
+ # Check for incomplete batch tasks on startup
389
+ incomplete_batches = get_incomplete_batches()
390
+ if incomplete_batches:
391
+ latest = incomplete_batches[0]
392
+ b_id = latest.get("batch_id", "Unknown")
393
+ pending_count = latest.get("pending_count", 0)
394
+ render_action_card(
395
+ f"[bold yellow]⚠️ Detected incomplete batch task:[/bold yellow] [bold white]{b_id}[/bold white] "
396
+ f"({pending_count} pending items).\n"
397
+ f" ┃ Type [bold cyan]/resume-batch[/bold cyan] to resume extraction."
398
+ )
399
+
400
+ last_interrupt_time = 0.0
401
+
402
+ while self.running:
403
+ try:
404
+ if get_agent_mode():
405
+ prompt_html = HTML("<b><style color='#5c9cf5'> ┃ > </style></b>")
406
+ else:
407
+ prompt_html = HTML("<b><style color='#fab283'> ┃ 👤 > </style></b>")
408
+
409
+ user_input = self.session.prompt(prompt_html)
410
+ if user_input is None: # Triggered by Esc on empty buffer or exit
411
+ break
412
+
413
+ user_input = user_input.strip()
414
+
415
+ # ANSI Line Erase: Erase raw typed input line cleanly before rendering the formatted card
416
+ sys.stdout.write("\033[1A\033[2K\r")
417
+ sys.stdout.flush()
418
+
419
+ last_interrupt_time = 0.0
420
+ if not user_input:
421
+ continue
422
+
423
+ should_continue = self.dispatch(user_input)
424
+ if not should_continue:
425
+ break
426
+
427
+ except KeyboardInterrupt:
428
+ now = time.time()
429
+ if now - last_interrupt_time < 2.5:
430
+ console.print("\n[dim]Session ended (Ctrl+C).[/dim]")
431
+ break
432
+ else:
433
+ last_interrupt_time = now
434
+ console.print("\n[dim]Press [bold #fab283]Ctrl+C[/bold #fab283] again to exit.[/dim]")
435
+ continue
436
+ except EOFError:
437
+ console.print("\n[dim]Session ended (EOF).[/dim]")
438
+ break
439
+ except Exception as e:
440
+ console.print(f"[bold red][!] Unexpected error: {e}[/bold red]")
441
+ finally:
442
+ if self.use_alt_screen:
443
+ sys.stdout.write("\033[?1049l")
444
+ sys.stdout.flush()
445
+ cleanup_terminal_on_exit()
446
+
447
+
448
+ def run_tui_loop():
449
+ """Convenience function running the CLIApp interactive loop."""
450
+ app = CLIApp(__version__)
451
+ app.run()
452
+
453
+
454
+ def main():
455
+ """Entry point for the global socialscrape command."""
456
+ bootstrap_global_storage()
457
+ router.register_plugin_commands()
458
+
459
+ if len(sys.argv) > 1:
460
+ arg = sys.argv[1].lower()
461
+ if arg in ("--help", "-h"):
462
+ handle_help_command()
463
+ return
464
+ elif arg in ("--version", "-v"):
465
+ console.print(f"SocialScrape v{__version__}")
466
+ return
467
+ elif arg in ("doctor", "--doctor", "/doctor"):
468
+ handle_doctor()
469
+ return
470
+ elif arg == "batch":
471
+ handle_batch_command(sys.argv[2:])
472
+ return
473
+ elif arg in ("resume-batch", "resume_batch"):
474
+ handle_resume_batch_command(sys.argv[2:])
475
+ return
476
+ elif arg in ("--skill", "-s", "skill"):
477
+ handle_skill_command(sys.argv[2:], to_stdout=True)
478
+ return
479
+ elif arg in ("--skills", "skills"):
480
+ handle_skills_list_command(to_stdout=True)
481
+ return
482
+
483
+ # Dynamic plugin resolution for CLI subcommands
484
+ resolved = resolve_plugin_folder(arg)
485
+ if resolved:
486
+ handle_plugin_command(resolved, sys.argv[2:])
487
+ return
488
+
489
+ app = CLIApp(__version__)
490
+ app.run()
491
+
492
+
493
+ def main_dev():
494
+ """Entry point for local development/testing mode."""
495
+ os.environ["SOCIALSCRAPE_LOCAL_MODE"] = "1"
496
+ main()
497
+
498
+
499
+ if __name__ == "__main__":
500
+ main()