thumbgate 1.39.1 → 1.40.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude-plugin/plugin.json +1 -1
- package/.well-known/llms.txt +2 -2
- package/.well-known/mcp/server-card.json +1 -1
- package/README.md +5 -4
- package/adapters/claude/.mcp.json +6 -2
- package/adapters/codex/config.toml +5 -0
- package/adapters/forge/forge.yaml +4 -4
- package/adapters/future-agi/.mcp.json +1 -1
- package/adapters/future-agi/config.toml +1 -1
- package/adapters/future-agi/opencode.json +1 -1
- package/adapters/herdr/herdr-plugin.toml +2 -2
- package/adapters/mcp/server-stdio.js +82 -7
- package/adapters/opencode/opencode.json +1 -1
- package/bin/cli.js +128 -15
- package/config/brand-standards.json +131 -0
- package/config/gates/default.json +18 -1
- package/config/github-about.json +1 -1
- package/config/mcp-allowlists.json +16 -3
- package/config/merge-quality-checks.json +1 -0
- package/config/post-deploy-marketing-pages.json +3 -3
- package/config/schemas/task-outcome-receipt.schema.json +9 -0
- package/openapi/openapi.yaml +7 -3
- package/package.json +62 -28
- package/public/about.html +2 -2
- package/public/admin.html +771 -0
- package/public/agent-manager.html +3 -3
- package/public/agents-cost-savings.html +1 -1
- package/public/ai-malpractice-prevention.html +12 -12
- package/public/architecture.html +0 -1
- package/public/assets/diagrams/decision.svg +3 -3
- package/public/blog/2026-10-05-why-3-days-of-triage-wont-save-ai-speed-code.html +1 -1
- package/public/blog/2026-10-09-your-code-got-a-third-author-governance.html +1 -1
- package/public/blog/git-at-agent-scale.html +2 -2
- package/public/blog/inside-your-boundary.html +1 -1
- package/public/blog/process-over-outcome-gates.html +1 -1
- package/public/case-studies.html +1 -2
- package/public/codex-enterprise.html +1 -1
- package/public/codex-plugin.html +1 -1
- package/public/dashboard.html +773 -481
- package/public/diagnostic.html +8 -3
- package/public/enterprise-governance.html +26 -174
- package/public/eval-scorecard.html +3 -4
- package/public/eval-scorecard.json +2 -2
- package/public/evaluations.html +0 -1
- package/public/founders.html +3 -3
- package/public/gaming-playbook.html +4 -4
- package/public/guide.html +3 -5
- package/public/index.html +159 -69
- package/public/install.html +12 -11
- package/public/js/buyer-intent.js +49 -8
- package/public/lessons.html +103 -46
- package/public/numbers.html +32 -33
- package/public/operator-framework.html +44 -72
- package/public/peter.html +3 -3
- package/public/platform-partners.html +1 -1
- package/public/pricing.html +75 -60
- package/public/pro.html +3 -1
- package/public/project-switcher.js +76 -0
- package/public/whitepaper.html +1 -2
- package/scripts/activation-quickstart.js +15 -3
- package/scripts/activation-tracker.js +280 -3
- package/scripts/agent-action-inventory.js +235 -143
- package/scripts/agent-operations-planner.js +1 -1
- package/scripts/agent-readiness.js +36 -6
- package/scripts/agentic-prompt-pipelines.js +901 -0
- package/scripts/analytics-window.js +7 -1
- package/scripts/async-job-runner.js +66 -11
- package/scripts/audit-trail.js +37 -24
- package/scripts/auto-promote-gates.js +37 -27
- package/scripts/backfill-lesson-scopes.js +122 -0
- package/scripts/billing.js +889 -132
- package/scripts/bot-detection.js +112 -0
- package/scripts/brand-standards-gate.js +571 -0
- package/scripts/chatgpt-ads-readiness-pack.js +1 -1
- package/scripts/cli-schema.js +1 -1
- package/scripts/commercial-offer.js +2 -2
- package/scripts/contextfs.js +9 -3
- package/scripts/cross-encoder-reranker.js +4 -0
- package/scripts/dashboard-chat.js +11 -0
- package/scripts/dashboard.js +574 -167
- package/scripts/decision-journal.js +7 -4
- package/scripts/docker-sandbox-planner.js +3 -3
- package/scripts/export-dpo-pairs.js +12 -7
- package/scripts/feedback-aggregate.js +4 -0
- package/scripts/feedback-attribution.js +6 -4
- package/scripts/feedback-history-distiller.js +18 -6
- package/scripts/feedback-loop.js +255 -89
- package/scripts/feedback-paths.js +8 -1
- package/scripts/feedback-sanitizer.js +5 -0
- package/scripts/feedback-scope.js +106 -0
- package/scripts/feedback-session.js +8 -2
- package/scripts/filesystem-search.js +13 -8
- package/scripts/financial-control-plane.js +707 -45
- package/scripts/gate-stats.js +8 -2
- package/scripts/gates-engine.js +694 -230
- package/scripts/generate-eval-scorecard.js +0 -1
- package/scripts/harness-tool-names.js +31 -5
- package/scripts/hybrid-feedback-context.js +5 -2
- package/scripts/intervention-policy.js +2 -1
- package/scripts/lesson-canonical.js +2 -2
- package/scripts/lesson-db.js +55 -14
- package/scripts/lesson-graph.js +2 -1
- package/scripts/lesson-retrieval.js +95 -9
- package/scripts/lesson-search.js +86 -22
- package/scripts/lesson-synthesis.js +21 -5
- package/scripts/mailer/index.js +17 -1
- package/scripts/mailer/resend-mailer.js +213 -179
- package/scripts/migrate-project-scope.js +209 -0
- package/scripts/operational-integrity.js +436 -3
- package/scripts/override-audit.js +2 -0
- package/scripts/owner-admin.js +338 -0
- package/scripts/pr-manager.js +194 -1
- package/scripts/progressive-signoff.js +260 -0
- package/scripts/project-catalog.js +243 -0
- package/scripts/project-dashboard.js +61 -0
- package/scripts/project-evidence.js +172 -0
- package/scripts/project-identity.js +182 -0
- package/scripts/project-scope.js +381 -0
- package/scripts/prompt-guard.js +446 -52
- package/scripts/proof-report.js +232 -0
- package/scripts/provider-action-normalizer.js +14 -6
- package/scripts/rate-limiter.js +41 -0
- package/scripts/secret-redaction.js +171 -25
- package/scripts/secret-scanner.js +101 -42
- package/scripts/self-protection.js +2 -2
- package/scripts/seo-gsd.js +14 -14
- package/scripts/session-context-dedupe.js +66 -0
- package/scripts/settings-hierarchy.js +4 -2
- package/scripts/statusline-meta.js +34 -23
- package/scripts/task-outcomes.js +29 -2
- package/scripts/telemetry-analytics.js +238 -13
- package/scripts/thumbgate-search.js +23 -9
- package/scripts/tool-kpi-tracker.js +5 -2
- package/scripts/tool-registry.js +42 -1
- package/scripts/triage-savings-calculator.js +1 -1
- package/scripts/vector-store.js +4 -1
- package/scripts/verified-lessons.js +270 -0
- package/scripts/verify-marketing-pages-deployed.js +2 -2
- package/scripts/workflow-sentinel.js +29 -10
- package/server.json +2 -2
- package/src/api/server.js +2371 -451
- package/src/feedback.js +21 -0
- package/src/hermes-sync-plane.js +2 -1
- package/src/index.js +2 -0
- package/src/lesson-search.js +9 -0
- package/src/mckinsey-top-company-ai-coding.js +493 -0
- package/src/mcp/server.js +3 -0
- package/src/mcp-writeguard.js +772 -11
- package/src/openshell-lovable-engine.js +1475 -0
- package/src/task-outcome.js +3 -0
- package/config/evals/agent-safety-eval.json +0 -447
- package/config/evals/retrieval-ranking-golden.json +0 -522
- package/config/progressive/01-wire-only.json +0 -11
- package/config/progressive/02-dashboard-empty-ok.json +0 -10
- package/config/progressive/03-one-lesson.json +0 -10
- package/config/progressive/04-warn-fires.json +0 -11
- package/config/progressive/05-strict-optional.json +0 -11
- package/config/progressive/README.md +0 -15
- package/public/assets/diagrams/agent-integration.png +0 -0
- package/public/assets/diagrams/thumbgate-architecture.png +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "thumbgate",
|
|
3
3
|
"description": "One 👎 becomes a hard rule the agent cannot bypass. Captures thumbs-down feedback, distills it into PreToolUse Pre-Action Checks, enforced across every future Claude Code session.",
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.40.1",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Igor Ganapolsky",
|
|
7
7
|
"email": "ig5973700@gmail.com",
|
package/.well-known/llms.txt
CHANGED
|
@@ -61,8 +61,8 @@ npx thumbgate init --agent claude-code
|
|
|
61
61
|
- Free GPT: advice, checkpointing, and setup help in ChatGPT
|
|
62
62
|
- Codex Plugin: https://thumbgate.ai/codex-plugin
|
|
63
63
|
- Free local CLI: 2 captures/day, 10 total captures, up to 3 active auto-promoted prevention rules, and local Pre-Action Checks after install (recall and lesson search are Pro-only)
|
|
64
|
-
-
|
|
65
|
-
-
|
|
64
|
+
- Setup Sprint: $499 one-time for one supported workflow. Free CLI for evaluation. Custom scope after proof.
|
|
65
|
+
- Setup Sprint: one-time engagement covering one supported workflow — a 60-minute review, one configured local gate, its regression test, and written rollout/rollback proof within two business days. Current terms: https://thumbgate.ai/pricing
|
|
66
66
|
- Enterprise: custom pricing, scoped after intake — shared hosted lesson database, org-wide dashboard, GCP/DFCX guardrails, VPC gating, and white-glove workflow hardening sprints
|
|
67
67
|
|
|
68
68
|
## Links
|
package/README.md
CHANGED
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
<a href="#quick-start"><img src="https://img.shields.io/badge/⚡_Quick_Start-npx_thumbgate_init-22d3ee?style=for-the-badge" alt="Quick Start" /></a>
|
|
26
26
|
<a href="https://thumbgate.ai/#demo?utm_source=github&utm_medium=readme"><img src="https://img.shields.io/badge/🎬_Watch-90s_Demo-ff647c?style=for-the-badge" alt="Watch Demo" /></a>
|
|
27
27
|
<a href="https://thumbgate.ai/go/gpt?utm_source=github&utm_medium=readme"><img src="https://img.shields.io/badge/💬_Try-ThumbGate_GPT-56e39f?style=for-the-badge" alt="Try GPT" /></a>
|
|
28
|
-
<a href="https://thumbgate.ai/
|
|
28
|
+
<a href="https://thumbgate.ai/go/pro-direct?utm_source=github&utm_medium=readme"><img src="https://img.shields.io/badge/💼_Pro-$19/mo-ffd166?style=for-the-badge" alt="Pro Tier" /></a>
|
|
29
29
|
</p>
|
|
30
30
|
|
|
31
31
|
---
|
|
@@ -183,15 +183,15 @@ Free tier: **2 feedback captures/day (10 total)** and **up to 3 active auto-prom
|
|
|
183
183
|
| Hosted team lesson sync | — | — | Not general availability |
|
|
184
184
|
| Hosted org dashboard | — | — | Not general availability |
|
|
185
185
|
|
|
186
|
-
**Enterprise intake path:** the **
|
|
186
|
+
**Enterprise intake path:** the **Setup Sprint** scopes one repeated failure before any broader rollout commitment. **[Start intake →](https://thumbgate.ai/go/diagnostic?utm_source=github&utm_medium=readme&utm_campaign=team_rollout)**
|
|
187
187
|
|
|
188
188
|
**Local technical path:** install the CLI and use `init` plus the documented setup so Pre-Action Checks evaluate tool calls where the agent actually runs.
|
|
189
189
|
|
|
190
190
|
**First-dollar activation path:** open the [ThumbGate GPT](https://thumbgate.ai/go/gpt?utm_source=github&utm_medium=readme), paste the risky action, capture typed feedback (`thumbs down:` / `thumbs up:`). **Native ChatGPT rating buttons are not the ThumbGate capture path.** Ask: **what repeated AI mistake would be worth catching before the tool executes?**
|
|
191
191
|
|
|
192
|
-
**Paid path for individual operators:** [ThumbGate Pro](https://thumbgate.ai/
|
|
192
|
+
**Paid path for individual operators:** [ThumbGate Pro](https://thumbgate.ai/go/pro-direct?utm_source=github&utm_medium=readme&utm_campaign=pro_page) is the self-serve side lane for a personal dashboard and export-ready evidence.
|
|
193
193
|
|
|
194
|
-
[**Start free**](https://thumbgate.ai/?utm_source=github&utm_medium=readme) · [**Pro $19/mo**](https://thumbgate.ai/
|
|
194
|
+
[**Start free**](https://thumbgate.ai/?utm_source=github&utm_medium=readme) · [**Pro $19/mo**](https://thumbgate.ai/go/pro-direct?utm_source=github&utm_medium=readme) · [**Live Dashboard**](https://thumbgate.ai/dashboard?utm_source=github&utm_medium=readme) · [**Team Sprint intake**](https://thumbgate.ai/go/diagnostic?utm_source=github&utm_medium=readme) · [**Setup Sprint**](https://thumbgate.ai/go/diagnostic?utm_source=github&utm_medium=readme&utm_campaign=top_cta) · [**First Dollar Playbook**](docs/FIRST_DOLLAR_PLAYBOOK.md)
|
|
195
195
|
|
|
196
196
|
**Popular buyer questions:** **[AI search topical presence](https://thumbgate.ai/guides/ai-search-topical-presence?utm_source=github&utm_medium=readme&utm_campaign=buyer_questions)** · **[Relational knowledge and AI recommendations](https://thumbgate.ai/guides/relational-knowledge-ai-recommendations?utm_source=github&utm_medium=readme&utm_campaign=buyer_questions)** · **[AI Mode ads for agent governance](https://thumbgate.ai/guides/ai-mode-ads-agent-governance?utm_source=github&utm_medium=readme&utm_campaign=buyer_questions)** · **[MCP tool governance](https://thumbgate.ai/guides/mcp-tool-governance?utm_source=github&utm_medium=readme&utm_campaign=buyer_questions)** · **[AI agent pre-action approval gates](https://thumbgate.ai/guides/ai-agent-pre-action-approval-gates?utm_source=github&utm_medium=readme&utm_campaign=buyer_questions)** · **[Background agent governance](https://thumbgate.ai/guides/background-agent-governance?utm_source=github&utm_medium=readme&utm_campaign=buyer_questions)** · **[GPT-5.5 model evaluation](https://thumbgate.ai/guides/gpt-5-5-model-evaluation?utm_source=github&utm_medium=readme&utm_campaign=buyer_questions)** · **[Stop repeated AI agent mistakes](https://thumbgate.ai/guides/stop-repeated-ai-agent-mistakes?utm_source=github&utm_medium=readme&utm_campaign=buyer_questions)** · **[Browser automation safety](https://thumbgate.ai/guides/browser-automation-safety?utm_source=github&utm_medium=readme&utm_campaign=buyer_questions)** · **[Native messaging host security](https://thumbgate.ai/guides/native-messaging-host-security?utm_source=github&utm_medium=readme&utm_campaign=buyer_questions)** · **[Autoresearch agent safety](https://thumbgate.ai/guides/autoresearch-agent-safety?utm_source=github&utm_medium=readme&utm_campaign=buyer_questions)** · **[Cursor guardrails](https://thumbgate.ai/guides/cursor-agent-guardrails?utm_source=github&utm_medium=readme&utm_campaign=buyer_questions)** · **[Codex CLI guardrails](https://thumbgate.ai/guides/codex-cli-guardrails?utm_source=github&utm_medium=readme&utm_campaign=buyer_questions)** · **[Gemini CLI memory + enforcement](https://thumbgate.ai/guides/gemini-cli-feedback-memory?utm_source=github&utm_medium=readme&utm_campaign=buyer_questions)** · **[Google Cloud MCP guardrails](https://thumbgate.ai/guides/gcp-mcp-guardrails?utm_source=github&utm_medium=readme&utm_campaign=buyer_questions)** · **[Roo Code alternative: migrate to Cline](https://thumbgate.ai/guides/roo-code-alternative-cline?utm_source=github&utm_medium=readme&utm_campaign=buyer_questions)**
|
|
197
197
|
|
|
@@ -320,6 +320,7 @@ Full index: **[docs/INDEX.md](docs/INDEX.md)**
|
|
|
320
320
|
|------|------|
|
|
321
321
|
| Agent workflow contract | [WORKFLOW.md](WORKFLOW.md) |
|
|
322
322
|
| Ready-for-agent intake | [.github/ISSUE_TEMPLATE/ready-for-agent.yml](.github/ISSUE_TEMPLATE/ready-for-agent.yml) |
|
|
323
|
+
| Cloud-to-Mac dispatch loop | [docs/guides/mac-dispatch-loop.md](docs/guides/mac-dispatch-loop.md) |
|
|
323
324
|
| Verification Evidence | [docs/VERIFICATION_EVIDENCE.md](docs/VERIFICATION_EVIDENCE.md) |
|
|
324
325
|
| Release Confidence | [docs/RELEASE_CONFIDENCE.md](docs/RELEASE_CONFIDENCE.md) |
|
|
325
326
|
| Changeset strategy | [docs/CHANGESET_STRATEGY.md](docs/CHANGESET_STRATEGY.md) |
|
|
@@ -2,13 +2,17 @@
|
|
|
2
2
|
"mcpServers": {
|
|
3
3
|
"thumbgate": {
|
|
4
4
|
"command": "npx",
|
|
5
|
-
"args": ["--yes", "--package", "thumbgate@1.
|
|
5
|
+
"args": ["--yes", "--package", "thumbgate@1.40.1", "thumbgate", "serve"]
|
|
6
6
|
}
|
|
7
7
|
},
|
|
8
8
|
"hooks": {
|
|
9
9
|
"preToolUse": {
|
|
10
10
|
"command": "npx",
|
|
11
|
-
"args": ["--yes", "--package", "thumbgate@1.
|
|
11
|
+
"args": ["--yes", "--package", "thumbgate@1.40.1", "thumbgate", "gate-check"]
|
|
12
|
+
},
|
|
13
|
+
"userPromptSubmit": {
|
|
14
|
+
"command": "npx",
|
|
15
|
+
"args": ["--yes", "--package", "thumbgate@1.40.1", "thumbgate", "hook-auto-capture"]
|
|
12
16
|
}
|
|
13
17
|
}
|
|
14
18
|
}
|
|
@@ -9,3 +9,8 @@ args = ["-lc", "[ -x \"$HOME/.thumbgate/runtime/node_modules/.bin/thumbgate\" ]
|
|
|
9
9
|
[hooks.pre_tool_use]
|
|
10
10
|
command = "sh"
|
|
11
11
|
args = ["-lc", "[ -x \"$HOME/.thumbgate/runtime/node_modules/.bin/thumbgate\" ] && exec \"$HOME/.thumbgate/runtime/node_modules/.bin/thumbgate\" \"gate-check\" || mkdir -p \"$HOME/.thumbgate/runtime\" && exec npm \"exec\" \"--prefix\" \"$HOME/.thumbgate/runtime\" \"--yes\" \"--package\" \"thumbgate@latest\" \"--\" \"thumbgate\" \"gate-check\""]
|
|
12
|
+
|
|
13
|
+
# Hard UserPromptSubmit hook for Codex — blocks pasted passwords and API keys before model submission
|
|
14
|
+
[hooks.user_prompt_submit]
|
|
15
|
+
command = "sh"
|
|
16
|
+
args = ["-lc", "[ -x \"$HOME/.thumbgate/runtime/node_modules/.bin/thumbgate\" ] && exec \"$HOME/.thumbgate/runtime/node_modules/.bin/thumbgate\" \"hook-auto-capture\" || mkdir -p \"$HOME/.thumbgate/runtime\" && exec npm \"exec\" \"--prefix\" \"$HOME/.thumbgate/runtime\" \"--yes\" \"--package\" \"thumbgate@latest\" \"--\" \"thumbgate\" \"hook-auto-capture\""]
|
|
@@ -9,12 +9,12 @@ version: "1"
|
|
|
9
9
|
skills:
|
|
10
10
|
thumbgate-gate-check:
|
|
11
11
|
description: "ThumbGate PreToolUse gate — blocks known-bad tool calls"
|
|
12
|
-
command: "npx --yes --package thumbgate@1.
|
|
12
|
+
command: "npx --yes --package thumbgate@1.40.1 thumbgate gate-check"
|
|
13
13
|
trigger: pre_tool_use
|
|
14
14
|
|
|
15
15
|
thumbgate-feedback:
|
|
16
|
-
description: "ThumbGate feedback capture — logs
|
|
17
|
-
command: "npx --yes --package thumbgate@1.
|
|
16
|
+
description: "ThumbGate UserPromptSubmit guard & feedback capture — blocks pasted passwords/keys and logs safe prompt context"
|
|
17
|
+
command: "npx --yes --package thumbgate@1.40.1 thumbgate hook-auto-capture"
|
|
18
18
|
trigger: user_prompt
|
|
19
19
|
|
|
20
20
|
mcp:
|
|
@@ -23,6 +23,6 @@ mcp:
|
|
|
23
23
|
args:
|
|
24
24
|
- "--yes"
|
|
25
25
|
- "--package"
|
|
26
|
-
- "thumbgate@1.
|
|
26
|
+
- "thumbgate@1.40.1"
|
|
27
27
|
- "thumbgate"
|
|
28
28
|
- "serve"
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
[plugin]
|
|
2
2
|
id = "thumbgate-approvals"
|
|
3
3
|
name = "ThumbGate Approvals"
|
|
4
|
-
version = "1.
|
|
4
|
+
version = "1.40.1"
|
|
5
5
|
minHerdrVersion = "0.7.0"
|
|
6
6
|
description = "Pre-action governance, spend guard, and safety approval gates for multi-agent terminal sessions in Herdr."
|
|
7
7
|
platforms = ["linux", "macos", "windows"]
|
|
@@ -12,7 +12,7 @@ category = "Security & Governance"
|
|
|
12
12
|
|
|
13
13
|
[mcp_server]
|
|
14
14
|
command = "npx"
|
|
15
|
-
args = ["--yes", "--package", "thumbgate@1.
|
|
15
|
+
args = ["--yes", "--package", "thumbgate@1.40.1", "thumbgate", "serve"]
|
|
16
16
|
|
|
17
17
|
[mcp_server.env]
|
|
18
18
|
THUMBGATE_ENFORCE_ENTITLEMENTS = "1"
|
|
@@ -334,7 +334,7 @@ const {
|
|
|
334
334
|
finalizeSession: finalizeFeedbackSession,
|
|
335
335
|
} = require('../../scripts/feedback-session');
|
|
336
336
|
|
|
337
|
-
const SERVER_INFO = { name: 'thumbgate-mcp', version: '1.
|
|
337
|
+
const SERVER_INFO = { name: 'thumbgate-mcp', version: '1.40.1' };
|
|
338
338
|
const COMMERCE_CATEGORIES = [
|
|
339
339
|
'product_recommendation',
|
|
340
340
|
'brand_compliance',
|
|
@@ -579,6 +579,29 @@ function buildSuggestFixResponse(args = {}) {
|
|
|
579
579
|
.slice(0, limit)
|
|
580
580
|
.map(({ action, source }) => ({ action, source }));
|
|
581
581
|
|
|
582
|
+
let designSelfCorrection = null;
|
|
583
|
+
const isDesignQuery = /\b(contrast|tap\s*target|touch\s*target|44px|overflow|focus\s*ring|colorblind|cls|layout\s*shift)\b/i.test(context)
|
|
584
|
+
|| typeof args.sourceCode === 'string'
|
|
585
|
+
|| Array.isArray(args.visualFindings);
|
|
586
|
+
const rawDesignSrc = typeof args.sourceCode === 'string' ? args.sourceCode : '';
|
|
587
|
+
if (isDesignQuery && rawDesignSrc.length <= 262144) {
|
|
588
|
+
try {
|
|
589
|
+
const { runDesignSelfCorrectionPipeline } = require('../../src/openshell-lovable-engine');
|
|
590
|
+
const vf = Array.isArray(args.visualFindings) ? args.visualFindings : (context ? [context] : []);
|
|
591
|
+
designSelfCorrection = runDesignSelfCorrectionPipeline({
|
|
592
|
+
sourceCode: rawDesignSrc,
|
|
593
|
+
visualFindings: vf,
|
|
594
|
+
});
|
|
595
|
+
for (const p of designSelfCorrection.patches) {
|
|
596
|
+
const tw = p.tailwindPatch?.add?.length ? ` | Tailwind +[${p.tailwindPatch.add.join(' ')}]` : '';
|
|
597
|
+
all.unshift({
|
|
598
|
+
action: `Apply [${p.type}] on ${p.selector || p.astPath}: CSS { ${p.cssOverride} }${tw}`,
|
|
599
|
+
source: 'lovable-ast-design-engine',
|
|
600
|
+
});
|
|
601
|
+
}
|
|
602
|
+
} catch { /* non-fatal */ }
|
|
603
|
+
}
|
|
604
|
+
|
|
582
605
|
// If nothing matched, add generic fallback
|
|
583
606
|
if (all.length === 0) {
|
|
584
607
|
all.push({
|
|
@@ -587,10 +610,12 @@ function buildSuggestFixResponse(args = {}) {
|
|
|
587
610
|
});
|
|
588
611
|
}
|
|
589
612
|
|
|
613
|
+
const capped = all.slice(0, limit);
|
|
590
614
|
return toTextResult({
|
|
591
|
-
suggestions:
|
|
615
|
+
suggestions: capped,
|
|
592
616
|
query: context,
|
|
593
|
-
totalFound:
|
|
617
|
+
totalFound: capped.length,
|
|
618
|
+
...(designSelfCorrection ? { designSelfCorrection } : {}),
|
|
594
619
|
});
|
|
595
620
|
}
|
|
596
621
|
|
|
@@ -1096,15 +1121,19 @@ async function callToolInner(name, args) {
|
|
|
1096
1121
|
const pairedFeedback = pairFeedbackWithReceipt(args);
|
|
1097
1122
|
return toCaptureFeedbackTextResult(captureFeedback({
|
|
1098
1123
|
...pairedFeedback,
|
|
1124
|
+
cwd: resolveWorkspaceCwd(args.cwd),
|
|
1125
|
+
lessonId: args.lessonId,
|
|
1126
|
+
lessonKey: args.lessonKey,
|
|
1099
1127
|
reviewOrigin: 'automated',
|
|
1100
1128
|
}));
|
|
1101
1129
|
}
|
|
1102
1130
|
case 'feedback_summary':
|
|
1103
|
-
return toTextResult(feedbackSummary(Number(args.recent || 20), { humanOnly: true }));
|
|
1131
|
+
return toTextResult(feedbackSummary(Number(args.recent || 20), { humanOnly: true, projectKey: require('../../scripts/project-identity').resolveLocalProject(resolveWorkspaceCwd(args.cwd)).projectKey }));
|
|
1104
1132
|
case 'search_lessons': {
|
|
1105
1133
|
const module = loadPrivateMcpModule('lessonSearch');
|
|
1106
1134
|
if (!module) return unavailablePrivateMcpFeature('search_lessons');
|
|
1107
1135
|
return toTextResult(module.searchLessons(args.query || '', {
|
|
1136
|
+
projectKey: require('../../scripts/project-identity').resolveLocalProject(resolveWorkspaceCwd(args.cwd)).projectKey,
|
|
1108
1137
|
limit: Number(args.limit || 10),
|
|
1109
1138
|
category: args.category,
|
|
1110
1139
|
tags: Array.isArray(args.tags) ? args.tags : [],
|
|
@@ -1124,7 +1153,9 @@ async function callToolInner(name, args) {
|
|
|
1124
1153
|
{ maxResults: options.maxResults || 5 },
|
|
1125
1154
|
),
|
|
1126
1155
|
}));
|
|
1127
|
-
|
|
1156
|
+
const { lookupLessonByError } = require('../../scripts/verified-lessons');
|
|
1157
|
+
const exactError = lookupLessonByError(args.actionContext || '');
|
|
1158
|
+
let retrievalResults = await retrieveWithReranking(
|
|
1128
1159
|
args.toolName,
|
|
1129
1160
|
args.actionContext || '',
|
|
1130
1161
|
{
|
|
@@ -1137,7 +1168,22 @@ async function callToolInner(name, args) {
|
|
|
1137
1168
|
queryRewrite: args.queryRewrite !== false,
|
|
1138
1169
|
includeRetrievalMeta: args.includeRetrievalMeta === true,
|
|
1139
1170
|
},
|
|
1140
|
-
)
|
|
1171
|
+
);
|
|
1172
|
+
if (exactError && exactError.isSeeded) {
|
|
1173
|
+
const exactItem = {
|
|
1174
|
+
id: exactError.id,
|
|
1175
|
+
title: (exactError.stale ? '[STALE] ' : '') + exactError.title,
|
|
1176
|
+
signal: 'negative',
|
|
1177
|
+
content: exactError.content,
|
|
1178
|
+
badge: exactError.badge,
|
|
1179
|
+
stale: exactError.stale,
|
|
1180
|
+
verificationCount: exactError.verificationCount,
|
|
1181
|
+
lastVerifiedAt: exactError.lastVerifiedAt,
|
|
1182
|
+
rule: { fix: exactError.fix },
|
|
1183
|
+
};
|
|
1184
|
+
retrievalResults = [exactItem, ...(Array.isArray(retrievalResults) ? retrievalResults.filter(r => r.id !== exactError.id) : [])];
|
|
1185
|
+
}
|
|
1186
|
+
return toTextResult(retrievalResults);
|
|
1141
1187
|
}
|
|
1142
1188
|
case 'ai_component_inventory': {
|
|
1143
1189
|
const {
|
|
@@ -1224,6 +1270,20 @@ async function callToolInner(name, args) {
|
|
|
1224
1270
|
decision = 'error';
|
|
1225
1271
|
reason = 'gate engine returned unparseable output';
|
|
1226
1272
|
}
|
|
1273
|
+
let designSelfCorrection = null;
|
|
1274
|
+
if (decision !== 'block' && decision !== 'error') {
|
|
1275
|
+
try {
|
|
1276
|
+
const ti = canonical.toolInput || {};
|
|
1277
|
+
const fp = String(ti.file_path || ti.filePath || '').trim();
|
|
1278
|
+
const src = String(ti.content ?? ti.new_string ?? ti.sourceCode ?? '');
|
|
1279
|
+
const hasVf = Array.isArray(ti.visualFindings) && ti.visualFindings.length > 0;
|
|
1280
|
+
if (src.length <= 262144 && ((/\.(?:html?|jsx|tsx|css)$/i.test(fp) && Boolean(src)) || hasVf)) {
|
|
1281
|
+
const { runDesignSelfCorrectionPipeline } = require('../../src/openshell-lovable-engine');
|
|
1282
|
+
const rep = runDesignSelfCorrectionPipeline({ sourceCode: src, visualFindings: ti.visualFindings });
|
|
1283
|
+
if (rep.issueCount > 0) designSelfCorrection = rep;
|
|
1284
|
+
}
|
|
1285
|
+
} catch { /* non-fatal */ }
|
|
1286
|
+
}
|
|
1227
1287
|
const strict = process.env.THUMBGATE_STRICT_ENFORCEMENT === '1';
|
|
1228
1288
|
return {
|
|
1229
1289
|
content: [{
|
|
@@ -1240,6 +1300,7 @@ async function callToolInner(name, args) {
|
|
|
1240
1300
|
? 'Gate evaluation failed. Treat as unsafe and ask the user.'
|
|
1241
1301
|
: 'No policy gate matched.',
|
|
1242
1302
|
reason,
|
|
1303
|
+
...(designSelfCorrection ? { designSelfCorrection } : {}),
|
|
1243
1304
|
}, null, 2),
|
|
1244
1305
|
}],
|
|
1245
1306
|
};
|
|
@@ -1429,9 +1490,19 @@ async function callToolInner(name, args) {
|
|
|
1429
1490
|
gateName,
|
|
1430
1491
|
args.evidence || '',
|
|
1431
1492
|
args.structuredReasoning || null,
|
|
1432
|
-
{ source: 'mcp', actor: args.actor || 'agent' },
|
|
1493
|
+
{ ...require('../../scripts/project-identity').resolveLocalProject(resolveWorkspaceCwd(args.cwd)), source: 'mcp', actor: args.actor || 'agent' },
|
|
1433
1494
|
);
|
|
1434
1495
|
const result = { satisfied: true, gate: gateName, ...entry };
|
|
1496
|
+
if (args.lessonId || args.lessonKey || args.appliedLessons) {
|
|
1497
|
+
try {
|
|
1498
|
+
const { verifyLesson } = require("../../scripts/verified-lessons");
|
|
1499
|
+
const lessons = Array.isArray(args.appliedLessons) ? args.appliedLessons : [args.lessonId || args.lessonKey];
|
|
1500
|
+
const checkCmd = args.evidence || ("gate " + gateName + " satisfied");
|
|
1501
|
+
for (const lid of lessons) {
|
|
1502
|
+
if (lid) verifyLesson(lid, checkCmd);
|
|
1503
|
+
}
|
|
1504
|
+
} catch (_satErr) {}
|
|
1505
|
+
}
|
|
1435
1506
|
// Log structured reasoning to audit trail for learning
|
|
1436
1507
|
if (args.structuredReasoning) {
|
|
1437
1508
|
recordAuditEvent({
|
|
@@ -1788,6 +1859,10 @@ async function callToolInner(name, args) {
|
|
|
1788
1859
|
matryoshkaEmbedding: args.matryoshkaEmbedding !== false,
|
|
1789
1860
|
matryoshkaOptions: args.matryoshkaOptions || undefined,
|
|
1790
1861
|
}));
|
|
1862
|
+
case 'graphrag_traverse':
|
|
1863
|
+
case 'route_workload':
|
|
1864
|
+
case 'trim_context':
|
|
1865
|
+
return toTextResult(await require('../../scripts/agentic-prompt-pipelines').handlePipelineTool(name, args));
|
|
1791
1866
|
case 'plan_agent_design_governance':
|
|
1792
1867
|
return toTextResult(buildAgentDesignGovernancePlan(args));
|
|
1793
1868
|
case 'plan_proactive_agent_eval_guardrails':
|
package/bin/cli.js
CHANGED
|
@@ -104,7 +104,7 @@ function upgradeNudge() {
|
|
|
104
104
|
const pricingUrl = pricingUrlFor('cli_upgrade_nudge', COMMAND || 'general');
|
|
105
105
|
const diagnosticUrl = diagnosticUrlFor('cli_upgrade_nudge', COMMAND || 'general');
|
|
106
106
|
process.stderr.write(
|
|
107
|
-
'\n Enterprise entry: $499
|
|
107
|
+
'\n Enterprise entry: $499 Setup Sprint for one workflow\n' +
|
|
108
108
|
` ${diagnosticUrl}\n` +
|
|
109
109
|
`\n Solo side lane: Pro — ${PRO_PRICE_LABEL}\n` +
|
|
110
110
|
' Removes solo caps; adds personal recall, dashboard proof, exports, and managed adapters.\n' +
|
|
@@ -116,7 +116,7 @@ function diagnostic() {
|
|
|
116
116
|
const intakeUrl = diagnosticUrlFor('cli_diagnostic', COMMAND || 'diagnostic');
|
|
117
117
|
const checkoutUrl = diagnosticCheckoutUrlFor('cli_diagnostic', COMMAND || 'diagnostic');
|
|
118
118
|
console.log('');
|
|
119
|
-
console.log(' ThumbGate
|
|
119
|
+
console.log(' ThumbGate Setup Sprint — $499');
|
|
120
120
|
console.log(' ------------------------------------------');
|
|
121
121
|
console.log(' Use this when one repeated AI-agent workflow failure is already costing');
|
|
122
122
|
console.log(' review time, release confidence, customer trust, or money.');
|
|
@@ -1263,7 +1263,7 @@ function capture() {
|
|
|
1263
1263
|
|
|
1264
1264
|
const { getUsage } = require(path.join(PKG_ROOT, 'scripts', 'rate-limiter'));
|
|
1265
1265
|
const capLimit = checkLimit('capture_feedback');
|
|
1266
|
-
if (!capLimit.allowed) {
|
|
1266
|
+
if (!capLimit.allowed && (args.stats || args.summary)) {
|
|
1267
1267
|
limitNudge('capture_feedback', capLimit);
|
|
1268
1268
|
process.exit(1);
|
|
1269
1269
|
}
|
|
@@ -1344,6 +1344,15 @@ function capture() {
|
|
|
1344
1344
|
whatWentWrong = context;
|
|
1345
1345
|
}
|
|
1346
1346
|
|
|
1347
|
+
if (!capLimit.allowed) {
|
|
1348
|
+
const { proWouldHaveBlockedSentence } = require(path.join(PKG_ROOT, 'scripts', 'rate-limiter'));
|
|
1349
|
+
const sentence = proWouldHaveBlockedSentence(whatWentWrong || context);
|
|
1350
|
+
if (sentence) process.stderr.write(`${sentence}\n`);
|
|
1351
|
+
limitNudge('capture_feedback', capLimit);
|
|
1352
|
+
process.exit(1);
|
|
1353
|
+
}
|
|
1354
|
+
|
|
1355
|
+
|
|
1347
1356
|
let whatToChange = args['what-to-change'];
|
|
1348
1357
|
if (!whatToChange && consumedSignalArgs > 0 && positionalArgs.length > consumedSignalArgs + 2) {
|
|
1349
1358
|
whatToChange = positionalArgs.slice(consumedSignalArgs + 2).join(' ');
|
|
@@ -1354,6 +1363,7 @@ function capture() {
|
|
|
1354
1363
|
}
|
|
1355
1364
|
|
|
1356
1365
|
const result = captureFeedback({
|
|
1366
|
+
cwd: CWD,
|
|
1357
1367
|
signal: normalized,
|
|
1358
1368
|
context: context,
|
|
1359
1369
|
whatWentWrong: whatWentWrong,
|
|
@@ -1465,6 +1475,7 @@ function feedbackSelfTest() {
|
|
|
1465
1475
|
const { captureFeedback, getFeedbackPaths } = require(path.join(PKG_ROOT, 'scripts', 'feedback-loop'));
|
|
1466
1476
|
const context = args.context || `feedback self-test: typed thumbs ${normalized} reaches ThumbGate capture`;
|
|
1467
1477
|
const result = captureFeedback({
|
|
1478
|
+
cwd: CWD,
|
|
1468
1479
|
signal: normalized,
|
|
1469
1480
|
context,
|
|
1470
1481
|
whatWentWrong: normalized === 'down'
|
|
@@ -1592,7 +1603,7 @@ function stats() {
|
|
|
1592
1603
|
console.log(` Repeated Failures detected: ${payload.negatives}`);
|
|
1593
1604
|
console.log(` Estimated Operational Loss: $${payload.revenueAtRisk}`);
|
|
1594
1605
|
console.log(' Action Required: Run "npx thumbgate rules" to generate guardrails.');
|
|
1595
|
-
console.log(' Strategic Recommendation: if this is a shared workflow problem, start with the $499
|
|
1606
|
+
console.log(' Strategic Recommendation: if this is a shared workflow problem, start with the $499 Setup Sprint.');
|
|
1596
1607
|
console.log(' Enterprise entry: https://thumbgate.ai/pricing');
|
|
1597
1608
|
console.log(' Solo side lane: npx thumbgate pro');
|
|
1598
1609
|
} else {
|
|
@@ -1650,12 +1661,12 @@ function cfo() {
|
|
|
1650
1661
|
fallbackReason,
|
|
1651
1662
|
summary,
|
|
1652
1663
|
}, null, 2));
|
|
1653
|
-
process.
|
|
1664
|
+
process.exitCode = 0;
|
|
1654
1665
|
})
|
|
1655
1666
|
.catch((err) => {
|
|
1656
1667
|
progress.fail('CFO billing summary failed');
|
|
1657
1668
|
console.error(err && err.message ? err.message : err);
|
|
1658
|
-
process.
|
|
1669
|
+
process.exitCode = 1;
|
|
1659
1670
|
});
|
|
1660
1671
|
}
|
|
1661
1672
|
|
|
@@ -1733,7 +1744,7 @@ function pro() {
|
|
|
1733
1744
|
console.log(' - Personal recall: search lessons, rules, and proof');
|
|
1734
1745
|
console.log(' - Local Pro dashboard: your own browser dashboard for search, gates, and DPO export');
|
|
1735
1746
|
console.log(' - Managed adapters: Claude Code, Cursor, Codex, Gemini, Amp, Cline, OpenCode');
|
|
1736
|
-
console.log(' -
|
|
1747
|
+
console.log(' - Setup Sprint: $499 for one supported workflow; hosted team sync and org dashboard are not GA');
|
|
1737
1748
|
console.log(' - Commercial truth doc: source of truth for traction, pricing, and proof claims');
|
|
1738
1749
|
console.log('\nLinks:');
|
|
1739
1750
|
console.log(` Buy Pro : ${PRO_CHECKOUT_URL}`);
|
|
@@ -2304,6 +2315,13 @@ function rules() {
|
|
|
2304
2315
|
const { writePreventionRules } = require(path.join(PKG_ROOT, 'scripts', 'feedback-loop'));
|
|
2305
2316
|
const outPath = args.output || path.join(CWD, '.thumbgate', 'prevention-rules.md');
|
|
2306
2317
|
const result = writePreventionRules(outPath, Number(args.min || 2));
|
|
2318
|
+
{
|
|
2319
|
+
const { isProTier, droppedRepeatFromRulesMarkdown, proWouldHaveBlockedSentence, FREE_TIER_MAX_GATES } = require(path.join(PKG_ROOT, 'scripts', 'rate-limiter'));
|
|
2320
|
+
if (!isProTier()) {
|
|
2321
|
+
const sentence = proWouldHaveBlockedSentence(droppedRepeatFromRulesMarkdown(result.markdown, FREE_TIER_MAX_GATES));
|
|
2322
|
+
if (sentence) process.stderr.write(`${sentence}\n`);
|
|
2323
|
+
}
|
|
2324
|
+
}
|
|
2307
2325
|
if (args.json) {
|
|
2308
2326
|
// Count rule sections (## headers) from the generated markdown
|
|
2309
2327
|
const ruleHeaders = (result.markdown || '').match(/^## /gm);
|
|
@@ -3614,11 +3632,6 @@ function hookAutoCapture() {
|
|
|
3614
3632
|
|
|
3615
3633
|
const guardResult = evaluatePromptGuard(prompt);
|
|
3616
3634
|
if (guardResult) {
|
|
3617
|
-
recordConversationEntry({
|
|
3618
|
-
author: 'user',
|
|
3619
|
-
text: prompt,
|
|
3620
|
-
source: 'claude_user_prompt',
|
|
3621
|
-
});
|
|
3622
3635
|
process.stdout.write(`${JSON.stringify(guardResult)}\n`);
|
|
3623
3636
|
return;
|
|
3624
3637
|
}
|
|
@@ -3761,7 +3774,8 @@ function dashboard() {
|
|
|
3761
3774
|
const { resolveProjectDir } = require(path.join(PKG_ROOT, 'scripts', 'feedback-paths'));
|
|
3762
3775
|
const projectDir = resolveProjectDir({ cwd: process.cwd(), env: process.env });
|
|
3763
3776
|
const port = process.env.PORT || 3456;
|
|
3764
|
-
const
|
|
3777
|
+
const { resolveLocalProject } = require(path.join(PKG_ROOT, 'scripts', 'project-identity'));
|
|
3778
|
+
const url = `http://127.0.0.1:${port}/dashboard?project=${encodeURIComponent(resolveLocalProject(projectDir).projectKey)}`;
|
|
3765
3779
|
|
|
3766
3780
|
progress.start(`Starting local dashboard on :${port}…`);
|
|
3767
3781
|
ensureDash(Number(port))
|
|
@@ -4014,7 +4028,7 @@ function help() {
|
|
|
4014
4028
|
console.log(' break-glass --reason="..." Short TTL recovery if gates over-fire');
|
|
4015
4029
|
console.log(' brain [--write] Build the agent-readable context brain (lessons + rules + gates)');
|
|
4016
4030
|
console.log(' pro ThumbGate Pro (dashboard, exports, sync)');
|
|
4017
|
-
console.log(' diagnostic $499
|
|
4031
|
+
console.log(' diagnostic $499 Setup Sprint for one repeated team failure');
|
|
4018
4032
|
console.log(' subscribe <email> Get the 5-min setup guide + weekly tips by email');
|
|
4019
4033
|
console.log('');
|
|
4020
4034
|
console.log('More:');
|
|
@@ -4238,7 +4252,7 @@ const SUBCOMMAND_HELP = {
|
|
|
4238
4252
|
stats: 'Usage: npx thumbgate stats\n\nShow gate enforcement statistics: blocked/warned counts, active gates, time saved.',
|
|
4239
4253
|
trial: 'Usage: npx thumbgate trial\n\nShow Pro trial status, remaining days, and upgrade path.',
|
|
4240
4254
|
pro: 'Usage: npx thumbgate pro [--activate <key>]\n\nLaunch the local Pro dashboard or activate a Pro license key.',
|
|
4241
|
-
diagnostic: 'Usage: npx thumbgate diagnostic\n\nShow the $499
|
|
4255
|
+
diagnostic: 'Usage: npx thumbgate diagnostic\n\nShow the $499 Setup Sprint fit-check and checkout paths for teams with one repeated AI-agent workflow failure.',
|
|
4242
4256
|
subscribe: 'Usage: npx thumbgate subscribe <email>\n\nSubscribe to the 5-minute setup guide + trial reminders.',
|
|
4243
4257
|
lessons: 'Usage: npx thumbgate lessons [--query="..."] [--limit=N]\n\nSearch the lesson database (Pro feature).',
|
|
4244
4258
|
search: 'Usage: npx thumbgate search <query>\n\nSearch ThumbGate knowledge base (Pro feature).',
|
|
@@ -4281,6 +4295,7 @@ const SUBCOMMAND_HELP = {
|
|
|
4281
4295
|
compact: 'Usage: npx thumbgate compact\n\nCompact the lesson database and reclaim disk space.',
|
|
4282
4296
|
'context-packs': 'Usage: npx thumbgate context-packs\n\nGenerate context packs from top failure patterns.',
|
|
4283
4297
|
suggest: 'Usage: npx thumbgate suggest <gate-id>\n\nSuggest fixes for a specific gate based on lesson history.',
|
|
4298
|
+
agents: 'Usage: npx thumbgate agents [--json] [--days=30] [--data-dir=path] [--owner=<id>=<user>] [--register=<id>]\n\n30-day AI governance system of record: lists agents, models, MCP servers, and hook sources with first/last seen, call counts, editable owner (default: machine user), and flags callers outside config/mcp-allowlists.json or the register as "unregistered agent".',
|
|
4284
4299
|
inventory: 'Usage: npx thumbgate inventory [--json] [--days=N] [--data-dir=path] [--max-bytes=N]\n\nRead-only inventory of agent activity in this repo\'s ThumbGate store: agents seen, tool calls by tool, allow/deny counts, deny reasons per gate, top gates, per-day activity, and the false-deny rate.\n\nEvery source reports its own status (ok / empty / missing) so an uninstrumented store never looks like a quiet one. falseDenyRate is null with a stated reason whenever a real denominator was not observed; falseDenyNumerator and falseDenyDenominator are always emitted raw.\n\nEach source is read as a bounded tail (default 8 MiB, --max-bytes to change) so a multi-hundred-MB audit log is never loaded whole. If the tail did not reach back to the start of the window, windowFullyCovered is false and the text output says so.',
|
|
4285
4300
|
'conflict-audit': 'Usage: npx thumbgate conflict-audit [--json] [--offline] [--repo-root=path] [--github-repo=owner/name] [--branch=main] [--consecutive-failures=N] [--excluded-lines=N] [--commits=N]\n\nDeterministic detector for controls that report success but enforce nothing. Six detectors, no model involved:\n\n D1 gate configs declaring a `patterns` array when the engine reads `pattern` (the match block is skipped, so the gate fires on every tool in its toolNames)\n D2 gate patterns that cannot compile (an inline (?i) flag group throws; the engine swallows the throw as "no match")\n D3 checks required by NEITHER classic branch protection NOR any repository ruleset, which have failed on N or more consecutive recent commits\n D4 sonar.exclusions / sonar.coverage.exclusions entries that hide non-trivial code inside sonar.sources from scanning\n D5 modules and entry exports with zero production call sites outside their own tests (for a PUBLISHED package the entry surface is public API whose callers are downstream npm consumers, so those are reported NOT INSPECTED rather than dead)\n D6 the bare `path.resolve(process.argv[1]) === path.resolve(__filename)` main check, which no-ops under an npm bin shim\n\nEvery detector reports its own status: `ran` (inspected), `partial` (some of the surface was not inspected, and which), or `unavailable` (could not inspect at all). An unavailable detector is NEVER reported as clean. D3 needs the `gh` CLI (resolved from a fixed install location, never through $PATH) plus read access to branch protection and repository rulesets; use --offline to skip it explicitly.',
|
|
4286
4301
|
cost: 'Usage: npx thumbgate cost [--json] [--stats <path>] [--mix \'{"claude-sonnet-4-5":0.8,...}\']\n\nShow cumulative $ and tokens saved by PreToolUse gate blocks. Reads ~/.thumbgate/gate-stats.json.',
|
|
@@ -4573,6 +4588,9 @@ switch (COMMAND) {
|
|
|
4573
4588
|
process.exit(1);
|
|
4574
4589
|
});
|
|
4575
4590
|
break;
|
|
4591
|
+
case 'proof':
|
|
4592
|
+
require(path.join(PKG_ROOT, 'scripts', 'proof-report')).runProofCli(process.argv.slice(3));
|
|
4593
|
+
break;
|
|
4576
4594
|
case 'stats':
|
|
4577
4595
|
stats();
|
|
4578
4596
|
upgradeNudge();
|
|
@@ -5494,6 +5512,44 @@ switch (COMMAND) {
|
|
|
5494
5512
|
}
|
|
5495
5513
|
break;
|
|
5496
5514
|
}
|
|
5515
|
+
case 'agents': {
|
|
5516
|
+
const agentArgs = parseArgs(process.argv.slice(3));
|
|
5517
|
+
const {
|
|
5518
|
+
buildAgentRegister,
|
|
5519
|
+
renderAgentRegisterText,
|
|
5520
|
+
updateAgentRegisterEntry,
|
|
5521
|
+
} = require(path.join(PKG_ROOT, 'scripts', 'agent-action-inventory'));
|
|
5522
|
+
const { resolveFeedbackDir } = require(path.join(PKG_ROOT, 'scripts', 'feedback-paths'));
|
|
5523
|
+
const targetDir = agentArgs['data-dir'] || resolveFeedbackDir();
|
|
5524
|
+
if (typeof agentArgs.owner === 'string' && agentArgs.owner.includes('=')) {
|
|
5525
|
+
const eq = agentArgs.owner.indexOf('=');
|
|
5526
|
+
const targetId = agentArgs.owner.slice(0, eq).trim();
|
|
5527
|
+
const nextOwner = agentArgs.owner.slice(eq + 1).trim();
|
|
5528
|
+
updateAgentRegisterEntry({ dataDir: targetDir, id: targetId, owner: nextOwner });
|
|
5529
|
+
}
|
|
5530
|
+
if (typeof agentArgs.register === 'string' && agentArgs.register.trim()) {
|
|
5531
|
+
const ownerOpt = typeof agentArgs.owner === 'string' && !agentArgs.owner.includes('=')
|
|
5532
|
+
? agentArgs.owner.trim()
|
|
5533
|
+
: undefined;
|
|
5534
|
+
updateAgentRegisterEntry({
|
|
5535
|
+
dataDir: targetDir,
|
|
5536
|
+
id: agentArgs.register.trim(),
|
|
5537
|
+
owner: ownerOpt,
|
|
5538
|
+
registered: true,
|
|
5539
|
+
});
|
|
5540
|
+
}
|
|
5541
|
+
const registerReport = buildAgentRegister({
|
|
5542
|
+
dataDir: targetDir,
|
|
5543
|
+
windowDays: agentArgs.days,
|
|
5544
|
+
maxBytes: agentArgs['max-bytes'] ? Number(agentArgs['max-bytes']) : undefined,
|
|
5545
|
+
});
|
|
5546
|
+
if (agentArgs.json) {
|
|
5547
|
+
console.log(JSON.stringify(registerReport, null, 2));
|
|
5548
|
+
} else {
|
|
5549
|
+
process.stdout.write(renderAgentRegisterText(registerReport));
|
|
5550
|
+
}
|
|
5551
|
+
break;
|
|
5552
|
+
}
|
|
5497
5553
|
case 'conflict-audit': {
|
|
5498
5554
|
// Deterministic sweep for controls that report success but enforce
|
|
5499
5555
|
// nothing. Each detector reports its own status, so a surface that could
|
|
@@ -5643,6 +5699,63 @@ switch (COMMAND) {
|
|
|
5643
5699
|
}
|
|
5644
5700
|
break;
|
|
5645
5701
|
}
|
|
5702
|
+
case 'policy-prove': {
|
|
5703
|
+
const args = process.argv.slice(3);
|
|
5704
|
+
const jsonFlag = args.includes('--json') || args.includes('--output=json');
|
|
5705
|
+
const bIdx = args.indexOf('--boundary');
|
|
5706
|
+
const boundaryFile = bIdx >= 0 ? args[bIdx + 1] : null;
|
|
5707
|
+
const candidateFile = args.find((a, idx) => !a.startsWith('--') && idx !== bIdx + 1);
|
|
5708
|
+
if (!candidateFile || !boundaryFile) {
|
|
5709
|
+
console.error('Usage: npx thumbgate policy-prove <candidate.json> --boundary <boundary.json> [--json]');
|
|
5710
|
+
process.exit(2);
|
|
5711
|
+
}
|
|
5712
|
+
try {
|
|
5713
|
+
const { provePolicyBoundary } = require(path.join(PKG_ROOT, 'src', 'openshell-lovable-engine'));
|
|
5714
|
+
const candidate = JSON.parse(fs.readFileSync(path.resolve(CWD, candidateFile), 'utf8'));
|
|
5715
|
+
const boundary = JSON.parse(fs.readFileSync(path.resolve(CWD, boundaryFile), 'utf8'));
|
|
5716
|
+
const verdict = provePolicyBoundary(candidate, boundary);
|
|
5717
|
+
if (jsonFlag) {
|
|
5718
|
+
console.log(JSON.stringify(verdict, null, 2));
|
|
5719
|
+
} else {
|
|
5720
|
+
console.log(`result: ${verdict.result}`);
|
|
5721
|
+
console.log(`coverage: domains=${verdict.coverage.domains.join(',')}`);
|
|
5722
|
+
if (verdict.counterexample) console.log(`counterexample: ${verdict.counterexample}`);
|
|
5723
|
+
if (verdict.reason) console.log(`reason: ${verdict.reason}`);
|
|
5724
|
+
}
|
|
5725
|
+
process.exit(verdict.exitCode);
|
|
5726
|
+
} catch (err) {
|
|
5727
|
+
console.error(`result: error\nreason: ${err.message}`);
|
|
5728
|
+
process.exit(2);
|
|
5729
|
+
}
|
|
5730
|
+
}
|
|
5731
|
+
case 'design-fix': {
|
|
5732
|
+
const args = process.argv.slice(3);
|
|
5733
|
+
const writeInPlace = args.includes('--write');
|
|
5734
|
+
const jsonFlag = args.includes('--json');
|
|
5735
|
+
const allowTailwind = !args.includes('--no-tailwind');
|
|
5736
|
+
const fIdx = args.indexOf('--findings');
|
|
5737
|
+
const findingsArg = fIdx >= 0 ? args[fIdx + 1] : null;
|
|
5738
|
+
const targetFile = args.find((a, idx) => !a.startsWith('--') && (fIdx < 0 || idx !== fIdx + 1));
|
|
5739
|
+
if (!targetFile) {
|
|
5740
|
+
console.error('Usage: npx thumbgate design-fix <file.html|file.tsx|file.css> [--findings <json-or-text>] [--no-tailwind] [--write] [--json]');
|
|
5741
|
+
process.exit(2);
|
|
5742
|
+
}
|
|
5743
|
+
const fullPath = path.resolve(CWD, targetFile);
|
|
5744
|
+
let visualFindings = [];
|
|
5745
|
+
if (findingsArg) {
|
|
5746
|
+
const maybePath = path.resolve(CWD, findingsArg);
|
|
5747
|
+
const rawFindings = fs.existsSync(maybePath) ? fs.readFileSync(maybePath, 'utf8') : findingsArg;
|
|
5748
|
+
try { visualFindings = JSON.parse(rawFindings); } catch { visualFindings = [rawFindings]; }
|
|
5749
|
+
}
|
|
5750
|
+
const { runDesignSelfCorrectionPipeline } = require(path.join(PKG_ROOT, 'src', 'openshell-lovable-engine'));
|
|
5751
|
+
const report = runDesignSelfCorrectionPipeline({ filePath: fullPath, visualFindings, allowTailwind, applyInPlace: writeInPlace, allowDiskRead: true });
|
|
5752
|
+
if (jsonFlag) console.log(JSON.stringify(report, null, 2));
|
|
5753
|
+
else {
|
|
5754
|
+
console.log(`design-fix: ${report.issueCount} AST optimization(s)${report.appliedInPlace ? ` written to ${targetFile}` : ''}`);
|
|
5755
|
+
for (const p of report.patches) console.log(` - [${p.type}] ${p.astPath || p.selector} -> CSS { ${p.cssOverride} }`);
|
|
5756
|
+
}
|
|
5757
|
+
process.exit(0);
|
|
5758
|
+
}
|
|
5646
5759
|
default:
|
|
5647
5760
|
if (COMMAND) {
|
|
5648
5761
|
console.error(`Unknown command: ${COMMAND}`);
|