extractGitFatal kept only git's "fatal:" line, so SSH clone/fetch failures
(install from git@host:..., hub indexes over SSH, updates) reported just
"Could not read from remote repository." and dropped the ssh line that says
why: publickey denied, host key verification, unresolved hostname, or a
refused/timed-out connection.
For that generic message, append the preceding transport line (skipping
"Cloning into" and warning chatter). When the reason is a publickey denial,
WrapGitError adds an "ssh -T user@host" hint. Other errors are unchanged.
config.yaml records which skills a project wants, but not which commit
each one resolved to, so two teammates running `install -p` a week apart
could end up with different skill contents.
Project mode now writes .skillshare/skills.lock.json next to the config.
`install -p` checks out the locked commit for skills and tracked repos,
and brings an already installed skill to the lock when they differ.
`update -p` and the dashboard move a pin only for skills whose commit
actually changed, so a stale local copy cannot roll the team back, and
uninstall drops the pin. A locked value is only honoured when it is a
full SHA for the same source, since it ends up as a git argument.
- Fallback fetch pulled only the default branch because a depth-1 clone
is single-branch; fetch all heads and tags so an abbreviated SHA off
the default branch resolves.
- Move the --track guard from CLI flag parsing into InstallTrackedRepo
so the Web UI is covered too, and reject tags as well as SHAs: both
leave HEAD detached with nothing for `git pull` to follow.
- An all-hex branch or tag name (e.g. 20240915) was treated as a SHA in
check and never queried; look the ref up first and fall back to the
literal SHA only when the remote has no such ref. Full 40-char SHAs
still skip the network.
- Rename the git package's 7-char shortHash to abbrevHash to avoid
clashing with install's 12-char helper.
Refs #281
Teams with supply-chain review need reproducible installs, but --branch
only worked for branch names because git clone --branch rejects SHAs.
Clone the default branch and detach at the pinned commit (targeted
depth-1 fetch, falling back to --unshallow for abbreviated SHAs or
servers that refuse arbitrary wants). Resolve tags in check via
refs/tags and the peeled ^{} commit, and short-circuit SHA pins without
a network round-trip since they can never move. Reject --track with a
SHA: a tracked repo must follow a branch to pull.
Closes#281
Retry generic HTTPS clone failures by progressively treating additional path segments as part of a nested GitLab repository. Limit retry to repo-boundary errors and preserve the final fallback error for debugging.
Route temp clone cleanup through a shared helper that logs cleanup failures with path and error while preserving existing best-effort cleanup semantics.
Cover cleanup failure logging with a deterministic unit test.
Hub index fetch previously handled only unauthenticated HTTP(S) GET or
local file paths, leaving private and GitHub Enterprise repos out of
reach — raw HTTPS URLs redirect to login before token headers apply, and
SSH-style hub URLs were unrecognized.
Resolve SSH hub sources by shallow-cloning the repo with the user's SSH
keys and reading the index from it. The in-repo index path uses the
existing //path subdir convention (consistent with `install`), defaulting
to skillshare-hub.json at the repo root. Both scp-style and ssh:// URLs
are accepted. In the web dashboard, SSH clones are restricted to saved
hubs so a request-supplied URL can't drive an arbitrary clone.
Ref #185
Support Gitea (gitea.com and self-hosted instances) as a git hosting
platform for installing skills. Includes both core platform integration
and a Gitea Contents API fast path for direct file downloads without
full git clone.
Platform support (P0):
- auth.go: add PlatformGitea, detect gitea hosts, resolve GITEA_TOKEN
- config.go / project.go: add gitea_hosts config field with normalization,
env var merge (SKILLSHARE_GITEA_HOSTS), and EffectiveGiteaHosts()
- source.go: add isGiteaHost() and GiteaHosts to ParseOptions
- install.go: pass GiteaHosts from config to source parsing
- install_git.go: include GITEA_TOKEN in auth error hints
API fast path (P1):
- gitea_download.go: Gitea Contents API recursive directory download
(GET /api/v1/repos/{owner}/{repo}/contents/{path}), matching the
GitHub Contents API pattern
- install_apply.go / install_discovery.go: hook Gitea API fallback
after sparse checkout, before full clone
Support CNB (Cloud Native Base, cnb.cool) as a git hosting platform for
installing skills. This adds platform detection, token authentication
via CNB_TOKEN, host configuration (cnb_hosts / SKILLSHARE_CNB_HOSTS),
and URL parsing for both direct and web URLs (including /-/tree paths).
Changes:
- auth.go: add PlatformCNB, detect cnb.cool hosts, resolve CNB_TOKEN
- config.go / project.go: add cnb_hosts config field with normalization
and env var merge, plus EffectiveCNBHosts() accessor
- source.go: add isCNBHost() and CNBHosts to ParseOptions
- install.go: pass CNBHosts from config to source parsing
- install_git.go: include CNB_TOKEN in auth error hints
Source.Branch threads the branch parameter through discovery.
cloneRepo() passes --branch to git clone when set.
source.Branch is set from parsed.opts.Branch in cmdInstall.
Ref: #90
The update handler used internal/git which ran git commands without
capturing stderr, so failures like divergent branches only showed
"exit status 128". Now runGitWithProgress captures stderr and pipes
it through install.WrapGitError for meaningful messages.
Also adds:
- extractGitFatal() strips verbose hint: lines from git output
- Force checkbox and per-item Force retry button in Update UI
- "(try force update)" / "(try --force)" hint on pull failures
When git commands fail with an empty stderr (common in --progress mode),
wrapGitError() was returning the raw exec.ExitError which only produces
"exit status 128" — giving users no clue about the actual problem.
Now extracts the exit code and maps it to actionable messages:
- exit 128: "repository not found or authentication required"
- exit 128 + token: "authentication token was rejected"
- exit 1: "check network connectivity and repository URL"
When git operations fail due to SSL certificate issues (self-signed certs,
internal CAs), the error message now suggests GIT_SSL_CAINFO, GIT_SSL_NO_VERIFY,
and SSH as alternatives instead of showing raw git stderr.
Env vars like GIT_SSL_CAINFO are already inherited via os.Environ() in
gitCommand() — the actual gap was error detection and user guidance.
- 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
Add PlatformAzureDevOps detection (dev.azure.com, ssh.dev.azure.com,
visualstudio.com) and AZURE_DEVOPS_TOKEN env var support. Token is
auto-injected via git config insteadOf rewrite, same pattern as
GITHUB_TOKEN/GITLAB_TOKEN/BITBUCKET_TOKEN.
Update error messages, sanitizeTokens redaction, environment-variables
docs with PAT creation guide and official Microsoft docs link, and
url-formats docs with Azure DevOps auth section.
The // subdir syntax (e.g., repo//skills/foo) stores meta.Subdir with
a leading "/". git rev-parse and ls-tree paths never have leading
slashes, causing tree hash lookups to fail silently.
Strip leading "/" in getSubdirTreeHash(), resolveSkillStatuses(), and
handler_check.go. Add LeadingSlash unit test and E2E runbook.
Previously `skillshare check` compared repo-level commit hashes, causing
all skills from a registry repo to show "update_available" whenever any
commit was pushed — even if the individual skill's files were unchanged.
Now each skill records its git tree hash (subdir-level SHA) at install
time. During check, a three-tier comparison is used:
1. Fast path: commit hash matches → up_to_date (zero extra cost)
2. Tree hash path: blobless fetch (~150KB) + batch ls-tree → per-skill
comparison; unchanged subdirs stay up_to_date
3. Fallback: no tree hash (old installs) → commit comparison (unchanged)
Also fixes pterm progress bar printing twice when it auto-stops at 100%.
Restructure the install package to reduce install.go size and isolate responsibilities without changing exported API signatures.
Changes:
- convert internal/install/install.go into a thin facade (types, test hook, exported wrappers)
- extract install flows into install_apply.go
- extract discovery flows into install_discovery.go
- extract update flow into install_update.go
- extract audit logic into install_audit.go
- extract git helpers into install_git.go
- extract tracked repo flow into install_tracked.go
- extract updatable/tracked query helpers into install_queries.go
- extract copy helpers into copy.go
Compatibility:
- exported API signatures are unchanged
- package remains flat as package install
- behavior is intended to remain equivalent; only code organization changed
Verification run before and after split:
- go test ./internal/install -count=1
- go test ./cmd/skillshare -run 'TestRenderInstallWarnings_CompactSuppressesExtraDetails|TestRenderBlockedAuditError_TrackedRepositoryContext' -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|TestInstall_Track_BlocksCritical' -count=1
- go test ./...