@triedotdev/mcp 1.0.39 → 1.0.41

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/dist/index.js CHANGED
@@ -9,7 +9,17 @@ import {
9
9
  getContextForAI,
10
10
  loadConfig,
11
11
  loadContextState
12
- } from "./chunk-HG5AWUH7.js";
12
+ } from "./chunk-G2GNVUMP.js";
13
+ import {
14
+ appendToSection,
15
+ getProjectInfoStructured,
16
+ getProjectSection,
17
+ getProjectSections,
18
+ initProjectInfo,
19
+ loadProjectInfo,
20
+ projectInfoExists,
21
+ updateProjectSection
22
+ } from "./chunk-Q4RVENDE.js";
13
23
  import {
14
24
  CRITICAL_REVIEW_CHECKLIST,
15
25
  SuperReviewerAgent,
@@ -4341,6 +4351,205 @@ ${fileChange.diff}
4341
4351
  }
4342
4352
  };
4343
4353
 
4354
+ // src/tools/project-info.ts
4355
+ var TrieProjectInfoTool = class {
4356
+ async execute(args) {
4357
+ const workDir = args.directory || getWorkingDirectory(void 0, true);
4358
+ const action = args.action || "view";
4359
+ try {
4360
+ switch (action) {
4361
+ case "view":
4362
+ return await this.handleView(workDir, args.section);
4363
+ case "init":
4364
+ return await this.handleInit(workDir);
4365
+ case "update":
4366
+ return await this.handleUpdate(workDir, args.section, args.content);
4367
+ case "append":
4368
+ return await this.handleAppend(workDir, args.section, args.content);
4369
+ case "sections":
4370
+ return await this.handleSections(workDir);
4371
+ case "raw":
4372
+ return await this.handleRaw(workDir);
4373
+ default:
4374
+ return this.error(`Unknown action: ${action}. Use: view, init, update, append, sections, raw`);
4375
+ }
4376
+ } catch (error) {
4377
+ return this.error(`Error: ${error instanceof Error ? error.message : String(error)}`);
4378
+ }
4379
+ }
4380
+ async handleView(workDir, section) {
4381
+ if (!projectInfoExists(workDir)) {
4382
+ return this.formatResponse(`## Project Info Not Found
4383
+
4384
+ No \`.trie/PROJECT.md\` file exists in this project.
4385
+
4386
+ **To create one, use:**
4387
+ \`\`\`
4388
+ trie_project action="init"
4389
+ \`\`\`
4390
+
4391
+ Or run: \`trie-agent project init\`
4392
+
4393
+ This will create a template with sections for:
4394
+ - Project Overview
4395
+ - Technology Stack
4396
+ - Architecture
4397
+ - Coding Conventions
4398
+ - Environment
4399
+ - Team
4400
+ - Compliance
4401
+ - AI Instructions`);
4402
+ }
4403
+ if (section) {
4404
+ const sectionContent = await getProjectSection(section, workDir);
4405
+ if (sectionContent === null) {
4406
+ const sections = await getProjectSections(workDir);
4407
+ return this.formatResponse(`## Section Not Found: "${section}"
4408
+
4409
+ Available sections:
4410
+ ${sections.map((s) => `- ${s}`).join("\n")}`);
4411
+ }
4412
+ return this.formatResponse(`## ${section}
4413
+
4414
+ ${sectionContent}`);
4415
+ }
4416
+ const info = await getProjectInfoStructured(workDir);
4417
+ let output = `## Project Information
4418
+
4419
+ **Path:** \`${info.path}\`
4420
+ **Sections:** ${Object.keys(info.sections).length}
4421
+
4422
+ ---
4423
+
4424
+ `;
4425
+ for (const [name, content] of Object.entries(info.sections)) {
4426
+ output += `### ${name}
4427
+
4428
+ ${content}
4429
+
4430
+ ---
4431
+
4432
+ `;
4433
+ }
4434
+ return this.formatResponse(output);
4435
+ }
4436
+ async handleInit(workDir) {
4437
+ const result = await initProjectInfo(workDir);
4438
+ if (result.created) {
4439
+ return this.formatResponse(`## PROJECT.md Created
4440
+
4441
+ **Path:** \`${result.path}\`
4442
+
4443
+ A new PROJECT.md file has been created with a template including sections for:
4444
+ - Project Overview
4445
+ - Technology Stack
4446
+ - Architecture
4447
+ - Coding Conventions
4448
+ - Environment
4449
+ - Team
4450
+ - Compliance
4451
+ - AI Instructions
4452
+
4453
+ **Next steps:**
4454
+ 1. Open the file and fill in your project details
4455
+ 2. The content will be available via \`trie://project\` resource
4456
+ 3. AI assistants will use this context when working on your project
4457
+
4458
+ **View the template:**
4459
+ \`\`\`
4460
+ trie_project action="view"
4461
+ \`\`\``);
4462
+ }
4463
+ return this.formatResponse(`## PROJECT.md Already Exists
4464
+
4465
+ **Path:** \`${result.path}\`
4466
+
4467
+ Use \`trie_project action="view"\` to see the current content.`);
4468
+ }
4469
+ async handleUpdate(workDir, section, content) {
4470
+ if (!section) {
4471
+ return this.error("Missing required parameter: section");
4472
+ }
4473
+ if (!content) {
4474
+ return this.error("Missing required parameter: content");
4475
+ }
4476
+ const success = await updateProjectSection(section, content, workDir);
4477
+ if (success) {
4478
+ return this.formatResponse(`## Section Updated: "${section}"
4479
+
4480
+ The "${section}" section has been updated with your new content.
4481
+
4482
+ **View updated section:**
4483
+ \`\`\`
4484
+ trie_project action="view" section="${section}"
4485
+ \`\`\``);
4486
+ }
4487
+ const sections = await getProjectSections(workDir);
4488
+ return this.error(`Could not update section "${section}".
4489
+
4490
+ Available sections:
4491
+ ${sections.map((s) => `- ${s}`).join("\n")}`);
4492
+ }
4493
+ async handleAppend(workDir, section, content) {
4494
+ if (!section) {
4495
+ return this.error("Missing required parameter: section");
4496
+ }
4497
+ if (!content) {
4498
+ return this.error("Missing required parameter: content");
4499
+ }
4500
+ const success = await appendToSection(section, content, workDir);
4501
+ if (success) {
4502
+ return this.formatResponse(`## Content Appended to: "${section}"
4503
+
4504
+ Your content has been added to the "${section}" section.
4505
+
4506
+ **View updated section:**
4507
+ \`\`\`
4508
+ trie_project action="view" section="${section}"
4509
+ \`\`\``);
4510
+ }
4511
+ return this.error(`Could not append to section "${section}". Make sure the section exists.`);
4512
+ }
4513
+ async handleSections(workDir) {
4514
+ if (!projectInfoExists(workDir)) {
4515
+ return this.formatResponse(`## No PROJECT.md Found
4516
+
4517
+ Run \`trie_project action="init"\` to create one.`);
4518
+ }
4519
+ const sections = await getProjectSections(workDir);
4520
+ return this.formatResponse(`## Available Sections
4521
+
4522
+ ${sections.map((s, i) => `${i + 1}. **${s}**`).join("\n")}
4523
+
4524
+ **View a section:**
4525
+ \`\`\`
4526
+ trie_project action="view" section="Section Name"
4527
+ \`\`\`
4528
+
4529
+ **Update a section:**
4530
+ \`\`\`
4531
+ trie_project action="update" section="Section Name" content="New content..."
4532
+ \`\`\``);
4533
+ }
4534
+ async handleRaw(workDir) {
4535
+ const content = await loadProjectInfo(workDir);
4536
+ if (!content) {
4537
+ return this.formatResponse(`No PROJECT.md found. Run \`trie_project action="init"\` to create one.`);
4538
+ }
4539
+ return this.formatResponse(content);
4540
+ }
4541
+ formatResponse(text) {
4542
+ return {
4543
+ content: [{ type: "text", text }]
4544
+ };
4545
+ }
4546
+ error(message) {
4547
+ return {
4548
+ content: [{ type: "text", text: `**Error:** ${message}` }]
4549
+ };
4550
+ }
4551
+ };
4552
+
4344
4553
  // src/server/tool-registry.ts
