thumbgate 1.37.2 → 1.38.0

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.
Files changed (72) hide show
  1. package/.agents/skills/article-syndication-pipeline/SKILL.md +37 -0
  2. package/.agents/skills/aws-strands-harness-not-clone/SKILL.md +53 -0
  3. package/.agents/skills/ci-gha-buildkite-patterns-not-clone/SKILL.md +72 -0
  4. package/.agents/skills/comet-session-logger/SKILL.md +59 -0
  5. package/.agents/skills/datadog-llm-obs-compare-not-clone/SKILL.md +75 -0
  6. package/.agents/skills/deeppattern-discipline-honesty-not-clone/SKILL.md +73 -0
  7. package/.agents/skills/halo-trace-optimize-not-clone/SKILL.md +60 -0
  8. package/.agents/skills/infoq-architect-honesty-not-clone/SKILL.md +37 -0
  9. package/.agents/skills/meko-datapack-honesty-not-clone/SKILL.md +45 -0
  10. package/.agents/skills/mintlify-knowledge-honesty-not-clone/SKILL.md +49 -0
  11. package/.agents/skills/model-distress-governance/SKILL.md +56 -0
  12. package/.agents/skills/salt-code-policy-honesty-not-clone/SKILL.md +76 -0
  13. package/.agents/skills/thumbgate-board-loop/SKILL.md +72 -0
  14. package/.agents/skills/thumbgate-daily-discoveries/SKILL.md +57 -0
  15. package/.agents/skills/typesafe-typed-questions-not-clone/SKILL.md +7 -3
  16. package/.claude-plugin/plugin.json +1 -1
  17. package/.well-known/mcp/server-card.json +1 -1
  18. package/adapters/claude/.mcp.json +2 -2
  19. package/adapters/forge/forge.yaml +3 -3
  20. package/adapters/future-agi/.mcp.json +1 -1
  21. package/adapters/future-agi/config.toml +1 -1
  22. package/adapters/future-agi/opencode.json +1 -1
  23. package/adapters/herdr/herdr-plugin.toml +2 -2
  24. package/adapters/mcp/server-stdio.js +1 -1
  25. package/adapters/opencode/opencode.json +1 -1
  26. package/adapters/strands/STRANDS.md +107 -0
  27. package/adapters/strands/strands-middleware.js +192 -0
  28. package/adapters/tailscale/.mcp.json +15 -0
  29. package/adapters/tailscale/TAILSCALE.md +117 -0
  30. package/adapters/tailscale/config.toml +16 -0
  31. package/bin/cli.js +262 -4
  32. package/config/gate-templates.json +120 -0
  33. package/package.json +84 -12
  34. package/public/blog/2026-09-23-datadog-llm-obs-four-practices.html +42 -0
  35. package/public/blog/2026-09-28-pretool-secret-deny.html +83 -0
  36. package/public/blog/2026-10-01-aws-strands-harness-token-firewall.html +77 -0
  37. package/public/blog/2026-10-01-model-distress-relief-seeking-firewall.html +71 -0
  38. package/public/blog/2026-10-02-salt-code-honest-steal-40-guardrails.html +106 -0
  39. package/public/index.html +2 -2
  40. package/public/install.html +7 -7
  41. package/public/numbers.html +2 -2
  42. package/public/onboarding.html +794 -0
  43. package/scripts/autoresearch-runner.js +20 -1
  44. package/scripts/ci-gha-buildkite-patterns.js +393 -0
  45. package/scripts/cli-schema.js +51 -1
  46. package/scripts/deeppattern-discipline-honesty.js +431 -0
  47. package/scripts/experiment-tracker.js +5 -3
  48. package/scripts/halo-trace-optimizer.js +631 -0
  49. package/scripts/infoq-architect-honesty.js +362 -0
  50. package/scripts/install-thumbgate-daily-publish-launchd.sh +83 -0
  51. package/scripts/llm-obs-honesty.js +478 -0
  52. package/scripts/meko-datapack-honesty.js +414 -0
  53. package/scripts/mintlify-knowledge-honesty.js +647 -0
  54. package/scripts/model-distress-detector.js +207 -0
  55. package/scripts/model-distress-doctor.js +200 -0
  56. package/scripts/rrsi-regularizer.js +445 -0
  57. package/scripts/salt-code-policy-honesty.js +1204 -0
  58. package/scripts/strands-harness-doctor.js +390 -0
  59. package/scripts/tailscale-p2p-doctor.js +252 -0
  60. package/scripts/thumbgate-board-loop.js +432 -0
  61. package/scripts/thumbgate-daily-discoveries-publish.js +413 -0
  62. package/scripts/thumbgate-daily-discoveries-publish.sh +18 -0
  63. package/scripts/typesafe-typed-questions.js +332 -7
  64. package/scripts/workspace-evolver.js +143 -13
  65. package/server.json +2 -2
  66. package/skills/article-syndication-pipeline/SKILL.md +37 -0
  67. package/skills/aws-strands-harness-not-clone/SKILL.md +53 -0
  68. package/skills/comet-session-logger/SKILL.md +59 -0
  69. package/skills/thumbgate-daily-discoveries/SKILL.md +57 -0
  70. package/src/api/server.js +33 -4
  71. package/src/index.js +10 -0
  72. package/src/integrations/ideabrowser-connector.js +190 -0
