@rigstate/mcp 0.7.13 → 0.7.14
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 +20 -4
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/tools/sync-ide-rules.ts +26 -6
package/package.json
CHANGED
|
@@ -64,16 +64,36 @@ export async function syncIdeRules(
|
|
|
64
64
|
}
|
|
65
65
|
|
|
66
66
|
// 2. Fetch Project & Preferred IDE
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
.
|
|
67
|
+
// 2. Fetch Project Data using Secure RPC (Avoids RLS blocks on direct table select)
|
|
68
|
+
// Since we passed access check, this RPC is safe to use.
|
|
69
|
+
const { data: projectData, error: rpcError } = await supabase
|
|
70
|
+
.rpc('get_project_context_secure', {
|
|
71
|
+
p_project_id: projectId,
|
|
72
|
+
p_user_id: userId
|
|
73
|
+
})
|
|
71
74
|
.single();
|
|
72
75
|
|
|
73
|
-
if (
|
|
74
|
-
throw new Error(`Project ${projectId}
|
|
76
|
+
if (rpcError || !projectData) {
|
|
77
|
+
throw new Error(`Project ${projectId} not found or access denied (Secure RPC failed).`);
|
|
75
78
|
}
|
|
76
79
|
|
|
80
|
+
// Map RPC result back to expected Project format for rules engine
|
|
81
|
+
// The RPC returns a flat object, we need to ensure it matches the Project interface expected by generateRuleContent
|
|
82
|
+
const rawData = projectData as any;
|
|
83
|
+
|
|
84
|
+
// Construct a Project-compatible object with fallbacks
|
|
85
|
+
const project = {
|
|
86
|
+
id: projectId, // Ensure ID is explicit
|
|
87
|
+
name: rawData.name || 'Unknown Project',
|
|
88
|
+
description: rawData.description || '',
|
|
89
|
+
project_type: rawData.project_type || 'web_app',
|
|
90
|
+
tech_stack: rawData.tech_stack || [],
|
|
91
|
+
repository_url: rawData.repository_url,
|
|
92
|
+
preferred_ide: rawData.preferred_ide || 'cursor',
|
|
93
|
+
// Pass through other fields that might be in the RPC response
|
|
94
|
+
...rawData
|
|
95
|
+
};
|
|
96
|
+
|
|
77
97
|
// 2. Determine IDE (Preference -> Fallback)
|
|
78
98
|
const ide: IDEProvider = (project.preferred_ide as IDEProvider) || 'cursor';
|
|
79
99
|
|