@rigstate/mcp 0.6.3 → 0.6.5
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 +36 -16
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/tools/get-project-context.ts +61 -25
package/package.json
CHANGED
|
@@ -49,18 +49,49 @@ export async function getProjectContext(
|
|
|
49
49
|
userId: string,
|
|
50
50
|
projectId: string
|
|
51
51
|
): Promise<ProjectContextResponse> {
|
|
52
|
-
//
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
52
|
+
// Define RPC response type
|
|
53
|
+
interface ProjectContextRow {
|
|
54
|
+
id: string;
|
|
55
|
+
name: string;
|
|
56
|
+
description: string;
|
|
57
|
+
project_type: string;
|
|
58
|
+
created_at: string;
|
|
59
|
+
last_indexed_at: string;
|
|
60
|
+
detected_stack: any;
|
|
61
|
+
repository_tree: any;
|
|
62
|
+
architectural_dna: any;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
// Fetch project securely via RPC (bypasses RLS with strict checks)
|
|
66
|
+
const { data: rawData, error: projectError } = await supabase
|
|
67
|
+
.rpc('get_project_context_secure', {
|
|
68
|
+
p_project_id: projectId,
|
|
69
|
+
p_user_id: userId
|
|
70
|
+
})
|
|
58
71
|
.single();
|
|
59
72
|
|
|
60
|
-
|
|
73
|
+
const projectRow = rawData as ProjectContextRow;
|
|
74
|
+
|
|
75
|
+
if (projectError || !projectRow) {
|
|
76
|
+
console.error('Project fetch failed:', projectError);
|
|
61
77
|
throw new Error('Project not found or access denied');
|
|
62
78
|
}
|
|
63
79
|
|
|
80
|
+
// Map RPC result to tool structure
|
|
81
|
+
const project = {
|
|
82
|
+
id: projectRow.id,
|
|
83
|
+
name: projectRow.name,
|
|
84
|
+
description: projectRow.description,
|
|
85
|
+
project_type: projectRow.project_type,
|
|
86
|
+
created_at: projectRow.created_at,
|
|
87
|
+
last_indexed_at: projectRow.last_indexed_at,
|
|
88
|
+
detected_stack: projectRow.detected_stack,
|
|
89
|
+
repository_tree: projectRow.repository_tree
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
// DNA is now directly available
|
|
93
|
+
const stackDef = (projectRow.architectural_dna as any)?.stack_definition;
|
|
94
|
+
|
|
64
95
|
// Fetch Digest Data
|
|
65
96
|
const { data: agentTasks } = await supabase
|
|
66
97
|
.from('agent_bridge')
|
|
@@ -123,30 +154,35 @@ export async function getProjectContext(
|
|
|
123
154
|
// Build summary
|
|
124
155
|
const summaryParts: string[] = [];
|
|
125
156
|
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
summaryParts.push(`
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
summaryParts.push(`Key Libraries: ${techStack.keyLibraries.join(', ')}`);
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
if (techStack.topFolders.length > 0) {
|
|
143
|
-
summaryParts.push(`Top Folders: ${techStack.topFolders.join(', ')}`);
|
|
157
|
+
summaryParts.push(`Project Type: ${project.project_type?.toUpperCase() || 'UNKNOWN'}`);
|
|
158
|
+
|
|
159
|
+
// Add DNA Stack Info if available (Truth)
|
|
160
|
+
if (stackDef) {
|
|
161
|
+
summaryParts.push('\n=== CURRENT STACK ===');
|
|
162
|
+
if (stackDef.frontend) summaryParts.push(`Frontend: ${stackDef.frontend.framework} (${stackDef.frontend.language})`);
|
|
163
|
+
if (stackDef.backend) summaryParts.push(`Backend: ${stackDef.backend.service} (${stackDef.backend.database})`);
|
|
164
|
+
if (stackDef.styling) summaryParts.push(`Styling: ${stackDef.styling.framework} ${stackDef.styling.library || ''}`);
|
|
165
|
+
if (stackDef.hosting) summaryParts.push(`Infrastructure: ${stackDef.hosting.provider}`);
|
|
166
|
+
} else {
|
|
167
|
+
// Fallback to detected stack
|
|
168
|
+
if (techStack.framework) summaryParts.push(`Framework: ${techStack.framework}`);
|
|
169
|
+
if (techStack.orm) summaryParts.push(`ORM: ${techStack.orm}`);
|
|
144
170
|
}
|
|
145
171
|
|
|
146
172
|
if (project.description) {
|
|
147
173
|
summaryParts.push(`\nDescription: ${project.description}`);
|
|
148
174
|
}
|
|
149
175
|
|
|
176
|
+
// Add Tooling Guidelines (Critical for Universal IDE Support)
|
|
177
|
+
summaryParts.push('\n=== RIGSTATE TOOLING GUIDELINES ===');
|
|
178
|
+
summaryParts.push('You have access to specialized MCP tools. USE THEM TO SUCCEED:');
|
|
179
|
+
summaryParts.push('1. NEVER guess about architecture. Use `query_brain` to search project documentation.');
|
|
180
|
+
summaryParts.push('2. BEFORE coding, check `get_learned_instructions` to see if you have been corrected before.');
|
|
181
|
+
summaryParts.push('3. When finishing a task, ALWAYS update the roadmap using `update_roadmap`.');
|
|
182
|
+
summaryParts.push('4. If you discover a reusable pattern, submit it with `submit_curator_signal`.');
|
|
183
|
+
summaryParts.push('5. For large refactors, use `run_architecture_audit` to check against rules.');
|
|
184
|
+
summaryParts.push('6. Store major decisions using `save_decision` (ADR).');
|
|
185
|
+
|
|
150
186
|
// Add Digest to Summary
|
|
151
187
|
summaryParts.push('\n=== RECENT ACTIVITY DIGEST ===');
|
|
152
188
|
|