@triedotdev/mcp 1.0.102 → 1.0.103
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/README.md +0 -1
- package/dist/{chunk-OVRG5RP3.js → chunk-33WL3D7A.js} +3 -5
- package/dist/{chunk-OVRG5RP3.js.map → chunk-33WL3D7A.js.map} +1 -1
- package/dist/{chunk-JDHR5BDR.js → chunk-6JPPYG7F.js} +928 -258
- package/dist/chunk-6JPPYG7F.js.map +1 -0
- package/dist/{chunk-M4JCQO5G.js → chunk-CKYU5JOD.js} +579 -114
- package/dist/chunk-CKYU5JOD.js.map +1 -0
- package/dist/{chunk-B3MNN3XB.js → chunk-HFKOGW7H.js} +6 -8
- package/dist/{chunk-B3MNN3XB.js.map → chunk-HFKOGW7H.js.map} +1 -1
- package/dist/chunk-HIKONDDO.js +26 -0
- package/dist/chunk-HIKONDDO.js.map +1 -0
- package/dist/chunk-M4YMTHGG.js +2822 -0
- package/dist/chunk-M4YMTHGG.js.map +1 -0
- package/dist/{chunk-NIASHOAB.js → chunk-SPQJC7RA.js} +5 -5
- package/dist/cli/main.js +16 -18
- package/dist/cli/main.js.map +1 -1
- package/dist/cli/yolo-daemon.js +17 -64
- package/dist/cli/yolo-daemon.js.map +1 -1
- package/dist/{goal-manager-LAOT4QQX.js → goal-manager-AP4LTE6U.js} +3 -4
- package/dist/{guardian-agent-M352CBE5.js → guardian-agent-WB6LWRLM.js} +7 -8
- package/dist/index.js +41 -119
- package/dist/index.js.map +1 -1
- package/package.json +4 -1
- package/dist/chunk-AE2XLMZC.js +0 -6152
- package/dist/chunk-AE2XLMZC.js.map +0 -1
- package/dist/chunk-CCI6LKXZ.js +0 -526
- package/dist/chunk-CCI6LKXZ.js.map +0 -1
- package/dist/chunk-JDHR5BDR.js.map +0 -1
- package/dist/chunk-M4JCQO5G.js.map +0 -1
- package/dist/chunk-R3I2GCZC.js +0 -682
- package/dist/chunk-R3I2GCZC.js.map +0 -1
- package/dist/issue-store-W2X33X2X.js +0 -28
- package/dist/issue-store-W2X33X2X.js.map +0 -1
- /package/dist/{chunk-NIASHOAB.js.map → chunk-SPQJC7RA.js.map} +0 -0
- /package/dist/{goal-manager-LAOT4QQX.js.map → goal-manager-AP4LTE6U.js.map} +0 -0
- /package/dist/{guardian-agent-M352CBE5.js.map → guardian-agent-WB6LWRLM.js.map} +0 -0
package/dist/cli/yolo-daemon.js
CHANGED
|
@@ -3,21 +3,20 @@ import {
|
|
|
3
3
|
InteractiveDashboard,
|
|
4
4
|
StreamingManager,
|
|
5
5
|
TrieScanTool
|
|
6
|
-
} from "../chunk-
|
|
7
|
-
import "../chunk-
|
|
6
|
+
} from "../chunk-M4YMTHGG.js";
|
|
7
|
+
import "../chunk-HFKOGW7H.js";
|
|
8
8
|
import {
|
|
9
9
|
isTrieInitialized
|
|
10
|
-
} from "../chunk-
|
|
11
|
-
import "../chunk-
|
|
12
|
-
import "../chunk-F4NJ4CBP.js";
|
|
10
|
+
} from "../chunk-HIKONDDO.js";
|
|
11
|
+
import "../chunk-SPQJC7RA.js";
|
|
13
12
|
import "../chunk-IXO4G4D3.js";
|
|
14
|
-
import "../chunk-
|
|
15
|
-
import "../chunk-
|
|
16
|
-
import "../chunk-R3I2GCZC.js";
|
|
17
|
-
import "../chunk-JDHR5BDR.js";
|
|
13
|
+
import "../chunk-33WL3D7A.js";
|
|
14
|
+
import "../chunk-6JPPYG7F.js";
|
|
18
15
|
import {
|
|
19
16
|
getWorkingDirectory
|
|
20
17
|
} from "../chunk-R4AAPFXC.js";
|
|
18
|
+
import "../chunk-F4NJ4CBP.js";
|
|
19
|
+
import "../chunk-6NLHFIYA.js";
|
|
21
20
|
import {
|
|
22
21
|
isInteractiveMode,
|
|
23
22
|
setInteractiveMode
|
|
@@ -102,9 +101,6 @@ var WatchDaemon = class {
|
|
|
102
101
|
this.streamingManager = new StreamingManager();
|
|
103
102
|
this.dashboard = new InteractiveDashboard();
|
|
104
103
|
this.streamingManager.subscribe((update) => this.dashboard?.handleStreamUpdate(update));
|
|
105
|
-
this.dashboard.onMoneybagsChange(() => {
|
|
106
|
-
this.recalculateMoneybags();
|
|
107
|
-
});
|
|
108
104
|
await this.dashboard.start();
|
|
109
105
|
this.streamingManager.reportWatchStatus({
|
|
110
106
|
watching: !this.config.runOnce,
|
|
@@ -146,36 +142,14 @@ var WatchDaemon = class {
|
|
|
146
142
|
if (this.config.workers !== void 0) scanArgs.workers = this.config.workers;
|
|
147
143
|
if (this.config.timeoutMs) scanArgs.timeoutMs = this.config.timeoutMs;
|
|
148
144
|
if (this.config.forceScouts) scanArgs.forceAgents = this.config.forceScouts;
|
|
149
|
-
if (this.dashboard && typeof this.dashboard.
|
|
150
|
-
const
|
|
151
|
-
scanArgs.
|
|
152
|
-
scanArgs.
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
industry: this.config.industry || guardianConfig.moneybags.industry
|
|
158
|
-
};
|
|
159
|
-
scanArgs.agentSmithConfig = {
|
|
160
|
-
aiEnhancement: guardianConfig.agentSmith.aiEnhancement,
|
|
161
|
-
minSeverity: guardianConfig.agentSmith.minSeverity,
|
|
162
|
-
enabledCategories: { ...guardianConfig.agentSmith.enabledCategories },
|
|
163
|
-
memoryRetentionDays: guardianConfig.agentSmith.memoryRetentionDays
|
|
164
|
-
};
|
|
165
|
-
scanArgs.parallel = guardianConfig.performance.parallel;
|
|
166
|
-
scanArgs.cache = guardianConfig.performance.cache;
|
|
167
|
-
scanArgs.maxConcurrency = guardianConfig.performance.maxConcurrency;
|
|
168
|
-
scanArgs.timeoutMs = guardianConfig.performance.timeoutMs;
|
|
169
|
-
scanArgs.workers = guardianConfig.performance.workers;
|
|
170
|
-
scanArgs.streaming = guardianConfig.performance.streaming;
|
|
171
|
-
} else {
|
|
172
|
-
if (this.config.userCount || this.config.industry) {
|
|
173
|
-
scanArgs.userCount = this.config.userCount;
|
|
174
|
-
scanArgs.moneybagsConfig = {
|
|
175
|
-
userCount: this.config.userCount || 250,
|
|
176
|
-
...this.config.industry && { industry: this.config.industry }
|
|
177
|
-
};
|
|
178
|
-
}
|
|
145
|
+
if (this.dashboard && typeof this.dashboard.getAgentConfig === "function") {
|
|
146
|
+
const agentConfig = this.dashboard.getAgentConfig();
|
|
147
|
+
scanArgs.parallel = agentConfig.performance.parallel;
|
|
148
|
+
scanArgs.cache = agentConfig.performance.cache;
|
|
149
|
+
scanArgs.maxConcurrency = agentConfig.performance.maxConcurrency;
|
|
150
|
+
scanArgs.timeoutMs = agentConfig.performance.timeoutMs;
|
|
151
|
+
scanArgs.workers = agentConfig.performance.workers;
|
|
152
|
+
scanArgs.streaming = agentConfig.performance.streaming;
|
|
179
153
|
}
|
|
180
154
|
if (this.streamingManager) scanArgs.streamingManager = this.streamingManager;
|
|
181
155
|
if (this.dashboard) scanArgs.dashboard = this.dashboard;
|
|
@@ -291,14 +265,6 @@ var WatchDaemon = class {
|
|
|
291
265
|
await this.runScan(files);
|
|
292
266
|
this.isProcessing = false;
|
|
293
267
|
}
|
|
294
|
-
/**
|
|
295
|
-
* Recalculate Moneybags costs with updated settings
|
|
296
|
-
* This re-runs only the Moneybags agent on previously scanned issues
|
|
297
|
-
*/
|
|
298
|
-
recalculateMoneybags() {
|
|
299
|
-
this.log("info", "Recalculating Moneybags costs with new settings...");
|
|
300
|
-
void this.runScan(this.config.files);
|
|
301
|
-
}
|
|
302
268
|
/**
|
|
303
269
|
* Log a message
|
|
304
270
|
*/
|
|
@@ -449,22 +415,10 @@ function parseArgs() {
|
|
|
449
415
|
config2.userCount = parseInt(nextArg || "250", 10);
|
|
450
416
|
i++;
|
|
451
417
|
break;
|
|
452
|
-
case "--industry":
|
|
453
|
-
if (nextArg && ["solopreneur", "startup", "fintech", "healthcare", "enterprise", "saas", "ecommerce"].includes(nextArg)) {
|
|
454
|
-
config2.industry = nextArg;
|
|
455
|
-
i++;
|
|
456
|
-
} else {
|
|
457
|
-
if (!process.stdout.isTTY || process.argv.includes("--non-interactive")) {
|
|
458
|
-
console.error(`Invalid industry: ${nextArg || "(none)"}`);
|
|
459
|
-
console.error("Valid options: solopreneur, startup, fintech, healthcare, enterprise, saas, ecommerce");
|
|
460
|
-
}
|
|
461
|
-
process.exit(1);
|
|
462
|
-
}
|
|
463
|
-
break;
|
|
464
418
|
case "--help":
|
|
465
419
|
case "-h":
|
|
466
420
|
console.log(`
|
|
467
|
-
Trie
|
|
421
|
+
Trie Agent - File Watcher & Scanner
|
|
468
422
|
|
|
469
423
|
USAGE:
|
|
470
424
|
trie watch [options] Watch for changes and scan continuously
|
|
@@ -477,7 +431,6 @@ OPTIONS:
|
|
|
477
431
|
--agents <list> Alias for --scouts (backward compatibility)
|
|
478
432
|
--files <list> Comma-separated file list to scan
|
|
479
433
|
--users, -u <count> User count for cost estimation (default: 250)
|
|
480
|
-
--industry <type> Industry type for cost scaling (solopreneur, startup, fintech, healthcare, enterprise, saas, ecommerce)
|
|
481
434
|
|
|
482
435
|
OUTPUT:
|
|
483
436
|
--json Output as JSON (for log aggregation)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/cli/yolo-daemon.ts"],"sourcesContent":["#!/usr/bin/env node\n/**\n * Trie Guardian - File Watcher & Scanner\n * \n * Watches a directory and reports issues as they occur.\n * Also handles one-shot scanning via --once flag.\n * \n * Usage:\n * trie watch [options] # Watch for changes\n * trie scan [options] # Scan once and exit\n * \n * See `trie watch --help` for all options.\n */\n\nimport { watch, existsSync, statSync, readFileSync } from 'fs';\nimport { readdir } from 'fs/promises';\nimport { join, extname, basename, resolve } from 'path';\nimport { TrieScanTool } from '../tools/scan.js';\nimport { StreamingManager } from '../utils/streaming.js';\nimport { InteractiveDashboard } from './interactive-dashboard.js';\nimport { getWorkingDirectory } from '../utils/workspace.js';\nimport { isInteractiveMode, setInteractiveMode } from '../utils/progress.js';\nimport { isTrieInitialized } from '../utils/trie-init.js';\n\n// File extensions to watch\nconst WATCH_EXTENSIONS = new Set([\n '.ts', '.tsx', '.js', '.jsx', '.mjs',\n '.vue', '.svelte', '.astro',\n '.py', '.go', '.rs'\n]);\n\n// Directories to skip\nconst SKIP_DIRS = new Set([\n 'node_modules', '.git', 'dist', 'build', '.next', '.nuxt',\n 'coverage', '.turbo', '.cache', '__pycache__', '.venv'\n]);\n\ninterface DaemonConfig {\n directory: string;\n debounceMs: number;\n jsonOutput: boolean;\n runOnce: boolean;\n format?: 'text' | 'json';\n output?: string;\n parallel?: boolean;\n cache?: boolean;\n maxConcurrency?: number;\n streaming?: boolean;\n interactive?: boolean;\n workers?: boolean;\n timeoutMs?: number;\n files?: string[];\n /** Comma-separated list of scouts to run (e.g., \"security,legal\") */\n forceScouts?: string[];\n /** User count for cost estimation (default: 250) */\n userCount?: number;\n /** Industry for Moneybags cost scaling */\n industry?: 'solopreneur' | 'startup' | 'fintech' | 'healthcare' | 'enterprise' | 'saas' | 'ecommerce';\n}\n\ninterface DaemonStats {\n filesScanned: number;\n issuesFound: number;\n errors: number;\n startTime: number;\n}\n\nclass WatchDaemon {\n private config: DaemonConfig;\n private stats: DaemonStats;\n private scanTool = new TrieScanTool();\n private watchers: Map<string, ReturnType<typeof watch>> = new Map();\n private pendingFiles: Set<string> = new Set();\n private debounceTimer: NodeJS.Timeout | null = null;\n private isProcessing = false;\n private streamingManager: StreamingManager | undefined = undefined;\n private dashboard: InteractiveDashboard | undefined = undefined;\n\n constructor(config: DaemonConfig) {\n this.config = config;\n this.stats = {\n filesScanned: 0,\n issuesFound: 0,\n errors: 0,\n startTime: Date.now()\n };\n }\n\n /**\n * Start the daemon\n */\n async start(): Promise<void> {\n // Enable global interactive mode when TTY and not explicitly disabled\n if (this.config.interactive !== false && process.stdout.isTTY) {\n setInteractiveMode(true);\n }\n if (!isTrieInitialized(this.config.directory)) {\n if (!isInteractiveMode()) {\n console.error('Trie is not initialized for this project.');\n console.error('Run `trie init` first.');\n }\n process.exit(1);\n }\n\n this.log('info', 'Starting Trie Agent', {\n directory: this.config.directory,\n debounceMs: this.config.debounceMs\n });\n if (!isInteractiveMode()) {\n console.error('\\nYour Trie agent is watching over your codebase.\\n');\n }\n\n // Validate directory\n if (!existsSync(this.config.directory)) {\n this.log('error', 'Directory not found', { directory: this.config.directory });\n process.exit(1);\n }\n\n // Start interactive dashboard if enabled\n if (isInteractiveMode()) {\n this.streamingManager = new StreamingManager();\n this.dashboard = new InteractiveDashboard();\n this.streamingManager.subscribe(update => this.dashboard?.handleStreamUpdate(update));\n \n // Register callback for Moneybags settings changes\n this.dashboard.onMoneybagsChange(() => {\n this.recalculateMoneybags();\n });\n \n await this.dashboard.start();\n this.streamingManager.reportWatchStatus({\n watching: !this.config.runOnce,\n directories: 0,\n debounceMs: this.config.debounceMs\n });\n }\n\n // Run initial scan\n this.log('info', 'Running initial scan...');\n await this.runScan(this.config.files);\n\n // If run-once mode, exit after initial scan\n if (this.config.runOnce) {\n this.log('info', 'Run-once mode: exiting after initial scan', { ...this.stats });\n process.exit(this.stats.issuesFound > 0 ? 1 : 0);\n }\n\n // Start watching\n await this.watchDirectory(this.config.directory);\n this.streamingManager?.reportWatchStatus({\n watching: true,\n directories: this.watchers.size,\n debounceMs: this.config.debounceMs\n });\n this.log('info', 'Guardian is watching for changes...', { \n directories: this.watchers.size \n });\n\n // Handle graceful shutdown\n process.on('SIGINT', () => this.shutdown('SIGINT'));\n process.on('SIGTERM', () => this.shutdown('SIGTERM'));\n }\n\n /**\n * Run a scan on all files or specific files\n */\n private async runScan(files?: string[]): Promise<void> {\n try {\n const scanArgs: Record<string, unknown> = files\n ? { files }\n : { directory: this.config.directory };\n\n if (this.config.format) scanArgs.format = this.config.format;\n if (this.config.output) scanArgs.output = this.config.output;\n if (this.config.parallel !== undefined) scanArgs.parallel = this.config.parallel;\n if (this.config.cache !== undefined) scanArgs.cache = this.config.cache;\n if (this.config.maxConcurrency) scanArgs.maxConcurrency = this.config.maxConcurrency;\n if (this.config.streaming !== undefined) scanArgs.streaming = this.config.streaming;\n if (this.config.interactive !== undefined) scanArgs.interactive = this.config.interactive;\n if (this.config.workers !== undefined) scanArgs.workers = this.config.workers;\n if (this.config.timeoutMs) scanArgs.timeoutMs = this.config.timeoutMs;\n if (this.config.forceScouts) scanArgs.forceAgents = this.config.forceScouts;\n // Get Guardian config from dashboard if available, otherwise use CLI args\n if (this.dashboard && typeof this.dashboard.getGuardianConfig === 'function') {\n const guardianConfig = this.dashboard.getGuardianConfig();\n\n // Moneybags config (CLI args can override dashboard config)\n scanArgs.userCount = this.config.userCount || guardianConfig.moneybags.userCount;\n scanArgs.moneybagsConfig = {\n userCount: this.config.userCount || guardianConfig.moneybags.userCount,\n payingUsers: guardianConfig.moneybags.payingUsers,\n revenuePerUser: guardianConfig.moneybags.revenuePerUser,\n developerRate: guardianConfig.moneybags.developerRate,\n industry: this.config.industry || guardianConfig.moneybags.industry as 'solopreneur' | 'startup' | 'fintech' | 'healthcare' | 'enterprise' | 'saas' | 'ecommerce' | undefined\n };\n \n // Agent Smith config\n scanArgs.agentSmithConfig = {\n aiEnhancement: guardianConfig.agentSmith.aiEnhancement,\n minSeverity: guardianConfig.agentSmith.minSeverity,\n enabledCategories: { ...guardianConfig.agentSmith.enabledCategories },\n memoryRetentionDays: guardianConfig.agentSmith.memoryRetentionDays\n };\n \n // Performance config\n scanArgs.parallel = guardianConfig.performance.parallel;\n scanArgs.cache = guardianConfig.performance.cache;\n scanArgs.maxConcurrency = guardianConfig.performance.maxConcurrency;\n scanArgs.timeoutMs = guardianConfig.performance.timeoutMs;\n scanArgs.workers = guardianConfig.performance.workers;\n scanArgs.streaming = guardianConfig.performance.streaming;\n } else {\n // Use CLI args when not in interactive dashboard mode\n if (this.config.userCount || this.config.industry) {\n scanArgs.userCount = this.config.userCount;\n scanArgs.moneybagsConfig = {\n userCount: this.config.userCount || 250,\n ...(this.config.industry && { industry: this.config.industry })\n };\n }\n }\n\n if (this.streamingManager) scanArgs.streamingManager = this.streamingManager;\n if (this.dashboard) scanArgs.dashboard = this.dashboard;\n\n const result = await this.scanTool.execute(scanArgs);\n const resultText = result.content?.[0]?.text || '';\n\n // PRINT THE FULL REPORT TO STDOUT (for terminal/chat display)\n if (resultText && this.config.runOnce && !isInteractiveMode()) {\n console.log(resultText);\n }\n\n // Parse results - try multiple patterns to extract issue count\n let issueCount = 0;\n if (this.config.format === 'json' && this.config.output && existsSync(this.config.output)) {\n try {\n const report = JSON.parse(readFileSync(this.config.output, 'utf-8'));\n issueCount = report?.results?.totalIssues ?? 0;\n } catch {\n issueCount = 0;\n }\n } else {\n // Try multiple patterns to catch issue counts\n const patterns = [\n /(\\d+)\\s+actionable\\s+issues?\\s+found/i, // \"30 actionable issues found\"\n /(\\d+)\\s+Issues?\\s+Found/i, // \"30 Issues Found\"\n /Found\\s+(\\d+)\\s+issues?/i, // \"Found 30 issues\"\n /\\[COMPLETE\\]\\s+(\\d+)\\s+issues?/i, // \"[COMPLETE] 30 issues\"\n /(\\d+)\\s+total/i, // \"30 total\" (fallback)\n ];\n \n for (const pattern of patterns) {\n const match = resultText.match(pattern);\n if (match && match[1]) {\n issueCount = parseInt(match[1], 10);\n break;\n }\n }\n }\n\n this.stats.filesScanned += files?.length || 1;\n this.stats.issuesFound += issueCount;\n\n // Don't log \"No issues found\" after a full scan that displayed a report\n // The report already shows the issue count prominently\n if (issueCount > 0) {\n // Parse severity breakdown for additional logging\n const criticalMatch = resultText.match(/(\\d+)\\s+critical/i);\n const seriousMatch = resultText.match(/(\\d+)\\s+serious|(\\d+)\\s+important/i);\n\n if (criticalMatch && criticalMatch[1] && parseInt(criticalMatch[1], 10) > 0) {\n this.log('error', 'Critical issues detected', { count: parseInt(criticalMatch[1], 10) });\n }\n if (seriousMatch && (seriousMatch[1] || seriousMatch[2])) {\n const count = parseInt(seriousMatch[1] || seriousMatch[2] || '0', 10);\n if (count > 0) {\n this.log('warn', 'Serious issues detected', { count });\n }\n }\n }\n // NOTE: Removed the \"No issues found\" log because it was confusing\n // when printed after a full scan report that already shows issue counts\n } catch (error) {\n this.stats.errors++;\n this.log('error', 'Scan failed', { \n error: error instanceof Error ? error.message : String(error) \n });\n }\n }\n\n /**\n * Watch a directory recursively\n */\n private async watchDirectory(dir: string): Promise<void> {\n if (!existsSync(dir)) return;\n\n try {\n const stat = statSync(dir);\n if (!stat.isDirectory()) return;\n\n const dirName = basename(dir);\n if (SKIP_DIRS.has(dirName) || dirName.startsWith('.')) return;\n\n // Watch this directory\n const watcher = watch(dir, { persistent: true }, (_eventType, filename) => {\n if (!filename) return;\n\n const fullPath = join(dir, filename);\n const ext = extname(filename).toLowerCase();\n\n if (!WATCH_EXTENSIONS.has(ext)) return;\n if (!existsSync(fullPath)) return;\n\n this.pendingFiles.add(fullPath);\n this.streamingManager?.reportWatchChange(fullPath);\n this.scheduleProcessing();\n });\n\n this.watchers.set(dir, watcher);\n\n // Recursively watch subdirectories\n const entries = await readdir(dir, { withFileTypes: true });\n for (const entry of entries) {\n if (entry.isDirectory()) {\n await this.watchDirectory(join(dir, entry.name));\n }\n }\n } catch (error) {\n // Skip inaccessible directories\n }\n }\n\n /**\n * Schedule processing of pending files (debounced)\n */\n private scheduleProcessing(): void {\n if (this.debounceTimer) {\n clearTimeout(this.debounceTimer);\n }\n\n this.debounceTimer = setTimeout(() => {\n this.processPendingFiles();\n }, this.config.debounceMs);\n }\n\n /**\n * Process all pending files\n */\n private async processPendingFiles(): Promise<void> {\n if (this.isProcessing || this.pendingFiles.size === 0) return;\n\n this.isProcessing = true;\n const files = Array.from(this.pendingFiles);\n this.pendingFiles.clear();\n\n this.log('info', 'Processing changed files', { \n count: files.length,\n files: files.map(f => basename(f))\n });\n\n await this.runScan(files);\n this.isProcessing = false;\n }\n\n /**\n * Recalculate Moneybags costs with updated settings\n * This re-runs only the Moneybags agent on previously scanned issues\n */\n private recalculateMoneybags(): void {\n // Trigger a rescan with Moneybags-only focus\n // We re-use the existing scan infrastructure but the dashboard will \n // already have the new config values ready\n this.log('info', 'Recalculating Moneybags costs with new settings...');\n \n // Run a full scan with updated Moneybags config\n // The scan will pick up the new config from dashboard.getGuardianConfig()\n void this.runScan(this.config.files);\n }\n\n /**\n * Log a message\n */\n private log(level: 'info' | 'warn' | 'error', message: string, data?: Record<string, unknown>): void {\n const timestamp = new Date().toISOString();\n const uptime = Math.round((Date.now() - this.stats.startTime) / 1000);\n\n // Suppress human-readable logs when interactive dashboard is active\n if (!this.config.jsonOutput && isInteractiveMode()) {\n return;\n }\n\n if (this.config.jsonOutput) {\n console.log(JSON.stringify({\n timestamp,\n level,\n message,\n uptime,\n ...data,\n stats: this.stats\n }));\n } else {\n const levelEmoji = { info: '[i]', warn: '[!]', error: '[X]' }[level];\n const dataStr = data ? ` ${JSON.stringify(data)}` : '';\n console.log(`[${timestamp}] ${levelEmoji} ${message}${dataStr}`);\n }\n }\n\n /**\n * Graceful shutdown\n */\n private shutdown(signal: string): void {\n this.log('info', 'Shutting down', { signal, stats: this.stats });\n\n // Close all watchers\n for (const watcher of this.watchers.values()) {\n watcher.close();\n }\n\n // Clear timers\n if (this.debounceTimer) {\n clearTimeout(this.debounceTimer);\n }\n\n if (this.streamingManager) {\n this.streamingManager.reportWatchStatus({\n watching: false,\n directories: 0\n });\n }\n if (this.dashboard) {\n this.dashboard.stop();\n }\n\n process.exit(0);\n }\n}\n\n/**\n * Parse command line arguments\n */\nfunction parseArgs(): DaemonConfig {\n const args = process.argv.slice(2);\n const config: DaemonConfig = {\n // Silent mode for initial workspace detection (TUI will handle display)\n directory: getWorkingDirectory(undefined, true),\n debounceMs: 1000,\n jsonOutput: false,\n runOnce: false,\n // Default to interactive mode for TTY terminals\n interactive: process.stdout.isTTY === true\n };\n\n for (let i = 0; i < args.length; i++) {\n const arg = args[i];\n const nextArg = args[i + 1];\n\n switch (arg) {\n case '--dir':\n case '-d':\n config.directory = resolve(nextArg || '.');\n i++;\n break;\n case '--debounce':\n case '-D':\n config.debounceMs = parseInt(nextArg || '1000', 10);\n i++;\n break;\n case '--json':\n config.jsonOutput = true;\n break;\n case '--format':\n if (nextArg) {\n config.format = nextArg === 'json' ? 'json' : 'text';\n i++;\n }\n break;\n case '--output':\n if (nextArg) {\n config.output = nextArg;\n i++;\n }\n break;\n case '--parallel':\n config.parallel = true;\n break;\n case '--no-parallel':\n config.parallel = false;\n break;\n case '--cache':\n config.cache = true;\n break;\n case '--no-cache':\n config.cache = false;\n break;\n case '--force-rescan':\n case '--force':\n config.cache = false; // Force rescan by disabling cache\n break;\n case '--max-concurrency':\n config.maxConcurrency = parseInt(nextArg || '4', 10);\n i++;\n break;\n case '--streaming':\n config.streaming = true;\n break;\n case '--no-streaming':\n config.streaming = false;\n break;\n case '--interactive':\n config.interactive = true;\n break;\n case '--no-interactive':\n config.interactive = false;\n break;\n case '--workers':\n config.workers = true;\n break;\n case '--no-workers':\n config.workers = false;\n break;\n case '--timeout':\n config.timeoutMs = parseInt(nextArg || '120000', 10);\n i++;\n break;\n case '--files':\n if (nextArg) {\n config.files = nextArg.split(',').map(f => f.trim()).filter(Boolean);\n i++;\n }\n break;\n case '--scouts':\n case '--agents': // Alias for backward compatibility\n if (nextArg) {\n config.forceScouts = nextArg.split(',').map(s => s.trim()).filter(Boolean);\n i++;\n }\n break;\n case '--once':\n config.runOnce = true;\n break;\n case '--users':\n case '-u':\n config.userCount = parseInt(nextArg || '250', 10);\n i++;\n break;\n case '--industry':\n if (nextArg && ['solopreneur', 'startup', 'fintech', 'healthcare', 'enterprise', 'saas', 'ecommerce'].includes(nextArg)) {\n config.industry = nextArg as 'solopreneur' | 'startup' | 'fintech' | 'healthcare' | 'enterprise' | 'saas' | 'ecommerce';\n i++;\n } else {\n if (!process.stdout.isTTY || process.argv.includes('--non-interactive')) {\n console.error(`Invalid industry: ${nextArg || '(none)'}`);\n console.error('Valid options: solopreneur, startup, fintech, healthcare, enterprise, saas, ecommerce');\n }\n process.exit(1);\n }\n break;\n case '--help':\n case '-h':\n console.log(`\nTrie Guardian - File Watcher & Scanner\n\nUSAGE:\n trie watch [options] Watch for changes and scan continuously\n trie scan [options] Scan once and exit\n\nOPTIONS:\n --dir, -d <path> Directory to watch/scan (default: current directory)\n --debounce, -D <ms> Debounce time in ms (default: 1000)\n --scouts <list> Comma-separated scouts to run (e.g., security,legal)\n --agents <list> Alias for --scouts (backward compatibility)\n --files <list> Comma-separated file list to scan\n --users, -u <count> User count for cost estimation (default: 250)\n --industry <type> Industry type for cost scaling (solopreneur, startup, fintech, healthcare, enterprise, saas, ecommerce)\n\nOUTPUT:\n --json Output as JSON (for log aggregation)\n --format <text|json> Scan output format\n --output <path> Output file path for json format\n\nPERFORMANCE:\n --parallel Enable parallel execution\n --no-parallel Disable parallel execution\n --cache Enable result caching\n --no-cache Disable result caching\n --force-rescan Force rescan (bypasses cache, same as --no-cache)\n --max-concurrency <n> Max parallel scouts\n --streaming Enable streaming updates\n --no-streaming Disable streaming updates\n --workers Use worker threads for scouts\n --no-workers Disable worker threads\n --timeout <ms> Scout timeout in ms\n\nDISPLAY:\n --interactive Enable interactive dashboard (default for TTY)\n --no-interactive Disable interactive dashboard (for CI/scripts)\n\nEXAMPLES:\n trie watch # Watch current directory\n trie scan # Scan once and exit\n trie scan --scouts security,legal # Scan with specific scouts\n trie scan --users 1000 --industry fintech # Scale for fintech with 1K users\n trie watch --no-interactive # CI mode: watch without dashboard\n trie scan --json --output report.json\n`);\n process.exit(0);\n }\n }\n\n return config;\n}\n\n// Run the daemon\nconst config = parseArgs();\nconst daemon = new WatchDaemon(config);\ndaemon.start().catch(error => {\n if (!process.stdout.isTTY || process.argv.includes('--non-interactive')) {\n console.error('Failed to start daemon:', error);\n }\n process.exit(1);\n});\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAcA,SAAS,OAAO,YAAY,UAAU,oBAAoB;AAC1D,SAAS,eAAe;AACxB,SAAS,MAAM,SAAS,UAAU,eAAe;AASjD,IAAM,mBAAmB,oBAAI,IAAI;AAAA,EAC/B;AAAA,EAAO;AAAA,EAAQ;AAAA,EAAO;AAAA,EAAQ;AAAA,EAC9B;AAAA,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F;AAEA,SAAOA;AACT;AAGA,IAAM,SAAS,UAAU;AACzB,IAAM,SAAS,IAAI,YAAY,MAAM;AACrC,OAAO,MAAM,EAAE,MAAM,WAAS;AAC5B,MAAI,CAAC,QAAQ,OAAO,SAAS,QAAQ,KAAK,SAAS,mBAAmB,GAAG;AACvE,YAAQ,MAAM,2BAA2B,KAAK;AAAA,EAChD;AACA,UAAQ,KAAK,CAAC;AAChB,CAAC;","names":["config"]}
|
|
1
|
+
{"version":3,"sources":["../../src/cli/yolo-daemon.ts"],"sourcesContent":["#!/usr/bin/env node\n/**\n * Trie Guardian - File Watcher & Scanner\n * \n * Watches a directory and reports issues as they occur.\n * Also handles one-shot scanning via --once flag.\n * \n * Usage:\n * trie watch [options] # Watch for changes\n * trie scan [options] # Scan once and exit\n * \n * See `trie watch --help` for all options.\n */\n\nimport { watch, existsSync, statSync, readFileSync } from 'fs';\nimport { readdir } from 'fs/promises';\nimport { join, extname, basename, resolve } from 'path';\nimport { TrieScanTool } from '../tools/scan.js';\nimport { StreamingManager } from '../utils/streaming.js';\nimport { InteractiveDashboard } from './interactive-dashboard.js';\nimport { getWorkingDirectory } from '../utils/workspace.js';\nimport { isInteractiveMode, setInteractiveMode } from '../utils/progress.js';\nimport { isTrieInitialized } from '../utils/trie-init.js';\n\n// File extensions to watch\nconst WATCH_EXTENSIONS = new Set([\n '.ts', '.tsx', '.js', '.jsx', '.mjs',\n '.vue', '.svelte', '.astro',\n '.py', '.go', '.rs'\n]);\n\n// Directories to skip\nconst SKIP_DIRS = new Set([\n 'node_modules', '.git', 'dist', 'build', '.next', '.nuxt',\n 'coverage', '.turbo', '.cache', '__pycache__', '.venv'\n]);\n\ninterface DaemonConfig {\n directory: string;\n debounceMs: number;\n jsonOutput: boolean;\n runOnce: boolean;\n format?: 'text' | 'json';\n output?: string;\n parallel?: boolean;\n cache?: boolean;\n maxConcurrency?: number;\n streaming?: boolean;\n interactive?: boolean;\n workers?: boolean;\n timeoutMs?: number;\n files?: string[];\n /** Comma-separated list of scouts to run (e.g., \"security,legal\") */\n forceScouts?: string[];\n /** User count for cost estimation (default: 250) */\n userCount?: number;\n}\n\ninterface DaemonStats {\n filesScanned: number;\n issuesFound: number;\n errors: number;\n startTime: number;\n}\n\nclass WatchDaemon {\n private config: DaemonConfig;\n private stats: DaemonStats;\n private scanTool = new TrieScanTool();\n private watchers: Map<string, ReturnType<typeof watch>> = new Map();\n private pendingFiles: Set<string> = new Set();\n private debounceTimer: NodeJS.Timeout | null = null;\n private isProcessing = false;\n private streamingManager: StreamingManager | undefined = undefined;\n private dashboard: InteractiveDashboard | undefined = undefined;\n\n constructor(config: DaemonConfig) {\n this.config = config;\n this.stats = {\n filesScanned: 0,\n issuesFound: 0,\n errors: 0,\n startTime: Date.now()\n };\n }\n\n /**\n * Start the daemon\n */\n async start(): Promise<void> {\n // Enable global interactive mode when TTY and not explicitly disabled\n if (this.config.interactive !== false && process.stdout.isTTY) {\n setInteractiveMode(true);\n }\n if (!isTrieInitialized(this.config.directory)) {\n if (!isInteractiveMode()) {\n console.error('Trie is not initialized for this project.');\n console.error('Run `trie init` first.');\n }\n process.exit(1);\n }\n\n this.log('info', 'Starting Trie Agent', {\n directory: this.config.directory,\n debounceMs: this.config.debounceMs\n });\n if (!isInteractiveMode()) {\n console.error('\\nYour Trie agent is watching over your codebase.\\n');\n }\n\n // Validate directory\n if (!existsSync(this.config.directory)) {\n this.log('error', 'Directory not found', { directory: this.config.directory });\n process.exit(1);\n }\n\n // Start interactive dashboard if enabled\n if (isInteractiveMode()) {\n this.streamingManager = new StreamingManager();\n this.dashboard = new InteractiveDashboard();\n this.streamingManager.subscribe(update => this.dashboard?.handleStreamUpdate(update));\n await this.dashboard.start();\n this.streamingManager.reportWatchStatus({\n watching: !this.config.runOnce,\n directories: 0,\n debounceMs: this.config.debounceMs\n });\n }\n\n // Run initial scan\n this.log('info', 'Running initial scan...');\n await this.runScan(this.config.files);\n\n // If run-once mode, exit after initial scan\n if (this.config.runOnce) {\n this.log('info', 'Run-once mode: exiting after initial scan', { ...this.stats });\n process.exit(this.stats.issuesFound > 0 ? 1 : 0);\n }\n\n // Start watching\n await this.watchDirectory(this.config.directory);\n this.streamingManager?.reportWatchStatus({\n watching: true,\n directories: this.watchers.size,\n debounceMs: this.config.debounceMs\n });\n this.log('info', 'Guardian is watching for changes...', { \n directories: this.watchers.size \n });\n\n // Handle graceful shutdown\n process.on('SIGINT', () => this.shutdown('SIGINT'));\n process.on('SIGTERM', () => this.shutdown('SIGTERM'));\n }\n\n /**\n * Run a scan on all files or specific files\n */\n private async runScan(files?: string[]): Promise<void> {\n try {\n const scanArgs: Record<string, unknown> = files\n ? { files }\n : { directory: this.config.directory };\n\n if (this.config.format) scanArgs.format = this.config.format;\n if (this.config.output) scanArgs.output = this.config.output;\n if (this.config.parallel !== undefined) scanArgs.parallel = this.config.parallel;\n if (this.config.cache !== undefined) scanArgs.cache = this.config.cache;\n if (this.config.maxConcurrency) scanArgs.maxConcurrency = this.config.maxConcurrency;\n if (this.config.streaming !== undefined) scanArgs.streaming = this.config.streaming;\n if (this.config.interactive !== undefined) scanArgs.interactive = this.config.interactive;\n if (this.config.workers !== undefined) scanArgs.workers = this.config.workers;\n if (this.config.timeoutMs) scanArgs.timeoutMs = this.config.timeoutMs;\n if (this.config.forceScouts) scanArgs.forceAgents = this.config.forceScouts;\n if (this.dashboard && typeof this.dashboard.getAgentConfig === 'function') {\n const agentConfig = this.dashboard.getAgentConfig();\n scanArgs.parallel = agentConfig.performance.parallel;\n scanArgs.cache = agentConfig.performance.cache;\n scanArgs.maxConcurrency = agentConfig.performance.maxConcurrency;\n scanArgs.timeoutMs = agentConfig.performance.timeoutMs;\n scanArgs.workers = agentConfig.performance.workers;\n scanArgs.streaming = agentConfig.performance.streaming;\n }\n\n if (this.streamingManager) scanArgs.streamingManager = this.streamingManager;\n if (this.dashboard) scanArgs.dashboard = this.dashboard;\n\n const result = await this.scanTool.execute(scanArgs);\n const resultText = result.content?.[0]?.text || '';\n\n // PRINT THE FULL REPORT TO STDOUT (for terminal/chat display)\n if (resultText && this.config.runOnce && !isInteractiveMode()) {\n console.log(resultText);\n }\n\n // Parse results - try multiple patterns to extract issue count\n let issueCount = 0;\n if (this.config.format === 'json' && this.config.output && existsSync(this.config.output)) {\n try {\n const report = JSON.parse(readFileSync(this.config.output, 'utf-8'));\n issueCount = report?.results?.totalIssues ?? 0;\n } catch {\n issueCount = 0;\n }\n } else {\n // Try multiple patterns to catch issue counts\n const patterns = [\n /(\\d+)\\s+actionable\\s+issues?\\s+found/i, // \"30 actionable issues found\"\n /(\\d+)\\s+Issues?\\s+Found/i, // \"30 Issues Found\"\n /Found\\s+(\\d+)\\s+issues?/i, // \"Found 30 issues\"\n /\\[COMPLETE\\]\\s+(\\d+)\\s+issues?/i, // \"[COMPLETE] 30 issues\"\n /(\\d+)\\s+total/i, // \"30 total\" (fallback)\n ];\n \n for (const pattern of patterns) {\n const match = resultText.match(pattern);\n if (match && match[1]) {\n issueCount = parseInt(match[1], 10);\n break;\n }\n }\n }\n\n this.stats.filesScanned += files?.length || 1;\n this.stats.issuesFound += issueCount;\n\n // Don't log \"No issues found\" after a full scan that displayed a report\n // The report already shows the issue count prominently\n if (issueCount > 0) {\n // Parse severity breakdown for additional logging\n const criticalMatch = resultText.match(/(\\d+)\\s+critical/i);\n const seriousMatch = resultText.match(/(\\d+)\\s+serious|(\\d+)\\s+important/i);\n\n if (criticalMatch && criticalMatch[1] && parseInt(criticalMatch[1], 10) > 0) {\n this.log('error', 'Critical issues detected', { count: parseInt(criticalMatch[1], 10) });\n }\n if (seriousMatch && (seriousMatch[1] || seriousMatch[2])) {\n const count = parseInt(seriousMatch[1] || seriousMatch[2] || '0', 10);\n if (count > 0) {\n this.log('warn', 'Serious issues detected', { count });\n }\n }\n }\n // NOTE: Removed the \"No issues found\" log because it was confusing\n // when printed after a full scan report that already shows issue counts\n } catch (error) {\n this.stats.errors++;\n this.log('error', 'Scan failed', { \n error: error instanceof Error ? error.message : String(error) \n });\n }\n }\n\n /**\n * Watch a directory recursively\n */\n private async watchDirectory(dir: string): Promise<void> {\n if (!existsSync(dir)) return;\n\n try {\n const stat = statSync(dir);\n if (!stat.isDirectory()) return;\n\n const dirName = basename(dir);\n if (SKIP_DIRS.has(dirName) || dirName.startsWith('.')) return;\n\n // Watch this directory\n const watcher = watch(dir, { persistent: true }, (_eventType, filename) => {\n if (!filename) return;\n\n const fullPath = join(dir, filename);\n const ext = extname(filename).toLowerCase();\n\n if (!WATCH_EXTENSIONS.has(ext)) return;\n if (!existsSync(fullPath)) return;\n\n this.pendingFiles.add(fullPath);\n this.streamingManager?.reportWatchChange(fullPath);\n this.scheduleProcessing();\n });\n\n this.watchers.set(dir, watcher);\n\n // Recursively watch subdirectories\n const entries = await readdir(dir, { withFileTypes: true });\n for (const entry of entries) {\n if (entry.isDirectory()) {\n await this.watchDirectory(join(dir, entry.name));\n }\n }\n } catch (error) {\n // Skip inaccessible directories\n }\n }\n\n /**\n * Schedule processing of pending files (debounced)\n */\n private scheduleProcessing(): void {\n if (this.debounceTimer) {\n clearTimeout(this.debounceTimer);\n }\n\n this.debounceTimer = setTimeout(() => {\n this.processPendingFiles();\n }, this.config.debounceMs);\n }\n\n /**\n * Process all pending files\n */\n private async processPendingFiles(): Promise<void> {\n if (this.isProcessing || this.pendingFiles.size === 0) return;\n\n this.isProcessing = true;\n const files = Array.from(this.pendingFiles);\n this.pendingFiles.clear();\n\n this.log('info', 'Processing changed files', { \n count: files.length,\n files: files.map(f => basename(f))\n });\n\n await this.runScan(files);\n this.isProcessing = false;\n }\n\n\n /**\n * Log a message\n */\n private log(level: 'info' | 'warn' | 'error', message: string, data?: Record<string, unknown>): void {\n const timestamp = new Date().toISOString();\n const uptime = Math.round((Date.now() - this.stats.startTime) / 1000);\n\n // Suppress human-readable logs when interactive dashboard is active\n if (!this.config.jsonOutput && isInteractiveMode()) {\n return;\n }\n\n if (this.config.jsonOutput) {\n console.log(JSON.stringify({\n timestamp,\n level,\n message,\n uptime,\n ...data,\n stats: this.stats\n }));\n } else {\n const levelEmoji = { info: '[i]', warn: '[!]', error: '[X]' }[level];\n const dataStr = data ? ` ${JSON.stringify(data)}` : '';\n console.log(`[${timestamp}] ${levelEmoji} ${message}${dataStr}`);\n }\n }\n\n /**\n * Graceful shutdown\n */\n private shutdown(signal: string): void {\n this.log('info', 'Shutting down', { signal, stats: this.stats });\n\n // Close all watchers\n for (const watcher of this.watchers.values()) {\n watcher.close();\n }\n\n // Clear timers\n if (this.debounceTimer) {\n clearTimeout(this.debounceTimer);\n }\n\n if (this.streamingManager) {\n this.streamingManager.reportWatchStatus({\n watching: false,\n directories: 0\n });\n }\n if (this.dashboard) {\n this.dashboard.stop();\n }\n\n process.exit(0);\n }\n}\n\n/**\n * Parse command line arguments\n */\nfunction parseArgs(): DaemonConfig {\n const args = process.argv.slice(2);\n const config: DaemonConfig = {\n // Silent mode for initial workspace detection (TUI will handle display)\n directory: getWorkingDirectory(undefined, true),\n debounceMs: 1000,\n jsonOutput: false,\n runOnce: false,\n // Default to interactive mode for TTY terminals\n interactive: process.stdout.isTTY === true\n };\n\n for (let i = 0; i < args.length; i++) {\n const arg = args[i];\n const nextArg = args[i + 1];\n\n switch (arg) {\n case '--dir':\n case '-d':\n config.directory = resolve(nextArg || '.');\n i++;\n break;\n case '--debounce':\n case '-D':\n config.debounceMs = parseInt(nextArg || '1000', 10);\n i++;\n break;\n case '--json':\n config.jsonOutput = true;\n break;\n case '--format':\n if (nextArg) {\n config.format = nextArg === 'json' ? 'json' : 'text';\n i++;\n }\n break;\n case '--output':\n if (nextArg) {\n config.output = nextArg;\n i++;\n }\n break;\n case '--parallel':\n config.parallel = true;\n break;\n case '--no-parallel':\n config.parallel = false;\n break;\n case '--cache':\n config.cache = true;\n break;\n case '--no-cache':\n config.cache = false;\n break;\n case '--force-rescan':\n case '--force':\n config.cache = false; // Force rescan by disabling cache\n break;\n case '--max-concurrency':\n config.maxConcurrency = parseInt(nextArg || '4', 10);\n i++;\n break;\n case '--streaming':\n config.streaming = true;\n break;\n case '--no-streaming':\n config.streaming = false;\n break;\n case '--interactive':\n config.interactive = true;\n break;\n case '--no-interactive':\n config.interactive = false;\n break;\n case '--workers':\n config.workers = true;\n break;\n case '--no-workers':\n config.workers = false;\n break;\n case '--timeout':\n config.timeoutMs = parseInt(nextArg || '120000', 10);\n i++;\n break;\n case '--files':\n if (nextArg) {\n config.files = nextArg.split(',').map(f => f.trim()).filter(Boolean);\n i++;\n }\n break;\n case '--scouts':\n case '--agents': // Alias for backward compatibility\n if (nextArg) {\n config.forceScouts = nextArg.split(',').map(s => s.trim()).filter(Boolean);\n i++;\n }\n break;\n case '--once':\n config.runOnce = true;\n break;\n case '--users':\n case '-u':\n config.userCount = parseInt(nextArg || '250', 10);\n i++;\n break;\n case '--help':\n case '-h':\n console.log(`\nTrie Agent - File Watcher & Scanner\n\nUSAGE:\n trie watch [options] Watch for changes and scan continuously\n trie scan [options] Scan once and exit\n\nOPTIONS:\n --dir, -d <path> Directory to watch/scan (default: current directory)\n --debounce, -D <ms> Debounce time in ms (default: 1000)\n --scouts <list> Comma-separated scouts to run (e.g., security,legal)\n --agents <list> Alias for --scouts (backward compatibility)\n --files <list> Comma-separated file list to scan\n --users, -u <count> User count for cost estimation (default: 250)\n\nOUTPUT:\n --json Output as JSON (for log aggregation)\n --format <text|json> Scan output format\n --output <path> Output file path for json format\n\nPERFORMANCE:\n --parallel Enable parallel execution\n --no-parallel Disable parallel execution\n --cache Enable result caching\n --no-cache Disable result caching\n --force-rescan Force rescan (bypasses cache, same as --no-cache)\n --max-concurrency <n> Max parallel scouts\n --streaming Enable streaming updates\n --no-streaming Disable streaming updates\n --workers Use worker threads for scouts\n --no-workers Disable worker threads\n --timeout <ms> Scout timeout in ms\n\nDISPLAY:\n --interactive Enable interactive dashboard (default for TTY)\n --no-interactive Disable interactive dashboard (for CI/scripts)\n\nEXAMPLES:\n trie watch # Watch current directory\n trie scan # Scan once and exit\n trie scan --scouts security,legal # Scan with specific scouts\n trie scan --users 1000 --industry fintech # Scale for fintech with 1K users\n trie watch --no-interactive # CI mode: watch without dashboard\n trie scan --json --output report.json\n`);\n process.exit(0);\n }\n }\n\n return config;\n}\n\n// Run the daemon\nconst config = parseArgs();\nconst daemon = new WatchDaemon(config);\ndaemon.start().catch(error => {\n if (!process.stdout.isTTY || process.argv.includes('--non-interactive')) {\n console.error('Failed to start daemon:', error);\n }\n process.exit(1);\n});\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAcA,SAAS,OAAO,YAAY,UAAU,oBAAoB;AAC1D,SAAS,eAAe;AACxB,SAAS,MAAM,SAAS,UAAU,eAAe;AASjD,IAAM,mBAAmB,oBAAI,IAAI;AAAA,EAC/B;AAAA,EAAO;AAAA,EAAQ;AAAA,EAAO;AAAA,EAAQ;AAAA,EAC9B;AAAA,EAAQ;AAAA,EAAW;AAAA,EACnB;AAAA,EAAO;AAAA,EAAO;AAChB,CAAC;AAGD,IAAM,YAAY,oBAAI,IAAI;AAAA,EACxB;AAAA,EAAgB;AAAA,EAAQ;AAAA,EAAQ;AAAA,EAAS;AAAA,EAAS;AAAA,EAClD;AAAA,EAAY;AAAA,EAAU;AAAA,EAAU;AAAA,EAAe;AACjD,CAAC;AA8BD,IAAM,cAAN,MAAkB;AAAA,EACR;AAAA,EACA;AAAA,EACA,WAAW,IAAI,aAAa;AAAA,EAC5B,WAAkD,oBAAI,IAAI;AAAA,EAC1D,eAA4B,oBAAI,IAAI;AAAA,EACpC,gBAAuC;AAAA,EACvC,eAAe;AAAA,EACf,mBAAiD;AAAA,EACjD,YAA8C;AAAA,EAEtD,YAAYA,SAAsB;AAChC,SAAK,SAASA;AACd,SAAK,QAAQ;AAAA,MACX,cAAc;AAAA,MACd,aAAa;AAAA,MACb,QAAQ;AAAA,MACR,WAAW,KAAK,IAAI;AAAA,IACtB;AAAA,EACF;AAAA;AAAA;AAAA;AAAA,EAKA,MAAM,QAAuB;AAE3B,QAAI,KAAK,OAAO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A,QAAO,UAAU;AACjB;AAAA,MACF,KAAK;AAAA,MACL,KAAK;AACH,QAAAA,QAAO,YAAY,SAAS,WAAW,OAAO,EAAE;AAChD;AACA;AAAA,MACF,KAAK;AAAA,MACL,KAAK;AACH,gBAAQ,IAAI;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,CA4CnB;AACO,gBAAQ,KAAK,CAAC;AAAA,IAClB;AAAA,EACF;AAEA,SAAOA;AACT;AAGA,IAAM,SAAS,UAAU;AACzB,IAAM,SAAS,IAAI,YAAY,MAAM;AACrC,OAAO,MAAM,EAAE,MAAM,WAAS;AAC5B,MAAI,CAAC,QAAQ,OAAO,SAAS,QAAQ,KAAK,SAAS,mBAAmB,GAAG;AACvE,YAAQ,MAAM,2BAA2B,KAAK;AAAA,EAChD;AACA,UAAQ,KAAK,CAAC;AAChB,CAAC;","names":["config"]}
|
|
@@ -4,9 +4,8 @@ import {
|
|
|
4
4
|
calculateAdaptiveScanFrequency,
|
|
5
5
|
clearGoalManagers,
|
|
6
6
|
getGoalManager
|
|
7
|
-
} from "./chunk-
|
|
8
|
-
import "./chunk-
|
|
9
|
-
import "./chunk-JDHR5BDR.js";
|
|
7
|
+
} from "./chunk-33WL3D7A.js";
|
|
8
|
+
import "./chunk-6JPPYG7F.js";
|
|
10
9
|
import "./chunk-R4AAPFXC.js";
|
|
11
10
|
import "./chunk-APMV77PU.js";
|
|
12
11
|
import "./chunk-DGUM43GV.js";
|
|
@@ -17,4 +16,4 @@ export {
|
|
|
17
16
|
clearGoalManagers,
|
|
18
17
|
getGoalManager
|
|
19
18
|
};
|
|
20
|
-
//# sourceMappingURL=goal-manager-
|
|
19
|
+
//# sourceMappingURL=goal-manager-AP4LTE6U.js.map
|
|
@@ -1,19 +1,18 @@
|
|
|
1
1
|
import {
|
|
2
2
|
GuardianAgent,
|
|
3
3
|
getGuardian
|
|
4
|
-
} from "./chunk-
|
|
5
|
-
import "./chunk-
|
|
6
|
-
import "./chunk-F4NJ4CBP.js";
|
|
4
|
+
} from "./chunk-HFKOGW7H.js";
|
|
5
|
+
import "./chunk-SPQJC7RA.js";
|
|
7
6
|
import "./chunk-IXO4G4D3.js";
|
|
8
|
-
import "./chunk-
|
|
9
|
-
import "./chunk-
|
|
10
|
-
import "./chunk-R3I2GCZC.js";
|
|
11
|
-
import "./chunk-JDHR5BDR.js";
|
|
7
|
+
import "./chunk-33WL3D7A.js";
|
|
8
|
+
import "./chunk-6JPPYG7F.js";
|
|
12
9
|
import "./chunk-R4AAPFXC.js";
|
|
10
|
+
import "./chunk-F4NJ4CBP.js";
|
|
11
|
+
import "./chunk-6NLHFIYA.js";
|
|
13
12
|
import "./chunk-APMV77PU.js";
|
|
14
13
|
import "./chunk-DGUM43GV.js";
|
|
15
14
|
export {
|
|
16
15
|
GuardianAgent,
|
|
17
16
|
getGuardian
|
|
18
17
|
};
|
|
19
|
-
//# sourceMappingURL=guardian-agent-
|
|
18
|
+
//# sourceMappingURL=guardian-agent-WB6LWRLM.js.map
|
package/dist/index.js
CHANGED
|
@@ -3,45 +3,45 @@ import {
|
|
|
3
3
|
IncidentIndex,
|
|
4
4
|
LearningEngine,
|
|
5
5
|
LinearIngester,
|
|
6
|
+
appendToSection,
|
|
6
7
|
completeBootstrap,
|
|
7
8
|
exportToJson,
|
|
8
9
|
formatFriendlyError,
|
|
9
10
|
getAutonomyConfig,
|
|
11
|
+
getContextForAI,
|
|
10
12
|
getLastCheckpoint,
|
|
13
|
+
getProjectInfoStructured,
|
|
14
|
+
getProjectSection,
|
|
15
|
+
getProjectSections,
|
|
11
16
|
importFromJson,
|
|
17
|
+
initProjectInfo,
|
|
12
18
|
initializeBootstrapFiles,
|
|
13
19
|
listCheckpoints,
|
|
14
20
|
loadBootstrapContext,
|
|
15
21
|
loadConfig,
|
|
22
|
+
loadContextState,
|
|
23
|
+
loadProjectInfo,
|
|
16
24
|
loadRules,
|
|
17
25
|
loadTeamInfo,
|
|
18
26
|
needsBootstrap,
|
|
19
27
|
perceiveCurrentChanges,
|
|
28
|
+
projectInfoExists,
|
|
20
29
|
reasonAboutChangesHumanReadable,
|
|
30
|
+
runShellCommandSync,
|
|
21
31
|
saveCheckpoint,
|
|
22
|
-
trackIssueOccurrence
|
|
23
|
-
|
|
32
|
+
trackIssueOccurrence,
|
|
33
|
+
updateProjectSection
|
|
34
|
+
} from "./chunk-CKYU5JOD.js";
|
|
24
35
|
import {
|
|
25
36
|
InteractiveDashboard,
|
|
26
37
|
StreamingManager,
|
|
27
38
|
TrieScanTool,
|
|
28
39
|
getOutputManager
|
|
29
|
-
} from "./chunk-
|
|
30
|
-
import "./chunk-
|
|
40
|
+
} from "./chunk-M4YMTHGG.js";
|
|
41
|
+
import "./chunk-HFKOGW7H.js";
|
|
31
42
|
import {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
getProjectInfoStructured,
|
|
35
|
-
getProjectSection,
|
|
36
|
-
getProjectSections,
|
|
37
|
-
initProjectInfo,
|
|
38
|
-
isTrieInitialized,
|
|
39
|
-
loadContextState,
|
|
40
|
-
loadProjectInfo,
|
|
41
|
-
projectInfoExists,
|
|
42
|
-
runShellCommandSync,
|
|
43
|
-
updateProjectSection
|
|
44
|
-
} from "./chunk-CCI6LKXZ.js";
|
|
43
|
+
isTrieInitialized
|
|
44
|
+
} from "./chunk-HIKONDDO.js";
|
|
45
45
|
import {
|
|
46
46
|
ContextGraph,
|
|
47
47
|
findCrossProjectPatterns,
|
|
@@ -49,15 +49,12 @@ import {
|
|
|
49
49
|
getStorage,
|
|
50
50
|
listTrackedProjects,
|
|
51
51
|
searchGlobalPatterns
|
|
52
|
-
} from "./chunk-
|
|
53
|
-
import "./chunk-F4NJ4CBP.js";
|
|
52
|
+
} from "./chunk-SPQJC7RA.js";
|
|
54
53
|
import "./chunk-IXO4G4D3.js";
|
|
55
|
-
import "./chunk-6NLHFIYA.js";
|
|
56
54
|
import {
|
|
57
55
|
getSkillRegistry
|
|
58
56
|
} from "./chunk-G76DYVGX.js";
|
|
59
|
-
import "./chunk-
|
|
60
|
-
import "./chunk-R3I2GCZC.js";
|
|
57
|
+
import "./chunk-33WL3D7A.js";
|
|
61
58
|
import {
|
|
62
59
|
findSimilarIssues,
|
|
63
60
|
getMemoryStats,
|
|
@@ -65,11 +62,13 @@ import {
|
|
|
65
62
|
markIssueResolved,
|
|
66
63
|
purgeIssues,
|
|
67
64
|
searchIssues
|
|
68
|
-
} from "./chunk-
|
|
65
|
+
} from "./chunk-6JPPYG7F.js";
|
|
69
66
|
import {
|
|
70
67
|
getTrieDirectory,
|
|
71
68
|
getWorkingDirectory
|
|
72
69
|
} from "./chunk-R4AAPFXC.js";
|
|
70
|
+
import "./chunk-F4NJ4CBP.js";
|
|
71
|
+
import "./chunk-6NLHFIYA.js";
|
|
73
72
|
import {
|
|
74
73
|
isInteractiveMode
|
|
75
74
|
} from "./chunk-APMV77PU.js";
|
|
@@ -3069,7 +3068,6 @@ var SKIP_DIRS = /* @__PURE__ */ new Set([
|
|
|
3069
3068
|
".cache"
|
|
3070
3069
|
]);
|
|
3071
3070
|
var TrieWatchTool = class {
|
|
3072
|
-
scanTool = new TrieScanTool();
|
|
3073
3071
|
extractionPipeline = null;
|
|
3074
3072
|
state = {
|
|
3075
3073
|
isRunning: false,
|
|
@@ -3165,23 +3163,12 @@ var TrieWatchTool = class {
|
|
|
3165
3163
|
getOutputManager().setMode("console");
|
|
3166
3164
|
}
|
|
3167
3165
|
await this.watchDirectory(directory, debounceMs);
|
|
3168
|
-
if (!isInteractiveMode()) {
|
|
3169
|
-
console.error("Running initial scan...\n");
|
|
3170
|
-
}
|
|
3171
|
-
const initialResult = await this.scanTool.execute({
|
|
3172
|
-
directory,
|
|
3173
|
-
interactive: isInteractiveMode(),
|
|
3174
|
-
streamingManager: this.streamingManager,
|
|
3175
|
-
dashboard: this.dashboard
|
|
3176
|
-
});
|
|
3177
3166
|
if (this.streamingManager) {
|
|
3178
|
-
|
|
3179
|
-
|
|
3180
|
-
|
|
3181
|
-
|
|
3182
|
-
|
|
3183
|
-
});
|
|
3184
|
-
}, 100);
|
|
3167
|
+
this.streamingManager.reportWatchStatus({
|
|
3168
|
+
watching: true,
|
|
3169
|
+
directories: this.watchers.size,
|
|
3170
|
+
debounceMs
|
|
3171
|
+
});
|
|
3185
3172
|
}
|
|
3186
3173
|
return {
|
|
3187
3174
|
content: [{
|
|
@@ -3204,16 +3191,11 @@ Your Trie agent is now autonomously watching and learning from your codebase.
|
|
|
3204
3191
|
### The agent learns:
|
|
3205
3192
|
- Every commit builds the decision ledger
|
|
3206
3193
|
- \`trie gotcha\` queries the ledger for predictions
|
|
3207
|
-
- \`trie ok\` / \`trie bad\` teach the agent what matters
|
|
3194
|
+
- \`trie ok\` / \`trie bad\` teach the agent what matters
|
|
3208
3195
|
|
|
3209
3196
|
### Commands:
|
|
3210
3197
|
- \`trie_watch status\` - See agent status
|
|
3211
|
-
- \`trie_watch
|
|
3212
|
-
- \`trie_watch stop\` - Stop the agent
|
|
3213
|
-
|
|
3214
|
-
---
|
|
3215
|
-
|
|
3216
|
-
${initialResult.content?.[0]?.text || "Initial scan complete."}`
|
|
3198
|
+
- \`trie_watch stop\` - Stop the agent`
|
|
3217
3199
|
}]
|
|
3218
3200
|
};
|
|
3219
3201
|
}
|
|
@@ -3289,7 +3271,7 @@ ${f.content.slice(0, 1e3)}`
|
|
|
3289
3271
|
// First 1KB of each file
|
|
3290
3272
|
).join("\n\n---\n\n");
|
|
3291
3273
|
if (!isInteractiveMode()) {
|
|
3292
|
-
console.error("
|
|
3274
|
+
console.error("[*] Extracting signals from changes...");
|
|
3293
3275
|
}
|
|
3294
3276
|
const signal = await this.extractionPipeline.process(combinedContent, {
|
|
3295
3277
|
sourceType: "file",
|
|
@@ -3297,7 +3279,7 @@ ${f.content.slice(0, 1e3)}`
|
|
|
3297
3279
|
});
|
|
3298
3280
|
if (signal.decisions.length > 0 || signal.facts.length > 0 || signal.blockers.length > 0) {
|
|
3299
3281
|
if (!isInteractiveMode()) {
|
|
3300
|
-
console.error(`
|
|
3282
|
+
console.error(` [+] Extracted: ${signal.decisions.length} decisions, ${signal.facts.length} facts, ${signal.blockers.length} blockers`);
|
|
3301
3283
|
}
|
|
3302
3284
|
if (this.streamingManager) {
|
|
3303
3285
|
this.streamingManager.reportSignalExtraction({
|
|
@@ -3307,11 +3289,14 @@ ${f.content.slice(0, 1e3)}`
|
|
|
3307
3289
|
questions: signal.questions.length
|
|
3308
3290
|
});
|
|
3309
3291
|
}
|
|
3292
|
+
if (signal.blockers.length > 0 && !this.isQuiet()) {
|
|
3293
|
+
this.maybeAutoCheck(files);
|
|
3294
|
+
}
|
|
3310
3295
|
}
|
|
3311
3296
|
}
|
|
3312
3297
|
} catch (error) {
|
|
3313
3298
|
if (!isInteractiveMode()) {
|
|
3314
|
-
console.error(`
|
|
3299
|
+
console.error(` [!] Signal extraction failed: ${error}`);
|
|
3315
3300
|
}
|
|
3316
3301
|
}
|
|
3317
3302
|
}
|
|
@@ -3320,43 +3305,10 @@ ${f.content.slice(0, 1e3)}`
|
|
|
3320
3305
|
this.streamingManager.reportWatchChange(file);
|
|
3321
3306
|
}
|
|
3322
3307
|
}
|
|
3323
|
-
const result = await this.scanTool.execute({
|
|
3324
|
-
files,
|
|
3325
|
-
interactive: isInteractiveMode(),
|
|
3326
|
-
streamingManager: this.streamingManager,
|
|
3327
|
-
dashboard: this.dashboard
|
|
3328
|
-
});
|
|
3329
|
-
const resultText = result.content?.[0]?.text || "";
|
|
3330
3308
|
this.state.filesScanned += files.length;
|
|
3331
|
-
const issueMatch = resultText.match(/(\d+) total/);
|
|
3332
|
-
if (issueMatch?.[1] !== void 0) {
|
|
3333
|
-
const newIssues = parseInt(issueMatch[1], 10);
|
|
3334
|
-
this.state.totalIssuesFound += newIssues;
|
|
3335
|
-
if (!isInteractiveMode()) {
|
|
3336
|
-
if (newIssues > 0) {
|
|
3337
|
-
console.error(`
|
|
3338
|
-
Found ${newIssues} issues in changed files!`);
|
|
3339
|
-
const criticalMatch = resultText.match(/(\d+) CRITICAL/);
|
|
3340
|
-
const seriousMatch = resultText.match(/(\d+) SERIOUS/);
|
|
3341
|
-
const moderateMatch = resultText.match(/(\d+) MODERATE/);
|
|
3342
|
-
if (criticalMatch) {
|
|
3343
|
-
console.error(` [!] ${criticalMatch[1]} critical issues`);
|
|
3344
|
-
}
|
|
3345
|
-
if (seriousMatch) {
|
|
3346
|
-
console.error(` [x] ${seriousMatch[1]} serious issues`);
|
|
3347
|
-
}
|
|
3348
|
-
if (moderateMatch) {
|
|
3349
|
-
console.error(` [~] ${moderateMatch[1]} moderate issues`);
|
|
3350
|
-
}
|
|
3351
|
-
} else {
|
|
3352
|
-
console.error(" [OK] No issues found - code looks good!");
|
|
3353
|
-
}
|
|
3354
|
-
}
|
|
3355
|
-
}
|
|
3356
3309
|
for (const file of files) {
|
|
3357
3310
|
this.state.lastScan.set(file, Date.now());
|
|
3358
3311
|
}
|
|
3359
|
-
this.maybeNudge(files, resultText);
|
|
3360
3312
|
} catch (error) {
|
|
3361
3313
|
if (!isInteractiveMode()) {
|
|
3362
3314
|
console.error(`Scan error: ${error}`);
|
|
@@ -3375,38 +3327,8 @@ Found ${newIssues} issues in changed files!`);
|
|
|
3375
3327
|
return false;
|
|
3376
3328
|
}
|
|
3377
3329
|
}
|
|
3378
|
-
maybeNudge(files, resultText) {
|
|
3379
|
-
if (this.isQuiet()) return;
|
|
3380
|
-
const isCritical = /CRITICAL|\[STOP\]/i.test(resultText);
|
|
3381
|
-
const isRisky = /HIGH RISK|SERIOUS|\[!\]/i.test(resultText);
|
|
3382
|
-
if (!isCritical && !isRisky) return;
|
|
3383
|
-
if (isCritical) {
|
|
3384
|
-
this.state.criticalIssueCount++;
|
|
3385
|
-
this.maybeAutoCheck(files);
|
|
3386
|
-
}
|
|
3387
|
-
for (const file of files) {
|
|
3388
|
-
if (this.state.nudgedFiles.has(file)) continue;
|
|
3389
|
-
this.state.nudgedFiles.add(file);
|
|
3390
|
-
const severity = isCritical ? "critical" : "warning";
|
|
3391
|
-
const message = isCritical ? `[!!!] STOP! ${basename2(file)} has critical issues. Do NOT push until fixed.` : `[!] Heads up: ${basename2(file)} looks risky. Pause and run targeted tests before pushing.`;
|
|
3392
|
-
const payload = {
|
|
3393
|
-
file,
|
|
3394
|
-
message,
|
|
3395
|
-
severity: severity === "critical" ? "high" : "high",
|
|
3396
|
-
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
3397
|
-
};
|
|
3398
|
-
this.state.nudges.push(payload);
|
|
3399
|
-
getOutputManager().nudge(
|
|
3400
|
-
message,
|
|
3401
|
-
severity,
|
|
3402
|
-
file,
|
|
3403
|
-
severity === "critical" ? void 0 : 15e3
|
|
3404
|
-
// Auto-hide warnings after 15s, keep critical until dismissed
|
|
3405
|
-
);
|
|
3406
|
-
}
|
|
3407
|
-
}
|
|
3408
3330
|
/**
|
|
3409
|
-
* Auto-run
|
|
3331
|
+
* Auto-run gotcha prediction on changed files
|
|
3410
3332
|
* Respects cooldown and autonomy config
|
|
3411
3333
|
*/
|
|
3412
3334
|
async maybeAutoCheck(triggerFiles) {
|
|
@@ -3546,12 +3468,12 @@ Use \`trie_watch start\` to begin autonomous scanning.`
|
|
|
3546
3468
|
).join("\n");
|
|
3547
3469
|
let agencyStatus = "";
|
|
3548
3470
|
try {
|
|
3549
|
-
const { getGuardian } = await import("./guardian-agent-
|
|
3550
|
-
const
|
|
3551
|
-
await
|
|
3552
|
-
const status = await
|
|
3471
|
+
const { getGuardian } = await import("./guardian-agent-WB6LWRLM.js");
|
|
3472
|
+
const trieAgent = getGuardian(getWorkingDirectory(void 0, true));
|
|
3473
|
+
await trieAgent.initialize();
|
|
3474
|
+
const status = await trieAgent.getAgencyStatus();
|
|
3553
3475
|
agencyStatus = `
|
|
3554
|
-
### [AI]
|
|
3476
|
+
### [AI] Trie Agent:
|
|
3555
3477
|
- **Goals:** ${status.goals.active} active, ${status.goals.completed} completed${status.goals.topGoal ? ` (${status.goals.topGoal.slice(0, 40)}...)` : ""}
|
|
3556
3478
|
- **Hypotheses:** ${status.hypotheses.testing} testing, ${status.hypotheses.validated} validated
|
|
3557
3479
|
- **Risk Level:** ${status.riskLevel.toUpperCase()}
|