Commit Graph
1357 Commits
Author SHA1 Message Date
Willie 586f0f5773 fix(agents): correct project-mode agent dispatch for all commands
Fixes 3 high-severity bugs found by Codex adversarial review:

1. update -p agents: was writing to global agents instead of project.
   Fix: check project mode BEFORE agent branch, add cmdUpdateAgentsProject.

2. sync -p agents: was silently running skill sync.
   Fix: add syncAgentsProject with project config/target resolution.
   sync -p all: now runs skill sync then project agent sync.

3. uninstall -p agents: was searching .skillshare/skills instead of agents.
   Fix: already addressed in 22c6c61e, verified still correct.

Additional hardening for commands without project agent support:
- collect -p agents: returns explicit "not yet supported" error
- status -p agents: returns explicit error
- check -p agents: returns explicit error
- diff -p agents: returns explicit error
- audit -p agents: returns explicit error

Principle: never silently fall back to skills when agents is requested.
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
Willie 95c46ca822 feat(agents): wire backup/restore and update CLI help text (Phase 4)
backup/restore:
- "backup agents" backs up agent target paths (entry name: <target>-agents)
- "restore agents <target>" restores from agent backup
- Default backup unchanged (skills only)

help text:
- Updated 9 commands with agents positional in Usage and Examples:
  list, sync, update, uninstall, collect, trash, backup, restore,
  status, diff

5 new integration tests (backup/restore round-trip, dry-run, default
unchanged, project mode rejected), all passing.
2026-04-07 18:05:40 +08:00
Willie c2b9a1537d feat(agents): wire kind filter into status, diff, doctor (Phase 3)
status:
- "status agents" shows agent source + per-target agent status (path, linked, drift)
- "status all" shows both skills and agents
- JSON output includes "agents" section with source/count/targets
- Default "status" unchanged (skills only)

diff:
- Kind field populated in JSON output ("skill" or "agent")
- parseKindArg wired into cmdDiff dispatch
- diffItemToJSON helper centralizes Kind defaulting

doctor:
- New checkAgentTargets: validates agent target paths, detects broken
  symlinks and drift (expected vs linked count)
- Checks run after existing agent source check

8 new integration tests, all passing.
2026-04-07 18:05:40 +08:00
Willie cb55ffe55c feat(agents): add positional kind filter and wire agents into list, sync, update, uninstall, collect, trash
Phase 1 — Foundation:
- parseKindArg() defaults to kindSkills, adds "all" keyword
- list: discover agents via resource.AgentKind, populate Kind field in JSON/TUI
- sync agents / sync all: new sync_agents.go handles agent sync to targets
- uninstall: migrate from --kind flag to positional ("uninstall agents <name>")

Phase 2 — Core CRUD:
- update agents: check status, enrich with remote, reinstall from source
- uninstall agents: move .md + sidecar to agent trash with confirmation
- collect agents: CollectAgents from agent-capable targets to source
- trash agents: list/restore/delete/empty for agent trash directory
- trash.RestoreAgent(): file-level restore (vs directory-level for skills)

Behavior: all commands default to skills-only (no breaking change).
"cmd agents" = agents only, "cmd all" = skills + agents.

Fix: TestLog_SyncPartialStatus uses dangling symlink instead of chmod
(root ignores permissions in devcontainer).

25 new integration tests, all passing.
2026-04-07 18:05:40 +08:00
Willie ca73b40e0f feat: warn when agents installed/synced but no targets support agents
Add Config.HasAgentTarget() helper that checks if any configured target
has an agents path set.

handler_install: append warning to install summary when agents are
installed but no targets support them.

handler_sync: after sync completes, check if agents exist in source
but no targets have agent paths — add warning to response.
2026-04-07 18:05:40 +08:00
Willie e6e41c117b fix(ui): use props instead of parent scope vars in FolderTreeView
activeItems/activeTab are not accessible inside the FolderTreeView
sub-component. Use the skills prop (already passed) instead.
2026-04-07 18:05:40 +08:00
Willie 974c3d51b1 fix(ui): agent detail hides Files, tab persists to localStorage, folder view labels
SkillDetailPage: hide Files card when skill.kind === 'agent' (single
file, redundant info).

