Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 19 additions & 7 deletions .ai/contexts/ipc-bridge.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,23 @@
# Context: ipc-bridge

## Archived projects manager (#863 slice 2)
## Archived projects manager (#863 slices 2–3, #1167)

`settings-panel.js` mounts `renderArchivedProjects` from `archived-manager.js`
after the shared renderer helpers, dialogs, notices and sidebar controller.
It passes a copy of hidden entries/kinds, archive timestamps, cached projects and
It reads `archivedProjects` through `getSetting` and passes a copy of folder records,
hidden entries/kinds, archive timestamps, cached projects and
the working remote-host list. Host edits update labels without saving. The manager
groups Local first, then configured hosts in order, then unknown aliases; it never
collapses a worktree entry into its repository. The filter, selections and folds
are local to the mounted list. Filtering clears selections outside the results.
Counts exclude deleted entries. Missing timestamps and unknown session counts
are omitted, never invented. Names use `shortProjectPath` (last two segments).

Unarchive uses the exact stored entry via `unarchiveProject`, sequentially for a
Unarchive uses the exact stored entry via `unarchiveProject` and/or `unarchiveFolder`, sequentially for a
bulk action. Successful entries leave the list, reload projects and get one B8
ten-second Undo notice. Undo calls `archiveProjectSettings(path, folderKey)` and
ten-second Undo notice for project archives only. Folder restores use an informational
notice; mixed restores explain that Undo only re-archives projects and that folders
must be archived again through Archive folder. Undo calls `archiveProjectSettings(path, folderKey)` and
reads the new writer timestamp. After reopening Settings, Undo refreshes the
currently mounted manager; a pending action does not consume its Undo notice.
The notice stores its entry array and load generation. A later accepted project
Expand Down Expand Up @@ -54,12 +57,20 @@ leaves fallback focus to that caller; sidebar and project-settings callers retai
their existing project-header/sidebar fallback. Unlocking keeps refused actions
disabled until the menu reopens. It never calls
Unarchive before Delete. The overflow also copies the full path through
`writeClipboard`. No new IPC or launch code is introduced.
`writeClipboard`. The folder restore IPC does not change launch code.

Native controls provide Tab navigation; Enter/Space folds host groups and Escape
clears the filter. ResizeObserver alone controls the 720px stacked layout and
480px search disclosure. New surfaces use existing dark chrome tokens. Folder
archives and archived sessions are not listed in this slice.
480px search disclosure. New surfaces use existing dark chrome tokens.

Folder and project archives with the same exact entry share one row with both badges.
Folder dates accept the stored ISO timestamp; metadata includes the number of disabled
schedules. Deleted entries stay excluded. Combined restoration clears the project
archive first. The existing project writer also clears its folder record, so a following
`unarchiveFolder` returning `NOT_ARCHIVED` counts as success only after that project's
successful restore. A genuine folder failure retains a Folder-only row for retry;
a project failure prevents the folder call. Refresh reads both stores and retains the
filter and folded groups. Archived sessions remain outside this slice.

**Purpose**: The trust boundary between the Electron main process (Node, full filesystem) and the renderer (Chromium, sandboxed). The renderer can only call what `preload.js` exposes via `contextBridge`; everything else is denied.

