Commit Graph
1402 Commits
Author SHA1 Message Date
Willie 7552c76973 refactor: eliminate sidecar reads and use centralized metadata store
Production code no longer reads or writes .skillshare-meta.json sidecars:
- InstallAgentFromDiscovery: write to centralized store via WriteMetaToStore
- agent_check.go: read from centralized store passed as parameter
- handler_skills.go: read agents from s.agentsStore
- audit.go: readMetaFileHashes reads from parent .metadata.json
- analyzer_metadata.go: extract findMetaEntry to deduplicate walk logic
- uninstall_agents.go: remove entry from centralized store on uninstall
- batchUpdateAgents: pass store to reinstallAgent, remove dead field
- Replace LoadMetadata+nil guard with LoadMetadataOrNew across 6 files
2026-04-08 17:43:30 +08:00
Willie 67c7010b6d refactor: remove dead MetadataEntry.Name field and add LoadMetadataOrNew
- Remove MetadataEntry.Name (json:"-", never set in production) and
  FullName() method (only used in one test)
- Add LoadMetadataOrNew() helper to replace 8+ instances of the
  LoadMetadata + nil guard boilerplate
2026-04-08 17:43:19 +08:00
Willie 0244abb4ce refactor: consolidate reconcile walk logic into shared core
Extract the identical walk-and-reconcile logic from ReconcileGlobalSkills
and ReconcileProjectSkills into reconcileSkillsWalk() in a new
reconcile_core.go file. Both callers are now thin wrappers.

- Move git helpers (isGitRepo, gitCurrentBranch, gitRemoteOrigin) to core
- Add pruneStaleEntries() shared helper
- Project version injects gitignore collection via onFound callback
- ~140 lines of duplication eliminated
2026-04-08 17:43:09 +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 b5266574a7 fix: rewrite agent update to use discovery + single-file installer
reinstallAgent previously called install.Install() which expects
directory-based skill installation. Agent sources point to .md files,
so the subdir resolver rejected them.

Now uses DiscoverFromGit/DiscoverFromGitSubdir + InstallAgentFromDiscovery
which correctly handles single-file agent copies. Also preserves the
original repo subdir scope for monorepo installs and reconstructs the
correct destination subdirectory for grouped agents.
2026-04-08 16:35:35 +08:00
Willie 4af128fcf0 fix: migrate metadata consumers from Get(basename) to GetByPath
All call sites that looked up metadata entries using filepath.Base()
now use store.GetByPath(relPath) which handles both full-path keys
and legacy basename+group keys transparently.

Also fixes makeInstallOpts() to set SourceDir from updateContext,
preventing nested skill updates from writing metadata to wrong dir.
2026-04-08 16:35:27 +08:00
Willie 7290884977 fix: use full-path metadata keys to prevent grouped skill collisions
Metadata store entries for grouped skills (e.g. frontend/foo, backend/foo)
were keyed by basename only, causing the second install to overwrite the
first. This changes the key to the full relative path.

Key changes:
- WriteMetaToStore: use full rel path as key, clean up legacy basename key
- Add KeyToRelPath() helper and MigrateLegacyKey() method for backward compat
- Reconcile: migrate legacy basename keys to full-path keys on load
- install_queries: guard against double-prefixing with KeyToRelPath
- LoadMetadata: auto-run sidecar cleanup on every load (idempotent)
- migrateAgentSidecars: recurse into subdirectories
- mergeSkillSidecar: use full-path keys, detect tracked repos
2026-04-08 16:35:19 +08:00
Willie 9025fb35bf docs: update website docs for centralized .metadata.json format 2026-04-08 15:14:22 +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 34b6c2a9e0 test: fix remaining unit tests for centralized metadata store keys
- Reconcile tests use bare name as store key (not group/name)
- updatable_test uses MetadataStore directly instead of WriteMeta dual-write
- Tracked repos marked with Tracked: true in store
- All unit + integration tests pass (make check green)
2026-04-08 14:38:25 +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 ed1beb1ccb refactor: replace all remaining ReadMeta/LoadRegistry with MetadataStore
Replace every remaining call to the old per-skill metadata API
(ReadMeta, RefreshMetaHashes, config.LoadRegistry) with the centralized
MetadataStore across 10 files:

Server handlers:
- handler_check.go: use s.skillsStore.Get() instead of ReadMeta
- handler_check_stream.go: same pattern as handler_check.go
- handler_skills_batch.go: use s.skillsStore.RefreshHashes() + Save()

CLI commands:
- check.go: load store once in collectCheckItems, use MetadataEntry
- doctor.go: load store once in checkSkillIntegrity
- list.go: load store once in buildSkillEntries (replaces parallel ReadMeta)
- uninstall.go: use skillsStore for display/dry-run/finalize
- uninstall_project.go: same pattern, remove config.LoadRegistry
- update_batch.go: pruneRegistry now uses MetadataStore

Hub:
- hub/index.go: load store once in BuildIndex

