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
Extend install/update with agent-aware --json output and apply the same
audit block-threshold gate skills already use.
Install:
- install --json: imply --force; imply --all only when neither
--skill nor --agent is set (so explicit selectors still work)
- project-mode install now routes through cmdInstallProjectParsed
so --json suppresses UI and emits a pure-JSON payload
- agent installs propagate SourceDir so metadata lands in the
agents root, not the install subdir
- validation error lists --agent / --kind / --branch explicitly
Update agents:
- update agents supports --force, --skip-audit, --audit-threshold
- tracked agent repos + metadata-backed single-file agents now run
the same audit gate as skills; blocks roll back from a temp stage
- JSON output returns the final per-agent status
(updated/skipped/failed/up_to_date/...) by merging check results
with batch update outcomes
Audit:
- auditInstalledAgent shares one helper with auditInstalledSkill
(scan + cleanup callbacks); single-file agent scans now use
audit.ScanFile / ScanFileForProject instead of staging the file
into a temp directory
- UpdateAgentFromDiscovery stages to temp, audits, then renames
atomically (rename already overwrites on POSIX)
Refactors pulled in while reworking these paths:
- extract jsonUISuppressor helper in json_output.go and use it
from install/update/update_agents; collapses 4 copies of the
suppress/restore closure dance and the per-error failJSON block
- drop relPath plumbing from installAgentFromDiscoveryInternal
now that ScanFile doesn't need a staged relative path
- list.go render functions now use theme.ANSI() so NO_COLOR is
respected in plain-text output
Tests:
- add TestInstallAgentFromDiscovery_HighFindingBlocked (unit)
- add TestUpdate_Agents_HighFindingBlockedByThreshold (integration)
- add TestInstall_Project_JSON_Agent_PureJSON,
TestUpdate_Agents_JSON_ReportsFinalStatus
- fix TestList_SKILLSHARE_THEME_Light / TestList_NO_COLOR to
write a config before invoking list
- fix TestTargetList_NoTUI_FallsBackToPlainText assertion to match
the new structured Mode: merge output
- fix TestDoctor_AllGood_PassesAll by pinning SKILLSHARE_THEME=dark
so the no-TTY theme fallback warning doesn't fire
- add list_tui_content_test.go covering light/dark glamour base
- list detail pane now picks LightStyleConfig on light terminals
Docs:
- update install.md, update.md, understand/agents.md for the new
flags, JSON shapes, and agents update workflow
Replaces all tc.* references in list_tui.go, list_tui_item.go, and
list_tui_content.go with the new internal/theme API. Also fixes the
hardcoded lipgloss.Color("15") at list_tui_item.go:296 — the root
cause of issue #125.
NOTE: The codebase does not compile at this commit alone because
other TUIs still reference the tc struct. The full build is
restored in commit 4 of this PR (migration of remaining TUIs and
deletion of legacy palettes). Treat this PR as one atomic change.
Fixes#125
- auditCache: centralized cache with installed-count staleness check
- resourceNames: agent display name formatting (strip .md suffix)
- AuditPage: skip audit when 0 installed, show empty state per kind
- clearAuditCache on install/uninstall/update across all pages
- ResourcesPage: agent target summary, context menu for agents
- FilterStudioPage: agent display name in preview search
- SkillPickerModal: accessible radio button (button element)
- fieldDocs: agents sub-keys no longer marked reserved
- Integration tests: diff/sync prune after uninstall-all, tracked agent install
FilterAgents matched against FlatName which includes .md (e.g.
"tutor.md"), so user patterns like "tutor" or "team-*" silently
matched nothing. Strip the .md suffix before pattern comparison so
agent filters behave consistently with skill filters.
Add FilterAgents unit tests (include, exclude, combined, nested,
glob, invalid pattern) and integration tests for both filter paths:
- include/exclude config patterns (4 tests)
- .agentignore disabled state (3 tests: explicit, glob, nested)
Backend:
- PATCH /api/targets/:name accepts agent_include/agent_exclude fields
- POST /api/sync-matrix/preview returns agent entries with kind=agent
- GET /api/overview returns agentsSource and extrasSource paths
- Fix ResolveProjectTargets to resolve Agents sub-key (path + filters)
- Add agent filter CLI flags: --add-agent-include, --add-agent-exclude,
--remove-agent-include, --remove-agent-exclude, --agent-mode
- Unify target list JSON/TUI to show agent info and filters
Frontend:
- FilterStudioPage: kind-driven single-context view (?kind=skill|agent)
- KindBadge: use design system tokens (ss-badge + wobble in playful)
- TargetsPage: link to Filter Studio with ?kind= param
- ResourceDetailPage: capitalize type labels (Local, GitHub)
- ResourcesPage: sync activeTab from URL searchParams on navigation
- DashboardPage: show agents/extras source dirs, link skills card
with ?tab=skills for reliable tab switching
- API client: extend updateTarget and previewSyncMatrix for agent filters
Tests:
- Agent include/exclude round-trip persistence
- Invalid agent pattern returns 400
- Preview with agent entries and kind field
- No agent entries for targets without agent path
- CLI target agent filter integration tests
Restructure status command output for both -g and -p modes:
- Remove "(project)" suffix from all section headers (logo already shows it)
- Merge agents source info into Source section alongside skills
- Show agents as sub-items under each target instead of a separate section
- Remove standalone printAgentStatus/printProjectAgentStatus (dead code)
- Simplify cmdStatus: remove kind parameter since status always shows all
- JSON output unchanged (backward compatible)
Remove kind filter (agents/--all) from status command — it now defaults
to showing everything, matching diff behavior. Status is a read-only
overview command; users expect the full picture without extra flags.
- Remove parseKindArgWithAll from cmdStatus, hardcode kindAll
- Update help text and usage examples
- Simplify tests: merge agents/all variants into default tests
- Update runbook steps 9-11 → 9-10
Migrate from "ss list all" syntax to "ss list --all" across all commands
that support kind filtering (list, sync, status, check, audit, backup,
restore, trash).
- Remove "all" as a recognized positional keyword in parseKindArg
- Add extractAllFlag and parseKindArgWithAll helpers
- Update help text, usage examples, and runbook
- Update all integration tests to use --all flag
Align agent target naming with the skills-style __ flattening so nested agents do not collide by basename in flat agent directories. Add unit and project-mode integration coverage to verify repeated syncs stay stable and no longer report false updates.
Extract resolveProjectPath() helper to centralize ~ expansion and
relative-to-project-root resolution. Fixes extras sync and agent
target path resolution in project mode when paths are relative.
Add integration tests for sync --all agents/extras overlap detection
in both global and project modes.
Replace .skillshare-meta.json sidecar writes with centralized
.metadata.json store writes across all test files. Use
install.MetadataFileName constant instead of hardcoded strings.
Updated: audit_test, doctor_test, gitignore_project_test,
install_online_test, list_project_test, sync_symlinked_dir_test,
uninstall_project_test, uninstall_test, uninstall_trash_test,
audit_output_online_test, audit_scan_skill_test, analyzer_metadata_test
Grouped install tests now assert full-path keys (e.g. 'frontend/pdf-skill')
instead of basename keys, and verify that legacy basename keys are removed
after migration.
Code quality fixes from review:
- Extract RemoveByNames() to eliminate copy-paste in uninstall Phase 7
- Add MetadataKindSkill/MetadataKindAgent constants
- Remove dual-write shim (findSkillsRoot + writeMetaToCentralized)
- install_apply.go uses WriteMetaToStore with SourceDir (no sidecar)
- Move LoadMetadata out of walk loops (P0 efficiency fix)
- isGroupDir accepts store parameter to avoid redundant loads
- Add SourceDir to InstallOptions for --into group support
- Dual-write in WriteMeta: also writes to .metadata.json for backward compat
- Migration looks in parent dir for registry.yaml
- Group uninstall matches entries by Group field + full path
- Sync test uses MetadataStore instead of registry.yaml
- All integration tests pass (0 FAIL)
- CheckAgents uses recursive discovery via resource.AgentKind{}.Discover()
so nested agents (e.g. demo/code-reviewer.md) are found correctly
- Add --group/-G flag to update, check, and uninstall agents commands
with shared validateAgentGroups/matchesAnyGroup helpers
- Fix TUI project-mode dispatch: call cmdUpdateAgentsProject and
cmdUninstallAgents directly instead of passing 'agents' keyword to
handlers that don't understand it
- TUI confirmation overlay shows correct command with 'agents' keyword
and confirmKind field tracks skill vs agent
- TUI toggleDisabled (E key) writes to .agentignore for agents instead
of .skillignore
- Agent Discover now marks .agentignore matches as Disabled=true instead
of skipping them, so disabled agents appear in list with [disabled] tag
- Sync filters out disabled agents via resource.ActiveAgents()
- auditSkillByName uses scanPathTarget to support single-file agent audit
- Uninstall agents display uses RelPath (e.g. demo/tutor) instead of
frontmatter name (e.g. Python Tutor Expert)
When extras has an entry named 'agents' whose target paths overlap with
the resolved agent target paths from targets.yaml, the extras targets
are skipped with a warning — the agents sync system takes priority.
Detection uses dual conditions: extras name == 'agents' AND resolved
path overlap. Non-'agents' extras targeting agent paths are unaffected.
Agents source must exist with actual files; empty/missing source means
no overlap (extras sync normally).
Also fixes:
- CheckAgents now recurses into subdirectories via resource.AgentKind
- update agents resolves nested agent names via filepath.Base
- filterAgentCheckResults matches both full path and basename
Validates the full agent workflow: install mixed repo (skills + agents)
then sync all — verifying skills go to skills targets, agents go to
agent-capable targets, agents are excluded from targets without agents
path, and the skip warning mentions the target name.
Uses 'sync all' since plain 'sync' only syncs skills by design.
Both syncAgentsGlobal and syncAgentsProject now collect target names
where agentPath is empty and print a summary warning after the sync
summary line. This makes it visible to users which targets were
silently skipped, helping them configure agents paths if desired.
Mixed repos containing both skills/ and agents/ directories previously
only installed skills, silently ignoring agents. Now after every skill
install exit point, discovered agents are also installed to the agents
source directory.
- Add installDiscoveredAgents helper that installs agents post-skills
- Update 'Found' message to show agent count in mixed repos
- Call helper at all 4 skill install exit points in handleGitInstall
- Add integration test for mixed-repo install scenario
- TestList_Agents_KindFilter_NoTUI: verifies list agents/all/default
kind filtering works correctly in --no-tui mode
- TestTrash_MergedList_IncludesAgents: verifies uninstalled agents
appear in trash agents list --no-tui output
Add -p/--project support to 'backup agents' and 'restore agents' commands.
Project-mode backups are stored under .skillshare/backups/ (parallel to
.skillshare/trash/).
Backup engine changes:
- Add ProjectBackupDir(), CreateInDir(), ListInDir() to internal/backup
- Add RestoreLatestInDir(), FindBackupsForTargetInDir(),
GetBackupByTimestampInDir() to restore.go
- Existing global functions become thin wrappers (zero caller churn)
Command layer changes:
- Allow project mode through for kind=agents in cmdBackup/cmdRestore
- Auto-detect project mode when .skillshare/config.yaml exists
- Refactor backup_agents.go with resolveAgentBackupContext() to
resolve backup dir + agent targets per mode
Skills backup in project mode remains unsupported (error unchanged).
Remove all "not yet supported in project mode" errors. Every command
that supports agents in global mode now also supports project mode:
- status -p agents: shows project agent source + per-target status
- status -p all: shows both skills and agents
- check -p agents: checks agent status from .skillshare/agents/
- diff -p agents: computes agent diffs (missing/orphan per target)
- diff agents (global): also now fully implemented via diffGlobalAgents
- collect -p agents: collects local agents from project targets
- audit -p agents: scans .skillshare/agents/ for security patterns
New file: diff_agents.go — shared agent diff logic for both modes
(computeAgentDiff, diffProjectAgents, diffGlobalAgents).
11 new integration tests covering all 5 commands in project mode.
Total agent tests: 56.
7 new integration tests covering:
- trash agents empty / delete
- uninstall agents in project mode (fix: wire kind into project dispatch)
- check all (combined skill + agent)
- sync agents skips targets without agent path
- list all --json verifies kind field on every entry
- status agents --json with target details
Total agent tests: 45 (38 + 7).