thumbgate 1.4.3 → 1.4.4
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/.claude-plugin/marketplace.json +2 -2
- package/.claude-plugin/plugin.json +1 -1
- package/.well-known/mcp/server-card.json +1 -1
- package/adapters/README.md +1 -1
- package/adapters/claude/.mcp.json +2 -2
- package/adapters/codex/config.toml +2 -2
- package/adapters/mcp/server-stdio.js +1 -1
- package/adapters/opencode/opencode.json +1 -1
- package/package.json +157 -9
- package/scripts/statusline.sh +1 -0
- package/src/api/server.js +113 -16
- package/src/index.js +3 -0
- package/.claude-plugin/bundle/icon.png +0 -0
- package/.claude-plugin/bundle/icon.svg +0 -18
- package/.claude-plugin/bundle/server/index.js +0 -24
- package/adapters/chatgpt/INSTALL.md +0 -158
- package/adapters/perplexity/.mcp.json +0 -36
- package/adapters/perplexity/config.toml +0 -16
- package/adapters/perplexity/opencode.json +0 -29
- package/bin/memory.sh +0 -64
- package/bin/obsidian-sync.sh +0 -20
- package/plugins/amp-skill/INSTALL.md +0 -52
- package/plugins/amp-skill/SKILL.md +0 -64
- package/plugins/claude-codex-bridge/.claude-plugin/plugin.json +0 -22
- package/plugins/claude-codex-bridge/.mcp.json +0 -14
- package/plugins/claude-codex-bridge/INSTALL.md +0 -43
- package/plugins/claude-codex-bridge/README.md +0 -46
- package/plugins/claude-codex-bridge/scripts/codex-bridge.js +0 -286
- package/plugins/claude-codex-bridge/skills/adversarial-review/SKILL.md +0 -24
- package/plugins/claude-codex-bridge/skills/result/SKILL.md +0 -22
- package/plugins/claude-codex-bridge/skills/review/SKILL.md +0 -28
- package/plugins/claude-codex-bridge/skills/second-pass/SKILL.md +0 -27
- package/plugins/claude-codex-bridge/skills/setup/SKILL.md +0 -21
- package/plugins/claude-codex-bridge/skills/status/SKILL.md +0 -19
- package/plugins/claude-skill/INSTALL.md +0 -55
- package/plugins/claude-skill/SKILL.md +0 -46
- package/plugins/codex-profile/.codex-plugin/plugin.json +0 -43
- package/plugins/codex-profile/.mcp.json +0 -14
- package/plugins/codex-profile/AGENTS.md +0 -20
- package/plugins/codex-profile/INSTALL.md +0 -89
- package/plugins/codex-profile/README.md +0 -61
- package/plugins/cursor-marketplace/.cursor-plugin/plugin.json +0 -23
- package/plugins/cursor-marketplace/CHANGELOG.md +0 -30
- package/plugins/cursor-marketplace/LICENSE +0 -21
- package/plugins/cursor-marketplace/README.md +0 -124
- package/plugins/cursor-marketplace/agents/reliability-reviewer.md +0 -31
- package/plugins/cursor-marketplace/assets/logo-400x400.png +0 -0
- package/plugins/cursor-marketplace/commands/capture-feedback.md +0 -33
- package/plugins/cursor-marketplace/commands/check-gates.md +0 -25
- package/plugins/cursor-marketplace/commands/show-lessons.md +0 -27
- package/plugins/cursor-marketplace/hooks/hooks.json +0 -10
- package/plugins/cursor-marketplace/mcp.json +0 -14
- package/plugins/cursor-marketplace/rules/feedback-capture.mdc +0 -34
- package/plugins/cursor-marketplace/rules/pre-action-gates.mdc +0 -30
- package/plugins/cursor-marketplace/rules/session-continuity.mdc +0 -28
- package/plugins/cursor-marketplace/scripts/gate-check.sh +0 -21
- package/plugins/cursor-marketplace/skills/capture-feedback/SKILL.md +0 -48
- package/plugins/cursor-marketplace/skills/prevention-rules/SKILL.md +0 -31
- package/plugins/cursor-marketplace/skills/recall-context/SKILL.md +0 -30
- package/plugins/cursor-marketplace/skills/search-lessons/SKILL.md +0 -33
- package/plugins/gemini-extension/INSTALL.md +0 -92
- package/plugins/gemini-extension/gemini_prompt.txt +0 -14
- package/plugins/gemini-extension/tool_contract.json +0 -45
- package/plugins/opencode-profile/INSTALL.md +0 -57
- package/public/assets/instagram-card.png +0 -0
- package/public/assets/tiktok-agent-memory.mp4 +0 -0
- package/public/blog.html +0 -474
- package/public/compare/mem0.html +0 -189
- package/public/compare/speclock.html +0 -180
- package/public/compare.html +0 -310
- package/public/dashboard.html +0 -1100
- package/public/guide.html +0 -317
- package/public/guides/claude-code-prevent-repeated-mistakes.html +0 -161
- package/public/guides/codex-cli-guardrails.html +0 -158
- package/public/guides/cursor-prevent-repeated-mistakes.html +0 -161
- package/public/guides/pre-action-gates.html +0 -162
- package/public/guides/stop-repeated-ai-agent-mistakes.html +0 -159
- package/public/index.html +0 -1225
- package/public/js/buyer-intent.js +0 -252
- package/public/learn/agent-harness-pattern.html +0 -180
- package/public/learn/ai-agent-persistent-memory.html +0 -203
- package/public/learn/learn.css +0 -45
- package/public/learn/mcp-pre-action-gates-explained.html +0 -172
- package/public/learn/stop-ai-agent-force-push.html +0 -134
- package/public/learn/vibe-coding-safety-net.html +0 -142
- package/public/learn.html +0 -274
- package/public/lessons.html +0 -967
- package/public/llm-context.md +0 -156
- package/public/pro.html +0 -1087
- package/public/vercel.json +0 -8
- package/scripts/a2ui-engine.js +0 -73
- package/scripts/adk-consolidator.js +0 -274
- package/scripts/agent-security-hardening.js +0 -225
- package/scripts/ai-search-visibility.js +0 -116
- package/scripts/autonomous-sales-agent.js +0 -39
- package/scripts/autoresearch-runner.js +0 -216
- package/scripts/background-agent-governance.js +0 -229
- package/scripts/behavioral-extraction.js +0 -93
- package/scripts/budget-enforcer.js +0 -173
- package/scripts/budget-guard.js +0 -173
- package/scripts/build-claude-mcpb.js +0 -255
- package/scripts/build-codex-plugin.js +0 -152
- package/scripts/capture-railway-diagnostics.sh +0 -97
- package/scripts/changeset-check.js +0 -372
- package/scripts/check-congruence.js +0 -443
- package/scripts/computer-use-firewall.js +0 -280
- package/scripts/content-engine/linkedin-content-generator.js +0 -154
- package/scripts/content-engine/output/linkedin-memento-validation.md +0 -17
- package/scripts/content-engine/output/linkedin-posts-2026-04-09.md +0 -175
- package/scripts/content-engine/reddit-thread-finder.js +0 -154
- package/scripts/context-engine.js +0 -710
- package/scripts/daily-digest.js +0 -11
- package/scripts/data-governance.js +0 -173
- package/scripts/deploy-gcp.sh +0 -44
- package/scripts/deploy-policy.js +0 -249
- package/scripts/disagreement-mining.js +0 -315
- package/scripts/dpo-optimizer.js +0 -206
- package/scripts/ensure-repo-bootstrap.js +0 -130
- package/scripts/ephemeral-agent-store.js +0 -212
- package/scripts/eval-harness.js +0 -56
- package/scripts/export-kto-pairs.js +0 -309
- package/scripts/export-training.js +0 -446
- package/scripts/feedback-fallback.js +0 -111
- package/scripts/feedback-inbox-read.js +0 -162
- package/scripts/feedback-root-consolidator.js +0 -233
- package/scripts/feedback-to-memory.js +0 -185
- package/scripts/gate-satisfy.js +0 -42
- package/scripts/generate-paperbanana-diagrams.sh +0 -99
- package/scripts/generate-pretool-hook.sh +0 -40
- package/scripts/github-about.js +0 -430
- package/scripts/github-outreach.js +0 -65
- package/scripts/gtm-revenue-loop.js +0 -535
- package/scripts/hallucination-detector.js +0 -226
- package/scripts/hf-papers.js +0 -317
- package/scripts/hook-auto-capture.sh +0 -100
- package/scripts/hook-stop-pr-thread-check.sh +0 -68
- package/scripts/hook-stop-self-score.sh +0 -51
- package/scripts/hook-stop-verify-deploy.sh +0 -31
- package/scripts/hook-verify-before-done.sh +0 -20
- package/scripts/managed-dpo-export.js +0 -91
- package/scripts/markdown-escape.js +0 -12
- package/scripts/marketing-experiment.js +0 -657
- package/scripts/memalign-recall.js +0 -111
- package/scripts/memory-migration.js +0 -296
- package/scripts/meta-policy.js +0 -190
- package/scripts/metered-billing.js +0 -16
- package/scripts/model-tier-router.js +0 -310
- package/scripts/money-watcher.js +0 -218
- package/scripts/multi-hop-recall.js +0 -240
- package/scripts/per-step-scoring.js +0 -163
- package/scripts/perplexity-command-center.js +0 -644
- package/scripts/perplexity-marketing.js +0 -454
- package/scripts/pii-scanner.js +0 -153
- package/scripts/plan-gate.js +0 -154
- package/scripts/post-everywhere.js +0 -341
- package/scripts/post-to-x-retry.sh +0 -22
- package/scripts/post-to-x.js +0 -369
- package/scripts/pr-manager.js +0 -421
- package/scripts/principle-extractor.js +0 -162
- package/scripts/pro-features.js +0 -41
- package/scripts/prompt-dlp.js +0 -222
- package/scripts/prove-adapters.js +0 -860
- package/scripts/prove-attribution.js +0 -361
- package/scripts/prove-automation.js +0 -651
- package/scripts/prove-autoresearch.js +0 -304
- package/scripts/prove-claim-verification.js +0 -277
- package/scripts/prove-cloudflare-sandbox.js +0 -161
- package/scripts/prove-data-pipeline.js +0 -408
- package/scripts/prove-data-quality.js +0 -227
- package/scripts/prove-evolution.js +0 -352
- package/scripts/prove-harnesses.js +0 -287
- package/scripts/prove-intelligence.js +0 -257
- package/scripts/prove-lancedb.js +0 -425
- package/scripts/prove-local-intelligence.js +0 -340
- package/scripts/prove-loop-closure.js +0 -263
- package/scripts/prove-packaged-runtime.js +0 -327
- package/scripts/prove-predictive-insights.js +0 -355
- package/scripts/prove-runtime.js +0 -363
- package/scripts/prove-seo-gsd.js +0 -234
- package/scripts/prove-settings.js +0 -279
- package/scripts/prove-subway-upgrades.js +0 -277
- package/scripts/prove-tessl.js +0 -229
- package/scripts/prove-training-export.js +0 -325
- package/scripts/prove-workflow-contract.js +0 -112
- package/scripts/prove-xmemory.js +0 -332
- package/scripts/publish-decision.js +0 -159
- package/scripts/ralph-loop.js +0 -376
- package/scripts/ralph-mode-ci.js +0 -434
- package/scripts/reddit-dm-outreach.js +0 -192
- package/scripts/reddit-monitor-cron.sh +0 -26
- package/scripts/reminder-engine.js +0 -132
- package/scripts/revenue-status.js +0 -472
- package/scripts/rotate-stripe-webhook-secret.js +0 -314
- package/scripts/schedule-manager.js +0 -249
- package/scripts/self-healing-check.js +0 -193
- package/scripts/session-analyzer.js +0 -533
- package/scripts/shieldcortex-memory-firewall-runner.mjs +0 -53
- package/scripts/skill-exporter.js +0 -260
- package/scripts/skill-materializer.js +0 -134
- package/scripts/skill-packs.js +0 -136
- package/scripts/skill-proposer.js +0 -99
- package/scripts/skill-quality-tracker.js +0 -282
- package/scripts/slow-loop.js +0 -72
- package/scripts/social-analytics/db/marketing-db.js +0 -179
- package/scripts/social-analytics/db/schema.sql +0 -55
- package/scripts/social-analytics/digest.js +0 -256
- package/scripts/social-analytics/engagement-audit.js +0 -185
- package/scripts/social-analytics/generate-instagram-card.js +0 -123
- package/scripts/social-analytics/generate-slides.js +0 -268
- package/scripts/social-analytics/instagram-thumbgate-post.js +0 -111
- package/scripts/social-analytics/install-growth-automation.js +0 -114
- package/scripts/social-analytics/load-env.js +0 -77
- package/scripts/social-analytics/mcp-server.js +0 -289
- package/scripts/social-analytics/normalizer.js +0 -580
- package/scripts/social-analytics/notify.js +0 -162
- package/scripts/social-analytics/poll-all.js +0 -107
- package/scripts/social-analytics/pollers/github.js +0 -195
- package/scripts/social-analytics/pollers/instagram.js +0 -253
- package/scripts/social-analytics/pollers/linkedin.js +0 -340
- package/scripts/social-analytics/pollers/plausible.js +0 -245
- package/scripts/social-analytics/pollers/reddit.js +0 -306
- package/scripts/social-analytics/pollers/threads.js +0 -233
- package/scripts/social-analytics/pollers/tiktok.js +0 -203
- package/scripts/social-analytics/pollers/x.js +0 -227
- package/scripts/social-analytics/pollers/youtube.js +0 -304
- package/scripts/social-analytics/pollers/zernio.js +0 -183
- package/scripts/social-analytics/post-video.js +0 -316
- package/scripts/social-analytics/publish-instagram-thumbgate.js +0 -104
- package/scripts/social-analytics/publish-thumbgate-launch.js +0 -322
- package/scripts/social-analytics/publishers/devto.js +0 -122
- package/scripts/social-analytics/publishers/instagram.js +0 -317
- package/scripts/social-analytics/publishers/linkedin.js +0 -294
- package/scripts/social-analytics/publishers/reddit.js +0 -385
- package/scripts/social-analytics/publishers/threads.js +0 -275
- package/scripts/social-analytics/publishers/tiktok.js +0 -217
- package/scripts/social-analytics/publishers/x.js +0 -259
- package/scripts/social-analytics/publishers/youtube.js +0 -223
- package/scripts/social-analytics/publishers/zernio.js +0 -568
- package/scripts/social-analytics/reconcile-thumbgate-campaign.js +0 -165
- package/scripts/social-analytics/run-digest.js +0 -34
- package/scripts/social-analytics/schedule-thumbgate-campaign.js +0 -275
- package/scripts/social-analytics/store.js +0 -455
- package/scripts/social-analytics/sync-launch-assets.js +0 -185
- package/scripts/social-analytics/utm.js +0 -143
- package/scripts/social-pipeline.js +0 -2626
- package/scripts/social-post-hourly.js +0 -228
- package/scripts/social-quality-gate.js +0 -134
- package/scripts/social-reply-monitor.js +0 -592
- package/scripts/status-dashboard.js +0 -155
- package/scripts/stripe-live-status.js +0 -115
- package/scripts/subagent-profiles.js +0 -79
- package/scripts/sync-branch-protection.js +0 -340
- package/scripts/sync-gh-secrets-from-env.sh +0 -70
- package/scripts/sync-github-about.js +0 -55
- package/scripts/sync-version.js +0 -479
- package/scripts/synthetic-dpo.js +0 -234
- package/scripts/tessl-export.js +0 -369
- package/scripts/test-coverage.js +0 -128
- package/scripts/thumbgate-bench.js +0 -494
- package/scripts/thumbgate_session_start.sh +0 -32
- package/scripts/train_from_feedback.py +0 -929
- package/scripts/validate-feedback.js +0 -581
- package/scripts/verify-obsidian-setup.sh +0 -269
- package/scripts/verify-run.js +0 -269
- package/scripts/weekly-auto-post.js +0 -124
- package/scripts/x-autonomous-marketing.js +0 -139
|
@@ -1,268 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
'use strict';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* generate-slides.js
|
|
6
|
-
* Generates PNG slide frames for ThumbGate marketing short videos.
|
|
7
|
-
*
|
|
8
|
-
* 6 rotating templates — each tells a different story about the product.
|
|
9
|
-
* Templates are rotated by the post-scheduler so CI never reposts the
|
|
10
|
-
* same content within the configured cooldown window.
|
|
11
|
-
*
|
|
12
|
-
* Output: slide_01.png … slide_NN.png + manifest.json
|
|
13
|
-
* ffmpeg stitches them into MP4 via the video-autopilot CI workflow.
|
|
14
|
-
*
|
|
15
|
-
* Usage:
|
|
16
|
-
* node scripts/social-analytics/generate-slides.js
|
|
17
|
-
* node scripts/social-analytics/generate-slides.js --template=2
|
|
18
|
-
* node scripts/social-analytics/generate-slides.js --template=auto --out=/tmp
|
|
19
|
-
*/
|
|
20
|
-
|
|
21
|
-
const { execSync } = require('node:child_process');
|
|
22
|
-
const path = require('node:path');
|
|
23
|
-
const fs = require('node:fs');
|
|
24
|
-
|
|
25
|
-
// ---------------------------------------------------------------------------
|
|
26
|
-
// Templates — 6 distinct story arcs, each 28-35 seconds
|
|
27
|
-
// Edit content here; rendering logic is unchanged.
|
|
28
|
-
// ---------------------------------------------------------------------------
|
|
29
|
-
|
|
30
|
-
const TEMPLATES = {
|
|
31
|
-
|
|
32
|
-
// 1 — Force-push wipes PRs
|
|
33
|
-
1: {
|
|
34
|
-
name: 'force-push',
|
|
35
|
-
slides: [
|
|
36
|
-
{ holdSeconds: 4, title: ['Your AI agent', 'just force-pushed', 'to main.'], subtitle: 'It wiped 3 open PRs.', lines: [], cta: null },
|
|
37
|
-
{ holdSeconds: 4, title: ['You told it not to.', 'It did it again.'], subtitle: 'Prompts are suggestions — not constraints.', lines: [], cta: null },
|
|
38
|
-
{ holdSeconds: 6, title: ['ThumbGate blocks it:'], subtitle: null, lines: ['→ Agent: git push --force origin main', '→ PreToolUse hook fires', '→ Gate #4: force-push to main', '✗ BLOCKED — rule auto-promoted', ' after 1 previous failure.'], cta: null },
|
|
39
|
-
{ holdSeconds: 5, title: ['The feedback loop:'], subtitle: null, lines: ['👎 bad action captured', '→ lesson written to SQLite DB', '→ prevention rule generated', '→ PreToolUse gate activated', '✓ same mistake: blocked forever'], cta: null },
|
|
40
|
-
{ holdSeconds: 6, title: ['ThumbGate', 'v1.4.1'], subtitle: 'Live GPT + local gates', lines: [], cta: { line1: 'Try the GPT →', line2: 'chatgpt.com/g/g-69dcfd1cd5f881918ae31874631d6f08-thumbgate' } },
|
|
41
|
-
],
|
|
42
|
-
},
|
|
43
|
-
|
|
44
|
-
// 2 — Deleted prod config
|
|
45
|
-
2: {
|
|
46
|
-
name: 'deleted-config',
|
|
47
|
-
slides: [
|
|
48
|
-
{ holdSeconds: 4, title: ['AI agent deleted', 'your prod config.'], subtitle: '"It looked unused."', lines: [], cta: null },
|
|
49
|
-
{ holdSeconds: 4, title: ['2 hours of rollback.', 'For a file it', '"cleaned up".'], subtitle: null, lines: [], cta: null },
|
|
50
|
-
{ holdSeconds: 6, title: ['Gate auto-created', 'after 1 failure:'], subtitle: null, lines: ['→ Agent: rm config/prod.json', '→ PreToolUse hook fires', '→ Pattern: rm config/*.json', '✗ BLOCKED — protected path', ' Add to .thumbgate/allowlist', ' to override explicitly.'], cta: null },
|
|
51
|
-
{ holdSeconds: 5, title: ['Every 👎 becomes', 'a permanent gate.'], subtitle: null, lines: ['1 failure → warn gate', '3 failures → hard block', 'No config change required.', 'Automatic.'], cta: null },
|
|
52
|
-
{ holdSeconds: 6, title: ['ThumbGate', 'v1.4.1'], subtitle: 'npx thumbgate serve', lines: [], cta: { line1: 'Try the GPT →', line2: 'chatgpt.com/g/g-69dcfd1cd5f881918ae31874631d6f08-thumbgate' } },
|
|
53
|
-
],
|
|
54
|
-
},
|
|
55
|
-
|
|
56
|
-
// 3 — Session amnesia
|
|
57
|
-
3: {
|
|
58
|
-
name: 'session-amnesia',
|
|
59
|
-
slides: [
|
|
60
|
-
{ holdSeconds: 4, title: ['Every new session,', 'your AI agent', 'forgets everything.'], subtitle: null, lines: [], cta: null },
|
|
61
|
-
{ holdSeconds: 5, title: ['You re-explain.', 'It breaks the', 'same thing.', 'You fix it again.'], subtitle: 'Sound familiar?', lines: [], cta: null },
|
|
62
|
-
{ holdSeconds: 6, title: ['ThumbGate gives it', 'persistent memory:'], subtitle: null, lines: ['→ 👎 on bad action', '→ lesson stored in SQLite+FTS5', '→ retrieved next session', '→ gate blocks same mistake', '✓ learning that persists'], cta: null },
|
|
63
|
-
{ holdSeconds: 5, title: ['Session 1 vs 50:'], subtitle: null, lines: ['Session 1: same mistakes', 'Session 10: fewer mistakes', 'Session 50: gates block them', ' before you even see them.', 'Compounding prevention.'], cta: null },
|
|
64
|
-
{ holdSeconds: 6, title: ['ThumbGate', 'v1.4.1'], subtitle: 'Works with ChatGPT, Claude Code, Cursor, Codex CLI', lines: [], cta: { line1: 'Open the GPT →', line2: 'chatgpt.com/g/g-69dcfd1cd5f881918ae31874631d6f08-thumbgate' } },
|
|
65
|
-
],
|
|
66
|
-
},
|
|
67
|
-
|
|
68
|
-
// 4 — Thompson Sampling (technical)
|
|
69
|
-
4: {
|
|
70
|
-
name: 'thompson-sampling',
|
|
71
|
-
slides: [
|
|
72
|
-
{ holdSeconds: 4, title: ['How do gates decide', 'which lessons', 'matter most?'], subtitle: 'Thompson Sampling.', lines: [], cta: null },
|
|
73
|
-
{ holdSeconds: 6, title: ['Each gate has a', 'Beta distribution:'], subtitle: null, lines: ['Gate starts: Beta(1,1) = uniform', '👎 on trigger: alpha += 1', '👍 no issue: beta += 1', '→ High alpha = high-priority gate', '→ Rarely triggered = auto-demoted'], cta: null },
|
|
74
|
-
{ holdSeconds: 5, title: ['After ~20 cycles,', 'gates self-sort:'], subtitle: null, lines: ['force-push → Beta(18,2) HIGH', 'rm config → Beta(12,3) HIGH', 'npm audit → Beta(2,15) demoted', '✓ signal rises, noise falls'], cta: null },
|
|
75
|
-
{ holdSeconds: 5, title: ['No tuning.', 'No config.', 'Self-correcting.'], subtitle: 'The gate ranking adapts to your codebase.', lines: [], cta: null },
|
|
76
|
-
{ holdSeconds: 6, title: ['ThumbGate', 'v1.4.1'], subtitle: 'Thompson Sampling + LanceDB vector search', lines: [], cta: { line1: 'Try the GPT →', line2: 'chatgpt.com/g/g-69dcfd1cd5f881918ae31874631d6f08-thumbgate' } },
|
|
77
|
-
],
|
|
78
|
-
},
|
|
79
|
-
|
|
80
|
-
// 5 — 30-second install demo
|
|
81
|
-
5: {
|
|
82
|
-
name: 'install-demo',
|
|
83
|
-
slides: [
|
|
84
|
-
{ holdSeconds: 4, title: ['Stop your AI agent', 'from making the', 'same mistakes.'], subtitle: 'Install in 30 seconds.', lines: [], cta: null },
|
|
85
|
-
{ holdSeconds: 5, title: ['Step 1:'], subtitle: null, lines: ['npx thumbgate serve', '', '✓ MCP server running on :3001', '✓ SQLite lesson DB initialised', '✓ PreToolUse hook active'], cta: null },
|
|
86
|
-
{ holdSeconds: 5, title: ['Step 2:'], subtitle: null, lines: ['Give a thumbs-down:', 'thumbgate feedback --down \\', ' "agent deleted prod config"', '', '→ Lesson captured + indexed'], cta: null },
|
|
87
|
-
{ holdSeconds: 5, title: ['Step 3:', '(automatic)'], subtitle: null, lines: ['→ Prevention rule generated', '→ Gate created: rm config/*', '→ Next time agent tries it:', '✗ BLOCKED before execution'], cta: null },
|
|
88
|
-
{ holdSeconds: 6, title: ['ThumbGate', 'v1.4.1'], subtitle: 'Free. Open source. No sign-up.', lines: [], cta: { line1: 'Open the GPT first', line2: 'chatgpt.com/g/g-69dcfd1cd5f881918ae31874631d6f08-thumbgate' } },
|
|
89
|
-
],
|
|
90
|
-
},
|
|
91
|
-
|
|
92
|
-
// 6 — Before/After comparison
|
|
93
|
-
6: {
|
|
94
|
-
name: 'before-after',
|
|
95
|
-
slides: [
|
|
96
|
-
{ holdSeconds: 4, title: ['Before ThumbGate:'], subtitle: null, lines: ['Agent runs dangerous command', 'You notice after deploy', 'You write a rule in CLAUDE.md', 'Agent ignores it next session', 'Repeat forever.'], cta: null },
|
|
97
|
-
{ holdSeconds: 4, title: ['After ThumbGate:'], subtitle: null, lines: ['Agent tries dangerous command', '✗ BLOCKED by PreToolUse gate', 'Gate was promoted from your 👎', '✓ Never reaches production'], cta: null },
|
|
98
|
-
{ holdSeconds: 5, title: ['The difference:'], subtitle: null, lines: ['CLAUDE.md = suggestion', 'ThumbGate = enforcement', '', 'Rules in files get ignored.', 'Gates cannot be ignored.'], cta: null },
|
|
99
|
-
{ holdSeconds: 5, title: ['What changes:'], subtitle: null, lines: ['→ mistakes blocked pre-execution', '→ lessons persist across sessions', '→ gates auto-promote from failures', '→ DPO export for fine-tuning', '✓ compounding safety over time'], cta: null },
|
|
100
|
-
{ holdSeconds: 6, title: ['ThumbGate', 'v1.4.1'], subtitle: 'Free + Open Source', lines: [], cta: { line1: 'Try the GPT →', line2: 'chatgpt.com/g/g-69dcfd1cd5f881918ae31874631d6f08-thumbgate' } },
|
|
101
|
-
],
|
|
102
|
-
},
|
|
103
|
-
|
|
104
|
-
};
|
|
105
|
-
|
|
106
|
-
// ---------------------------------------------------------------------------
|
|
107
|
-
// Python renderer (unchanged — handles all templates via SLIDES var)
|
|
108
|
-
// ---------------------------------------------------------------------------
|
|
109
|
-
|
|
110
|
-
function buildPythonScript(slides, outDir) {
|
|
111
|
-
return `
|
|
112
|
-
import os, json as _json
|
|
113
|
-
from PIL import Image, ImageDraw, ImageFont
|
|
114
|
-
|
|
115
|
-
W, H = 1080, 1920
|
|
116
|
-
OUT_DIR = ${JSON.stringify(outDir)}
|
|
117
|
-
os.makedirs(OUT_DIR, exist_ok=True)
|
|
118
|
-
|
|
119
|
-
FONT_PATHS = {
|
|
120
|
-
'bold': '/usr/share/fonts/truetype/dejavu/DejaVuSans-Bold.ttf',
|
|
121
|
-
'regular': '/usr/share/fonts/truetype/dejavu/DejaVuSans.ttf',
|
|
122
|
-
'mono': '/usr/share/fonts/truetype/dejavu/DejaVuSansMono.ttf',
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
def font(name, size):
|
|
126
|
-
try: return ImageFont.truetype(FONT_PATHS.get(name, FONT_PATHS['regular']), size)
|
|
127
|
-
except: return ImageFont.load_default()
|
|
128
|
-
|
|
129
|
-
SLIDES = _json.loads(${JSON.stringify(JSON.stringify(slides))})
|
|
130
|
-
|
|
131
|
-
def bg():
|
|
132
|
-
img = Image.new('RGB', (W, H), '#0a0a0f')
|
|
133
|
-
d = ImageDraw.Draw(img)
|
|
134
|
-
for i in range(H):
|
|
135
|
-
r = i/H
|
|
136
|
-
d.line([(0,i),(W,i)], fill=(int(10+8*(1-r)), int(10+2*(1-r)), int(15+30*(1-r))))
|
|
137
|
-
return img, d
|
|
138
|
-
|
|
139
|
-
def draw_slide(s, idx):
|
|
140
|
-
img, d = bg()
|
|
141
|
-
d.rectangle([(0,0),(W,8)], fill='#6366f1')
|
|
142
|
-
d.rectangle([(0,H-8),(W,H)], fill='#6366f1')
|
|
143
|
-
y = 200
|
|
144
|
-
for tl in s.get('title', []):
|
|
145
|
-
d.text((80, y), tl, font=font('bold', 76), fill='#ffffff')
|
|
146
|
-
y += 95
|
|
147
|
-
y += 20
|
|
148
|
-
sub = s.get('subtitle')
|
|
149
|
-
if sub:
|
|
150
|
-
d.text((80, y), sub, font=font('regular', 44), fill='#8888aa')
|
|
151
|
-
y += 65
|
|
152
|
-
y += 20
|
|
153
|
-
lines = s.get('lines', [])
|
|
154
|
-
if lines:
|
|
155
|
-
d.rectangle([(40, y-20),(W-40, y+len(lines)*58+25)], fill='#12121e', outline='#2a2a3f', width=2)
|
|
156
|
-
for line in lines:
|
|
157
|
-
px = 70
|
|
158
|
-
if line.startswith('✗'):
|
|
159
|
-
d.text((px, y), '✗', font=font('bold', 38), fill='#ef4444')
|
|
160
|
-
d.text((px+40, y), line[1:], font=font('mono', 36), fill='#ffaaaa')
|
|
161
|
-
elif line.startswith('✓'):
|
|
162
|
-
d.text((px, y), '✓', font=font('bold', 38), fill='#22c55e')
|
|
163
|
-
d.text((px+40, y), line[1:], font=font('mono', 36), fill='#aaffaa')
|
|
164
|
-
elif line.startswith('→'):
|
|
165
|
-
d.text((px, y), '→', font=font('regular', 38), fill='#6366f1')
|
|
166
|
-
d.text((px+40, y), line[1:], font=font('mono', 36), fill='#d0d8f0')
|
|
167
|
-
elif line.startswith('👎'):
|
|
168
|
-
d.text((px, y), line, font=font('mono', 36), fill='#fbbf24')
|
|
169
|
-
else:
|
|
170
|
-
d.text((px, y), line, font=font('mono', 36), fill='#d0d8f0')
|
|
171
|
-
y += 58
|
|
172
|
-
cta = s.get('cta')
|
|
173
|
-
if cta:
|
|
174
|
-
cy = H - 320
|
|
175
|
-
d.rectangle([(60, cy),(W-60, cy+180)], fill='#6366f1')
|
|
176
|
-
d.text((80, cy+24), cta['line1'], font=font('bold', 56), fill='#ffffff')
|
|
177
|
-
d.text((80, cy+100), cta['line2'], font=font('regular', 38), fill='#e0e8ff')
|
|
178
|
-
img.save(os.path.join(OUT_DIR, f'slide_{idx:02d}.png'), 'PNG')
|
|
179
|
-
print(f' Wrote slide_{idx:02d}.png')
|
|
180
|
-
|
|
181
|
-
for i, slide in enumerate(SLIDES): draw_slide(slide, i+1)
|
|
182
|
-
print(f'Generated {len(SLIDES)} slides → {OUT_DIR}')
|
|
183
|
-
`;
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
// ---------------------------------------------------------------------------
|
|
187
|
-
// Template selector
|
|
188
|
-
// ---------------------------------------------------------------------------
|
|
189
|
-
|
|
190
|
-
/**
|
|
191
|
-
* Pick the next template to use, avoiding recent repeats.
|
|
192
|
-
* Reads marketing DB if available; falls back to round-robin by hour.
|
|
193
|
-
*/
|
|
194
|
-
function pickTemplate(requestedId) {
|
|
195
|
-
if (requestedId && requestedId !== 'auto') {
|
|
196
|
-
const id = Number.parseInt(requestedId, 10);
|
|
197
|
-
if (!TEMPLATES[id]) { console.error(`Unknown template id: ${id}`); process.exit(1); }
|
|
198
|
-
return id;
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
// Try to pick least-recently-used from marketing DB
|
|
202
|
-
try {
|
|
203
|
-
const db = require('./db/marketing-db');
|
|
204
|
-
const recent = db.list({ type: 'video', days: 30, limit: 100 });
|
|
205
|
-
const usedTemplates = new Set(
|
|
206
|
-
recent.map(r => { try { return JSON.parse(r.extra_json || '{}').templateId; } catch { return null; } }).filter(Boolean)
|
|
207
|
-
);
|
|
208
|
-
const allIds = Object.keys(TEMPLATES).map(Number);
|
|
209
|
-
const unused = allIds.filter(id => !usedTemplates.has(id));
|
|
210
|
-
if (unused.length > 0) return unused[0]; // pick first unused
|
|
211
|
-
// All used — pick oldest
|
|
212
|
-
const templateCounts = {};
|
|
213
|
-
for (const r of recent) {
|
|
214
|
-
try { const t = JSON.parse(r.extra_json || '{}').templateId; if (t) templateCounts[t] = (templateCounts[t] || 0) + 1; } catch {}
|
|
215
|
-
}
|
|
216
|
-
const sortedIds = [...allIds];
|
|
217
|
-
sortedIds.sort((a, b) => (templateCounts[a] || 0) - (templateCounts[b] || 0));
|
|
218
|
-
return sortedIds[0];
|
|
219
|
-
} catch {
|
|
220
|
-
// Fallback: round-robin by 4-hour block
|
|
221
|
-
const block = Math.floor(Date.now() / (4 * 3600 * 1000));
|
|
222
|
-
const ids = Object.keys(TEMPLATES).map(Number);
|
|
223
|
-
return ids[block % ids.length];
|
|
224
|
-
}
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
// ---------------------------------------------------------------------------
|
|
228
|
-
// Entry point
|
|
229
|
-
// ---------------------------------------------------------------------------
|
|
230
|
-
|
|
231
|
-
function main() {
|
|
232
|
-
const args = process.argv.slice(2);
|
|
233
|
-
const outDir = args.find(a => a.startsWith('--out='))?.slice(6) || path.join(__dirname);
|
|
234
|
-
const campaign = args.find(a => a.startsWith('--campaign='))?.slice(11) || 'default';
|
|
235
|
-
const templateArg = args.find(a => a.startsWith('--template='))?.slice(11) || 'auto';
|
|
236
|
-
|
|
237
|
-
const templateId = pickTemplate(templateArg);
|
|
238
|
-
const template = TEMPLATES[templateId];
|
|
239
|
-
|
|
240
|
-
console.log(`[generate-slides] template=${templateId}(${template.name}) campaign=${campaign} out=${outDir}`);
|
|
241
|
-
|
|
242
|
-
const pyScript = buildPythonScript(template.slides, outDir);
|
|
243
|
-
const tmpPy = path.join(require('node:os').tmpdir(), 'thumbgate_slides.py');
|
|
244
|
-
fs.writeFileSync(tmpPy, pyScript);
|
|
245
|
-
|
|
246
|
-
try {
|
|
247
|
-
execSync(`python3 ${tmpPy}`, { stdio: 'inherit' });
|
|
248
|
-
} catch (err) {
|
|
249
|
-
console.error('[generate-slides] Python render failed:', err.message);
|
|
250
|
-
process.exit(1);
|
|
251
|
-
}
|
|
252
|
-
|
|
253
|
-
const manifest = {
|
|
254
|
-
templateId,
|
|
255
|
-
templateName: template.name,
|
|
256
|
-
campaign,
|
|
257
|
-
generatedAt: new Date().toISOString(),
|
|
258
|
-
slides: template.slides.map((s, i) => ({
|
|
259
|
-
file: `slide_${String(i + 1).padStart(2, '0')}.png`,
|
|
260
|
-
holdSeconds: s.holdSeconds,
|
|
261
|
-
})),
|
|
262
|
-
totalDuration: template.slides.reduce((sum, s) => sum + s.holdSeconds, 0),
|
|
263
|
-
};
|
|
264
|
-
fs.writeFileSync(path.join(outDir, 'manifest.json'), JSON.stringify(manifest, null, 2));
|
|
265
|
-
console.log(`[generate-slides] Done. template=${templateId} duration=${manifest.totalDuration}s`);
|
|
266
|
-
}
|
|
267
|
-
|
|
268
|
-
main();
|
|
@@ -1,111 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
'use strict';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* instagram-thumbgate-post.js
|
|
6
|
-
* Posts ThumbGate Instagram card and caption via Zernio API.
|
|
7
|
-
*
|
|
8
|
-
* Usage:
|
|
9
|
-
* node instagram-thumbgate-post.js [--image-path=path/to/image.png]
|
|
10
|
-
*/
|
|
11
|
-
|
|
12
|
-
const path = require('path');
|
|
13
|
-
const {
|
|
14
|
-
publishPost,
|
|
15
|
-
schedulePost,
|
|
16
|
-
getConnectedAccounts,
|
|
17
|
-
uploadLocalMedia,
|
|
18
|
-
} = require('./publishers/zernio');
|
|
19
|
-
|
|
20
|
-
const THUMBGATE_CAPTION = `Your AI coding agent has amnesia. It forgets everything between sessions.
|
|
21
|
-
|
|
22
|
-
ThumbGate gives it memory that survives restarts. Thumbs-down a mistake → it becomes a prevention rule → the agent can't repeat it.
|
|
23
|
-
|
|
24
|
-
One command: npx thumbgate init
|
|
25
|
-
|
|
26
|
-
Works with Claude Code, Cursor, Codex, Gemini.
|
|
27
|
-
|
|
28
|
-
#AIAgents #DeveloperTools #ClaudeCode #ThumbGate`;
|
|
29
|
-
|
|
30
|
-
async function postThumbGateToInstagram(options = {}) {
|
|
31
|
-
const caption = String(options.caption || THUMBGATE_CAPTION).trim();
|
|
32
|
-
const imagePath = options.imagePath ? path.resolve(options.imagePath) : '';
|
|
33
|
-
const schedule = String(options.schedule || '').trim();
|
|
34
|
-
const timezone = String(options.timezone || 'America/New_York').trim() || 'America/New_York';
|
|
35
|
-
|
|
36
|
-
try {
|
|
37
|
-
console.log('[instagram] Fetching Zernio connected accounts...');
|
|
38
|
-
const accounts = await getConnectedAccounts();
|
|
39
|
-
|
|
40
|
-
// Find Instagram account
|
|
41
|
-
const instagramAccount = accounts.find((a) => a.platform === 'instagram');
|
|
42
|
-
if (!instagramAccount) {
|
|
43
|
-
throw new Error('No Instagram account found in Zernio. Please connect Instagram first.');
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
console.log(`[instagram] Found Instagram account: ${instagramAccount.accountId}`);
|
|
47
|
-
|
|
48
|
-
const platforms = [
|
|
49
|
-
{
|
|
50
|
-
platform: 'instagram',
|
|
51
|
-
accountId: instagramAccount.accountId,
|
|
52
|
-
},
|
|
53
|
-
];
|
|
54
|
-
|
|
55
|
-
if (!imagePath) {
|
|
56
|
-
throw new Error('Instagram posts require an imagePath because Zernio requires media content for Instagram posts.');
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
console.log(`[instagram] Uploading Instagram media from ${imagePath}...`);
|
|
60
|
-
const mediaItem = await uploadLocalMedia(imagePath);
|
|
61
|
-
|
|
62
|
-
const publishOptions = {
|
|
63
|
-
mediaItems: [mediaItem],
|
|
64
|
-
utm: options.utm,
|
|
65
|
-
};
|
|
66
|
-
|
|
67
|
-
let result;
|
|
68
|
-
if (schedule) {
|
|
69
|
-
console.log(`[instagram] Scheduling Instagram post for ${schedule} (${timezone})...`);
|
|
70
|
-
result = await schedulePost(caption, platforms, schedule, timezone, publishOptions);
|
|
71
|
-
} else {
|
|
72
|
-
console.log('[instagram] Publishing ThumbGate caption to Instagram...');
|
|
73
|
-
result = await publishPost(caption, platforms, publishOptions);
|
|
74
|
-
}
|
|
75
|
-
if (result && result.blocked) {
|
|
76
|
-
const reasons = Array.isArray(result.reasons)
|
|
77
|
-
? result.reasons.map((reason) => reason.reason || reason.id || String(reason)).join(', ')
|
|
78
|
-
: 'quality gate blocked the caption';
|
|
79
|
-
throw new Error(`Instagram post blocked: ${reasons}`);
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
if (schedule) {
|
|
83
|
-
console.log('✅ Instagram post scheduled successfully!');
|
|
84
|
-
} else {
|
|
85
|
-
console.log('✅ Post published successfully!');
|
|
86
|
-
}
|
|
87
|
-
console.log(`Post ID: ${result.id || result.data?.id || 'unknown'}`);
|
|
88
|
-
return result;
|
|
89
|
-
} catch (err) {
|
|
90
|
-
console.error(`❌ Failed to post to Instagram: ${err.message}`);
|
|
91
|
-
throw err;
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
// CLI execution
|
|
96
|
-
if (require.main === module) {
|
|
97
|
-
const args = process.argv.slice(2);
|
|
98
|
-
const imageArg = args.find((arg) => arg.startsWith('--image-path='));
|
|
99
|
-
const imagePath = imageArg ? imageArg.slice('--image-path='.length) : '';
|
|
100
|
-
|
|
101
|
-
(async () => {
|
|
102
|
-
try {
|
|
103
|
-
await postThumbGateToInstagram({ imagePath });
|
|
104
|
-
process.exit(0);
|
|
105
|
-
} catch (err) {
|
|
106
|
-
process.exit(1);
|
|
107
|
-
}
|
|
108
|
-
})();
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
module.exports = { postThumbGateToInstagram, THUMBGATE_CAPTION };
|
|
@@ -1,114 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
'use strict';
|
|
3
|
-
|
|
4
|
-
const path = require('node:path');
|
|
5
|
-
const scheduleManager = require('../schedule-manager');
|
|
6
|
-
|
|
7
|
-
const REPO_ROOT = path.resolve(__dirname, '..', '..');
|
|
8
|
-
const GROWTH_REPORT_DIR = path.join(REPO_ROOT, '.thumbgate', 'reports', 'gtm-revenue-loop');
|
|
9
|
-
|
|
10
|
-
function buildNodeEvalCommand(scriptPath, args = []) {
|
|
11
|
-
const absolutePath = path.resolve(scriptPath);
|
|
12
|
-
const serializedArgs = JSON.stringify(args);
|
|
13
|
-
return [
|
|
14
|
-
'const { spawnSync } = require(\'node:child_process\');',
|
|
15
|
-
`process.chdir(${JSON.stringify(REPO_ROOT)});`,
|
|
16
|
-
`const result = spawnSync(process.execPath, [${JSON.stringify(absolutePath)}, ...${serializedArgs}], {`,
|
|
17
|
-
' cwd: process.cwd(),',
|
|
18
|
-
' env: process.env,',
|
|
19
|
-
' stdio: \'inherit\',',
|
|
20
|
-
'});',
|
|
21
|
-
'if (result.error) throw result.error;',
|
|
22
|
-
'process.exit(typeof result.status === \'number\' ? result.status : 0);',
|
|
23
|
-
].join(' ');
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
function buildGrowthSchedules() {
|
|
27
|
-
return [
|
|
28
|
-
{
|
|
29
|
-
id: 'thumbgate-growth-schedule-campaign',
|
|
30
|
-
name: 'ThumbGate Growth Campaign Scheduler',
|
|
31
|
-
description: 'Schedules the next day of tracked Zernio launch posts.',
|
|
32
|
-
schedule: 'daily 21:15',
|
|
33
|
-
command: buildNodeEvalCommand(path.join(__dirname, 'schedule-thumbgate-campaign.js')),
|
|
34
|
-
workingDirectory: REPO_ROOT,
|
|
35
|
-
},
|
|
36
|
-
{
|
|
37
|
-
id: 'thumbgate-growth-poll-zernio',
|
|
38
|
-
name: 'ThumbGate Growth Poll Zernio',
|
|
39
|
-
description: 'Polls Zernio analytics into the local engagement store every hour.',
|
|
40
|
-
schedule: 'hourly',
|
|
41
|
-
command: buildNodeEvalCommand(path.join(__dirname, 'pollers', 'zernio.js')),
|
|
42
|
-
workingDirectory: REPO_ROOT,
|
|
43
|
-
},
|
|
44
|
-
{
|
|
45
|
-
id: 'thumbgate-growth-sync-launch-assets',
|
|
46
|
-
name: 'ThumbGate Growth Sync Launch Assets',
|
|
47
|
-
description: 'Syncs published and scheduled launch assets from Zernio into a durable local registry.',
|
|
48
|
-
schedule: 'hourly',
|
|
49
|
-
command: buildNodeEvalCommand(path.join(__dirname, 'sync-launch-assets.js')),
|
|
50
|
-
workingDirectory: REPO_ROOT,
|
|
51
|
-
},
|
|
52
|
-
{
|
|
53
|
-
id: 'thumbgate-growth-reply-monitor',
|
|
54
|
-
name: 'ThumbGate Growth Reply Monitor',
|
|
55
|
-
description: 'Checks social replies and posts supported follow-ups or drafts them for review.',
|
|
56
|
-
schedule: 'hourly',
|
|
57
|
-
command: buildNodeEvalCommand(path.join(REPO_ROOT, 'scripts', 'social-reply-monitor.js')),
|
|
58
|
-
workingDirectory: REPO_ROOT,
|
|
59
|
-
},
|
|
60
|
-
{
|
|
61
|
-
id: 'thumbgate-growth-money-watch',
|
|
62
|
-
name: 'ThumbGate Growth Money Watch',
|
|
63
|
-
description: 'Persists hourly commercial-change checks so the first paid event is captured immediately.',
|
|
64
|
-
schedule: 'hourly',
|
|
65
|
-
command: buildNodeEvalCommand(path.join(REPO_ROOT, 'scripts', 'money-watcher.js'), [
|
|
66
|
-
'--once',
|
|
67
|
-
]),
|
|
68
|
-
workingDirectory: REPO_ROOT,
|
|
69
|
-
},
|
|
70
|
-
{
|
|
71
|
-
id: 'thumbgate-growth-revenue-loop',
|
|
72
|
-
name: 'ThumbGate Growth Revenue Loop',
|
|
73
|
-
description: 'Refreshes the local-first target queue and outreach artifact for the first paid customers.',
|
|
74
|
-
schedule: 'daily 08:20',
|
|
75
|
-
command: buildNodeEvalCommand(path.join(REPO_ROOT, 'scripts', 'autonomous-sales-agent.js'), [
|
|
76
|
-
`--report-dir=${GROWTH_REPORT_DIR}`,
|
|
77
|
-
'--max-targets=8',
|
|
78
|
-
]),
|
|
79
|
-
workingDirectory: REPO_ROOT,
|
|
80
|
-
},
|
|
81
|
-
{
|
|
82
|
-
id: 'thumbgate-growth-social-digest',
|
|
83
|
-
name: 'ThumbGate Growth Social Digest',
|
|
84
|
-
description: 'Builds the daily social analytics digest after the day closes.',
|
|
85
|
-
schedule: 'daily 22:15',
|
|
86
|
-
command: buildNodeEvalCommand(path.join(__dirname, 'run-digest.js'), ['--days=7']),
|
|
87
|
-
workingDirectory: REPO_ROOT,
|
|
88
|
-
},
|
|
89
|
-
];
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
function installGrowthAutomation(manager = scheduleManager) {
|
|
93
|
-
const schedules = buildGrowthSchedules();
|
|
94
|
-
|
|
95
|
-
const installed = schedules.map((schedule) => manager.createSchedule(schedule));
|
|
96
|
-
return {
|
|
97
|
-
installed,
|
|
98
|
-
schedules: manager.listSchedules().filter((schedule) => schedule.id.startsWith('thumbgate-growth-')),
|
|
99
|
-
};
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
if (require.main === module) {
|
|
103
|
-
const result = installGrowthAutomation();
|
|
104
|
-
process.stdout.write(`${JSON.stringify(result, null, 2)}\n`);
|
|
105
|
-
if (result.installed.some((entry) => !entry.success)) {
|
|
106
|
-
process.exitCode = 1;
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
module.exports = {
|
|
111
|
-
buildNodeEvalCommand,
|
|
112
|
-
buildGrowthSchedules,
|
|
113
|
-
installGrowthAutomation,
|
|
114
|
-
};
|
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
const fs = require('node:fs');
|
|
4
|
-
const path = require('node:path');
|
|
5
|
-
let dotenv = null;
|
|
6
|
-
try {
|
|
7
|
-
dotenv = require('dotenv');
|
|
8
|
-
} catch (_) {
|
|
9
|
-
dotenv = null;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
const DEFAULT_ENV_PATH = path.resolve(__dirname, '..', '..', '.env');
|
|
13
|
-
|
|
14
|
-
function resolveEnvPath(envPath = DEFAULT_ENV_PATH) {
|
|
15
|
-
return path.isAbsolute(envPath) ? envPath : path.resolve(process.cwd(), envPath);
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
function loadLocalEnv(options = {}) {
|
|
19
|
-
const resolvedPath = resolveEnvPath(options.envPath);
|
|
20
|
-
if (!fs.existsSync(resolvedPath)) {
|
|
21
|
-
return {
|
|
22
|
-
exists: false,
|
|
23
|
-
loadedKeys: [],
|
|
24
|
-
path: resolvedPath,
|
|
25
|
-
};
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
const source = fs.readFileSync(resolvedPath, 'utf8');
|
|
29
|
-
const parsed = dotenv ? dotenv.parse(source) : parseEnvFallback(source);
|
|
30
|
-
const loadedKeys = [];
|
|
31
|
-
const override = options.override === true;
|
|
32
|
-
|
|
33
|
-
for (const [key, value] of Object.entries(parsed)) {
|
|
34
|
-
if (!override && process.env[key] !== undefined) {
|
|
35
|
-
continue;
|
|
36
|
-
}
|
|
37
|
-
process.env[key] = value;
|
|
38
|
-
loadedKeys.push(key);
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
return {
|
|
42
|
-
exists: true,
|
|
43
|
-
loadedKeys,
|
|
44
|
-
path: resolvedPath,
|
|
45
|
-
};
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
function parseEnvFallback(source) {
|
|
49
|
-
const parsed = {};
|
|
50
|
-
for (const rawLine of String(source).split(/\r?\n/)) {
|
|
51
|
-
const line = rawLine.trim();
|
|
52
|
-
if (!line || line.startsWith('#')) {
|
|
53
|
-
continue;
|
|
54
|
-
}
|
|
55
|
-
const separatorIndex = line.indexOf('=');
|
|
56
|
-
if (separatorIndex <= 0) {
|
|
57
|
-
continue;
|
|
58
|
-
}
|
|
59
|
-
const key = line.slice(0, separatorIndex).trim();
|
|
60
|
-
let value = line.slice(separatorIndex + 1).trim();
|
|
61
|
-
if (
|
|
62
|
-
(value.startsWith('"') && value.endsWith('"')) ||
|
|
63
|
-
(value.startsWith("'") && value.endsWith("'"))
|
|
64
|
-
) {
|
|
65
|
-
value = value.slice(1, -1);
|
|
66
|
-
}
|
|
67
|
-
parsed[key] = value;
|
|
68
|
-
}
|
|
69
|
-
return parsed;
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
module.exports = {
|
|
73
|
-
DEFAULT_ENV_PATH,
|
|
74
|
-
loadLocalEnv,
|
|
75
|
-
parseEnvFallback,
|
|
76
|
-
resolveEnvPath,
|
|
77
|
-
};
|