ResourcesPage:
- Tab selection persists to localStorage, restored on revisit.
- Folder view summary: '2 agents in 1 folder' (not 'skills').
- Folder tree: FileText icon for agents, Puzzle for skills.
- Grid card: FileText icon for agents.
2026-04-07 18:05:40 +08:00
Willie 9be0ea001b fix: agent list metadata, detail lookup, card icon, and time format
handler_skills list: read agent metadata directly via os.ReadFile
instead of install.ReadMeta (which appends subdirectory). Fixes agents
showing as 'local' instead of 'github'.

handler_skills detail: strip .md from URL param before agent lookup.
Fixes 'skill not found: content-marketer.md' error.

handler_skills: use time.RFC3339 instead of hardcoded format string.

ResourcesPage: use FileText icon for agents, Folder for skills.
2026-04-07 18:05:40 +08:00
Willie 6c339da80d fix(ui): align checkbox with first text line and fix install summary label
SkillPickerModal: use items-start + mt-1.5 on checkbox/radio to align
with first line of multi-line content (name + path).

handler_install: summary message uses 'agents' when kind is agent,
instead of always saying 'skills'.
2026-04-07 18:05:40 +08:00
Willie 9ffc7bb52f fix(ui): center-align checkbox with skill name in picker modal 2026-04-07 18:05:40 +08:00
Willie da4f460a90 fix(ui): dynamic picker modal title based on resource kind
Show 'Select Agents to Install' when all items are agents,
'Select Resources to Install' for mixed, 'Select Skills to Install'
for skills-only.
2026-04-07 18:05:40 +08:00
Willie a2d3b47e46 fix(install): discover agents in subdir URLs and fix single-item kind routing
Backend (install_discovery.go):
- Add discoverAgents() call to all 3 subdir discovery paths (sparse
  checkout, GitHub API, full clone fallback). Previously only whole-repo
  discovery detected agents.

Frontend (InstallForm.tsx):
- Single-skill fast path now checks hasAgents before auto-installing.
  When agents exist alongside a single skill, falls through to the
  kind selector instead of silently installing as skill.
2026-04-07 18:05:40 +08:00
Willie 60489b3a0d fix(install): route agent installs to agents source directory
Backend (handler_install.go):
- handleInstallBatch checks body.Kind field; when 'agent', uses
  InstallAgentFromDiscovery() writing to agentsSource() instead of
  skills source directory.

Frontend (client.ts):
- installBatch accepts optional kind param.

Frontend (InstallForm.tsx):
- handleBatchInstall detects kind from selected items and passes
  kind='agent' to the API when installing agents.
2026-04-07 18:05:40 +08:00
Willie e4301f5781 feat(ui,api): kind-first install flow for mixed repos + discover agents
Backend (handler_install.go):
- handleDiscover now returns agents[] alongside skills[] with kind field
- needsSelection true when agents are present

Frontend (client.ts):
- Add DiscoveredAgent type and agents field to DiscoverResult

Frontend (InstallForm.tsx):
- Mixed repo: show kind selector dialog (Skills/Agents buttons)
- Pure agent repo: map agents to skill picker format directly
- After kind selection, open existing SkillPickerModal with filtered items

Spec/design/tasks updated with kind-first selection decision.
2026-04-07 18:05:40 +08:00
Willie d690408df9 fix(ui): increase spacing between Resources header and tabs 2026-04-07 18:05:40 +08:00
Willie 273277c2d6 fix(ui): use Layers icon for Resources header to avoid tab icon duplication 2026-04-07 18:05:40 +08:00
Willie 84c60314d5 fix(ui): remove redundant count subtitle from Resources page header
Counts are already shown in the tab badges — subtitle now shows
a static description instead of duplicating the numbers.
2026-04-07 18:05:40 +08:00
Willie d3851b1a69 refactor(ui): underline tabs with playful theme support for resource tabs
Replace SegmentedControl with proper underline tab pattern:
- nav[role=tablist] with button[role=tab][aria-selected]
- 3px bottom border indicator, semibold text, count badge pill
- Gap-6 spacing between tabs for breathing room

