Commit Graph
41 Commits
Author SHA1 Message Date
Willie 3e8b6e8bd9 fix(git): warn before staging first-level source links
Source links can record machine-local paths in Git. Share advisory indexed and ignored checks across CLI, init, and dashboard staging and previews, with scope-correct ignore patterns and manual untracking instructions, without changing staging behavior.
2026-10-05 14:11:57 +08:00
Willie dd6991ca3c fix(push): refuse unpushed config.yaml history at root scope (#366) (#372)
* fix(push): reject unpushed config history at root scope

Untracking config.yaml at the tip still uploads its contents from earlier local commits. Refuse root-scope pushes before mutation and before upload when unpublished history adds or changes the file or its directory tree, without rewriting history.

Share the check across the CLI and dashboard, return unpushed_config_history, and allow removals and config inherited unchanged from upstream merges. Cover first pushes, dry runs, push --pull, directory paths, renames, and merge commits, and document manual repair in all website locales.

Fixes #366

* fix(push): check exactly what push sends for config history

Review of the config history guard found two range problems:

- The guard checked @{u}..HEAD, but a same-named upstream was pushed with
  a bare `git push`. With remote.pushDefault or push.default=matching that
  could send config-bearing commits to another remote, or other branches,
  that the guard never looked at. PushArgs now always names the upstream
  remote and branch (read from branch config, so names with "/" survive),
  so the checked range and the pushed range are the same.
- Without an upstream every commit on HEAD counted as unpushed, so a
  config.yaml already published on origin followed by the
  "Keep config.yaml out of version control" commit was refused. The guard
  now checks HEAD --not --remotes=<push remote>.

The refusal message now suggests rebasing from just before the oldest
offending commit instead of @{u} or --root, which would rewrite commits
the remote already has.

* fix(push): check config history against the remote's live refs

Local remote-tracking refs can be stale. When another machine force-pushes
the remote to drop a leaked config.yaml commit, this clone's
refs/remotes/<remote>/... still contains it, so the guard treated the leak
as already published and HEAD:main, still a fast-forward, would publish it
again.

The guard now excludes only the objects the push remote's refs point to
right now (git ls-remote), limited to objects this clone has. It falls back
to local remote-tracking refs only when the remote cannot be reached, in
which case the push fails anyway. Revisions go to git log on stdin as
"^<id>" lines because git before 2.42 rejects "--not" there.

* fix(push): screen config history against every push URL, without replace refs

Two more ways the screened history could differ from what git push uploads:

- `git ls-remote <remote>` queries the fetch URL, but git push sends to every
  remote.<name>.pushurl. A commit already on the fetch URL could still be
  new to a push URL. The guard now lists `git remote get-url --push --all`
  and excludes only objects that every push URL has.
- With a refs/replace/* entry for an offending commit, git log read the
  sanitized replacement while the push pack carries the original. The log
  and the rebase-base lookup now run with --no-replace-objects.

* fix(push): let pushes the remote will reject reach the pull step

Our own review of the config history guard found two problems:

- When another machine had pushed, the remote's tip was unknown locally, so
  no live ref survived the "objects this clone has" filter and the whole
  history counted as unpushed. A config.yaml published long ago, followed by
  the stop-tracking commit, then blocked `push --pull` before it could pull,
  and replaced the plain push's ErrPushRejected hint. A push URL whose
  destination branch tip this clone lacks rejects the push as
  non-fast-forward and receives nothing, so it is now left out, and the
  check passes when every push URL is like that. `push --pull` re-runs the
  check after pulling, with the tip known.
- PushRemote read branch.<b>.remote even when @{u} no longer resolved, while
  PushArgs then pushed to origin. pushTarget now follows the same
  HasUpstream rule as PushArgs.
2026-10-04 03:09:17 +08:00
Willie 475b176914 fix(pull): keep the local config.yaml when a later pull brings a tracked copy (#362)
* fix(pull): keep the local config.yaml when a later pull brings a tracked copy

#357 refuses a root-scope first pull when the remote tracks config.yaml, but once upstream is set, a pull that merges in a remote-tracked copy still replaced this machine's config: Git treats the ignored file as expendable. Snapshot config.yaml around later pulls (CLI pull, push --pull, and the dashboard), restore it, and warn so the user can untrack it with push.

Refs #353

* fix(git): untrack config.yaml after push --pull and warn on identical copies

push --pull ran the root safety sweep before integrating the remote, so a
pull that brought in a remote-tracked config.yaml was pushed back as-is:
the remote kept tracking it and the next first pull elsewhere was refused.
Re-run EnsureConfigUntracked after the pull and commit the removal before
pushing.

The warning also depended on the pull changing the local bytes, so a
tracked copy identical to this machine's went unreported. KeepLocalConfig's
restore now reports whether the repo tracks config.yaml after the pull.

* fix(git): only restore config.yaml when the pull could have touched it

KeepLocalConfig wrote its snapshot back after every root-scope pull, so an
edit made to an untracked config.yaml while the pull ran was silently
replaced by the stale copy. Git only rewrites config.yaml when it is
tracked before or after the pull, so restore only in that case.

* fix(git): restore config.yaml only when the pull changed its index entry

Gating the restore on "tracked before or after" still overwrote edits made
during a pull when config.yaml was already tracked and the pull left it
alone. Compare config.yaml's index entry (mode, blob, stage) before and
after the pull instead; a merge, reset or conflict that touches the file
changes it, and anything else keeps the current file.

* fix(git): warn about a tracked config.yaml only when the upstream tracks it

The warning followed the local index, so a config.yaml tracked only by a
local, unpushed commit was reported as tracked by the remote, and the
suggested push would publish it in history. Check the upstream tree with
RemoteTracksConfig("@{u}") instead.

* fix(git): restore config.yaml after a pull that aborts its merge

A merge that brought in a tracked config.yaml and conflicted elsewhere was
aborted, which deleted the file again and returned the index entry to its
pre-pull state, so restore saw no change and the local config was lost.
Also restore when the snapshotted file is missing after the pull.

* fix(git): keep config.yaml ignored when a later rule negates it

EnsureConfigUntracked only checked that a "config.yaml" line existed, so a
pulled .gitignore with a later "!config.yaml" left the file unignored and
the following `git add -A` tracked this machine's copy again. Check the
effective ignore state and append an overriding entry when needed.

* fix: commit post-pull .gitignore repairs and keep config.yaml's mode

push --pull committed only when EnsureConfigUntracked removed an index
entry, so a pulled .gitignore that stopped ignoring config.yaml was
repaired locally but never pushed, leaving the tree dirty. Commit whenever
the safety step leaves changes.

KeepLocalConfig skipped the restore when the bytes matched, so a checkout
that rewrote config.yaml with the default mode dropped this machine's
restrictive permissions. Compare the mode too, and chmod after writing
since WriteFile's mode is masked by umask.

* fix(git): restore config.yaml over a tracked config.yaml directory

A pull that checks out a tracked config.yaml/ tree replaces the ignored
local file with a directory, which os.Remove cannot delete, so restore
failed and the local config stayed lost. Remove a directory there before
writing the snapshot back; its contents are in Git. EnsureConfigUntracked
now untracks recursively so push can remove that tree too.

* fix: keep post-checkout config edits and preview .gitignore repairs

Restore wrote the snapshot back whenever the pull changed config.yaml's
index entry, even when a newer copy had been written after Git checked it
out. Skip the restore when the file on disk no longer matches the blob the
pull checked out.

A dry-run push or commit only previewed untracking config.yaml, so when a
later "!config.yaml" rule un-ignored it the preview listed config.yaml to
commit while a real run repairs .gitignore instead. Preview that repair.

* fix: scope the post-pull safety commit and keep post-checkout symlinks

The post-pull safety step in push --pull ran `git add -A`, so an edit made
by another process while the pull ran was committed and pushed under the
config-safety message. Stage only .gitignore on top of the config.yaml
removal and commit the index as staged.

The post-checkout edit check skipped symlinks, so a dotfiles manager that
replaced config.yaml with a newer link after the checkout had it replaced
by the stale snapshot. Treat a link where Git checked out a file, or a
different link target, as a newer local edit.

* fix: preview explicit config.yaml entries and refuse other .gitignore edits

A dry run previewed the .gitignore repair only when config.yaml was not
ignored at all, but a real run also appends the explicit entry when a
broader rule such as *.yaml ignores it. Preview whenever the entry is
missing too.

The post-pull safety commit staged the whole .gitignore, so an edit made
by another process while the pull ran was pushed with it. Refuse unless
the file only gained config.yaml lines over its staged version.

* fix: report config.yaml restore failures instead of dropping them

integrateRemote declared the KeepLocalConfig result with :=, shadowing the
named err that the deferred restore joins its failure into, so a failed
restore was swallowed and pull or push --pull went on to sync targets with
another machine's config.yaml. The dashboard pull replaced the pull's own
error with a bare 500 on a restore failure, losing the conflict response
and the ops log entry; join the errors so both are reported.
2026-10-04 01:58:30 +08:00
adam maguedandWillie 7fccd6ffa5 fix(pull): refuse root-scope first pull when remote tracks config.yaml (#357)
When git_root is configured as root, config.yaml is machine-specific and kept out of version control by .gitignore. If a remote repository tracks config.yaml, a first pull silently overwrites the local config.yaml during git merge or git reset.

Detect whether the remote tracks config.yaml at root scope before integrating changes in FirstPull and init remote setup. If so, refuse the operation and report guidance to untrack config.yaml on the remote via push before pulling.

Co-authored-by: Willie <egg358358@gmail.com>
2026-10-03 23:50:35 +08:00
Willie 5d269e8e4c feat(push): add --pull for two-way sync in one command (#354)
* feat(push): add --pull for two-way sync in one command

Users editing skills on several machines have to remember push on one and pull on the other, and a push from a machine that is behind fails until they pull first. push --pull commits local changes, merges the remote with the same merge semantics pull uses, pushes, and syncs the git root scope.

A conflict stops before anything is pushed and keeps the local commit; a target sync failure after a successful push is reported separately so the user knows the remote is already updated. It never rebases or force-pushes. commit rejects --pull instead of silently ignoring it, since both commands share the argument parser.

* docs(push): document push --pull across guides and translations

Cover the new flag on the push reference, the cross-machine sync guide, the quick reference, the daily workflow and the cross-machine recipe, in English and the ja, ko, zh-Hans and zh-Hant translations, plus the built-in skill's sync reference.

* fix(push): print the scope's sync command when --pull sync fails

A bare 'skillshare sync' retry hint defaults to skills and may pick project mode, so it does not redo an agents, extras, or root sync. Derive both the sync and the hint from one per-scope list.

* fix(pull): sync extras for the root git scope

The root scope versions skills, agents and extras, but pull and push --pull only synced skills and agents, so merged extras changes never reached their targets.

* fix(server): sync extras after a root-scope pull

The root scope versions extras too, but the dashboard pull only synced skills and agents, so merged extras never reached their targets. Matches the CLI fix.

* feat(ui): add a Sync both ways action to Git Sync

Mirrors skillshare push --pull: commit local changes, merge the remote and sync targets, then push, in one click. A pull conflict stops at the existing review before anything is pushed.

* feat(ui): confirm Sync both ways and list what it will do

Sync both ways commits, merges and pushes in one click, so ask first and show the concrete outcome (files to commit, remote commits to merge, scope, push target, conflict behavior) before changing anything.

* fix(ui): make Sync both ways match push --pull

It skipped target sync when the pull was already up to date, stopped on an empty remote instead of pushing, and the pull dropped extras warnings. Add alwaysSync and a remote_empty code to /api/pull and surface all extras warnings.
2026-10-03 18:53:08 +08:00
Willie 73c4a8d27e feat(ui): resolve Git pull conflicts across computers
Guide diverged repositories through pull-and-merge or commit-and-pull before pushing. Compare conflicting file versions in the dashboard and require explicit choices tied to the reviewed revisions, while preserving both histories and automatic metadata merging.

Cover previews, modify/delete conflicts, stale and invalid choices, binary and large files, and dry-run behavior. Add an isolated preview fixture, verification runbook, translations, and documentation.

Validated with devcontainer make check, targeted Git API and UI tests, UI lint/build, website build, React Doctor, and a real isolated UI pull-resolution-push flow across all four themes.
2026-10-01 23:08:43 +08:00
Willie 36a314442b refactor(server): decode JSON request bodies through one size-limited helper
About 57 handlers decoded request bodies with no size limit, and the few
that had one each picked their own. They now go through decodeJSON with a
1 MiB default; handlers that need more keep their larger limit. An
oversized body gets 413 instead of whatever the handler returned for bad
JSON (MCP and plugin requests used to answer 400). Every other decode
error keeps the handler's existing status and message.
2026-09-30 02:25:42 +08:00
Willie 8cfeae1e7c fix(sync): translate the path overlap warning and link to Health Check
The server put a fixed English sentence into the sync warnings, so the
dashboard showed it untranslated in every locale. The sync response now
reports the overlap as a path_overlap count, and the dashboard renders
it from the locale files with a button that opens the Health Check page.
The pull flow keeps the English sentence because it only shows raw
warning strings.
2026-09-30 00:25:01 +08:00
Willie 9dab28fc19 fix(git): undo a pull's partial checkout and explain permission errors
When git cannot finish a pull's checkout (for example, it may not unlink
a root-owned file), it stops without undoing the files it already wrote,
and with no MERGE_HEAD there is nothing for merge --abort to undo. The
remote's copies then showed up as local changes: the dashboard blocked
the next pull and suggested committing them, which would push the stale
remote content back as a new commit.

A failed pull now restores paths that were clean before it started and
now hold exactly the upstream version, leaving the user's own edits
alone. The dashboard reports permission failures with a
permission_denied code and shows the chown command that gives the
source folder back to the current user.
2026-09-27 02:10:12 +08:00
Willie bf32112032 feat(git): show pending remote commits and auto-merge metadata conflicts
Two machines sharing a source repo kept stopping at the same two places.
The Git page had no way to know the remote moved until a push bounced, so
it now fetches once on open and labels Pull with the commit count (status
itself stays offline because the sidebar polls it). And both machines
rewrite .metadata.json on every install or update, so nearly every
diverged pull conflicted there; those conflicts are now merged per entry,
keeping the later installed_at, while any other conflict still stops the
pull and names the files.
2026-09-25 02:22:35 +08:00
Willie 51af1d30ba fix(git): recover when two machines push to the same source repo
Once both machines committed, the UI push was rejected and the follow-up
pull failed with "Need to specify how to reconcile divergent branches",
leaving no way out without a terminal. Pull now merges explicitly and
aborts a conflicted merge so a later commit-all cannot push conflict
markers; a rejected push returns push_rejected so the UI offers Pull.
2026-09-25 02:18:00 +08:00
Willie 2ed30eb1f8 feat: sync one project from its page
A project's pending changes could only be written by a full sync, which
also touched global targets and every other project. Sync project on the
project page previews and writes just that project's skills, agents and
MCP; the API takes a project root to scope the resource sync and the MCP
apply.

Refs #289
2026-09-22 15:17:11 +08:00
Willie 4bcd569e25 feat: MCP connections, plugins and a redesigned dashboard (v0.21.0) (#285)
* feat(mcp): sync portable server configuration across six clients

Add inline and external MCP sources with guided CLI and dashboard setup, native imports, conflict previews, ownership tracking, backups, and restore. Support Claude Code, Codex, Cursor, VS Code, OpenCode, and Grok CLI in global and project scopes.

Format YAML on save, document MCP fields in the config assistant, and keep its layout stable for scalar list items. Include schemas, localized UI copy, documentation, and regression and end-to-end coverage.

* fix(config): keep loading config when the MCP section is invalid

A mistake in the mcp section (an unknown key, a targets value that is
not a list, an invalid server field) made config.Load, LoadProject,
Save, SaveIn and ValidateConfig fail. Every command that reads config,
including skills sync, install, list and the dashboard, stopped working
because of settings it never uses.

MCPConfig now keeps a section that does not parse exactly as written and
records the error instead of returning it, so commands unrelated to MCP
load and save the config without touching that section. MCP commands
still validate their source on every run, and the dashboard config
editor calls the new ValidateMCP, so saving an invalid MCP section there
is still rejected.

Also correct the ProjectSources comment: sources.mcp resolves from the
directory containing config.yaml, not from the project root.

* fix(mcp): protect Agent files during concurrent edits and recovery

A release review of the MCP sync engine found ways it could lock users
out, report false conflicts, or change entries it does not own.

Recovery
- A failed write left pending.json behind, and every later MCP command
  refused to run. Failed writes now remove their journal, and a journal
  whose Agent file changed again is discarded, because ownership hashes
  still flag entries that no longer match.
- Preview no longer writes. It reads the ownership that recovery will
  record, byte for byte, so a preview stays valid across the recovery
  that the next write performs under the lock.

Concurrent Agent writes
- Claude Code rewrites ~/.claude.json on its own, so hashing whole files
  expired previews and failed applies. Revisions and pre-write checks
  now cover only the MCP entries, and apply rereads each file and applies
  the previewed entry edits to its current content, keeping settings the
  Agent wrote after the preview.

Comparison and ownership
- Only fields Skillshare renders are hashed, after dropping defaults
  Agents add or omit (type stdio/http, empty env, args or headers,
  enabled: true) and header name case, so equivalent entries are not
  reported as drift. enabled and disabled are compared, so turning off a
  managed server is a conflict instead of being overwritten.
- An unmanaged entry that already matches the source is reported as
  unchanged but no longer claimed, so removing the server never deletes
  an entry the user wrote. Import adopts it explicitly, and without
  --replace refuses to rewrite a differing entry, such as a literal token
  that import turned into an environment reference.
- Sync keeps Agent-only fields such as timeouts in existing entries.

Import
- Agent-only fields become warnings instead of blocking the import.
- streamable-http is accepted, and enabled/disabled flags are checked
  for every client.
- Values carrying a URL password, such as database DSNs, become
  environment references, and credential-like arguments are flagged.

Writes and state
- Save only renders the definition first, so a server that could never
  sync, such as one without targets, is rejected before it is saved.
- A symlinked config.yaml is written through to its target.
- TOML entries are updated in place, keep CRLF line endings, and repeated
  add/remove cycles no longer grow blank lines.
- JSON edits no longer HTML-escape characters such as &.
- GROK_HOME is honored.
- Backups keep the newest 20 per Agent file, pruned by file name, and
  damaged backup files are skipped instead of failing the list.
- GET /api/mcp no longer fails when an Agent that no server uses has an
  unresolvable path.

* feat(mcp): detect the client format of pasted JSON

Import without --from, the add wizard and the dashboard import API
assumed Claude's mcpServers shape unless a client was named, so VS Code
"servers" and OpenCode "mcp" snippets copied from server docs failed to
import. The client is now chosen by the top-level key, and a bare server
object still reads as Claude's single-entry shape.

TOML stays explicit because Codex and Grok share the format; a .toml
file without --from is still read as Codex.

* refactor(mcp): print CLI results through internal/ui

MCP commands wrote plain fmt output and duplicated statusFromErr, unlike
every other command. Plans, backup IDs and save/apply messages now use
the shared ui helpers, so they get the standard status prefixes and
colors; each change line shows the server name, action and target. The
operation log uses statusFromErr. --json output is unchanged.

* fix(server): serve MCP settings only to localhost or IP hosts

MCP settings include stdio commands that Agents execute, so a web page
must not be able to read or change them. The existing Origin check does
not stop DNS rebinding: once an attacker's domain resolves to 127.0.0.1,
the browser sends that domain as both Origin and Host from a loopback
address, and the dashboard also binds 0.0.0.0 in Docker.

Rebinding always needs a domain name, so every MCP route now also
requires a Host that is localhost or an IP literal, whatever the bind
address. Other dashboard routes are unaffected. Opening the dashboard
through a domain name, including a reverse proxy, therefore returns 403
for MCP settings; the message says to use localhost or an IP address,
because rewriting Host at the proxy would still fail the Origin check
and would reopen the hole.

Remove the unused POST /api/mcp/sync endpoint. Configuring with sync
covers it, and the guard wraps every remaining MCP route.

* fix(sync): make sync --all report MCP results reliably

- "sync -g mcp" and "sync --dry-run mcp" ran skills sync, because mcp
  was only recognized as the first argument. It now matches in any
  position.
- sync --all --json printed plain-text errors when the MCP preflight
  failed, and only an error on conflicts. Preflight errors now use the
  JSON error shape, and conflicts also return the credential-free plan so
  scripts can see which entries conflict.
- When resource sync failed, MCP was skipped without notice. Text output
  now warns that MCP settings were not applied; JSON output omits the mcp
  field, which --all otherwise always includes.
- MCP was applied with the preflight revision, which failed whenever the
  resource sync changed config or state in between. It is now planned
  again under the MCP lock, and conflicts found then still stop the
  write.

* fix(sync): recognize agents and extras after flags

sync only checked the first argument for a resource kind, so
"sync --dry-run agents" and "sync -g extras" silently synchronized
skills instead. Sync flags take no values, so the kind now matches in
any position.

The shared parseKindArg keeps its first-argument rule: uninstall, update
and similar commands accept resource names, and a name such as "agents"
must not be read as a kind.

* feat(ui): redesign the MCP dashboard around a server-by-agent matrix

The MCP page listed servers and planned changes as flat text, which made
it hard to see where each server is written and what needs attention.

- A matrix shows each server's status per Agent, summarizes pending
  changes and conflicts, and can hide synced entries. Agents whose MCP
  file or config directory exists are marked as detected; GET /api/mcp
  now returns the detected clients.
- Setup is a two-step dialog: add a remote URL, paste JSON or TOML, or
  import from an Agent, then preview which Agent files change. Importing
  an entry the Agent already has adopts it, Replace overrides only that
  entry, and a target selection equal to the inherited mcp.targets is
  saved without pinning targets on the server.
- Conflicts explain their cause and offer Import from <agent> or
  Replace. Removal lists the affected Agent files and offers removing
  from the source only or removing and syncing. Backups are grouped by
  day, with a preview before restoring a file.
- Agent icons appear on the MCP and Targets pages, and the universal
  target is marked as a path shared across agents. Brand icons come from
  @lobehub/icons-static-svg, with bundled SVGs for Warp and Zed.
- Segmented controls wrap instead of overflowing narrow containers.
- New copy is translated for every supported locale.

* fix(ui): let Sync all apply MCP after syncing resources

Sync all previewed MCP, synced skills, agents and extras, then applied
MCP with the revision from the first preview. When the resource sync
changed config or state, that revision was stale and MCP failed with
"preview again" after everything else had already been synced.

MCP is now rechecked before and after the resource sync by comparing the
reviewed changes (target, name and action) instead of the revision, and
applied with the fresh revision. A different set of changes still stops
before any MCP file is written.

* fix(ui): keep flow-style YAML collections when saving config

Formatting on save forced every collection into block style, so a
hand-written "targets: [claude, codex]" was expanded into a list each
time the config was saved. Each collection now keeps its flow or block
style, indentation is still normalized and comments are preserved, and
flow collections are not padded with spaces.

* docs(mcp): document ownership, normalization and dashboard host rules

- Explain that matching entries stay unmanaged until imported, so
  removing a server leaves them in place, and that import adopts an
  identical entry while --replace rewrites a differing one.
- Note that Agent defaults and header case are not treated as changes,
  that disabling a managed server is a conflict, and that previews stay
  valid while an Agent rewrites unrelated settings.
- Describe Agent-specific fields, streamable-http, GROK_HOME, backup
  retention, recovery by the next MCP write, and the VS Code limitation
  on environment references in headers.
- Document that MCP settings require opening the dashboard by localhost
  or an IP address, with SSH port forwarding for remote machines.
- Update the built-in skill for all six clients and the adoption rule,
  and the MCP runbook for import refusal, Agent-specific fields and
  pulled changes.

* docs(skill): streamline guidance and refresh resource workflows

Keep the built-in skill entrypoint focused and route agent and MCP details to dedicated references. Correct scope, audit, automation, and recovery guidance against the current CLI.

* feat(ui): redesign the dashboard around two styles and a flatter layout

The dashboard had grown page by page, so the same idea looked different
depending on where you met it and pages held controls with nothing to act on.
This rebuilds it on one token set that drives both the Clean and Playful styles
in light and dark, and reshapes the pages around what a person actually does.

Notable changes:

- MCP: replace the server-by-agent matrix with one row per server. The agents a
  server writes to are chips inside the row, so the list grows downwards as more
  CLIs gain MCP support instead of scrolling sideways.
- Settings: collect General, Backup, Log, Health, Extensions and Files into one
  page. The Files tab keeps a panel beside the editor showing what the field
  under the cursor does, the file's shape, or the unsaved changes.
- Audit rules: the YAML editor gets the same panel, plus a Test tab that runs a
  rule's regex against pasted lines.
- Skills and Agents become separate pages; install, search, updates and trash
  move into them. Old routes redirect.
- Tour: rewrite every step's copy, add MCP and Install steps, and anchor each
  step to a control that is always rendered so no step silently times out.
- Give every button a pointer cursor; the browser default does not say a button
  is clickable and each component class had to opt in by hand.

Docs follow the new Settings tabs and the MCP list.

* chore(devcontainer): move dev servers to uncommon ports

5173, 19420 and 8888 are defaults that other projects on the same
machine already hold, so `make devc` failed to bind and the container
never started. Use 45173, 49420 and 48888 instead, identical inside and
outside the container so every banner, log and doc prints the URL that
actually works.

* feat(ui): link dashboard source counts to their pages

The counts in the playful dashboard's source note named a number but led
nowhere, so reaching Skills or MCP from there meant going back to the
sidebar. Each row is now a link to its own page.

The hover fill uses currentColor because .ss-pinnote.src overrides the ink
tokens for the yellow note.

* feat(ui): build and browse hubs from the dashboard

A hub is a JSON index that lists skills, and until now the web UI could
only consume one someone else had already hosted. Writing the index by
hand was the only way to produce one, and the two halves never met: the
dialog that searched hubs and the page that would have built one shared a
config file but nothing else.

The new /hubs page holds both halves behind two tabs:

  Browse   pick a hub, filter its contents by tag or text, install from it
           without leaving the page
  My hubs  assemble an index from installed skills, validate it, export it

A draft is offered as a source in Browse straight away, read from the
draft API rather than a file, so you can see what a recipient sees before
deciding whether to host anything. Where the index is hosted is stored on
the draft and stripped from the exported document, so a reopened hub
remembers where it was published and the published file stays clean.

Hub management moves out of the install dialog, which keeps only the
search-source dropdown and links here.

Routing switches to createBrowserRouter for useBlocker, which guards the
builder against navigating away from unsaved entries.

* docs(extras): add shared instructions recipe for AGENTS.md across agents

Answers a recurring question about sharing one instruction file between AI
agents: extras already covers it, since each agent keeps its user-level
copy in its own directory and one extra can target all of them.

Naming the source file AGENTS.md rather than something neutral matters —
Codex concatenates AGENTS.md files and has no import syntax, so it only
recognises the file by name. Claude Code and Antigravity read a fixed
filename of their own but resolve @-imports, so a one-line CLAUDE.md or
GEMINI.md picks up the synced file.

Says plainly that this is not agent memory. Agents keep their own
learnings in private stores — a Markdown directory for Claude Code, a
database for Codex, non-file storage for Cursor — so that side is a
migration problem, not something syncing files can solve.

* feat(ui): filter skills and agents by target

The Targets column showed which targets a resource reaches, but there was
no way to narrow the list down to one. The filter reads the sync matrix —
the same source that column renders — so a result always matches the icons
the rows show.

Options and counts are derived from the matrix, so no target is offered
that would filter to nothing, and the control stays hidden until at least
two targets have something. A selected target that disappears on a kind
switch or an uninstall falls back to All rather than emptying the list.

The toolbar had 24px to spare at 1440px, so the new control wrapped the
row. Source moves from a 325px segmented control to a dropdown like its
neighbours, and every filter now sizes to its label instead of a fixed
width that truncated the longer values.

* fix(ui): tighten page headers and reach hubs from skills

PageHeader carried mb-7 while .ss-wrap already separates its children with a
28px flex gap. Margins and flex gaps add up rather than collapse, so every
page inside the wrapper opened with a 56px hole under its title. Move the
default onto .ss-pgh so the wrapper can zero it, keeping the 28px for pages
that lay out their own children.

Hubs is a source you install from and a catalog you publish, not inventory
you own, so it no longer sits in the Library group next to Skills, Agents and
Plugins. The Skills page header already links to it and the page already
carries a back link there. Skills stays highlighted while the hub page is
open. Plugins takes the Package icon its own page identifies with, so the
sidebar no longer shows two identical puzzle pieces.

* fix(skill): stop implement-feature from running --no-tui as a command

The dispatch-order note wrote "not --no-tui" as !`--no-tui`. In a skill file
that is the syntax for running a shell command at load time, so the skill died
with "command not found: --no-tui" before any of it could be read. Spell the
condition out in words instead.

* feat(list): toggle model invocation for a skill with M

The only cheap gesture in the list TUI was E, which hides a skill from every
harness. Wanting a skill installed but not auto-loaded meant leaving the TUI
to edit SKILL.md, so people disabled skills they only meant to make
manual-only. M flips disable-model-invocation in place and the detail panel
shows a "manual only" badge so the state is never a blind toggle.

Unlike E this edits the skill file, which upstream may own: update skips
tracked repos with local changes, and reinstalling a skill drops the edit. M
says so and asks before writing in those cases. The flag is written as a
single-line edit rather than a YAML round-trip, and turning it back off
removes the line, so two presses return the file byte for byte and a tracked
repo is clean again. Agents are left alone; their harnesses do not read the key.

Refs #283

* feat(plugin): manage complete plugins across agent tools

Add CLI, TUI, and web flows for discovery, adoption, sync selection, updates, and removal while preserving native package formats and unrelated installations.

Support Claude, Codex, Cursor, Antigravity desktop, Pi, and OpenCode. Update help, completions, built-in skill, and documentation; keep plugins outside sync --all.

* docs(skill): describe the redesigned dashboard in the style skill

The style skill still documented the pre-redesign hand-drawn system, so
pages written with it came out on legacy tokens and outside the ss-*
classes; the new Plugins page was the first casualty.

The rewrite names tokens and classes and points to components.css for
their values, because copied values are what went stale last time. The
ui command docs described Playful by the old look as well.

* fix(ui): keep Playful ghost buttons free of stray shadows

The hover and disabled rules outranked the ghost variant's
box-shadow: none, so a frameless button grew a lone shadow arc in
Playful. Bulk toolbar and toast buttons shared the problem.

Ghost also gets a soft outline in Playful: beside 2px ink frames a bare
label such as Cancel did not read as a button.

* refactor(ui): lay out the Plugins page like the MCP page

The page was built on legacy tokens and plain markup, so it missed the
Playful frames and drifted from every other page. A per-agent column
layout would not have scaled either: each agent that gains plugin
support would add a column.

Plugins now follow the MCP server list: one row per plugin with its
agents as toggles inside the row, so the list only grows downwards.
Per-agent sync and update move to package-level actions in the row
menu, and the dialogs use the standard header, body and footer.

* feat(ui): give plugins a kind colour and per-agent actions

Plugins borrowed a neutral grey tile because no kind colour existed,
which made them the one resource without an identity on the page.
Magenta sits furthest from the five hues already taken.

Laying plugins out as rows had dropped the per-agent sync and update.
Retrying one agent after a partial failure should not re-run the rest,
so each agent in the expanded row gets its own menu. Update is left out
for a deselected agent, which has nothing installed to update.

* feat(ui): count plugins on the Dashboard

The source summary listed every resource kind except plugins, so the
Dashboard under-reported what a source holds. The Playful source note
grows to fit a fifth row.

MCP now sits above Plugins in the sidebar to match that order, and its
Dashboard label reuses the sidebar's "MCP" instead of a longer string
of its own.

* feat(scripts): add a host verification environment

Plugin and MCP work talks to the real Agent CLIs, and those live on the
host, not in the devcontainer, where every target reports "not installed".
Verifying by hand meant either pointing a build at real config or
assembling a dozen environment variables each time.

`make verify` builds a host binary and runs it against .verify-home/ in
the repo, redirecting HOME, the XDG dirs and each agent's own config
variable. The environment starts from `env -i`, so a stray
SKILLSHARE_CONFIG in the caller's shell cannot pull the run back to real
paths. Living inside the repo is safe because project-mode detection
only inspects the working directory and never walks up to a parent.

It also seeds the dashboard cache from ui/dist. A dev build serves a
placeholder rather than the working tree, because runtime download only
applies to numbered versions, so the UI was previously unverifiable
without a release.

* fix(ui): show progress while a plugin selection is applied

Toggling an agent shells out to that agent's own CLI, which takes
seconds. The row gave no sign of it: the toggle only greyed out, and
the confirmation badge is hidden while a target is deselected, so
turning one on looked like nothing happened at all.

The toggle being applied now lifts out of the greyed state and spins in
its badge. Agent versions also get room for their real strings, since
"2.1.276 (Claude Code)" was truncated to a width chosen for a bare
version number.

verify.sh gains a 'run' subcommand, so the same throwaway environment
can be driven from a script rather than only an interactive shell.

* fix(ui): spin the control that started a plugin action

Reading the inventory shells out to six agent CLIs and takes about two
and a half seconds, and every action refreshes it afterwards. Nothing on
the page said so: a menu action closed the menu and left the page still,
so the wait read as a freeze.

Each control now tracks its own work. Check, sync and import spin in
place, a menu action spins the row it acts on, and the agents refresh
follows the query itself rather than the mutation flag.

* feat(ui): split MCP add and import by where the configuration comes from

"Import from a target" opened a dialog whose second tab pasted a snippet,
which is not a target and usually comes from a provider's setup page rather
than a tool the user already configured. Pasting is a way to add a server,
so it moves under "Add server" beside the form, and importing now means one
thing: read what an installed Agent already has.

The paste side gains a file picker, matching `mcp import --file`; the API
only ever took content, so the browser reads the file and fills the editor.

The target picker no longer waits for a successful parse, and a footer that
said "writes 0 config files" next to a greyed-out button now names what is
missing instead.

* fix(ui): label the plugins result strip as the last action

The strip and the plugin inventory below it used the same list styling with
no heading on either, so two rows carrying the same plugin name read as one
list. The status word made it worse: "imported" is one of the outcomes
lifecycle.go returns for an action, but it sat where an inventory row shows
state, so it looked like a property of the plugin.

Give it the section heading the Agents list already has, plus a count and a
dismiss button, so it reads as the report it is.

* feat(plugins): expand compatibility and clarify setup guidance

Support additional native targets, safe source links, Git refs, and explicit OpenCode entries while exposing per-target capabilities across CLI, TUI, and UI.

Separate unsupported integrations from environment errors, explain next steps in plain language, and link official documentation. Update built-in guidance, website docs, completions, and regression coverage.

* feat(plugin): serve a plugin's files and translatable discovery problems

The dashboard could only show a plugin's name and targets, so reviewing
what a plugin ships meant opening the snapshot by hand. Files and
ReadFile expose the reviewed local copy read-only through os.OpenRoot,
which keeps reads inside the snapshot even across symlinks.

Discovery problems now carry a key and arguments next to the English
sentence, so the dashboard can translate them while the CLI keeps its
wording. Inventory asks every Agent CLI in parallel and Packages answers
from config alone, so the plugin list no longer waits on the slowest CLI.

* feat(mcp): sync to Pi, show native config, and lay out written entries

Pi has no built-in MCP support, so a server targeting it must name the
third-party extension that will read the file. `--pi-extension` and the
`piExtension` source field record that choice, and sync writes the file
format of the chosen package instead of guessing.

RenderNative and POST /api/mcp/render return what each Agent would
receive for a definition, with secrets kept as references, so the
dashboard can show the result before anything is written.

Sync used to insert entries on a single line and never revisit them. A
managed entry that still sits on one line is now reported as an update
and rewritten one field per line; entries formatted by hand are left
alone.

* feat(ui): choose plugin Agents like MCP, browse plugin files, view MCP config

The plugin fold listed bound Agents with a per-Agent menu, while MCP let
you simply tick the Agents you want. Plugins now work the same way: the
fold discovers where the source can also go, shows those Agents as
unticked toggles, and a tick previews an install. The per-Agent menu is
gone, and updating a plugin targets only the Agents that support it
instead of hiding the action when one of them does not.

A plugin with a local copy can be browsed in a read-only files dialog,
using the same tree as a skill's Files tab. The MCP "view config" moved
out of a fold in the server form into its own view, reachable from the
server menu, so the native result has room to be read. The MCP dialogs
also ask for the Pi extension when Pi is selected.

Playful tile names drop from 25px to 22px: "brainstorming" was 1px wider
than the tile and lost its last letter to the next line.

* docs: reshoot dashboard screenshots for the redesigned UI

The README and website still showed the pre-redesign dashboard, which no longer matches what users see after upgrading.

* docs: describe MCP, plugins and the new dashboard for v0.21.0

The README still announced v0.20.0 and never mentioned plugins, and its
MCP section listed four clients. The built-in skill and the docs pick up
the Pi extension setup, the formatting-only MCP update, and the plugin
fold and files dialog, so agents and users are not surprised by them.
2026-09-19 03:14:03 +08:00
Willie 3743a1ef3f fix(sync): honor file ignore patterns in copy mode
Apply config ignore patterns to copy-mode file traversal, checksum, mtime, CLI diff, and server sync/diff paths.

Add default ignores for .DS_Store, .git, and __pycache__ in global and project init configs.

Tests: go test ./... -count=1
2026-06-29 10:30:11 +08:00
Willie 140df6b4c9 fix(server): surface git fetch failures
Return errors from branch refresh and checkout when git fetch fails instead of serving stale refs or proceeding with checkout.

Cover branch-list and checkout fetch failures with server regression tests.
2026-06-14 15:08:19 +08:00
Willie 4d08690d36 fix(review): address PR #174 review feedback
- handler_git: dashboard Pull auto-sync now uses EffectiveSkillsSource()
  instead of the git_root scope dir, so it no longer mangles skill rel
  paths (skills/foo -> skills__foo) when git_root is root/agents/extras
- extension: run the transform subprocess via CommandContext with a 30s
  timeout so a hung extension can't block sync indefinitely
- md-toml.js (codex-agents, gemini-commands): escape values via
  JSON.stringify so control characters produce valid TOML basic strings
- gitroot: quote paths in the commit/push mv guidance so paths with spaces
  can be pasted safely
- extras list + extras server handlers: warn when an extension fails to
  resolve instead of silently falling back and reporting false drift

Lock-contention suggestions on handleSetGitRoot/handleAbsorbNested are not
applied: this is a single-user localhost dashboard, and dropping the write
lock around .git-mutating operations trades safety for negligible throughput.
2026-05-30 19:23:12 +08:00
Willie 2f6f6bd052 fix(git): enforce root-scope safety on commit/push instead of warning
Root-scope git operations detected hazards but proceeded anyway, letting
preventable mistakes reach the remote:

- Nested git repos were only warned about, then committed/pushed as empty
  submodules (silent data loss). Now commit/push abort (CLI non-zero exit,
  server 400) until the nested repos are disabled, and the web UI disables
  the commit/push buttons while any are present.
- The pre-stage safety sweep ran before the dry-run check, so `--dry-run`
  wrote .gitignore and ran `git rm --cached config.yaml`. The sweep/guard is
  now strictly read-only on dry-run and only reports what would change.
- Server git endpoints used EffectiveGitRoot() without validating git_root,
  so a hand-edited invalid scope silently fell back to skills. They now share
  a gitSource() guard that rejects invalid scopes with 400, mirroring the
  CLI's resolveGitRoot.
2026-05-30 19:23:12 +08:00
Willie eda9ac75a4 feat(git-root): guard root scope against submodule traps and config leaks
At the root git_root scope, `git add -A` over the config base directory
records any subdirectory that has its own .git (e.g. the skills source) as
an empty submodule, and can commit the machine-specific config.yaml.

- Detect nested repos and warn before commit/push (CLI) or surface them on
  the Git Sync page with a one-click "Disable nested .git" action (UI),
  which renames .git to .git.disabled (reversible) and drops any stale
  gitlink from the index so the directory's files track as normal blobs.
- Keep config.yaml out of a root-scope repo automatically: ensure it is
  ignored and untrack it (git rm --cached) before staging, on both the CLI
  and the web UI commit/push paths.
- Expose nestedRepos/configTracked in GET /api/git/status and add
  POST /api/git/absorb-nested (validated against detected nested repos).
2026-05-30 19:23:12 +08:00
Willie 96ead0b361 feat(ui): make Git Sync not-a-repo state actionable
The not-a-repo state was a dead end: the scope switcher only rendered once a
repo existed, so there was no way to initialize git or set a remote from the
UI. Add an 'Initialize git repository' button that opens the existing scope
dialog (with optional remote) — POST /api/git/root already inits the scope
repo and wires origin. Dialog title/message adapt for the init case.

Also detect a missing git executable: gitStatus reports gitInstalled (via
exec.LookPath), the page shows a clear 'Git is not installed' notice instead
of a cryptic 500 on init, and handleSetGitRoot rejects with a plain message.
2026-05-30 19:23:12 +08:00
Willie 53e5b2455b feat(ui): set git remote during scope switch on Git Sync page
The Git Sync scope switcher now accepts an optional remote URL, reaching
UI parity with the CLI's `init --git-root <scope> --remote <url>`. The
POST /api/git/root handler takes an optional remoteURL and wires origin on
the just-initialized scope repo via a new git.SetOrAddRemote helper (adds
origin when absent, updates the URL otherwise). Adds gitSync.scope.remote*
strings across all locales.
2026-05-30 19:23:12 +08:00
Willie e51134af24 feat(git-root): surface scope mismatch in UI and document git_root field
Add Config.GitRootMismatch() as the single source of truth for detecting
when the git repo lives at a different scope than git_root configures, and
reuse it across the CLI guidance, the server status response (scopeMismatch
/mismatchScope/mismatchDir), and a new warning banner on the Git Sync page.

Document git_root in the config structure-view field docs (fieldDocs) and the
GitStatus client type, and add the gitSync.scope.* / gitSync.mismatch.* i18n
keys across all locales to keep dictionary parity.

Cover the behavior with config, server handler, and CLI integration tests:
push/pull honor the root scope (agents files reach the remote, config.yaml
stays untracked), POST /git/root inits+persists the scope and rejects invalid
scopes and project mode, and git status reports scope mismatches.
2026-05-30 19:23:12 +08:00
Willie 16c6e8ec8d feat(server): git operations honor git_root scope + POST /git/root to switch scope
- extract shared git.InitScopeRepo/WriteScopeGitignore/EnsureLocalIdentity (UI-free)
- cmd init delegates to the shared helpers (no logic duplication)
- handler_git operations use EffectiveGitRoot; status exposes the scope
- new POST /api/git/root inits a repo at the target scope dir + persists git_root
2026-05-30 19:23:12 +08:00
Willie d6600e744a feat: add UI local commit action 2026-05-27 16:28:50 +08:00
Willie 996d00e342 feat(config): migrate consumers to Effective*Source helpers (Phase 3+5)
Make the v0.19.16 sources map actually do something: route all path
reads through Config.EffectiveSkillsSource() / EffectiveAgentsSource() /
EffectiveExtrasSource() so users who set sources.skills / sources.agents /
sources.extras get the configured paths everywhere.

Mechanical changes (~50 files):
- cmd/skillshare/**: replace cfg.Source / cfg.ExtrasSource reads with
  cfg.EffectiveSkillsSource() / cfg.EffectiveExtrasSource()
- internal/server/**: replace s.cfg.Source / s.cfg.ExtrasSource reads
  with the same helpers; server.skillsSource() / gitignoreDir() use the
  global-mode helper
- internal/config/config_validate.go: validate using EffectiveSkillsSource
  while still rejecting configs that set neither field explicitly
- internal/config/reconcile.go, registry.go: read via helpers

Behavioral fixes (paired with the migration):
- extras init / extras source / POST /api/extras no longer silently
  backfill the legacy extras_source field — the runtime fallback inside
  EffectiveExtrasSource() handles it. This stops surprise diffs in users'
  config.yaml after running extras commands.
- extras source command writes back to whichever field the user already
  configured (sources.extras if set, otherwise legacy extras_source) so
  the update is not shadowed.
- source_type in /api/extras and extras list correctly reports "default"
  vs "extras_source" by inspecting the raw (unresolved) configured value;
  sources.extras counts as configured for this purpose.

UI:
- ui/src/lib/fieldDocs.ts: neutralize sources / sources.* descriptions
  so they describe both project and global modes (Phase 5).

Preserved (intentional):
- Direct writes to cfg.Source / cfg.AgentsSource / cfg.ExtrasSource in
  init, migrate.go, cloneForSave, and server.reloadConfig — these are
  raw-field writes, not path reads.
- Updated test expectations for the removed backfills.
2026-05-21 14:49:11 +08:00
Willie 465db305ca feat(sync): pass projectRoot from project-mode callers
Project-mode sync now passes the project root directory through to
createLink, enabling relative symlinks for all paths under the project.
Server handlers use s.projectRoot for project-mode dashboards.

Ref: #120
2026-04-07 17:26:37 +08:00
Willie 3c8c56002d feat(sync): wire projectRoot through merge and symlink sync paths
SyncTargetMerge, SyncTargetMergeWithSkills, CreateSymlink, and SyncTarget
now accept projectRoot. When non-empty, createLink uses relative symlinks
for paths under the project root.

All existing callers pass empty string (global mode, no behavior change).

Ref: #120
2026-04-07 17:26:37 +08:00
Willie ccdafd3293 feat(sync): add target_naming config option (flat/standard)
Add per-target target_naming setting that controls how skill directories
are named in sync targets. 'flat' (default) preserves the existing
flattened __ separator behavior. 'standard' uses the SKILL.md name field
directly, following the Agent Skills specification.

Standard mode:
- Validates SKILL.md names match directory basenames
- Detects and skips name collisions with warnings
- Auto-migrates managed entries when switching from flat to standard
- Preserves legacy entries when bare name is already occupied

Also includes:
- Per-target toggle via CLI (--target-naming), TUI (N key), and Web UI
- Collision output redesigned as deduplicated compact summary
- Config inheritance: global target_naming → per-target override
- JSON schema + UI validation for the new field

Closes #110
2026-04-01 00:32:49 +08:00
Willie 41dd81b7f2 refactor: migrate all callers to SkillsConfig() / EnsureSkills()
44 files across CLI commands, sync engine, and server handlers now use
SkillsConfig() for reads and EnsureSkills() for writes instead of
accessing flat TargetConfig fields directly.

Key changes:
- sync engine (SyncTargetMerge/Copy/Symlink): reads sc := target.SkillsConfig()
- target commands: filter add/remove and mode set use EnsureSkills()
- target TUI: mode picker, filter ops, detail panel all via SkillsConfig()
- server handlers: backup, restore, targets, sync, diff, collect, analyze
- init/init_project: new target creation uses Skills sub-key
- doctor, status, diff: target display reads from SkillsConfig()
- computeTargetDiff: accepts config.TargetConfig directly (was anon struct)
2026-03-29 04:59:23 +08:00
Willie 5307b3276e fix(server): use snapshot pattern to eliminate map races and narrow lock scope
Addresses P1 and P2 from code review on the RWMutex commit:

P1 — Stream handlers now snapshot config under RLock before streaming:
- handleDiffStream: clone Targets map to prevent concurrent map panic
- handleCheckStream, handleAuditStream: snapshot source/projectRoot
- handleUpdateStream: snapshot source (per-item Lock already correct)

P2 — All read handlers now use narrow snapshot instead of defer RUnlock:
- RLock → copy needed fields to locals → RUnlock → do work with locals
- Prevents slow I/O (git fetch, version check, audit scan) from blocking
  the auto-reload middleware's exclusive Lock on concurrent requests

Other changes:
- computeTargetDiff takes source parameter (no more s.cfg.Source access)
- Add cloneTargets() helper for safe map copying
- Add writeOpsLogTo/writeAuditLogTo for lock-free oplog writes
2026-03-17 04:48:42 +08:00
Willie 11f696cffe fix(server): upgrade Mutex to RWMutex for concurrent read safety
Addresses PR #82 review: read-only handlers accessed s.cfg without
synchronization, risking data races with concurrent config reloads.

- Upgrade sync.Mutex → sync.RWMutex (drop-in compatible)
- Add RLock to 26 non-streaming read handlers
- Keep exclusive Lock for write handlers (unchanged)
- Skip SSE streaming handlers to avoid blocking writes during streams
- Fix isConfigGitignored to propagate GitignoreContains errors
2026-03-17 04:48:42 +08:00
Willie 7d0952b8b6 feat(ui): add branch switcher to Git Sync page
Allow non-technical users to switch branches from the Web UI without
needing a terminal. The dropdown shows local branches first, then
remote-only branches tagged "(remote)".

Backend:
- Add ListLocalBranches, ListRemoteBranches, Checkout to internal/git
- Add GET /api/git/branches (?fetch=true for remote discovery)
- Add POST /api/git/checkout with dirty-check guard + fetch-before-switch
- Oplog instrumentation for checkout operations

Frontend:
- Branch Select dropdown replaces static text when >1 branch exists
- Refresh button to fetch new remote branches on demand
- Dirty state disables switching with visual hint
- Card overflow + z-index fix for playful theme dropdown clipping
2026-03-14 04:01:10 +08:00
Willie d842d7a871 feat(ui): add Repository Info Card to Git Sync page
Replace the minimal Repo Status Card with a full Repository Info Card
showing remote URL with platform detection (GitHub/GitLab/Bitbucket),
branch tracking info, HEAD commit hash and message, and status badges.

Backend: export GetRemoteURL, add GetHeadMessage and GetTrackingBranch
to internal/git, extend /api/git/status with 4 new fields.

Frontend: new parseRemoteURL utility parses SSH/HTTPS remote URLs and
detects platform by exact hostname match. RepoInfoCard displays parsed
owner/repo with platform icon, clickable link, copy button, and
graceful fallbacks for missing remote or unparseable URLs.
2026-03-14 04:01:10 +08:00
Willie d1370c0f98 fix(sync): preserve external symlinks in merge/copy mode conversions
When a target directory is an external symlink (e.g., dotfiles manager
pointing ~/.claude/skills/ elsewhere), sync previously deleted it
unconditionally during symlink→merge/copy mode conversion. This also
affected DiscoverSourceSkills which failed to traverse symlinked source
directories because filepath.Walk uses Lstat on root.

Changes:
- Add resolveWalkRoot() helper; use in both Discover functions so
  filepath.Walk enters symlinked source directories
- Add isSymlinkToSource() to distinguish source-pointing symlinks
  (symlink mode residue, safe to remove) from external symlinks
- Pass explicit sourcePath to SyncTargetMergeWithSkills and
  SyncTargetCopyWithSkills for reliable symlink origin detection
- Fix FindLocalSkills to use utils.ResolveLinkTarget (handles relative
  symlinks correctly) and follow external symlinks for scanning
- Fix CheckStatusMerge to follow external symlinks instead of returning
  StatusConflict
- Add 17 unit tests and 6 integration tests covering symlinked source,
  target, both, chained symlinks, idempotency, prune, and pull
2026-03-02 10:05:57 +08:00
Willie 2f6dd42695 perf(sync): cache discovery + add progress UI for sync operations
DiscoverSourceSkills was called 1+2N times (N = number of targets),
each doing a full filepath.Walk + SKILL.md frontmatter parsing.
Now discovered once and passed to all targets via WithSkills variants.

Changes:
- Add SyncTargetMergeWithSkills, PruneOrphanLinksWithSkills (PruneOptions struct)
- Add SyncTargetCopyWithSkills with onProgress callback, PruneOrphanCopiesWithSkills
- Discovery spinner + per-target reporting + summary line in CLI
- Copy mode shows per-skill spinner progress during slow checksum+copy
- Collision report uses dim gray text to avoid confusion with sync results
- Server handlers (handleSync, handlePull) use single discovery pass
- Fix pre-existing TestLog_StatsOutput assertion ("Success rate" → "OK:")
2026-02-26 22:27:23 +08:00
Willie 3b8c681bb2 feat: auto-inject auth tokens for hub search and Web UI git operations
Add token auto-injection for private repo support across all platforms:
- Hub search (--hub): normalize web URLs to raw-content URLs and apply
  platform-specific auth headers (GitLab, GitHub, Bitbucket)
- Web UI push/pull/update: use *WithAuth variants for git operations
- Export ResolveTokenForURL and DetectPlatformForURL from install/auth
2026-02-22 15:13:10 +08:00
Willie 76e1f6e3a9 fix: prune broken external symlinks after data migration (#28)
After data migration (e.g. XDG path change), target symlinks still
point to old source path. PruneOrphanLinks treated these as "external"
and always preserved them, even with --force.

- Auto-remove broken external symlinks (target no longer exists)
- Pass force flag to PruneOrphanLinks; force removes valid external symlinks
- Use utils.PathHasPrefix for Windows case-insensitive path comparison
2026-02-16 15:23:03 +08:00
Willie a29e198725 feat: add target filter CLI, skill-level targets field, and Web UI support
- CLI: `target <name> --add-include/--add-exclude/--remove-include/--remove-exclude`
- SKILL.md `targets` frontmatter restricts sync to specified targets
- Cross-mode matching (e.g. "claude" matches "claude-code" project target)
- Web UI: inline filter editor on Targets page, target badges on Skills pages
- API: PATCH /api/targets/{name} for filter updates
- Fix drift detection in doctor/status/handler to account for skill-level targets
- `check` warns about unknown target names in skill-level targets field
- Docs: update skill-format, target command, configuration, creating-skills
2026-02-15 23:29:30 +08:00
Willie bd75ef8939 feat: support target include/exclude filters across sync, UI, and docs 2026-02-14 00:21:48 +08:00
Willie d8699762ad fix: use deep skill count in init and prevent null files in git status API
- init: replace shallow os.ReadDir count with DiscoverSourceSkills()
  to correctly count nested skills by SKILL.md presence
- handler_git: guard against nil slice from GetDirtyFiles() overwriting
  the initialized empty slice, which serialized as JSON null
- GitSyncPage: add optional chaining on status.files for defense
2026-02-13 14:21:36 +08:00
Willie e5813cc7e0 feat: add oplog instrumentation to all API handlers, improve audit/log/sync CLI
- Add oplog write helpers to server (oplog_helper.go) and instrument
  all handler_*.go endpoints with ops/audit logging
- Improve audit CLI with structured auditRunSummary and severity counts
- Enhance log CLI with richer filtering and detail display
- Improve sync CLI with drift detection summaries in oplog
- Reorder web UI sidebar nav by user workflow (core → acquire → distribute → maintain → monitor)
- Enhance LogPage with better formatting and filtering
- Add server oplog unit tests (logging_test.go, log_test.go)
- Update docs for log command and quick-reference
2026-02-10 03:50:03 +08:00
Willie 092fb14f8a feat: add web dashboard with embedded React SPA (skillshare ui)
Single-binary web UI for visual skill management — React 19 + Vite
frontend embedded via go:embed, Go net/http REST API backend (30+
endpoints). Includes dashboard, skills browser, targets, sync, collect,
search, install, config editor, backup/restore, and git sync pages.

Also adds Bitbucket/GitLab URL parsing for install, git operations
library, skill version checking, CI frontend build steps, Docker
sandbox support, and website docs for the ui command.
2026-02-08 05:08:30 +08:00