Commit Graph
478 Commits
Author SHA1 Message Date
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 637814a996 style: gofmt 2026-04-07 17:35:06 +08:00
Willie 9ff006988a fix(sync): canonicalize paths for relative symlinks, atomic reformat
Two correctness improvements from Codex review:

1. EvalSymlinks before relative-link decisions: shouldUseRelative and
   createLink now resolve symlinked ancestors via EvalSymlinks so that
   a project opened through a symlinked workspace, or a target dir that
   traverses a symlink, produces correct relative paths (or falls back
   to absolute when paths diverge from the project root).

2. Atomic reformat via reformatLink: instead of remove→create (which
   loses the link on createLink failure), reformat now creates a temp
   link and renames it over the original. On Unix this is atomic; on
   Windows it falls back to remove→create when rename fails.

Tests added for symlinked project root, divergent target symlink,
and reformatLink atomic swap.
2026-04-07 17:26:37 +08:00
Willie adec63727b fix(sync): prevent infinite reformat loop on Windows junction fallback
On Windows without Developer Mode, createLink falls back to an NTFS
junction (always absolute). linkNeedsReformat would then return true
on every sync, causing a remove→recreate loop.

Add build-tagged canCreateRelativeLink(): returns true on Unix, and
on Windows probes once with sync.Once by creating a test relative
symlink in a temp dir. linkNeedsReformat skips reformat when the
platform cannot create relative links.

Also use filepath.Clean instead of filepath.Abs in resolveReadlink
(input is already absolute, avoids unnecessary os.Getwd).

Addresses PR #122 review feedback.
2026-04-07 17:26:37 +08:00
Willie de0291c37c fix(sync): handle root projectRoot prefix, use abs paths for Windows Rel
- shouldUseRelative: avoid double separator when projectRoot is /
- symlink_windows.go: use pre-resolved absTarget/absSource for Rel
- extras.go: check os.Remove error on wrong symlink replacement
2026-04-07 17:26:37 +08:00
Willie 3316c9073e fix(sync): resolve relative readlink against link parent, check os.Remove errors
filepath.Abs(dest) on a relative readlink result resolves against CWD,
not the symlink's parent directory. This broke the 'already correct'
check when comparing relative symlinks to absolute source paths.

Add resolveReadlink() helper that joins relative targets with
filepath.Dir(linkPath) before calling filepath.Abs.

Also check os.Remove errors in all reformat paths instead of ignoring
them silently.

Addresses PR #122 review feedback.
2026-04-07 17:26:37 +08:00
Willie e51fe60254 fix(sync): upgrade existing absolute symlinks to relative in project mode
sync previously skipped symlinks that pointed to the correct source,
even if their format (absolute vs relative) didn't match the expected
mode. This meant existing absolute symlinks in project mode were never
converted to relative on subsequent syncs.

Add linkNeedsReformat(dest, wantRelative) helper that checks whether
the raw readlink result has the wrong format. All four 'already
correct' skip points now check format and recreate when mismatched:

- SyncTargetMergeWithSkills (skills merge mode)
- SyncTarget (skills symlink mode)
- syncExtraSymlinkMode (extras directory symlink)
- syncOneExtraFile (extras per-file merge)

Global mode is unaffected: shouldUseRelative returns false, so
linkNeedsReformat never triggers on absolute links.

Also fix macOS /var → /private/var path mismatch in
TestSyncProject_RelativeSymlinks by EvalSymlinks on expected path.
2026-04-07 17:26:37 +08:00
Willie fe244e8289 refactor(sync): simplify shouldUseRelative and hoist extras computation
- Use utils.PathHasPrefix/PathsEqual for Windows case-insensitivity
- Eliminate redundant filepath.Clean call
- Hoist shouldUseRelative in syncExtraPerFile (compute once, pass bool)
- Add invariant comment in SyncTargetMergeWithSkills
2026-04-07 17:26:37 +08:00
Willie bbf2e4343e feat(sync): unify extras symlinks through createLink
Replace direct os.Symlink calls in extras.go with createLink, gaining:
- Relative symlink support in project mode
- Windows junction fallback for extras (previously missing)

Thread projectRoot through SyncExtra, CollectExtraFiles, and all callers.

Ref: #120
2026-04-07 17:26:37 +08:00
Willie 465db305ca feat(sync): pass projectRoot from project-mode callers
Project-mode sync now passes the project root directory through to
createLink, enabling relative symlinks for all paths under the project.
Server handlers use s.projectRoot for project-mode dashboards.