The only remaining ReadMeta call is in a test file
(search_batch_meta_roundtrip_test.go) which tests the shim itself.
2026-04-08 11:19:27 +08:00
Willie d0a1df3e8b refactor: replace ReadMeta in server handler_skills and handler_update
handler_skills.go uses s.skillsStore.Get() for skill metadata.
handler_update.go uses store parameter in getServerUpdatableSkills.
2026-04-08 11:11:03 +08:00
Willie e62f729f18 refactor: partial uninstall migration to MetadataStore 2026-04-08 11:08:24 +08:00
Willie ad05ed9a2f refactor: replace ReadMeta in update handlers with MetadataStore
update.go, update_handlers.go, update_project.go, update_resolve.go
now use MetadataStore.Get() instead of per-skill ReadMeta.
2026-04-08 11:04:28 +08:00
Willie 1f1790b6be refactor: replace Registry with MetadataStore in reconcile, server, install context
Phase 1 of caller migration:
- projectRuntime: registry → skillsStore + agentsStore
- globalInstallContext: reg → store
- ReconcileGlobalSkills/ProjectSkills/ProjectAgents: take *MetadataStore
- Server struct: registry → skillsStore + agentsStore
- handler_install, handler_skills, handler_uninstall: use MetadataStore
- install.go, search.go: post-install reconciliation via MetadataStore
2026-04-08 10:59:13 +08:00
Willie 5310297f33 refactor: mark legacy meta functions as deprecated, skip .metadata.json in hash walk
ComputeFileHashes now skips both .skillshare-meta.json and
.metadata.json. WriteMeta, ReadMeta, HasMeta, NewMetaFromSource,
RefreshMetaHashes marked as deprecated.
2026-04-08 10:41:02 +08:00
Willie ce6be175d4 feat: add migration from old sidecar + registry to .metadata.json
LoadMetadataWithMigration auto-detects old format on first load:
reads registry.yaml entries, merges sidecar .skillshare-meta.json
fields, writes unified .metadata.json, cleans up old files.
Idempotent — skips migration if .metadata.json already exists.
2026-04-08 10:39:43 +08:00
Willie fa5679d0c0 feat: add MetadataStore helpers (SetFromSource, ComputeEntryHashes, RefreshHashes)
ComputeFileHashes now also skips .metadata.json when computing hashes.
2026-04-08 03:36:03 +08:00
Willie e9eee35cf2 feat: add MetadataStore Load/Save with atomic writes
LoadMetadata returns empty store on missing file. Save uses
temp-file + os.Rename for crash safety.
2026-04-08 03:17:21 +08:00
Willie dad90d79d5 feat: add MetadataStore core types and CRUD operations
Introduces MetadataEntry (merges SkillMeta + RegistryEntry) and
MetadataStore (map-based container with Set/Get/Remove/Has/List).
This is the foundation for centralized .metadata.json files.
2026-04-08 03:15:47 +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 34c275a2b8 fix(sync): remove extra indent between checkmark and path in extras output 2026-04-07 22:09:51 +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 5afaf57745 feat(tui): add tab switching between skills/agents in list TUI
- Add Tab/Shift+Tab to cycle All/Skills/Agents tabs with count badges
- Tab bar renders at top with bold+underline cyan active, dim inactive
- Tab acts as pre-filter composing with text filter via AND logic
- Cache tab-filtered items in applyFilter() to avoid per-frame recomputation
- Add tabNoun() method to consolidate noun switches across title/filter bar

Agent install --into support:
- Support --into flag for agent install (CLI, server, project mode)
- Support --into=value syntax in addition to --into value
- Server handler_skills uses recursive AgentKind.Discover() for nested agents
- Fix agent metadata read path: use file basename instead of frontmatter name
- Sync --all flag now includes agent sync (not just extras)

Agent content viewer:
- Agents render full-width without sidebar (single .md file, no tree needed)
- Simplified help text and keyboard handling for agent content view

Agent uninstall fixes:
- Use discovery-based resolution instead of hardcoded name+.md path lookup
- Support matching by Name, FlatName, RelPath, or trimmed RelPath
- Compressed confirmation display (list format, max 20 shown)

UI polish:
- Help bar keys highlighted in dim cyan, descriptions in dim gray
- Align 'No items.' text with list title via PaddingLeft(2)
2026-04-07 21:55:05 +08:00
Willie 9d934f87d3 fix: pass AgentsSource to Config in project mode install
Without this, installDiscoveredAgents in project mode falls back to
the global agents path (~/.config/skillshare/agents/) instead of the
project agents path (.skillshare/agents/).
2026-04-07 20:45:40 +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 9f77ac0b61 feat(install): add TUI multi-select and batch progress for agent install
Pure-agent repos now show a checklist TUI for selecting which agents
to install (matching the skill install flow). Supports:
- Single agent: direct install (no TUI)
- Multi-agent: interactive checklist TUI (space/a/enter)
- --all/--yes: install all without prompt
- -a name1,name2: filter by name without prompt
- --dry-run: preview list
- Non-TTY: error with hint to use flags
- Batch progress: spinner (<=20) or progress bar (>20)
- Results display: installed/failed/skipped sections
2026-04-07 19:47:59 +08:00
Willie 91057c1756 feat(install): detect and install agents from pure-agent repos
When a repo has no SKILL.md files but contains .md agents (discovered
via Rule 4 fallback in discovery layer), the CLI now installs them
instead of showing 'No skills found'.

