@rigstate/mcp 0.7.10 → 0.7.13

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rigstate/mcp",
3
- "version": "0.7.10",
3
+ "version": "0.7.13",
4
4
  "description": "Rigstate MCP Server - Model Context Protocol for AI Editors",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -24,7 +24,7 @@ export async function buildProjectSummary(
24
24
 
25
25
  const detailedInstructions = activeTask.prompt_content || activeTask.instruction_set;
26
26
  if (detailedInstructions) {
27
- summaryParts.push(` Instructions: ${detailedInstructions.substring(0, 1000)}...`);
27
+ summaryParts.push(` Instructions: ${detailedInstructions}`);
28
28
  }
29
29
  if (activeTask.architectural_brief) {
30
30
  summaryParts.push(`\n Architectural Brief: ${activeTask.architectural_brief}`);
@@ -63,8 +63,29 @@ export async function listRoadmapTasks(
63
63
  const formatted = activeTasks.length > 0
64
64
  ? activeTasks.map((t: any) => {
65
65
  const statusEmoji = t.status === 'ACTIVE' ? '🔵' : '🔒';
66
- return `${statusEmoji} Step ${t.step_number}: ${t.title} (ID: ${t.id})`;
67
- }).join('\n')
66
+ const priorityBadge = t.priority ? `[${t.priority}]` : '';
67
+ const tags = t.tags && t.tags.length > 0 ? `Tags: ${t.tags.join(', ')}` : '';
68
+
69
+ let details = `${statusEmoji} Step ${t.step_number}: ${t.title} ${priorityBadge} (ID: ${t.id})`;
70
+
71
+ if (t.description) {
72
+ details += `\n Description: ${t.description.substring(0, 150)}${t.description.length > 150 ? '...' : ''}`;
73
+ }
74
+
75
+ if (tags) {
76
+ details += `\n ${tags}`;
77
+ }
78
+
79
+ if (t.prompt_content) {
80
+ details += `\n Instruction Preview: ${t.prompt_content.substring(0, 100).replace(/\n/g, ' ')}...`;
81
+ }
82
+
83
+ if (t.architectural_brief) {
84
+ details += `\n Arch Brief: ${t.architectural_brief.substring(0, 100).replace(/\n/g, ' ')}...`;
85
+ }
86
+
87
+ return details;
88
+ }).join('\n\n')
68
89
  : 'No active or locked tasks found in the roadmap.';
69
90
 
70
91
  return {
@@ -75,20 +75,54 @@ export async function saveDecision(
75
75
  : decision;
76
76
 
77
77
  // Insert the memory with high importance (ADR = 9/10)
78
- const { data: memory, error: insertError } = await supabase
79
- .from('project_memories')
80
- .insert({
81
- project_id: projectId,
82
- content: fullContent,
83
- summary: summary,
84
- category: category,
85
- tags: ['ADR', ...tags],
86
- importance: 9, // High importance for decisions
87
- source_type: 'mcp', // Track source as MCP
88
- is_active: true
89
- })
90
- .select('id')
91
- .single();
78
+ // Use the secure RPC if possible, falling back to direct insert if older RPC not found (unlikely now)
79
+ let memoryId: string | null = null;
80
+ let insertError: any = null;
81
+
82
+ try {
83
+ const { data, error } = await supabase.rpc('save_project_memory_secure', {
84
+ p_project_id: projectId,
85
+ p_user_id: userId,
86
+ p_content: fullContent,
87
+ p_category: category,
88
+ p_tags: ['ADR', ...tags],
89
+ p_importance: 9,
90
+ p_source_type: 'mcp'
91
+ });
92
+
93
+ if (error) {
94
+ insertError = error;
95
+ } else {
96
+ memoryId = data;
97
+ }
98
+ } catch (e) {
99
+ insertError = e;
100
+ }
101
+
102
+ if (!memoryId) {
103
+ // Direct Fallback
104
+ const { data: memory, error } = await supabase
105
+ .from('project_memories')
106
+ .insert({
107
+ project_id: projectId,
108
+ content: fullContent,
109
+ summary: summary,
110
+ category: category,
111
+ tags: ['ADR', ...tags],
112
+ importance: 9, // High importance for decisions
113
+ source_type: 'mcp', // Track source as MCP
114
+ is_active: true
115
+ })
116
+ .select('id')
117
+ .single();
118
+
119
+ if (error) {
120
+ insertError = error;
121
+ } else if (memory) {
122
+ memoryId = memory.id;
123
+ insertError = null; // Clear error if fallback succeeded
124
+ }
125
+ }
92
126
 
93
127
  if (insertError) {
94
128
  // Handle specific database errors
@@ -103,7 +137,7 @@ export async function saveDecision(
103
137
 
104
138
  return {
105
139
  success: true,
106
- memoryId: memory.id,
140
+ memoryId: memoryId!,
107
141
  message: `✅ Decision "${title}" saved to project "${project?.name || projectId}" with importance 9/10`
108
142
  };
109
143
  }