Commit Graph
1482 Commits
Author SHA1 Message Date
Willie 7a319fa8f3 fix(ui): remove duplicate Track badge from card view
The Track badge in SkillPostit was redundant with the existing Tracked
indicator at the bottom. Revert to Users icon — Track badge is only
used in the folder tree view.
2026-04-10 03:12:15 +08:00
Willie cbbfcde390 fix(ui): improve Sync page stats layout and ignored section grouping
- Replace flex-wrap badge layout with CSS Grid for aligned KindBadge rows
- Fix ignored count showing only skills instead of total (skills + agents)
- Group ignored items by kind (skill/agent) with KindBadge sub-headers
- Increase spacing between groups for better visual hierarchy
2026-04-10 02:38:44 +08:00
Willie 0e314e19e3 fix(ui): apply Track badge and name formatting to sticky folder header 2026-04-10 02:26:47 +08:00
Willie 3c4d057950 refactor(ui): centralize display name formatting via resourceNames utilities
Replace 25+ inline .replace(/__/g, '/') calls with shared utilities:
- formatSkillDisplayName() for flat name → path conversion
- formatTrackedRepoName() for tracked repo name display (strip _ + unflatten)
- formatAgentDisplayName() for agent names (.md removal + unflatten)

Consolidate error toasts into single summary in DashboardPage update-all.
Remove duplicate displayPath() in BatchUninstallPage (was reimplementing
formatSkillDisplayName).

Backend: refactor agentIgnorePayload to accept pre-discovered agents,
eliminating duplicate filesystem traversal in sync/diff handlers.
2026-04-10 02:25:27 +08:00
Willie 92d5fc66ba fix(agents): exclude convention files and respect agents/ subdir in tracked repos
Agent discovery was treating non-agent files (CLAUDE.md, AGENTS.md, etc.)
as agent resources when they appeared in tracked repos.

Two fixes:
- Expand ConventionalExcludes with 7 well-known convention filenames
  (CLAUDE.md, AGENTS.md, GEMINI.md, COPILOT.md, CONTRIBUTING.md,
  CODE_OF_CONDUCT.md, SUPPORT.md)
- For tracked repos with an agents/ subdirectory, only discover files
  inside agents/ — skip repo root files and other subdirs (docs/, etc.)

Also includes UI polish:
- Display flat names (__ separator) as path separators in toasts/labels
- Consolidate batch install errors into single toast
- Show .agentignore state in sync diff/preview responses
- Track badge + friendly repo name in resource list/folder tree
2026-04-10 02:14:15 +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 da000c4d07 feat(server): agent tracked repo install, prune-on-empty, audit guards
- appendAgentDiffs helper deduplicates diff/stream agent logic
- handler_agent_diff: skip local copies, junction-aware checks
- handler_sync: prune orphan agents even when source is empty
- handler_install: tracked agent repo auto-detection and routing
- handler_skills: expose RepoRelPath and Targets for agents
- handler_skills_batch: agent target assignment via frontmatter
- handler_sync_matrix: pass agent Targets to ClassifySkillForTarget
- handler_update: tracked agent repo git pull update
- handler_audit: guard empty/missing source dirs gracefully
- Tests for all of the above
2026-04-10 02:05:13 +08:00
Willie 40dca838db fix(cli): agent diff drift detection and sync prune when source empty
- diff_agents: detect symlink drift, local copy blocking, fix prune count
- sync_agents: continue to prune targets when source has no agents
  instead of returning early, matching skills behavior
2026-04-10 02:05:06 +08:00
Willie b23425aafd feat(cli): tracked agent repo support in install, check, update, doctor
- install: --agent + --track validation, InferTrackedKind dispatch
- install_handlers: agent kind routing, renderTrackedAgentRepoMeta
- check: enrich tracked agents with remote status (update_available, dirty)
- update_agents: batchUpdateAgents with tracked repo git pull
- list: agent repo URL fallback via RepoRelPath
- doctor: filter-aware agent count, project mode version check
2026-04-10 02:05:01 +08:00
Willie 7e30699eaa feat: add tracked agent repo discovery and install support
- DiscoveredResource gains RepoRelPath and Targets fields
- AgentKind.Discover populates RepoRelPath via findTrackedRepoRelPath
- AgentCheckResult gains RepoPath and dirty status for tracked repos
- InferTrackedKind auto-detects pure-agent repos for --track install
- TrackedRepoResult reports AgentCount and Agents list
2026-04-10 02:04:55 +08:00
Willie b8a189ba58 Improve resource install agent support
Add local-path resource discovery so install flows can detect agents as well as skills. Preserve nested agent paths and suffixless agent metadata keys during batch install and update, and refresh the UI copy to use resource-aware wording on the install surface.
2026-04-10 01:26:40 +08:00
Willie 35fcb7475b feat(ui): add SegmentedControl for agent scope on Collect page
CollectPage now has Skills/Agents/Both scope selector matching
SyncPage pattern. Scan and collect operations pass kind to API.
Selected set uses 3-segment key (target/kind/name) to prevent
collision between skills and agents with same name.
2026-04-10 00:28:39 +08:00
Willie bf2aff0059 feat(ui): extend collect API client with kind parameter
collectScan now accepts optional kind param for agent scanning.
collect method items accept optional kind field.
2026-04-10 00:25:53 +08:00
Willie 4b37f1f21d feat(server): extend collect endpoint to pull agents via kind field
collectSkillRef now has optional kind field. Items with kind=agent
are resolved against agent target paths and pulled via PullAgents().
Results from skills and agents are merged into a single response.

