Commit Graph
668 Commits
Author SHA1 Message Date
Willie 85508dcea8 docs(audit): add analyzability score section and missing rule IDs
The analyzability score feature (committed in ae7bd21) was missing
dedicated documentation. Also backfills content-oversize (from 3ad814d)
which was never added to the docs.

- Add "Analyzability Score" section explaining score meaning, threshold,
  exclusions, and CLI/JSON output format
- Add content-oversize to Content Integrity table
- Add low-analyzability to LOW/INFO severity listing
- Add low-analyzability (INFO) and content-oversize (MEDIUM) to
  Built-in Rule IDs table
- Update :::note block to mention new structural/analyzability checks
2026-03-02 23:01:30 +08:00
Willie b6652f11a0 feat(audit): add command safety tiering (T0–T5) for behavioral classification
Classify every shell command in skill files into 6 behavioral tiers
(read-only, mutating, destructive, network, privilege, stealth) as an
orthogonal dimension to pattern-based severity. This lets audit report
"what kind of actions" a skill performs, not just "which known patterns
it matches."

- Add tier engine with 80+ command mappings and stealth regex patterns
- Detect tiers in scripts and Markdown fenced code blocks separately
- Generate combination findings: T2+T3→HIGH, T5→CRITICAL, T3>5→MEDIUM
- Display tier profile in CLI text, TUI detail panel, and JSON/API output
- Exclude .skillshare-meta.json from totalBytes to fix analyzability ratio
- Document tier definitions, profile output, and combination findings
2026-03-02 23:01:30 +08:00
Willie 787c46c7c3 fix(tui): improve gray text contrast on dark terminals
Bump Dim 245→247 and Faint 239→242 for better readability on
dark terminal backgrounds without losing visual hierarchy.
2026-03-02 23:01:30 +08:00
Willie 71bf0969be feat(audit): show analyzability score in TUI detail panel and summary
- Detail panel: show per-skill "Auditable: X%" with green/yellow color
- Summary footer: append "Auditable: X% avg" to the status bar
2026-03-02 23:01:30 +08:00
Willie 8e83495200 feat(audit): add analyzability score and pre-commit hook
Analyzability score measures what percentage of a skill's content is
auditable plaintext vs binary/non-scannable. Surfaces in CLI text
output, JSON, SARIF, and Web UI API responses.

- Add TotalBytes, AuditableBytes, Analyzability fields to audit.Result
- Emit INFO-level low-analyzability finding when score < 70%
- Show "Auditable: X%" in per-skill and summary text output
- Expose analyzability in server API (auditResultResponse + auditSummary)
- Add .pre-commit-hooks.yaml for pre-commit framework integration
- Add pre-commit hook recipe docs and audit.md cross-references
2026-03-02 23:01:30 +08:00
Willie afb8951359 fix(audit): show spinner/progress on stderr for structured output formats
Previously --format json/sarif completely suppressed spinner and progress
bar, making the CLI appear frozen during long scans.

Now spinner/progress output is redirected to stderr via ProgressWriter,
so progress indicators remain visible while structured data stays clean
on stdout. This follows the Unix convention: data → stdout, diagnostics
→ stderr.

Also:
- Extract fileTTY() shared helper (DRY IsTTY + isProgressTTY)
- Add format constants (formatText/JSON/SARIF) and isStructured()
- Capture/restore previous ProgressWriter in defer (defensive)
2026-03-02 23:01:30 +08:00
Willie 3bc9ad7574 feat(targets): add AstrBot, update Cline to universal .agents/skills
- Add AstrBot target (data/skills / ~/.astrbot/data/skills)
- Update Cline paths from ~/.cline/skills to ~/.agents/skills (global)
  and .cline/skills to .agents/skills (project)
- Update website docs: add AstrBot badge/row, update Cline paths,
  add Cline to universal agents info box
