Files
skillshare/internal/server/handler_version.go
T
Willie 14bd568b9a feat: add project mode support to web dashboard (skillshare ui -p)
The web dashboard now fully supports project-level skills. When launched
with `-p` or when `.skillshare/config.yaml` is auto-detected, the UI
adapts: Git Sync and Backup pages are hidden, Config edits the project
config, Install reconciles ProjectConfig.Skills[], and targets resolve
from project-level definitions.

Server: add NewProject constructor, IsProjectMode/configPath/saveConfig/
reloadConfig helpers, branch all handlers for project mode.

Frontend: AppContext propagates isProjectMode, Layout filters nav items,
Git/Backup pages show unavailable message, Config/Dashboard adapt.

Extract ReconcileProjectSkills to internal/config for reuse by both CLI
and server. Add unit tests and integration tests for project UI.

Update docs, README, and Docker playground with project mode demo project
and skillshare-ui-p alias.
2026-02-08 17:15:59 +08:00

49 lines
1.3 KiB
Go

package server
import (
"net/http"
"skillshare/internal/config"
versioncheck "skillshare/internal/version"
)
func (s *Server) handleVersionCheck(w http.ResponseWriter, r *http.Request) {
cliVersion := versioncheck.Version
cliUpdateAvailable := false
var cliLatest *string
// CLI version check (uses 24h cache)
if result := versioncheck.Check(cliVersion); result != nil {
cliUpdateAvailable = result.UpdateAvailable
cliLatest = &result.LatestVersion
}
// Skill version (local) — always check global source for built-in skill
skillSourceDir := s.cfg.Source
if s.IsProjectMode() {
if globalCfg, err := config.Load(); err == nil {
skillSourceDir = globalCfg.Source
}
}
skillVersion := versioncheck.ReadLocalSkillVersion(skillSourceDir)
// Skill version (remote) — network call with 3s timeout
var skillLatest *string
skillUpdateAvailable := false
if skillVersion != "" {
if remote := versioncheck.FetchRemoteSkillVersion(); remote != "" {
skillLatest = &remote
skillUpdateAvailable = remote != skillVersion
}
}
writeJSON(w, map[string]any{
"cliVersion": cliVersion,
"cliLatest": cliLatest,
"cliUpdateAvailable": cliUpdateAvailable,
"skillVersion": skillVersion,
"skillLatest": skillLatest,
"skillUpdateAvailable": skillUpdateAvailable,
})
}