Adds handleAgentInstall() which:
- Respects --agent name filter
- Uses InstallAgentFromDiscovery() (same as UI flow)
- Supports --dry-run and --force
- Shows next-steps hint to run 'sync agents'
2026-04-07 19:35:16 +08:00
Willie 5f7d9adad3 fix(ui): resolve TypeScript errors — add ResourceTab type, useSearchParams import, tab filtering 2026-04-07 19:14:43 +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 98bd7d7fc2 feat(tui): show agent diffs with [A] badge in diff TUI
Merge agent diffs into skill diff results so both appear together
in the diff TUI. Agent entries display a cyan [A] badge prefix
in the detail panel's category listings.

Changes:
- Add mergeAgentDiffsGlobal/mergeAgentDiffsProject helpers that
  compute agent diffs and merge them into per-target skill results
- Call merge helpers in cmdDiffGlobal and cmdDiffProject before
  TUI/output rendering
- Build agent name set in buildDiffDetail and render [A] badge
  for agent entries in category expansion
- Fix categorizeItems to handle agent-specific reasons
  ('not in target' → New, 'local file' → Local Only)
2026-04-07 19:04:35 +08:00
Willie 11aebd2876 feat(tui): show agent badge and route agent restore in backup restore TUI
Add [A] badge to agent backup entries in the target list, and resolve
the correct agent target path when restoring. Agent backups (entries
ending with -agents) now look up AgentsConfig or fall back to builtin
DefaultAgentTargets for path resolution, both in the restore action
and in the detail/diff panels.
2026-04-07 19:02:56 +08:00
Willie dc4ef279c0 feat(tui): add agent badge and correct restore routing in trash TUI 2026-04-07 18:59:35 +08:00
Willie a941b617f8 feat(tui): support agent content viewing in list detail panel
Agents are single .md files, not directories. The content viewer now:
- Detects agent vs skill via contentKind field on the model
- Renders agent .md content directly (no directory walk)
- Shows a single-file tree entry for the agent
- Resolves file paths from agentsSourcePath for agents
2026-04-07 18:54:35 +08:00
Willie 3c3139fc60 feat(tui): pass agentsSourcePath and route actions per kind in list TUI 2026-04-07 18:53:17 +08:00
Willie be962fd557 feat(tui): add k:kind filter tag for agent/skill filtering in list 2026-04-07 18:49:27 +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 b93518e3da test(e2e): add agents runbook and fix all 33 runbooks to 361/361 pass
Add comprehensive agents_commands_runbook.md covering all agent CLI
commands: list, sync, status, diff, collect, uninstall, trash, update,
backup, and doctor (30 steps).

Fix 18 previously failing runbooks:
- Add workdir: $HOME to mdproof.json to prevent workspace pollution
  from project mode auto-detection
- Fix jq assertions using positional index to use select(.name == ...)
- Fix extras_flatten legacy agents/ dir conflict (rm in cleanup)
- Fix auto_create_target_dir sed insertion and Will/Would wording
- Fix uninstall_sync_orphan config indentation for migrated format
- Fix universal_target_path grep pattern (name vs global_name)
- Fix uninstall_all_glob registry.yaml filter in verify step
- Fix target_naming grep for actual CLI warning output
- Fix registry_yaml_split anchored grep for top-level skills:
- Fix skillignore_source_discovery stdout suppression and jq filter
- Fix ui_base_path: use pre-built binary, PID files, high ports,
  redirect server log to stderr to keep JSON pure
- Fix extras init redirect to suppress ANSI warnings in JSON steps
2026-04-07 18:07:08 +08:00
Willie 43d6bd1948 refactor(agents): simplify — extract shared helpers, fix path bug, use DirEntry.Type
From 3-agent review (reuse, quality, efficiency):

Bug fix:
- syncAgentsProject: use resolveProjectAgentTargetPath instead of
  inline path resolution (~ was not expanded for absolute paths)

Deduplication:
- Extract syncAgentTarget() shared by global + project sync loops
  (eliminates 30-line copy-paste)
- Extract renderAgentCheck() shared by project + global check
  (eliminates duplicate rendering block)
- Consolidate countLinkedAgents → delegates to countAgentLinksAndBroken

Efficiency:
- Use DirEntry.Type() instead of os.Lstat in diff_agents.go and
  doctor_agents.go (saves one syscall per .md file)

Cleanup:
- Remove dead start param from cmdCollectAgents
- Remove unused imports

Net: -76 lines.
2026-04-07 18:05:40 +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 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