11 Commits
Author SHA1 Message Date
Willie 36a314442b refactor(server): decode JSON request bodies through one size-limited helper
About 57 handlers decoded request bodies with no size limit, and the few
that had one each picked their own. They now go through decodeJSON with a
1 MiB default; handlers that need more keep their larger limit. An
oversized body gets 413 instead of whatever the handler returned for bad
JSON (MCP and plugin requests used to answer 400). Every other decode
error keeps the handler's existing status and message.
2026-09-30 02:25:42 +08:00
Willie 00f51adbda feat(extras): create and manage single-file extras from the CLI and dashboard
Single-file extras (file + per-target as) already worked in the sync
engine, but the only way to create one was editing config.yaml or the
dashboard's AGENTS.md tab, so they looked like an AGENTS.md-only feature.
Syncing a file such as Pi's APPEND_SYSTEM.md required hand-written config.

- extras init gains --file and --as; the init TUI asks Folder or Single
  file. Validation runs before anything is written, and init neither
  creates the source file nor syncs.
- extras list and add-target show the full source and target file paths.
- POST /api/extras accepts file and per-target as, with the same
  connection checks as add-target.
- The dashboard's first Extras tab becomes "Folders & files" and lists
  every extra except AGENTS.md files; Add extra can create a single file
  with a per-target file name.
- Assigning shared AGENTS.md files now only attaches or detaches AGENTS.md
  extras. Before, saving on the AGENTS.md tab restored and removed any
  other single-file extra linked to the same instruction file.

Refs #300
2026-09-29 00:27:48 +08:00
Willie 342fac7691 feat(server): serve shared files and their locations in project mode
In a project, single-file extras were only reachable through the folder
extras API, which has no file name, no import mode and no immediate
sync. The dashboard now shows them on the AGENTS.md tab like global
shared files, so the instructions routes it needs must work in project
mode: list, create, content, resolve and the locations routes.

A project location must stay inside the project (absolute, ~ and ..
paths are refused with instructions_location_outside_project) and is
stored relative, so a clone keeps working. A tool's own file is a valid
location in a project, so the is_target check is skipped there.

Refs #299
2026-09-28 18:40:15 +08:00
Willie 0bbcbd7d54 fix(server): settle and roll back instruction locations
A location whose file was edited outside skillshare had no way to collect
or reapply, and a location whose config save failed stayed written on
disk. Resolve now takes a location path, and a failed save restores
what the file held; a failed reload keeps the saved location.

Refs #299
2026-09-28 17:41:33 +08:00
Willie 04485099ed feat(server): add locations API for shared instruction files
The dashboard could only attach a shared AGENTS.md to known tools, while
the CLI's --add-target/--as already writes it to any folder under any
name. Add list/add/mode/remove/restore-preview routes for such locations,
syncing a new location right away and refusing folders in the way, tool
files and files held by another shared file. The extras add-target route
now accepts as and runs the same config validation as the CLI.

Refs #299
2026-09-28 17:30:41 +08:00
Willie 7baf716c63 feat(instructions): translate dashboard warnings and errors
Mode changes, attach and the other AGENTS.md actions returned English
sentences, so a zh-TW dashboard showed "backed up ... before replacing
it" and "... is a directory" untranslated. Warnings are now
{code, params, message} and every instructions error carries a code,
so the dashboard shows them from i18n and falls back to the English
message for unknown codes. CLI output is unchanged.

Also from the Windows re-test:
- replacing a user's junction says so and where it pointed;
- status, doctor and sync agree on identical unowned copies (kept, not
  linked), and an identical copy no longer suggests --force;
- the targets list shows a Developer Mode tooltip when file links are
  unavailable;
- file names are taken from Windows paths too.

Refs #299
2026-09-28 16:12:59 +08:00
Willie 87e6cc9538 fix(extras): guard shared-file ownership and keep user files on restore
Exploratory CLI, dashboard and real-Windows testing of single-file extras
found paths that corrupted another shared file, lost user content, or
reported the wrong state.