Ref: #120
2026-04-07 17:26:37 +08:00
Willie 3c8c56002d feat(sync): wire projectRoot through merge and symlink sync paths
SyncTargetMerge, SyncTargetMergeWithSkills, CreateSymlink, and SyncTarget
now accept projectRoot. When non-empty, createLink uses relative symlinks
for paths under the project root.

All existing callers pass empty string (global mode, no behavior change).

Ref: #120
2026-04-07 17:26:37 +08:00
Willie 1d62b15713 feat(sync): add relative parameter to createLink
Unix: computes filepath.Rel from link dir to source, falls back to
absolute on error.
Windows: tries os.Symlink with relative path first (Developer Mode),
falls back to mklink /J with absolute paths.

All existing call sites pass false (no behavior change yet).

Ref: #120
2026-04-07 17:26:37 +08:00
Willie c450078c69 feat(sync): add shouldUseRelative helper for project-mode relative symlinks
Determines whether both source and target paths are under the project
root, in which case relative symlinks are portable and can be committed
to git.

Ref: #120
2026-04-07 17:26:37 +08:00
Willie e82d18cfa4 fix: sync must not prune registry entries for installed skills
Sync's registry prune logic removed entries for installed skills whose
files were missing from disk. This was wrong: the registry is the
authoritative record of installations managed by install/uninstall.

Remove PruneStaleSkills calls from sync (CLI global, CLI project, and
web UI handler). Reconcile (called during install) still uses prune
with full metadata context, which is correct.

Fixes: running 'sync' after 'install' would clear registry.yaml when
the installed skill's source files were not yet on disk.
2026-04-06 17:28:10 +08:00
Willie 343e29cfe5 fix(ui,server): harden target management, toggle, and tracked-repo UX
- Enable frontmatter parsing in DiscoverSourceSkillsAll so /api/skills
  returns saved targets (fixes target display reverting to All)
- Skip tracked-repo skills in batch/single target handlers to prevent
  dirty git state; reject with 400 for single-skill endpoint
- Add RefreshMetaHashes to recompute audit hashes after SKILL.md edits;
  batch handler refreshes outside the write lock
- Show 'Uninstall Repo' with confirm dialog for tracked-repo members
  instead of the always-failing individual uninstall action
- Return 409 Conflict when enabling a skill disabled by glob pattern
  in .skillignore/.skillignore.local instead of false success
- Preserve IsInRepo flag for root-skillignore-disabled skills so they
  remain visible in the Tracked tab after disable