2026-03-02 23:01:30 +08:00
Willie 8ef6f113af docs(recipes): add SARIF GitHub Actions workflow to CI/CD recipe
- Add GitHub Actions with SARIF upload example
- Update existing examples to use --format json instead of --json
- Add SARIF variation note and verification step
2026-03-02 23:01:30 +08:00
Willie 3af76ff4b9 docs(audit): add SARIF output format and --format flag documentation
- Add --format flag to Options table, mark --json as deprecated
- Add SARIF output section with severity mapping table
- Add GitHub Actions Code Scanning example with SARIF upload
- Update usage examples and recommended workflow
2026-03-02 23:01:30 +08:00
Willie 11668b8f0a feat(audit): add --format flag with sarif/json/text + deprecate --json
- Add --format <text|json|sarif> flag to audit command
- Deprecate --json in favor of --format json (with stderr warning)
- SARIF output uses ToSARIF() from internal/audit/sarif.go
- Suppress UI (spinners, progress bars) for all structured outputs
- Update auditPath/auditSkillByName to accept format string
- Update help text with new flag and examples
- Add 3 integration tests: FormatSARIF, FormatJSON, JSONDeprecation
2026-03-02 23:01:30 +08:00
Willie 043a47e57a feat(audit): add SARIF 2.1.0 conversion (internal/audit/sarif.go)
Add ToSARIF() function that converts audit Results into SARIF 2.1.0
format for CI/CD integration (GitHub Code Scanning, etc.).

- 12 structs modeling the SARIF schema subset we need
- Severity mapping: CRITICAL/HIGH→error, MEDIUM→warning, LOW/INFO→note
- Rule deduplication by pattern (first occurrence wins)
- SARIFOptions for tool version and base URI
- 4 test cases: empty, findings, severity mapping, JSON round-trip
2026-03-02 23:01:30 +08:00
Willie 0712368668 feat(devc): add make devc shortcut to enter devcontainer from terminal
Adds scripts/devcontainer_shell.sh that detects a running devcontainer
and opens an interactive shell (or runs a one-off command). Registered
as `make devc` / `mise run devc`. Also consolidates README recent
updates to one entry per minor series and updates the devcontainer
skill with the new entry point.
2026-03-02 10:05:57 +08:00
Willie 38f8f1c796 fix(symlink): resolve symlinked source/target dirs across all Walk callsites
filepath.Walk/WalkDir silently skip symlinked root directories because
os.Lstat sees the root as a non-directory symlink and never enters it.
This affected update, uninstall, reconcile, and server handlers when
the source directory was a symlink (common with dotfiles managers).

Extract ResolveSymlink() from sync.go into internal/utils/path.go and
apply it at every filepath.Walk/WalkDir callsite on source/target dirs.

Also add containment guards to resolveGroupSkills (uninstall) and
resolveGroupUpdatable (update) to reject group directories that are
symlinks pointing outside the source tree.
v0.16.7
2026-03-02 10:05:57 +08:00
Willie 32a29c8e91 fix(upgrade): clear prompt lines to preserve tree layout
Upgrade prompts ("Install built-in skill?" and "Upgrade to vX?")
left their input lines visible after the user responded, breaking
the tree-drawing structure. Add ui.ClearLines() to erase prompt
lines via ANSI cursor-up + clear-line, so StepEnd connects cleanly
to the preceding tree node. No-op on non-TTY.
2026-03-02 10:05:57 +08:00
Willie 8a820bbe5e docs: add symlinked directory sync E2E runbook
Covers 13 test scenarios for dotfiles manager symlink support:
symlinked source/target, chained symlinks, merge/copy modes,
status/diff/list/collect through symlinks, and idempotency.
2026-03-02 10:05:57 +08:00
Willie c426a801d7 fix(sync): preserve external symlinks during sync (dotfiles manager support)
When source or target directories are symlinks managed by external tools
(e.g., dotfiles managers), sync would incorrectly delete them during
mode conversion. This change:

- Add resolveWalkRoot() so filepath.Walk follows symlinked source dirs
- Add isSymlinkToSource() with canonicalization to distinguish internal
  symlink-mode targets from external symlinks (alias-safe)
- Protect external target symlinks in both merge and copy mode
- Allow FindLocalSkills to scan through external symlinked targets
- Handle external symlinks in CheckStatusMerge as normal directories
2026-03-02 10:05:57 +08:00
Willie d1370c0f98 fix(sync): preserve external symlinks in merge/copy mode conversions
When a target directory is an external symlink (e.g., dotfiles manager
pointing ~/.claude/skills/ elsewhere), sync previously deleted it
unconditionally during symlink→merge/copy mode conversion. This also
affected DiscoverSourceSkills which failed to traverse symlinked source
directories because filepath.Walk uses Lstat on root.

Changes:
- Add resolveWalkRoot() helper; use in both Discover functions so
  filepath.Walk enters symlinked source directories
- Add isSymlinkToSource() to distinguish source-pointing symlinks
  (symlink mode residue, safe to remove) from external symlinks
- Pass explicit sourcePath to SyncTargetMergeWithSkills and
  SyncTargetCopyWithSkills for reliable symlink origin detection
- Fix FindLocalSkills to use utils.ResolveLinkTarget (handles relative
  symlinks correctly) and follow external symlinks for scanning