Playful theme enhancements:
- Wavy SVG border-image for the tab bar bottom border (dark mode variant)
- Active tab count badge inverts to pencil bg + paper text
- Wobble border-radius on count badge via --radius-wobble-badge

Clean theme: minimal underline with pencil color active state.
2026-04-07 18:05:40 +08:00
Willie 79b717e115 fix(ui): use ss-segmented classes for resource tabs to inherit playful theme
Replace raw button underline tabs with ss-segmented + ss-segmented-item
classes. This hooks into the existing playful theme CSS which applies
wobbly border-radius, hard offset shadows, and pencil-colored active
state — matching the hand-drawn aesthetic of other segmented controls.

Uses non-connected variant (gap between buttons) to visually
distinguish from the sub-filter pills below.
2026-04-07 18:05:40 +08:00
Willie e5d512fb67 refactor(ui): replace SegmentedControl with underline tabs for Skills/Agents
Use underline tab pattern for Skills/Agents primary navigation:
- Border-bottom indicator on active tab (pencil color)
- Icon + label + count for each tab
- Sits between page header and sticky toolbar
- Clear visual hierarchy: underline tabs (primary) vs pill filters (secondary)

Removes the connected SegmentedControl that was visually identical
to the sub-filters, causing hierarchy confusion.
2026-04-07 18:05:40 +08:00
Willie c61033a143 refactor(ui): use connected SegmentedControl style for Skills/Agents tabs
Move resource type toggle into the sticky toolbar row alongside the
view toggle. Use connected + size='md' SegmentedControl matching the
grid/folder/table view toggle design (icon + text label, white active
background, shared border container).

Removes the separate tab section above the toolbar — both controls
now live in the same horizontal bar for a cleaner, more compact layout.
2026-04-07 18:05:40 +08:00
Willie eff9647def refactor(ui): rename SkillsPage to ResourcesPage with Skills/Agents tabs
Rename SkillsPage.tsx to ResourcesPage.tsx. Page title changed to
'Resources' with subtitle showing both skill and agent counts.

Add top-level SegmentedControl tabs (Skills | Agents) for switching
between resource types. Each tab has its own count badge. Sub-filters
(All/Tracked/GitHub/Local) apply within the active tab.

Tab selection persists via ?tab=agents URL param. Dashboard stat cards
link to /resources and /resources?tab=agents.

Route: /resources is the primary path; /skills kept as alias.
Nav sidebar: 'Skills' → 'Resources' with Layers icon.
Keyboard shortcut 's' → /resources.
Tour updated for resource-oriented language.
2026-04-07 18:05:40 +08:00
Willie d759a7e8ee docs: add agent support to all command reference and getting-started pages
Command pages updated (7 files):
- list: 'skillshare list agents', [A] badge
- install: --kind agent, -a flag, auto-detection
- sync: agent sync with all three modes, supported targets
- check: 'skillshare check agents' drift detection
- audit: 'skillshare audit agents'
- enable: --kind agent routes to .agentignore
- uninstall: --kind agent flag

Getting started updated:
- first-sync: link to agents concepts in What's Next
- quick-reference: agent management command table + agents source path

Commands index: added agents row to What do you want to do table.
2026-04-07 18:05:40 +08:00
Willie f8c958d305 test: add agent integration tests for install, check, enable, and uninstall
7 integration tests covering:
- install --kind flag parsing and validation
- install -a flag parsing
- check agents with empty dir, local agent, and JSON output
- enable/disable --kind agent routing to .agentignore
- uninstall --kind agent flag parsing
2026-04-07 18:05:40 +08:00
Willie 8ed32e2ded feat(install): discover agents in tracked repos on clone and update
installTrackedRepoImpl: discover agents alongside skills after clone.
Report agent count in warnings. Update empty-repo warning to account
for repos that have only agents.

