Files
yetone 6a0afc38a9 library: a skill can be removed with no copy kept in the backups (Eternalfate__ on X)
Removing a skill always moved its folder to ~/.magpie/backups/<time>/,
and backups that hold skills are never pruned, so they piled up. The
sheet that asks first now has one tick under what it says, "Keep a copy
in magpie's backups", ticked unless the reader unticked it last time
(localStorage magpie.libSkillBackup). Unticked, the sheet says the
folder is deleted and Remove posts noBackup: true. The default is
unchanged.

What is deleted is only magpie's own folder for the skill, or an
agent's own skill folder. Never deleted, either way:
- a folder a library skill links to (~/.agents/skills or anywhere
  else): only the link goes, and there's no tick on its sheet;
- an entry in ~/.agents/skills, which other tools read too: it still
  goes to the backups (inSharedDir), and the sheet has no tick for it;
- a skill brought in from the agents: it still goes back to them;
- a link inside a skill's folder: RemoveAll takes the link, not its
  target.

Every path that removes skills:
- GUI: one skill, Remove all / Remove n, Remove gone, an agent's own
  skill and several of them (skills/remove, remove-all, remove-gone,
  remove-found, remove-found-some take noBackup);
- CLI: magpie library skill rm <name> --no-backup, and --no-backup on
  rm --all and rm --gone, whose prompt says so;
- TUI: d asks, then D deletes with no backup (d d still keeps a copy);
  the first d's flash says so, on rows with a folder to delete.
library: RemoveSkillsHow, RemoveFoundSkillsHow, RemoveGoneSkillsHow
(keep bool); RemoveSkill(s) and RemoveFoundSkill(s) keep a copy as
before.

The sheets with the tick say they hold nothing to lose (modal.dirty
false): toggling it made Cancel ask to discard changes. A page reload
with such a sheet open still reads the form as changed (beforeunload
reads the core's modalFormDirty); not changed here.

Existing backups stay where they are, in ~/.magpie/backups/<time>/skills
and <time>/<agent>/skills. Nothing clears them; the Library's Backups
button opens the folder. docs/subsystems/library.md says so.

Run (mote, this tree at base 9494a38b4; rebased onto 848e3b1b2, whose two
commits since touch only internal/gateway):
- new tests: TestRemoveSkillWithoutBackup, TestRemoveFoundSkillWithout-
  Backup (library), TestLibrarySkillRmNoBackup (cli),
  TestLibraryDeleteWithoutBackup (tui): ok.
- broken by hand: with keep forced true in RemoveSkillsHow and
  RemoveFoundSkillsHow, all four are red (folders found in the backups);
  with the inSharedDir guard taken out, TestRemoveFoundSkillWithoutBackup
  is red (the shared entry deleted, not backed up).
- go test ./internal/library ./internal/cli ./internal/tui ./internal/gui
  -timeout 45m: library, cli, tui ok. gui: TestBuiltinsTranslated (#7257)
  and TestSettingsSaveKeepsWhatItDoesNotSend (#7240) red, the same at
  origin/main 9494a38b4 without this change.
- gofmt -l: nothing. GOOS=linux go vet -tags nogui and GOOS=windows go
  vet of those four packages: ok.
- GUI, chromium and webkit: skill-remove-nobackup (new: en, zh, zh-TW, ja,
  de at 980 and 440px; tick, its text, the choice remembered, the post,
  no tick for linked or shared skills, nothing sideways), i18n-keys,
  i18n-en-no-cjk and the 27 files that remove skills or read these
  sheets' lines. Red: the new file's Cancel (the dirty-form ask above,
  fixed and green after), and api-key-theme (#6444),
  found-skill-pick-remove at 420px (#5013), saved-signedout-remove
  (#6666): those 18 the same at origin/main 9494a38b4.

Not run: the full go test ./... and the whole GUI suite. mote and mica
were both taken by other sessions' full suites for over an hour. No
guard test outside the packages run reads the files changed (grep for
docs/subsystems/library.md and plugins/library). Not tried in the real
app or on Windows or Linux; a Windows junction to a skill folder goes
through the same linked() branch as on macOS.
2026-11-20 14:59:04 +08:00
..