4345
4554
  var ToolRegistry = class {
4346
4555
  tools = /* @__PURE__ */ new Map();
@@ -4361,6 +4570,7 @@ var ToolRegistry = class {
4361
4570
  this.tools.set("save_agent", new TrieSaveAgentTool());
4362
4571
  this.tools.set("list_agents", new TrieListAgentsTool());
4363
4572
  this.tools.set("pr_review", new TriePRReviewTool());
4573
+ this.tools.set("project", new TrieProjectInfoTool());
4364
4574
  }
4365
4575
  defineToolSchemas() {
4366
4576
  this.definitions = [
@@ -4584,6 +4794,32 @@ var ToolRegistry = class {
4584
4794
  }
4585
4795
  }
4586
4796
  },
4797
+ {
4798
+ name: "trie_project",
4799
+ description: "View and manage project information (.trie/PROJECT.md). Store project context for AI assistants. Alias: project",
4800
+ inputSchema: {
4801
+ type: "object",
4802
+ properties: {
4803
+ action: {
4804
+ type: "string",
4805
+ enum: ["view", "init", "update", "append", "sections", "raw"],
4806
+ description: "Action: view (default), init (create template), update (replace section), append (add to section), sections (list), raw (full file)"
4807
+ },
4808
+ section: {
4809
+ type: "string",
4810
+ description: 'Section name (e.g., "Project Overview", "Technology Stack", "AI Instructions")'
4811
+ },
4812
+ content: {
4813
+ type: "string",
4814
+ description: "Content for update/append actions"
4815
+ },
4816
+ directory: {
4817
+ type: "string",
4818
+ description: "Project directory (defaults to current workspace)"
4819
+ }
4820
+ }
4821
+ }
4822
+ },
4587
4823
  // Add remaining tool definitions...
4588
4824
  this.createAgentToolDefinitions(),
4589
4825
  this.createCustomAgentDefinitions(),
@@ -4798,6 +5034,12 @@ var ResourceManager = class {
4798
5034
  description: "Current project context for AI assistants - read this first",
4799
5035
  mimeType: "text/markdown"
4800
5036
  },
5037
+ {
5038
+ uri: "trie://project",
5039
+ name: "Project Information",
5040
+ description: "User-defined project context (description, conventions, architecture, AI instructions)",
5041
+ mimeType: "text/markdown"
5042
+ },
4801
5043
  {
4802
5044
  uri: "trie://context/state",
4803
5045
  name: "Context State",
@@ -4870,6 +5112,9 @@ var ResourceManager = class {
4870
5112
  if (parsedUri === "context") {
4871
5113
  return await this.getContextResource(uri);
4872
5114
  }
5115
+ if (parsedUri === "project") {
5116
+ return await this.getProjectResource(uri);
5117
+ }
4873
5118
  if (parsedUri === "context/state") {
4874
5119
  return await this.getContextStateResource(uri);
4875
5120
  }
@@ -4928,6 +5173,56 @@ var ResourceManager = class {
4928
5173
  }]
4929
5174
  };
4930
5175
  }