Oplog tracks skill and agent counts separately for observability.
2026-04-10 00:25:25 +08:00
Willie 4834e4580d feat(server): extend collect scan to support kind=agent parameter
handleCollectScan now accepts ?kind=skill|agent query parameter.
When kind=agent, scans for local agent files in agent target dirs.
When kind is empty, scans for both skills and agents.
2026-04-10 00:20:01 +08:00
Willie a73d55dc26 refactor: extract agent helpers and simplify duplicated patterns
- Extract agent_helpers.go: kind constants, discoverActiveAgents(),
  resolveAgentPath(), builtinAgentTargets(), mergeAgentDiffItems()
- Replace 3 inline agent path resolution blocks with resolveAgentPath()
- Replace 3 inline agent discovery blocks with discoverActiveAgents()
- Replace 2 inline diff merge blocks with mergeAgentDiffItems()
- Fix handleSync prune triple-scan: capture index from merge pass
- Frontend: replace 10 filter() calls with single useMemo reduce pass
- Use kind constants instead of raw strings across all server files
2026-04-10 00:02:53 +08:00
Willie d4bd0a66df docs(sync,diff): fix agent sync description and add agent diff section
- Fix sync.md: 'sync' defaults to skills only, not skills+agents
- Fix --all flag description: syncs skills + agents + extras
- Add 'sync agents' to usage examples
- Add Agent Diff section to diff.md with usage examples
2026-04-09 23:56:03 +08:00
Willie 294be5f08a docs(ui): update sync page and API description for kind param
- Sync page now has scope selector (Skills / Agents / Both)
- POST /api/sync accepts kind param
2026-04-09 23:53:25 +08:00
Willie 568d2b7f64 fix: address code review findings
- Fix data race: read agentsSource inside RLock in handleDiffStream
- Validate kind param in handleSync (reject invalid values)
- Add test for symlink-points-elsewhere agent diff case
- Always show KindBadge on DiffItemRow (default to 'skill')
2026-04-09 23:50:42 +08:00
Willie 3dfbff7f53 feat(ui): add sync scope control and kind-separated summary
- SegmentedControl with Skills / Agents / Both options (default: Both)
- Sync button text and API kind param change with selection
- Diff summary shows separate skill/agent counts with KindBadge
- Split button labels (Force Sync) also reflect scope
2026-04-09 23:44:33 +08:00
Willie dfd69b7ea0 feat(ui): add kind param to sync API client
Accepts 'skill' | 'agent' to control sync scope.
2026-04-09 23:42:36 +08:00
Willie d1ac3dd649 feat(server): support kind param in POST /api/sync
Accept 'kind' field in sync request body:
- 'skill': sync skills only (current behavior)
- 'agent': sync agents only via SyncAgents()
- '' (empty): sync both skills and agents

