@triedotdev/mcp 1.0.40 → 1.0.42

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.
@@ -1,229 +0,0 @@
1
- import {
2
- getWorkingDirectory
3
- } from "./chunk-IMFD4SJC.js";
4
-
5
- // src/utils/project-info.ts
6
- import { readFile, writeFile, mkdir } from "fs/promises";
7
- import { existsSync } from "fs";
8
- import { join } from "path";
9
- var PROJECT_MD_PATH = ".trie/PROJECT.md";
10
- function getProjectTemplate() {
11
- return `# Project Information
12
-
13
- > This file stores important project context for AI assistants.
14
- > Edit freely - this file is yours, not auto-generated.
15
- > Available via MCP resource: \`trie://project\`
16
-
17
- ---
18
-
19
- ## Project Overview
20
-
21
- <!-- Describe your project's purpose and goals -->
22
-
23
- [Add project description here]
24
-
25
- ---
26
-
27
- ## Technology Stack
28
-
29
- <!-- List frameworks, languages, databases, cloud services, etc. -->
30
-
31
- - **Language:**
32
- - **Framework:**
33
- - **Database:**
34
- - **Hosting:**
35
-
36
- ---
37
-
38
- ## Architecture
39
-
40
- <!-- Key patterns, architectural decisions, and system design -->
41
-
42
- [Describe your architecture here]
43
-
44
- ---
45
-
46
- ## Coding Conventions
47
-
48
- <!-- Style guidelines, naming conventions, patterns to follow -->
49
-
50
- -
51
- -
52
- -
53
-
54
- ---
55
-
56
- ## Environment
57
-
58
- <!-- URLs, API endpoints, deployment info -->
59
-
60
- | Environment | URL | Notes |
61
- |-------------|-----|-------|
62
- | Development | | |
63
- | Staging | | |
64
- | Production | | |
65
-
66
- ---
67
-
68
- ## Team
69
-
70
- <!-- Ownership, contacts, responsibilities -->
71
-
72
- - **Owner:**
73
- - **Team:**
74
-
75
- ---
76
-
77
- ## Compliance
78
-
79
- <!-- HIPAA, SOC2, GDPR, PCI-DSS requirements if applicable -->
80
-
81
- - [ ] GDPR
82
- - [ ] SOC2
83
- - [ ] HIPAA
84
- - [ ] PCI-DSS
85
-
86
- ---
87
-
88
- ## AI Instructions
89
-
90
- <!-- Special instructions for AI assistants working on this project -->
91
-
92
- When working on this project, AI assistants should:
93
-
94
- 1.
95
- 2.
96
- 3.
97
-
98
- ---
99
-
100
- *This file is read by Trie agents and exposed via \`trie://project\` MCP resource.*
101
- *Edit this file to provide context to Claude Code, Cursor, GitHub Actions, and other AI tools.*
102
- `;
103
- }
104
- function projectInfoExists(workDir) {
105
- const dir = workDir || getWorkingDirectory(void 0, true);
106
- const projectPath = join(dir, PROJECT_MD_PATH);
107
- return existsSync(projectPath);
108
- }
109
- async function loadProjectInfo(workDir) {
110
- const dir = workDir || getWorkingDirectory(void 0, true);
111
- const projectPath = join(dir, PROJECT_MD_PATH);
112
- try {
113
- if (!existsSync(projectPath)) {
114
- return null;
115
- }
116
- return await readFile(projectPath, "utf-8");
117
- } catch {
118
- return null;
119
- }
120
- }
121
- async function saveProjectInfo(content, workDir) {
122
- const dir = workDir || getWorkingDirectory(void 0, true);
123
- const trieDir = join(dir, ".trie");
124
- const projectPath = join(dir, PROJECT_MD_PATH);
125
- await mkdir(trieDir, { recursive: true });
126
- await writeFile(projectPath, content, "utf-8");
127
- }
128
- async function initProjectInfo(workDir) {
129
- const dir = workDir || getWorkingDirectory(void 0, true);
130
- const projectPath = join(dir, PROJECT_MD_PATH);
131
- if (existsSync(projectPath)) {
132
- return { created: false, path: projectPath };
133
- }
134
- await saveProjectInfo(getProjectTemplate(), dir);
135
- return { created: true, path: projectPath };
136
- }
137
- async function getProjectSection(sectionName, workDir) {
138
- const content = await loadProjectInfo(workDir);
139
- if (!content) return null;
140
- const sectionRegex = new RegExp(
141
- `## ${escapeRegex(sectionName)}\\s*\\n([\\s\\S]*?)(?=\\n## |\\n---\\s*$|$)`,
142
- "i"
143
- );
144
- const match = content.match(sectionRegex);
145
- if (match) {
146
- return match[1].trim();
147
- }
148
- return null;
149
- }
150
- async function updateProjectSection(sectionName, newContent, workDir) {
151
- let content = await loadProjectInfo(workDir);
152
- if (!content) {
153
- await initProjectInfo(workDir);
154
- content = await loadProjectInfo(workDir);
155
- if (!content) return false;
156
- }
157
- const sectionRegex = new RegExp(
158
- `(## ${escapeRegex(sectionName)}\\s*\\n)([\\s\\S]*?)((?=\\n## )|(?=\\n---\\s*$)|$)`,
159
- "i"
160
- );
161
- if (content.match(sectionRegex)) {
162
- const updatedContent = content.replace(sectionRegex, `$1
163
- ${newContent}
164
-
165
- $3`);
166
- await saveProjectInfo(updatedContent, workDir);
167
- return true;
168
- }
169
- return false;
170
- }
171
- async function appendToSection(sectionName, contentToAdd, workDir) {
172
- const currentContent = await getProjectSection(sectionName, workDir);
173
- if (currentContent === null) return false;
174
- const newContent = currentContent + "\n" + contentToAdd;
175
- return updateProjectSection(sectionName, newContent, workDir);
176
- }
177
- async function getProjectSections(workDir) {
178
- const content = await loadProjectInfo(workDir);
179
- if (!content) return [];
180
- const sectionRegex = /^## (.+)$/gm;
181
- const sections = [];
182
- let match;
183
- while ((match = sectionRegex.exec(content)) !== null) {
184
- sections.push(match[1].trim());
185
- }
186
- return sections;
187
- }
188
- async function getProjectInfoStructured(workDir) {
189
- const dir = workDir || getWorkingDirectory(void 0, true);
190
- const projectPath = join(dir, PROJECT_MD_PATH);
191
- const content = await loadProjectInfo(dir);
192
- if (!content) {
193
- return {
194
- exists: false,
195
- path: projectPath,
196
- sections: {},
197
- raw: null
198
- };
199
- }
200
- const sectionNames = await getProjectSections(dir);
201
- const sections = {};
202
- for (const name of sectionNames) {
203
- const sectionContent = await getProjectSection(name, dir);
204
- if (sectionContent) {
205
- sections[name] = sectionContent;
206
- }
207
- }
208
- return {
209
- exists: true,
210
- path: projectPath,
211
- sections,
212
- raw: content
213
- };
214
- }
215
- function escapeRegex(str) {
216
- return str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
217
- }
218
-
219
- export {
220
- projectInfoExists,
221
- loadProjectInfo,
222
- initProjectInfo,
223
- getProjectSection,
224
- updateProjectSection,
225
- appendToSection,
226
- getProjectSections,
227
- getProjectInfoStructured
228
- };
229
- //# sourceMappingURL=chunk-Q4RVENDE.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/utils/project-info.ts"],"sourcesContent":["/**\n * Project Info Manager\n * \n * Manages the .trie/PROJECT.md file that stores user-defined project context.\n * Unlike AGENTS.md (auto-generated), PROJECT.md is fully user-controlled.\n */\n\nimport { readFile, writeFile, mkdir } from 'fs/promises';\nimport { existsSync } from 'fs';\nimport { join } from 'path';\nimport { getWorkingDirectory } from './workspace.js';\n\nconst PROJECT_MD_PATH = '.trie/PROJECT.md';\n\n/**\n * Default PROJECT.md template\n */\nexport function getProjectTemplate(): string {\n return `# Project Information\n\n> This file stores important project context for AI assistants.\n> Edit freely - this file is yours, not auto-generated.\n> Available via MCP resource: \\`trie://project\\`\n\n---\n\n## Project Overview\n\n<!-- Describe your project's purpose and goals -->\n\n[Add project description here]\n\n---\n\n## Technology Stack\n\n<!-- List frameworks, languages, databases, cloud services, etc. -->\n\n- **Language:** \n- **Framework:** \n- **Database:** \n- **Hosting:** \n\n---\n\n## Architecture\n\n<!-- Key patterns, architectural decisions, and system design -->\n\n[Describe your architecture here]\n\n---\n\n## Coding Conventions\n\n<!-- Style guidelines, naming conventions, patterns to follow -->\n\n- \n- \n- \n\n---\n\n## Environment\n\n<!-- URLs, API endpoints, deployment info -->\n\n| Environment | URL | Notes |\n|-------------|-----|-------|\n| Development | | |\n| Staging | | |\n| Production | | |\n\n---\n\n## Team\n\n<!-- Ownership, contacts, responsibilities -->\n\n- **Owner:** \n- **Team:** \n\n---\n\n## Compliance\n\n<!-- HIPAA, SOC2, GDPR, PCI-DSS requirements if applicable -->\n\n- [ ] GDPR\n- [ ] SOC2\n- [ ] HIPAA\n- [ ] PCI-DSS\n\n---\n\n## AI Instructions\n\n<!-- Special instructions for AI assistants working on this project -->\n\nWhen working on this project, AI assistants should:\n\n1. \n2. \n3. \n\n---\n\n*This file is read by Trie agents and exposed via \\`trie://project\\` MCP resource.*\n*Edit this file to provide context to Claude Code, Cursor, GitHub Actions, and other AI tools.*\n`;\n}\n\n/**\n * Check if PROJECT.md exists\n */\nexport function projectInfoExists(workDir?: string): boolean {\n const dir = workDir || getWorkingDirectory(undefined, true);\n const projectPath = join(dir, PROJECT_MD_PATH);\n return existsSync(projectPath);\n}\n\n/**\n * Load PROJECT.md content\n */\nexport async function loadProjectInfo(workDir?: string): Promise<string | null> {\n const dir = workDir || getWorkingDirectory(undefined, true);\n const projectPath = join(dir, PROJECT_MD_PATH);\n \n try {\n if (!existsSync(projectPath)) {\n return null;\n }\n return await readFile(projectPath, 'utf-8');\n } catch {\n return null;\n }\n}\n\n/**\n * Save PROJECT.md content\n */\nexport async function saveProjectInfo(content: string, workDir?: string): Promise<void> {\n const dir = workDir || getWorkingDirectory(undefined, true);\n const trieDir = join(dir, '.trie');\n const projectPath = join(dir, PROJECT_MD_PATH);\n \n // Ensure .trie directory exists\n await mkdir(trieDir, { recursive: true });\n \n await writeFile(projectPath, content, 'utf-8');\n}\n\n/**\n * Initialize PROJECT.md with template\n */\nexport async function initProjectInfo(workDir?: string): Promise<{ created: boolean; path: string }> {\n const dir = workDir || getWorkingDirectory(undefined, true);\n const projectPath = join(dir, PROJECT_MD_PATH);\n \n if (existsSync(projectPath)) {\n return { created: false, path: projectPath };\n }\n \n await saveProjectInfo(getProjectTemplate(), dir);\n return { created: true, path: projectPath };\n}\n\n/**\n * Get a specific section from PROJECT.md\n */\nexport async function getProjectSection(sectionName: string, workDir?: string): Promise<string | null> {\n const content = await loadProjectInfo(workDir);\n if (!content) return null;\n \n // Find section by header\n const sectionRegex = new RegExp(\n `## ${escapeRegex(sectionName)}\\\\s*\\\\n([\\\\s\\\\S]*?)(?=\\\\n## |\\\\n---\\\\s*$|$)`,\n 'i'\n );\n \n const match = content.match(sectionRegex);\n if (match) {\n return match[1].trim();\n }\n \n return null;\n}\n\n/**\n * Update a specific section in PROJECT.md\n */\nexport async function updateProjectSection(\n sectionName: string, \n newContent: string, \n workDir?: string\n): Promise<boolean> {\n let content = await loadProjectInfo(workDir);\n \n if (!content) {\n // Initialize with template first\n await initProjectInfo(workDir);\n content = await loadProjectInfo(workDir);\n if (!content) return false;\n }\n \n // Find and replace section content\n const sectionRegex = new RegExp(\n `(## ${escapeRegex(sectionName)}\\\\s*\\\\n)([\\\\s\\\\S]*?)((?=\\\\n## )|(?=\\\\n---\\\\s*$)|$)`,\n 'i'\n );\n \n if (content.match(sectionRegex)) {\n const updatedContent = content.replace(sectionRegex, `$1\\n${newContent}\\n\\n$3`);\n await saveProjectInfo(updatedContent, workDir);\n return true;\n }\n \n return false;\n}\n\n/**\n * Append content to a section\n */\nexport async function appendToSection(\n sectionName: string,\n contentToAdd: string,\n workDir?: string\n): Promise<boolean> {\n const currentContent = await getProjectSection(sectionName, workDir);\n if (currentContent === null) return false;\n \n const newContent = currentContent + '\\n' + contentToAdd;\n return updateProjectSection(sectionName, newContent, workDir);\n}\n\n/**\n * Get all section names from PROJECT.md\n */\nexport async function getProjectSections(workDir?: string): Promise<string[]> {\n const content = await loadProjectInfo(workDir);\n if (!content) return [];\n \n const sectionRegex = /^## (.+)$/gm;\n const sections: string[] = [];\n let match;\n \n while ((match = sectionRegex.exec(content)) !== null) {\n sections.push(match[1].trim());\n }\n \n return sections;\n}\n\n/**\n * Get project info as structured data (for JSON responses)\n */\nexport async function getProjectInfoStructured(workDir?: string): Promise<{\n exists: boolean;\n path: string;\n sections: Record<string, string>;\n raw: string | null;\n}> {\n const dir = workDir || getWorkingDirectory(undefined, true);\n const projectPath = join(dir, PROJECT_MD_PATH);\n const content = await loadProjectInfo(dir);\n \n if (!content) {\n return {\n exists: false,\n path: projectPath,\n sections: {},\n raw: null,\n };\n }\n \n const sectionNames = await getProjectSections(dir);\n const sections: Record<string, string> = {};\n \n for (const name of sectionNames) {\n const sectionContent = await getProjectSection(name, dir);\n if (sectionContent) {\n sections[name] = sectionContent;\n }\n }\n \n return {\n exists: true,\n path: projectPath,\n sections,\n raw: content,\n };\n}\n\n/**\n * Escape special regex characters\n */\nfun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