@triedotdev/mcp 1.0.62 → 1.0.63
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 +591 -52
- package/dist/agent-smith-W4HUCFGC.js +14 -0
- package/dist/{agent-smith-runner-ZU4R3I2Z.js → agent-smith-runner-QRVOEOBE.js} +13 -7
- package/dist/agent-smith-runner-QRVOEOBE.js.map +1 -0
- package/dist/chunk-4YSLDGBL.js +674 -0
- package/dist/chunk-4YSLDGBL.js.map +1 -0
- package/dist/chunk-7KHT2NKR.js +212 -0
- package/dist/chunk-7KHT2NKR.js.map +1 -0
- package/dist/{chunk-XSPS463E.js → chunk-ALA6733H.js} +492 -14
- package/dist/chunk-ALA6733H.js.map +1 -0
- package/dist/chunk-AQCAMIQQ.js +139 -0
- package/dist/chunk-AQCAMIQQ.js.map +1 -0
- package/dist/chunk-D3DMONAJ.js +904 -0
- package/dist/chunk-D3DMONAJ.js.map +1 -0
- package/dist/{chunk-KB5ZN6K2.js → chunk-GWSNINKX.js} +2 -2
- package/dist/{chunk-32WLOG6E.js → chunk-K6BQBKIR.js} +662 -633
- package/dist/chunk-K6BQBKIR.js.map +1 -0
- package/dist/{chunk-ASGSTVVF.js → chunk-KOFQ47YW.js} +10 -6
- package/dist/chunk-KOFQ47YW.js.map +1 -0
- package/dist/{chunk-XXNE6HBE.js → chunk-N2AZH3EQ.js} +7697 -4803
- package/dist/chunk-N2AZH3EQ.js.map +1 -0
- package/dist/chunk-PBOVCPKE.js +2566 -0
- package/dist/chunk-PBOVCPKE.js.map +1 -0
- package/dist/{chunk-NUT4G5AY.js → chunk-R7Z7OHTJ.js} +493 -650
- package/dist/chunk-R7Z7OHTJ.js.map +1 -0
- package/dist/chunk-TSHZQKCM.js +933 -0
- package/dist/chunk-TSHZQKCM.js.map +1 -0
- package/dist/{chunk-S4VGGLXF.js → chunk-X2PABPBH.js} +461 -892
- package/dist/chunk-X2PABPBH.js.map +1 -0
- package/dist/cli/create-agent.js +3 -2
- package/dist/cli/create-agent.js.map +1 -1
- package/dist/cli/main.js +1120 -70
- package/dist/cli/main.js.map +1 -1
- package/dist/cli/yolo-daemon.js +151 -41
- package/dist/cli/yolo-daemon.js.map +1 -1
- package/dist/goal-manager-KFBOAP4X.js +20 -0
- package/dist/goal-manager-KFBOAP4X.js.map +1 -0
- package/dist/guardian-agent-PULK546O.js +17 -0
- package/dist/guardian-agent-PULK546O.js.map +1 -0
- package/dist/index.js +173 -39
- package/dist/index.js.map +1 -1
- package/dist/issue-store-QRDF3X55.js +22 -0
- package/dist/issue-store-QRDF3X55.js.map +1 -0
- package/dist/workers/agent-worker.js +6 -3
- package/dist/workers/agent-worker.js.map +1 -1
- package/package.json +1 -1
- package/dist/agent-smith-57MKX5QC.js +0 -13
- package/dist/agent-smith-runner-ZU4R3I2Z.js.map +0 -1
- package/dist/chunk-32WLOG6E.js.map +0 -1
- package/dist/chunk-ASGSTVVF.js.map +0 -1
- package/dist/chunk-NUT4G5AY.js.map +0 -1
- package/dist/chunk-S4VGGLXF.js.map +0 -1
- package/dist/chunk-XSPS463E.js.map +0 -1
- package/dist/chunk-XXNE6HBE.js.map +0 -1
- /package/dist/{agent-smith-57MKX5QC.js.map → agent-smith-W4HUCFGC.js.map} +0 -0
- /package/dist/{chunk-KB5ZN6K2.js.map → chunk-GWSNINKX.js.map} +0 -0
package/dist/cli/yolo-daemon.js
CHANGED
|
@@ -1,16 +1,26 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
|
+
InteractiveDashboard,
|
|
4
|
+
StreamingManager,
|
|
3
5
|
TrieScanTool
|
|
4
|
-
} from "../chunk-
|
|
5
|
-
import "../chunk-
|
|
6
|
-
import "../chunk-
|
|
6
|
+
} from "../chunk-N2AZH3EQ.js";
|
|
7
|
+
import "../chunk-ULOW5HSH.js";
|
|
8
|
+
import "../chunk-PBOVCPKE.js";
|
|
9
|
+
import "../chunk-D3DMONAJ.js";
|
|
10
|
+
import {
|
|
11
|
+
isTrieInitialized
|
|
12
|
+
} from "../chunk-ALA6733H.js";
|
|
13
|
+
import "../chunk-4YSLDGBL.js";
|
|
14
|
+
import "../chunk-X2PABPBH.js";
|
|
15
|
+
import "../chunk-7KHT2NKR.js";
|
|
7
16
|
import "../chunk-MVUCBUBR.js";
|
|
8
|
-
import "../chunk-
|
|
17
|
+
import "../chunk-6NLHFIYA.js";
|
|
18
|
+
import "../chunk-K6BQBKIR.js";
|
|
19
|
+
import "../chunk-AQCAMIQQ.js";
|
|
20
|
+
import "../chunk-TSHZQKCM.js";
|
|
9
21
|
import {
|
|
10
22
|
getWorkingDirectory
|
|
11
|
-
} from "../chunk-
|
|
12
|
-
import "../chunk-ULOW5HSH.js";
|
|
13
|
-
import "../chunk-6NLHFIYA.js";
|
|
23
|
+
} from "../chunk-KOFQ47YW.js";
|
|
14
24
|
import {
|
|
15
25
|
isInteractiveMode,
|
|
16
26
|
setInteractiveMode
|
|
@@ -55,6 +65,8 @@ var WatchDaemon = class {
|
|
|
55
65
|
pendingFiles = /* @__PURE__ */ new Set();
|
|
56
66
|
debounceTimer = null;
|
|
57
67
|
isProcessing = false;
|
|
68
|
+
streamingManager = void 0;
|
|
69
|
+
dashboard = void 0;
|
|
58
70
|
constructor(config2) {
|
|
59
71
|
this.config = config2;
|
|
60
72
|
this.stats = {
|
|
@@ -71,6 +83,13 @@ var WatchDaemon = class {
|
|
|
71
83
|
if (this.config.interactive !== false && process.stdout.isTTY) {
|
|
72
84
|
setInteractiveMode(true);
|
|
73
85
|
}
|
|
86
|
+
if (!isTrieInitialized(this.config.directory)) {
|
|
87
|
+
if (!isInteractiveMode()) {
|
|
88
|
+
console.error("Trie is not initialized for this project.");
|
|
89
|
+
console.error("Run `trie init` first.");
|
|
90
|
+
}
|
|
91
|
+
process.exit(1);
|
|
92
|
+
}
|
|
74
93
|
this.log("info", "\u{1F6E1}\uFE0F Starting Trie Guardian Agent", {
|
|
75
94
|
directory: this.config.directory,
|
|
76
95
|
debounceMs: this.config.debounceMs
|
|
@@ -82,6 +101,20 @@ var WatchDaemon = class {
|
|
|
82
101
|
this.log("error", "Directory not found", { directory: this.config.directory });
|
|
83
102
|
process.exit(1);
|
|
84
103
|
}
|
|
104
|
+
if (isInteractiveMode()) {
|
|
105
|
+
this.streamingManager = new StreamingManager();
|
|
106
|
+
this.dashboard = new InteractiveDashboard();
|
|
107
|
+
this.streamingManager.subscribe((update) => this.dashboard?.handleStreamUpdate(update));
|
|
108
|
+
this.dashboard.onMoneybagsChange(() => {
|
|
109
|
+
this.recalculateMoneybags();
|
|
110
|
+
});
|
|
111
|
+
await this.dashboard.start();
|
|
112
|
+
this.streamingManager.reportWatchStatus({
|
|
113
|
+
watching: !this.config.runOnce,
|
|
114
|
+
directories: 0,
|
|
115
|
+
debounceMs: this.config.debounceMs
|
|
116
|
+
});
|
|
117
|
+
}
|
|
85
118
|
this.log("info", "Running initial scan...");
|
|
86
119
|
await this.runScan(this.config.files);
|
|
87
120
|
if (this.config.runOnce) {
|
|
@@ -89,6 +122,11 @@ var WatchDaemon = class {
|
|
|
89
122
|
process.exit(this.stats.issuesFound > 0 ? 1 : 0);
|
|
90
123
|
}
|
|
91
124
|
await this.watchDirectory(this.config.directory);
|
|
125
|
+
this.streamingManager?.reportWatchStatus({
|
|
126
|
+
watching: true,
|
|
127
|
+
directories: this.watchers.size,
|
|
128
|
+
debounceMs: this.config.debounceMs
|
|
129
|
+
});
|
|
92
130
|
this.log("info", "Guardian is watching for changes...", {
|
|
93
131
|
directories: this.watchers.size
|
|
94
132
|
});
|
|
@@ -110,7 +148,39 @@ var WatchDaemon = class {
|
|
|
110
148
|
if (this.config.interactive !== void 0) scanArgs.interactive = this.config.interactive;
|
|
111
149
|
if (this.config.workers !== void 0) scanArgs.workers = this.config.workers;
|
|
112
150
|
if (this.config.timeoutMs) scanArgs.timeoutMs = this.config.timeoutMs;
|
|
113
|
-
if (this.
|
|
151
|
+
if (this.dashboard && typeof this.dashboard.getGuardianConfig === "function") {
|
|
152
|
+
const guardianConfig = this.dashboard.getGuardianConfig();
|
|
153
|
+
scanArgs.userCount = this.config.userCount || guardianConfig.moneybags.userCount;
|
|
154
|
+
scanArgs.moneybagsConfig = {
|
|
155
|
+
userCount: this.config.userCount || guardianConfig.moneybags.userCount,
|
|
156
|
+
payingUsers: guardianConfig.moneybags.payingUsers,
|
|
157
|
+
revenuePerUser: guardianConfig.moneybags.revenuePerUser,
|
|
158
|
+
developerRate: guardianConfig.moneybags.developerRate,
|
|
159
|
+
industry: this.config.industry || guardianConfig.moneybags.industry
|
|
160
|
+
};
|
|
161
|
+
scanArgs.agentSmithConfig = {
|
|
162
|
+
aiEnhancement: guardianConfig.agentSmith.aiEnhancement,
|
|
163
|
+
minSeverity: guardianConfig.agentSmith.minSeverity,
|
|
164
|
+
enabledCategories: { ...guardianConfig.agentSmith.enabledCategories },
|
|
165
|
+
memoryRetentionDays: guardianConfig.agentSmith.memoryRetentionDays
|
|
166
|
+
};
|
|
167
|
+
scanArgs.parallel = guardianConfig.performance.parallel;
|
|
168
|
+
scanArgs.cache = guardianConfig.performance.cache;
|
|
169
|
+
scanArgs.maxConcurrency = guardianConfig.performance.maxConcurrency;
|
|
170
|
+
scanArgs.timeoutMs = guardianConfig.performance.timeoutMs;
|
|
171
|
+
scanArgs.workers = guardianConfig.performance.workers;
|
|
172
|
+
scanArgs.streaming = guardianConfig.performance.streaming;
|
|
173
|
+
} else {
|
|
174
|
+
if (this.config.userCount || this.config.industry) {
|
|
175
|
+
scanArgs.userCount = this.config.userCount;
|
|
176
|
+
scanArgs.moneybagsConfig = {
|
|
177
|
+
userCount: this.config.userCount || 250,
|
|
178
|
+
...this.config.industry && { industry: this.config.industry }
|
|
179
|
+
};
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
if (this.streamingManager) scanArgs.streamingManager = this.streamingManager;
|
|
183
|
+
if (this.dashboard) scanArgs.dashboard = this.dashboard;
|
|
114
184
|
const result = await this.scanTool.execute(scanArgs);
|
|
115
185
|
const resultText = result.content?.[0]?.text || "";
|
|
116
186
|
if (resultText && this.config.runOnce && !isInteractiveMode()) {
|
|
@@ -184,6 +254,7 @@ var WatchDaemon = class {
|
|
|
184
254
|
if (!WATCH_EXTENSIONS.has(ext)) return;
|
|
185
255
|
if (!existsSync(fullPath)) return;
|
|
186
256
|
this.pendingFiles.add(fullPath);
|
|
257
|
+
this.streamingManager?.reportWatchChange(fullPath);
|
|
187
258
|
this.scheduleProcessing();
|
|
188
259
|
});
|
|
189
260
|
this.watchers.set(dir, watcher);
|
|
@@ -222,6 +293,14 @@ var WatchDaemon = class {
|
|
|
222
293
|
await this.runScan(files);
|
|
223
294
|
this.isProcessing = false;
|
|
224
295
|
}
|
|
296
|
+
/**
|
|
297
|
+
* Recalculate Moneybags costs with updated settings
|
|
298
|
+
* This re-runs only the Moneybags agent on previously scanned issues
|
|
299
|
+
*/
|
|
300
|
+
recalculateMoneybags() {
|
|
301
|
+
this.log("info", "Recalculating Moneybags costs with new settings...");
|
|
302
|
+
void this.runScan(this.config.files);
|
|
303
|
+
}
|
|
225
304
|
/**
|
|
226
305
|
* Log a message
|
|
227
306
|
*/
|
|
@@ -257,13 +336,23 @@ var WatchDaemon = class {
|
|
|
257
336
|
if (this.debounceTimer) {
|
|
258
337
|
clearTimeout(this.debounceTimer);
|
|
259
338
|
}
|
|
339
|
+
if (this.streamingManager) {
|
|
340
|
+
this.streamingManager.reportWatchStatus({
|
|
341
|
+
watching: false,
|
|
342
|
+
directories: 0
|
|
343
|
+
});
|
|
344
|
+
}
|
|
345
|
+
if (this.dashboard) {
|
|
346
|
+
this.dashboard.stop();
|
|
347
|
+
}
|
|
260
348
|
process.exit(0);
|
|
261
349
|
}
|
|
262
350
|
};
|
|
263
351
|
function parseArgs() {
|
|
264
352
|
const args = process.argv.slice(2);
|
|
265
353
|
const config2 = {
|
|
266
|
-
|
|
354
|
+
// Silent mode for initial workspace detection (TUI will handle display)
|
|
355
|
+
directory: getWorkingDirectory(void 0, true),
|
|
267
356
|
debounceMs: 1e3,
|
|
268
357
|
jsonOutput: false,
|
|
269
358
|
runOnce: false,
|
|
@@ -351,44 +440,63 @@ function parseArgs() {
|
|
|
351
440
|
config2.userCount = parseInt(nextArg || "250", 10);
|
|
352
441
|
i++;
|
|
353
442
|
break;
|
|
443
|
+
case "--industry":
|
|
444
|
+
if (nextArg && ["solopreneur", "startup", "fintech", "healthcare", "enterprise", "saas", "ecommerce"].includes(nextArg)) {
|
|
445
|
+
config2.industry = nextArg;
|
|
446
|
+
i++;
|
|
447
|
+
} else {
|
|
448
|
+
if (!process.stdout.isTTY || process.argv.includes("--non-interactive")) {
|
|
449
|
+
console.error(`Invalid industry: ${nextArg || "(none)"}`);
|
|
450
|
+
console.error("Valid options: solopreneur, startup, fintech, healthcare, enterprise, saas, ecommerce");
|
|
451
|
+
}
|
|
452
|
+
process.exit(1);
|
|
453
|
+
}
|
|
454
|
+
break;
|
|
354
455
|
case "--help":
|
|
355
456
|
case "-h":
|
|
356
457
|
console.log(`
|
|
357
|
-
Trie
|
|
358
|
-
Headless file watcher for local/CI environments.
|
|
458
|
+
Trie Guardian - File Watcher & Scanner
|
|
359
459
|
|
|
360
|
-
|
|
361
|
-
|
|
460
|
+
USAGE:
|
|
461
|
+
trie watch [options] Watch for changes and scan continuously
|
|
462
|
+
trie scan [options] Scan once and exit
|
|
362
463
|
|
|
363
|
-
|
|
364
|
-
--dir, -d
|
|
365
|
-
--debounce, -D
|
|
366
|
-
--
|
|
367
|
-
--
|
|
368
|
-
--
|
|
369
|
-
--
|
|
370
|
-
--no-parallel Disable parallel execution
|
|
371
|
-
--cache Enable result caching
|
|
372
|
-
--no-cache Disable result caching
|
|
373
|
-
--max-concurrency Max parallel agents
|
|
374
|
-
--streaming Enable streaming updates
|
|
375
|
-
--no-streaming Disable streaming updates
|
|
376
|
-
--interactive Enable interactive dashboard (default for TTY)
|
|
377
|
-
--no-interactive Disable interactive dashboard (for CI/scripts)
|
|
378
|
-
--workers Use worker threads for agents
|
|
379
|
-
--no-workers Disable worker threads
|
|
380
|
-
--timeout Agent timeout in ms
|
|
381
|
-
--files Comma-separated file list to scan
|
|
382
|
-
--once Run once and exit (no watch)
|
|
383
|
-
--users, -u User count for cost estimation (default: 250)
|
|
384
|
-
--help, -h Show this help
|
|
464
|
+
OPTIONS:
|
|
465
|
+
--dir, -d <path> Directory to watch/scan (default: current directory)
|
|
466
|
+
--debounce, -D <ms> Debounce time in ms (default: 1000)
|
|
467
|
+
--agents <list> Comma-separated agents to run (e.g., security,privacy)
|
|
468
|
+
--files <list> Comma-separated file list to scan
|
|
469
|
+
--users, -u <count> User count for cost estimation (default: 250)
|
|
470
|
+
--industry <type> Industry type for cost scaling (solopreneur, startup, fintech, healthcare, enterprise, saas, ecommerce)
|
|
385
471
|
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
472
|
+
OUTPUT:
|
|
473
|
+
--json Output as JSON (for log aggregation)
|
|
474
|
+
--format <text|json> Scan output format
|
|
475
|
+
--output <path> Output file path for json format
|
|
389
476
|
|
|
390
|
-
|
|
391
|
-
|
|
477
|
+
PERFORMANCE:
|
|
478
|
+
--parallel Enable parallel execution
|
|
479
|
+
--no-parallel Disable parallel execution
|
|
480
|
+
--cache Enable result caching
|
|
481
|
+
--no-cache Disable result caching
|
|
482
|
+
--max-concurrency <n> Max parallel agents
|
|
483
|
+
--streaming Enable streaming updates
|
|
484
|
+
--no-streaming Disable streaming updates
|
|
485
|
+
--workers Use worker threads for agents
|
|
486
|
+
--no-workers Disable worker threads
|
|
487
|
+
--timeout <ms> Agent timeout in ms
|
|
488
|
+
|
|
489
|
+
DISPLAY:
|
|
490
|
+
--interactive Enable interactive dashboard (default for TTY)
|
|
491
|
+
--no-interactive Disable interactive dashboard (for CI/scripts)
|
|
492
|
+
|
|
493
|
+
EXAMPLES:
|
|
494
|
+
trie watch # Watch current directory
|
|
495
|
+
trie scan # Scan once and exit
|
|
496
|
+
trie scan --agents security,privacy # Scan with specific agents
|
|
497
|
+
trie scan --users 1000 --industry fintech # Scale for fintech with 1K users
|
|
498
|
+
trie watch --no-interactive # CI mode: watch without dashboard
|
|
499
|
+
trie scan --json --output report.json
|
|
392
500
|
`);
|
|
393
501
|
process.exit(0);
|
|
394
502
|
}
|
|
@@ -398,7 +506,9 @@ Examples:
|
|
|
398
506
|
var config = parseArgs();
|
|
399
507
|
var daemon = new WatchDaemon(config);
|
|
400
508
|
daemon.start().catch((error) => {
|
|
401
|
-
|
|
509
|
+
if (!process.stdout.isTTY || process.argv.includes("--non-interactive")) {
|
|
510
|
+
console.error("Failed to start daemon:", error);
|
|
511
|
+
}
|
|
402
512
|
process.exit(1);
|
|
403
513
|
});
|
|
404
514
|
//# sourceMappingURL=yolo-daemon.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/cli/yolo-daemon.ts"],"sourcesContent":["#!/usr/bin/env node\n/**\n * Trie Agent Watch Daemon\n * \n * Headless file watcher for local/CI environments.\n * Watches a directory and reports issues as they occur.\n * \n * Usage:\n * node dist/cli/yolo-daemon.js [options]\n * \n * Options:\n * --dir, -d Directory to watch (default: cwd)\n * --debounce, -D Debounce time in ms (default: 1000)\n * --json Output as JSON (for log aggregation)\n * --once Run once and exit (no watch)\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 { getWorkingDirectory } from '../utils/workspace.js';\nimport { isInteractiveMode, setInteractiveMode } from '../utils/progress.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 /** 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\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\n this.log('info', '🛡️ Starting Trie Guardian Agent', {\n directory: this.config.directory,\n debounceMs: this.config.debounceMs\n });\n if (!isInteractiveMode()) {\n console.error('\\n🛡️ Your guardian 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 // 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.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.userCount) scanArgs.userCount = this.config.userCount;\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.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 * 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: 'ℹ️', warn: '⚠️', error: '❌' }[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 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 directory: getWorkingDirectory(),\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 '--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 '--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 Watch Daemon\nHeadless file watcher for local/CI environments.\n\nUsage:\n node dist/cli/yolo-daemon.js [options]\n\nOptions:\n --dir, -d Directory to watch (default: cwd)\n --debounce, -D Debounce time in ms (default: 1000)\n --json Output as JSON (for log aggregation)\n --format Scan output format: text|json\n --output Output file path for json format\n --parallel Enable parallel execution\n --no-parallel Disable parallel execution\n --cache Enable result caching\n --no-cache Disable result caching\n --max-concurrency Max parallel agents\n --streaming Enable streaming updates\n --no-streaming Disable streaming updates\n --interactive Enable interactive dashboard (default for TTY)\n --no-interactive Disable interactive dashboard (for CI/scripts)\n --workers Use worker threads for agents\n --no-workers Disable worker threads\n --timeout Agent timeout in ms\n --files Comma-separated file list to scan\n --once Run once and exit (no watch)\n --users, -u User count for cost estimation (default: 250)\n --help, -h Show this help\n\nExamples:\n # Watch current directory\n node dist/cli/yolo-daemon.js\n\n # CI mode: scan once and exit with error code if issues found\n node dist/cli/yolo-daemon.js --once\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 console.error('Failed to start daemon:', error);\n process.exit(1);\n});\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAiBA,SAAS,OAAO,YAAY,UAAU,oBAAoB;AAC1D,SAAS,eAAe;AACxB,SAAS,MAAM,SAAS,UAAU,eAAe;AAMjD,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;AA4BD,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,EAEvB,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,gBAAgB,SAAS,QAAQ,OAAO,OAAO;AAC7D,yBAAmB,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AAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,CAoCnB;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,UAAQ,MAAM,2BAA2B,KAAK;AAC9C,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 /** 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 Guardian Agent', {\n directory: this.config.directory,\n debounceMs: this.config.debounceMs\n });\n if (!isInteractiveMode()) {\n console.error('\\n🛡️ Your guardian 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 // 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: 'ℹ️', warn: '⚠️', error: '❌' }[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 '--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 '--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 --agents <list> Comma-separated agents to run (e.g., security,privacy)\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 --max-concurrency <n> Max parallel agents\n --streaming Enable streaming updates\n --no-streaming Disable streaming updates\n --workers Use worker threads for agents\n --no-workers Disable worker threads\n --timeout <ms> Agent 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 --agents security,privacy # Scan with specific agents\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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;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,CA2CnB;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"]}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import {
|
|
2
|
+
GoalManager,
|
|
3
|
+
adaptScanFrequency,
|
|
4
|
+
calculateAdaptiveScanFrequency,
|
|
5
|
+
clearGoalManagers,
|
|
6
|
+
getGoalManager
|
|
7
|
+
} from "./chunk-D3DMONAJ.js";
|
|
8
|
+
import "./chunk-4YSLDGBL.js";
|
|
9
|
+
import "./chunk-TSHZQKCM.js";
|
|
10
|
+
import "./chunk-KOFQ47YW.js";
|
|
11
|
+
import "./chunk-RAZUNSBI.js";
|
|
12
|
+
import "./chunk-DGUM43GV.js";
|
|
13
|
+
export {
|
|
14
|
+
GoalManager,
|
|
15
|
+
adaptScanFrequency,
|
|
16
|
+
calculateAdaptiveScanFrequency,
|
|
17
|
+
clearGoalManagers,
|
|
18
|
+
getGoalManager
|
|
19
|
+
};
|
|
20
|
+
//# sourceMappingURL=goal-manager-KFBOAP4X.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import {
|
|
2
|
+
GuardianAgent,
|
|
3
|
+
getGuardian
|
|
4
|
+
} from "./chunk-PBOVCPKE.js";
|
|
5
|
+
import "./chunk-D3DMONAJ.js";
|
|
6
|
+
import "./chunk-4YSLDGBL.js";
|
|
7
|
+
import "./chunk-7KHT2NKR.js";
|
|
8
|
+
import "./chunk-AQCAMIQQ.js";
|
|
9
|
+
import "./chunk-TSHZQKCM.js";
|
|
10
|
+
import "./chunk-KOFQ47YW.js";
|
|
11
|
+
import "./chunk-RAZUNSBI.js";
|
|
12
|
+
import "./chunk-DGUM43GV.js";
|
|
13
|
+
export {
|
|
14
|
+
GuardianAgent,
|
|
15
|
+
getGuardian
|
|
16
|
+
};
|
|
17
|
+
//# sourceMappingURL=guardian-agent-PULK546O.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|