updateTrackedRepo: discover agents after git pull, report count.
2026-04-07 18:05:40 +08:00
Willie 9896aa7cd6 docs: add Agents concepts page to website documentation
Create website/docs/understand/agents.md covering:
- Skills vs Agents comparison table
- Directory structure (global + project)
- Agent file format and naming conventions
- Supported targets (claude, cursor, opencode, augment)
- Sync modes (merge/symlink/copy)
- .agentignore usage
- Install from repos with auto-detection
- CLI commands reference
- Data flow diagram

Update sidebar ordering to include agents between skill-format and
project-skills.
2026-04-07 18:05:40 +08:00
Willie 2cb830f736 feat(check): add remote update detection for tracked agents
Add RepoURL field to AgentCheckResult. Add EnrichAgentResultsWithRemote()
that batches remote HEAD hash checks via ParallelCheckURLs and marks
agents as 'update_available' when remote has newer commits than the
installed version.
2026-04-07 18:05:40 +08:00
Willie abd2328b9a feat(ui): add KindBadge to CollectPage and BatchUninstallPage
CollectPage: show kind badge next to local skill names in scan results.
BatchUninstallPage: show kind badge next to each skill in uninstall list.
2026-04-07 18:05:40 +08:00
Willie 2f4021fc6a feat: add kind badge to list TUI and remaining frontend pages
list_tui_item: show [A] badge prefix for agents in terminal list view.
list.go: add Kind field to skillEntry and skillJSON structs.

SyncPage: add kind badge to diff items using DiffTarget.items.kind.
AuditPage: add kind badge to audit result cards.
UpdatePage: add kind badge to update result items.
SkillPickerModal: add kind badge in skill picker.
client.ts: add kind to DiffTarget items and AuditResult types.
2026-04-07 18:05:40 +08:00
Willie c176d89405 feat(api): add kind field to sync, audit, check, update, and install handlers
handler_sync: add Kind field to diff stream item struct.
handler_audit: add Kind field to audit stream result.
handler_check: add Kind field to check stream result.
handler_update: add Kind field to update stream result.
handler_install: add Kind field to install request for agent support.
2026-04-07 18:05:40 +08:00
Willie e29a42d2d1 feat(cli): add kind arg to update command and kind field to diff output
update: add parseKindArg() for 'skillshare update agents' syntax.

diff: add Kind field to diffJSONItem struct for agent-aware diff output.
2026-04-07 18:05:40 +08:00
Willie 5dc981a5cb feat(audit): wire agent-only audit filtering via kind arg
When 'skillshare audit agents' is used, override sourcePath to agents
source directory so auditInstalled() scans agent .md files.
2026-04-07 18:05:40 +08:00
Willie 57cfab7133 feat(cli): add kind filter to check and uninstall commands
check: add parseKindArg() for 'skillshare check agents'. When agents
kind selected, runs CheckAgents() on agents source dir and displays
per-agent status (up_to_date/drifted/local/error). Supports --json.

uninstall: add --kind flag to parseUninstallArgs and parseKindFlag()
in cmdUninstall dispatch. Kind stored in uninstallOptions for
agent-specific uninstall routing.
2026-04-07 18:05:40 +08:00
Willie 6659898cc2 feat: add kind badge to SkillDetailPage and kind arg to audit command
SkillDetailPage: import KindBadge, show kind badge (S/A) next to skill
name in the detail header.

audit: add parseKindArg() for 'skillshare audit agents' syntax. Kind
filter parsing ready, actual agent-only filtering to be wired.
2026-04-07 18:05:40 +08:00
Willie 4c43506df3 feat: agent detail endpoint, project reconcile, and TrashPage badge
handler_skills: skill detail endpoint falls back to agents source when
skill not found. Returns agent .md file content and kind='agent'.

project_reconcile: add ReconcileProjectAgents() to scan agents source,
update registry with kind='agent' entries, and batch-update
.skillshare/.gitignore for agent files and metadata.

TrashPage: add KindBadge next to trashed item names with 'skill'
fallback for old trash items without kind field.
2026-04-07 18:05:40 +08:00
Willie 017dc22f3e feat: add --kind agent to enable/disable and agent path to TargetsPage
enable.go: support --kind agent flag to route enable/disable operations
to .agentignore instead of .skillignore. Works in both global and project
modes. Oplog entries now include kind field.

