Add local repository scanning and UI

Implement local repository scanning end-to-end. Frontend: add UI (toolbar, local-scan panel, list/cards), CSS styles, icons, new state fields, and templates; convert recent repo items to buttons and wire up actions to select, view and open scanned repos. JS: add helper utilities (repoNameFromPath, normalizeRemoteUrl, serverRepoRemoteUrls), scanForLocalRepos/selectLocalRepo functions, render template for scan results, and call scanLocalRepos via tauri-api. Tauri API: expose scan_local_repos (tauri command) in tauri-api.js. Backend (Rust): add LocalRepoCandidate type and a scanner implementation that walks configurable/default roots, deduplicates paths, matches local remotes against allowed server URLs, enforces depth/result limits, and returns matched candidates; register scan_local_repos in the command list. Includes error handling and user-facing messages for missing roots or remotes.
This commit is contained in:
2026-05-10 14:32:41 +12:00
parent f0358dbdfe
commit 346f8536f0
5 changed files with 678 additions and 28 deletions
+158 -8
View File
@@ -338,17 +338,25 @@
}
.recent-item {
display: block;
width: 100%;
border: 0;
border-radius: var(--radius-md);
background: transparent;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
cursor: pointer;
color: var(--text-muted);
padding: 4px 0;
padding: 4px 6px;
font-size: 13px;
text-align: left;
}
.recent-item:hover {
background: var(--bg-hover);
color: var(--accent);
border: 0;
}
/* ── Git output ───────────────────────────────────── */
@@ -380,15 +388,157 @@
color: var(--text-muted);
}
/* ── Local repo indicator ─────────────────────────── */
.selected-repo {
font-size: 13px;
padding: 6px 10px;
background: rgba(47, 129, 247, 0.06);
border: 1px solid rgba(47, 129, 247, 0.2);
/* ── GitHub Desktop style toolbar ─────────────────── */
.gd-toolbar {
display: grid;
grid-template-columns: minmax(0, 2fr) minmax(0, 1.5fr) minmax(0, 1.5fr);
align-items: stretch;
width: 100%;
height: 56px;
margin: -16px -16px 16px;
border-bottom: 1px solid var(--border);
background: var(--bg-panel);
flex-shrink: 0;
}
.main > .gd-toolbar {
margin: 0 0 12px;
border: 1px solid var(--border);
border-radius: var(--radius-md);
word-break: break-all;
overflow: hidden;
}
.gd-toolbar-cell {
display: grid;
grid-template-columns: auto minmax(0, 1fr) auto;
align-items: center;
gap: 10px;
width: 100%;
height: 100%;
padding: 0 14px;
border: 0;
border-right: 1px solid var(--border);
border-radius: 0;
background: transparent;
color: var(--text-main);
cursor: pointer;
text-align: left;
transition: background 0.1s ease;
}
.gd-toolbar-cell:last-child {
border-right: 0;
}
.gd-toolbar-cell:hover:not(:disabled):not(.gd-toolbar-cell-empty) {
background: rgba(177, 186, 196, 0.08);
border-color: var(--border);
}
.gd-toolbar-cell:disabled,
.gd-toolbar-cell-empty {
cursor: default;
opacity: 0.7;
}
.gd-cell-icon {
display: flex;
align-items: center;
justify-content: center;
width: 22px;
height: 22px;
color: var(--text-muted);
flex-shrink: 0;
}
.gd-cell-copy {
min-width: 0;
display: flex;
flex-direction: column;
line-height: 1.25;
}
.gd-cell-label {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
color: var(--text-muted);
font-size: 11px;
font-weight: 400;
}
.gd-cell-value {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
margin-top: 2px;
font-size: 14px;
font-weight: 600;
color: var(--text-main);
}
.gd-cell-value-muted {
color: var(--text-muted);
font-weight: 400;
font-style: italic;
}
.gd-cell-caret {
color: var(--text-muted);
flex-shrink: 0;
}
.selected-repo-path-line {
margin-top: -6px;
font-size: 12px;
font-family: ui-monospace, "Cascadia Code", "Fira Code", Consolas, monospace;
word-break: break-all;
}
.local-scan-panel {
padding: 12px;
border: 1px solid var(--border);
border-radius: var(--radius-lg);
background: rgba(33, 38, 45, 0.35);
}
.local-scan-title {
font-size: 15px;
}
.local-repo-list {
display: grid;
gap: 8px;
max-height: 320px;
overflow: auto;
}
.local-repo-card {
display: flex;
justify-content: space-between;
align-items: center;
gap: 12px;
padding: 10px 12px;
border: 1px solid var(--border);
border-radius: var(--radius-md);
background: var(--bg-panel);
}
.local-repo-info {
min-width: 0;
display: flex;
flex-direction: column;
gap: 2px;
}
.local-repo-info span {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.local-scan-empty {
padding: 24px 12px;
}
/* ── Empty state ──────────────────────────────────── */