feat: add Nix flake and handle Nix-store installs in upgrade (#764)

* feat: add Nix flake and stop self-upgrade of Nix-store installs

Add flake.nix with packages, overlays.default, checks and a formatter,
building nix/package.nix with the unit tests in the Nix sandbox. The
version comes from the Release Please manifest, so releases need no Nix
edit. A Nix workflow runs `nix flake check` on non-docs changes.

`skillshare upgrade` now detects binaries under /nix/store/ and prints
`nix profile upgrade skillshare` instead of replacing a read-only store
path; update notices and doctor suggest the same command.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(upgrade): give Nix installs the right update path everywhere

The first flake commit sent every /nix/store binary to `nix profile
upgrade`, failed a plain `skillshare upgrade` with exit 1 even when the
CLI was current, and left the dashboard with a generic 500.

- Tell `nix profile` installs (the profile manifest lists the store path)
  from NixOS, Home Manager and overlay installs, which are told to update
  their configuration and rebuild. Detection lives in one helper shared by
  the update notice, doctor, upgrade and the dashboard.
- `upgrade` on Nix reports "already up to date" or prints the hint and
  exits 0; the built-in skill still updates.
- The dashboard runs the upgrade so the skill updates, then answers
  409 `upgrade.nix` with the command when a newer CLI waits on Nix. The
  UI shows localized text for it in all 11 locales.
- Installs skip the unit tests; the flake's checks enable them. postPatch
  lowers only the go directive's patch version and fails evaluation with
  a clear message when go.mod needs a newer Go minor. CI also builds the
  package on macOS.
- Docs, translations, the built-in skill reference and the release topic
  describe the new behaviour.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Charitarth Chugh
2026-11-04 15:53:57 +08:00
committed by GitHub
co-authored by Claude Opus 5.5
parent 83d4d0ac19
commit 64c8a3f34e
67 changed files with 864 additions and 59 deletions
+53
View File
@@ -0,0 +1,53 @@
name: Nix
# Keeps the flake building, including the Go unit tests in the Nix sandbox.
# A hash mismatch after a go.sum change means vendorHash in nix/package.nix
# needs the "got: sha256-..." value from the log.
on:
push:
branches: [main]
paths-ignore: &docs-paths
- "website/**"
- "video/**"
- "wiki/**"
- "proposals/**"
- "ai_docs/**"
- "**/*.md"
pull_request:
branches: [main]
paths-ignore: *docs-paths
workflow_dispatch:
concurrency:
group: ${{ github.event_name == 'pull_request' && format('nix-pr-{0}', github.event.pull_request.number) || format('nix-{0}', github.run_id) }}
cancel-in-progress: true
permissions:
contents: read
jobs:
check:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Nix
uses: cachix/install-nix-action@v31
- name: Flake check
run: nix flake check -L
# The unit tests do not run on macOS upstream either, so only build the
# package (with its version check) for aarch64-darwin.
build-darwin:
runs-on: macos-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Nix
uses: cachix/install-nix-action@v31
- name: Build
run: nix build -L .#skillshare
+1
View File
@@ -21,6 +21,7 @@ Thumbs.db
# Build and test output
coverage.out
/result
tmp/
__pycache__/
.cache/
+8
View File
@@ -116,6 +116,14 @@ brew install skillshare
> **Tipp:** Mit `skillshare upgrade` aktualisierst du auf die neueste Version. Der Befehl erkennt deine Installationsmethode und erledigt den Rest.
### CLI: Nix
```bash
nix profile add github:runkids/skillshare
```
Aktualisiere mit `nix profile upgrade skillshare`. Erfordert Nix 2.30+ mit aktivierten Flakes; mit älterem Nix oder Lix verwende `nix profile install`. NixOS- und Home-Manager-Konfigurationen können das `overlays.default` des Flakes verwenden.
### GitHub Actions
```yaml
+8
View File
@@ -116,6 +116,14 @@ brew install skillshare
> **Consejo:** ejecuta `skillshare upgrade` para actualizar a la última versión. Detecta tu método de instalación y se encarga del resto.
### CLI: Nix
```bash
nix profile add github:runkids/skillshare
```
Actualiza con `nix profile upgrade skillshare`. Requiere Nix 2.30+ con flakes habilitados; con Nix más antiguo o Lix, usa `nix profile install`. Las configuraciones de NixOS y Home Manager pueden usar el `overlays.default` del flake.
### GitHub Actions
```yaml
+8
View File
@@ -116,6 +116,14 @@ brew install skillshare
> **Astuce :** lancez `skillshare upgrade` pour passer à la dernière version. La commande détecte votre méthode d'installation et s'occupe du reste.
### CLI : Nix
```bash
nix profile add github:runkids/skillshare
```
Mettez à jour avec `nix profile upgrade skillshare`. Nécessite Nix 2.30+ avec les flakes activés ; avec un Nix plus ancien ou Lix, utilisez `nix profile install`. Les configurations NixOS et Home Manager peuvent utiliser l'`overlays.default` du flake.
### GitHub Actions
```yaml
+8
View File
@@ -116,6 +116,14 @@ brew install skillshare
> **ヒント:** `skillshare upgrade` で最新版に更新できます。インストール方法を自動で判別し、残りの作業も行います。
### CLI:Nix
```bash
nix profile add github:runkids/skillshare
```
更新には `nix profile upgrade skillshare` を使います。flakes を有効にした Nix 2.30 以降が必要です。古い Nix や Lix では `nix profile install` を使ってください。NixOS や Home Manager の設定では flake の `overlays.default` を使えます。
### GitHub Actions
```yaml
+8
View File
@@ -116,6 +116,14 @@ brew install skillshare
> **팁:** `skillshare upgrade`를 실행하면 최신 버전으로 업데이트됩니다. 설치 방식을 자동으로 감지해 나머지를 처리합니다.
### CLI: Nix
```bash
nix profile add github:runkids/skillshare
```
업데이트는 `nix profile upgrade skillshare`로 합니다. flakes가 활성화된 Nix 2.30 이상이 필요하며, 이전 Nix나 Lix에서는 `nix profile install`을 사용하세요. NixOS와 Home Manager 설정에서는 flake의 `overlays.default`를 사용할 수 있습니다.
### GitHub Actions
```yaml
+8
View File
@@ -116,6 +116,14 @@ brew install skillshare
> **Dica:** execute `skillshare upgrade` para atualizar para a versão mais recente. Ele detecta seu método de instalação e cuida do resto.
### CLI: Nix
```bash
nix profile add github:runkids/skillshare
```
Atualize com `nix profile upgrade skillshare`. Requer Nix 2.30+ com flakes habilitados; com Nix mais antigo ou Lix, use `nix profile install`. Configurações do NixOS e do Home Manager podem usar o `overlays.default` do flake.
### GitHub Actions
```yaml
+8
View File
@@ -116,6 +116,14 @@ brew install skillshare
> **提示:** 运行 `skillshare upgrade` 更新到最新版。它会自动判断你的安装方式并处理后续步骤。
### CLI:Nix
```bash
nix profile add github:runkids/skillshare
```
使用 `nix profile upgrade skillshare` 更新。需要启用 flakes 的 Nix 2.30 及以上版本;较旧的 Nix 或 Lix 请使用 `nix profile install`。NixOS 和 Home Manager 配置可以使用 flake 的 `overlays.default`。
### GitHub Actions
```yaml
+8
View File
@@ -116,6 +116,14 @@ brew install skillshare
> **提示:** 執行 `skillshare upgrade` 更新到最新版。它會自動判斷你的安裝方式並處理後續步驟。
### CLI:Nix
```bash
nix profile add github:runkids/skillshare
```
使用 `nix profile upgrade skillshare` 更新。需要啟用 flakes 的 Nix 2.30 以上版本;較舊的 Nix 或 Lix 請使用 `nix profile install`。NixOS 與 Home Manager 設定可以使用 flake 的 `overlays.default`。
### GitHub Actions
```yaml
+8
View File
@@ -117,6 +117,14 @@ brew install skillshare
> **Tip:** Run `skillshare upgrade` to update to the latest version. It auto-detects your install method and handles the rest.
### CLI: Nix
```bash
nix profile add github:runkids/skillshare
```
Update with `nix profile upgrade skillshare`. Requires Nix 2.30+ with flakes enabled; on older Nix or Lix, use `nix profile install`. NixOS and Home Manager configurations can use the flake's `overlays.default`.
### GitHub Actions
```yaml
+10 -3
View File
@@ -1531,7 +1531,7 @@ func checkVersionDoctor(cfg *config.Config, result *doctorResult, isProject bool
// Uses the shared versioncheck.Check which handles caching, auth, and
// proper semver comparison. Safe to call from a goroutine.
func fetchDoctorUpdateResult() *versioncheck.CheckResult {
method := detectInstallMethod()
method := versioncheck.DetectCurrentInstallMethod()
if version == "" || version == "dev" {
return &versioncheck.CheckResult{
CurrentVersion: "dev",
@@ -1547,8 +1547,15 @@ func printUpdateAvailable(update *versioncheck.CheckResult, result *doctorResult
if update == nil || !update.UpdateAvailable {
return
}
ui.Row(ui.MarkNone, "Update", ui.VersionLabel(update.CurrentVersion)+" → "+ui.VersionLabel(update.LatestVersion)+" available", doctorWidth)
result.suggest(update.InstallMethod.UpgradeCommand(), "update to "+ui.VersionLabel(update.LatestVersion))
available := ui.VersionLabel(update.CurrentVersion) + " → " + ui.VersionLabel(update.LatestVersion) + " available"
cmd := update.InstallMethod.UpgradeCommand()
if cmd == "" {
available += ui.DimText(" · " + versioncheck.NixConfigUpgradeHint)
}
ui.Row(ui.MarkNone, "Update", available, doctorWidth)
if cmd != "" {
result.suggest(cmd, "update to "+ui.VersionLabel(update.LatestVersion))
}
}
func printDoctorHelp() {
+2 -16
View File
@@ -171,28 +171,14 @@ func main() {
// Check for updates (non-blocking, silent on errors)
// Skip for upgrade (just upgraded, old version in process) and doctor (has its own check)
if !skipMaintenance && cmd != "upgrade" && cmd != "doctor" {
method := detectInstallMethod()
method := versioncheck.DetectCurrentInstallMethod()
if result := versioncheck.Check(version, method); result != nil && result.UpdateAvailable {
ui.UpdateNotification(result.CurrentVersion, result.LatestVersion, result.InstallMethod.UpgradeCommand())
ui.UpdateNotification(result.CurrentVersion, result.LatestVersion, result.InstallMethod.UpgradeInstruction())
}
}
}
}
// detectInstallMethod resolves the current executable path and determines
// how skillshare was installed (Homebrew vs direct download).
func detectInstallMethod() versioncheck.InstallMethod {
execPath, err := os.Executable()
if err != nil {
return versioncheck.InstallDirect
}
execPath, err = filepath.EvalSymlinks(execPath)
if err != nil {
return versioncheck.InstallDirect
}
return versioncheck.DetectInstallMethod(execPath)
}
func reportMigrationResults(results []config.MigrationResult) {
for _, r := range results {
switch r.Status {
+10 -3
View File
@@ -158,8 +158,8 @@ func upgradeCLIBinary(dryRun, force bool) (string, error) {
return "", err
}
// Check if installed via Homebrew
if versionpkg.DetectInstallMethod(execPath) == versionpkg.InstallBrew {
method := versionpkg.DetectInstallMethod(execPath)
if method == versionpkg.InstallBrew {
if dryRun {
printUpgradeRow(ui.MarkNone, "CLI", current+" · would run brew upgrade skillshare", time.Time{})
return "", nil
@@ -185,11 +185,18 @@ func upgradeCLIBinary(dryRun, force bool) (string, error) {
latestVersion = release.Version
}
if version == latestVersion && !force {
// --force reinstalls the same version, which only skillshare's own installs can do.
if version == latestVersion && (!force || method.IsNix()) {
printUpgradeRow(ui.MarkOK, "CLI", current+", already up to date", time.Time{})
return "", nil
}
// Replacing a file in the Nix store would corrupt it, so Nix updates it instead.
if method.IsNix() {
printUpgradeRow(ui.MarkWarn, "CLI", fmt.Sprintf("%s → v%s available · %s, %s", current, latestVersion, versionpkg.NixUpgradeNote, method.UpgradeInstruction()), time.Time{})
return "", nil
}
if dryRun {
printUpgradeRow(ui.MarkNone, "CLI", fmt.Sprintf("%s → v%s · would download", current, latestVersion), time.Time{})
return "", nil
Generated
+27
View File
@@ -0,0 +1,27 @@
{
"nodes": {
"nixpkgs": {
"locked": {
"lastModified": 1792502884,
"narHash": "sha256-IoNisKcGbUjdd45qCqywGMCYmZ5EnkxezvLII0FWwNA=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "02c087f3fe673c9e317f206a627cb6b910336dbe",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"nixpkgs": "nixpkgs"
}
}
},
"root": "root",
"version": 7
}
+34
View File
@@ -0,0 +1,34 @@
{
description = "Share skills across AI CLI tools";
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
outputs =
{ self, nixpkgs }:
let
systems = [
"x86_64-linux"
"aarch64-linux"
"aarch64-darwin"
];
forAllSystems = f: nixpkgs.lib.genAttrs systems (system: f nixpkgs.legacyPackages.${system});
in
{
packages = forAllSystems (pkgs: {
skillshare = pkgs.callPackage ./nix/package.nix { };
default = self.packages.${pkgs.stdenv.hostPlatform.system}.skillshare;
});
overlays.default = final: _prev: {
skillshare = final.callPackage ./nix/package.nix { };
};
checks = forAllSystems (pkgs: {
skillshare = self.packages.${pkgs.stdenv.hostPlatform.system}.skillshare.overrideAttrs {
doCheck = true;
};
});
formatter = forAllSystems (pkgs: pkgs.nixfmt-tree);
};
}
+14 -3
View File
@@ -25,9 +25,10 @@ type uiUpgradeResult struct {
}
var (
runUIUpgrade = defaultRunUIUpgrade
startUIRestartHelper = defaultStartUIRestartHelper
processExit = os.Exit
detectUIInstallMethod = versioncheck.DetectCurrentInstallMethod
runUIUpgrade = defaultRunUIUpgrade
startUIRestartHelper = defaultStartUIRestartHelper
processExit = os.Exit
)
func (s *Server) handleUpgrade(w http.ResponseWriter, r *http.Request) {
@@ -45,6 +46,16 @@ func (s *Server) handleUpgrade(w http.ResponseWriter, r *http.Request) {
writeError(w, http.StatusInternalServerError, err.Error())
return
}
// `upgrade` keeps a Nix-store binary and still updates the skill, so a
// newer CLI it could not install is reported with what to run instead.
if strings.Contains(result.Output, versioncheck.NixUpgradeNote) {
if method := detectUIInstallMethod(); method.IsNix() {
writeCodedError(w, http.StatusConflict, "upgrade.nix",
"skillshare is installed with Nix; "+method.UpgradeInstruction(),
map[string]string{"command": method.UpgradeCommand()})
return
}
}
writeJSON(w, map[string]any{
"ok": true,
"updated": result.Updated,
@@ -138,3 +138,62 @@ func TestHandleUpgradeNeedsSudoIsCoded(t *testing.T) {
t.Errorf("got %d %s, want 403 with upgrade.needs_sudo", rec.Code, rec.Body.String())
}
}
func stubNixUpgrade(t *testing.T, method versioncheck.InstallMethod, output string) *bool {
t.Helper()
oldDetect, oldRun := detectUIInstallMethod, runUIUpgrade
ran := false
detectUIInstallMethod = func() versioncheck.InstallMethod { return method }
runUIUpgrade = func() (uiUpgradeResult, error) {
ran = true
return uiUpgradeResult{Updated: true, Output: output}, nil
}
t.Cleanup(func() { detectUIInstallMethod, runUIUpgrade = oldDetect, oldRun })
return &ran
}
const nixPendingOutput = "CLI v1.0.0 → v1.1.0 available · " + versioncheck.NixUpgradeNote + ", run: nix profile upgrade skillshare\nSkill updated"
func TestHandleUpgradeNixProfileReportsPendingCLI(t *testing.T) {
ran := stubNixUpgrade(t, versioncheck.InstallNixProfile, nixPendingOutput)
s := &Server{}
rec := httptest.NewRecorder()
s.handleUpgrade(rec, httptest.NewRequest(http.MethodPost, "/api/upgrade", nil))
if !*ran {
t.Fatal("upgrade should still run so the built-in skill updates")
}
if rec.Code != http.StatusConflict {
t.Fatalf("status = %d body = %s", rec.Code, rec.Body.String())
}
body := rec.Body.String()
if !strings.Contains(body, `"error_code":"upgrade.nix"`) || !strings.Contains(body, `"command":"nix profile upgrade skillshare"`) {
t.Fatalf("response should carry the Nix code and command: %s", body)
}
}
func TestHandleUpgradeNixConfigReportsPendingCLI(t *testing.T) {
stubNixUpgrade(t, versioncheck.InstallNix, nixPendingOutput)
s := &Server{}
rec := httptest.NewRecorder()
s.handleUpgrade(rec, httptest.NewRequest(http.MethodPost, "/api/upgrade", nil))
body := rec.Body.String()
if rec.Code != http.StatusConflict || !strings.Contains(body, `"command":""`) || !strings.Contains(body, versioncheck.NixConfigUpgradeHint) {
t.Fatalf("status = %d body = %s", rec.Code, body)
}
}
func TestHandleUpgradeNixUpdatesSkillWhenCLICurrent(t *testing.T) {
ran := stubNixUpgrade(t, versioncheck.InstallNix, "CLI v1.1.0, already up to date\nSkill updated")
s := &Server{}
rec := httptest.NewRecorder()
s.handleUpgrade(rec, httptest.NewRequest(http.MethodPost, "/api/upgrade", nil))
if !*ran || rec.Code != http.StatusOK {
t.Fatalf("ran = %v status = %d body = %s", *ran, rec.Code, rec.Body.String())
}
}
+4 -5
View File
@@ -569,18 +569,17 @@ func RenderInlineBar(done, total int) string {
}
// UpdateNotification prints a colorful update notification.
// upgradeCmd is the command the user should run (e.g. "brew upgrade skillshare"
// or "skillshare upgrade").
func UpdateNotification(currentVersion, latestVersion, upgradeCmd string) {
// instruction says how to upgrade (e.g. "run: brew upgrade skillshare").
func UpdateNotification(currentVersion, latestVersion, instruction string) {
runLine := " " + strings.ToUpper(instruction[:1]) + instruction[1:]
if !IsTTY() {
fmt.Fprintf(os.Stderr, "\n! Update available: %s -> %s\n", currentVersion, latestVersion)
fmt.Fprintf(os.Stderr, " Run '%s' to update\n", upgradeCmd)
fmt.Fprintln(os.Stderr, runLine)
return
}
fmt.Fprintln(os.Stderr)
versionLine := fmt.Sprintf(" Version: %s -> %s", currentVersion, latestVersion)
runLine := fmt.Sprintf(" Run: %s", upgradeCmd)
w := DisplayWidth(versionLine)
if rw := DisplayWidth(runLine); rw > w {
w = rw
+1 -1
View File
@@ -25,7 +25,7 @@ func TestUpdateNotification_WritesToStderr(t *testing.T) {
}
os.Stdout = wOut
UpdateNotification("1.0.0", "2.0.0", "skillshare upgrade")
UpdateNotification("1.0.0", "2.0.0", "run: skillshare upgrade")
wErr.Close()
wOut.Close()
+54 -4
View File
@@ -3,7 +3,9 @@ package version
import (
"encoding/json"
"fmt"
"os"
"os/exec"
"path/filepath"
"strings"
)
@@ -11,18 +13,58 @@ import (
type InstallMethod int
const (
InstallDirect InstallMethod = iota // GitHub release / go install / manual
InstallBrew // Homebrew (brew install)
InstallDirect InstallMethod = iota // GitHub release / go install / manual
InstallBrew // Homebrew (brew install)
InstallNix // Nix store, from a NixOS, Home Manager or overlay configuration
InstallNixProfile // Nix store, from nix profile add
)
// UpgradeCommand returns the CLI command the user should run to upgrade.
// NixConfigUpgradeHint tells a user whose Nix configuration provides
// skillshare how to update it. The steps differ per setup, so no single
// command fits.
const NixConfigUpgradeHint = "update skillshare in your Nix configuration and rebuild"
// UpgradeCommand returns the CLI command the user should run to upgrade, or ""
// when no single command does it.
func (m InstallMethod) UpgradeCommand() string {
if m == InstallBrew {
switch m {
case InstallBrew:
return "brew upgrade skillshare"
case InstallNix:
return ""
case InstallNixProfile:
return "nix profile upgrade skillshare"
}
return "skillshare upgrade"
}
// UpgradeInstruction returns how to upgrade as a lowercase instruction:
// "run: <command>", or NixConfigUpgradeHint when there is no command.
func (m InstallMethod) UpgradeInstruction() string {
if cmd := m.UpgradeCommand(); cmd != "" {
return "run: " + cmd
}
return NixConfigUpgradeHint
}
// IsNix reports whether Nix, not skillshare, must replace the binary.
func (m InstallMethod) IsNix() bool {
return m == InstallNix || m == InstallNixProfile
}
// DetectCurrentInstallMethod determines how the running binary was installed,
// falling back to InstallDirect when its path cannot be resolved.
func DetectCurrentInstallMethod() InstallMethod {
execPath, err := os.Executable()
if err != nil {
return InstallDirect
}
if execPath, err = filepath.EvalSymlinks(execPath); err != nil {
return InstallDirect
}
return DetectInstallMethod(execPath)
}
// DetectInstallMethod determines the installation method from the resolved
// executable path. The caller should resolve symlinks before calling this.
func DetectInstallMethod(execPath string) InstallMethod {
@@ -36,6 +78,10 @@ func DetectInstallMethod(execPath string) InstallMethod {
return InstallBrew
}
}
// The Nix store is read-only to its users; Nix itself must replace the binary.
if strings.HasPrefix(execPath, "/nix/store/") {
return detectNixMethod(execPath, nixProfileManifests())
}
return InstallDirect
}
@@ -76,3 +122,7 @@ const SudoUpgradeHint = "skillshare upgrade"
// SudoUpgradeHintPrefix precedes SudoUpgradeHint in the CLI error.
const SudoUpgradeHintPrefix = "run in a terminal: "
// NixUpgradeNote marks the upgrade row that a Nix install prints when a newer
// CLI exists. The dashboard matches on it to explain why the CLI was kept.
const NixUpgradeNote = "installed with Nix"
+96
View File
@@ -0,0 +1,96 @@
package version
import (
"os"
"path/filepath"
"testing"
)
func TestDetectInstallMethod(t *testing.T) {
tests := []struct {
name string
execPath string
want InstallMethod
}{
{name: "homebrew arm", execPath: "/opt/homebrew/Cellar/skillshare/0.26.3/bin/skillshare", want: InstallBrew},
{name: "linuxbrew", execPath: "/home/linuxbrew/.linuxbrew/Cellar/skillshare/0.26.3/bin/skillshare", want: InstallBrew},
{name: "install script", execPath: "/home/me/.local/bin/skillshare", want: InstallDirect},
{name: "nix-like name outside the store", execPath: "/home/me/nix/store/skillshare", want: InstallDirect},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
if got := DetectInstallMethod(tt.execPath); got != tt.want {
t.Fatalf("DetectInstallMethod(%q) = %v, want %v", tt.execPath, got, tt.want)
}
})
}
}
func TestDetectInstallMethodNixStore(t *testing.T) {
if got := DetectInstallMethod("/nix/store/abc123-skillshare-0.26.3/bin/skillshare"); !got.IsNix() {
t.Fatalf("DetectInstallMethod(nix store) = %v, want a Nix method", got)
}
}
func TestDetectNixMethod(t *testing.T) {
const execPath = "/nix/store/abc123-skillshare-0.26.3/bin/skillshare"
writeManifest := func(t *testing.T, body string) string {
t.Helper()
path := filepath.Join(t.TempDir(), "manifest.json")
if err := os.WriteFile(path, []byte(body), 0o644); err != nil {
t.Fatal(err)
}
return path
}
tests := []struct {
name string
manifest string
want InstallMethod
}{
{
name: "nix profile add",
manifest: `{"version":3,"elements":{"skillshare":{"storePaths":["/nix/store/abc123-skillshare-0.26.3"]}}}`,
want: InstallNixProfile,
},
{
name: "home manager combined package",
manifest: `{"version":3,"elements":{"home-manager-path":{"storePaths":["/nix/store/def456-home-manager-path"]}}}`,
want: InstallNix,
},
{
name: "older skillshare in the profile",
manifest: `{"version":3,"elements":{"skillshare":{"storePaths":["/nix/store/old999-skillshare-0.26.2"]}}}`,
want: InstallNix,
},
{
name: "older manifest without element names",
manifest: `{"version":2,"elements":[{"storePaths":["/nix/store/abc123-skillshare-0.26.3"]}]}`,
want: InstallNix,
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
manifests := []string{filepath.Join(t.TempDir(), "missing.json"), writeManifest(t, tt.manifest)}
if got := detectNixMethod(execPath, manifests); got != tt.want {
t.Fatalf("detectNixMethod = %v, want %v", got, tt.want)
}
})
}
}
func TestUpgradeInstruction(t *testing.T) {
tests := []struct {
method InstallMethod
want string
}{
{method: InstallDirect, want: "run: skillshare upgrade"},
{method: InstallBrew, want: "run: brew upgrade skillshare"},
{method: InstallNixProfile, want: "run: nix profile upgrade skillshare"},
{method: InstallNix, want: NixConfigUpgradeHint},
}
for _, tt := range tests {
if got := tt.method.UpgradeInstruction(); got != tt.want {
t.Fatalf("UpgradeInstruction(%v) = %q, want %q", tt.method, got, tt.want)
}
}
}
+64
View File
@@ -0,0 +1,64 @@
package version
import (
"encoding/json"
"os"
"path/filepath"
"slices"
"strings"
)
// nixProfileElement is the name `nix profile add github:runkids/skillshare`
// gives the flake's default package, and the one the upgrade command names.
const nixProfileElement = "skillshare"
// nixProfileManifests returns the manifests of the user's `nix profile`
// profiles: ~/.nix-profile, and its XDG location when use-xdg-base-directories
// is set.
func nixProfileManifests() []string {
var paths []string
if home, err := os.UserHomeDir(); err == nil {
paths = append(paths, filepath.Join(home, ".nix-profile", "manifest.json"))
state := os.Getenv("XDG_STATE_HOME")
if state == "" {
state = filepath.Join(home, ".local", "state")
}
paths = append(paths, filepath.Join(state, "nix", "profile", "manifest.json"))
}
return paths
}
// nixProfileManifest mirrors the subset of a version 3 `nix profile` manifest
// we need. nix-env profiles have no manifest.json, and older versions list
// elements without names, so neither parses into this.
type nixProfileManifest struct {
Elements map[string]struct {
StorePaths []string `json:"storePaths"`
} `json:"elements"`
}
// detectNixMethod tells a `nix profile` install, which one command upgrades,
// from a binary a NixOS, Home Manager or nix-env setup provides. Home Manager
// adds one combined package to the profile, so the skillshare store path is
// only an element's own when the user added skillshare directly.
func detectNixMethod(execPath string, manifests []string) InstallMethod {
parts := strings.SplitN(execPath, "/", 5) // "", "nix", "store", "<hash>-<name>", rest
if len(parts) < 4 {
return InstallNix
}
storePath := "/nix/store/" + parts[3]
for _, manifest := range manifests {
data, err := os.ReadFile(manifest)
if err != nil {
continue
}
var m nixProfileManifest
if json.Unmarshal(data, &m) != nil {
continue
}
if slices.Contains(m.Elements[nixProfileElement].StorePaths, storePath) {
return InstallNixProfile
}
}
return InstallNix
}
+112
View File
@@ -0,0 +1,112 @@
{
lib,
buildGoModule,
gitMinimal,
runtimeShell,
versionCheckHook,
writableTmpDirAsHomeHook,
# Release Please keeps this manifest at the latest released version.
version ? (lib.importJSON ../.github/release-please-manifest.json).".",
}:
let
inherit (lib) fileset;
goModVersion = lib.removePrefix "go " (
lib.findFirst (lib.hasPrefix "go ") (throw "go.mod has no go directive") (
lib.splitString "\n" (builtins.readFile ../go.mod)
)
);
in
buildGoModule (finalAttrs: {
pname = "skillshare";
inherit version;
# Unit tests read files across the repository (schemas, ui locales, scripts),
# so exclude only what no Go code reads; docs edits then cause no rebuild.
src = fileset.toSource {
root = ../.;
fileset = fileset.difference ../. (
fileset.unions (
map fileset.maybeMissing [
../ai_docs
../proposals
../video
../website
../wiki
../nix
../flake.nix
../flake.lock
../CHANGELOG.md
]
++ [ (fileset.fileFilter (file: lib.hasPrefix "README" file.name) ../.) ]
)
);
};
# Update when go.sum changes; the Nix CI job prints the new value.
vendorHash = "sha256-vZxkLUP6E+tyat87VBpW3kr+JtXJizTHmEkiJDoZzbg=";
# go.mod pins the newest Go patch release, which nixpkgs may not ship yet.
# Lower only the patch; a newer minor needs a newer toolchain.
postPatch =
let
goVersion = finalAttrs.passthru.go.version;
in
lib.optionalString (lib.versionOlder goVersion goModVersion) (
assert lib.assertMsg (lib.versions.majorMinor goVersion == lib.versions.majorMinor goModVersion)
"go.mod requires Go ${goModVersion}, but nixpkgs provides Go ${goVersion}; run `nix flake update`";
''
go mod edit -go=${goVersion}
''
);
subPackages = [ "cmd/skillshare" ];
env.CGO_ENABLED = 0;
ldflags = [
"-s"
"-w"
"-X main.version=${finalAttrs.version}"
];
nativeCheckInputs = [
gitMinimal
writableTmpDirAsHomeHook
];
# Tests bind loopback servers.
__darwinAllowLocalNetworking = true;
# The sandbox has neither /bin/bash nor /usr/bin/env, which test scripts use.
preCheck = ''
patchShebangs .devcontainer/bin
find cmd internal -name '*_test.go' -exec \
sed -i -E 's@#!(/bin/bash|/usr/bin/env bash)@#!${runtimeShell}@' {} +
'';
# Installs skip the tests; the flake's checks enable them.
doCheck = false;
# Unit tests only, matching `scripts/test.sh --unit`. Tests run like upstream
# CI: with cgo (some rely on its deadlock behavior) and without -trimpath
# (some locate the repository through runtime.Caller).
checkPhase = ''
runHook preCheck
CGO_ENABLED=1 go test -p $NIX_BUILD_CORES -trimpath=false ./cmd/... ./internal/...
runHook postCheck
'';
nativeInstallCheckInputs = [ versionCheckHook ];
versionCheckProgramArg = "version";
doInstallCheck = true;
meta = {
description = "Share skills across AI CLI tools";
homepage = "https://github.com/runkids/skillshare";
changelog = "https://github.com/runkids/skillshare/releases/tag/v${finalAttrs.version}";
license = lib.licenses.mit;
mainProgram = "skillshare";
platforms = lib.platforms.unix;
};
})
+3
View File
@@ -109,6 +109,9 @@ skillshare upgrade --dry-run # Preview
`upgrade --skill --force` installs without that prompt. Use this only when installation
is requested. `init --skill` also opts in explicitly.
**Nix installs:** the CLI binary is never replaced, even with `--force`; `upgrade` prints
`nix profile upgrade skillshare` or says to rebuild the Nix configuration. The skill still updates.
**After upgrading skill:** `skillshare sync`
`list` and `status` warn when an enabled `follow_source_links` policy skips an unavailable first-level source link; healthy skills remain in the inventory. With `--json`, warnings go to stderr so stdout stays valid JSON.
+3 -2
View File
@@ -2,11 +2,12 @@ import { useState, useEffect } from 'react';
import { useQuery } from '@tanstack/react-query';
import { X, Copy, Check, CircleArrowUp } from 'lucide-react';
import { queryKeys, staleTimes } from '../lib/queryKeys';
import { api, ApiError } from '../api/client';
import { api } from '../api/client';
import type { VersionCheck } from '../api/client';
import DialogShell from './DialogShell';
import Button from './Button';
import { useT } from '../i18n';
import { upgradeErrorMessage } from '../lib/upgradeError';
const DISMISSED_KEY = 'ss-update-dialog-dismissed';
@@ -101,7 +102,7 @@ export default function UpdateDialog() {
await api.restartApp({ clearCache: false });
void waitForRestartThenReload();
} catch (err) {
setStatus(err instanceof ApiError && err.code === 'upgrade.needs_sudo' ? t('updateDialog.needsSudo') : (err as Error).message);
setStatus(upgradeErrorMessage(err, t));
setUpdating(false);
}
};
+2
View File
@@ -938,6 +938,8 @@
"update.stale.pruned.other": "{count} Skills gelöscht. Im Papierkorb 7 Tage lang wiederherstellbar.",
"updateDialog.copyCommand": "Befehl kopieren",
"updateDialog.needsSudo": "Für das Update wird dein Passwort benötigt. Führe skillshare upgrade in einem Terminal aus.",
"updateDialog.nixConfig": "skillshare ist mit Nix installiert. Aktualisiere skillshare in deiner Nix-Konfiguration und baue neu.",
"updateDialog.nixProfile": "skillshare ist mit Nix installiert. Führe {command} in einem Terminal aus.",
"updateDialog.newVersion": "Neue Version verfügbar",
"updateDialog.restartDev": "DEV-Modus-Neustart simuliert.",
"updateDialog.restartManual": "Aktualisiert. Starte mit skillshare ui start neu, falls diese Seite keine Verbindung herstellt.",
+2
View File
@@ -945,6 +945,8 @@
"syncResult.upToDate.other": "{count} targets already up to date",
"updateDialog.copyCommand": "Copy command",
"updateDialog.needsSudo": "Updating needs your password. Run skillshare upgrade in a terminal.",
"updateDialog.nixConfig": "skillshare is installed with Nix. Update skillshare in your Nix configuration and rebuild.",
"updateDialog.nixProfile": "skillshare is installed with Nix. Run {command} in a terminal.",
"updateDialog.newVersion": "New version available",
"updateDialog.restartDev": "DEV mode restart simulated.",
"updateDialog.restartManual": "Updated. Restart with skillshare ui start if this page does not reconnect.",
+2
View File
@@ -938,6 +938,8 @@
"update.stale.pruned.other": "Se purgaron {count} skills. Restáuralos desde la papelera en 7 días.",
"updateDialog.copyCommand": "Copiar comando",
"updateDialog.needsSudo": "La actualización necesita tu contraseña. Ejecuta skillshare upgrade en una terminal.",
"updateDialog.nixConfig": "skillshare está instalado con Nix. Actualiza skillshare en tu configuración de Nix y vuelve a compilarla.",
"updateDialog.nixProfile": "skillshare está instalado con Nix. Ejecuta {command} en una terminal.",
"updateDialog.newVersion": "Nueva versión disponible",
"updateDialog.restartDev": "Reinicio en modo DEV simulado.",
"updateDialog.restartManual": "Actualizado. Reinicia con skillshare ui start si esta página no se reconecta.",
+2
View File
@@ -938,6 +938,8 @@
"update.stale.pruned.other": "{count} skill پاک‌سازی شد. تا ۷ روز از سطل زباله قابل بازیابی است.",
"updateDialog.copyCommand": "کپی دستور",
"updateDialog.needsSudo": "به‌روزرسانی به گذرواژهٔ شما نیاز دارد. در ترمینال skillshare upgrade را اجرا کنید.",
"updateDialog.nixConfig": "skillshare با Nix نصب شده است. skillshare را در پیکربندی Nix خود به‌روز کنید و دوباره بسازید.",
"updateDialog.nixProfile": "skillshare با Nix نصب شده است. در ترمینال {command} را اجرا کنید.",
"updateDialog.newVersion": "نسخه جدید موجود است",
"updateDialog.restartDev": "راه‌اندازی مجدد در حالت DEV شبیه‌سازی شد.",
"updateDialog.restartManual": "به‌روزرسانی شد. اگر این صفحه دوباره وصل نشد، با skillshare ui start دوباره راه‌اندازی کنید.",
+2
View File
@@ -938,6 +938,8 @@
"update.stale.pruned.other": "{count} skills purgés. Restaurables depuis la corbeille pendant 7 jours.",
"updateDialog.copyCommand": "Copier la commande",
"updateDialog.needsSudo": "La mise à jour nécessite votre mot de passe. Exécutez skillshare upgrade dans un terminal.",
"updateDialog.nixConfig": "skillshare est installé avec Nix. Mettez à jour skillshare dans votre configuration Nix puis reconstruisez-la.",
"updateDialog.nixProfile": "skillshare est installé avec Nix. Exécutez {command} dans un terminal.",
"updateDialog.newVersion": "Nouvelle version disponible",
"updateDialog.restartDev": "Redémarrage simulé en mode DEV.",
"updateDialog.restartManual": "Mise à jour effectuée. Redémarrez avec skillshare ui start si cette page ne se reconnecte pas.",
+2
View File
@@ -938,6 +938,8 @@
"update.stale.pruned.other": "{count} skill dihapus. Pulihkan dari Sampah dalam 7 hari.",
"updateDialog.copyCommand": "Salin perintah",
"updateDialog.needsSudo": "Pembaruan memerlukan kata sandi Anda. Jalankan skillshare upgrade di terminal.",
"updateDialog.nixConfig": "skillshare dipasang dengan Nix. Perbarui skillshare di konfigurasi Nix Anda lalu bangun ulang.",
"updateDialog.nixProfile": "skillshare dipasang dengan Nix. Jalankan {command} di terminal.",
"updateDialog.newVersion": "Versi baru tersedia",
"updateDialog.restartDev": "Mulai ulang mode DEV disimulasikan.",
"updateDialog.restartManual": "Diperbarui. Jalankan ulang dengan skillshare ui start jika halaman ini tidak tersambung kembali.",
+2
View File
@@ -938,6 +938,8 @@
"update.stale.pruned.other": "{count} 件の skill を削除しました。7 日以内ならゴミ箱から復元できます。",
"updateDialog.copyCommand": "コマンドをコピー",
"updateDialog.needsSudo": "更新にはパスワードが必要です。ターミナルで skillshare upgrade を実行してください。",
"updateDialog.nixConfig": "skillshare は Nix でインストールされています。Nix の設定で skillshare を更新し、リビルドしてください。",
"updateDialog.nixProfile": "skillshare は Nix でインストールされています。ターミナルで {command} を実行してください。",
"updateDialog.newVersion": "新しいバージョンが利用可能です",
"updateDialog.restartDev": "DEV モードの再起動をシミュレートしました。",
"updateDialog.restartManual": "更新しました。このページが再接続しない場合は、skillshare ui start で再起動してください。",
+2
View File
@@ -938,6 +938,8 @@
"update.stale.pruned.other": "skill {count}개를 정리했습니다. 7일 안에 휴지통에서 복원할 수 있습니다.",
"updateDialog.copyCommand": "명령 복사",
"updateDialog.needsSudo": "업데이트하려면 비밀번호가 필요합니다. 터미널에서 skillshare upgrade 를 실행하세요.",
"updateDialog.nixConfig": "skillshare가 Nix로 설치되었습니다. Nix 설정에서 skillshare를 업데이트한 뒤 다시 빌드하세요.",
"updateDialog.nixProfile": "skillshare가 Nix로 설치되었습니다. 터미널에서 {command} 를 실행하세요.",
"updateDialog.newVersion": "새 버전 사용 가능",
"updateDialog.restartDev": "DEV 모드 재시작을 시뮬레이션했습니다.",
"updateDialog.restartManual": "업데이트되었습니다. 이 페이지가 다시 연결되지 않으면 skillshare ui start로 다시 시작하세요.",
+2
View File
@@ -938,6 +938,8 @@
"update.stale.pruned.other": "{count} skills removidas. Restaure da lixeira em até 7 dias.",
"updateDialog.copyCommand": "Copiar comando",
"updateDialog.needsSudo": "A atualização precisa da sua senha. Execute skillshare upgrade em um terminal.",
"updateDialog.nixConfig": "O skillshare foi instalado com Nix. Atualize o skillshare na sua configuração do Nix e reconstrua.",
"updateDialog.nixProfile": "O skillshare foi instalado com Nix. Execute {command} em um terminal.",
"updateDialog.newVersion": "Nova versão disponível",
"updateDialog.restartDev": "Reinicialização em modo DEV simulada.",
"updateDialog.restartManual": "Atualizado. Reinicie com skillshare ui start se esta página não reconectar.",
+2
View File
@@ -938,6 +938,8 @@
"update.stale.pruned.other": "已清除 {count} 个 skills,7 天内可从回收站恢复。",
"updateDialog.copyCommand": "复制命令",
"updateDialog.needsSudo": "更新需要输入密码,请在终端执行 skillshare upgrade。",
"updateDialog.nixConfig": "skillshare 通过 Nix 安装。请在 Nix 配置中更新 skillshare 并重新构建。",
"updateDialog.nixProfile": "skillshare 通过 Nix 安装。请在终端运行 {command}。",
"updateDialog.newVersion": "有新版本可用",
"updateDialog.restartDev": "已模拟 DEV 模式重启。",
"updateDialog.restartManual": "已更新。如果此页面没有重新连接,请执行 skillshare ui start 重启。",
+2
View File
@@ -938,6 +938,8 @@
"update.stale.pruned.other": "已清除 {count} 個 skills,7 天內可從垃圾桶還原。",
"updateDialog.copyCommand": "複製指令",
"updateDialog.needsSudo": "更新需要輸入密碼,請在終端機執行 skillshare upgrade。",
"updateDialog.nixConfig": "skillshare 透過 Nix 安裝。請在 Nix 設定中更新 skillshare 並重新建置。",
"updateDialog.nixProfile": "skillshare 透過 Nix 安裝。請在終端機執行 {command}。",
"updateDialog.newVersion": "有新版本可用",
"updateDialog.restartDev": "已模擬 DEV 模式重新啟動。",
"updateDialog.restartManual": "已更新。如果此頁面沒有重新連線,請執行 skillshare ui start 重新啟動。",
+20
View File
@@ -0,0 +1,20 @@
import { describe, expect, it } from 'vitest';
import { ApiError } from '../api/client';
import { upgradeErrorMessage } from './upgradeError';
const t = ((key: string, params?: Record<string, unknown>) => (params?.command ? `${key}:${params.command}` : key)) as Parameters<typeof upgradeErrorMessage>[1];
describe('upgradeErrorMessage', () => {
it('names the nix profile command', () => {
const err = new ApiError(409, 'x', { code: 'upgrade.nix', params: { command: 'nix profile upgrade skillshare' } });
expect(upgradeErrorMessage(err, t)).toBe('updateDialog.nixProfile:nix profile upgrade skillshare');
});
it('points a Nix configuration at a rebuild', () => {
const err = new ApiError(409, 'x', { code: 'upgrade.nix', params: { command: '' } });
expect(upgradeErrorMessage(err, t)).toBe('updateDialog.nixConfig');
});
it('keeps the sudo hint and other messages', () => {
expect(upgradeErrorMessage(new ApiError(403, 'x', { code: 'upgrade.needs_sudo' }), t)).toBe('updateDialog.needsSudo');
expect(upgradeErrorMessage(new Error('boom'), t)).toBe('boom');
});
});
+12
View File
@@ -0,0 +1,12 @@
import { ApiError } from '../api/client';
import type { useT } from '../i18n';
/** Turns a failed POST /api/upgrade into the message to show. */
export function upgradeErrorMessage(err: unknown, t: ReturnType<typeof useT>): string {
if (err instanceof ApiError && err.code === 'upgrade.needs_sudo') return t('updateDialog.needsSudo');
if (err instanceof ApiError && err.code === 'upgrade.nix') {
const command = typeof err.params?.command === 'string' ? err.params.command : '';
return command ? t('updateDialog.nixProfile', { command }) : t('updateDialog.nixConfig');
}
return (err as Error).message;
}
+3 -2
View File
@@ -2,9 +2,10 @@ import { useMemo, useState } from 'react';
import { Link } from 'react-router-dom';
import { useQuery, useQueryClient } from '@tanstack/react-query';
import { AlertTriangle, ArrowUpCircle, CheckCircle2, ChevronDown, ChevronRight, Info, Pencil, RefreshCw, XCircle } from 'lucide-react';
import { api, ApiError, type DoctorCheck } from '../api/client';
import { api, type DoctorCheck } from '../api/client';
import Button from '../components/Button';
import CopyButton from '../components/CopyButton';
import { upgradeErrorMessage } from '../lib/upgradeError';
import PageHeader from '../components/PageHeader';
import { PageSkeleton } from '../components/Skeleton';
import { useAppContext } from '../context/AppContext';
@@ -74,7 +75,7 @@ export default function DoctorPage() {
setUpgradeMessage(t('updateDialog.restartManual'));
setUpgrading(false);
} catch (e) {
setUpgradeMessage(e instanceof ApiError && e.code === 'upgrade.needs_sudo' ? t('updateDialog.needsSudo') : (e as Error).message);
setUpgradeMessage(upgradeErrorMessage(e, t));
setUpgrading(false);
}
};
+16 -1
View File
@@ -42,8 +42,23 @@ curl -fsSL https://raw.githubusercontent.com/runkids/skillshare/main/install.sh
irm https://raw.githubusercontent.com/runkids/skillshare/main/install.ps1 | iex
```
**Nix (Linux / Apple Silicon macOS):**
```bash
nix profile add github:runkids/skillshare
```
Update with `nix profile upgrade skillshare`. Requires Nix 2.30+ with flakes enabled; on older Nix or Lix, use `nix profile install`. For NixOS or Home Manager, add the flake as an input and use its overlay:
```nix
# flake.nix
inputs.skillshare.url = "github:runkids/skillshare";
# NixOS or Home Manager module
nixpkgs.overlays = [ inputs.skillshare.overlays.default ];
environment.systemPackages = [ pkgs.skillshare ]; # or home.packages
```
:::tip Updating later
`skillshare upgrade` detects how you installed (Homebrew, script, manual) and updates the CLI in place.
`skillshare upgrade` detects how you installed (Homebrew, script, manual) and updates the CLI in place. For a Nix install, it leaves the CLI to Nix and says how to update it: `nix profile upgrade skillshare` for a `nix profile` install, or a rebuild of your NixOS or Home Manager configuration.
:::
## 2. Initialize
@@ -362,6 +362,8 @@ Next
brew upgrade skillshare update to v1.3.0
```
A `nix profile` install gets `nix profile upgrade skillshare` as its Next line. When NixOS or Home Manager provides skillshare, the Update row says to update your Nix configuration and rebuild, and there is no Next line for it.
## JSON Output
Use `--json` for machine-readable output in CI pipelines and automation:
+4 -2
View File
@@ -187,7 +187,7 @@ The web dashboard exposes a REST API at `/api/`. All endpoints return JSON.
| GET | `/api/doctor` | Run all health checks (JSON) |
| GET | `/api/health` | Liveness probe; returns `200` once the server is ready |
| GET | `/api/version` | Current/latest version + whether an upgrade is available |
| POST | `/api/upgrade` | Run `skillshare upgrade` in place (returns `devMode: true` when the binary is a dev build) |
| POST | `/api/upgrade` | Run `skillshare upgrade` in place (returns `devMode: true` when the binary is a dev build, and `409` with code `upgrade.nix` for a Nix install) |
| POST | `/api/restart` | Restart the local UI server; optional `{ "clearCache": true }` body clears cached UI assets first |
## In-place Upgrade
@@ -198,6 +198,8 @@ When the dashboard detects that a newer CLI release is available, the **Update**
2. Once the new binary is in place, the UI calls `POST /api/restart` to restart the local server.
3. The browser polls `GET /api/health` and reloads automatically once the new server is ready.
If skillshare is installed with Nix, the endpoint refuses with `409` (`upgrade.nix`) and the dialog shows how to update through Nix instead. See [upgrade](./upgrade.md#nix-users).
If the running binary is a development build (`version == "dev"`), the upgrade endpoint returns `devMode: true` and the UI simulates a restart without modifying anything on disk.
If the auto-reload doesn't complete, the dialog tells you to run `skillshare ui start` to bring the background server back up.
@@ -279,7 +281,7 @@ The dashboard reads and writes `.skillshare/config.yaml`, syncs to project-local
## Homebrew Note
All install methods (Homebrew, installer script, manual binary) use runtime UI download. When you run `skillshare ui`, it automatically downloads the UI assets from GitHub on first launch. After that, the cached assets are used offline.
All install methods (Homebrew, Nix, installer script, manual binary) use runtime UI download. When you run `skillshare ui`, it automatically downloads the UI assets from GitHub on first launch. After that, the cached assets are used offline.
To clear the downloaded UI cache:
@@ -60,6 +60,18 @@ You can also use Homebrew directly:
brew upgrade skillshare
```
## Nix Users {#nix-users}
If you installed with Nix, `skillshare upgrade` leaves the CLI alone, because replacing a file in the Nix store would corrupt it. When a newer version exists, it tells you how to get it instead. For `nix profile add`, that is:
```bash
nix profile upgrade skillshare
```
When a NixOS, Home Manager or overlay configuration provides skillshare, update skillshare in that configuration (for a flake input, `nix flake update skillshare`) and rebuild. The dashboard's upgrade button shows the same advice.
`skillshare upgrade --skill` still updates the built-in skill.
## Examples
```bash
+1 -1
View File
@@ -30,7 +30,7 @@ skillshare version 0.16.6
When a newer version is available, `skillshare` displays an update notification after commands that support it. The notification is **Homebrew-aware**: if skillshare was installed via Homebrew, it queries `brew info` for the latest formula version and suggests `brew upgrade skillshare`; otherwise it checks GitHub releases and suggests `skillshare upgrade`.
Detection is automatic — skillshare resolves its own executable path and checks whether it resides under a Homebrew Cellar prefix (e.g. `/opt/homebrew/Cellar/skillshare/`).
Detection is automatic — skillshare resolves its own executable path and checks whether it resides under a Homebrew Cellar prefix (e.g. `/opt/homebrew/Cellar/skillshare/`). A binary under `/nix/store/` checks GitHub releases. It suggests `nix profile upgrade skillshare` when the binary is in your `nix profile`, and otherwise tells you to update skillshare in your Nix configuration and rebuild.
Version checks are cached for 24 hours at `~/.cache/skillshare/version-check.json`.
@@ -42,8 +42,23 @@ curl -fsSL https://raw.githubusercontent.com/runkids/skillshare/main/install.sh
irm https://raw.githubusercontent.com/runkids/skillshare/main/install.ps1 | iex
```
**Nix(Linux / Apple Silicon macOS):**
```bash
nix profile add github:runkids/skillshare
```
更新には `nix profile upgrade skillshare` を使います。flakes を有効にした Nix 2.30 以降が必要です。古い Nix や Lix では `nix profile install` を使ってください。NixOS や Home Manager では flake を input に追加し、overlay を使います。
```nix
# flake.nix
inputs.skillshare.url = "github:runkids/skillshare";
# NixOS or Home Manager module
nixpkgs.overlays = [ inputs.skillshare.overlays.default ];
environment.systemPackages = [ pkgs.skillshare ]; # or home.packages
```
:::tip あとから更新する
`skillshare upgrade` はインストール方法(Homebrew、スクリプト、手動)を判別し、その場で CLI を更新します。
`skillshare upgrade` はインストール方法(Homebrew、スクリプト、手動)を判別し、その場で CLI を更新します。Nix でインストールした場合は CLI を Nix に任せ、更新方法を表示します。`nix profile` でのインストールなら `nix profile upgrade skillshare`、NixOS や Home Manager なら設定のリビルドです。
:::
## 2. 初期化する
@@ -357,6 +357,8 @@ Next
brew upgrade skillshare update to v1.3.0
```
`nix profile` でインストールした場合、Next 行は `nix profile upgrade skillshare` になります。NixOS や Home Manager が skillshare を提供している場合は、Update 行に Nix の設定を更新してリビルドするよう表示され、Next 行は出ません。
## JSON 出力
CI パイプラインや自動化のために、機械可読な出力には `--json` を使用します。
@@ -187,7 +187,7 @@ Web ダッシュボードは `/api/` に REST API を公開しています。す
| GET | `/api/doctor` | すべてのヘルスチェックを実行(JSON) |
| GET | `/api/health` | 死活監視プローブ。サーバーの準備ができると `200` を返す |
| GET | `/api/version` | 現在/最新バージョンとアップグレードの可否 |
| POST | `/api/upgrade` | `skillshare upgrade` をその場で実行(バイナリが開発ビルドの場合は `devMode: true` を返す) |
| POST | `/api/upgrade` | `skillshare upgrade` をその場で実行(バイナリが開発ビルドの場合は `devMode: true` を返し、Nix でのインストールではコード `upgrade.nix` の `409` を返す) |
| POST | `/api/restart` | ローカル UI サーバーを再起動。任意の `{ "clearCache": true }` ボディでキャッシュされた UI アセットを先にクリア |
## インプレースアップグレード
@@ -198,6 +198,8 @@ Web ダッシュボードは `/api/` に REST API を公開しています。す
2. 新しいバイナリが配置されると、UI が `POST /api/restart` を呼び出してローカルサーバーを再起動します。
3. ブラウザは `GET /api/health` をポーリングし、新しいサーバーの準備ができ次第、自動的にリロードします。
skillshare を Nix でインストールしている場合、エンドポイントは `409`(`upgrade.nix`)で拒否し、ダイアログには Nix での更新方法が表示されます。[upgrade](./upgrade.md#nix-users) を参照してください。
実行中のバイナリが開発ビルド(`version == "dev"`)である場合、upgrade エンドポイントは `devMode: true` を返し、UI はディスク上の何も変更せずに再起動をシミュレートします。
自動リロードが完了しない場合、ダイアログは `skillshare ui start` を実行してバックグラウンドサーバーを復旧するよう案内します。
@@ -279,7 +281,7 @@ skillshare ui -p
## Homebrew に関する補足
すべてのインストール方法(Homebrew、インストーラースクリプト、手動バイナリ)はランタイム UI ダウンロードを使用します。`skillshare ui` を実行すると、初回起動時に GitHub から UI アセットが自動的にダウンロードされます。以降はキャッシュされたアセットがオフラインで使用されます。
すべてのインストール方法(Homebrew、Nix、インストーラースクリプト、手動バイナリ)はランタイム UI ダウンロードを使用します。`skillshare ui` を実行すると、初回起動時に GitHub から UI アセットが自動的にダウンロードされます。以降はキャッシュされたアセットがオフラインで使用されます。
ダウンロード済みの UI キャッシュをクリアするには:
@@ -60,6 +60,18 @@ Homebrew を直接使うこともできます。
brew upgrade skillshare
```
## Nix ユーザー {#nix-users}
Nix でインストールした場合、Nix store 内のファイルを置き換えると store が壊れるため、`skillshare upgrade` は CLI を更新しません。新しいバージョンがある場合は、代わりに更新方法を表示します。`nix profile add` でインストールした場合は次のコマンドです。
```bash
nix profile upgrade skillshare
```
NixOS、Home Manager、overlay の設定で skillshare を提供している場合は、その設定で skillshare を更新し(flake input なら `nix flake update skillshare`)、リビルドしてください。ダッシュボードの更新ボタンも同じ案内を表示します。
組み込みスキルは引き続き `skillshare upgrade --skill` で更新できます。
## 例
```bash
@@ -30,7 +30,7 @@ skillshare version 0.16.6
新しいバージョンが利用可能な場合、`skillshare` は対応しているコマンドの実行後にアップデート通知を表示します。この通知は **Homebrew を認識**します。skillshare が Homebrew でインストールされていた場合は `brew info` に問い合わせて最新の formula バージョンを確認し、`brew upgrade skillshare` を提案します。それ以外の場合は GitHub のリリースを確認し、`skillshare upgrade` を提案します。
検出は自動です。skillshare は自身の実行ファイルのパスを解決し、Homebrew の Cellar プレフィックス配下にあるかどうかを確認します(例: `/opt/homebrew/Cellar/skillshare/`)。
検出は自動です。skillshare は自身の実行ファイルのパスを解決し、Homebrew の Cellar プレフィックス配下にあるかどうかを確認します(例: `/opt/homebrew/Cellar/skillshare/`)。`/nix/store/` 配下のバイナリは GitHub のリリースを確認します。バイナリが `nix profile` にある場合は `nix profile upgrade skillshare` を提案し、それ以外の場合は Nix の設定で skillshare を更新してリビルドするよう案内します。
バージョンチェックの結果は `~/.cache/skillshare/version-check.json` に 24 時間キャッシュされます。
@@ -42,8 +42,23 @@ curl -fsSL https://raw.githubusercontent.com/runkids/skillshare/main/install.sh
irm https://raw.githubusercontent.com/runkids/skillshare/main/install.ps1 | iex
```
**Nix (Linux / Apple Silicon macOS):**
```bash
nix profile add github:runkids/skillshare
```
업데이트는 `nix profile upgrade skillshare`로 합니다. flakes가 활성화된 Nix 2.30 이상이 필요하며, 이전 Nix나 Lix에서는 `nix profile install`을 사용하세요. NixOS나 Home Manager에서는 flake를 input으로 추가하고 overlay를 사용하세요.
```nix
# flake.nix
inputs.skillshare.url = "github:runkids/skillshare";
# NixOS or Home Manager module
nixpkgs.overlays = [ inputs.skillshare.overlays.default ];
environment.systemPackages = [ pkgs.skillshare ]; # or home.packages
```
:::tip 나중에 업데이트하기
`skillshare upgrade`는 설치 방식(Homebrew, 스크립트, 수동)을 감지해 CLI를 제자리에서 업데이트합니다.
`skillshare upgrade`는 설치 방식(Homebrew, 스크립트, 수동)을 감지해 CLI를 제자리에서 업데이트합니다. Nix로 설치한 경우에는 CLI를 Nix에 맡기고 업데이트 방법을 안내합니다. `nix profile`로 설치했다면 `nix profile upgrade skillshare`, NixOS나 Home Manager라면 설정을 다시 빌드하라고 안내합니다.
:::
## 2. 초기화
@@ -357,6 +357,8 @@ Next
brew upgrade skillshare update to v1.3.0
```
`nix profile`로 설치했다면 Next 줄에 `nix profile upgrade skillshare`가 표시됩니다. NixOS나 Home Manager가 skillshare를 제공하는 경우에는 Update 줄에 Nix 설정을 업데이트하고 다시 빌드하라는 안내가 붙고, Next 줄은 표시되지 않습니다.
## JSON 출력
CI 파이프라인과 자동화를 위한 기계 판독 가능한 출력에는 `--json`을 사용하십시오:
@@ -187,7 +187,7 @@ project mode(`-p`)로 실행할 때 대시보드는 다음과 같이 달라집
| GET | `/api/doctor` | 모든 상태 검사 실행(JSON) |
| GET | `/api/health` | liveness probe. 서버가 준비되면 `200`을 반환합니다 |
| GET | `/api/version` | 현재/최신 버전 + 업그레이드 가능 여부 |
| POST | `/api/upgrade` | 제자리에서 `skillshare upgrade` 실행(바이너리가 dev build인 경우 `devMode: true` 반환) |
| POST | `/api/upgrade` | 제자리에서 `skillshare upgrade` 실행(바이너리가 dev build인 경우 `devMode: true` 반환, Nix 설치에서는 코드 `upgrade.nix`와 함께 `409` 반환) |
| POST | `/api/restart` | 로컬 UI 서버 재시작. 선택적으로 `{ "clearCache": true }` body를 전달하면 먼저 캐시된 UI 자산을 지웁니다 |
## 제자리 업그레이드
@@ -198,6 +198,8 @@ project mode(`-p`)로 실행할 때 대시보드는 다음과 같이 달라집
2. 새 바이너리가 준비되면 UI가 `POST /api/restart`를 호출하여 로컬 서버를 재시작합니다.
3. 브라우저는 `GET /api/health`를 폴링하며 새 서버가 준비되면 자동으로 새로고침합니다.
skillshare를 Nix로 설치한 경우 엔드포인트는 `409`(`upgrade.nix`)로 거부하고, 대화상자에 Nix로 업데이트하는 방법이 표시됩니다. [upgrade](./upgrade.md#nix-users)를 참고하세요.
실행 중인 바이너리가 개발 빌드(`version == "dev"`)인 경우, upgrade 엔드포인트는 `devMode: true`를 반환하고 UI는 디스크의 어떤 것도 수정하지 않은 채 재시작을 시뮬레이션합니다.
자동 새로고침이 완료되지 않으면, 대화상자는 백그라운드 서버를 다시 시작하기 위해 `skillshare ui start`를 실행하라고 안내합니다.
@@ -279,7 +281,7 @@ skillshare ui -p
## Homebrew 참고 사항
모든 설치 방법(Homebrew, 설치 스크립트, 수동 바이너리)은 런타임 UI 다운로드를 사용합니다. `skillshare ui`를 실행하면 최초 실행 시 GitHub에서 UI 자산을 자동으로 다운로드합니다. 이후에는 캐시된 자산이 오프라인으로 사용됩니다.
모든 설치 방법(Homebrew, Nix, 설치 스크립트, 수동 바이너리)은 런타임 UI 다운로드를 사용합니다. `skillshare ui`를 실행하면 최초 실행 시 GitHub에서 UI 자산을 자동으로 다운로드합니다. 이후에는 캐시된 자산이 오프라인으로 사용됩니다.
다운로드된 UI 캐시를 지우려면:
@@ -60,6 +60,18 @@ Homebrew를 직접 사용할 수도 있습니다.
brew upgrade skillshare
```
## Nix 사용자 {#nix-users}
Nix로 설치한 경우, Nix store의 파일을 교체하면 store가 손상되므로 `skillshare upgrade`는 CLI를 건드리지 않습니다. 새 버전이 있으면 대신 업데이트 방법을 안내합니다. `nix profile add`로 설치했다면 다음 명령입니다.
```bash
nix profile upgrade skillshare
```
NixOS, Home Manager 또는 overlay 설정에서 skillshare를 제공한다면 해당 설정에서 skillshare를 업데이트하고(flake input이라면 `nix flake update skillshare`) 다시 빌드하세요. 대시보드의 업데이트 버튼도 같은 안내를 표시합니다.
내장 스킬은 여전히 `skillshare upgrade --skill`로 업데이트할 수 있습니다.
## 예시
```bash
@@ -30,7 +30,7 @@ skillshare version 0.16.6
새 버전을 사용할 수 있을 때, `skillshare`는 이를 지원하는 명령 실행 후 업데이트 알림을 표시합니다. 이 알림은 **Homebrew를 인식**합니다. skillshare가 Homebrew로 설치된 경우 `brew info`를 조회해 최신 formula 버전을 확인하고 `brew upgrade skillshare`를 제안하며, 그렇지 않으면 GitHub 릴리스를 확인하고 `skillshare upgrade`를 제안합니다.
감지는 자동으로 이루어집니다. skillshare는 자체 실행 파일 경로를 확인하여 Homebrew Cellar 접두사(예: `/opt/homebrew/Cellar/skillshare/`) 아래에 있는지 확인합니다.
감지는 자동으로 이루어집니다. skillshare는 자체 실행 파일 경로를 확인하여 Homebrew Cellar 접두사(예: `/opt/homebrew/Cellar/skillshare/`) 아래에 있는지 확인합니다. `/nix/store/` 아래의 바이너리는 GitHub 릴리스를 확인합니다. 바이너리가 `nix profile`에 있으면 `nix profile upgrade skillshare`를 제안하고, 그렇지 않으면 Nix 설정에서 skillshare를 업데이트하고 다시 빌드하라고 안내합니다.
버전 확인 결과는 `~/.cache/skillshare/version-check.json`에 24시간 동안 캐시됩니다.
@@ -42,8 +42,23 @@ curl -fsSL https://raw.githubusercontent.com/runkids/skillshare/main/install.sh
irm https://raw.githubusercontent.com/runkids/skillshare/main/install.ps1 | iex
```
**Nix(Linux / Apple Silicon macOS):**
```bash
nix profile add github:runkids/skillshare
```
使用 `nix profile upgrade skillshare` 更新。需要启用 flakes 的 Nix 2.30 及以上版本;较旧的 Nix 或 Lix 请使用 `nix profile install`。在 NixOS 或 Home Manager 中,把 flake 加为 input,并使用它的 overlay:
```nix
# flake.nix
inputs.skillshare.url = "github:runkids/skillshare";
# NixOS or Home Manager module
nixpkgs.overlays = [ inputs.skillshare.overlays.default ];
environment.systemPackages = [ pkgs.skillshare ]; # or home.packages
```
:::tip 之后如何更新
`skillshare upgrade` 会自动识别你的安装方式(Homebrew、脚本、手动),并就地更新 CLI。
`skillshare upgrade` 会自动识别你的安装方式(Homebrew、脚本、手动),并就地更新 CLI。通过 Nix 安装时,它不替换 CLI,而是提示更新方法:`nix profile` 安装提示 `nix profile upgrade skillshare`,NixOS 或 Home Manager 则提示更新配置并重新构建。
:::
## 2. 初始化
@@ -361,6 +361,8 @@ Next
brew upgrade skillshare update to v1.3.0
```
通过 `nix profile` 安装时,Next 行显示 `nix profile upgrade skillshare`。由 NixOS 或 Home Manager 提供 skillshare 时,Update 行会提示更新 Nix 配置并重新构建,不显示对应的 Next 行。
## JSON 输出
在 CI 流水线和自动化中使用 `--json` 获取机器可读的输出:
@@ -187,7 +187,7 @@ web dashboard 在 `/api/` 下暴露一个 REST API。所有端点都返回 JSON
| GET | `/api/doctor` | 运行所有健康检查(JSON) |
| GET | `/api/health` | 存活探针;server 就绪后返回 `200` |
| GET | `/api/version` | 当前/最新版本,以及是否有可用升级 |
| POST | `/api/upgrade` | 就地运行 `skillshare upgrade`(当二进制文件为开发构建时返回 `devMode: true`) |
| POST | `/api/upgrade` | 就地运行 `skillshare upgrade`(当二进制文件为开发构建时返回 `devMode: true`;通过 Nix 安装时返回 `409`,错误码为 `upgrade.nix`) |
| POST | `/api/restart` | 重启本地 UI server;可选的 `{ "clearCache": true }` body 会先清除缓存的 UI 资源 |
## 就地升级
@@ -198,6 +198,8 @@ web dashboard 在 `/api/` 下暴露一个 REST API。所有端点都返回 JSON
2. 新二进制文件就位后,UI 调用 `POST /api/restart` 重启本地 server。
3. 浏览器轮询 `GET /api/health`,并在新 server 就绪后自动重新加载。
如果 skillshare 通过 Nix 安装,该端点会以 `409`(`upgrade.nix`)拒绝,对话框会改为说明如何通过 Nix 更新。参见 [upgrade](./upgrade.md#nix-users)。
如果运行中的二进制文件是开发构建(`version == "dev"`),upgrade 端点会返回
`devMode: true`,UI 会模拟一次重启而不修改磁盘上的任何内容。
@@ -280,7 +282,7 @@ dashboard 会读写 `.skillshare/config.yaml`,同步到 project 本地的 targ
## Homebrew 说明
所有安装方式(Homebrew、安装脚本、手动二进制文件)都使用运行时 UI 下载。当你运行 `skillshare ui` 时,它会在首次启动时自动从 GitHub 下载 UI 资源。之后会使用缓存的资源离线运行。
所有安装方式(Homebrew、Nix、安装脚本、手动二进制文件)都使用运行时 UI 下载。当你运行 `skillshare ui` 时,它会在首次启动时自动从 GitHub 下载 UI 资源。之后会使用缓存的资源离线运行。
清除已下载的 UI 缓存:
@@ -60,6 +60,18 @@ skillshare upgrade
brew upgrade skillshare
```
## Nix 用户 {#nix-users}
如果通过 Nix 安装,`skillshare upgrade` 不会改动 CLI,因为替换 Nix store 中的文件会损坏 store。有新版本时,它会改为提示更新方法。通过 `nix profile add` 安装时为:
```bash
nix profile upgrade skillshare
```
如果 skillshare 由 NixOS、Home Manager 或 overlay 配置提供,请在该配置中更新 skillshare(flake input 可用 `nix flake update skillshare`)并重新构建。仪表板的更新按钮也会显示同样的提示。
内置 skill 仍可通过 `skillshare upgrade --skill` 更新。
## 示例
```bash
@@ -30,7 +30,7 @@ skillshare version 0.16.6
当有新版本可用时,`skillshare` 会在支持该功能的命令执行后显示更新通知。这个通知会**感知 Homebrew**:如果 skillshare 是通过 Homebrew 安装的,它会查询 `brew info` 获取最新的 formula 版本,并建议执行 `brew upgrade skillshare`;否则会检查 GitHub releases 并建议执行 `skillshare upgrade`。
检测是自动进行的——skillshare 会解析自身可执行文件的路径,并检查它是否位于 Homebrew Cellar 前缀下(例如 `/opt/homebrew/Cellar/skillshare/`)。
检测是自动进行的——skillshare 会解析自身可执行文件的路径,并检查它是否位于 Homebrew Cellar 前缀下(例如 `/opt/homebrew/Cellar/skillshare/`)。位于 `/nix/store/` 下的二进制文件会检查 GitHub releases。若二进制文件位于你的 `nix profile` 中,则建议执行 `nix profile upgrade skillshare`,否则提示你在 Nix 配置中更新 skillshare 并重新构建。
版本检查结果会缓存 24 小时,缓存位置为 `~/.cache/skillshare/version-check.json`。
@@ -42,8 +42,23 @@ curl -fsSL https://raw.githubusercontent.com/runkids/skillshare/main/install.sh
irm https://raw.githubusercontent.com/runkids/skillshare/main/install.ps1 | iex
```
**Nix(Linux / Apple Silicon macOS):**
```bash
nix profile add github:runkids/skillshare
```
使用 `nix profile upgrade skillshare` 更新。需要啟用 flakes 的 Nix 2.30 以上版本;較舊的 Nix 或 Lix 請使用 `nix profile install`。在 NixOS 或 Home Manager 中,把 flake 加為 input,並使用它的 overlay:
```nix
# flake.nix
inputs.skillshare.url = "github:runkids/skillshare";
# NixOS or Home Manager module
nixpkgs.overlays = [ inputs.skillshare.overlays.default ];
environment.systemPackages = [ pkgs.skillshare ]; # or home.packages
```
:::tip 之後如何更新
`skillshare upgrade` 會偵測你當初的安裝方式(Homebrew、腳本、手動),並就地更新 CLI。
`skillshare upgrade` 會偵測你當初的安裝方式(Homebrew、腳本、手動),並就地更新 CLI。透過 Nix 安裝時,它不會替換 CLI,而是提示更新方式:`nix profile` 安裝提示 `nix profile upgrade skillshare`,NixOS 或 Home Manager 則提示更新設定並重新建置。
:::
## 2. 初始化
@@ -357,6 +357,8 @@ Next
brew upgrade skillshare update to v1.3.0
```
透過 `nix profile` 安裝時,Next 行顯示 `nix profile upgrade skillshare`。由 NixOS 或 Home Manager 提供 skillshare 時,Update 行會提示更新 Nix 設定並重新建置,不顯示對應的 Next 行。
## JSON 輸出
在 CI pipelines 與自動化中使用 `--json` 取得機器可讀輸出:
@@ -187,7 +187,7 @@ Web dashboard 在 `/api/` 上提供 REST API。所有端點皆回傳 JSON。
| GET | `/api/doctor` | 執行所有健康檢查(JSON) |
| GET | `/api/health` | 存活探測;伺服器就緒後回傳 `200` |
| GET | `/api/version` | 目前/最新版本 + 是否有可用升級 |
| POST | `/api/upgrade` | 就地執行 `skillshare upgrade`(若執行檔為開發版本則回傳 `devMode: true`) |
| POST | `/api/upgrade` | 就地執行 `skillshare upgrade`(若執行檔為開發版本則回傳 `devMode: true`;透過 Nix 安裝時回傳 `409`,錯誤碼為 `upgrade.nix`) |
| POST | `/api/restart` | 重啟本機 UI 伺服器;可選的 `{ "clearCache": true }` body 會先清除快取的 UI 資源 |
## 就地升級
@@ -198,6 +198,8 @@ Web dashboard 在 `/api/` 上提供 REST API。所有端點皆回傳 JSON。
2. 新執行檔就緒後,UI 呼叫 `POST /api/restart` 重啟本機伺服器。
3. 瀏覽器輪詢 `GET /api/health`,並在新伺服器就緒後自動重新載入。
如果 skillshare 透過 Nix 安裝,該端點會以 `409`(`upgrade.nix`)拒絕,對話框會改為說明如何透過 Nix 更新。參見 [upgrade](./upgrade.md#nix-users)。
如果正在執行的是開發版本(`version == "dev"`),upgrade 端點會回傳 `devMode: true`,UI 會模擬重啟而不修改磁碟上的任何內容。
如果自動重新載入沒有完成,對話框會提示你執行 `skillshare ui start` 以重新啟動背景伺服器。
@@ -279,7 +281,7 @@ Dashboard 會讀寫 `.skillshare/config.yaml`、同步至 project 本機的 targ
## Homebrew 說明
所有安裝方式(Homebrew、安裝腳本、手動下載執行檔)都使用執行時 UI 下載。當你執行 `skillshare ui` 時,它會在首次啟動時自動從 GitHub 下載 UI 資源。之後,會使用快取的資源離線運作。
所有安裝方式(Homebrew、Nix、安裝腳本、手動下載執行檔)都使用執行時 UI 下載。當你執行 `skillshare ui` 時,它會在首次啟動時自動從 GitHub 下載 UI 資源。之後,會使用快取的資源離線運作。
若要清除已下載的 UI 快取:
@@ -60,6 +60,18 @@ skillshare upgrade
brew upgrade skillshare
```
## Nix 使用者 {#nix-users}
如果透過 Nix 安裝,`skillshare upgrade` 不會更動 CLI,因為替換 Nix store 中的檔案會損壞 store。有新版本時,它會改為提示更新方式。透過 `nix profile add` 安裝時為:
```bash
nix profile upgrade skillshare
```
如果 skillshare 由 NixOS、Home Manager 或 overlay 設定提供,請在該設定中更新 skillshare(flake input 可用 `nix flake update skillshare`)並重新建置。儀表板的更新按鈕也會顯示相同的提示。
內建 skill 仍可透過 `skillshare upgrade --skill` 更新。
## 範例
```bash
@@ -30,7 +30,7 @@ skillshare version 0.16.6
當有新版本可用時,`skillshare` 會在支援的指令執行後顯示更新通知。此通知具備 **Homebrew 感知能力**:如果 skillshare 是透過 Homebrew 安裝的,它會查詢 `brew info` 取得最新的 formula 版本,並建議執行 `brew upgrade skillshare`;否則它會檢查 GitHub releases 並建議執行 `skillshare upgrade`。
偵測是自動的——skillshare 會解析自身的執行檔路徑,並檢查它是否位於 Homebrew Cellar 前綴目錄下(例如 `/opt/homebrew/Cellar/skillshare/`)。
偵測是自動的——skillshare 會解析自身的執行檔路徑,並檢查它是否位於 Homebrew Cellar 前綴目錄下(例如 `/opt/homebrew/Cellar/skillshare/`)。位於 `/nix/store/` 下的執行檔會檢查 GitHub releases。若執行檔位於你的 `nix profile` 中,則建議執行 `nix profile upgrade skillshare`,否則提示你在 Nix 設定中更新 skillshare 並重新建置。
版本檢查結果會快取 24 小時,存放於 `~/.cache/skillshare/version-check.json`。
+2
View File
@@ -84,6 +84,8 @@ For a bug fix, prove that the test fails before the fix. Add an E2E runbook in `
All command execution and isolation rules live in `testing`. Never run the CLI or tests on the host.
The Nix flake also runs the unit tests, inside the Nix sandbox, which has `/bin/sh` but no `/bin/bash` or `/usr/bin/env`. A change to `go.sum` also needs a new `vendorHash`; see `release`.
## Web API
When a dashboard endpoint is needed:
+11
View File
@@ -57,6 +57,17 @@ Then:
Release notes are local maintainer artifacts by default. Never force-add an ignored file unless explicitly requested. Never infer authorization for credentials, registry login, or external publication.
## Nix Flake
`flake.nix` builds `nix/package.nix`, which reads its version from the Release Please manifest, so releases need no Nix edit. A `github:runkids/skillshare` install builds `main` and reports the latest release version.
Installs skip the unit tests; only the flake's `checks` run them. The **Nix** workflow runs `nix flake check` (build plus unit tests in the sandbox) on Linux and builds the package on macOS for every non-docs change. Two failures need a hand edit:
- A hash mismatch after a `go.sum` change: put the log's `got: sha256-...` value into `vendorHash`.
- `go.mod` requiring a Go minor version newer than the locked nixpkgs ships fails evaluation with a message saying so: run `nix flake update`. Newer patch versions need nothing, because `postPatch` lowers the `go` directive to the toolchain's version.
The devcontainer has no Nix, so reproduce Nix failures in a throwaway `nixos/nix` container, never on the host: `docker run --rm --privileged -v "$PWD":/src -w /src nixos/nix nix --extra-experimental-features 'nix-command flakes' build --option sandbox true -L path:/src`.
## Verification and Report
Report actual test results, whether both changelog copies match, the verified version location, commit/tag state, and external actions not performed. If the working tree is dirty, list the unrelated changes that were preserved.