feat: detect missing project folders + offer GitHub re-clone - #273
Open
NovakPAai wants to merge 1 commit into
Open
feat: detect missing project folders + offer GitHub re-clone#273NovakPAai wants to merge 1 commit into
NovakPAai wants to merge 1 commit into
Conversation
When a registered project folder is deleted/moved on disk, the Projects
launcher now flags it instead of failing with a confusing "invalid path".
- projects.js: pathExists() on-disk check; cloneRepo hardening — anchored
GitHub-remote regex + realpath-of-nearest-ancestor containment guard
(closes a symlinked-parent escape reachable via the "folder missing" window)
- server.js: GET /api/projects/manual returns `exists`; /api/launch returns
{missing:true, remoteUrl, projectId} before the generic safety check; new
POST /api/projects/reclone restores the folder at its original path, with a
per-id in-flight guard (409)
- frontend: missing tiles show a role="note" disclaimer + Re-clone/Remove;
launch-time misses (app.js + detail.js resume) offer a re-clone dialog;
shared anchored isGithubRemote(); a11y — dialog semantics, Escape close,
focus-on-open, aria-busy, AA-contrast warning text
- tests: pathExists + cloneRepo guardrails (symlink-ancestor, control chars);
headless render check in scratchpad; end-to-end server smoke green
Collaborator
Author
|
@vakovalskii — requesting your review as maintainer. 🙏 TL;DR: the Projects launcher now detects when a registered project folder was deleted/moved on disk and offers a one-click Re-clone from GitHub (restoring it at its original path), instead of failing with a confusing "invalid path". Safe to review quickly:
Please pay attention to:
Two items are intentionally deferred (documented in |
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.
What & why
When you register/clone a project in codbash and later delete that folder from disk (cleaning up your machine), the Projects launcher kept showing the tile, and clicking New/Last failed with a confusing "invalid or unsafe project path". This adds first-class handling for missing folders.
Note: the new
existscheck already flags real registered projects as missing-on-disk in local testing, so the feature is immediately useful.Behaviour
role="note"disclaimer — "⚠ Folder is missing on disk — it was moved or deleted." Launch controls are replaced by ↓ Re-clone (when a GitHub remote is known) and × Remove. History drill-in stays available. Local projects with no GitHub remote show "Restore the folder, or remove it from the list."/api/launchreturns{ missing:true, remoteUrl, projectId }(before the generic safety check), so every launch path — the launcher's New/Last and the session-detail Resume — pops a one-click re-clone dialog instead of a dead-end toast.POST /api/projects/reclone { id }restores the repo at its original path (not a fresh~/code/<repo>), reusingcloneRepo.API
GET /api/projects/manualexistsper project (skips git probe when the folder is gone)POST /api/launchmissing:true(+remoteUrl,projectId) for a deleted folderPOST /api/projects/recloneReview (3 agents: code / security / UX — all findings applied)
cloneRepo's home-dir containment (realpath-of-nearest-ancestor check), reachable precisely via the "folder missing" window. Plus: anchored GitHub-remote regex (rejects control chars),pathExistslength cap, per-id re-clone rate guard, anchored client-sideisGithubRemote().detail.js) now also handlesmissing:true.role="note", confirm-overlay dialog semantics (role="dialog"/aria-modal/aria-labelledby), Escape-to-close, focus-on-open,aria-busy, immediate "Cloning…" feedback.Deferred (documented in the design doc)
startServerhas no teardown seam (autoSync/heartbeat timers keep the loop alive) — needs a route-extraction refactor. Interim evidence: green end-to-end server smoke + unit tests forpathExists/cloneRepo.Origincheck on mutating POST routes — pre-existing/systemic, not introduced here.Test plan
node --test test/*.test.js— 216 pass / 0 fail (1 win32-only skip); addstest/projects-missing.test.js(10 cases incl. symlink-ancestor + control-char guards)exists:false→ launchmissing:true→ reclone guardrails (no-remote 400, invalid-id 400, unknown-id 404) — GREEN; user registry backed up + restored intactrenderLauncherCard— missing (GitHub + local) / present cards + anchoredisGithubRemote— GREENDocs:
docs/design/missing-project-detection.md,specs/missing-project-detection.feature.🤖 Generated with Claude Code