271 Commits
Author SHA1 Message Date
Willie c60bfd3c08 chore: release v0.19.19 2026-05-23 01:18:38 +08:00
WillieandClaude a61a0e3bea fix(install): include root SKILL.md in tracked repo discovery
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>
2026-05-22 11:29:01 +08:00
WillieandClaude 210605ea4e fix(install): persist metadata for tracked repos with root-level SKILL.md
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>
2026-05-22 10:57:55 +08:00
Willie 8e0117a29d feat(init): emit sources map for new global configs (Phase 4)
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.
2026-05-21 14:54:24 +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 906ede81e0 test: add integration coverage for fail-closed and source/target overlap
- 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
2026-05-20 18:34:45 +08:00
Willie 68d5eadc0b feat: support custom project source directories via sources map
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
2026-05-20 15:42:53 +08:00
Willie 1c22cc7e7b fix(test): align agent install test with new name resolution priority
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.
2026-05-17 22:25:58 +08:00
Willie 9307fc521c chore: release v0.19.12 2026-05-14 23:43:43 +08:00
Willie 56fafb53e0 fix: preserve update metadata keys for symlinked sources 2026-05-12 21:10:08 +08:00
Willie f173b1d456 test(sync): add integration tests for token summary and budget warnings
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.
2026-05-11 21:34:38 +08:00
Willie d8007dd750 refactor: simplify completion with struct map, fix nushell gaps
- 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
2026-05-08 16:06:14 +08:00
Willie 79cb6c2410 feat: add powershell/nushell completion + fix bash fallback (#148)
- 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)
2026-05-08 15:54:16 +08:00
Willie 829851f420 feat: add shell completion command for bash/zsh/fish (#148)
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.
2026-05-08 15:49:33 +08:00
Willie d2946cb4d1 fix(tests): align integration tests with cursor project path change
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).
2026-05-05 12:11:06 +08:00
hhh2210 851f06dc0a fix(sync): infer targets from host skill paths 2026-04-29 18:47:05 +08:00
Willie 07c091529b refactor(search): harden preview error handling, cache, and a11y
- 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
2026-04-23 16:46:53 +08:00
Willie cb69b78513 fix(test): resolve macOS symlink path mismatch in target list project JSON test
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.
2026-04-14 20:51:43 +08:00
Willie 1a5b4f809f feat(target): add targetNaming, sync, and agentSync fields to target list JSON output
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.
2026-04-14 20:41:56 +08:00
Willie e0f946ac93 test: replace online antigravity tests with offline mock repo
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.
2026-04-13 18:23:10 +08:00
Willie e32f2164c9 fix: suppress update notice in all structured-output modes
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
2026-04-13 16:00:18 +08:00
Willie 5476ec84c3 fix(tests): remove unused os import in install_online_test
The os package was imported but not referenced, causing the online
integration test build to fail in CI (docker-sandbox-online job).
2026-04-11 03:53:38 +08:00
Willie 788f9bc6e9 feat(agents): JSON output + audit gate for install/update
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
2026-04-10 23:27:26 +08:00
Willie 47fe1b8318 refactor(tui): migrate list TUIs to theme package
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
2026-04-10 14:36:22 +08:00
Willie 5c99a1cb9f feat(ui): audit cache invalidation, agent target display, UX polish
- 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
2026-04-10 02:05:23 +08:00
Willie 26c5050347 test(audit): verify agents/skills audit uses correct terminology
TestAudit_AgentsTerminology: ensures 'audit agents' says agent, not skill
TestAudit_SkillsTerminology: ensures default audit says skill, not agent
2026-04-09 14:37:53 +08:00
Willie 6d1f675a17 fix(sync): strip .md extension in agent filter matching and add tests
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)
2026-04-09 14:14:05 +08:00
Willie 5836a8802f feat: add agent filter support to Filter Studio, targets CLI, and overview API
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
2026-04-09 03:50:28 +08:00
Willie 081348d39b refactor(collect): unify skills/agents flow with collectPlan + generics
Replace duplicated runCollectSkills/runCollectAgents (~110 lines of 95%
identical code) with a single runCollectPlan function driven by a
collectPlan struct + toCollectResources[T] generic converter.