- Fix CheckStatusMerge to follow external symlinks instead of returning
  StatusConflict
- Add 17 unit tests and 6 integration tests covering symlinked source,
  target, both, chained symlinks, idempotency, prune, and pull
2026-03-02 10:05:57 +08:00
Willie d8fb76d33d fix(restore): handle ReadDir error to prevent accidental backup deletion
os.ReadDir failure was silently ignored, causing otherTargets to be 0
and triggering removal of the entire timestamp directory instead of
just the target subdirectory. Now returns an error early.

Also adds diff TUI expand test from previous session.
v0.16.6
2026-03-02 02:23:50 +08:00
Willie 8e5efe36f6 docs: add v0.16.6 changelog entry
Covers diff TUI, --patch/--stat flags, glob pattern matching,
trash/restore TUIs, Homebrew-aware version check, and bug fixes.
2026-03-02 02:23:50 +08:00
Willie 7a22b781f2 feat(diff): async expand with spinner and support all diff types
- Add loading spinner while computing file diffs (prevents TUI freeze)
- Compute file diffs in parallel using sync.WaitGroup
- Support expanding "local only" and "remove" items (not just modify/add)
- Populate dstDir on remove/orphan items for file listing
- Relax ensureFiles to work with dstDir-only entries
- Add stale result guard when navigating during async load
2026-03-02 02:23:50 +08:00
Willie b371050078 feat(skills): add devcontainer skill for AI-guided container execution
Teaches AI assistants when and how to run CLI commands, tests, and
debugging inside the devcontainer instead of on the host. Covers
ssenv isolation, credential-helper, web UI, and common pitfalls.
2026-03-02 02:23:50 +08:00
Willie ba894dc5a6 docs: update website docs for v0.16.* features
Cross-validate and fix docs against source code:
- diff: fix merge mode description (no manifest-based orphans)
- backup: fix "What Gets Backed Up" (symlinks now followed)
- restore: add interactive TUI section and --no-tui flag
- trash: add SKILL.md preview, ls/rm aliases
- version: fix example, add Homebrew-aware update notifications
- install: add shell glob protection tip
- update: add basename matching note for glob patterns
- uninstall: add top-level-only matching note
- README: consolidate 0.16.* highlights
2026-03-02 02:23:50 +08:00
Willie 8a377481cb feat(version): Homebrew-aware version check
Homebrew formula updates lag GitHub Releases by hours/days, causing
Homebrew users to see "update available" when `brew upgrade` says
already up-to-date. Now detect install method from executable path
and query `brew info --json=v2` for Homebrew installs instead of
the GitHub Release API.

- Add InstallMethod type with DetectInstallMethod() and
  FetchBrewLatestVersion() in internal/version/homebrew.go
- Check() accepts InstallMethod to branch fetch strategy
- UpdateNotification() accepts upgradeCmd (shows correct command)
- UpgradeCommand() method on InstallMethod centralizes the mapping
- doctor.go reuses versioncheck.Check() (fixes semver string
  comparison bug in old fetchUpdateMessage)
- Remove duplicated isHomebrewInstall() from upgrade.go
- Skip post-command version check for doctor (has its own)
2026-03-02 02:23:50 +08:00
Willie ae16181689 refactor(auth): consolidate duplicated auth infra and fix GH_TOKEN gap
- Remove duplicated RateLimitError, newGitHubRequest, newGitHubClient,
  checkRateLimit from internal/version — now uses internal/github client,
  which also fixes missing `gh auth token` fallback for version checks
- Add GH_TOKEN as fallback in install.resolveToken() for GitHub platform,
  matching github.GetToken() resolution order (GITHUB_TOKEN → GH_TOKEN)
- Add GH_TOKEN to sanitizeTokens() redaction list
- Extract shared IsAuthError() in install/auth.go; push.go and
  wrapGitError() both delegate to it (adds "Access denied" coverage)
- Consolidate shouldFallback*TrackedClone auth checks via isAuthOrAccessError()
- Thread single *http.Client through search.Search() and all callees,
  reducing ~60 redundant TLS handshakes to connection-pooled reuse
- Pass *http.Client to downloadFile() instead of creating per-file clients
- Replace sourceHost() with extractHost() (same package, identical purpose)
- Remove unused isGitRepo() alias; callers use IsGitRepo() directly
2026-03-02 02:23:50 +08:00
Willie d2883e5773 refactor(tui): consolidate duplicated utilities and cache detail rendering
- Extract shared formatDurationShort, truncateStr, renderHorizontalSplit,
  tuiMinSplitWidth into tui_helpers.go; replace 5 truncate and 3 relative
  time duplicates across cmd/skillshare with thin wrappers
