thumbgate 1.4.3 → 1.4.5
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/llms.txt +12 -8
- package/.well-known/mcp/server-card.json +1 -1
- package/README.md +18 -8
- 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/config/github-about.json +2 -2
- package/package.json +158 -10
- package/scripts/billing.js +5 -2
- 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,644 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
const fs = require('node:fs');
|
|
4
|
-
const path = require('node:path');
|
|
5
|
-
|
|
6
|
-
const { PROMPTS: VISIBILITY_PROMPTS } = require('./ai-search-visibility');
|
|
7
|
-
const {
|
|
8
|
-
PerplexityClient,
|
|
9
|
-
extractAgentText,
|
|
10
|
-
extractChatText,
|
|
11
|
-
extractCitations,
|
|
12
|
-
normalizeSearchResults,
|
|
13
|
-
} = require('./perplexity-client');
|
|
14
|
-
|
|
15
|
-
const DEFAULT_OUTPUT_ROOT = path.join(process.cwd(), '.thumbgate', 'perplexity');
|
|
16
|
-
const DEFAULT_LEAD_LIMIT = 12;
|
|
17
|
-
const DEFAULT_AGENT_MODEL = process.env.PERPLEXITY_AGENT_MODEL || 'openai/gpt-5.4';
|
|
18
|
-
|
|
19
|
-
const PRODUCT = {
|
|
20
|
-
name: 'ThumbGate',
|
|
21
|
-
repo: 'https://github.com/IgorGanapolsky/ThumbGate',
|
|
22
|
-
site: 'https://thumbgate-production.up.railway.app',
|
|
23
|
-
checkout: 'https://thumbgate-production.up.railway.app/checkout/pro',
|
|
24
|
-
promise: 'turn thumbs-up/down feedback into pre-action gates that stop AI agents from repeating mistakes',
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
const LEAD_SEARCH_QUERIES = [
|
|
28
|
-
{
|
|
29
|
-
label: 'agent reliability pain',
|
|
30
|
-
query: 'AI coding agent repeats mistakes Claude Code Cursor Codex MCP guardrails',
|
|
31
|
-
},
|
|
32
|
-
{
|
|
33
|
-
label: 'pre-action gate demand',
|
|
34
|
-
query: 'pre tool use hook block bad tool calls AI agent safety developer workflow',
|
|
35
|
-
},
|
|
36
|
-
{
|
|
37
|
-
label: 'team workflow hardening',
|
|
38
|
-
query: 'AI coding agent broke production migration force push guardrail team workflow',
|
|
39
|
-
},
|
|
40
|
-
{
|
|
41
|
-
label: 'memory and feedback loop',
|
|
42
|
-
query: 'thumbs down feedback memory AI coding agents DPO preference learning developer tools',
|
|
43
|
-
},
|
|
44
|
-
{
|
|
45
|
-
label: 'marketplace placement',
|
|
46
|
-
query: 'Claude Code plugins MCP memory guardrails AI developer tools',
|
|
47
|
-
},
|
|
48
|
-
];
|
|
49
|
-
|
|
50
|
-
function parseArgs(argv = process.argv.slice(2)) {
|
|
51
|
-
const opts = {
|
|
52
|
-
command: 'full',
|
|
53
|
-
dryRun: false,
|
|
54
|
-
write: true,
|
|
55
|
-
json: false,
|
|
56
|
-
leadLimit: DEFAULT_LEAD_LIMIT,
|
|
57
|
-
outDir: null,
|
|
58
|
-
allowChatFallback: false,
|
|
59
|
-
};
|
|
60
|
-
|
|
61
|
-
for (const arg of argv) {
|
|
62
|
-
if (!arg.startsWith('-') && opts.command === 'full') {
|
|
63
|
-
opts.command = arg;
|
|
64
|
-
} else if (arg === '--dry-run') {
|
|
65
|
-
opts.dryRun = true;
|
|
66
|
-
} else if (arg === '--no-write') {
|
|
67
|
-
opts.write = false;
|
|
68
|
-
} else if (arg === '--json') {
|
|
69
|
-
opts.json = true;
|
|
70
|
-
} else if (arg === '--allow-chat-fallback') {
|
|
71
|
-
opts.allowChatFallback = true;
|
|
72
|
-
} else if (arg.startsWith('--out-dir=')) {
|
|
73
|
-
opts.outDir = arg.slice('--out-dir='.length);
|
|
74
|
-
} else if (arg.startsWith('--limit=')) {
|
|
75
|
-
opts.leadLimit = parsePositiveInt(arg.slice('--limit='.length), DEFAULT_LEAD_LIMIT);
|
|
76
|
-
} else {
|
|
77
|
-
throw new Error(`Unknown argument: ${arg}`);
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
return opts;
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
function parsePositiveInt(value, fallback) {
|
|
85
|
-
const parsed = Number.parseInt(String(value), 10);
|
|
86
|
-
return Number.isFinite(parsed) && parsed > 0 ? parsed : fallback;
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
function dateStamp(now = new Date()) {
|
|
90
|
-
return now.toISOString().slice(0, 10);
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
function ensureDir(dir) {
|
|
94
|
-
fs.mkdirSync(dir, { recursive: true });
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
function outputDirFor(opts = {}) {
|
|
98
|
-
if (opts.outDir) return path.resolve(opts.outDir);
|
|
99
|
-
return path.join(DEFAULT_OUTPUT_ROOT, dateStamp(opts.now));
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
function hasLiveAccess(ctx) {
|
|
103
|
-
return !ctx.dryRun && ctx.client.hasApiKey();
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
function normalizeStatusResponse(response) {
|
|
107
|
-
return String(response || '').replaceAll(/\s+/g, ' ').trim();
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
async function collectVisibility(ctx) {
|
|
111
|
-
const results = [];
|
|
112
|
-
|
|
113
|
-
for (const prompt of VISIBILITY_PROMPTS) {
|
|
114
|
-
if (!hasLiveAccess(ctx)) {
|
|
115
|
-
results.push({
|
|
116
|
-
prompt,
|
|
117
|
-
status: 'MANUAL',
|
|
118
|
-
found: false,
|
|
119
|
-
response: null,
|
|
120
|
-
citations: [],
|
|
121
|
-
});
|
|
122
|
-
continue;
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
try {
|
|
126
|
-
const response = await ctx.client.chatCompletion({
|
|
127
|
-
model: 'sonar',
|
|
128
|
-
messages: [{ role: 'user', content: prompt }],
|
|
129
|
-
});
|
|
130
|
-
const text = extractChatText(response);
|
|
131
|
-
const found = /thumbgate/i.test(text);
|
|
132
|
-
results.push({
|
|
133
|
-
prompt,
|
|
134
|
-
status: found ? 'FOUND' : 'MISSING',
|
|
135
|
-
found,
|
|
136
|
-
response: normalizeStatusResponse(text),
|
|
137
|
-
citations: extractCitations(response),
|
|
138
|
-
});
|
|
139
|
-
} catch (err) {
|
|
140
|
-
results.push({
|
|
141
|
-
prompt,
|
|
142
|
-
status: 'ERROR',
|
|
143
|
-
found: false,
|
|
144
|
-
response: null,
|
|
145
|
-
citations: [],
|
|
146
|
-
error: err.message,
|
|
147
|
-
});
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
const scored = scoreVisibility(results);
|
|
152
|
-
return {
|
|
153
|
-
date: dateStamp(ctx.now),
|
|
154
|
-
mode: hasLiveAccess(ctx) ? 'live' : 'manual',
|
|
155
|
-
prompts: VISIBILITY_PROMPTS.length,
|
|
156
|
-
...scored,
|
|
157
|
-
results,
|
|
158
|
-
};
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
function scoreVisibility(results) {
|
|
162
|
-
const measured = results.filter((item) => item.status !== 'MANUAL');
|
|
163
|
-
const found = measured.filter((item) => item.status === 'FOUND').length;
|
|
164
|
-
const missing = measured.filter((item) => item.status === 'MISSING').length;
|
|
165
|
-
const errors = measured.filter((item) => item.status === 'ERROR').length;
|
|
166
|
-
const score = measured.length ? `${found}/${measured.length}` : 'manual';
|
|
167
|
-
return { score, found, missing, errors, measured: measured.length };
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
async function discoverLeads(ctx) {
|
|
171
|
-
const rawResults = [];
|
|
172
|
-
const queryReports = [];
|
|
173
|
-
|
|
174
|
-
for (const search of LEAD_SEARCH_QUERIES) {
|
|
175
|
-
if (!hasLiveAccess(ctx)) {
|
|
176
|
-
queryReports.push({ ...search, status: 'MANUAL', results: [] });
|
|
177
|
-
continue;
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
try {
|
|
181
|
-
const response = await ctx.client.search({
|
|
182
|
-
query: search.query,
|
|
183
|
-
maxResults: Math.min(10, ctx.leadLimit),
|
|
184
|
-
maxTokensPerPage: 768,
|
|
185
|
-
});
|
|
186
|
-
const results = normalizeSearchResults(response).map((item) => ({
|
|
187
|
-
...item,
|
|
188
|
-
queryLabel: search.label,
|
|
189
|
-
query: search.query,
|
|
190
|
-
}));
|
|
191
|
-
rawResults.push(...results);
|
|
192
|
-
queryReports.push({ ...search, status: 'OK', results });
|
|
193
|
-
} catch (err) {
|
|
194
|
-
queryReports.push({ ...search, status: 'ERROR', error: err.message, results: [] });
|
|
195
|
-
}
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
const deduped = dedupeLeads(rawResults)
|
|
199
|
-
.map(scoreLead)
|
|
200
|
-
.sort((a, b) => b.score - a.score || a.title.localeCompare(b.title))
|
|
201
|
-
.slice(0, ctx.leadLimit);
|
|
202
|
-
|
|
203
|
-
return {
|
|
204
|
-
date: dateStamp(ctx.now),
|
|
205
|
-
mode: hasLiveAccess(ctx) ? 'live' : 'manual',
|
|
206
|
-
queryCount: LEAD_SEARCH_QUERIES.length,
|
|
207
|
-
leadCount: deduped.length,
|
|
208
|
-
queries: queryReports.map((item) => ({
|
|
209
|
-
label: item.label,
|
|
210
|
-
query: item.query,
|
|
211
|
-
status: item.status,
|
|
212
|
-
resultCount: item.results.length,
|
|
213
|
-
...(item.error ? { error: item.error } : {}),
|
|
214
|
-
})),
|
|
215
|
-
leads: deduped,
|
|
216
|
-
};
|
|
217
|
-
}
|
|
218
|
-
|
|
219
|
-
function canonicalLeadUrl(url) {
|
|
220
|
-
try {
|
|
221
|
-
const parsed = new URL(url);
|
|
222
|
-
parsed.hash = '';
|
|
223
|
-
const trackingKeys = [];
|
|
224
|
-
for (const key of parsed.searchParams.keys()) {
|
|
225
|
-
if (/^(utm$|utm_|fbclid$|gclid$|mc_cid$|mc_eid$)/i.test(key)) {
|
|
226
|
-
trackingKeys.push(key);
|
|
227
|
-
}
|
|
228
|
-
}
|
|
229
|
-
for (const key of trackingKeys) parsed.searchParams.delete(key);
|
|
230
|
-
parsed.searchParams.sort();
|
|
231
|
-
const cleanUrl = parsed.toString();
|
|
232
|
-
return cleanUrl.endsWith('/') ? cleanUrl.slice(0, -1) : cleanUrl;
|
|
233
|
-
} catch {
|
|
234
|
-
return String(url || '').trim();
|
|
235
|
-
}
|
|
236
|
-
}
|
|
237
|
-
|
|
238
|
-
function dedupeLeads(results) {
|
|
239
|
-
const seen = new Map();
|
|
240
|
-
for (const item of results) {
|
|
241
|
-
const key = canonicalLeadUrl(item.url);
|
|
242
|
-
if (!key) continue;
|
|
243
|
-
const existing = seen.get(key);
|
|
244
|
-
if (!existing) {
|
|
245
|
-
seen.set(key, { ...item, url: key, queryLabels: [item.queryLabel] });
|
|
246
|
-
} else if (!existing.queryLabels.includes(item.queryLabel)) {
|
|
247
|
-
existing.queryLabels.push(item.queryLabel);
|
|
248
|
-
}
|
|
249
|
-
}
|
|
250
|
-
return [...seen.values()];
|
|
251
|
-
}
|
|
252
|
-
|
|
253
|
-
function scoreLead(lead) {
|
|
254
|
-
const text = `${lead.title} ${lead.snippet} ${lead.url}`.toLowerCase();
|
|
255
|
-
const reasons = [];
|
|
256
|
-
let score = 0;
|
|
257
|
-
|
|
258
|
-
score += addScore(text, /\b(ai|llm|agent|coding agent|assistant)\b/, 3, reasons, 'AI-agent context');
|
|
259
|
-
score += addScore(text, /\b(claude|codex|cursor|gemini|amp|mcp|pretooluse|tool call)\b/, 3, reasons, 'target ecosystem');
|
|
260
|
-
score += addScore(text, /\b(repeat|mistake|broken|failure|guardrail|safety|block|prevent|hook)\b/, 4, reasons, 'clear pain signal');
|
|
261
|
-
score += addScore(text, /\b(team|enterprise|production|workflow|devops|platform)\b/, 2, reasons, 'team workflow angle');
|
|
262
|
-
score += addScore(text, /\b(reddit|news\.ycombinator|github\.com|stackoverflow|discord|forum|community)\b/, 2, reasons, 'community surface');
|
|
263
|
-
score += addScore(text, /\b(price|buy|paid|tool|saas|plugin|marketplace)\b/, 2, reasons, 'commercial intent');
|
|
264
|
-
|
|
265
|
-
if (lead.date && /2026|2025/.test(String(lead.date))) {
|
|
266
|
-
score += 1;
|
|
267
|
-
reasons.push('recent result');
|
|
268
|
-
}
|
|
269
|
-
|
|
270
|
-
return {
|
|
271
|
-
...lead,
|
|
272
|
-
score,
|
|
273
|
-
reasons,
|
|
274
|
-
outreachAngle: buildOutreachAngle(lead, reasons),
|
|
275
|
-
};
|
|
276
|
-
}
|
|
277
|
-
|
|
278
|
-
function addScore(text, regex, points, reasons, reason) {
|
|
279
|
-
if (!regex.test(text)) return 0;
|
|
280
|
-
reasons.push(reason);
|
|
281
|
-
return points;
|
|
282
|
-
}
|
|
283
|
-
|
|
284
|
-
function buildOutreachAngle(lead, reasons) {
|
|
285
|
-
if (reasons.includes('clear pain signal')) {
|
|
286
|
-
return 'Lead with repeated-agent-mistake prevention and offer a concrete before/after gate example.';
|
|
287
|
-
}
|
|
288
|
-
if (reasons.includes('target ecosystem')) {
|
|
289
|
-
return 'Lead with the exact install path for their agent ecosystem and show the first thumbs-down-to-gate loop.';
|
|
290
|
-
}
|
|
291
|
-
return 'Lead with ThumbGate as a lightweight reliability gateway for AI coding workflows.';
|
|
292
|
-
}
|
|
293
|
-
|
|
294
|
-
async function buildAgentBrief(ctx, inputs = {}) {
|
|
295
|
-
const visibility = inputs.visibility || null;
|
|
296
|
-
const leads = inputs.leads || null;
|
|
297
|
-
const prompt = buildBriefPrompt({ visibility, leads });
|
|
298
|
-
|
|
299
|
-
if (!hasLiveAccess(ctx)) {
|
|
300
|
-
return {
|
|
301
|
-
date: dateStamp(ctx.now),
|
|
302
|
-
mode: 'manual',
|
|
303
|
-
model: DEFAULT_AGENT_MODEL,
|
|
304
|
-
content: formatManualBrief({ visibility, leads }),
|
|
305
|
-
};
|
|
306
|
-
}
|
|
307
|
-
|
|
308
|
-
try {
|
|
309
|
-
const response = await ctx.client.agentResponse({
|
|
310
|
-
model: ctx.agentModel,
|
|
311
|
-
input: prompt,
|
|
312
|
-
instructions: 'You are ThumbGate revenue intelligence. Be specific, factual, and conversion-oriented. Prioritize actions that can create the first dollar or improve distribution quality.',
|
|
313
|
-
tools: [{ type: 'web_search' }, { type: 'fetch_url' }],
|
|
314
|
-
maxOutputTokens: 1800,
|
|
315
|
-
});
|
|
316
|
-
return {
|
|
317
|
-
date: dateStamp(ctx.now),
|
|
318
|
-
mode: 'live',
|
|
319
|
-
model: ctx.agentModel,
|
|
320
|
-
content: extractAgentText(response),
|
|
321
|
-
rawUsage: response.usage || null,
|
|
322
|
-
};
|
|
323
|
-
} catch (err) {
|
|
324
|
-
if (!ctx.allowChatFallback) {
|
|
325
|
-
throw err;
|
|
326
|
-
}
|
|
327
|
-
const response = await ctx.client.chatCompletion({
|
|
328
|
-
model: 'sonar-pro',
|
|
329
|
-
messages: [{ role: 'user', content: prompt }],
|
|
330
|
-
options: { web_search_options: { search_context_size: 'medium' } },
|
|
331
|
-
});
|
|
332
|
-
return {
|
|
333
|
-
date: dateStamp(ctx.now),
|
|
334
|
-
mode: 'chat-fallback',
|
|
335
|
-
model: 'sonar-pro',
|
|
336
|
-
content: extractChatText(response),
|
|
337
|
-
fallbackReason: err.message,
|
|
338
|
-
};
|
|
339
|
-
}
|
|
340
|
-
}
|
|
341
|
-
|
|
342
|
-
function buildBriefPrompt({ visibility, leads }) {
|
|
343
|
-
const visibilitySummary = visibility
|
|
344
|
-
? `Visibility score: ${visibility.score}; missing prompts: ${visibility.missing}; errors: ${visibility.errors}.`
|
|
345
|
-
: 'Visibility report was not generated in this run.';
|
|
346
|
-
const leadSummary = leads
|
|
347
|
-
? leads.leads.slice(0, 8).map((lead, index) => `${index + 1}. ${lead.title} (${lead.url}) score=${lead.score}`).join('\n')
|
|
348
|
-
: 'Lead report was not generated in this run.';
|
|
349
|
-
|
|
350
|
-
return `Create a ThumbGate Perplexity Max command brief.
|
|
351
|
-
|
|
352
|
-
Product: ${PRODUCT.name}
|
|
353
|
-
Promise: ${PRODUCT.promise}
|
|
354
|
-
Repo: ${PRODUCT.repo}
|
|
355
|
-
Site: ${PRODUCT.site}
|
|
356
|
-
Checkout: ${PRODUCT.checkout}
|
|
357
|
-
|
|
358
|
-
${visibilitySummary}
|
|
359
|
-
|
|
360
|
-
Top lead surfaces:
|
|
361
|
-
${leadSummary}
|
|
362
|
-
|
|
363
|
-
Return:
|
|
364
|
-
1. The single highest-ROI acquisition action for the next 24 hours.
|
|
365
|
-
2. Three search/GEO gaps to fix in docs or landing copy.
|
|
366
|
-
3. Five outreach targets or communities with a specific angle.
|
|
367
|
-
4. One risk that could waste time or spend.
|
|
368
|
-
5. A concise action plan with owners and proof to collect.`;
|
|
369
|
-
}
|
|
370
|
-
|
|
371
|
-
function formatManualBrief({ visibility, leads }) {
|
|
372
|
-
const visibilityScore = visibility?.score || 'manual';
|
|
373
|
-
const leadCount = leads?.leadCount || 0;
|
|
374
|
-
return [
|
|
375
|
-
'# ThumbGate Perplexity Max Brief',
|
|
376
|
-
'',
|
|
377
|
-
`Generated: ${new Date().toISOString()}`,
|
|
378
|
-
'',
|
|
379
|
-
'Mode: manual or dry-run. Set PERPLEXITY_API_KEY to generate a live Agent API brief.',
|
|
380
|
-
'',
|
|
381
|
-
`Visibility score: ${visibilityScore}`,
|
|
382
|
-
`Lead count: ${leadCount}`,
|
|
383
|
-
'',
|
|
384
|
-
'Next action: run `npm run perplexity:full` with PERPLEXITY_API_KEY configured, then inspect the top scored leads before posting or replying.',
|
|
385
|
-
].join('\n');
|
|
386
|
-
}
|
|
387
|
-
|
|
388
|
-
function buildMcpConfig() {
|
|
389
|
-
return {
|
|
390
|
-
source: 'https://github.com/perplexityai/modelcontextprotocol',
|
|
391
|
-
claudeCode: 'claude mcp add perplexity --env PERPLEXITY_API_KEY="your_key_here" -- npx -y @perplexity-ai/mcp-server',
|
|
392
|
-
codex: 'codex mcp add perplexity --env PERPLEXITY_API_KEY="your_key_here" -- npx -y @perplexity-ai/mcp-server',
|
|
393
|
-
mcpServers: {
|
|
394
|
-
perplexity: {
|
|
395
|
-
command: 'npx',
|
|
396
|
-
args: ['-y', '@perplexity-ai/mcp-server'],
|
|
397
|
-
env: {
|
|
398
|
-
PERPLEXITY_API_KEY: '${PERPLEXITY_API_KEY}',
|
|
399
|
-
},
|
|
400
|
-
},
|
|
401
|
-
},
|
|
402
|
-
};
|
|
403
|
-
}
|
|
404
|
-
|
|
405
|
-
function lessonsFromRun(run) {
|
|
406
|
-
const lessons = [];
|
|
407
|
-
const visibility = run.visibility;
|
|
408
|
-
if (visibility) {
|
|
409
|
-
for (const result of visibility.results || []) {
|
|
410
|
-
if (result.status !== 'MISSING') continue;
|
|
411
|
-
lessons.push({
|
|
412
|
-
signal: 'down',
|
|
413
|
-
domain: 'perplexity-visibility',
|
|
414
|
-
context: `Perplexity answer for "${result.prompt}" did not mention ThumbGate.`,
|
|
415
|
-
whatWentWrong: 'ThumbGate is not visible for a high-intent AI-agent reliability query.',
|
|
416
|
-
whatToChange: 'Add or strengthen docs, landing-page copy, and citations for this exact query intent.',
|
|
417
|
-
tags: ['perplexity', 'geo', 'visibility', 'acquisition'],
|
|
418
|
-
createdAt: new Date().toISOString(),
|
|
419
|
-
});
|
|
420
|
-
}
|
|
421
|
-
}
|
|
422
|
-
const leads = run.leads?.leads || [];
|
|
423
|
-
for (const lead of leads.slice(0, 5)) {
|
|
424
|
-
lessons.push({
|
|
425
|
-
signal: 'up',
|
|
426
|
-
domain: 'perplexity-lead-discovery',
|
|
427
|
-
context: `Perplexity surfaced ${lead.url} as a lead candidate with score ${lead.score}.`,
|
|
428
|
-
whatWorked: lead.outreachAngle,
|
|
429
|
-
tags: ['perplexity', 'lead', 'acquisition'],
|
|
430
|
-
createdAt: new Date().toISOString(),
|
|
431
|
-
});
|
|
432
|
-
}
|
|
433
|
-
return lessons;
|
|
434
|
-
}
|
|
435
|
-
|
|
436
|
-
async function runCommand(command = 'full', opts = {}) {
|
|
437
|
-
const ctx = {
|
|
438
|
-
now: opts.now || new Date(),
|
|
439
|
-
dryRun: Boolean(opts.dryRun),
|
|
440
|
-
write: opts.write !== false,
|
|
441
|
-
outDir: outputDirFor(opts),
|
|
442
|
-
leadLimit: parsePositiveInt(opts.leadLimit, DEFAULT_LEAD_LIMIT),
|
|
443
|
-
allowChatFallback: Boolean(opts.allowChatFallback),
|
|
444
|
-
agentModel: opts.agentModel || DEFAULT_AGENT_MODEL,
|
|
445
|
-
client: opts.client || new PerplexityClient(opts.clientOptions || {}),
|
|
446
|
-
};
|
|
447
|
-
|
|
448
|
-
const run = {
|
|
449
|
-
command,
|
|
450
|
-
date: dateStamp(ctx.now),
|
|
451
|
-
outputDir: ctx.outDir,
|
|
452
|
-
dryRun: ctx.dryRun,
|
|
453
|
-
hasApiKey: ctx.client.hasApiKey(),
|
|
454
|
-
};
|
|
455
|
-
|
|
456
|
-
switch (command) {
|
|
457
|
-
case 'visibility':
|
|
458
|
-
run.visibility = await collectVisibility(ctx);
|
|
459
|
-
break;
|
|
460
|
-
case 'leads':
|
|
461
|
-
run.leads = await discoverLeads(ctx);
|
|
462
|
-
break;
|
|
463
|
-
case 'brief':
|
|
464
|
-
run.brief = await buildAgentBrief(ctx);
|
|
465
|
-
break;
|
|
466
|
-
case 'mcp-config':
|
|
467
|
-
run.mcpConfig = buildMcpConfig();
|
|
468
|
-
break;
|
|
469
|
-
case 'full':
|
|
470
|
-
run.visibility = await collectVisibility(ctx);
|
|
471
|
-
run.leads = await discoverLeads(ctx);
|
|
472
|
-
run.brief = await buildAgentBrief(ctx, { visibility: run.visibility, leads: run.leads });
|
|
473
|
-
run.mcpConfig = buildMcpConfig();
|
|
474
|
-
break;
|
|
475
|
-
default:
|
|
476
|
-
throw new Error(`Unknown command: ${command}`);
|
|
477
|
-
}
|
|
478
|
-
|
|
479
|
-
run.lessons = lessonsFromRun(run);
|
|
480
|
-
run.summary = buildSummary(run);
|
|
481
|
-
|
|
482
|
-
if (ctx.write) {
|
|
483
|
-
run.written = writeArtifacts(run, ctx.outDir);
|
|
484
|
-
}
|
|
485
|
-
|
|
486
|
-
return run;
|
|
487
|
-
}
|
|
488
|
-
|
|
489
|
-
function buildSummary(run) {
|
|
490
|
-
return {
|
|
491
|
-
command: run.command,
|
|
492
|
-
date: run.date,
|
|
493
|
-
dryRun: run.dryRun,
|
|
494
|
-
hasApiKey: run.hasApiKey,
|
|
495
|
-
visibilityScore: run.visibility?.score || null,
|
|
496
|
-
leadCount: run.leads?.leadCount || 0,
|
|
497
|
-
lessonCount: run.lessons?.length || 0,
|
|
498
|
-
briefMode: run.brief?.mode || null,
|
|
499
|
-
};
|
|
500
|
-
}
|
|
501
|
-
|
|
502
|
-
function writeArtifacts(run, outDir) {
|
|
503
|
-
ensureDir(outDir);
|
|
504
|
-
const written = [];
|
|
505
|
-
|
|
506
|
-
written.push(writeJson(path.join(outDir, 'summary.json'), run.summary));
|
|
507
|
-
|
|
508
|
-
if (run.visibility) {
|
|
509
|
-
written.push(
|
|
510
|
-
writeJson(path.join(outDir, 'visibility.json'), run.visibility),
|
|
511
|
-
writeText(path.join(outDir, 'visibility.md'), formatVisibilityMarkdown(run.visibility))
|
|
512
|
-
);
|
|
513
|
-
}
|
|
514
|
-
if (run.leads) {
|
|
515
|
-
written.push(
|
|
516
|
-
writeJson(path.join(outDir, 'leads.json'), run.leads),
|
|
517
|
-
writeText(path.join(outDir, 'leads.md'), formatLeadsMarkdown(run.leads))
|
|
518
|
-
);
|
|
519
|
-
}
|
|
520
|
-
if (run.brief) {
|
|
521
|
-
written.push(writeText(path.join(outDir, 'agent-brief.md'), run.brief.content || ''));
|
|
522
|
-
}
|
|
523
|
-
if (run.mcpConfig) {
|
|
524
|
-
written.push(writeJson(path.join(outDir, 'perplexity-mcp-config.json'), run.mcpConfig));
|
|
525
|
-
}
|
|
526
|
-
if (run.lessons?.length) {
|
|
527
|
-
written.push(writeText(path.join(outDir, 'memory-lessons.jsonl'), run.lessons.map((item) => JSON.stringify(item)).join('\n') + '\n'));
|
|
528
|
-
}
|
|
529
|
-
|
|
530
|
-
return written;
|
|
531
|
-
}
|
|
532
|
-
|
|
533
|
-
function writeJson(filePath, value) {
|
|
534
|
-
return writeText(filePath, JSON.stringify(value, null, 2) + '\n');
|
|
535
|
-
}
|
|
536
|
-
|
|
537
|
-
function writeText(filePath, value) {
|
|
538
|
-
fs.writeFileSync(filePath, value, 'utf8');
|
|
539
|
-
return filePath;
|
|
540
|
-
}
|
|
541
|
-
|
|
542
|
-
function formatVisibilityMarkdown(report) {
|
|
543
|
-
const lines = [
|
|
544
|
-
'# Perplexity Visibility Report',
|
|
545
|
-
'',
|
|
546
|
-
`Date: ${report.date}`,
|
|
547
|
-
`Mode: ${report.mode}`,
|
|
548
|
-
`Score: ${report.score}`,
|
|
549
|
-
'',
|
|
550
|
-
'| Status | Prompt | Notes |',
|
|
551
|
-
'| --- | --- | --- |',
|
|
552
|
-
];
|
|
553
|
-
|
|
554
|
-
for (const item of report.results) {
|
|
555
|
-
const note = visibilityNote(item);
|
|
556
|
-
lines.push(`| ${item.status} | ${escapeMarkdownTable(item.prompt)} | ${escapeMarkdownTable(note)} |`);
|
|
557
|
-
}
|
|
558
|
-
return lines.join('\n') + '\n';
|
|
559
|
-
}
|
|
560
|
-
|
|
561
|
-
function visibilityNote(item) {
|
|
562
|
-
if (item.error) return item.error;
|
|
563
|
-
if (item.found) return 'ThumbGate mentioned';
|
|
564
|
-
if (item.status === 'MANUAL') return 'Manual check required';
|
|
565
|
-
return 'ThumbGate missing';
|
|
566
|
-
}
|
|
567
|
-
|
|
568
|
-
function formatLeadsMarkdown(report) {
|
|
569
|
-
const lines = [
|
|
570
|
-
'# Perplexity Lead Discovery Report',
|
|
571
|
-
'',
|
|
572
|
-
`Date: ${report.date}`,
|
|
573
|
-
`Mode: ${report.mode}`,
|
|
574
|
-
`Leads: ${report.leadCount}`,
|
|
575
|
-
'',
|
|
576
|
-
'| Score | Lead | Reason | Angle |',
|
|
577
|
-
'| ---: | --- | --- | --- |',
|
|
578
|
-
];
|
|
579
|
-
|
|
580
|
-
for (const lead of report.leads) {
|
|
581
|
-
const link = `[${escapeMarkdownLinkText(lead.title)}](${lead.url})`;
|
|
582
|
-
lines.push(`| ${lead.score} | ${link} | ${escapeMarkdownTable(lead.reasons.join(', '))} | ${escapeMarkdownTable(lead.outreachAngle)} |`);
|
|
583
|
-
}
|
|
584
|
-
return lines.join('\n') + '\n';
|
|
585
|
-
}
|
|
586
|
-
|
|
587
|
-
function escapeMarkdownTable(value) {
|
|
588
|
-
return String(value || '')
|
|
589
|
-
.split('\\').join('\\\\')
|
|
590
|
-
.split('|').join('\\|')
|
|
591
|
-
.split('\r').join(' ')
|
|
592
|
-
.split('\n').join(' ');
|
|
593
|
-
}
|
|
594
|
-
|
|
595
|
-
function escapeMarkdownLinkText(value) {
|
|
596
|
-
return String(value || 'Untitled')
|
|
597
|
-
.split('\\').join('\\\\')
|
|
598
|
-
.split('[').join('\\[')
|
|
599
|
-
.split(']').join('\\]');
|
|
600
|
-
}
|
|
601
|
-
|
|
602
|
-
function isCliEntrypoint(argv = process.argv) {
|
|
603
|
-
return Boolean(argv[1] && path.resolve(argv[1]) === __filename);
|
|
604
|
-
}
|
|
605
|
-
|
|
606
|
-
async function main() {
|
|
607
|
-
const opts = parseArgs();
|
|
608
|
-
const run = await runCommand(opts.command, opts);
|
|
609
|
-
if (opts.json) {
|
|
610
|
-
console.log(JSON.stringify(run.summary, null, 2));
|
|
611
|
-
return;
|
|
612
|
-
}
|
|
613
|
-
console.log(`Perplexity command center: ${run.command}`);
|
|
614
|
-
console.log(`Output: ${run.outputDir}`);
|
|
615
|
-
console.log(`Visibility: ${run.summary.visibilityScore || 'not run'}`);
|
|
616
|
-
console.log(`Leads: ${run.summary.leadCount}`);
|
|
617
|
-
console.log(`Lessons staged: ${run.summary.lessonCount}`);
|
|
618
|
-
}
|
|
619
|
-
|
|
620
|
-
module.exports = {
|
|
621
|
-
LEAD_SEARCH_QUERIES,
|
|
622
|
-
buildAgentBrief,
|
|
623
|
-
buildBriefPrompt,
|
|
624
|
-
buildMcpConfig,
|
|
625
|
-
buildSummary,
|
|
626
|
-
collectVisibility,
|
|
627
|
-
dateStamp,
|
|
628
|
-
dedupeLeads,
|
|
629
|
-
discoverLeads,
|
|
630
|
-
formatLeadsMarkdown,
|
|
631
|
-
formatVisibilityMarkdown,
|
|
632
|
-
isCliEntrypoint,
|
|
633
|
-
lessonsFromRun,
|
|
634
|
-
parseArgs,
|
|
635
|
-
runCommand,
|
|
636
|
-
scoreLead,
|
|
637
|
-
};
|
|
638
|
-
|
|
639
|
-
if (isCliEntrypoint()) {
|
|
640
|
-
main().catch((err) => {
|
|
641
|
-
console.error(`Perplexity command center failed: ${err.message}`);
|
|
642
|
-
process.exit(1);
|
|
643
|
-
});
|
|
644
|
-
}
|