thumbgate 1.39.1 → 1.40.2
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/plugin.json +1 -1
- package/.well-known/llms.txt +2 -2
- package/.well-known/mcp/server-card.json +1 -1
- package/README.md +5 -4
- package/adapters/claude/.mcp.json +6 -2
- package/adapters/codex/config.toml +5 -0
- package/adapters/forge/forge.yaml +4 -4
- package/adapters/future-agi/.mcp.json +1 -1
- package/adapters/future-agi/config.toml +1 -1
- package/adapters/future-agi/opencode.json +1 -1
- package/adapters/herdr/herdr-plugin.toml +2 -2
- package/adapters/mcp/server-stdio.js +82 -7
- package/adapters/opencode/opencode.json +1 -1
- package/bin/cli.js +128 -15
- package/config/brand-standards.json +131 -0
- package/config/gates/default.json +18 -1
- package/config/github-about.json +1 -1
- package/config/mcp-allowlists.json +16 -3
- package/config/merge-quality-checks.json +1 -0
- package/config/post-deploy-marketing-pages.json +3 -3
- package/config/schemas/task-outcome-receipt.schema.json +9 -0
- package/openapi/openapi.yaml +7 -3
- package/package.json +98 -31
- package/public/about.html +2 -2
- package/public/admin.html +771 -0
- package/public/agent-manager.html +3 -3
- package/public/agents-cost-savings.html +1 -1
- package/public/ai-malpractice-prevention.html +12 -12
- package/public/architecture.html +0 -1
- package/public/assets/diagrams/decision.svg +3 -3
- package/public/blog/2026-10-05-why-3-days-of-triage-wont-save-ai-speed-code.html +1 -1
- package/public/blog/2026-10-09-your-code-got-a-third-author-governance.html +1 -1
- package/public/blog/git-at-agent-scale.html +2 -2
- package/public/blog/inside-your-boundary.html +1 -1
- package/public/blog/process-over-outcome-gates.html +1 -1
- package/public/case-studies.html +1 -2
- package/public/codex-enterprise.html +1 -1
- package/public/codex-plugin.html +1 -1
- package/public/dashboard.html +773 -481
- package/public/diagnostic.html +8 -3
- package/public/enterprise-governance.html +26 -174
- package/public/eval-scorecard.html +3 -4
- package/public/eval-scorecard.json +2 -2
- package/public/evaluations.html +0 -1
- package/public/founders.html +3 -3
- package/public/gaming-playbook.html +4 -4
- package/public/guide.html +3 -5
- package/public/index.html +181 -205
- package/public/install.html +12 -11
- package/public/js/buyer-intent.js +49 -8
- package/public/lessons.html +103 -46
- package/public/numbers.html +32 -33
- package/public/operator-framework.html +44 -72
- package/public/peter.html +3 -3
- package/public/platform-partners.html +1 -1
- package/public/pricing.html +61 -327
- package/public/pro.html +3 -1
- package/public/project-switcher.js +76 -0
- package/public/whitepaper.html +1 -2
- package/scripts/activation-quickstart.js +15 -3
- package/scripts/activation-tracker.js +280 -3
- package/scripts/agent-action-inventory.js +235 -143
- package/scripts/agent-operations-planner.js +1 -1
- package/scripts/agent-readiness.js +36 -6
- package/scripts/agentic-prompt-pipelines.js +901 -0
- package/scripts/analytics-report.js +363 -0
- package/scripts/analytics-window.js +7 -1
- package/scripts/async-job-runner.js +66 -11
- package/scripts/audit-trail.js +37 -24
- package/scripts/auto-context-packs.js +249 -0
- package/scripts/auto-promote-gates.js +37 -27
- package/scripts/backfill-lesson-scopes.js +122 -0
- package/scripts/billing-setup.js +137 -0
- package/scripts/billing.js +889 -132
- package/scripts/bot-detection.js +112 -0
- package/scripts/brand-standards-gate.js +571 -0
- package/scripts/chatgpt-ads-readiness-pack.js +1 -1
- package/scripts/check-update.js +236 -0
- package/scripts/cli-schema.js +1 -1
- package/scripts/commercial-offer.js +2 -2
- package/scripts/contextfs.js +9 -3
- package/scripts/conversion-rate-stats.js +442 -0
- package/scripts/cost-cli.js +147 -0
- package/scripts/creator-campaigns.js +239 -0
- package/scripts/cross-encoder-reranker.js +4 -0
- package/scripts/cuda-gate-batch.js +560 -0
- package/scripts/daemon-manager.js +108 -0
- package/scripts/dashboard-chat.js +11 -0
- package/scripts/dashboard.js +576 -169
- package/scripts/decision-journal.js +7 -4
- package/scripts/delegation-runtime.js +1036 -0
- package/scripts/dispatch-brief.js +159 -0
- package/scripts/distribution-surfaces.js +110 -0
- package/scripts/docker-sandbox-planner.js +3 -3
- package/scripts/egm-goldfish-packet.js +95 -0
- package/scripts/embeddinggemma-adapter.js +407 -0
- package/scripts/export-dpo-pairs.js +12 -7
- package/scripts/feedback-aggregate.js +4 -0
- package/scripts/feedback-attribution.js +6 -4
- package/scripts/feedback-history-distiller.js +18 -6
- package/scripts/feedback-loop.js +255 -89
- package/scripts/feedback-paths.js +8 -1
- package/scripts/feedback-sanitizer.js +5 -0
- package/scripts/feedback-scope.js +106 -0
- package/scripts/feedback-session.js +8 -2
- package/scripts/filesystem-search.js +13 -8
- package/scripts/financial-control-plane.js +707 -45
- package/scripts/funnel-analytics.js +35 -0
- package/scripts/gate-semantic-layer.js +292 -0
- package/scripts/gate-stats.js +8 -2
- package/scripts/gates-engine.js +694 -230
- package/scripts/generate-eval-scorecard.js +0 -1
- package/scripts/harness-tool-names.js +31 -5
- package/scripts/hybrid-feedback-context.js +5 -2
- package/scripts/implementation-notes.js +241 -0
- package/scripts/intent-router.js +518 -0
- package/scripts/intervention-policy.js +2 -1
- package/scripts/latency-budget.js +164 -0
- package/scripts/lesson-canonical.js +2 -2
- package/scripts/lesson-db.js +55 -14
- package/scripts/lesson-graph.js +2 -1
- package/scripts/lesson-retrieval.js +95 -9
- package/scripts/lesson-search.js +86 -22
- package/scripts/lesson-synthesis.js +21 -5
- package/scripts/mailer/index.js +17 -1
- package/scripts/mailer/resend-mailer.js +213 -179
- package/scripts/mcp-writeguard.js +158 -0
- package/scripts/migrate-project-scope.js +209 -0
- package/scripts/model-candidates.js +414 -0
- package/scripts/openrouter-armor-partnership-diode.js +2419 -0
- package/scripts/operational-dashboard.js +172 -0
- package/scripts/operational-integrity.js +436 -3
- package/scripts/operational-summary.js +190 -0
- package/scripts/operator-artifacts.js +622 -0
- package/scripts/optimize-context.js +17 -0
- package/scripts/override-audit.js +2 -0
- package/scripts/owner-admin.js +338 -0
- package/scripts/pr-manager.js +194 -1
- package/scripts/predictive-insights.js +449 -0
- package/scripts/profound-aeo-citation-engine.js +583 -0
- package/scripts/progressive-signoff.js +260 -0
- package/scripts/project-catalog.js +243 -0
- package/scripts/project-dashboard.js +61 -0
- package/scripts/project-evidence.js +172 -0
- package/scripts/project-identity.js +182 -0
- package/scripts/project-scope.js +381 -0
- package/scripts/prompt-guard.js +446 -52
- package/scripts/proof-report.js +232 -0
- package/scripts/provider-action-normalizer.js +14 -6
- package/scripts/pulse.js +80 -0
- package/scripts/rate-limiter.js +41 -0
- package/scripts/rrsi-doctor.js +2698 -0
- package/scripts/secret-redaction.js +171 -25
- package/scripts/secret-scanner.js +101 -42
- package/scripts/self-protection.js +2 -2
- package/scripts/seo-gsd.js +14 -14
- package/scripts/session-context-dedupe.js +66 -0
- package/scripts/session-report.js +120 -0
- package/scripts/settings-hierarchy.js +4 -2
- package/scripts/statusline-meta.js +34 -23
- package/scripts/subagent-profiles.js +79 -0
- package/scripts/task-outcomes.js +29 -2
- package/scripts/telemetry-analytics.js +238 -13
- package/scripts/third-author-cli.js +118 -0
- package/scripts/third-author-governance.js +437 -0
- package/scripts/thumbgate-dream.js +878 -0
- package/scripts/thumbgate-search.js +23 -9
- package/scripts/tool-kpi-tracker.js +5 -2
- package/scripts/tool-registry.js +42 -1
- package/scripts/triage-savings-calculator.js +1 -1
- package/scripts/vector-store.js +4 -1
- package/scripts/verified-lessons.js +270 -0
- package/scripts/verify-marketing-pages-deployed.js +2 -2
- package/scripts/workflow-sentinel.js +29 -10
- package/server.json +2 -2
- package/skills/thumbgate-daily-discoveries/SKILL.md +25 -41
- package/src/api/server.js +2371 -451
- package/src/feedback.js +21 -0
- package/src/hermes-sync-plane.js +2 -1
- package/src/index.js +2 -0
- package/src/lesson-search.js +9 -0
- package/src/mckinsey-top-company-ai-coding.js +493 -0
- package/src/mcp/server.js +3 -0
- package/src/mcp-writeguard.js +772 -11
- package/src/openshell-lovable-engine.js +1475 -0
- package/src/task-outcome.js +3 -0
- package/config/evals/agent-safety-eval.json +0 -447
- package/config/evals/retrieval-ranking-golden.json +0 -522
- package/config/progressive/01-wire-only.json +0 -11
- package/config/progressive/02-dashboard-empty-ok.json +0 -10
- package/config/progressive/03-one-lesson.json +0 -10
- package/config/progressive/04-warn-fires.json +0 -11
- package/config/progressive/05-strict-optional.json +0 -11
- package/config/progressive/README.md +0 -15
- package/public/assets/diagrams/agent-integration.png +0 -0
- package/public/assets/diagrams/thumbgate-architecture.png +0 -0
- package/scripts/install-thumbgate-daily-publish-launchd.sh +0 -83
- package/scripts/thumbgate-daily-discoveries-publish.js +0 -461
- package/scripts/thumbgate-daily-discoveries-publish.sh +0 -18
|
@@ -0,0 +1,363 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const https = require('https');
|
|
4
|
+
const { PRODUCTHUNT_URL } = require('./distribution-surfaces');
|
|
5
|
+
const { getOperationalBillingSummary } = require('./operational-summary');
|
|
6
|
+
const { summarizeCreatorPerformance } = require('./creator-campaigns');
|
|
7
|
+
const { getFeedbackPaths } = require('./feedback-loop');
|
|
8
|
+
const { buildPredictiveInsights } = require('./predictive-insights');
|
|
9
|
+
const { getTelemetryAnalytics } = require('./telemetry-analytics');
|
|
10
|
+
|
|
11
|
+
const NPM_PACKAGE = 'thumbgate';
|
|
12
|
+
const GITHUB_REPO = 'IgorGanapolsky/ThumbGate';
|
|
13
|
+
const PLAUSIBLE_URL = 'https://plausible.io/thumbgate-production.up.railway.app';
|
|
14
|
+
const LANDING_PAGE = 'https://thumbgate-production.up.railway.app';
|
|
15
|
+
|
|
16
|
+
function httpsGet(url) {
|
|
17
|
+
const headers = { 'User-Agent': 'thumbgate-analytics' };
|
|
18
|
+
let parsedUrl;
|
|
19
|
+
try {
|
|
20
|
+
parsedUrl = new URL(url);
|
|
21
|
+
} catch (_) {}
|
|
22
|
+
if (parsedUrl && parsedUrl.hostname === 'api.github.com' && process.env.GITHUB_TOKEN) {
|
|
23
|
+
headers['Authorization'] = `token ${process.env.GITHUB_TOKEN}`;
|
|
24
|
+
}
|
|
25
|
+
return new Promise((resolve, reject) => {
|
|
26
|
+
https.get(url, { headers }, (res) => {
|
|
27
|
+
let data = '';
|
|
28
|
+
res.on('data', (chunk) => { data += chunk; });
|
|
29
|
+
res.on('end', () => {
|
|
30
|
+
if (res.statusCode >= 400) {
|
|
31
|
+
reject(new Error(`HTTP ${res.statusCode} for ${url}: ${data}`));
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
try { resolve(JSON.parse(data)); } catch (e) { reject(e); }
|
|
35
|
+
});
|
|
36
|
+
}).on('error', reject);
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
function sparkline(values) {
|
|
41
|
+
const chars = '▁▂▃▄▅▆▇█';
|
|
42
|
+
const max = Math.max(...values, 1);
|
|
43
|
+
return values.map((v) => chars[Math.min(Math.floor((v / max) * (chars.length - 1)), chars.length - 1)]).join('');
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
async function fetchNpmMonthly() {
|
|
47
|
+
return httpsGet(`https://api.npmjs.org/downloads/range/last-month/${NPM_PACKAGE}`);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
async function fetchNpmWeekly() {
|
|
51
|
+
return httpsGet(`https://api.npmjs.org/downloads/point/last-week/${NPM_PACKAGE}`);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
async function fetchGitHub() {
|
|
55
|
+
return httpsGet(`https://api.github.com/repos/${GITHUB_REPO}`);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
async function fetchNpmVersions() {
|
|
59
|
+
return httpsGet(`https://registry.npmjs.org/${NPM_PACKAGE}`);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
function loadTelemetrySnapshot() {
|
|
63
|
+
const { FEEDBACK_DIR } = getFeedbackPaths();
|
|
64
|
+
return getTelemetryAnalytics(FEEDBACK_DIR);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
function getCounterValue(counter = {}, key) {
|
|
68
|
+
return Number(counter && counter[key]) || 0;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
function mergeDimensionCounters(metricCounters = {}) {
|
|
72
|
+
const metrics = Object.keys(metricCounters);
|
|
73
|
+
const rows = new Map();
|
|
74
|
+
|
|
75
|
+
for (const metric of metrics) {
|
|
76
|
+
const counter = metricCounters[metric] || {};
|
|
77
|
+
for (const [rawKey, rawValue] of Object.entries(counter)) {
|
|
78
|
+
const key = String(rawKey || '').trim() || 'unknown';
|
|
79
|
+
const row = rows.get(key) || { key };
|
|
80
|
+
row[metric] = Number(rawValue || 0);
|
|
81
|
+
rows.set(key, row);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
return Array.from(rows.values());
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
function buildPredictiveStagingModel(telemetry = {}, billingSummary = {}) {
|
|
89
|
+
return {
|
|
90
|
+
dims: {
|
|
91
|
+
sources: mergeDimensionCounters({
|
|
92
|
+
pageViews: telemetry.visitors && telemetry.visitors.bySource,
|
|
93
|
+
checkoutStarts: telemetry.ctas && telemetry.ctas.checkoutStartsBySource,
|
|
94
|
+
acquisitionLeads: billingSummary.attribution && billingSummary.attribution.acquisitionBySource,
|
|
95
|
+
paidCustomers: billingSummary.attribution && billingSummary.attribution.paidBySource,
|
|
96
|
+
bookedRevenueCents: billingSummary.attribution && billingSummary.attribution.bookedRevenueBySourceCents,
|
|
97
|
+
}),
|
|
98
|
+
creators: mergeDimensionCounters({
|
|
99
|
+
pageViews: telemetry.visitors && telemetry.visitors.byCreator,
|
|
100
|
+
checkoutStarts: telemetry.ctas && telemetry.ctas.checkoutStartsByCreator,
|
|
101
|
+
acquisitionLeads: billingSummary.attribution && billingSummary.attribution.acquisitionByCreator,
|
|
102
|
+
paidCustomers: billingSummary.attribution && billingSummary.attribution.paidByCreator,
|
|
103
|
+
bookedRevenueCents: billingSummary.attribution && billingSummary.attribution.bookedRevenueByCreatorCents,
|
|
104
|
+
workflowSprintLeads: billingSummary.pipeline && billingSummary.pipeline.workflowSprintLeads && billingSummary.pipeline.workflowSprintLeads.byCreator,
|
|
105
|
+
qualifiedWorkflowSprintLeads: billingSummary.pipeline && billingSummary.pipeline.qualifiedWorkflowSprintLeads && billingSummary.pipeline.qualifiedWorkflowSprintLeads.byCreator,
|
|
106
|
+
}),
|
|
107
|
+
},
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
function resolveProductHuntCount(primaryCounter = {}, secondaryCounter = {}) {
|
|
112
|
+
const primary = getCounterValue(primaryCounter, 'producthunt');
|
|
113
|
+
if (primary > 0) return primary;
|
|
114
|
+
return getCounterValue(secondaryCounter, 'producthunt');
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
async function collectAnalytics(fetchers = {}) {
|
|
118
|
+
const fetchMonthly = fetchers.fetchNpmMonthly || fetchNpmMonthly;
|
|
119
|
+
const fetchWeekly = fetchers.fetchNpmWeekly || fetchNpmWeekly;
|
|
120
|
+
const fetchRepo = fetchers.fetchGitHub || fetchGitHub;
|
|
121
|
+
const fetchVersions = fetchers.fetchNpmVersions || fetchNpmVersions;
|
|
122
|
+
const fetchTelemetry = fetchers.fetchTelemetry || loadTelemetrySnapshot;
|
|
123
|
+
const fetchBillingSummary = fetchers.fetchBillingSummary || (async () => {
|
|
124
|
+
const result = await getOperationalBillingSummary();
|
|
125
|
+
return result.summary;
|
|
126
|
+
});
|
|
127
|
+
|
|
128
|
+
const [monthly, weekly, github, npmMeta, telemetry, billingSummary] = await Promise.all([
|
|
129
|
+
fetchMonthly(),
|
|
130
|
+
fetchWeekly(),
|
|
131
|
+
fetchRepo(),
|
|
132
|
+
fetchVersions().catch(() => null),
|
|
133
|
+
Promise.resolve().then(() => fetchTelemetry()).catch(() => null),
|
|
134
|
+
Promise.resolve().then(() => fetchBillingSummary()).catch(() => null),
|
|
135
|
+
]);
|
|
136
|
+
|
|
137
|
+
return { monthly, weekly, github, npmMeta, telemetry, billingSummary };
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* Estimate organic downloads by filtering out publish-day inflation.
|
|
142
|
+
* npm registry mirrors, bot crawlers (socket.dev, snyk, bundlephobia),
|
|
143
|
+
* and npm-stat bots all re-download on publish events.
|
|
144
|
+
* Weekend days with no publishes give the organic baseline.
|
|
145
|
+
*/
|
|
146
|
+
function estimateOrganicDownloads(dailyDownloads, publishDates) {
|
|
147
|
+
const publishSet = new Set(publishDates);
|
|
148
|
+
|
|
149
|
+
let weekendNoPublishTotal = 0;
|
|
150
|
+
let weekendNoPublishCount = 0;
|
|
151
|
+
let publishDayTotal = 0;
|
|
152
|
+
let publishDayCount = 0;
|
|
153
|
+
let noPublishDayTotal = 0;
|
|
154
|
+
let noPublishDayCount = 0;
|
|
155
|
+
|
|
156
|
+
for (const day of dailyDownloads) {
|
|
157
|
+
const dt = new Date(day.day + 'T00:00:00Z');
|
|
158
|
+
const isWeekend = dt.getUTCDay() === 0 || dt.getUTCDay() === 6;
|
|
159
|
+
const isPublishDay = publishSet.has(day.day);
|
|
160
|
+
|
|
161
|
+
if (isPublishDay) {
|
|
162
|
+
publishDayTotal += day.downloads;
|
|
163
|
+
publishDayCount++;
|
|
164
|
+
} else {
|
|
165
|
+
noPublishDayTotal += day.downloads;
|
|
166
|
+
noPublishDayCount++;
|
|
167
|
+
if (isWeekend) {
|
|
168
|
+
weekendNoPublishTotal += day.downloads;
|
|
169
|
+
weekendNoPublishCount++;
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
const organicDailyBaseline = weekendNoPublishCount > 0
|
|
175
|
+
? Math.round(weekendNoPublishTotal / weekendNoPublishCount)
|
|
176
|
+
: (noPublishDayCount > 0 ? Math.round(noPublishDayTotal / noPublishDayCount) : 0);
|
|
177
|
+
|
|
178
|
+
const totalDownloads = dailyDownloads.reduce((s, d) => s + d.downloads, 0);
|
|
179
|
+
const estimatedOrganic30d = organicDailyBaseline * 30;
|
|
180
|
+
const estimatedInflated = totalDownloads - estimatedOrganic30d;
|
|
181
|
+
const organicRate = totalDownloads > 0 ? (estimatedOrganic30d / totalDownloads * 100) : 0;
|
|
182
|
+
|
|
183
|
+
return {
|
|
184
|
+
organicDailyBaseline,
|
|
185
|
+
estimatedOrganic30d,
|
|
186
|
+
estimatedInflated: Math.max(0, estimatedInflated),
|
|
187
|
+
organicRate: Math.min(100, organicRate),
|
|
188
|
+
organicWeekly: organicDailyBaseline * 7,
|
|
189
|
+
publishDayAvg: publishDayCount > 0 ? Math.round(publishDayTotal / publishDayCount) : 0,
|
|
190
|
+
noPublishDayAvg: noPublishDayCount > 0 ? Math.round(noPublishDayTotal / noPublishDayCount) : 0,
|
|
191
|
+
publishDayCount,
|
|
192
|
+
totalDownloads,
|
|
193
|
+
};
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
function formatCreatorRows(telemetry = null, billingSummary = null) {
|
|
197
|
+
return summarizeCreatorPerformance(telemetry, billingSummary).map((entry, index) => {
|
|
198
|
+
const revenueDollars = (entry.bookedRevenueCents / 100).toFixed(2);
|
|
199
|
+
return ` ${index + 1}. ${entry.creator} — rev $${revenueDollars}, paid ${entry.paidOrders}, sprint ${entry.qualifiedSprintLeads}/${entry.sprintLeads}, checkouts ${entry.checkoutStarts}, visitors ${entry.visitors}`;
|
|
200
|
+
});
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
function formatReport(monthly, weekly, github, npmMeta, telemetry = null, billingSummary = null) {
|
|
204
|
+
const weeklyDownloads = weekly.downloads || 0;
|
|
205
|
+
const allDays = monthly.downloads || [];
|
|
206
|
+
const monthlyDownloads = allDays.reduce((sum, d) => sum + d.downloads, 0);
|
|
207
|
+
const dailyValues = allDays.slice(-7).map((d) => d.downloads);
|
|
208
|
+
const trend = sparkline(dailyValues);
|
|
209
|
+
|
|
210
|
+
// Extract publish dates from npm registry metadata
|
|
211
|
+
const publishDates = [];
|
|
212
|
+
if (npmMeta && npmMeta.time) {
|
|
213
|
+
for (const [version, timestamp] of Object.entries(npmMeta.time)) {
|
|
214
|
+
if (version !== 'created' && version !== 'modified') {
|
|
215
|
+
publishDates.push(timestamp.slice(0, 10));
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
const organic = estimateOrganicDownloads(allDays, publishDates);
|
|
221
|
+
const productHuntVisitors = telemetry
|
|
222
|
+
? resolveProductHuntCount(telemetry.visitors.byTrafficChannel, telemetry.visitors.bySource)
|
|
223
|
+
: 0;
|
|
224
|
+
const productHuntCtas = telemetry
|
|
225
|
+
? resolveProductHuntCount(telemetry.ctas.byTrafficChannel, telemetry.ctas.bySource)
|
|
226
|
+
: 0;
|
|
227
|
+
const productHuntCheckouts = telemetry
|
|
228
|
+
? resolveProductHuntCount(telemetry.ctas.checkoutStartsByTrafficChannel, telemetry.ctas.checkoutStartsBySource)
|
|
229
|
+
: 0;
|
|
230
|
+
const telemetryWindow = telemetry && telemetry.window ? telemetry.window : 'all';
|
|
231
|
+
const telemetryLastSeen = telemetry && telemetry.latestSeenAt ? telemetry.latestSeenAt : 'none';
|
|
232
|
+
const trafficQuality = telemetry && telemetry.trafficQuality ? telemetry.trafficQuality : null;
|
|
233
|
+
const externalTraffic = trafficQuality && trafficQuality.external ? trafficQuality.external : null;
|
|
234
|
+
const exportReadiness = {
|
|
235
|
+
plausible: Boolean(process.env.PLAUSIBLE_API_KEY && (process.env.PLAUSIBLE_SITE_ID || process.env.PLAUSIBLE_DOMAIN)),
|
|
236
|
+
posthog: Boolean((process.env.POSTHOG_PERSONAL_API_KEY || process.env.POSTHOG_API_KEY) && process.env.POSTHOG_PROJECT_ID),
|
|
237
|
+
ga4: Boolean(process.env.GA4_PROPERTY_ID && (process.env.GOOGLE_APPLICATION_CREDENTIALS || process.env.GOOGLE_CLIENT_EMAIL)),
|
|
238
|
+
};
|
|
239
|
+
const anyDashboardExportReady = exportReadiness.plausible || exportReadiness.posthog || exportReadiness.ga4;
|
|
240
|
+
const creatorRows = formatCreatorRows(telemetry, billingSummary);
|
|
241
|
+
const predictive = buildPredictiveInsights({
|
|
242
|
+
telemetryAnalytics: telemetry || {},
|
|
243
|
+
billingSummary: billingSummary || {},
|
|
244
|
+
stagingModel: buildPredictiveStagingModel(telemetry || {}, billingSummary || {}),
|
|
245
|
+
});
|
|
246
|
+
|
|
247
|
+
const lines = [
|
|
248
|
+
'',
|
|
249
|
+
'╔══════════════════════════════════════════════════════════════════╗',
|
|
250
|
+
'║ ThumbGate — Unified Analytics Snapshot ║',
|
|
251
|
+
'╚══════════════════════════════════════════════════════════════════╝',
|
|
252
|
+
'',
|
|
253
|
+
'📦 npm — thumbgate (REPORTED)',
|
|
254
|
+
` Weekly downloads: ${weeklyDownloads.toLocaleString()}`,
|
|
255
|
+
` Monthly downloads: ${monthlyDownloads.toLocaleString()}`,
|
|
256
|
+
` Daily trend (7d): ${trend} [${dailyValues.join(', ')}]`,
|
|
257
|
+
'',
|
|
258
|
+
'🔬 npm — ORGANIC ESTIMATE (excluding publish-day + bot inflation)',
|
|
259
|
+
` Organic baseline: ~${organic.organicDailyBaseline}/day → ~${organic.organicWeekly}/week → ~${organic.estimatedOrganic30d.toLocaleString()}/month`,
|
|
260
|
+
` Publish-day avg: ${organic.publishDayAvg}/day (${organic.publishDayCount} publish days this period)`,
|
|
261
|
+
` No-publish avg: ${organic.noPublishDayAvg}/day`,
|
|
262
|
+
` Organic rate: ${organic.organicRate.toFixed(1)}% of reported downloads`,
|
|
263
|
+
` Inflated by: ~${organic.estimatedInflated.toLocaleString()} downloads (registry mirrors, bots, self-installs)`,
|
|
264
|
+
'',
|
|
265
|
+
'⭐ GitHub — IgorGanapolsky/ThumbGate',
|
|
266
|
+
` Stars: ${(github.stargazers_count || 0).toLocaleString()}`,
|
|
267
|
+
` Forks: ${(github.forks_count || 0).toLocaleString()}`,
|
|
268
|
+
` Open issues: ${(github.open_issues_count || 0).toLocaleString()}`,
|
|
269
|
+
` Watchers: ${(github.subscribers_count || 0).toLocaleString()}`,
|
|
270
|
+
'',
|
|
271
|
+
'🌐 Landing Page',
|
|
272
|
+
` Plausible: ${PLAUSIBLE_URL}`,
|
|
273
|
+
` ⚠️ Check Plausible to exclude your own IP (Settings → filter)`,
|
|
274
|
+
'',
|
|
275
|
+
'🚀 ProductHunt',
|
|
276
|
+
` Listing: ${PRODUCTHUNT_URL}`,
|
|
277
|
+
` Tracked: utm_source=producthunt → traffic_channel=producthunt`,
|
|
278
|
+
` Visitors: ${productHuntVisitors}`,
|
|
279
|
+
` CTA clicks: ${productHuntCtas}`,
|
|
280
|
+
` Checkouts: ${productHuntCheckouts}`,
|
|
281
|
+
` Window: ${telemetryWindow}`,
|
|
282
|
+
` Last seen: ${telemetryLastSeen}`,
|
|
283
|
+
'',
|
|
284
|
+
'🧼 First-party traffic quality',
|
|
285
|
+
` Raw events: ${trafficQuality ? trafficQuality.rawEvents : 0}`,
|
|
286
|
+
` External events: ${trafficQuality ? trafficQuality.externalEvents : 0}`,
|
|
287
|
+
` Excluded events: ${trafficQuality ? trafficQuality.excludedEvents : 0}`,
|
|
288
|
+
` Clean visitors: ${externalTraffic ? externalTraffic.uniqueVisitors : 0}`,
|
|
289
|
+
` Clean page views: ${externalTraffic ? externalTraffic.pageViews : 0}`,
|
|
290
|
+
` Clean checkouts: ${externalTraffic ? externalTraffic.checkoutStarts : 0}`,
|
|
291
|
+
` Clean paths: ${externalTraffic && externalTraffic.visitorPaths ? externalTraffic.visitorPaths.length : 0}`,
|
|
292
|
+
` Verdict: ${trafficQuality ? trafficQuality.verdict : 'missing'}`,
|
|
293
|
+
...(trafficQuality && trafficQuality.topExclusionReason
|
|
294
|
+
? [` Top exclusion: ${trafficQuality.topExclusionReason.key} (${trafficQuality.topExclusionReason.count}×)`]
|
|
295
|
+
: [' Top exclusion: none']),
|
|
296
|
+
'',
|
|
297
|
+
'📤 Dashboard-grade visitor-path exports',
|
|
298
|
+
` Plausible API: ${exportReadiness.plausible ? 'configured' : 'missing PLAUSIBLE_API_KEY + site id/domain'}`,
|
|
299
|
+
` PostHog API: ${exportReadiness.posthog ? 'configured' : 'missing POSTHOG_* export credentials'}`,
|
|
300
|
+
` GA4 Data API: ${exportReadiness.ga4 ? 'configured' : 'missing GA4_PROPERTY_ID + Google credentials'}`,
|
|
301
|
+
` Export verdict: ${anyDashboardExportReady ? 'ready for provider path pulls' : 'not dashboard-grade in this repo yet'}`,
|
|
302
|
+
'',
|
|
303
|
+
'🎥 Creator Partnerships',
|
|
304
|
+
' Ranked: booked revenue → paid orders → qualified sprint leads → checkouts',
|
|
305
|
+
...(creatorRows.length > 0 ? creatorRows : [' No attributed creator campaigns yet.']),
|
|
306
|
+
'',
|
|
307
|
+
'🔮 Predictive Insights',
|
|
308
|
+
` Pro propensity: ${predictive.upgradePropensity.pro.band} (${predictive.upgradePropensity.pro.score})`,
|
|
309
|
+
` Team propensity: ${predictive.upgradePropensity.team.band} (${predictive.upgradePropensity.team.score})`,
|
|
310
|
+
` Revenue forecast: $${(predictive.revenueForecast.predictedBookedRevenueCents / 100).toFixed(2)} (+$${(predictive.revenueForecast.incrementalOpportunityCents / 100).toFixed(2)} opportunity)`,
|
|
311
|
+
` Predictive alerts:${predictive.anomalySummary.count} (${predictive.anomalySummary.severity})`,
|
|
312
|
+
...(predictive.topCreators[0]
|
|
313
|
+
? [` Top creator opp: ${predictive.topCreators[0].key} → +$${(predictive.topCreators[0].opportunityRevenueCents / 100).toFixed(2)}`]
|
|
314
|
+
: [' Top creator opp: none yet']),
|
|
315
|
+
...(predictive.topSources[0]
|
|
316
|
+
? [` Top channel opp: ${predictive.topSources[0].key} → +$${(predictive.topSources[0].opportunityRevenueCents / 100).toFixed(2)}`]
|
|
317
|
+
: [' Top channel opp: none yet']),
|
|
318
|
+
'',
|
|
319
|
+
'🔗 UTM links for sharing (tracks referral source in Plausible)',
|
|
320
|
+
` Twitter: ${LANDING_PAGE}?utm_source=twitter&utm_medium=social&utm_campaign=launch`,
|
|
321
|
+
` LinkedIn: ${LANDING_PAGE}?utm_source=linkedin&utm_medium=social&utm_campaign=launch`,
|
|
322
|
+
` Reddit: ${LANDING_PAGE}?utm_source=reddit&utm_medium=social&utm_campaign=launch`,
|
|
323
|
+
` HackerNews: ${LANDING_PAGE}?utm_source=hackernews&utm_medium=social&utm_campaign=launch`,
|
|
324
|
+
'',
|
|
325
|
+
'📏 HONEST METRICS (use these, not the inflated ones)',
|
|
326
|
+
` Real npm traction: ~${organic.organicWeekly} downloads/week`,
|
|
327
|
+
` GitHub stars: ${(github.stargazers_count || 0)}`,
|
|
328
|
+
` ProductHunt: check listing for upvotes/followers`,
|
|
329
|
+
` Landing page: check Plausible (exclude your IP!)`,
|
|
330
|
+
'',
|
|
331
|
+
];
|
|
332
|
+
|
|
333
|
+
return lines.join('\n');
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
async function run(options = {}) {
|
|
337
|
+
const log = options.log || console.log;
|
|
338
|
+
const error = options.error || console.error;
|
|
339
|
+
const exit = options.exit || process.exit;
|
|
340
|
+
|
|
341
|
+
try {
|
|
342
|
+
const { monthly, weekly, github, npmMeta, telemetry, billingSummary } = await collectAnalytics(options.fetchers);
|
|
343
|
+
log(formatReport(monthly, weekly, github, npmMeta, telemetry, billingSummary));
|
|
344
|
+
} catch (err) {
|
|
345
|
+
error('Analytics fetch failed:', err.message);
|
|
346
|
+
exit(1);
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
module.exports = {
|
|
351
|
+
run,
|
|
352
|
+
collectAnalytics,
|
|
353
|
+
formatReport,
|
|
354
|
+
fetchNpmMonthly,
|
|
355
|
+
fetchNpmWeekly,
|
|
356
|
+
fetchGitHub,
|
|
357
|
+
fetchNpmVersions,
|
|
358
|
+
estimateOrganicDownloads,
|
|
359
|
+
};
|
|
360
|
+
|
|
361
|
+
if (require.main === module) {
|
|
362
|
+
run();
|
|
363
|
+
}
|
|
@@ -73,6 +73,10 @@ function normalizeWindow(value) {
|
|
|
73
73
|
case '30days':
|
|
74
74
|
case '30-day':
|
|
75
75
|
return '30d';
|
|
76
|
+
case '90':
|
|
77
|
+
case '90days':
|
|
78
|
+
case '90-day':
|
|
79
|
+
return '90d';
|
|
76
80
|
default:
|
|
77
81
|
return normalized;
|
|
78
82
|
}
|
|
@@ -95,7 +99,7 @@ function resolveAnalyticsWindow(options = {}) {
|
|
|
95
99
|
}
|
|
96
100
|
|
|
97
101
|
const window = normalizeWindow(options.window);
|
|
98
|
-
if (!['lifetime', 'today', '7d', '30d'].includes(window)) {
|
|
102
|
+
if (!['lifetime', 'today', '7d', '30d', '90d'].includes(window)) {
|
|
99
103
|
const err = new Error(`Invalid analytics window: ${window}`);
|
|
100
104
|
err.code = 'invalid_window';
|
|
101
105
|
throw err;
|
|
@@ -112,6 +116,8 @@ function resolveAnalyticsWindow(options = {}) {
|
|
|
112
116
|
startLocalDate = shiftLocalDate(endLocalDate, -6);
|
|
113
117
|
} else if (window === '30d') {
|
|
114
118
|
startLocalDate = shiftLocalDate(endLocalDate, -29);
|
|
119
|
+
} else if (window === '90d') {
|
|
120
|
+
startLocalDate = shiftLocalDate(endLocalDate, -89);
|
|
115
121
|
}
|
|
116
122
|
|
|
117
123
|
return {
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
const { tenantDataScope, assertScopedDataPath, restrictedWorkerEnv, withDataScope } = require('./feedback-scope');
|
|
4
|
+
|
|
3
5
|
const fs = require('fs');
|
|
6
|
+
const { randomUUID } = require('node:crypto');
|
|
4
7
|
const path = require('path');
|
|
5
8
|
const { spawnSync } = require('child_process');
|
|
6
9
|
|
|
@@ -25,7 +28,7 @@ function nowIso() {
|
|
|
25
28
|
}
|
|
26
29
|
|
|
27
30
|
function generateJobId() {
|
|
28
|
-
return `job_${Date.now()}_${
|
|
31
|
+
return `job_${Date.now()}_${randomUUID()}`;
|
|
29
32
|
}
|
|
30
33
|
|
|
31
34
|
function readJson(filePath) {
|
|
@@ -39,7 +42,13 @@ function readJson(filePath) {
|
|
|
39
42
|
|
|
40
43
|
function writeJson(filePath, value) {
|
|
41
44
|
ensureDir(path.dirname(filePath));
|
|
42
|
-
|
|
45
|
+
const serialized = JSON.stringify(value, null, 2) + '\n';
|
|
46
|
+
const temporary = assertScopedDataPath(`${filePath}.${process.pid}.${randomUUID()}.tmp`);
|
|
47
|
+
const descriptor = fs.openSync(temporary, 'wx', 0o600);
|
|
48
|
+
try {
|
|
49
|
+
try { fs.writeFileSync(descriptor, serialized, 'utf8'); } finally { fs.closeSync(descriptor); }
|
|
50
|
+
fs.renameSync(temporary, filePath);
|
|
51
|
+
} finally { fs.rmSync(temporary, { force: true }); }
|
|
43
52
|
}
|
|
44
53
|
|
|
45
54
|
function appendJSONL(filePath, record) {
|
|
@@ -48,16 +57,19 @@ function appendJSONL(filePath, record) {
|
|
|
48
57
|
}
|
|
49
58
|
|
|
50
59
|
function getJobRuntimePaths(jobId) {
|
|
60
|
+
if (jobId && !/^[A-Za-z0-9][A-Za-z0-9_.-]{0,159}$/.test(jobId)) {
|
|
61
|
+
const error = new Error('Invalid job identifier'); error.statusCode = 400; throw error;
|
|
62
|
+
}
|
|
51
63
|
const { FEEDBACK_DIR } = getFeedbackPaths();
|
|
52
|
-
const jobsDir = path.join(FEEDBACK_DIR, JOB_STATE_DIRNAME);
|
|
53
|
-
const jobDir = jobId ? path.join(jobsDir, jobId) : null;
|
|
64
|
+
const jobsDir = assertScopedDataPath(path.join(FEEDBACK_DIR, JOB_STATE_DIRNAME));
|
|
65
|
+
const jobDir = jobId ? assertScopedDataPath(path.join(jobsDir, jobId)) : null;
|
|
54
66
|
return {
|
|
55
67
|
feedbackDir: FEEDBACK_DIR,
|
|
56
68
|
jobsDir,
|
|
57
69
|
jobDir,
|
|
58
|
-
statePath: jobDir ? path.join(jobDir, 'state.json') : null,
|
|
59
|
-
controlPath: jobDir ? path.join(jobDir, JOB_CONTROL_FILENAME) : null,
|
|
60
|
-
logPath: path.join(FEEDBACK_DIR, JOB_LOG_FILENAME),
|
|
70
|
+
statePath: jobDir ? assertScopedDataPath(path.join(jobDir, 'state.json')) : null,
|
|
71
|
+
controlPath: jobDir ? assertScopedDataPath(path.join(jobDir, JOB_CONTROL_FILENAME)) : null,
|
|
72
|
+
logPath: assertScopedDataPath(path.join(FEEDBACK_DIR, JOB_LOG_FILENAME)),
|
|
61
73
|
};
|
|
62
74
|
}
|
|
63
75
|
|
|
@@ -137,6 +149,7 @@ function serializeJobForState(job) {
|
|
|
137
149
|
}
|
|
138
150
|
|
|
139
151
|
function queueJob(job) {
|
|
152
|
+
assertTenantJob(job);
|
|
140
153
|
const normalizedJob = {
|
|
141
154
|
...job,
|
|
142
155
|
id: job.id || generateJobId(),
|
|
@@ -198,7 +211,7 @@ function listJobStates(options = {}) {
|
|
|
198
211
|
: null;
|
|
199
212
|
|
|
200
213
|
const results = fs.readdirSync(jobsDir)
|
|
201
|
-
.map((entry) => readJson(path.join(jobsDir, entry, 'state.json')))
|
|
214
|
+
.map((entry) => readJson(assertScopedDataPath(path.join(jobsDir, entry, 'state.json'))))
|
|
202
215
|
.filter(Boolean)
|
|
203
216
|
.filter((entry) => !statuses || statuses.has(entry.status))
|
|
204
217
|
.sort((left, right) => {
|
|
@@ -576,7 +589,7 @@ function runCommandStage(stage) {
|
|
|
576
589
|
const tokens = parseCommandArgv(stage.command);
|
|
577
590
|
const result = spawnSync(tokens[0], tokens.slice(1), {
|
|
578
591
|
cwd: stage.workingDirectory || process.cwd(),
|
|
579
|
-
env:
|
|
592
|
+
env: restrictedWorkerEnv(),
|
|
580
593
|
encoding: 'utf8',
|
|
581
594
|
stdio: 'pipe',
|
|
582
595
|
shell: false,
|
|
@@ -842,7 +855,26 @@ function resumeJob(jobId, job = null, options = {}) {
|
|
|
842
855
|
* @param {object} job
|
|
843
856
|
* @returns {object} Job execution result
|
|
844
857
|
*/
|
|
858
|
+
function assertTenantJob(job) {
|
|
859
|
+
if (!tenantDataScope()) return;
|
|
860
|
+
const denied = () => { const error = new Error('Hosted tenant jobs require a verified fixed export or an execution sandbox'); error.statusCode = 403; throw error; };
|
|
861
|
+
if (job.skill !== 'hosted-dpo-export' || job.recordFeedback !== false || job.autoImprove !== false || job.verificationMode !== 'none' || job.taskFn || !Array.isArray(job.stages) || job.stages.length !== 1) denied();
|
|
862
|
+
const stage = job.stages[0];
|
|
863
|
+
if (stage.taskFn || stage.run || typeof stage.command !== 'string') denied();
|
|
864
|
+
const args = parseCommandArgv(stage.command);
|
|
865
|
+
if (args[0] !== process.execPath || args[1] !== path.join(__dirname, 'managed-dpo-export.js')) denied();
|
|
866
|
+
let inputCount = 0;
|
|
867
|
+
for (let index = 2; index < args.length; index += 2) {
|
|
868
|
+
if (!['--inputPath', '--memoryLogPath', '--outputPath'].includes(args[index]) || !args[index + 1]) denied();
|
|
869
|
+
assertScopedDataPath(args[index + 1]);
|
|
870
|
+
if (args[index] !== '--outputPath') inputCount += 1;
|
|
871
|
+
}
|
|
872
|
+
if (inputCount !== 1) denied();
|
|
873
|
+
if (stage.workingDirectory) assertScopedDataPath(stage.workingDirectory);
|
|
874
|
+
}
|
|
875
|
+
|
|
845
876
|
function executeJob(job, options = {}) {
|
|
877
|
+
assertTenantJob(job);
|
|
846
878
|
const started = Date.now();
|
|
847
879
|
const normalizedJob = {
|
|
848
880
|
...job,
|
|
@@ -1052,7 +1084,7 @@ function executeJob(job, options = {}) {
|
|
|
1052
1084
|
}
|
|
1053
1085
|
|
|
1054
1086
|
function runJobFromFile(jobFilePath, options = {}) {
|
|
1055
|
-
const resolvedPath = path.resolve(jobFilePath);
|
|
1087
|
+
const resolvedPath = assertScopedDataPath(path.resolve(jobFilePath));
|
|
1056
1088
|
const spec = readJson(resolvedPath);
|
|
1057
1089
|
if (!spec) {
|
|
1058
1090
|
throw new Error(`Unable to read job file: ${resolvedPath}`);
|
|
@@ -1118,6 +1150,7 @@ function runBatch(jobs) {
|
|
|
1118
1150
|
|
|
1119
1151
|
module.exports = {
|
|
1120
1152
|
recallContext,
|
|
1153
|
+
assertTenantJob,
|
|
1121
1154
|
executeJob,
|
|
1122
1155
|
queueJob,
|
|
1123
1156
|
runBatch,
|
|
@@ -1125,6 +1158,7 @@ module.exports = {
|
|
|
1125
1158
|
readJobLog,
|
|
1126
1159
|
getJobStats,
|
|
1127
1160
|
readJobState,
|
|
1161
|
+
writeJobState,
|
|
1128
1162
|
listJobStates,
|
|
1129
1163
|
readJobControl,
|
|
1130
1164
|
requestJobControl,
|
|
@@ -1140,14 +1174,17 @@ module.exports = {
|
|
|
1140
1174
|
JOB_STATE_DIRNAME,
|
|
1141
1175
|
};
|
|
1142
1176
|
|
|
1143
|
-
|
|
1177
|
+
function parseCliArguments() {
|
|
1144
1178
|
const args = {};
|
|
1145
1179
|
process.argv.slice(2).forEach((arg) => {
|
|
1146
1180
|
if (!arg.startsWith('--')) return;
|
|
1147
1181
|
const [key, ...rest] = arg.slice(2).split('=');
|
|
1148
1182
|
args[key] = rest.length > 0 ? rest.join('=') : true;
|
|
1149
1183
|
});
|
|
1184
|
+
return args;
|
|
1185
|
+
}
|
|
1150
1186
|
|
|
1187
|
+
function runControlCliCommand(args) {
|
|
1151
1188
|
if (args.pause) {
|
|
1152
1189
|
console.log(JSON.stringify(requestJobControl(args.pause, 'pause'), null, 2));
|
|
1153
1190
|
process.exit(0);
|
|
@@ -1170,6 +1207,9 @@ if (require.main === module) {
|
|
|
1170
1207
|
process.exit(result.failed > 0 || result.cancelled > 0 ? 1 : 0);
|
|
1171
1208
|
}
|
|
1172
1209
|
|
|
1210
|
+
}
|
|
1211
|
+
|
|
1212
|
+
function runHarnessCliCommand(args) {
|
|
1173
1213
|
if (args['list-harnesses']) {
|
|
1174
1214
|
const { listHarnesses } = require('./natural-language-harness');
|
|
1175
1215
|
console.log(JSON.stringify({ harnesses: listHarnesses({ tag: args.tag }) }, null, 2));
|
|
@@ -1194,6 +1234,13 @@ if (require.main === module) {
|
|
|
1194
1234
|
process.exit(['failed', 'cancelled'].includes(result.status) ? 1 : 0);
|
|
1195
1235
|
}
|
|
1196
1236
|
|
|
1237
|
+
}
|
|
1238
|
+
|
|
1239
|
+
function runCli() {
|
|
1240
|
+
const args = parseCliArguments();
|
|
1241
|
+
runControlCliCommand(args);
|
|
1242
|
+
runHarnessCliCommand(args);
|
|
1243
|
+
|
|
1197
1244
|
if (args['run-file']) {
|
|
1198
1245
|
const result = runJobFromFile(args['run-file']);
|
|
1199
1246
|
console.log(JSON.stringify(result, null, 2));
|
|
@@ -1240,3 +1287,11 @@ if (require.main === module) {
|
|
|
1240
1287
|
node scripts/async-job-runner.js --stats
|
|
1241
1288
|
node scripts/async-job-runner.js --log --limit=10`);
|
|
1242
1289
|
}
|
|
1290
|
+
|
|
1291
|
+
if (require.main === module) {
|
|
1292
|
+
if (process.env.THUMBGATE_WORKER_SCOPE) {
|
|
1293
|
+
withDataScope(JSON.parse(process.env.THUMBGATE_WORKER_SCOPE), runCli);
|
|
1294
|
+
} else {
|
|
1295
|
+
runCli();
|
|
1296
|
+
}
|
|
1297
|
+
}
|