feat: workspace-level sidebar shortcuts with shortcut badges and desktop tabs extraction

This commit is contained in:
Mohamed Boudra
2026-03-03 20:56:42 +07:00
parent 73eabd2eea
commit 74ac17f910
22 changed files with 1287 additions and 629 deletions
+38
View File
@@ -156,6 +156,44 @@ export function deriveProjectName(projectKey: string): string {
return segments[segments.length - 1] || projectKey;
}
/**
* Formats a project name for display in the UI.
*
* - GitHub remotes show owner/repo
* - Other remotes show the remote path when possible
* - Local projects prefer the provided projectName, then fallback to cwd tail
*/
export function deriveProjectDisplayName(input: {
projectKey: string;
projectName: string;
}): string {
const githubPrefix = "remote:github.com/";
if (input.projectKey.startsWith(githubPrefix)) {
return input.projectKey.slice(githubPrefix.length);
}
if (input.projectKey.startsWith("remote:")) {
const withoutPrefix = input.projectKey.slice("remote:".length);
const slashIdx = withoutPrefix.indexOf("/");
if (slashIdx >= 0) {
const remotePath = withoutPrefix.slice(slashIdx + 1).trim();
if (remotePath.length > 0) {
return remotePath;
}
}
return withoutPrefix;
}
const trimmedProjectName = input.projectName.trim();
if (trimmedProjectName.length > 0) {
return trimmedProjectName;
}
const normalized = input.projectKey.replace(/\\/g, "/").replace(/\/+$/, "");
const segments = normalized.split("/").filter(Boolean);
return segments[segments.length - 1] ?? input.projectKey;
}
/**
* Determines the date group label for an agent based on lastActivityAt.
*/