Expand Down Expand Up @@ -463,6 +474,7 @@ consent and avoid recovery during a system exit. See window-frame.md.
| `add-project` | `(projectPath)` | Register a project (creates folder index) |
| `archive-project-settings` | `(projectPath, folderKey)` | Archive the project reversibly; preserve settings/cache/registration, suspend schedules through hidden-state filtering. Returns `{ ok: true, entry }`, where `entry` is the exact stored bare path or `alias::path` for `unarchiveProject(entry)`. Bridge: `archiveProjectSettings`. |
| `unarchive-project` | `(entry)` | Refuse entries marked `delete` before effects with `{ error, code: 'DELETED' }`; missing entries return `{ error, code: 'NOT_ARCHIVED' }`. Remove an archived or legacy hidden entry, refresh its folder and restore legacy local schedule registration. Bridge: `unarchiveProject`. |
| `unarchive-folder` | `(entry)` | Restore an exact folder archive through `writer.clearArchivedEntry`; missing entries return `{ error, code: NOT_ARCHIVED }`. Keep session archive flags and schedule files unchanged; preserve disabled schedules as a re-enable offer and notify once with `archive`. Bridge: `unarchiveFolder`. |
| `archive-project` | `(groups, opts)` | Archive folder groups and confirmed schedules; success includes `archivedAt` for the reverse path. Bridge: `archiveProject`. |
| `undo-archive-project` | `(groups, archivedAt)` | Refuse invalid groups or a stale timestamp before any effects; remove those folder archives, restore consumed offers and re-enable exactly their `disabledByArchive` files. Bridge: `undoArchiveProject`; folder Archive Undo passes the original groups and returned timestamp before restoring session archive flags. |
| `remove-project` | `(projectPath, folderKey)` | Legacy removal: drop settings, cache/search and schedule registration; no disk deletion. Bridge: `removeProjectLegacy`; neither current Delete entry point uses it. |
Expand Down
25 changes: 21 additions & 4 deletions .ai/contexts/session-cache.md
Original file line number Diff line number Diff line change
Expand Up @@ -2480,8 +2480,11 @@ Project Settings offers **Archive Project** and **Delete Project** (#568).
Archive writes only the existing `global.hiddenProjects` array through
`archive-project-settings`. Bare paths keep their historical all-host matching;
`alias::path` entries match only that host. There is no key migration. Old Hide
entries remain listed in Global Settings → **Archived projects**; entries marked
as deleted are excluded.
entries remain listed in Global Settings → **Archived**; entries marked
as deleted are excluded. Folder archives share this manager, with separate badges
and restore semantics described below. A combined row clears the project archive
first; that existing writer operation also clears its folder archive and preserves
the disabled schedules as an offer.

Archive keeps `project:<path>`, cache metadata, session rows, search rows and
`scheduleProjects`. `buildProjectsFromCache` already filters hidden entries;
Expand Down Expand Up @@ -2607,8 +2610,22 @@ lists never cross the writer transport. See `session-index-writer.md` for orderi
local groups in the schedule registry; `archive-project` re-scans and disables
only the ones the renderer confirmed — see
[schedule-runner.md](schedule-runner.md) ("Disabling a schedule file").
- **Clearing by hand.** `add-project` and `delete-worktree` call
`clearArchivedEntry`.
- **Clearing by hand.** Settings → Archived lists the keys of `archivedProjects`
alongside non-deleted `hiddenProjects`, merging an exact entry into one row with
Project and Folder badges. `unarchive-folder(entry)` calls the writer's
`clearArchivedEntry` and sends one `projects-changed('archive')` notification on
success; missing entries return `NOT_ARCHIVED`. The own-key check precedes
writer normalization: `vps::/srv/x/` cannot restore stored `vps::/srv/x`.
`add-project` and
`delete-worktree` retain their existing clearing paths. A plain folder restore
keeps session archive flags and schedule file bytes unchanged. The existing
clearing helper moves disabled schedules into a re-enable offer, preserving
unrelated offers. Folder Undo remains the separate timestamp-checked path.
Recovery notices for a failed Undo or partial Archive expose **Open Archived**.
Partial Archive notices also explain that retrying Archive folder requires
restoring the folder in Archived first, with either Schedules tab setting.
Folder rows show disabled schedule counts only above zero, using singular
"1 schedule off" for one file.
- **Re-enable offers.** An entry records `disabledSchedules`, the files the
archive actually disabled. When an entry leaves `archivedProjects` (a
reappearance in `get-projects`, or `clearArchivedEntry`), a non-empty list
Expand Down
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ What changes for you in each release of Switchboard. How to write an entry: [doc

### Changed
- After a restart, Switchboard re-reads only Claude Code transcripts changed since the previous run. Codex history is still re-read in full. (#1144)
- Settings → Archived groups projects by host, shows their paths and archive dates, and filters by name, path or host. Restore one or several projects with Undo, or delete an archived project through the existing preview without restoring it first. Worktree entries whose repository is gone can be deleted; entries still grouped under a repository explain that you can delete their repository instead. (#863)
- Settings → Archived groups project and folder archives by host, shows their paths and archive dates, and filters by name, path or host. Folder archives show their disabled schedule count and can be restored after Undo expires, keeping schedules off until you choose Turn back on. Restore one or several projects with Undo, or delete an archived project through the existing preview without restoring it first. Worktree entries whose repository is gone can be deleted; entries still grouped under a repository explain that you can delete their repository instead. (#863, #1167)
- Codex sessions run non-interactively by a program (`codex exec`: scripted reviews and fixes) are now left out of the sidebar and grid like Claude Agent SDK sessions, under the same **Hide SDK-launched Sessions** setting. They still count in the heatmap and are found by search; the ones you have open stay listed. Codex sessions already indexed are re-checked once at the next start. (#1145)

### Fixed
Expand Down
8 changes: 8 additions & 0 deletions docs/session-browser.md
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,14 @@ back on exactly the schedules it disabled; stopped processes stay stopped.
An empty folder archived without a dialog also offers Undo. An options dialog
with nothing running is configuration and has no Undo notice.

After Undo has expired, open Settings → **Archived**. Folder archives have a
**Folder** badge, their archive date and the number of schedules turned off.
**Unarchive** restores the group while keeping its sessions archived and schedules
off. The offer at the top of the restored group lets you **Turn back on** those
schedules. This restore has no folder Undo; use **Archive folder** to archive it
again. A row with both Project and Folder badges restores both archives.
Recovery notices for partial Archive or failed Undo have an **Open Archived** action.

Accepting the options hides the folder and its nested worktrees from the sidebar, even
with both boxes unticked. **Show archived sessions** shows it again, and search
still finds its sessions. The folder comes back, with its settings, when it is
Expand Down
15 changes: 10 additions & 5 deletions docs/settings.md
Original file line number Diff line number Diff line change
Expand Up @@ -140,16 +140,21 @@ The **What is sent** explanation expands when selected.

### Archived

Projects are grouped by host, with Local first. Each row shows its name, full path
(also in the tooltip), Project and legacy badges, and an archive date for new
archives. Worktree entries keep their own rows and paths. Filter by name, path,
Project and folder archives are grouped by host, with Local first. Each row shows
its name, full path (also in the tooltip), Project or Folder badges (both when
archived both ways), any legacy badge, and the available archive date. Folder
archives also show how many schedules the archive turned off. Worktree entries keep their own rows and paths. Filter by name, path,
host label or alias; Escape clears the filter. Host headers fold with Enter or
Space. Select rows or a host group to unarchive several projects together.

**Unarchive** applies immediately and offers a ten-second **Undo**. The row's
**Unarchive** applies immediately. Project restores offer a ten-second **Undo**;
folder restores keep sessions archived and schedules off, with **Turn back on**
offered at the top of the restored group. Re-archive a folder with **Archive folder**;
in a mixed restore, Undo re-archives projects only. A combined row restores its
project archive first, then its folder archive. The row's
**More actions** menu offers **Copy path** and **Delete project…**. Delete opens
the same preview and confirmation as the sidebar, without unarchiving first.
Folder and session archive management will be added separately.
Archived session management will be added separately.

### Advanced

Expand Down
16 changes: 16 additions & 0 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@
}

// Shell profiles → shell-profiles.js
const { discoverShellProfiles, getShellProfiles, resolveShell, isWindows, isWslShell, windowsToWslPath, shellArgs, quoteArgvForShell, claudeCommand, headlessClaudeLaunch } = require('./src/main/terminals/shell-profiles');

Check warning on line 88 in main.js

View workflow job for this annotation

GitHub Actions / lint

'discoverShellProfiles' is assigned a value but never used. Allowed unused vars must match /^_/u
const { startScheduler, scheduleLaunchRefusal, resolveScheduleSandbox, initialScheduleProjects, scanSchedules, setScheduleEnabled } = require('./src/main/schedules/schedule-runner');
const { buildScheduleList } = require('./src/main/schedules/schedule-list');
const { archivePlanForGroups, validArchiveGroups } = require('./archived-projects');
Expand Down Expand Up @@ -627,8 +627,8 @@
getMainWindow: () => mainWindow,
log,
});
const { readSessionFile, readFolderFromFilesystem,

Check warning on line 630 in main.js

View workflow job for this annotation

GitHub Actions / lint

'readFolderFromFilesystem' is assigned a value but never used. Allowed unused vars must match /^_/u

Check warning on line 630 in main.js

View workflow job for this annotation

GitHub Actions / lint

'readSessionFile' is assigned a value but never used. Allowed unused vars must match /^_/u
backfillEntrypoints, backfillCustomTitles, revealIfSdkSession, notifyRendererProjectsChanged, sendStatus, populateCacheViaWorker,

Check warning on line 631 in main.js

View workflow job for this annotation

GitHub Actions / lint

'sendStatus' is assigned a value but never used. Allowed unused vars must match /^_/u
scanFoldersViaWorker, setRemoteRoots, resolveFolderDir, isIndexingFinished } = sessionCache;
// see .ai/contexts/session-cache.md ("Projects query worker")
const { createProjectsWorkerClient } = require('./projects-worker-client');
Expand Down Expand Up @@ -1059,6 +1059,22 @@
return res;
});

ipcMain.handle('unarchive-folder', async (_event, entry) => {
try {
if (typeof entry !== 'string' || !Object.hasOwn(getSetting('archivedProjects') || {}, entry)) {
return { error: 'Folder is not archived', code: 'NOT_ARCHIVED' };
}
const { alias, folder } = parseFolderKey(entry);
if (!await writer.clearArchivedEntry(alias, alias && folder === '' ? '/' : folder)) {
return { error: 'Folder is not archived', code: 'NOT_ARCHIVED' };
}
notifyRendererProjectsChanged('archive');
return { ok: true };
} catch (error) {
return { error: error.message };
}
});

ipcMain.handle('undo-archive-project', async (_event, groups, archivedAt) =>
await writer.undoArchiveProjectFolders(groups, archivedAt, archiveDeps()));

Expand Down Expand Up @@ -3173,7 +3189,7 @@
// WSL profiles only work for plain terminals — Claude CLI sessions need the
// Windows shell because session data lives on the Windows filesystem.
const requestedProfile = resolveShell(effectiveProfileId);
const useWslProfile = isWslShell(requestedProfile.path) && isPlainTerminal;

Check warning on line 3192 in main.js

View workflow job for this annotation

GitHub Actions / lint

'useWslProfile' is assigned a value but never used. Allowed unused vars must match /^_/u
const shellProfile = (isWslShell(requestedProfile.path) && !isPlainTerminal)
? resolveShell('auto')
: requestedProfile;
Expand Down
1 change: 1 addition & 0 deletions preload.js
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ contextBridge.exposeInMainWorld('api', {
onProjectDeleteRecovery: callback => ipcRenderer.on('project-delete-recovery', (_event, payload) => callback(payload)),
archiveProjectSettings: (projectPath, folderKey) => ipcRenderer.invoke('archive-project-settings', projectPath, folderKey),
unarchiveProject: (entry) => ipcRenderer.invoke('unarchive-project', entry),
unarchiveFolder: (entry) => ipcRenderer.invoke('unarchive-folder', entry),
remapProject: (oldPath, newPath) => ipcRenderer.invoke('remap-project', oldPath, newPath),
checkRemapProject: (oldPath) => ipcRenderer.invoke('check-remap-project', oldPath),
deleteWorktree: (worktreePath, shown) => ipcRenderer.invoke('delete-worktree', worktreePath, shown),
Expand Down
Loading
Loading