5176
+ async getProjectResource(uri) {
5177
+ const workDir = getWorkingDirectory(void 0, true);
5178
+ if (!projectInfoExists(workDir)) {
5179
+ return {
5180
+ contents: [{
5181
+ uri,
5182
+ mimeType: "text/markdown",
5183
+ text: `# Project Information Not Found
5184
+
5185
+ No \`.trie/PROJECT.md\` file exists in this project.
5186
+
5187
+ ## Create One
5188
+
5189
+ Use the \`trie_project\` tool with action="init" to create a PROJECT.md template:
5190
+
5191
+ \`\`\`
5192
+ trie_project action="init"
5193
+ \`\`\`
5194
+
5195
+ Or run from CLI:
5196
+ \`\`\`
5197
+ trie-agent project init
5198
+ \`\`\`
5199
+
5200
+ ## What is PROJECT.md?
5201
+
5202
+ PROJECT.md is a user-defined file that stores important project context:
5203
+ - Project description and purpose
5204
+ - Technology stack
5205
+ - Architecture decisions
5206
+ - Coding conventions
5207
+ - Environment info
5208
+ - Team ownership
5209
+ - Compliance requirements
5210
+ - Special instructions for AI assistants
5211
+
5212
+ This information is automatically available to Claude Code, Cursor, and other AI tools.
5213
+ `
5214
+ }]
5215
+ };
5216
+ }
5217
+ const content = await loadProjectInfo(workDir);
5218
+ return {
5219
+ contents: [{
5220
+ uri,
5221
+ mimeType: "text/markdown",
5222
+ text: content || ""
5223
+ }]
5224
+ };
5225
+ }
4931
5226
  async getAgentsResource(uri) {
4932
5227
  await this.agentRegistry.loadCustomAgents();
4933
5228
  const agents = this.agentRegistry.getAgentDescriptions();
@@ -5359,6 +5654,9 @@ var RequestHandlers = class {
5359
5654
  return await this.toolRegistry.getTool("list_agents").execute(args);
5360
5655
  case "pr_review":
5361
5656
  return await this.toolRegistry.getTool("pr_review").execute(args);
5657
+ case "project":
5658
+ case "project_info":
5659
+ return await this.toolRegistry.getTool("project").execute(args);
5362
5660
  case "agent_smith":
5363
5661
  case "smith":
5364
5662
  return await this.handleAgentSmith(args);