Commit Graph
167 Commits
Author SHA1 Message Date
Willie 98300a2eec fix(install): recognize gitdir files as checkouts
Followed worktrees and submodules were discovered as tracked repos but bypassed guards that required a .git directory. Widen IsGitRepo to accept a directory or regular gitdir file and reuse it in discovery and reconciliation. All existing callers classify checkouts or run Git commands; none requires the directory layout, so a separate predicate would retain inconsistent decisions.

Exercise actual followed worktrees in CLI and dashboard update fixtures, including project mode and force retries, and document that they receive the same checkout guards.
2026-10-05 21:53:12 +08:00
Willie df7a6ad73d fix(sourcewalk): preserve inventory on followed traversal failures
Discovery callbacks may ignore filesystem errors after a followed target passes its availability probe. Record these failures in the shared Follow policy before dispatching callbacks so sync and reconciliation preserve entries missing from an incomplete inventory.

Keep ordinary vanished-child races tolerated, while treating loss of the target itself as unavailable. Cover both walkers and merge/copy pruning, and document read failures in the English and translated configuration guidance.
2026-10-05 20:46:45 +08:00
Willie 3b898f3730 Merge branch 'main' into runkids/274-follow-source-links 2026-10-05 16:11:45 +08:00
Willie 8879d445ab fix(status): require a source fingerprint for extension outputs (#416)
Extension outputs were matched to an agent by stem alone. A plain copy
that sync tracked before the target enabled an extension (reviewer.md)
passed for the converted output, so status, doctor, diff and the Sync tab
reported the target in sync while the next sync would write reviewer.toml
and prune the copy.

Only a transform records a source fingerprint, so an output without one
is no longer counted as converted. Outputs written before fingerprints
existed (before 0.24.5) show as pending until the next sync, which is
what they were already reported as before #392.

Refs #415
2026-10-05 15:51:40 +08:00
Willie d6162baba0 fix(sourcewalk): resolve junction chains and compare canonical roots
canonicalPath relied on filepath.EvalSymlinks, which since Go 1.23 leaves
a Windows junction component in place. A link whose target is itself a
junction, or sits below one, was followed as the unresolved junction:
the walk saw no descendants while the inventory counted as complete, so
target entries from that link could be pruned, and a sync target spelled
through a junction could evade the overlap guard. Every existing path
component is now resolved hop by hop, and a target that still ends in a
link marks the link unavailable instead of being followed.

The policy also kept the source root as spelled, so a relative global
source was discovered but never resolved for writes or audit. Root,
first-level and Resolve comparisons now use the same canonical absolute
form. Copy and checksum roots get the same one-hop resolution so a
followed junction that is itself a skill no longer trips the cycle guard.
2026-10-05 15:40:51 +08:00
Willie c9e532a66f fix(source-links): use the server's follow snapshot for collect and keep Windows link text logical
The project dashboard builds a synthetic global config without
follow_source_links, so the collect handler read a zero policy and a
forced collect could replace a followed source link with the target
copy. The per-instance snapshot already knows the project setting.

On Windows the absolute link fallback (junctions, or symlinks without
Developer Mode) canonicalized the source root even with the key off. A
source root that is itself a directory symlink then no longer matched
the logical path that status, prune and merge ownership compare
against, so every sync reported a conflict or recreated every link.
Store the logical path as main did; only relative links need the
canonical root.
2026-10-05 15:40:51 +08:00
Willie 72ed5ba0fb fix(diff): compare extension agent outputs and apply target filters (#414)
* fix(diff): compare extension agent outputs and apply target filters

#392 taught status and doctor to recognise converted extension outputs,
but diff (CLI) and the Sync tab (/api/diff) still compared the target
directory's *.md files against the source name. A target whose extension
renames the output (codex -> .toml) therefore listed every agent as
pending after a sync.

Both diff paths now use the same manifest-based check as status, and
report tracked outputs whose source is gone as prune items. They also
apply the target's include/exclude and the agents' frontmatter targets,
so an agent that sync would skip is no longer shown as pending.

Refs #391

* chore(release): request 0.24.6

The pending feat commits would make Release Please propose 0.25.0. This
batch is meant to ship as the 0.24.6 patch, so ask for that version.

Release-As: 0.24.6
2026-10-05 15:40:19 +08:00
Willie 6bc41d29ec fix(sync): preserve logical identity of followed source links
Keep the canonical skills source root and logical relative tail when creating or reformatting project links, including Windows relative links and junction fallback. Shared agent and extra links retain full canonicalization, and global Unix link text stays unchanged.

Allow group walks outside the source only for an enabled first-level link validated by Follow.Resolve, remapping children to logical paths and metadata keys while retaining nested-link guards and root-skipping semantics. Resolve copy and checksum operation roots before walking to avoid false cycles, and preserve followed source links during forced collect with per-item warnings.

Regression coverage verifies second-sync ownership, status, prune, unlink, format changes, linked-root copying, group guards, and forced collect preservation. Linux build, vet, sync and command tests, sourcewalk ratchet, server collect tests, context validation, and Windows cross-build passed; Windows runtime was not verified. No new raw-walk allowance was needed.
2026-10-05 14:45:58 +08:00
Willie 89fc4fbdf1 feat(sourcewalk): follow first-level source links when enabled
Users link a checkout directly under the skills source (e.g.
skills/_dev-skills -> ~/code/dev-skills) and expect it to behave like any
other first-level entry. sourcewalk resolved only the root, so these links
were invisible to discovery, sync, update, and the dashboard.

follow_source_links (global and project config, default false) enables a
per-operation sourcewalk.Follow policy. Walk, WalkDir, and ReadDir report a
followed link under its own name as a directory and descend into its
target, so names, RelPath, FlatName, SourcePath, tracked-repo detection, and
metadata keys stay logical. Only entries directly under the source root are
followed. The policy is built from config and passed explicitly to every
discovery caller in the CLI, server, and reconcile, so counts agree; the
server keeps a per-instance snapshot refreshed on config load and save
instead of a process-global flag.

A link is skipped, with one warning per operation, when its target is
missing or unreadable, is the source or a parent of it, or overlaps an
active skills target. A missing or unreadable target marks the operation
incomplete: sync then skips pruning and copy-orphan deletion, and reconcile
keeps metadata, so an unmounted drive or a re-clone in progress cannot
erase target entries or install records. A link to an existing file is not
a directory link and stays an ordinary entry; treating it as incomplete
would disable pruning for anyone sharing a file such as .skillignore.

doctor keeps raw link identity: with the key off it still says the link is
not followed and names follow_source_links: true; with it on it reports
followed links and skipped links with the reason.

The raw-walk allowlist gains entries for the policy path in Walk and
WalkDir: the source root walk with a policy, and the walk of a validated
link target whose paths are remapped to the logical link path. Both live
in sourcewalk itself, the package that owns source traversal.

Refs #274
2026-10-05 14:26:09 +08:00
Willie c43bb763f9 fix(status): count one extension output per agent
Two agents that flatten to the same name matched the same manifest entry
and were both counted, so status could report 2/2 with one output on
disk. Each manifest key now satisfies one agent.

Refs Codex review on #392.
2026-10-04 20:01:51 +08:00
Willie 51a3be1ca6 fix(status): report drift when an extension agent's source changed
Counting an extension output as synced from its output hash alone missed
the common case: the user edits the agent in the source and runs status
to see whether a sync is due. The output still matched the manifest, so
status, doctor and the dashboard reported no drift although the next
sync would regenerate it.

Sync now records a SHA-256 of the source each output was converted from
in the manifest (sources), and status counts an output only when both
the output and that fingerprint are current. Outputs recorded by earlier
releases have no fingerprint and count as current until the next sync
records one, so upgrading does not show the 0/N the report was about.

Refs #391, Codex review on #392.
2026-10-04 19:49:29 +08:00
Willie f403ea5a6f fix(status): count extension-converted agents as synced
An agent target with an extension writes each agent under output_ext
(reviewer.toml) with transformed content, and the manifest tracks that
output name. status, doctor and the dashboard's Sync tab counted synced
agents by looking for the source name and comparing with the source
content, so every converted agent was missing: status showed 0/N with
drift, doctor said the same, and the Sync tab kept them pending after a
successful sync.

For an extension target, count an agent as synced when the manifest
tracks an output with the same stem and that file still matches its
recorded hash. Matching by stem avoids loading the extension spec in
status paths. doctor keeps reporting leftover broken links for these
targets.

Refs #391
2026-10-04 19:33:50 +08:00
Willie 881d08e52e fix(sync): skip nested target dotdirs when discovering source skills
Installing a repo whose root is a skill copies the whole repo into the
source, including any .claude/skills/ the author keeps for their own
development. Install discovery already skips target dotdirs, but the
source walk used by sync, check, and the dashboard only skipped .git,
so those dev-only skills surfaced as nested skills and were synced to
every target.

Share the skip set through sourcewalk and apply it in both source
walks. Only dotdirs nested below the source root are skipped: host-style
paths directly under the root (.cursor/skills/*) stay visible because
they drive target inference.
2026-10-04 17:11:53 +08:00
Willie 8c60f51b9f feat(source): add the sourcewalk walker and sourcefs write boundary for proposal 274 (#385)
Implements rollout steps 1 and 2 of proposals/274-skillfollow.md. Nothing follows a link or parses .skillfollow yet.

Step 1: doctor reports first-level symlinks and junctions in the skills source as info, in text and JSON, without following them.

Step 2a: internal/sourcewalk owns traversal of the skills source. Thirteen raw walks move onto it with identical behavior, and a go/parser ratchet fails the tests on any new unclassified walk.

Step 2b: internal/sourcefs wraps an os.Root opened at the skills source and refuses any write whose path has a link component. The six write sites the proposal found in review move onto it, including the cross-device copy fallback, and a second ratchet covers raw os write calls. The only behavior change is that an explicit path crossing a link inside the source is refused instead of written through.

Refs #274

Release-As: 0.24.3
2026-10-04 15:15:43 +08:00
Willie d78e7ce09a feat(cli): redesign init and give every command one output style (#360)
* fix(install): omit the empty audit section in dry-run

A dry-run skips the security audit, yet the single-skill path still printed
the "Audit Findings" heading with nothing under it, which reads as if the
audit ran and found an empty result.

* feat(init): ask first, confirm a summary, then write

The old init asked nine questions in three input styles and wrote files as
it went, so cancelling midway left a half-built setup, and detection created
tool folders even under --dry-run. Connecting a second machine to an
existing repo was only offered at the very end, and the built-in skill
defaulted to "no", which read as "not recommended" (#200).

init now collects every answer into a plan, shows a summary with Yes /
Change settings / Cancel, and writes nothing until confirmed. Esc cancels
cleanly. A "Connect my existing skillshare repo" path checks the repo
before writing, detects its layout, prefers the repo version of same-name
skills and keeps local-only ones for the next push. The built-in skill is
installed by default, and the first sync runs at the end so the tools work
right away. Prompts use one inline huh-based component with theme colors.

Without a terminal (CI, scripts, AI agents) init now applies the same
defaults as pressing Enter and prints each decision with the flag that
changes it, instead of silently doing less; init -p and --discover add the
detected tools. Output that is not a terminal is plain text.

BREAKING CHANGE: non-interactive `init` now enables git, installs the
built-in skill and selects every detected tool; pass --no-git, --no-skill,
--no-targets or --no-copy for the previous minimal setup. Piped or
redirected output no longer contains ANSI colors; use --json where offered
for machine-readable output.

Refs #200

* docs(init): show the new init flow and the connect-a-repo path

The getting-started page still described the old four-question wizard with
a screenshot of it, the second-machine guide never mentioned the new
"Connect my existing skillshare repo" choice, and the recipe told users to
run pull and sync after init even though init now does both.

Replace the screenshot with ones from the new flow, describe the questions,
summary and cancel behavior, and explain what connecting a repo does before
and after confirmation. The devcontainer example gains --no-git because
init without a terminal now turns git on by default.

Refs #200

* feat(devcontainer): seed fake tools and a repo with ssenv --seed

Trying init by hand needed several manual steps to fake installed AI tools
and a skills repo to connect. `ssenv create --seed` (and `ssnew --seed`)
now creates claude/codex/cursor directories with a few skills and a local
bare repo at ~/remote/skills.git, so both init paths can be tried at once.

Refs #200

* fix(ui): skip the logo on 16-color terminals and hide the cursor while it plays

`docker exec -it` sets only TERM=xterm, which reads as 16 colors: the logo
was mapped onto the terminal's own palette and its fade-in collapsed into a
few flickering cells. Below 256 colors the banner now prints only its text,
and the devcontainer sets COLORTERM=truecolor.

The visible cursor also jumped along the logo's left edge while frames
redrew in place. It is hidden during the animation and restored on exit,
including Ctrl+C.

Refs #200

* style(ui): color the question mark in prompts

The uncolored "?" before each question read like a stray character. It
now uses the accent color of the "›" cursor.

Refs #200

* fix(init): name the root git scope by what it versions

"everything" suggested plugins, MCP servers and hooks were versioned too,
but they live in config.yaml, which the root scope gitignores. The option
and summary now say "skills, agents, extras" and note that those settings
stay in each machine's config.yaml.

Refs #200

* feat(init): show --discover in the new init style

--discover still printed the old header, "agent(s)" counts and "+ name"
lists next to the new prompt. Global and project discover now share
init's answered rows (Tools, Config) and a Next line, and call the
targets "AI tools" as init's banner does.

Refs #200

* feat(init): replace the pixel logo with a SKILLSHARE wordmark

The half-block logo looked stretched on terminals with tall line height
and turned to mush when shrunk to fit. init now opens with a three-line
pixel wordmark, SKILL in blue and SHARE in gold, that lights up from left
to right, followed by the version and tagline on one dim line. The
generated logo data and its generator script are gone.

Without a terminal, without color, below 256 colors or on a narrow
terminal, the banner still prints a plain "skillshare vX" line.

Refs #200

* refactor(init): label the chosen tools "Targets"

init called them "Tools" while the rest of the CLI, the config file and
the `target` command call them targets. The answered rows and the summary
now say "Targets", the same label the other commands will use. Sentences
that describe what was detected ("Found 3 AI tools") stay as they are.

The docs tables, the First Sync steps and both init screenshots are
updated to match.

Refs #200

* feat(cli): ask yes/no questions with the inline prompt

uninstall, trash empty, extras remove, target add, collect, update,
upgrade and audit each printed their own "[y/N]:" line and parsed the
answer by hand, while init already used the inline Yes/No prompt. They
now share it: esc answers no, and a declined question prints one dim
"Cancelled. Nothing was …" line, as init's cancel now does too.

Without a terminal the prompt reads one line from stdin instead, so
piped answers such as `echo y | skillshare uninstall x` keep working.
It reads byte by byte so a second question still gets its own answer.

Refs #200

* feat(sync): report each target on one aligned row

Sync printed a ruled header, a "Backing up" block and a "name: merged
(43 linked, 0 local, 0 updated, 0 pruned)" line per target, so the
counts that changed were hard to find among zeros. It now follows the
init style: one row per target with only the non-zero counts, a single
Backup row, and a closing line with the duration. `sync --all` names
its Skills, Agents and Extras blocks and no longer explains how to set
up extras when none are configured.

The non-TTY text changes with it; `--json` stays the stable interface
for scripts. Tests match rows through the new AssertRowContains helper.

Refs #200

* feat(status): show targets as one table

Status printed each target as a header with indented skills and agents
lines full of bracketed modes and zero counts, and the audit policy as
four lines of uppercase labels. Comparing targets meant reading every
block. Each target is now one row with a skills and an agents column,
a single line names the modes in use, and audit and version take one
line each. Global and project mode share the renderer, so project
paths read relative to the project root.

Refs #200

* feat(install): report each step on one aligned row

Install printed a logo, a box-drawn tree, "Next Steps" bullets and a
separate "Audit Findings" block, so the result was hard to find. It now
uses the same rows as sync and status: Source, Audit and Install with
the destination folded to ~, then a closing line and a Next block.

Spinners write through a gate that Stop closes before clearing the line.
pterm's render goroutine checks IsActive and then writes, so a fast step
such as install --dry-run left "Copying files..." stuck in front of the
next line.

Refs #200

* feat(uninstall): confirm against one line and point at undo

Uninstall opened with a boxed header and Name/Path lines, and closed
with the trash folder path and a "Next Steps" bullet. Now one line names
the target, its folder and what it holds; the result is a single
"Uninstall x → trash, kept 7 days" row; and Next offers sync, the trash
restore command that undoes it, and the reinstall command when the
skill came from a remote source.

A batch run with --force or --dry-run no longer lists the targets twice,
since there is no question for the list to support. Mixed batches are
counted as items, not targets, which already names the AI tools.

Refs #200

* feat(update): report each skill or repo on one Update row

Update opened with an "Updating" header, the full source path and a
"0 tracked repo(s), 1 skill(s)" line, then printed a Changes box and two
success lines before "Next Steps". A single update is now an Update row
(source or commit count, time), the commits it pulled in dim text, the
Audit row, and Next. A batch ends with the audit result and one closing
line that leaves out zero counts.

Progress bars now clear themselves when they stop, like spinners, so a
finished batch no longer leaves "[3/3] ... 100% Done" behind.

Refs #200

* feat(check): list what needs attention and close with one line

Check opened with a header, the full source path and an item count,
counted skills with updates without naming them, and ended with two
"Run ..." hints. It now prints one row per repo, skill or agent that
needs attention (behind, update available, stale, failed), a closing
line that leaves out zero counts, and the update command under Next. A
single-name check is one row, like update.

Refs #200

* feat(push,pull): report commit, push and pull as aligned rows

Push and pull opened with a header and closed with "Push complete" or
"Pull complete", so they never said what they committed, where they
pushed, or what a pull brought in. Push now prints a Commit row (file
count and message) and a Push row naming the upstream branch, never the
remote URL since it can carry credentials. Pull prints a Pull row with
the commit and file counts and the commits themselves, as update does
for a tracked repository, before the sync output. Dry runs list the
changed files as ~ + - instead of raw porcelain codes, and error hints
are dim notes instead of info lines.

Refs #200

* feat(upgrade): report the CLI and the skill on one row each

Upgrade opened with the logo and printed a tree of steps per part
(current version, latest version, status) ending in "Already up to date
✓". Each part is now one row, such as "✓ CLI  v0.22.0 → v0.23.0 · 3.1s"
or "✓ Skill  v0.23.0, already up to date", with spinners that clear.
Sync is offered under Next only when the skill changed, and the star
request is a dim line at the end.

Refs #200

* feat(new): report the created skill on one row

New printed a "New Skill Created" header, the full path, and numbered
"Next steps" that told the user to edit the file and run sync. It now
prints "✓ Created  ~/…/SKILL.md", the folders a pattern added, and sync
under Next. A dry run shows the same row, a Preview section with the
template, and the dry-run line.

Refs #200

* feat(trash): list items and restores as aligned rows

The plain trash list printed each item as an info line with its size and
age in parentheses under a "Trash" header, and restore printed two
success/info lines plus a "Next Steps" label. The list is now rows of
name, size and age with one closing count, and restore is one row
naming where the item went back, with sync under Next. An item trashed
under a minute ago reads "just now" instead of "just now ago".

Refs #200

* feat(collect): list local items and results as aligned rows

Collect opened with a header, listed local items as "[target] path"
list items under a second header, then printed a third header before
the per-item results and a metric summary line. It now lists each local
item as a row (name, target, path), asks the inline confirm, prints one
row per result and closes with "Collected N skills" plus sync and,
when the source is a git repository, commit under Next.

Refs #200

* feat(hooks): show hooks and their changes as aligned rows

Hooks printed "Hooks source: <path>" as an info line, statuses through
the fixed-width Status helper, and results as sentences ending in
"Run 'skillshare hooks sync' when ready." Hooks and Agent file changes
are now rows, with conflicts marked as failures and inactive outputs as
warnings, saves and applies close with one line, and the next command
sits under Next. The list's "Pending sync" section no longer shows
entries that are already in place.

Refs #200

* feat(mcp): show servers, changes and checks as aligned rows

MCP printed "MCP source: <path>" as an info line, plan changes through
the fixed-width Status helper, results as sentences that named the next
command inline, and check summaries as "2 server(s) checked: 1
error(s)". Changes and parked servers are now rows with conflicts
marked as failures, saves and applies close with one line and Next, and
check marks each server with its findings beneath and closes with
"Checked 2 servers: 1 error". The Status helper had no callers left and
is removed.

Refs #200

* feat(plugin): show packages, plans and results as aligned rows

Plugin text output was raw "name · target · id · state" lines with
"Warning:", "Includes:" and "Revision:" prefixes, and the list walked a
map so packages came out in a different order each run. Packages,
discovered candidates, planned changes and results are now rows sorted
by name, marked by state (registered, not installed, pending, blocked,
failed), with details as dim notes and the dry-run line after a
preview. JSON output is unchanged.

Refs #200

* feat(audit): replace header and summary boxes with rows

Audit framed its context in a header box (mode, path, block rule,
policy), numbered batch results "[1/2]", printed per-skill verdicts as
"→ Aggregate risk / Block decision" lines, and closed with a Summary box
that listed every count including zeros. The context is now one title
line with a dim note, flagged skills are aligned rows with their highest
severity, the summary leaves out zero counts, and the run closes with
one line saying whether anything was blocked and by which severity,
followed by the command to see the first blocked skill's findings.

The progress bar no longer writes its final frame when stdout is not a
terminal; that frame had no newline and ran into the next line.

Refs #200

* feat(audit): show audit rules as aligned rows

The rules list was a fixed-width table framed by 90-character dividers
with a "(N rules: N enabled, N disabled)" footer, and rule changes were
sentences like "Set severity for X → HIGH". Rules are now rows keyed by
ID with a colored severity and the pattern dimmed, disabled rules dim
as a whole, the list closes with a count that names disabled rules only
when there are some, and each change is one row.

Refs #200

* feat(search): drop the logo and tree, show results as rows

Search opened with the ASCII logo, drew its progress as a ├─/└─ tree,
listed results under a column header with dividers, and ended installs
with "Run 'skillshare sync' to distribute to all targets". Results are
now aligned rows with the source, stars or risk, and the description
and tags beneath; a single install reports the same Install row as
`skillshare install`; batch installs list only failures before one Done
line; and sync and audit sit under Next. Login and rate-limit problems
name the command that fixes them. Non-terminal output no longer prints
a "name: installing..." line per skill.

Refs #200

* feat(backup): show backups and restores as rows with one closing line

Backup and restore opened with headers, announced dry runs with a
warning before doing anything, summarized with an operation box, and
followed a backup with a "Recent backups" list. Targets now back up in
name order as rows with folded paths, runs close with one Done line
(and Next restore), listings are rows keyed by timestamp or path with a
total, and dry runs end with the shared dry-run line. Cleanup reports
how many backups remain instead of a separate "Current" line.

Refs #200

* feat(help): one line per command, subcommands in each command's help

The top-level help opened with the ASCII logo and listed about 70 lines
across ten uppercase sections plus 15 examples, so it did not fit a
screen, yet it left out analyze and the common options. It now lists
each command once in six groups with the common options, and points to
`<command> --help` for subcommands. The mcp, plugin, hooks and extras
pages use the same layout and keep all their content.

A mistyped command prints one error with the closest command instead
of the whole help, a lone option such as --no-tui shows the help, and
`skillshare version` prints one line.

Refs #200

* feat(extras): show extras and their changes as rows with Next

Extras printed a header, "→ name" lines with ad-hoc colored marks
(including ✗ for targets that were only waiting for a sync), and ended
each change with a sentence naming the next command. The list now shows
each extra as a bold name over aligned target rows (! for drift or not
synced) and closes with a count and, when something is pending, Next
sync extras. Init, collect, add/remove target, mode and source changes
close with one Done line, details become notes, and dry-run collect
ends with the shared dry-run line.

Refs #200

* feat(target): show targets as sections and rows with Next

Target info and the plain list printed "Key:" lines at two indent
levels, with "(none)" for every unset filter, and remove printed
"Backing up" / "Unlinking" headers with one line per step. Info now
shows the name over Skills and Agents sections with aligned rows, the
list gives each target one row per resource with details dimmed, and
empty filters are left out. Remove reports one row per target (plus
its backups) and closes with a Done count; dry runs say what would
happen per target and end with the shared dry-run line. Skills on/off,
add and mode/naming/filter changes close with Done and Next.

Refs #200

* feat(doctor): report checks as aligned rows and end with Next

Doctor opened with the ASCII logo, split its report under divider
headers, mixed ✓/→/! lines with full paths and "(s)" counts, listed
targets in random map order, and ended with a bare warning count that
left the fix to scattered "Run:" hints. Checks now print as aligned
rows under bold sections (Environment, Targets, Extras, MCP/hooks/
plugins, Storage, Version), paths fold to ~, targets are sorted with
one row per resource, and the report closes with a Done line plus up
to three Next commands collected from the checks (sync, sync agents,
sync hooks, upgrade, ...). The --json output is unchanged.

Refs #200

* feat(hub): drop the logo and report hub changes with Done

hub index opened with the ASCII logo and a tree of spinner steps, then
repeated the result as "→ Mode / Skills / Output" lines with the full
path. It now shows one spinner that clears itself and a Done line
naming the folded output path, skill count and duration, with the
index contents as a note. hub list shows aligned rows with the default
and built-in hubs marked in dim text instead of a "*" column, and the
add, remove and default commands close with a Done line.

Refs #200

* test(install): match the shared dry-run line in online tests

The online-tagged install tests still looked for the old "dry-run"
banner, which install no longer prints since the restyle. They are
skipped by default, so the mismatch only showed under -tags online.

Refs #200

* fix(target): align remove rows on target names only

The label column was sized for "<name>-agents" so an agents backup
could fit, which left a wide gap on every row when no agents were
backed up. The agents backup row now uses the target name too and says
"agents backed up", so the column fits the names.

Refs #200

* fix(update): list each item in a batch dry run

A batch dry run only said "Would update N skills". Off a terminal the
names leaked out through the progress bar's title lines, but on a
terminal those lines clear, so the dry run never said which skills or
repos it would touch. It now prints one Update row per item, as the
single-item dry run does.

Refs #200

* fix(ui): keep the progress bar silent off a terminal

Off a terminal the bar printed "Title (0/N)", every title change and
every phase header as permanent lines, which a terminal shows only as
a frame that clears itself. Audit left a stale "Scanning skills (0/7)"
line, and scripts saw different content than a terminal. The bar now
prints nothing off a terminal, like the spinner.

Refs #200

* fix(audit): avoid a double blank line before Summary

The audit header ends with a blank line and Summary added its own, so
a clean scan with no result rows showed two blank lines in a row. The
Summary title no longer adds one; the result rows add it when present.

Refs #200

* fix(mcp): drop the blank line above "Saved the MCP source"

A save with no backup or migration notes printed a blank line with
nothing above it, so mcp add and mcp edit opened on an empty line.

Refs #200

* fix(doctor): stop repeating the extra's name in its findings

Extras findings printed "rules  rules → /home/me/.claude/rules: 1
file(s) out of sync": the row label already names the extra, the path
was not folded to ~, and the count used "file(s)". The rows now start
at the arrow, fold the path and pluralize the count. JSON details keep
the extra's name so each line still stands alone.

Refs #200

* fix(doctor): show integrity issues as rows under Integrity

Tampered skills and missing hashes printed as free "! Skill integrity:
N skill(s) ..." lines after the verified row, breaking the aligned
Environment rows. They now sit under a single Integrity row, which
turns to ! when any skill has an issue.

Refs #200

* fix(doctor): pluralize the Skillignore and Trash rows

The rows read "1 patterns, 1 skills ignored" and "1 item(s) (50 B),
oldest <1 day". They now read "1 pattern, 1 skill ignored" and "1 item,
50 B · oldest under a day". The JSON messages keep their wording, since
scripts may match on them.

Refs #200

* docs: show the restyled output of batch 3 commands

The reference pages still showed the old output of upgrade, new, trash,
collect, audit, search, backup, restore, extras, hub, target and doctor:
divider headers, arrow-prefixed lines and "(s)" plurals. The examples
now match what the commands print, in all five locales, and the doctor
check table uses the new row labels.

Refs #200

* feat(trash): let trash empty skip its confirmation with --force

Scripts had no way to empty the trash: off a terminal the confirmation
reads stdin and cancels on EOF. --force (-f) skips it, as it does for
uninstall and extras remove.

Refs #200

* fix(doctor): show source, link and target problems as rows

Missing sources, unsupported links, folders without SKILL.md, unknown
skill targets, bad include/exclude patterns and broken symlinks printed
as free "✗ Source not found: …" lines between the aligned rows. They
now use the row of the check they belong to, and broken symlinks or a
missing source add a Next suggestion.

Refs #200

* fix(ui): leave out durations that would read 0.0s

Fast commands ended with "· 0.0s", which says nothing. Every result line
now formats its time through ui.Took, which init already used for its
steps: durations under 0.05s are left out.

Refs #200

* fix(ui): print dev builds without a v prefix

Version labels were built as "v" + version everywhere, so a dev
build printed "vdev". VersionLabel adds the prefix only when the
version starts with a digit, and the logo, help header, version
command and upgrade output share it.

Refs #200

* fix: pluralize category and drop "just now ago"

The checklist status bar appended "s" to its item name and printed
"categorys". The trash TUI formatted ages with its own helper that
added "ago" after "just now". plural now handles consonant + y,
and the trash TUI uses the shared timeAgo, which makes formatAge
unused.

Refs #200

* fix(target): drop the parenthesized counts in the plain list

The plain target list printed "merged (43 shared, 0 local)" while
target info and doctor print "merged · 43 shared" with zero counts
left out. The sync summary now returns both forms from one scan, so
the TUI and --json keep their existing text and the plain list
matches the other commands.

Refs #200

* test(backup): make the agents backup test back something up

The test only synced agents, which become symlinks into the source
and are skipped by backup, so it passed without any backup being
written. It now adds a target-local agent and checks that the file
lands in the backup.

Refs #200

* refactor(cli): render every command's --help with printHelp

About forty help pages were hand-aligned raw strings with "Usage:",
"Options:" and "Examples:" headings, while hooks, mcp, plugin, extras
and the top-level help already used printHelp. They now share it, so
headings, option order (short flag first) and alignment match across
commands. Examples align on their own column so long commands no
longer push option descriptions to the right, and "--help, -h" rows
are dropped as on the converted pages.

Refs #200

* feat(enable): print enable and disable results as rows

enable/disable still used the old "Disabled: x (added to .skillignore)"
line plus a "Run skillshare sync" sentence. They now print one row per
pattern, a Next hint after a change, and the dry-run closing line,
like the other restyled commands.

Refs #200

* fix(sync): pluralize the leftover cleanup note

Project sync printed "Cleaned 1 leftover skill(s)". The note now
uses the singular or plural noun, and the sync docs show it as the
dim note it is instead of an arrow line.

Refs #200

* fix(cli): drop the arrow info lines left in install, update and sync

These commands were restyled, but about fifty messages still went
through ui.Info, which prints a leading arrow, and several said
"skill(s)" or "item(s)". Hints now print as dim notes, empty results
("No agents found") as closing lines, follow-up commands as Next,
and counts use the singular or plural noun.

Refs #200

* fix(cli): tidy small leftovers found in the recorded output

doctor printed "0 minutes ago" for a fresh backup and an ASCII arrow in
the Update row, unlike trash and upgrade, which say "just now" and
"v1.2.0 → v1.3.0". The "bring the Targets up to date" hint capitalized
a word mid-sentence, and search --list showed hub sources under the
home directory as a cut-off absolute path instead of folding it to ~.
JSON messages keep their wording.

Refs #200

* fix(search): fit a home-folded source path in the list

Folding the home directory to ~ was not enough: a typical local hub
path such as ~/.config/skillshare/skills/frontend/react is 42
characters, so the 40-character cap still cut it. Fifty characters
next to the 24-character name column stays within 80 columns.

Refs #200

* feat(list): print the plain list with rows and a closing count

The --no-tui list still used the old header with a divider and an arrow
on every skill, so it looked unlike every other restyled command. Skills
now line up in one column under their group, tracked repos use the
✓ / ! marks, and the list closes with a count split by tracked, remote
and local (zero counts left out). Project mode keeps its scope as a dim
"· project" after the title.

Global and project had copied the same plain-output code; both now call
printSkillList. The loading spinner clears itself instead of leaving a
"Loaded N skills" line.

Refs #200

* fix(cli): show help for subcommand --help instead of running it

target add/remove/list, trash list/empty and hub list/remove passed
--help through as an argument, so they ran the command, failed on a
target or hub named "--help", or rejected the flag. tui on --help even
switched the TUI on. Each now prints its command's help page.

The tui status and toggle lines also move to the row and Done style.

Refs #200

* feat(diff): print differences as rows and close with next steps

The plain diff still printed a Summary line, divider headers, arrow
hints and per-target "scanning" lines when output was not a terminal.
Each group of targets now lists one row per kind of change ("New  a,
b"), targets in sync share a single ✓ row, extras use the same rows,
and diff closes with a count and up to three commands. The suggested
sync command follows what differs: sync, sync agents, sync extras or
sync --all.

Agents no longer show as "New 1 skill", because rows name the change
rather than counting skills. "skillshare diff all", listed in the help,
failed with "target 'all' not found"; it now diffs everything, the
same as no argument.

Refs #200

* test: sync the install warning summary and gofmt two status tests

The "6 findings" wording changed in an earlier commit, but the unit
test under cmd/ still expected "6 finding(s)": scripts/test.sh and
make check only run ./internal and ./tests, so the cmd tests never ran.
Two status tests also had comment alignment gofmt rejects, which fails
make check's fmt-check.

Refs #200

* test: run the cmd unit tests in scripts/test.sh

CI runs go test ./cmd/skillshare/... ./internal/..., but the local
runner behind make test and make check only ran ./internal/..., so a
stale assertion in cmd/skillshare passed locally and would only fail
in CI.

Refs #200

* feat(cli): restyle commit and analyze output

commit and analyze were the last git and inspection commands still
printing the old header and table layouts. They now use the same rows,
Done line, and Next hints as push and pull, so a commit reads like the
commit row of push, and analyze shows each target group as a bold name
with aligned token rows instead of a boxed table.

Refs #200

* feat(log): show entries as rows and fold the log path

The plain log view still opened each section with a boxed header that
printed the absolute log path, then a TIME | CMD | STATUS table. Entries
now read like every other command: a status mark, the command, when it
ran and how long it took, with details indented beneath. The log path is
folded to ~ and moves to a dim footnote.

log --stats drops its divider and ends with one summary line. It and
the TUI stats panel said "just now ago" for a fresh entry; both now use
timeAgo, which already handles that case.

Refs #200

* feat(cli): restyle completion, ui and leftover arrow lines

completion --install, ui start/stop and a few notices still printed
arrow info lines with absolute paths. They now end with a Done line,
fold paths to ~, and give config-file lines their own bold heading so
the lines to paste read apart from the hints. The empty extras TUI now
says the same thing as extras list.

Refs #200

* feat(init): report git changes on an existing setup as rows

init --remote and init --git-root on an existing setup still printed
arrow lines with absolute paths and spinner results in a different
voice. They now print aligned Git, Remote, Pull and Git root rows like
a fresh init, end a dry run with the shared Dry run line, and give the
choices after a remote check as Next commands.

A source repo the user created before init had no fallback identity,
so on a machine without git config the follow-up commit failed and
dumped git's whole "Please tell me who you are" message. The existing
repo now gets the same local fallback a new one does.

Refs #200

* feat(doctor): warn when a newer built-in skill is published

status already compared the skillshare skill with the published one,
but doctor only printed the local version, so a run meant to find
problems called an old skill healthy. doctor now fetches the published
version alongside the CLI update check and suggests upgrade --skill.

Both commands share a semver comparison. status compared with !=, so a
skill ahead of main (a dev build) was reported as having an update.

Refs #200

* fix(cli): count batch audit warnings in words and clear progress spinners

The batch install and update audit summary still printed "2 skill(s)"
and "warning(s)" after the rest of the output switched to "1 skill" /
"2 skills". uninstall and agent update also left "Found N skills" and
"Check complete" behind, progress messages the restyle clears.

Refs #200

* fix(cli): say so when diff or analyze has no targets

With no targets configured, diff reported "No differences" and analyze
printed only its "Add -v" hint, both reading like a healthy result.
They now say no targets are configured and suggest target add, as
target list does.

Refs #200

* fix(diff): align values across target sections

Each target section sized its labels on its own, so a section with
"Local only" started its values two columns later than one with only
"New", and the list read ragged. All sections now share one width.

Refs #200

* fix(doctor): count built-in skill warnings in the summary

The skill rows (not found, missing version, newer version available)
were marked as warnings and counted by --json, but never reached the
text summary, so doctor could print "! Skill not found" and close with
"All checks passed". The all-good integration test only passed because
of this; it now installs the built-in skill it needs.

Refs #200

* fix(init): stop writing a git identity into existing repos

On a repo the user created, init stored skillshare@local in the repo
config so its one commit would work. That setting outranks --global,
so the advice we printed never took effect and later pushes went out
as skillshare@local. The commit now gets the fallback through env
vars only. The note for repos init creates names the repo-level
command that actually overrides it.

Dry runs also wrote .gitignore into existing repos while closing with
"nothing was written", and warned about --no-git when it was not
passed; both now only describe what would happen.

Refs #200

* fix(cli): tell "no targets" apart from "nothing reaches them"

diff and analyze said "No targets configured" and suggested adding one
whenever there was nothing to show, including when targets exist but
have skills turned off or no skill is meant for them.

Refs #200

* fix(log): drop the trailing separator on instant entries

Entries with no recorded duration ended in a dangling " · ". Also
removes the formatRelativeTime alias the stats restyle left unused;
its test now covers formatDurationShort directly.

Refs #200

* docs: match tui, project list and log examples to the real output

The tui and project list examples used label widths the CLI does not
print, and the plain log example claimed to show non-TTY output, which
joins each entry's details on one line.

Refs #200

* perf(version): cache the published skill version for a day

doctor and status asked GitHub for the latest skill version on every
run, adding up to 3 s when offline. They now reuse the answer for 24
hours, the same interval the CLI update check caches for. upgrade
--skill still fetches fresh and records what it got.

Refs #200

* perf(server): reuse the cached skill version on the dashboard

The version endpoint fetched the published skill version on every
call, like doctor and status did, so it now shares their 24-hour
cache. It also treated any difference as an update, offering a
"newer" skill to anyone running a local build ahead of main.

Refs #200

* test(redteam): match the restyled update --diff heading

update --diff now titles its file list "Files changed" in sentence case,
like every other section, so the check for the list looked for the old
"Files Changed" box title and failed although the list was there.

Refs #200

* test(cli): keep /tmp fixtures unfolded where HOME is /tmp

scripts/test.sh now runs the cmd unit tests, so the docker sandbox runs
them too, with HOME=/tmp. shortenPath then folds the /tmp fixtures in
four tests to ~ and their exact-path checks fail. The tests now point
the cached home elsewhere while they run.

Refs #200

* fix(init): find skills/ in a repo that holds nothing else

The check for a skills/ folder ran only when the repo root had no skill
folders, but it counted skills/ itself as one, so it never ran. A repo
with only skills/ became the source as a whole, one level too high.

Refs #200

* fix(init): keep the skills git scope for a custom source

With a remote that has no skills yet, init defaulted to versioning the
whole skillshare folder. For a --source outside that folder it holds
none of the user's skills, so the commit and every later push carried
nothing while init reported the remote as linked.

Refs #200

* test(sync): check only the Agents section for updated agents

The restyle turned the old "0 updated" check on the agent summary into
"no 'updated' anywhere", which also covered the Skills section. On
macOS the first project sync reports the skill as updated there, so
the test failed on something it was never meant to check.

Refs #200
2026-10-03 21:43:35 +08:00
Willie 6e176ddb0c feat(extras): share Markdown memory across agents (#349)
* feat(extras): add shared Markdown memory management

Store user-managed notes in extras/memory for global and project scopes.
Add CLI operations, a nested dashboard browser, versioned edits, and
backup-backed deletion and recovery.

Connect selected agents with reviewed, marked reading guidance while
preserving existing instruction files and routes. Add explicit INDEX
linking, conflict draft comparison, and copy-content previews.

Document the workflow in five website locales with English screenshots
and translate dashboard copy across all eleven locales. Native automatic
memory remains separate from this shared file overlay.

Validation: make check; 22 UI tests; TypeScript and ESLint; production UI
build; six isolated CLI E2E steps; five-locale website build; explicit
Claude-write/fresh-Codex-read smoke test.

* feat(memory): support dashboard note moves and redesign browser

Add version-checked rename and folder moves without replacing existing notes.
Back up the old path and preserve content and permissions while refreshing
selection, search, index warnings, and backup links.

Integrate the two-pane Memory browser and compact agent controls. Refresh all
English screenshots and document move/link/history behavior in five locales.

Validation: make check, scoped UI tests, TypeScript, ESLint, UI production build,
five-locale website build, locale parity, and visible Chrome workflow checks.

* fix(memory): recheck reviewed files before committing changes

Preserve external edits detected after note backup or draft preparation, and create new notes exclusively. Revalidate each guidance file before writing, report stale partial failures, and correct the built-in move/rename documentation.

* fix(memory): repair initialization and preserve note recovery scope

Detect missing starter files before dashboard note creation and refresh the index after initialization. Honor requested backup paths, include external project memory sources in recovery scope, and log initialization failures after partial mutations.

* fix(memory): protect guidance creates and match Windows history paths

Create new reviewed instruction files exclusively to preserve competing writes. Match Windows history links with native backup paths while keeping POSIX names and backup API paths intact.

* fix(memory): require configured extra for external backup access

Keep project backup scope inside the repository unless a valid memory folder extra enables its external source. Cover listing, version preview and restore denial without changing configured-source recovery.

* fix(memory): lock backup scope validation through restore

Validate project memory backup access under the restore write lock so concurrent extra deletion cannot revoke access between validation and writing. Hold read locks across scoped backup reads as well.
2026-10-03 14:16:58 +08:00
Willie 80ac109f72 fix(sync): show unmatched include warnings in every sync view (#328)
The unmatched include warning from #326 was written straight to
DiagOutput. The dashboard sync never showed it because DiagOutput is the
server's stdout, and an interactive CLI sync could redraw its progress
area over it. Return the warnings with the merge and copy results so
SyncSkillTarget adds them to the target's warnings, which both the CLI
and the API already report. Prefix them with the target name, since the
API returns one list for all targets.

A top-level skill name has no path separator, so the suggestion cut off
its first character and suggested "alpha" for a typo like "lpha". Compare
the whole name in that case.

Refs #325
2026-10-02 16:24:03 +08:00
star-nebula 4e3b2b269a fix(sync): report include patterns that match no skill (#326)
Target include/exclude patterns are matched with filepath.Match against the
source-path flat name, while target_naming: standard shows the bare SKILL.md
name in the target directory. A pattern written with the name the target shows
selects nothing, so sync prunes the entries a working pattern had linked, and
the only trace is the echoed include: line, which never says that any of those
patterns matched zero skills.

Add FindUnmatchedIncludes and render one diagnostic per include pattern that
selects no discovered skill, suggesting the flat names whose last path segment
is the pattern. exclude is left alone: an exclusion that blocks nothing is the
normal state of a spare filter, while an include that selects nothing is always
a mistake and is the destructive direction. The diagnostic goes to DiagOutput,
so --json output is unchanged, and no filtering, naming, or pruning behavior
moves.

Closes #325
2026-10-02 15:54:53 +08:00
Willie a2d75300f6 fix(sync): prune only agent copies skillshare wrote in copy mode
Copy and extension modes pruned every unexpected .md (or output-extension)
file in the agents target, so agent files a user kept there were deleted
on the next sync, unlike skills copy mode, which prunes only manifest
entries.

Copy and transform outputs are now tracked with the same checksum
manifest the merge fallback already uses, and prune removes only tracked
copies the user has not edited. Existing copies are adopted while their
agent is still synced, and an untracked pre-transform .md that still
matches its agent is treated as a stale copy, so switching to an
extension keeps cleaning it up. Copies already orphaned before upgrading
are kept and must be removed by hand.

copyTracker.pruneOrphans now continues past a failed removal and joins
the errors, so one locked file no longer leaves the other orphans behind.
2026-10-01 22:10:08 +08:00
Willie 097d2c0257 fix(sync): keep unreadable links and report failed agent prune removals
prunableLink treated any stat failure as a broken link, so a live link
whose referent was temporarily unreadable (for example permission denied)
was deleted as if it pointed nowhere. Only a missing referent now counts
as broken.

PruneOrphanAgentLinks and PruneOrphanAgentCopies ignored os.Remove errors
and still listed the entry as removed, so sync reported a prune that did
not happen. Failed removals are now returned as errors, which the agent
runner already surfaces as warnings.
2026-10-01 21:55:41 +08:00
Willie bdd1fcf286 fix(sync): keep links to other locations when pruning agents and extras
Merge-mode pruning for agents and extras removed any link whose name was
not expected, so links a user made to agent or extra files outside the
source were deleted on the next sync or `extras --remove-target --prune`.

Agents and extras do not record their links in a manifest, so the #315
provenance check cannot be reused. Prune now removes a link only when it
is broken or resolves inside the source. Relative links are resolved from
the real parent directory, matching how createLink writes them, so
orphans under a symlinked target directory are still found.
2026-10-01 21:23:30 +08:00
Willie 9d66437487 docs(sync): describe ManagedOnly pruning after the provenance fix
Since #315, a live link into the source is pruned only when the manifest
tracks it. The ManagedOnly comments still said any link into the source
counted as skillshare's, which no longer matches what the leftover-dir
cleanup removes.
2026-10-01 20:55:56 +08:00
star-nebula 5f3e79f19e fix(sync): prune only links skillshare created (#315)
Merge-mode prune removed any target entry that was a symlink or junction
resolving under the skills source, without checking whether skillshare had
created it. Links made by hand or by another tool were therefore deleted by
name, silently and outside trash, so they were not recoverable through
restore.

Ask the manifest, which the directory branch of this same function and all
of copy-mode pruning already treat as the ownership record: a live link into
the source is pruned when it is tracked there or when --force is set, and is
kept and reported as a local entry otherwise. Broken links into the source
and the force escape hatch behave exactly as before.
2026-10-01 20:50:51 +08:00
Willie c327a26e30 feat: native hooks, MCP tool policy and Pi built-in MCP (v0.23.0) (#304)
* feat(hooks): manage native hooks across agents

Add global and project hook management for ten coding agents with native
format adapters, explicit ownership, revision-guarded synchronization and
selective backup/restore. Preserve unrelated native configuration and leave
hook execution and trust decisions with each agent.

Expose CLI commands and completions alongside dashboard import, editing,
native preview, target/project views, synchronization and backups. Localize
messages and document the workflows across supported locales.

Validation: devcontainer make check, full dashboard Vitest suite,
TypeScript/Vite build, scoped ESLint, isolated CLI lifecycle and real UI
acceptance. Native agent hook execution was not tested.

* feat(mcp)!: sync Pi only through its built-in MCP

Pi could be synced through three different mechanisms (built-in MCP,
pi-mcp-adapter, or the extension file), chosen per server. Mixing them
inside one scope was an error users hit easily, and the adapter and
extension files drifted from what Pi itself reads. Pi's built-in MCP
now covers what the other modes offered, so every Pi server is written
to ~/.pi/agent/mcp.json or <project>/.pi/mcp.json.

Existing setups migrate on the next sync: entries Skillshare wrote to
mcp-adapter.json are removed through the ownership ledger, extension
entries are rewritten in place, and hand-written entries stay put.
piExtension and piOptionsPrune still load (with a notice) so old
configs keep working, and are dropped on the next save. directTools is
kept but no longer rendered, since only the adapter reads it.

Pruning unchanged fields Skillshare wrote earlier is now always on,
the per-project off switch no longer applies to Pi, and the removed
--pi-extension and --pi-options-prune flags explain the change instead
of failing as unknown. Import still reads mcp-adapter.json read-only so
servers kept only there can be brought over.

BREAKING CHANGE: --pi-extension and --pi-options-prune were removed;
Pi servers are always synced to Pi's built-in MCP file.

* fix(mcp): load Pi switches and adapter options left from before 0.23.0

Phase 1 made Pi sync only through its built-in MCP, which left two
upgrade paths broken or misleading:

- A project entry with disabled: true that selected Pi used to work in
  adapter mode, but now fails every sync with "pi cannot turn off".
  Loading now takes pi (and Pi accounts) out of such an entry with a
  notice; an entry left with no targets stays and turns nothing off, so
  an explicit empty list is now valid for a switch. Saving a new switch
  for pi still fails.
- piOptions keys that only pi-mcp-adapter reads (lifecycle, idleTimeout,
  approveTools, ...) were copied into Pi's built-in mcp.json, where
  nothing reads them. Loading drops them with a notice naming each key,
  and saving new ones is refused. Keys neither Pi nor the adapter
  documents still pass through. includeTools/excludeTools are left for
  the tool policy change, which converts them.

Both changes rewrite the YAML node on load, like the phase 1 legacy
fields, so the next save persists them.

* feat(mcp): portable tool policy per server

Users need one place to say which of a server's tools the model sees,
instead of Pi-only adapter options that Pi's built-in MCP no longer
reads. A server's tools{expose, allow, deny} is rendered per Agent:
Pi gets exposure and an ordered toolExposure, Codex gets
enabled_tools/disabled_tools, Copilot gets its tools list. Parts an
Agent cannot hold (OpenCode and Kilo have no per-server field) are
named in the plan and by mcp check rather than dropped silently.

directTools and the adapter's includeTools/excludeTools are converted
on load and on import, so existing configs keep their behavior; the
--direct-tools flag is removed with a pointer to the new flags.
check --live now reports tool names so the dashboard can suggest them.

Refs #140

* feat(ui): drop the Pi mode, prune switch and Direct tools from MCP

Since 0.23.0 Pi syncs only through its built-in MCP and the API no longer
returns piExtension, so the server dialog showed an empty "Pi MCP mode"
select, links to pi-mcp-adapter and pi-mcp-extension, a prune switch the
backend ignores and adapter-only Direct tools. Toggling Pi also opened a
mode setup that no longer exists, and Pi was still offered as an Agent
that can turn a global server off per project, which the backend refuses.

Pi now shows only tool exposure, its other settings and one link to
Pi's MCP docs. The import dialog still sends piExtension, but only to
pick between Pi's mcp.json and the legacy mcp-adapter.json, which the
listed path already tells apart. Settings the config still carries from
before 0.23.0 are explained once on the MCP page from the source's
notices, worded in the dashboard's language.

* fix(ui): clarify hook takeover and localize MCP actions

Identify global and project hooks in sync previews, show full takeover guidance, and link project conflicts to their Hooks tab. Translate MCP pending actions using the existing locale keys.

* feat(mcp): name unapplied tool policy parts in the render preview

The dashboard's server editor needs to say which Agents cannot follow
part of a tool policy before the server is saved. The plan's notices
only cover saved servers, so each rendered target now carries the gaps
from toolPolicyGaps instead of the UI re-implementing the per-Agent rules.

Refs #140

* feat(ui): edit the portable MCP tool policy in the dashboard

Saving a server from the edit dialog rebuilt it from the form and
dropped its tools policy. The draft now carries tools, and a Tools
section edits exposure, allow and deny for every Agent at once. Tool
names can be loaded on demand from the saved server through the live
check, and each selected Agent that does not apply a part is named from
the backend's render preview.

Pi's other settings flag the adapter-only keys and the exposure fields
that Tools now owns, so the form refuses what the backend refuses with
a message that points to Tools. Rows show a short policy marker, and the
plan's tool policy notices are localized on the MCP page.

Refs #140

* feat(mcp): save the config without retired settings on sync

Notices about settings 0.23.0 retired (piExtension, piOptionsPrune,
adapter-only piOptions, Pi switch entries, directTools/includeTools/
excludeTools) only went away when the user happened to save MCP settings.
Sync never rewrote the source, so most users kept seeing them.

Loading already converts those settings in memory, so a sync now writes
the converted config back (global, per project, external source, CLI and
dashboard), after keeping the previous content in the file history.
Dry runs write nothing, and a failed save is reported after the Agent
files are applied. The plan carries `migrates`, so the dashboard's sync
runs MCP even when no Agent file changes.

The CLI notices are one short line per kind with each server named
once, and a sync prints the file it updated with its backup. The
dashboard no longer shows these notices: sync handles them with nothing
for the user to do, and tool policy gaps stay in the server dialog.

* fix(ui): catch MCP tool policy mistakes before saving

The empty "Other Pi settings" box showed a toolExposure example even
while Tools had a setting. That example is exactly what the dialog
refuses in that state, so it read as a saved value that went unflagged.
The example now leaves toolExposure out while Tools is set.

A Deny list that removes every tool Allow keeps was only refused by the
server, in English with raw field names. The Tools section now says so
in the user's language and disables Save; the server check stays.

* fix(ui): move Pi settings help into info tooltips

The Pi block stacked four lines of help under the exposure select, one
of them in raw config words (entry, toolExposure), which pushed the
fields apart. The help now sits behind keyboard-focusable info icons:
one on a new "Pi settings" heading, which keeps the official docs link
beside it since a tooltip cannot hold a link, and one on the exposure
label with a shorter, plain explanation. The line saying Tools sets the
exposure stays, because it explains why the select is locked.

* docs(mcp): describe Pi built-in only and the tool policy

0.23.0 dropped the Pi modes, the prune switch and directTools, and added a
portable tools policy (#140, #143). The MCP reference still told users to
pick pi-mcp-adapter and pass flags that now fail, and said nothing about
what the first sync does to an old config or which Agents apply which part
of a tool policy.

The reference now covers the tools field and flags with a per-Agent table
linked to each Agent's docs, the dashboard Tools section, Pi's built-in
files and options, and an upgrade section: what the first sync converts,
which adapter entries it removes, the config save with its migrate backup,
and what replaces each removed flag. The how-to, dashboard and backup pages
follow.

* docs(skill): teach the built-in skill the Pi and tool policy changes

Agents using the skill would still pass --pi-extension and --direct-tools,
which fail since 0.23.0, and would not know the tools policy or what a sync
does to a 0.22 Pi config. The MCP reference now matches the CLI; the
description is unchanged and stays within its size limit.

* test(mcp): cover Pi migration and the tool policy in the runbook

The runbook still exercised pi-mcp-extension, pi-mcp-adapter and
--pi-options-prune, all removed in 0.23.0. New steps check Pi built-in
cleanup, the first-sync conversion of a 0.22 config with its migrate
backup and untouched hand-written adapter entries, the removed-flag
messages, and what each Agent receives from one tool policy.

* docs(wiki): record the 0.23.0 MCP Pi and tool policy milestone

Keeps the design decisions and evidence limits of #140 and #143 (the
ledger-driven migration, the migrate backup, per-Agent translation rules)
where later work can find them without reading five phase reports.

* docs(i18n): mirror the Pi built-in and tool policy docs in four locales

The zh-Hant, zh-Hans, ja and ko MCP pages still described the removed Pi
modes and flags, and linked to anchors that no longer exist in English.
They now carry the tool policy, Pi, and upgrade sections with the English
anchors and dashboard labels taken from each locale's UI strings.

* feat(mcp): probe an unsaved server definition for the dashboard

Loading tools in the server dialog could only probe the saved config, so
editing a URL and clicking load tested the old address and surfaced a raw
"connection refused" for a server the user was already fixing. A new server
could not load tools at all until saved.

POST /api/mcp/probe runs the existing live probe on the definition in the
request, resolving env and header references as the saved-server check does,
and never saves or syncs. Failures carry an error kind (connect, timeout,
auth, protocol, command, unknown) so the dashboard can explain them in the
user's language and keep the raw text as detail.

* fix(ui): load MCP tools with the dialog's current settings

The Tools section now probes the connection as the form describes it, so
an edited URL or command is what gets tested and a new server can load its
tools before saving. Probe failures read as short localized messages with
the raw error behind Details instead of the probe's English text.

Loaded names are dropped when the connection fields change, since they may
no longer be this server's tools; editing Allow or Deny keeps them.

* docs(mcp): say Load tools probes the dialog's current settings

The MCP and UI references said the button starts the saved server and that
a new server must be saved first, which is no longer true.

* feat(ui): pick MCP tools from a loaded checklist

Typing exact tool names into allow/deny chip inputs made users guess
names the server already knows. The Tools section now loads the
server's tool list and lets users tick which tools the model gets;
unticking writes the exact name to deny, re-ticking removes it (and
adds it to a non-empty allow list), and rows removed by a deny
wildcard are locked with the rule named in a tooltip.

Wildcard and unlisted rules stay editable as chips in the same box,
and an outcome summary tells users which agents honor the list,
which honor it only partly, and which cannot filter tools at all, so
nobody assumes a filter applies where it does not.

* refactor(mcp): drop tools.expose in favor of Pi's own exposure

tools.expose only ever meant something to Pi, yet it sat in the
cross-Agent tool policy, locked Pi's exposure select whenever a policy
was set, and produced an "expose" gap for every other Agent. Pi's
exposure mode now lives only in piOptions.exposure: it can sit next to
a tool policy (only toolExposure still conflicts, since the policy
writes it), allowed tools inherit it, and pi-mcp-adapter's directTools
migrates to it. The flag and field were never released, so they are
removed without a shim.

The dashboard now describes a policy in plain words ("2 tools
excluded") instead of the old "2 denied" shorthand, shows Pi's
exposure on the server list in words, hints that Enter adds a rule,
and no longer leaves "{}" behind when an exposure is set and then
cleared.

* fix(hooks): make import a takeover and plans say what changes

A hands-on trial showed several rough edges in hooks management:

- Importing one per-event candidate such as claude-stop merged every event
  of the file into the entry, so unrelated hooks became managed.
- An imported hook then conflicted on the next sync as an "identical
  unmanaged hook" until --replace, although importing it was the takeover.
- Narrowing an entry was reported as "remove" of the whole file although
  only one event left it, and plans gave no event-level detail.
- A misspelled event such as Stopp was accepted silently and would never run.
- Rewriting a compact settings.json produced half compact, half indented
  JSON and left an empty hooks key Skillshare itself had added.

A name that matches a candidate now picks only that candidate. Saving an
import (Mutation.adopt) records the identical native registrations as the
entry's own even without sync, so the next sync adopts them in place; edits
made outside Skillshare afterwards still conflict. Changes carry added,
updated and removed events, and "remove" is reserved for an entry that leaves
the file. A per-Agent catalog of documented events, from each Agent's
official hooks reference, drives advisory plan warnings and is served at
GET /api/hooks/catalog. JSON edits keep the file's compact or indented style
and drop a hooks key once Skillshare empties the one it created.

* style(ui): keep clean theme switches and picked cards black and white

The clean theme is black-and-white only, so its on switches and picked
cards use ink instead of the green ok and blue accent colors. The playful
theme keeps its own colors.

* feat(hooks): return full file texts from the hooks preview

The dashboard can only show which Agent files a hooks change touches, not
what changes inside them. POST /api/hooks/preview now also returns files[]:
each native file the plan would change, with its current text and the exact
text sync would write, taken from the same plan apply writes from. Other
plan responses stay unchanged, and the route keeps the localhost-only guard.

* feat(hooks): manage Antigravity and Antigravity CLI hooks

Antigravity and its CLI (agy) are skills targets, but their hooks could
not be managed. Both read the same files, ~/.gemini/config/hooks.json and a
project's .agents/hooks.json, so they are one hooks Agent with
antigravity-cli and agy as aliases.

Antigravity's hooks.json maps hook names to blocks of events rather than
one event map. Each Skillshare hook becomes one block named after it, held
as a single owned element, so ownership, adoption, conflicts and restore
work as for the other Agents. Keeping the block's own name lets an import
take the block over in place; a same-named block Skillshare does not own is
a conflict until it is imported or replaced. Disabled blocks are not offered
for import, and edits keep the file's compact or indented style.

The event catalog lists the documented events (seconds timeouts), import
problems are no longer cleared before validation, and the schema and docs
cover the new Agent.

* fix(hooks): replace an edited registration in place

Acceptance found that --replace on a registration Skillshare owned but
someone edited outside appended a second copy: the edited one stayed in the
file, now unmanaged, next to the replacement. When the element at the
record's last written position is owned by no one, replace now overwrites it
there, for both an edit with --replace and 'hooks sync NAME --replace'.

Writing into a one-line array such as "Stop": [{...}] also mixed one-line
and indented layouts; elements written there now stay on that line. Import
candidate lists print an explanation shared by several rows once instead of
on every row.

* feat(ui): rebuild the hooks page around targets, the catalog and real diffs

Editing a hook meant typing event names from memory, repeating each
target by hand and saving JSON the dashboard could not check, and the
preview only listed actions without showing what would change in a
file. The backend now publishes each target's documented events and the
full before/after text of every file a preview touches, so the UI can
guide the whole flow instead of trusting free text.

- Event fields pick from the catalog with descriptions, and show the
  tool filter and timeout unit only where the target has them.
- An empty target tab offers to copy another target's commands, mapping
  events to their closest equivalent and converting timeout units, and
  says when an event has no counterpart.
- Native JSON gets completion, formatting and linting with the line and
  a suggested event, and never drops invalid text when switching back to
  fields; Cmd/Ctrl+S saves without syncing and Esc asks before
  discarding edits.
- The preview shows one card per file with event-level changes and a
  folded line diff that marks the user's own hooks as untouched.
- Import preloads each target's unmanaged hooks, saves only the checked
  ones with adopt so sync does not duplicate them, and keeps pasting as
  a secondary path.
- Antigravity joins the managed targets, the wording says targets
  throughout, and the remove dialog no longer contradicts itself.

* fix(hooks): keep key order and separators when replacing an element

Replacing a registration in place re-encoded it from a Go map, so its keys
came out sorted, and on a one-line array it was minimized without the
spaces the line used: [{"hooks": [{"type": "command", ...}]}] turned into
[{"hooks":[{"command":...,"type":"command"}]}]. The whole line then showed
as changed and read as a rewrite of the user's style.

A replaced element now keeps the replaced one's key order at every depth,
with new keys at the end, and elements written on a one-line array use the
line's own spacing after colons and commas.

* feat(hooks): stop managing a hook while keeping its entries

Removing a hook from the source always queued the removal of its native
entries on the next sync, so there was no way to hand a synced or adopted
hook back to the user. MCP already has this as `remove --keep-files`.

`hooks remove NAME --keep-files` (and `unmanage` in the API mutation)
removes the entry and forgets its ownership records in that scope, so sync
neither removes nor updates what it wrote; the entries show up as unmanaged
and importable again. It is rejected with --sync, like MCP.

The dashboard remove dialog adds "Stop managing" and now says what each
choice does to the target files, including that "Remove from source only"
still deletes the entries on the next sync. Its backup note is neutral and
the dialog is wider to fit the diff.

* fix(mcp): warn that Pi's built-in MCP needs Pi 0.99.0 and no old extension

The first sync after upgrading moves Pi servers off pi-mcp-adapter and
pi-mcp-extension into Pi's mcp.json. A user still on Pi before 0.99.0
silently loses every server, because older Pi does not read that file, and
Pi's docs say an installed extension that registers /mcp replaces the
built-in MCP. Nothing told them either.

The plan now adds one notice, shown by preview, sync and --json, when it
removes an entry Skillshare wrote to mcp-adapter.json, rewrites an owned
entry in pi-mcp-extension's format (the transport field), or the config
still has settings only the extensions read. The ledger check covers a
config that owns adapter entries without saying piExtension.

* docs(mcp): say what Pi needs before the first 0.23.0 sync

The upgrade section described how the config changes but not the two
things a user must do in Pi: run Pi 0.99.0 or later, and remove
pi-mcp-adapter or pi-mcp-extension, which Pi's docs say replace the
built-in MCP. It now shows the sync warning, lists every dropped adapter
option, and says a disabled entry no longer turns a server off for Pi in
that project. The import paragraph claimed sync never changes
mcp-adapter.json; it removes the entries it wrote there.

* fix(ui): make hook diffs, editors and the hooks rail readable

Supervisor and user trial of the rebuilt hooks page found diffs that
read as "we will touch your hook", an editor too small for real hooks,
and text cut short in the rail.

- Diffs: removed lines red and added lines green through new diff theme
  tokens (the one colour exception in the clean theme), removals before
  additions, lines differing only by a trailing comma or whitespace kept
  as context, long lines wrapped, and the "left as is" marker on its own
  line. An adopt-only card says the file is unchanged.
- Editors: native JSON and code editors expand over the dialog and back
  as the same editor, so lint, completion, format, the error count and
  Cmd/Ctrl+S keep working; Esc closes completion first. The invalid-JSON
  explanation sits above the editor.
- Dialogs are 880px like MCP's.
- Main page: full target paths wrap under the name with no inner scroll
  box, the sync card shows the target file, empty descriptions are
  hidden, the unmanaged note avoids an orphaned character, and the row
  menu uses a hooks-specific "each target" label.
- Import names follow the CLI (<target>-<event>) or a script's basename.

* feat(ui): show MCP plan notices before a sync

The API returned the plan's notices, but no dashboard view showed them, so
dashboard users never saw that the 0.23.0 sync rewrites their config or
that Pi's built-in MCP needs Pi 0.99.0 and no old extension. The MCP sync
dialog and the Sync page now list them, translated through mcp.notice.*
keys; a notice the UI does not know is shown as the server sent it.

* fix(install): default CLI installs to the user-local bin directory

Use ~/.local/bin so ordinary script installs and upgrades do not require administrator access. Preserve INSTALL_DIR overrides and existing installations, verify the installed binary directly, and show PATH setup only when needed.

Add offline installer regressions and align installation guidance across all five documentation locales, including automation PATH setup.

Validation: seven offline installer cases, make check in the devcontainer, all five website locale builds, and AI context checks passed.

* fix(ui): let stop managing succeed and open the source config from the header

Stop managing sent a mutation whose plan differs from the removal preview the
dialog had loaded, because the server forgets the ownership records first, so
the revision never matched and every attempt failed as stale. Both the hooks
and MCP remove dialogs now preview that mutation before saving it; it writes no
target file, so there is no diff to review. Its toast also says the entries
stay in the files instead of "Removed".

The source path line under the lists took space most people never read. A
config.yaml button in the page header now shows the full path on hover and
opens the Config page editor; a separate sources.mcp file has no editor there,
so that case copies the path instead.

The Pi chip on a server row no longer mentions other Pi settings.

* test(server): replay the dashboard's hooks and MCP requests against the handlers

UI tests mock the API with one fixed revision, so a dialog that saves with a
revision from the wrong preview passed every vitest while "Stop managing"
failed in real use. These tests send the exact mutation JSON and preview
revision each dialog uses (remove, stop managing, edit, toggle, takeover,
import/adopt, restore, global and project sync) in global, hooks.projects
or mcp.projects, and project-mode scopes, and pin that hooks refuses an
unmanage saved with the removal preview's revision.

* fix(ui): show comma-only line changes in the hooks diff

A line that only gained or lost a trailing comma was shown as unchanged
with its new text, so the preview hid a real byte change to the file.
Lines still align ignoring the comma, so an added sibling does not shift
unrelated lines, but a differing pair now shows as removed and added,
removals first within each change. The user's own event keeps its
"left as is" note on the new line.

* fix(hooks): name the events a Copilot hook file changes

Copilot keeps each hook in its own file, so its plan changes carried no
events and the preview card showed only the action while every other
Agent listed "+ SessionStart" and the like. The planner now compares the
file's hooks map before and after the write and reports added, updated
and removed events the same way shared files do.

* feat(ui): open config.yaml at the section the header button came from

The config.yaml button on the Hooks and MCP pages opened the editor at
the top, leaving the user to scroll for the part that page manages. It
now links to /config?section=hooks or ?section=mcp, and the Config page
puts the cursor on that top-level key and scrolls it into view once the
file is loaded. A config without the key opens at the top as before.

* fix(ui): say what hooks and MCP dialogs will really do

Trying hooks across eight targets showed several places where the
dashboard hid or misstated the outcome:

- Remove and sync writes every pending change of the scope, but the
  hooks and MCP remove dialogs only named the removed entry; they now
  name the other hooks or servers that go out with it.
- With more than three targets, each remove choice spelled out every
  target; it now gives the count.
- Preview cards shrank to their header in a long list and hid the diff.
- A hook's summary listed SessionStart and sessionStart as separate rows
  with no hint of which target runs which; rows now merge case-only
  differences and show their targets' icons.
- Save and sync used the same toast as a plain save.
- The copy panel promised the closest events even when a target had
  none; it now says those events must be picked by hand.
- The Hooks rail's expandable target rows had no accessible name.

* fix(ui): pair hooks diff lines only at the same indentation

Diff lines were aligned ignoring leading whitespace, so appending an
event paired the file's closing braces with braces inside the new block.
Once differing pairs show as removed and added, that turned one comma
change into a run of removed closing braces. Only the trailing comma is
ignored now, so the diff shows the comma pair and the added lines.

* fix(ui): explain each hook removal choice on its own button

The three consequence lines sat in the dialog body, away from the buttons
they describe, and made the dialog long when a hook reached many targets.
Each explanation now shows as a tooltip on its footer button, on hover and
keyboard focus, and is wired through aria-describedby for screen readers.

Tooltip placed button-anchored tips that did not fit below using the
cursor offset, so a two-line tip covered the buttons; it now flips above
the anchor. It also shows nothing without content, which lets the dialog
keep its buttons mounted while the preview loads.

The CJK strings dropped the space between the target text and the
particle, which read as "8 個目標 的".

* fix(hooks): delete the files and folders a removed hook leaves empty

Syncing a hook to an Agent whose hooks file did not exist, then removing
it, left shells behind: `{}` in Claude, Codex, Gemini, Qwen, Droid and
Antigravity files, `{"version":1}` for Cursor, and empty folders such as
~/.copilot/hooks and ~/.pi/agent/extensions. They look like user
configuration and confuse the next import or review.

The ledger now records the shared files Skillshare created and the
folders it made for its outputs. When removal leaves a created file with
nothing but that skeleton, the plan deletes it and says so, and the file
diff shows the deletion. Files and folders that existed before, settings
or comments the user added, and non-empty folders all stay. Apply checks
the skeleton again, so settings added after the preview keep the file.

* fix(hooks): note Copilot's folder trust and use Pi's current package

Running Copilot CLI against a synced project showed that .github/hooks
is skipped until the folder is in trustedFolders, while COPILOT_HOME
hooks run anyway; the Copilot note was the only command Agent note that
did not mention trust. Pi's extension docs now import ExtensionAPI from
@earendil-works/pi-coding-agent, so the hook template follows them. The
old name still loads because the import is type-only, but editors no
longer resolve its types.

* test(hooks): run synced hooks in real Agent CLIs

Unit tests only prove Skillshare writes the native files we believe are
right. This runbook syncs a marker-writing hook for each Agent, starts
the real CLI once per scope with a throwaway HOME and fake credentials,
and checks the markers, so a format or location mistake shows up as a
missing marker. Antigravity and Cursor check credentials before any hook
runs; the runbook lists how to confirm them by hand.

* fix(hooks): write the hooks section in block style

yaml.v3 encodes an empty mapping as flow `{}`, and entries added to it
inherit that style, so the first hook saved after the section was emptied
landed on one unreadable line in config.yaml. The section is now expanded
before it is written, like the MCP section, which also unfolds entries an
earlier save left on one line.

* fix(ui): let Beautify unfold nested one-line YAML

Beautify kept flow collections as written, so a hooks or MCP section
squeezed onto one line stayed that way and the button reported nothing to
change. It now expands flow collections that nest others, and everything
inside them, while short lists such as `targets: [claude, codex]` stay on
one line. Saving still keeps the user's flow style.

* fix(ui): show hook targets once and light them up per event

Each event line repeated its own row of target icons under the header's
icons, and two rows of logos stacked on the right read as clutter. The
header now shows the targets as one overlapping stack, and hovering an
event line fades the targets it does not run on. Screen readers still hear
each line's targets.

* fix(ui): document the hooks section in the config editor

The field panel labelled every key under hooks as an unknown field, which
suggested the section was a mistake. It now explains hooks, its entries,
bindings, events, code, files and projects like the MCP keys.

* docs(hooks): describe the config editor and Copilot folder trust

The hooks page now writes its section in block style, opens the config
editor at hooks:, and the field panel and Beautify understand the
section; none of that was documented. Running Copilot CLI also showed that
project hooks in .github/hooks load only in a trusted folder, which the
destinations section did not say.

* docs(changelog): add 0.23.0 entry

Records native hooks, the MCP tool policy, the dashboard work around both,
and the Pi built-in MCP breaking changes, so users upgrading from 0.22.2
know what moves on their first sync.

* fix(server): validate hooks when the config editor saves

The config editor kept the hooks section as an opaque node and never ran
the hooks checks, so a malformed binding saved successfully and then broke
the Hooks page and `sync --all` until the YAML was repaired by hand. A
project config could also gain `hooks.projects`, which only the global
config may hold. Saving now rejects both with the same message sync gives.

* fix(hooks): keep an Antigravity block's name when importing it

An Antigravity hook is the named block in hooks.json. Importing one under
another name, through `hooks import --from agy NAME` or a renamed row in the
dashboard, planned a new block and left the original unmanaged, so both
ran. Such a takeover is now a conflict that asks for the block's own name,
and the import dialog keeps that name fixed for Antigravity rows.
2026-10-01 02:24:24 +08:00
Willie cf12f33eff feat(ui): list failed sync targets apart from warnings
A dashboard sync that lost a target reported it only as a warning
string, next to backup notes and prune hints, under a "Sync complete"
toast, so a partial failure was easy to miss and nothing said how to fix
it. The sync API now returns a "failed" list (target, part, error, the
matching warning text, and whether a symlink conflict caused it);
"warnings" is unchanged. The Sync page shows failed targets first with
their part and error, offers Turn on Force for a symlink conflict,
marks the target in the change list, and toasts a warning instead of
success.
2026-09-30 03:08:55 +08:00
Willie b76375dab5 refactor(sync): share the per-target skills sync step between CLI and server
After the server fixes, the CLI's collect*SyncResult functions and the
Web API loop ran the same merge/copy/symlink and prune logic twice. Both
now call sync.SyncSkillTarget and only render its result: the CLI keeps
its parallel grouping and progress output, the server stays sequential.
The stats helpers this orphaned are removed.

The server's "pruned" list is now always an array; it could be null
when a prune removed nothing.
2026-09-30 02:08:24 +08:00
Willie b62faeed60 fix(sync): skip extras whose source directory is missing
Global sync created a missing extras source, project sync and `sync
--all` skipped it, and the Web API created it while ignoring any
MkdirAll error. Creating an empty source only hides a misconfigured path,
so every caller now skips the extra and tells the user to create the
directory. The Web API reports the hint in a new per-extra "warnings"
field; existing response fields are unchanged.
2026-09-30 02:05:34 +08:00
Willie dc255a6f36 refactor(sync): share the extras per-target loop between CLI and server
Global sync, project sync, `sync --all` and the Web API each carried a
copy of the extras target loop, and the server inlined its own mode
switch. All four now call sync.RunExtraTargets, and the TUI calls the
exported sync.SyncExtraTarget.

This is a pure refactor. The caller differences (missing-source policy,
agent-overlap skip, path resolution, error precedence) are options on
the runner, and characterization tests pin them so the follow-up fixes
show up as deliberate test changes.
2026-09-30 02:00:42 +08:00
Willie f313e3c37f fix(sync): report agent prune failures instead of dropping them
Both the CLI and the Web API discarded the error from pruning orphaned
agents, so a target whose directory could not be read looked clean while
stale links stayed behind. The shared runner now turns the error into a
"<target>: agents prune failed: <err>" warning, which both callers
already render. The sync itself still counts, matching how skills treat
prune failures.
2026-09-30 01:57:31 +08:00
Willie 47a6a17a69 refactor(sync): share the agents sync loop between CLI and server
The CLI and the Web API each carried their own filter, sync or transform,
then prune loop for agents, and the copies had started to drift. Both now
call sync.RunAgentSync and render its per-target results as before.

This is a pure refactor: characterization tests pin the server's 200 with
warnings on a per-target failure, the CLI's non-zero exit, the server's
silent skip of targets without an agents path, and the merge of agent
lists into the skills row. Prune errors are now returned in the result
but still ignored by both callers; surfacing them is a separate fix.
2026-09-30 01:56:07 +08:00
Willie c8faab039f test(integration): consolidate redundant filtering and sync cases
Reduce repeated fixtures while retaining CLI flag, output, pruning,
copy-mode, and combined source/target symlink coverage. Keep manifest
orphan pruning and exercise repeated sync through both symlinked paths.

Removed integration cases and their retained unit coverage:
- TestSync_MergeMode_IncludeFilter -> TestFilterSkills_IncludeOnly.
- TestSync_MergeMode_ExcludeFilter -> TestFilterSkills_ExcludeOnly.
- TestSync_Pruning_PreservesLocalDirectories -> TestPruneOrphanLinks_KeepsLocal.
- TestSync_Agents_IncludeFilter -> TestFilterAgents_IncludeOnly.
- TestSync_Agents_ExcludeFilter -> TestFilterAgents_ExcludeOnly.
- TestSync_Agents_GlobExcludePattern -> TestFilterAgents_ExcludeOnly and
  TestFilterSkills_GlobPatterns (shared flat-name matcher).
- TestSync_SourceDirIsSymlink -> TestSyncTargetMerge_SourceIsSymlink.
- TestSync_TargetDirIsSymlink -> TestSyncTargetMerge_TargetIsSymlink.

For the removed TestInstall_SkillIgnore_* cases, internal/skillignore
retains the following semantic coverage:
- ExcludesMatchedSkills -> TestMatch_ExactMatch and TestMatch_NoMatch.
- GroupPattern -> TestMatch_GroupPrefix and TestMatcherMatch parent
  directory inheritance cases.
- PrecisePathInGroup -> TestMatcherMatch contains / is anchored cases;
  also folded into the retained Git-discovery WildcardPattern test.
- DoubleStarPattern -> TestMatcherMatch double-star cases and
  TestDiscoverSourceSkills_IgnorePatterns/DoubleStarPattern.
- DirOnlyPattern -> TestMatcherMatch directory-only cases,
  TestRegressions/#83_trailing_slash, and
  TestDiscoverSourceSkills_IgnorePatterns/DirOnlyPattern.
- CharClassPattern -> TestMatcherMatch character-class cases and
  TestDiscoverSourceSkills_IgnorePatterns/CharClassPattern.
- CombinedPatterns -> TestMatcherMatch negation cases,
  TestReadPatterns_ParsesFile, and TestRegressions.
Keep Git discovery wildcard and negation tests, including nested paths
and traversal into an ignored parent with a negated child.

Convert five TestDiscoverSourceSkills_*Pattern functions into matching
named subtests of TestDiscoverSourceSkills_IgnorePatterns, preserving
all fixtures and asserting the exact retained skill set. Preserve the
separate Lite traversal and WithStats behavior tests.

Convert all 18 Test{MoveToTrash,MoveAgentToTrash,Restore,RestoreAgent}
_RejectsTraversal_* cases into identically named subtests under their
respective Test*_RejectsTraversal functions. Retain every malicious
input, rejection assertion, and canary check.

Validation (Linux devcontainer):
- make build
- go test ./tests/integration/... ./internal/sync/... ./internal/trash/... -count=1
- make check
- git diff --check (host)
All passed.
2026-09-30 01:46:27 +08:00
Willie e0882217ab feat(targets): list copy-mode copies apart when skills are switched off
Switching skills off keeps copy-mode copies, since they are real folders the
user may have edited, but they were listed as the user's own items. The tool
still loads them next to wherever it now reads skills from, so each skill
shows up twice. The CLI, the preview and the dashboard dialog now list them
separately and say to delete them if the tool reads the same skills
elsewhere, leaving that choice to the user.
2026-09-29 05:13:06 +08:00
Willie 7bc8bd6634 fix(targets): count what a skills-off folder still holds and refuse mixed flags
With skills off, analyze only counted unmanaged folders, yet the tool still
loads the links a target sharing the folder keeps and the copies copy mode
leaves behind, so the report showed fewer skills than the tool reads.

`target <name> --skills=false` combined with include/exclude flags applied
the filters and silently dropped the switch, because filter updates return
first. The switch removes links, so the mix is now refused instead.
2026-09-29 05:03:49 +08:00
Willie 46b23cd2ad feat(targets): let a target keep its instructions with skills switched off
Some tools only need skillshare for AGENTS.md, MCP or agents, while their
skills folder is managed elsewhere or shared through another target.
Syncing skills into those folders duplicated what the tool already reads,
so a target can now turn skills off (`target <name> --no-skills`, the
dashboard switch) and sync, diff, status and doctor skip its skills.
Switching off warns about the other tools that read the same folder.

The target list also gains tools that were missing, with colored vendor
logos where their licenses allow it, and zencoder/replit default paths
follow their current documentation.

The dashboard's target pages get the matching UI: universal is pinned as
the shared folder when adding a target, the add dialog lists what will be
written, and the AGENTS.md tab shows where the file comes from in one card
with an in-place switch between shared files.
2026-09-29 04:51:24 +08:00
Willie 86dca7924f feat(backup): browse and restore file history, delete snapshots
skillshare backs up AGENTS.md, CLAUDE.md and shared-file locations before
rewriting them, but nothing could list or restore those copies, and a
target snapshot could not be deleted on its own. The file backups now
record why they were taken in their name (<time>.<reason>.bak; older ones
have none), and the server and CLI can list them, show a version and
restore it, saving the current content first. A link is only replaced
when the caller asks for it.

Also:
- DELETE /api/backups/{timestamp} and `backup --delete`.
- Agents snapshots (<target>-agents) could not be restored from the
  dashboard: the name was looked up as a target.
- Project mode uses the project's backups folder for snapshots and lists
  only file backups inside the project.
- MCP backups report which servers they changed and when.

Refs #299
2026-09-28 19:23:16 +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 f307c8a114 fix(sync): keep user files safe in copy fallback and mode switches
Review of the file-link fallback found paths that lost or misreported
user data:

- An identical local file was adopted as a skillshare copy and later
  pruned without backup. Only files sync writes are tracked now.
- Clearing all own text in import mode was treated as no record, so
  switching back resurrected the attach-time content.
- The mode API saved the new mode and returned success when a directory
  blocked the sync; it now keeps the old mode and returns 409.
- Restore preview promised a delete for files restore leaves alone; both
  now share one ownership decision.
- Prune forgot ownership even when removing the copy failed.

Refs #299
2026-09-28 14:27:53 +08:00
Willie faa5186818 fix(sync): keep import-mode edits when switching back to import
Switching a target from import to copy or symlink and back rebuilt the
file from the attach-time restore point, so lines the user wrote while in
import mode vanished (they survived only as a drift backup). Save the
file's own content when leaving import and rebuild from that on the way
back; the attach-time restore point itself is never re-recorded.

Refs #299
2026-09-28 14:04:15 +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 c7eb59a78f fix(sync): stop linking single files with junctions on Windows
createLink always tried `mklink /J` first. mklink does not check the
source type, so agents, single-file extras such as a shared AGENTS.md, and
per-file extras links became directory junctions that point at a file:
Explorer shows a folder and tools cannot read it. Sync then compared only
the link destination and kept the broken junction forever.

Files now get real symlinks only. When the OS cannot create them (Windows
without Developer Mode, non-elevated), file-based link modes fall back to
copies at the mode level, so status, doctor, the API and later syncs all
see an effective `copy` mode. Fallback copies are tracked by hash so they
keep updating and pruning without touching the user's own files, and turn
back into links once links work. Single-file extras remember what they last
wrote, so an unedited copy is replaced silently instead of producing a
drift backup on every source edit, and switching a target back to import
restores the user's attach-time content plus the import block.

Includes a Windows runbook and script, verified on a Windows 11 ARM64 VM
with and without symlink rights.

Refs #299
2026-09-28 13:54:52 +08:00
Willie 97499ebcc4 fix: recognise Windows junctions wherever links are detected
Since Go 1.23, os.Lstat reports NTFS junctions as irregular files instead
of symlinks (winsymlink, active for go 1.25 in go.mod). Every check that
looked only at os.ModeSymlink therefore missed the junctions skillshare
itself creates on Windows: linked skills could be treated as local folders,
backed up, copied through, or left behind on prune.

Detect links through utils.IsLinkMode, which also asks the OS about the
reparse tag of irregular entries, and count only real symlinks and
junctions as links so OneDrive placeholders and deduplicated files stay
regular files. restore.go also used os.Stat for its link check, which
follows the link and never matched.

Refs #299
2026-09-28 13:53:16 +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
Willie bc01ff1b3e feat(server): let tracked-repo skills take dashboard targets
Setting targets on a skill inside a tracked repo used to be refused,
because writing its SKILL.md leaves the clone dirty and `update` then
skips the repo (or `--force` throws the setting away).

Store those targets in the source's .metadata.json instead, keyed by
the skill's path, and apply them at discovery over the frontmatter.
The clone stays clean, `update` keeps working, and the setting survives
it. Uninstalling a repo or skill drops its entries.

Overrides are saved in the same lock section that writes them: every
API request reloads the store from disk, so saving after unlocking
could lose them, and saving outside the lock raced with other writers.

Refs #295
2026-09-26 21:02:28 +08:00
Willie 45854c5b57 fix(sync): count manifest-managed hidden entries in target scans
Flat target naming turns a source skill under a dot directory
(e.g. .system/example) into a hidden target entry (.system__example).
Target scans skipped every hidden name, so diff, doctor, status and the
dashboard reported these synced skills as missing, and prune never
removed them after the source skill was deleted.

Hidden entries are now skipped only when the target manifest does not
record them as managed, so files like .skillshare-manifest.json or
.DS_Store are still ignored.

Refs #294
2026-09-25 22:26:51 +08:00
Willie 188193d12d feat(extras): let collect overwrite source files with --force
In copy mode, sync --force can push source over target, but collect
skipped every file already in source, so edits made directly in a
copy-mode target could not be pulled back. collect --force now
overwrites those files; identical ones are still skipped.

Collect also replaced collected files with symlinks regardless of mode,
turning copy-mode targets into symlinks. Copy-mode targets now keep
their files, in the CLI and the extras TUI.

With flatten, two target files sharing a basename map to one source
file; the second is now reported instead of overwriting the first under
--force. --from paths are matched after expanding ~ and cleaning, so a
spelling that differs from config no longer drops the target's mode.

Refs #291
2026-09-24 00:05:55 +08:00
Willie cb2bcec948 feat(agents): convert agents with a target extension
Tools disagree on agent frontmatter and some need another format entirely,
so an agent written for Claude is misread elsewhere. An `extension` on a
target's agents block reuses the extras transform mechanism to convert each
agent during sync.

Converted targets hold transformed output, so collect never pulls them back
into the source. Leftover symlinks from merge or symlink mode are removed
rather than written through, and a failed conversion drops the old output
so an unconverted agent never stays active.

The bundled opencode-agents extension keeps only fields OpenCode documents
and refuses agents that restrict their tools, since dropping those fields
would widen the agent's access.

Refs #267
Refs #241
2026-09-21 13:31:38 +08:00
Willie 1fb23f1e59 feat(analyze): measure what each target actually loads
The analyze numbers were drifting from what tools really see. Symlink-mode
targets expose the whole source folder, so .skillignore'd skills still load
but were left out; merge/copy targets often hold skills the user dropped in
by hand that skillshare never counted; and chars/4 undercounted CJK text by
roughly four times.

Route the CLI, TUI, web handler and sync summary through one
sync.TargetSkills so the three copies of the filter logic cannot disagree
again. Disabled skills stay in the discovery with Disabled=true and are
priced for symlink targets; unmanaged folders in a target are reported as
Local. Token estimates now charge one token per wide rune.

The dashboard keeps the chosen target in the URL so target and project
pages can deep-link into the analysis, lists project targets after own
targets with their tool icon, and tags local/disabled rows. Select gives
single-select icons a key to silence a React warning.
2026-09-21 04:17:26 +08:00
Willie 449fe40d6f fix(targets): move goose and openhands to .agents/skills
Both tools now document ~/.agents/skills and <project>/.agents/skills as
their skills locations and keep the old directories only for backward
compatibility. Writing to the old path next to `universal` makes them read
every skill from two places.

Global configs pin absolute paths, so they are unaffected and keep their
overlap warning. Project configs store target names only, so an existing
project follows the new default on its next sync while the links it created
in .goose/skills or .openhands/skills would stay behind and show up as
duplicates. Project sync now removes those leftovers from also_scans
directories that no configured target writes to.

That directory belongs to another tool, so the cleanup runs the prune with
ManagedOnly: only symlinks into the source and manifest-tracked folders are
removed. The flat-name heuristic would otherwise delete hand-made folders
such as `_drafts`. Targets with an explicit path are skipped, and --dry-run
only previews.

Refs #135
2026-09-21 02:55:18 +08:00
Willie e780fbf1ab fix(sync): honour agent frontmatter targets when syncing agents
The agent discovery already parsed the `targets` frontmatter list into
DiscoveredResource.Targets, but no agent sync path ever applied it, so an
agent declared for one tool was still delivered to every agent-capable
target. Agents have no shared schema across harnesses, so this gives authors
a way to keep a per-tool variant of the same agent without cross-polluting
targets. Applied in CLI sync (global and project), the dashboard sync
handler, doctor's expected count and the target summary so all views agree.

Refs #267
2026-09-02 13:36:30 +08:00