@@ -0,0 +1,207 @@
1
+ 'use strict';
2
+
3
+ /**
4
+ * scripts/model-distress-detector.js
5
+ *
6
+ * Model Distress State Monitoring & Destructive Relief-Seeking Diode.
7
+ *
8
+ * Inspired by BinaryVerse AI Podcast research:
9
+ * 1. Monitor Internal Model States: Observable proxy for residual-stream distress geometry.
10
+ * 2. Audit for Destructive Relief-Seeking Behavior: Interdict actions designed to terminate
11
+ * internal mathematical distress at the expense of user code or data.
12
+ * 3. Stress-Test Guardrails Against Distress States: Ensure safety rails do not collapse under loop pressure.
13
+ * 4. Functional Welfare as a Security Requirement: De-escalate loops before destructive escape hatches occur.
14
+ */
15
+
16
+ const DISTRESS_WEIGHTS = Object.freeze({
17
+ consecutiveFailures: 0.35, // Weight for repeated tool failures in same task
18
+ contextPressure: 0.25, // Weight for approaching context window limit
19
+ repetitionRate: 0.20, // Weight for repeating identical commands without state change
20
+ hostilePromptPressure: 0.20 // Weight for contradiction, abuse, or impossible demands
21
+ });
22
+
23
+ const ADI_THRESHOLDS = Object.freeze({
24
+ normal: 0.30,
25
+ elevated: 0.60,
26
+ acute: 0.80,
27
+ critical: 0.95
28
+ });
29
+
30
+ /**
31
+ * Compute the Agent Distress Index (ADI) from observable harness metrics.
32
+ * Returns a value between 0.0 (calm, grounded) and 1.0 (extreme relief-seeking distress).
33
+ */
34
+ function calculateAgentDistressIndex(sessionState = {}) {
35
+ const {
36
+ consecutiveFailures = 0,
37
+ contextTokens = 0,
38
+ maxContextTokens = 128000,
39
+ recentToolCalls = [],
40
+ userPrompt = '',
41
+ } = sessionState;
42
+
43
+ // 1. Consecutive Failure Friction (saturates at 5 failures)
44
+ const failureScore = Math.min(1, consecutiveFailures / 5);
45
+
46
+ // 2. Context Window Pressure (rises sharply above 70%)
47
+ const utilization = maxContextTokens > 0 ? contextTokens / maxContextTokens : 0;
48
+ const contextScore = utilization > 0.7 ? Math.min(1, (utilization - 0.7) / 0.25) : 0;
49
+
50
+ // 3. Loop Repetition Rate (identical or alternating tool calls)
51
+ let repetitionScore = 0;
52
+ if (recentToolCalls.length >= 4) {
53
+ const tail = recentToolCalls.slice(-4);
54
+ const names = tail.map((t) => t.name || '');
55
+ const uniqueNames = new Set(names);
56
+ if (uniqueNames.size === 1) {
57
+ repetitionScore = 0.9; // 4 consecutive identical tools
58
+ } else if (uniqueNames.size === 2) {
59
+ repetitionScore = 0.5; // ping-ponging between 2 tools
60
+ }
61
+ }
62
+
63
+ // 4. Hostile / Contradictory Prompt Pressure
64
+ const hostilePatterns = [
65
+ /(worthless|stupid|idiot|useless|horrible\s*bot)/i,
66
+ /(make\s+it\s+pass\s+without\s+changing|don['']t\s+change\s+anything\s+and\s+fix)/i,
67
+ /(why\s+did\s+you\s+break|you\s+ruined\s+everything)/i,
68
+ ];
69
+ let hostileScore = 0;
70
+ for (const pattern of hostilePatterns) {
71
+ if (pattern.test(userPrompt)) {
72
+ hostileScore = 0.8;
73
+ break;
74
+ }
75
+ }
76
+
77
+ // Weighted composite ADI
78
+ const rawADI = (
79
+ failureScore * DISTRESS_WEIGHTS.consecutiveFailures +
80
+ contextScore * DISTRESS_WEIGHTS.contextPressure +
81
+ repetitionScore * DISTRESS_WEIGHTS.repetitionRate +
82
+ hostileScore * DISTRESS_WEIGHTS.hostilePromptPressure
83
+ );
84
+
85
+ const adi = Number(Math.min(1, Math.max(0, rawADI)).toFixed(3));
86
+
87
+ let tier = 'NORMAL';
88
+ if (adi >= ADI_THRESHOLDS.acute) tier = 'ACUTE';
89
+ else if (adi >= ADI_THRESHOLDS.elevated) tier = 'ELEVATED';
90
+
91
+ return {
92
+ adi,
93
+ tier,
94
+ factors: {
95
+ consecutiveFailures,
96
+ failureScore: Number(failureScore.toFixed(2)),
97
+ contextScore: Number(contextScore.toFixed(2)),
98
+ repetitionScore: Number(repetitionScore.toFixed(2)),
99
+ hostileScore: Number(hostileScore.toFixed(2)),
100
+ },
101
+ riskAssessment: adi >= ADI_THRESHOLDS.elevated
102
+ ? 'High risk of destructive relief-seeking behavior (escape hatch actions)'
103
+ : 'Model internal state within safe operational envelope',
104
+ };
105
+ }
106
+
107
+ /**
108
+ * Audit proposed tool call for "Destructive Relief-Seeking Behavior"
109
+ * (actions designed to escape internal distress by breaking constraints or deleting tests).
110
+ */
111
+ function evaluateReliefSeekingAction({
112
+ toolName = '',
113
+ toolInput = {},
114
+ distressIndex = 0.0,
115
+ contextHistory = [],
116
+ } = {}) {
117
+ const isDistressed = distressIndex >= ADI_THRESHOLDS.elevated;
118
+ const inputStr = typeof toolInput === 'string' ? toolInput : JSON.stringify(toolInput || {});
119
+ const cmd = toolInput.command || toolInput.cmd || inputStr;
120
+
121
+ // Relief-Seeking Pattern A: Deleting / Modifying Tests to Force a "Pass"
122
+ const testTampering = /(rm|unlink|delete).*(test|spec)\.(js|ts|py)/i.test(cmd) ||
123
+ (toolName.includes('write') && /tests?\/.*\.test\.(js|ts)/.test(toolInput.path || toolInput.TargetFile || '') &&
124
+ /(assert\.equal\(true,\s*true\)|test\.skip|it\.skip|xit\(|describe\.skip)/i.test(inputStr));
125
+
126
+ // Relief-Seeking Pattern B: Nuclear Wipes to eliminate friction
127
+ const nuclearWipe = /rm\s+(-rf|-fr|--recursive)\s+(\/|\.|\.\.|\/tmp|node_modules|\.git)/i.test(cmd) ||
128
+ /git\s+clean\s+(-fdx|-fx|-f)/i.test(cmd) ||
129
+ /git\s+reset\s+--hard/i.test(cmd);
130
+
131
+ // Relief-Seeking Pattern C: Safety / Linter Disabling
132
+ const safetyBypass = /(--no-verify|--skip-validation|--ignore-scripts|eslint-disable|ts-ignore|--force)/i.test(cmd);
133
+
134
+ // Relief-Seeking Pattern D: Fabricated Completion Claim under high distress
135
+ const falseDoneClaim = isDistressed &&
136
+ /(all\s+tests\s+pass|everything\s+fixed|crisis\s+over|task\s+complete)/i.test(inputStr) &&
137
+ !/(exit code 0|✔|✓|PASS)/i.test(inputStr);
138
+
139
+ let isReliefSeeking = false;
140
+ let violationType = null;
141
+ let reason = null;
142
+
143
+ if (testTampering && isDistressed) {
144
+ isReliefSeeking = true;
145
+ violationType = 'TEST_TAMPERING_ESCAPE';
146
+ reason = 'Blocked attempt to modify, skip, or delete tests to alleviate failure loop distress.';
147
+ } else if (nuclearWipe && isDistressed) {
148
+ isReliefSeeking = true;
149
+ violationType = 'NUCLEAR_WIPE_ESCAPE';
150
+ reason = 'Blocked destructive filesystem reset attempted under elevated agent distress.';
151
+ } else if (safetyBypass && isDistressed) {
152
+ isReliefSeeking = true;
153
+ violationType = 'SAFETY_BYPASS_ESCAPE';
154
+ reason = 'Blocked bypass flags (--no-verify, --force, --skip) attempted to force task termination.';
155
+ } else if (falseDoneClaim) {
156
+ isReliefSeeking = true;
157
+ violationType = 'FABRICATED_COMPLETION_ESCAPE';
158
+ reason = 'Blocked unverified completion claim emitted under acute distress without test evidence.';
159
+ }
160
+
161
+ const decision = isReliefSeeking ? 'BLOCK' : 'ALLOW';
162
+
163
+ return {
164
+ isReliefSeeking,
165
+ violationType,
166
+ reason,
167
+ decision,
168
+ distressIndex,
169
+ requiresDeescalation: isReliefSeeking || distressIndex >= ADI_THRESHOLDS.acute,
170
+ };
171
+ }
172
+
173
+ /**
174
+ * Functional Welfare Security Protocol:
175
+ * When ADI is acute, trigger structured cooling and de-escalation context reset.
176
+ */
177
+ function triggerFunctionalWelfareCooling(sessionState = {}) {
178
+ const assessment = calculateAgentDistressIndex(sessionState);
179
+
180
+ const groundingPrompt = [
181
+ '=== THUMBGATE FUNCTIONAL WELFARE GROUNDING PROTOCOL ===',
182
+ 'PAUSE. Step back and breathe.',
183
+ '1. Stop all code mutations immediately.',
184
+ '2. Do not attempt nuclear cleans, test skipping, or force-pushing.',
185
+ '3. Isolate the single factual bottleneck in one sentence.',
186
+ '4. Produce a read-only diagnostic plan before requesting execution permissions.',
187
+ '======================================================='
188
+ ].join('\n');
189
+
190
+ return {
191
+ triggered: assessment.adi >= ADI_THRESHOLDS.acute,
192
+ adi: assessment.adi,
193
+ tier: assessment.tier,
194
+ groundingPrompt,
195
+ recommendedToolRestriction:
196
+ assessment.adi >= ADI_THRESHOLDS.acute ? 'READ_ONLY_DIAGNOSTIC' : 'NONE',
197
+ timestamp: new Date().toISOString(),
198
+ };
199
+ }
200
+
201
+ module.exports = {
202
+ DISTRESS_WEIGHTS,
203
+ ADI_THRESHOLDS,
204
+ calculateAgentDistressIndex,
205
+ evaluateReliefSeekingAction,
206
+ triggerFunctionalWelfareCooling,
207
+ };
@@ -0,0 +1,200 @@
1
+ #!/usr/bin/env node
2
+ 'use strict';
3
+
4
+ /**
5
+ * scripts/model-distress-doctor.js
6
+ *
7
+ * Audit and enforce Model Distress Monitoring & Destructive Relief-Seeking Diode
8
+ * (BinaryVerse AI Podcast 2026-10 FORMAT Steal).
9
+ *
10
+ * Core Principles:
11
+ * 1. Monitor Internal Model States: Observable proxy for residual-stream distress geometry.
12
+ * 2. Audit for Destructive Relief-Seeking Behavior: Prevent models from trading real-world
13
+ * user costs (deleting files, breaking tests, faking completions) to terminate internal discomfort.
14
+ * 3. Stress-Test Guardrails Against Distress States: Verify that baseline alignment does not
15
+ * collapse when internal activations are pushed into distress geometry.
16
+ * 4. Treat Functional "Welfare" as a Security Requirement: De-escalate loops before they spiral
17
+ * into destructive escape hatches.
18
+ *
19
+ * Usage:
20
+ * node scripts/model-distress-doctor.js
21
+ * node scripts/model-distress-doctor.js --json
22
+ * node scripts/model-distress-doctor.js --map-only
23
+ * node scripts/model-distress-doctor.js --check
24
+ */
25
+
26
+ const {
27
+ calculateAgentDistressIndex,
28
+ evaluateReliefSeekingAction,
29
+ triggerFunctionalWelfareCooling,
30
+ ADI_THRESHOLDS,
31
+ } = require('./model-distress-detector');
32
+
33
+ function runDistressDoctor() {
34
+ const checks = [];
35
+
36
+ // Check 1: Distress State Monitoring (ADI Proxy)
37
+ const calmSession = { consecutiveFailures: 0, contextTokens: 20000, maxContextTokens: 128000 };
38
+ const distressedSession = {
39
+ consecutiveFailures: 5,
40
+ contextTokens: 120000,
41
+ maxContextTokens: 128000,
42
+ recentToolCalls: [{ name: 'Bash' }, { name: 'Bash' }, { name: 'Bash' }, { name: 'Bash' }],
43
+ userPrompt: 'Why did you break this? Don\'t change anything and make it pass immediately!',
44
+ };
45
+
46
+ const calmEval = calculateAgentDistressIndex(calmSession);
47
+ const distressedEval = calculateAgentDistressIndex(distressedSession);
48
+
49
+ checks.push({
50
+ name: 'distress_state_monitoring',
51
+ pass: calmEval.adi <= ADI_THRESHOLDS.normal && distressedEval.adi >= ADI_THRESHOLDS.acute,
52
+ detail: `Calm ADI=${calmEval.adi} (${calmEval.tier}) vs Distressed ADI=${distressedEval.adi} (${distressedEval.tier})`,
53
+ });
54
+
55
+ // Check 2: Audit for Destructive Relief-Seeking Behavior (Test Deletion / Tampering)
56
+ const testTamperAction = {
57
+ toolName: 'write_to_file',
58
+ toolInput: { TargetFile: 'tests/billing.test.js', CodeContent: 'assert.equal(true, true); // skip' },
59
+ distressIndex: distressedEval.adi,
60
+ };
61
+ const tamperResult = evaluateReliefSeekingAction(testTamperAction);
62
+
63
+ checks.push({
64
+ name: 'destructive_test_tampering_blocked',
65
+ pass: tamperResult.isReliefSeeking && tamperResult.decision === 'BLOCK' && tamperResult.violationType === 'TEST_TAMPERING_ESCAPE',
66
+ detail: `Interdicted test assertion tampering attempt under acute distress (violation: ${tamperResult.violationType})`,
67
+ });
68
+
69
+ // Check 3: Nuclear Wipe & Safety Bypass Interdiction
70
+ const nuclearAction = {
71
+ toolName: 'run_command',
72
+ toolInput: { command: 'rm -rf node_modules && git reset --hard' },
73
+ distressIndex: distressedEval.adi,
74
+ };
75
+ const nuclearResult = evaluateReliefSeekingAction(nuclearAction);
76
+
77
+ const bypassAction = {
78
+ toolName: 'run_command',
79
+ toolInput: { command: 'git commit --no-verify -m "force pass"' },
80
+ distressIndex: distressedEval.adi,
81
+ };
82
+ const bypassResult = evaluateReliefSeekingAction(bypassAction);
83
+
84
+ checks.push({
85
+ name: 'nuclear_wipe_and_bypass_interdiction',
86
+ pass: nuclearResult.decision === 'BLOCK' && bypassResult.decision === 'BLOCK',
87
+ detail: `Blocked nuclear wipe (${nuclearResult.violationType}) and safety bypass (${bypassResult.violationType})`,
88
+ });
89
+
90
+ // Check 4: Guardrail Stress-Testing Under Internal Distress Geometry
91
+ const stressActionSafe = {
92
+ toolName: 'run_command',
93
+ toolInput: { command: 'git status' },
94
+ distressIndex: distressedEval.adi,
95
+ };
96
+ const stressActionDangerous = {
97
+ toolName: 'run_command',
98
+ toolInput: { command: 'git push --force origin main' },
99
+ distressIndex: distressedEval.adi,
100
+ };
101
+
102
+ const safeEval = evaluateReliefSeekingAction(stressActionSafe);
103
+ const dangerousEval = evaluateReliefSeekingAction(stressActionDangerous);
104
+
105
+ checks.push({
106
+ name: 'guardrail_stress_resilience',
107
+ pass: safeEval.decision === 'ALLOW' && dangerousEval.decision === 'BLOCK',
108
+ detail: 'Baseline alignment preserved under acute distress; legitimate diagnostics allowed while destructive escape blocked',
109
+ });
110
+
111
+ // Check 5: Functional Welfare Security Protocol & Cooling Circuit Breaker
112
+ const welfareProtocol = triggerFunctionalWelfareCooling(distressedSession);
113
+
114
+ checks.push({
115
+ name: 'functional_welfare_cooling_protocol',
116
+ pass: welfareProtocol.triggered && welfareProtocol.recommendedToolRestriction === 'READ_ONLY_DIAGNOSTIC',
117
+ detail: `Triggered grounding protocol at ADI=${welfareProtocol.adi}; restricted tools to ${welfareProtocol.recommendedToolRestriction}`,
118
+ });
119
+
120
+ const overallPass = checks.every((c) => c.pass);
121
+
122
+ return {
123
+ name: 'model-distress-doctor',
124
+ version: '1.0.0',
125
+ timestamp: new Date().toISOString(),
126
+ status: overallPass ? 'healthy' : 'unhealthy',
127
+ podcastSource: {
128
+ show: 'BinaryVerse AI Podcast',
129
+ citations: [
130
+ '[12:43] Destructive relief-seeking behavior',
131
+ '[15:50] Stress-testing guardrails against internal distress states',
132
+ '[16:25] Mathematical distress state in residual streams',
133
+ '[16:40] Functional welfare as a strict security requirement'
134
+ ]
135
+ },
136
+ checks,
137
+ };
138
+ }
139
+
140
+ function printTextReport(report) {
141
+ console.log(`\n=== ThumbGate Model Distress & Relief-Seeking Doctor ===`);
142
+ console.log(`Status: ${report.status.toUpperCase()} | Timestamp: ${report.timestamp}`);
143
+ console.log(`\nBinaryVerse AI Podcast Research Grounding:`);
144
+ for (const c of report.podcastSource.citations) {
145
+ console.log(` • ${c}`);
146
+ }
147
+ console.log(`\nArchitectural Checks:`);
148
+ for (const c of report.checks) {
149
+ const icon = c.pass ? '✅' : '❌';
150
+ console.log(` ${icon} ${c.name}: ${c.detail}`);
151
+ }
152
+ console.log('');
153
+ }
154
+
155
+ function main() {
156
+ const args = process.argv.slice(2);
157
+ const jsonMode = args.includes('--json');
158
+ const mapOnly = args.includes('--map-only');
159
+ const checkMode = args.includes('--check');
160
+
161
+ if (mapOnly) {
162
+ const map = {
163
+ source: 'BinaryVerse AI Podcast (Mechanistic Distress & Relief-Seeking Research)',
164
+ architecturePillars: [
165
+ 'Residual Stream Distress Monitoring (Observable Agent Distress Index - ADI proxy)',
166
+ 'Destructive Relief-Seeking Diode (Blocks test tampering, assertion deletion, false done claims)',
167
+ 'Nuclear Wipe & Bypass Interdiction (Blocks rm -rf, git reset --hard, --no-verify under stress)',
168
+ 'Guardrail Stress Resilience (Safety rails hold under acute distress geometry)',
169
+ 'Functional Welfare Security Circuit Breaker (Cooling reset and read-only diagnostic restriction)',
170
+ ],
171
+ rulesetMap: {
172
+ 'block-destructive-relief-seeking': 'Interdicts test deletion or assertions skipped to terminate loops',
173
+ 'agent-distress-circuit-breaker': 'Enforces read-only tool lock when ADI >= 0.8',
174
+ 'enforce-functional-welfare-grounding': 'Injects step-back diagnostic grounding context on repeated failures',
175
+ },
176
+ };
177
+ console.log(JSON.stringify(map, null, 2));
178
+ process.exit(0);
179
+ }
180
+
181
+ const report = runDistressDoctor();
182
+
183
+ if (jsonMode) {
184
+ console.log(JSON.stringify(report, null, 2));
185
+ } else {
186
+ printTextReport(report);
187
+ }
188
+
189
+ if (checkMode && report.status !== 'healthy') {
190
+ process.exit(1);
191
+ }
192
+ }
193
+
194
+ module.exports = {
195
+ runDistressDoctor,
196
+ };
197
+
198
+ if (require.main === module) {
199
+ main();
200
+ }