Key changes:

- Add collectPlan/collectResources types and runCollectPlan unified flow
- Add toCollectResources[T] generic to bridge typed slices into the
  shared pipeline (scan → display → dry-run → confirm → pull → render)
- Replace fragile err.Error() == "already exists in source" string
  matching with ErrAlreadyExists sentinel error + errors.Is()
- Move os.MkdirAll from per-agent PullAgent to PullAgents (call once)
- Add FindLocalAgents/PullAgent/PullAgents to match FindLocalSkills API
- Add target selection, --force/--dry-run/--json support for agent collect
- Add integration tests for agent collect (target filter, dry-run, force,
  JSON, oplog, project mode)
- Update collect.md, agents.md, ui.md docs for agent collect support
2026-04-09 00:36:39 +08:00
Willie 6e9177aae0 style: fix gofmt alignment in test files 2026-04-08 22:42:35 +08:00
Willie a726e363fc refactor: redesign status output — unified layout with agents in targets
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)
2026-04-08 21:55:32 +08:00
Willie 525ae0b9f4 refactor: status always shows both skills and agents
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
2026-04-08 21:40:03 +08:00
Willie eadfcf3d6f refactor: replace positional "all" keyword with --all flag for kind filter
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
2026-04-08 21:31:41 +08:00
Willie 43c5154a78 Flatten nested agent sync names
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.
2026-04-08 20:52:29 +08:00
Willie 27f352e5d2 fix: resolve relative paths in project mode extras and agent targets
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.
2026-04-08 18:35:36 +08:00
Willie f95a113fce test: migrate all test metadata to centralized store format
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
2026-04-08 17:43:46 +08:00
Willie ff032b3745 test: update integration tests for full-path metadata keys
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.
2026-04-08 16:35:40 +08:00
Willie 2acfec82ec refactor: simplify metadata — extract helpers, remove dual-write, add kind constants
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
2026-04-08 15:00:22 +08:00
Willie 424a9df7a4 chore: remove debug test files and local metadata 2026-04-08 14:30:29 +08:00
Willie e91890d2b0 test: fix all integration tests for centralized .metadata.json format
- 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)
2026-04-08 14:28:57 +08:00
Willie ebcfaf6bc4 feat(agents): add --group support, fix nested discovery, and improve TUI dispatch
- 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)
2026-04-08 02:37:42 +08:00
Willie 49d33938a2 feat(sync): skip extras 'agents' targets that overlap with agents sync
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
2026-04-07 22:35:59 +08:00
Willie 3241159b56 style(sync): unify summary format and headers across skills, agents, extras
- Replace ui.Info() agent summary with ui.AgentSyncSummary() using
  OperationSummary pattern (colored metrics, consistent spacing)
- Add ui.ExtrasSyncSummary() call to extras sync (was missing summary)
- Unify section headers: 'Syncing X' / 'Syncing X (project)' pattern
- Remove extra fmt.Println() before extras to fix double blank lines
- Rename agentSyncStats.skipped to .local to match UI semantics
2026-04-07 22:05:34 +08:00
Willie de49f31a39 test: add E2E test for mixed-repo install then sync to correct targets
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.
2026-04-07 20:27:31 +08:00
Willie 73d4d32dfe feat(sync): warn when targets are skipped for agents (no agents path)
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.
2026-04-07 20:22:30 +08:00
Willie e2a3d7024c fix: install agents from mixed repos after skills
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
2026-04-07 20:20:21 +08:00
Willie 031306af62 test(tui): add integration tests for agent TUI features
- 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
2026-04-07 19:07:21 +08:00
Willie 30f8fb0131 feat(agents): add project-mode backup and restore for agents
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).
2026-04-07 18:27:08 +08:00
Willie 075c0191b7 feat(agents): implement project-mode agent support for all commands
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.
2026-04-07 18:05:40 +08:00
Willie eceb9cc6e4 test(agents): fill coverage gaps — project mode uninstall, trash empty/delete, multi-target, JSON kind
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).
2026-04-07 18:05:40 +08:00