Commit Graph
428 Commits
Author SHA1 Message Date
Willie b014f8c6dc feat: optimize large-repo install and update flows
Implement Issue #46 across install/update paths to reduce perceived hangs and improve subdir installation performance on large repositories.

Main changes:
- Add git progress streaming primitives in internal/install/git_progress.go.
  - runGitCommandWithProgress supports stderr streaming callbacks in TTY mode.
  - scanGitProgress handles both CR and LF progress delimiters.
- Thread InstallOptions.OnProgress through clone/pull/discovery/install/update paths.
  - Keep non-TTY behavior quiet to avoid noisy logs.
  - Add TreeSpinner.Update for live message updates.
- Add progress-aware git update APIs in internal/git/info.go:
  - PullWithProgress and ForcePullWithProgress (keep PullWithEnv/ForcePullWithEnv for compatibility).
- Introduce shared GitHub client utilities in internal/github/client.go.
  - Centralize token lookup, request construction, and rate-limit handling.
  - Refactor internal/search/search.go to use shared client while preserving compatibility aliases.
- Add GitHub/GHE API subdir fast path in internal/install/github_download.go.
  - github.com => api.github.com
  - github-like enterprise hosts => https://<host>/api/v3
  - On API failure, emit warning and fallback to git-based flows.
- Add sparse checkout fallback for non-GitHub subdir sources in internal/install/sparse_checkout.go.
  - Use filter+no-checkout+depth=1 then sparse-checkout set + checkout.
- Extend discovery/install metadata plumbing.
  - DiscoveryResult now includes CommitHash and Warnings.
  - install/discover subdir paths preserve warnings and commit hashes from API/sparse/full-clone flows.
- Preserve compatibility and UX expectations.
  - Keep existing action strings (for tests/UI stability).
  - Keep legacy discover/pull APIs as wrappers around new progress-aware variants.
- Improve --track download efficiency.
  - Track clone now attempts --filter=blob:none --depth 1 --single-branch first.
  - Falls back to full clone only on remote capability mismatch, not on auth/not-found errors.

CLI wiring:
- cmd/skillshare/install.go
  - TTY handlers now pass progress callbacks and use with-progress discover APIs.
  - Subdir handler shows API-vs-clone stage messages and renders discovery fallback warnings.
- cmd/skillshare/update.go and cmd/skillshare/update_project.go
  - Use PullWithProgress/ForcePullWithProgress for tracked repos.
  - Ensure reinstall/update install flows forward progress callbacks.

Tests added/updated:
- internal/install/git_progress_test.go
- internal/install/github_download_test.go
- internal/install/sparse_checkout_test.go
- internal/install/tracked_clone_test.go
- internal/install/source_test.go (GitHubOwner/GitHubRepo coverage)
- internal/git/info_test.go (PullWithProgress/ForcePullWithProgress)
- tests/integration/install_subdir_optimization_test.go
- tests/integration/install_online_test.go (GitHub API subdir case)

Validation performed:
- go test ./internal/install -count=1
- go test ./internal/git -run 'Test.*Pull.*' -count=1
- go build -o bin/skillshare ./cmd/skillshare && SKILLSHARE_TEST_BINARY="/Users/williehung/Developer/Apps/github/skillshare/bin/skillshare" go test ./tests/integration -run 'TestInstall_Subdir|TestUpdate_' -count=1
- go build -o bin/skillshare ./cmd/skillshare && SKILLSHARE_TEST_BINARY="/Users/williehung/Developer/Apps/github/skillshare/bin/skillshare" go test ./tests/integration -run 'TestInstall_Track_|TestUpdate_TrackedRepo' -count=1
- go test -tags online ./tests/integration -run TestInstall_GitHubSubdirViaAPI -count=1
- make lint
- make test
2026-02-25 07:02:54 +08:00
Willie a05d3448f2 fix(sync): match targets by shared path and track local dirs in prune
MatchesTargetName now falls back to path comparison when name-based
matching fails, so targets sharing the same project_path (e.g. codex
and universal both using .agents/skills) correctly match in
FilterSkillsByTarget.

PruneOrphanLinks records user-created directories in LocalDirs instead
of emitting misleading "unknown directory" warnings, and syncMergeMode
counts them toward the local skill total.
2026-02-25 07:02:54 +08:00
Willie 2ee8033171 feat: migrate contributor skills to .skillshare/skills/ for project-mode sharing
Move 5 skills from .claude/commands/ to .skillshare/skills/ so contributors
can share them via `skillshare sync -p`. Each skill has clear responsibility:
- cli-e2e-test: run isolated E2E tests in devcontainer
- codebase-audit: read-only cross-validation of code/docs/tests
- implement-feature: TDD workflow with E2E runbook generation
- update-docs: sync website docs with code changes
- changelog: generate CHANGELOG entries (RELEASE_NOTES maintainer-only)

