Commit Graph
2209 Commits
Author SHA1 Message Date
Willie 5dfd63d5e9 fix(sync): fail only the target whose config is invalid
Any per-target config problem, such as a skills path that is a file or
an unknown mode, made `skillshare sync`, `sync -p` and the dashboard
refuse to sync anything. That contradicts the policy that sync runs
every target and reports the ones that failed. Sync now validates the
config as a whole first and still stops on global problems (source,
global mode or naming, git_root, extras); a target whose own settings
are invalid is skipped for skills and agents and reported as failed
("invalid config" in CLI output and --json details, part "config" in
the dashboard's failed list). Config validation on save is unchanged.
2026-09-30 03:27:20 +08:00
Willie d6960e46a7 fix(sync): count agent failures in the sync operation log
The log counted only skills targets as failed. The CLI wrote its sync
entry before `sync --all` ran agents, `sync agents` logged empty stats,
and the dashboard left agent failures out of targets_failed, so a run
that lost a target's agents still read "ok" and Last sync could not
say what failed. CLI and dashboard now log once after every part ran:
targets_failed counts each failed target once, the new failed_targets
lists their names, and targets_total is every target in scope.
2026-09-30 03:25:26 +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 b8616dc93b fix(ui): keep syncing MCP when an extras target fails
runSync threw at the first extras target with an error, after skills
and agents had already synced. The Sync page then dropped their result
and warnings, never wrote MCP, and showed one error without naming the
extra or target. It now collects every failed extras target and carries
on, matching `sync --all`; the page lists each as "<extra> → <target>:
<error>".
2026-09-30 03:01:31 +08:00
Willie 7fd9a8fe40 docs(ui): describe what the Sync page shows when a target fails
Since 191bdec3 a dashboard sync keeps going after a skills target
fails, but the Sync row only described the happy path. It now says what
the page actually shows: failures as warnings with the run marked
partial, an error when every skills target fails, and an extras failure
that stops before MCP is written.
2026-09-30 02:57:48 +08:00
Willie 82b4033684 docs(uninstall): describe the git status block in help and tracked repo docs
uninstall has failed a tracked repo whose git status cannot be read
since 8e5a09c4, but --help still listed only the uncommitted-changes
check. The tracked repositories page also said a dirty repo only warns
and that the directory is removed, while uninstall stops unless --force
and moves the repo to trash.
2026-09-30 02:54:49 +08:00
Willie d741baf333 docs: document unreadable git status and translate recent command changes
uninstall now fails a tracked repo whose git status cannot be read
unless --force, but the command page and built-in skill still described
only the uncommitted-changes check. The recent list, status, sync,
update and uninstall changes were also English-only, while this site
updates every locale alongside the English page.
2026-09-30 02:47:18 +08:00
Willie 92b78c2962 docs(wiki): route agents to the shared sync runners and request helpers
The recent refactors consolidated sync loops into internal/sync runners,
server body decoding into decodeJSON, and UI kind queries into kindQuery.
Without pointers in the topics an agent would likely reimplement these
inline and reintroduce the drift the refactors removed.
2026-09-30 02:41:39 +08:00
Willie 7dfb7644a4 refactor(uninstall): run global and project skill uninstall through one flow
Global and project uninstall each carried their own resolve, preflight,
confirm, execute, gitignore and finalize steps, about 1700 lines in two
files that had drifted. One runUninstallSkills flow now serves both,
with an uninstallMode struct holding what differs: source and trash
dirs, config, glob and --json support, prompt and hint wording, gitignore
handling, and project lock pruning.

Output, prompts, JSON, oplog entries and exit codes are unchanged; the
characterization tests from 60732db3 pass as before. The one change in
how it runs: project mode now checks tracked repos' git status in
parallel like global, printing the same lines in the same order once the
checks finish.
2026-09-30 02:37:03 +08:00
Willie 2a5cfd382c fix(ui): revert the open ignore file instead of config.yaml
On the .skillignore and .agentignore tabs, Revert reset the config.yaml
editor and left the ignore file's edits in place, so the button looked
like it did nothing. It now resets whichever file the tab has open.
2026-09-30 02:33:38 +08:00
Willie 9fd26e154b refactor(ui): build the kind query through one encoding helper
resources.ts and audit.ts appended ?kind= unencoded while backups.ts
encoded it. Every call now uses kindQuery in http.ts, which encodes.
Today's kind values are fixed words, so requests do not change; the
helper keeps a future value from breaking the query string.
2026-09-30 02:31:29 +08:00
Willie 85bf933451 fix(uninstall): log project uninstalls with global oplog semantics
The project wrapper logged every call, including --help (recorded as a
skill named "--help"), resolve errors, declined prompts and dry runs, and
always with zero succeeded, so a partial uninstall never showed as
partial. Project uninstall now logs once when it has run, with the real
succeeded count, exactly like global. The project list TUI, which calls
it directly, now logs its uninstalls too, as the global one already did.
2026-09-30 02:30:39 +08:00
Willie 5b54dd67b7 fix(uninstall): report specific resolve errors in project mode
Project uninstall had its own name resolver that turned every problem
into "not found", hiding that a name matched several nested skills or
pointed at a file. It now uses the global resolver, so both modes report
the same specific errors; only the not-found wording still names the
project's skills directory.
2026-09-30 02:29:07 +08:00
Willie cbe8d3a437 refactor(ui): share query hooks for overview, mcp, skills, targets and diff
Close to thirty components and pages each spelled out the same query key,
fetcher and stale time for these shared queries. They now call one hook
per query and pass only what differs per page: enabled flags, polling,
and the MCP stale time, which pages already disagreed on and keep.
2026-09-30 02:29:07 +08:00
Willie b6613b5d12 fix(git): include git's stderr when IsDirty fails
uninstall, update, status, list and the Web API now report "failed to
check git status: <err>", but the error was only "exit status 128"
because IsDirty dropped what git printed on stderr. The message now says
why git status failed, such as a corrupt index.
2026-09-30 02:27:48 +08:00
Willie 880dad5c22 fix(status,list): show unreadable git status as unknown instead of clean
status and list discarded the error from the uncommitted-changes check,
so a tracked repo whose git status could not be read was shown as
up-to-date. They now show it as unknown with a warning naming the repo
and error; status --json sets the existing status and message fields.
The commands still succeed, since they only report.
2026-09-30 02:26:24 +08:00
Willie 350d71f41c fix(uninstall): keep project operational gitignore entries in .skillshare
Project uninstall backfills logs/, trash/ and backups/ into a gitignore
for projects created before v0.17.3. Since 60e19f96 ensureProjectGitignore
takes the .skillshare directory, but this caller still passed the project
root, so those entries landed in the project's own .gitignore.
2026-09-30 02:26:24 +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 60732db37a test(integration): pin global and project uninstall differences
Before merging the two uninstall flows, pin where they differ today
(glob expansion, resolve errors, --json support, preflight messages,
prompts, dry-run and gitignore output, lock pruning, oplog) so the merge
and the fixes that follow show up as deliberate test changes.
2026-09-30 02:24:37 +08:00
Willie 4b1e8d4e58 refactor(ui): extract useEditableFile for config page editors
ConfigPage repeated the same load, dirty-tracking, save and reset state
for config.yaml, .skillignore and .agentignore. One hook now holds it,
with tests, and each editor passes only its own save call.

The discard check for the extensions tab no longer reads the .agentignore
dirty flag, which the old three-way ternary returned for any other tab.
2026-09-30 02:24:12 +08:00
Willie 0793ebe3c6 fix(update): fail tracked repos whose git status cannot be read
update discarded the error from the uncommitted-changes check, so a repo
whose git status could not be read was treated as clean and pulled over
whatever local edits it had. It now fails that repo with "failed to check
git status: <err>" unless --force, matching uninstall and the Web API.
Batch update counts these as failed instead of skipped and exits non-zero.
2026-09-30 02:22:48 +08:00
Willie 8dd6e23f18 refactor(cli): name the audit and log TUI split-width threshold
The audit and log TUIs each hard-coded 70 columns in three places as the
width below which they drop to a vertical layout. It is now one named
constant next to tuiMinSplitWidth, the separate 80-column threshold the
list and trash TUIs use.
2026-09-30 02:21:41 +08:00
Willie 018bf96dc0 test(server): cover agents-extras overlap skip in project mode
The skip added in b062a113 was only tested in global mode, where agent
target paths are absolute. Project mode resolves relative paths against
the project root, so it gets its own test.
2026-09-30 02:21:11 +08:00
Willie cc68f54338 refactor(audit): split audit.go by responsibility
audit.go had grown to 1821 lines mixing result scoring, skill and content
scanning, markdown link checks and content integrity. Each now lives in
its own file, matching how the tests were already split. Code is moved
verbatim; only package and import headers were added.
2026-09-30 02:21:11 +08:00
Willie d67580f4f5 refactor(cli): use resolveAutoMode in hub and search
hub (five subcommands) and search still inlined the auto-mode check that
resolveAutoMode already implements, so a change to auto-detection would
have to be repeated in six more places.
2026-09-30 02:20:31 +08:00
Willie 37fec01d34 fix(search): accept every skill name that install accepts
Search kept its own name check, which rejected mixed-case names such as
"MySkill" that install happily accepts, so those skills never showed up
in results. It now uses validate.SkillName, the rule install applies.
Names install rejects, such as a leading underscore, stay hidden.
2026-09-30 02:19:47 +08:00
Willie 035ab61859 fix(sync): count extras target failures in sync --all and the Web API log
`sync extras` already exits non-zero and logs "partial" when a target
fails, but `sync --all` only printed a warning and exited 0, and its
--json path ignored extras errors entirely. The Web API always logged
"ok". Both now follow the CLI: `sync --all` exits non-zero on an extras
failure in text and JSON, global and project, without holding back MCP;
the Web API oplog records the error count with status "partial", or
"error" when every target that ran failed. The HTTP status stays 200.
2026-09-30 02:11:01 +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 b062a11322 fix(server): skip extras targets that the agents sync manages
The CLI skips targets of the "agents" extra whose path the agents sync
already writes to, so the two syncs do not fight over the same folder.
The Web API synced them anyway. It now builds the same set of agent
target paths and marks those targets with skipped_by "agents", the CLI's
JSON field name; existing response fields are unchanged.
2026-09-30 02:07:22 +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 57919f1b6c fix(server): refuse to replace a conflicting skills symlink without force
In symlink mode the Web API called SyncTarget directly, so a target
symlink pointing somewhere else was handled differently from `skillshare
sync`: no conflict message, and force had no effect. It now checks the
link first like the CLI. Without force the target fails with "conflict -
symlink points to X (use --force to override)" and counts as a failed
target; with force the link is replaced.
2026-09-30 02:04:46 +08:00
Willie 553e42811a fix(server): report skills prune failures and warnings
The Web API dropped the error from pruning orphaned skills and never
passed on the prune's own warnings, so a dashboard sync could leave stale
entries behind with no sign of it. It now reports them the way the CLI
does: "<target>: prune failed: <err>" followed by the prune warnings.
2026-09-30 02:03:33 +08:00
Willie 191bdec33f fix(server): keep syncing skills targets after one fails
The Web API returned 500 at the first skills target that failed, so
every target after it was left unsynced and agents, extras and MCP never
ran. It now follows the CLI: the failing target becomes a
"<target>: sync failed: <err>" warning, the rest still sync, and the
oplog records the real targets_failed count with status "partial". When
every skills target fails the request is still an error, so single-target
setups keep seeing one.
2026-09-30 02:01:02 +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 8e5a09c4f8 fix(uninstall): refuse to trash a tracked repo whose git status cannot be read
When git status failed, the CLI printed a warning and uninstalled the
repo anyway. A repo that cannot be read may still hold uncommitted
work, so moving it to trash risked losing it without the dirty-check
prompt. Without --force, that repo now fails with "failed to check git
status: <err>" and is counted as failed; clean items in the same batch
are still removed. --force keeps proceeding with a warning. This
matches the Web API since 20ae89a8.

The project uninstall test that asserted the old warn-and-continue
behavior now asserts the block.
2026-09-30 01:51:53 +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 8e3deade4c refactor(ui): move resource grouping helpers and the uninstall dialog out of ResourcesPage
ResourcesPage.tsx had 1301 lines and was the second most changed
dashboard file. Pure sorting and grouping helpers sat next to the page
state, and ResourceDetailPage imported the uninstall dialog from
another page.

The React-free helpers now live in lib/resourceGrouping.ts with focused
tests, and UninstallDialog lives in components/resources/. The page is
286 lines shorter, and its behavior and markup are unchanged.
2026-09-30 01:44:50 +08:00
Willie a2a426b851 refactor(git): remove unused Pull, ForcePull and PushRemote wrappers
Nothing in the repository calls these three unauthenticated wrappers.
Every caller uses the WithAuth or WithEnv variants, which stay. Removing
them means new code cannot pick the variant that silently skips token
auth.
2026-09-30 01:44:50 +08:00
Willie 115236a6fb fix(server): use token auth when checking default-branch skill remotes
The dashboard check fetched the remote HEAD without credentials when a
skill had no pinned branch. Private repos therefore reported an error in
the dashboard while the CLI check, which uses
GetRemoteHeadHashWithAuth, succeeded. The pinned-branch path already
used auth, and the default-branch path now matches it.
2026-09-30 01:44:50 +08:00
Willie 1c8e462179 refactor(cli): share filter input setup and key handling across TUIs
Twelve Bubble Tea screens built the same "/ " filter input and pasted
the same key handling. esc clears the filter and re-applies it, enter
locks it in, and typing re-applies it only when the text changed. A fix
to that behavior had to be made in every screen, and the shared filter
bar renderer lived in list_tui.go even though every TUI used it.

newTUIFilterInput and handleTUIFilterKey now hold that logic in
tui_helpers.go, next to renderTUIFilterBar, and focused tests cover the
key rules. The target list keeps its own handler because its enter and
typing behavior differ. The hard-coded split width of 70 in the log and
audit screens is left as is, because changing it would change layout.
2026-09-30 01:43:07 +08:00
Willie 6a325037f2 refactor(server): share the skills config reconcile step
Install, batch install, tracked-repo install, uninstall and rehydrate
each repeated the same nine-line block to reconcile the project or
global skills config. reconcileSkillsConfig now holds that block, so a
change to reconcile behavior or logging is made once instead of five
times. Each caller still passes its own source directory, so behavior
is unchanged.
2026-09-30 01:35:10 +08:00
Willie 20ae89a838 fix(server): stop dropping git and metadata errors in check, uninstall and batch targets
The dashboard check reimplemented the CLI's per-repo check but fetched
without the HTTPS token and ignored git status errors. Private tracked
repos could fail in the dashboard while `skillshare check` worked, and a
repo whose status could not be read showed as up to date. Both check
endpoints now call check.ParallelCheckRepos, the same code the CLI uses.
The JSON and SSE response shape does not change.

Batch uninstall treated a failed dirty check as clean and moved the
repo to trash. Without force, that item now fails with the git error
instead. This is stricter than the CLI, which only warns and continues.

Batch target updates ignored metadata save failures and still reported
success, so an override could silently disappear on the next reload.
They now return 500.
2026-09-30 01:34:58 +08:00
Willie d2b0a01d02 refactor(ui): split the dashboard API client into domain modules
client.ts had grown to 1835 lines of types and calls for every page. In
six months it changed in 71 commits, more than any other source file,
so almost every dashboard change had to edit one oversized file.

The transport now lives in http.ts, and each domain has its own call
module and type file. client.ts stays as a barrel that composes the
same api object. The 124 exported names and 145 api keys are
unchanged, so importers and the tests that mock api/client need no
edits. Domain modules import from http.ts, not from client.ts, which
avoids an import cycle through the barrel.
2026-09-30 01:34:04 +08:00
Willie b47e1d79e2 refactor(cli): drop dead sync paths and share run-mode auto-detection
syncTarget and syncTargetWithSkills had no callers, so the merge, copy
and symlink helpers behind them were unreachable. That was 256 lines
kept alive next to the parallel sync path that replaced them, and
readers had to work out which path was real.

Twenty-five commands also repeated the same seven lines that turn
modeAuto into project or global mode. resolveAutoMode keeps that rule
in one place. Commands whose auto-detection differs, such as hub,
search, backup, init and plugin, are left unchanged.
2026-09-30 01:33:58 +08:00
Willie 21d016b5e2 fix: install dialog issue 2026-09-30 01:27:34 +08:00
Willie 306e144061 fix(ui): group the Sync page's target-only list by target
The in-sync and ignored lists were grouped earlier, but the list of
resources that exist only in targets was still one comma-joined line.
It merged every target's names, so a reader could not tell which target
held a resource before collecting it.

Each target now gets its own group with its logo chip and count, and
each name carries a skill or agent icon.
2026-09-30 01:27:05 +08:00
Willie 0bc7e0e2fc fix(ui): use the standard selected row in the add target dialog
The picked tool drew a rounded inset ink ring inside the list, which
looked like a card dropped into the rows and clashed with the dashed
separators in Playful. It now uses .ss-r.sel, the tinted fill that the
collect and install dialogs already use for a selected row.
2026-09-30 00:26:37 +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