From f28e5e23f448e476116bee2dbb89aa396dfa774b Mon Sep 17 00:00:00 2001 From: Willie Date: Fri, 2 Oct 2026 20:30:27 +0800 Subject: [PATCH] fix(install): keep local installs updatable from any directory and in shape (#336) * fix(install): keep local installs updatable from any directory and in shape Follow-ups to local-source change detection (#334): - Global installs recorded a relative local path as typed, so `update` and `check` resolved it against whatever directory they ran in and failed with "source path does not exist". Global CLI and dashboard installs now record the absolute path. Project mode keeps the path as written, because .skillshare/config.yaml is shared across machines. - The dashboard installs the root of a directory that also holds child skills as its SKILL.md alone, but `update` re-copied the whole directory, pulling in child skills and unrelated files. Updates now keep that shape. The detection is shared with `check` so both agree on which files belong to the install. * fix(install): never narrow a whole-directory update to SKILL.md alone The SKILL.md-only shape was inferred from a child skill in the source that the recorded hashes lack. A whole-directory install whose source gained a child skill later matched that too, so `update` replaced it with SKILL.md alone and deleted its other files. Decide from the recorded files instead: only an install that recorded SKILL.md alone keeps that shape. --- cmd/skillshare/install.go | 7 ++ internal/check/local_check.go | 15 +--- internal/check/local_check_test.go | 13 +++ internal/install/install.go | 3 + internal/install/install_apply.go | 10 ++- internal/install/install_update.go | 1 + internal/install/install_update_test.go | 82 +++++++++++++++++++ internal/install/local_shape.go | 51 ++++++++++++ internal/server/handler_install.go | 6 ++ internal/server/handler_install_test.go | 29 +++++++ tests/integration/install_basic_test.go | 17 ++++ tests/integration/install_project_test.go | 16 ++++ website/docs/reference/commands/check.md | 2 +- website/docs/reference/commands/install.md | 2 + .../current/reference/commands/check.md | 2 +- .../current/reference/commands/install.md | 2 + .../current/reference/commands/check.md | 2 +- .../current/reference/commands/install.md | 2 + .../current/reference/commands/check.md | 2 +- .../current/reference/commands/install.md | 2 + .../current/reference/commands/check.md | 2 +- .../current/reference/commands/install.md | 2 + 22 files changed, 249 insertions(+), 21 deletions(-) create mode 100644 internal/install/local_shape.go diff --git a/cmd/skillshare/install.go b/cmd/skillshare/install.go index d25715e53..e8a0d2d34 100644 --- a/cmd/skillshare/install.go +++ b/cmd/skillshare/install.go @@ -431,6 +431,13 @@ func cmdInstall(args []string) error { if err == nil && parsed.opts.Branch != "" { source.Branch = parsed.opts.Branch } + // Global metadata has no fixed base for a relative path, so `update` and + // `check` would resolve it against whatever directory they run in. + // Project mode keeps relative sources: they are relative to the project + // root and the project config is shared across machines. + if err == nil && source.Type == install.SourceTypeLocalPath { + source.Raw = source.Path + } if err != nil { logInstallOp(config.ConfigPath(), rest, start, err, installLogSummary{ Source: parsed.sourceArg, diff --git a/internal/check/local_check.go b/internal/check/local_check.go index cf707fddd..d81e2f0af 100644 --- a/internal/check/local_check.go +++ b/internal/check/local_check.go @@ -46,21 +46,8 @@ func LocalSourceStatus(entry *install.MetadataEntry) (status, message string) { } // installedFiles narrows the source hashes to the files an install copies. -// `install ` copies the whole directory, nested skills included. The -// dashboard installs the root of a directory that also holds child skills -// as its SKILL.md alone; that shape is recognized by recorded hashes that -// contain none of the child skills present in the source. func installedFiles(source, recorded map[string]string) map[string]string { - hasChildSkill := false - for rel := range source { - if strings.HasSuffix(rel, "/SKILL.md") { - if _, ok := recorded[rel]; ok { - return source - } - hasChildSkill = true - } - } - if !hasChildSkill { + if !install.IsSkillFileOnlyInstall(source, recorded) { return source } if hash, ok := source["SKILL.md"]; ok { diff --git a/internal/check/local_check_test.go b/internal/check/local_check_test.go index a6487b6a9..7989d5926 100644 --- a/internal/check/local_check_test.go +++ b/internal/check/local_check_test.go @@ -166,3 +166,16 @@ func TestLocalSourceStatus_WholeDirectoryInstall_DetectsChildSkillChange(t *test t.Errorf("status = %q, want update_available", status) } } + +func TestLocalSourceStatus_WholeDirectoryInstall_ChildAddedLater(t *testing.T) { + entry, src := localEntry(t) + os.WriteFile(filepath.Join(src, "README.md"), []byte("readme"), 0644) + entry.FileHashes, _ = install.ComputeFileHashes(src) + + os.MkdirAll(filepath.Join(src, "child"), 0755) + os.WriteFile(filepath.Join(src, "child", "SKILL.md"), []byte("# Child"), 0644) + + if status, _ := LocalSourceStatus(entry); status != "update_available" { + t.Errorf("status = %q, want update_available", status) + } +} diff --git a/internal/install/install.go b/internal/install/install.go index 62abf1da0..864cd28d9 100644 --- a/internal/install/install.go +++ b/internal/install/install.go @@ -41,6 +41,9 @@ type InstallOptions struct { // they point these at the final destination to keep metadata keys stable. AuditAcceptRoot string AuditAcceptPath string + // skillFileOnly makes a local install copy only SKILL.md. Updates set it + // to keep the shape of a collection root installed that way. + skillFileOnly bool } // auditAcceptTarget returns the (sourceDir, path) pair used to key accepted diff --git a/internal/install/install_apply.go b/internal/install/install_apply.go index 33a190ede..a72f5df7a 100644 --- a/internal/install/install_apply.go +++ b/internal/install/install_apply.go @@ -238,8 +238,14 @@ func installFromLocal(source *Source, destPath string, result *InstallResult, op return result, nil } - // Copy directory - if err := copyDir(source.Path, destPath); err != nil { + if opts.skillFileOnly { + if err := os.MkdirAll(destPath, 0755); err != nil { + return nil, fmt.Errorf("failed to create destination: %w", err) + } + if err := copyFile(filepath.Join(source.Path, "SKILL.md"), filepath.Join(destPath, "SKILL.md")); err != nil { + return nil, fmt.Errorf("failed to copy SKILL.md: %w", err) + } + } else if err := copyDir(source.Path, destPath); err != nil { return nil, fmt.Errorf("failed to copy skill: %w", err) } diff --git a/internal/install/install_update.go b/internal/install/install_update.go index 1314d7f80..69117db6f 100644 --- a/internal/install/install_update.go +++ b/internal/install/install_update.go @@ -121,6 +121,7 @@ func handleUpdate(source *Source, destPath string, result *InstallResult, opts I AuditProjectRoot: opts.AuditProjectRoot, AuditAcceptRoot: opts.SourceDir, AuditAcceptPath: destPath, + skillFileOnly: isSkillFileOnlyLocalInstall(source, destPath, opts.SourceDir), }) if err != nil { // Installation failed - original skill is preserved diff --git a/internal/install/install_update_test.go b/internal/install/install_update_test.go index dbcb635e3..48e33e55f 100644 --- a/internal/install/install_update_test.go +++ b/internal/install/install_update_test.go @@ -3,6 +3,7 @@ package install import ( "os" "path/filepath" + "strings" "testing" "time" ) @@ -89,3 +90,84 @@ func TestUpdate_LegacyRepoRootOrchestratorMigratesToSkillOnly(t *testing.T) { t.Fatalf("expected SKILL.md hash, got %#v", entry.FileHashes) } } + +func TestUpdate_LocalCollectionRoot_KeepsSkillFileOnly(t *testing.T) { + tmp := t.TempDir() + repo := filepath.Join(tmp, "repo") + write := func(rel, body string) { + p := filepath.Join(repo, rel) + os.MkdirAll(filepath.Dir(p), 0755) + os.WriteFile(p, []byte(body), 0644) + } + write("SKILL.md", "---\nname: root\n---\n# v1") + write("README.md", "readme") + write("skills/child/SKILL.md", "---\nname: child\n---\n# Child") + + // The dashboard installs the root of a collection as its SKILL.md alone. + discovery, err := DiscoverLocal(&Source{Type: SourceTypeLocalPath, Raw: repo, Path: repo, Name: "repo"}) + if err != nil { + t.Fatal(err) + } + sourceDir := filepath.Join(tmp, "dest") + destPath := filepath.Join(sourceDir, "root") + for _, skill := range discovery.Skills { + if skill.Path == "." { + if _, err := InstallFromDiscovery(discovery, skill, destPath, InstallOptions{SourceDir: sourceDir, SkipAudit: true}); err != nil { + t.Fatal(err) + } + } + } + + write("SKILL.md", "---\nname: root\n---\n# v2") + source, err := ParseSource(LoadMetadataOrNew(sourceDir).GetByPath("root").Source) + if err != nil { + t.Fatal(err) + } + if _, err := Install(source, destPath, InstallOptions{SourceDir: sourceDir, Update: true, SkipAudit: true}); err != nil { + t.Fatalf("update: %v", err) + } + + var files []string + filepath.Walk(destPath, func(path string, info os.FileInfo, err error) error { + if err == nil && !info.IsDir() { + rel, _ := filepath.Rel(destPath, path) + files = append(files, filepath.ToSlash(rel)) + } + return nil + }) + if len(files) != 1 || files[0] != "SKILL.md" { + t.Errorf("updated files = %v, want only SKILL.md", files) + } + if got, _ := os.ReadFile(filepath.Join(destPath, "SKILL.md")); !strings.Contains(string(got), "# v2") { + t.Errorf("SKILL.md was not updated: %s", got) + } +} + +func TestUpdate_LocalWholeDirectory_ChildAddedLater_KeepsOtherFiles(t *testing.T) { + tmp := t.TempDir() + src := filepath.Join(tmp, "pack") + write := func(rel, body string) { + p := filepath.Join(src, rel) + os.MkdirAll(filepath.Dir(p), 0755) + os.WriteFile(p, []byte(body), 0644) + } + write("SKILL.md", "---\nname: pack\n---\n# v1") + write("README.md", "readme") + + sourceDir := filepath.Join(tmp, "dest") + destPath := filepath.Join(sourceDir, "pack") + source := &Source{Type: SourceTypeLocalPath, Raw: src, Path: src, Name: "pack"} + if _, err := Install(source, destPath, InstallOptions{SourceDir: sourceDir, SkipAudit: true}); err != nil { + t.Fatal(err) + } + + // A child skill appears at the source after a whole-directory install. + write("child/SKILL.md", "---\nname: child\n---\n# Child") + if _, err := Install(source, destPath, InstallOptions{SourceDir: sourceDir, Update: true, SkipAudit: true}); err != nil { + t.Fatalf("update: %v", err) + } + + if _, err := os.Stat(filepath.Join(destPath, "README.md")); err != nil { + t.Errorf("README.md was removed by the update: %v", err) + } +} diff --git a/internal/install/local_shape.go b/internal/install/local_shape.go new file mode 100644 index 000000000..7aaf9923a --- /dev/null +++ b/internal/install/local_shape.go @@ -0,0 +1,51 @@ +package install + +import ( + "path/filepath" + "strings" +) + +// IsSkillFileOnlyInstall reports whether recorded file hashes describe a +// local install that copied only SKILL.md from a source directory that also +// holds child skills. The dashboard installs the root of such a collection +// this way; `install ` copies the whole directory, child skills +// included. source holds the current hashes of the source directory. +// +// The recorded files decide: an install that recorded anything besides +// SKILL.md copied the whole directory, even if child skills were added to +// the source later, and updating it as SKILL.md alone would delete files. +func IsSkillFileOnlyInstall(source, recorded map[string]string) bool { + if _, ok := recorded["SKILL.md"]; !ok || len(recorded) != 1 { + return false + } + for rel := range source { + if strings.HasSuffix(rel, "/SKILL.md") { + return true + } + } + return false +} + +// isSkillFileOnlyLocalInstall reports whether the local skill at destPath +// was installed as its SKILL.md alone, so an update keeps that shape. +func isSkillFileOnlyLocalInstall(source *Source, destPath, sourceDir string) bool { + if source.Type != SourceTypeLocalPath { + return false + } + if sourceDir == "" { + sourceDir = filepath.Dir(destPath) + } + rel, err := filepath.Rel(sourceDir, destPath) + if err != nil { + return false + } + entry := LoadMetadataOrNew(sourceDir).GetByPath(filepath.ToSlash(rel)) + if entry == nil || len(entry.FileHashes) == 0 { + return false + } + hashes, err := ComputeFileHashes(source.Path) + if err != nil { + return false + } + return IsSkillFileOnlyInstall(hashes, entry.FileHashes) +} diff --git a/internal/server/handler_install.go b/internal/server/handler_install.go index 7675a7be0..e71a351f6 100644 --- a/internal/server/handler_install.go +++ b/internal/server/handler_install.go @@ -150,6 +150,9 @@ func (s *Server) handleInstallBatch(w http.ResponseWriter, r *http.Request) { writeError(w, http.StatusBadRequest, err.Error()) return } + } else if source.Type == install.SourceTypeLocalPath { + // Global metadata has no fixed base for a relative path. + source.Raw = source.Path } discovery, err := discoverInstallSource(source) @@ -364,6 +367,9 @@ func (s *Server) handleInstall(w http.ResponseWriter, r *http.Request) { writeError(w, http.StatusBadRequest, err.Error()) return } + } else if source.Type == install.SourceTypeLocalPath { + // Global metadata has no fixed base for a relative path. + source.Raw = source.Path } if body.Name != "" { diff --git a/internal/server/handler_install_test.go b/internal/server/handler_install_test.go index b1826286a..4601380d7 100644 --- a/internal/server/handler_install_test.go +++ b/internal/server/handler_install_test.go @@ -177,6 +177,35 @@ func TestHandleInstallBatch_LocalAgentInstallPreservesNestedPath(t *testing.T) { } } +func TestHandleInstall_GlobalRelativeLocalPathRecordsAbsoluteSource(t *testing.T) { + s, _ := newTestServer(t) + + parent := t.TempDir() + if err := os.MkdirAll(filepath.Join(parent, "rel-skill"), 0o755); err != nil { + t.Fatal(err) + } + if err := os.WriteFile(filepath.Join(parent, "rel-skill", "SKILL.md"), []byte("---\nname: rel-skill\n---\n# Rel"), 0o644); err != nil { + t.Fatal(err) + } + t.Chdir(parent) + + payload, _ := json.Marshal(map[string]any{"source": "./rel-skill", "skipAudit": true}) + req := httptest.NewRequest(http.MethodPost, "/api/install", bytes.NewReader(payload)) + rr := httptest.NewRecorder() + s.mux.ServeHTTP(rr, req) + if rr.Code != http.StatusOK { + t.Fatalf("unexpected status: got %d, body=%s", rr.Code, rr.Body.String()) + } + + entry := s.skillsStore.GetByPath("rel-skill") + if entry == nil { + t.Fatal("expected metadata for rel-skill") + } + if want := filepath.Join(parent, "rel-skill"); entry.Source != want { + t.Errorf("Source = %q, want %q", entry.Source, want) + } +} + func TestHandleInstall_ProjectRootRejected(t *testing.T) { s, projectRoot := newProjectTargetServer(t, nil) diff --git a/tests/integration/install_basic_test.go b/tests/integration/install_basic_test.go index 846b46ed7..0a5f7679f 100644 --- a/tests/integration/install_basic_test.go +++ b/tests/integration/install_basic_test.go @@ -374,6 +374,23 @@ targets: {} result.AssertAnyOutputContains(t, "No remote skills defined") } +func TestInstall_RelativeLocalPath_RecordsAbsoluteSource(t *testing.T) { + sb := testutil.NewSandbox(t) + defer sb.Cleanup() + sb.WriteConfig(`source: ` + sb.SourcePath + "\ntargets: {}\n") + + parent := filepath.Join(sb.Root, "apps") + sb.WriteFile(filepath.Join(parent, "rel-skill", "SKILL.md"), "---\nname: rel-skill\n---\n# v1") + sb.RunCLIInDir(parent, "install", "./rel-skill").AssertSuccess(t) + + sb.WriteFile(filepath.Join(parent, "rel-skill", "SKILL.md"), "---\nname: rel-skill\n---\n# v2") + sb.RunCLIInDir(sb.Root, "update", "rel-skill").AssertSuccess(t) + + if got := sb.ReadFile(filepath.Join(sb.SourcePath, "rel-skill", "SKILL.md")); !strings.Contains(got, "# v2") { + t.Errorf("update from another directory did not re-copy the source, got:\n%s", got) + } +} + func TestInstall_LocalGitRepo_ClonesSuccessfully(t *testing.T) { sb := testutil.NewSandbox(t) defer sb.Cleanup() diff --git a/tests/integration/install_project_test.go b/tests/integration/install_project_test.go index d4d03d469..96959f3fa 100644 --- a/tests/integration/install_project_test.go +++ b/tests/integration/install_project_test.go @@ -31,6 +31,22 @@ func TestInstallProject_LocalPath(t *testing.T) { } } +func TestInstallProject_RelativeLocalPath_StaysRelative(t *testing.T) { + sb := testutil.NewSandbox(t) + defer sb.Cleanup() + projectRoot := sb.SetupProjectDir("claude") + sb.WriteFile(filepath.Join(projectRoot, "vendor", "team-skill", "SKILL.md"), "---\nname: team-skill\n---\n# Team") + + sb.RunCLIInDir(projectRoot, "install", "./vendor/team-skill", "-p").AssertSuccess(t) + + // The project config is committed and replayed on other machines, so a + // relative source must not be rewritten to this machine's absolute path. + cfg := sb.ReadFile(filepath.Join(projectRoot, ".skillshare", "config.yaml")) + if !strings.Contains(cfg, "source: ./vendor/team-skill") { + t.Errorf("project config should keep the relative source, got:\n%s", cfg) + } +} + func TestInstallProject_CurrentDirectoryRejected(t *testing.T) { sb := testutil.NewSandbox(t) defer sb.Cleanup() diff --git a/website/docs/reference/commands/check.md b/website/docs/reference/commands/check.md index e2a843498..1621bb040 100644 --- a/website/docs/reference/commands/check.md +++ b/website/docs/reference/commands/check.md @@ -68,7 +68,7 @@ skillshare update surge # Re-copies from the path and runs the security audit skillshare sync ``` -Skills installed before file hashes were recorded keep the "local source" status until they are updated or reinstalled. Skills installed from a relative path (such as `./my-skill`) are not compared either, because the directory the path was relative to is not recorded; install with an absolute path to enable the check. +Skills installed before file hashes were recorded keep the "local source" status until they are updated or reinstalled. In project mode, skills installed from a relative path (such as `./vendor/my-skill`) are not compared. ## Example Output diff --git a/website/docs/reference/commands/install.md b/website/docs/reference/commands/install.md index ea5a9264c..02909b98a 100644 --- a/website/docs/reference/commands/install.md +++ b/website/docs/reference/commands/install.md @@ -198,6 +198,8 @@ skillshare install ~/Downloads/my-skill skillshare install /absolute/path/to/skill ``` +A local path is copied into the source directory. In global mode, a relative path such as `./my-skill` is recorded as an absolute path, so `update` and [`check`](./check.md#local-path-installs) find it from any directory. In project mode it is recorded as written, because `.skillshare/config.yaml` is shared across machines. + :::tip Fuzzy subdirectory resolution When specifying a subdirectory path like `owner/repo/skill-name`, if the exact path doesn't exist in the repo, skillshare scans all `SKILL.md` files and matches by directory basename. If multiple skills share the same name, an ambiguity error is shown with full paths so you can specify the exact one. ::: diff --git a/website/i18n/ja/docusaurus-plugin-content-docs/current/reference/commands/check.md b/website/i18n/ja/docusaurus-plugin-content-docs/current/reference/commands/check.md index b7a25182a..7d2b9b89f 100644 --- a/website/i18n/ja/docusaurus-plugin-content-docs/current/reference/commands/check.md +++ b/website/i18n/ja/docusaurus-plugin-content-docs/current/reference/commands/check.md @@ -68,7 +68,7 @@ skillshare update surge # パスから再コピーし、セキュリティ監 skillshare sync ``` -ファイルハッシュが記録される前にインストールされた Skill は、update または再インストールするまで「local source」のままです。 相対パス(`./my-skill` など)からインストールした Skill も、基準となるディレクトリが記録されないため比較されません。チェックを有効にするには絶対パスでインストールしてください。 +ファイルハッシュが記録される前にインストールされた Skill は、update または再インストールするまで「local source」のままです。 Project mode で相対パス(`./vendor/my-skill` など)からインストールした Skill は比較されません。 ## 出力例 diff --git a/website/i18n/ja/docusaurus-plugin-content-docs/current/reference/commands/install.md b/website/i18n/ja/docusaurus-plugin-content-docs/current/reference/commands/install.md index 5e41f4c38..09023378b 100644 --- a/website/i18n/ja/docusaurus-plugin-content-docs/current/reference/commands/install.md +++ b/website/i18n/ja/docusaurus-plugin-content-docs/current/reference/commands/install.md @@ -198,6 +198,8 @@ skillshare install ~/Downloads/my-skill skillshare install /absolute/path/to/skill ``` +ローカルパスはソースディレクトリにコピーされます。Global mode では `./my-skill` のような相対パスは絶対パスとして記録されるため、`update` と [`check`](./check.md#local-path-installs) はどのディレクトリからでもそのパスを見つけられます。Project mode では `.skillshare/config.yaml` が複数のマシンで共有されるため、入力どおりに記録されます。 + :::tip ファジーなサブディレクトリ解決 `owner/repo/skill-name` のようなサブディレクトリパスを指定した際、そのパスがリポジトリ内に完全一致で存在しない場合、skillshare はすべての `SKILL.md` ファイルをスキャンし、ディレクトリのベース名でマッチさせます。同名の Skill が複数存在する場合は、フルパス付きの曖昧性エラーが表示されるので、正確なパスを指定できます。 ::: diff --git a/website/i18n/ko/docusaurus-plugin-content-docs/current/reference/commands/check.md b/website/i18n/ko/docusaurus-plugin-content-docs/current/reference/commands/check.md index 19e1e6413..2e8112069 100644 --- a/website/i18n/ko/docusaurus-plugin-content-docs/current/reference/commands/check.md +++ b/website/i18n/ko/docusaurus-plugin-content-docs/current/reference/commands/check.md @@ -68,7 +68,7 @@ skillshare update surge # 경로에서 다시 복사하고 보안 감사를 skillshare sync ``` -파일 해시가 기록되기 전에 설치된 skill은 update하거나 다시 설치할 때까지 "local source" 상태로 남습니다. 상대 경로(`./my-skill` 등)로 설치한 skill도 기준 디렉터리가 기록되지 않으므로 비교하지 않습니다. 확인을 사용하려면 절대 경로로 설치하세요. +파일 해시가 기록되기 전에 설치된 skill은 update하거나 다시 설치할 때까지 "local source" 상태로 남습니다. Project mode에서 상대 경로(`./vendor/my-skill` 등)로 설치한 skill은 비교하지 않습니다. ## 출력 예시 diff --git a/website/i18n/ko/docusaurus-plugin-content-docs/current/reference/commands/install.md b/website/i18n/ko/docusaurus-plugin-content-docs/current/reference/commands/install.md index 67ee5a8c3..46397252d 100644 --- a/website/i18n/ko/docusaurus-plugin-content-docs/current/reference/commands/install.md +++ b/website/i18n/ko/docusaurus-plugin-content-docs/current/reference/commands/install.md @@ -198,6 +198,8 @@ skillshare install ~/Downloads/my-skill skillshare install /absolute/path/to/skill ``` +로컬 경로는 source 디렉터리로 복사됩니다. Global mode에서는 `./my-skill` 같은 상대 경로가 절대 경로로 기록되므로 `update`와 [`check`](./check.md#local-path-installs)가 어느 디렉터리에서든 해당 경로를 찾을 수 있습니다. Project mode에서는 `.skillshare/config.yaml`을 여러 머신에서 공유하므로 입력한 그대로 기록됩니다. + :::tip Fuzzy 하위 디렉터리 해석 `owner/repo/skill-name`과 같은 하위 디렉터리 경로를 지정할 때, repo에 정확한 경로가 없으면 skillshare는 모든 `SKILL.md` 파일을 스캔하여 디렉터리 basename으로 매칭합니다. 같은 이름을 가진 skill이 여러 개면, 전체 경로와 함께 모호성 오류가 표시되어 정확한 것을 지정할 수 있습니다. ::: diff --git a/website/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/commands/check.md b/website/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/commands/check.md index a5105769c..1a9fa7622 100644 --- a/website/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/commands/check.md +++ b/website/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/commands/check.md @@ -68,7 +68,7 @@ skillshare update surge # 从该路径重新复制,并执行安全审计 skillshare sync ``` -在记录文件哈希值之前安装的 skill,会保持 "local source" 状态,直到执行 update 或重新安装。通过相对路径(如 `./my-skill`)安装的 skill 也不会比较,因为不会记录该相对路径的基准目录;如需启用检查,请使用绝对路径安装。 +在记录文件哈希值之前安装的 skill,会保持 "local source" 状态,直到执行 update 或重新安装。在 project mode 中,通过相对路径(如 `./vendor/my-skill`)安装的 skill 不会比较。 ## 示例输出 diff --git a/website/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/commands/install.md b/website/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/commands/install.md index f1922587b..2d2e752ca 100644 --- a/website/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/commands/install.md +++ b/website/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/commands/install.md @@ -198,6 +198,8 @@ skillshare install ~/Downloads/my-skill skillshare install /absolute/path/to/skill ``` +本地路径会复制到 source 目录。在 global mode 中,`./my-skill` 这类相对路径会记录为绝对路径,因此 `update` 和 [`check`](./check.md#local-path-installs) 在任何目录下都能找到它。在 project mode 中,由于 `.skillshare/config.yaml` 会在多台机器之间共享,路径会按输入原样记录。 + :::tip 模糊子目录解析 当指定像 `owner/repo/skill-name` 这样的子目录路径时,如果该精确路径在仓库中不存在,skillshare 会扫描所有 `SKILL.md` 文件并按目录 basename 进行匹配。如果多个 Skill 共享同一个名称,会显示带完整路径的歧义错误,方便你指定具体的那一个。 ::: diff --git a/website/i18n/zh-Hant/docusaurus-plugin-content-docs/current/reference/commands/check.md b/website/i18n/zh-Hant/docusaurus-plugin-content-docs/current/reference/commands/check.md index 5d4967a28..a76992603 100644 --- a/website/i18n/zh-Hant/docusaurus-plugin-content-docs/current/reference/commands/check.md +++ b/website/i18n/zh-Hant/docusaurus-plugin-content-docs/current/reference/commands/check.md @@ -68,7 +68,7 @@ skillshare update surge # 從該路徑重新複製,並執行安全稽核 skillshare sync ``` -在記錄檔案 hash 之前安裝的 skill,會維持「local source」狀態,直到執行 update 或重新安裝。透過相對路徑(如 `./my-skill`)安裝的 skill 也不會比對,因為不會記錄該相對路徑的基準目錄;如需啟用檢查,請使用絕對路徑安裝。 +在記錄檔案 hash 之前安裝的 skill,會維持「local source」狀態,直到執行 update 或重新安裝。在 project mode 中,透過相對路徑(如 `./vendor/my-skill`)安裝的 skill 不會比對。 ## 輸出範例 diff --git a/website/i18n/zh-Hant/docusaurus-plugin-content-docs/current/reference/commands/install.md b/website/i18n/zh-Hant/docusaurus-plugin-content-docs/current/reference/commands/install.md index 5a63f7e0d..a3ba2c4a6 100644 --- a/website/i18n/zh-Hant/docusaurus-plugin-content-docs/current/reference/commands/install.md +++ b/website/i18n/zh-Hant/docusaurus-plugin-content-docs/current/reference/commands/install.md @@ -198,6 +198,8 @@ skillshare install ~/Downloads/my-skill skillshare install /absolute/path/to/skill ``` +本機路徑會複製到 source 目錄。在 global mode 中,`./my-skill` 這類相對路徑會記錄為絕對路徑,因此 `update` 和 [`check`](./check.md#local-path-installs) 在任何目錄下都能找到它。在 project mode 中,由於 `.skillshare/config.yaml` 會在多台機器之間共用,路徑會照輸入原樣記錄。 + :::tip 模糊子目錄解析 指定像 `owner/repo/skill-name` 這樣的子目錄路徑時,如果該 repo 中沒有完全相符的路徑,skillshare 會掃描所有 `SKILL.md` 檔案,並依目錄基礎名稱比對。如果有多個 skills 共用同一個名稱,會顯示含完整路徑的模糊錯誤,讓你指定確切的那一個。 :::