Agent sync uses existing SyncAgents/PruneOrphanAgentLinks/PruneOrphanAgentCopies.
Remove agent-exists-but-no-target warning (now obsolete).
2026-04-09 23:41:16 +08:00
Willie 55e2e0e5b3 feat(server): include agent diffs in handleDiff and handleDiffStream
- Discover agents from agentsSource() and compute per-target diffs
- Merge agent diff items into existing target results
- Set Kind='skill' on all existing skill diff items
- Set Kind='agent' on all agent diff items
- Targets without agentPath are skipped (matches CLI behavior)
2026-04-09 23:38:37 +08:00
Willie 335092066f feat(server): add computeAgentTargetDiff for agent diff in UI
Port agent diff logic from CLI (diff_agents.go) to server package.
Returns []diffItem with Kind='agent' for link/update/prune/local actions.
2026-04-09 23:34:21 +08:00
Willie aaabc3ad88 refactor: simplify audit code — constants, dedup helpers, cache pattern
- Add audit.CrossSkillResultName constant, use in Go + TS
- Merge toAuditInputs/toAgentAuditInputs into one with isFile param
- Extract discoverForKind() and toInputsForKind() to eliminate 5+ if-else branches
- Simplify launchAuditTUIWithTabs with otherKindFilter dispatch
- Use CROSS_SKILL_NAME constant in AuditPage.tsx
2026-04-09 16:23:01 +08:00
Willie f0f371c604 fix(list): group agents by directory in TUI
Set RepoName from parent directory for nested agents so
buildGroupedItems creates proper group headers (e.g. demo (27))
instead of putting all agents under standalone.
2026-04-09 16:07:07 +08:00
Willie ed924c9193 fix(list): fix tab bar clipped off screen in split layout
Panel height calculation was off by 1 (subtracted 7 but actual
overhead is 8 lines), causing the tab bar to be pushed above the
visible terminal area.
2026-04-09 16:02:05 +08:00
Willie ff1aedfd1a fix(audit): group agents by directory in TUI
auditRepoKey now groups any nested path (e.g. demo/code-reviewer.md)
by its first segment, not just tracked repo prefixes starting with _.
This gives agents the same directory grouping as the Resources page.
2026-04-09 15:41:29 +08:00
Willie 33cbd17ddc fix(audit): show 'No skills/agents' instead of 'No items' in TUI
Set list item name per tab so empty state shows contextual message.
Also align empty state text with left padding matching list title.
2026-04-09 15:39:18 +08:00
Willie 4c0674ddc1 fix(audit): set agentsSourcePath in project mode for TUI tab
Project mode was missing agentsSourcePath assignment, causing
Agents(0) in TUI even when agents exist. Also simplifies the
kind-based source selection to use the existing override at line 217.
2026-04-09 15:38:02 +08:00
Willie 486f13513e fix(audit): exclude _cross-skill from TUI tab counts
Filter out synthetic _cross-skill result before passing to TUI.
Fixes Skills(7) showing when only 6 real skills were scanned.
2026-04-09 15:35:45 +08:00
Willie 12490620b0 fix(ui): audit card icon color follows max severity
Icon/border color now maps to the highest severity finding in the card:
CRITICAL → red, HIGH/MEDIUM → orange, LOW → blue, INFO → gray.
Previously all non-blocked cards used the same orange regardless of
severity, making it impossible to gauge severity at a glance.
2026-04-09 15:29:10 +08:00
Willie e1c6549129 fix(ui): fix audit summary mixing agent counts with finding counts
Summary line now shows only consistent metrics:
- scanned/passed/blocked/with findings (all agent-level)
- total finding count (clearly labeled)
Removed low/info severity counts that were confusing because they
counted findings while adjacent numbers counted agents.
2026-04-09 15:24:44 +08:00
Willie 01a6f662c6 fix(ui): exclude _cross-skill from audit card count and show separately
Cross-skill analysis is a synthetic result, not an actual scanned
resource. Separating it fixes the mismatch between summary counts
(e.g. '4 warnings') and visible card count (was showing 5 cards).
Now shown as a distinct 'Cross-resource analysis' section.
2026-04-09 15:14:57 +08:00
Willie 91eabf3369 feat(ui): cache audit results with React Query
SSE scan results are written to query cache on completion. Navigating
away and back shows cached results instead of requiring a re-scan.
Cache expires after 5 minutes (staleTimes.audit). Per-kind cache keys
ensure skills and agents results are independent.
2026-04-09 15:02:46 +08:00
Willie 40347477d5 fix(audit): scan all agents including disabled ones
Security audit should scan ALL agents regardless of .agentignore
status — disabled agents may still contain threats.
2026-04-09 14:49:24 +08:00
Willie 353f0cb068 fix(ui): match audit tab style to resources page
Replace the button-style tabs (filled bg, border-2) in AuditPage with
the underline+icon+badge style used by ResourcesPage, TrashPage, and
BatchUninstallPage for visual consistency across tabbed pages.

- Use nav with role=tablist and aria-selected for accessibility
- Add Puzzle/Bot icons matching ResourcesPage tabs
- Show count badge only when data is available (tab.count != null)
- Apply ss-resource-tab class for shared underline transition style
2026-04-09 14:46:02 +08:00
Willie 1b9ba78719 fix(audit): scan agents as individual files, not directories
Agents are individual .md files discovered by resource.AgentKind{}.Discover(),
but audit was using collectInstalledSkillPaths() which calls
sync.DiscoverSourceSkillsLite() — designed for skill directories. Then
ParallelScan() called ScanSkill() which expects directories, not files.

Changes:
- Add IsFile flag to audit.SkillInput; when set, ParallelScan uses
  ScanFile/ScanFileForProject instead of ScanSkill variants
- Add collectInstalledAgentPaths() using resource.AgentKind{}.Discover()
  and resource.ActiveAgents() for proper agent file discovery
