* 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>
334 lines
12 KiB
TypeScript
334 lines
12 KiB
TypeScript
import { test as base } from "./fixtures";
|
|
import { expect } from "@playwright/test";
|
|
import { gotoAppShell } from "./helpers/app";
|
|
import { injectDesktopBridge } from "./helpers/desktop-updates";
|
|
import { getServerId } from "./helpers/server-id";
|
|
import {
|
|
cancelSkillSelection,
|
|
chooseAllSkills,
|
|
chooseCustomSkills,
|
|
createSkillsSandbox,
|
|
expectAllSkillsSelected,
|
|
expectNoRemovalWarning,
|
|
expectRemovalWarning,
|
|
expectSavedSkillSelection,
|
|
expectSaveErrorKeepsSheetOpen,
|
|
expectSelectedSkills,
|
|
expectSkillChoices,
|
|
expectSkillFilePresent,
|
|
expectSkillPresentIn,
|
|
expectSkillSelectionOpen,
|
|
expectSkillsInstalled,
|
|
openSkillsIntegrations,
|
|
openSkillSelection,
|
|
saveSkillSelection,
|
|
toggleSkill,
|
|
serveRealSkillsCommands,
|
|
type SkillsSandbox,
|
|
type SkillsSandboxOptions,
|
|
} from "./helpers/skills-selection";
|
|
|
|
interface SkillsSandboxSetup extends SkillsSandboxOptions {
|
|
/** What the desktop confirm dialog answers when the removal warning fires. */
|
|
confirmRemoval?: boolean;
|
|
}
|
|
|
|
type StartSkills = (setup?: SkillsSandboxSetup) => Promise<SkillsSandbox>;
|
|
|
|
// Every skills command runs against the real desktop handlers over a temp bundle
|
|
// and temp user data, so the assertions cover persistence and convergence, not a
|
|
// browser stand-in for them.
|
|
const test = base.extend<{ startSkills: StartSkills }>({
|
|
startSkills: async ({ page }, provide) => {
|
|
const sandboxes: SkillsSandbox[] = [];
|
|
await provide(async (setup = {}) => {
|
|
const { confirmRemoval, ...options } = setup;
|
|
const sandbox = await createSkillsSandbox(options);
|
|
await injectDesktopBridge(page, {
|
|
serverId: getServerId(),
|
|
confirmShouldAccept: confirmRemoval ?? false,
|
|
});
|
|
await serveRealSkillsCommands(page, sandbox);
|
|
sandboxes.push(sandbox);
|
|
return sandbox;
|
|
});
|
|
for (const sandbox of sandboxes) {
|
|
await sandbox.cleanup();
|
|
}
|
|
},
|
|
});
|
|
|
|
test.describe("Choosing installed skills", () => {
|
|
test("installs only the skills selected in Settings", async ({ page, startSkills }) => {
|
|
const skills = await startSkills();
|
|
await gotoAppShell(page);
|
|
await openSkillsIntegrations(page);
|
|
|
|
await openSkillSelection(page);
|
|
await chooseCustomSkills(page, ["paseo", "paseo-loop"]);
|
|
await saveSkillSelection(page);
|
|
|
|
await expectSkillsInstalled(skills, ["paseo", "paseo-loop"]);
|
|
await expectSelectedSkills(page, ["paseo", "paseo-loop"]);
|
|
});
|
|
|
|
test("all skills includes every available skill", async ({ page, startSkills }) => {
|
|
const skills = await startSkills();
|
|
await gotoAppShell(page);
|
|
await openSkillsIntegrations(page);
|
|
await openSkillSelection(page);
|
|
await chooseCustomSkills(page, ["paseo"]);
|
|
await saveSkillSelection(page);
|
|
|
|
await openSkillSelection(page);
|
|
await chooseAllSkills(page);
|
|
await saveSkillSelection(page);
|
|
|
|
await expectSkillsInstalled(skills, skills.bundledSkills);
|
|
await expectAllSkillsSelected(page);
|
|
});
|
|
|
|
test("cancelling leaves the installed skills untouched", async ({ page, startSkills }) => {
|
|
const skills = await startSkills();
|
|
await gotoAppShell(page);
|
|
await openSkillsIntegrations(page);
|
|
await openSkillSelection(page);
|
|
await chooseCustomSkills(page, ["paseo"]);
|
|
await saveSkillSelection(page);
|
|
|
|
await openSkillSelection(page);
|
|
await toggleSkill(page, "paseo-loop");
|
|
await cancelSkillSelection(page);
|
|
|
|
await expectSkillsInstalled(skills, ["paseo"]);
|
|
await expectSelectedSkills(page, ["paseo"]);
|
|
});
|
|
|
|
test("a failed save keeps the sheet open with an error", async ({ page, startSkills }) => {
|
|
const skills = await startSkills({ blockAgentsDir: true });
|
|
await gotoAppShell(page);
|
|
await openSkillsIntegrations(page);
|
|
|
|
await openSkillSelection(page);
|
|
await chooseCustomSkills(page, ["paseo"]);
|
|
await saveSkillSelection(page);
|
|
|
|
await expectSaveErrorKeepsSheetOpen(page);
|
|
await expectSkillsInstalled(skills, []);
|
|
});
|
|
|
|
test("an empty selection does not offer an Install action that cannot install anything", async ({
|
|
page,
|
|
startSkills,
|
|
}) => {
|
|
await startSkills({ installed: { mode: "all" }, confirmRemoval: true });
|
|
await gotoAppShell(page);
|
|
await openSkillsIntegrations(page);
|
|
|
|
await openSkillSelection(page);
|
|
await chooseCustomSkills(page, []);
|
|
await saveSkillSelection(page);
|
|
|
|
// The remaining Install action belongs to the command-line integration.
|
|
await expect(page.getByRole("button", { name: "Install", exact: true })).toHaveCount(1);
|
|
await expect(page.getByRole("button", { name: "Choose skills", exact: true })).toBeVisible();
|
|
});
|
|
|
|
test("a selection containing only retired skills does not offer a no-op Install", async ({
|
|
page,
|
|
startSkills,
|
|
}) => {
|
|
await startSkills({ installed: { mode: "custom", skills: ["retired-skill"] } });
|
|
await gotoAppShell(page);
|
|
await openSkillsIntegrations(page);
|
|
|
|
// The remaining Install action belongs to the command-line integration.
|
|
await expect(page.getByRole("button", { name: "Install", exact: true })).toHaveCount(1);
|
|
await expect(page.getByRole("button", { name: "Choose skills", exact: true })).toBeVisible();
|
|
});
|
|
|
|
test("an empty bundled catalog does not offer a no-op Install", async ({ page, startSkills }) => {
|
|
await startSkills({ bundledSkills: [] });
|
|
await gotoAppShell(page);
|
|
await openSkillsIntegrations(page);
|
|
|
|
// The remaining Install action belongs to the command-line integration.
|
|
await expect(page.getByRole("button", { name: "Install", exact: true })).toHaveCount(1);
|
|
await expect(page.getByRole("button", { name: "Choose skills", exact: true })).toBeVisible();
|
|
});
|
|
|
|
test("cannot dismiss the sheet while Save is pending", async ({ page, startSkills }) => {
|
|
const skills = await startSkills({ holdSave: true });
|
|
await gotoAppShell(page);
|
|
await openSkillsIntegrations(page);
|
|
await openSkillSelection(page);
|
|
await chooseCustomSkills(page, ["paseo"]);
|
|
|
|
await saveSkillSelection(page);
|
|
await skills.waitForHeldSave();
|
|
await page.keyboard.press("Escape");
|
|
await expectSkillSelectionOpen(page);
|
|
|
|
skills.releaseHeldSave();
|
|
await expect(page.getByRole("switch", { name: "All skills", exact: true })).toHaveCount(0);
|
|
});
|
|
});
|
|
|
|
test.describe("Removing an installed skill", () => {
|
|
test("delete-only drift stays in Choose skills instead of Update", async ({
|
|
page,
|
|
startSkills,
|
|
}) => {
|
|
await startSkills({
|
|
installed: { mode: "custom", skills: ["paseo"] },
|
|
placeOnDisk: {
|
|
skill: "paseo-loop",
|
|
target: "claude",
|
|
files: { "SKILL.md": "# paseo-loop\n", "notes/mine.md": "my notes" },
|
|
},
|
|
});
|
|
await gotoAppShell(page);
|
|
await openSkillsIntegrations(page);
|
|
|
|
await expect(page.getByText("Update available", { exact: true })).toHaveCount(0);
|
|
await expect(page.getByRole("button", { name: "Update", exact: true })).toHaveCount(0);
|
|
await expect(page.getByRole("button", { name: "Choose skills", exact: true })).toBeVisible();
|
|
});
|
|
|
|
test("warns before deleting the skill folders", async ({ page, startSkills }) => {
|
|
const skills = await startSkills({ installed: { mode: "all" }, confirmRemoval: false });
|
|
await gotoAppShell(page);
|
|
await openSkillsIntegrations(page);
|
|
|
|
await openSkillSelection(page);
|
|
await chooseCustomSkills(page, ["paseo", "paseo-advisor"]);
|
|
await saveSkillSelection(page);
|
|
|
|
await expectRemovalWarning(page, ["paseo-loop"]);
|
|
await expectSkillSelectionOpen(page);
|
|
await expectSkillsInstalled(skills, skills.bundledSkills);
|
|
await expectSavedSkillSelection(skills, { mode: "all" });
|
|
});
|
|
|
|
test("confirming the warning removes the skill", async ({ page, startSkills }) => {
|
|
const skills = await startSkills({ installed: { mode: "all" }, confirmRemoval: true });
|
|
await gotoAppShell(page);
|
|
await openSkillsIntegrations(page);
|
|
|
|
await openSkillSelection(page);
|
|
await chooseCustomSkills(page, ["paseo", "paseo-advisor"]);
|
|
await saveSkillSelection(page);
|
|
|
|
await expectRemovalWarning(page, ["paseo-loop"]);
|
|
await expectSkillsInstalled(skills, ["paseo", "paseo-advisor"]);
|
|
await expectSelectedSkills(page, ["paseo", "paseo-advisor"]);
|
|
});
|
|
|
|
test("warns for a skill installed in only one agent directory", async ({ page, startSkills }) => {
|
|
const skills = await startSkills({
|
|
installed: { mode: "all" },
|
|
keepOnlyIn: { skill: "paseo-loop", target: "claude" },
|
|
confirmRemoval: false,
|
|
});
|
|
await gotoAppShell(page);
|
|
await openSkillsIntegrations(page);
|
|
|
|
await openSkillSelection(page);
|
|
await chooseCustomSkills(page, ["paseo", "paseo-advisor"]);
|
|
await saveSkillSelection(page);
|
|
|
|
await expectRemovalWarning(page, ["paseo-loop"]);
|
|
await expectSkillSelectionOpen(page);
|
|
await expectSkillPresentIn(skills, "claude", "paseo-loop");
|
|
await expectSavedSkillSelection(skills, { mode: "all" });
|
|
});
|
|
|
|
test("warns for a skill on disk that the saved selection never mentioned", async ({
|
|
page,
|
|
startSkills,
|
|
}) => {
|
|
// The committed preference excludes paseo-loop, but the directory is back —
|
|
// a manual reinstall or an external sync. Saving any edit deletes it.
|
|
const skills = await startSkills({
|
|
installed: { mode: "custom", skills: ["paseo"] },
|
|
placeOnDisk: {
|
|
skill: "paseo-loop",
|
|
target: "claude",
|
|
files: { "SKILL.md": "# paseo-loop\n", "notes/mine.md": "my notes" },
|
|
},
|
|
confirmRemoval: false,
|
|
});
|
|
await gotoAppShell(page);
|
|
await openSkillsIntegrations(page);
|
|
|
|
await openSkillSelection(page);
|
|
await toggleSkill(page, "paseo-advisor");
|
|
await saveSkillSelection(page);
|
|
|
|
await expectRemovalWarning(page, ["paseo-loop"]);
|
|
await expectSkillSelectionOpen(page);
|
|
await expectSkillFilePresent(skills, "claude", "paseo-loop", "notes/mine.md");
|
|
await expectSavedSkillSelection(skills, { mode: "custom", skills: ["paseo"] });
|
|
});
|
|
|
|
test("warns about a directory that appears after the sheet was opened", async ({
|
|
page,
|
|
startSkills,
|
|
}) => {
|
|
const skills = await startSkills({
|
|
installed: { mode: "custom", skills: ["paseo"] },
|
|
confirmRemoval: false,
|
|
});
|
|
await gotoAppShell(page);
|
|
await openSkillsIntegrations(page);
|
|
await openSkillSelection(page);
|
|
|
|
// Nothing to delete when the sheet opened; the host looks again at save time.
|
|
await skills.placeSkillOnDisk("paseo-loop", "claude");
|
|
await toggleSkill(page, "paseo-advisor");
|
|
await saveSkillSelection(page);
|
|
|
|
await expectRemovalWarning(page, ["paseo-loop"]);
|
|
await expectSkillSelectionOpen(page);
|
|
await expectSkillPresentIn(skills, "claude", "paseo-loop");
|
|
await expectSavedSkillSelection(skills, { mode: "custom", skills: ["paseo"] });
|
|
});
|
|
|
|
test("keeps draft choices when fresher status arrives while the sheet is open", async ({
|
|
page,
|
|
startSkills,
|
|
}) => {
|
|
const skills = await startSkills({ installed: { mode: "all" }, confirmRemoval: false });
|
|
await gotoAppShell(page);
|
|
await openSkillsIntegrations(page);
|
|
await openSkillSelection(page);
|
|
await chooseCustomSkills(page, ["paseo", "paseo-advisor"]);
|
|
|
|
// Another window commits a different selection. Saving picks that up, so the
|
|
// sheet is handed a selection it did not start from while an edit is open.
|
|
await skills.commitSelectionExternally({ mode: "custom", skills: ["paseo", "paseo-loop"] }, [
|
|
"paseo-advisor",
|
|
]);
|
|
await saveSkillSelection(page);
|
|
await expectRemovalWarning(page, ["paseo-loop"]);
|
|
|
|
await expectSkillChoices(page, ["paseo", "paseo-advisor"]);
|
|
});
|
|
|
|
test("adding a skill saves without a warning", async ({ page, startSkills }) => {
|
|
const skills = await startSkills({
|
|
installed: { mode: "custom", skills: ["paseo"] },
|
|
confirmRemoval: false,
|
|
});
|
|
await gotoAppShell(page);
|
|
await openSkillsIntegrations(page);
|
|
|
|
await openSkillSelection(page);
|
|
await toggleSkill(page, "paseo-loop");
|
|
await saveSkillSelection(page);
|
|
|
|
await expectSkillsInstalled(skills, ["paseo", "paseo-loop"]);
|
|
await expectNoRemovalWarning(page);
|
|
});
|
|
});
|