Validate global configs against the effective skills source so sync --global honors the default source when source and sources.skills are omitted.
Add unit and integration coverage for issue #238.
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
Avoid presenting targets that share ~/.agents/skills as individually detected CLIs during init discovery. Show the universal shared-directory guidance instead and cover the re-init regression.
Reject project-mode installs that target the current project root and add a copy-layer guard that skips destination subtrees during recursive copies. This prevents install ./ -p from recursively copying .skillshare/skills into itself on Windows.
TestBackup_AfterSync_ResolvesSymlinks failed ~7-10% of runs. The cause
is in the test, not production: `sync` takes a pre-sync backup of the
target before creating the agent-browser symlink, and the explicit
`backup` takes a second one. When the two land in different clock-seconds
there are two timestamp dirs, and `entries[0]` (lexicographically oldest)
points at the pre-sync backup that predates the symlink, so the
symlinked-skill assertion fails.
Select the newest backup dir (last entry, ascending sort) so the
assertion targets the post-sync backup that actually contains the
resolved symlink. Verified 0/80 failures under -race.
ref #226
When tracked repo metadata is committed but the gitignored clone dirs are
absent on a fresh machine, `update --all` silently reported zero work: the
batch path skipped missing repos with no message, and the web UI's
update-all paths only listed repos present on disk.
Missing tracked repos are now detected and surfaced everywhere:
- CLI: a warning block (human output) plus an aggregated
`missing_tracked_repos` summary (names + one-shot rehydrate hint) in JSON;
the per-item error is concise. Fixed for both global and project modes,
and batch and single-target paths.
- Server: GET /api/update/missing-tracked-repos and the update-all/stream
summaries report them; POST /api/update/rehydrate re-clones them from
metadata (mirrors bare `skillshare install`).
- UI: the Update page shows a warning banner listing missing repos with a
Rehydrate button; strings added to all 11 locales.
Closes#212
UI (Extras page):
- Label per-target flatten/extension/mode controls with column headers
- Render flatten as a dropdown so it matches the adjacent selects
- Collapse the add-target form behind a button and widen the path input
- Confirm before removing a target
- Polish layout: tinted icon, inset source chip, hover rows, aligned columns
Components:
- Select: bound the dropdown width so long option descriptions wrap instead
of stretching the popup across the page
- Toast: render messages multi-line, widen the container, and give
error/warning toasts more time to read
Sync feedback:
- Restructure extras sync-failure toasts into readable lines and fix the
contradictory "N more errors" count (new nMoreErrors translation)
CLI/server:
- Match extra target paths by resolved absolute path (handles ~ vs /home)
when adding, removing, or updating targets
Installing a specific skill from a mixed repo dragged in every agent.
The -a/--agent handler implicitly set Kind=agent, but -s/--skill never
set Kind=skill, so installDiscoveredAgents could not tell that the user
had narrowed the install — and it looped over every discovered agent
without applying the -a name filter.
Fix the install path so agents track the user's intent:
- -s/--skill (without -a) installs only the named skills, no agents.
- -s/--skill with -a installs only the named agents, via selectAgents,
matching the pure-agent path.
- --all/--yes still installs everything.
- An unknown -a name fails the whole command before any skill is
installed (validated up front against the discovered agents, including
repos with no agents at all), so automation never sees a half-success.
Add integration tests covering each case.
Fixes#183
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.
Combining --git-root <scope> with --remote <url> on an already-initialized
setup now switches the scope and wires the remote onto the new scope's repo
in one command, instead of warning and ignoring --git-root. Reuses the
existing scope-switch and remote-configuration paths back to back.
Project init rejected --git-root (and other git flags) with a bare 'unknown
option', which is confusing when the user just forgot that git integration is
global-only — easy to hit when the current directory has a .skillshare/ and
init auto-detects project mode. Match git-related flags (--git-root, --git,
--no-git, --remote) explicitly and explain they are global-only, pointing at
'skillshare init -g <flag>'. Add TestInitProject_GitRootFlag_RejectedAsGlobalOnly.
Previously 'skillshare init --git-root <scope>' on an already-initialized
setup either errored with 'already initialized' (no --remote) or warned and
ignored the flag (with --remote), so there was no non-interactive way to
change the scope after init — only the web UI or a manual config edit.
handleExistingInit now treats 'init --git-root <scope>' (without --remote) as
a headless scope switch via switchGitRootScope: it inits a repo at the new
scope directory (reusing one already there, sharing doGitInitIfAbsent with the
fresh-init and server paths) and persists git_root. It does not relocate an
existing repo — switching scope means 'version a different directory', not
'move history'. Combined with --remote the flag still falls through to the
remote path, now pointing users at the standalone form instead of a bare
'ignored' warning.
Update the mismatch guidance to offer 'skillshare init --git-root <scope>' as
the first fix, and revise the git_root docs (configuration + init) to document
the headless switch, superseding the earlier 'must re-run init / not supported'
wording. Add TestGitRoot_SwitchScopeAfterInit.
Stripped one-shot containers (read-only HOME, unwritable identity, or owner
mismatch) can make git init/commit fail during test setup, surfacing as a
misleading assertion failure deep inside a test. Add a requireWorkingGit probe
that init/config/add/commits in a throwaway temp dir up front and t.Skips with
the underlying git error when the environment cannot create commits. The probe
touches nothing outside its temp dir and does not change git_root behavior.
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.
- writeInitGitignore now appends config.yaml to a pre-existing root .gitignore
if missing (enforces the safety guarantee instead of best-effort)
- single source of truth config.ScopeDir; EffectiveGitRoot/scopeDir/gitRootScopes delegate
- warn when --git-root is passed with --remote on an already-initialized repo
- use 0o644 and check WriteFile errors; add tests for the append + agents scope
After Phase A (210605ea) fixed metadata + status display for tracked
repos with a root-level SKILL.md, three output gaps remained:
- 'Found 0 skill(s)' on install (should be 1 — root SKILL.md counts)
- 'tracked_repos[].skill_count' was 0 (same root-case)
- 'Run sync' suggestion appeared even when no skill was discovered
Root cause: install/update used discoverSkills(destPath, false) which
walks the tracked repo's own root, treating the root SKILL.md at
relPath='.' as ignored. But 'skillshare sync' walks the source
directory; the same SKILL.md inside _<name>/ has relPath='_<name>'
(not '.') and is discovered as a normal skill. The two walkers used
the same helper with different includeRoot settings and produced
inconsistent counts.
Changes:
- installTrackedRepoImpl and updateTrackedRepo: switch to
discoverSkills(repoPath, true) so SkillCount matches sync's view.
- buildTrackedRepoJSON: when counting skills per repo, accept both
RelPath='<repo>/...' (nested) and RelPath='<repo>' (root-only).
- handleTrackedRepoInstall: suppress the 'Run sync' next-step when
the repo had no skills/agents discovered.
Closes#163
Co-authored-by: Claude <noreply@anthropic.com>
When --track installed a repo whose SKILL.md sits at the repository root
(non-spec layout), the install reported success but:
- .metadata.json gained no entry (cross-machine recovery via metadata broken)
- status --json tracked_repos did not list the repo
Two coupled bugs caused this:
1. cmdInstall gated ReconcileGlobalSkills on len(InstalledSkills) > 0.
Tracked repos with no discoverable nested skills produced an empty
InstalledSkills slice, so reconcile never ran and never detected the
_<name>/.git directory to write a tracked entry.
2. extractTrackedRepos derived repo names from discovered skills, so
repos with zero discoverable skills were silently dropped from status
and list output.
Fix both by:
- Making the post-install reconcile unconditional on success. Reconcile is
idempotent and cheap; gating it on InstalledSkills > 0 created a path
where successful installs left metadata stale.
- Switching extractTrackedRepos to install.GetTrackedRepos (a directory
walk for _-prefixed git repos), the same source-of-truth used by check
and update. Shared across status, status_project, list, and list_project.
Closes#163
Co-authored-by: Claude <noreply@anthropic.com>
Fresh `skillshare init` (global) now writes the v0.19.16 `sources:` map
instead of the legacy top-level fields:
sources:
skills: ~/.config/skillshare/skills
agents: ~/.config/skillshare/agents
What changed:
- cmd/skillshare/init.go: construct Config with Sources{Skills, Agents}
rather than Source/ExtrasSource. The --subdir update path writes to
cfg.Sources.Skills accordingly. The --remote re-init path uses
cfg.EffectiveSkillsSource() for git operations so it works whichever
shape the existing config uses.
- internal/config/config.go: add `,omitempty` to Source field so configs
that only set sources.skills don't get a noisy `source: ""` line.
- tests/integration/extras_test.go: rename TestInit_SetsExtrasSource to
TestInit_WritesSourcesMap and assert the new shape (sources map
present, legacy source/extras_source/agents_source absent).
Existing configs are untouched — legacy fields keep working through
Config.Effective*Source helpers. No auto-migration on Save.
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.
- 3 malformed-config tests verify uninstall/new/check abort instead of
silently using the default .skillshare path
- 1 overlap test verifies sync rejects sources.skills aliasing a
target path
- Fix pre-existing TestUninstall_AllProject fixture which used
malformed targets: {} (map, not list) — now caught by fail-closed
load
Add ProjectSources struct to ProjectConfig with optional skills, agents,
and extras fields. When set, project-mode commands resolve source paths
from these values instead of hardcoded .skillshare/{skills,agents,extras}/.
Config example:
sources:
skills: ./docs/skills
agents: ./docs/agents
Three EffectiveXxxSource(projectRoot) methods provide the central
resolution logic with fallback to defaults. The projectRuntime gateway
and server layer route through these methods, so most commands get
custom source support automatically.
Closes#153
The tracked repo name resolution was changed to prefer source.Name
over TrackName() in a656e30b, but this integration test still used
TrackName() to compute the expected directory path.
DiscoverSourceSkillsWithStats did not set collectContext=true, so
DescChars/BodyChars were always 0 when sync called buildAnalyzeEntries.
Add DiscoverSourceSkillsWithStatsAndContext that enables both ignore
stats and context collection in a single walk, and use it in sync.go
and sync_project.go.
- Replace three switch statements with a single shells map[string]shellDef
- Add missing --add-agent-{include,exclude} and --remove-agent-{include,exclude}
flags to nushell target completion
- Fix nushell audit using 'target?' instead of 'subcommand?'
- Replace raw fmt.Println with ui.Info in post-install hints
- Use testutil assertion helpers in integration tests
- Verify --install actually writes the file to disk
- Add PowerShell and Nushell completion scripts
- Fix bash completion when bash-completion package is not installed
(fallback from _init_completion to manual COMP_WORDS parsing)
Add 'skillshare completion <shell>' command that generates shell
completion scripts. Supports --install flag to auto-write the script
to the correct platform path.
Covers all commands, subcommands, and per-command flags for bash,
zsh, and fish shells.
The cursor target's project path was updated from .cursor/skills to
.agents/skills in 57b0649d but three integration tests still asserted
the old path:
- TestInitProject_Fresh_CreatesStructure
- TestInitProject_Discover_WithMode_AddsTargetMode
- TestSyncProject_MultipleTargets
Fix testutil knownPaths map and test assertions to match the new path.
Discover test now uses windsurf (unique path) instead of cursor
(grouped at .agents/skills with 10+ other targets).
- Add ErrSkillNotFound sentinel error in search/preview.go so callers
can distinguish 404 from other errors with errors.Is instead of
brittle string matching
- Cap previewCache at 200 entries with TTL purge + full reset on
overflow to prevent unbounded memory growth
- Make Card and SearchResultsTable rows keyboard-accessible
(role=button, tabIndex=0, Enter/Space handlers)
- Refactor SkillPreviewModal to accept a single SearchResult prop
instead of 6 individual fields — reduces prop drilling and keeps
the modal in sync with the result shape
- Fix search_online_test: add --list flag so output is not gated
behind interactive TUI
On macOS, temp dirs are under /var/folders which is a symlink to
/private/var/folders. EvalSymlinks normalises the path before comparing,
matching what the CLI outputs after os.Stat resolution.
Refactors targetListJSON (global and project modes) to use the shared
buildTargetTUIItems + newTargetListJSONItem path, eliminating duplicated
item-building logic and ensuring both modes expose consistent metadata:
- targetNaming: effective naming strategy (flat/nested)
- sync: skill sync summary string
- agentSync: agent sync summary string
Adds assertions in target_agents_test.go and a new integration test
(TestTarget_List_Project_JSON_IncludesSyncMetadata) to cover the new fields.
The antigravity repo (47MB, 995 skills) took ~110s per test on CI due
to audit scanning all skills. Replace with a local file:// bare repo
containing 4 mock skills (2 clean + 2 malicious) that produces the
same batch audit output (Blocked/Failed, CRITICAL, findings, etc.)
in under 1 second.
This moves the tests from online to offline (build tag !online),
eliminating the network dependency entirely.
UpdateNotification() wrote to stdout via fmt.Printf, corrupting JSON
output when --json was passed to commands like search. Machine
consumers got invalid JSON with trailing human-readable text.
Three-layer fix:
1. Move UpdateNotification output to os.Stderr (safety net for any
caller that bypasses the main.go guard).
2. Add isStructuredOutput() that detects all machine-readable modes:
--json, -j, and --format json/sarif/markdown.
3. Skip the update check and trailing newline entirely in main()
when structured output is requested, honouring the contract that
stdout = pure structured data and stderr = empty.
Tests:
- Unit: isStructuredOutput table test (9 cases)
- Unit: UpdateNotification writes only to stderr
- Integration: versioned binary (1.0.0) with seeded cache (9.9.9)
exercises the real update path for search --json, list -j, and
audit --format json — asserts valid JSON stdout + empty stderr.
Closes#129