@rigstate/mcp 0.6.2 → 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 CHANGED
@@ -1917,10 +1917,26 @@ var KEY_LIBS = {
1917
1917
  "ai": "Vercel AI"
1918
1918
  };
1919
1919
  async function getProjectContext(supabase, userId, projectId) {
1920
- const { data: project, error: projectError } = await supabase.from("projects").select("id, name, description, project_type, created_at, last_indexed_at, detected_stack, repository_tree").eq("id", projectId).eq("owner_id", userId).single();
1921
- if (projectError || !project) {
1920
+ const { data: rawData, error: projectError } = await supabase.rpc("get_project_context_secure", {
1921
+ p_project_id: projectId,
1922
+ p_user_id: userId
1923
+ }).single();
1924
+ const projectRow = rawData;
1925
+ if (projectError || !projectRow) {
1926
+ console.error("Project fetch failed:", projectError);
1922
1927
  throw new Error("Project not found or access denied");
1923
1928
  }
1929
+ const project = {
1930
+ id: projectRow.id,
1931
+ name: projectRow.name,
1932
+ description: projectRow.description,
1933
+ project_type: projectRow.project_type,
1934
+ created_at: projectRow.created_at,
1935
+ last_indexed_at: projectRow.last_indexed_at,
1936
+ detected_stack: projectRow.detected_stack,
1937
+ repository_tree: projectRow.repository_tree
1938
+ };
1939
+ const stackDef = projectRow.architectural_dna?.stack_definition;
1924
1940
  const { data: agentTasks } = await supabase.from("agent_bridge").select("id, roadmap_chunks(title), execution_summary, completed_at").eq("project_id", projectId).eq("status", "COMPLETED").order("completed_at", { ascending: false }).limit(3);
1925
1941
  const { data: roadmapItems } = await supabase.from("roadmap_chunks").select("title, status, updated_at").eq("project_id", projectId).order("updated_at", { ascending: false }).limit(3);
1926
1942
  const techStack = {
@@ -1954,25 +1970,29 @@ async function getProjectContext(supabase, userId, projectId) {
1954
1970
  )].slice(0, 10);
1955
1971
  }
1956
1972
  const summaryParts = [];
1957
- if (project.project_type) {
1958
- summaryParts.push(`Project Type: ${project.project_type.toUpperCase()}`);
1959
- }
1960
- if (techStack.framework) {
1961
- summaryParts.push(`Framework: ${techStack.framework}`);
1962
- }
1963
- if (techStack.orm) {
1964
- summaryParts.push(`ORM: ${techStack.orm}`);
1965
- }
1966
- if (techStack.keyLibraries.length > 0) {
1967
- summaryParts.push(`Key Libraries: ${techStack.keyLibraries.join(", ")}`);
1968
- }
1969
- if (techStack.topFolders.length > 0) {
1970
- summaryParts.push(`Top Folders: ${techStack.topFolders.join(", ")}`);
1973
+ summaryParts.push(`Project Type: ${project.project_type?.toUpperCase() || "UNKNOWN"}`);
1974
+ if (stackDef) {
1975
+ summaryParts.push("\n=== CURRENT STACK ===");
1976
+ if (stackDef.frontend) summaryParts.push(`Frontend: ${stackDef.frontend.framework} (${stackDef.frontend.language})`);
1977
+ if (stackDef.backend) summaryParts.push(`Backend: ${stackDef.backend.service} (${stackDef.backend.database})`);
1978
+ if (stackDef.styling) summaryParts.push(`Styling: ${stackDef.styling.framework} ${stackDef.styling.library || ""}`);
1979
+ if (stackDef.hosting) summaryParts.push(`Infrastructure: ${stackDef.hosting.provider}`);
1980
+ } else {
1981
+ if (techStack.framework) summaryParts.push(`Framework: ${techStack.framework}`);
1982
+ if (techStack.orm) summaryParts.push(`ORM: ${techStack.orm}`);
1971
1983
  }
1972
1984
  if (project.description) {
1973
1985
  summaryParts.push(`
1974
1986
  Description: ${project.description}`);
1975
1987
  }
1988
+ summaryParts.push("\n=== RIGSTATE TOOLING GUIDELINES ===");
1989
+ summaryParts.push("You have access to specialized MCP tools. USE THEM TO SUCCEED:");
1990
+ summaryParts.push("1. NEVER guess about architecture. Use `query_brain` to search project documentation.");
1991
+ summaryParts.push("2. BEFORE coding, check `get_learned_instructions` to see if you have been corrected before.");
1992
+ summaryParts.push("3. When finishing a task, ALWAYS update the roadmap using `update_roadmap`.");
1993
+ summaryParts.push("4. If you discover a reusable pattern, submit it with `submit_curator_signal`.");
1994
+ summaryParts.push("5. For large refactors, use `run_architecture_audit` to check against rules.");
1995
+ summaryParts.push("6. Store major decisions using `save_decision` (ADR).");
1976
1996
  summaryParts.push("\n=== RECENT ACTIVITY DIGEST ===");
1977
1997
  if (agentTasks && agentTasks.length > 0) {
1978
1998
  summaryParts.push("\nLatest AI Executions:");