social-autoposter 1.6.16 → 1.6.18

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 (174) hide show
  1. package/bin/cli.js +63 -0
  2. package/bin/server.js +3421 -1266
  3. package/browser-agent-configs/all-agents-mcp.json +21 -2
  4. package/browser-agent-configs/linkedin-harness-mcp.json +21 -0
  5. package/mcp/dist/index.js +676 -0
  6. package/mcp/dist/repo.js +92 -0
  7. package/mcp/dist/setup.js +239 -0
  8. package/mcp/dist/twitterAuth.js +70 -0
  9. package/mcp/dist/version.js +81 -0
  10. package/mcp/install.mjs +160 -0
  11. package/mcp/manifest.json +65 -0
  12. package/mcp/package.json +25 -0
  13. package/package.json +6 -2
  14. package/scripts/_li_discover_pending.py +47 -48
  15. package/scripts/_phaseA_build_envelope.py +135 -0
  16. package/scripts/_phaseA_select_5AI7GO.py +191 -0
  17. package/scripts/_redditlink_finalize.py +50 -0
  18. package/scripts/_seo_lane_roi.py +2 -2
  19. package/scripts/audit_helper.py +120 -0
  20. package/scripts/backfill_aggregate_stats.py +1 -1
  21. package/scripts/backfill_crossroute_attribution.py +136 -0
  22. package/scripts/backfill_twitter_attempts_topic.py +118 -0
  23. package/scripts/browser_watch.py +145 -0
  24. package/scripts/campaign_bump.py +3 -29
  25. package/scripts/check_unread_web_chats.py +9 -89
  26. package/scripts/claim_web_chat.py +16 -36
  27. package/scripts/cleanup_harness_tabs.py +6 -1
  28. package/scripts/counterparty_history.py +104 -2
  29. package/scripts/db.py +1 -1
  30. package/scripts/delete_twitter_posts.py +272 -0
  31. package/scripts/discover_linkedin_candidates.py +169 -113
  32. package/scripts/dm_conversation.py +387 -1294
  33. package/scripts/dm_engage_helper.py +161 -0
  34. package/scripts/dm_short_links.py +257 -408
  35. package/scripts/dump_web_chat_history.py +11 -50
  36. package/scripts/engage_github.py +60 -2
  37. package/scripts/engage_reddit.py +33 -1
  38. package/scripts/engage_twitter_helper.py +23 -4
  39. package/scripts/engagement_styles.py +482 -303
  40. package/scripts/fetch_prospect_profile.py +125 -39
  41. package/scripts/finalize_post_101.py +170 -0
  42. package/scripts/find_threads.py +4 -3
  43. package/scripts/fix_style_lengths_20260601.py +93 -0
  44. package/scripts/generate_daily_human_style.py +281 -95
  45. package/scripts/get_run_cost.py +9 -44
  46. package/scripts/github_engage_helper.py +93 -0
  47. package/scripts/http_api.py +4 -3
  48. package/scripts/human_dm_replies_helper.py +169 -0
  49. package/scripts/ig_post_type_picker.py +39 -100
  50. package/scripts/ingest_human_dm_replies.py +27 -41
  51. package/scripts/ingest_web_chat_replies.py +17 -30
  52. package/scripts/insert_li_notifs.py +69 -0
  53. package/scripts/insert_post_072.py +128 -0
  54. package/scripts/insert_post_074.py +121 -0
  55. package/scripts/insert_post_082.py +82 -0
  56. package/scripts/install_lane_digest.py +23 -12
  57. package/scripts/invent_mcp_server.py +350 -0
  58. package/scripts/invent_topics.py +1462 -0
  59. package/scripts/li_discover_insert.py +41 -31
  60. package/scripts/li_discovery.py +161 -0
  61. package/scripts/li_notif_scan_process.py +204 -0
  62. package/scripts/li_process_notifications.py +40 -44
  63. package/scripts/li_process_notifs.py +69 -0
  64. package/scripts/link_edit_helper.py +142 -0
  65. package/scripts/link_tail.py +100 -6
  66. package/scripts/linkedin_browser.py +170 -135
  67. package/scripts/linkedin_killswitch.py +305 -0
  68. package/scripts/linkedin_search_topic_schema.py +49 -0
  69. package/scripts/linkedin_unipile.py +614 -0
  70. package/scripts/linkedin_url.py +33 -58
  71. package/scripts/log_claude_session.py +2 -9
  72. package/scripts/log_linkedin_search_attempts.py +30 -21
  73. package/scripts/log_post.py +141 -0
  74. package/scripts/log_run.py +115 -4
  75. package/scripts/log_twitter_search_attempts.py +22 -6
  76. package/scripts/lookup_post.py +20 -30
  77. package/scripts/mark_web_chat_processed.py +8 -21
  78. package/scripts/migrate_mentions_out_of_posts.py +1 -1
  79. package/scripts/moltbook_tools.py +1 -1
  80. package/scripts/pending_threads.py +39 -128
  81. package/scripts/pick_project.py +4 -2
  82. package/scripts/pick_search_topic.py +771 -0
  83. package/scripts/post_github.py +2 -1
  84. package/scripts/post_reddit.py +203 -56
  85. package/scripts/precompute_dashboard_stats.py +44 -12
  86. package/scripts/process_li_notifs.py +140 -0
  87. package/scripts/project_excludes.py +13 -19
  88. package/scripts/project_stats_json.py +132 -21
  89. package/scripts/project_topics.py +96 -0
  90. package/scripts/qualified_query_bank.py +295 -0
  91. package/scripts/reddit_browser.py +129 -27
  92. package/scripts/reddit_browser_fetch.py +141 -0
  93. package/scripts/reddit_browser_lock.py +24 -2
  94. package/scripts/reddit_query_bank.py +200 -0
  95. package/scripts/reddit_threads_helper.py +151 -0
  96. package/scripts/reddit_tools.py +63 -8
  97. package/scripts/reply_db.py +171 -0
  98. package/scripts/run_moltbook_cycle.py +7 -2
  99. package/scripts/scan_dm_candidates.py +131 -4
  100. package/scripts/scan_twitter_mentions_browser.py +5 -3
  101. package/scripts/scan_twitter_thread_followups.py +30 -19
  102. package/scripts/score_linkedin_candidates.py +73 -110
  103. package/scripts/score_twitter_candidates.py +257 -6
  104. package/scripts/scrape_linkedin_comment_stats.py +1276 -29
  105. package/scripts/seed_search_topics.py +127 -0
  106. package/scripts/send_web_chat_reply.py +41 -92
  107. package/scripts/setup_twitter_auth.py +448 -0
  108. package/scripts/{update_stats.py → stats.py} +382 -42
  109. package/scripts/stats_helper.py +52 -0
  110. package/scripts/strike_alert.py +4 -4
  111. package/scripts/style_length_report.py +287 -0
  112. package/scripts/sync_ig_to_posts.py +34 -0
  113. package/scripts/tmp_fix32992.py +17 -0
  114. package/scripts/tmp_recover.py +17 -0
  115. package/scripts/top_dud_linkedin_queries.py +19 -38
  116. package/scripts/top_dud_twitter_topics.py +102 -0
  117. package/scripts/top_linkedin_queries.py +19 -32
  118. package/scripts/top_search_topics.py +44 -153
  119. package/scripts/top_twitter_queries.py +106 -21
  120. package/scripts/twitter_browser.py +137 -2
  121. package/scripts/twitter_cycle_helper.py +42 -16
  122. package/scripts/twitter_gen_links.py +1 -1
  123. package/scripts/twitter_post_plan.py +151 -13
  124. package/scripts/twitter_scan.py +302 -0
  125. package/scripts/unclaim_web_chat.py +4 -15
  126. package/scripts/update_linkedin_stats_from_feed.py +98 -125
  127. package/scripts/watchdog_hung_runs.py +16 -4
  128. package/skill/audit-dm-staleness.sh +10 -23
  129. package/skill/audit-linkedin.sh +10 -0
  130. package/skill/audit-reddit-resurrect.sh +14 -12
  131. package/skill/audit.sh +91 -32
  132. package/skill/backfill-twitter-attempts-topic.sh +19 -0
  133. package/skill/backfill-twitter-ghost-posts.sh +24 -0
  134. package/skill/check-web-chats.sh +5 -8
  135. package/skill/dm-outreach-linkedin.sh +62 -49
  136. package/skill/dm-outreach-reddit.sh +15 -17
  137. package/skill/engage-dm-replies.sh +132 -237
  138. package/skill/engage-linkedin.sh +236 -130
  139. package/skill/engage-reddit.sh +10 -2
  140. package/skill/engage-twitter.sh +105 -14
  141. package/skill/github-engage.sh +15 -11
  142. package/skill/ingest-web-chat-replies.sh +2 -4
  143. package/skill/invent-supply-test.sh +95 -0
  144. package/skill/invent-topics.sh +50 -0
  145. package/skill/lib/linkedin-backend.sh +307 -0
  146. package/skill/lib/reddit-backend.sh +218 -0
  147. package/skill/lib/twitter-backend.sh +11 -7
  148. package/skill/link-edit-github.sh +14 -24
  149. package/skill/link-edit-moltbook.sh +11 -22
  150. package/skill/link-edit-reddit.sh +30 -34
  151. package/skill/lock.sh +65 -6
  152. package/skill/run-cycle-update-guard.sh +44 -0
  153. package/skill/run-generate-daily-style.sh +12 -7
  154. package/skill/run-instagram-render.sh +98 -135
  155. package/skill/run-linkedin-launchd.sh +11 -0
  156. package/skill/run-linkedin-unipile.sh +130 -0
  157. package/skill/run-linkedin.sh +901 -201
  158. package/skill/run-reddit-search.sh +42 -34
  159. package/skill/run-reddit-threads.sh +133 -83
  160. package/skill/run-twitter-cycle-singleton.sh +38 -67
  161. package/skill/run-twitter-cycle.sh +827 -348
  162. package/skill/run-twitter-threads.sh +47 -52
  163. package/skill/social-autoposter-update.sh +66 -0
  164. package/skill/stats-linkedin.sh +102 -20
  165. package/skill/stats.sh +17 -19
  166. package/skill/styles.sh +7 -1
  167. package/skill/topics.sh +51 -0
  168. package/scripts/reconcile_twitter_search_topic.py +0 -125
  169. package/skill/engage.sh +0 -292
  170. package/skill/link-edit-linkedin.sh +0 -147
  171. package/skill/octolens-linkedin.sh +0 -4
  172. package/skill/octolens-reddit.sh +0 -4
  173. package/skill/octolens-twitter.sh +0 -4
  174. package/skill/octolens.sh +0 -163