- Remove duplicate applyRestoreDetailScroll from restore_tui.go
- Cache detail panel content in restore_tui.go and trash_tui.go to avoid
  filesystem I/O (recursive walks, SKILL.md reads) on every bubbletea
  render frame — recompute only on selection change or mutation
- Remove dead ListBackupVersions call in startDelete whose result was
  discarded
2026-03-02 02:23:50 +08:00
Willie 13744f89a8 refactor: consolidate duplicated utilities and simplify diff API
- Extract shared applyDetailScroll into tui_helpers.go (was duplicated
  across diff_tui.go, log_tui.go, audit_tui.go)
- Create utils.FileHash and utils.FileHashFormatted, replacing private
  copies in install/meta.go and audit/audit.go
- Export install.MetaFileName constant, use from diff_file.go
- Replace double SHA-256 in fileContentsEqual with streaming byte compare
  for early-exit efficiency
- Add 1MB size cap to generateUnifiedDiff to prevent performance issues
- Move noTUI into diffRenderOpts struct, simplifying function signatures
2026-03-02 02:23:50 +08:00
Willie ada539603e refactor(diff): address code review findings
- Remove dead field diffTUIModel.results (never read)
- Replace hand-rolled countOccurrences with strings.Count
- Skip latestMtime() walk for merge mode (symlinks make it misleading)
- Fix ensureFiles() nil cache miss (return non-nil empty slice)
- Cache sorted items + categories in TUI model (avoid per-render recompute)
2026-03-02 02:23:50 +08:00
Willie e48a0192a7 docs(diff): update docs for TUI, --stat, --patch, new category labels
Update website diff page and built-in skill reference to reflect:
- Interactive TUI with left-right panel layout (default on TTY)
- New flags: --stat, --patch, --no-tui
- Redesigned category labels (New, Modified, Local Override, etc.)
- File-level diff examples

Also remove unused results field from diffTUIModel and replace
custom countOccurrences with strings.Count in tests.
2026-03-02 02:23:50 +08:00
Willie 20411ed89c fix(diff): hide .skillshare-meta.json from file-level diff and make --stat imply --no-tui 2026-03-02 02:23:50 +08:00
Willie 924487b334 feat(diff): add file list, text diff, and time info to TUI detail panel
- Add expand state (Enter key toggle) for file-level diff display
- Show file list with +/-/~ icons for add/delete/modify files
- Show colored unified diff (green/red/cyan) for modified files
- Add source/target mtime rows in detail header
- Replace "Actions" section with "Next Steps" using prominent styling
- Update list item description with sync/local breakdown
- Add stat counts (err/diff/ok) to TUI title bar
- Fix freeze: defer file walk to Enter toggle instead of every render
- Fix gofmt in trash_tui.go and restore.go
2026-03-02 02:23:50 +08:00
Willie 6a904545f4 test(diff): add integration tests for file stat, patch, new labels, summary 2026-03-02 02:23:50 +08:00
Willie c72ab5fed4 feat(diff): add --patch and --stat flags with file stat, time info, and unified diff 2026-03-02 02:23:50 +08:00
Willie 6fea949988 feat(diff): redesign labels with git-style symbols and add statistics summary 2026-03-02 02:23:50 +08:00
Willie c59498bc6c feat(diff): extend diff entries with file-level data, source paths, and mtime
- Add files, srcDir, dstDir fields to copyDiffEntry for lazy file diff
- Add srcMtime, dstMtime to targetDiffResult for time display
- Add ensureFiles() lazy loader and latestMtime() helper
- Pass sourceMap through collectMergeDiff for source path resolution
- Use named struct literals throughout collect functions
2026-03-02 02:23:50 +08:00
Willie 398e0bf40c feat(diff): add file-level diff engine for skill content comparison
Implement diffSkillFiles to walk source/destination directories and
detect add/modify/delete changes at the file level. Uses SHA-256 for
content comparison and sergi/go-diff for unified text diffs. Includes
binary detection, git-style stat rendering, and 9 unit tests.
2026-03-02 02:23:50 +08:00
Willie 7bdb9a4762 deps: upgrade sergi/go-diff to v1.4.0 for text diff support 2026-03-02 02:23:50 +08:00
Willie 27e5c3ae82 feat(diff): add interactive bubbletea TUI with left-right panel layout
Left panel shows target list with status icons (✓/!/✗), right panel
displays categorized diff details for the selected target. Supports
filter (/), detail scroll (Ctrl+d/u), and narrow terminal fallback.