- Update changelog and website changelog for v0.18.7
2026-04-04 17:05:22 +08:00
Willie ce76f58393 fix(doctor): read metadata.version + harden frontmatter delimiter parsing
- doctor: replace inline frontmatter parser with version.ReadLocalSkillVersion
  which correctly reads nested metadata.version (fixes #119)
- frontmatter_write: use TrimRight instead of TrimSpace for --- delimiter
  so indented --- inside YAML block scalars is not mistaken for end marker
- Update changelog and website changelog for v0.18.7
2026-04-04 17:05:22 +08:00
Willie 4fbee521ce fix(server): batch targets folder matching + reduce mutex scope
- Fix folder trailing slash bug: filepath.Clean now normalizes input
  before matchesFolder comparison (e.g. 'frontend/' → 'frontend')
- Narrow mutex scope in handleBatchSetTargets: RLock for config read,
  no lock during DiscoverSourceSkillsAll, Lock only for write loop
  (matches existing handleSetSkillTargets pattern)
- Defensive filepath.Clean on cleanEmptyParents inputs
- Add TestMatchesFolder unit test and trailing slash handler test
2026-04-04 17:05:22 +08:00
Willie 9abd9af71f feat(server): add SetFrontmatterList utility + batch/single target endpoints
New utility: SetFrontmatterList() writes/removes YAML list fields
in SKILL.md frontmatter with dot-notation support (metadata.targets).
Normalizes legacy top-level targets field. Preserves body content.

New endpoints:
- POST /api/skills/batch/targets — set targets for all skills in folder
- PATCH /api/skills/{name}/targets — set target for single skill
Both use s.mu.Lock() for safe concurrent access.

Includes 15 unit tests covering set/remove/traverse/root-only/not-found.
Part of issue #115.
2026-04-04 17:05:22 +08:00
Willie 115edf3f24 fix(server): correct project-mode gitignore path + prevent registry prune basename collision
P2-1: handleUninstallRepo and handleBatchUninstall used s.cfg.Source for
gitignore removal, but project-mode installs write to .skillshare/.gitignore
with a "skills/" prefix. Add gitignoreDir() helper that returns the correct
base directory per mode, and prefix entries in project mode.

P2-2: Registry prune used filepath.Base(repoName) to derive the legacy group,
causing sibling nested repos (e.g., org/_team-skills vs dept/_team-skills) to
collide on the same basename. Now uses exact Group match for nested repos and
restricts legacy basename matching to top-level repos only.

Tests added (15 new):
- resolveTrackedRepo: auto _ prefix, nested, already-prefixed, not-found,
  basename fallback
- Registry prune: full-path Group, nested members by prefix, sibling isolation
- Project-mode gitignore: single + batch uninstall
- updateSingle: basename fallback, not-found, regular skill priority
- cleanEmptyParents: multi-level, stops at non-empty, stops at boundary
2026-04-04 17:05:22 +08:00
Willie 7dcf64ea69 fix(server): drop reconcile from repo uninstall to avoid pruning agents
ReconcileGlobalSkills uses PruneStaleSkills(skillsOnly=false) which
removes agent entries unrelated to the uninstalled repo. The explicit
filter + Save is sufficient; full reconcile deferred to next sync.
2026-04-04 17:05:22 +08:00
Willie b22cd6b50b fix(server): scope registry prune to tracked entries only
Group-based filter now requires entry.Tracked to avoid removing
unrelated agent entries that happen to share the same group name.
2026-04-04 17:05:22 +08:00
Willie 657e400f8c fix(server): resolve order + registry prune for repo uninstall
- updateSingle: check exact skill path before resolveTrackedRepo
  fallback, preventing basename collision with nested repos
- handleUninstallRepo: match repo's own registry entry by FullName
  in addition to group-based matching for member skills
2026-04-04 17:05:22 +08:00
Willie a4984cd322 fix(server): resolve nested repos in update + prune registry on uninstall
P1: updateSingle now uses resolveTrackedRepo (shared with uninstall)
to find nested tracked repos like org/_team-skills instead of only
probing root-level _name/name.

P2: handleUninstallRepo now prunes registry entries belonging to the
uninstalled repo and runs ReconcileGlobalSkills/ReconcileProjectSkills,
matching the cleanup that handleUninstallBatch already does.

Extracted resolveTrackedRepo as a Server method to deduplicate the
nested path resolution logic between uninstall and update handlers.
2026-04-04 17:05:22 +08:00
Willie 7e160dee16 fix(trash): support nested tracked repo names in trash lifecycle
MoveToTrash, List, Restore, and Cleanup all assumed flat names.
When a nested tracked repo like org/_team-skills was uninstalled,
the trash entry landed in a subdirectory that List could not see
and Restore could not reach.

- MoveToTrash: create intermediate dirs via filepath.Dir(trashPath)
- List: recursive WalkDir to discover nested entries, store full
  relative path in TrashEntry.Name
- Restore: MkdirAll on destination parent before rename
- Cleanup: remove empty intermediate dirs after expiry via
  cleanEmptyParents helper

Closes runkids/skillshare#116 follow-up (nested trash path)
2026-04-04 17:05:22 +08:00
amdoi7 b625b8ce9a Merge origin/main into fix/dashboard-tracked-repo-actions 2026-04-03 15:34:10 +08:00
amdoi7 b1dde02519 test(server): cover tracked repo uninstall edge cases
Add handler tests for nested tracked repo uninstall, ambiguous basename rejection, and traversal rejection.
Also isolate trash-backed server tests by setting XDG_DATA_HOME in test helpers.
2026-04-03 15:29:05 +08:00
amdoi7 e3ea2afb88 fix(ui): address tracked repo review feedback
Validate tracked repo names against path traversal and surface repository listing errors in the uninstall handler.
Track in-flight dashboard repo actions with sets so loading state stays correct during overlapping clicks.
2026-04-03 15:14:51 +08:00
amdoi7 14da64f33a fix(ui): manage tracked repos from dashboard
Add update and uninstall controls to the dashboard tracked repo list.
Handle nested tracked repo paths in the uninstall API so dashboard actions work for both top-level and nested repos.
2026-04-03 14:34:17 +08:00
Willie a570670a92 fix: registry cleanup after uninstall and sync, UI polish
- Fix UI batch uninstall not removing nested skill registry entries:
  handler used flat names (__) but registry stores path names (/),
  now tracks exact RelPath from discovered skills for matching

- Add stale entry pruning to ReconcileGlobalSkills and
  ReconcileProjectSkills using a live set built during disk walk,
  so skills deleted from source are removed from registry

- Trigger registry reconcile after sync in both UI handler (via defer
  for early-return safety) and CLI (global + project mode), writing
  warnings to stderr to avoid corrupting --json output

- UI: fix BatchUninstallPage search treating plain text as exact-match
  glob (now substring search when no * or ? present), display nested
  skill paths with / instead of __ in confirm and result dialogs

- UI: hide redundant 'X repo(s) and Y skill(s) already up to date'
  line on UpdatePage when everything is already current

- Fix test isolation: set XDG_CONFIG_HOME in server test helpers to
  prevent host agents dir leaking into test results, skip chmod-based
  oplog test when running as root

- Add README badge for Awesome Codex CLI
2026-04-01 22:30:39 +08:00
Willie 24b7b4d5b2 fix(reconcile): write tracked repo branch to registry.yaml
Tracked repos have no .skillshare-meta.json, so reconcile could not
read branch from metadata. Now falls back to git rev-parse --abbrev-ref
HEAD for tracked repos, ensuring branch is written to registry.yaml
for cross-device rebuild.

Added gitCurrentBranch() helper in config package (cannot import
internal/git due to circular dependency).

Added registry assertion to TestInstallBranch_TrackedRepo.
2026-04-01 00:32:49 +08:00
Willie 178462dcfe fix: three branch-related bugs found in review
P1: check.go '@' separator broke SSH URLs (git@github.com:org/repo)
    — splitURLBranch would split at the '@' in the URL itself
    — Fix: use tab character as separator (cannot appear in URLs)
    — Added unit test for SSH URL round-trip

P1: install_config.go grouped same-repo different-branch skills together
    — groupConfigSkillsByRepo keyed by CloneURL only, ignoring Branch
    — Fix: include branch in grouping key so each branch clones separately

P2: reconcile never cleared stale branch from registry
    — Only updated when meta.Branch was non-empty, never cleared it
    — Fix: sync branch unconditionally when meta is available
2026-04-01 00:32:49 +08:00
Willie 14713f9e3d fix(install): pass source.Branch to sparse checkout in subdir discovery
sparseCloneSubdir in discoverFromGitSubdir was hardcoding empty branch,
ignoring --branch when sparse checkout was used for subdirectory discovery.

Reported by: gemini-code-assist on PR #112
2026-04-01 00:32:49 +08:00
Willie 94d7ccddef refactor: deduplicate branch helpers and cache per-repo git calls
- check.go: extract urlBranchKey()/splitURLBranch() helpers, used in 5 places
- handler_skills.go: extract enrichSkillBranch() helper, used in 2 handlers
- handler_targets.go: merge duplicate merge/copy resolution into single case
- list.go: cache git.GetCurrentBranch() per-repo instead of per-skill
2026-04-01 00:32:49 +08:00
Willie f01ec9ec12 fix(sync): summarize resolution warnings instead of printing each one
With 25000+ skipped skills (standard naming + name collisions),
the CLI sync output was flooded with per-skill warning lines.

Now prints a concise summary:
  12345 skill(s) skipped (naming validation)
  456 name collision(s) excluded

Applied to both merge and copy sync modes.
2026-04-01 00:32:49 +08:00
Willie 6f70e76758 fix(sync): accurate expectedSkillCount and surface skipped skills
Problem: Sync page showed 'in sync' but Targets page showed
39032/64075 — ~25000 skills silently dropped by name collisions
and SKILL.md validation in standard naming mode.

Root cause: expectedSkillCount used raw filtered count (pre-resolution)
while diff used post-resolution count. The gap was invisible.

Fix:
1. handler_targets.go: expectedSkillCount now uses resolution.Skills
   count (post-collision/validation), matching what sync actually does
2. handler_diff_stream.go: surfaces skippedCount and collisionCount
   in diff response so UI can explain why skills were dropped
3. handler_sync.go: diffTarget struct gains SkippedCount/CollisionCount
4. TargetsPage: shows warning when skills are skipped with collision count
5. SyncPage: shows naming conflict notice in 'in sync' cards
6. API client: Target and DiffTarget types gain optional fields
2026-04-01 00:32:49 +08:00
Willie 903df9f446 feat(server): add branch to skills API and install handlers
- skillItem struct gains Branch field (json: branch,omitempty)
- handleListSkills and handleGetSkill populate Branch from SkillMeta;
  fall back to git.GetCurrentBranch for tracked repos with empty metadata branch
- handleDiscover, handleInstallBatch, handleInstall all accept Branch in
  request body and propagate it to Source.Branch and InstallOptions.Branch
2026-04-01 00:32:49 +08:00
Willie db69638e30 feat(install): project mode --branch support and branch display in check
- Set source.Branch in project install path
- Sync branch in project reconcile
- Add Branch to checkRepoResult and RepoCheckOutput for JSON/display
- Read current branch from tracked repos in check

Ref: #90
2026-04-01 00:32:49 +08:00
Willie 354db51928 feat(check): branch-aware remote ref comparison and registry rebuild
- Add GetRemoteRefHash/WithAuth/WithEnv to internal/git/info.go:
  uses git ls-remote with refs/heads/<branch> when branch is set,
  falls back to HEAD when branch is empty
- Add Branch field to URLCheckInput and URLCheckOutput in check/parallel.go;
  ParallelCheckURLs dispatches to GetRemoteRefHashWithAuth when Branch is set
- check.go: group skills by RepoURL@branch composite key so skills on
  different branches of the same repo are checked against the correct ref;
  urlHashMap keyed by same composite key for correct broadcast
- install_config.go (InstallFromConfig): propagate SkillEntryDTO.Branch
  into Source.Branch for both plain and tracked skill phases so registry
  rebuild (install --from-config) respects the recorded branch
2026-04-01 00:32:49 +08:00
Willie 428eb11120 feat(install): persist branch to metadata and registry, read in update
- NewMetaFromSource: set meta.Branch from source.Branch
- installFromDiscoveryImpl: forward discovery.Source.Branch when building
  per-skill Source struct for metadata
- installFromGitSubdir: pass source.Branch to sparseCloneSubdir (was
  hardcoded empty string, causing subdir installs to ignore --branch)
- ReconcileGlobalSkills: sync meta.Branch to registry on both new and
  existing entries
- toSkillEntryDTOs: include Branch field in DTO conversion
- updateRegularSkill / updateSkillFromMeta: restore source.Branch from
  meta before reinstalling, so updates pull from the originally-specified
  branch

Tests: TestInstallBranch_MetadataPersistence, TestInstallBranch_UpdatePreservesBranch
2026-04-01 00:32:49 +08:00
Willie 55ce0fb89e feat(install): pass --branch to discovery clone for regular installs
Source.Branch threads the branch parameter through discovery.
cloneRepo() passes --branch to git clone when set.
source.Branch is set from parsed.opts.Branch in cmdInstall.

Ref: #90
2026-04-01 00:32:49 +08:00
Willie 09a40a4bdf feat(install): pass --branch to git clone for tracked repos
cloneTrackedRepo(), cloneRepoFull(), and sparseCloneSubdir() now accept
a branch parameter. When non-empty, --branch <name> is passed to
git clone. Fallback chain (partial → full) preserved.

Ref: #90
2026-04-01 00:32:49 +08:00
Willie 8def337c05 feat(install): add Branch field to InstallOptions, SkillMeta, SkillEntry, SkillEntryDTO 2026-04-01 00:32:49 +08:00
Willie ccdafd3293 feat(sync): add target_naming config option (flat/standard)
Add per-target target_naming setting that controls how skill directories
are named in sync targets. 'flat' (default) preserves the existing
flattened __ separator behavior. 'standard' uses the SKILL.md name field
directly, following the Agent Skills specification.

Standard mode:
- Validates SKILL.md names match directory basenames
- Detects and skips name collisions with warnings
- Auto-migrates managed entries when switching from flat to standard
- Preserves legacy entries when bare name is already occupied

Also includes:
- Per-target toggle via CLI (--target-naming), TUI (N key), and Web UI
- Collision output redesigned as deduplicated compact summary
- Config inheritance: global target_naming → per-target override
- JSON schema + UI validation for the new field

Closes #110
2026-04-01 00:32:49 +08:00
Willie f0f15ce15a refactor(targets): restructure targets.yaml to nested per-kind format
Unify global_name/project_name into single name field and move flat
paths into skills: { global, project } nested block. All 56 targets
converted with zero public API signature changes.

Add targetPathPair sub-struct and agents: block for v1 agent targets
(claude, cursor, opencode, augment). New DefaultAgentTargets() and
ProjectAgentTargets() functions return only targets with agent paths.

Update all internal consumers: DefaultTargets, ProjectTargets,
LookupProjectTarget, GroupedProjectTargets, MatchesTargetName,
KnownTargetNames, resolveTargetPaths, ProjectTargetDotDirs.

ProjectTargetDotDirs now collects dot-dirs from both skill and agent
project paths to prevent discovery from scanning agent target copies.
2026-03-30 18:32:33 +08:00
Willie 3b5571f4be refactor(config): use 2-space YAML indentation for all config output
Replace yaml.Marshal (4-space default) with marshalYAML helper using
yaml.Encoder.SetIndent(2) across config, project config, and registry.
Matches industry standard (Kubernetes, Docker Compose, GitHub Actions)
and reduces excessive nesting depth in targets with skills sub-keys.
2026-03-29 05:00:42 +08:00