package/bin/cli.js CHANGED
@@ -24,6 +24,7 @@ const COPY_TARGETS = [
24
24
  'setup',
25
25
  'browser-agent-configs',
26
26
  'mcp-servers',
27
+ 'mcp',
27
28
  ];
28
29
 
29
30
  const ENV_TEMPLATE = `# social-autoposter environment variables
@@ -53,6 +54,7 @@ const BROWSER_AGENT_CONFIGS = [
53
54
  'linkedin-agent-mcp.json',
54
55
  'linkedin-agent.json',
55
56
  'twitter-harness-mcp.json',
57
+ 'linkedin-harness-mcp.json',
56
58
  'all-agents-mcp.json',
57
59
  ];
58
60
 
@@ -553,6 +555,18 @@ function generatePlists() {
553
555
  stdoutLog: `${DEST}/skill/logs/launchd-stats-stdout.log`,
554
556
  stderrLog: `${DEST}/skill/logs/launchd-stats-stderr.log`,
555
557
  },
558
+ {
559
+ // Daily self-updater. Pulls + installs the latest published release so a
560
+ // hands-free / headless install never drifts stale. The script refuses to
561
+ // touch a .git dev checkout, so it is a safe no-op on a source box.
562
+ file: 'com.m13v.social-autoposter-update.plist',
563
+ label: 'com.m13v.social-autoposter-update',
564
+ script: `${DEST}/skill/social-autoposter-update.sh`,
565
+ interval: 86400,
566
+ runAtLoad: true,
567
+ stdoutLog: `${DEST}/skill/logs/launchd-self-update-stdout.log`,
568
+ stderrLog: `${DEST}/skill/logs/launchd-self-update-stderr.log`,
569
+ },
556
570
  ];
557
571
 
558
572
  const driver = scheduler.driverFor();
@@ -701,6 +715,7 @@ function init() {
701
715
 
702
716
  installPythonDeps();
703
717
  removeLegacyEngagementStylesSidecar();
718
+ installMcp();
704
719
 
705
720
  // Remove stale skill/SKILL.md if it exists (SKILL.md lives at repo root only)
706
721
  const skillMd = path.join(DEST, 'skill', 'SKILL.md');
@@ -771,6 +786,7 @@ function update() {
771
786
  // and the candidate-style sidecar gets merged (preserves VM-side candidates).
772
787
  installPythonDeps();
773
788
  removeLegacyEngagementStylesSidecar();
789
+ installMcp();
774
790
 
775
791
  // Remove stale skill/SKILL.md if it exists (SKILL.md lives at repo root only)
776
792
  const skillMd = path.join(DEST, 'skill', 'SKILL.md');
@@ -824,6 +840,53 @@ function installPythonDeps() {
824
840
  }
825
841
  }
826
842
 
843
+ // Set up the social-autoposter MCP server (the X/Twitter draft/autopilot/stats
844
+ // surface for Claude Desktop + Claude Code). The package ships a prebuilt
845
+ // mcp/dist/, so we only install the runtime deps (@modelcontextprotocol/sdk +
846
+ // zod) and register the server into both clients. REPO_DIR auto-resolves to
847
+ // ~/social-autoposter (mcp/../..) so no env wiring is needed beyond what
848
+ // install.mjs pins. Idempotent; safe on both init and update.
849
+ function installMcp() {
850
+ const mcpDest = path.join(DEST, 'mcp');
851
+ if (!fs.existsSync(path.join(mcpDest, 'package.json'))) {
852
+ console.warn(' WARNING: mcp/ missing from install — skipping MCP setup');
853
+ return;
854
+ }
855
+ // Stamp the REAL shipped version (this npm package's version) into the MCP so
856
+ // it can report itself accurately at runtime. The top-level package.json is
857
+ // NOT copied into the install, so without this the MCP can't see its true
858
+ // version. mcp/src/version.ts reads dist/version.json first. Refreshed on
859
+ // every init/update.
860
+ try {
861
+ const pkgVersion = require('../package.json').version;
862
+ const distDir = path.join(mcpDest, 'dist');
863
+ fs.mkdirSync(distDir, { recursive: true });
864
+ fs.writeFileSync(
865
+ path.join(distDir, 'version.json'),
866
+ JSON.stringify({ version: pkgVersion, installedAt: new Date().toISOString() }, null, 2)
867
+ );
868
+ console.log(' stamped MCP version', pkgVersion);
869
+ } catch (e) {
870
+ console.warn(' WARNING: could not stamp MCP version:', e && e.message);
871
+ }
872
+ console.log(' installing MCP runtime deps (npm install --omit=dev in mcp/)');
873
+ const npmRes = spawnSync('npm', ['install', '--omit=dev', '--no-audit', '--no-fund'], {
874
+ cwd: mcpDest,
875
+ stdio: 'inherit',
876
+ });
877
+ if (npmRes.status !== 0) {
878
+ console.warn(' WARNING: npm install in mcp/ failed — run manually:');
879
+ console.warn(' (cd ~/social-autoposter/mcp && npm install --omit=dev)');
880
+ return;
881
+ }
882
+ console.log(' registering social-autoposter MCP with Claude Desktop + Claude Code');
883
+ const reg = spawnSync('node', ['install.mjs'], { cwd: mcpDest, stdio: 'inherit' });
884
+ if (reg.status !== 0) {
885
+ console.warn(' WARNING: MCP client registration failed — run manually:');
886
+ console.warn(' (cd ~/social-autoposter/mcp && node install.mjs)');
887
+ }
888
+ }
889
+
827
890
  // Sweep the legacy candidate-style sidecar JSON + lock file off every install.
828
891
  // The taxonomy lives in Postgres `engagement_styles_registry` now (single
829
892
  // source of truth for all installs, no per-machine JSON drift); see