- Add toAgentAuditInputs() helper that sets IsFile=true
- Branch on kindAgents in auditInstalled(), auditFiltered(), and
  launchAuditTUIWithTabs() to use agent-specific discovery and inputs
- Add discoverAuditAgents() in server handler and update
  resolveAuditSource() to return isAgents flag
- Update handleAuditAll, handleAuditStream to use agent-aware discovery
  and build SkillInput with IsFile=true for agents
2026-04-09 14:45:24 +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 833fc86632 feat(ui): add Skills/Agents tab bar to audit page
Tab bar switches between skills and agents audit scans. Each tab
caches results independently. API calls include ?kind parameter.
Display text dynamized for skill/agent context.
2026-04-09 14:36:32 +08:00
Willie 86461ecc7d feat(audit): add Skills/Agents tab switching to TUI
Two-tab TUI following list_tui.go pattern. Tab/Shift+Tab cycles
between Skills and Agents tabs. Initial tab matches CLI argument.
Secondary kind scanned lazily when TUI launches via auditTUIContext.

Also adds agentsSourcePath param to auditInstalled/auditFiltered
and launchAuditTUIWithTabs helper for dual-kind scanning.
2026-04-09 14:31:14 +08:00
Willie e1c94b5427 feat(server): add ?kind=agents param to audit API handlers
- Add resolveAuditSource() helper that returns source dir and result kind
  based on ?kind query param (agents → agentsSource(), default → skills)
- Update handleAuditAll() to use resolveAuditSource() and set Kind on
  all results after processAuditResults()
- Update handleAuditStream() with the same pattern for SSE endpoint
- Update toAuditResponse() to propagate result.Kind into response JSON
2026-04-09 14:24:43 +08:00
Willie c6f24ab34a feat(audit): dynamize skill/agent terminology in CLI output
Thread kind parameter through auditInstalled, auditFiltered, and
auditSkillByName. All output text now uses Noun() for correct
skill(s)/agent(s) display. Set Result.Kind on all scan results.

Also update audit_project.go callers to pass kindSkills.
2026-04-09 14:23:20 +08:00
Willie baf6b181ae feat(audit): add Kind field to Result, Noun helpers to kind_filter, remove --all flag
- audit.Result gains a Kind string field ("skill"|"agent", set by caller)
  so callers can tag results for display without touching the scan engine
- resourceKindFilter gets Noun(count) and SingularNoun() helpers to produce
  correct singular/plural display nouns per resource type
- audit command switches from parseKindArgWithAll to parseKindArg, dropping
  the --all flag and its two help-text lines; agents subcommand is the way
  to target agents explicitly
2026-04-09 14:18:28 +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 2475acd35e feat(ui): add agent support to batch uninstall and trash pages
- Add agent-mode batch uninstall handler with kind-based routing
  in handler_uninstall.go (skill/agent dispatch)
- Add Skills/Agents tab navigation to BatchUninstallPage and TrashPage
  with per-tab filtering and scoped empty states
- Extract SourceBadge component to replace duplicated getTypeLabel /
  skillTypeLabel helpers across ResourcesPage, ResourceDetailPage,
  BatchUninstallPage, and AnalyzePage
- Add kind field to BatchUninstallRequest API type
- Capitalize badge labels for consistency (tracked → Tracked, etc.)
2026-04-09 13:48:30 +08:00
Willie d2bf6a0fe3 docs: add agent management to README for v0.19.0
Update tagline, highlights, architecture diagram, and platform table
to reflect agents as a core resource type alongside skills and extras.
2026-04-09 04:18:08 +08:00
Willie 30da704406 fix(sync): pass -g flag to cmdSyncExtras in global --all mode
Without the explicit -g flag, cmdSyncExtras falls back to auto-detection
which picks project mode when cwd contains .skillshare/config.yaml,
causing 'sync --all -g' to display project extras messages instead of
global ones. Mirrors the project-mode path that already passes -p.
2026-04-09 04:11:31 +08:00
Willie 2a91a72f6e fix(server): sync matrix agent handling and stale test routes
- Fix sync matrix using wrong builtin agent targets in project mode
  (DefaultAgentTargets → branch on IsProjectMode)
- Fix sync matrix not skipping filters for agent symlink mode,
  matching the existing skill symlink behavior
- Remove double-defensive slice copies in handleListTargets since
  targetsummary.Builder already clones Include/Exclude
- Extract shared findAgent() to deduplicate discovery logic between
  resolveAgentResource and resolveAgentRelPathWithStatus
- Update test URLs from /api/skills to /api/resources and response
  keys from skills/skill to resources/resource to match the route
  rename from the resources refactor
2026-04-09 04:07:35 +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