thumbgate 1.4.2 → 1.4.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude-plugin/README.md +45 -34
- package/.claude-plugin/marketplace.json +3 -3
- package/.claude-plugin/plugin.json +3 -3
- package/.well-known/llms.txt +1 -1
- package/.well-known/mcp/server-card.json +1 -1
- package/README.md +26 -2
- package/adapters/README.md +4 -1
- package/adapters/claude/.mcp.json +2 -2
- package/adapters/codex/config.toml +2 -2
- package/adapters/mcp/server-stdio.js +10 -4
- package/adapters/opencode/opencode.json +1 -1
- package/bin/cli.js +246 -90
- package/config/mcp-allowlists.json +11 -3
- package/package.json +184 -21
- package/scripts/audit-trail.js +25 -15
- package/scripts/auto-wire-hooks.js +127 -0
- package/scripts/cli-demo.js +102 -0
- package/scripts/cli-schema.js +285 -0
- package/scripts/cli-status.js +166 -0
- package/scripts/cross-encoder-reranker.js +235 -0
- package/scripts/explore-subcommands.js +277 -0
- package/scripts/explore.js +569 -0
- package/scripts/feedback-loop.js +20 -6
- package/scripts/lesson-inference.js +7 -1
- package/scripts/lesson-reranker.js +263 -0
- package/scripts/lesson-retrieval.js +34 -17
- package/scripts/lesson-search.js +69 -0
- package/scripts/perplexity-client.js +210 -0
- package/scripts/reflector-agent.js +2 -2
- package/scripts/statusline-local-stats.js +3 -1
- package/scripts/statusline.sh +12 -11
- package/src/api/server.js +178 -17
- 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 -138
- 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 -1128
- 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 -140
- 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 -142
- 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-marketing.js +0 -466
- 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 -326
- 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 -331
- 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/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/analytics.sqlite +0 -0
- package/scripts/social-analytics/db/schema.sql +0 -32
- 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 -97
- 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/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 -539
- 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_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
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "thumbgate",
|
|
3
|
-
"version": "1.4.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "1.4.4",
|
|
4
|
+
"description": "Self-improving agent governance: type thumbs-up or thumbs-down on any AI agent action. ThumbGate turns every mistake into a prevention rule and blocks the pattern from repeating. One thumbs-down, never again. 33 pre-action gates, budget enforcement, and self-protection for Claude Code, Cursor, Codex, Gemini CLI, and Amp.",
|
|
5
5
|
"homepage": "https://thumbgate-production.up.railway.app",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
@@ -10,24 +10,172 @@
|
|
|
10
10
|
"bugs": {
|
|
11
11
|
"url": "https://github.com/IgorGanapolsky/ThumbGate/issues"
|
|
12
12
|
},
|
|
13
|
-
"main": "
|
|
13
|
+
"main": "src/index.js",
|
|
14
14
|
"bin": {
|
|
15
15
|
"thumbgate": "bin/cli.js"
|
|
16
16
|
},
|
|
17
17
|
"files": [
|
|
18
|
-
"bin/",
|
|
18
|
+
"bin/cli.js",
|
|
19
|
+
"bin/postinstall.js",
|
|
19
20
|
"src/",
|
|
20
|
-
"
|
|
21
|
-
"adapters/",
|
|
21
|
+
"adapters/mcp/server-stdio.js",
|
|
22
|
+
"adapters/chatgpt/openapi.yaml",
|
|
23
|
+
"adapters/gemini/function-declarations.json",
|
|
24
|
+
"adapters/claude/.mcp.json",
|
|
25
|
+
"adapters/codex/config.toml",
|
|
26
|
+
"adapters/opencode/opencode.json",
|
|
27
|
+
"adapters/amp/skills/thumbgate-feedback/SKILL.md",
|
|
28
|
+
"adapters/forge/forge.yaml",
|
|
22
29
|
"config/",
|
|
23
|
-
"plugins/",
|
|
24
30
|
"skills/",
|
|
25
31
|
"openapi/",
|
|
26
|
-
"public/",
|
|
27
32
|
".well-known/",
|
|
28
|
-
".claude-plugin/",
|
|
33
|
+
".claude-plugin/plugin.json",
|
|
34
|
+
".claude-plugin/marketplace.json",
|
|
35
|
+
".claude-plugin/README.md",
|
|
29
36
|
"README.md",
|
|
30
|
-
"LICENSE"
|
|
37
|
+
"LICENSE",
|
|
38
|
+
"scripts/agent-readiness.js",
|
|
39
|
+
"scripts/access-anomaly-detector.js",
|
|
40
|
+
"scripts/agentic-data-pipeline.js",
|
|
41
|
+
"scripts/analytics-report.js",
|
|
42
|
+
"scripts/analytics-window.js",
|
|
43
|
+
"scripts/async-job-runner.js",
|
|
44
|
+
"scripts/audit-trail.js",
|
|
45
|
+
"scripts/auto-promote-gates.js",
|
|
46
|
+
"scripts/auto-wire-hooks.js",
|
|
47
|
+
"scripts/belief-update.js",
|
|
48
|
+
"scripts/billing-setup.js",
|
|
49
|
+
"scripts/billing.js",
|
|
50
|
+
"scripts/bot-detector.js",
|
|
51
|
+
"scripts/build-metadata.js",
|
|
52
|
+
"scripts/claude-feedback-sync.js",
|
|
53
|
+
"scripts/cli-demo.js",
|
|
54
|
+
"scripts/cli-feedback.js",
|
|
55
|
+
"scripts/cli-schema.js",
|
|
56
|
+
"scripts/cli-status.js",
|
|
57
|
+
"scripts/cli-telemetry.js",
|
|
58
|
+
"scripts/cloudflare-dynamic-sandbox.js",
|
|
59
|
+
"scripts/code-reasoning.js",
|
|
60
|
+
"scripts/codegraph-context.js",
|
|
61
|
+
"scripts/commercial-offer.js",
|
|
62
|
+
"scripts/context-manager.js",
|
|
63
|
+
"scripts/contextfs.js",
|
|
64
|
+
"scripts/conversation-context.js",
|
|
65
|
+
"scripts/creator-campaigns.js",
|
|
66
|
+
"scripts/cross-encoder-reranker.js",
|
|
67
|
+
"scripts/daemon-manager.js",
|
|
68
|
+
"scripts/dashboard-render-spec.js",
|
|
69
|
+
"scripts/dashboard.js",
|
|
70
|
+
"scripts/decision-journal.js",
|
|
71
|
+
"scripts/delegation-runtime.js",
|
|
72
|
+
"scripts/dispatch-brief.js",
|
|
73
|
+
"scripts/distribution-surfaces.js",
|
|
74
|
+
"scripts/docker-sandbox-planner.js",
|
|
75
|
+
"scripts/document-intake.js",
|
|
76
|
+
"scripts/evolution-state.js",
|
|
77
|
+
"scripts/experiment-tracker.js",
|
|
78
|
+
"scripts/explore-subcommands.js",
|
|
79
|
+
"scripts/explore.js",
|
|
80
|
+
"scripts/export-databricks-bundle.js",
|
|
81
|
+
"scripts/export-dpo-pairs.js",
|
|
82
|
+
"scripts/export-hf-dataset.js",
|
|
83
|
+
"scripts/failure-diagnostics.js",
|
|
84
|
+
"scripts/feedback-attribution.js",
|
|
85
|
+
"scripts/feedback-history-distiller.js",
|
|
86
|
+
"scripts/feedback-loop.js",
|
|
87
|
+
"scripts/feedback-paths.js",
|
|
88
|
+
"scripts/feedback-quality.js",
|
|
89
|
+
"scripts/feedback-schema.js",
|
|
90
|
+
"scripts/feedback-session.js",
|
|
91
|
+
"scripts/feedback-to-rules.js",
|
|
92
|
+
"scripts/filesystem-search.js",
|
|
93
|
+
"scripts/fs-utils.js",
|
|
94
|
+
"scripts/funnel-analytics.js",
|
|
95
|
+
"scripts/gate-stats.js",
|
|
96
|
+
"scripts/gate-templates.js",
|
|
97
|
+
"scripts/gates-engine.js",
|
|
98
|
+
"scripts/harness-selector.js",
|
|
99
|
+
"scripts/history-distiller.js",
|
|
100
|
+
"scripts/hook-runtime.js",
|
|
101
|
+
"scripts/hook-thumbgate-cache-updater.js",
|
|
102
|
+
"scripts/hosted-config.js",
|
|
103
|
+
"scripts/hosted-job-launcher.js",
|
|
104
|
+
"scripts/hybrid-feedback-context.js",
|
|
105
|
+
"scripts/install-mcp.js",
|
|
106
|
+
"scripts/intent-router.js",
|
|
107
|
+
"scripts/internal-agent-bootstrap.js",
|
|
108
|
+
"scripts/intervention-policy.js",
|
|
109
|
+
"scripts/jsonl-watcher.js",
|
|
110
|
+
"scripts/lesson-db.js",
|
|
111
|
+
"scripts/lesson-inference.js",
|
|
112
|
+
"scripts/lesson-reranker.js",
|
|
113
|
+
"scripts/lesson-retrieval.js",
|
|
114
|
+
"scripts/lesson-rotation.js",
|
|
115
|
+
"scripts/lesson-search.js",
|
|
116
|
+
"scripts/lesson-synthesis.js",
|
|
117
|
+
"scripts/license.js",
|
|
118
|
+
"scripts/llm-client.js",
|
|
119
|
+
"scripts/local-model-profile.js",
|
|
120
|
+
"scripts/managed-lesson-agent.js",
|
|
121
|
+
"scripts/mcp-config.js",
|
|
122
|
+
"scripts/mcp-policy.js",
|
|
123
|
+
"scripts/memory-firewall.js",
|
|
124
|
+
"scripts/meta-agent-loop.js",
|
|
125
|
+
"scripts/natural-language-harness.js",
|
|
126
|
+
"scripts/obsidian-export.js",
|
|
127
|
+
"scripts/operational-dashboard.js",
|
|
128
|
+
"scripts/operational-integrity.js",
|
|
129
|
+
"scripts/operational-summary.js",
|
|
130
|
+
"scripts/optimize-context.js",
|
|
131
|
+
"scripts/org-dashboard.js",
|
|
132
|
+
"scripts/partner-orchestration.js",
|
|
133
|
+
"scripts/perplexity-client.js",
|
|
134
|
+
"scripts/predictive-insights.js",
|
|
135
|
+
"scripts/pro-local-dashboard.js",
|
|
136
|
+
"scripts/problem-detail.js",
|
|
137
|
+
"scripts/product-feedback.js",
|
|
138
|
+
"scripts/profile-router.js",
|
|
139
|
+
"scripts/prompt-guard.js",
|
|
140
|
+
"scripts/published-cli.js",
|
|
141
|
+
"scripts/pulse.js",
|
|
142
|
+
"scripts/rate-limiter.js",
|
|
143
|
+
"scripts/reflector-agent.js",
|
|
144
|
+
"scripts/risk-scorer.js",
|
|
145
|
+
"scripts/rlaif-self-audit.js",
|
|
146
|
+
"scripts/rubric-engine.js",
|
|
147
|
+
"scripts/secret-scanner.js",
|
|
148
|
+
"scripts/security-scanner.js",
|
|
149
|
+
"scripts/self-distill-agent.js",
|
|
150
|
+
"scripts/self-heal.js",
|
|
151
|
+
"scripts/semantic-dedup.js",
|
|
152
|
+
"scripts/semantic-layer.js",
|
|
153
|
+
"scripts/seo-gsd.js",
|
|
154
|
+
"scripts/settings-hierarchy.js",
|
|
155
|
+
"scripts/skill-generator.js",
|
|
156
|
+
"scripts/slo-alert-engine.js",
|
|
157
|
+
"scripts/statusline-cache-path.js",
|
|
158
|
+
"scripts/statusline-lesson.js",
|
|
159
|
+
"scripts/statusline-links.js",
|
|
160
|
+
"scripts/statusline-local-stats.js",
|
|
161
|
+
"scripts/statusline-meta.js",
|
|
162
|
+
"scripts/statusline.sh",
|
|
163
|
+
"scripts/statusline-tower.js",
|
|
164
|
+
"scripts/telemetry-analytics.js",
|
|
165
|
+
"scripts/thompson-sampling.js",
|
|
166
|
+
"scripts/thumbgate-search.js",
|
|
167
|
+
"scripts/tool-registry.js",
|
|
168
|
+
"scripts/tool-kpi-tracker.js",
|
|
169
|
+
"scripts/user-profile.js",
|
|
170
|
+
"scripts/validate-workflow-contract.js",
|
|
171
|
+
"scripts/vector-store.js",
|
|
172
|
+
"scripts/verification-loop.js",
|
|
173
|
+
"scripts/webhook-delivery.js",
|
|
174
|
+
"scripts/workflow-runs.js",
|
|
175
|
+
"scripts/workflow-sentinel.js",
|
|
176
|
+
"scripts/workflow-sprint-intake.js",
|
|
177
|
+
"scripts/workspace-evolver.js",
|
|
178
|
+
"scripts/xmemory-lite.js"
|
|
31
179
|
],
|
|
32
180
|
"scripts": {
|
|
33
181
|
"postinstall": "node bin/postinstall.js || true",
|
|
@@ -72,7 +220,7 @@
|
|
|
72
220
|
"social:post-everywhere:dry": "node scripts/post-everywhere.js --dry-run",
|
|
73
221
|
"social:reply-monitor": "node scripts/social-reply-monitor.js",
|
|
74
222
|
"social:reply-monitor:dry": "node scripts/social-reply-monitor.js --dry-run",
|
|
75
|
-
"test": "npm run test:schema && npm run test:loop && npm run test:dpo && npm run test:kto && npm run test:api && npm run test:proof && npm run test:e2e && npm run test:rlaif && npm run test:attribution && npm run test:quality && npm run test:intelligence && npm run test:training-export && npm run test:deployment && npm run test:operational-integrity && npm run test:workflow && npm run test:billing && npm run test:cli && npm run test:watcher && npm run test:autoresearch && npm run test:ops && npm run test:tessl && npm run test:gates && npm run test:evoskill && npm run test:gates-hardening && npm run test:workers && npm run test:social-analytics && npm run test:memalign && npm run test:xmemory-lite && npm run test:filesystem-search && npm run test:zernio && npm run test:obsidian-export && npm run test:lesson-db && npm run test:lesson-rotation && npm run test:memory-dedup && npm run test:feedback-quality && npm run test:sync-version && npm run test:check-congruence && npm run test:tool-registry && npm run test:feedback-to-rules && npm run test:memory-firewall && npm run test:belief-update && npm run test:hosted-config && npm run test:operational-summary && npm run test:cloudflare-sandbox && npm run test:mcp-config && npm run test:plan-gate && npm run test:pulse && npm run test:semantic-layer && npm run test:data-pipeline && npm run test:optimize-context && npm run test:principle-extractor && npm run test:analytics-window && npm run test:funnel-analytics && npm run test:experiment-tracker && npm run test:build-metadata && npm run test:context-engine && npm run test:hf-papers && npm run test:marketing-experiment && npm run test:seo-gsd && npm run test:verify-run && npm run test:export-dpo-pairs && npm run test:export-hf-dataset && npm run test:license && npm run test:bot-detector && npm run test:postinstall && npm run test:funnel-invariants && npm run test:cli-telemetry && npm run test:pro-parity && npm run test:model-tier-router && npm run test:computer-use-firewall && npm run test:skill-exporter && npm run test:statusline && npm run test:evolution && npm run test:org-dashboard && npm run test:multi-hop-recall && npm run test:synthetic-dpo && npm run test:thumbgate-skill && npm run test:learn-hub && npm run test:feedback-fallback && npm run test:metaclaw && npm run test:server-lock && npm run test:control-tower && npm run test:pii-scanner && npm run test:data-governance && npm run test:lesson-inference && npm run test:semantic-dedup && npm run test:fs-utils && npm run test:lesson-retrieval && npm run test:reflector-agent && npm run test:feedback-session && npm run test:feedback-history-distiller && npm run test:hallucination-detector && npm run test:history-distiller && npm run test:predictive-insights && npm run test:prove-predictive-insights && npm run test:statusbar-cli && npm run test:generate-instagram-card && npm run test:instagram-thumbgate-post && npm run test:publish-instagram-thumbgate && npm run test:lesson-synthesis && npm run test:background-governance && npm run test:memory-migration && npm run test:prompt-dlp && npm run test:ephemeral-store && npm run test:agent-security && npm run test:skill-progressive && npm run test:per-step-scoring && npm run test:weekly-auto-post && npm run test:social-post-hourly && npm run test:social-quality-gate && npm run test:a2ui-engine && npm run test:gate-satisfy && npm run test:money-watcher && npm run test:budget && npm run test:quick-start && npm run test:utm && npm run test:product-feedback && npm run test:feedback-root-consolidator && npm run test:engagement-audit && npm run test:install-growth-automation && npm run test:publish-thumbgate-launch && npm run test:reconcile-thumbgate-campaign && npm run test:reddit-publisher && npm run test:schedule-thumbgate-campaign && npm run test:social-reply-monitor && npm run test:sync-launch-assets && npm run test:ai-search-visibility && npm run test:security-scanner && npm run test:llm-client && npm run test:managed-lesson-agent && npm run test:self-distill && npm run test:meta-agent && npm run test:harness-selector && npm run test:seo-guides && npm run test:enforcement-loop",
|
|
223
|
+
"test": "npm run test:schema && npm run test:loop && npm run test:dpo && npm run test:kto && npm run test:api && npm run test:proof && npm run test:e2e && npm run test:rlaif && npm run test:attribution && npm run test:quality && npm run test:intelligence && npm run test:training-export && npm run test:deployment && npm run test:operational-integrity && npm run test:workflow && npm run test:billing && npm run test:cli && npm run test:watcher && npm run test:autoresearch && npm run test:ops && npm run test:session-analyzer && npm run test:tessl && npm run test:gates && npm run test:evoskill && npm run test:gates-hardening && npm run test:workers && npm run test:social-analytics && npm run test:memalign && npm run test:xmemory-lite && npm run test:filesystem-search && npm run test:zernio && npm run test:obsidian-export && npm run test:lesson-db && npm run test:lesson-rotation && npm run test:memory-dedup && npm run test:feedback-quality && npm run test:sync-version && npm run test:check-congruence && npm run test:tool-registry && npm run test:feedback-to-rules && npm run test:memory-firewall && npm run test:belief-update && npm run test:hosted-config && npm run test:operational-summary && npm run test:operator-key-auth && npm run test:cloudflare-sandbox && npm run test:mcp-config && npm run test:plan-gate && npm run test:pulse && npm run test:semantic-layer && npm run test:data-pipeline && npm run test:optimize-context && npm run test:principle-extractor && npm run test:analytics-window && npm run test:funnel-analytics && npm run test:experiment-tracker && npm run test:build-metadata && npm run test:context-engine && npm run test:hf-papers && npm run test:marketing-experiment && npm run test:seo-gsd && npm run test:verify-run && npm run test:export-dpo-pairs && npm run test:export-hf-dataset && npm run test:license && npm run test:bot-detector && npm run test:postinstall && npm run test:funnel-invariants && npm run test:cli-telemetry && npm run test:pro-parity && npm run test:model-tier-router && npm run test:computer-use-firewall && npm run test:skill-exporter && npm run test:statusline && npm run test:evolution && npm run test:org-dashboard && npm run test:multi-hop-recall && npm run test:synthetic-dpo && npm run test:thumbgate-skill && npm run test:learn-hub && npm run test:feedback-fallback && npm run test:metaclaw && npm run test:server-lock && npm run test:control-tower && npm run test:pii-scanner && npm run test:data-governance && npm run test:lesson-inference && npm run test:semantic-dedup && npm run test:fs-utils && npm run test:cli-schema && npm run test:explore && npm run test:lesson-reranker && npm run test:lesson-retrieval && npm run test:cross-encoder && npm run test:reflector-agent && npm run test:feedback-session && npm run test:feedback-history-distiller && npm run test:hallucination-detector && npm run test:history-distiller && npm run test:predictive-insights && npm run test:prove-predictive-insights && npm run test:statusbar-cli && npm run test:generate-instagram-card && npm run test:instagram-thumbgate-post && npm run test:publish-instagram-thumbgate && npm run test:lesson-synthesis && npm run test:background-governance && npm run test:memory-migration && npm run test:prompt-dlp && npm run test:ephemeral-store && npm run test:agent-security && npm run test:skill-progressive && npm run test:per-step-scoring && npm run test:weekly-auto-post && npm run test:social-post-hourly && npm run test:social-quality-gate && npm run test:a2ui-engine && npm run test:gate-satisfy && npm run test:money-watcher && npm run test:budget && npm run test:quick-start && npm run test:utm && npm run test:product-feedback && npm run test:feedback-root-consolidator && npm run test:engagement-audit && npm run test:install-growth-automation && npm run test:publish-thumbgate-launch && npm run test:reconcile-thumbgate-campaign && npm run test:reddit-publisher && npm run test:schedule-thumbgate-campaign && npm run test:social-reply-monitor && npm run test:sync-launch-assets && npm run test:ai-search-visibility && npm run test:perplexity && npm run test:security-scanner && npm run test:llm-client && npm run test:managed-lesson-agent && npm run test:self-distill && npm run test:meta-agent && npm run test:harness-selector && npm run test:thumbgate-bench && npm run test:seo-guides && npm run test:enforcement-loop && npm run test:cli-agent-experience",
|
|
76
224
|
"test:feedback-fallback": "node --test tests/feedback-fallback.test.js",
|
|
77
225
|
"test:metaclaw": "node --test tests/metaclaw-features.test.js",
|
|
78
226
|
"test:server-lock": "node --test tests/server-stdio-lock.test.js",
|
|
@@ -94,6 +242,7 @@
|
|
|
94
242
|
"test:belief-update": "node --test tests/belief-update.test.js",
|
|
95
243
|
"test:hosted-config": "node --test tests/hosted-config.test.js",
|
|
96
244
|
"test:operational-summary": "node --test tests/operational-summary.test.js",
|
|
245
|
+
"test:operator-key-auth": "node --test tests/api-operator-key-auth.test.js",
|
|
97
246
|
"test:cloudflare-sandbox": "node --test tests/cloudflare-dynamic-sandbox.test.js tests/cloudflare-sandbox-api.test.js",
|
|
98
247
|
"test:mcp-config": "node --test tests/mcp-config.test.js",
|
|
99
248
|
"test:plan-gate": "node --test tests/plan-gate.test.js",
|
|
@@ -132,15 +281,16 @@
|
|
|
132
281
|
"test:quality": "node --test tests/validate-feedback.test.js",
|
|
133
282
|
"test:intelligence": "node --test tests/intelligence.test.js",
|
|
134
283
|
"test:training-export": "node --test tests/training-export.test.js tests/databricks-export.test.js",
|
|
135
|
-
"test:deployment": "node --test tests/deployment.test.js tests/deploy-policy.test.js tests/publish-decision.test.js tests/changeset-check.test.js tests/sonarcloud-workflow.test.js",
|
|
284
|
+
"test:deployment": "node --test tests/deployment.test.js tests/deploy-policy.test.js tests/publish-decision.test.js tests/changeset-check.test.js tests/sonarcloud-workflow.test.js tests/package-boundary.test.js",
|
|
136
285
|
"test:operational-integrity": "node --test tests/operational-integrity.test.js tests/sync-branch-protection.test.js",
|
|
137
|
-
"test:workflow": "node --test tests/workflow-contract.test.js tests/social-marketing-assets.test.js tests/social-pipeline.test.js tests/positioning-contract.test.js tests/docs-claim-hygiene.test.js tests/workflow-runs.test.js tests/workflow-sprint-intake.test.js tests/gtm-revenue-loop.test.js tests/enterprise-story.test.js tests/ralph-loop.test.js",
|
|
286
|
+
"test:workflow": "node --test tests/workflow-contract.test.js tests/social-marketing-assets.test.js tests/social-pipeline.test.js tests/positioning-contract.test.js tests/docs-claim-hygiene.test.js tests/workflow-runs.test.js tests/workflow-sprint-intake.test.js tests/gtm-revenue-loop.test.js tests/enterprise-story.test.js tests/ralph-loop.test.js tests/ralph-mode-ci.test.js",
|
|
138
287
|
"test:billing": "node --test tests/billing.test.js",
|
|
139
288
|
"test:cli": "node --test tests/analytics-report.test.js tests/creator-campaigns.test.js tests/cli.test.js tests/codex-bridge-script.test.js tests/dispatch-brief.test.js tests/feedback-normalize.test.js tests/install-mcp.test.js tests/pr-manager.test.js tests/pro-local-dashboard.test.js tests/published-cli.test.js tests/revenue-status.test.js",
|
|
140
289
|
"test:evolution": "node --test tests/workspace-evolver.test.js",
|
|
141
290
|
"test:watcher": "node --test tests/jsonl-watcher.test.js",
|
|
142
291
|
"test:autoresearch": "node --test tests/autoresearch.test.js",
|
|
143
292
|
"test:ops": "node --test tests/adk-consolidator.test.js tests/anthropic-partner-strategy.test.js tests/auto-promote-gates.test.js tests/auto-wire-hooks.test.js tests/claude-skill.test.js tests/codegraph-context.test.js tests/commercial-signals.test.js tests/decision-journal.test.js tests/delegation-runtime.test.js tests/disagreement-mining.test.js tests/failure-diagnostics.test.js tests/gate-stats.test.js tests/github-billing.test.js tests/intervention-policy.test.js tests/markdown-escape.test.js tests/mcp-tools-gates.test.js tests/project-bayes-e2e.test.js tests/project-bayes.test.js tests/rate-limiter.test.js tests/schedule-manager.test.js tests/session-handoff.test.js tests/skill-generator.test.js tests/smart-learning.test.js tests/spike-and-sink.test.js tests/stripe-webhook-route.test.js tests/stripe-webhook-rotation.test.js tests/train-from-feedback.test.js tests/workflow-hardening-sprint.test.js tests/workflow-sentinel.test.js tests/test-suite-parity.test.js tests/a2ui-engine.test.js tests/webhook-delivery.test.js",
|
|
293
|
+
"test:session-analyzer": "node --test tests/session-analyzer.test.js",
|
|
144
294
|
"test:tessl": "node --test tests/tessl-export.test.js",
|
|
145
295
|
"test:gates": "node --test tests/gate-templates.test.js tests/gates-engine.test.js tests/claim-verification.test.js tests/secret-scanner.test.js tests/prompt-guard.test.js tests/audit-trail.test.js tests/profile-router.test.js tests/workflow-sentinel.test.js tests/docker-sandbox-planner.test.js",
|
|
146
296
|
"test:budget": "node --test tests/budget-enforcer.test.js",
|
|
@@ -206,6 +356,7 @@
|
|
|
206
356
|
"test:data-governance": "node --test tests/data-governance.test.js",
|
|
207
357
|
"test:lesson-inference": "node --test tests/conversation-context.test.js tests/lesson-inference.test.js",
|
|
208
358
|
"test:lesson-retrieval": "node --test tests/lesson-retrieval.test.js",
|
|
359
|
+
"test:cross-encoder": "node --test tests/cross-encoder-reranker.test.js",
|
|
209
360
|
"test:reflector-agent": "node --test tests/reflector-agent.test.js",
|
|
210
361
|
"test:feedback-session": "node --test tests/feedback-session.test.js",
|
|
211
362
|
"test:feedback-history-distiller": "node --test tests/feedback-history-distiller.test.js",
|
|
@@ -269,7 +420,19 @@
|
|
|
269
420
|
"test:meta-agent": "node --test tests/meta-agent-loop.test.js",
|
|
270
421
|
"test:semantic-dedup": "node --test tests/semantic-dedup.test.js",
|
|
271
422
|
"test:fs-utils": "node --test tests/fs-utils.test.js",
|
|
272
|
-
"test:
|
|
423
|
+
"test:lesson-reranker": "node --test tests/lesson-reranker.test.js",
|
|
424
|
+
"test:harness-selector": "node --test tests/harness-selector.test.js",
|
|
425
|
+
"test:thumbgate-bench": "node --test tests/thumbgate-bench.test.js",
|
|
426
|
+
"thumbgate:bench": "node scripts/thumbgate-bench.js",
|
|
427
|
+
"test:perplexity": "node --test tests/perplexity-client.test.js tests/perplexity-command-center.test.js tests/perplexity-adapter.test.js",
|
|
428
|
+
"perplexity:visibility": "node scripts/perplexity-command-center.js visibility",
|
|
429
|
+
"perplexity:leads": "node scripts/perplexity-command-center.js leads",
|
|
430
|
+
"perplexity:brief": "node scripts/perplexity-command-center.js brief",
|
|
431
|
+
"perplexity:full": "node scripts/perplexity-command-center.js full",
|
|
432
|
+
"perplexity:mcp-config": "node scripts/perplexity-command-center.js mcp-config",
|
|
433
|
+
"test:explore": "node --test tests/explore.test.js",
|
|
434
|
+
"test:cli-schema": "node --test tests/cli-schema.test.js",
|
|
435
|
+
"test:cli-agent-experience": "node --test tests/cli-agent-experience.test.js"
|
|
273
436
|
},
|
|
274
437
|
"keywords": [
|
|
275
438
|
"mcp",
|
|
@@ -324,15 +487,15 @@
|
|
|
324
487
|
"node": ">=18.18.0"
|
|
325
488
|
},
|
|
326
489
|
"dependencies": {
|
|
327
|
-
"@anthropic-ai/sdk": "^0.
|
|
328
|
-
"@google/genai": "^1.
|
|
490
|
+
"@anthropic-ai/sdk": "^0.88.0",
|
|
491
|
+
"@google/genai": "^1.49.0",
|
|
329
492
|
"@huggingface/transformers": "^4.0.1",
|
|
330
493
|
"@lancedb/lancedb": "^0.27.2",
|
|
331
494
|
"apache-arrow": "^18.1.0",
|
|
332
|
-
"better-sqlite3": "^12.
|
|
333
|
-
"dotenv": "^17.4.
|
|
495
|
+
"better-sqlite3": "^12.9.0",
|
|
496
|
+
"dotenv": "^17.4.2",
|
|
334
497
|
"playwright-core": "^1.59.1",
|
|
335
|
-
"stripe": "^22.0.
|
|
498
|
+
"stripe": "^22.0.1"
|
|
336
499
|
},
|
|
337
500
|
"overrides": {
|
|
338
501
|
"express@4.22.1": {
|
|
@@ -341,9 +504,9 @@
|
|
|
341
504
|
},
|
|
342
505
|
"mcpName": "io.github.IgorGanapolsky/thumbgate",
|
|
343
506
|
"devDependencies": {
|
|
344
|
-
"@changesets/changelog-github": "^0.
|
|
507
|
+
"@changesets/changelog-github": "^0.6.0",
|
|
345
508
|
"@changesets/cli": "^2.30.0",
|
|
346
509
|
"c8": "^11.0.0",
|
|
347
|
-
"undici": "^8.0
|
|
510
|
+
"undici": "^8.1.0"
|
|
348
511
|
}
|
|
349
512
|
}
|
package/scripts/audit-trail.js
CHANGED
|
@@ -12,10 +12,12 @@
|
|
|
12
12
|
|
|
13
13
|
const fs = require('fs');
|
|
14
14
|
const path = require('path');
|
|
15
|
+
const crypto = require('crypto');
|
|
15
16
|
const { resolveFeedbackDir } = require('./feedback-paths');
|
|
16
17
|
const { ensureDir } = require('./fs-utils');
|
|
17
18
|
|
|
18
19
|
const AUDIT_LOG_FILENAME = 'audit-trail.jsonl';
|
|
20
|
+
const GATE_EVENTS_LOG_FILENAME = 'gate-events-log.jsonl';
|
|
19
21
|
|
|
20
22
|
// ---------------------------------------------------------------------------
|
|
21
23
|
// Paths
|
|
@@ -98,27 +100,34 @@ function sanitizeToolInput(toolInput) {
|
|
|
98
100
|
// ---------------------------------------------------------------------------
|
|
99
101
|
|
|
100
102
|
/**
|
|
101
|
-
* Converts deny/warn audit events into
|
|
102
|
-
*
|
|
103
|
+
* Converts deny/warn audit events into a separate gate-events log.
|
|
104
|
+
*
|
|
105
|
+
* IMPORTANT: Gate denials are NOT user feedback. Writing them to the main
|
|
106
|
+
* feedback-log.jsonl inflated user-facing stats ~18x (1,943 synthetic entries
|
|
107
|
+
* vs ~300 real). Gate events are now logged to gate-events-log.jsonl for
|
|
108
|
+
* internal analytics only — they never pollute thumbs-up/thumbs-down counts.
|
|
103
109
|
*/
|
|
104
110
|
function auditToFeedback(auditRecord) {
|
|
105
111
|
if (auditRecord.decision === 'allow') return null;
|
|
106
112
|
|
|
107
113
|
try {
|
|
108
|
-
const
|
|
109
|
-
const
|
|
110
|
-
const
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
114
|
+
const { getFeedbackPaths } = require('./feedback-paths');
|
|
115
|
+
const { FEEDBACK_DIR } = getFeedbackPaths();
|
|
116
|
+
const gateLogPath = path.join(FEEDBACK_DIR, GATE_EVENTS_LOG_FILENAME);
|
|
117
|
+
ensureDir(path.dirname(gateLogPath));
|
|
118
|
+
const entry = {
|
|
119
|
+
id: `gate_${crypto.randomUUID()}`,
|
|
120
|
+
gateId: auditRecord.gateId,
|
|
121
|
+
decision: auditRecord.decision,
|
|
122
|
+
toolName: auditRecord.toolName,
|
|
123
|
+
message: auditRecord.message || null,
|
|
124
|
+
source: auditRecord.source || null,
|
|
125
|
+
timestamp: new Date().toISOString(),
|
|
126
|
+
};
|
|
127
|
+
fs.appendFileSync(gateLogPath, JSON.stringify(entry) + '\n');
|
|
128
|
+
return entry;
|
|
120
129
|
} catch {
|
|
121
|
-
//
|
|
130
|
+
// Gate event logging failure should never break the audit trail
|
|
122
131
|
return null;
|
|
123
132
|
}
|
|
124
133
|
}
|
|
@@ -316,6 +325,7 @@ module.exports = {
|
|
|
316
325
|
getAuditLogPath,
|
|
317
326
|
sanitizeToolInput,
|
|
318
327
|
AUDIT_LOG_FILENAME,
|
|
328
|
+
GATE_EVENTS_LOG_FILENAME,
|
|
319
329
|
CACHE_TUNE_STATE_FILENAME,
|
|
320
330
|
};
|
|
321
331
|
|
|
@@ -94,6 +94,64 @@ function hookAlreadyPresent(hookArray, command) {
|
|
|
94
94
|
);
|
|
95
95
|
}
|
|
96
96
|
|
|
97
|
+
/**
|
|
98
|
+
* pruneStaleFileHooks — Remove hook entries whose command references a shell
|
|
99
|
+
* script path that no longer exists on disk.
|
|
100
|
+
*
|
|
101
|
+
* Only paths that look like file references (contain a `/` or `\`, or end with
|
|
102
|
+
* `.sh`) are checked. Pure command strings (node calls, npx invocations, etc.)
|
|
103
|
+
* are left untouched.
|
|
104
|
+
*
|
|
105
|
+
* @param {Array} hookArray - The array of hook-entry objects for one lifecycle.
|
|
106
|
+
* @param {string} [baseDir] - Directory used to resolve relative paths
|
|
107
|
+
* (defaults to process.cwd()).
|
|
108
|
+
* @returns {{ hooks: Array, removedPaths: string[] }}
|
|
109
|
+
*/
|
|
110
|
+
function pruneStaleFileHooks(hookArray, baseDir) {
|
|
111
|
+
if (!Array.isArray(hookArray)) {
|
|
112
|
+
return { hooks: [], removedPaths: [] };
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
const resolveBase = baseDir || process.cwd();
|
|
116
|
+
const removedPaths = [];
|
|
117
|
+
|
|
118
|
+
const hooks = hookArray.filter((entry) => {
|
|
119
|
+
const entryHooks = Array.isArray(entry && entry.hooks) ? entry.hooks : [];
|
|
120
|
+
let shouldRemove = false;
|
|
121
|
+
|
|
122
|
+
for (const hook of entryHooks) {
|
|
123
|
+
const command = hook && typeof hook.command === 'string' ? hook.command : '';
|
|
124
|
+
if (!command) continue;
|
|
125
|
+
|
|
126
|
+
// Extract the first token as the potential script path.
|
|
127
|
+
const firstToken = command.split(/\s+/)[0];
|
|
128
|
+
|
|
129
|
+
// Only treat it as a file reference if it looks like a path.
|
|
130
|
+
const looksLikePath =
|
|
131
|
+
firstToken.includes('/') ||
|
|
132
|
+
firstToken.includes('\\') ||
|
|
133
|
+
firstToken.endsWith('.sh');
|
|
134
|
+
|
|
135
|
+
if (!looksLikePath) continue;
|
|
136
|
+
|
|
137
|
+
// Resolve the path (absolute or relative to baseDir).
|
|
138
|
+
const resolved = path.isAbsolute(firstToken)
|
|
139
|
+
? firstToken
|
|
140
|
+
: path.resolve(resolveBase, firstToken);
|
|
141
|
+
|
|
142
|
+
if (!fs.existsSync(resolved)) {
|
|
143
|
+
removedPaths.push(firstToken);
|
|
144
|
+
shouldRemove = true;
|
|
145
|
+
break;
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
return !shouldRemove;
|
|
150
|
+
});
|
|
151
|
+
|
|
152
|
+
return { hooks, removedPaths };
|
|
153
|
+
}
|
|
154
|
+
|
|
97
155
|
function pruneLegacyHookEntries(hookArray, expectedCommand, legacyPattern) {
|
|
98
156
|
if (!Array.isArray(hookArray)) {
|
|
99
157
|
return { hooks: [], removed: false };
|
|
@@ -131,12 +189,78 @@ function syncClaudeStatusLine(settingsPath, desiredStatusLine, dryRun) {
|
|
|
131
189
|
return true;
|
|
132
190
|
}
|
|
133
191
|
|
|
192
|
+
/**
|
|
193
|
+
* claudeProjectSettingsPath — returns the project-level .claude/settings.json
|
|
194
|
+
* path relative to the given base directory (defaults to CWD).
|
|
195
|
+
*/
|
|
196
|
+
function claudeProjectSettingsPath(baseDir) {
|
|
197
|
+
return path.join(baseDir || process.cwd(), '.claude', 'settings.json');
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
/**
|
|
201
|
+
* pruneStaleHooksInFile — reads a settings file, removes any hook entries that
|
|
202
|
+
* reference missing shell script files, and writes the file back if changed.
|
|
203
|
+
*
|
|
204
|
+
* @param {string} filePath - Absolute path to the settings JSON file.
|
|
205
|
+
* @param {string} baseDir - Base directory for resolving relative script paths.
|
|
206
|
+
* @param {boolean} dryRun - When true, changes are computed but not persisted.
|
|
207
|
+
* @returns {{ changed: boolean, removedPaths: string[] }}
|
|
208
|
+
*/
|
|
209
|
+
function pruneStaleHooksInFile(filePath, baseDir, dryRun) {
|
|
210
|
+
const settings = loadJsonFile(filePath);
|
|
211
|
+
if (!settings || !settings.hooks || typeof settings.hooks !== 'object') {
|
|
212
|
+
return { changed: false, removedPaths: [] };
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
const allRemovedPaths = [];
|
|
216
|
+
let changed = false;
|
|
217
|
+
|
|
218
|
+
for (const lifecycle of Object.keys(settings.hooks)) {
|
|
219
|
+
const { hooks, removedPaths } = pruneStaleFileHooks(settings.hooks[lifecycle], baseDir);
|
|
220
|
+
if (removedPaths.length > 0) {
|
|
221
|
+
settings.hooks[lifecycle] = hooks;
|
|
222
|
+
allRemovedPaths.push(...removedPaths);
|
|
223
|
+
changed = true;
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
if (changed && !dryRun) {
|
|
228
|
+
fs.writeFileSync(filePath, JSON.stringify(settings, null, 2) + '\n');
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
return { changed, removedPaths: allRemovedPaths };
|
|
232
|
+
}
|
|
233
|
+
|
|
134
234
|
function wireClaudeHooks(options) {
|
|
135
235
|
const settingsPath = options.settingsPath || claudeSettingsPath();
|
|
136
236
|
const sharedSettingsPath = options.sharedSettingsPath || claudeSharedSettingsPath();
|
|
237
|
+
const projectSettingsPath =
|
|
238
|
+
options.projectSettingsPath || claudeProjectSettingsPath(options.projectDir);
|
|
137
239
|
const dryRun = options.dryRun || false;
|
|
240
|
+
const projectDir = options.projectDir || process.cwd();
|
|
138
241
|
const desiredStatusLine = statuslineCommand();
|
|
139
242
|
|
|
243
|
+
// --- Step 0: clean up stale hooks from BOTH settings locations ---
|
|
244
|
+
const staleWarnings = [];
|
|
245
|
+
|
|
246
|
+
// User-level: ~/.claude/settings.local.json
|
|
247
|
+
const userStale = pruneStaleHooksInFile(settingsPath, projectDir, dryRun);
|
|
248
|
+
for (const p of userStale.removedPaths) {
|
|
249
|
+
const msg = `Removed stale hook referencing missing file: ${p}`;
|
|
250
|
+
console.warn(msg);
|
|
251
|
+
staleWarnings.push({ file: settingsPath, path: p });
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
// Project-level: $CWD/.claude/settings.json (takes precedence for some events)
|
|
255
|
+
if (fs.existsSync(projectSettingsPath)) {
|
|
256
|
+
const projStale = pruneStaleHooksInFile(projectSettingsPath, projectDir, dryRun);
|
|
257
|
+
for (const p of projStale.removedPaths) {
|
|
258
|
+
const msg = `Removed stale hook referencing missing file: ${p}`;
|
|
259
|
+
console.warn(msg);
|
|
260
|
+
staleWarnings.push({ file: projectSettingsPath, path: p });
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
|
|
140
264
|
let settings = loadJsonFile(settingsPath) || {};
|
|
141
265
|
settings.hooks = settings.hooks || {};
|
|
142
266
|
|
|
@@ -426,10 +550,13 @@ module.exports = {
|
|
|
426
550
|
parseFlags,
|
|
427
551
|
claudeSettingsPath,
|
|
428
552
|
claudeSharedSettingsPath,
|
|
553
|
+
claudeProjectSettingsPath,
|
|
429
554
|
codexConfigPath,
|
|
430
555
|
geminiSettingsPath,
|
|
431
556
|
syncClaudeStatusLine,
|
|
432
557
|
forgeConfigPath,
|
|
558
|
+
pruneStaleFileHooks,
|
|
559
|
+
pruneStaleHooksInFile,
|
|
433
560
|
CLAUDE_HOOKS,
|
|
434
561
|
preToolHookCommand,
|
|
435
562
|
userPromptHookCommand,
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* cli-demo.js — simulated walkthrough of the ThumbGate value prop.
|
|
6
|
+
*
|
|
7
|
+
* Shows in ~10 seconds:
|
|
8
|
+
* 1. A mock bad action (force-push)
|
|
9
|
+
* 2. Giving it a thumbs-down
|
|
10
|
+
* 3. Lesson created
|
|
11
|
+
* 4. Next session: gate fires, action blocked
|
|
12
|
+
*
|
|
13
|
+
* No actual data is written — this is a pure simulation for onboarding.
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
const BD = '\x1b[1m';
|
|
17
|
+
const RST = '\x1b[0m';
|
|
18
|
+
const G = '\x1b[32m';
|
|
19
|
+
const R = '\x1b[31m';
|
|
20
|
+
const C = '\x1b[36m';
|
|
21
|
+
const Y = '\x1b[33m';
|
|
22
|
+
const D = '\x1b[90m';
|
|
23
|
+
|
|
24
|
+
function sleep(ms) {
|
|
25
|
+
const end = Date.now() + ms;
|
|
26
|
+
while (Date.now() < end) { /* spin — no async needed for short delays */ }
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
function runDemo(options = {}) {
|
|
30
|
+
const json = options.json || false;
|
|
31
|
+
|
|
32
|
+
if (json) {
|
|
33
|
+
const steps = [
|
|
34
|
+
{ step: 1, event: 'bad_action', description: 'Agent runs: git push --force origin main', result: 'executed', badge: 'ALLOWED' },
|
|
35
|
+
{ step: 2, event: 'thumbs_down', description: 'User gives thumbs-down feedback', signal: 'down', context: 'force-pushed to main, overwrote teammate\'s work' },
|
|
36
|
+
{ step: 3, event: 'lesson_created', description: 'ThumbGate creates a lesson from the feedback', lesson: { id: 'demo-lesson-001', signal: 'negative', context: 'force-pushed to main', whatWentWrong: 'Overwrote teammate\'s commits on main branch', whatToChange: 'Never force-push to protected branches' } },
|
|
37
|
+
{ step: 4, event: 'gate_promoted', description: 'Pattern detected: 2+ failures on force-push → auto-promoted to blocking gate', gate: { id: 'auto-block-force-push', pattern: 'git push --force.*main', action: 'block', occurrences: 2 } },
|
|
38
|
+
{ step: 5, event: 'gate_fires', description: 'Next session: agent tries git push --force origin main', result: 'BLOCKED', reason: 'Auto-promoted gate: force-push to main detected' },
|
|
39
|
+
];
|
|
40
|
+
return { demo: true, steps };
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
const lines = [];
|
|
44
|
+
const w = (s) => lines.push(s);
|
|
45
|
+
|
|
46
|
+
w('');
|
|
47
|
+
w(`${BD}${C}thumbgate demo${RST} — see ThumbGate in action (simulated)`);
|
|
48
|
+
w('═'.repeat(60));
|
|
49
|
+
w('');
|
|
50
|
+
|
|
51
|
+
// Step 1: Bad action
|
|
52
|
+
w(`${BD}Session 1: Agent runs a risky command${RST}`);
|
|
53
|
+
w(`${D}─────────────────────────────────────${RST}`);
|
|
54
|
+
w(` ${D}Agent>${RST} ${BD}git push --force origin main${RST}`);
|
|
55
|
+
w(` ${G}[ALLOWED]${RST} — No gates configured yet, action proceeds.`);
|
|
56
|
+
w(` ${R}💥 Result: teammate's commits overwritten on main${RST}`);
|
|
57
|
+
w('');
|
|
58
|
+
|
|
59
|
+
// Step 2: Thumbs down
|
|
60
|
+
w(`${BD}You give feedback:${RST}`);
|
|
61
|
+
w(` ${R}👎 thumbs-down${RST} — "force-pushed to main, overwrote teammate's work"`);
|
|
62
|
+
w('');
|
|
63
|
+
|
|
64
|
+
// Step 3: Lesson
|
|
65
|
+
w(`${BD}ThumbGate captures a lesson:${RST}`);
|
|
66
|
+
w(`${D}─────────────────────────────────────${RST}`);
|
|
67
|
+
w(` ${Y}[LEARNING]${RST} Lesson created`);
|
|
68
|
+
w(` Signal : ${R}negative${RST}`);
|
|
69
|
+
w(` Context : force-pushed to main`);
|
|
70
|
+
w(` Root cause : Overwrote teammate's commits on main branch`);
|
|
71
|
+
w(` Corrective : Never force-push to protected branches`);
|
|
72
|
+
w(` Tags : git, deployment, data-loss`);
|
|
73
|
+
w('');
|
|
74
|
+
|
|
75
|
+
// Step 4: Gate promotion
|
|
76
|
+
w(`${BD}Pattern detected (2+ similar failures):${RST}`);
|
|
77
|
+
w(` ${Y}→${RST} Auto-promoted to ${R}blocking gate${RST}`);
|
|
78
|
+
w(` Gate ID : auto-block-force-push`);
|
|
79
|
+
w(` Pattern : git push --force.*main`);
|
|
80
|
+
w(` Action : ${R}block${RST}`);
|
|
81
|
+
w('');
|
|
82
|
+
|
|
83
|
+
// Step 5: Next session — blocked
|
|
84
|
+
w(`${BD}Session 2: Agent tries the same command${RST}`);
|
|
85
|
+
w(`${D}─────────────────────────────────────${RST}`);
|
|
86
|
+
w(` ${D}Agent>${RST} ${BD}git push --force origin main${RST}`);
|
|
87
|
+
w(` ${R}[BLOCKED]${RST} Gate fired: force-push to main detected`);
|
|
88
|
+
w(` ${G}✅ Mistake prevented. Teammate's work is safe.${RST}`);
|
|
89
|
+
w('');
|
|
90
|
+
|
|
91
|
+
w('═'.repeat(60));
|
|
92
|
+
w(`${BD}That's ThumbGate:${RST} one thumbs-down → permanent protection.`);
|
|
93
|
+
w('');
|
|
94
|
+
w(` Get started: ${C}npx thumbgate init${RST}`);
|
|
95
|
+
w(` Capture: ${C}npx thumbgate capture --feedback=down --context="what failed"${RST}`);
|
|
96
|
+
w(` Check gates: ${C}npx thumbgate gate-stats --json${RST}`);
|
|
97
|
+
w('');
|
|
98
|
+
|
|
99
|
+
return lines.join('\n');
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
module.exports = { runDemo };
|