suppressUIToStderr was redirecting UI to stderr, but in environments
where stdout and stderr share the same terminal (e.g. docker exec),
all the spinner/progress/header output was still visible alongside
the JSON. Replace with suppressUIToDevnull which opens os.DevNull
for both os.Stdout and ui.ProgressWriter, producing zero visible
noise in --json mode.
Also add status --json support for project mode, reusing the same
JSON schema as global mode (source, skill_count, tracked_repos,
targets, audit, version).
install --json: logo, spinners, and step output leaked to stdout,
corrupting machine-parseable JSON. Add suppressUIToStderr() around the
entire install flow, restoring stdout before writing JSON.
diff --project --json: spinner and progress display polluted stdout.
Skip spinner and progress creation in JSON mode, matching the existing
cmdDiffGlobal pattern.
uninstall --json: five error paths (discovery failure, no skills found,
glob detection, validation, preflight) returned plain-text errors instead
of JSON error envelopes. Wrap each with writeJSONError().
Add 8 integration tests (5 new failure cases + 3 confirming existing
behavior) with an assertPureJSON helper that validates stdout contains
only valid JSON with no leading/trailing noise.
The --json addition accidentally removed the guard that rejects
unexpected positional arguments in project mode. Restore it so
`skillshare status --project foo` correctly returns an error
instead of silently ignoring the extra argument.
writeJSONError now returns a jsonSilentError sentinel that main()
recognises — it exits with code 1 without printing plain-text output
to stdout. This fixes a regression where --json errors (config load
failure, missing source dir, discovery failure) returned exit 0.
All writeJSONError call sites changed from the broken pattern:
writeJSONError(err); return nil // exit 0, wrong
to:
return writeJSONError(err) // exit 1, correct
Also applied the same fix to update.go error paths which had the
older pattern of writeJSONError(err) followed by return err (which
would print both JSON and plain text).
Added regression tests for sync and install error paths verifying
both non-zero exit code and valid JSON error output on stdout.
Address code review feedback from PR #67:
- Move all dry-run diagnostic messages (internal/sync) from stdout to
stderr so they don't pollute JSON output
- Suppress UI output (spinners, headers, warnings) in uninstall --json
mode by adding jsonOutput guards across all phases
- Return nil after writeJSONError to prevent dual output (JSON + plain
text error) in install and sync commands
- Handle json.MarshalIndent error in writeJSONError with stderr fallback
- Merge duplicated discovery logic (JSON vs non-JSON branches) in sync,
sync_project, diff, and collect using nullable spinner pattern
- Remove checkRepoDirty alias in status.go, call isRepoDirty directly
- Remove extractJSON test workaround — tests now assert stdout is valid
JSON directly, enforcing the clean-stdout contract
- Replace hasFlag loop with slices.Contains (stdlib)
- Deduplicate checkRepoDirty → delegate to isRepoDirty
- Add nil-receiver guard to diffProgress.stop() for consistency
- Return explicit error for status --json in project mode
- Use consistent error message in sync --json source-not-found path
Improve all 5 active skills with pushy descriptions for better
triggering accuracy, following devcontainer as the gold standard.
- changelog: add trigger scenarios (release notes, version prep)
- cli-e2e-test: add trigger scenarios (runbook, E2E validation)
- codebase-audit: add 3 new audit dimensions (handler split, oplog
coverage, web API consistency) and trigger scenarios
- implement-feature: add project patterns reference (handler split,
dual-mode, TUI, web API, oplog) and trigger scenarios
- update-docs: expand scope to all 7 doc categories with code-to-doc
mapping guide and trigger scenarios
Also remove empty .skillshare/skills/frontend/ directory.
Detect local drift (modified/missing/added files) in installed skills
by comparing current SHA-256 hashes against stored .skillshare-meta.json
records. Skills without metadata are flagged as unverifiable warnings.
Replace bordered boxes around Source/Sync sections with simple
title + indented rows. Reserves brand yellow solely for selected
item indicator, reducing visual noise in the detail panel.
- Add contentEqual() byte comparison for copy-mode idempotency check:
re-running sync extras no longer marks identical copies as conflicts
- Restore mode default in CLI handler so display shows "(merge)"
instead of "()" for targets with no explicit mode
- Fix bug: pass `rest` (not `args`) to cmdSyncExtras in --all path
- Return error from cmdSyncExtras when totalErrors > 0
- Remove empty if-block dead code in syncOneExtraFile
- Remove redundant mode default (SyncExtra already defaults to merge)
- Consolidate capitalize/capitalizeFirst into single Unicode-safe helper
- Remove trivial copyExtraFile wrapper, call copyFile directly
- Warn when --all is used in project mode (extras are global only)
- Cache os.UserHomeDir() at package level for shortenPath
- Use source file set instead of per-file os.Stat in pruneExtraOrphans
Route `skillshare sync extras` to new cmdSyncExtras handler that
iterates config.Extras, calls sync.SyncExtra per target, and logs
to oplog. `skillshare sync --all` runs normal skill sync followed
by extras sync in one invocation.
- Use existing boolPtr() helper instead of inline *bool construction
- Add oplog instrumentation to cmdTUIToggle for operation history
- Pass pre-loaded cfg to shouldLaunchTUI in diff.go and backup.go
to avoid redundant config.Load() calls
The old applyDetailScroll embedded a scroll indicator inside the panel
content, consuming panel height and causing MaxHeight to clip the last
visible lines. Long lines that visually wrapped also broke the scroll
line-count calculation.
Replace with wrapAndScroll (hardWrapContent + applyDetailScrollSplit)
which hard-wraps content for accurate line counts and returns scroll
info separately for display in the help bar. Extract appendScrollInfo
helper to eliminate repeated if-append boilerplate across all TUIs.
Affects: audit, audit-rules, log, diff, restore TUIs (both horizontal
and vertical layouts).
Header, findings, and summary box were visually cramped with no
blank lines separating them. Add breathing room between:
- header box and first finding (single-skill / path mode)
- last arrow line and summary box
- logical groups inside summary box (policy / counts / severity / aggregate / note)
Apply per-category ANSI colors to the Threats breakdown in the CLI
summary box, matching the TUI footer palette. Add Purple, BrightRed,
OrangeAlt, BrightBlue color constants to internal/ui. Non-TTY output
remains plain text.
Labels use dim style while values use bold semantic colors, making
counts visually prominent. Threat category breakdown now colors each
category independently (injection=red, exfiltration=orange, etc.)
instead of uniform yellow, so users can distinguish threat types at
a glance.
Surface per-category finding counts (e.g., injection:3 exfiltration:2)
in CLI summary, TUI footer, markdown report, JSON output, and web API.
Adds Result.CountByCategory(), formatCategoryBreakdown() with compact
mode for TUI, and byCategory field to all audit summary structs.
Previously the Phase 2 finding fields (ruleId, analyzer, category,
confidence, fingerprint) were only emitted in JSON and SARIF output.
This propagates them to CLI text, TUI detail panel, Markdown reports,
Server API responses, and the React frontend — each channel showing
the subset most useful for its audience.
- Server API: all 5 fields (omitempty) in auditFindingResponse
- CLI text: dim [ruleID / analyzer] line between severity and snippet
- TUI: cyan ruleID / analyzer / category line + search index
- Markdown: Rule ID and Category table columns
- Frontend: ruleId · analyzer · category dim metadata line
LEGACY dedupe label used Gray (ANSI 90) which is near-invisible on dark
backgrounds — switch to Yellow for both CLI and TUI. Add Gray color to
separator and label text (dedupe:, analyzers:) so colored values stand
out from structural punctuation.
applyPolicyToSummary was called in cmdAudit after auditInstalled/
auditFiltered returned, but both functions call presentAuditResults
(which launches the TUI) internally — so summary.PolicyProfile was
empty when the TUI rendered. Move applyPolicyToSummary before
presentAuditResults in both functions.
Also fix dedupe default label (global is now the default, not legacy)
and update audit/status docs to reflect current output format.
- Make DefaultRegistry() a singleton (stateless analyzers, safe to share)
- Consolidate duplicate ANSI regex into ui.StripANSI(); broaden pattern
to match all CSI sequences ([a-zA-Z] terminator, not just 'm')
- Extract shared policyProfileLabel/policyDedupeLabel/policyAnalyzersLabel
helpers; unify formatPolicyLine and formatPolicyLineFromPolicy
- Remove redundant applyPolicyToSummary calls inside auditInstalled and
auditFiltered (cmdAudit already applies it centrally)
- Fix double isMarkdown check in scanSkillImpl walk loop
- Convert variadic ...*Registry to regular *Registry parameter across
scanSkillImpl, ParallelScan, scanSkillPath, and scanPathTarget
- Pre-compute registry.Has() before walk loop to avoid per-file O(n) scan
- Add ANSI color helpers (colorizeProfile/Dedupe/Analyzers) for text output
and lipgloss equivalents (tuiColorize*) for TUI — all values now UPPERCASE
- Colorize threshold with severity color in header, summary box, and TUI
- Colorize Max sev in summary box with severity color
- Add Audit section to `skillshare status` (global + project) showing
resolved policy: Profile, Block rule, Dedupe, Analyzers
- Fix TUI not showing Policy row: move policy field population from
runAudit() into scan functions via applyPolicyToSummary() so TUI
receives populated summary before launch
Color mapping:
Profile: DEFAULT=cyan STRICT=yellow PERMISSIVE=green
Threshold: severity color (red/orange/yellow/blue/gray)
Dedupe: GLOBAL=cyan LEGACY=gray
Analyzers: specific=cyan ALL=cyan
- Add "policy:" line to header box (before scan starts)
- Add "Policy:" line to text summary box
- Add Policy row to TUI detail panel (right side)
- Add Policy label to TUI footer bar
- Batch no-tui mode: only show skills with findings (suppress 60k+
clean ✓ lines). Single-skill mode still shows full detail.
config.Load() normalized empty block_threshold to "CRITICAL", preventing
ResolvePolicy from applying profile-based thresholds (e.g. strict → HIGH).
Change: normalizeAuditBlockThreshold("") now returns "" instead of "CRITICAL".
All downstream callers (install, update, server) already use
audit.NormalizeThreshold() which handles empty → CRITICAL independently.
Also adds 4 integration tests for --profile, --dedupe, and config-based
profile resolution. Includes gofmt formatting fixes.
- CLI: add --profile and --dedupe flags to audit command with help text
- Pipeline: apply DeduplicateGlobal when dedupe_mode=global, recount
summary after dedup via recountSummary helper
- Output: add policyProfile/policyDedupe to JSON summary and Markdown
header (non-default profiles only)
- Server: add auditPolicy() method, populate policy fields in API
responses for both all-skills and single-skill audit endpoints
Implement a full bubbletea TUI with two navigation levels:
- Level 1 (patterns): shows pattern categories with rule count, disabled
count, and max severity; press Enter to drill in, d to toggle pattern
- Level 2 (rules): shows individual rules with severity and status; detail
panel shows full ID, regex, message, source; d toggles single rule,
D toggles entire pattern, Esc returns to Level 1
Also adds audit.ResetGlobalCache() to clear cached rules after YAML
mutations, enabling live-reload within the TUI session.
pterm's cursor package writes hide/show ANSI codes (\x1b[?25l/h)
directly to os.Stdout, bypassing WithWriter(). The previous fix
(SetProgressWriter to stderr) was insufficient because pterm still
created progress bar objects that triggered cursor.Hide()/Show().
Add SuppressProgressToStderr() which both redirects ProgressWriter
and forces isProgressTTY() to return false, preventing pterm
components from being instantiated at all. Extract assertNoANSI
test helper and cover all three structured formats (JSON, SARIF,
Markdown).
Also update pre-commit E2E runbook with steps 10-11 (framework
integration tests) and add pre-commit-hook recipe to sidebar.
Replace nested pair-checking loop with set-based approach:
- Single pass builds capability sets (credReaders, netSenders, etc.)
- Each rule checks non-empty sets → one summary finding per rule
- 100k skills: ~15ms vs ~30s+ (benchmark included)
- Use DiscoverSourceSkillsLite for audit discovery (skip frontmatter)
- Use patternDataflowTaint constant instead of raw string
Previously the audit TUI "/" filter only matched skill names. Now it
also searches risk label, status (blocked/warning/clean), max severity,
finding pattern names, and finding file names — making it easy to narrow
down results like `/critical`, `/exec-command`, or `/blocked`.
P1: SARIF startLine=0 is invalid per spec — GitHub Code Scanning rejects
it. Use *sarifRegion pointer with omitempty so findings without line
numbers (tier, cross-skill, analyzability, content-integrity) produce
valid SARIF output without a region field.
P2: Server audit endpoint (handleAuditAll) now calls CrossSkillAnalysis
after collecting results, matching CLI behavior. Previously the API
returned only per-skill findings without cross-skill interaction checks.
Also guard fmt.Println() in auditFiltered() for structured output
consistency (same fix as auditInstalled in previous commit).
Two issues caused red team test failures after --format flag introduction:
1. ss_capture helper merged stderr into stdout (2>&1), so the --json
deprecation warning poisoned JSON parsing by jq. Fix: capture stderr
to a temp file separately from stdout.
2. Two unguarded fmt.Println() calls in auditInstalled() printed blank
lines to stdout even in JSON/SARIF/markdown mode. Fix: wrap in
if !jsonOutput guard.
Also migrate all 39 --json invocations in red team tests to --format json
since --json is deprecated.
- Add --format markdown for self-contained audit reports (GitHub Issues/PRs)
- Simplify pterm box rendering: replace DefaultBox with separator-line style
- Remove unused SkillBox, SummaryBox, SkillDisplay, wrapText helpers
- Color Box titles cyan (consistent with HeaderBox)
- Add breathing room: blank lines around progress bar and after summary
- Show "skillshare audit (project)" header title in project mode
- Append elapsed time to cross-skill synthetic results to fix slice mismatch
Two individually harmless skills can form an attack chain when installed
together (e.g., one reads credentials, another has network access).
After per-skill scans complete, the audit engine now extracts a capability
profile from each Result and checks for dangerous cross-skill combinations:
- cross-skill-exfiltration (HIGH): credential reader + network sender
- cross-skill-privilege-network (MEDIUM): privilege commands + network
- cross-skill-stealth (HIGH): stealth skill alongside high-risk skill
Rules only fire for complementary pairs (each skill lacks the other's
capability) to avoid duplicating per-skill findings. Results appear as
synthetic "_cross-skill" entry in all output formats (text, JSON, SARIF, TUI).
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
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
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)
- 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
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.
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.
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