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,162 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
/**
|
|
3
|
-
* Feedback Inbox Reader
|
|
4
|
-
*
|
|
5
|
-
* Reads new feedback entries from the inbox JSONL file, using a cursor
|
|
6
|
-
* to avoid reprocessing. External systems (Phoenix bridge, other agents)
|
|
7
|
-
* append feedback signals to the inbox; Amp's reflexion-preflight skill
|
|
8
|
-
* calls this script each turn to ingest new signals.
|
|
9
|
-
*
|
|
10
|
-
* Usage:
|
|
11
|
-
* node scripts/feedback-inbox-read.js # output new entries as JSON array
|
|
12
|
-
* node scripts/feedback-inbox-read.js --peek # show count without advancing cursor
|
|
13
|
-
* node scripts/feedback-inbox-read.js --reset # reset cursor to re-read all
|
|
14
|
-
* node scripts/feedback-inbox-read.js --test # run built-in tests
|
|
15
|
-
*
|
|
16
|
-
* Inbox: .claude/feedback-loop/inbox.jsonl
|
|
17
|
-
* Cursor: .claude/feedback-loop/inbox.cursor.json
|
|
18
|
-
*/
|
|
19
|
-
'use strict';
|
|
20
|
-
|
|
21
|
-
const fs = require('fs');
|
|
22
|
-
const path = require('path');
|
|
23
|
-
|
|
24
|
-
const PROJECT_ROOT = path.join(__dirname, '..');
|
|
25
|
-
const INBOX_PATH = path.join(PROJECT_ROOT, '.claude', 'feedback-loop', 'inbox.jsonl');
|
|
26
|
-
const CURSOR_PATH = path.join(PROJECT_ROOT, '.claude', 'feedback-loop', 'inbox.cursor.json');
|
|
27
|
-
|
|
28
|
-
function readInbox() {
|
|
29
|
-
if (!fs.existsSync(INBOX_PATH)) return [];
|
|
30
|
-
const raw = fs.readFileSync(INBOX_PATH, 'utf-8').trim();
|
|
31
|
-
if (!raw) return [];
|
|
32
|
-
return raw.split('\n').map((line, idx) => {
|
|
33
|
-
try {
|
|
34
|
-
return { _lineIndex: idx, ...JSON.parse(line) };
|
|
35
|
-
} catch {
|
|
36
|
-
return null;
|
|
37
|
-
}
|
|
38
|
-
}).filter(Boolean);
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
function loadCursor() {
|
|
42
|
-
if (!fs.existsSync(CURSOR_PATH)) return { lastLineIndex: -1 };
|
|
43
|
-
try {
|
|
44
|
-
return JSON.parse(fs.readFileSync(CURSOR_PATH, 'utf-8'));
|
|
45
|
-
} catch {
|
|
46
|
-
return { lastLineIndex: -1 };
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
function saveCursor(cursor) {
|
|
51
|
-
const dir = path.dirname(CURSOR_PATH);
|
|
52
|
-
if (!fs.existsSync(dir)) fs.mkdirSync(dir, { recursive: true });
|
|
53
|
-
fs.writeFileSync(CURSOR_PATH, JSON.stringify(cursor, null, 2) + '\n');
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
function getNewEntries(advance) {
|
|
57
|
-
const entries = readInbox();
|
|
58
|
-
if (entries.length === 0) return [];
|
|
59
|
-
|
|
60
|
-
const cursor = loadCursor();
|
|
61
|
-
const newEntries = entries.filter((e) => e._lineIndex > cursor.lastLineIndex);
|
|
62
|
-
|
|
63
|
-
if (advance && newEntries.length > 0) {
|
|
64
|
-
const maxIdx = Math.max(...newEntries.map((e) => e._lineIndex));
|
|
65
|
-
saveCursor({ lastLineIndex: maxIdx, updatedAt: new Date().toISOString() });
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
// Strip internal _lineIndex before returning
|
|
69
|
-
return newEntries.map(({ _lineIndex, ...rest }) => rest);
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
// ---------------------------------------------------------------------------
|
|
73
|
-
// CLI
|
|
74
|
-
// ---------------------------------------------------------------------------
|
|
75
|
-
|
|
76
|
-
function runTests() {
|
|
77
|
-
const os = require('os');
|
|
78
|
-
let passed = 0;
|
|
79
|
-
let failed = 0;
|
|
80
|
-
|
|
81
|
-
function assert(condition, name) {
|
|
82
|
-
if (condition) { passed++; console.log(` ✅ ${name}`); }
|
|
83
|
-
else { failed++; console.log(` ❌ ${name}`); }
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
console.log('\n🧪 feedback-inbox-read.js — Tests\n');
|
|
87
|
-
|
|
88
|
-
// Setup temp inbox
|
|
89
|
-
const tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), 'inbox-test-'));
|
|
90
|
-
const tmpInbox = path.join(tmpDir, 'inbox.jsonl');
|
|
91
|
-
const tmpCursor = path.join(tmpDir, 'inbox.cursor.json');
|
|
92
|
-
|
|
93
|
-
// Write test entries
|
|
94
|
-
const entries = [
|
|
95
|
-
{ signal: 'negative', context: 'Bad thing happened', tags: ['testing'] },
|
|
96
|
-
{ signal: 'positive', context: 'Good thing happened', tags: ['testing'] },
|
|
97
|
-
{ signal: 'negative', context: 'Another bad thing', tags: ['thumbgate'] },
|
|
98
|
-
];
|
|
99
|
-
fs.writeFileSync(tmpInbox, entries.map((e) => JSON.stringify(e)).join('\n') + '\n');
|
|
100
|
-
|
|
101
|
-
// Test reading all (no cursor)
|
|
102
|
-
const allEntries = (() => {
|
|
103
|
-
const raw = fs.readFileSync(tmpInbox, 'utf-8').trim();
|
|
104
|
-
return raw.split('\n').map((line, idx) => {
|
|
105
|
-
try { return { _lineIndex: idx, ...JSON.parse(line) }; }
|
|
106
|
-
catch { return null; }
|
|
107
|
-
}).filter(Boolean);
|
|
108
|
-
})();
|
|
109
|
-
assert(allEntries.length === 3, 'reads all 3 entries from inbox');
|
|
110
|
-
|
|
111
|
-
// Test cursor-based filtering
|
|
112
|
-
fs.writeFileSync(tmpCursor, JSON.stringify({ lastLineIndex: 0 }));
|
|
113
|
-
const afterFirst = allEntries.filter((e) => e._lineIndex > 0);
|
|
114
|
-
assert(afterFirst.length === 2, 'cursor at 0 → 2 new entries');
|
|
115
|
-
|
|
116
|
-
fs.writeFileSync(tmpCursor, JSON.stringify({ lastLineIndex: 2 }));
|
|
117
|
-
const afterAll = allEntries.filter((e) => e._lineIndex > 2);
|
|
118
|
-
assert(afterAll.length === 0, 'cursor at 2 → 0 new entries');
|
|
119
|
-
|
|
120
|
-
// Test loadCursor with missing file
|
|
121
|
-
const missingCursor = path.join(tmpDir, 'missing.cursor.json');
|
|
122
|
-
const fakeMod = { loadCursor: () => {
|
|
123
|
-
if (!fs.existsSync(missingCursor)) return { lastLineIndex: -1 };
|
|
124
|
-
try { return JSON.parse(fs.readFileSync(missingCursor, 'utf-8')); } catch { return { lastLineIndex: -1 }; }
|
|
125
|
-
}};
|
|
126
|
-
assert(fakeMod.loadCursor().lastLineIndex === -1, 'loadCursor returns -1 for missing file');
|
|
127
|
-
|
|
128
|
-
// Test saveCursor creates directory
|
|
129
|
-
const deepDir = path.join(tmpDir, 'deep', 'nested');
|
|
130
|
-
const deepCursor = path.join(deepDir, 'cursor.json');
|
|
131
|
-
if (!fs.existsSync(deepDir)) fs.mkdirSync(deepDir, { recursive: true });
|
|
132
|
-
fs.writeFileSync(deepCursor, JSON.stringify({ lastLineIndex: 5, updatedAt: new Date().toISOString() }) + '\n');
|
|
133
|
-
const loaded = JSON.parse(fs.readFileSync(deepCursor, 'utf-8'));
|
|
134
|
-
assert(loaded.lastLineIndex === 5, 'saveCursor persists cursor value');
|
|
135
|
-
|
|
136
|
-
// Cleanup
|
|
137
|
-
fs.rmSync(tmpDir, { recursive: true, force: true });
|
|
138
|
-
|
|
139
|
-
console.log(`\n${'═'.repeat(50)}`);
|
|
140
|
-
console.log(`Results: ${passed} passed, ${failed} failed, ${passed + failed} total`);
|
|
141
|
-
console.log(`${'═'.repeat(50)}\n`);
|
|
142
|
-
process.exit(failed > 0 ? 1 : 0);
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
if (require.main === module) {
|
|
146
|
-
if (process.argv.includes('--test')) {
|
|
147
|
-
runTests();
|
|
148
|
-
} else if (process.argv.includes('--reset')) {
|
|
149
|
-
if (fs.existsSync(CURSOR_PATH)) fs.unlinkSync(CURSOR_PATH);
|
|
150
|
-
console.log('Cursor reset.');
|
|
151
|
-
} else {
|
|
152
|
-
const peek = process.argv.includes('--peek');
|
|
153
|
-
const entries = getNewEntries(!peek);
|
|
154
|
-
if (entries.length === 0) {
|
|
155
|
-
// Silent — no new entries
|
|
156
|
-
process.exit(0);
|
|
157
|
-
}
|
|
158
|
-
process.stdout.write(JSON.stringify(entries, null, 2) + '\n');
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
module.exports = { getNewEntries, readInbox, loadCursor, saveCursor, INBOX_PATH, CURSOR_PATH };
|
|
@@ -1,233 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
'use strict';
|
|
3
|
-
|
|
4
|
-
const fs = require('fs');
|
|
5
|
-
const path = require('path');
|
|
6
|
-
const { ensureParentDir, readJsonl } = require('./fs-utils');
|
|
7
|
-
const {
|
|
8
|
-
getThumbgateFeedbackDir,
|
|
9
|
-
listFeedbackArtifactPaths,
|
|
10
|
-
} = require('./feedback-paths');
|
|
11
|
-
|
|
12
|
-
const JSONL_ARTIFACTS = new Set([
|
|
13
|
-
'funnel-events.jsonl',
|
|
14
|
-
'telemetry-pings.jsonl',
|
|
15
|
-
'revenue-events.jsonl',
|
|
16
|
-
'workflow-sprint-leads.jsonl',
|
|
17
|
-
]);
|
|
18
|
-
|
|
19
|
-
const JSON_ARTIFACTS = new Map([
|
|
20
|
-
['api-keys.json', () => ({ keys: {} })],
|
|
21
|
-
['local-checkout-sessions.json', () => ({ sessions: {} })],
|
|
22
|
-
]);
|
|
23
|
-
|
|
24
|
-
const CONSOLIDATED_ARTIFACTS = [
|
|
25
|
-
'api-keys.json',
|
|
26
|
-
'funnel-events.jsonl',
|
|
27
|
-
'telemetry-pings.jsonl',
|
|
28
|
-
'revenue-events.jsonl',
|
|
29
|
-
'local-checkout-sessions.json',
|
|
30
|
-
'workflow-sprint-leads.jsonl',
|
|
31
|
-
];
|
|
32
|
-
|
|
33
|
-
function getScopedProjectOptions(options = {}) {
|
|
34
|
-
if (options.feedbackDir) return options;
|
|
35
|
-
|
|
36
|
-
const projectDir = options.projectDir || options.cwd;
|
|
37
|
-
if (!projectDir) return options;
|
|
38
|
-
|
|
39
|
-
return {
|
|
40
|
-
...options,
|
|
41
|
-
projectDir,
|
|
42
|
-
explicitProjectDir: true,
|
|
43
|
-
};
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
function readJsonFile(filePath, fallbackFactory) {
|
|
47
|
-
if (!filePath || !fs.existsSync(filePath)) return fallbackFactory();
|
|
48
|
-
try {
|
|
49
|
-
const parsed = JSON.parse(fs.readFileSync(filePath, 'utf8'));
|
|
50
|
-
return parsed && typeof parsed === 'object' ? parsed : fallbackFactory();
|
|
51
|
-
} catch {
|
|
52
|
-
return fallbackFactory();
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
function stableArtifactTimestamp(record = {}) {
|
|
57
|
-
return String(
|
|
58
|
-
record.timestamp ||
|
|
59
|
-
record.receivedAt ||
|
|
60
|
-
record.submittedAt ||
|
|
61
|
-
record.updatedAt ||
|
|
62
|
-
record.createdAt ||
|
|
63
|
-
''
|
|
64
|
-
);
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
function dedupeJsonlRows(rows = []) {
|
|
68
|
-
const merged = [];
|
|
69
|
-
const seen = new Set();
|
|
70
|
-
|
|
71
|
-
for (const row of rows) {
|
|
72
|
-
if (!row || typeof row !== 'object') continue;
|
|
73
|
-
const key = JSON.stringify(row);
|
|
74
|
-
if (seen.has(key)) continue;
|
|
75
|
-
seen.add(key);
|
|
76
|
-
merged.push(row);
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
return merged.sort((a, b) => {
|
|
80
|
-
const timeCompare = stableArtifactTimestamp(a).localeCompare(stableArtifactTimestamp(b));
|
|
81
|
-
if (timeCompare !== 0) return timeCompare;
|
|
82
|
-
return JSON.stringify(a).localeCompare(JSON.stringify(b));
|
|
83
|
-
});
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
function mergeKeyStorePayloads(payloads = []) {
|
|
87
|
-
const merged = { keys: {} };
|
|
88
|
-
for (const payload of payloads) {
|
|
89
|
-
if (!payload || typeof payload !== 'object') continue;
|
|
90
|
-
Object.assign(merged, payload);
|
|
91
|
-
merged.keys = {
|
|
92
|
-
...(merged.keys || {}),
|
|
93
|
-
...((payload && payload.keys) || {}),
|
|
94
|
-
};
|
|
95
|
-
}
|
|
96
|
-
return merged;
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
function mergeCheckoutSessionsPayloads(payloads = []) {
|
|
100
|
-
const merged = { sessions: {} };
|
|
101
|
-
for (const payload of payloads) {
|
|
102
|
-
if (!payload || typeof payload !== 'object') continue;
|
|
103
|
-
Object.assign(merged, payload);
|
|
104
|
-
merged.sessions = {
|
|
105
|
-
...(merged.sessions || {}),
|
|
106
|
-
...((payload && payload.sessions) || {}),
|
|
107
|
-
};
|
|
108
|
-
}
|
|
109
|
-
return merged;
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
function serializeJson(payload) {
|
|
113
|
-
return `${JSON.stringify(payload, null, 2)}\n`;
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
function serializeJsonl(rows = []) {
|
|
117
|
-
const serialized = rows.map((row) => JSON.stringify(row)).join('\n');
|
|
118
|
-
return serialized ? `${serialized}\n` : '';
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
function writeIfChanged(filePath, nextContent, write = true) {
|
|
122
|
-
const currentContent = fs.existsSync(filePath) ? fs.readFileSync(filePath, 'utf8') : null;
|
|
123
|
-
const changed = currentContent !== nextContent;
|
|
124
|
-
|
|
125
|
-
if (write && changed) {
|
|
126
|
-
ensureParentDir(filePath);
|
|
127
|
-
fs.writeFileSync(filePath, nextContent, 'utf8');
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
return {
|
|
131
|
-
changed,
|
|
132
|
-
wrote: write && changed,
|
|
133
|
-
};
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
function consolidateJsonArtifact(fileName, primaryPath, sourcePaths, write) {
|
|
137
|
-
const fallbackFactory = JSON_ARTIFACTS.get(fileName);
|
|
138
|
-
const payloads = sourcePaths.map((candidate) => readJsonFile(candidate, fallbackFactory));
|
|
139
|
-
const merged = fileName === 'api-keys.json'
|
|
140
|
-
? mergeKeyStorePayloads(payloads)
|
|
141
|
-
: mergeCheckoutSessionsPayloads(payloads);
|
|
142
|
-
const initializedEmpty = sourcePaths.length === 0;
|
|
143
|
-
const writeResult = writeIfChanged(primaryPath, serializeJson(merged), write);
|
|
144
|
-
|
|
145
|
-
return {
|
|
146
|
-
fileName,
|
|
147
|
-
format: 'json',
|
|
148
|
-
primaryPath,
|
|
149
|
-
sourcePaths,
|
|
150
|
-
sourceCount: sourcePaths.length,
|
|
151
|
-
initializedEmpty,
|
|
152
|
-
wrote: writeResult.wrote,
|
|
153
|
-
changed: writeResult.changed,
|
|
154
|
-
keyCount: Object.keys(merged.keys || {}).length,
|
|
155
|
-
sessionCount: Object.keys(merged.sessions || {}).length,
|
|
156
|
-
};
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
function consolidateJsonlArtifact(fileName, primaryPath, sourcePaths, write) {
|
|
160
|
-
const merged = dedupeJsonlRows(sourcePaths.flatMap((candidate) => readJsonl(candidate)));
|
|
161
|
-
const initializedEmpty = sourcePaths.length === 0;
|
|
162
|
-
const writeResult = writeIfChanged(primaryPath, serializeJsonl(merged), write);
|
|
163
|
-
|
|
164
|
-
return {
|
|
165
|
-
fileName,
|
|
166
|
-
format: 'jsonl',
|
|
167
|
-
primaryPath,
|
|
168
|
-
sourcePaths,
|
|
169
|
-
sourceCount: sourcePaths.length,
|
|
170
|
-
initializedEmpty,
|
|
171
|
-
wrote: writeResult.wrote,
|
|
172
|
-
changed: writeResult.changed,
|
|
173
|
-
rowCount: merged.length,
|
|
174
|
-
};
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
function consolidateArtifact(fileName, options = {}) {
|
|
178
|
-
const artifactPaths = listFeedbackArtifactPaths(fileName, options);
|
|
179
|
-
const primaryPath = artifactPaths[0];
|
|
180
|
-
const sourcePaths = artifactPaths.filter((candidate) => fs.existsSync(candidate));
|
|
181
|
-
const write = options.write !== false;
|
|
182
|
-
|
|
183
|
-
if (JSONL_ARTIFACTS.has(fileName)) {
|
|
184
|
-
return consolidateJsonlArtifact(fileName, primaryPath, sourcePaths, write);
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
return consolidateJsonArtifact(fileName, primaryPath, sourcePaths, write);
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
function consolidateFeedbackRoot(options = {}) {
|
|
191
|
-
const scopedOptions = getScopedProjectOptions(options);
|
|
192
|
-
const feedbackDir = scopedOptions.feedbackDir
|
|
193
|
-
|| getThumbgateFeedbackDir(scopedOptions);
|
|
194
|
-
const artifacts = CONSOLIDATED_ARTIFACTS.map((fileName) => consolidateArtifact(fileName, {
|
|
195
|
-
...scopedOptions,
|
|
196
|
-
feedbackDir,
|
|
197
|
-
}));
|
|
198
|
-
const sourceRoots = Array.from(new Set(
|
|
199
|
-
artifacts.flatMap((artifact) => artifact.sourcePaths.map((candidate) => path.dirname(candidate)))
|
|
200
|
-
)).sort();
|
|
201
|
-
|
|
202
|
-
return {
|
|
203
|
-
feedbackDir,
|
|
204
|
-
write: options.write !== false,
|
|
205
|
-
artifactCount: artifacts.length,
|
|
206
|
-
wroteArtifacts: artifacts.filter((artifact) => artifact.wrote).length,
|
|
207
|
-
changedArtifacts: artifacts.filter((artifact) => artifact.changed).length,
|
|
208
|
-
initializedArtifacts: artifacts.filter((artifact) => artifact.initializedEmpty).map((artifact) => artifact.fileName),
|
|
209
|
-
sourceRoots,
|
|
210
|
-
artifacts,
|
|
211
|
-
};
|
|
212
|
-
}
|
|
213
|
-
|
|
214
|
-
function runCli() {
|
|
215
|
-
const args = new Set(process.argv.slice(2));
|
|
216
|
-
const dryRun = args.has('--dry-run');
|
|
217
|
-
const summary = consolidateFeedbackRoot({ write: !dryRun });
|
|
218
|
-
process.stdout.write(`${JSON.stringify(summary, null, 2)}\n`);
|
|
219
|
-
}
|
|
220
|
-
|
|
221
|
-
module.exports = {
|
|
222
|
-
CONSOLIDATED_ARTIFACTS,
|
|
223
|
-
consolidateArtifact,
|
|
224
|
-
consolidateFeedbackRoot,
|
|
225
|
-
dedupeJsonlRows,
|
|
226
|
-
getScopedProjectOptions,
|
|
227
|
-
mergeCheckoutSessionsPayloads,
|
|
228
|
-
mergeKeyStorePayloads,
|
|
229
|
-
};
|
|
230
|
-
|
|
231
|
-
if (require.main === module) {
|
|
232
|
-
runCli();
|
|
233
|
-
}
|
|
@@ -1,185 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
/**
|
|
3
|
-
* Feedback → Memory Bridge
|
|
4
|
-
*
|
|
5
|
-
* Converts raw feedback params into a schema-validated memory object
|
|
6
|
-
* suitable for mcp__memory__remember. This is the validation boundary
|
|
7
|
-
* between external feedback signals and MCP memory storage.
|
|
8
|
-
*
|
|
9
|
-
* Usage:
|
|
10
|
-
* echo '{"signal":"negative","context":"...","whatWentWrong":"...","tags":["testing"]}' | node scripts/feedback-to-memory.js
|
|
11
|
-
* node scripts/feedback-to-memory.js --test
|
|
12
|
-
*
|
|
13
|
-
* Input (stdin JSON):
|
|
14
|
-
* signal: "positive" | "negative"
|
|
15
|
-
* context: string — what the agent was doing
|
|
16
|
-
* whatWentWrong: string — for negative: what failed
|
|
17
|
-
* whatToChange: string — for negative: how to avoid
|
|
18
|
-
* whatWorked: string — for positive: the pattern to repeat
|
|
19
|
-
* tags: string[] — optional domain tags; a fallback domain tag is inferred when omitted
|
|
20
|
-
*
|
|
21
|
-
* Output (stdout JSON):
|
|
22
|
-
* { ok: true, memory: { title, content, category, importance, tags } }
|
|
23
|
-
* { ok: false, reason: string, issues?: string[] }
|
|
24
|
-
*/
|
|
25
|
-
'use strict';
|
|
26
|
-
|
|
27
|
-
const { resolveFeedbackAction, prepareForStorage } = require('./feedback-schema');
|
|
28
|
-
const { buildClarificationMessage } = require('./feedback-quality');
|
|
29
|
-
|
|
30
|
-
function convertFeedbackToMemory(params) {
|
|
31
|
-
const action = resolveFeedbackAction({
|
|
32
|
-
signal: params.signal,
|
|
33
|
-
context: params.context || '',
|
|
34
|
-
whatWentWrong: params.whatWentWrong,
|
|
35
|
-
whatToChange: params.whatToChange,
|
|
36
|
-
whatWorked: params.whatWorked,
|
|
37
|
-
tags: params.tags || [],
|
|
38
|
-
});
|
|
39
|
-
|
|
40
|
-
if (!action || action.type === 'no-action') {
|
|
41
|
-
const clarification = buildClarificationMessage({
|
|
42
|
-
signal: params.signal,
|
|
43
|
-
context: params.context || '',
|
|
44
|
-
whatWentWrong: params.whatWentWrong,
|
|
45
|
-
whatToChange: params.whatToChange,
|
|
46
|
-
whatWorked: params.whatWorked,
|
|
47
|
-
});
|
|
48
|
-
return {
|
|
49
|
-
ok: false,
|
|
50
|
-
reason: action ? action.reason : 'Unknown action resolution failure',
|
|
51
|
-
...(clarification || {}),
|
|
52
|
-
};
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
const prep = prepareForStorage(action.memory);
|
|
56
|
-
if (!prep.ok) {
|
|
57
|
-
return { ok: false, reason: `Schema validation failed: ${prep.issues.join('; ')}`, issues: prep.issues };
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
return { ok: true, actionType: action.type, memory: prep.memory };
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
// ---------------------------------------------------------------------------
|
|
64
|
-
// CLI: stdin mode
|
|
65
|
-
// ---------------------------------------------------------------------------
|
|
66
|
-
|
|
67
|
-
function runStdin() {
|
|
68
|
-
let input = '';
|
|
69
|
-
process.stdin.setEncoding('utf-8');
|
|
70
|
-
process.stdin.on('data', (chunk) => { input += chunk; });
|
|
71
|
-
process.stdin.on('end', () => {
|
|
72
|
-
try {
|
|
73
|
-
const params = JSON.parse(input.trim());
|
|
74
|
-
const result = convertFeedbackToMemory(params);
|
|
75
|
-
process.stdout.write(JSON.stringify(result, null, 2) + '\n');
|
|
76
|
-
process.exit(result.ok ? 0 : 2);
|
|
77
|
-
} catch (err) {
|
|
78
|
-
process.stdout.write(JSON.stringify({ ok: false, reason: `Parse error: ${err.message}` }, null, 2) + '\n');
|
|
79
|
-
process.exit(1);
|
|
80
|
-
}
|
|
81
|
-
});
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
// ---------------------------------------------------------------------------
|
|
85
|
-
// Built-in Tests
|
|
86
|
-
// ---------------------------------------------------------------------------
|
|
87
|
-
|
|
88
|
-
function runTests() {
|
|
89
|
-
let passed = 0;
|
|
90
|
-
let failed = 0;
|
|
91
|
-
|
|
92
|
-
function assert(condition, name) {
|
|
93
|
-
if (condition) {
|
|
94
|
-
passed++;
|
|
95
|
-
console.log(` ✅ ${name}`);
|
|
96
|
-
} else {
|
|
97
|
-
failed++;
|
|
98
|
-
console.log(` ❌ ${name}`);
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
console.log('\n🧪 feedback-to-memory.js — Tests\n');
|
|
103
|
-
|
|
104
|
-
// Valid negative feedback → memory
|
|
105
|
-
const neg = convertFeedbackToMemory({
|
|
106
|
-
signal: 'negative',
|
|
107
|
-
context: 'Agent claimed fix without test evidence',
|
|
108
|
-
whatWentWrong: 'No tests were run before claiming the bug was fixed',
|
|
109
|
-
whatToChange: 'Always run tests and show output before claiming done',
|
|
110
|
-
tags: ['verification', 'testing'],
|
|
111
|
-
});
|
|
112
|
-
assert(neg.ok === true, 'valid negative → ok');
|
|
113
|
-
assert(neg.actionType === 'store-mistake', 'negative → store-mistake');
|
|
114
|
-
assert(neg.memory.title.startsWith('MISTAKE:'), 'negative → MISTAKE: prefix');
|
|
115
|
-
assert(neg.memory.category === 'error', 'negative → error category');
|
|
116
|
-
assert(neg.memory.tags.includes('verification'), 'preserves domain tags');
|
|
117
|
-
|
|
118
|
-
// Valid positive feedback → memory
|
|
119
|
-
const pos = convertFeedbackToMemory({
|
|
120
|
-
signal: 'positive',
|
|
121
|
-
whatWorked: 'Built schema-validated feedback system with prevention rules',
|
|
122
|
-
tags: ['architecture', 'thumbgate'],
|
|
123
|
-
});
|
|
124
|
-
assert(pos.ok === true, 'valid positive → ok');
|
|
125
|
-
assert(pos.actionType === 'store-learning', 'positive → store-learning');
|
|
126
|
-
assert(pos.memory.title.startsWith('SUCCESS:'), 'positive → SUCCESS: prefix');
|
|
127
|
-
assert(pos.memory.category === 'learning', 'positive → learning category');
|
|
128
|
-
|
|
129
|
-
const inferredPos = convertFeedbackToMemory({
|
|
130
|
-
signal: 'positive',
|
|
131
|
-
context: 'ThumbGate automation and Claude statusline repair',
|
|
132
|
-
whatWorked: 'Verified the live ThumbGate version and fixed the stale Claude statusline wiring',
|
|
133
|
-
});
|
|
134
|
-
assert(inferredPos.ok === true, 'specific positive without tags → ok');
|
|
135
|
-
assert(inferredPos.memory.tags.includes('thumbgate'), 'infers a non-generic domain tag');
|
|
136
|
-
|
|
137
|
-
// Bare thumbs down → rejected
|
|
138
|
-
const bare = convertFeedbackToMemory({ signal: 'negative' });
|
|
139
|
-
assert(bare.ok === false, 'bare negative → rejected');
|
|
140
|
-
assert(bare.reason.includes('No context') || bare.reason.includes('cannot'), 'reports missing context');
|
|
141
|
-
|
|
142
|
-
// Bare thumbs up → rejected
|
|
143
|
-
const bareUp = convertFeedbackToMemory({ signal: 'positive' });
|
|
144
|
-
assert(bareUp.ok === false, 'bare positive → rejected');
|
|
145
|
-
|
|
146
|
-
// Unknown signal → rejected
|
|
147
|
-
const unknown = convertFeedbackToMemory({ signal: 'maybe', context: 'test' });
|
|
148
|
-
assert(unknown.ok === false, 'unknown signal → rejected');
|
|
149
|
-
|
|
150
|
-
// Context-only negative → ok
|
|
151
|
-
const ctxNeg = convertFeedbackToMemory({
|
|
152
|
-
signal: 'negative',
|
|
153
|
-
context: 'Showed fake ThumbGate statistics panel to user',
|
|
154
|
-
tags: ['thumbgate'],
|
|
155
|
-
});
|
|
156
|
-
assert(ctxNeg.ok === true, 'context-only negative → ok');
|
|
157
|
-
|
|
158
|
-
// Context-only positive → ok
|
|
159
|
-
const ctxPos = convertFeedbackToMemory({
|
|
160
|
-
signal: 'positive',
|
|
161
|
-
context: 'Ran full test suite and showed green output before responding',
|
|
162
|
-
tags: ['verification'],
|
|
163
|
-
});
|
|
164
|
-
assert(ctxPos.ok === true, 'context-only positive → ok');
|
|
165
|
-
|
|
166
|
-
console.log(`\n${'═'.repeat(50)}`);
|
|
167
|
-
console.log(`Results: ${passed} passed, ${failed} failed, ${passed + failed} total`);
|
|
168
|
-
console.log(`${'═'.repeat(50)}\n`);
|
|
169
|
-
|
|
170
|
-
process.exit(failed > 0 ? 1 : 0);
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
// ---------------------------------------------------------------------------
|
|
174
|
-
// Exports & main
|
|
175
|
-
// ---------------------------------------------------------------------------
|
|
176
|
-
|
|
177
|
-
module.exports = { convertFeedbackToMemory };
|
|
178
|
-
|
|
179
|
-
if (require.main === module) {
|
|
180
|
-
if (process.argv.includes('--test')) {
|
|
181
|
-
runTests();
|
|
182
|
-
} else {
|
|
183
|
-
runStdin();
|
|
184
|
-
}
|
|
185
|
-
}
|
package/scripts/gate-satisfy.js
DELETED
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
'use strict';
|
|
3
|
-
|
|
4
|
-
const { satisfyCondition } = require('./gates-engine');
|
|
5
|
-
|
|
6
|
-
function run() {
|
|
7
|
-
const args = process.argv.slice(2);
|
|
8
|
-
let gateId = null;
|
|
9
|
-
let evidence = '';
|
|
10
|
-
|
|
11
|
-
for (let i = 0; i < args.length; i++) {
|
|
12
|
-
if (args[i] === '--gate' && args[i + 1]) {
|
|
13
|
-
gateId = args[i + 1];
|
|
14
|
-
i++;
|
|
15
|
-
} else if (args[i] === '--evidence' && args[i + 1]) {
|
|
16
|
-
evidence = args[i + 1];
|
|
17
|
-
i++;
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
if (!gateId) {
|
|
22
|
-
process.stderr.write('Usage: node scripts/gate-satisfy.js --gate <gate-id> [--evidence "<text>"]\n');
|
|
23
|
-
process.exit(1);
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
const entry = satisfyCondition(gateId, evidence);
|
|
27
|
-
const output = { gate: gateId, satisfied: true, timestamp: entry.timestamp, evidence: entry.evidence };
|
|
28
|
-
process.stdout.write(JSON.stringify(output, null, 2) + '\n');
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
// Export for MCP tool usage
|
|
32
|
-
function satisfyGate(gateId, evidence) {
|
|
33
|
-
if (!gateId) throw new Error('gate ID is required');
|
|
34
|
-
const entry = satisfyCondition(gateId, evidence || '');
|
|
35
|
-
return { gate: gateId, satisfied: true, timestamp: entry.timestamp, evidence: entry.evidence };
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
module.exports = { satisfyGate };
|
|
39
|
-
|
|
40
|
-
if (require.main === module) {
|
|
41
|
-
run();
|
|
42
|
-
}
|