TargetsPage.tsx: show agent path below skill path when target has
agentPath. Display agent linked count alongside skill counts.
2026-04-07 18:05:40 +08:00
Willie 9a053a35b6 feat(ui): add agent stat card, kind filter tabs, and kind fields to API handlers
DashboardPage: add Agents stat card with Bot icon and accent color,
linking to /skills?kind=agent.

SkillsPage: add Skills/Agents filter tabs alongside existing filters.
KindBadge displayed on each skill card. matchFilter supports kind-based
filtering with accurate filter counts.

handler_collect: add kind field to localSkillItem response.
handler_uninstall: add kind field to batch request and result structs.
2026-04-07 18:05:40 +08:00
Willie 47da532bbe feat(cli,api): add agent info to status, doctor, and trash handler
status: show agents source path and agent count alongside skills source.

doctor: add checkAgentsSource() health check verifying agents source
directory exists, is a directory, and reports agent count. Non-existent
dir is info (not error) since agents are optional.

handler_trash: add kind field to trashItemJSON for frontend badge.
2026-04-07 18:05:40 +08:00
Willie 5536cac794 feat(ui): add agent kind types to API client and KindBadge component
Update TypeScript types to match backend agent support:
- Skill: add kind field ('skill' | 'agent')
- Overview: add agentCount field
- Target: add agentPath, agentLinkedCount, agentExpectedCount
- AuditFinding: add optional kind field
- TrashedSkill: add optional kind field

Update listSkills() to accept optional kind filter param (?kind=agent).

Add KindBadge component rendering [S] (info) or [A] (accent) badges
using the existing Badge component.
2026-04-07 18:05:40 +08:00
Willie 6f2932c650 feat(api): add agent support to overview, skills, and targets endpoints
Add agentsSource() helper to Server for mode-aware agent directory
resolution (global: EffectiveAgentsSource, project: .skillshare/agents).

handler_overview: add agentCount field counting .md files in agents dir.

handler_skills: add kind field ("skill"/"agent") to skillItem response.
Support ?kind= query param filter. List agents from agents source dir
alongside skills, with metadata enrichment from per-agent meta files.

handler_targets: add agentPath, agentLinkedCount, agentExpectedCount
fields to targetItem for frontend agent path display.
2026-04-07 18:05:40 +08:00
Willie 12f8c52a11 feat: add .agentignore support and agent file validation
Add ReadAgentIgnoreMatcher() in skillignore package to read .agentignore
and .agentignore.local files using the same gitignore-style pattern
format as .skillignore.

Integrate .agentignore filtering into AgentKind.Discover() with both
directory-level CanSkipDir() and file-level Match() checks.

Add agent validation in internal/validate/:
- AgentFile(): extension check, filename restrictions (no spaces/special
  chars), file size warning (>100KB), existence and type checks
- AgentName(): name format validation (alphanumeric + hyphens/underscores)

9 new tests across resource and validate packages.
2026-04-07 18:05:40 +08:00
Willie e2101ab5e9 feat(cli): add resource kind filter parsing for CLI commands
Add kind_filter.go with two parsing strategies:
- parseKindArg(): positional syntax (list agents, sync skills)
- parseKindFlag(): flag syntax (uninstall --kind agent tutor)

resourceKindFilter type with IncludesSkills()/IncludesAgents() helpers
for handler-level routing. Supports singular and plural forms
(skill/skills, agent/agents).

16 test cases covering both parsers and filter logic.
2026-04-07 18:05:40 +08:00
Willie 949fd444e0 feat(check,trash): add agent drift detection and agent trash support
Add CheckAgents() in internal/check/ that scans agents source directory,
reads per-agent metadata (<name>.skillshare-meta.json), and compares
file hashes to detect drift. Statuses: up_to_date, drifted, local, error.

Add agent trash functions in internal/trash/:
- AgentTrashDir() / ProjectAgentTrashDir() for agent-specific trash paths
- MoveAgentToTrash() moves agent .md file + metadata to timestamped
  trash subdirectory with rename-or-copy-then-delete fallback

