WIP - feat(github-import): provision deco.cx site and admin MCP on GitHub i…#2963
WIP - feat(github-import): provision deco.cx site and admin MCP on GitHub i…#2963
Conversation
🧪 BenchmarkShould we run the Virtual MCP strategy benchmark for this PR? React with 👍 to run the benchmark.
Benchmark will run on the next push after you react. |
Release OptionsSuggested: Patch ( React with an emoji to override the release type:
Current version:
|
There was a problem hiding this comment.
3 issues found across 14 files
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="apps/mesh/src/api/routes/github-repos.ts">
<violation number="1" location="apps/mesh/src/api/routes/github-repos.ts:192">
P2: Auth guard checks `auth.user?.id` which rejects API-key authenticated requests. Use `getUserId(ctx)` (already imported) or `isAuthenticated(ctx)` to support both auth methods.
(Based on your team's feedback about using getUserId(ctx) instead of accessing ctx.auth.user directly.) [FEEDBACK_USED]</violation>
</file>
<file name="apps/mesh/src/web/components/account-popover.tsx">
<violation number="1" location="apps/mesh/src/web/components/account-popover.tsx:295">
P2: Query errors are rendered as “Not connected”, which misreports GitHub connection state on network/API failures. Add an explicit error state before the disconnected fallback.</violation>
</file>
<file name="apps/mesh/migrations/059-github-installation-id.ts">
<violation number="1" location="apps/mesh/migrations/059-github-installation-id.ts:23">
P2: `down()` can fail because it sets `access_token` back to NOT NULL without first handling rows that now contain NULL.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
| "/connection", | ||
| ]) { | ||
| app.use(path, async (c, next) => { | ||
| if (!c.get("meshContext").auth.user?.id) |
There was a problem hiding this comment.
P2: Auth guard checks auth.user?.id which rejects API-key authenticated requests. Use getUserId(ctx) (already imported) or isAuthenticated(ctx) to support both auth methods.
(Based on your team's feedback about using getUserId(ctx) instead of accessing ctx.auth.user directly.)
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At apps/mesh/src/api/routes/github-repos.ts, line 192:
<comment>Auth guard checks `auth.user?.id` which rejects API-key authenticated requests. Use `getUserId(ctx)` (already imported) or `isAuthenticated(ctx)` to support both auth methods.
(Based on your team's feedback about using getUserId(ctx) instead of accessing ctx.auth.user directly.) </comment>
<file context>
@@ -0,0 +1,608 @@
+ "/connection",
+]) {
+ app.use(path, async (c, next) => {
+ if (!c.get("meshContext").auth.user?.id)
+ return c.json({ error: "Unauthorized" }, 401);
+ return next();
</file context>
| return <span className="text-xs text-muted-foreground">Checking…</span>; | ||
| } | ||
|
|
||
| if (!statusData?.connected) { |
There was a problem hiding this comment.
P2: Query errors are rendered as “Not connected”, which misreports GitHub connection state on network/API failures. Add an explicit error state before the disconnected fallback.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At apps/mesh/src/web/components/account-popover.tsx, line 295:
<comment>Query errors are rendered as “Not connected”, which misreports GitHub connection state on network/API failures. Add an explicit error state before the disconnected fallback.</comment>
<file context>
@@ -252,7 +254,75 @@ function PreferenceRow({
+ return <span className="text-xs text-muted-foreground">Checking…</span>;
+ }
+
+ if (!statusData?.connected) {
+ return <span className="text-xs text-muted-foreground">Not connected</span>;
+ }
</file context>
| await sql`ALTER TABLE github_credentials ALTER COLUMN access_token SET NOT NULL`.execute( | ||
| db, | ||
| ); |
There was a problem hiding this comment.
P2: down() can fail because it sets access_token back to NOT NULL without first handling rows that now contain NULL.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At apps/mesh/migrations/059-github-installation-id.ts, line 23:
<comment>`down()` can fail because it sets `access_token` back to NOT NULL without first handling rows that now contain NULL.</comment>
<file context>
@@ -0,0 +1,31 @@
+}
+
+export async function down(db: Kysely<unknown>): Promise<void> {
+ await sql`ALTER TABLE github_credentials ALTER COLUMN access_token SET NOT NULL`.execute(
+ db,
+ );
</file context>
| await sql`ALTER TABLE github_credentials ALTER COLUMN access_token SET NOT NULL`.execute( | |
| db, | |
| ); | |
| await sql`UPDATE github_credentials SET access_token = '' WHERE access_token IS NULL`.execute(db); | |
| await sql`ALTER TABLE github_credentials ALTER COLUMN access_token SET NOT NULL`.execute( | |
| db, | |
| ); |
…mport When importing a GitHub repository, the flow now also: - Creates a deco.cx site on Supabase with selfHosting metadata - Creates an admin MCP connection pointing to sites-admin-mcp - Links both GitHub and admin connections to the Virtual MCP project - Sets up pinned views (Preview, Assets, Monitor) when admin conn is available Also: - Extracts shared Supabase helpers into deco-supabase.ts - Adds "Manage" link to GitHub connected accounts (org-aware URL) - Gracefully skips deco.cx provisioning when Supabase is not configured Made-with: Cursor
e5109ac to
5cddbc6
Compare
…mport
When importing a GitHub repository, the flow now also:
Also:
Made-with: Cursor
What is this contribution about?
Screenshots/Demonstration
How to Test
Migration Notes
Review Checklist
Summary by cubic
Adds GitHub repository import via a GitHub App and auto‑provisions a matching deco.cx site with an admin MCP, linking both connections to the new Virtual MCP project for a ready-to-use workflow.
New Features
/api/github-repos; “Manage” link in account popover uses org-aware URL.ADMIN_MCP, link both connections to the project, and pin Preview/Assets/Monitor views.deco-supabase.tsand refactoreddeco-sitesto use them.Migration
GITHUB_APP_SLUG,GITHUB_APP_ID,GITHUB_APP_PRIVATE_KEY.DECO_SUPABASE_URL,DECO_SUPABASE_SERVICE_KEY.ADMIN_MCPindeco-supabase.tsif your endpoint differs.Written for commit 5cddbc6. Summary will update on new commits.