feat(ui): redesign the Hubs page around one list with in-place editing

Previewing a hub from the builder landed on an empty "pick a hub" state:
the builder and the browser kept separate copies of the drafts and the
browser's copy went stale. Merging both into one page removes the split,
so your own hub is shown exactly as others will see it and edited in place.

Hub entries can now be added from any repository URL, not only from
installed skills, with a branch or tag picked from the remote. The version
is written into the source URL, the only place the hub format keeps it,
and a new /api/hub/refs endpoint lists refs and rewrites sources so the UI
never builds tree/<ref> URLs itself. Skills added from installed ones keep
the version they were installed from.

Draft reads and saves read refs from the URLs only, so opening a hub never
waits on a remote. Added hubs get unique labels, since the default hub is
stored by label.
This commit is contained in:
Willie
2026-09-28 23:39:19 +08:00
parent cbaa140289
commit 13a93242f8
39 changed files with 2715 additions and 1346 deletions
+29 -3
View File
@@ -31,7 +31,7 @@ func DraftCandidates(sourcePath string) ([]DraftEntry, error) {
if candidate == nil || !candidate.Tracked {
continue
}
parsed, err := install.ParseSource(candidate.Source)
parsed, err := parseInstalled(candidate)
if err == nil && parsed.Subdir == "" {
entry = candidate
relative, err := filepath.Rel(parent, skill.RelPath)
@@ -43,10 +43,10 @@ func DraftCandidates(sourcePath string) ([]DraftEntry, error) {
}
}
if entry != nil && entry.Source != "" {
setField(data, "source", entry.Source)
setField(data, "source", installedSource(entry))
if selector != "" {
setField(data, "skill", selector)
} else if parsed, err := install.ParseSource(entry.Source); err == nil && parsed.Subdir == "" && entry.Subdir != "" {
} else if parsed, err := parseInstalled(entry); err == nil && parsed.Subdir == "" && entry.Subdir != "" {
setField(data, "skill", entry.Subdir)
}
}
@@ -64,3 +64,29 @@ func DraftCandidates(sourcePath string) ([]DraftEntry, error) {
sort.Slice(entries, func(i, j int) bool { return entries[i].ID < entries[j].ID })
return entries, nil
}
// parseInstalled parses the entry's source as it was installed, so a web URL
// whose ref contains "/" splits into ref and subdir as the install did.
func parseInstalled(entry *install.MetadataEntry) (*install.Source, error) {
parsed, err := install.ParseSource(entry.Source)
if err == nil && entry.Branch != "" {
parsed.ApplyRecordedBranch(entry.Branch)
}
return parsed, err
}
// installedSource returns the entry's source pinned at the ref it was
// installed from, so the hub entry installs the same version.
func installedSource(entry *install.MetadataEntry) string {
if entry.Branch == "" {
return entry.Source
}
parsed, err := parseInstalled(entry)
if err != nil {
return entry.Source
}
if pinned, err := parsed.AtRef(entry.Branch); err == nil {
return pinned
}
return entry.Source
}
+13
View File
@@ -119,6 +119,19 @@ func validateDraft(d Draft) error {
return nil
}
// DraftRefs maps each entry whose source names a ref to that ref. It never
// asks a remote, since every read and save of a draft goes through it: a ref
// containing "/" shows only its first segment until the editor settles it.
func DraftRefs(d Draft, opts install.ParseOptions) map[string]string {
refs := make(map[string]string)
for _, e := range d.Entries {
if ref := install.SourceRef(field(e.Data, "source"), opts, nil); ref != "" {
refs[e.ID] = ref
}
}
return refs
}
// DraftProblems lists all blockers, including local skills; none are silently omitted.
func DraftProblems(d Draft) []DraftProblem {
problems := make([]DraftProblem, 0)
+26
View File
@@ -201,3 +201,29 @@ func TestDraftCandidatesTrackedRepository(t *testing.T) {
t.Fatalf("tracked source lost: %#v", entries[0])
}
}
func TestDraftCandidatesKeepInstalledRef(t *testing.T) {
root := t.TempDir()
for _, path := range []string{"review", "_team/skills/lint"} {
os.MkdirAll(filepath.Join(root, path), 0755)
os.WriteFile(filepath.Join(root, path, "SKILL.md"), []byte("---\nname: x\n---\nX."), 0644)
}
os.MkdirAll(filepath.Join(root, "_team", ".git"), 0755)
os.WriteFile(filepath.Join(root, ".metadata.json"), []byte(`{"version":1,"entries":{
"review":{"source":"acme/repo","subdir":"skills/review","branch":"v1.2.0"},
"_team":{"source":"github.com/acme/team/tree/release/2","tracked":true,"branch":"release/2"}}}`), 0644)
entries, err := DraftCandidates(root)
if err != nil || len(entries) != 2 {
t.Fatalf("candidates: %v %#v", err, entries)
}
got := map[string]string{}
for _, e := range entries {
got[e.ID] = field(e.Data, "source") + " " + field(e.Data, "skill")
}
if want := "github.com/acme/repo/tree/v1.2.0 skills/review"; got["review"] != want {
t.Errorf("review = %q, want %q", got["review"], want)
}
if want := "github.com/acme/team/tree/release/2 skills/lint"; got["_team/skills/lint"] != want {
t.Errorf("tracked = %q, want %q", got["_team/skills/lint"], want)
}
}
+8
View File
@@ -140,6 +140,9 @@ type Source struct {
// webRef is the {ref}/{path} tail of a tree/, blob/ or src/ web URL,
// kept so a ref containing "/" can be resolved at install time.
webRef webRef
// webHost is "gitlab" or "bitbucket" for HTTPS sources on those hosts,
// whose web URLs can name a ref.
webHost string
}
// GitHub URL pattern: github.com/owner/repo[/path/to/subdir]
@@ -716,6 +719,11 @@ func parseGitHTTPS(matches []string, source *Source, opts ParseOptions) (*Source
source.Type = SourceTypeGitHTTPS
source.CloneURL = fmt.Sprintf("%s://%s/%s.git", schema, host, repoPath)
if strings.Contains(host, "bitbucket") {
source.webHost = "bitbucket"
} else if isGitLabHost(host, opts.GitLabHosts) {
source.webHost = "gitlab"
}
if err := validateCloneURL(source.CloneURL); err != nil {
return nil, err
+205 -17
View File
@@ -2,8 +2,12 @@ package install
import (
"context"
"errors"
"fmt"
"os/exec"
"path"
"slices"
"strconv"
"strings"
)
@@ -53,10 +57,23 @@ func (s *Source) applyWebRef(w webRef) string {
// RemoteRefs caches each remote's branch and tag names, so resolving many web
// URLs from one repo lists its refs once. The zero value is ready to use.
type RemoteRefs struct {
byURL map[string]map[string]bool
byURL map[string]*RefList
}
func (r *RemoteRefs) list(s *Source) (map[string]bool, error) {
// RefList is a remote's default branch, branches and tags. Branches are
// sorted by name; tags newest version first.
type RefList struct {
DefaultBranch string
Branches []string
Tags []string
}
func (l *RefList) has(ref string) bool {
return slices.Contains(l.Branches, ref) || slices.Contains(l.Tags, ref)
}
// List returns the source remote's refs, listing each remote once.
func (r *RemoteRefs) List(s *Source) (*RefList, error) {
if refs, ok := r.byURL[s.CloneURL]; ok {
return refs, nil
}
@@ -65,7 +82,7 @@ func (r *RemoteRefs) list(s *Source) (map[string]bool, error) {
return nil, err
}
if r.byURL == nil {
r.byURL = make(map[string]map[string]bool)
r.byURL = make(map[string]*RefList)
}
r.byURL[s.CloneURL] = refs
return refs, nil
@@ -95,17 +112,17 @@ func (r *RemoteRefs) Resolve(s *Source) error {
return s.settleWebRef(first)
}
refs, err := r.list(s)
refs, err := r.List(s)
if err != nil {
return nil // let the clone report the real problem
}
if refs[first] {
if refs.has(first) {
return s.settleWebRef(first)
}
override := s.Branch != "" && s.Branch != first
segments := strings.Split(w.tail, "/")
for i := len(segments); i > 1; i-- {
if ref := strings.Join(segments[:i], "/"); refs[ref] {
if ref := strings.Join(segments[:i], "/"); refs.has(ref) {
if !override {
s.Branch = ref
}
@@ -118,6 +135,17 @@ func (r *RemoteRefs) Resolve(s *Source) error {
return fmt.Errorf("ref %q from the URL was not found on the remote; pass --branch to choose one (needed when a branch name contains \"/\")", first)
}
// Settle resolves the source's URL ref like Resolve, but reads a ref the
// remote does not have, or a remote that cannot be listed, as the URL's first
// segment, so the source can be re-pinned with AtRef.
func (r *RemoteRefs) Settle(s *Source) error {
if err := r.Resolve(s); err == nil && !s.HasAmbiguousWebRef() {
return nil
}
first, _, _ := strings.Cut(s.webRef.tail, "/")
return s.settleWebRef(first)
}
// HasAmbiguousWebRef reports whether the source's URL ref might contain "/",
// so its real ref and subdir are only known after Resolve.
func (s *Source) HasAmbiguousWebRef() bool {
@@ -157,33 +185,89 @@ func (s *Source) settleWebRef(ref string) error {
return nil
}
// listRemoteRefs returns the remote's branch and tag names.
func listRemoteRefs(s *Source) (map[string]bool, error) {
// listRemoteRefs returns the remote's default branch, branches and tags.
func listRemoteRefs(s *Source) (*RefList, error) {
ctx, cancel := context.WithTimeout(context.Background(), gitCommandTimeout)
defer cancel()
cmd := gitCommand(ctx, "ls-remote", "--heads", "--tags", s.CloneURL)
cmd := gitCommand(ctx, "ls-remote", "--symref", s.CloneURL, "HEAD", "refs/heads/*", "refs/tags/*")
cmd.Env = append(cmd.Env, s.authEnv()...)
out, err := cmd.Output()
if err != nil {
return nil, err
var exitErr *exec.ExitError
if errors.As(err, &exitErr) && len(exitErr.Stderr) > 0 {
return nil, fmt.Errorf("git ls-remote: %s", strings.TrimSpace(string(exitErr.Stderr)))
}
return nil, fmt.Errorf("git ls-remote: %w", err)
}
refs := make(map[string]bool)
refs := &RefList{Branches: []string{}, Tags: []string{}}
for _, line := range strings.Split(string(out), "\n") {
_, name, ok := strings.Cut(strings.TrimSpace(line), "\t")
value, name, ok := strings.Cut(strings.TrimSpace(line), "\t")
if !ok {
continue
}
name = strings.TrimSuffix(name, "^{}")
if b, ok := strings.CutPrefix(name, "refs/heads/"); ok {
refs[b] = true
} else if t, ok := strings.CutPrefix(name, "refs/tags/"); ok {
refs[t] = true
if target, ok := strings.CutPrefix(value, "ref: refs/heads/"); ok && name == "HEAD" {
refs.DefaultBranch = target
} else if b, ok := strings.CutPrefix(name, "refs/heads/"); ok {
refs.Branches = append(refs.Branches, b)
} else if t, ok := strings.CutPrefix(name, "refs/tags/"); ok && !strings.HasSuffix(t, "^{}") {
refs.Tags = append(refs.Tags, t)
}
}
slices.Sort(refs.Branches)
slices.SortFunc(refs.Tags, compareTagsNewestFirst)
return refs, nil
}
// compareTagsNewestFirst orders version tags (v1.2.0, 1.2) by descending
// version, before any other tags, which follow in reverse name order.
func compareTagsNewestFirst(a, b string) int {
va, okA := parseTagVersion(a)
vb, okB := parseTagVersion(b)
switch {
case okA && okB:
if c := slices.Compare(vb.numbers, va.numbers); c != 0 {
return c
}
// A release sorts before its pre-releases.
if (va.pre == "") != (vb.pre == "") {
if va.pre == "" {
return -1
}
return 1
}
return strings.Compare(b, a)
case okA:
return -1
case okB:
return 1
}
return strings.Compare(b, a)
}
type tagVersion struct {
numbers []int
pre string
}
func parseTagVersion(tag string) (tagVersion, bool) {
core, pre, _ := strings.Cut(strings.TrimPrefix(tag, "v"), "-")
core, _, _ = strings.Cut(core, "+")
parts := strings.Split(core, ".")
if len(parts) > 3 {
return tagVersion{}, false
}
numbers := make([]int, 3)
for i, p := range parts {
n, err := strconv.Atoi(p)
if err != nil || n < 0 {
return tagVersion{}, false
}
numbers[i] = n
}
return tagVersion{numbers: numbers, pre: pre}, true
}
// ApplyRecordedBranch sets the branch a skill was installed with, for
// reinstalling it from its recorded source URL. An empty branch means the
// remote default even when the URL names a ref: installs from before URL refs
@@ -200,3 +284,107 @@ func (s *Source) ApplyRecordedBranch(branch string) {
_ = s.settleWebRef(branch)
}
}
// ErrRefNotPinnable reports a source whose URL cannot name a ref: only
// GitHub, GitLab and Bitbucket web URLs can.
var ErrRefNotPinnable = errors.New("only GitHub, GitLab and Bitbucket sources can pin a ref")
// webRepo returns the repo's web URL and the path markers that come before a
// ref in tree and file URLs, or ok=false for hosts whose URLs cannot name a ref.
func (s *Source) webRepo() (repo, tree, blob string, ok bool) {
base := strings.TrimSuffix(s.CloneURL, ".git")
switch {
case s.Type == SourceTypeGitHub:
return strings.TrimPrefix(base, "https://"), "tree", "blob", true
case s.Type == SourceTypeGitHTTPS && s.webHost == "gitlab":
return base, "-/tree", "-/blob", true
case s.Type == SourceTypeGitHTTPS && s.webHost == "bitbucket":
return base, "src", "src", true
}
return "", "", "", false
}
// PinnedRef returns the ref the source's URL names ("" for the remote
// default branch), and ok=false when the source cannot name one. A ref that
// may contain "/" is only its first segment until RemoteRefs.Resolve.
func (s *Source) PinnedRef() (ref string, ok bool) {
if _, _, _, ok := s.webRepo(); !ok {
return "", false
}
return s.Branch, true
}
// AtRef returns the source as a web URL that pins ref, keeping its subdir and
// SKILL.md target. An empty ref means the remote default branch.
func (s *Source) AtRef(ref string) (string, error) {
repo, tree, blob, ok := s.webRepo()
if !ok {
return "", ErrRefNotPinnable
}
if s.HasAmbiguousWebRef() {
return "", fmt.Errorf("the ref in %q could not be resolved", s.Raw)
}
if ref != "" && (strings.ContainsAny(ref, " \t\r\n?#\\") || strings.Contains(ref, "..") ||
strings.HasPrefix(ref, "/") || strings.HasSuffix(ref, "/") || strings.HasPrefix(ref, "-")) {
return "", fmt.Errorf("invalid ref %q", ref)
}
marker, tail := tree, s.Subdir
if s.ExplicitSkill {
marker, tail = blob, path.Join(s.Subdir, "SKILL.md")
}
if ref == "" {
// GitHub URLs need no ref. Elsewhere a repo root keeps ".git" and a path
// gets HEAD for the default branch, so a path joined on later is not
// read as part of the repo.
if !s.ExplicitSkill && s.Type == SourceTypeGitHub {
return joinURLPath(repo, s.Subdir), nil
}
if !s.ExplicitSkill && s.Subdir == "" {
return repo + ".git", nil
}
ref = "HEAD"
}
return joinURLPath(repo, marker, ref, tail), nil
}
func joinURLPath(parts ...string) string {
return strings.Join(slices.DeleteFunc(parts, func(p string) bool { return p == "" }), "/")
}
// SourceAtRef rewrites a GitHub, GitLab or Bitbucket source as a web URL
// pinned at ref (the remote default branch when ref is empty). A URL ref that
// may contain "/" is settled against the remote first.
func SourceAtRef(raw, ref string, opts ParseOptions) (string, error) {
s, err := ParseSourceWithOptions(raw, opts)
if err != nil {
return "", err
}
if _, _, _, ok := s.webRepo(); !ok {
return "", ErrRefNotPinnable
}
if err := (&RemoteRefs{}).Settle(s); err != nil {
return "", err
}
return s.AtRef(ref)
}
// SourceRef returns the ref a source's URL names, or "" for the default
// branch, other hosts and unparseable sources. A ref that may contain "/" is
// settled against the remote, listed once per remote through refs; with nil
// refs it stays the URL's first segment and nothing is asked of the remote.
func SourceRef(raw string, opts ParseOptions, refs *RemoteRefs) string {
s, err := ParseSourceWithOptions(raw, opts)
if err != nil {
return ""
}
if _, ok := s.PinnedRef(); !ok {
return ""
}
if refs != nil {
// Settle only fails on an invalid subdir, which install reports; the
// ref it settled on still stands.
_ = refs.Settle(s)
}
ref, _ := s.PinnedRef()
return ref
}
+97
View File
@@ -1,6 +1,8 @@
package install
import (
"errors"
"fmt"
"os"
"path/filepath"
"strings"
@@ -200,3 +202,98 @@ func TestApplyRecordedBranch(t *testing.T) {
})
}
}
func TestRemoteRefs_ListSplitsBranchesAndTags(t *testing.T) {
remote := newRefsRemote(t)
for _, tag := range []string{"v1.10.0", "v1.2.0", "v1.2.0-rc.1", "nightly"} {
runGit(t, remote, "tag", "-a", tag, "-m", tag)
}
var refs RemoteRefs
list, err := refs.List(parseWithRemote(t, "github.com/o/r", remote))
if err != nil {
t.Fatalf("List: %v", err)
}
got := fmt.Sprintf("%s %v %v", list.DefaultBranch, list.Branches, list.Tags)
want := "main [feature/x main] [v1.10.0 v1.2.0 v1.2.0-rc.1 v1.0 nightly]"
if got != want {
t.Errorf("refs = %s, want %s", got, want)
}
}
func TestSourceAtRef(t *testing.T) {
tests := []struct {
name, raw, ref, want string
}{
{"github shorthand", "o/r/skills/foo", "v1.2.0", "github.com/o/r/tree/v1.2.0/skills/foo"},
{"github URL replaces its ref", "https://github.com/o/r/tree/v1.0/skills/foo", "main", "github.com/o/r/tree/main/skills/foo"},
{"slash branch is replaced whole", "github.com/o/r/tree/feature/x/skills/foo", "v1.0", "github.com/o/r/tree/v1.0/skills/foo"},
{"ref the remote lacks is replaced", "github.com/o/r/tree/master/skills/foo", "main", "github.com/o/r/tree/main/skills/foo"},
{"github file URL stays a file URL", "github.com/o/r/blob/v1.0/skills/foo/SKILL.md", "v2", "github.com/o/r/blob/v2/skills/foo/SKILL.md"},
{"github default branch drops the ref", "github.com/o/r/tree/v1.0/skills/foo", "", "github.com/o/r/skills/foo"},
{"gitlab", "https://gitlab.com/g/r/-/tree/main/skills/foo", "v1.0", "https://gitlab.com/g/r/-/tree/v1.0/skills/foo"},
{"gitlab default branch keeps the subdir apart", "https://gitlab.com/g/r/-/tree/v1.0/skills/foo", "", "https://gitlab.com/g/r/-/tree/HEAD/skills/foo"},
{"gitlab repo root", "https://gitlab.com/g/r.git", "v1.0", "https://gitlab.com/g/r/-/tree/v1.0"},
{"bitbucket", "https://bitbucket.org/o/r/src/main/skills/foo", "v1.0", "https://bitbucket.org/o/r/src/v1.0/skills/foo"},
{"gitlab default branch at the root", "https://gitlab.com/g/r/-/tree/v1.0", "", "https://gitlab.com/g/r.git"},
{"bitbucket default branch at the root", "https://bitbucket.org/o/r/src/v1.0", "", "https://bitbucket.org/o/r.git"},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
source, err := ParseSource(tt.raw)
if err != nil {
t.Fatal(err)
}
// Stand in for the remote so no test touches the network.
refs := RemoteRefs{byURL: map[string]*RefList{
source.CloneURL: {Branches: []string{"feature/x", "main"}, Tags: []string{"v1.0"}},
}}
if err := refs.Settle(source); err != nil {
t.Fatalf("Settle: %v", err)
}
got, err := source.AtRef(tt.ref)
if err != nil {
t.Fatalf("AtRef: %v", err)
}
if got != tt.want {
t.Errorf("AtRef(%q) of %q = %q, want %q", tt.ref, tt.raw, got, tt.want)
}
if ref := SourceRef(got, ParseOptions{}, &refs); ref != tt.ref {
t.Errorf("SourceRef(%q) = %q, want %q", got, ref, tt.ref)
}
})
}
}
// The dashboard joins a skill's path onto a repo root pinned at the default
// branch, so that root must keep the repo and the path apart.
func TestSourceAtRef_DefaultBranchRootTakesAPath(t *testing.T) {
for _, raw := range []string{"https://gitlab.com/g/r/-/tree/v1.0", "https://bitbucket.org/o/r/src/v1.0"} {
source, err := ParseSource(raw)
if err != nil {
t.Fatal(err)
}
refs := RemoteRefs{byURL: map[string]*RefList{source.CloneURL: {Tags: []string{"v1.0"}}}}
if err := refs.Settle(source); err != nil {
t.Fatalf("Settle: %v", err)
}
root, err := source.AtRef("")
if err != nil {
t.Fatalf("AtRef: %v", err)
}
joined, err := ParseSource(root + "/skills/foo")
if err != nil {
t.Fatal(err)
}
if joined.CloneURL != source.CloneURL || joined.Subdir != "skills/foo" {
t.Errorf("%q/skills/foo parsed as repo %q subdir %q, want repo %q subdir skills/foo", root, joined.CloneURL, joined.Subdir, source.CloneURL)
}
}
}
func TestSourceAtRef_RejectsOtherHosts(t *testing.T) {
for _, raw := range []string{"https://git.example.com/o/r", "git@github.com:o/r.git", "/tmp/skills", "file:///tmp/r"} {
if _, err := SourceAtRef(raw, "v1.0", ParseOptions{}); !errors.Is(err, ErrRefNotPinnable) {
t.Errorf("SourceAtRef(%q) err = %v, want ErrRefNotPinnable", raw, err)
}
}
}
+9 -6
View File
@@ -30,8 +30,11 @@ func draftError(w http.ResponseWriter, err error) {
writeError(w, status, err.Error())
}
func writeDraft(w http.ResponseWriter, d hub.Draft) {
writeJSON(w, map[string]any{"draft": d, "problems": hub.DraftProblems(d)})
func (s *Server) writeDraft(w http.ResponseWriter, d hub.Draft) {
s.mu.RLock()
parseOpts := s.parseOpts()
s.mu.RUnlock()
writeJSON(w, map[string]any{"draft": d, "problems": hub.DraftProblems(d), "refs": hub.DraftRefs(d, parseOpts)})
}
func decodeDraftBody(w http.ResponseWriter, r *http.Request, dst any) error {
@@ -80,7 +83,7 @@ func (s *Server) handleHubDrafts(w http.ResponseWriter, r *http.Request) {
return
}
s.writeOpsLog("hub-draft-create", "ok", start, map[string]any{"id": created.ID}, "")
writeDraft(w, created)
s.writeDraft(w, created)
}
func (s *Server) handleHubDraft(w http.ResponseWriter, r *http.Request) {
@@ -93,7 +96,7 @@ func (s *Server) handleHubDraft(w http.ResponseWriter, r *http.Request) {
draftError(w, err)
return
}
writeDraft(w, d)
s.writeDraft(w, d)
case http.MethodPut:
var d hub.Draft
if err := decodeDraftBody(w, r, &d); err != nil {
@@ -107,7 +110,7 @@ func (s *Server) handleHubDraft(w http.ResponseWriter, r *http.Request) {
return
}
s.writeOpsLog("hub-draft-save", "ok", start, map[string]any{"id": id}, "")
writeDraft(w, saved)
s.writeDraft(w, saved)
case http.MethodDelete:
if err := store.Delete(id, r.URL.Query().Get("revision")); err != nil {
draftError(w, err)
@@ -136,7 +139,7 @@ func (s *Server) handleHubDraftImport(w http.ResponseWriter, r *http.Request) {
return
}
s.writeOpsLog("hub-draft-import", "ok", start, map[string]any{"id": d.ID}, "")
writeDraft(w, d)
s.writeDraft(w, d)
}
func (s *Server) handleHubDraftExport(w http.ResponseWriter, r *http.Request) {
+73
View File
@@ -0,0 +1,73 @@
package server
import (
"encoding/json"
"net/http"
"skillshare/internal/install"
)
type hubRefsResponse struct {
Pinnable bool `json:"pinnable"`
Current string `json:"current"`
DefaultBranch string `json:"defaultBranch"`
Branches []string `json:"branches"`
Tags []string `json:"tags"`
Source *string `json:"source,omitempty"`
}
// handleHubRefs lists the branches and tags a hub entry's source can pin, and
// with "ref" in the body also returns the source rewritten to pin that ref.
func (s *Server) handleHubRefs(w http.ResponseWriter, r *http.Request) {
s.mu.RLock()
parseOpts := s.parseOpts()
s.mu.RUnlock()
var body struct {
Source string `json:"source"`
Ref *string `json:"ref"`
}
if err := json.NewDecoder(r.Body).Decode(&body); err != nil {
writeError(w, http.StatusBadRequest, "invalid JSON body")
return
}
if body.Source == "" {
writeError(w, http.StatusBadRequest, "source is required")
return
}
source, err := install.ParseSourceWithOptions(body.Source, parseOpts)
if err != nil {
writeError(w, http.StatusBadRequest, "invalid source: "+err.Error())
return
}
resp := hubRefsResponse{Branches: []string{}, Tags: []string{}}
if _, ok := source.PinnedRef(); !ok {
writeJSON(w, resp)
return
}
var refs install.RemoteRefs
list, err := refs.List(source)
if err != nil {
writeError(w, http.StatusInternalServerError, err.Error())
return
}
if err := refs.Settle(source); err != nil {
writeError(w, http.StatusBadRequest, "invalid source: "+err.Error())
return
}
resp.Pinnable = true
resp.Current, _ = source.PinnedRef()
resp.DefaultBranch = list.DefaultBranch
resp.Branches = list.Branches
resp.Tags = list.Tags
if body.Ref != nil {
pinned, err := source.AtRef(*body.Ref)
if err != nil {
writeError(w, http.StatusBadRequest, err.Error())
return
}
resp.Source = &pinned
}
writeJSON(w, resp)
}
+87
View File
@@ -0,0 +1,87 @@
package server
import (
"bytes"
"encoding/json"
"maps"
"net/http"
"net/http/httptest"
"os"
"path/filepath"
"testing"
)
func postHubRefs(t *testing.T, s *Server, body string) *httptest.ResponseRecorder {
t.Helper()
rr := httptest.NewRecorder()
s.handler.ServeHTTP(rr, httptest.NewRequest("POST", "/api/hub/refs", bytes.NewBufferString(body)))
return rr
}
func TestHubRefs_RejectsInvalidSource(t *testing.T) {
s, _ := newTestServer(t)
for _, body := range []string{`{}`, `{"source":""}`, `not json`} {
if rr := postHubRefs(t, s, body); rr.Code != http.StatusBadRequest {
t.Errorf("%s: status %d, want 400", body, rr.Code)
}
}
}
func TestHubRefs_NotPinnable(t *testing.T) {
s, _ := newTestServer(t)
rr := postHubRefs(t, s, `{"source":"https://git.example.com/o/r/skills/foo","ref":"v1"}`)
if rr.Code != http.StatusOK {
t.Fatalf("status %d: %s", rr.Code, rr.Body.String())
}
want := `{"pinnable":false,"current":"","defaultBranch":"","branches":[],"tags":[]}`
if got := bytes.TrimSpace(rr.Body.Bytes()); string(got) != want {
t.Errorf("body = %s, want %s", got, want)
}
}
// Draft refs are read from the URLs alone, without asking the remote.
func TestHubDraftRefs(t *testing.T) {
s, _ := newTestServer(t)
rr := httptest.NewRecorder()
body := `{"schemaVersion":1,"skills":[` +
`{"name":"a","source":"github.com/acme/r/tree/v1.0/skills/a"},` +
`{"name":"b","source":"acme/r/skills/b"}]}`
s.handler.ServeHTTP(rr, httptest.NewRequest("POST", "/api/hub/drafts/import", bytes.NewBufferString(body)))
var resp struct {
Draft struct {
Entries []struct {
ID string `json:"id"`
} `json:"entries"`
} `json:"draft"`
Refs map[string]string `json:"refs"`
}
if err := json.Unmarshal(rr.Body.Bytes(), &resp); err != nil || len(resp.Draft.Entries) != 2 {
t.Fatalf("import: %d %s", rr.Code, rr.Body.String())
}
entries := resp.Draft.Entries
want := map[string]string{entries[0].ID: "v1.0"}
if !maps.Equal(resp.Refs, want) {
t.Errorf("refs = %v, want %v", resp.Refs, want)
}
}
func TestHandleSearch_BuiltinResultsCarryRef(t *testing.T) {
s, src := newTestServer(t)
os.MkdirAll(filepath.Join(src, "foo"), 0755)
os.WriteFile(filepath.Join(src, "foo", "SKILL.md"), []byte("---\nname: foo\n---\nFoo."), 0644)
os.WriteFile(filepath.Join(src, ".metadata.json"), []byte(`{"version":1,"entries":{"foo":{"source":"github.com/acme/r/tree/v2.0/skills/foo"}}}`), 0644)
rr := httptest.NewRecorder()
s.handler.ServeHTTP(rr, httptest.NewRequest("GET", "/api/search?q=foo&hub=@builtin", nil))
var resp struct {
Results []struct {
Ref string `json:"ref"`
} `json:"results"`
}
if err := json.Unmarshal(rr.Body.Bytes(), &resp); err != nil || len(resp.Results) != 1 {
t.Fatalf("search: %d %s", rr.Code, rr.Body.String())
}
if resp.Results[0].Ref != "v2.0" {
t.Errorf("ref = %q, want v2.0", resp.Results[0].Ref)
}
}
+10 -5
View File
@@ -16,6 +16,7 @@ func (s *Server) handleSearch(w http.ResponseWriter, r *http.Request) {
// Snapshot config under RLock, then release before I/O.
s.mu.RLock()
source := s.skillsSource()
parseOpts := s.parseOpts()
hubCfg := s.cfg.Hub
if s.IsProjectMode() && s.projectCfg != nil {
hubCfg = s.projectCfg.Hub
@@ -63,6 +64,7 @@ func (s *Server) handleSearch(w http.ResponseWriter, r *http.Request) {
Name string `json:"name"`
Description string `json:"description"`
Source string `json:"source"`
Ref string `json:"ref,omitempty"`
Skill string `json:"skill,omitempty"`
Stars int `json:"stars"`
Owner string `json:"owner"`
@@ -76,11 +78,14 @@ func (s *Server) handleSearch(w http.ResponseWriter, r *http.Request) {
Name: r.Name,
Description: r.Description,
Source: r.Source,
Skill: r.Skill,
Stars: r.Stars,
Owner: r.Owner,
Repo: r.Repo,
Tags: r.Tags,
// A hosted index can hold hundreds of entries, so the remote is not
// asked; a branch containing "/" shows as its first segment.
Ref: install.SourceRef(r.Source, parseOpts, nil),
Skill: r.Skill,
Stars: r.Stars,
Owner: r.Owner,
Repo: r.Repo,
Tags: r.Tags,
})
}
+1
View File
@@ -476,6 +476,7 @@ func (s *Server) registerRoutes() {
s.mux.HandleFunc("DELETE /api/hub/drafts/{id}", s.handleHubDraft)
s.mux.HandleFunc("POST /api/hub/drafts/{id}/export", s.handleHubDraftExport)
s.mux.HandleFunc("GET /api/hub/index", s.handleHubIndex)
s.mux.HandleFunc("POST /api/hub/refs", s.handleHubRefs)
s.mux.HandleFunc("GET /api/hub/saved", s.handleGetHubSaved)
s.mux.HandleFunc("PUT /api/hub/saved", s.handlePutHubSaved)
s.mux.HandleFunc("POST /api/hub/saved", s.handlePostHubSaved)
+2
View File
@@ -1207,6 +1207,8 @@ export interface SearchResult {
owner: string;
repo: string;
tags?: string[];
/** Branch or tag the source names; empty or absent means the default branch. */
ref?: string;
}
export interface SkillPreview {
+19 -1
View File
@@ -14,7 +14,21 @@ export interface HubDraft {
fields: Record<string, unknown>;
}
export interface HubProblem { entryId: string; code: string }
export interface DraftResponse { draft: HubDraft; problems: HubProblem[] }
export interface DraftResponse {
draft: HubDraft;
problems: HubProblem[];
/** Branch or tag each entry's source names, keyed by entry id; entries on the default branch are absent. */
refs?: Record<string, string>;
}
/** Versions a source can be pinned to. `source` is set only when a `ref` was asked for. */
export interface HubRefs {
pinnable: boolean;
current: string;
defaultBranch: string;
branches: string[];
tags: string[];
source?: string;
}
const root = '/hub/drafts';
const json = (method: string, data: unknown) => ({ method, body: JSON.stringify(data) });
export const hubDrafts = {
@@ -28,6 +42,10 @@ export const hubDrafts = {
export: (draft: HubDraft) => apiFetch<Record<string, unknown>>(`${root}/${encodeURIComponent(draft.id)}/export`, json('POST', { revision: draft.revision })),
};
/** Lists a source's branches and tags; with `ref` ("" = default branch), also returns the source rewritten to it. */
export const hubRefs = (source: string, ref?: string) =>
apiFetch<HubRefs>('/hub/refs', json('POST', ref === undefined ? { source } : { source, ref }));
export function hubAddCommand(location: string, label: string): string {
const quote = (s: string) => `'${s.replace(/'/g, `'"'"'`)}'`;
return `skillshare hub add ${quote(location.trim())}${label.trim() ? ` --label ${quote(label.trim())}` : ''}`;
+110
View File
@@ -0,0 +1,110 @@
import { useEffect, useRef, useState } from 'react';
import { FilePlus, Plus, Upload } from 'lucide-react';
import Button from '../Button';
import { useT } from '../../i18n';
interface Props {
/** Rejects with a message the menu shows under the field. */
onAdd: (url: string) => Promise<void>;
onCreate: () => void;
onImport: (file: File) => void;
}
/** One entry point for every way a hub gets into the list. */
export default function AddHubMenu({ onAdd, onCreate, onImport }: Props) {
const t = useT();
const [open, setOpen] = useState(false);
const [url, setURL] = useState('');
const [error, setError] = useState('');
const [busy, setBusy] = useState(false);
const ref = useRef<HTMLDivElement>(null);
const fileInput = useRef<HTMLInputElement>(null);
useEffect(() => {
if (!open) return;
const onDown = (e: MouseEvent) => {
if (ref.current && !ref.current.contains(e.target as Node)) setOpen(false);
};
const onKey = (e: KeyboardEvent) => {
if (e.key === 'Escape') setOpen(false);
};
document.addEventListener('mousedown', onDown);
document.addEventListener('keydown', onKey);
return () => {
document.removeEventListener('mousedown', onDown);
document.removeEventListener('keydown', onKey);
};
}, [open]);
const add = async () => {
setBusy(true);
setError('');
try {
await onAdd(url);
setURL('');
setOpen(false);
} catch (e) {
setError((e as Error).message);
} finally {
setBusy(false);
}
};
return (
<div ref={ref} className="relative">
<input
ref={fileInput}
type="file"
accept=".json,application/json"
className="hidden"
aria-label={t('hubs.add.import')}
onChange={(e) => {
const file = e.target.files?.[0];
e.target.value = '';
if (file) onImport(file);
}}
/>
<button type="button" className="ss-btn w-full" aria-haspopup="menu" aria-expanded={open} onClick={() => setOpen(!open)}>
<Plus size={14} />
{t('hubs.addOrCreate')}
</button>
{open && (
<div role="menu" aria-label={t('hubs.addOrCreate')} className="ss-menu absolute left-0 top-full z-50 mt-2 !w-[400px] animate-dropdown-in">
<form
className="flex flex-col gap-2 px-2.5 pt-2.5 pb-3"
onSubmit={(e) => { e.preventDefault(); void add(); }}
>
<label htmlFor="hub-add-url" className="text-[13px] font-semibold">{t('hubs.add.existing')}</label>
<div className="flex gap-2">
<span className="ss-inp min-w-0 flex-1">
<input
id="hub-add-url"
autoFocus
value={url}
disabled={busy}
placeholder={t('install.hubs.urlPlaceholder')}
onChange={(e) => { setURL(e.target.value); setError(''); }}
/>
</span>
<Button type="submit" loading={busy}>{t('install.hubs.addButton')}</Button>
</div>
{error ? <span className="text-[12.5px] text-bad">{error}</span> : <span className="text-xs text-ink-3">{t('hubs.add.hint')}</span>}
</form>
<hr />
{[
{ icon: FilePlus, title: t('hubs.add.create'), hint: t('hubs.add.createHint'), run: onCreate },
{ icon: Upload, title: t('hubs.add.import'), hint: t('hubs.add.importHint'), run: () => fileInput.current?.click() },
].map(({ icon: Icon, title, hint, run }) => (
<button key={title} type="button" role="menuitem" className="!h-auto !items-start !py-3" onClick={() => { setOpen(false); run(); }}>
<Icon size={16} className="mt-0.5 shrink-0" />
<span className="flex flex-col gap-0.5 text-start">
<span className="text-[13.5px] font-semibold text-ink">{title}</span>
<span className="text-[12.5px] font-normal text-ink-2">{hint}</span>
</span>
</button>
))}
</div>
)}
</div>
);
}
+230
View File
@@ -0,0 +1,230 @@
import { useState } from 'react';
import { useQuery } from '@tanstack/react-query';
import { X } from 'lucide-react';
import { api } from '../../api/client';
import type { DiscoveredSkill } from '../../api/client';
import { hubDrafts, hubRefs } from '../../api/hubDrafts';
import type { HubEntry, HubRefs } from '../../api/hubDrafts';
import Button from '../Button';
import DialogShell from '../DialogShell';
import Spinner from '../Spinner';
import { Checkbox, Select } from '../Input';
import { inHub, refOptions, skillSource } from './hubShared';
import { queryKeys } from '../../lib/queryKeys';
import { useT } from '../../i18n';
interface Props {
hubName: string;
/** What the hub already holds, so nothing is added twice. */
entries: HubEntry[];
onAdd: (data: HubEntry['data'][]) => void;
/** Adds an empty row to fill in by hand. */
onManual: () => void;
onClose: () => void;
}
interface Found {
/** What the user pasted. */
source: string;
refs: HubRefs;
version: string;
/** The pasted source at the chosen version; each skill's source starts from it. */
root: string;
skills: DiscoveredSkill[];
}
/** Adds skills from a Git URL, at a chosen version, or from what is installed here. */
export default function AddSkillDialog({ hubName, entries, onAdd, onManual, onClose }: Props) {
const t = useT();
const [tab, setTab] = useState<'url' | 'installed'>('url');
const [url, setURL] = useState('');
const [found, setFound] = useState<Found | null>(null);
const [busy, setBusy] = useState(false);
const [error, setError] = useState('');
const [picked, setPicked] = useState<string[]>([]);
const [query, setQuery] = useState('');
const [installedPicked, setInstalledPicked] = useState<string[]>([]);
const candidates = useQuery({
queryKey: queryKeys.hub.candidates,
queryFn: () => hubDrafts.candidates(),
enabled: tab === 'installed',
});
const foundSource = (skill: DiscoveredSkill) => skillSource(found!.root, skill.path);
const addable = (skills: DiscoveredSkill[], root: string) =>
skills.filter((s) => !inHub(entries, skillSource(root, s.path), '', s.name)).map((s) => s.path);
async function find() {
const source = url.trim();
if (!source) return;
setBusy(true);
setError('');
try {
const [refs, discovered] = await Promise.all([hubRefs(source), api.discover(source)]);
// A pasted GitLab or Bitbucket root has no marker between repo and path;
// the server's rewrite keeps the skill paths joined onto it apart.
const root = refs.pinnable ? (await hubRefs(source, refs.current)).source ?? source : source;
setFound({ source, refs, version: refs.current, root, skills: discovered.skills });
setPicked(addable(discovered.skills, root));
} catch (e) {
setFound(null);
setError((e as Error).message);
} finally {
setBusy(false);
}
}
async function changeVersion(version: string) {
if (!found) return;
setBusy(true);
setError('');
try {
const res = await hubRefs(found.source, version);
const root = res.source ?? found.source;
const discovered = await api.discover(root, version || undefined);
setFound({ ...found, version, root, skills: discovered.skills });
setPicked(addable(discovered.skills, root));
} catch (e) {
setError((e as Error).message);
} finally {
setBusy(false);
}
}
const shownCandidates = (candidates.data ?? []).filter((c) =>
`${c.data.name ?? ''} ${c.id}`.toLowerCase().includes(query.toLowerCase()));
const count = tab === 'url' ? picked.length : installedPicked.length;
const add = () => {
if (tab === 'url' && found) {
onAdd(found.skills.filter((s) => picked.includes(s.path)).map((s) => ({
name: s.name,
...(s.description ? { description: s.description } : {}),
source: foundSource(s),
})));
} else {
onAdd((candidates.data ?? []).filter((c) => installedPicked.includes(c.id)).map((c) => c.data));
}
};
const toggle = (list: string[], id: string, on: boolean) => on ? [...list, id] : list.filter((x) => x !== id);
return (
<DialogShell open onClose={onClose} maxWidth="xl" padding="none" ariaLabel={t('hubs.addSkill.title', { name: hubName })}>
<div className="dh">
<h2 className="ss-h2">{t('hubs.addSkill.title', { name: hubName })}</h2>
<button type="button" className="ss-ib" onClick={onClose} aria-label={t('common.close')}>
<X size={16} />
</button>
</div>
<div className="db">
<div className="ss-tabs" role="tablist" aria-label={t('hubs.addSkill.how')}>
{(['url', 'installed'] as const).map((k) => (
<button key={k} type="button" role="tab" aria-selected={tab === k} className={tab === k ? 'on' : ''} onClick={() => setTab(k)}>
{t(k === 'url' ? 'hubs.addSkill.tab.url' : 'hubs.addSkill.tab.installed')}
</button>
))}
</div>
{tab === 'url' ? (
<>
<form className="ss-fld" onSubmit={(e) => { e.preventDefault(); void find(); }}>
<label htmlFor="hub-skill-url">{t('hubs.addSkill.url')}</label>
<div className="flex gap-2">
<span className="ss-inp min-w-0 flex-1 font-mono">
<input id="hub-skill-url" value={url} placeholder="github.com/owner/repo" onChange={(e) => setURL(e.target.value)} />
</span>
<Button type="submit" variant="secondary" disabled={!url.trim() || busy}>{t('hubs.addSkill.find')}</Button>
</div>
<span className="hp">{t('hubs.addSkill.urlHint')}</span>
</form>
{error && <div role="alert" className="ss-note bad"><span className="flex-1 break-words">{error}</span></div>}
{busy && (
<div className="flex items-center gap-2 text-[13px] text-ink-2">
<Spinner size="sm" />
{t('hubs.browse.loading')}
</div>
)}
{found && (
<>
<div className="ss-fld">
<Select
label={t('hubs.view.version')}
className="w-full"
value={found.version}
onChange={(v) => void changeVersion(v)}
options={refOptions(t, found.refs, found.version)}
disabled={busy || !found.refs.pinnable}
/>
<span className="hp">{found.refs.pinnable ? t('hubs.addSkill.versionHint') : t('hubs.ref.fixed')}</span>
</div>
<div className="flex flex-col gap-2">
<div className="flex items-center gap-2">
<span className="text-[13px] font-semibold">
{t(found.skills.length === 1 ? 'hubs.addSkill.found.one' : 'hubs.addSkill.found.other', { count: found.skills.length })}
</span>
{found.skills.length > 1 && (
<Button variant="link" onClick={() => setPicked(addable(found.skills, found.root))}>{t('hubs.addSkill.selectAll')}</Button>
)}
</div>
{found.skills.length > 0 && (
<div className="ss-list max-h-72 overflow-auto">
{found.skills.map((s) => {
const already = inHub(entries, foundSource(s), '', s.name);
return (
<div key={s.path} className={`ss-r !min-h-11 !items-start ${already ? 'dim' : ''}`}>
<Checkbox label={s.name} hideLabel checked={picked.includes(s.path)} disabled={already} onChange={(on) => setPicked((l) => toggle(l, s.path, on))} className="mt-0.5" />
<span className="flex min-w-0 flex-1 flex-col gap-0.5">
<span className="nm m font-mono">{s.name}</span>
{s.description && <span className="text-[12.5px] text-ink-2">{s.description}</span>}
</span>
{already && <span className="whitespace-nowrap text-xs text-ink-3">{t('hubs.addSkill.inHub')}</span>}
</div>
);
})}
</div>
)}
</div>
</>
)}
</>
) : (
<>
<span className="ss-inp">
<input value={query} onChange={(e) => setQuery(e.target.value)} placeholder={t('hubBuilder.filter')} aria-label={t('hubBuilder.filter')} />
</span>
{candidates.isPending && <Spinner size="sm" />}
{candidates.isError && <div className="ss-note bad"><span className="flex-1">{(candidates.error as Error).message}</span></div>}
{candidates.data?.length === 0 && <p className="text-[13px] text-ink-2">{t('hubBuilder.noInstalled')}</p>}
{shownCandidates.length > 0 && (
<div className="ss-list max-h-80 overflow-auto">
{shownCandidates.map((c) => {
const already = inHub(entries, c.data.source ?? '', c.data.skill ?? '', c.data.name ?? '');
return (
<div key={c.id} className={`ss-r !min-h-11 !items-start ${already ? 'dim' : ''}`}>
<Checkbox label={c.data.name || c.id} hideLabel checked={installedPicked.includes(c.id)} disabled={already} onChange={(on) => setInstalledPicked((l) => toggle(l, c.id, on))} className="mt-0.5" />
<span className="flex min-w-0 flex-1 flex-col gap-0.5">
<span className="nm m font-mono">{c.data.name || c.id}</span>
<span className="truncate font-mono text-[11.5px] text-ink-3">{c.data.source || c.id}</span>
</span>
{already && <span className="whitespace-nowrap text-xs text-ink-3">{t('hubs.addSkill.inHub')}</span>}
</div>
);
})}
</div>
)}
</>
)}
</div>
<div className="df">
<Button variant="link" className="mr-auto !text-ink-2 underline underline-offset-4" onClick={onManual}>{t('hubs.addSkill.manual')}</Button>
<Button variant="secondary" onClick={onClose}>{t('common.cancel')}</Button>
<Button onClick={add} disabled={count === 0 || busy}>{t('hubs.addSkill.add', { count })}</Button>
</div>
</DialogShell>
);
}
-352
View File
@@ -1,352 +0,0 @@
import { useMemo, useState } from 'react';
import { useQuery, useQueryClient } from '@tanstack/react-query';
import { Library, Link2, Plus, Search, Star, Trash2 } from 'lucide-react';
import { api, type HubSavedEntry, type SearchResult } from '../../api/client';
import { hubDrafts, type HubEntry } from '../../api/hubDrafts';
import Button from '../Button';
import ConfirmDialog from '../ConfirmDialog';
import EmptyState from '../EmptyState';
import InstallDialog from '../InstallDialog';
import Spinner from '../Spinner';
import { Select } from '../Select';
import { queryKeys, staleTimes } from '../../lib/queryKeys';
import { useT } from '../../i18n';
/** Shipped with skillshare, so it is offered even when the user has saved nothing. */
const COMMUNITY: HubSavedEntry = {
label: 'Skillshare Hub',
url: 'https://raw.githubusercontent.com/runkids/skillshare-hub/main/skillshare-hub.json',
builtIn: true,
};
/** Prefix that marks a source as a local draft rather than a hosted index. */
const DRAFT = 'draft:';
/** A draft entry already carries everything a hub row shows; nothing is fetched. */
const draftResult = (entry: HubEntry): SearchResult => ({
name: entry.data.name ?? '',
description: entry.data.description ?? '',
source: entry.data.source ?? '',
skill: entry.data.skill,
stars: 0,
owner: '',
repo: '',
tags: entry.data.tags,
});
const sameURL = (a: string, b: string) => a.trim().replace(/\/+$/, '') === b.trim().replace(/\/+$/, '');
interface Props {
/** Set when arriving from a draft's "preview as recipient"; not saved as a subscription. */
previewURL?: string;
previewLabel?: string;
}
/**
* The consuming half of hubs: pick a saved hub, see what is inside it, install from it.
* Installing hands the source to the install dialog so the audit gate stays in one place.
*/
export default function HubBrowser({ previewURL, previewLabel }: Props) {
const t = useT();
const queryClient = useQueryClient();
const [picked, setPicked] = useState<string | null>(previewURL ?? null);
const [filter, setFilter] = useState('');
const [tag, setTag] = useState('');
const [url, setURL] = useState('');
const [label, setLabel] = useState('');
const [error, setError] = useState('');
const [busy, setBusy] = useState(false);
const [removing, setRemoving] = useState<HubSavedEntry | null>(null);
const [installing, setInstalling] = useState<string | null>(null);
const { data: config } = useQuery({
queryKey: queryKeys.hubConfig,
queryFn: () => api.getHubConfig(),
staleTime: staleTimes.config,
});
const { data: drafts = [] } = useQuery({ queryKey: ['hub', 'drafts'], queryFn: () => hubDrafts.list() });
const hubs = useMemo(() => {
const saved = (config?.hubs ?? []).filter((h) => !sameURL(h.url, COMMUNITY.url));
const list = [COMMUNITY, ...saved];
if (previewURL && !previewURL.startsWith(DRAFT) && !list.some((h) => sameURL(h.url, previewURL))) {
list.unshift({ label: previewLabel || t('hubs.preview.label'), url: previewURL });
}
return list;
}, [config, previewURL, previewLabel, t]);
const isDraft = Boolean(picked?.startsWith(DRAFT));
const pickedDraft = isDraft ? drafts.find((d) => DRAFT + d.id === picked) : undefined;
const current = pickedDraft
? { label: pickedDraft.name || t('hubBuilder.untitled'), url: picked!, builtIn: false }
: hubs.find((h) => h.url === picked) ?? null;
const isDefault = (hub: HubSavedEntry) =>
Boolean(config?.default) && hub.label.toLowerCase() === config!.default.toLowerCase();
const contents = useQuery({
queryKey: ['hub', 'contents', picked],
// An empty query returns every entry of a hosted index.
queryFn: async () => {
if (picked!.startsWith(DRAFT)) {
const { draft } = await hubDrafts.get(picked!.slice(DRAFT.length));
return { results: draft.entries.map(draftResult) };
}
return api.searchHub('', picked!);
},
enabled: Boolean(picked),
staleTime: staleTimes.skills,
});
const { data: skillsData } = useQuery({
queryKey: queryKeys.skills.all,
queryFn: () => api.listSkills(),
staleTime: staleTimes.skills,
});
const installed = useMemo(
() => new Set((skillsData?.resources ?? []).map((r) => r.name)),
[skillsData],
);
/** Every tag the picked hub actually uses, so the dropdown never offers a dead option. */
const tags = useMemo(() => {
const seen = new Set<string>();
for (const r of contents.data?.results ?? []) for (const name of r.tags ?? []) seen.add(name);
return [...seen].sort();
}, [contents.data]);
const shown = (contents.data?.results ?? []).filter(
(r: SearchResult) =>
(!tag || (r.tags ?? []).includes(tag)) &&
`${r.name} ${r.description} ${(r.tags ?? []).join(' ')}`.toLowerCase().includes(filter.toLowerCase()),
);
const save = async (next: HubSavedEntry[], defaultLabel: string) => {
const body = { hubs: next.filter((h) => !h.builtIn).map(({ label: l, url: u }) => ({ label: l, url: u })), default: defaultLabel };
await api.putHubConfig(body);
queryClient.setQueryData(queryKeys.hubConfig, body);
};
const add = async () => {
const trimmed = url.trim();
if (!trimmed) { setError(t('install.hubs.urlRequired')); return; }
if (hubs.some((h) => sameURL(h.url, trimmed))) { setError(t('install.hubs.urlExists')); return; }
setBusy(true);
setError('');
try {
const name = label.trim() || trimmed.split('/').filter(Boolean).pop() || trimmed;
await save([...hubs, { label: name, url: trimmed }], config?.default ?? '');
setURL('');
setLabel('');
setPicked(trimmed);
} catch (e) {
setError((e as Error).message);
} finally {
setBusy(false);
}
};
const remove = async (hub: HubSavedEntry) => {
const next = hubs.filter((h) => h.url !== hub.url);
await save(next, isDefault(hub) ? '' : config?.default ?? '');
if (picked === hub.url) setPicked(null);
};
return (
<div className="grid grid-cols-[260px_minmax(0,1fr)] items-start gap-6">
<div className="sticky top-6 flex flex-col gap-3">
<div className="ss-sec !mb-0">
<h2>{t('hubs.browse.sources')}</h2>
<span className="ss-cnt">{hubs.length}</span>
</div>
<div className="ss-list">
{hubs.map((hub) => (
<div key={hub.url} className={`ss-r !min-h-[52px] ${hub.url === picked ? 'sel' : ''}`}>
<button
type="button"
aria-current={hub.url === picked}
className="flex min-w-0 flex-1 flex-col items-start gap-0.5 text-start"
onClick={() => { setPicked(hub.url); setFilter(''); setTag(''); }}
>
<span className="flex items-center gap-1.5 font-semibold text-[13.5px]">
{hub.label}
{isDefault(hub) && <Star size={12} className="fill-current text-warn" />}
</span>
<span className="w-full truncate font-mono text-[11.5px] text-ink-3">{hub.url}</span>
</button>
{!hub.builtIn && (
<button type="button" className="ss-ib" aria-label={t('install.hubs.remove')} onClick={() => setRemoving(hub)}>
<Trash2 size={15} />
</button>
)}
</div>
))}
</div>
{drafts.length > 0 && (
<>
<div className="ss-sec !mb-0 !mt-1">
<h2>{t('hubs.browse.mine')}</h2>
<span className="ss-cnt">{drafts.length}</span>
</div>
<div className="ss-list">
{drafts.map((d) => (
<div key={d.id} className={`ss-r !min-h-[52px] ${DRAFT + d.id === picked ? 'sel' : ''}`}>
<button
type="button"
aria-current={DRAFT + d.id === picked}
className="flex w-full min-w-0 flex-1 flex-col items-start gap-0.5 text-start"
onClick={() => { setPicked(DRAFT + d.id); setFilter(''); setTag(''); }}
>
<span className="font-semibold text-[13.5px]">{d.name || t('hubBuilder.untitled')}</span>
<span className="text-xs text-ink-3">{t(d.entries.length === 1 ? 'hubBuilder.count.one' : 'hubBuilder.count.other', { count: d.entries.length })}</span>
</button>
</div>
))}
</div>
</>
)}
<div className="ss-box flex flex-col gap-2.5">
<span className="text-[13px] font-semibold">{t('install.hubs.add')}</span>
<span className="ss-inp">
<Link2 size={14} className="shrink-0 text-ink-3" />
<input
value={url}
onChange={(e) => { setURL(e.target.value); setError(''); }}
placeholder={t('install.hubs.urlPlaceholder')}
aria-label={t('install.hubs.urlPlaceholder')}
disabled={busy}
/>
</span>
<span className="ss-inp">
<input
value={label}
onChange={(e) => setLabel(e.target.value)}
placeholder={t('install.hubs.labelPlaceholder')}
aria-label={t('install.hubs.labelPlaceholder')}
disabled={busy}
/>
</span>
{error && <span className="text-[12.5px] text-bad">{error}</span>}
<Button size="sm" onClick={() => void add()} loading={busy} disabled={busy}>
<Plus size={14} />
{t('install.hubs.addButton')}
</Button>
<span className="text-[12.5px] leading-relaxed text-ink-3">{t('install.hubs.hint')}</span>
</div>
</div>
<div className="flex min-w-0 flex-col gap-3">
{!current ? (
<EmptyState icon={Library} title={t('hubs.browse.pickTitle')} description={t('hubs.browse.pickHint')} />
) : (
<>
{/* The filter has to stay reachable: this list runs to hundreds of rows.
The band runs wider than the content so the list's offset shadow scrolls under it too. */}
<div className="ss-sec !mb-0 sticky top-0 z-10 -mx-2 -mt-6 bg-bg px-2 pt-6 pb-3">
<h2>{current.label}</h2>
{contents.data && <span className="ss-cnt">{contents.data.results.length}</span>}
<span className="ml-auto flex items-center gap-3">
{!isDraft && !current.builtIn && !isDefault(current) && (
<button type="button" className="ss-btn sm" onClick={() => void save(hubs, current.label)}>
{t('hubs.browse.makeDefault')}
</button>
)}
{tags.length > 0 && (
<Select
size="sm"
className="w-[150px] shrink-0"
prefix={t('hubs.browse.tag')}
value={tag}
onChange={setTag}
options={[{ value: '', label: t('hubs.browse.allTags') }, ...tags.map((v) => ({ value: v, label: v }))]}
/>
)}
<span className="ss-inp sm !h-8 w-[200px]">
<Search size={14} className="shrink-0 text-ink-3" />
<input
value={filter}
onChange={(e) => setFilter(e.target.value)}
placeholder={t('hubs.browse.filter')}
aria-label={t('hubs.browse.filter')}
/>
</span>
</span>
</div>
{isDraft && (
<div className="ss-note">
<span className="flex-1">{t('hubs.browse.localNote')}</span>
</div>
)}
{contents.isPending && (
<div className="ss-box flex items-center gap-2.5 text-[13px] text-ink-2">
<Spinner size="sm" />
{t('hubs.browse.loading')}
</div>
)}
{contents.isError && (
<div className="ss-note bad">
<span className="flex-1">{(contents.error as Error).message}</span>
</div>
)}
{contents.data && shown.length === 0 && (
<EmptyState icon={Search} title={t('hubs.browse.noMatch')} />
)}
{shown.length > 0 && (
<div className="ss-list">
{shown.map((r) => (
<div key={`${r.source}:${r.name}`} className="ss-r">
<span className="flex min-w-0 flex-1 flex-col gap-0.5">
<span className="flex items-center gap-2">
<span className="nm m">{r.name}</span>
{(r.tags ?? []).slice(0, 3).map((name) => (
<span key={name} className="ss-tag">{name}</span>
))}
</span>
{r.description && <span className="truncate text-[13px] text-ink-2">{r.description}</span>}
<span className="truncate font-mono text-[11.5px] text-ink-3">{r.source}</span>
</span>
{!r.source ? (
<span className="text-[12.5px] text-ink-3">{t('hubBuilder.noSource')}</span>
) : installed.has(r.name) ? (
<span className="ss-st ok">{t('hubs.browse.installed')}</span>
) : (
<button type="button" className="ss-btn sm" onClick={() => setInstalling(r.source)}>
{t('hubs.browse.install')}
</button>
)}
</div>
))}
</div>
)}
</>
)}
</div>
{installing && (
<InstallDialog
kind="skill"
initialTab="url"
initialSource={installing}
onClose={() => {
setInstalling(null);
void queryClient.invalidateQueries({ queryKey: queryKeys.skills.all });
}}
/>
)}
<ConfirmDialog
open={removing !== null}
title={t('install.hubs.remove')}
message={t('hubs.browse.removeHint', { name: removing?.label ?? '' })}
variant="danger"
onCancel={() => setRemoving(null)}
onConfirm={() => { const hub = removing; setRemoving(null); if (hub) void remove(hub); }}
/>
</div>
);
}
-274
View File
@@ -1,274 +0,0 @@
import { useEffect, useRef, useState } from 'react';
import { Link, useBeforeUnload, useBlocker } from 'react-router-dom';
import { useQueryClient } from '@tanstack/react-query';
import { AlertTriangle, CheckCircle2, Download, Eye, FilePlus, Plus, Upload } from 'lucide-react';
import { api, ApiError, type HubSavedEntry } from '../../api/client';
import { hubAddCommand, hubDrafts, type DraftResponse, type HubDraft, type HubEntry, type HubProblem } from '../../api/hubDrafts';
import Button from '../Button';
import ConfirmDialog from '../ConfirmDialog';
import EmptyState from '../EmptyState';
import HubEntryEditor from './HubEntryEditor';
import InstalledSkillPicker from './InstalledSkillPicker';
import { queryKeys } from '../../lib/queryKeys';
import { useT } from '../../i18n';
type HubAction = { type: 'open'; id: string } | { type: 'import'; file: File } | { type: 'create' | 'save' | 'delete' | 'download' | 'copy' | 'chooseFile' | 'subscribe' };
export default function HubBuilder() {
const t = useT();
const queryClient = useQueryClient();
const [drafts, setDrafts] = useState<HubDraft[]>([]);
const [draft, setDraft] = useState<HubDraft | null>(null);
const [saved, setSaved] = useState('');
const [problems, setProblems] = useState<HubProblem[]>([]);
const [candidates, setCandidates] = useState<HubEntry[]>([]);
const [picker, setPicker] = useState(false);
const [query, setQuery] = useState('');
const [open, setOpen] = useState<string[]>([]);
const [loading, setLoading] = useState(true);
const [error, setError] = useState('');
const [notice, setNotice] = useState('');
const [confirm, setConfirm] = useState<{ kind: 'delete' | 'leave'; action: HubAction } | null>(null);
const [busy, setBusy] = useState(false);
const fileInput = useRef<HTMLInputElement>(null);
const dirty = draft !== null && JSON.stringify(draft) !== saved;
// Where the index is hosted belongs to the draft, so a reopened hub remembers it.
const location = String(draft?.fields?.publishUrl ?? '');
const setLocation = (value: string) =>
setDraft(current => current && ({ ...current, fields: { ...current.fields, publishUrl: value } }));
const blocker = useBlocker(dirty || busy);
useBeforeUnload((event) => { if (dirty || busy) { event.preventDefault(); event.returnValue = ''; } });
useEffect(() => {
let active = true;
Promise.all([hubDrafts.list(), hubDrafts.candidates()]).then(([items, skills]) => {
if (active) { setDrafts(items); setCandidates(skills); }
}).catch((err: Error) => { if (active) setError(err.message); })
.finally(() => { if (active) setLoading(false); });
return () => { active = false; };
}, []);
function accept(response: DraftResponse) {
setDraft(response.draft); setSaved(JSON.stringify(response.draft)); setProblems(response.problems);
setDrafts(items => [response.draft, ...items.filter(item => item.id !== response.draft.id)]);
setQuery(''); setOpen([]);
}
function requestAction(action: HubAction) {
if (action.type === 'delete') setConfirm({ kind: 'delete', action });
else if (dirty && ['open', 'create', 'chooseFile'].includes(action.type)) setConfirm({ kind: 'leave', action });
else void performAction(action);
}
async function performAction(action: HubAction) {
if (action.type === 'chooseFile') { fileInput.current?.click(); return; }
setBusy(true); setError(''); setNotice('');
try {
switch (action.type) {
case 'open': accept(await hubDrafts.get(action.id)); break;
case 'create':
accept(await hubDrafts.create({ name: t('hubBuilder.untitled'), description: '', entries: [], fields: {} })); break;
case 'import':
if (action.file.size > 4 * 1024 * 1024) throw new Error(t('hubBuilder.fileTooLarge'));
accept(await hubDrafts.import(await action.file.text())); break;
case 'save':
if (draft) { accept(await hubDrafts.save(draft)); setNotice(t('hubBuilder.saved')); } break;
case 'delete':
if (draft) {
await hubDrafts.remove(draft); setDrafts(items => items.filter(item => item.id !== draft.id));
setDraft(null); setSaved('');
} break;
case 'download':
if (draft) downloadIndex(await hubDrafts.export(draft)); break;
case 'copy':
if (draft) { await navigator.clipboard.writeText(hubAddCommand(location, draft.name)); setNotice(t('hubBuilder.copied')); } break;
case 'subscribe':
if (draft) {
// Same config the CLI and the Browse tab read, so it shows up in both at once.
const config = await api.getHubConfig();
const url = location.trim();
const next: HubSavedEntry[] = [...config.hubs.filter(h => h.url !== url), { label: draft.name, url }];
await api.putHubConfig({ hubs: next, default: config.default });
queryClient.setQueryData(queryKeys.hubConfig, { hubs: next, default: config.default });
setNotice(t('hubBuilder.subscribed'));
} break;
}
} catch (err) {
setError(err instanceof ApiError && err.status === 409 ? t('hubBuilder.conflict') : err instanceof Error ? err.message : String(err));
} finally { setBusy(false); }
}
function changeEntry(id: string, key: string, value: unknown) {
setDraft(current => current && ({ ...current, entries: current.entries.map(entry => {
if (entry.id !== id) return entry;
const data = { ...entry.data, [key]: value };
if (key === 'source' || key === 'skill') {
delete data.riskScore; delete data.riskLabel; delete data.auditedAt;
}
return { ...entry, data };
}) }));
}
function addEntries(entries: HubEntry[]) {
const added = entries.map(entry => ({ ...entry, id: Array.from(crypto.getRandomValues(new Uint8Array(16)), byte => byte.toString(16).padStart(2, '0')).join('') }));
setDraft(current => current && ({ ...current, entries: [...current.entries, ...added] }));
setPicker(false); setQuery('');
// A hand-added entry has nothing in it yet, so open it straight away.
if (added.length === 1 && !added[0].data.source) setOpen(list => [...list, added[0].id]);
}
const shown = draft?.entries.filter(entry => `${entry.data.name ?? ''} ${entry.data.source ?? ''} ${(entry.data.tags ?? []).join(' ')}`.toLowerCase().includes(query.toLowerCase())) ?? [];
const publishLocation = /^(https?:\/\/|ssh:\/\/|[^\s@]+@[^\s:]+:)/.test(location.trim()) && !Array.from(location).some(char => char.charCodeAt(0) < 32 || char.charCodeAt(0) === 127);
const blocked = problems.length > 0;
const fileField = (
<input ref={fileInput} type="file" accept=".json,application/json" className="hidden" aria-label={t('hubBuilder.import')} onChange={event => {
const file = event.target.files?.[0]; event.target.value = ''; if (file) requestAction({ type: 'import', file });
}} />
);
if (loading) return <p role="status" className="text-[13px] text-ink-2">{t('hubBuilder.loading')}</p>;
return (
<div className="grid grid-cols-[220px_minmax(0,1fr)] items-start gap-6">
{fileField}
<aside aria-label={t('hubBuilder.drafts')} className="flex flex-col gap-3">
<div className="ss-sec !mb-0">
<h2>{t('hubBuilder.drafts')}</h2>
<span className="ss-cnt">{drafts.length}</span>
</div>
{drafts.length === 0 ? (
<p className="text-[13px] text-ink-2">{t('hubBuilder.emptyDrafts')}</p>
) : (
<div className="ss-list">
{drafts.map(item => {
const published = String(item.fields?.publishUrl ?? '').trim();
return (
<div key={item.id} className={`ss-r !min-h-[52px] ${draft?.id === item.id ? 'sel' : ''}`}>
<button type="button" disabled={busy} aria-pressed={draft?.id === item.id}
className="flex min-w-0 w-full flex-1 flex-col items-start gap-0.5 text-start"
onClick={() => requestAction({ type: 'open', id: item.id })}>
<span className="nm m break-words">{item.name || t('hubBuilder.untitled')}</span>
<span className="text-xs text-ink-3">
{t(item.entries.length === 1 ? 'hubBuilder.count.one' : 'hubBuilder.count.other', { count: item.entries.length })}
{published && ` \u00b7 ${t('hubBuilder.published')}`}
</span>
{published && <span className="w-full truncate font-mono text-[11px] text-ink-3">{published}</span>}
</button>
</div>
);
})}
</div>
)}
<div className="flex flex-col gap-2">
<Button size="sm" disabled={busy} onClick={() => requestAction({ type: 'create' })}><Plus size={14} />{t('hubBuilder.create')}</Button>
<Button size="sm" variant="secondary" disabled={busy} onClick={() => requestAction({ type: 'chooseFile' })}><Upload size={14} />{t('hubBuilder.import')}</Button>
</div>
</aside>
{!draft ? (
<EmptyState icon={FilePlus} title={t('hubBuilder.startTitle')} description={t('hubBuilder.start')}
action={<Button onClick={() => requestAction({ type: 'create' })} disabled={busy}><Plus size={15} />{t('hubBuilder.create')}</Button>} />
) : (
<div className="flex min-w-0 flex-col gap-[18px]">
{error && <div role="alert" className="ss-note bad"><span className="flex-1 break-words">{error}</span></div>}
{notice && <p role="status" className="ss-note"><span className="flex-1">{notice}</span></p>}
<div className={`ss-note ${blocked ? 'bad' : dirty ? 'warn' : 'ok'}`}>
{blocked ? <AlertTriangle size={16} className="mt-0.5 shrink-0" /> : <CheckCircle2 size={16} className="mt-0.5 shrink-0" />}
<span className="flex-1">{blocked ? t(problems.length === 1 ? 'hubBuilder.blocked.one' : 'hubBuilder.blocked.other', { count: problems.length }) : dirty ? t('hubBuilder.unsaved') : t('hubBuilder.ready')}</span>
</div>
<fieldset disabled={busy} className="flex min-w-0 flex-col gap-[18px]">
<div className="ss-box flex flex-col gap-3">
<div className="grid grid-cols-2 gap-3.5">
<div className="ss-fld">
<label htmlFor="hub-name">{t('hubBuilder.name')}</label>
<span className="ss-inp"><input id="hub-name" value={draft.name} onChange={event => setDraft({ ...draft, name: event.target.value })} /></span>
</div>
<div className="ss-fld">
<label htmlFor="hub-description">{t('hubBuilder.description')}</label>
<span className="ss-inp"><input id="hub-description" value={draft.description} onChange={event => setDraft({ ...draft, description: event.target.value })} /></span>
</div>
</div>
<span className="hp">{t('hubBuilder.metadataHint')}</span>
</div>
<div className="flex flex-col gap-3">
<div className="ss-sec !mb-0">
<h2>{t('hubBuilder.skills')}</h2>
<span className="ss-cnt">{draft.entries.length}</span>
<span className="ml-auto flex items-center gap-3">
{draft.entries.length > 0 && (
<span className="ss-inp !h-8 w-[200px]">
<input value={query} onChange={event => setQuery(event.target.value)} placeholder={t('hubBuilder.filter')} aria-label={t('hubBuilder.filter')} />
</span>
)}
<button type="button" className="ss-btn sm" onClick={() => setPicker(true)}><Plus size={14} />{t('hubBuilder.fromInstalled')}</button>
<button type="button" className="ss-btn sm ghost" onClick={() => addEntries([{ id: '', data: { name: '', source: '' } }])}>{t('hubBuilder.manual')}</button>
</span>
</div>
{draft.entries.length === 0 ? (
<div className="ss-empty"><p>{t('hubBuilder.noEntries')}</p></div>
) : (
<div className="ss-list">
{shown.map(entry => (
<HubEntryEditor key={entry.id} entry={entry} showProblems={!dirty}
problems={problems.filter(problem => problem.entryId === entry.id)}
expanded={open.includes(entry.id)}
onToggle={() => setOpen(list => list.includes(entry.id) ? list.filter(id => id !== entry.id) : [...list, entry.id])}
onChange={(key, value) => changeEntry(entry.id, key, value)}
onRemove={() => setDraft({ ...draft, entries: draft.entries.filter(item => item.id !== entry.id) })} />
))}
</div>
)}
</div>
</fieldset>
<div className="ss-box flex flex-col gap-3">
<span className="hp">{t('hubBuilder.accessHint')}</span>
<div className="flex flex-wrap items-center gap-2.5">
<Button disabled={!dirty || busy} loading={busy} onClick={() => requestAction({ type: 'save' })}>{t('hubBuilder.save')}</Button>
<Button variant="secondary" disabled={dirty || blocked || busy} onClick={() => requestAction({ type: 'download' })}><Download size={15} />{t('hubBuilder.download')}</Button>
<Link to={`/hubs?preview=draft:${encodeURIComponent(draft.id)}`} className="ss-btn"><Eye size={15} />{t('hubBuilder.previewInBrowse')}</Link>
<Button variant="ghost" disabled={busy} onClick={() => requestAction({ type: 'open', id: draft.id })}>{t('hubBuilder.reload')}</Button>
<Button variant="ghost" disabled={busy} onClick={() => requestAction({ type: 'delete' })}>{t('hubBuilder.delete')}</Button>
</div>
</div>
<div className="ss-box flex flex-col gap-3">
<div className="flex flex-col gap-1">
<h2 className="ss-h2">{t('hubBuilder.shareTitle')}</h2>
<span className="hp">{t('hubBuilder.shareHint')}</span>
</div>
<div className="ss-fld">
<label htmlFor="hub-location">{t('hubBuilder.hostLocation')}</label>
<span className="ss-inp font-mono"><input id="hub-location" placeholder="https://example.com/skillshare-hub.json" value={location} onChange={event => setLocation(event.target.value)} /></span>
</div>
{publishLocation && (
<>
<div className="ss-code !p-3 font-mono text-[12.5px] break-all">{hubAddCommand(location, draft.name)}</div>
<div className="flex flex-wrap items-center gap-2.5">
<Button variant="secondary" disabled={busy} onClick={() => requestAction({ type: 'copy' })}>{t('hubBuilder.copyCommand')}</Button>
<Button variant="ghost" disabled={busy} onClick={() => requestAction({ type: 'subscribe' })}>{t('hubBuilder.subscribe')}</Button>
</div>
</>
)}
</div>
</div>
)}
{picker && <InstalledSkillPicker candidates={candidates} onClose={() => setPicker(false)} onAdd={addEntries} />}
<ConfirmDialog open={confirm !== null} title={t(confirm?.kind === 'delete' ? 'hubBuilder.delete' : 'hubBuilder.leaveTitle')}
message={t(confirm?.kind === 'delete' ? 'hubBuilder.deleteHint' : 'hubBuilder.leaveHint')} variant={confirm?.kind === 'delete' ? 'danger' : 'default'}
onCancel={() => setConfirm(null)} onConfirm={() => { const action = confirm?.action; setConfirm(null); if (action) void performAction(action); }} />
<ConfirmDialog open={blocker.state === 'blocked'} title={t('hubBuilder.leaveTitle')} message={t('hubBuilder.leaveHint')}
loading={busy} onCancel={() => blocker.state === 'blocked' && blocker.reset()} onConfirm={() => blocker.state === 'blocked' && blocker.proceed()} />
</div>
);
}
function downloadIndex(data: Record<string, unknown>) {
const url = URL.createObjectURL(new Blob([JSON.stringify(data, null, 2) + '\n'], { type: 'application/json' }));
const anchor = document.createElement('a'); anchor.href = url; anchor.download = 'skillshare-hub.json';
document.body.append(anchor); anchor.click(); anchor.remove();
setTimeout(() => URL.revokeObjectURL(url), 1000);
}
+189
View File
@@ -0,0 +1,189 @@
import { useMemo, useState } from 'react';
import { useBeforeUnload, useBlocker } from 'react-router-dom';
import { useQueryClient } from '@tanstack/react-query';
import { Plus } from 'lucide-react';
import { ApiError } from '../../api/client';
import { hubDrafts } from '../../api/hubDrafts';
import type { DraftResponse, HubDraft, HubEntry } from '../../api/hubDrafts';
import Button from '../Button';
import ConfirmDialog from '../ConfirmDialog';
import AddSkillDialog from './AddSkillDialog';
import HubEntryEditor from './HubEntryEditor';
import { newEntryId } from './hubShared';
import { queryKeys } from '../../lib/queryKeys';
import { useT } from '../../i18n';
interface Props {
response: DraftResponse;
onDone: () => void;
}
/** Counts what differs from the saved hub: the name, the description, and each added, removed or edited skill. */
function countChanges(saved: HubDraft, draft: HubDraft) {
const before = new Map(saved.entries.map((e) => [e.id, JSON.stringify(e)]));
const now = new Set(draft.entries.map((e) => e.id));
let n = Number(saved.name !== draft.name) + Number(saved.description !== draft.description);
for (const e of draft.entries) if (before.get(e.id) !== JSON.stringify(e)) n++;
for (const id of before.keys()) if (!now.has(id)) n++;
return n;
}
/** The user's own hub, edited in place where it is viewed. */
export default function HubEditor({ response, onDone }: Props) {
const t = useT();
const queryClient = useQueryClient();
const [base, setBase] = useState(response);
const [draft, setDraft] = useState(response.draft);
const [versions, setVersions] = useState<Record<string, string>>(response.refs ?? {});
const [open, setOpen] = useState<string[]>([]);
const [adding, setAdding] = useState(false);
const [busy, setBusy] = useState(false);
const [error, setError] = useState('');
const savedJSON = useMemo(() => JSON.stringify(base.draft), [base]);
const dirty = JSON.stringify(draft) !== savedJSON;
const blocker = useBlocker(dirty || busy);
useBeforeUnload((event) => { if (dirty || busy) { event.preventDefault(); event.returnValue = ''; } });
// A problem the server reported only holds while its entry is unchanged.
const savedEntries = useMemo(() => new Map(base.draft.entries.map((e) => [e.id, JSON.stringify(e)])), [base]);
const savedSources = useMemo(() => new Map(base.draft.entries.map((e) => [e.id, e.data.source])), [base]);
const problemsOf = (entry: HubEntry) =>
savedEntries.get(entry.id) === JSON.stringify(entry) ? base.problems.filter((p) => p.entryId === entry.id) : [];
const blocked = draft.entries.filter((e) => problemsOf(e).length > 0).length;
const changes = Math.max(1, countChanges(base.draft, draft));
const setEntries = (update: (entries: HubEntry[]) => HubEntry[]) =>
setDraft((current) => ({ ...current, entries: update(current.entries) }));
function changeEntry(id: string, key: string, value: unknown) {
setEntries((entries) => entries.map((entry) => {
if (entry.id !== id) return entry;
const data = { ...entry.data, [key]: value };
if (key === 'source' || key === 'skill') {
delete data.riskScore; delete data.riskLabel; delete data.auditedAt;
}
return { ...entry, data };
}));
// A hand-edited source may name another version; it is read again when the dropdown opens.
if (key === 'source') setVersions((v) => { const rest = { ...v }; delete rest[id]; return rest; });
}
function addEntries(added: HubEntry['data'][]) {
setEntries((entries) => [...entries, ...added.map((data) => ({ id: newEntryId(), data }))]);
setAdding(false);
}
async function save() {
setBusy(true);
setError('');
try {
const res = await hubDrafts.save(draft);
queryClient.setQueryData(queryKeys.hub.draft(res.draft.id), res);
void queryClient.invalidateQueries({ queryKey: queryKeys.hub.drafts, exact: true });
setBase(res);
setDraft(res.draft);
setVersions(res.refs ?? {});
// Stay while something still needs fixing, so the red rows say what.
if (!res.problems.some((p) => p.entryId)) onDone();
} catch (err) {
setError(err instanceof ApiError && err.status === 409 ? t('hubs.conflict') : err instanceof Error ? err.message : String(err));
} finally {
setBusy(false);
}
}
function cancel() {
// Reload what is saved, which also recovers from an edit made in another window.
void queryClient.invalidateQueries({ queryKey: queryKeys.hub.draft(draft.id) });
onDone();
}
return (
<div className="flex min-w-0 flex-col gap-3.5">
<div className="ss-sec !mb-0 !items-center">
<h2>{t('hubs.edit.title', { name: draft.name || t('hubBuilder.untitled') })}</h2>
<span className="ml-auto flex items-center gap-2">
<Button variant="secondary" onClick={() => setAdding(true)} disabled={busy}>
<Plus size={14} />
{t('hubs.edit.addSkill')}
</Button>
{!dirty && <Button onClick={onDone}>{t('hubs.edit.done')}</Button>}
</span>
</div>
{error && <div role="alert" className="ss-note bad"><span className="flex-1 break-words">{error}</span></div>}
<fieldset disabled={busy} className="flex min-w-0 flex-col gap-3.5">
<div className="ss-box grid grid-cols-2 gap-3.5 !py-4">
<div className="ss-fld">
<label htmlFor="hub-name">{t('hubs.edit.name')}</label>
<span className="ss-inp"><input id="hub-name" value={draft.name} onChange={(e) => setDraft({ ...draft, name: e.target.value })} /></span>
</div>
<div className="ss-fld">
<label htmlFor="hub-description">{t('hubs.edit.description')}</label>
<span className="ss-inp"><input id="hub-description" value={draft.description} onChange={(e) => setDraft({ ...draft, description: e.target.value })} /></span>
</div>
</div>
{draft.entries.length === 0 ? (
<div className="ss-empty"><p>{t('hubBuilder.noEntries')}</p></div>
) : (
<div className="ss-list">
<div className="ss-lh !grid grid-cols-[180px_minmax(0,1fr)_150px_30px_30px] gap-2.5">
<span>{t('hubs.edit.name')}</span>
<span>{t('hubs.edit.source')}</span>
<span>{t('hubs.view.version')}</span>
</div>
{draft.entries.map((entry) => (
<HubEntryEditor
key={entry.id}
entry={entry}
problems={problemsOf(entry)}
version={versions[entry.id] ?? (savedSources.get(entry.id) === entry.data.source ? base.refs?.[entry.id] ?? '' : undefined)}
expanded={open.includes(entry.id)}
onToggle={() => setOpen((list) => list.includes(entry.id) ? list.filter((id) => id !== entry.id) : [...list, entry.id])}
onChange={(key, value) => changeEntry(entry.id, key, value)}
onVersion={(source, version) => {
changeEntry(entry.id, 'source', source);
setVersions((v) => ({ ...v, [entry.id]: version }));
}}
onRemove={() => setEntries((entries) => entries.filter((item) => item.id !== entry.id))}
/>
))}
</div>
)}
</fieldset>
{dirty && (
<div className="ss-box sticky bottom-4 z-10 flex items-center gap-2.5 !py-3 shadow-[var(--sh-float)]">
<span className="h-2 w-2 shrink-0 rounded-full bg-warn" />
<span className="flex-1 text-[13px] text-ink-2">
{t(changes === 1 ? 'hubs.edit.changes.one' : 'hubs.edit.changes.other', { count: changes })}
{blocked > 0 && ` · ${t(blocked === 1 ? 'hubs.edit.blocked.one' : 'hubs.edit.blocked.other', { count: blocked })}`}
</span>
<Button variant="secondary" onClick={cancel} disabled={busy}>{t('common.cancel')}</Button>
<Button onClick={() => void save()} loading={busy}>{t('common.save')}</Button>
</div>
)}
{adding && (
<AddSkillDialog
hubName={draft.name || t('hubBuilder.untitled')}
entries={draft.entries}
onAdd={addEntries}
onManual={() => addEntries([{ name: '', source: '' }])}
onClose={() => setAdding(false)}
/>
)}
<ConfirmDialog
open={blocker.state === 'blocked'}
title={t('hubBuilder.leaveTitle')}
message={t('hubBuilder.leaveHint')}
loading={busy}
onCancel={() => blocker.state === 'blocked' && blocker.reset()}
onConfirm={() => blocker.state === 'blocked' && blocker.proceed()}
/>
</div>
);
}
+88 -52
View File
@@ -1,90 +1,126 @@
import { Fragment } from 'react';
import { ChevronDown, X } from 'lucide-react';
import { useEffect, useState } from 'react';
import { useQuery, useQueryClient } from '@tanstack/react-query';
import { AlertCircle, ChevronDown, Trash2 } from 'lucide-react';
import { hubRefs } from '../../api/hubDrafts';
import type { HubEntry, HubProblem } from '../../api/hubDrafts';
import { Select } from '../Select';
import { refOptions } from './hubShared';
import { queryKeys } from '../../lib/queryKeys';
import { useT } from '../../i18n';
interface Props {
entry: HubEntry;
/** Only problems that still apply: the entry is unchanged since the server reported them. */
problems: HubProblem[];
showProblems: boolean;
/** Branch or tag the source names, as last known; "" is the default branch, undefined not known yet. */
version?: string;
expanded: boolean;
onToggle: () => void;
onChange: (key: string, value: unknown) => void;
/** A version was picked: the source rewritten to it, and the version itself. */
onVersion: (source: string, version: string) => void;
onRemove: () => void;
}
/**
* One row per skill. The fields only appear when the row is open, so a hub with a
* dozen entries stays a list instead of a dozen stacked forms.
* One skill per row: name, source and version on one line. The rarely edited
* fields fold out underneath, so a long hub stays a list rather than a stack of forms.
*/
export default function HubEntryEditor({ entry, problems, showProblems, expanded, onToggle, onChange, onRemove }: Props) {
export default function HubEntryEditor({ entry, problems, version, expanded, onToggle, onChange, onVersion, onRemove }: Props) {
const t = useT();
const queryClient = useQueryClient();
const name = entry.data.name || t('hubBuilder.newEntry');
const source = entry.data.source ?? '';
const blocked = showProblems && problems.length > 0;
const field = (key: string) => `hub-${entry.id}-${key}`;
// Branches and tags are only listed once someone reaches for the dropdown.
const [wanted, setWanted] = useState(false);
const [error, setError] = useState('');
// A new or re-typed source has no known version, so it is looked up once typing pauses.
const [settled, setSettled] = useState(source);
useEffect(() => {
const timer = setTimeout(() => setSettled(source), 500);
return () => clearTimeout(timer);
}, [source]);
const refs = useQuery({
queryKey: queryKeys.hub.refs(source),
queryFn: () => hubRefs(source),
enabled: (wanted || (version === undefined && settled === source)) && Boolean(source.trim()),
staleTime: 5 * 60 * 1000,
});
const current = refs.data?.current ?? version ?? '';
const fixed = refs.data?.pinnable === false;
const pick = async (next: string) => {
setError('');
try {
const res = await hubRefs(source, next);
// A source that cannot be pinned comes back without one; it stays as it is.
if (!res.pinnable || res.source === undefined) return;
const pinned = res.source;
if (refs.data) queryClient.setQueryData(queryKeys.hub.refs(pinned), { ...refs.data, current: next, source: undefined });
onVersion(pinned, next);
} catch (e) {
setError((e as Error).message);
}
};
const message = problems.length > 0
? problems.map((p) => t(`hubBuilder.problem.${p.code}`)).join(' ')
: error || (refs.isError ? (refs.error as Error).message : '');
return (
<Fragment>
<div className="ss-r">
<span className={`h-[7px] w-[7px] shrink-0 rounded-full ${blocked ? 'bg-bad' : source ? 'bg-ok' : 'bg-ink-3'}`} />
<span className="flex min-w-0 flex-1 flex-col gap-0.5">
<span className="nm m break-words">{name}</span>
{blocked ? (
<span className="text-[12.5px] leading-snug text-bad">{problems.map(problem => t(`hubBuilder.problem.${problem.code}`)).join(' ')}</span>
) : (
<span className="truncate font-mono text-[11.5px] text-ink-3">{source || t('hubBuilder.noSource')}</span>
)}
<div className={`ss-r !block !py-2.5 ${problems.length > 0 ? 'bg-bad-bg' : ''}`}>
<div className="grid grid-cols-[180px_minmax(0,1fr)_150px_30px_30px] items-center gap-2.5">
<span className="ss-inp !h-8 font-mono">
<input aria-label={t('hubs.edit.name')} value={entry.data.name ?? ''} placeholder={t('hubBuilder.newEntry')} onChange={(e) => onChange('name', e.target.value)} />
</span>
{!blocked && source && <span className="ss-tag ok">{t('hubBuilder.installable')}</span>}
<button type="button" className="ss-ib" aria-expanded={expanded} aria-label={t(expanded ? 'hubBuilder.collapseEntry' : 'hubBuilder.expandEntry', { name })} onClick={onToggle}>
<span className={`ss-inp !h-8 font-mono ${problems.length > 0 ? 'err' : ''}`}>
<input aria-label={t('hubs.edit.source')} value={source} placeholder="github.com/owner/repo/skills/review" onChange={(e) => onChange('source', e.target.value)} />
</span>
<div onPointerDownCapture={() => setWanted(true)} onFocusCapture={() => setWanted(true)} title={fixed ? t('hubs.ref.fixed') : undefined}>
<Select
size="sm"
ariaLabel={t('hubs.view.version')}
value={current}
onChange={(v) => void pick(v)}
options={refOptions(t, refs.data, current, refs.isFetching)}
disabled={!source.trim() || fixed}
/>
</div>
<button type="button" className="ss-ib" aria-label={t('hubs.edit.removeEntry', { name })} title={t('hubs.edit.removeEntry', { name })} onClick={onRemove}>
<Trash2 size={15} />
</button>
<button type="button" className="ss-ib" aria-expanded={expanded} aria-label={t('hubs.edit.moreFields', { name })} title={t('hubs.edit.moreFields', { name })} onClick={onToggle}>
<ChevronDown size={16} className={expanded ? 'rotate-180' : ''} />
</button>
</div>
{message && (
<span className="mt-1.5 flex items-center gap-1.5 pl-[190px] text-[12.5px] text-bad">
<AlertCircle size={13} className="shrink-0" />
{message}
</span>
)}
{!message && fixed && <span className="mt-1.5 block pl-[190px] text-[12.5px] text-ink-3">{t('hubs.ref.fixed')}</span>}
{expanded && (
<div className="ss-r fold !min-h-0 flex-col !items-stretch gap-3.5 !py-4">
<div className="grid grid-cols-2 gap-3.5">
<div className="ss-fld">
<label htmlFor={field('name')}>{t('hubBuilder.displayName')}</label>
<span className="ss-inp"><input id={field('name')} value={entry.data.name ?? ''} onChange={event => onChange('name', event.target.value)} /></span>
</div>
<div className="ss-fld">
<label htmlFor={field('source')}>{t('hubBuilder.source')}</label>
<span className={`ss-inp font-mono ${blocked ? 'err' : ''}`}>
<input id={field('source')} value={source} placeholder="owner/repo/skills/review" onChange={event => onChange('source', event.target.value)} />
</span>
<span className="hp">{t('hubBuilder.sourceHint')}</span>
</div>
</div>
<div className="mt-3 flex flex-col gap-3.5 pl-[190px] pb-1.5">
<div className="ss-fld">
<label htmlFor={field('description')}>{t('hubBuilder.entryDescription')}</label>
<span className="ss-inp area"><textarea id={field('description')} rows={2} value={entry.data.description ?? ''} onChange={event => onChange('description', event.target.value)} /></span>
<span className="ss-inp area"><textarea id={field('description')} rows={2} value={entry.data.description ?? ''} onChange={(e) => onChange('description', e.target.value)} /></span>
</div>
<div className="grid grid-cols-2 items-end gap-3.5">
<div className="grid grid-cols-2 gap-3.5">
<div className="ss-fld">
<label htmlFor={field('tags')}>{t('hubBuilder.tags')}</label>
<span className="ss-inp"><input id={field('tags')} value={(entry.data.tags ?? []).join(',')} onChange={event => onChange('tags', event.target.value.split(','))} /></span>
<span className="ss-inp"><input id={field('tags')} value={(entry.data.tags ?? []).join(',')} onChange={(e) => onChange('tags', e.target.value.split(','))} /></span>
</div>
<div className="flex items-center justify-end gap-3">
<details className="mr-auto">
<summary className="text-[12.5px] text-ink-2">{t('hubBuilder.advanced')}</summary>
<div className="ss-fld mt-3">
<label htmlFor={field('selector')}>{t('hubBuilder.selector')}</label>
<span className="ss-inp font-mono"><input id={field('selector')} value={entry.data.skill ?? ''} onChange={event => onChange('skill', event.target.value)} /></span>
<span className="hp">{t('hubBuilder.selectorHint')}</span>
</div>
</details>
<button type="button" className="ss-btn sm dng" onClick={onRemove}>
<X size={13} />
{t('hubBuilder.remove')}
</button>
<div className="ss-fld">
<label htmlFor={field('selector')}>{t('hubBuilder.selector')}</label>
<span className="ss-inp font-mono"><input id={field('selector')} value={entry.data.skill ?? ''} onChange={(e) => onChange('skill', e.target.value)} /></span>
<span className="hp">{t('hubBuilder.selectorHint')}</span>
</div>
</div>
</div>
)}
</Fragment>
</div>
);
}
+59
View File
@@ -0,0 +1,59 @@
import { Star } from 'lucide-react';
import AddHubMenu from './AddHubMenu';
import { useT } from '../../i18n';
export interface HubListItem {
key: string;
label: string;
sub: string;
mine: boolean;
isDefault: boolean;
}
interface Props {
items: HubListItem[];
selected: string | null;
onPick: (key: string) => void;
/** While a hub is being edited the list stays visible but cannot be used. */
locked: boolean;
onAdd: (url: string) => Promise<void>;
onCreate: () => void;
onImport: (file: File) => void;
}
/** Every hub in one list: the built-in one, saved subscriptions and the user's own. */
export default function HubList({ items, selected, onPick, locked, onAdd, onCreate, onImport }: Props) {
const t = useT();
return (
<div className="sticky top-6 flex flex-col gap-3">
<div className="ss-sec !mb-0">
<h2>{t('hubs.browse.sources')}</h2>
<span className="ss-cnt">{items.length}</span>
</div>
<div className={`ss-list ${locked ? 'pointer-events-none opacity-55' : ''}`} aria-disabled={locked || undefined}>
{items.map((hub) => (
<button
key={hub.key}
type="button"
disabled={locked}
aria-current={hub.key === selected}
className={`ss-r !min-h-[52px] w-full !flex-col !items-start !gap-0.5 text-start ${hub.key === selected ? 'sel' : ''}`}
onClick={() => onPick(hub.key)}
>
<span className="flex items-center gap-1.5 text-[13.5px] font-semibold">
{hub.label}
{hub.isDefault && <Star size={12} className="fill-current text-warn" aria-label={t('hubs.default')} />}
{hub.mine && <span className="ss-tag inf">{t('hubs.mine')}</span>}
</span>
<span className="w-full truncate font-mono text-[11.5px] text-ink-3">{hub.sub}</span>
</button>
))}
</div>
{locked ? (
<span className="text-xs text-ink-3">{t('hubs.edit.locked')}</span>
) : (
<AddHubMenu onAdd={onAdd} onCreate={onCreate} onImport={onImport} />
)}
</div>
);
}
+182
View File
@@ -0,0 +1,182 @@
import { useMemo, useState } from 'react';
import type { ReactNode } from 'react';
import { useQuery, useQueryClient } from '@tanstack/react-query';
import { Search, Tag } from 'lucide-react';
import { api } from '../../api/client';
import type { SearchResult } from '../../api/client';
import { hubDrafts } from '../../api/hubDrafts';
import EmptyState from '../EmptyState';
import InstallDialog from '../InstallDialog';
import Spinner from '../Spinner';
import { Select } from '../Select';
import { queryKeys, staleTimes } from '../../lib/queryKeys';
import { useT } from '../../i18n';
interface Props {
title: string;
/** Set for the user's own hub; its rows come from the saved draft instead of a hosted index. */
draftId?: string;
url?: string;
actions: ReactNode;
}
/**
* A hub exactly as a recipient sees it. Installing hands the source to the
* install dialog so the audit gate stays in one place.
*/
export default function HubView({ title, draftId, url, actions }: Props) {
const t = useT();
const queryClient = useQueryClient();
const [filter, setFilter] = useState('');
const [tag, setTag] = useState('');
const [installing, setInstalling] = useState<string | null>(null);
const draft = useQuery({
queryKey: queryKeys.hub.draft(draftId ?? ''),
queryFn: () => hubDrafts.get(draftId!),
enabled: Boolean(draftId),
});
const hosted = useQuery({
queryKey: queryKeys.hub.contents(url ?? ''),
// An empty query returns every entry of a hosted index.
queryFn: () => api.searchHub('', url!),
enabled: !draftId && Boolean(url),
staleTime: staleTimes.skills,
});
const contents = draftId ? draft : hosted;
const results = useMemo<SearchResult[] | undefined>(() => {
if (!draftId) return hosted.data?.results;
const response = draft.data;
return response?.draft.entries.map((e) => ({
name: e.data.name ?? '',
description: e.data.description ?? '',
source: e.data.source ?? '',
skill: e.data.skill,
tags: e.data.tags,
ref: response.refs?.[e.id],
stars: 0,
owner: '',
repo: '',
}));
}, [draftId, draft.data, hosted.data]);
const { data: skillsData } = useQuery({
queryKey: queryKeys.skills.all,
queryFn: () => api.listSkills(),
staleTime: staleTimes.skills,
});
const installed = useMemo(() => new Set((skillsData?.resources ?? []).map((r) => r.name)), [skillsData]);
/** Every tag the hub actually uses, so the dropdown never offers a dead option. */
const tags = useMemo(() => {
const seen = new Set<string>();
for (const r of results ?? []) for (const name of r.tags ?? []) seen.add(name);
return [...seen].sort();
}, [results]);
const shown = (results ?? []).filter(
(r) =>
(!tag || (r.tags ?? []).includes(tag)) &&
`${r.name} ${r.description} ${(r.tags ?? []).join(' ')}`.toLowerCase().includes(filter.toLowerCase()),
);
return (
<div className="flex min-w-0 flex-col gap-3">
{/* The filter has to stay reachable: a hosted hub runs to hundreds of rows.
The band runs wider than the content so the list's offset shadow scrolls under it too. */}
<div className="sticky top-0 z-10 -mx-2 -mt-6 flex flex-col gap-3 bg-bg px-2 pt-6 pb-3">
<div className="ss-sec !mb-0 !items-center">
<h2>{title}</h2>
{results && <span className="ss-cnt">{results.length}</span>}
{draftId && <span className="ss-tag inf">{t('hubs.mine')}</span>}
<span className="ml-auto flex items-center gap-2">{actions}</span>
</div>
<div className="flex items-center gap-2.5">
<span className="flex-1 text-[12.5px] text-ink-3">{draftId && t('hubs.view.mineNote')}</span>
{tags.length > 0 && (
<Select
size="sm"
className="w-[150px] shrink-0"
prefix={t('hubs.browse.tag')}
value={tag}
onChange={setTag}
options={[{ value: '', label: t('hubs.browse.allTags') }, ...tags.map((v) => ({ value: v, label: v }))]}
/>
)}
<span className="ss-inp sm !h-8 w-[220px]">
<Search size={14} className="shrink-0 text-ink-3" />
<input value={filter} onChange={(e) => setFilter(e.target.value)} placeholder={t('hubs.browse.filter')} aria-label={t('hubs.browse.filter')} />
</span>
</div>
</div>
{contents.isPending && (
<div className="ss-box flex items-center gap-2.5 text-[13px] text-ink-2">
<Spinner size="sm" />
{t('hubs.browse.loading')}
</div>
)}
{contents.isError && (
<div className="ss-note bad">
<span className="flex-1">{(contents.error as Error).message}</span>
</div>
)}
{results && shown.length === 0 && (
<EmptyState icon={Search} title={results.length === 0 ? t('hubBuilder.noEntries') : t('hubs.browse.noMatch')} />
)}
{shown.length > 0 && (
<div className="ss-list">
<div className="ss-lh">
<span className="flex-1">Skill</span>
<span className="w-[120px] shrink-0">{t('hubs.view.version')}</span>
<span className="w-[96px] shrink-0" />
</div>
{shown.map((r, i) => (
<div key={`${i}:${r.source}:${r.name}`} className="ss-r">
<span className="flex min-w-0 flex-1 flex-col gap-0.5">
<span className="flex items-center gap-2">
<span className="nm m font-mono">{r.name}</span>
{(r.tags ?? []).slice(0, 3).map((name) => (
<span key={name} className="ss-tag">{name}</span>
))}
</span>
{r.description && <span className="truncate text-[13px] text-ink-2">{r.description}</span>}
<span className="truncate font-mono text-[11.5px] text-ink-3">{r.source}</span>
</span>
<span className="flex w-[120px] shrink-0 items-center">
{r.ref ? (
<span className="ss-tag max-w-full"><Tag size={11} className="shrink-0" /><span className="truncate">{r.ref}</span></span>
) : (
<span className="text-xs text-ink-3">{t('hubs.ref.default')}</span>
)}
</span>
<span className="flex w-[96px] shrink-0 justify-end">
{!r.source ? (
<span className="text-[12.5px] text-ink-3">{t('hubBuilder.noSource')}</span>
) : installed.has(r.name) ? (
<span className="ss-st ok">{t('hubs.browse.installed')}</span>
) : (
<button type="button" className="ss-btn sm" onClick={() => setInstalling(r.source)}>
{t('hubs.browse.install')}
</button>
)}
</span>
</div>
))}
</div>
)}
{installing && (
<InstallDialog
kind="skill"
initialTab="url"
initialSource={installing}
onClose={() => {
setInstalling(null);
void queryClient.invalidateQueries({ queryKey: queryKeys.skills.all });
}}
/>
)}
</div>
);
}
@@ -1,28 +0,0 @@
import { useState } from 'react';
import type { HubEntry } from '../../api/hubDrafts';
import Button from '../Button';
import DialogShell from '../DialogShell';
import { Checkbox, Input } from '../Input';
import { useT } from '../../i18n';
interface Props { candidates: HubEntry[]; onClose: () => void; onAdd: (entries: HubEntry[]) => void }
export default function InstalledSkillPicker({ candidates, onClose, onAdd }: Props) {
const t = useT();
const [query, setQuery] = useState('');
const [selection, setSelection] = useState<string[]>([]);
const selected = new Set(selection);
return <DialogShell open onClose={onClose} ariaLabel={t('hubBuilder.fromInstalled')}>
<div className="space-y-4">
<h2 className="ss-h2">{t('hubBuilder.fromInstalled')}</h2>
<Input label={t('hubBuilder.filter')} value={query} onChange={event => setQuery(event.target.value)} />
<div className="max-h-80 overflow-auto space-y-3">
{candidates.length === 0 && <p>{t('hubBuilder.noInstalled')}</p>}
{candidates.filter(entry => `${entry.data.name} ${entry.id}`.toLowerCase().includes(query.toLowerCase())).map(entry => <div key={entry.id}>
<Checkbox label={entry.data.name || entry.id} checked={selected.has(entry.id)} onChange={checked => setSelection(current => checked ? [...current, entry.id] : current.filter(id => id !== entry.id))} />
<p className="text-xs text-ink-2 break-all ms-6">{entry.id}</p>
</div>)}
</div>
<Button disabled={selection.length === 0} onClick={() => onAdd(candidates.filter(entry => selected.has(entry.id)))}>{t('hubBuilder.addSelected', { count: selection.length })}</Button>
</div>
</DialogShell>;
}
+58
View File
@@ -0,0 +1,58 @@
import { useEffect, useRef, useState } from 'react';
import { MoreHorizontal } from 'lucide-react';
import type { LucideIcon } from 'lucide-react';
interface Item {
label: string;
icon: LucideIcon;
onClick: () => void;
danger?: boolean;
}
/** The rarely used actions of a hub, behind one icon button. */
export default function MoreMenu({ label, items }: { label: string; items: Item[] }) {
const [open, setOpen] = useState(false);
const ref = useRef<HTMLDivElement>(null);
useEffect(() => {
if (!open) return;
const onDown = (e: MouseEvent) => {
if (ref.current && !ref.current.contains(e.target as Node)) setOpen(false);
};
const onKey = (e: KeyboardEvent) => {
if (e.key === 'Escape') setOpen(false);
};
document.addEventListener('mousedown', onDown);
document.addEventListener('keydown', onKey);
return () => {
document.removeEventListener('mousedown', onDown);
document.removeEventListener('keydown', onKey);
};
}, [open]);
return (
<div ref={ref} className="relative shrink-0">
<button
type="button"
className="ss-btn !w-[34px] !px-0"
aria-label={label}
title={label}
aria-haspopup="menu"
aria-expanded={open}
onClick={() => setOpen(!open)}
>
<MoreHorizontal size={16} />
</button>
{open && (
<div role="menu" aria-label={label} className="ss-menu absolute right-0 top-full z-50 mt-1 !w-44 animate-dropdown-in">
{items.map(({ label: text, icon: Icon, onClick, danger }) => (
<button key={text} type="button" role="menuitem" className={danger ? 'dng' : ''} onClick={() => { setOpen(false); onClick(); }}>
<Icon size={15} />
{text}
</button>
))}
</div>
)}
</div>
);
}
+146
View File
@@ -0,0 +1,146 @@
import { useState } from 'react';
import type { ReactNode } from 'react';
import { useQueryClient } from '@tanstack/react-query';
import { Check, Copy, Download, X } from 'lucide-react';
import { ApiError } from '../../api/client';
import { hubAddCommand, hubDrafts } from '../../api/hubDrafts';
import type { DraftResponse } from '../../api/hubDrafts';
import Button from '../Button';
import DialogShell from '../DialogShell';
import { blockedEntries, downloadIndex, publishable } from './hubShared';
import { queryKeys } from '../../lib/queryKeys';
import { useT } from '../../i18n';
function Step({ n, children }: { n: number; children: ReactNode }) {
return (
<div className="flex gap-3.5">
<span className="grid h-6 w-6 shrink-0 place-items-center rounded-full bg-pri text-xs font-bold text-on-pri">{n}</span>
<div className="flex min-w-0 flex-1 flex-col gap-2">{children}</div>
</div>
);
}
/** Three steps from an own hub to one the team can add: download, host, hand out the command. */
export default function ShareDialog({ response, onClose }: { response: DraftResponse; onClose: () => void }) {
const t = useT();
const queryClient = useQueryClient();
const { draft, problems } = response;
const saved = String(draft.fields?.publishUrl ?? '');
const [location, setLocation] = useState(saved);
const [busy, setBusy] = useState(false);
const [error, setError] = useState('');
const [copied, setCopied] = useState(false);
const blocked = blockedEntries(problems).size;
const empty = draft.entries.length === 0;
const name = draft.name || t('hubBuilder.untitled');
const fail = (err: unknown) =>
setError(err instanceof ApiError && err.status === 409 ? t('hubs.conflict') : err instanceof Error ? err.message : String(err));
/** The hosted URL belongs to the hub, so a reopened hub remembers it. */
async function commit() {
if (location.trim() === saved.trim()) return true;
setBusy(true);
setError('');
try {
const res = await hubDrafts.save({ ...draft, fields: { ...draft.fields, publishUrl: location.trim() } });
queryClient.setQueryData(queryKeys.hub.draft(res.draft.id), res);
void queryClient.invalidateQueries({ queryKey: queryKeys.hub.drafts, exact: true });
return true;
} catch (err) {
fail(err);
return false;
} finally {
setBusy(false);
}
}
async function download() {
setBusy(true);
setError('');
try {
downloadIndex(await hubDrafts.export(draft));
} catch (err) {
fail(err);
} finally {
setBusy(false);
}
}
async function copy() {
try {
await navigator.clipboard.writeText(hubAddCommand(location, name));
setCopied(true);
setTimeout(() => setCopied(false), 2000);
} catch {
// Ignore clipboard failures; the command stays visible to copy by hand.
}
}
const close = async () => { if (await commit()) onClose(); };
return (
<DialogShell open onClose={() => void close()} maxWidth="xl" padding="none" preventClose={busy} ariaLabel={t('hubs.share.title', { name })}>
<div className="dh">
<div className="flex flex-col gap-1">
<h2 className="ss-h2">{t('hubs.share.title', { name })}</h2>
<p className="text-[13px] text-ink-2">
{empty
? t('hubBuilder.problem.empty')
: blocked > 0
? t(blocked === 1 ? 'hubBuilder.blocked.one' : 'hubBuilder.blocked.other', { count: blocked })
: t(draft.entries.length === 1 ? 'hubs.share.ready.one' : 'hubs.share.ready.other', { count: draft.entries.length })}
</p>
</div>
<button type="button" className="ss-ib" onClick={() => void close()} aria-label={t('common.close')} disabled={busy}>
<X size={16} />
</button>
</div>
<div className="db !gap-5">
{error && <div role="alert" className="ss-note bad"><span className="flex-1 break-words">{error}</span></div>}
<Step n={1}>
<span className="text-sm font-semibold">{t('hubs.share.step1')}</span>
<Button variant="secondary" className="self-start" disabled={busy || blocked > 0 || empty} onClick={() => void download()}>
<Download size={14} />
{t('hubs.share.download')}
</Button>
{(blocked > 0 || empty) && <span className="text-[12.5px] text-ink-3">{t('hubs.share.fixFirst')}</span>}
</Step>
<Step n={2}>
<label htmlFor="hub-share-location" className="text-sm font-semibold">{t('hubs.share.step2')}</label>
<span className="ss-inp font-mono">
<input
id="hub-share-location"
placeholder="https://example.com/skillshare-hub.json"
value={location}
onChange={(e) => setLocation(e.target.value)}
onBlur={() => void commit()}
/>
</span>
<span className="text-[12.5px] text-ink-3">{t('hubs.share.step2Hint')}</span>
{/* The URL is only asked for to build this command, so the command sits right under it. */}
<span className="mt-2 text-[13px] text-ink-2">{t('hubs.share.step3')}</span>
{publishable(location) ? (
<>
<div className="ss-code flex items-center gap-2 !whitespace-normal !py-2.5 !pr-2.5 !pl-3">
<code className="min-w-0 flex-1 break-all text-ink">{hubAddCommand(location, name)}</code>
<Button variant="secondary" size="sm" onClick={() => void copy()}>
{copied ? <Check size={13} className="text-ok" /> : <Copy size={13} />}
{t('common.copy')}
</Button>
</div>
<span className="text-[12.5px] text-ink-3">{t('hubs.share.step3Hint')}</span>
</>
) : (
<span className="text-[12.5px] text-ink-3">{t('hubs.share.needURL')}</span>
)}
</Step>
</div>
<div className="df">
<Button onClick={() => void close()} loading={busy}>{t('hubs.edit.done')}</Button>
</div>
</DialogShell>
);
}
+82
View File
@@ -0,0 +1,82 @@
import type { HubSavedEntry } from '../../api/client';
import type { HubEntry, HubProblem, HubRefs } from '../../api/hubDrafts';
import type { SelectOption } from '../Select';
import type { useT } from '../../i18n';
type T = ReturnType<typeof useT>;
/** Shipped with skillshare, so it is offered even when the user has saved nothing. */
export const COMMUNITY: HubSavedEntry = {
label: 'Skillshare Hub',
url: 'https://raw.githubusercontent.com/runkids/skillshare-hub/main/skillshare-hub.json',
builtIn: true,
};
/** Prefix that marks a list key as one of the user's own hubs rather than a hosted index. */
export const DRAFT = 'draft:';
export const sameURL = (a: string, b: string) => a.trim().replace(/\/+$/, '') === b.trim().replace(/\/+$/, '');
export const newEntryId = () =>
Array.from(crypto.getRandomValues(new Uint8Array(16)), (byte) => byte.toString(16).padStart(2, '0')).join('');
/** Entries a recipient could not install; the draft-wide "empty" problem has no entry. */
export const blockedEntries = (problems: HubProblem[]) =>
new Set(problems.filter((p) => p.entryId).map((p) => p.entryId));
/**
* Whether an entry already covers this source (and selector), so it is not added twice.
* A skill of the same name counts too: both would install into one directory.
*/
export const inHub = (entries: HubEntry[], source: string, skill = '', name = '') =>
(Boolean(source.trim()) &&
entries.some((e) => sameURL(e.data.source ?? '', source) && (e.data.skill ?? '') === skill)) ||
(Boolean(name) && entries.some((e) => e.data.name === name));
/**
* One skill inside a discovered repository. Mirrors the server's discovery source:
* a whole-repo SSH source marks the subdirectory with "//", every other source with "/".
* The ref is already part of `root`, so no version is written here.
*/
export function skillSource(root: string, path: string) {
const base = root.trim().replace(/\/+$/, '');
if (!path || path === '.') return base;
const ssh = /^(git@|ssh:\/\/)/.test(base) && !base.replace(/^ssh:\/\//, '').includes('//');
return `${base}${ssh ? '//' : '/'}${path}`;
}
/** Version choices for a source: the default branch first, then branches, then tags. */
export function refOptions(t: T, refs: HubRefs | undefined, current: string, loading = false): SelectOption[] {
const options: SelectOption[] = [{
value: '',
label: t('hubs.ref.default'),
note: refs?.defaultBranch ? `· ${refs.defaultBranch}` : undefined,
}];
const seen = new Set(['']);
const add = (value: string, group?: string) => {
if (seen.has(value)) return;
seen.add(value);
options.push({ value, label: value, group });
};
if (current && !(refs?.branches ?? []).includes(current) && !(refs?.tags ?? []).includes(current)) add(current);
for (const b of refs?.branches ?? []) add(b, 'Branch');
for (const tag of refs?.tags ?? []) add(tag, 'Tag');
if (loading) options.push({ value: '\u0000loading', label: t('hubs.ref.loading'), disabled: true });
return options;
}
/** A hosted location a recipient can reach; local paths and control characters are not. */
export const publishable = (location: string) =>
/^(https?:\/\/|ssh:\/\/|[^\s@]+@[^\s:]+:)/.test(location.trim()) &&
!Array.from(location).some((char) => char.charCodeAt(0) < 32 || char.charCodeAt(0) === 127);
export function downloadIndex(data: Record<string, unknown>) {
const url = URL.createObjectURL(new Blob([JSON.stringify(data, null, 2) + '\n'], { type: 'application/json' }));
const anchor = document.createElement('a');
anchor.href = url;
anchor.download = 'skillshare-hub.json';
document.body.append(anchor);
anchor.click();
anchor.remove();
setTimeout(() => URL.revokeObjectURL(url), 1000);
}
+59 -49
View File
@@ -981,15 +981,12 @@
"install.url.onlySkills": "Keine Agents gefunden. skillshare sucht nur im obersten agents/-Ordner der Quelle, daher sind dies Skills und erscheinen auf der Skills-Seite. Für Agents aus einem Unterordner den Pfad anhängen: owner/repo/path/to/folder.",
"install.url.onlyAgents": "Keine Skills in dieser Quelle. Dies sind Agents und erscheinen auf der Agents-Seite.",
"install.hubs.title": "Hubs verwalten",
"install.hubs.add": "Hub hinzufügen",
"install.hubs.addButton": "Hinzufügen",
"install.hubs.urlPlaceholder": "URL oder Dateipfad",
"install.hubs.labelPlaceholder": "Bezeichnung (optional)",
"install.hubs.remove": "Hub entfernen",
"install.hubs.urlRequired": "URL ist erforderlich",
"install.hubs.urlExists": "Diese Hub-URL existiert bereits",
"install.hubs.subtitle": "Die Suche durchsucht den ausgewählten Hub. Die GitHub-Suche ist immer verfügbar.",
"install.hubs.hint": "Ein Hub ist eine skillshare-hub.json-Datei mit einer Liste von Skills. Gib eine URL oder eine lokale Datei an.",
"install.toast.installed": "{label}: Installiert",
"install.toast.exists": "{count} bereits installiert: {names}. Zum Ersetzen unter Advanced Force overwrite aktivieren.",
"install.done": "Fertig",
@@ -1845,55 +1842,22 @@
"auditRules.regex.suppressed.other": "unterdrückt {count} Zeilen",
"hubBuilder.title": "Meine Hubs",
"hubBuilder.subtitle": "Erstelle einen Katalog von Skills zum Teilen.",
"hubBuilder.import": "JSON importieren",
"hubBuilder.create": "Neuer Hub",
"hubBuilder.untitled": "Unbenannter Hub",
"hubBuilder.drafts": "Entwürfe",
"hubBuilder.emptyDrafts": "Gespeicherte Entwürfe erscheinen hier.",
"hubBuilder.count.one": "{count} Skill",
"hubBuilder.count.other": "{count} Skills",
"hubBuilder.startTitle": "Skills ohne JSON teilen",
"hubBuilder.start": "Erstelle einen Hub, wähle installierte Skills und lade den Index herunter. Vorhandene Indizes lassen sich auch importieren.",
"hubBuilder.name": "Hub-Name",
"hubBuilder.description": "Beschreibung",
"hubBuilder.metadataHint": "Name und Beschreibung ordnen die Entwürfe und werden nicht exportiert.",
"hubBuilder.fromInstalled": "Installierte Skills auswählen",
"hubBuilder.manual": "Quelle manuell hinzufügen",
"hubBuilder.filter": "Skills suchen",
"hubBuilder.noEntries": "Füge installierte Skills oder eine Repository-Quelle hinzu.",
"hubBuilder.newEntry": "Neuer Skill",
"hubBuilder.displayName": "Anzeigename",
"hubBuilder.entryDescription": "Skill-Beschreibung",
"hubBuilder.source": "Installationsquelle",
"hubBuilder.sourceHint": "Nutze ein entferntes Repository oder einen Pfad wie owner/repo/skills/review. Lokale Quellen können gespeichert, aber nicht exportiert werden.",
"hubBuilder.tags": "Tags (durch Kommas getrennt)",
"hubBuilder.advanced": "Erweitert",
"hubBuilder.selector": "Skill-Auswahl (optional)",
"hubBuilder.selectorHint": "Bleibt beim Import erhalten. Nutze den ursprünglichen Namen oder relativen Pfad im Repository.",
"hubBuilder.unsaved": "Ungespeicherte Änderungen. Speichern, um Quellen zu prüfen.",
"hubBuilder.blocked.one": "{count} Skill kann sonst niemand installieren. Korrigiere die Quelle oder entferne den Eintrag.",
"hubBuilder.blocked.other": "{count} Skills kann sonst niemand installieren. Korrigiere jede Quelle oder entferne den Eintrag.",
"hubBuilder.ready": "Gespeichert. Bereit zum Export.",
"hubBuilder.accessHint": "Nur die Syntax wird geprüft, nicht die Verfügbarkeit. Empfänger benötigen Zugriff auf private Repositories.",
"hubBuilder.save": "Entwurf speichern",
"hubBuilder.saved": "Entwurf gespeichert.",
"hubBuilder.download": "Index herunterladen",
"hubBuilder.reload": "Gespeicherten Entwurf neu laden",
"hubBuilder.delete": "Entwurf löschen",
"hubBuilder.shareTitle": "Über diesen Rechner hinaus teilen",
"hubBuilder.shareHint": "Du kannst diesen Hub bereits lokal durchsuchen. Damit andere daraus installieren können, lade skillshare-hub.json herunter, hoste sie über Git oder HTTP und trage hier ein, wo sie liegt.",
"hubBuilder.hostLocation": "Adresse des bereitgestellten Index",
"hubBuilder.copyCommand": "Hinzufügebefehl kopieren",
"hubBuilder.copied": "Befehl kopiert.",
"hubBuilder.noInstalled": "Keine installierten Skills. Quellen können manuell hinzugefügt werden.",
"hubBuilder.addSelected": "{count} ausgewählte hinzufügen",
"hubBuilder.leaveTitle": "Ungespeicherte Änderungen verwerfen?",
"hubBuilder.leaveHint": "Änderungen seit dem letzten Speichern gehen verloren.",
"hubBuilder.deleteHint": "Diesen Entwurf endgültig löschen? Installierte Skills und bereitgestellte Dateien bleiben erhalten.",
"hubBuilder.conflict": "Der Entwurf wurde in einem anderen Fenster geändert. Lade ihn vor dem Bearbeiten neu. Aktuelle Änderungen wurden nicht gespeichert.",
"hubBuilder.fileTooLarge": "Wähle eine JSON-Datei unter 4 MB.",
"hubBuilder.loading": "Wird geladen…",
"hubBuilder.remove": "Entfernen",
"hubBuilder.problem.local_source": "Diese Quelle ist lokal. Zum Export ein entferntes Repository angeben.",
"hubBuilder.problem.missing_source": "Installationsquelle eingeben.",
"hubBuilder.problem.invalid_source": "Quelle unbekannt. Repository-Syntax prüfen.",
@@ -1901,19 +1865,68 @@
"hubBuilder.problem.missing_name": "Anzeigenamen eingeben.",
"hubBuilder.problem.invalid_selector": "Einen relativen Repository-Pfad ohne übergeordnete Verzeichnisse verwenden.",
"hubBuilder.problem.empty": "Mindestens einen Skill hinzufügen.",
"hubBuilder.skills": "Skills",
"hubBuilder.noSource": "Noch keine Quelle",
"hubBuilder.installable": "installable",
"hubBuilder.expandEntry": "{name} bearbeiten",
"hubBuilder.collapseEntry": "{name} einklappen",
"hubBuilder.subscribe": "Zu meinen Hubs",
"hubBuilder.subscribed": "Hinzugefügt. Er steht jetzt im Tab „Durchsuchen“.",
"hubBuilder.published": "Veröffentlicht",
"hubBuilder.previewInBrowse": "In Durchsuchen ansehen",
"hubs.title": "Hubs",
"hubs.subtitle": "Skills aus einem geteilten Katalog installieren oder einen für dein Team erstellen.",
"hubs.tabs.browse": "Durchsuchen",
"hubs.tabs.mine": "Meine Hubs",
"hubs.mine": "Meiner",
"hubs.default": "Standard",
"hubs.shared": "geteilt",
"hubs.addOrCreate": "Hub hinzufügen oder erstellen",
"hubs.add.existing": "Vorhandenen Hub hinzufügen",
"hubs.add.hint": "Füge die URL oder den Pfad einer skillshare-hub.json ein. Der Name kommt aus der URL.",
"hubs.add.create": "Neuen Hub erstellen",
"hubs.add.createHint": "Leer beginnen, dann URLs einfügen oder installierte Skills hinzufügen.",
"hubs.add.import": "skillshare-hub.json importieren",
"hubs.add.importHint": "Einen vorhandenen Index öffnen und weiter bearbeiten.",
"hubs.view.mineNote": "Wer diesen Hub hinzufügt, sieht genau diese Liste.",
"hubs.view.edit": "Bearbeiten",
"hubs.view.share": "Teilen",
"hubs.view.more": "Weitere Aktionen",
"hubs.view.version": "Version",
"hubs.view.delete": "Hub löschen",
"hubs.view.deleteHint": "Diesen Hub endgültig löschen? Installierte Skills und gehostete Dateien bleiben unberührt.",
"hubs.ref.default": "Standard-Branch",
"hubs.ref.loading": "Versionen werden geladen…",
"hubs.ref.fixed": "Diese Quelle kann nur ihren Standard-Branch nutzen.",
"hubs.conflict": "Dieser Hub wurde in einem anderen Fenster geändert, deine Änderungen wurden daher nicht gespeichert. Kopiere, was du behalten willst, und brich ab oder schließe, um die neueste Version zu laden.",
"hubs.edit.title": "{name} bearbeiten",
"hubs.edit.locked": "Wird bearbeitet. Speichere oder brich ab, um den Hub zu wechseln.",
"hubs.edit.addSkill": "Skill hinzufügen",
"hubs.edit.done": "Fertig",
"hubs.edit.name": "Name",
"hubs.edit.description": "Beschreibung",
"hubs.edit.source": "Quelle",
"hubs.edit.removeEntry": "{name} entfernen",
"hubs.edit.moreFields": "Weitere Felder für {name}",
"hubs.edit.changes.one": "{count} ungespeicherte Änderung",
"hubs.edit.changes.other": "{count} ungespeicherte Änderungen",
"hubs.edit.blocked.one": "{count} Skill kann sonst niemand installieren",
"hubs.edit.blocked.other": "{count} Skills kann sonst niemand installieren",
"hubs.share.title": "{name} teilen",
"hubs.share.ready.one": "{count} Skill ist installierbar. Mit den zwei Schritten unten kann dein Team diesen Hub hinzufügen.",
"hubs.share.ready.other": "Alle {count} Skills sind installierbar. Mit den zwei Schritten unten kann dein Team diesen Hub hinzufügen.",
"hubs.share.step1": "Indexdatei herunterladen",
"hubs.share.download": "skillshare-hub.json herunterladen",
"hubs.share.fixFirst": "Wähle zuerst Bearbeiten und korrigiere die Skills, die sonst niemand installieren kann.",
"hubs.share.step2": "Lege sie dort ab, wo dein Team sie erreicht, und füge die URL ein",
"hubs.share.step2Hint": "Ein Git-Repo oder HTTP funktionieren beide. Bei einem privaten Repo brauchen andere Lesezugriff.",
"hubs.share.step3": "Bitte dein Team, diesen Befehl auszuführen",
"hubs.share.step3Hint": "Oder im Dashboard auf der Hubs-Seite „Hub hinzufügen oder erstellen“ wählen und dieselbe URL einfügen.",
"hubs.share.needURL": "Füge oben die URL ein, dann erscheint hier der Befehl.",
"hubs.addSkill.title": "Skills zu {name} hinzufügen",
"hubs.addSkill.how": "Art des Hinzufügens",
"hubs.addSkill.tab.url": "URL einfügen",
"hubs.addSkill.tab.installed": "Installiert",
"hubs.addSkill.url": "Git-URL",
"hubs.addSkill.find": "Suchen",
"hubs.addSkill.urlHint": "Ein Repo, einen Unterordner oder eine GitHub-URL mit tree/<Version>/ einfügen. Vorher installieren ist nicht nötig.",
"hubs.addSkill.versionHint": "Zeigt die Branches und Tags dieses Repos. Mit Standard-Branch folgst du immer der neuesten Version.",
"hubs.addSkill.found.one": "{count} Skill gefunden",
"hubs.addSkill.found.other": "{count} Skills gefunden",
"hubs.addSkill.selectAll": "Alle auswählen",
"hubs.addSkill.inHub": "Schon in diesem Hub",
"hubs.addSkill.manual": "Nicht gefunden? Quelle selbst eingeben",
"hubs.addSkill.add": "{count} hinzufügen",
"hubs.browse.sources": "Hubs",
"hubs.browse.pickTitle": "Hub auswählen",
"hubs.browse.pickHint": "Wähle links einen Hub, um die enthaltenen Skills zu sehen.",
@@ -1926,9 +1939,6 @@
"hubs.browse.removeHint": "{name} aus deinen Hubs entfernen? Bereits installierte Skills bleiben.",
"hubs.browse.tag": "Tag",
"hubs.browse.allTags": "Alle",
"hubs.browse.mine": "Meine Hubs (lokal)",
"hubs.browse.localNote": "Ein lokaler Entwurf – nur du siehst ihn, bis der Index gehostet wird.",
"hubs.preview.label": "Vorschau",
"plugins.title": "Plugins",
"plugins.subtitle": "Vollständige Plugins behalten und Synchronisierungsziele wählen.",
"plugins.add": "Plugin hinzufügen",
+59 -49
View File
@@ -981,15 +981,12 @@
"install.url.onlySkills": "No agents found. skillshare looks for an agents/ folder at the top of the source, so these are skills and will show on the Skills page. To get agents from a subfolder, add its path: owner/repo/path/to/folder.",
"install.url.onlyAgents": "No skills found in this source. These are agents and will show on the Agents page.",
"install.hubs.title": "Manage hubs",
"install.hubs.add": "Add hub",
"install.hubs.addButton": "Add",
"install.hubs.urlPlaceholder": "URL or file path",
"install.hubs.labelPlaceholder": "Label (optional)",
"install.hubs.remove": "Remove hub",
"install.hubs.urlRequired": "URL is required",
"install.hubs.urlExists": "This hub URL already exists",
"install.hubs.subtitle": "Search looks in the hub you pick. GitHub search is always available.",
"install.hubs.hint": "A hub is a skillshare-hub.json file that lists skills. Point to a URL or a local file.",
"install.toast.installed": "Installed {label}",
"install.toast.exists": "{count} already installed: {names}. Turn on Force overwrite under Advanced to replace.",
"install.done": "Done",
@@ -1845,55 +1842,22 @@
"auditRules.regex.suppressed.other": "suppresses {count} lines",
"hubBuilder.title": "My Hubs",
"hubBuilder.subtitle": "Create a skill catalog to share with others.",
"hubBuilder.import": "Import JSON",
"hubBuilder.create": "New Hub",
"hubBuilder.untitled": "Untitled Hub",
"hubBuilder.drafts": "Drafts",
"hubBuilder.emptyDrafts": "Your saved drafts will appear here.",
"hubBuilder.count.one": "{count} skill",
"hubBuilder.count.other": "{count} skills",
"hubBuilder.startTitle": "Share skills without writing JSON",
"hubBuilder.start": "Create a Hub, choose installed skills, then download its index. You can also import an existing index.",
"hubBuilder.name": "Hub name",
"hubBuilder.description": "Description",
"hubBuilder.metadataHint": "Name and description organize your drafts; they are not included in the exported index.",
"hubBuilder.fromInstalled": "Choose installed skills",
"hubBuilder.manual": "Add source manually",
"hubBuilder.filter": "Search skills",
"hubBuilder.noEntries": "Add installed skills or enter a repository source to begin.",
"hubBuilder.newEntry": "New skill",
"hubBuilder.displayName": "Display name",
"hubBuilder.entryDescription": "Skill description",
"hubBuilder.source": "Install source",
"hubBuilder.sourceHint": "Use a remote repository or a path within one, such as owner/repo/skills/review. Local sources can be saved but cannot be exported.",
"hubBuilder.tags": "Tags (comma-separated)",
"hubBuilder.advanced": "Advanced",
"hubBuilder.selector": "Skill selector (optional)",
"hubBuilder.selectorHint": "Preserved on import. Use the original skill name or repository-relative path when selecting from a multi-skill repository.",
"hubBuilder.unsaved": "Unsaved changes. Save to check sources before downloading.",
"hubBuilder.blocked.one": "{count} skill cannot be installed by anyone else. Fix its source, or remove the entry.",
"hubBuilder.blocked.other": "{count} skills cannot be installed by anyone else. Fix each source, or remove the entry.",
"hubBuilder.ready": "Saved. Ready to export.",
"hubBuilder.accessHint": "Source syntax is checked; availability is not verified. Recipients need access to private repositories.",
"hubBuilder.save": "Save draft",
"hubBuilder.saved": "Draft saved.",
"hubBuilder.download": "Download index",
"hubBuilder.reload": "Reload saved draft",
"hubBuilder.delete": "Delete draft",
"hubBuilder.shareTitle": "Share beyond this machine",
"hubBuilder.shareHint": "You can already browse this hub locally. To let other people install from it, download skillshare-hub.json, host it on Git or HTTP, then record where it lives.",
"hubBuilder.hostLocation": "Hosted index location",
"hubBuilder.copyCommand": "Copy add command",
"hubBuilder.copied": "Command copied.",
"hubBuilder.noInstalled": "No installed skills found. You can add sources manually.",
"hubBuilder.addSelected": "Add {count} selected",
"hubBuilder.leaveTitle": "Discard unsaved changes?",
"hubBuilder.leaveHint": "Leaving now discards edits since your last save.",
"hubBuilder.deleteHint": "Delete this draft permanently? Installed skills and hosted files are not affected.",
"hubBuilder.conflict": "This draft changed in another window. Reload the saved draft before editing again; your current edits have not been saved.",
"hubBuilder.fileTooLarge": "Choose a JSON file smaller than 4 MB.",
"hubBuilder.loading": "Loading…",
"hubBuilder.remove": "Remove",
"hubBuilder.problem.local_source": "This source is local. Enter a remote repository before exporting.",
"hubBuilder.problem.missing_source": "Enter an install source.",
"hubBuilder.problem.invalid_source": "The install source is not recognized. Check the repository syntax.",
@@ -1901,19 +1865,68 @@
"hubBuilder.problem.missing_name": "Enter a display name.",
"hubBuilder.problem.invalid_selector": "Use a repository-relative skill selector without parent directory traversal.",
"hubBuilder.problem.empty": "Add at least one skill.",
"hubBuilder.skills": "Skills",
"hubBuilder.noSource": "No source yet",
"hubBuilder.installable": "installable",
"hubBuilder.expandEntry": "Edit {name}",
"hubBuilder.collapseEntry": "Collapse {name}",
"hubBuilder.subscribe": "Add to my hubs",
"hubBuilder.subscribed": "Added. It is in the Browse tab now.",
"hubBuilder.published": "Published",
"hubBuilder.previewInBrowse": "Preview in Browse",
"hubs.title": "Hubs",
"hubs.subtitle": "Install skills from a shared catalog, or build one for your team.",
"hubs.tabs.browse": "Browse",
"hubs.tabs.mine": "My hubs",
"hubs.mine": "Mine",
"hubs.default": "Default",
"hubs.shared": "shared",
"hubs.addOrCreate": "Add or create a Hub",
"hubs.add.existing": "Add an existing Hub",
"hubs.add.hint": "Paste the URL or path of a skillshare-hub.json. Its name comes from the URL.",
"hubs.add.create": "Create a new Hub",
"hubs.add.createHint": "Start empty, then paste URLs or add installed skills.",
"hubs.add.import": "Import skillshare-hub.json",
"hubs.add.importHint": "Open an index you already have and keep editing.",
"hubs.view.mineNote": "Once someone adds this Hub, this is the list they see.",
"hubs.view.edit": "Edit",
"hubs.view.share": "Share",
"hubs.view.more": "More actions",
"hubs.view.version": "Version",
"hubs.view.delete": "Delete Hub",
"hubs.view.deleteHint": "Delete this Hub permanently? Installed skills and hosted files are not affected.",
"hubs.ref.default": "Default branch",
"hubs.ref.loading": "Loading versions…",
"hubs.ref.fixed": "This source can only use its default branch.",
"hubs.conflict": "This Hub changed in another window, so your changes were not saved. Copy anything you want to keep, then cancel or close to load the latest version.",
"hubs.edit.title": "Edit {name}",
"hubs.edit.locked": "Editing. Save or cancel to switch Hubs.",
"hubs.edit.addSkill": "Add skill",
"hubs.edit.done": "Done",
"hubs.edit.name": "Name",
"hubs.edit.description": "Description",
"hubs.edit.source": "Source",
"hubs.edit.removeEntry": "Remove {name}",
"hubs.edit.moreFields": "More fields for {name}",
"hubs.edit.changes.one": "{count} unsaved change",
"hubs.edit.changes.other": "{count} unsaved changes",
"hubs.edit.blocked.one": "{count} skill others can’t install",
"hubs.edit.blocked.other": "{count} skills others can’t install",
"hubs.share.title": "Share {name}",
"hubs.share.ready.one": "{count} skill can be installed. Follow the two steps below so your team can add this Hub.",
"hubs.share.ready.other": "All {count} skills can be installed. Follow the two steps below so your team can add this Hub.",
"hubs.share.step1": "Download the index file",
"hubs.share.download": "Download skillshare-hub.json",
"hubs.share.fixFirst": "Choose Edit and fix the skills others can’t install first.",
"hubs.share.step2": "Put it where your team can reach it, then paste the URL",
"hubs.share.step2Hint": "A Git repo or HTTP both work. For a private repo, people need read access.",
"hubs.share.step3": "Ask your team to run this command",
"hubs.share.step3Hint": "Or, in the dashboard, choose Add or create a Hub on the Hubs page and paste the same URL.",
"hubs.share.needURL": "Paste the URL above to see the command.",
"hubs.addSkill.title": "Add skills to {name}",
"hubs.addSkill.how": "How to add",
"hubs.addSkill.tab.url": "Paste URL",
"hubs.addSkill.tab.installed": "Installed",
"hubs.addSkill.url": "Git URL",
"hubs.addSkill.find": "Find",
"hubs.addSkill.urlHint": "Paste a repo, a subfolder, or a GitHub URL with tree/<version>/. No need to install it first.",
"hubs.addSkill.versionHint": "Lists this repo’s branches and tags. Pick Default branch to follow the latest version.",
"hubs.addSkill.found.one": "Found {count} skill",
"hubs.addSkill.found.other": "Found {count} skills",
"hubs.addSkill.selectAll": "Select all",
"hubs.addSkill.inHub": "Already in this Hub",
"hubs.addSkill.manual": "Can’t find it? Enter the source yourself",
"hubs.addSkill.add": "Add {count}",
"hubs.browse.sources": "Hubs",
"hubs.browse.pickTitle": "Pick a hub",
"hubs.browse.pickHint": "Choose a hub on the left to see the skills it offers.",
@@ -1926,9 +1939,6 @@
"hubs.browse.removeHint": "Remove {name} from your hubs? Skills you already installed stay.",
"hubs.browse.tag": "Tag",
"hubs.browse.allTags": "All",
"hubs.browse.mine": "My hubs (local)",
"hubs.browse.localNote": "A local draft — only you can see it until the index is hosted.",
"hubs.preview.label": "Preview",
"plugins.title": "Plugins",
"plugins.subtitle": "Keep complete plugins together and choose where to sync them.",
"plugins.add": "Add plugin",
+59 -49
View File
@@ -981,15 +981,12 @@
"install.url.onlySkills": "No se encontraron agents. skillshare solo busca una carpeta agents/ en el nivel superior del origen, así que estos son skills y aparecerán en la página Skills. Para agents de una subcarpeta, añade su ruta: owner/repo/path/to/folder.",
"install.url.onlyAgents": "No hay skills en este origen. Estos son agents y aparecerán en la página Agents.",
"install.hubs.title": "Gestionar hubs",
"install.hubs.add": "Añadir hub",
"install.hubs.addButton": "Añadir",
"install.hubs.urlPlaceholder": "URL o ruta de archivo",
"install.hubs.labelPlaceholder": "Etiqueta (opcional)",
"install.hubs.remove": "Eliminar hub",
"install.hubs.urlRequired": "La URL es obligatoria",
"install.hubs.urlExists": "Esta URL de hub ya existe",
"install.hubs.subtitle": "La búsqueda usa el hub que elijas. La búsqueda en GitHub siempre está disponible.",
"install.hubs.hint": "Un hub es un archivo skillshare-hub.json que lista skills. Indica una URL o un archivo local.",
"install.toast.installed": "{label}: Instalado",
"install.toast.exists": "{count} ya instalados: {names}. Para reemplazarlos, activa Force overwrite en Advanced.",
"install.done": "Listo",
@@ -1845,55 +1842,22 @@
"auditRules.regex.suppressed.other": "suprime {count} líneas",
"hubBuilder.title": "Mis Hubs",
"hubBuilder.subtitle": "Crea un catálogo de habilidades para compartir.",
"hubBuilder.import": "Importar JSON",
"hubBuilder.create": "Nuevo Hub",
"hubBuilder.untitled": "Hub sin título",
"hubBuilder.drafts": "Borradores",
"hubBuilder.emptyDrafts": "Tus borradores guardados aparecerán aquí.",
"hubBuilder.count.one": "{count} habilidad",
"hubBuilder.count.other": "{count} habilidades",
"hubBuilder.startTitle": "Comparte habilidades sin escribir JSON",
"hubBuilder.start": "Crea un Hub, elige habilidades instaladas y descarga el índice. También puedes importar un índice existente.",
"hubBuilder.name": "Nombre del Hub",
"hubBuilder.description": "Descripción",
"hubBuilder.metadataHint": "El nombre y la descripción organizan tus borradores; no se exportan.",
"hubBuilder.fromInstalled": "Elegir habilidades instaladas",
"hubBuilder.manual": "Añadir origen manualmente",
"hubBuilder.filter": "Buscar habilidades",
"hubBuilder.noEntries": "Añade habilidades instaladas o un origen de repositorio.",
"hubBuilder.newEntry": "Nueva habilidad",
"hubBuilder.displayName": "Nombre visible",
"hubBuilder.entryDescription": "Descripción de la habilidad",
"hubBuilder.source": "Origen de instalación",
"hubBuilder.sourceHint": "Usa un repositorio remoto o una ruta como owner/repo/skills/review. Los orígenes locales se guardan, pero no se exportan.",
"hubBuilder.tags": "Etiquetas (separadas por comas)",
"hubBuilder.advanced": "Avanzado",
"hubBuilder.selector": "Selector de habilidad (opcional)",
"hubBuilder.selectorHint": "Se conserva al importar. Usa el nombre original o la ruta relativa dentro del repositorio.",
"hubBuilder.unsaved": "Cambios sin guardar. Guarda para comprobar los orígenes.",
"hubBuilder.blocked.one": "Nadie más puede instalar {count} skill. Corrige su origen o elimina la entrada.",
"hubBuilder.blocked.other": "Nadie más puede instalar {count} skills. Corrige cada origen o elimina la entrada.",
"hubBuilder.ready": "Guardado. Listo para exportar.",
"hubBuilder.accessHint": "Se comprueba la sintaxis, no la disponibilidad. Los destinatarios necesitan acceso a repositorios privados.",
"hubBuilder.save": "Guardar borrador",
"hubBuilder.saved": "Borrador guardado.",
"hubBuilder.download": "Descargar índice",
"hubBuilder.reload": "Recargar borrador guardado",
"hubBuilder.delete": "Eliminar borrador",
"hubBuilder.shareTitle": "Compartir fuera de este equipo",
"hubBuilder.shareHint": "Ya puedes explorar este hub en local. Para que otras personas instalen desde él, descarga skillshare-hub.json, alójalo en Git o HTTP y anota aquí su ubicación.",
"hubBuilder.hostLocation": "Ubicación del índice alojado",
"hubBuilder.copyCommand": "Copiar comando de adición",
"hubBuilder.copied": "Comando copiado.",
"hubBuilder.noInstalled": "No hay habilidades instaladas. Puedes añadir orígenes manualmente.",
"hubBuilder.addSelected": "Añadir {count} seleccionadas",
"hubBuilder.leaveTitle": "¿Descartar cambios sin guardar?",
"hubBuilder.leaveHint": "Se perderán los cambios desde el último guardado.",
"hubBuilder.deleteHint": "¿Eliminar este borrador permanentemente? No afecta a habilidades instaladas ni archivos alojados.",
"hubBuilder.conflict": "El borrador cambió en otra ventana. Recárgalo antes de editar. Tus cambios actuales no se han guardado.",
"hubBuilder.fileTooLarge": "Elige un archivo JSON de menos de 4 MB.",
"hubBuilder.loading": "Cargando…",
"hubBuilder.remove": "Quitar",
"hubBuilder.problem.local_source": "El origen es local. Introduce un repositorio remoto para exportar.",
"hubBuilder.problem.missing_source": "Introduce un origen de instalación.",
"hubBuilder.problem.invalid_source": "Origen no reconocido. Revisa la sintaxis del repositorio.",
@@ -1901,19 +1865,68 @@
"hubBuilder.problem.missing_name": "Introduce un nombre visible.",
"hubBuilder.problem.invalid_selector": "Usa un selector relativo al repositorio sin referencias al directorio superior.",
"hubBuilder.problem.empty": "Añade al menos una habilidad.",
"hubBuilder.skills": "Skills",
"hubBuilder.noSource": "Sin origen todavía",
"hubBuilder.installable": "installable",
"hubBuilder.expandEntry": "Editar {name}",
"hubBuilder.collapseEntry": "Contraer {name}",
"hubBuilder.subscribe": "Añadir a mis Hubs",
"hubBuilder.subscribed": "Añadido. Ya está en la pestaña Explorar.",
"hubBuilder.published": "Publicado",
"hubBuilder.previewInBrowse": "Ver en Explorar",
"hubs.title": "Hubs",
"hubs.subtitle": "Instala skills desde un catálogo compartido o crea uno para tu equipo.",
"hubs.tabs.browse": "Explorar",
"hubs.tabs.mine": "Mis Hubs",
"hubs.mine": "Mío",
"hubs.default": "Predeterminado",
"hubs.shared": "compartido",
"hubs.addOrCreate": "Añadir o crear un Hub",
"hubs.add.existing": "Añadir un Hub existente",
"hubs.add.hint": "Pega la URL o la ruta de un skillshare-hub.json. El nombre se toma de la URL.",
"hubs.add.create": "Crear un Hub nuevo",
"hubs.add.createHint": "Empieza vacío y luego pega URLs o añade skills instalados.",
"hubs.add.import": "Importar skillshare-hub.json",
"hubs.add.importHint": "Abre un índice que ya tengas y sigue editándolo.",
"hubs.view.mineNote": "Quien añada este Hub verá exactamente esta lista.",
"hubs.view.edit": "Editar",
"hubs.view.share": "Compartir",
"hubs.view.more": "Más acciones",
"hubs.view.version": "Versión",
"hubs.view.delete": "Eliminar Hub",
"hubs.view.deleteHint": "¿Eliminar este Hub para siempre? Los skills instalados y los archivos alojados no se ven afectados.",
"hubs.ref.default": "Rama predeterminada",
"hubs.ref.loading": "Cargando versiones…",
"hubs.ref.fixed": "Este origen solo puede usar su rama predeterminada.",
"hubs.conflict": "Este Hub cambió en otra ventana, así que tus cambios no se guardaron. Copia lo que quieras conservar y luego cancela o cierra para cargar la versión más reciente.",
"hubs.edit.title": "Editar {name}",
"hubs.edit.locked": "Editando. Guarda o cancela para cambiar de Hub.",
"hubs.edit.addSkill": "Añadir skill",
"hubs.edit.done": "Listo",
"hubs.edit.name": "Nombre",
"hubs.edit.description": "Descripción",
"hubs.edit.source": "Origen",
"hubs.edit.removeEntry": "Quitar {name}",
"hubs.edit.moreFields": "Más campos de {name}",
"hubs.edit.changes.one": "{count} cambio sin guardar",
"hubs.edit.changes.other": "{count} cambios sin guardar",
"hubs.edit.blocked.one": "{count} skill que nadie más puede instalar",
"hubs.edit.blocked.other": "{count} skills que nadie más puede instalar",
"hubs.share.title": "Compartir {name}",
"hubs.share.ready.one": "{count} skill se puede instalar. Sigue los dos pasos de abajo para que tu equipo añada este Hub.",
"hubs.share.ready.other": "Los {count} skills se pueden instalar. Sigue los dos pasos de abajo para que tu equipo añada este Hub.",
"hubs.share.step1": "Descarga el archivo de índice",
"hubs.share.download": "Descargar skillshare-hub.json",
"hubs.share.fixFirst": "Primero elige Editar y corrige los skills que nadie más puede instalar.",
"hubs.share.step2": "Ponlo donde tu equipo pueda acceder y pega la URL",
"hubs.share.step2Hint": "Sirve un repo Git o HTTP. Para un repo privado, los demás necesitan permiso de lectura.",
"hubs.share.step3": "Pide a tu equipo que ejecute este comando",
"hubs.share.step3Hint": "O, en el dashboard, elige Añadir o crear un Hub en la página Hubs y pega la misma URL.",
"hubs.share.needURL": "Pega la URL arriba para ver el comando.",
"hubs.addSkill.title": "Añadir skills a {name}",
"hubs.addSkill.how": "Cómo añadir",
"hubs.addSkill.tab.url": "Pegar URL",
"hubs.addSkill.tab.installed": "Instalados",
"hubs.addSkill.url": "URL de Git",
"hubs.addSkill.find": "Buscar",
"hubs.addSkill.urlHint": "Pega un repo, una subcarpeta o una URL de GitHub con tree/<versión>/. No hace falta instalarlo antes.",
"hubs.addSkill.versionHint": "Muestra las ramas y etiquetas de este repo. Elige Rama predeterminada para seguir siempre la última versión.",
"hubs.addSkill.found.one": "{count} skill encontrado",
"hubs.addSkill.found.other": "{count} skills encontrados",
"hubs.addSkill.selectAll": "Seleccionar todo",
"hubs.addSkill.inHub": "Ya está en este Hub",
"hubs.addSkill.manual": "¿No lo encuentras? Escribe el origen a mano",
"hubs.addSkill.add": "Añadir {count}",
"hubs.browse.sources": "Hubs",
"hubs.browse.pickTitle": "Elige un Hub",
"hubs.browse.pickHint": "Elige un Hub a la izquierda para ver las skills que ofrece.",
@@ -1926,9 +1939,6 @@
"hubs.browse.removeHint": "¿Quitar {name} de tus Hubs? Las skills ya instaladas se mantienen.",
"hubs.browse.tag": "Etiqueta",
"hubs.browse.allTags": "Todas",
"hubs.browse.mine": "Mis hubs (local)",
"hubs.browse.localNote": "Un borrador local: solo tú puedes verlo hasta que el índice esté alojado.",
"hubs.preview.label": "Vista previa",
"plugins.title": "Plugins",
"plugins.subtitle": "Conserva los plugins completos y elige dónde sincronizarlos.",
"plugins.add": "Añadir plugin",
+59 -49
View File
@@ -981,15 +981,12 @@
"install.url.onlySkills": "هیچ agent پیدا نشد. skillshare فقط پوشه agents/ را در بالاترین سطح منبع جست‌وجو می‌کند، پس این‌ها skill هستند و در صفحه Skills نمایش داده می‌شوند. برای agentهای یک زیرپوشه، مسیر آن را اضافه کنید: owner/repo/path/to/folder.",
"install.url.onlyAgents": "این منبع هیچ skill ندارد. این‌ها agent هستند و در صفحه Agents نمایش داده می‌شوند.",
"install.hubs.title": "مدیریت Hubها",
"install.hubs.add": "افزودن Hub",
"install.hubs.addButton": "افزودن",
"install.hubs.urlPlaceholder": "URL یا مسیر فایل",
"install.hubs.labelPlaceholder": "برچسب (اختیاری)",
"install.hubs.remove": "حذف hub",
"install.hubs.urlRequired": "آدرس URL الزامی است",
"install.hubs.urlExists": "این آدرس hub از قبل موجود است",
"install.hubs.subtitle": "جستجو در hub انتخابی شما انجام می‌شود. جستجوی GitHub همیشه در دسترس است.",
"install.hubs.hint": "hub یک فایل skillshare-hub.json است که فهرست اسکیل‌ها را دارد. به یک URL یا فایل محلی اشاره کنید.",
"install.toast.installed": "{label}: نصب شد",
"install.toast.exists": "{count} مورد از قبل نصب شده: {names}. برای جایگزینی، Force overwrite را در Advanced روشن کنید.",
"install.done": "پایان",
@@ -1845,55 +1842,22 @@
"auditRules.regex.suppressed.other": "{count} خط را حذف می‌کند",
"hubBuilder.title": "Hubهای من",
"hubBuilder.subtitle": "فهرستی از مهارت‌ها برای اشتراک بسازید.",
"hubBuilder.import": "وارد کردن JSON",
"hubBuilder.create": "Hub جدید",
"hubBuilder.untitled": "Hub بدون نام",
"hubBuilder.drafts": "پیش‌نویس‌ها",
"hubBuilder.emptyDrafts": "پیش‌نویس‌های ذخیره‌شده اینجا نمایش داده می‌شوند.",
"hubBuilder.count.one": "{count} مهارت",
"hubBuilder.count.other": "{count} مهارت",
"hubBuilder.startTitle": "اشتراک مهارت بدون نوشتن JSON",
"hubBuilder.start": "یک Hub بسازید، مهارت‌های نصب‌شده را انتخاب و نمایه را دریافت کنید. نمایه موجود را هم می‌توانید وارد کنید.",
"hubBuilder.name": "نام Hub",
"hubBuilder.description": "توضیحات",
"hubBuilder.metadataHint": "نام و توضیحات برای مرتب‌سازی پیش‌نویس‌ها هستند و صادر نمی‌شوند.",
"hubBuilder.fromInstalled": "انتخاب مهارت‌های نصب‌شده",
"hubBuilder.manual": "افزودن دستی منبع",
"hubBuilder.filter": "جستجوی مهارت",
"hubBuilder.noEntries": "مهارت نصب‌شده یا منبع مخزن را اضافه کنید.",
"hubBuilder.newEntry": "مهارت جدید",
"hubBuilder.displayName": "نام نمایشی",
"hubBuilder.entryDescription": "توضیح مهارت",
"hubBuilder.source": "منبع نصب",
"hubBuilder.sourceHint": "از مخزن راه دور یا مسیری مانند owner/repo/skills/review استفاده کنید. منابع محلی قابل ذخیره‌اند اما صادر نمی‌شوند.",
"hubBuilder.tags": "برچسب‌ها (جداشده با ویرگول)",
"hubBuilder.advanced": "پیشرفته",
"hubBuilder.selector": "انتخابگر مهارت (اختیاری)",
"hubBuilder.selectorHint": "هنگام ورود حفظ می‌شود. نام اصلی یا مسیر نسبی مهارت در مخزن را وارد کنید.",
"hubBuilder.unsaved": "تغییرات ذخیره نشده‌اند. برای بررسی منابع ذخیره کنید.",
"hubBuilder.blocked.one": "{count} skill را دیگران نمی‌توانند نصب کنند. هر منبع را اصلاح یا مورد را حذف کنید.",
"hubBuilder.blocked.other": "{count} skill را دیگران نمی‌توانند نصب کنند. هر منبع را اصلاح یا مورد را حذف کنید.",
"hubBuilder.ready": "ذخیره شد. آماده صدور است.",
"hubBuilder.accessHint": "فقط ساختار منبع بررسی می‌شود، نه دسترسی. گیرندگان به مجوز مخزن خصوصی نیاز دارند.",
"hubBuilder.save": "ذخیره پیش‌نویس",
"hubBuilder.saved": "پیش‌نویس ذخیره شد.",
"hubBuilder.download": "دریافت نمایه",
"hubBuilder.reload": "بارگذاری دوباره پیش‌نویس ذخیره‌شده",
"hubBuilder.delete": "حذف پیش‌نویس",
"hubBuilder.shareTitle": "اشتراک‌گذاری بیرون از این دستگاه",
"hubBuilder.shareHint": "همین حالا می‌توانید این هاب را به‌صورت محلی مرور کنید. برای اینکه دیگران بتوانند از آن نصب کنند، فایل skillshare-hub.json را دانلود کنید، روی Git یا HTTP میزبانی کنید و سپس محل آن را اینجا ثبت کنید.",
"hubBuilder.hostLocation": "نشانی نمایه میزبانی‌شده",
"hubBuilder.copyCommand": "کپی فرمان افزودن",
"hubBuilder.copied": "فرمان کپی شد.",
"hubBuilder.noInstalled": "مهارت نصب‌شده‌ای نیست. منبع را دستی اضافه کنید.",
"hubBuilder.addSelected": "افزودن {count} مورد انتخاب‌شده",
"hubBuilder.leaveTitle": "کنار گذاشتن تغییرات ذخیره‌نشده؟",
"hubBuilder.leaveHint": "تغییرات پس از آخرین ذخیره از دست می‌روند.",
"hubBuilder.deleteHint": "این پیش‌نویس برای همیشه حذف شود؟ مهارت‌های نصب‌شده و فایل‌های میزبانی‌شده تغییر نمی‌کنند.",
"hubBuilder.conflict": "پیش‌نویس در پنجره دیگری تغییر کرده است. پیش از ویرایش دوباره بارگذاری کنید. تغییرات فعلی ذخیره نشده‌اند.",
"hubBuilder.fileTooLarge": "فایل JSON کوچک‌تر از ۴ مگابایت انتخاب کنید.",
"hubBuilder.loading": "در حال بارگذاری…",
"hubBuilder.remove": "حذف",
"hubBuilder.problem.local_source": "این منبع محلی است. برای صدور مخزن راه دور وارد کنید.",
"hubBuilder.problem.missing_source": "منبع نصب را وارد کنید.",
"hubBuilder.problem.invalid_source": "منبع شناخته نشد. ساختار مخزن را بررسی کنید.",
@@ -1901,19 +1865,68 @@
"hubBuilder.problem.missing_name": "نام نمایشی را وارد کنید.",
"hubBuilder.problem.invalid_selector": "از مسیر نسبی مخزن بدون رفتن به پوشه والد استفاده کنید.",
"hubBuilder.problem.empty": "حداقل یک مهارت اضافه کنید.",
"hubBuilder.skills": "Skills",
"hubBuilder.noSource": "هنوز منبعی نیست",
"hubBuilder.installable": "installable",
"hubBuilder.expandEntry": "ویرایش {name}",
"hubBuilder.collapseEntry": "بستن {name}",
"hubBuilder.subscribe": "افزودن به هاب‌های من",
"hubBuilder.subscribed": "اضافه شد. اکنون در زبانه مرور است.",
"hubBuilder.published": "منتشرشده",
"hubBuilder.previewInBrowse": "پیش‌نمایش در مرور",
"hubs.title": "هاب‌ها",
"hubs.subtitle": "skills را از یک فهرست مشترک نصب کنید یا یکی برای تیم خود بسازید.",
"hubs.tabs.browse": "مرور",
"hubs.tabs.mine": "هاب‌های من",
"hubs.mine": "مال من",
"hubs.default": "پیش‌فرض",
"hubs.shared": "هم‌رسانی‌شده",
"hubs.addOrCreate": "افزودن یا ساختن Hub",
"hubs.add.existing": "افزودن یک Hub موجود",
"hubs.add.hint": "نشانی یا مسیر یک skillshare-hub.json را بچسبانید. نامش از نشانی گرفته می‌شود.",
"hubs.add.create": "ساختن Hub تازه",
"hubs.add.createHint": "خالی شروع کنید، سپس نشانی بچسبانید یا skills نصب‌شده را بیفزایید.",
"hubs.add.import": "وارد کردن skillshare-hub.json",
"hubs.add.importHint": "فهرستی را که دارید باز کنید و ویرایش را ادامه دهید.",
"hubs.view.mineNote": "وقتی کسی این Hub را بیفزاید، همین فهرست را می‌بیند.",
"hubs.view.edit": "ویرایش",
"hubs.view.share": "هم‌رسانی",
"hubs.view.more": "کارهای بیشتر",
"hubs.view.version": "نسخه",
"hubs.view.delete": "حذف Hub",
"hubs.view.deleteHint": "این Hub برای همیشه حذف شود؟ skills نصب‌شده و فایل‌های میزبانی‌شده تغییری نمی‌کنند.",
"hubs.ref.default": "شاخهٔ پیش‌فرض",
"hubs.ref.loading": "در حال خواندن نسخه‌ها…",
"hubs.ref.fixed": "این منبع فقط می‌تواند از شاخهٔ پیش‌فرض خود استفاده کند.",
"hubs.conflict": "این Hub در پنجرهٔ دیگری تغییر کرده، پس تغییرات شما ذخیره نشد. هرچه می‌خواهید نگه دارید کپی کنید، سپس لغو کنید یا ببندید تا تازه‌ترین نسخه بارگیری شود.",
"hubs.edit.title": "ویرایش {name}",
"hubs.edit.locked": "در حال ویرایش. برای رفتن به Hub دیگر، ذخیره یا لغو کنید.",
"hubs.edit.addSkill": "افزودن skill",
"hubs.edit.done": "تمام",
"hubs.edit.name": "نام",
"hubs.edit.description": "توضیح",
"hubs.edit.source": "منبع",
"hubs.edit.removeEntry": "حذف {name}",
"hubs.edit.moreFields": "فیلدهای بیشتر برای {name}",
"hubs.edit.changes.one": "{count} تغییر ذخیره‌نشده",
"hubs.edit.changes.other": "{count} تغییر ذخیره‌نشده",
"hubs.edit.blocked.one": "{count} skill که دیگران نمی‌توانند نصب کنند",
"hubs.edit.blocked.other": "{count} skill که دیگران نمی‌توانند نصب کنند",
"hubs.share.title": "هم‌رسانی {name}",
"hubs.share.ready.one": "{count} skill قابل نصب است. با دو گام زیر، تیم شما می‌تواند این Hub را بیفزاید.",
"hubs.share.ready.other": "هر {count} skill قابل نصب است. با دو گام زیر، تیم شما می‌تواند این Hub را بیفزاید.",
"hubs.share.step1": "فایل فهرست را بارگیری کنید",
"hubs.share.download": "بارگیری skillshare-hub.json",
"hubs.share.fixFirst": "ابتدا ویرایش را بزنید و skillهایی را که دیگران نمی‌توانند نصب کنند اصلاح کنید.",
"hubs.share.step2": "آن را جایی بگذارید که تیم به آن دسترسی دارد، سپس نشانی را بچسبانید",
"hubs.share.step2Hint": "مخزن Git یا HTTP هر دو کار می‌کنند. برای مخزن خصوصی، دیگران به دسترسی خواندن نیاز دارند.",
"hubs.share.step3": "از تیم بخواهید این فرمان را اجرا کند",
"hubs.share.step3Hint": "یا در dashboard، در صفحهٔ Hubs گزینهٔ افزودن یا ساختن Hub را بزنید و همان نشانی را بچسبانید.",
"hubs.share.needURL": "نشانی را در بالا بچسبانید تا فرمان نمایش داده شود.",
"hubs.addSkill.title": "افزودن skill به {name}",
"hubs.addSkill.how": "روش افزودن",
"hubs.addSkill.tab.url": "چسباندن نشانی",
"hubs.addSkill.tab.installed": "نصب‌شده",
"hubs.addSkill.url": "نشانی Git",
"hubs.addSkill.find": "یافتن",
"hubs.addSkill.urlHint": "یک مخزن، یک زیرپوشه یا نشانی GitHub با tree/<نسخه>/ را بچسبانید. لازم نیست اول نصبش کنید.",
"hubs.addSkill.versionHint": "شاخه‌ها و برچسب‌های این مخزن را نشان می‌دهد. شاخهٔ پیش‌فرض را انتخاب کنید تا همیشه تازه‌ترین نسخه را داشته باشید.",
"hubs.addSkill.found.one": "{count} skill پیدا شد",
"hubs.addSkill.found.other": "{count} skill پیدا شد",
"hubs.addSkill.selectAll": "انتخاب همه",
"hubs.addSkill.inHub": "از قبل در این Hub است",
"hubs.addSkill.manual": "پیدا نشد؟ منبع را خودتان وارد کنید",
"hubs.addSkill.add": "افزودن {count}",
"hubs.browse.sources": "هاب‌ها",
"hubs.browse.pickTitle": "یک هاب انتخاب کنید",
"hubs.browse.pickHint": "برای دیدن skills موجود، از سمت راست یک هاب انتخاب کنید.",
@@ -1926,9 +1939,6 @@
"hubs.browse.removeHint": "{name} از هاب‌های شما حذف شود؟ skills نصب‌شده باقی می‌مانند.",
"hubs.browse.tag": "برچسب",
"hubs.browse.allTags": "همه",
"hubs.browse.mine": "هاب‌های من (محلی)",
"hubs.browse.localNote": "یک پیش‌نویس محلی — تا زمانی که فهرست میزبانی نشود فقط شما آن را می‌بینید.",
"hubs.preview.label": "پیش‌نمایش",
"plugins.title": "افزونه‌ها",
"plugins.subtitle": "افزونه‌ها را کامل نگه دارید و مقصد همگام‌سازی را انتخاب کنید.",
"plugins.add": "افزودن افزونه",
+59 -49
View File
@@ -981,15 +981,12 @@
"install.url.onlySkills": "Aucun agent trouvé. skillshare cherche uniquement un dossier agents/ à la racine de la source : ce sont donc des skills, visibles sur la page Skills. Pour les agents d’un sous-dossier, ajoutez son chemin : owner/repo/path/to/folder.",
"install.url.onlyAgents": "Aucun skill dans cette source. Ce sont des agents, visibles sur la page Agents.",
"install.hubs.title": "Gérer les hubs",
"install.hubs.add": "Ajouter un hub",
"install.hubs.addButton": "Ajouter",
"install.hubs.urlPlaceholder": "URL ou chemin de fichier",
"install.hubs.labelPlaceholder": "Libellé (optionnel)",
"install.hubs.remove": "Supprimer le hub",
"install.hubs.urlRequired": "L'URL est obligatoire",
"install.hubs.urlExists": "Cette URL de hub existe déjà",
"install.hubs.subtitle": "La recherche porte sur le hub choisi. La recherche GitHub reste toujours disponible.",
"install.hubs.hint": "Un hub est un fichier skillshare-hub.json qui liste des skills. Indiquez une URL ou un fichier local.",
"install.toast.installed": "{label} : Installé",
"install.toast.exists": "{count} déjà installés : {names}. Pour les remplacer, activez Force overwrite dans Advanced.",
"install.done": "Terminer",
@@ -1845,55 +1842,22 @@
"auditRules.regex.suppressed.other": "supprime {count} lignes",
"hubBuilder.title": "Mes Hubs",
"hubBuilder.subtitle": "Créez un catalogue de compétences à partager.",
"hubBuilder.import": "Importer JSON",
"hubBuilder.create": "Nouveau Hub",
"hubBuilder.untitled": "Hub sans titre",
"hubBuilder.drafts": "Brouillons",
"hubBuilder.emptyDrafts": "Vos brouillons enregistrés apparaîtront ici.",
"hubBuilder.count.one": "{count} compétence",
"hubBuilder.count.other": "{count} compétences",
"hubBuilder.startTitle": "Partagez sans écrire de JSON",
"hubBuilder.start": "Créez un Hub, choisissez des compétences installées et téléchargez son index. Vous pouvez aussi importer un index existant.",
"hubBuilder.name": "Nom du Hub",
"hubBuilder.description": "Description",
"hubBuilder.metadataHint": "Le nom et la description servent à organiser les brouillons et ne sont pas exportés.",
"hubBuilder.fromInstalled": "Choisir des compétences installées",
"hubBuilder.manual": "Ajouter une source manuellement",
"hubBuilder.filter": "Rechercher des compétences",
"hubBuilder.noEntries": "Ajoutez des compétences installées ou une source de dépôt.",
"hubBuilder.newEntry": "Nouvelle compétence",
"hubBuilder.displayName": "Nom affiché",
"hubBuilder.entryDescription": "Description de la compétence",
"hubBuilder.source": "Source d’installation",
"hubBuilder.sourceHint": "Utilisez un dépôt distant ou un chemin comme owner/repo/skills/review. Les sources locales sont enregistrables mais non exportables.",
"hubBuilder.tags": "Étiquettes (séparées par des virgules)",
"hubBuilder.advanced": "Avancé",
"hubBuilder.selector": "Sélecteur de compétence (facultatif)",
"hubBuilder.selectorHint": "Conservé à l’importation. Utilisez le nom original ou le chemin relatif dans le dépôt.",
"hubBuilder.unsaved": "Modifications non enregistrées. Enregistrez pour vérifier les sources.",
"hubBuilder.blocked.one": "Personne d'autre ne peut installer {count} skill. Corrigez sa source ou supprimez l'entrée.",
"hubBuilder.blocked.other": "Personne d'autre ne peut installer {count} skills. Corrigez chaque source ou supprimez l'entrée.",
"hubBuilder.ready": "Enregistré. Prêt à exporter.",
"hubBuilder.accessHint": "Seule la syntaxe est vérifiée, pas la disponibilité. Les destinataires doivent avoir accès aux dépôts privés.",
"hubBuilder.save": "Enregistrer le brouillon",
"hubBuilder.saved": "Brouillon enregistré.",
"hubBuilder.download": "Télécharger l’index",
"hubBuilder.reload": "Recharger le brouillon enregistré",
"hubBuilder.delete": "Supprimer le brouillon",
"hubBuilder.shareTitle": "Partager au-delà de cette machine",
"hubBuilder.shareHint": "Vous pouvez déjà parcourir ce hub en local. Pour que d'autres puissent y installer des skills, téléchargez skillshare-hub.json, hébergez-le sur Git ou HTTP, puis indiquez ici son emplacement.",
"hubBuilder.hostLocation": "Emplacement de l’index hébergé",
"hubBuilder.copyCommand": "Copier la commande d’ajout",
"hubBuilder.copied": "Commande copiée.",
"hubBuilder.noInstalled": "Aucune compétence installée. Vous pouvez ajouter des sources manuellement.",
"hubBuilder.addSelected": "Ajouter les {count} sélections",
"hubBuilder.leaveTitle": "Abandonner les modifications ?",
"hubBuilder.leaveHint": "Les modifications depuis le dernier enregistrement seront perdues.",
"hubBuilder.deleteHint": "Supprimer définitivement ce brouillon ? Les compétences installées et les fichiers hébergés ne sont pas affectés.",
"hubBuilder.conflict": "Ce brouillon a changé dans une autre fenêtre. Rechargez-le avant de modifier. Vos changements actuels ne sont pas enregistrés.",
"hubBuilder.fileTooLarge": "Choisissez un fichier JSON de moins de 4 Mo.",
"hubBuilder.loading": "Chargement…",
"hubBuilder.remove": "Retirer",
"hubBuilder.problem.local_source": "Cette source est locale. Saisissez un dépôt distant pour exporter.",
"hubBuilder.problem.missing_source": "Saisissez une source d’installation.",
"hubBuilder.problem.invalid_source": "Source inconnue. Vérifiez la syntaxe du dépôt.",
@@ -1901,19 +1865,68 @@
"hubBuilder.problem.missing_name": "Saisissez un nom affiché.",
"hubBuilder.problem.invalid_selector": "Utilisez un sélecteur relatif au dépôt sans remonter au dossier parent.",
"hubBuilder.problem.empty": "Ajoutez au moins une compétence.",
"hubBuilder.skills": "Skills",
"hubBuilder.noSource": "Pas encore de source",
"hubBuilder.installable": "installable",
"hubBuilder.expandEntry": "Modifier {name}",
"hubBuilder.collapseEntry": "Réduire {name}",
"hubBuilder.subscribe": "Ajouter à mes Hubs",
"hubBuilder.subscribed": "Ajouté. Il est maintenant dans l'onglet Parcourir.",
"hubBuilder.published": "Publié",
"hubBuilder.previewInBrowse": "Aperçu dans Parcourir",
"hubs.title": "Hubs",
"hubs.subtitle": "Installez des skills depuis un catalogue partagé, ou créez-en un pour votre équipe.",
"hubs.tabs.browse": "Parcourir",
"hubs.tabs.mine": "Mes Hubs",
"hubs.mine": "À moi",
"hubs.default": "Par défaut",
"hubs.shared": "partagé",
"hubs.addOrCreate": "Ajouter ou créer un Hub",
"hubs.add.existing": "Ajouter un Hub existant",
"hubs.add.hint": "Collez l'URL ou le chemin d'un skillshare-hub.json. Son nom vient de l'URL.",
"hubs.add.create": "Créer un nouveau Hub",
"hubs.add.createHint": "Partez de zéro, puis collez des URL ou ajoutez des skills installés.",
"hubs.add.import": "Importer skillshare-hub.json",
"hubs.add.importHint": "Ouvrez un index existant et continuez à le modifier.",
"hubs.view.mineNote": "Quand quelqu’un ajoute ce Hub, voici la liste qu’il voit.",
"hubs.view.edit": "Modifier",
"hubs.view.share": "Partager",
"hubs.view.more": "Plus d'actions",
"hubs.view.version": "Version",
"hubs.view.delete": "Supprimer le Hub",
"hubs.view.deleteHint": "Supprimer définitivement ce Hub ? Les skills installés et les fichiers hébergés ne sont pas touchés.",
"hubs.ref.default": "Branche par défaut",
"hubs.ref.loading": "Chargement des versions…",
"hubs.ref.fixed": "Cette source ne peut utiliser que sa branche par défaut.",
"hubs.conflict": "Ce Hub a été modifié dans une autre fenêtre, vos changements n'ont donc pas été enregistrés. Copiez ce que vous voulez garder, puis annulez ou fermez pour charger la dernière version.",
"hubs.edit.title": "Modifier {name}",
"hubs.edit.locked": "Modification en cours. Enregistrez ou annulez pour changer de Hub.",
"hubs.edit.addSkill": "Ajouter un skill",
"hubs.edit.done": "Terminé",
"hubs.edit.name": "Nom",
"hubs.edit.description": "Description",
"hubs.edit.source": "Source",
"hubs.edit.removeEntry": "Retirer {name}",
"hubs.edit.moreFields": "Autres champs pour {name}",
"hubs.edit.changes.one": "{count} modification non enregistrée",
"hubs.edit.changes.other": "{count} modifications non enregistrées",
"hubs.edit.blocked.one": "{count} skill que personne d’autre ne peut installer",
"hubs.edit.blocked.other": "{count} skills que personne d’autre ne peut installer",
"hubs.share.title": "Partager {name}",
"hubs.share.ready.one": "{count} skill peut être installé. Suivez les deux étapes ci-dessous pour que votre équipe ajoute ce Hub.",
"hubs.share.ready.other": "Les {count} skills peuvent être installés. Suivez les deux étapes ci-dessous pour que votre équipe ajoute ce Hub.",
"hubs.share.step1": "Téléchargez le fichier d'index",
"hubs.share.download": "Télécharger skillshare-hub.json",
"hubs.share.fixFirst": "Choisissez d'abord Modifier et corrigez les skills que personne d'autre ne peut installer.",
"hubs.share.step2": "Placez-le là où votre équipe y a accès, puis collez l'URL",
"hubs.share.step2Hint": "Un dépôt Git ou HTTP conviennent. Pour un dépôt privé, il faut un accès en lecture.",
"hubs.share.step3": "Demandez à votre équipe de lancer cette commande",
"hubs.share.step3Hint": "Ou, dans le dashboard, choisissez Ajouter ou créer un Hub sur la page Hubs et collez la même URL.",
"hubs.share.needURL": "Collez l'URL ci-dessus pour voir la commande.",
"hubs.addSkill.title": "Ajouter des skills à {name}",
"hubs.addSkill.how": "Mode d'ajout",
"hubs.addSkill.tab.url": "Coller une URL",
"hubs.addSkill.tab.installed": "Installés",
"hubs.addSkill.url": "URL Git",
"hubs.addSkill.find": "Chercher",
"hubs.addSkill.urlHint": "Collez un dépôt, un sous-dossier ou une URL GitHub avec tree/<version>/. Inutile de l'installer d'abord.",
"hubs.addSkill.versionHint": "Liste les branches et tags de ce dépôt. Choisissez Branche par défaut pour suivre la dernière version.",
"hubs.addSkill.found.one": "{count} skill trouvé",
"hubs.addSkill.found.other": "{count} skills trouvés",
"hubs.addSkill.selectAll": "Tout sélectionner",
"hubs.addSkill.inHub": "Déjà dans ce Hub",
"hubs.addSkill.manual": "Introuvable ? Saisissez la source vous-même",
"hubs.addSkill.add": "Ajouter {count}",
"hubs.browse.sources": "Hubs",
"hubs.browse.pickTitle": "Choisissez un Hub",
"hubs.browse.pickHint": "Choisissez un Hub à gauche pour voir les skills qu'il propose.",
@@ -1926,9 +1939,6 @@
"hubs.browse.removeHint": "Retirer {name} de vos Hubs ? Les skills déjà installées restent.",
"hubs.browse.tag": "Étiquette",
"hubs.browse.allTags": "Toutes",
"hubs.browse.mine": "Mes hubs (local)",
"hubs.browse.localNote": "Un brouillon local : vous seul pouvez le voir tant que l'index n'est pas hébergé.",
"hubs.preview.label": "Aperçu",
"plugins.title": "Plugins",
"plugins.subtitle": "Conservez les plugins complets et choisissez où les synchroniser.",
"plugins.add": "Ajouter un plugin",
+59 -49
View File
@@ -981,15 +981,12 @@
"install.url.onlySkills": "Tidak ada agents. skillshare hanya mencari folder agents/ di tingkat teratas sumber, jadi ini adalah skills dan akan muncul di halaman Skills. Untuk agents di subfolder, tambahkan jalurnya: owner/repo/path/to/folder.",
"install.url.onlyAgents": "Tidak ada skills di sumber ini. Ini adalah agents dan akan muncul di halaman Agents.",
"install.hubs.title": "Kelola Hub",
"install.hubs.add": "Tambah Hub",
"install.hubs.addButton": "Tambah",
"install.hubs.urlPlaceholder": "URL atau path file",
"install.hubs.labelPlaceholder": "Label (opsional)",
"install.hubs.remove": "Hapus hub",
"install.hubs.urlRequired": "URL wajib diisi",
"install.hubs.urlExists": "URL hub ini sudah ada",
"install.hubs.subtitle": "Pencarian dilakukan di hub yang Anda pilih. Pencarian GitHub selalu tersedia.",
"install.hubs.hint": "Hub adalah berkas skillshare-hub.json yang berisi daftar skill. Arahkan ke URL atau berkas lokal.",
"install.toast.installed": "{label}: Terinstal",
"install.toast.exists": "{count} sudah terpasang: {names}. Untuk mengganti, aktifkan Force overwrite di Advanced.",
"install.done": "Selesai",
@@ -1845,55 +1842,22 @@
"auditRules.regex.suppressed.other": "menekan {count} baris",
"hubBuilder.title": "Hub saya",
"hubBuilder.subtitle": "Buat katalog skill untuk dibagikan.",
"hubBuilder.import": "Impor JSON",
"hubBuilder.create": "Hub baru",
"hubBuilder.untitled": "Hub tanpa judul",
"hubBuilder.drafts": "Draf",
"hubBuilder.emptyDrafts": "Draf tersimpan akan muncul di sini.",
"hubBuilder.count.one": "{count} skill",
"hubBuilder.count.other": "{count} skill",
"hubBuilder.startTitle": "Bagikan skill tanpa menulis JSON",
"hubBuilder.start": "Buat Hub, pilih skill terpasang, lalu unduh indeks. Anda juga bisa mengimpor indeks yang ada.",
"hubBuilder.name": "Nama Hub",
"hubBuilder.description": "Deskripsi",
"hubBuilder.metadataHint": "Nama dan deskripsi untuk mengatur draf, tidak disertakan dalam ekspor.",
"hubBuilder.fromInstalled": "Pilih skill terpasang",
"hubBuilder.manual": "Tambah sumber manual",
"hubBuilder.filter": "Cari skill",
"hubBuilder.noEntries": "Tambahkan skill terpasang atau sumber repositori.",
"hubBuilder.newEntry": "Skill baru",
"hubBuilder.displayName": "Nama tampilan",
"hubBuilder.entryDescription": "Deskripsi skill",
"hubBuilder.source": "Sumber instalasi",
"hubBuilder.sourceHint": "Gunakan repositori jarak jauh atau jalur seperti owner/repo/skills/review. Sumber lokal bisa disimpan tetapi tidak diekspor.",
"hubBuilder.tags": "Tag (pisahkan dengan koma)",
"hubBuilder.advanced": "Lanjutan",
"hubBuilder.selector": "Pemilih skill (opsional)",
"hubBuilder.selectorHint": "Dipertahankan saat impor. Gunakan nama asli atau jalur relatif dalam repositori.",
"hubBuilder.unsaved": "Perubahan belum disimpan. Simpan untuk memeriksa sumber.",
"hubBuilder.blocked.one": "{count} skill tidak bisa dipasang orang lain. Perbaiki sumbernya atau hapus entrinya.",
"hubBuilder.blocked.other": "{count} skills tidak bisa dipasang orang lain. Perbaiki setiap sumber atau hapus entrinya.",
"hubBuilder.ready": "Tersimpan. Siap diekspor.",
"hubBuilder.accessHint": "Hanya sintaks yang diperiksa, bukan ketersediaan. Penerima memerlukan akses ke repositori privat.",
"hubBuilder.save": "Simpan draf",
"hubBuilder.saved": "Draf tersimpan.",
"hubBuilder.download": "Unduh indeks",
"hubBuilder.reload": "Muat ulang draf tersimpan",
"hubBuilder.delete": "Hapus draf",
"hubBuilder.shareTitle": "Bagikan ke luar mesin ini",
"hubBuilder.shareHint": "Anda sudah bisa menelusuri hub ini secara lokal. Agar orang lain dapat memasang dari sini, unduh skillshare-hub.json, host di Git atau HTTP, lalu catat lokasinya di sini.",
"hubBuilder.hostLocation": "Lokasi indeks yang dihosting",
"hubBuilder.copyCommand": "Salin perintah tambah",
"hubBuilder.copied": "Perintah disalin.",
"hubBuilder.noInstalled": "Tidak ada skill terpasang. Anda dapat menambah sumber manual.",
"hubBuilder.addSelected": "Tambah {count} pilihan",
"hubBuilder.leaveTitle": "Buang perubahan yang belum disimpan?",
"hubBuilder.leaveHint": "Perubahan sejak penyimpanan terakhir akan hilang.",
"hubBuilder.deleteHint": "Hapus draf ini selamanya? Skill terpasang dan berkas yang dihosting tidak terpengaruh.",
"hubBuilder.conflict": "Draf berubah di jendela lain. Muat ulang sebelum mengedit. Perubahan saat ini belum disimpan.",
"hubBuilder.fileTooLarge": "Pilih berkas JSON kurang dari 4 MB.",
"hubBuilder.loading": "Memuat…",
"hubBuilder.remove": "Hapus",
"hubBuilder.problem.local_source": "Sumber ini lokal. Masukkan repositori jarak jauh untuk mengekspor.",
"hubBuilder.problem.missing_source": "Masukkan sumber instalasi.",
"hubBuilder.problem.invalid_source": "Sumber tidak dikenali. Periksa sintaks repositori.",
@@ -1901,19 +1865,68 @@
"hubBuilder.problem.missing_name": "Masukkan nama tampilan.",
"hubBuilder.problem.invalid_selector": "Gunakan pemilih relatif repositori tanpa menuju direktori induk.",
"hubBuilder.problem.empty": "Tambahkan setidaknya satu skill.",
"hubBuilder.skills": "Skills",
"hubBuilder.noSource": "Belum ada sumber",
"hubBuilder.installable": "installable",
"hubBuilder.expandEntry": "Ubah {name}",
"hubBuilder.collapseEntry": "Tutup {name}",
"hubBuilder.subscribe": "Tambah ke hub saya",
"hubBuilder.subscribed": "Ditambahkan. Sekarang ada di tab Jelajahi.",
"hubBuilder.published": "Sudah dipublikasikan",
"hubBuilder.previewInBrowse": "Pratinjau di Jelajah",
"hubs.title": "Hubs",
"hubs.subtitle": "Pasang skills dari katalog bersama, atau buat satu untuk tim Anda.",
"hubs.tabs.browse": "Jelajahi",
"hubs.tabs.mine": "Hub saya",
"hubs.mine": "Milik saya",
"hubs.default": "Bawaan",
"hubs.shared": "dibagikan",
"hubs.addOrCreate": "Tambah atau buat Hub",
"hubs.add.existing": "Tambah Hub yang sudah ada",
"hubs.add.hint": "Tempel URL atau path skillshare-hub.json. Namanya diambil dari URL.",
"hubs.add.create": "Buat Hub baru",
"hubs.add.createHint": "Mulai kosong, lalu tempel URL atau tambahkan skills yang terpasang.",
"hubs.add.import": "Impor skillshare-hub.json",
"hubs.add.importHint": "Buka indeks yang sudah ada dan lanjutkan mengedit.",
"hubs.view.mineNote": "Setelah orang lain menambahkan Hub ini, daftar inilah yang mereka lihat.",
"hubs.view.edit": "Edit",
"hubs.view.share": "Bagikan",
"hubs.view.more": "Tindakan lain",
"hubs.view.version": "Versi",
"hubs.view.delete": "Hapus Hub",
"hubs.view.deleteHint": "Hapus Hub ini secara permanen? Skills yang terpasang dan file yang di-host tidak terpengaruh.",
"hubs.ref.default": "Branch bawaan",
"hubs.ref.loading": "Memuat versi…",
"hubs.ref.fixed": "Sumber ini hanya bisa memakai branch bawaannya.",
"hubs.conflict": "Hub ini diubah di jendela lain, jadi perubahan Anda tidak tersimpan. Salin yang ingin disimpan, lalu batalkan atau tutup untuk memuat versi terbaru.",
"hubs.edit.title": "Edit {name}",
"hubs.edit.locked": "Sedang mengedit. Simpan atau batalkan untuk berpindah Hub.",
"hubs.edit.addSkill": "Tambah skill",
"hubs.edit.done": "Selesai",
"hubs.edit.name": "Nama",
"hubs.edit.description": "Deskripsi",
"hubs.edit.source": "Sumber",
"hubs.edit.removeEntry": "Hapus {name}",
"hubs.edit.moreFields": "Kolom lain untuk {name}",
"hubs.edit.changes.one": "{count} perubahan belum disimpan",
"hubs.edit.changes.other": "{count} perubahan belum disimpan",
"hubs.edit.blocked.one": "{count} skill tidak bisa dipasang orang lain",
"hubs.edit.blocked.other": "{count} skills tidak bisa dipasang orang lain",
"hubs.share.title": "Bagikan {name}",
"hubs.share.ready.one": "{count} skill bisa dipasang. Ikuti dua langkah di bawah agar tim Anda bisa menambahkan Hub ini.",
"hubs.share.ready.other": "Semua {count} skills bisa dipasang. Ikuti dua langkah di bawah agar tim Anda bisa menambahkan Hub ini.",
"hubs.share.step1": "Unduh file indeks",
"hubs.share.download": "Unduh skillshare-hub.json",
"hubs.share.fixFirst": "Pilih Edit dulu dan perbaiki skills yang tidak bisa dipasang orang lain.",
"hubs.share.step2": "Taruh di tempat yang bisa dijangkau tim Anda, lalu tempel URL-nya",
"hubs.share.step2Hint": "Repo Git atau HTTP sama-sama bisa. Untuk repo privat, orang lain perlu akses baca.",
"hubs.share.step3": "Minta tim Anda menjalankan perintah ini",
"hubs.share.step3Hint": "Atau di dashboard, pilih Tambah atau buat Hub di halaman Hubs lalu tempel URL yang sama.",
"hubs.share.needURL": "Tempel URL di atas untuk melihat perintahnya.",
"hubs.addSkill.title": "Tambah skills ke {name}",
"hubs.addSkill.how": "Cara menambah",
"hubs.addSkill.tab.url": "Tempel URL",
"hubs.addSkill.tab.installed": "Terpasang",
"hubs.addSkill.url": "URL Git",
"hubs.addSkill.find": "Cari",
"hubs.addSkill.urlHint": "Tempel repo, subfolder, atau URL GitHub dengan tree/<versi>/. Tidak perlu dipasang dulu.",
"hubs.addSkill.versionHint": "Menampilkan branch dan tag repo ini. Pilih Branch bawaan untuk selalu mengikuti versi terbaru.",
"hubs.addSkill.found.one": "Ditemukan {count} skill",
"hubs.addSkill.found.other": "Ditemukan {count} skills",
"hubs.addSkill.selectAll": "Pilih semua",
"hubs.addSkill.inHub": "Sudah ada di Hub ini",
"hubs.addSkill.manual": "Tidak ketemu? Isi sumbernya sendiri",
"hubs.addSkill.add": "Tambah {count}",
"hubs.browse.sources": "Hubs",
"hubs.browse.pickTitle": "Pilih hub",
"hubs.browse.pickHint": "Pilih hub di sebelah kiri untuk melihat skills yang tersedia.",
@@ -1926,9 +1939,6 @@
"hubs.browse.removeHint": "Hapus {name} dari hub Anda? Skills yang sudah dipasang tetap ada.",
"hubs.browse.tag": "Tag",
"hubs.browse.allTags": "Semua",
"hubs.browse.mine": "Hub saya (lokal)",
"hubs.browse.localNote": "Draf lokal — hanya Anda yang bisa melihatnya sampai indeksnya di-host.",
"hubs.preview.label": "Pratinjau",
"plugins.title": "Plugin",
"plugins.subtitle": "Pertahankan plugin lengkap dan pilih tujuan sinkronisasi.",
"plugins.add": "Tambah plugin",
+59 -49
View File
@@ -981,15 +981,12 @@
"install.url.onlySkills": "agents が見つかりません。skillshare はソースの最上位にある agents/ フォルダーだけを探すため、これらは skills として Skills ページに表示されます。サブフォルダーの agents を入れるにはパスを付けてください: owner/repo/path/to/folder。",
"install.url.onlyAgents": "このソースには skills がありません。これらは agents で、Agents ページに表示されます。",
"install.hubs.title": "ハブを管理",
"install.hubs.add": "ハブを追加",
"install.hubs.addButton": "追加",
"install.hubs.urlPlaceholder": "URL またはファイルパス",
"install.hubs.labelPlaceholder": "ラベル(任意)",
"install.hubs.remove": "ハブを削除",
"install.hubs.urlRequired": "URL は必須です",
"install.hubs.urlExists": "このハブ URL はすでに存在します",
"install.hubs.subtitle": "検索は選んだ hub を対象にします。GitHub 検索はいつでも使えます。",
"install.hubs.hint": "hub はスキルを一覧する skillshare-hub.json ファイルです。URL またはローカルファイルを指定します。",
"install.toast.installed": "{label}: インストール完了",
"install.toast.exists": "{count} 件はインストール済み: {names}。置き換えるには Advanced で Force overwrite をオンにしてください。",
"install.done": "完了",
@@ -1845,55 +1842,22 @@
"auditRules.regex.suppressed.other": "{count} 行を除外",
"hubBuilder.title": "マイ Hub",
"hubBuilder.subtitle": "スキルのカタログを作成して共有します。",
"hubBuilder.import": "JSON を読み込む",
"hubBuilder.create": "新しい Hub",
"hubBuilder.untitled": "無題の Hub",
"hubBuilder.drafts": "下書き",
"hubBuilder.emptyDrafts": "保存した下書きがここに表示されます。",
"hubBuilder.count.one": "{count} 個のスキル",
"hubBuilder.count.other": "{count} 個のスキル",
"hubBuilder.startTitle": "JSON を書かずにスキルを共有",
"hubBuilder.start": "Hub を作成し、インストール済みスキルを選んでインデックスをダウンロードします。既存のインデックスも読み込めます。",
"hubBuilder.name": "Hub 名",
"hubBuilder.description": "説明",
"hubBuilder.metadataHint": "名前と説明は下書きの整理用です。出力には含まれません。",
"hubBuilder.fromInstalled": "インストール済みから選択",
"hubBuilder.manual": "ソースを手動追加",
"hubBuilder.filter": "スキルを検索",
"hubBuilder.noEntries": "インストール済みスキルかリポジトリのソースを追加してください。",
"hubBuilder.newEntry": "新しいスキル",
"hubBuilder.displayName": "表示名",
"hubBuilder.entryDescription": "スキルの説明",
"hubBuilder.source": "インストール元",
"hubBuilder.sourceHint": "owner/repo/skills/review などのリモートリポジトリ内のパスを指定します。ローカルのソースは保存のみ可能です。",
"hubBuilder.tags": "タグ(カンマ区切り)",
"hubBuilder.advanced": "詳細設定",
"hubBuilder.selector": "スキルセレクター(任意)",
"hubBuilder.selectorHint": "読み込み時に保持されます。複数スキルのリポジトリでは元の名前かリポジトリ内の相対パスを指定します。",
"hubBuilder.unsaved": "未保存の変更があります。保存してソースを確認してください。",
"hubBuilder.blocked.one": "{count} 件の skills は他の人がインストールできません。ソースを修正するか、項目を削除してください。",
"hubBuilder.blocked.other": "{count} 件の skills は他の人がインストールできません。ソースを修正するか、項目を削除してください。",
"hubBuilder.ready": "保存済み。出力できます。",
"hubBuilder.accessHint": "構文のみを確認します。アクセスは未検証です。非公開リポジトリには利用者の権限が必要です。",
"hubBuilder.save": "下書きを保存",
"hubBuilder.saved": "保存しました。",
"hubBuilder.download": "インデックスをダウンロード",
"hubBuilder.reload": "保存済みを再読み込み",
"hubBuilder.delete": "下書きを削除",
"hubBuilder.shareTitle": "この端末の外部と共有",
"hubBuilder.shareHint": "このハブはすでにローカルで閲覧できます。他の人がインストールできるようにするには、skillshare-hub.json をダウンロードし、Git または HTTP 上に配置して、その場所をここに記録してください。",
"hubBuilder.hostLocation": "公開先のインデックス",
"hubBuilder.copyCommand": "追加コマンドをコピー",
"hubBuilder.copied": "コピーしました。",
"hubBuilder.noInstalled": "インストール済みスキルがありません。手動で追加できます。",
"hubBuilder.addSelected": "選択した {count} 件を追加",
"hubBuilder.leaveTitle": "未保存の変更を破棄しますか?",
"hubBuilder.leaveHint": "最後の保存以降の変更が失われます。",
"hubBuilder.deleteHint": "下書きを完全に削除しますか?インストール済みスキルや公開ファイルには影響しません。",
"hubBuilder.conflict": "別の画面で変更されています。再読み込みして編集してください。今回の変更は保存されていません。",
"hubBuilder.fileTooLarge": "4 MB 未満の JSON を選んでください。",
"hubBuilder.loading": "読み込み中…",
"hubBuilder.remove": "削除",
"hubBuilder.problem.local_source": "ローカルのソースです。出力するにはリモートリポジトリを指定してください。",
"hubBuilder.problem.missing_source": "インストール元を入力してください。",
"hubBuilder.problem.invalid_source": "ソースを認識できません。リポジトリの構文を確認してください。",
@@ -1901,19 +1865,68 @@
"hubBuilder.problem.missing_name": "表示名を入力してください。",
"hubBuilder.problem.invalid_selector": "親ディレクトリへの移動を含まない相対パスを指定してください。",
"hubBuilder.problem.empty": "スキルを 1 つ以上追加してください。",
"hubBuilder.skills": "Skills",
"hubBuilder.noSource": "ソース未入力",
"hubBuilder.installable": "installable",
"hubBuilder.expandEntry": "{name} を編集",
"hubBuilder.collapseEntry": "{name} を閉じる",
"hubBuilder.subscribe": "自分の Hub に追加",
"hubBuilder.subscribed": "追加しました。「閲覧」タブで確認できます。",
"hubBuilder.published": "公開済み",
"hubBuilder.previewInBrowse": "「ブラウズ」で確認",
"hubs.title": "Hub",
"hubs.subtitle": "共有カタログから skills をインストールするか、チーム用に作成します。",
"hubs.tabs.browse": "閲覧",
"hubs.tabs.mine": "自分の Hub",
"hubs.mine": "自分の",
"hubs.default": "既定",
"hubs.shared": "共有済み",
"hubs.addOrCreate": "Hub を追加・作成",
"hubs.add.existing": "既存の Hub を追加",
"hubs.add.hint": "skillshare-hub.json の URL かパスを貼り付けます。名前は URL から付きます。",
"hubs.add.create": "新しい Hub を作成",
"hubs.add.createHint": "空の状態から始めて、URL を貼るかインストール済みの skills から追加します。",
"hubs.add.import": "skillshare-hub.json を読み込む",
"hubs.add.importHint": "手元の索引ファイルを開いて編集を続けます。",
"hubs.view.mineNote": "他の人がこの Hub を追加すると、この一覧が表示されます。",
"hubs.view.edit": "編集",
"hubs.view.share": "共有",
"hubs.view.more": "その他の操作",
"hubs.view.version": "バージョン",
"hubs.view.delete": "Hub を削除",
"hubs.view.deleteHint": "この Hub を完全に削除しますか?インストール済みの skills や公開先のファイルには影響しません。",
"hubs.ref.default": "既定のブランチ",
"hubs.ref.loading": "バージョンを読み込み中…",
"hubs.ref.fixed": "このソースは既定のブランチしか使えません。",
"hubs.conflict": "この Hub は別のウィンドウで変更されたため、変更は保存されていません。残したい内容をコピーしてから、キャンセルするか閉じて最新版を読み込んでください。",
"hubs.edit.title": "{name} を編集",
"hubs.edit.locked": "編集中です。保存するかキャンセルすると Hub を切り替えられます。",
"hubs.edit.addSkill": "skill を追加",
"hubs.edit.done": "完了",
"hubs.edit.name": "名前",
"hubs.edit.description": "説明",
"hubs.edit.source": "ソース",
"hubs.edit.removeEntry": "{name} を削除",
"hubs.edit.moreFields": "{name} のその他の項目",
"hubs.edit.changes.one": "未保存の変更が {count} 件あります",
"hubs.edit.changes.other": "未保存の変更が {count} 件あります",
"hubs.edit.blocked.one": "{count} 件の skill は他の人がインストールできません",
"hubs.edit.blocked.other": "{count} 件の skill は他の人がインストールできません",
"hubs.share.title": "{name} を共有",
"hubs.share.ready.one": "{count} 件の skill はすべてインストールできます。次の 2 ステップで、チームがこの Hub を追加できるようにします。",
"hubs.share.ready.other": "{count} 件の skill はすべてインストールできます。次の 2 ステップで、チームがこの Hub を追加できるようにします。",
"hubs.share.step1": "索引ファイルをダウンロード",
"hubs.share.download": "skillshare-hub.json をダウンロード",
"hubs.share.fixFirst": "先に「編集」から、他の人がインストールできない skill を直してください。",
"hubs.share.step2": "チームがアクセスできる場所に置いて、URL を貼り付けます",
"hubs.share.step2Hint": "Git リポジトリでも HTTP でも使えます。非公開リポジトリには読み取り権限が必要です。",
"hubs.share.step3": "チームにこのコマンドを実行してもらいます",
"hubs.share.step3Hint": "または dashboard の Hubs ページで「Hub を追加・作成」を選び、同じ URL を貼り付けます。",
"hubs.share.needURL": "上に URL を貼り付けると、ここにコマンドが表示されます。",
"hubs.addSkill.title": "{name} に skill を追加",
"hubs.addSkill.how": "追加方法",
"hubs.addSkill.tab.url": "URL を貼り付け",
"hubs.addSkill.tab.installed": "インストール済み",
"hubs.addSkill.url": "Git URL",
"hubs.addSkill.find": "探す",
"hubs.addSkill.urlHint": "リポジトリ、サブフォルダ、または tree/<バージョン>/ を含む GitHub の URL を貼り付けられます。先にインストールする必要はありません。",
"hubs.addSkill.versionHint": "このリポジトリのブランチとタグを一覧表示します。「既定のブランチ」を選ぶと常に最新版を使います。",
"hubs.addSkill.found.one": "{count} 件の skill が見つかりました",
"hubs.addSkill.found.other": "{count} 件の skill が見つかりました",
"hubs.addSkill.selectAll": "すべて選択",
"hubs.addSkill.inHub": "この Hub に追加済み",
"hubs.addSkill.manual": "見つからない場合はソースを手入力",
"hubs.addSkill.add": "{count} 件を追加",
"hubs.browse.sources": "Hub",
"hubs.browse.pickTitle": "Hub を選ぶ",
"hubs.browse.pickHint": "左の Hub を選ぶと、含まれる skills が表示されます。",
@@ -1926,9 +1939,6 @@
"hubs.browse.removeHint": "{name} を Hub から削除しますか?インストール済みの skills はそのまま残ります。",
"hubs.browse.tag": "タグ",
"hubs.browse.allTags": "すべて",
"hubs.browse.mine": "マイ Hub(ローカル)",
"hubs.browse.localNote": "ローカルの下書きです。インデックスを公開するまではあなたにしか見えません。",
"hubs.preview.label": "プレビュー",
"plugins.title": "プラグイン",
"plugins.subtitle": "プラグイン全体を保ち、同期先を選択します。",
"plugins.add": "プラグインを追加",
+59 -49
View File
@@ -981,15 +981,12 @@
"install.url.onlySkills": "agents를 찾지 못했습니다. skillshare는 소스 최상위의 agents/ 폴더만 찾으므로 이 항목은 skills이며 Skills 페이지에 표시됩니다. 하위 폴더의 agents는 경로를 붙이세요: owner/repo/path/to/folder.",
"install.url.onlyAgents": "이 소스에는 skills가 없습니다. 이 항목은 agents이며 Agents 페이지에 표시됩니다.",
"install.hubs.title": "허브 관리",
"install.hubs.add": "허브 추가",
"install.hubs.addButton": "추가",
"install.hubs.urlPlaceholder": "URL 또는 파일 경로",
"install.hubs.labelPlaceholder": "레이블 (선택사항)",
"install.hubs.remove": "허브 제거",
"install.hubs.urlRequired": "URL이 필요합니다",
"install.hubs.urlExists": "이 허브 URL이 이미 존재합니다",
"install.hubs.subtitle": "검색은 선택한 hub에서 이루어집니다. GitHub 검색은 항상 사용할 수 있습니다.",
"install.hubs.hint": "hub는 skill 목록이 담긴 skillshare-hub.json 파일입니다. URL이나 로컬 파일을 지정하세요.",
"install.toast.installed": "{label}: 설치됨",
"install.toast.exists": "{count}개는 이미 설치됨: {names}. 교체하려면 Advanced에서 Force overwrite를 켜세요.",
"install.done": "완료",
@@ -1845,55 +1842,22 @@
"auditRules.regex.suppressed.other": "{count}줄 제외",
"hubBuilder.title": "내 Hub",
"hubBuilder.subtitle": "스킬 목록을 만들어 공유하세요.",
"hubBuilder.import": "JSON 가져오기",
"hubBuilder.create": "새 Hub",
"hubBuilder.untitled": "이름 없는 Hub",
"hubBuilder.drafts": "초안",
"hubBuilder.emptyDrafts": "저장한 초안이 여기에 표시됩니다.",
"hubBuilder.count.one": "스킬 {count}개",
"hubBuilder.count.other": "스킬 {count}개",
"hubBuilder.startTitle": "JSON 없이 스킬 공유",
"hubBuilder.start": "Hub를 만들고 설치된 스킬을 선택한 뒤 인덱스를 다운로드하세요. 기존 인덱스도 가져올 수 있습니다.",
"hubBuilder.name": "Hub 이름",
"hubBuilder.description": "설명",
"hubBuilder.metadataHint": "이름과 설명은 초안 정리용이며 내보낸 인덱스에는 포함되지 않습니다.",
"hubBuilder.fromInstalled": "설치된 스킬 선택",
"hubBuilder.manual": "소스 직접 추가",
"hubBuilder.filter": "스킬 검색",
"hubBuilder.noEntries": "설치된 스킬이나 저장소 소스를 추가하세요.",
"hubBuilder.newEntry": "새 스킬",
"hubBuilder.displayName": "표시 이름",
"hubBuilder.entryDescription": "스킬 설명",
"hubBuilder.source": "설치 소스",
"hubBuilder.sourceHint": "owner/repo/skills/review 같은 원격 저장소 경로를 사용하세요. 로컬 소스는 저장만 가능합니다.",
"hubBuilder.tags": "태그 (쉼표 구분)",
"hubBuilder.advanced": "고급",
"hubBuilder.selector": "스킬 선택자 (선택)",
"hubBuilder.selectorHint": "가져올 때 유지됩니다. 여러 스킬이 있는 저장소의 원래 이름이나 상대 경로를 입력하세요.",
"hubBuilder.unsaved": "저장하지 않은 변경 사항이 있습니다. 저장 후 소스를 확인하세요.",
"hubBuilder.blocked.one": "{count}개의 skills는 다른 사람이 설치할 수 없습니다. 각 소스를 고치거나 항목을 제거하세요.",
"hubBuilder.blocked.other": "{count}개의 skills는 다른 사람이 설치할 수 없습니다. 각 소스를 고치거나 항목을 제거하세요.",
"hubBuilder.ready": "저장되었습니다. 내보낼 수 있습니다.",
"hubBuilder.accessHint": "소스 문법만 확인하며 접근 가능 여부는 검증하지 않습니다. 비공개 저장소에는 사용자의 접근 권한이 필요합니다.",
"hubBuilder.save": "초안 저장",
"hubBuilder.saved": "초안이 저장되었습니다.",
"hubBuilder.download": "인덱스 다운로드",
"hubBuilder.reload": "저장된 초안 다시 불러오기",
"hubBuilder.delete": "초안 삭제",
"hubBuilder.shareTitle": "이 컴퓨터 밖으로 공유",
"hubBuilder.shareHint": "이 허브는 이미 로컬에서 둘러볼 수 있습니다. 다른 사람이 설치할 수 있게 하려면 skillshare-hub.json을 내려받아 Git 또는 HTTP에 호스팅한 뒤, 그 위치를 여기에 기록하세요.",
"hubBuilder.hostLocation": "호스팅된 인덱스 위치",
"hubBuilder.copyCommand": "추가 명령 복사",
"hubBuilder.copied": "명령을 복사했습니다.",
"hubBuilder.noInstalled": "설치된 스킬이 없습니다. 소스를 직접 추가할 수 있습니다.",
"hubBuilder.addSelected": "선택한 {count}개 추가",
"hubBuilder.leaveTitle": "저장하지 않은 변경을 버릴까요?",
"hubBuilder.leaveHint": "마지막 저장 이후의 수정 사항이 사라집니다.",
"hubBuilder.deleteHint": "초안을 영구 삭제할까요? 설치된 스킬과 호스팅 파일에는 영향이 없습니다.",
"hubBuilder.conflict": "다른 창에서 초안이 변경되었습니다. 다시 불러온 뒤 편집하세요. 현재 변경은 저장되지 않았습니다.",
"hubBuilder.fileTooLarge": "4 MB 미만의 JSON 파일을 선택하세요.",
"hubBuilder.loading": "불러오는 중…",
"hubBuilder.remove": "제거",
"hubBuilder.problem.local_source": "로컬 소스입니다. 내보내려면 원격 저장소를 입력하세요.",
"hubBuilder.problem.missing_source": "설치 소스를 입력하세요.",
"hubBuilder.problem.invalid_source": "설치 소스를 인식할 수 없습니다. 저장소 문법을 확인하세요.",
@@ -1901,19 +1865,68 @@
"hubBuilder.problem.missing_name": "표시 이름을 입력하세요.",
"hubBuilder.problem.invalid_selector": "상위 디렉터리 이동이 없는 저장소 상대 경로를 사용하세요.",
"hubBuilder.problem.empty": "스킬을 하나 이상 추가하세요.",
"hubBuilder.skills": "Skills",
"hubBuilder.noSource": "소스 없음",
"hubBuilder.installable": "installable",
"hubBuilder.expandEntry": "{name} 편집",
"hubBuilder.collapseEntry": "{name} 접기",
"hubBuilder.subscribe": "내 Hub에 추가",
"hubBuilder.subscribed": "추가했습니다. 이제 둘러보기 탭에 있습니다.",
"hubBuilder.published": "게시됨",
"hubBuilder.previewInBrowse": "둘러보기에서 미리 보기",
"hubs.title": "Hub",
"hubs.subtitle": "공유 카탈로그에서 skills를 설치하거나 팀용으로 하나 만드세요.",
"hubs.tabs.browse": "둘러보기",
"hubs.tabs.mine": "내 Hub",
"hubs.mine": "내 Hub",
"hubs.default": "기본",
"hubs.shared": "공유됨",
"hubs.addOrCreate": "Hub 추가 또는 만들기",
"hubs.add.existing": "기존 Hub 추가",
"hubs.add.hint": "skillshare-hub.json의 URL이나 경로를 붙여 넣으세요. 이름은 URL에서 가져옵니다.",
"hubs.add.create": "새 Hub 만들기",
"hubs.add.createHint": "빈 상태로 시작한 뒤 URL을 붙여 넣거나 설치된 skills에서 추가하세요.",
"hubs.add.import": "skillshare-hub.json 가져오기",
"hubs.add.importHint": "이미 있는 인덱스 파일을 열어 계속 편집하세요.",
"hubs.view.mineNote": "다른 사람이 이 Hub를 추가하면 바로 이 목록을 보게 됩니다.",
"hubs.view.edit": "편집",
"hubs.view.share": "공유",
"hubs.view.more": "더 보기",
"hubs.view.version": "버전",
"hubs.view.delete": "Hub 삭제",
"hubs.view.deleteHint": "이 Hub를 영구히 삭제할까요? 설치된 skills와 호스팅된 파일은 영향을 받지 않습니다.",
"hubs.ref.default": "기본 브랜치",
"hubs.ref.loading": "버전 불러오는 중…",
"hubs.ref.fixed": "이 소스는 기본 브랜치만 쓸 수 있습니다.",
"hubs.conflict": "이 Hub가 다른 창에서 바뀌어 변경 내용이 저장되지 않았습니다. 남길 내용을 복사한 뒤 취소하거나 닫아서 최신 버전을 불러오세요.",
"hubs.edit.title": "{name} 편집",
"hubs.edit.locked": "편집 중입니다. 저장하거나 취소해야 Hub를 바꿀 수 있습니다.",
"hubs.edit.addSkill": "skill 추가",
"hubs.edit.done": "완료",
"hubs.edit.name": "이름",
"hubs.edit.description": "설명",
"hubs.edit.source": "소스",
"hubs.edit.removeEntry": "{name} 제거",
"hubs.edit.moreFields": "{name}의 다른 항목",
"hubs.edit.changes.one": "저장하지 않은 변경 {count}개",
"hubs.edit.changes.other": "저장하지 않은 변경 {count}개",
"hubs.edit.blocked.one": "다른 사람이 설치할 수 없는 skill {count}개",
"hubs.edit.blocked.other": "다른 사람이 설치할 수 없는 skill {count}개",
"hubs.share.title": "{name} 공유",
"hubs.share.ready.one": "skill {count}개를 모두 설치할 수 있습니다. 아래 두 단계를 따라 팀이 이 Hub를 추가하게 하세요.",
"hubs.share.ready.other": "skill {count}개를 모두 설치할 수 있습니다. 아래 두 단계를 따라 팀이 이 Hub를 추가하게 하세요.",
"hubs.share.step1": "인덱스 파일 다운로드",
"hubs.share.download": "skillshare-hub.json 다운로드",
"hubs.share.fixFirst": "먼저 편집을 눌러 다른 사람이 설치할 수 없는 skill을 고치세요.",
"hubs.share.step2": "팀이 접근할 수 있는 곳에 올리고 URL을 붙여 넣으세요",
"hubs.share.step2Hint": "Git 저장소나 HTTP 모두 됩니다. 비공개 저장소는 읽기 권한이 있어야 합니다.",
"hubs.share.step3": "팀에게 이 명령을 실행하게 하세요",
"hubs.share.step3Hint": "또는 dashboard의 Hubs 페이지에서 Hub 추가 또는 만들기를 눌러 같은 URL을 붙여 넣으세요.",
"hubs.share.needURL": "위에 URL을 붙여 넣으면 여기에 명령이 나타납니다.",
"hubs.addSkill.title": "{name}에 skill 추가",
"hubs.addSkill.how": "추가 방법",
"hubs.addSkill.tab.url": "URL 붙여 넣기",
"hubs.addSkill.tab.installed": "설치됨",
"hubs.addSkill.url": "Git URL",
"hubs.addSkill.find": "찾기",
"hubs.addSkill.urlHint": "저장소, 하위 폴더, 또는 tree/<버전>/이 들어간 GitHub URL을 붙여 넣을 수 있습니다. 먼저 설치할 필요는 없습니다.",
"hubs.addSkill.versionHint": "이 저장소의 브랜치와 태그를 보여 줍니다. 기본 브랜치를 고르면 항상 최신 버전을 따라갑니다.",
"hubs.addSkill.found.one": "skill {count}개를 찾았습니다",
"hubs.addSkill.found.other": "skill {count}개를 찾았습니다",
"hubs.addSkill.selectAll": "모두 선택",
"hubs.addSkill.inHub": "이미 이 Hub에 있음",
"hubs.addSkill.manual": "찾을 수 없나요? 소스를 직접 입력",
"hubs.addSkill.add": "{count}개 추가",
"hubs.browse.sources": "Hub",
"hubs.browse.pickTitle": "Hub 선택",
"hubs.browse.pickHint": "왼쪽에서 Hub를 선택하면 포함된 skills가 표시됩니다.",
@@ -1926,9 +1939,6 @@
"hubs.browse.removeHint": "{name}을(를) Hub에서 제거할까요? 이미 설치한 skills는 그대로 남습니다.",
"hubs.browse.tag": "태그",
"hubs.browse.allTags": "전체",
"hubs.browse.mine": "내 Hub (로컬)",
"hubs.browse.localNote": "로컬 초안입니다. 색인을 호스팅하기 전까지는 본인만 볼 수 있습니다.",
"hubs.preview.label": "미리 보기",
"plugins.title": "플러그인",
"plugins.subtitle": "전체 플러그인을 유지하고 동기화할 도구를 선택하세요.",
"plugins.add": "플러그인 추가",
+59 -49
View File
@@ -981,15 +981,12 @@
"install.url.onlySkills": "Nenhum agent encontrado. O skillshare só procura uma pasta agents/ no topo da origem, então estes são skills e aparecerão na página Skills. Para agents de uma subpasta, adicione o caminho: owner/repo/path/to/folder.",
"install.url.onlyAgents": "Nenhum skill nesta origem. Estes são agents e aparecerão na página Agents.",
"install.hubs.title": "Gerenciar Hubs",
"install.hubs.add": "Adicionar Hub",
"install.hubs.addButton": "Adicionar",
"install.hubs.urlPlaceholder": "URL ou caminho de arquivo",
"install.hubs.labelPlaceholder": "Rótulo (opcional)",
"install.hubs.remove": "Remover hub",
"install.hubs.urlRequired": "URL é obrigatória",
"install.hubs.urlExists": "Esta URL de hub já existe",
"install.hubs.subtitle": "A busca usa o hub que você escolher. A busca no GitHub está sempre disponível.",
"install.hubs.hint": "Um hub é um arquivo skillshare-hub.json que lista skills. Aponte para uma URL ou um arquivo local.",
"install.toast.installed": "{label}: Instalado",
"install.toast.exists": "{count} já instalados: {names}. Para substituir, ative Force overwrite em Advanced.",
"install.done": "Concluir",
@@ -1845,55 +1842,22 @@
"auditRules.regex.suppressed.other": "suprime {count} linhas",
"hubBuilder.title": "Meus Hubs",
"hubBuilder.subtitle": "Crie um catálogo de habilidades para compartilhar.",
"hubBuilder.import": "Importar JSON",
"hubBuilder.create": "Novo Hub",
"hubBuilder.untitled": "Hub sem título",
"hubBuilder.drafts": "Rascunhos",
"hubBuilder.emptyDrafts": "Seus rascunhos salvos aparecerão aqui.",
"hubBuilder.count.one": "{count} habilidade",
"hubBuilder.count.other": "{count} habilidades",
"hubBuilder.startTitle": "Compartilhe habilidades sem escrever JSON",
"hubBuilder.start": "Crie um Hub, escolha habilidades instaladas e baixe o índice. Você também pode importar um índice existente.",
"hubBuilder.name": "Nome do Hub",
"hubBuilder.description": "Descrição",
"hubBuilder.metadataHint": "Nome e descrição organizam os rascunhos e não são exportados.",
"hubBuilder.fromInstalled": "Escolher habilidades instaladas",
"hubBuilder.manual": "Adicionar origem manualmente",
"hubBuilder.filter": "Buscar habilidades",
"hubBuilder.noEntries": "Adicione habilidades instaladas ou uma origem de repositório.",
"hubBuilder.newEntry": "Nova habilidade",
"hubBuilder.displayName": "Nome de exibição",
"hubBuilder.entryDescription": "Descrição da habilidade",
"hubBuilder.source": "Origem de instalação",
"hubBuilder.sourceHint": "Use um repositório remoto ou caminho como owner/repo/skills/review. Origens locais podem ser salvas, mas não exportadas.",
"hubBuilder.tags": "Tags (separadas por vírgulas)",
"hubBuilder.advanced": "Avançado",
"hubBuilder.selector": "Seletor de habilidade (opcional)",
"hubBuilder.selectorHint": "Preservado na importação. Use o nome original ou caminho relativo no repositório.",
"hubBuilder.unsaved": "Alterações não salvas. Salve para verificar as origens.",
"hubBuilder.blocked.one": "Ninguém mais consegue instalar {count} skill. Corrija a origem ou remova a entrada.",
"hubBuilder.blocked.other": "Ninguém mais consegue instalar {count} skills. Corrija cada origem ou remova a entrada.",
"hubBuilder.ready": "Salvo. Pronto para exportar.",
"hubBuilder.accessHint": "A sintaxe é verificada, não a disponibilidade. Destinatários precisam de acesso a repositórios privados.",
"hubBuilder.save": "Salvar rascunho",
"hubBuilder.saved": "Rascunho salvo.",
"hubBuilder.download": "Baixar índice",
"hubBuilder.reload": "Recarregar rascunho salvo",
"hubBuilder.delete": "Excluir rascunho",
"hubBuilder.shareTitle": "Compartilhar fora desta máquina",
"hubBuilder.shareHint": "Você já pode navegar neste hub localmente. Para que outras pessoas instalem a partir dele, baixe o skillshare-hub.json, hospede-o no Git ou em HTTP e registre aqui onde ele está.",
"hubBuilder.hostLocation": "Local do índice hospedado",
"hubBuilder.copyCommand": "Copiar comando de adição",
"hubBuilder.copied": "Comando copiado.",
"hubBuilder.noInstalled": "Nenhuma habilidade instalada. Você pode adicionar origens manualmente.",
"hubBuilder.addSelected": "Adicionar {count} selecionadas",
"hubBuilder.leaveTitle": "Descartar alterações não salvas?",
"hubBuilder.leaveHint": "As alterações desde o último salvamento serão perdidas.",
"hubBuilder.deleteHint": "Excluir este rascunho permanentemente? Habilidades instaladas e arquivos hospedados não serão afetados.",
"hubBuilder.conflict": "Este rascunho mudou em outra janela. Recarregue antes de editar. Suas alterações atuais não foram salvas.",
"hubBuilder.fileTooLarge": "Escolha um JSON menor que 4 MB.",
"hubBuilder.loading": "Carregando…",
"hubBuilder.remove": "Remover",
"hubBuilder.problem.local_source": "Esta origem é local. Informe um repositório remoto para exportar.",
"hubBuilder.problem.missing_source": "Informe uma origem de instalação.",
"hubBuilder.problem.invalid_source": "Origem não reconhecida. Verifique a sintaxe do repositório.",
@@ -1901,19 +1865,68 @@
"hubBuilder.problem.missing_name": "Informe um nome de exibição.",
"hubBuilder.problem.invalid_selector": "Use um seletor relativo ao repositório sem acessar diretórios superiores.",
"hubBuilder.problem.empty": "Adicione pelo menos uma habilidade.",
"hubBuilder.skills": "Skills",
"hubBuilder.noSource": "Sem origem ainda",
"hubBuilder.installable": "installable",
"hubBuilder.expandEntry": "Editar {name}",
"hubBuilder.collapseEntry": "Recolher {name}",
"hubBuilder.subscribe": "Adicionar aos meus Hubs",
"hubBuilder.subscribed": "Adicionado. Já está na aba Explorar.",
"hubBuilder.published": "Publicado",
"hubBuilder.previewInBrowse": "Pré-visualizar em Navegar",
"hubs.title": "Hubs",
"hubs.subtitle": "Instale skills de um catálogo compartilhado ou crie um para sua equipe.",
"hubs.tabs.browse": "Explorar",
"hubs.tabs.mine": "Meus Hubs",
"hubs.mine": "Meu",
"hubs.default": "Padrão",
"hubs.shared": "compartilhado",
"hubs.addOrCreate": "Adicionar ou criar um Hub",
"hubs.add.existing": "Adicionar um Hub existente",
"hubs.add.hint": "Cole a URL ou o caminho de um skillshare-hub.json. O nome vem da URL.",
"hubs.add.create": "Criar um novo Hub",
"hubs.add.createHint": "Comece vazio e depois cole URLs ou adicione skills instalados.",
"hubs.add.import": "Importar skillshare-hub.json",
"hubs.add.importHint": "Abra um índice que você já tem e continue editando.",
"hubs.view.mineNote": "Quem adicionar este Hub verá exatamente esta lista.",
"hubs.view.edit": "Editar",
"hubs.view.share": "Compartilhar",
"hubs.view.more": "Mais ações",
"hubs.view.version": "Versão",
"hubs.view.delete": "Excluir Hub",
"hubs.view.deleteHint": "Excluir este Hub permanentemente? Skills instalados e arquivos hospedados não são afetados.",
"hubs.ref.default": "Branch padrão",
"hubs.ref.loading": "Carregando versões…",
"hubs.ref.fixed": "Esta origem só pode usar o branch padrão.",
"hubs.conflict": "Este Hub mudou em outra janela, então suas alterações não foram salvas. Copie o que quiser manter e depois cancele ou feche para carregar a versão mais recente.",
"hubs.edit.title": "Editar {name}",
"hubs.edit.locked": "Editando. Salve ou cancele para trocar de Hub.",
"hubs.edit.addSkill": "Adicionar skill",
"hubs.edit.done": "Concluído",
"hubs.edit.name": "Nome",
"hubs.edit.description": "Descrição",
"hubs.edit.source": "Origem",
"hubs.edit.removeEntry": "Remover {name}",
"hubs.edit.moreFields": "Mais campos de {name}",
"hubs.edit.changes.one": "{count} alteração não salva",
"hubs.edit.changes.other": "{count} alterações não salvas",
"hubs.edit.blocked.one": "{count} skill que ninguém mais consegue instalar",
"hubs.edit.blocked.other": "{count} skills que ninguém mais consegue instalar",
"hubs.share.title": "Compartilhar {name}",
"hubs.share.ready.one": "{count} skill pode ser instalado. Siga os dois passos abaixo para sua equipe adicionar este Hub.",
"hubs.share.ready.other": "Os {count} skills podem ser instalados. Siga os dois passos abaixo para sua equipe adicionar este Hub.",
"hubs.share.step1": "Baixe o arquivo de índice",
"hubs.share.download": "Baixar skillshare-hub.json",
"hubs.share.fixFirst": "Primeiro escolha Editar e corrija os skills que ninguém mais consegue instalar.",
"hubs.share.step2": "Coloque onde sua equipe consiga acessar e cole a URL",
"hubs.share.step2Hint": "Um repositório Git ou HTTP funcionam. Para um repositório privado, as pessoas precisam de acesso de leitura.",
"hubs.share.step3": "Peça à sua equipe para executar este comando",
"hubs.share.step3Hint": "Ou, no dashboard, escolha Adicionar ou criar um Hub na página Hubs e cole a mesma URL.",
"hubs.share.needURL": "Cole a URL acima para ver o comando.",
"hubs.addSkill.title": "Adicionar skills a {name}",
"hubs.addSkill.how": "Como adicionar",
"hubs.addSkill.tab.url": "Colar URL",
"hubs.addSkill.tab.installed": "Instalados",
"hubs.addSkill.url": "URL do Git",
"hubs.addSkill.find": "Buscar",
"hubs.addSkill.urlHint": "Cole um repositório, uma subpasta ou uma URL do GitHub com tree/<versão>/. Não é preciso instalar antes.",
"hubs.addSkill.versionHint": "Lista os branches e tags deste repositório. Escolha Branch padrão para acompanhar a versão mais recente.",
"hubs.addSkill.found.one": "{count} skill encontrado",
"hubs.addSkill.found.other": "{count} skills encontrados",
"hubs.addSkill.selectAll": "Selecionar tudo",
"hubs.addSkill.inHub": "Já está neste Hub",
"hubs.addSkill.manual": "Não encontrou? Digite a origem manualmente",
"hubs.addSkill.add": "Adicionar {count}",
"hubs.browse.sources": "Hubs",
"hubs.browse.pickTitle": "Escolha um Hub",
"hubs.browse.pickHint": "Escolha um Hub à esquerda para ver as skills que ele oferece.",
@@ -1926,9 +1939,6 @@
"hubs.browse.removeHint": "Remover {name} dos seus Hubs? As skills já instaladas permanecem.",
"hubs.browse.tag": "Tag",
"hubs.browse.allTags": "Todas",
"hubs.browse.mine": "Meus hubs (local)",
"hubs.browse.localNote": "Um rascunho local: só você consegue vê-lo até o índice ser hospedado.",
"hubs.preview.label": "Pré-visualização",
"plugins.title": "Plugins",
"plugins.subtitle": "Mantenha plugins completos e escolha onde sincronizá-los.",
"plugins.add": "Adicionar plugin",
+59 -49
View File
@@ -981,15 +981,12 @@
"install.url.onlySkills": "找不到 agents。skillshare 只在来源最上层查找 agents/ 文件夹,所以这些是 skills,会出现在 Skills 页。要安装子文件夹里的 agents,请在地址加上路径:owner/repo/path/to/folder。",
"install.url.onlyAgents": "这个来源没有 skills。这些是 agents,会出现在 Agents 页。",
"install.hubs.title": "管理 Hub",
"install.hubs.add": "添加 Hub",
"install.hubs.addButton": "添加",
"install.hubs.urlPlaceholder": "URL 或文件路径",
"install.hubs.labelPlaceholder": "标签(可选)",
"install.hubs.remove": "删除 hub",
"install.hubs.urlRequired": "URL 不能为空",
"install.hubs.urlExists": "该 hub URL 已存在",
"install.hubs.subtitle": "搜索会在你选择的 hub 中进行。GitHub 搜索始终可用。",
"install.hubs.hint": "hub 是列出 skill 的 skillshare-hub.json 文件。可以填 URL 或本地文件。",
"install.toast.installed": "{label}:已安装",
"install.toast.exists": "{count} 个已安装:{names}。要覆盖请在 Advanced 中开启 Force overwrite。",
"install.done": "完成",
@@ -1845,55 +1842,22 @@
"auditRules.regex.suppressed.other": "排除 {count} 行",
"hubBuilder.title": "我的 Hub",
"hubBuilder.subtitle": "创建技能目录,分享给其他人。",
"hubBuilder.import": "导入 JSON",
"hubBuilder.create": "新建 Hub",
"hubBuilder.untitled": "未命名 Hub",
"hubBuilder.drafts": "草稿",
"hubBuilder.emptyDrafts": "已保存的草稿会显示在这里。",
"hubBuilder.count.one": "{count} 个技能",
"hubBuilder.count.other": "{count} 个技能",
"hubBuilder.startTitle": "不用写 JSON,也能分享技能",
"hubBuilder.start": "创建 Hub、选择已安装技能,再下载索引。也可以导入现有索引。",
"hubBuilder.name": "Hub 名称",
"hubBuilder.description": "说明",
"hubBuilder.metadataHint": "名称与说明用于整理草稿,不会包含在导出的索引中。",
"hubBuilder.fromInstalled": "选择已安装技能",
"hubBuilder.manual": "手动添加来源",
"hubBuilder.filter": "搜索技能",
"hubBuilder.noEntries": "先添加已安装技能,或输入仓库来源。",
"hubBuilder.newEntry": "新技能",
"hubBuilder.displayName": "显示名称",
"hubBuilder.entryDescription": "技能说明",
"hubBuilder.source": "安装来源",
"hubBuilder.sourceHint": "使用远程仓库或其中的路径,例如 owner/repo/skills/review。本地来源可保存,但不能导出。",
"hubBuilder.tags": "标签(逗号分隔)",
"hubBuilder.advanced": "高级",
"hubBuilder.selector": "技能选择器(可选)",
"hubBuilder.selectorHint": "导入时会保留。从多技能仓库选择时,填写原技能名称或相对于仓库的路径。",
"hubBuilder.unsaved": "有未保存的更改。请先保存并检查来源,再下载。",
"hubBuilder.blocked.one": "有 {count} 个 skills 别人装不了。请修正来源或移除该项目。",
"hubBuilder.blocked.other": "有 {count} 个 skills 别人装不了。请修正来源或移除该项目。",
"hubBuilder.ready": "已保存,可以导出。",
"hubBuilder.accessHint": "仅检查来源语法,尚未验证可访问性。用户需有私有仓库的访问权限。",
"hubBuilder.save": "保存草稿",
"hubBuilder.saved": "草稿已保存。",
"hubBuilder.download": "下载索引",
"hubBuilder.reload": "重新加载已保存草稿",
"hubBuilder.delete": "删除草稿",
"hubBuilder.shareTitle": "分享到这台机器以外",
"hubBuilder.shareHint": "你已经可以在本机浏览这个 hub。要让别人也能安装,请下载 skillshare-hub.json,放到 Git 或 HTTP 上,再把位置记在这里。",
"hubBuilder.hostLocation": "托管索引的位置",
"hubBuilder.copyCommand": "复制添加命令",
"hubBuilder.copied": "命令已复制。",
"hubBuilder.noInstalled": "没有已安装技能,可以手动添加来源。",
"hubBuilder.addSelected": "添加选中的 {count} 项",
"hubBuilder.leaveTitle": "放弃未保存的更改?",
"hubBuilder.leaveHint": "离开会放弃上次保存后的修改。",
"hubBuilder.deleteHint": "永久删除此草稿?不会影响已安装技能或托管文件。",
"hubBuilder.conflict": "此草稿已在其他窗口更改。请重新加载后再编辑;当前修改尚未保存。",
"hubBuilder.fileTooLarge": "请选择小于 4 MB 的 JSON 文件。",
"hubBuilder.loading": "加载中…",
"hubBuilder.remove": "移除",
"hubBuilder.problem.local_source": "这是本地来源。请填写远程仓库才能导出。",
"hubBuilder.problem.missing_source": "请填写安装来源。",
"hubBuilder.problem.invalid_source": "无法识别安装来源,请检查仓库语法。",
@@ -1901,19 +1865,68 @@
"hubBuilder.problem.missing_name": "请填写显示名称。",
"hubBuilder.problem.invalid_selector": "请使用相对于仓库的技能路径,不可包含父目录跳转。",
"hubBuilder.problem.empty": "请至少添加一个技能。",
"hubBuilder.skills": "Skills",
"hubBuilder.noSource": "尚未填来源",
"hubBuilder.installable": "installable",
"hubBuilder.expandEntry": "编辑 {name}",
"hubBuilder.collapseEntry": "收起 {name}",
"hubBuilder.subscribe": "加入我的 Hub",
"hubBuilder.subscribed": "已加入,可以在「浏览」分页看到。",
"hubBuilder.published": "已发布",
"hubBuilder.previewInBrowse": "在浏览中预览",
"hubs.title": "Hubs",
"hubs.subtitle": "从共享目录安装 skills,或为团队建立一个。",
"hubs.tabs.browse": "浏览",
"hubs.tabs.mine": "我的 Hub",
"hubs.mine": "我的",
"hubs.default": "默认",
"hubs.shared": "已分享",
"hubs.addOrCreate": "添加或创建 Hub",
"hubs.add.existing": "添加已有的 Hub",
"hubs.add.hint": "粘贴 skillshare-hub.json 的网址或路径,名称会取自网址。",
"hubs.add.create": "创建新的 Hub",
"hubs.add.createHint": "从空白开始,再粘贴网址或从已安装的 skills 添加。",
"hubs.add.import": "导入 skillshare-hub.json",
"hubs.add.importHint": "打开已有的索引文件,继续编辑。",
"hubs.view.mineNote": "别人添加这个 Hub 后,看到的就是这个列表。",
"hubs.view.edit": "编辑",
"hubs.view.share": "分享",
"hubs.view.more": "更多操作",
"hubs.view.version": "版本",
"hubs.view.delete": "删除 Hub",
"hubs.view.deleteHint": "要永久删除这个 Hub 吗?已安装的 skills 和放在别处的文件不受影响。",
"hubs.ref.default": "默认分支",
"hubs.ref.loading": "正在读取版本…",
"hubs.ref.fixed": "这个来源只能用默认分支。",
"hubs.conflict": "这个 Hub 在另一个窗口被改过,所以你的修改没有保存。先复制想保留的内容,再点取消或关闭,加载最新版本。",
"hubs.edit.title": "编辑 {name}",
"hubs.edit.locked": "编辑中,保存或取消后才能切换 Hub。",
"hubs.edit.addSkill": "添加 skill",
"hubs.edit.done": "完成",
"hubs.edit.name": "名称",
"hubs.edit.description": "说明",
"hubs.edit.source": "来源",
"hubs.edit.removeEntry": "移除 {name}",
"hubs.edit.moreFields": "{name} 的其他字段",
"hubs.edit.changes.one": "有 {count} 项修改还没保存",
"hubs.edit.changes.other": "有 {count} 项修改还没保存",
"hubs.edit.blocked.one": "{count} 个 skill 别人装不了",
"hubs.edit.blocked.other": "{count} 个 skill 别人装不了",
"hubs.share.title": "分享 {name}",
"hubs.share.ready.one": "{count} 个 skill 都能安装。按下面两步,让团队添加这个 Hub。",
"hubs.share.ready.other": "{count} 个 skill 都能安装。按下面两步,让团队添加这个 Hub。",
"hubs.share.step1": "下载索引文件",
"hubs.share.download": "下载 skillshare-hub.json",
"hubs.share.fixFirst": "先点“编辑”修好别人装不了的 skill。",
"hubs.share.step2": "放到团队拿得到的地方,粘贴网址",
"hubs.share.step2Hint": "Git repo 或 HTTP 都可以。私有 repo 需要对方有读取权限。",
"hubs.share.step3": "请团队执行这行命令",
"hubs.share.step3Hint": "或在 dashboard 的 Hubs 页点“添加或创建 Hub”,粘贴同一个网址。",
"hubs.share.needURL": "粘贴网址后,这里会出现命令。",
"hubs.addSkill.title": "添加 skill 到 {name}",
"hubs.addSkill.how": "添加方式",
"hubs.addSkill.tab.url": "粘贴网址",
"hubs.addSkill.tab.installed": "已安装的",
"hubs.addSkill.url": "Git 网址",
"hubs.addSkill.find": "查找",
"hubs.addSkill.urlHint": "可以粘贴 repo、子文件夹,或 GitHub 上带 tree/<版本>/ 的网址。不必先安装。",
"hubs.addSkill.versionHint": "列出这个 repo 的 branch 和 tag。选“默认分支”就跟随最新版本。",
"hubs.addSkill.found.one": "找到 {count} 个 skill",
"hubs.addSkill.found.other": "找到 {count} 个 skill",
"hubs.addSkill.selectAll": "全选",
"hubs.addSkill.inHub": "已在这个 Hub",
"hubs.addSkill.manual": "找不到?手动填写来源",
"hubs.addSkill.add": "添加 {count} 个",
"hubs.browse.sources": "Hubs",
"hubs.browse.pickTitle": "选一个 Hub",
"hubs.browse.pickHint": "在左侧选一个 Hub,看看里面有哪些 skills。",
@@ -1926,9 +1939,6 @@
"hubs.browse.removeHint": "从你的 Hub 中移除 {name}?已安装的 skills 会保留。",
"hubs.browse.tag": "标签",
"hubs.browse.allTags": "全部",
"hubs.browse.mine": "我的 Hub(本机)",
"hubs.browse.localNote": "本机草稿 —— 在索引上线前只有你能看到。",
"hubs.preview.label": "预览",
"plugins.title": "Plugins",
"plugins.subtitle": "保留完整包,选择要同步到的工具。",
"plugins.add": "添加 plugin",
+59 -49
View File
@@ -981,15 +981,12 @@
"install.url.onlySkills": "找不到 agents。skillshare 只在來源最上層找 agents/ 資料夾,所以這些是 skills,會出現在 Skills 頁。要安裝子資料夾裡的 agents,請在網址加上路徑:owner/repo/path/to/folder。",
"install.url.onlyAgents": "這個來源沒有 skills。這些是 agents,會出現在 Agents 頁。",
"install.hubs.title": "管理 Hubs",
"install.hubs.add": "新增 Hub",
"install.hubs.addButton": "新增",
"install.hubs.urlPlaceholder": "URL 或檔案路徑",
"install.hubs.labelPlaceholder": "標籤(選填)",
"install.hubs.remove": "移除 hub",
"install.hubs.urlRequired": "URL 為必填",
"install.hubs.urlExists": "此 hub URL 已存在",
"install.hubs.subtitle": "搜尋會在你選的 hub 裡進行。GitHub 搜尋一直都能用。",
"install.hubs.hint": "hub 是列出 skills 的 skillshare-hub.json 檔案。可以填 URL 或本地檔案。",
"install.toast.installed": "{label}:已安裝",
"install.toast.exists": "{count} 個已安裝:{names}。要覆蓋請在 Advanced 開啟 Force overwrite。",
"install.done": "完成",
@@ -1845,55 +1842,22 @@
"auditRules.regex.suppressed.other": "排除 {count} 行",
"hubBuilder.title": "我的 Hub",
"hubBuilder.subtitle": "建立技能目錄,分享給其他人。",
"hubBuilder.import": "匯入 JSON",
"hubBuilder.create": "新增 Hub",
"hubBuilder.untitled": "未命名 Hub",
"hubBuilder.drafts": "草稿",
"hubBuilder.emptyDrafts": "已保存的草稿會顯示在這裡。",
"hubBuilder.count.one": "{count} 個技能",
"hubBuilder.count.other": "{count} 個技能",
"hubBuilder.startTitle": "不用寫 JSON,也能分享技能",
"hubBuilder.start": "建立 Hub、選擇已安裝技能,再下載索引。也可以匯入現有索引。",
"hubBuilder.name": "Hub 名稱",
"hubBuilder.description": "說明",
"hubBuilder.metadataHint": "名稱與說明用於整理草稿,不會包含在匯出的索引中。",
"hubBuilder.fromInstalled": "選擇已安裝技能",
"hubBuilder.manual": "手動新增來源",
"hubBuilder.filter": "搜尋技能",
"hubBuilder.noEntries": "先加入已安裝技能,或輸入儲存庫來源。",
"hubBuilder.newEntry": "新技能",
"hubBuilder.displayName": "顯示名稱",
"hubBuilder.entryDescription": "技能說明",
"hubBuilder.source": "安裝來源",
"hubBuilder.sourceHint": "使用遠端儲存庫或其中的路徑,例如 owner/repo/skills/review。本機來源可保存,但不能匯出。",
"hubBuilder.tags": "標籤(以逗號分隔)",
"hubBuilder.advanced": "進階",
"hubBuilder.selector": "技能選擇器(選填)",
"hubBuilder.selectorHint": "匯入時會保留。從多技能儲存庫選取時,填入原技能名稱或相對於儲存庫的路徑。",
"hubBuilder.unsaved": "有未保存的變更。請先保存並檢查來源,再下載。",
"hubBuilder.blocked.one": "有 {count} 個 skills 別人裝不了。請修正來源或移除該項目。",
"hubBuilder.blocked.other": "有 {count} 個 skills 別人裝不了。請修正來源或移除該項目。",
"hubBuilder.ready": "已保存,可以匯出。",
"hubBuilder.accessHint": "僅檢查來源語法,尚未驗證能否存取。使用者需有私人儲存庫的存取權。",
"hubBuilder.save": "保存草稿",
"hubBuilder.saved": "草稿已保存。",
"hubBuilder.download": "下載索引",
"hubBuilder.reload": "重新載入已保存草稿",
"hubBuilder.delete": "刪除草稿",
"hubBuilder.shareTitle": "分享到這台機器以外",
"hubBuilder.shareHint": "你已經可以在本機瀏覽這個 hub。要讓別人也能安裝,請下載 skillshare-hub.json,放到 Git 或 HTTP 上,再把位置記在這裡。",
"hubBuilder.hostLocation": "已放置索引的位置",
"hubBuilder.copyCommand": "複製加入指令",
"hubBuilder.copied": "指令已複製。",
"hubBuilder.noInstalled": "沒有已安裝技能,可以手動新增來源。",
"hubBuilder.addSelected": "加入選取的 {count} 項",
"hubBuilder.leaveTitle": "捨棄未保存的變更?",
"hubBuilder.leaveHint": "離開會捨棄上次保存後的修改。",
"hubBuilder.deleteHint": "永久刪除此草稿?不會影響已安裝技能或已放置的檔案。",
"hubBuilder.conflict": "此草稿已在其他視窗變更。請重新載入後再編輯;目前修改尚未保存。",
"hubBuilder.fileTooLarge": "請選擇小於 4 MB 的 JSON 檔案。",
"hubBuilder.loading": "載入中…",
"hubBuilder.remove": "移除",
"hubBuilder.problem.local_source": "這是本機來源。請填入遠端儲存庫才能匯出。",
"hubBuilder.problem.missing_source": "請填入安裝來源。",
"hubBuilder.problem.invalid_source": "無法辨識安裝來源,請檢查儲存庫語法。",
@@ -1901,19 +1865,68 @@
"hubBuilder.problem.missing_name": "請填入顯示名稱。",
"hubBuilder.problem.invalid_selector": "請使用相對於儲存庫的技能路徑,不可包含父目錄跳轉。",
"hubBuilder.problem.empty": "請至少加入一個技能。",
"hubBuilder.skills": "Skills",
"hubBuilder.noSource": "尚未填來源",
"hubBuilder.installable": "installable",
"hubBuilder.expandEntry": "編輯 {name}",
"hubBuilder.collapseEntry": "收合 {name}",
"hubBuilder.subscribe": "加入我的 Hub",
"hubBuilder.subscribed": "已加入,可以在「瀏覽」分頁看到。",
"hubBuilder.published": "已發布",
"hubBuilder.previewInBrowse": "在瀏覽中預覽",
"hubs.title": "Hubs",
"hubs.subtitle": "從共用目錄安裝 skills,或為團隊建立一個。",
"hubs.tabs.browse": "瀏覽",
"hubs.tabs.mine": "我的 Hub",
"hubs.mine": "我的",
"hubs.default": "預設",
"hubs.shared": "已分享",
"hubs.addOrCreate": "加入或建立 Hub",
"hubs.add.existing": "加入現有的 Hub",
"hubs.add.hint": "貼上 skillshare-hub.json 的網址或路徑,名稱會取自網址。",
"hubs.add.create": "建立新的 Hub",
"hubs.add.createHint": "空白開始,再貼網址或從已安裝的 skills 加入。",
"hubs.add.import": "匯入 skillshare-hub.json",
"hubs.add.importHint": "打開已經有的索引檔,繼續編輯。",
"hubs.view.mineNote": "別人加入這個 Hub 後,看到的就是這個清單。",
"hubs.view.edit": "編輯",
"hubs.view.share": "分享",
"hubs.view.more": "更多動作",
"hubs.view.version": "版本",
"hubs.view.delete": "刪除 Hub",
"hubs.view.deleteHint": "要永久刪除這個 Hub 嗎?已安裝的 skills 和放在別處的檔案不受影響。",
"hubs.ref.default": "預設分支",
"hubs.ref.loading": "正在讀取版本…",
"hubs.ref.fixed": "這個來源只能用預設分支。",
"hubs.conflict": "這個 Hub 在另一個視窗被改過,所以你的修改沒有儲存。先複製想保留的內容,再按取消或關閉,載入最新版本。",
"hubs.edit.title": "編輯 {name}",
"hubs.edit.locked": "編輯中,儲存或取消後才能切換 Hub。",
"hubs.edit.addSkill": "加入 skill",
"hubs.edit.done": "完成",
"hubs.edit.name": "名稱",
"hubs.edit.description": "說明",
"hubs.edit.source": "來源",
"hubs.edit.removeEntry": "移除 {name}",
"hubs.edit.moreFields": "{name} 的其他欄位",
"hubs.edit.changes.one": "有 {count} 項修改還沒儲存",
"hubs.edit.changes.other": "有 {count} 項修改還沒儲存",
"hubs.edit.blocked.one": "{count} 個 skill 別人裝不到",
"hubs.edit.blocked.other": "{count} 個 skill 別人裝不到",
"hubs.share.title": "分享 {name}",
"hubs.share.ready.one": "{count} 個 skill 都能安裝。照下面兩步,讓團隊加入這個 Hub。",
"hubs.share.ready.other": "{count} 個 skill 都能安裝。照下面兩步,讓團隊加入這個 Hub。",
"hubs.share.step1": "下載索引檔",
"hubs.share.download": "下載 skillshare-hub.json",
"hubs.share.fixFirst": "先按「編輯」修好別人裝不到的 skill。",
"hubs.share.step2": "放到團隊拿得到的地方,貼上網址",
"hubs.share.step2Hint": "Git repo 或 HTTP 都可以。私人 repo 要對方有讀取權限。",
"hubs.share.step3": "請團隊執行這行指令",
"hubs.share.step3Hint": "或在 dashboard 的 Hubs 頁按「加入或建立 Hub」,貼上同一個網址。",
"hubs.share.needURL": "貼上網址後,這裡會出現指令。",
"hubs.addSkill.title": "加入 skill 到 {name}",
"hubs.addSkill.how": "加入方式",
"hubs.addSkill.tab.url": "貼上網址",
"hubs.addSkill.tab.installed": "已安裝的",
"hubs.addSkill.url": "Git 網址",
"hubs.addSkill.find": "尋找",
"hubs.addSkill.urlHint": "可以貼 repo、子資料夾,或 GitHub 上帶 tree/<版本>/ 的網址。不必先安裝。",
"hubs.addSkill.versionHint": "列出這個 repo 的 branch 和 tag。選「預設分支」就跟著最新版走。",
"hubs.addSkill.found.one": "找到 {count} 個 skill",
"hubs.addSkill.found.other": "找到 {count} 個 skill",
"hubs.addSkill.selectAll": "全選",
"hubs.addSkill.inHub": "已在這個 Hub",
"hubs.addSkill.manual": "找不到?手動填寫來源",
"hubs.addSkill.add": "加入 {count} 個",
"hubs.browse.sources": "Hubs",
"hubs.browse.pickTitle": "選一個 Hub",
"hubs.browse.pickHint": "在左邊選一個 Hub,看看裡面有哪些 skills。",
@@ -1926,9 +1939,6 @@
"hubs.browse.removeHint": "從你的 Hub 中移除 {name}?已安裝的 skills 會保留。",
"hubs.browse.tag": "標籤",
"hubs.browse.allTags": "全部",
"hubs.browse.mine": "我的 Hub(本機)",
"hubs.browse.localNote": "本機草稿 —— 在索引上架前只有你看得到。",
"hubs.preview.label": "預覽",
"plugins.title": "Plugins",
"plugins.subtitle": "保留完整套件,選擇要同步到的工具。",
"plugins.add": "新增 plugin",
+8
View File
@@ -66,6 +66,14 @@ export const queryKeys = {
// Under `plugins`, so invalidating that key refreshes both.
pluginPackages: ['plugins', 'packages'] as const,
hubConfig: ['hub-config'] as const,
// Everything under `hub`, so invalidating `hub.drafts` also refreshes each draft.
hub: {
drafts: ['hub', 'drafts'] as const,
draft: (id: string) => ['hub', 'drafts', id] as const,
contents: (url: string) => ['hub', 'contents', url] as const,
refs: (source: string) => ['hub', 'refs', source] as const,
candidates: ['hub', 'candidates'] as const,
},
preview: (source: string) => ['preview', source] as const,
extrasDiff: (name?: string) => ['extras-diff', name ?? '__all'] as const,
analyze: ['analyze'] as const,
+153 -46
View File
@@ -1,69 +1,176 @@
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
import { render, screen, waitFor } from '@testing-library/react';
import { render, screen, waitFor, within } from '@testing-library/react';
import userEvent from '@testing-library/user-event';
import { createMemoryRouter, RouterProvider } from 'react-router-dom';
import { beforeEach, expect, it, vi } from 'vitest';
import { I18nProvider } from '../i18n';
import { hubDrafts, type HubDraft } from '../api/hubDrafts';
import { api } from '../api/client';
import { hubDrafts, hubRefs } from '../api/hubDrafts';
import type { HubDraft } from '../api/hubDrafts';
import HubPage from './HubPage';
vi.mock('../api/hubDrafts', async (original) => ({
...await original<typeof import('../api/hubDrafts')>(),
hubDrafts: { list: vi.fn(), get: vi.fn(), candidates: vi.fn(), create: vi.fn(), save: vi.fn(), remove: vi.fn(), import: vi.fn(), export: vi.fn() },
hubRefs: vi.fn(),
}));
const draft: HubDraft = { id: 'a', revision: 'r1', name: 'Team', description: '', updatedAt: '', fields: {}, entries: [{ id: 'entry', data: { name: 'Review', source: '/local/review', future: 42 } }] };
vi.mock('../api/client', async (original) => {
const mod = await original<typeof import('../api/client')>();
return { ...mod, api: { ...mod.api, getHubConfig: vi.fn(), putHubConfig: vi.fn(), listSkills: vi.fn(), searchHub: vi.fn(), discover: vi.fn() } };
});
const draft: HubDraft = {
id: 'a', revision: 'r1', name: 'Team', description: '', updatedAt: '',
fields: { publishUrl: 'https://host/team/skillshare-hub.json' },
entries: [{ id: 'entry', data: { name: 'Review', source: '/local/review', future: 42 } }],
};
function renderPage() {
// The builder lives behind the "My hubs" tab; Browse hits network queries this suite does not mock.
const router = createMemoryRouter([{ path: '*', element: <I18nProvider><HubPage /></I18nProvider> }], { initialEntries: ['/?tab=mine'] });
return render(<QueryClientProvider client={new QueryClient({ defaultOptions: { mutations: { retry: false } } })}><RouterProvider router={router} /></QueryClientProvider>);
const router = createMemoryRouter([{ path: '*', element: <I18nProvider><HubPage /></I18nProvider> }], { initialEntries: ['/hubs'] });
return render(<QueryClientProvider client={new QueryClient({ defaultOptions: { queries: { retry: false }, mutations: { retry: false } } })}><RouterProvider router={router} /></QueryClientProvider>);
}
beforeEach(() => {
vi.clearAllMocks();
vi.mocked(hubDrafts.list).mockResolvedValue([draft]);
vi.mocked(hubDrafts.get).mockResolvedValue({ draft, problems: [{ entryId: 'entry', code: 'local_source' }] });
vi.mocked(hubDrafts.candidates).mockResolvedValue([]);
vi.clearAllMocks();
// jsdom has no scrollIntoView, which the dropdown calls on its focused option.
HTMLElement.prototype.scrollIntoView = vi.fn();
vi.mocked(hubDrafts.list).mockResolvedValue([draft]);
vi.mocked(hubDrafts.get).mockResolvedValue({ draft, problems: [{ entryId: 'entry', code: 'local_source' }], refs: { entry: 'v1.2.0' } });
vi.mocked(api.getHubConfig).mockResolvedValue({ hubs: [{ label: 'team-copy', url: 'https://host/team/skillshare-hub.json/' }], default: '' });
vi.mocked(api.listSkills).mockResolvedValue({ resources: [] } as unknown as Awaited<ReturnType<typeof api.listSkills>>);
vi.mocked(api.searchHub).mockResolvedValue({ results: [] });
});
it('resumes a draft and requires saving changed sources before export', async () => {
const user = userEvent.setup(); renderPage();
await user.click(await screen.findByRole('button', { name: /Team/ }));
await user.click(await screen.findByRole('button', { name: 'Edit Review' }));
expect(await screen.findByDisplayValue('/local/review')).toBeInTheDocument();
expect(screen.getByRole('button', { name: 'Download index' })).toBeDisabled();
const source = screen.getByLabelText('Install source');
await user.clear(source); await user.type(source, 'acme/review');
vi.mocked(hubDrafts.save).mockImplementation(async d => ({ draft: { ...d, revision: 'r2' }, problems: [] }));
await user.click(screen.getByRole('button', { name: 'Save draft' }));
await waitFor(() => expect(screen.getByRole('button', { name: 'Download index' })).toBeEnabled());
expect(vi.mocked(hubDrafts.save).mock.calls[0][0].entries[0].data.future).toBe(42);
it('opens on the own hub and shows it as a recipient sees it', async () => {
renderPage();
expect(await screen.findByText('Once someone adds this Hub, this is the list they see.')).toBeInTheDocument();
expect(await screen.findByText('v1.2.0')).toBeInTheDocument();
expect(screen.getByRole('button', { name: 'Edit' })).toBeInTheDocument();
});
it('confirms deletion and keeps local-only entries visible', async () => {
const user = userEvent.setup(); renderPage();
await user.click(await screen.findByRole('button', { name: /Team/ }));
expect(await screen.findByText('This source is local. Enter a remote repository before exporting.')).toBeInTheDocument();
await user.click(screen.getByRole('button', { name: 'Delete draft' }));
expect(hubDrafts.remove).not.toHaveBeenCalled();
expect(screen.getByRole('dialog')).toBeInTheDocument();
it('lists a subscription to the own published hub only once', async () => {
renderPage();
await screen.findByRole('button', { name: /Team/ });
await waitFor(() => expect(api.getHubConfig).toHaveBeenCalled());
expect(screen.queryByRole('button', { name: /team-copy/ })).not.toBeInTheDocument();
});
it('saves in-place edits, keeps unknown fields and refreshes the hub list', async () => {
const user = userEvent.setup(); renderPage();
await user.click(await screen.findByRole('button', { name: 'Edit' }));
expect(screen.getByText('This source is local. Enter a remote repository before exporting.')).toBeInTheDocument();
const source = screen.getByLabelText('Source');
await user.clear(source); await user.type(source, 'acme/review');
vi.mocked(hubDrafts.save).mockImplementation(async d => ({ draft: { ...d, revision: 'r2' }, problems: [] }));
await user.click(screen.getByRole('button', { name: 'Save' }));
expect(await screen.findByRole('button', { name: 'Edit' })).toBeInTheDocument();
expect(vi.mocked(hubDrafts.save).mock.calls[0][0].entries[0].data.future).toBe(42);
expect(hubDrafts.list).toHaveBeenCalledTimes(2);
});
it('confirms deletion', async () => {
const user = userEvent.setup(); renderPage();
await user.click(await screen.findByRole('button', { name: 'More actions' }));
await user.click(screen.getByRole('menuitem', { name: 'Delete Hub' }));
expect(hubDrafts.remove).not.toHaveBeenCalled();
expect(screen.getByRole('dialog')).toHaveTextContent('Delete this Hub permanently?');
});
it('keeps unsaved edits after a revision conflict', async () => {
const { ApiError } = await import('../api/client');
vi.mocked(hubDrafts.save).mockRejectedValue(new ApiError(409, 'stale'));
const user = userEvent.setup(); renderPage();
await user.click(await screen.findByRole('button', { name: /Team/ }));
const name = await screen.findByLabelText('Hub name');
await user.clear(name); await user.type(name, 'My edit');
await user.click(screen.getByRole('button', { name: 'Save draft' }));
expect(await screen.findByRole('alert')).toHaveTextContent('another window');
expect(screen.getByDisplayValue('My edit')).toBeInTheDocument();
expect(screen.getByRole('button', { name: 'Download index' })).toBeDisabled();
const { ApiError } = await import('../api/client');
vi.mocked(hubDrafts.save).mockRejectedValue(new ApiError(409, 'stale'));
const user = userEvent.setup(); renderPage();
await user.click(await screen.findByRole('button', { name: 'Edit' }));
const name = screen.getByLabelText('Name', { selector: '#hub-name' });
await user.clear(name); await user.type(name, 'My edit');
await user.click(screen.getByRole('button', { name: 'Save' }));
expect(await screen.findByRole('alert')).toHaveTextContent('another window');
expect(screen.getByDisplayValue('My edit')).toBeInTheDocument();
});
it('warns before navigating away from edits', async () => {
const user = userEvent.setup(); renderPage();
await user.click(await screen.findByRole('button', { name: /Team/ }));
await user.type(await screen.findByLabelText('Hub name'), ' edits');
await user.click(screen.getByRole('link', { name: 'Back' }));
expect(await screen.findByRole('dialog')).toHaveTextContent('Discard unsaved changes?');
await user.click(screen.getByRole('button', { name: 'Cancel' }));
expect(screen.getByDisplayValue('Team edits')).toBeInTheDocument();
const user = userEvent.setup(); renderPage();
await user.click(await screen.findByRole('button', { name: 'Edit' }));
await user.type(screen.getByLabelText('Name', { selector: '#hub-name' }), ' edits');
await user.click(screen.getByRole('link', { name: 'Back' }));
const dialog = await screen.findByRole('dialog');
expect(dialog).toHaveTextContent('Discard unsaved changes?');
await user.click(within(dialog).getByRole('button', { name: 'Cancel' }));
expect(screen.getByDisplayValue('Team edits')).toBeInTheDocument();
});
it('adds skills found at a URL, pinned to the chosen version', async () => {
vi.mocked(hubDrafts.get).mockResolvedValue({
draft: { ...draft, entries: [{ id: 'lint', data: { name: 'lint', source: 'github.com/acme/skills/tree/v1.0.0/skills/lint' } }] },
problems: [],
});
const refs = { pinnable: true, current: '', defaultBranch: 'main', branches: ['main'], tags: ['v1.0.0'] };
vi.mocked(hubRefs).mockImplementation(async (_source, ref) =>
(ref === undefined ? refs : { ...refs, source: ref ? `github.com/acme/skills/tree/${ref}` : 'github.com/acme/skills' }));
const skills = [{ name: 'review', path: 'skills/review', description: 'Reviews diffs' }, { name: 'lint', path: 'skills/lint' }];
vi.mocked(api.discover).mockResolvedValue({ needsSelection: true, skills, agents: [] });
const user = userEvent.setup(); renderPage();
await user.click(await screen.findByRole('button', { name: 'Edit' }));
await user.click(screen.getByRole('button', { name: 'Add skill' }));
const dialog = screen.getByRole('dialog');
await user.type(within(dialog).getByLabelText('Git URL'), 'github.com/acme/skills');
await user.click(within(dialog).getByRole('button', { name: 'Find' }));
await user.click(await within(dialog).findByRole('combobox', { name: 'Version' }));
await user.click(screen.getByRole('option', { name: 'v1.0.0' }));
await waitFor(() => expect(api.discover).toHaveBeenLastCalledWith('github.com/acme/skills/tree/v1.0.0', 'v1.0.0'));
expect(within(dialog).getByText('Already in this Hub')).toBeInTheDocument();
await user.click(within(dialog).getByRole('button', { name: 'Add 1' }));
expect(screen.getByDisplayValue('github.com/acme/skills/tree/v1.0.0/skills/review')).toBeInTheDocument();
});
it('keeps a GitLab repo root apart from the skill paths added under it', async () => {
const refs = { pinnable: true, current: '', defaultBranch: 'main', branches: ['main'], tags: [] };
vi.mocked(hubRefs).mockImplementation(async (_source, ref) => (ref === undefined ? refs : { ...refs, source: 'https://gitlab.com/g/r.git' }));
vi.mocked(api.discover).mockResolvedValue({ needsSelection: true, skills: [{ name: 'lint', path: 'skills/lint' }], agents: [] });
const user = userEvent.setup(); renderPage();
await user.click(await screen.findByRole('button', { name: 'Edit' }));
await user.click(screen.getByRole('button', { name: 'Add skill' }));
const dialog = screen.getByRole('dialog');
await user.type(within(dialog).getByLabelText('Git URL'), 'https://gitlab.com/g/r');
await user.click(within(dialog).getByRole('button', { name: 'Find' }));
await user.click(await within(dialog).findByRole('button', { name: 'Add 1' }));
expect(screen.getByDisplayValue('https://gitlab.com/g/r.git/skills/lint')).toBeInTheDocument();
});
it('shows the saved version again once a source is edited back', async () => {
vi.mocked(hubDrafts.get).mockResolvedValue({
draft: { ...draft, entries: [{ id: 'entry', data: { name: 'Review', source: 'github.com/acme/skills/tree/v1.2.0/review' } }] },
problems: [], refs: { entry: 'v1.2.0' },
});
const user = userEvent.setup(); renderPage();
await user.click(await screen.findByRole('button', { name: 'Edit' }));
const source = screen.getByLabelText('Source');
await user.type(source, 'x{Backspace}');
expect(screen.getByRole('combobox', { name: 'Version' })).toHaveTextContent('v1.2.0');
});
it('opens a newly created hub, not another one, while the list refetches', async () => {
const created: HubDraft = { ...draft, id: 'b', name: 'Fresh', entries: [], fields: {} };
vi.mocked(hubDrafts.create).mockResolvedValue({ draft: created, problems: [] });
vi.mocked(hubDrafts.get).mockImplementation(async (id) => ({ draft: id === 'b' ? created : draft, problems: [] }));
const user = userEvent.setup(); renderPage();
await screen.findByRole('button', { name: 'Edit' });
vi.mocked(hubDrafts.list).mockReturnValue(new Promise(() => {}));
await user.click(screen.getByRole('button', { name: 'Add or create a Hub' }));
await user.click(screen.getByRole('menuitem', { name: /Create a new Hub/ }));
expect(await screen.findByDisplayValue('Fresh')).toBeInTheDocument();
expect(screen.queryByDisplayValue('Team')).not.toBeInTheDocument();
});
it('gives an added hub a label no other hub has', async () => {
vi.mocked(api.getHubConfig).mockResolvedValue({ hubs: [{ label: 'skillshare-hub.json', url: 'https://a.example/skillshare-hub.json' }], default: '' });
const user = userEvent.setup(); renderPage();
await screen.findByRole('button', { name: 'Edit' });
await user.click(screen.getByRole('button', { name: 'Add or create a Hub' }));
await user.type(screen.getByLabelText('Add an existing Hub'), 'https://b.example/skillshare-hub.json');
await user.click(screen.getByRole('button', { name: 'Add' }));
await waitFor(() => expect(api.putHubConfig).toHaveBeenCalled());
expect(vi.mocked(api.putHubConfig).mock.calls[0][0].hubs[1].label).toBe('skillshare-hub.json (2)');
});
+182 -23
View File
@@ -1,38 +1,197 @@
import { useSearchParams } from 'react-router-dom';
import HubBrowser from '../components/hub/HubBrowser';
import HubBuilder from '../components/hub/HubBuilder';
import { useMemo, useState } from 'react';
import { useQuery, useQueryClient } from '@tanstack/react-query';
import { Library, Pencil, Share, Star, Trash2 } from 'lucide-react';
import { api } from '../api/client';
import type { HubSavedEntry } from '../api/client';
import { hubDrafts } from '../api/hubDrafts';
import type { DraftResponse, HubDraft } from '../api/hubDrafts';
import Button from '../components/Button';
import ConfirmDialog from '../components/ConfirmDialog';
import EmptyState from '../components/EmptyState';
import PageHeader from '../components/PageHeader';
import HubEditor from '../components/hub/HubEditor';
import HubList from '../components/hub/HubList';
import type { HubListItem } from '../components/hub/HubList';
import HubView from '../components/hub/HubView';
import MoreMenu from '../components/hub/MoreMenu';
import ShareDialog from '../components/hub/ShareDialog';
import { COMMUNITY, DRAFT, sameURL } from '../components/hub/hubShared';
import { queryKeys, staleTimes } from '../lib/queryKeys';
import { useT } from '../i18n';
/**
* Both halves of hubs in one place: the ones you subscribe to and the ones you build.
* Publishing a draft ends in the Browse tab, so you can see what a recipient sees.
* Every hub in one list. The user's own hubs show exactly what a recipient sees,
* and are edited and shared from the same place.
*/
export default function HubPage() {
const t = useT();
const [params, setParams] = useSearchParams();
const tab = params.get('tab') === 'mine' ? 'mine' : 'browse';
const preview = params.get('preview');
const queryClient = useQueryClient();
const [picked, setPicked] = useState<string | null>(null);
const [editing, setEditing] = useState(false);
const [sharing, setSharing] = useState(false);
const [removing, setRemoving] = useState<HubSavedEntry | null>(null);
const [deleting, setDeleting] = useState(false);
const [error, setError] = useState('');
const go = (next: 'browse' | 'mine') =>
setParams((p) => {
if (next === 'mine') p.set('tab', 'mine');
else p.delete('tab');
return p;
}, { replace: true });
const { data: config } = useQuery({
queryKey: queryKeys.hubConfig,
queryFn: () => api.getHubConfig(),
staleTime: staleTimes.config,
});
const { data: drafts = [] } = useQuery({ queryKey: queryKeys.hub.drafts, queryFn: () => hubDrafts.list() });
// A subscription to one of the user's own published hubs is the same hub; show it once.
const saved = useMemo(() => {
const own = drafts.map((d) => String(d.fields?.publishUrl ?? '')).filter(Boolean);
const rest = (config?.hubs ?? []).filter((h) => !sameURL(h.url, COMMUNITY.url) && !own.some((u) => sameURL(u, h.url)));
return [COMMUNITY, ...rest];
}, [config, drafts]);
const isDefault = (hub: HubSavedEntry) =>
Boolean(config?.default) && hub.label.toLowerCase() === config!.default.toLowerCase();
const items: HubListItem[] = [
...saved.map((h) => ({ key: h.url, label: h.label, sub: h.url, mine: false, isDefault: isDefault(h) })),
...drafts.map((d) => ({
key: DRAFT + d.id,
label: d.name || t('hubBuilder.untitled'),
sub: t(d.entries.length === 1 ? 'hubBuilder.count.one' : 'hubBuilder.count.other', { count: d.entries.length })
+ (String(d.fields?.publishUrl ?? '').trim() ? ` · ${t('hubs.shared')}` : ''),
mine: true,
isDefault: false,
})),
];
// Open on the user's own hub when there is one; that is the one they came to work on.
const selected = picked && items.some((i) => i.key === picked) ? picked : drafts[0] ? DRAFT + drafts[0].id : picked;
const draftId = selected?.startsWith(DRAFT) ? selected.slice(DRAFT.length) : undefined;
const hub = draftId ? undefined : saved.find((h) => h.url === selected);
const current = items.find((i) => i.key === selected);
const draft = useQuery({
queryKey: queryKeys.hub.draft(draftId ?? ''),
queryFn: () => hubDrafts.get(draftId!),
enabled: Boolean(draftId),
});
const pick = (key: string) => { setPicked(key); setEditing(false); setError(''); };
const saveConfig = async (next: HubSavedEntry[], defaultLabel: string) => {
const body = { hubs: next.filter((h) => !h.builtIn).map(({ label, url }) => ({ label, url })), default: defaultLabel };
await api.putHubConfig(body);
queryClient.setQueryData(queryKeys.hubConfig, body);
};
const addHub = async (raw: string) => {
const url = raw.trim();
if (!url) throw new Error(t('install.hubs.urlRequired'));
if ((config?.hubs ?? []).some((h) => sameURL(h.url, url)) || sameURL(url, COMMUNITY.url)) throw new Error(t('install.hubs.urlExists'));
// The default hub is kept by label, so two hubs must never share one.
const base = url.split('/').filter(Boolean).pop() || url;
const taken = new Set([COMMUNITY, ...(config?.hubs ?? [])].map((h) => h.label.toLowerCase()));
let label = base;
for (let n = 2; taken.has(label.toLowerCase()); n++) label = `${base} (${n})`;
await saveConfig([...(config?.hubs ?? []), { label, url }], config?.default ?? '');
pick(url);
};
const opened = (res: DraftResponse, edit: boolean) => {
queryClient.setQueryData(queryKeys.hub.draft(res.draft.id), res);
// In the list before it is picked, or the page falls back to another draft until the refetch.
queryClient.setQueryData<HubDraft[]>(queryKeys.hub.drafts, (list = []) => [res.draft, ...list.filter((d) => d.id !== res.draft.id)]);
void queryClient.invalidateQueries({ queryKey: queryKeys.hub.drafts, exact: true });
pick(DRAFT + res.draft.id);
setEditing(edit);
};
const run = async (action: () => Promise<void>) => {
setError('');
try { await action(); } catch (e) { setError((e as Error).message); }
};
const create = () => run(async () => {
opened(await hubDrafts.create({ name: t('hubBuilder.untitled'), description: '', entries: [], fields: {} }), true);
});
const importFile = (file: File) => run(async () => {
if (file.size > 4 * 1024 * 1024) throw new Error(t('hubBuilder.fileTooLarge'));
opened(await hubDrafts.import(await file.text()), false);
});
const deleteDraft = () => run(async () => {
setDeleting(false);
if (!draft.data) return;
await hubDrafts.remove(draft.data.draft);
queryClient.removeQueries({ queryKey: queryKeys.hub.draft(draft.data.draft.id) });
await queryClient.invalidateQueries({ queryKey: queryKeys.hub.drafts, exact: true });
setPicked(null);
});
const removeHub = (target: HubSavedEntry) => run(async () => {
await saveConfig((config?.hubs ?? []).filter((h) => h.url !== target.url), isDefault(target) ? '' : config?.default ?? '');
setPicked(null);
});
let actions = null;
if (draftId) {
actions = (
<>
<Button variant="secondary" disabled={!draft.data} onClick={() => setEditing(true)}><Pencil size={14} />{t('hubs.view.edit')}</Button>
<Button disabled={!draft.data} onClick={() => setSharing(true)}><Share size={14} />{t('hubs.view.share')}</Button>
<MoreMenu label={t('hubs.view.more')} items={[{ label: t('hubs.view.delete'), icon: Trash2, danger: true, onClick: () => setDeleting(true) }]} />
</>
);
} else if (hub && !hub.builtIn) {
actions = (
<>
{!isDefault(hub) && (
<Button variant="secondary" onClick={() => void run(() => saveConfig(config?.hubs ?? [], hub.label))}><Star size={14} />{t('hubs.browse.makeDefault')}</Button>
)}
<MoreMenu label={t('hubs.view.more')} items={[{ label: t('install.hubs.remove'), icon: Trash2, danger: true, onClick: () => setRemoving(hub) }]} />
</>
);
}
return (
<div className="ss-wrap animate-fade-in">
<PageHeader title={t('hubs.title')} subtitle={t('hubs.subtitle')} backTo="/skills" />
<nav className="ss-tabs" aria-label={t('hubs.title')}>
<button type="button" className={tab === 'browse' ? 'on' : ''} aria-current={tab === 'browse'} onClick={() => go('browse')}>
{t('hubs.tabs.browse')}
</button>
<button type="button" className={tab === 'mine' ? 'on' : ''} aria-current={tab === 'mine'} onClick={() => go('mine')}>
{t('hubs.tabs.mine')}
</button>
</nav>
{tab === 'browse' ? <HubBrowser previewURL={preview ?? undefined} /> : <HubBuilder />}
<div className="grid grid-cols-[280px_minmax(0,1fr)] items-start gap-7">
<HubList
items={items}
selected={selected}
onPick={pick}
locked={editing}
onAdd={addHub}
onCreate={() => void create()}
onImport={(file) => void importFile(file)}
/>
<div className="flex min-w-0 flex-col gap-3">
{error && <div role="alert" className="ss-note bad"><span className="flex-1 break-words">{error}</span></div>}
{!current ? (
<EmptyState icon={Library} title={t('hubs.browse.pickTitle')} description={t('hubs.browse.pickHint')} />
) : editing && draft.data ? (
<HubEditor key={draft.data.draft.id} response={draft.data} onDone={() => setEditing(false)} />
) : (
<HubView key={current.key} title={current.label} draftId={draftId} url={hub?.url} actions={actions} />
)}
</div>
</div>
{sharing && draft.data && <ShareDialog response={draft.data} onClose={() => setSharing(false)} />}
<ConfirmDialog
open={deleting}
title={t('hubs.view.delete')}
message={t('hubs.view.deleteHint')}
variant="danger"
onCancel={() => setDeleting(false)}
onConfirm={() => void deleteDraft()}
/>
<ConfirmDialog
open={removing !== null}
title={t('install.hubs.remove')}
message={t('hubs.browse.removeHint', { name: removing?.label ?? '' })}
variant="danger"
onCancel={() => setRemoving(null)}
onConfirm={() => { const target = removing; setRemoving(null); if (target) void removeHub(target); }}
/>
</div>
);
}