6 unit tests for agent check covering empty dir, local agent, hash
match, drift detection, nonexistent dir, and non-md filtering.
2026-04-07 18:05:40 +08:00
Willie ba1b03f5f9 feat(install): add agent discovery, install flow, and --kind/--agent flags
Extend DiscoveryResult with Agents field and auto-detection rules:
- agents/ convention directory scanned for .md files
- pure agent repo fallback (no SKILL.md, no agents/ dir, root .md files)
- conventional excludes (README/LICENSE/CHANGELOG/SKILL.md)

Add InstallAgentFromDiscovery() for single-file agent install with
per-agent metadata (<name>.skillshare-meta.json with kind: agent).

Add Kind field to SkillMeta and InstallOptions. New CLI flags:
- --kind <skill|agent>: explicit resource kind selection
- --agent/-a <names>: select specific agents (implies --kind agent)

Add AgentInfo struct, DiscoveryResult helper methods (HasAgents,
HasSkills, IsMixed), and InstallOptions helpers (IsAgentMode,
HasAgentFilter).
2026-04-07 18:05:40 +08:00
Willie 9a4fbdc18f feat(sync): add agent sync engine with merge, symlink, and copy modes
Add SyncAgents() dispatcher supporting all three sync modes:
- merge: per-file symlinks with local file preservation
- symlink: whole directory symlink to agent source
- copy: file copy with content-diff detection

Add CheckAgentCollisions() to detect agents that flatten to the same
filename from different subdirectories.

Add PruneOrphanAgentLinks() for merge mode and PruneOrphanAgentCopies()
for copy mode to clean up stale agent files in targets.

Add CollectAgents() to copy non-symlinked .md files from target back
to agent source directory.

18 tests covering all modes, collision detection, pruning, and collect.
2026-04-07 18:05:40 +08:00
Willie ea055de8e5 refactor(registry): rename SkillEntry to ResourceEntry and add unified registry load/save
Rename SkillEntry to ResourceEntry with type alias for backward compat.
All 56 call sites continue to compile without changes.

Add LoadUnifiedRegistry() to merge separate skills and agents registry
files for global mode (skills/registry.yaml + agents/registry.yaml).
Agent entries automatically get Kind="agent" during merge.

Add SaveSplitByKind() to split a unified registry back by kind for
persisting to the correct source directory. Skips writing agents
registry file when no agent entries exist.
2026-04-07 18:05:40 +08:00
Willie c049ccdae0 feat(config): add agents_source field and create agents directory on init
Add AgentsSource field to Config struct with EffectiveAgentsSource()
method that defaults to ~/.config/skillshare/agents when not set.

Global init now creates agents source directory alongside skills source.
Project init creates .skillshare/agents/ alongside .skillshare/skills/.
projectRuntime gains agentsSourcePath field for project-mode agent ops.

Update config.schema.json with agents_source property definition.
2026-04-07 18:05:40 +08:00
Willie 5160ed5ffe feat(resource): add ResourceKind interface, SkillKind/AgentKind implementations, and reserved name validation
Create internal/resource/ package with:
- kind.go: ResourceKind interface (Discover, ResolveName, FlatName,
  CreateLink, feature gates) + DiscoveredResource struct
- skill.go: SkillKind — directory-based discovery via SKILL.md,
  frontmatter name resolution, nested separator flatten (a/b → a__b)
- agent.go: AgentKind — single-file .md discovery with conventional
  excludes (README/LICENSE/CHANGELOG/SKILL.md), filename-based naming
  with frontmatter override, directory-strip flatten (dir/f.md → f.md)

Add "agents" to reservedSkillNames in validate.SkillName() to prevent
skill names conflicting with the agents source directory.

16 unit tests covering discovery, nested paths, name resolution,
flat name computation, feature gates, and edge cases.
2026-04-07 18:05:39 +08:00
Willie 7a010a9ae0 chore: release v0.18.9 2026-04-07 17:36:07 +08:00