* feat(settings): choose which orchestration skills to install The skills row installed the whole bundle or nothing. A settings control next to it now opens a sheet where you keep every bundled skill or pick a subset, and saving converges ~/.agents, ~/.claude, and ~/.codex to it. "All skills" reads the bundle directory instead of a hardcoded catalog, so a skill added in a later release installs itself without another code change. Retired bundle names stay in a separate cleanup list so old copies on disk are still removed but never become selectable. The selection persists under Electron user data, separate from install state, so uninstalling does not erase the choice — a later install brings back exactly the chosen set. Installs with no saved selection read as "all", which is what they already had. * Restore skill selection after failed save * fix(settings): don't save a skill selection that never reached disk A failed save wrote the preference, converged, then wrote the old preference back. That leaves a window where a selection the user was told did not save is the one on disk, and a crash inside it makes the window permanent. Converge first and persist only on success — nothing to roll back, and a failed save now leaves disk and preference exactly as Cancel would. Resolving the bundle path when the command handlers are wired also broke daemon-manager's tests: the packaged branch reads process.resourcesPath, which is undefined outside Electron. Resolve targets per command instead — registering handlers should not touch the environment. * fix(settings): make skills convergence single-writer and confirm removals Startup auto-update and the settings commands were separate writers over the same skill directories. Either could apply a plan computed from a selection the other had already replaced — narrow the selection while startup is repairing drift and the repair puts the removed skill back. There is now one controller that owns scan, apply, and persist, and every entry point queues through it, so concurrent callers see a consistent result instead of an interleaved one. Save also had no recovery once it had converged: if the selection could not be committed afterwards, disk was changed while the preference still said the old thing, and the next startup silently undid the change. Save now puts the managed directories back to what the committed selection describes before it reports the failure, so a failed Save lands where Cancel would. Deselecting a skill deletes its directory in all three agent homes, including files the user put inside it. That is now confirmed like every other destructive action, naming the skills and the directories. Adding skills or saving an unchanged selection still saves without a prompt, and a skill the host has not installed yet deletes nothing so it does not prompt either. * fix(settings): confirm removal for skills installed in only some agent homes The removal confirmation read an `add` op as "not on disk yet". An `add` op means "missing from at least one target", so a skill sitting in ~/.claude but not the other two looked absent, and deselecting it deleted that directory — with anything the user had put inside it — without asking. The status snapshot now carries the installed skill names directly, taken from union presence across the three agent homes, and the confirmation reads that. `ops` keeps its one meaning. A host that predates the field cannot say what is on disk, so the app bridge assumes the saved selection is installed. Asking about a directory that turns out to be absent is harmless; the reverse is not. * fix(settings): warn about every skill directory a save deletes The confirmation asked "was this selected before and is it selected now", which is a different question from the one the host answers. The host converges to the desired set and deletes every managed directory outside it, so a skill on disk that the saved preference never mentioned — reinstalled by hand, restored by a sync, left behind by drift — was deleted with no warning, user files included. The predicate now mirrors the host rule: everything installed that the draft will not keep, regardless of what was saved before. It moved out of the sheet into its own module so the rule has one owner and can be tested directly. Saving with nothing to delete still does not prompt. * fix(settings): a failed save keeps files the user added inside a skill Save converges before it commits, and convergence deletes whole skill directories. When the commit then failed, the recovery re-installed the committed selection — which rebuilds the bundled files and nothing else, so notes, hooks, and anything else the user had put inside a deselected skill were gone for good. Cancel does not do that, and a failed save is supposed to land where Cancel would. Save now runs as a transaction. Before converging it stages a copy of every managed skill directory across the three agent homes, next to the tree so the copy stays on one filesystem. Committing drops the staging; failing anywhere puts each directory back exactly as it was, deletes the ones the candidate had created, and then drops the staging. Staging left by a process that died mid-save is cleaned up by the next one. The controller only sees begin/commit/rollback; the filesystem work lives in skills-transaction.ts. * fix(settings): make skill removal confirmation authoritative * fix(settings): verify skill convergence before commit * fix(settings): preserve concurrent skill edits on rollback * fix(settings): preserve staged skill metadata * fix(settings): stage skill deletions atomically * fix(settings): stage removals per filesystem * fix(settings): restore staged skill symlinks * fix(settings): canonicalize skill transaction roots * fix(settings): keep automatic skill updates non-destructive * fix(settings): report committed skill saves accurately * fix(settings): keep skill updates non-destructive * fix(settings): route skill removals through selection * fix(settings): close skill selection edge cases * fix(settings): preserve skill data during maintenance * fix(settings): hide unavailable skill install * fix(desktop): keep install policy at command boundary * fix(desktop): restore staged skill directories atomically * test(app): retry transient skills sandbox cleanup * fix(desktop): recover externally deleted skill stages * fix(desktop): preserve conflicting skill rollback data * fix(desktop): generalize skill rollback conflicts * fix(desktop): preserve skill rollback collisions * fix(desktop): recover quarantined skill backups * fix(app): inset adaptive sheet content on compact The compact Choose skills sheet rendered edge to edge: the All skills card touched both screen edges, the section label was glued to it, and the skill list ran to the edges too. Desktop was correct. AdaptiveModalSheet expressed its content inset through BottomSheetScrollView.contentContainerStyle. That is a library prop, not the style prop Unistyles registers, and gorhom's scroller was never rewritten by the Babel plugin, so on web the emitted class was never applied and the padding and gap resolved to nothing. The desktop card uses a real ScrollView, which Unistyles does track, which is why only compact was affected. The inset now lives on a View the sheet owns, rendered by every presentation, so one definition covers compact and desktop and a scroller only ever gets theme-free layout. The caller-facing prop is contentStyle, since it no longer lands on a scroll content container. Choose skills drops its ad-hoc label for SettingsSection, so the label carries the app's section rhythm instead of sitting equidistant between two cards. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> * fix(desktop): prevent skill rollback data loss Preserve externally replaced directory trees during recovery and reject managed child symlinks before synchronization can write outside a skill directory. --------- Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
102 lines
3.1 KiB
TypeScript
102 lines
3.1 KiB
TypeScript
import { expect, test, type Page } from "./fixtures";
|
|
import { gotoAppShell } from "./helpers/app";
|
|
import {
|
|
readRails,
|
|
readSheetHeaderRails,
|
|
readVerticalGap,
|
|
waitForSettledPosition,
|
|
} from "./helpers/sheet-layout";
|
|
import {
|
|
openCompactSkillsIntegrations,
|
|
openSkillSelection,
|
|
openSkillsIntegrations,
|
|
startSkillsSandbox,
|
|
type SkillsSandbox,
|
|
} from "./helpers/skills-selection";
|
|
|
|
const COMPACT_VIEWPORT = { width: 390, height: 844 };
|
|
const DESKTOP_VIEWPORT = { width: 1280, height: 900 };
|
|
|
|
const sandboxes: SkillsSandbox[] = [];
|
|
|
|
test.afterEach(async () => {
|
|
for (const sandbox of sandboxes.splice(0)) {
|
|
await sandbox.cleanup();
|
|
}
|
|
});
|
|
|
|
async function openChooseSkillsOnPhone(page: Page): Promise<void> {
|
|
sandboxes.push(await startSkillsSandbox(page));
|
|
await gotoAppShell(page);
|
|
await openCompactSkillsIntegrations(page);
|
|
await openSkillSelection(page);
|
|
await waitForSettledPosition(page.getByTestId("skill-selection-sheet"));
|
|
}
|
|
|
|
async function openChooseSkillsOnDesktop(page: Page): Promise<void> {
|
|
sandboxes.push(await startSkillsSandbox(page));
|
|
await gotoAppShell(page);
|
|
await openSkillsIntegrations(page);
|
|
await openSkillSelection(page);
|
|
}
|
|
|
|
function sheetHeaderRails(page: Page) {
|
|
return readSheetHeaderRails(page, "skill-selection-sheet", "Choose skills");
|
|
}
|
|
|
|
function allSkillsCard(page: Page) {
|
|
return page.getByTestId("skill-selection-all-card");
|
|
}
|
|
|
|
function skillListCard(page: Page) {
|
|
return page.getByTestId("skill-selection-list-card");
|
|
}
|
|
|
|
function bundledSkillsLabel(page: Page) {
|
|
return page.getByText("Bundled skills", { exact: true });
|
|
}
|
|
|
|
test.describe("Choose skills sheet on a compact form factor", () => {
|
|
test.use({ viewport: COMPACT_VIEWPORT });
|
|
|
|
test("keeps its cards on the sheet header rails", async ({ page }) => {
|
|
await openChooseSkillsOnPhone(page);
|
|
|
|
const header = await sheetHeaderRails(page);
|
|
|
|
expect(await readRails(allSkillsCard(page))).toEqual(header);
|
|
expect(await readRails(skillListCard(page))).toEqual(header);
|
|
});
|
|
|
|
test("gives the Bundled skills label more room above it than below", async ({ page }) => {
|
|
await openChooseSkillsOnPhone(page);
|
|
|
|
expect({
|
|
aboveLabel: await readVerticalGap(allSkillsCard(page), bundledSkillsLabel(page)),
|
|
belowLabel: await readVerticalGap(bundledSkillsLabel(page), skillListCard(page)),
|
|
}).toEqual({ aboveLabel: 16, belowLabel: 12 });
|
|
});
|
|
});
|
|
|
|
test.describe("Choose skills sheet on a desktop form factor", () => {
|
|
test.use({ viewport: DESKTOP_VIEWPORT });
|
|
|
|
test("keeps its cards on the sheet header rails", async ({ page }) => {
|
|
await openChooseSkillsOnDesktop(page);
|
|
|
|
const header = await sheetHeaderRails(page);
|
|
|
|
expect(await readRails(allSkillsCard(page))).toEqual(header);
|
|
expect(await readRails(skillListCard(page))).toEqual(header);
|
|
});
|
|
|
|
test("gives the Bundled skills label more room above it than below", async ({ page }) => {
|
|
await openChooseSkillsOnDesktop(page);
|
|
|
|
expect({
|
|
aboveLabel: await readVerticalGap(allSkillsCard(page), bundledSkillsLabel(page)),
|
|
belowLabel: await readVerticalGap(bundledSkillsLabel(page), skillListCard(page)),
|
|
}).toEqual({ aboveLabel: 16, belowLabel: 12 });
|
|
});
|
|
});
|