feat(workspaces): Add repo button on /projects (standalone repos)#43
Closed
dvcdsys wants to merge 1 commit into
Closed
feat(workspaces): Add repo button on /projects (standalone repos)#43dvcdsys wants to merge 1 commit into
dvcdsys wants to merge 1 commit into
Conversation
Adding a GitHub repo previously required navigating into a specific
workspace, which is awkward when projects in this codebase exist
independently of workspaces (workspaces are aggregations). The
dashboard's /projects page now has an Add repo button next to the
title that runs the same clone+index pipeline without forcing the
user to think about workspace assignment first.
Backend: workspaces gain an is_default flag (partial-UNIQUE index +
ALTER-TABLE migration) and a singleton default row is created at
startup via workspaces.EnsureDefault. POST /api/v1/git-repos resolves
that row and proxies into AddWorkspaceRepo so the existing job queue,
webhook, and link flows stay untouched. The default workspace is
protected from delete (409) so the standalone endpoint always has a
home. EnsureDefault is idempotent and side-steps name collisions
("Personal" → "Personal (2)") so an operator-created workspace with
the same name is never reassigned.
Frontend: AddRepoDialog's workspaceID prop is now optional; the
component routes to /git-repos when omitted. ProjectsListPage gets
the trigger button + an updated empty-state copy that points users
at it.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
7 tasks
Owner
Author
|
Folded into #42 — consolidated PR now carries both feature sets. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
/projectspage so a GitHub repository can be cloned + indexed without having to first pick or create a workspace. Reuses the existingAddRepoDialog; the only new piece is theworkspaceID-optional code path that POSTs to/api/v1/git-reposinstead of/api/v1/workspaces/{id}/repos.workspaces.is_default = 1) bootstrapped at server startup. The/git-reposendpoint internally resolves it and proxies toAddWorkspaceRepo, so the existing clone/index/webhook pipeline is untouched. The row is protected from delete (409) so the standalone endpoint always has a target.Motivation
Projects in this codebase are canonical, workspaces are groupings. Requiring a workspace selection to add a repo broke that mental model. The default workspace keeps the data model intact while giving users a frictionless "just add this repo" flow from
/projects.Notes
EnsureDefaultis idempotent + handles operator name collisions (e.g. a pre-existing workspace called "Personal" stays untouched; the bootstrap picks "Personal (2)" etc).workspaces(is_default) WHERE is_default = 1lives in the migration only — keeping it out ofSchemaso pre-feature databases don't trip on it before the column is added (same pattern asidx_projects_path_hash)./workspacesand can be renamed — only delete is blocked. A future polish PR could surface it specially in the workspace list (badge or sort-first).Test plan
go test ./...— adds:TestEnsureDefault_CreatesOnFirstCallTestEnsureDefault_IdempotentTestEnsureDefault_AvoidsNameCollisionTestDelete_DefaultProtectedTestStandaloneGitRepo_LandsInDefaultWorkspaceTestStandaloneGitRepo_DeleteDefaultWorkspaceConflictnpm run buildinserver/dashboard— typecheck + production build clean against regeneratedgenerated.ts./projects→ click Add repo → walk through token/account/repo/branch → submit → confirm the new project appears in/projectsand aworkspace_reposrow lands in the default workspace./workspaces→ confirm the default workspace exists; attempting to delete it surfaces a 409 error in the UI.🤖 Generated with Claude Code