Commit Graph
390 Commits
Author SHA1 Message Date
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
Willie b216e3539e docs: update audit and update command docs for supply-chain security features
- update.md: add --skip-audit and --diff flags, security audit gate
  section, file change summary section, batch exit code behavior
- audit.md: add source-repository-link rule, content integrity checks,
  severity-based risk floor, update-time scanning, built-in rule table
2026-02-23 04:18:01 +08:00
Willie ea33edd917 fix: uninstall group directory now removes member skills from config.yaml
When a group directory (e.g. `fix-review`) was uninstalled as a whole,
only the directory name was checked against config entries. But skills
in the manifest use FullName format (`group/skill`), so the exact match
never hit. Now uses prefix matching to also remove member skill entries.
2026-02-23 04:18:01 +08:00
Willie a0bfe9958a fix: batch update error propagation, skip-audit passthrough, and security hardening (#39)
- P1: Batch/all update now returns non-zero when repos are blocked by
  security audit (fail-closed for CI pipelines)
- P2: Pass --skip-audit to regular skill update via InstallOptions
- P2: Add path containment check in content integrity to prevent
  directory traversal via crafted file_hashes keys
- P3: Switch git diff parsing to NUL-delimited (-z) for safe handling
  of special filenames
2026-02-23 04:18:01 +08:00
Willie 62bd821cba feat: content hash pinning and integrity verification (#39)
Pin sha256 file hashes in .skillshare-meta.json during install/update.
Audit now detects content-tampered (MEDIUM), content-missing (LOW),
and content-unexpected (LOW) findings. Backward-compatible: skills
without file_hashes in meta are silently skipped.
2026-02-23 04:18:01 +08:00
Willie a5f84c2485 feat: auto-audit gate after update with rollback and --diff summary (#39)
Supply-chain hardening Phase 2:
- Add post-pull audit gate: HIGH/CRITICAL findings auto-rollback in
  non-interactive mode (fail-closed), prompt in TTY mode
- Use full 40-char commit hashes for reliable rollback (avoids short-hash ambiguity)
- Add --skip-audit flag to bypass the gate when risk is accepted
- Add --diff flag to show file-level change summary after tracked repo update
- Add GetChangedFiles() and ResetHard() git helpers
- Add audit gate in install --update git-pull path to prevent bypass
2026-02-23 04:18:01 +08:00
Willie a2a86c9e59 feat: add source-repository-link rule and severity-based risk floor (#39)
Supply-chain hardening Phase 1:
- Add source-repository-link-0 rule (HIGH) to detect [source repository](url) patterns
- Exclude source-repo labels from external-link-0 to prevent double-reporting
- Introduce risk floor: RiskLabel = max(score-label, severity-floor) so a
  single HIGH finding produces "high" risk instead of "low"
- Apply severity floor to CLI summary, server API summary, and per-result risk
2026-02-23 04:18:01 +08:00
Willie c59ae5aa19 feat: severity-based color ramp for audit output
Inspired by #39 — batch lines, summary box, severity counts, and
single-skill risk all use a consistent color ramp:
CRITICAL → red, HIGH → orange, MEDIUM → yellow, LOW/INFO → gray.

Also hide elapsed time when < 1s for cleaner batch output.
2026-02-23 04:18:01 +08:00
Willie 7e5682ee73 ci: append contributors section to release notes
Add post-GoReleaser step that queries GitHub Compare API for commit
authors between tags, excludes bots and maintainer (runkids), and
appends a ## Contributors section with @mentions to the release body.

Uses RELEASE_TEMPLATE.md with envsubst (scoped to two variables) to
keep the format editable outside the workflow YAML.
v0.15.3
2026-02-22 15:13:10 +08:00
Willie c0c097feeb docs: add issue references to v0.15.3 changelog
Link external-link rule to #38 (closes, supersedes #39) and
SKILL.md description fix to #40.
2026-02-22 15:13:10 +08:00
Willie a248e758ab docs: update pull.md for merge-by-default and add v0.15.3 changelog
- pull.md: reflect new merge behavior when both sides have skills
- CHANGELOG: add v0.15.3 entries (multi-name audit, external-link
  rule, hub auth tokens, parallel scan, pull merge-by-default)
2026-02-22 15:13:10 +08:00
Willie 97e2a2d5c6 refactor: extract shared parallel audit scan helper
Deduplicate bounded-concurrency worker pool that was repeated in
auditInstalled(), auditFiltered(), and handleAuditAll(). The new
audit.ParallelScan() centralises the pattern with index-aligned
results, reducing ~90 lines to a single reusable function.
2026-02-22 15:13:10 +08:00
Willie 7f52458a58 test: update pull tests for merge-by-default behavior
firstPull now attempts merge when both local and remote have skills
instead of blocking. Update two integration tests to expect successful
merge with both skills preserved and synced to targets.
2026-02-22 15:13:10 +08:00
Willie 0542e753ad fix: trim built-in skill description under 1024 chars and update references
CodeX rejects skill descriptions exceeding 1024 characters (issue #40).
Trim description from 1050 to 785 chars by removing verbose feature
details already covered in the skill body.

Also update audit reference with multi-name/--group support and
external-link pattern, bump version to v0.15.3, and add external-link
and dangling-link demo skills to playground.

Closes #40
2026-02-22 15:13:10 +08:00
Willie 52f55c8521 fix: pull merges by default when both sides have skills, audit resolves nested skill names
- firstPull: attempt merge instead of blocking when both local and
  remote have skills; override merge.ff=only with -c merge.ff=false
- auditSkillByName: fall back to collectInstalledSkillPaths for
  short-name resolution of nested skills (e.g. security/audit-demo-*)
- Add external-link and dangling-link demo skills to sandbox content
2026-02-22 15:13:10 +08:00
Willie 13d9b82be7 fix: devcontainer token loading from .env and host env fallback
- Remove token vars from remoteEnv (localEnv overrides .env with empty)
- Pass host tokens via docker-compose environment as fallback
- Add profile.d script to source .devcontainer/.env in login shells
- Add sandbox token passthrough for GitLab/Bitbucket/generic tokens
- Add root .env to .gitignore
2026-02-22 15:13:10 +08:00
Willie 3b8c681bb2 feat: auto-inject auth tokens for hub search and Web UI git operations
Add token auto-injection for private repo support across all platforms:
- Hub search (--hub): normalize web URLs to raw-content URLs and apply
  platform-specific auth headers (GitLab, GitHub, Bitbucket)
- Web UI push/pull/update: use *WithAuth variants for git operations
- Export ResolveTokenForURL and DetectPlatformForURL from install/auth
2026-02-22 15:13:10 +08:00
Willie 8778adddcc feat: add external-link-0 audit rule to detect external URLs in markdown links
Detect `[text](https://...)` patterns in skill files as a LOW severity
finding. External links may indicate prompt injection vectors or waste
tokens. Localhost/127.0.0.1/0.0.0.0 links are excluded via the rule's
exclude regex.

Closes #38
2026-02-22 15:13:10 +08:00
Willie 8a4f61ffec docs: clarify dangling-link is a structural check, not in rules.yaml
The built-in rule IDs table listed dangling-link alongside regex-based
rules with a "source of truth" link to rules.yaml, but dangling-link
uses filesystem lookups (os.Stat) and is not defined there. Add a note
explaining the distinction to avoid confusion.
2026-02-22 15:13:10 +08:00
Willie 0d3799d770 feat: add multi-name and --group support for audit command
Allow `skillshare audit a b c` and `--group`/`-G` flags to filter
which skills are scanned, matching the existing check/update pattern.
Single-name audit preserves detailed output; multi-target uses batch
format with parallel scanning.
2026-02-22 15:13:10 +08:00
Willie d692d146bf perf: parallelize audit scanning in CLI and API handlers
Use bounded goroutine pool (max 8 workers) for audit.ScanSkill calls
in both auditInstalled (CLI) and handleAuditAll (API). Scan results
are collected into a pre-allocated slice, then processed sequentially
for deterministic output ordering and summary accumulation.
2026-02-22 15:13:10 +08:00
Willie 311c9ad50f fix: force English git output and parallelize hub audit scanning
Add LC_ALL=C to git command environments in push, init commit, and
remote fetch to prevent locale-dependent output from breaking string
matching (e.g. "nothing to commit" in non-English locales).

Parallelize audit.ScanSkill in BuildIndex using goroutines with a
bounded semaphore (max 8 workers) to reduce index generation time
for large skill collections.
v0.15.2
2026-02-22 08:08:35 +08:00
Willie f6087ac8ba refactor: use plain bool for BuildIndex auditSkills parameter
Variadic ...bool was used for backward compatibility but is non-idiomatic
Go for an internal API. Plain bool makes the function contract explicit
and simplifies the audit check from len(auditSkills) > 0 && auditSkills[0]
to a direct boolean test.
2026-02-22 08:08:35 +08:00
Willie 506b60a1ee fix init remote flow and clarify interactive setup docs 2026-02-22 08:08:35 +08:00
Willie 593bcabf2e fix: defer git initial commit to after skill installation
doGitInit() previously committed immediately (only .gitignore), but
installSkillIfNeeded() runs later — leaving skill files uncommitted.
This caused "Local changes detected" on first pull.

Move commit to a single commitSourceFiles() call at the end of init,
after all files are in place. Covers all scenarios:

performFreshInit (first-time init):
- No remote, no skill → 1 commit: "Initial commit" (.gitignore)
- No remote, with skill → 1 commit: "Initial skills" (.gitignore + skill)
- Remote empty → same as above, remote fetch is no-op
- Remote has skills → reset --hard to remote; commitSourceFiles is no-op
- Remote unreachable → same as no-remote (fetch fails gracefully)

handleExistingInit (init --remote on existing config):
- Git exists → commitSourceFiles is no-op (already committed)
- Git not exists, remote reachable → commit before setupGitRemote so
  HEAD exists for reset --hard
- Git not exists, remote unreachable → commit .gitignore so push/pull
  don't see "Local changes detected"
2026-02-22 08:08:35 +08:00
Willie d1d528f192 feat: add --audit flag to hub index for security risk enrichment
Enrich hub index with per-skill audit scores so teammates can assess
skill safety before installing. Uses existing audit.ScanSkill() engine
(25 rules, 0-100 risk score) without modifying the audit package.

- SkillEntry gains riskScore (*int), riskLabel, auditedAt (omitempty)
- BuildIndex accepts variadic auditSkills param (backward compatible)
- search index deserializes and displays risk badges in hub results
- Schema stays v1; fields omitted when --audit not used
2026-02-22 08:08:35 +08:00
Willie a8f04320ea docs: add required token scopes per platform for auth errors
- environment-variables.md: add token creation steps and required scopes
  for GitLab (read_repository + write_repository) and Bitbucket
  (repository access token vs app password)
- common-errors.md: add token permissions quick-reference table
- CLI auth hint: append docs URL for detailed scope info
2026-02-22 08:08:35 +08:00
Willie 83d13f6e10 feat: add platform-specific token setup hints for auth errors
- CLI auth hint now shows PowerShell syntax on Windows, export on Unix
- Docs: add Windows PowerShell examples for GITLAB_TOKEN, BITBUCKET_TOKEN,
  SKILLSHARE_GIT_TOKEN in environment-variables.md
- Docs: rewrite auth error section in common-errors.md with token env var
  options, Windows syntax, and GitLab token type warning
2026-02-22 08:08:35 +08:00
Willie ba852f601d fix: show auth hints instead of "pull first" on push/pull auth failure
Auth errors (Authentication failed, Access denied) were not detected by
hintGitRemoteError, causing push to misleadingly suggest "skillshare
pull" as a remedy. Now detects auth errors and shows actionable options
(SSH URL, token env vars, credential helper). Pull also benefits since
it shares hintGitRemoteError.
2026-02-22 08:08:35 +08:00
Willie ce5ba1442c fix: strip "v" prefix from skill version to prevent "vv" display
SKILL.md frontmatter may contain "version: v0.15.0" (with v prefix),
but callers already prepend "v" when formatting. Normalize at the
source by trimming the prefix in both ReadLocalSkillVersion and
FetchRemoteSkillVersion.
2026-02-22 08:08:35 +08:00
Willie 029953133b docs: add v0.15.1 changelog entry v0.15.1 2026-02-21 21:12:51 +08:00
Willie 3518cca2b1 docs: add short flag aliases to built-in init skill reference 2026-02-21 21:12:51 +08:00
Willie cea26ea7fb feat: add dangling local markdown link detection to audit
Scan .md files in skill directories for broken relative links during
audit. Targets that don't exist on disk produce a LOW severity finding
(pattern: dangling-link). External URLs, anchors, and fragments are
skipped.

Integrated into the existing walk (zero extra IO) and disableable via
audit-rules.yaml (- id: dangling-link / enabled: false). The init-rules
template, built-in skill reference, and website docs are updated.
2026-02-21 21:12:51 +08:00
Willie 8e58cc7383 docs: add missing flags to diff and restore command pages
diff.md: add Options table (--target/-t, --project/-p, --global/-g)
restore.md: document -f shorthand for --from
2026-02-21 21:12:51 +08:00
Willie 836f1b498b refactor: dedupe git helpers and isolate test state 2026-02-21 21:12:51 +08:00
Willie 6d5c95a19a docs: align cross-machine-sync guide with new push/pull behavior
Update pseudo-code and error messages to match actual CLI output
after the push/pull/init overhaul.
2026-02-21 21:12:51 +08:00
Willie 03e35a1719 test: isolate oplog tests with per-test XDG state 2026-02-21 21:12:51 +08:00
Willie 89055804ff fix: harden pull/push first-sync flow and add regression coverage 2026-02-21 21:12:51 +08:00
Willie 6b8c38455c fix: overhaul push/pull/init git remote flow
Fixes multiple issues with the cross-machine sync workflow reported
in runkids/skillshare#35:

- push/pull auto-detect missing upstream and set it on first use
  (push uses -u, pull uses fetch + reset + set-upstream-to)
- First pull checks local/remote skill directories before resetting;
  refuses to overwrite local skills unless --force is passed
- init --remote auto-initializes git when config exists but .git does not
- HTTPS token auth (GITHUB_TOKEN, GITLAB_TOKEN, etc.) injected into
  push, pull, and init remote fetch
- init --help shows init-specific flags and examples
- Remote repos with only files (README) no longer misdetected as
  having skills (uses git ls-tree -d)
- Error hints suggest skillshare init --remote instead of raw git
2026-02-21 21:12:51 +08:00