- One shared file per link/copy target is now enforced in config
  validation, so the CLI, sync and API all refuse it; an import is never
  written through a link into another shared file (409
  instructions_target_held in the API).
- Restore recreates an original Windows junction as a junction, which
  needs no privilege, and remove restores before saving config so a
  failed restore no longer orphans the record.
- Imports into dotfiles links, damaged managed blocks, repointed links
  and CRLF files keep the user's content; project imports use paths
  relative to the file so a moved repo keeps working.
- Mode and assign responses carry sync warnings; dry-run says when an
  edit would be backed up; invalid modes no longer show as healthy.
- An edited copy reports modified, identical unowned copies count as
  synced without being owned, and relative project links no longer show
  drift.
- sync extras --json exits non-zero on errors; extras <name> --help
  works; --add-target gains --as; detach messages match behavior.

Refs #299
2026-09-28 15:27:02 +08:00
Willie c6ec545e96 feat(instructions): update copies when a shared file is saved
Saving a shared AGENTS.md in the dashboard only wrote the source, so every
target in copy mode (including the Windows copy fallback) kept the old
content until someone found the sync button. Saving now rewrites that
file's copy targets through the regular extras sync, so an edited copy is
still backed up first, and the toast names the copies it updated. Link and
import targets already read the source and are left alone.

Refs #299
2026-09-28 14:08:46 +08:00
Willie 88f5201911 feat(instructions): choose sync modes, preview restores, and move files
The AGENTS.md tab picked each target's mode for the user (import where
supported, a link elsewhere), which left Windows users without Developer
Mode no way out of a broken link and gave no copy option. Restore replaced
a file without showing what would come back, and only custom tools could
change which file a target reads.

- Each connected target gets a mode picker (import, symlink, copy); symlink
  is unavailable when the machine cannot create file links, and a target
  whose file is a folder link says so.
- Restore opens a preview of the file after restore and its diff.
- Every supported target can change its file location and name in a
  dialog, with reset to default.
- The target file tab is a single column with the read order on one line,
  a tinted managed import block, soft wrap, and an edit/preview switch;
  universal lists the files of the tools that read its skills.
- The convert dialog shows only the methods that apply and a ready preview.

Refs #299
2026-09-28 13:55:51 +08:00
Willie ad3d84b76a feat(instructions): manage the files of tools that read universal's skills
With only universal configured, tools such as Codex, Gemini CLI and Pi
still read skills from ~/.agents/skills, but none of them reads
~/.agents/AGENTS.md, and their own instruction files had no page and
could not take a shared AGENTS.md. Universal's AGENTS.md tab now offers
the installed ones in a dropdown, and the shared AGENTS.md list includes
them. A tool is listed once per file and disappears when it becomes a
target of its own.

Cline and the Warp Agent CLI read ~/.agents/AGENTS.md itself, per their
docs, so they now share universal's file.
2026-09-28 01:36:42 +08:00
Willie b8291895e1 feat(ui): share one AGENTS.md across tools from the dashboard
Claude Code now reads AGENTS.md, but every tool still keeps its standing
instructions in its own file (CLAUDE.md, GEMINI.md, AGENTS.md), and Claude
has no user-level AGENTS.md at all. Keeping several tools on the same
instructions meant copying text between those files by hand.

Each target page gets a tab named after the file it reads, with its read
order, an editor, and a convert flow from CLAUDE.md to AGENTS.md. In global
mode the Extras page gets an AGENTS.md tab where several shared files can
coexist and each target picks one or keeps its own. Shared files are
single-file extras: tools that follow @imports get a managed import block
and keep their own lines, others get a link in place of their file.
Projects get small shims instead, since every tool there reads ./AGENTS.md.
Custom targets can declare which file they read.

Restore records the target's state when it is first attached (file,
symlink, or no file) and always returns to it. Edits made after attaching
are kept as drift backups instead of becoming the restore point, so sync,
reapply and mode switches can no longer lose the user's original file.
2026-09-27 03:02:51 +08:00