@triedotdev/mcp 1.0.21 → 1.0.23

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.
@@ -0,0 +1,157 @@
1
+ import {
2
+ __require
3
+ } from "./chunk-DGUM43GV.js";
4
+
5
+ // src/utils/workspace.ts
6
+ import { existsSync } from "fs";
7
+ import { dirname, join, resolve } from "path";
8
+ var PROJECT_ROOT_INDICATORS = [
9
+ "package.json",
10
+ // Node.js/npm projects
11
+ ".git",
12
+ // Git repository root
13
+ "Cargo.toml",
14
+ // Rust projects
15
+ "go.mod",
16
+ // Go modules
17
+ "pyproject.toml",
18
+ // Python projects (modern)
19
+ "pom.xml",
20
+ // Maven (Java)
21
+ "build.gradle",
22
+ // Gradle (Java/Kotlin)
23
+ "deno.json"
24
+ // Deno projects
25
+ // Note: .trie/config.json would be a better indicator, but empty .trie dirs exist
26
+ // tsconfig.json is secondary as it can exist in subdirectories
27
+ ];
28
+ var NPM_PACKAGE_INDICATORS = [
29
+ "node_modules/@",
30
+ // Scoped packages
31
+ "node_modules/",
32
+ // Regular packages
33
+ ".npm/",
34
+ // npm cache
35
+ ".nvm/",
36
+ // nvm
37
+ "lib/node_modules/"
38
+ // Global npm
39
+ ];
40
+ function findProjectRoot(startDir, maxLevels = 10) {
41
+ let currentDir = resolve(startDir);
42
+ let levels = 0;
43
+ while (levels < maxLevels) {
44
+ for (const indicator of PROJECT_ROOT_INDICATORS) {
45
+ const indicatorPath = join(currentDir, indicator);
46
+ if (existsSync(indicatorPath)) {
47
+ return currentDir;
48
+ }
49
+ }
50
+ const parentDir = dirname(currentDir);
51
+ if (parentDir === currentDir) {
52
+ break;
53
+ }
54
+ currentDir = parentDir;
55
+ levels++;
56
+ }
57
+ return null;
58
+ }
59
+ function isInsideNpmPackage(dir) {
60
+ const normalizedPath = dir.replace(/\\/g, "/");
61
+ return NPM_PACKAGE_INDICATORS.some((indicator) => normalizedPath.includes(indicator));
62
+ }
63
+ function getWorkspaceFromEnv() {
64
+ const envVars = [
65
+ "CURSOR_WORKSPACE",
66
+ // Cursor IDE
67
+ "CURSOR_WORKSPACE_ROOT",
68
+ // Alternative Cursor env var
69
+ "VSCODE_WORKSPACE",
70
+ // VS Code
71
+ "VSCODE_CWD",
72
+ // VS Code working directory
73
+ "WORKSPACE_FOLDER",
74
+ // Generic workspace
75
+ "PROJECT_ROOT",
76
+ // Generic project root
77
+ "INIT_CWD",
78
+ // npm's original directory
79
+ "PWD"
80
+ // Original shell directory
81
+ ];
82
+ for (const envVar of envVars) {
83
+ const value = process.env[envVar];
84
+ if (value && existsSync(value)) {
85
+ const hasProjectIndicator = PROJECT_ROOT_INDICATORS.some(
86
+ (indicator) => existsSync(join(value, indicator))
87
+ );
88
+ if (hasProjectIndicator) {
89
+ return value;
90
+ }
91
+ }
92
+ }
93
+ return null;
94
+ }
95
+ function getWorkingDirectory(explicitDir, silent = false) {
96
+ if (explicitDir) {
97
+ return resolve(explicitDir);
98
+ }
99
+ if (!silent && process.env.DEBUG_TRIE_WORKSPACE) {
100
+ console.error("\u{1F50D} Debug: Environment variables:");
101
+ console.error(` CURSOR_WORKSPACE: ${process.env.CURSOR_WORKSPACE || "not set"}`);
102
+ console.error(` CURSOR_WORKSPACE_ROOT: ${process.env.CURSOR_WORKSPACE_ROOT || "not set"}`);
103
+ console.error(` VSCODE_CWD: ${process.env.VSCODE_CWD || "not set"}`);
104
+ console.error(` INIT_CWD: ${process.env.INIT_CWD || "not set"}`);
105
+ console.error(` PWD: ${process.env.PWD || "not set"}`);
106
+ console.error(` process.cwd(): ${process.cwd()}`);
107
+ }
108
+ const envWorkspace = getWorkspaceFromEnv();
109
+ if (envWorkspace) {
110
+ if (!silent) {
111
+ console.error(`\u{1F4C2} Using workspace from environment: ${envWorkspace}`);
112
+ }
113
+ return envWorkspace;
114
+ }
115
+ const cwd = process.cwd();
116
+ if (isInsideNpmPackage(cwd)) {
117
+ if (!silent) {
118
+ console.error("\u26A0\uFE0F Warning: MCP server running from npm package directory.");
119
+ console.error(' Please pass the "directory" parameter with your project path.');
120
+ console.error(` Current directory: ${cwd}`);
121
+ }
122
+ return cwd;
123
+ }
124
+ const projectRoot = findProjectRoot(cwd);
125
+ if (projectRoot) {
126
+ const packageJsonPath = join(projectRoot, "package.json");
127
+ if (existsSync(packageJsonPath)) {
128
+ try {
129
+ const pkg = JSON.parse(__require("fs").readFileSync(packageJsonPath, "utf-8"));
130
+ if (pkg.name === "@triedotdev/mcp" || pkg.name === "trie-mcp-agent") {
131
+ if (!silent) {
132
+ console.error("\u26A0\uFE0F Warning: Detected Trie package directory, not user workspace.");
133
+ console.error(' Please pass the "directory" parameter with your project path.');
134
+ }
135
+ return cwd;
136
+ }
137
+ } catch {
138
+ }
139
+ }
140
+ return projectRoot;
141
+ }
142
+ if (!silent) {
143
+ console.error("\u26A0\uFE0F Warning: Could not detect project root. Operating from:", cwd);
144
+ console.error(" Tip: Pass directory parameter or run from a directory with package.json/.git");
145
+ console.error(" Or set DEBUG_TRIE_WORKSPACE=1 to debug workspace detection");
146
+ console.error(` Current working directory: ${cwd}`);
147
+ console.error(" Examples:");
148
+ console.error(' Use trie_security with directory: "/path/to/your/project"');
149
+ console.error(' Use trie_scan with directory: "./your-project"');
150
+ }
151
+ return cwd;
152
+ }
153
+
154
+ export {
155
+ getWorkingDirectory
156
+ };
157
+ //# sourceMappingURL=chunk-IMFD4SJC.js.map
@@ -0,0 +1 @@
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 { existsSync, readFileSync } from 'fs';\nimport { dirname, join, resolve } from 'path';\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\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 // Debug: Log all relevant environment variables\n if (!silent && 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 (!silent) {\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 (!silent) {\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(require('fs').readFileSync(packageJsonPath, 'utf-8'));\n if (pkg.name === '@triedotdev/mcp' || pkg.name === 'trie-mcp-agent') {\n if (!silent) {\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 (!silent) {\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_security with directory: \"/path/to/your/project\"');\n console.error(' Use trie_scan with directory: \"./your-project\"');\n }\n\n return cwd;\n}\n"],"mappings":";;;;;AAQA,SAAS,kBAAgC;AACzC,SAAS,SAAS,MAAM,eAAe;AAIvC,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;AAMO,SAAS,gBAAgB,UAAkB,YAAoB,IAAmB;AACvF,MAAI,aAAa,QAAQ,QAAQ;AACjC,MAAI,SAAS;AAEb,SAAO,SAAS,WAAW;AAEzB,eAAW,aAAa,yBAAyB;AAC/C,YAAM,gBAAgB,KAAK,YAAY,SAAS;AAChD,UAAI,WAAW,aAAa,GAAG;AAC7B,eAAO;AAAA,MACT;AAAA,IACF;AAGA,UAAM,YAAY,QAAQ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3CS6Z2SL.js";
9
+ import {
10
+ AgentSmithAgent,
11
+ BaseAgent,
12
+ ProgressReporter
13
+ } from "./chunk-HGINYWNW.js";
6
14
  import {
7
15
  getVulnerabilityStats,
8
16
  getVulnerabilityTrie,
@@ -11,11 +19,6 @@ import {
11
19
  import {
12
20
  Trie
13
21
  } from "./chunk-6NLHFIYA.js";
14
- import {
15
- AgentSmithAgent,
16
- BaseAgent,
17
- ProgressReporter
18
- } from "./chunk-3AUDJWEF.js";
19
22
 
20
23
  // src/agents/security.ts
21
24
  var ALWAYS_SKIP_FILES = [
@@ -4780,7 +4783,7 @@ var AgentRegistryImpl = class {
4780
4783
  async loadCustomAgents() {
4781
4784
  if (this.customAgentsLoaded) return;
4782
4785
  try {
4783
- const agentsDir = join(process.cwd(), ".trie", "agents");
4786
+ const agentsDir = join(getWorkingDirectory(void 0, true), ".trie", "agents");
4784
4787
  const files = await readdir(agentsDir);
4785
4788
  const jsonFiles = files.filter((f) => f.endsWith(".json"));
4786
4789
  let loadedCount = 0;
@@ -8090,18 +8093,18 @@ var TrieScanTool = class {
8090
8093
  const startTime = Date.now();
8091
8094
  try {
8092
8095
  let { files, context: userContext, forceAgents, directory } = args;
8096
+ const workDir = getWorkingDirectory(directory);
8093
8097
  this.progress.startPhase("init", "\u{1F53A} TRIE AGENT - AI-Powered Code Analysis");
8094
8098
  if (!files || !Array.isArray(files) || files.length === 0) {
8095
- const scanDir2 = directory || process.cwd();
8096
- this.progress.startPhase("discovery", `Discovering files in ${basename7(scanDir2)}...`);
8097
- files = await this.discoverFiles(scanDir2);
8099
+ this.progress.startPhase("discovery", `Discovering files in ${basename7(workDir)}...`);
8100
+ files = await this.discoverFiles(workDir);
8098
8101
  this.progress.completePhase(`Found ${files.length} files`);
8099
8102
  }
8100
8103
  const resolvedFiles = files.map((f) => {
8101
8104
  if (isAbsolute(f)) {
8102
8105
  return f;
8103
8106
  }
8104
- return resolve(process.cwd(), f);
8107
+ return resolve(workDir, f);
8105
8108
  });
8106
8109
  const validFiles = resolvedFiles.filter((f) => {
8107
8110
  if (!existsSync4(f)) {
@@ -8113,9 +8116,8 @@ var TrieScanTool = class {
8113
8116
  if (validFiles.length === 0) {
8114
8117
  throw new Error("No valid files found to scan. Specify files or run from project root.");
8115
8118
  }
8116
- const scanDir = directory || process.cwd();
8117
8119
  if (!this.incrementalScanner) {
8118
- this.incrementalScanner = new IncrementalScanner(scanDir);
8120
+ this.incrementalScanner = new IncrementalScanner(workDir);
8119
8121
  await this.incrementalScanner.loadCache();
8120
8122
  }
8121
8123
  this.progress.startPhase("reading", `Scanning ${validFiles.length} files...`);
@@ -8154,7 +8156,7 @@ var TrieScanTool = class {
8154
8156
  const agentResults = await this.executor.executeAgents(
8155
8157
  selectedAgents,
8156
8158
  validFiles,
8157
- { workingDir: process.cwd() }
8159
+ { workingDir: workDir }
8158
8160
  );
8159
8161
  const allIssues = agentResults.flatMap((result2) => result2.issues);
8160
8162
  this.progress.startPhase("prioritizing", "Prioritizing findings...");
@@ -9611,7 +9613,8 @@ ${"\u2501".repeat(60)}
9611
9613
  return { content: [{ type: "text", text: output }] };
9612
9614
  }
9613
9615
  async applyFix(file, line, issue, fix, dryRun) {
9614
- const filePath = isAbsolute2(file) ? file : resolve2(process.cwd(), file);
9616
+ const workDir = getWorkingDirectory(void 0, true);
9617
+ const filePath = isAbsolute2(file) ? file : resolve2(workDir, file);
9615
9618
  if (!existsSync5(filePath)) {
9616
9619
  return {
9617
9620
  content: [{
@@ -9631,7 +9634,7 @@ ${"\u2501".repeat(60)}
9631
9634
  fix,
9632
9635
  language,
9633
9636
  code: contextLines.join("\n"),
9634
- filePath: relative4(process.cwd(), filePath),
9637
+ filePath: relative4(workDir, filePath),
9635
9638
  line: String(line)
9636
9639
  });
9637
9640
  const systemPrompt = getSystemPrompt("fix");
@@ -9646,7 +9649,7 @@ ${"\u2501".repeat(60)}
9646
9649
  output += `## \u{1F4CD} Target
9647
9650
 
9648
9651
  `;
9649
- output += `- **File:** \`${relative4(process.cwd(), filePath)}\`
9652
+ output += `- **File:** \`${relative4(workDir, filePath)}\`
9650
9653
  `;
9651
9654
  output += `- **Line:** ${line}
9652
9655
  `;
@@ -9702,7 +9705,8 @@ ${"\u2500".repeat(60)}
9702
9705
  return { content: [{ type: "text", text: output }] };
9703
9706
  }
9704
9707
  async generateFixPrompt(file, line, issue) {
9705
- const filePath = isAbsolute2(file) ? file : resolve2(process.cwd(), file);
9708
+ const workDir = getWorkingDirectory(void 0, true);
9709
+ const filePath = isAbsolute2(file) ? file : resolve2(workDir, file);
9706
9710
  if (!existsSync5(filePath)) {
9707
9711
  return {
9708
9712
  content: [{
@@ -9728,7 +9732,7 @@ ${"\u2501".repeat(60)}
9728
9732
  output += `## \u{1F4CD} Issue Details
9729
9733
 
9730
9734
  `;
9731
- output += `- **File:** \`${relative4(process.cwd(), filePath)}\`
9735
+ output += `- **File:** \`${relative4(workDir, filePath)}\`
9732
9736
  `;
9733
9737
  output += `- **Line:** ${line}
9734
9738
  `;
@@ -9881,4 +9885,4 @@ export {
9881
9885
  getSystemPrompt,
9882
9886
  TrieFixTool
9883
9887
  };
9884
- //# sourceMappingURL=chunk-52RPXHT6.js.map
9888
+ //# sourceMappingURL=chunk-JJATCZV5.js.map