feat(web): IDE unique comme seule coquille, ancien dashboard retiré
L'IDE (/ide) devient l'unique interface sur tous les supports (navigateur, PWA, app Electron chargent la même SPA). Tout le cycle de vie de l'ancien monde est réintégré dans l'IDE ; AppShell et les vues Dashboard / Sessions / Groups / GroupView / SessionView sont supprimés. - Infra: pile de modals Teleport (stores/modals.ts + ModalHost) et menu contextuel (useContextMenu + ContextMenu), montés dans IdeShell sans le démonter (attaches WS du dock préservées). - Explorer: créer worktree (branche + baseRef + session), travailler sur main, prune, promote (escalade force), supprimer worktree, commit/push, masquer/ supprimer repo, ajouter dépôt local ou cloner. - Sessions: create/kill/resume/fork, hide/unhide, archive/unarchive, masquer les découvertes, supervision AttentionList + réponse aux dialogues. - Groupes: create/delete, composition, lancement de session de groupe (ouvre le terminal dans le dock). - Compte: Réglages et Aide en overlays par-dessus l'IDE ; langue, push/PWA, tokens, connexions git, RGPD, déconnexion. Command Palette et deep-links recâblés pour rester dans l'IDE. - Routes: les anciens chemins rendent IdeShell via meta (overlay/panel/ terminal) ; /workspace/:repoId/:wt inchangé (contrat extension VS Code). Mobile: nav à 6 panneaux (explorer/editor/terminal/git/sessions/groups). La grille multi-terminaux de groupe est retirée (supplantée par la session de groupe unique P6 via --add-dir + le dock multi-onglets).
This commit is contained in:
@@ -1,33 +1,51 @@
|
||||
<template>
|
||||
<div>
|
||||
<!-- ligne repo (niveau projet) -->
|
||||
<button
|
||||
type="button"
|
||||
class="flex w-full items-center gap-1 rounded px-2 py-1 text-left text-xs text-fg hover:bg-surface-2/60"
|
||||
@click="ide.toggleRepo(repo.id)"
|
||||
<div
|
||||
class="group flex items-center rounded text-xs text-fg hover:bg-surface-2/60"
|
||||
@contextmenu.prevent="openRepoMenu($event)"
|
||||
>
|
||||
<component :is="repoExpanded ? ChevronDown : ChevronRight" :size="14" class="shrink-0 text-fg-subtle" />
|
||||
<FolderGit2 :size="13" class="shrink-0 text-fg-subtle" />
|
||||
<span class="truncate font-medium">{{ repo.label }}</span>
|
||||
<span v-if="worktreeList.length" class="ml-auto shrink-0 text-[10px] text-fg-subtle">{{ worktreeList.length }}</span>
|
||||
</button>
|
||||
<button type="button" class="flex min-w-0 flex-1 items-center gap-1 px-2 py-1 text-left" @click="ide.toggleRepo(repo.id)">
|
||||
<component :is="repoExpanded ? ChevronDown : ChevronRight" :size="14" class="shrink-0 text-fg-subtle" />
|
||||
<FolderGit2 :size="13" class="shrink-0 text-fg-subtle" />
|
||||
<span class="truncate font-medium">{{ repo.label }}</span>
|
||||
<span v-if="worktreeList.length" class="ml-auto shrink-0 pl-1 text-[10px] text-fg-subtle">{{ worktreeList.length }}</span>
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
class="shrink-0 rounded p-0.5 opacity-0 hover:bg-surface-3 hover:text-fg group-hover:opacity-100"
|
||||
:title="t('common.settings')"
|
||||
@click.stop="openRepoMenu($event)"
|
||||
>
|
||||
<MoreVertical :size="13" />
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div v-if="repoExpanded" class="pl-3">
|
||||
<p v-if="worktreeList.length === 0" class="px-3 py-0.5 text-[11px] text-fg-subtle">{{ t('ide.noWorktrees') }}</p>
|
||||
|
||||
<div v-for="wt in worktreeList" :key="wt.path">
|
||||
<!-- ligne worktree -->
|
||||
<button
|
||||
type="button"
|
||||
class="flex w-full items-center gap-1 rounded px-2 py-1 text-left text-xs hover:bg-surface-2/60"
|
||||
:class="isActiveWt(wt) ? 'bg-surface-2 text-fg' : 'text-fg-muted'"
|
||||
@click="onWtClick(wt)"
|
||||
<div
|
||||
class="group flex items-center rounded text-xs"
|
||||
:class="isActiveWt(wt) ? 'bg-surface-2 text-fg' : 'text-fg-muted hover:bg-surface-2/60'"
|
||||
@contextmenu.prevent="openWtMenu($event, wt)"
|
||||
>
|
||||
<component :is="isWtExpanded(wt) ? ChevronDown : ChevronRight" :size="14" class="shrink-0 text-fg-subtle" />
|
||||
<component :is="wt.isMain ? Home : GitBranch" :size="12" class="shrink-0 text-fg-subtle" />
|
||||
<span class="truncate font-mono">{{ wt.branch ?? wt.head.slice(0, 7) }}</span>
|
||||
<span v-if="isDirty(wt)" class="ml-auto shrink-0 text-amber-400" :title="t('worktrees.dirty', { n: wt.git.dirtyCount })">●</span>
|
||||
</button>
|
||||
<button type="button" class="flex min-w-0 flex-1 items-center gap-1 px-2 py-1 text-left" @click="onWtClick(wt)">
|
||||
<component :is="isWtExpanded(wt) ? ChevronDown : ChevronRight" :size="14" class="shrink-0 text-fg-subtle" />
|
||||
<component :is="wt.isMain ? Home : GitBranch" :size="12" class="shrink-0 text-fg-subtle" />
|
||||
<span class="truncate font-mono">{{ wt.branch ?? wt.head.slice(0, 7) }}</span>
|
||||
<span v-if="isDirty(wt)" class="ml-auto shrink-0 pl-1 text-amber-400" :title="t('worktrees.dirty', { n: wt.git.dirtyCount })">●</span>
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
class="shrink-0 rounded p-0.5 opacity-0 hover:bg-surface-3 hover:text-fg group-hover:opacity-100"
|
||||
:title="t('common.settings')"
|
||||
@click.stop="openWtMenu($event, wt)"
|
||||
>
|
||||
<MoreVertical :size="13" />
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<!-- sessions live corrélées au worktree (par cwd) -->
|
||||
<button
|
||||
@@ -60,19 +78,44 @@
|
||||
<script setup lang="ts">
|
||||
import { computed } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { ChevronDown, ChevronRight, FolderGit2, GitBranch, Home } from '@lucide/vue';
|
||||
import {
|
||||
ChevronDown,
|
||||
ChevronRight,
|
||||
FolderGit2,
|
||||
GitBranch,
|
||||
Home,
|
||||
MoreVertical,
|
||||
SquareTerminal,
|
||||
GitCompare,
|
||||
Upload,
|
||||
ArrowUp,
|
||||
Trash2,
|
||||
Scissors,
|
||||
Eye,
|
||||
EyeOff,
|
||||
} from '@lucide/vue';
|
||||
import type { RepoSummary, SessionSummary, WorktreeSummary } from '@arboretum/shared';
|
||||
import { ApiError } from '../../lib/api';
|
||||
import { useIdeStore } from '../../stores/ide';
|
||||
import { useWorktreesStore } from '../../stores/worktrees';
|
||||
import { useSessionsStore } from '../../stores/sessions';
|
||||
import { useToastsStore } from '../../stores/toasts';
|
||||
import { useModalsStore } from '../../stores/modals';
|
||||
import { useContextMenu, type ContextMenuItem } from '../../composables/useContextMenu';
|
||||
import FileTree from '../workspace/FileTree.vue';
|
||||
import SessionStateBadge from '../SessionStateBadge.vue';
|
||||
import ConfirmModal from './modals/ConfirmModal.vue';
|
||||
import WorktreeCreateModal from './modals/WorktreeCreateModal.vue';
|
||||
import NewSessionModal from './modals/NewSessionModal.vue';
|
||||
|
||||
const props = defineProps<{ repo: RepoSummary }>();
|
||||
const { t } = useI18n();
|
||||
const ide = useIdeStore();
|
||||
const worktrees = useWorktreesStore();
|
||||
const sessions = useSessionsStore();
|
||||
const toasts = useToastsStore();
|
||||
const modals = useModalsStore();
|
||||
const ctx = useContextMenu();
|
||||
|
||||
const repoExpanded = computed(() => ide.expandedRepoIds.includes(props.repo.id));
|
||||
const worktreeList = computed(() => worktrees.worktreesForRepo(props.repo.id));
|
||||
@@ -97,4 +140,139 @@ function onWtClick(wt: WorktreeSummary): void {
|
||||
ide.setActiveWorktree(wt.repoId, wt.path);
|
||||
ide.toggleWt(wt.path);
|
||||
}
|
||||
|
||||
// --- menu contextuel repo ---
|
||||
function openRepoMenu(e: MouseEvent): void {
|
||||
const items: ContextMenuItem[] = [
|
||||
{ label: t('ide.menu.newWorktree'), icon: GitBranch, onSelect: () => void modals.open(WorktreeCreateModal, { repo: props.repo, initialMode: 'worktree' }) },
|
||||
{ label: t('ide.menu.workOnMain'), icon: Home, onSelect: () => void modals.open(WorktreeCreateModal, { repo: props.repo, initialMode: 'main' }) },
|
||||
{ label: t('ide.menu.prune'), icon: Scissors, onSelect: () => void onPrune() },
|
||||
{
|
||||
label: props.repo.hidden ? t('ide.menu.showRepo') : t('ide.menu.hideRepo'),
|
||||
icon: props.repo.hidden ? Eye : EyeOff,
|
||||
onSelect: () => void onToggleHidden(),
|
||||
},
|
||||
{ label: t('ide.menu.removeRepo'), icon: Trash2, danger: true, onSelect: () => confirmRemoveRepo() },
|
||||
];
|
||||
ctx.open(e.clientX, e.clientY, items);
|
||||
}
|
||||
|
||||
async function onPrune(): Promise<void> {
|
||||
try {
|
||||
await worktrees.prune(props.repo.id);
|
||||
toasts.success(t('toast.pruned'));
|
||||
} catch (err) {
|
||||
toasts.error(err);
|
||||
}
|
||||
}
|
||||
|
||||
async function onToggleHidden(): Promise<void> {
|
||||
try {
|
||||
await worktrees.setHidden(props.repo.id, !props.repo.hidden);
|
||||
} catch (err) {
|
||||
toasts.error(err);
|
||||
}
|
||||
}
|
||||
|
||||
function confirmRemoveRepo(): void {
|
||||
modals.open(ConfirmModal, {
|
||||
title: t('ide.menu.removeRepo'),
|
||||
message: props.repo.path,
|
||||
danger: true,
|
||||
confirmLabel: t('repos.remove'),
|
||||
onConfirm: async () => {
|
||||
await worktrees.removeRepo(props.repo.id);
|
||||
toasts.success(t('toast.repoRemoved'));
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
// --- menu contextuel worktree ---
|
||||
function openWtMenu(e: MouseEvent, wt: WorktreeSummary): void {
|
||||
const items: ContextMenuItem[] = [
|
||||
{ label: t('ide.menu.openTerminal'), icon: SquareTerminal, onSelect: () => void modals.open(NewSessionModal, { cwd: wt.path }) },
|
||||
{ label: t('ide.menu.commit'), icon: GitCompare, onSelect: () => openGitPanel(wt) },
|
||||
{ label: t('ide.menu.push'), icon: Upload, onSelect: () => void onPush(wt) },
|
||||
];
|
||||
if (!wt.isMain) {
|
||||
items.push({ label: t('ide.menu.promote'), icon: ArrowUp, onSelect: () => confirmPromote(wt) });
|
||||
items.push({ label: t('ide.menu.deleteWorktree'), icon: Trash2, danger: true, onSelect: () => confirmDelete(wt) });
|
||||
}
|
||||
ctx.open(e.clientX, e.clientY, items);
|
||||
}
|
||||
|
||||
function openGitPanel(wt: WorktreeSummary): void {
|
||||
ide.setActiveWorktree(wt.repoId, wt.path);
|
||||
ide.setActivity('git');
|
||||
}
|
||||
|
||||
async function onPush(wt: WorktreeSummary): Promise<void> {
|
||||
try {
|
||||
await worktrees.pushWorktree(wt.repoId, wt.path);
|
||||
toasts.success(t('toast.pushed'));
|
||||
} catch (err) {
|
||||
toasts.error(err);
|
||||
}
|
||||
}
|
||||
|
||||
// promotion : « passer en principal » ; escalade force sur 409 (arbre modifié).
|
||||
function confirmPromote(wt: WorktreeSummary): void {
|
||||
modals.open(ConfirmModal, {
|
||||
title: t('ide.menu.promote'),
|
||||
message: t('worktrees.promoteConfirm', { branch: wt.branch ?? '' }),
|
||||
confirmLabel: t('worktrees.promote'),
|
||||
onConfirm: async () => {
|
||||
try {
|
||||
await worktrees.promoteWorktree(wt.repoId, wt.path, false);
|
||||
toasts.success(t('ide.menu.promote'));
|
||||
} catch (err) {
|
||||
if (err instanceof ApiError && err.status === 409) {
|
||||
modals.open(ConfirmModal, {
|
||||
title: t('worktrees.forcePromote'),
|
||||
message: err.message,
|
||||
danger: true,
|
||||
confirmLabel: t('worktrees.forcePromote'),
|
||||
onConfirm: async () => {
|
||||
await worktrees.promoteWorktree(wt.repoId, wt.path, true);
|
||||
toasts.success(t('ide.menu.promote'));
|
||||
},
|
||||
});
|
||||
return;
|
||||
}
|
||||
throw err;
|
||||
}
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
// suppression : escalade force sur 409 (arbre modifié ou session vivante).
|
||||
function confirmDelete(wt: WorktreeSummary): void {
|
||||
modals.open(ConfirmModal, {
|
||||
title: t('ide.menu.deleteWorktree'),
|
||||
message: wt.path,
|
||||
danger: true,
|
||||
confirmLabel: t('worktrees.confirmDelete'),
|
||||
onConfirm: async () => {
|
||||
try {
|
||||
await worktrees.deleteWorktree(wt.repoId, wt.path, false);
|
||||
toasts.success(t('toast.worktreeDeleted'));
|
||||
} catch (err) {
|
||||
if (err instanceof ApiError && err.status === 409) {
|
||||
modals.open(ConfirmModal, {
|
||||
title: t('worktrees.forceDelete'),
|
||||
message: err.message,
|
||||
danger: true,
|
||||
confirmLabel: t('worktrees.forceDelete'),
|
||||
onConfirm: async () => {
|
||||
await worktrees.deleteWorktree(wt.repoId, wt.path, true);
|
||||
toasts.success(t('toast.worktreeDeleted'));
|
||||
},
|
||||
});
|
||||
return;
|
||||
}
|
||||
throw err;
|
||||
}
|
||||
},
|
||||
});
|
||||
}
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user