@triedotdev/mcp 1.0.168 → 1.0.170
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 +54 -500
- package/dist/chunk-2YXOBNKW.js +619 -0
- package/dist/chunk-2YXOBNKW.js.map +1 -0
- package/dist/chunk-QR64Y5TI.js +363 -0
- package/dist/chunk-QR64Y5TI.js.map +1 -0
- package/dist/cli/main.d.ts +0 -15
- package/dist/cli/main.js +356 -3100
- package/dist/cli/main.js.map +1 -1
- package/dist/index.js +2 -36
- package/dist/index.js.map +1 -1
- package/dist/server/mcp-server.js +2 -36
- package/package.json +8 -31
- package/dist/autonomy-config-FSERX3O3.js +0 -30
- package/dist/autonomy-config-FSERX3O3.js.map +0 -1
- package/dist/chat-store-JNGNTDSN.js +0 -15
- package/dist/chat-store-JNGNTDSN.js.map +0 -1
- package/dist/chunk-2HF65EHQ.js +0 -311
- package/dist/chunk-2HF65EHQ.js.map +0 -1
- package/dist/chunk-43X6JBEM.js +0 -36
- package/dist/chunk-43X6JBEM.js.map +0 -1
- package/dist/chunk-4MXH2ZPT.js +0 -1827
- package/dist/chunk-4MXH2ZPT.js.map +0 -1
- package/dist/chunk-575YT2SD.js +0 -737
- package/dist/chunk-575YT2SD.js.map +0 -1
- package/dist/chunk-5BRRRTN6.js +0 -354
- package/dist/chunk-5BRRRTN6.js.map +0 -1
- package/dist/chunk-6NLHFIYA.js +0 -344
- package/dist/chunk-6NLHFIYA.js.map +0 -1
- package/dist/chunk-7WITSO22.js +0 -824
- package/dist/chunk-7WITSO22.js.map +0 -1
- package/dist/chunk-DGUM43GV.js +0 -11
- package/dist/chunk-DGUM43GV.js.map +0 -1
- package/dist/chunk-EFWVF6TI.js +0 -267
- package/dist/chunk-EFWVF6TI.js.map +0 -1
- package/dist/chunk-F6WFNUAY.js +0 -216
- package/dist/chunk-F6WFNUAY.js.map +0 -1
- package/dist/chunk-FQ45QP5A.js +0 -361
- package/dist/chunk-FQ45QP5A.js.map +0 -1
- package/dist/chunk-G2TGF6TR.js +0 -573
- package/dist/chunk-G2TGF6TR.js.map +0 -1
- package/dist/chunk-GTKYBOXL.js +0 -700
- package/dist/chunk-GTKYBOXL.js.map +0 -1
- package/dist/chunk-HVCDY3AK.js +0 -850
- package/dist/chunk-HVCDY3AK.js.map +0 -1
- package/dist/chunk-JVMBCWKS.js +0 -348
- package/dist/chunk-JVMBCWKS.js.map +0 -1
- package/dist/chunk-KDHN2ZQE.js +0 -313
- package/dist/chunk-KDHN2ZQE.js.map +0 -1
- package/dist/chunk-LQIMKE3P.js +0 -12524
- package/dist/chunk-LQIMKE3P.js.map +0 -1
- package/dist/chunk-ME2OERF5.js +0 -345
- package/dist/chunk-ME2OERF5.js.map +0 -1
- package/dist/chunk-MRHKX5M5.js +0 -662
- package/dist/chunk-MRHKX5M5.js.map +0 -1
- package/dist/chunk-OBQ74FOU.js +0 -27
- package/dist/chunk-OBQ74FOU.js.map +0 -1
- package/dist/chunk-OMR4YCBS.js +0 -987
- package/dist/chunk-OMR4YCBS.js.map +0 -1
- package/dist/chunk-Q5EKA5YA.js +0 -254
- package/dist/chunk-Q5EKA5YA.js.map +0 -1
- package/dist/chunk-Q63FFI6D.js +0 -132
- package/dist/chunk-Q63FFI6D.js.map +0 -1
- package/dist/chunk-SY6KQG44.js +0 -983
- package/dist/chunk-SY6KQG44.js.map +0 -1
- package/dist/chunk-T63OHG4Q.js +0 -440
- package/dist/chunk-T63OHG4Q.js.map +0 -1
- package/dist/chunk-TN5WEKWI.js +0 -173
- package/dist/chunk-TN5WEKWI.js.map +0 -1
- package/dist/chunk-VUL52BQL.js +0 -402
- package/dist/chunk-VUL52BQL.js.map +0 -1
- package/dist/chunk-VVITXIHN.js +0 -189
- package/dist/chunk-VVITXIHN.js.map +0 -1
- package/dist/chunk-WCN7S3EI.js +0 -14
- package/dist/chunk-WCN7S3EI.js.map +0 -1
- package/dist/chunk-XE6KQRKZ.js +0 -816
- package/dist/chunk-XE6KQRKZ.js.map +0 -1
- package/dist/chunk-XPZZFPBZ.js +0 -491
- package/dist/chunk-XPZZFPBZ.js.map +0 -1
- package/dist/chunk-XTFWT2XM.js +0 -727
- package/dist/chunk-XTFWT2XM.js.map +0 -1
- package/dist/chunk-YDHUCDHM.js +0 -4011
- package/dist/chunk-YDHUCDHM.js.map +0 -1
- package/dist/chunk-YZ6Y2H3P.js +0 -1289
- package/dist/chunk-YZ6Y2H3P.js.map +0 -1
- package/dist/chunk-ZJF5FTBX.js +0 -1396
- package/dist/chunk-ZJF5FTBX.js.map +0 -1
- package/dist/chunk-ZV2K6M7T.js +0 -74
- package/dist/chunk-ZV2K6M7T.js.map +0 -1
- package/dist/cli/create-agent.d.ts +0 -1
- package/dist/cli/create-agent.js +0 -1050
- package/dist/cli/create-agent.js.map +0 -1
- package/dist/cli/yolo-daemon.d.ts +0 -1
- package/dist/cli/yolo-daemon.js +0 -423
- package/dist/cli/yolo-daemon.js.map +0 -1
- package/dist/client-NJPZE5JT.js +0 -28
- package/dist/client-NJPZE5JT.js.map +0 -1
- package/dist/codebase-index-VAPF32XX.js +0 -12
- package/dist/codebase-index-VAPF32XX.js.map +0 -1
- package/dist/fast-analyzer-XXYMOXRK.js +0 -216
- package/dist/fast-analyzer-XXYMOXRK.js.map +0 -1
- package/dist/git-EO5SRFMN.js +0 -28
- package/dist/git-EO5SRFMN.js.map +0 -1
- package/dist/github-ingester-ZOKK6GRS.js +0 -11
- package/dist/github-ingester-ZOKK6GRS.js.map +0 -1
- package/dist/goal-manager-YOB7VWK7.js +0 -25
- package/dist/goal-manager-YOB7VWK7.js.map +0 -1
- package/dist/goal-validator-ULKIBDPX.js +0 -24
- package/dist/goal-validator-ULKIBDPX.js.map +0 -1
- package/dist/graph-B3NA4S7I.js +0 -10
- package/dist/graph-B3NA4S7I.js.map +0 -1
- package/dist/hypothesis-7BFFT5JY.js +0 -23
- package/dist/hypothesis-7BFFT5JY.js.map +0 -1
- package/dist/incident-index-EFNUSGWL.js +0 -11
- package/dist/incident-index-EFNUSGWL.js.map +0 -1
- package/dist/insight-store-EC4PLSAW.js +0 -22
- package/dist/insight-store-EC4PLSAW.js.map +0 -1
- package/dist/issue-store-ZIRP23EP.js +0 -36
- package/dist/issue-store-ZIRP23EP.js.map +0 -1
- package/dist/ledger-TWZTGDFA.js +0 -58
- package/dist/ledger-TWZTGDFA.js.map +0 -1
- package/dist/linear-ingester-XXPAZZRW.js +0 -11
- package/dist/linear-ingester-XXPAZZRW.js.map +0 -1
- package/dist/output-manager-RVJ37XKA.js +0 -13
- package/dist/output-manager-RVJ37XKA.js.map +0 -1
- package/dist/parse-goal-violation-SACGFG3C.js +0 -8
- package/dist/parse-goal-violation-SACGFG3C.js.map +0 -1
- package/dist/pattern-discovery-F7LU5K6E.js +0 -8
- package/dist/pattern-discovery-F7LU5K6E.js.map +0 -1
- package/dist/progress-SRQ2V3BP.js +0 -18
- package/dist/progress-SRQ2V3BP.js.map +0 -1
- package/dist/project-state-AHPA77SM.js +0 -28
- package/dist/project-state-AHPA77SM.js.map +0 -1
- package/dist/sync-M2FSWPBC.js +0 -12
- package/dist/sync-M2FSWPBC.js.map +0 -1
- package/dist/terminal-spawn-5YXDMUCF.js +0 -157
- package/dist/terminal-spawn-5YXDMUCF.js.map +0 -1
- package/dist/tiered-storage-Z3YCR465.js +0 -12
- package/dist/tiered-storage-Z3YCR465.js.map +0 -1
- package/dist/trie-agent-3YDPEGHJ.js +0 -28
- package/dist/trie-agent-3YDPEGHJ.js.map +0 -1
- package/dist/ui/chat.html +0 -1014
- package/dist/ui/goals.html +0 -967
- package/dist/ui/hypotheses.html +0 -1011
- package/dist/ui/ledger.html +0 -954
- package/dist/ui/nudges.html +0 -995
- package/dist/vibe-code-signatures-F6URTBW3.js +0 -16
- package/dist/vibe-code-signatures-F6URTBW3.js.map +0 -1
- package/dist/vulnerability-signatures-T7SKHORW.js +0 -18
- package/dist/vulnerability-signatures-T7SKHORW.js.map +0 -1
package/dist/chunk-VVITXIHN.js
DELETED
|
@@ -1,189 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
isInteractiveMode
|
|
3
|
-
} from "./chunk-KDHN2ZQE.js";
|
|
4
|
-
|
|
5
|
-
// src/utils/workspace.ts
|
|
6
|
-
import { execSync } from "child_process";
|
|
7
|
-
import { existsSync, readFileSync } from "fs";
|
|
8
|
-
import { basename, dirname, join, resolve } from "path";
|
|
9
|
-
var PROJECT_ROOT_INDICATORS = [
|
|
10
|
-
"package.json",
|
|
11
|
-
// Node.js/npm projects
|
|
12
|
-
".git",
|
|
13
|
-
// Git repository root
|
|
14
|
-
"Cargo.toml",
|
|
15
|
-
// Rust projects
|
|
16
|
-
"go.mod",
|
|
17
|
-
// Go modules
|
|
18
|
-
"pyproject.toml",
|
|
19
|
-
// Python projects (modern)
|
|
20
|
-
"pom.xml",
|
|
21
|
-
// Maven (Java)
|
|
22
|
-
"build.gradle",
|
|
23
|
-
// Gradle (Java/Kotlin)
|
|
24
|
-
"deno.json"
|
|
25
|
-
// Deno projects
|
|
26
|
-
// Note: .trie/config.json would be a better indicator, but empty .trie dirs exist
|
|
27
|
-
// tsconfig.json is secondary as it can exist in subdirectories
|
|
28
|
-
];
|
|
29
|
-
var NPM_PACKAGE_INDICATORS = [
|
|
30
|
-
"node_modules/@",
|
|
31
|
-
// Scoped packages
|
|
32
|
-
"node_modules/",
|
|
33
|
-
// Regular packages
|
|
34
|
-
".npm/",
|
|
35
|
-
// npm cache
|
|
36
|
-
".nvm/",
|
|
37
|
-
// nvm
|
|
38
|
-
"lib/node_modules/"
|
|
39
|
-
// Global npm
|
|
40
|
-
];
|
|
41
|
-
function getGitCommonDir(startDir) {
|
|
42
|
-
try {
|
|
43
|
-
const output = execSync("git rev-parse --git-common-dir", {
|
|
44
|
-
cwd: startDir,
|
|
45
|
-
stdio: ["ignore", "pipe", "ignore"]
|
|
46
|
-
}).toString().trim();
|
|
47
|
-
if (!output) return null;
|
|
48
|
-
return resolve(startDir, output);
|
|
49
|
-
} catch {
|
|
50
|
-
return null;
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
function getSharedWorktreeRoot(startDir) {
|
|
54
|
-
const commonDir = getGitCommonDir(startDir);
|
|
55
|
-
if (!commonDir) return null;
|
|
56
|
-
if (basename(commonDir) !== ".git") return null;
|
|
57
|
-
return dirname(commonDir);
|
|
58
|
-
}
|
|
59
|
-
function getTrieDirectory(workDir) {
|
|
60
|
-
const mode = process.env.TRIE_WORKTREE_MODE?.toLowerCase();
|
|
61
|
-
if (mode === "isolated") {
|
|
62
|
-
return join(workDir, ".trie");
|
|
63
|
-
}
|
|
64
|
-
const sharedRoot = getSharedWorktreeRoot(workDir);
|
|
65
|
-
if (sharedRoot) {
|
|
66
|
-
return join(sharedRoot, ".trie");
|
|
67
|
-
}
|
|
68
|
-
return join(workDir, ".trie");
|
|
69
|
-
}
|
|
70
|
-
function findProjectRoot(startDir, maxLevels = 10) {
|
|
71
|
-
let currentDir = resolve(startDir);
|
|
72
|
-
let levels = 0;
|
|
73
|
-
while (levels < maxLevels) {
|
|
74
|
-
for (const indicator of PROJECT_ROOT_INDICATORS) {
|
|
75
|
-
const indicatorPath = join(currentDir, indicator);
|
|
76
|
-
if (existsSync(indicatorPath)) {
|
|
77
|
-
return currentDir;
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
const parentDir = dirname(currentDir);
|
|
81
|
-
if (parentDir === currentDir) {
|
|
82
|
-
break;
|
|
83
|
-
}
|
|
84
|
-
currentDir = parentDir;
|
|
85
|
-
levels++;
|
|
86
|
-
}
|
|
87
|
-
return null;
|
|
88
|
-
}
|
|
89
|
-
function isInsideNpmPackage(dir) {
|
|
90
|
-
const normalizedPath = dir.replace(/\\/g, "/");
|
|
91
|
-
return NPM_PACKAGE_INDICATORS.some((indicator) => normalizedPath.includes(indicator));
|
|
92
|
-
}
|
|
93
|
-
function getWorkspaceFromEnv() {
|
|
94
|
-
const envVars = [
|
|
95
|
-
"CURSOR_WORKSPACE",
|
|
96
|
-
// Cursor IDE
|
|
97
|
-
"CURSOR_WORKSPACE_ROOT",
|
|
98
|
-
// Alternative Cursor env var
|
|
99
|
-
"VSCODE_WORKSPACE",
|
|
100
|
-
// VS Code
|
|
101
|
-
"VSCODE_CWD",
|
|
102
|
-
// VS Code working directory
|
|
103
|
-
"WORKSPACE_FOLDER",
|
|
104
|
-
// Generic workspace
|
|
105
|
-
"PROJECT_ROOT",
|
|
106
|
-
// Generic project root
|
|
107
|
-
"INIT_CWD",
|
|
108
|
-
// npm's original directory
|
|
109
|
-
"PWD"
|
|
110
|
-
// Original shell directory
|
|
111
|
-
];
|
|
112
|
-
for (const envVar of envVars) {
|
|
113
|
-
const value = process.env[envVar];
|
|
114
|
-
if (value && existsSync(value)) {
|
|
115
|
-
const hasProjectIndicator = PROJECT_ROOT_INDICATORS.some(
|
|
116
|
-
(indicator) => existsSync(join(value, indicator))
|
|
117
|
-
);
|
|
118
|
-
if (hasProjectIndicator) {
|
|
119
|
-
return value;
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
return null;
|
|
124
|
-
}
|
|
125
|
-
function getWorkingDirectory(explicitDir, silent = false) {
|
|
126
|
-
if (explicitDir) {
|
|
127
|
-
return resolve(explicitDir);
|
|
128
|
-
}
|
|
129
|
-
const shouldLog = !silent && !isInteractiveMode();
|
|
130
|
-
if (shouldLog && process.env.DEBUG_TRIE_WORKSPACE) {
|
|
131
|
-
console.error("Debug: Environment variables:");
|
|
132
|
-
console.error(` CURSOR_WORKSPACE: ${process.env.CURSOR_WORKSPACE || "not set"}`);
|
|
133
|
-
console.error(` CURSOR_WORKSPACE_ROOT: ${process.env.CURSOR_WORKSPACE_ROOT || "not set"}`);
|
|
134
|
-
console.error(` VSCODE_CWD: ${process.env.VSCODE_CWD || "not set"}`);
|
|
135
|
-
console.error(` INIT_CWD: ${process.env.INIT_CWD || "not set"}`);
|
|
136
|
-
console.error(` PWD: ${process.env.PWD || "not set"}`);
|
|
137
|
-
console.error(` process.cwd(): ${process.cwd()}`);
|
|
138
|
-
}
|
|
139
|
-
const envWorkspace = getWorkspaceFromEnv();
|
|
140
|
-
if (envWorkspace) {
|
|
141
|
-
if (shouldLog) {
|
|
142
|
-
console.error(`Using workspace from environment: ${envWorkspace}`);
|
|
143
|
-
}
|
|
144
|
-
return envWorkspace;
|
|
145
|
-
}
|
|
146
|
-
const cwd = process.cwd();
|
|
147
|
-
if (isInsideNpmPackage(cwd)) {
|
|
148
|
-
if (shouldLog) {
|
|
149
|
-
console.error("Warning: MCP server running from npm package directory.");
|
|
150
|
-
console.error(' Please pass the "directory" parameter with your project path.');
|
|
151
|
-
console.error(` Current directory: ${cwd}`);
|
|
152
|
-
}
|
|
153
|
-
return cwd;
|
|
154
|
-
}
|
|
155
|
-
const projectRoot = findProjectRoot(cwd);
|
|
156
|
-
if (projectRoot) {
|
|
157
|
-
const packageJsonPath = join(projectRoot, "package.json");
|
|
158
|
-
if (existsSync(packageJsonPath)) {
|
|
159
|
-
try {
|
|
160
|
-
const pkg = JSON.parse(readFileSync(packageJsonPath, "utf-8"));
|
|
161
|
-
if (pkg.name === "@triedotdev/mcp" || pkg.name === "trie-mcp-agent") {
|
|
162
|
-
if (shouldLog) {
|
|
163
|
-
console.error("Warning: Detected Trie package directory, not user workspace.");
|
|
164
|
-
console.error(' Please pass the "directory" parameter with your project path.');
|
|
165
|
-
}
|
|
166
|
-
return cwd;
|
|
167
|
-
}
|
|
168
|
-
} catch {
|
|
169
|
-
}
|
|
170
|
-
}
|
|
171
|
-
return projectRoot;
|
|
172
|
-
}
|
|
173
|
-
if (shouldLog) {
|
|
174
|
-
console.error("Warning: Could not detect project root. Operating from:", cwd);
|
|
175
|
-
console.error(" Tip: Pass directory parameter or run from a directory with package.json/.git");
|
|
176
|
-
console.error(" Or set DEBUG_TRIE_WORKSPACE=1 to debug workspace detection");
|
|
177
|
-
console.error(` Current working directory: ${cwd}`);
|
|
178
|
-
console.error(" Examples:");
|
|
179
|
-
console.error(' Use trie_fix with directory: "/path/to/your/project"');
|
|
180
|
-
console.error(' Use trie watch with directory: "./your-project"');
|
|
181
|
-
}
|
|
182
|
-
return cwd;
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
export {
|
|
186
|
-
getTrieDirectory,
|
|
187
|
-
getWorkingDirectory
|
|
188
|
-
};
|
|
189
|
-
//# sourceMappingURL=chunk-VVITXIHN.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/utils/workspace.ts"],"sourcesContent":["/**\n * Workspace detection utilities\n * \n * MCP servers run as separate processes where process.cwd() may not be\n * the user's workspace. These utilities detect the actual project root\n * by looking for common project indicators.\n */\n\nimport { execSync } from 'node:child_process';\nimport { existsSync, readFileSync } from 'fs';\nimport { basename, dirname, join, resolve } from 'path';\nimport { isInteractiveMode } from './progress.js';\n\n// Project root indicators - files/directories that indicate a project root\n// Ordered by strength: primary indicators first\nconst PROJECT_ROOT_INDICATORS = [\n 'package.json', // Node.js/npm projects\n '.git', // Git repository root\n 'Cargo.toml', // Rust projects\n 'go.mod', // Go modules\n 'pyproject.toml', // Python projects (modern)\n 'pom.xml', // Maven (Java)\n 'build.gradle', // Gradle (Java/Kotlin)\n 'deno.json', // Deno projects\n // Note: .trie/config.json would be a better indicator, but empty .trie dirs exist\n // tsconfig.json is secondary as it can exist in subdirectories\n];\n\n// Directories that indicate we're in an npm package, not a user workspace\nconst NPM_PACKAGE_INDICATORS = [\n 'node_modules/@', // Scoped packages\n 'node_modules/', // Regular packages\n '.npm/', // npm cache\n '.nvm/', // nvm\n 'lib/node_modules/', // Global npm\n];\n\nfunction getGitCommonDir(startDir: string): string | null {\n try {\n const output = execSync('git rev-parse --git-common-dir', {\n cwd: startDir,\n stdio: ['ignore', 'pipe', 'ignore'],\n })\n .toString()\n .trim();\n if (!output) return null;\n return resolve(startDir, output);\n } catch {\n return null;\n }\n}\n\nfunction getSharedWorktreeRoot(startDir: string): string | null {\n const commonDir = getGitCommonDir(startDir);\n if (!commonDir) return null;\n if (basename(commonDir) !== '.git') return null;\n return dirname(commonDir);\n}\n\nexport function getTrieDirectory(workDir: string): string {\n const mode = process.env.TRIE_WORKTREE_MODE?.toLowerCase();\n if (mode === 'isolated') {\n return join(workDir, '.trie');\n }\n const sharedRoot = getSharedWorktreeRoot(workDir);\n if (sharedRoot) {\n return join(sharedRoot, '.trie');\n }\n return join(workDir, '.trie');\n}\n\n/**\n * Find the nearest project root by walking up from a starting directory\n * Returns the directory containing a project root indicator, or null if none found\n */\nexport function findProjectRoot(startDir: string, maxLevels: number = 10): string | null {\n let currentDir = resolve(startDir);\n let levels = 0;\n \n while (levels < maxLevels) {\n // Check if any project root indicator exists in this directory\n for (const indicator of PROJECT_ROOT_INDICATORS) {\n const indicatorPath = join(currentDir, indicator);\n if (existsSync(indicatorPath)) {\n return currentDir;\n }\n }\n \n // Move up one directory\n const parentDir = dirname(currentDir);\n if (parentDir === currentDir) {\n // Reached filesystem root\n break;\n }\n currentDir = parentDir;\n levels++;\n }\n \n return null;\n}\n\n/**\n * Check if a path looks like it's inside an npm package installation\n */\nfunction isInsideNpmPackage(dir: string): boolean {\n const normalizedPath = dir.replace(/\\\\/g, '/');\n return NPM_PACKAGE_INDICATORS.some(indicator => normalizedPath.includes(indicator));\n}\n\n/**\n * Try to get workspace from environment variables\n * Various tools set these when invoking MCP servers\n */\nfunction getWorkspaceFromEnv(): string | null {\n // Common environment variables that might contain workspace path\n const envVars = [\n 'CURSOR_WORKSPACE', // Cursor IDE\n 'CURSOR_WORKSPACE_ROOT', // Alternative Cursor env var\n 'VSCODE_WORKSPACE', // VS Code\n 'VSCODE_CWD', // VS Code working directory\n 'WORKSPACE_FOLDER', // Generic workspace\n 'PROJECT_ROOT', // Generic project root\n 'INIT_CWD', // npm's original directory\n 'PWD', // Original shell directory\n ];\n \n for (const envVar of envVars) {\n const value = process.env[envVar];\n if (value && existsSync(value)) {\n // Verify it looks like a project\n const hasProjectIndicator = PROJECT_ROOT_INDICATORS.some(\n indicator => existsSync(join(value, indicator))\n );\n if (hasProjectIndicator) {\n return value;\n }\n }\n }\n \n return null;\n}\n\n/**\n * Get the best working directory for scanning/operations\n * Priority: \n * 1. Explicit directory arg\n * 2. Environment variable (CURSOR_WORKSPACE, etc.)\n * 3. Detected project root from cwd (if not inside npm package)\n * 4. process.cwd() with warning\n * \n * @param explicitDir - Optional explicit directory from user\n * @param silent - If true, don't log warnings when falling back to cwd\n */\nexport function getWorkingDirectory(explicitDir?: string, silent: boolean = false): string {\n // If explicitly provided, use it\n if (explicitDir) {\n return resolve(explicitDir);\n }\n\n // Suppress all logs in interactive mode (TUI handles its own display)\n const shouldLog = !silent && !isInteractiveMode();\n\n // Debug: Log all relevant environment variables\n if (shouldLog && process.env.DEBUG_TRIE_WORKSPACE) {\n console.error('Debug: Environment variables:');\n console.error(` CURSOR_WORKSPACE: ${process.env.CURSOR_WORKSPACE || 'not set'}`);\n console.error(` CURSOR_WORKSPACE_ROOT: ${process.env.CURSOR_WORKSPACE_ROOT || 'not set'}`);\n console.error(` VSCODE_CWD: ${process.env.VSCODE_CWD || 'not set'}`);\n console.error(` INIT_CWD: ${process.env.INIT_CWD || 'not set'}`);\n console.error(` PWD: ${process.env.PWD || 'not set'}`);\n console.error(` process.cwd(): ${process.cwd()}`);\n }\n\n // Try environment variables first\n const envWorkspace = getWorkspaceFromEnv();\n if (envWorkspace) {\n if (shouldLog) {\n console.error(`Using workspace from environment: ${envWorkspace}`);\n }\n return envWorkspace;\n }\n \n // Try to find a project root from cwd\n const cwd = process.cwd();\n \n // Check if we're running from inside an npm package (common for MCP servers)\n if (isInsideNpmPackage(cwd)) {\n if (shouldLog) {\n console.error('Warning: MCP server running from npm package directory.');\n console.error(' Please pass the \"directory\" parameter with your project path.');\n console.error(` Current directory: ${cwd}`);\n }\n // Still return cwd, but we've warned\n return cwd;\n }\n \n const projectRoot = findProjectRoot(cwd);\n \n if (projectRoot) {\n // Extra check: make sure we're not returning the Trie package itself\n const packageJsonPath = join(projectRoot, 'package.json');\n if (existsSync(packageJsonPath)) {\n try {\n const pkg = JSON.parse(readFileSync(packageJsonPath, 'utf-8'));\n if (pkg.name === '@triedotdev/mcp' || pkg.name === 'trie-mcp-agent') {\n if (shouldLog) {\n console.error('Warning: Detected Trie package directory, not user workspace.');\n console.error(' Please pass the \"directory\" parameter with your project path.');\n }\n return cwd;\n }\n } catch {\n // Ignore parse errors\n }\n }\n return projectRoot;\n }\n \n // Fallback to cwd, but warn\n if (shouldLog) {\n console.error('Warning: Could not detect project root. Operating from:', cwd);\n console.error(' Tip: Pass directory parameter or run from a directory with package.json/.git');\n console.error(' Or set DEBUG_TRIE_WORKSPACE=1 to debug workspace detection');\n console.error(` Current working directory: ${cwd}`);\n\n // Show how to properly call with directory\n console.error(' Examples:');\n console.error(' Use trie_fix with directory: \"/path/to/your/project\"');\n console.error(' Use trie watch with directory: \"./your-project\"');\n }\n\n return cwd;\n}\n"],"mappings":";;;;;AAQA,SAAS,gBAAgB;AACzB,SAAS,YAAY,oBAAoB;AACzC,SAAS,UAAU,SAAS,MAAM,eAAe;AAKjD,IAAM,0BAA0B;AAAA,EAC9B;AAAA;AAAA,EACA;AAAA;AAAA,EACA;AAAA;AAAA,EACA;AAAA;AAAA,EACA;AAAA;AAAA,EACA;AAAA;AAAA,EACA;AAAA;AAAA,EACA;AAAA;AAAA;AAAA;AAGF;AAGA,IAAM,yBAAyB;AAAA,EAC7B;AAAA;AAAA,EACA;AAAA;AAAA,EACA;AAAA;AAAA,EACA;AAAA;AAAA,EACA;AAAA;AACF;AAEA,SAAS,gBAAgB,UAAiC;AACxD,MAAI;AACF,UAAM,SAAS,SAAS,kCAAkC;AAAA,MACxD,KAAK;AAAA,MACL,OAAO,CAAC,UAAU,QAAQ,QAAQ;AAAA,IACpC,CAAC,EACE,SAAS,EACT,KAAK;AACR,QAAI,CAAC,OAAQ,QAAO;AACpB,WAAO,QAAQ,UAAU,MAAM;AAAA,EACjC,QAAQ;AACN,W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/B,UAAI;AACF,cAAM,MAAM,KAAK,MAAM,aAAa,iBAAiB,OAAO,CAAC;AAC7D,YAAI,IAAI,SAAS,qBAAqB,IAAI,SAAS,kBAAkB;AACnE,cAAI,WAAW;AACb,oBAAQ,MAAM,+DAA+D;AAC7E,oBAAQ,MAAM,kEAAkE;AAAA,UAClF;AACA,iBAAO;AAAA,QACT;AAAA,MACF,QAAQ;AAAA,MAER;AAAA,IACF;AACA,WAAO;AAAA,EACT;AAGA,MAAI,WAAW;AACb,YAAQ,MAAM,2DAA2D,GAAG;AAC5E,YAAQ,MAAM,iFAAiF;AAC/F,YAAQ,MAAM,+DAA+D;AAC7E,YAAQ,MAAM,iCAAiC,GAAG,EAAE;AAGpD,YAAQ,MAAM,cAAc;AAC5B,YAAQ,MAAM,2DAA2D;AACzE,YAAQ,MAAM,sDAAsD;AAAA,EACtE;AAEA,SAAO;AACT;","names":[]}
|
package/dist/chunk-WCN7S3EI.js
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
// src/cli/dashboard/parse-goal-violation.ts
|
|
2
|
-
function parseGoalViolation(message) {
|
|
3
|
-
const match = message.match(/Goal "([^"]+)" violated in ([^:]+): (.+)/);
|
|
4
|
-
if (!match) return null;
|
|
5
|
-
const [, goal, file, violation] = match;
|
|
6
|
-
if (!goal || !file || !violation) return null;
|
|
7
|
-
const cleanViolation = violation.replace(/\s*\[\d+%\s*confidence\]\s*$/i, "").trim();
|
|
8
|
-
return { file: file.trim(), goal: goal.trim(), violation: cleanViolation };
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
export {
|
|
12
|
-
parseGoalViolation
|
|
13
|
-
};
|
|
14
|
-
//# sourceMappingURL=chunk-WCN7S3EI.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/cli/dashboard/parse-goal-violation.ts"],"sourcesContent":["/**\n * Parse goal violation from nudge message format:\n * Goal \"X\" violated in FILE: VIOLATION [X% confidence]\n */\nexport function parseGoalViolation(message: string): { file: string; goal: string; violation: string } | null {\n const match = message.match(/Goal \"([^\"]+)\" violated in ([^:]+): (.+)/);\n if (!match) return null;\n const [, goal, file, violation] = match;\n if (!goal || !file || !violation) return null;\n // Strip trailing [X% confidence] from violation if present\n const cleanViolation = violation.replace(/\\s*\\[\\d+%\\s*confidence\\]\\s*$/i, '').trim();\n return { file: file.trim(), goal: goal.trim(), violation: cleanViolation };\n}\n"],"mappings":";AAIO,SAAS,mBAAmB,SAA2E;AAC5G,QAAM,QAAQ,QAAQ,MAAM,0CAA0C;AACtE,MAAI,CAAC,MAAO,QAAO;AACnB,QAAM,CAAC,EAAE,MAAM,MAAM,SAAS,IAAI;AAClC,MAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,UAAW,QAAO;AAEzC,QAAM,iBAAiB,UAAU,QAAQ,iCAAiC,EAAE,EAAE,KAAK;AACnF,SAAO,EAAE,MAAM,KAAK,KAAK,GAAG,MAAM,KAAK,KAAK,GAAG,WAAW,eAAe;AAC3E;","names":[]}
|