Also:
- .gitignore: allow .skillshare/skills/, config.yaml, .gitignore to be tracked
- .skillignore: block .skillshare/skills/* from external install discovery
- ai_docs/tests/README.md: content merged into cli-e2e-test skill
2026-02-25 07:02:54 +08:00
Willie 42c383dd83 docs(changelog): add uninstall --all, compact audit display, structured sections
Update CHANGELOG.md and RELEASE_NOTES_0.15.5.md with user-visible
changes from recent commits: uninstall --all flag, compact grouped
audit findings, structured SectionLabel output, and MultiSelect
filter text fix.
v0.15.5
2026-02-24 01:47:38 +08:00
Willie bd4200c076 docs: update output examples to match new compact audit UI
- update.md: replace HeaderBox example with lightweight header, change
  "Aggregate risk" to "risk:" format
- install.md: add --audit-verbose flag to Options table, update risk
  score description
- uninstall.md: remove batch size labels (SectionLabel now unconditional)
- README.md: "aggregate risk" → "risk score" wording
2026-02-24 01:47:38 +08:00
Willie b91a6fc1c5 refactor(ui): replace HeaderBox with lightweight headers in update command
Single-item paths (tracked repo, regular skill) now use StepStart/StepContinue
for a flowing style consistent with install. Batch paths use ui.Header for a
simple one-line title. HeaderBox is retained only for audit and log commands
where a bordered report frame is appropriate.
2026-02-24 01:47:38 +08:00
Willie 70502ecd44 refactor(ui): compact audit findings display with grouping and risk score
- Rewrite renderInstallWarnings with summary-first layout: counts + threshold status on top
- Group duplicate findings by (severity, message), show "× N" with locations
- Strip redundant "audit " prefix under Audit Findings section
- Show compact top-5 groups by default, full list with --audit-verbose
- Add renderAuditRiskOnly for batch mode (just risk score)
- Wire update single-item/batch paths (global + project) to shared renderers
- Remove renderUpdateAuditResult (all callers migrated)
- Update test assertions for new output format
2026-02-24 01:47:38 +08:00
Willie a15f87fe0e feat(ui): add SectionLabel("Next Steps") to all remaining single-item handlers
Replace fmt.Println() separators with ui.SectionLabel("Next Steps") in
single-item handlers across update, update_project, install (config-based),
install_project, uninstall, uninstall_project, and trash restore. This
completes the unified SectionLabel pattern across all command output paths.
2026-02-24 01:47:38 +08:00
Willie d150f74da4 refactor(ui): use SectionLabel unconditionally in batch result display
Remove the useSections (len > 10) gate from all batch result display
functions across install, update, update_project, uninstall, and
uninstall_project. SectionLabel is now always shown regardless of
result count, ensuring consistent visual structure for small batches
(e.g. --skill selecting 1 item from a multi-skill repo).
2026-02-24 01:47:38 +08:00
Willie 7de15b0566 feat(install): add SectionLabel and structured audit-blocked output for single-item handlers
Add ui.SectionLabel("Next Steps") before next-steps info in all 4 single-item
install handlers (tracked repo, git discovery, git subdir, direct) to align
with the batch install / update / uninstall UI pattern.

Intercept audit.ErrBlocked in single-item handlers and display structured output
(SectionLabel + StepFail + detail lines) instead of dumping the raw error. The
returned error is now a short one-liner so main.go prints a clean summary.
2026-02-24 01:47:38 +08:00
Willie 81a43a0e44 fix(ux): keep filter text after selection in MultiSelect prompts
Add survey.WithKeepFilter(true) to all 4 MultiSelect prompts so the
filter input is preserved after pressing space to toggle an option.
2026-02-24 01:47:38 +08:00
Willie 25f86173bd feat(ui): add Audit Findings section label for single-skill install/update
Adds visual separation before audit findings in single-skill output,
matching the SectionLabel pattern used in batch mode.
2026-02-24 01:47:38 +08:00
Willie 95ad57705e feat(update): add section labels and improve project batch output
- Global update: use SectionLabel for Summary/Next Steps when >10 skills
- Project batch update: add HeaderBox, track skipped count, show
  summary box with updated/skipped/security-failed/total counts
2026-02-24 01:47:38 +08:00
Willie 93aa257292 feat(uninstall): add --all flag to remove all skills from source
Support bulk uninstall via 'skillshare uninstall --all' in both global
and project modes. Uses glob-based discovery to find all skills and
tracked repos, with --dry-run preview and --force to skip confirmation.

- Parse --all with mutual exclusion vs skill names and --group
- Global: discover skills + tracked repos from source directory
- Project: discover from .skillshare/skills/ directory
- Prune orphan symlinks from targets after removal
- Integration tests for --all, --all --dry-run, and conflict errors
- Update uninstall docs with --all examples
- Add AI runbook for uninstall --all glob testing
2026-02-24 01:47:38 +08:00
Willie 537e293721 feat(ui): add SectionLabel, fix StepFail ANSI passthrough, skip short elapsed
- SectionLabel(): dim section headers for visual grouping in batch output
- StepFail(): preserve pre-styled ANSI labels instead of double-wrapping
- Spinner Success/Warn: skip elapsed suffix when <50ms (avoids noise in tests)
- InstallOptions.AuditVerbose field for --audit-verbose flag plumbing
- Update install integration test assertions for batch compact format
2026-02-24 01:47:38 +08:00
Willie a0c859a155 feat(install): compress batch output for --audit-verbose and dry-run skill list
Large repos (900+ skills) produced overwhelming output in three areas:

1. Dry-run skill list: 4 loops replaced with printSkillListCompact()
   - ≤20: show all (unchanged); >20: first 10 + "... and N more"

2. --audit-verbose batch warnings (displayInstallResults):
   - ≤20 skills with warnings: full verbose (unchanged)
   - >20: compact summary + HIGH/CRITICAL findings only from top 20
     skills; LOW/MEDIUM/INFO summarized as "also: LOW=N"

3. --audit-verbose blocked failures:
   - ≤20 blocked: full message (unchanged)
   - >20: first 20 verbose, rest compact

New helpers: printSkillListCompact, renderInstallWarningsHighCriticalOnly,
sortResultsByHighCritical, countSkillsWithWarnings, hasHighCriticalWarnings.
2026-02-24 01:47:38 +08:00
Willie 3721d69b54 fix: prune orphaned real directories in merge mode via manifest (#45)
- Extend .skillshare-manifest.json tracking from copy mode to merge mode.
- Update PruneOrphanLinks to prioritize manifest records over naming patterns.
- Ensure SyncTargetMerge writes to manifest for all linked/updated skills.
- Add integration tests for uninstall + sync orphan directory cleanup.
- Maintain backward compatibility for targets without existing manifests.
2026-02-24 01:47:38 +08:00
Willie 7e1b29a5a7 refactor(devcontainer): dedupe ssenv shortcut setup and unify mode prompt 2026-02-24 01:47:38 +08:00
Willie 7dc7d9a596 docs(changelog): add v0.15.5 entry for init --mode and per-target hint 2026-02-24 01:47:38 +08:00
Willie 4c628e9dc9 Add devcontainer ssenv workflow and AI test guide 2026-02-24 01:47:38 +08:00
Willie 0694fbdc9c docs(guides): add skill design guide with determinism and CLI wrapper patterns
New guide covering 5 principles for writing reliable skills:
determinism first, CLI wrapper pattern, progressive disclosure,
risk-matched complexity, and interface-first design. Draws from
Peter Steinberger's CLI-first practices and Pahud Hsieh's
"SKILL + single binary CLI" paradigm.
2026-02-24 01:47:38 +08:00
Willie 7ab4c626fa Harden devcontainer skillshare entrypoints 2026-02-24 01:47:38 +08:00
Willie 06c14b6a9d feat(init): add --mode flag and per-target compatibility hints
Closes #42

Some AI CLIs (Cursor, Antigravity, Copilot, OpenCode) skip symlinks
when scanning skill directories, causing symlinked skills to be
silently ignored during auto-discovery.

Changes:
- `init --mode <merge|copy|symlink>` / `-m`: set default sync mode at
  init time (global and project); interactive prompt when TTY detected
- `init --discover --mode`: applies mode only to newly added targets,
  leaving existing targets unchanged
- Per-target mode hint after `sync` and `doctor`: suggests `copy` for
  known compatibility-sensitive targets (cursor → antigravity →
  copilot → opencode); suppressed when only claude/codex configured
- Neutral decision matrix in sync-modes.md for constraint-based choice
- By-target override examples in target.md, sync.md, first-sync.md
- Integration tests for mode flag, discover+mode, hint presence/absence
2026-02-24 01:47:38 +08:00
Willie edd5bab6d0 fix(ci): harden redteam signal mutation script v0.15.4 2026-02-23 04:23:53 +08:00
Willie ca60592447 fix(ui): remove unused threshold param from BlockStamp 2026-02-23 04:18:01 +08:00
Willie d2b085a20b feat(ui): redesign audit page with enhanced visual hierarchy
Improve block/risk/severity display in the audit page:
- Stats grid: color-coded backgrounds, zero-value muting with opacity
- Triage panel: structured 3-column layout with mini progress bar
- SkillAuditCard: BlockStamp (red tilted stamp vs green pass pill)
  and RiskMeter (dashed box with horizontal bar + score)
- FindingRow: left border severity stripe, code snippets as torn
  paper notes with wobbly borders and slight rotation
2026-02-23 04:18:01 +08:00
Willie 479b0eec8e docs(changelog): credit PR #39 link-audit groundwork 2026-02-23 04:18:01 +08:00
Willie cd5902c590 feat: unify update audit threshold gate and docs 2026-02-23 04:18:01 +08:00
Willie 3ad814d3ba fix: add audit gate to install --track and tracked repo updates
InstallTrackedRepo and updateTrackedRepo had no security audit,
allowing --track to bypass all supply-chain checks. This adds
auditTrackedRepo (removes repo on block for fresh installs) and
auditTrackedRepoUpdate (git reset rollback for updates), plus
input validation, testable removeAll, and hardened error handling
across audit/install/uninstall paths.
2026-02-23 04:18:01 +08:00
Willie 13691861e4 feat: add structural markdown link parsing for audit rules
Replace simple regex-based markdown link extraction with a full
structural parser that handles inline links with titles, autolinks,
reference-style links, HTML anchors, multiline links, and correctly
skips code fences, inline code spans, and image links.

This ensures external-link and source-repository-link audit rules
match all Markdown link syntax variants while avoiding false positives
from code examples and images.
2026-02-23 04:18:01 +08:00
Willie a8fb965b8b test: add unit tests for sync, install, and server packages
Boost unit test coverage across three core packages:
- internal/sync: 11.6% → 54.6% (discovery, status, checksum, manifest, pull, merge/prune)
- internal/install: 40.7% → 60.0% (meta, ignore, copy, updatable, local install, options, gitignore, source)
- internal/server: 15.1% → 40.0% (health, overview, skills, targets, config, log, trash, sync, collect, check, backup, diff, audit, hub)
2026-02-23 04:18:01 +08:00
Willie 52dcdc8280 refactor: deduplicate auditGateAfterPull via scan function parameter
Merge auditGateAfterPull and auditGateAfterPullProject into a single
function by accepting an auditScanFunc callback. Callers pass either
audit.ScanSkill directly or a closure capturing projectRoot for
project-mode scans. Removes ~50 lines of duplicated security logic.

Addresses PR #43 review feedback (code duplication in audit gate).
2026-02-23 04:18:01 +08:00
Willie 41c80f32f5 fix: harden error handling in security-critical audit paths
- Check rollback (ResetHard) errors instead of ignoring them; report
  accurate status ("rolled back" vs "malicious content may remain")
- Add audit.ErrBlocked sentinel error; refactor isSecurityError to use
  errors.Is instead of fragile string matching
- Replace fmt.Scanln with bufio.NewReader for robust input reading
- Propagate walk/hash errors in ComputeFileHashes instead of silently
  skipping, ensuring complete integrity baselines

Addresses PR #43 review items from Gemini Code Assist.
2026-02-23 04:18:01 +08:00
Willie a35110037c docs: update docs to reflect --diff for regular skills and audit risk score
--diff works for both tracked repos (git diff) and regular skills (hash
comparison) but docs only mentioned tracked repos. Also document the
audit risk score display in CLI/Web UI after updates, and add missing
flags (--diff, --skip-audit, --group) to built-in skill reference.
2026-02-23 04:18:01 +08:00
Willie 6656877b4a fix: make air install non-fatal during devcontainer setup
go install air can fail due to network issues. The ui command already
has fallback auto-install, so setup.sh should not abort on failure.
2026-02-23 04:18:01 +08:00
Willie 70dec0a821 fix: resolve air binary path and use entrypoint config
Air installed via `go install` lands in GOPATH/bin, not GOROOT/bin.
Resolve the path dynamically with fallback auto-install. Also replace
deprecated `bin` with `entrypoint` in .air.toml.
2026-02-23 04:18:01 +08:00
Willie 855d74fbac ci: add red team jobs with nightly schedule
Run red team tests on push/PR. Signal tests (mutation + rules-disable)
run on push, nightly cron, and manual dispatch only.
2026-02-23 04:18:01 +08:00
Willie 00c3fd146c test: add red team signal tests for mutation and rules-disable
test-redteam-signal verifies the red team suite detects intentional
code mutations. test-redteam-rules-signal verifies it fails when
critical builtin audit rules are disabled.
2026-02-23 04:18:01 +08:00
Willie bd76ec9aa5 feat: surface audit risk score in update API and UI
Return auditRiskScore and auditRiskLabel in update results so the
dashboard can show security posture after both tracked-repo and
regular-skill updates. auditGateTrackedRepo now returns the audit
result alongside the blocked indicator.
2026-02-23 04:18:01 +08:00
Willie b93d8f103a fix: wait for API port and fix project-mode cwd with air
Air needs time to compile before the server is ready. Add a
wait-for-port loop (max 30s) so the dashboard URL is only shown
after the API is actually listening.

For project mode, use SKILLSHARE_UI_EXEC_PREFIX to cd into the
project directory before exec'ing the binary, since skillshare ui -p
relies on os.Getwd() and air must build from /workspace.
2026-02-23 04:18:01 +08:00
Willie 1637b1905f feat: integrate air hot-reload into devcontainer
Replace manual build+nohup with air in the `ui` command and install
air during setup so .go changes auto-restart the API server.
2026-02-23 04:18:01 +08:00
Willie 9700474c0f feat: use air hot-reload in ui-dev targets
Replace `go run` with `air` in both Makefile and mise.toml so Go
backend auto-restarts on source changes during UI development.
2026-02-23 04:18:01 +08:00
Willie 438b5b5ada feat: add air hot-reload config for Go backend
Air watches cmd/ and internal/ for .go changes and auto-rebuilds.
Uses env vars (SKILLSHARE_UI_HOST, SKILLSHARE_UI_FLAGS) so the same
config works for both local dev and devcontainer.
2026-02-23 04:18:01 +08:00
Willie 2171dc4db0 feat: add --diff and audit visibility for regular skill updates
Regular skills (non-git, metadata-based) now support --diff flag using
hash-based file comparison, display audit results after update, and
properly enforce the audit gate by not passing Force to inner Install.
2026-02-23 04:18:01 +08:00
Willie 684b0da971 docs: add v0.15.4 changelog, update SKILL.md, README, and UI for supply-chain security
- Add v0.15.4 CHANGELOG entry (audit gate, content hash pinning, --diff,
  source-repository-link rule, severity-based risk floor, bug fixes)
- Bump SKILL.md version to v0.15.4 with supply-chain security keywords
- Update README Recent Updates table to reference v0.15.4
- Fix security.md rule count 25→31 to match audit.md
- DashboardPage: include blocked count in update summary toast
- SkillDetailPage: show ConfirmDialog on blocked update with
  "Skip Audit & Update" retry option
2026-02-23 04:18:01 +08:00
Willie 0af0df57bf test: add red-team phase5 and harden hash path validation 2026-02-23 04:18:01 +08:00
Willie ae6620e484 docs: add supply-chain security lifecycle flowchart to security guide
Mermaid flowchart showing 3 phases: Install gate (audit + hash pinning),
Update gate (post-pull audit + auto-rollback), Integrity verification
(SHA-256 hash comparison). Color-coded nodes for pass/block/warning states.
2026-02-23 04:18:01 +08:00
Willie 5c44acd7d1 test: add red team E2E script for supply-chain security validation
Repeatable bash-based test exercising all audit patterns (CRITICAL→INFO),
update gate rollback, content hash integrity, and batch blast radius.

- scripts/red_team_test.sh: main entry (setup + 4 phases + summary)
- scripts/red_team/: split phases + shared helpers
- Makefile/mise.toml: add `test-redteam` target
- docker/sandbox/Dockerfile: add jq for JSON assertions
2026-02-23 04:18:01 +08:00
Willie a03e5a8e20 test: add isSecurityError unit test and server audit gate rollback failure tests
- cmd/skillshare/update_test.go: table-driven test covering all
  isSecurityError keywords (security audit, post-update audit,
  rolled back, rollback failed) and negative cases
- internal/server/handler_update_test.go: three tests for
  auditGateTrackedRepo: rollback failure warning on HIGH findings,
  rollback failure warning on scan error, and clean repo returns nil
2026-02-23 04:18:01 +08:00
Willie 5ce6507799 fix: server rollback error reporting and isSecurityError classification
- handler_update.go: check git.ResetHard return value; if rollback
  fails, append explicit warning to blocked message instead of
  silently claiming rolled back
- update.go: add "post-update audit" to isSecurityError keywords
  so install.Install audit failures are correctly classified as
  security blocks in batch exit code
2026-02-23 04:18:01 +08:00