Add --no-tui flag for plain text output; non-TTY auto-falls back.
2026-03-02 02:23:50 +08:00
Willie f5a816673f fix(backup,restore): handle -g/-p mode flags correctly
Both commands were missing parseModeArgs(), causing -g to be
misinterpreted as a target name. Now -g is accepted silently
(global is default) and -p returns a clear error.
2026-03-02 02:23:50 +08:00
Willie c5be126f0b feat(install,update,uninstall): add glob pattern matching for skill names
Support glob patterns (*, ?, [...]) in skill name arguments across all
three commands. Matching is case-insensitive.

- install: --skill and --exclude flags support glob (e.g. -s "core-*")
- update: positional names support glob (e.g. update "core-*")
- uninstall: positional names support glob (e.g. uninstall "core-*")

Shared helpers isGlobPattern() and matchGlob() extracted to helpers.go
to avoid duplication. Includes 25 new tests and updated docs.
2026-03-02 02:23:50 +08:00
Willie 30458e7b7e refactor(skill): rewrite built-in SKILL.md from reference manual to recipe-driven guide
The old SKILL.md organized commands by category (Inspect/Sync/Remote/...),
requiring AI to reason backward from categories to user intent. The new
structure organizes by scenario (Getting Started, Installing, Removing,
Team, Updates, Recovery), so AI can match user intent directly to the
right command sequence.

Key changes:
- Replace Commands table with 8 recipe groups covering all common workflows
- Add missing recipes: uninstall, search, new, collect
- Remove interactive-only example (bare `install user/repo`)
- Split push/pull into separate lines to prevent misexecution
- Merge AI Usage Notes into compact 5-rule "AI Caller Rules" section
- Bump version to v0.16.6
2026-03-02 02:23:50 +08:00
Willie 6d90481980 feat(tui): add red text to all destructive action confirmations
- trash_tui: delete and empty confirmations now render in red
- list_tui: uninstall confirmation now renders in red
- Consistent with restore_tui delete confirmation pattern
2026-03-02 02:23:50 +08:00
Willie 102b9e3a31 feat(restore): add --help flag and delete backup from TUI
Add --help/-h handling for both backup and restore commands.
Add d key in restore TUI to delete selected backup with red
confirmation prompt and success message.
2026-03-02 02:23:50 +08:00
Willie 995eb114d5 feat(restore): add unified Backup Restore TUI
Interactive two-phase TUI: target picker → version list with left-right
split panel layout. Includes detail panel with skill diffs, descriptions,
and target state. Wires no-args restore to TUI dispatch with --no-tui
fallback.
2026-03-02 02:23:50 +08:00
Willie 3e9453968d feat(trash): add SKILL.md preview to TUI detail panel
Show the first 15 lines of SKILL.md in the trash detail panel so users
can preview skill content before deciding to restore or delete.
2026-03-02 02:23:50 +08:00
Willie 71dea4ee14 feat(backup): add version listing and follow top-level symlinks
Add ListBackupVersions() and ListTargetsWithBackups() for TUI timestamp
selection. Fix merge-mode targets producing empty backups by following
top-level symlinks in copyDirFollowTopSymlinks().
2026-03-02 02:23:50 +08:00
Willie 2bcd2bf4de feat(backup): add ListTargetsWithBackups for TUI discovery
Scans backup directory and returns per-target summaries (count,
oldest, latest) sorted by target name. Uses timestamp parsing
instead of modtime for accuracy.
2026-03-02 02:23:50 +08:00
Willie b2af4f4929 feat(trash): add interactive TUI for trash list
Add bubbletea-based TUI with multi-select, fuzzy filter, and inline
restore/delete/empty operations. Follows the same dispatch pattern as
list and log: JSON → TUI (TTY + items + !--no-tui) → plain text.
2026-03-02 02:23:50 +08:00
Willie ec60453d7a chore: update docs 2026-02-28 21:42:25 +08:00
Willie 85b6329836 feat(targets): add Lingma as built-in target
Alibaba Cloud AI coding assistant. Global: ~/.lingma/skills,
project: .lingma/skills.
v0.16.5
2026-02-28 21:38:55 +08:00
Willie dce960ea9a feat(targets): add oh-my-pi (omp) as built-in target
Add omp target with global path ~/.omp/agent/skills and project path
.omp/skills. Alias: oh-my-pi. Ref: #57
2026-02-28 21:10:36 +08:00