diff --git a/herdr/skillshare-mod/RECIPE.md b/herdr/skillshare-mod/RECIPE.md index 0bc9541dc..cfb9db515 100644 --- a/herdr/skillshare-mod/RECIPE.md +++ b/herdr/skillshare-mod/RECIPE.md @@ -10,7 +10,7 @@ A skillshare button and panel added to your existing Herdr window. See which ski - A 400px panel beside the work area, resizable from 380 to 720px. Its 44px header shows the folder, machine, CLI version, Update panel when available and a close button. - **Overview**, **Library** and **Machines** tabs. In a project, All · Project · Global selects the scope; outside one, Global is shown. - Overview answers with Everything is in sync, targets/resources waiting, extras that need a look, or Syncing. A Sync button handles pending work. Six counts (Skills, Agents, MCP, Plugins, Hooks, Extras) open Library by kind; up to six target lines show what waits. Hovering a collapsed count opens the remaining target lines. -- Library has kind tabs, a filter, Sync and Install. Its scrollable list groups unknown, needs-attention, needs-sync, update, in-sync and disabled rows. In-sync skills and agents fold by source, with a List switch. Extras lists file and folder extras and memory notes; an extra whose source is missing needs attention. Each row opens a preview; update rows also have Update. +- Library has kind tabs, a filter, Sync and Install. Its scrollable list groups unknown, needs-attention, needs-sync, update, in-sync and disabled rows. In-sync skills and agents fold by source, with a List switch. Extras lists file and folder extras, then memory notes on their own, without a sync state or a count; an extra whose source is missing needs attention. Each row opens a preview; update rows also have Update. - Machines shows one card per Herdr machine: version, remote/source/target state, doctor warnings and Pull and sync or Sync both ways. A newer CLI version offers Update. - A 34px notice line appears during work or after an outcome. A 40px footer shows the source repository state and opens its actions. - Previews use Document/Settings/About, Targets and Details tabs where applicable. Install, audit results, source actions, conflict resolution, enable/disable, uninstall and updates use confirmation overlays. @@ -20,7 +20,7 @@ A skillshare button and panel added to your existing Herdr window. See which ski - The button toggles the panel and the close button hides it. Open/closed state survives space switches and restarts. - The panel follows the shown space's machine and focused terminal's folder. `.skillshare/config.yaml` or `skillshare/config.yaml` enables project scope beside global scope. -- It refreshes every 20 seconds while shown, checks resource updates every 10 minutes and checks the latest published panel release hourly. Hidden panels do no work. Resource reads appear independently; pending or failed reads remain unconfirmed instead of claiming everything is in sync. Memory notes never wait for a sync, so a failed memory read leaves sync states confirmed; if the memory read fails before any notes have been read, the Extras count is the extras already read. Skillshare before 0.24 has no memory list. +- It refreshes every 20 seconds while shown, checks resource updates every 10 minutes and checks the latest published panel release hourly. Hidden panels do no work. Resource reads appear independently; pending or failed reads remain unconfirmed instead of claiming everything is in sync. Memory notes never wait for a sync and are not counted, so a pending or failed memory read leaves sync states and counts confirmed. Skillshare before 0.24 has no memory list. - Sync applies pending scopes and plugin changes. Hook conflicts block all resource sync until resolved. Hook notices do not inflate named-entry counts. - Preview reads skill/agent files, MCP settings, an extra's file or folder, or a memory note, hiding secret values. Skills and agents offer Update, Diff, Enable/Disable, Uninstall and Ask agent to audit; declared hooks offer Enable, Disable and Remove. Destructive actions and audit hand-offs ask first. - Install takes a repository URL, uses the CLI's dry-run plan to choose skills, audits a separate clone and installs only after a passing audit or explicit Install anyway confirmation. A failed command remains a failure even when some items were installed. diff --git a/herdr/skillshare-mod/mods/skillshare/loader.js b/herdr/skillshare-mod/mods/skillshare/loader.js index 5d8fdb74f..b30e2c1be 100644 --- a/herdr/skillshare-mod/mods/skillshare/loader.js +++ b/herdr/skillshare-mod/mods/skillshare/loader.js @@ -111,11 +111,13 @@ export async function loadPreview(io, on, project, item, mcpPath) { // ending non-zero is not an error here. const r = await io.sh(READ_EXTRA, [item.dir], on), cut = r.stdout.indexOf("@@\n"); if (cut < 0) return { error: `${item.dir} could not be read.` }; - const files = r.stdout.slice(0, cut).split("\n").filter(Boolean), text = r.stdout.slice(cut + 3); - if (text && !files.includes("SKILL.md")) files.unshift("SKILL.md"); + // READ_EXTRA lists one name past the 40 shown: more says the list goes on. + const listed = r.stdout.slice(0, cut).split("\n").filter(Boolean), text = r.stdout.slice(cut + 3); + const files = listed.slice(0, 40), more = listed.length > 40; + if (text && !files.includes("SKILL.md")) { files.unshift("SKILL.md"); files.length = Math.min(files.length, 40); } if (!files.length) return { error: `${item.dir} has no files to show.` }; - if (files.includes("SKILL.md")) return { files, file: "SKILL.md", dir: item.dir, ...splitFrontmatter(text) }; - return { files, file: files[0], dir: item.dir, ...(await loadFile(io, on, item.dir, files[0])) }; + if (files.includes("SKILL.md")) return { files, more, file: "SKILL.md", dir: item.dir, ...splitFrontmatter(text) }; + return { files, more, file: files[0], dir: item.dir, ...(await loadFile(io, on, item.dir, files[0])) }; } const st = parseJSON((await io.run(["status", "--json", flag(item.scope)], at(on, project, item.scope))).stdout); const base = item.kind === "agents" ? st?.agents?.source : st?.source?.path; diff --git a/herdr/skillshare-mod/mods/skillshare/main.js b/herdr/skillshare-mod/mods/skillshare/main.js index 0e0e079a0..541af08cb 100644 --- a/herdr/skillshare-mod/mods/skillshare/main.js +++ b/herdr/skillshare-mod/mods/skillshare/main.js @@ -586,6 +586,8 @@ export default class Skillshare extends View { sections.push(...rows(single)); } else sections.push(...rows(live)); if (off.length) sections.push(this.groupHeader(t, "off", `OFF · ${off.length}`, t.muted, null), ...rows(off)); + // Memory notes have no sync state, so they sit apart from the sync groups. + if (groups.notes.length) sections.push(this.groupHeader(t, "notes", `MEMORY NOTES · ${groups.notes.length}`, t.muted, null), ...rows(groups.notes)); if (!listed.length) sections.push(div().px(18).py(14).child(note(t, progress.unknown.has(this.kind) ? "This inventory is not confirmed yet." : this.query ? "Nothing matches the filter." : `No ${KINDS.find(([k]) => k === this.kind)[1].toLowerCase()} here yet.`))); list = v_flex().pb(16).children(sections); } @@ -929,7 +931,7 @@ export default class Skillshare extends View { const doc = d.plain ? monoBox(t, `doc-${this.file}`, d.body ?? "") : TextView.markdown(`doc-${this.file ?? it.key}`, d.body ?? ""); // Only a skill with more than its SKILL.md gets a file list; otherwise the document has the width. body = [(d.files?.length ?? 0) > 1 ? div().id("files").w(196).h_full().flex_none().overflow_y_scrollbar().border_r(1).border_color(t.border) - .child(v_flex().py(10).gap(1).children(d.files.map(fileRow))) : null, scroll("pane", page([it.kind === "extras" && d.meta?.length ? card(d.meta) : null, doc]))]; + .child(v_flex().py(10).gap(1).children(d.files.map(fileRow)).children(d.more ? [div().px(18).pt(6).text_size(S().label).text_color(t.muted).child("The first 40 files")] : [])) : null, scroll("pane", page([it.kind === "extras" && d.meta?.length ? card(d.meta) : null, doc]))]; } else if (it.kind === "mcp") { body = [scroll("pane", page([d.server?.length ? card(d.server) : quietNote("skillshare's MCP source has no settings for this server on this machine."), quietNote("Secret values stay hidden. The preview shows names only.")]))]; diff --git a/herdr/skillshare-mod/mods/skillshare/model.js b/herdr/skillshare-mod/mods/skillshare/model.js index e729563d0..1e27c1653 100644 --- a/herdr/skillshare-mod/mods/skillshare/model.js +++ b/herdr/skillshare-mod/mods/skillshare/model.js @@ -236,7 +236,8 @@ export function targetList(raw, scope = "all", items = []) { } for (const i of items) { if (!(scope === "all" || i.scope === scope) || i.notice || !waitsForSync(i) || !["mcp", "plugins", "hooks", "extras"].includes(i.kind)) continue; - for (const r of previewTargets(i)) if (r.warn && by.has(r.name)) by.set(r.name, by.get(r.name) + 1); + // An extra can wait on two folders of one target; that target still waits on one resource. + for (const name of new Set(previewTargets(i).filter((r) => r.warn).map((r) => r.name))) if (by.has(name)) by.set(name, by.get(name) + 1); } return { known, scopes, list: [...by].map(([name, n]) => ({ name, n })).sort((a, b) => b.n - a.n || a.name.localeCompare(b.name)) }; } @@ -294,16 +295,15 @@ export function overviewAnswer({ loading, failed, error, moving, reading = [], i export function resourceProgress(raw, scope = "all") { const pending = new Set(), errors = [], unknown = new Set(); let available = false, incomplete = false; - const kinds = { list: ["skills", "agents"], mcp: ["mcp"], plugins: ["plugins"], hooks: ["hooks"], extras: ["extras"], memory: ["extras"] }; + // Memory notes are not counted, so the memory read holds no kind's count. + const kinds = { list: ["skills", "agents"], mcp: ["mcp"], plugins: ["plugins"], hooks: ["hooks"], extras: ["extras"], memory: [] }; for (const [s, one] of Object.entries(raw)) { if (scope !== "all" && scope !== s) continue; available ||= Object.keys(kinds).some((key) => one[key] != null); // Memory notes never wait for a sync, so their read leaves sync states confirmed. for (const key of one.pending ?? []) { pending.add(key); incomplete ||= key !== "memory"; } for (const [key, message] of Object.entries(one.errors ?? {})) { errors.push(`${s} ${key}: ${message}`); incomplete ||= key !== "memory"; } - // A memory error marks the Extras count unknown only after notes have been read. - const failed = (key) => Boolean(one.errors?.[key]) && (key !== "memory" || one.memory != null); - for (const [key, names] of Object.entries(kinds)) if ((one.pending ?? []).includes(key) || failed(key)) for (const name of names) unknown.add(name); + for (const [key, names] of Object.entries(kinds)) if ((one.pending ?? []).includes(key) || one.errors?.[key]) for (const name of names) unknown.add(name); } return { pending: [...pending], errors, unknown, available, incomplete }; } @@ -414,7 +414,9 @@ export function buildItems(scope, raw) { } // An extra's target is named by the target whose skills folder shares its parent folder. // Relative project paths start from the project folder; the first target by name wins a shared folder. - const segments = (path) => String(path ?? "").toLowerCase().split(/[\\/]+/).filter((s) => s && s !== "."); + // Windows paths ignore case; POSIX ones keep it, where .Claude and .claude are different folders. + const windows = [raw.root, ...(raw.targetPaths ?? []).map((t) => t.path)].some((p) => /^[a-z]:|\\/i.test(String(p ?? ""))); + const segments = (path) => (windows ? String(path ?? "").toLowerCase() : String(path ?? "")).split(/[\\/]+/).filter((s) => s && s !== "."); const root = raw.root ? segments(raw.root) : null; const homes = (raw.targetPaths ?? []).map((t) => ({ name: t.name, dir: segments(t.path).slice(0, -1) })).sort((a, b) => String(a.name).localeCompare(String(b.name))); const owner = (path) => { @@ -438,14 +440,15 @@ export function buildItems(scope, raw) { file: e.file, dir: e.source_dir, rows, sourceMissing, src: gone ? "source missing" : `${e.file || plural(e.file_count ?? 0, "file")} · ${plural(rows.length, "target")}`, state: gone ? "broken" : rows.some((r) => r.warn) ? "sync" : "ok" }); } + // A memory note is a file inside the memory extra: it has no sync state of its own and is not counted. for (const n of raw.memory?.notes ?? []) { items.push({ key: `${scope}:extras:memory/${n.path}`, kind: "extras", extra: "note", scope, name: n.path, label: n.path, - file: n.path, dir: raw.memory.root, rows: [], src: "memory note", state: "ok" }); + file: n.path, dir: raw.memory.root, rows: [], src: "memory note", state: "note" }); } if (raw.pending || raw.errors) { for (const item of items) { - const keys = item.kind === "skills" || item.kind === "agents" ? ["list", "diff", "status"] : item.kind === "extras" ? [item.extra === "note" ? "memory" : "extras"] : [item.kind]; - if (!item.notice && item.state !== "off" && keys.some((key) => raw.pending?.includes(key) || raw.errors?.[key])) { + const keys = item.kind === "skills" || item.kind === "agents" ? ["list", "diff", "status"] : [item.kind]; + if (!item.notice && item.state !== "off" && item.state !== "note" && keys.some((key) => raw.pending?.includes(key) || raw.errors?.[key])) { item.cachedState = item.state; item.state = "unknown"; } @@ -556,10 +559,11 @@ export const READ_SKILL = `cd "$1" 2>/dev/null || exit 3 find . -type f -not -path './.git/*' | sed 's|^\\./||' | sort | head -40 echo @@ head -c 60000 SKILL.md 2>/dev/null`; -// sh -c READ_EXTRA : a folder extra's files as extras sync sees them, then as READ_SKILL. +// sh -c READ_EXTRA : a folder extra's files as extras sync sees them (41 at most, one +// past the 40 shown, so a preview knows the list goes on), then as READ_SKILL. // DiscoverExtraFiles (internal/sync/extras.go) skips every .git folder and every .metadata.json. export const READ_EXTRA = `cd "$1" 2>/dev/null || exit 3 -find . -type d -name .git -prune -o -type f ! -name .metadata.json -print | sed 's|^\\./||' | sort | head -40 +find . -type d -name .git -prune -o -type f ! -name .metadata.json -print | sed 's|^\\./||' | sort | head -41 echo @@ head -c 60000 SKILL.md 2>/dev/null`; // sh -c READ_FILE : a file's first 60 kB. @@ -621,7 +625,7 @@ export function filterItems(items, { scope, kind, query }) { export function groupItems(items) { const by = (s) => items.filter((i) => !i.notice && s.includes(i.state)).sort((a, b) => a.label.localeCompare(b.label)); - return { update: by(["update"]), sync: by(["sync", "missing"]), ok: by(["ok", "off"]) }; + return { update: by(["update"]), sync: by(["sync", "missing"]), ok: by(["ok", "off"]), notes: by(["note"]) }; } // The repository a row came from: a tracked repo by name, a URL source by host/owner/repo @@ -653,7 +657,7 @@ export function sourceGroups(items) { export function counts(items) { const c = { all: 0, project: 0, global: 0, skills: 0, agents: 0, mcp: 0, plugins: 0, hooks: 0, extras: 0 }; - for (const i of items) { if (!i.notice) { c.all++; c[i.scope]++; c[i.kind]++; } } + for (const i of items) { if (!i.notice && i.state !== "note") { c.all++; c[i.scope]++; c[i.kind]++; } } return c; } diff --git a/herdr/skillshare/README.md b/herdr/skillshare/README.md index 21d7d2c64..39ca9e5e8 100644 --- a/herdr/skillshare/README.md +++ b/herdr/skillshare/README.md @@ -2,7 +2,7 @@ ![The skillshare panel in Herdr: what needs a sync and a line to every target, everything installed, and every machine](panels.png) -[skillshare](../../README.md) keeps your skills, agents, MCP servers, plugins and hooks in one +[skillshare](../../README.md) keeps your skills, agents, MCP servers, plugins, hooks and extras in one source you control and syncs them to Claude Code, Codex, Gemini CLI and the other AI coding tools you use. This panel puts it beside your agents in [Herdr](https://herdr.dev): @@ -107,10 +107,10 @@ Read ~/.config/herdr-app/AGENTS.md, then update only the installed skillshare mo as it is ready; a slow plugin inventory does not hold up other resources or the source's Git state. Refreshes keep existing rows visible. Pending or failed inventories show `…` instead of zero, and sync states remain unconfirmed until - the reads succeed; memory notes never wait for a sync, so their read is the exception: a failed - memory read leaves sync states confirmed. If the memory read fails before any notes have been - read, the Extras count is the extras already read; skillshare before 0.24 has no memory list. Read - errors stay visible beside the available data; the next refresh retries. + the reads succeed. Memory notes never wait for a sync and are not counted, so their read is the + exception: a pending or failed memory read leaves sync states and counts confirmed; skillshare + before 0.24 has no memory list. Read errors stay visible beside the available data; the next + refresh retries. `check` and `check agents` run every 10 minutes. Git state comes from `git status` in the source repository, because the CLI has no JSON for it. - The install dialog reads canonical names and repository-relative paths from @@ -132,21 +132,23 @@ Read ~/.config/herdr-app/AGENTS.md, then update only the installed skillshare mo - A preview reads on the item's machine: a skill's file names (40 at most) and the first 60 kB of the file shown, an agent's `.md`, the MCP source file, an extra's file or a folder extra's file - names and one file, or a memory note. Env, header and bearer-token values are replaced before + names (40 at most, saying so when there are more) and one file, or a memory note. Env, header and bearer-token values are replaced before the dialog gets them, so it shows names only. - The map's target names come from `status --json` and `diff --json`. A target's count is what `diff` reports for skills and agents, plus each MCP server, plugin, hook or extra waiting on it. An extra's target is named by the target whose skills folder shares its parent folder; a project's relative extras paths start from the project folder, and when targets share a folder - the first by name names it. + the first by name names it. Windows paths match in any case; POSIX paths match only in the same + case. Overview lists only what needs you: what waits for a sync, what has an update, hook notices, extras whose source is missing, and machines that are behind once the Machines tab has read them. Library lists everything by kind, in Need a look, Needs sync, Update available, In sync and Off; disabled rows are always under Off. -Extras lists each file or folder extra and each memory note; an extra waits for a sync while a -target's status in `extras list` is not `synced`. A missing source is the exception: a sync can't -fix it, so that extra is under Need a look as "source missing", and with nothing waiting Overview -says how many extras need a look instead of "Everything is in sync". +Extras lists each file or folder extra, then each memory note under Memory notes. A note has no +sync state and is not counted; the memory folder is also listed as the `memory` extra, and that +row is the one counted. An extra waits for a sync while a target's status in `extras list` is not `synced`. A missing source is the +exception: a sync can't fix it, so that extra is under Need a look as "source missing", and with +nothing waiting Overview says how many extras need a look instead of "Everything is in sync". For skills and agents, In sync switches between List and By source (the default), which folds rows from the same repository, or local ones, into collapsible groups. A source with one row stays a plain row, and a filter opens every group. diff --git a/herdr/skillshare/RECIPE.md b/herdr/skillshare/RECIPE.md index d204e1fce..a319ad119 100644 --- a/herdr/skillshare/RECIPE.md +++ b/herdr/skillshare/RECIPE.md @@ -4,7 +4,7 @@ skillshare beside your agents. Herdr's default window gains a skillshare button ![Herdr + skillshare](preview.png) -skillshare keeps one source of skills, agents, MCP servers, plugins and hooks and syncs it to Claude Code, Codex, Gemini CLI and the other AI coding tools you use. New to it? Start with the [main README](../../README.md); this folder's [README](README.md) covers installing the panel. +skillshare keeps one source of skills, agents, MCP servers, plugins, hooks and extras and syncs it to Claude Code, Codex, Gemini CLI and the other AI coding tools you use. New to it? Start with the [main README](../../README.md); this folder's [README](README.md) covers installing the panel. ## Installation and updates @@ -35,20 +35,20 @@ Left to right, everything as in Herdr's `main` layout, plus two blocks: - the agent's mark is Herdr's own program icon, found by the target's name or its `-` prefix; `omp` and `universal` use the two colour marks in `icons/`, and anything else the generic agent icon; - then only what needs you: "WAITING TO SYNC · n", "UPDATE AVAILABLE · n" with Update on each row, "NEED A LOOK · n" (hook notices, and extras whose source is missing), and "MACHINES · n" once the Machines tab has read them. - Library: - - Skills · Agents · MCP · Plugins · Hooks · Extras tabs with counts (named hook entries, including pending cleanup; notices do not count); - - Extras rows: each extra from `extras list --json` (its file or file count, and its target count; it waits for a sync while a target's status is not `synced`; when its source is missing (`source_exists: false`, or a target's `no source`) it is under NEED A LOOK as "source missing") and each memory note from `extras memory list --json`; + - Skills · Agents · MCP · Plugins · Hooks · Extras tabs with counts (named hook entries, including pending cleanup; notices and memory notes do not count); + - Extras rows: each extra from `extras list --json` (its file or file count, and its target count; it waits for a sync while a target's status is not `synced`; when its source is missing (`source_exists: false`, or a target's `no source`) it is under NEED A LOOK as "source missing") and each memory note from `extras memory list --json`, with no sync state; - a filter field, a Sync button (primary while something waits) and a 30px install button; - - the list, the only part that scrolls: rows whose sync state is unknown, then "NEED A LOOK · n" (hook notices, and extras whose source is missing), "NEEDS SYNC · n" in `blocked`, "UPDATE AVAILABLE · n" in `accent` with Update all when there are several, "IN SYNC · n", and "OFF · n" for disabled rows. For skills and agents "IN SYNC" has a List · By source switch, By source by default and kept in `shared`: rows sharing a repository (a tracked repo, or host/owner/repo of the source URL, with github.com left out) or the local source fold under a collapsed row with a chevron, a `git` or `folder` icon, the source and a count. A source with one row stays a plain row, and a filter opens every group. - - Each row is 46px: a dot (filled `accent`, `blocked` or `ansi2`; hollow `ansi1` when never synced or `muted` when disabled), the name, one short state, and a chevron. A row with an update also has Update. Clicking a row opens its preview; rows do not open in place. + - the list, the only part that scrolls: rows whose sync state is unknown, then "NEED A LOOK · n" (hook notices, and extras whose source is missing), "NEEDS SYNC · n" in `blocked`, "UPDATE AVAILABLE · n" in `accent` with Update all when there are several, "IN SYNC · n", "OFF · n" for disabled rows, and "MEMORY NOTES · n" for memory notes. For skills and agents "IN SYNC" has a List · By source switch, By source by default and kept in `shared`: rows sharing a repository (a tracked repo, or host/owner/repo of the source URL, with github.com left out) or the local source fold under a collapsed row with a chevron, a `git` or `folder` icon, the source and a count. A source with one row stays a plain row, and a filter opens every group. + - Each row is 46px: a dot (filled `accent`, `blocked` or `ansi2`; hollow `ansi1` when never synced or `muted` when disabled; filled `muted` for a memory note), the name, one short state, and a chevron. A row with an update also has Update. Clicking a row opens its preview; rows do not open in place. - Machines: one card per Herdr machine. Its header has a status dot, the name, "this computer" and the version (a pill when a newer skillshare exists). Two lines follow in the map's grammar, Remote to Source and Source to its targets, each with its state at the right, and the targets that wait by name, three at most. The footer has Pull and sync, or Sync both ways when that machine has uncommitted or unpushed work and an upstream (a plain pull would refuse), "Update to …" when a newer skillshare exists, and the doctor's errors or warnings. Updating skillshare puts the spinner on "Updating…" in the version button; pulling/syncing puts it on the sync button. Other actions are disabled without a spinner while the machine is busy. While the first check runs, two card-shaped placeholders pulse. - a 34px status line while work runs (work, installs included, runs one at a time per machine; machines run side by side), with a spinning ring in `working`, or a notice: a done notice clears after 4 s and a warning or error after 8 s, and a stopped pull keeps a "Review conflicts" bar; - a 40px footer: the source state, such as "Source · n uncommitted · ↑n ↓n", "up to date" or "no remote" (`blocked` when it needs attention), and Sync both ways when the repository has an upstream. -- Initial loading draws the content's own shape: the map with empty counts and four lines, list rows, machine cards. Each pulses once every 1.2 s. Resource reads run independently per scope and appear as each finishes; Source reads independently too. Refreshes keep existing rows visible; previously actionable Overview rows move to a neutral "SYNC STATUS UNCONFIRMED" section until their reads succeed. Pending or failed inventory counts show `…`, not zero; target lines and cached rows remain unconfirmed while their reads are pending or failed, and Overview does not claim everything is in sync. Memory notes are the exception, since they never wait for a sync: a failed `extras memory list` shows its error but leaves sync states confirmed. If the memory read fails before any notes have been read, the Extras count is the extras already read; skillshare before 0.24 has no memory list. Notes kept from an earlier read leave it at `…` until a read succeeds. Library names the reads still running. Errors stay visible beside available data and retry on the next refresh. +- Initial loading draws the content's own shape: the map with empty counts and four lines, list rows, machine cards. Each pulses once every 1.2 s. Resource reads run independently per scope and appear as each finishes; Source reads independently too. Refreshes keep existing rows visible; previously actionable Overview rows move to a neutral "SYNC STATUS UNCONFIRMED" section until their reads succeed. Pending or failed inventory counts show `…`, not zero; target lines and cached rows remain unconfirmed while their reads are pending or failed, and Overview does not claim everything is in sync. Memory notes are the exception, since they never wait for a sync and are not counted: a pending or failed `extras memory list` shows in Library but leaves sync states and counts confirmed, and notes kept from an earlier read stay listed; skillshare before 0.24 has no memory list. Library names the reads still running. Errors stay visible beside available data and retry on the next refresh. - Motion is Herdr's native kind: the status line's height slides (180 ms) so the list does not jump, a waiting line breathes and a syncing one flows, a dialog fades in and rises 8px (200 ms) and fades out (150 ms) before it closes, and buttons and rows show a pressed state. - Dialogs open as Herdr overlays with `frame: "none"`, so each draws its own card: a 56px header (title, one line under it, an Esc keycap and a close button), the body, and a 54px footer with quiet actions at the left and one primary button at the right. They are: preview, install, hook change, enable or disable, uninstall, audit hand-off, source repository, sync both ways, pull conflicts, update skillshare, update the panel, command output. - Preview (760×560) has one tab per question, so no pane shares its width: - - Document (Settings for an MCP server, Definition for a hook, About for a plugin): a skill's `SKILL.md` rendered as Markdown, with a file list at the left only when the skill has other files; an agent's file; an MCP server's transport, command, arguments and the names of its env, headers and token; a hook's description, agents and native files; a plugin's source and version; an extra's file, or a folder extra's files with `SKILL.md` or else the first one shown; a memory note. An extra whose source folder or file is gone (`source_exists: false`) says so, with no Try again. - - Targets n (Agents n for hooks and plugins): the item on top and a line down to each target, as on Overview. An extra's target is named by the target whose skills folder shares its parent folder, as the dashboard names it, or else by its path, and shows its mode and file name, or its status while it waits. A project's relative extras paths start from the project folder; when targets share a folder, the first by name names it. Memory notes have no Targets tab. + - Document (Settings for an MCP server, Definition for a hook, About for a plugin): a skill's `SKILL.md` rendered as Markdown, with a file list at the left only when the skill has other files; an agent's file; an MCP server's transport, command, arguments and the names of its env, headers and token; a hook's description, agents and native files; a plugin's source and version; an extra's file, or a folder extra's files (40 at most, with "The first 40 files" under the list when there are more) with `SKILL.md` or else the first one shown; a memory note. An extra whose source folder or file is gone (`source_exists: false`) says so, with no Try again. + - Targets n (Agents n for hooks and plugins): the item on top and a line down to each target, as on Overview. An extra's target is named by the target whose skills folder shares its parent folder, as the dashboard names it, or else by its path, and shows its mode and file name, or its status while it waits. A project's relative extras paths start from the project folder; when targets share a folder, the first by name names it. Windows paths match in any case; POSIX paths match only in the same case. Memory notes have no Targets tab. - Details, for skills and agents: the frontmatter as rows, and where the files are. - A hook notice has no tabs: it shows what the notice says. - Install shows its four steps (Source, Choose, Audit, Install) above the body. @@ -63,7 +63,7 @@ Left to right, everything as in Herdr's `main` layout, plus two blocks: - skills and agents offer Disable, or Enable when disabled (`skillshare disable` / `enable` with the entry's own path, `--kind agent` for an agent; the next sync applies it), Uninstall, and "Ask to audit…" when Herdr knows an agent: the one focused, or the last one focused; - top-level declared hooks offer Enable, Disable and Remove; - MCP, plugin and extras previews have no actions; Sync handles them. -- A preview reads on the item's machine: the skill's file names (40 at most) and the first 60 kB of the file shown, an agent's `.md`, the MCP source file `mcp list --json` names, an extra's file or a folder extra's file names and one file, or a memory note. Env, header and bearer-token values are replaced before the dialog gets them, so it shows names only. +- A preview reads on the item's machine: the skill's file names (40 at most) and the first 60 kB of the file shown, an agent's `.md`, the MCP source file `mcp list --json` names, an extra's file or a folder extra's file names (40 at most, saying so when there are more) and one file, or a memory note. Env, header and bearer-token values are replaced before the dialog gets them, so it shows names only. - Hook conflicts block `sync --all` for every resource kind; resolve them in the CLI or dashboard before retrying. - Sync, on Overview, syncs every scope that has something waiting in the scope the switch shows, and also runs `sync plugins` when a plugin waits. Sync in Library does the same, and with nothing waiting it syncs the shown scope again. - The install button opens a URL dialog with recent sources: diff --git a/herdr/skillshare/mods/skillshare/loader.js b/herdr/skillshare/mods/skillshare/loader.js index 5d8fdb74f..b30e2c1be 100644 --- a/herdr/skillshare/mods/skillshare/loader.js +++ b/herdr/skillshare/mods/skillshare/loader.js @@ -111,11 +111,13 @@ export async function loadPreview(io, on, project, item, mcpPath) { // ending non-zero is not an error here. const r = await io.sh(READ_EXTRA, [item.dir], on), cut = r.stdout.indexOf("@@\n"); if (cut < 0) return { error: `${item.dir} could not be read.` }; - const files = r.stdout.slice(0, cut).split("\n").filter(Boolean), text = r.stdout.slice(cut + 3); - if (text && !files.includes("SKILL.md")) files.unshift("SKILL.md"); + // READ_EXTRA lists one name past the 40 shown: more says the list goes on. + const listed = r.stdout.slice(0, cut).split("\n").filter(Boolean), text = r.stdout.slice(cut + 3); + const files = listed.slice(0, 40), more = listed.length > 40; + if (text && !files.includes("SKILL.md")) { files.unshift("SKILL.md"); files.length = Math.min(files.length, 40); } if (!files.length) return { error: `${item.dir} has no files to show.` }; - if (files.includes("SKILL.md")) return { files, file: "SKILL.md", dir: item.dir, ...splitFrontmatter(text) }; - return { files, file: files[0], dir: item.dir, ...(await loadFile(io, on, item.dir, files[0])) }; + if (files.includes("SKILL.md")) return { files, more, file: "SKILL.md", dir: item.dir, ...splitFrontmatter(text) }; + return { files, more, file: files[0], dir: item.dir, ...(await loadFile(io, on, item.dir, files[0])) }; } const st = parseJSON((await io.run(["status", "--json", flag(item.scope)], at(on, project, item.scope))).stdout); const base = item.kind === "agents" ? st?.agents?.source : st?.source?.path; diff --git a/herdr/skillshare/mods/skillshare/main.js b/herdr/skillshare/mods/skillshare/main.js index 0e0e079a0..541af08cb 100644 --- a/herdr/skillshare/mods/skillshare/main.js +++ b/herdr/skillshare/mods/skillshare/main.js @@ -586,6 +586,8 @@ export default class Skillshare extends View { sections.push(...rows(single)); } else sections.push(...rows(live)); if (off.length) sections.push(this.groupHeader(t, "off", `OFF · ${off.length}`, t.muted, null), ...rows(off)); + // Memory notes have no sync state, so they sit apart from the sync groups. + if (groups.notes.length) sections.push(this.groupHeader(t, "notes", `MEMORY NOTES · ${groups.notes.length}`, t.muted, null), ...rows(groups.notes)); if (!listed.length) sections.push(div().px(18).py(14).child(note(t, progress.unknown.has(this.kind) ? "This inventory is not confirmed yet." : this.query ? "Nothing matches the filter." : `No ${KINDS.find(([k]) => k === this.kind)[1].toLowerCase()} here yet.`))); list = v_flex().pb(16).children(sections); } @@ -929,7 +931,7 @@ export default class Skillshare extends View { const doc = d.plain ? monoBox(t, `doc-${this.file}`, d.body ?? "") : TextView.markdown(`doc-${this.file ?? it.key}`, d.body ?? ""); // Only a skill with more than its SKILL.md gets a file list; otherwise the document has the width. body = [(d.files?.length ?? 0) > 1 ? div().id("files").w(196).h_full().flex_none().overflow_y_scrollbar().border_r(1).border_color(t.border) - .child(v_flex().py(10).gap(1).children(d.files.map(fileRow))) : null, scroll("pane", page([it.kind === "extras" && d.meta?.length ? card(d.meta) : null, doc]))]; + .child(v_flex().py(10).gap(1).children(d.files.map(fileRow)).children(d.more ? [div().px(18).pt(6).text_size(S().label).text_color(t.muted).child("The first 40 files")] : [])) : null, scroll("pane", page([it.kind === "extras" && d.meta?.length ? card(d.meta) : null, doc]))]; } else if (it.kind === "mcp") { body = [scroll("pane", page([d.server?.length ? card(d.server) : quietNote("skillshare's MCP source has no settings for this server on this machine."), quietNote("Secret values stay hidden. The preview shows names only.")]))]; diff --git a/herdr/skillshare/mods/skillshare/model.js b/herdr/skillshare/mods/skillshare/model.js index e729563d0..1e27c1653 100644 --- a/herdr/skillshare/mods/skillshare/model.js +++ b/herdr/skillshare/mods/skillshare/model.js @@ -236,7 +236,8 @@ export function targetList(raw, scope = "all", items = []) { } for (const i of items) { if (!(scope === "all" || i.scope === scope) || i.notice || !waitsForSync(i) || !["mcp", "plugins", "hooks", "extras"].includes(i.kind)) continue; - for (const r of previewTargets(i)) if (r.warn && by.has(r.name)) by.set(r.name, by.get(r.name) + 1); + // An extra can wait on two folders of one target; that target still waits on one resource. + for (const name of new Set(previewTargets(i).filter((r) => r.warn).map((r) => r.name))) if (by.has(name)) by.set(name, by.get(name) + 1); } return { known, scopes, list: [...by].map(([name, n]) => ({ name, n })).sort((a, b) => b.n - a.n || a.name.localeCompare(b.name)) }; } @@ -294,16 +295,15 @@ export function overviewAnswer({ loading, failed, error, moving, reading = [], i export function resourceProgress(raw, scope = "all") { const pending = new Set(), errors = [], unknown = new Set(); let available = false, incomplete = false; - const kinds = { list: ["skills", "agents"], mcp: ["mcp"], plugins: ["plugins"], hooks: ["hooks"], extras: ["extras"], memory: ["extras"] }; + // Memory notes are not counted, so the memory read holds no kind's count. + const kinds = { list: ["skills", "agents"], mcp: ["mcp"], plugins: ["plugins"], hooks: ["hooks"], extras: ["extras"], memory: [] }; for (const [s, one] of Object.entries(raw)) { if (scope !== "all" && scope !== s) continue; available ||= Object.keys(kinds).some((key) => one[key] != null); // Memory notes never wait for a sync, so their read leaves sync states confirmed. for (const key of one.pending ?? []) { pending.add(key); incomplete ||= key !== "memory"; } for (const [key, message] of Object.entries(one.errors ?? {})) { errors.push(`${s} ${key}: ${message}`); incomplete ||= key !== "memory"; } - // A memory error marks the Extras count unknown only after notes have been read. - const failed = (key) => Boolean(one.errors?.[key]) && (key !== "memory" || one.memory != null); - for (const [key, names] of Object.entries(kinds)) if ((one.pending ?? []).includes(key) || failed(key)) for (const name of names) unknown.add(name); + for (const [key, names] of Object.entries(kinds)) if ((one.pending ?? []).includes(key) || one.errors?.[key]) for (const name of names) unknown.add(name); } return { pending: [...pending], errors, unknown, available, incomplete }; } @@ -414,7 +414,9 @@ export function buildItems(scope, raw) { } // An extra's target is named by the target whose skills folder shares its parent folder. // Relative project paths start from the project folder; the first target by name wins a shared folder. - const segments = (path) => String(path ?? "").toLowerCase().split(/[\\/]+/).filter((s) => s && s !== "."); + // Windows paths ignore case; POSIX ones keep it, where .Claude and .claude are different folders. + const windows = [raw.root, ...(raw.targetPaths ?? []).map((t) => t.path)].some((p) => /^[a-z]:|\\/i.test(String(p ?? ""))); + const segments = (path) => (windows ? String(path ?? "").toLowerCase() : String(path ?? "")).split(/[\\/]+/).filter((s) => s && s !== "."); const root = raw.root ? segments(raw.root) : null; const homes = (raw.targetPaths ?? []).map((t) => ({ name: t.name, dir: segments(t.path).slice(0, -1) })).sort((a, b) => String(a.name).localeCompare(String(b.name))); const owner = (path) => { @@ -438,14 +440,15 @@ export function buildItems(scope, raw) { file: e.file, dir: e.source_dir, rows, sourceMissing, src: gone ? "source missing" : `${e.file || plural(e.file_count ?? 0, "file")} · ${plural(rows.length, "target")}`, state: gone ? "broken" : rows.some((r) => r.warn) ? "sync" : "ok" }); } + // A memory note is a file inside the memory extra: it has no sync state of its own and is not counted. for (const n of raw.memory?.notes ?? []) { items.push({ key: `${scope}:extras:memory/${n.path}`, kind: "extras", extra: "note", scope, name: n.path, label: n.path, - file: n.path, dir: raw.memory.root, rows: [], src: "memory note", state: "ok" }); + file: n.path, dir: raw.memory.root, rows: [], src: "memory note", state: "note" }); } if (raw.pending || raw.errors) { for (const item of items) { - const keys = item.kind === "skills" || item.kind === "agents" ? ["list", "diff", "status"] : item.kind === "extras" ? [item.extra === "note" ? "memory" : "extras"] : [item.kind]; - if (!item.notice && item.state !== "off" && keys.some((key) => raw.pending?.includes(key) || raw.errors?.[key])) { + const keys = item.kind === "skills" || item.kind === "agents" ? ["list", "diff", "status"] : [item.kind]; + if (!item.notice && item.state !== "off" && item.state !== "note" && keys.some((key) => raw.pending?.includes(key) || raw.errors?.[key])) { item.cachedState = item.state; item.state = "unknown"; } @@ -556,10 +559,11 @@ export const READ_SKILL = `cd "$1" 2>/dev/null || exit 3 find . -type f -not -path './.git/*' | sed 's|^\\./||' | sort | head -40 echo @@ head -c 60000 SKILL.md 2>/dev/null`; -// sh -c READ_EXTRA : a folder extra's files as extras sync sees them, then as READ_SKILL. +// sh -c READ_EXTRA : a folder extra's files as extras sync sees them (41 at most, one +// past the 40 shown, so a preview knows the list goes on), then as READ_SKILL. // DiscoverExtraFiles (internal/sync/extras.go) skips every .git folder and every .metadata.json. export const READ_EXTRA = `cd "$1" 2>/dev/null || exit 3 -find . -type d -name .git -prune -o -type f ! -name .metadata.json -print | sed 's|^\\./||' | sort | head -40 +find . -type d -name .git -prune -o -type f ! -name .metadata.json -print | sed 's|^\\./||' | sort | head -41 echo @@ head -c 60000 SKILL.md 2>/dev/null`; // sh -c READ_FILE : a file's first 60 kB. @@ -621,7 +625,7 @@ export function filterItems(items, { scope, kind, query }) { export function groupItems(items) { const by = (s) => items.filter((i) => !i.notice && s.includes(i.state)).sort((a, b) => a.label.localeCompare(b.label)); - return { update: by(["update"]), sync: by(["sync", "missing"]), ok: by(["ok", "off"]) }; + return { update: by(["update"]), sync: by(["sync", "missing"]), ok: by(["ok", "off"]), notes: by(["note"]) }; } // The repository a row came from: a tracked repo by name, a URL source by host/owner/repo @@ -653,7 +657,7 @@ export function sourceGroups(items) { export function counts(items) { const c = { all: 0, project: 0, global: 0, skills: 0, agents: 0, mcp: 0, plugins: 0, hooks: 0, extras: 0 }; - for (const i of items) { if (!i.notice) { c.all++; c[i.scope]++; c[i.kind]++; } } + for (const i of items) { if (!i.notice && i.state !== "note") { c.all++; c[i.scope]++; c[i.kind]++; } } return c; } diff --git a/herdr/tests/loader.test.mjs b/herdr/tests/loader.test.mjs index bcaab6be9..c40f02126 100644 --- a/herdr/tests/loader.test.mjs +++ b/herdr/tests/loader.test.mjs @@ -180,6 +180,17 @@ test("an extra's preview reads its file, or a folder extra's files and the first assert.deepEqual([reads, chosen.file, chosen.meta, chosen.body], [[], "SKILL.md", [{ key: "name", value: "r" }], "Skill body\n"]); }); +test("a folder extra with more files than the preview lists says so", async () => { + // READ_EXTRA lists one name past the 40 shown, so the preview knows the list goes on. + const names = (n) => Array.from({ length: n }, (_, i) => `f${String(i).padStart(2, "0")}.md`).join("\n"); + const read = async (n) => loadPreview(machine({ scripts: { [READ_EXTRA]: { code: 1, stdout: `${names(n)}\n@@\n` }, [READ_FILE]: { stdout: "x" } } }).io, null, null, { kind: "extras", extra: "folder", dir: "/src/rules" }); + const long = await read(41), full = await read(40); + assert.deepEqual([long.files.length, long.more, full.files.length, Boolean(full.more)], [40, true, 40, false]); + // A SKILL.md past the cut is still shown first, and the list stays at 40. + const skill = await loadPreview(machine({ scripts: { [READ_EXTRA]: { stdout: `${names(41)}\n@@\nBody\n` } } }).io, null, null, { kind: "extras", extra: "folder", dir: "/src/rules" }); + assert.deepEqual([skill.files.length, skill.files[0], skill.file, skill.more], [40, "SKILL.md", "SKILL.md", true]); +}); + test("a missing extra source is said with nothing to retry; a target's no source alone still reads", async () => { const gone = await loadPreview(machine().io, null, null, { kind: "extras", extra: "file", dir: "/src/agents", file: "AGENTS.md", state: "broken", sourceMissing: true }); assert.equal(gone.error, undefined); diff --git a/herdr/tests/model.test.mjs b/herdr/tests/model.test.mjs index 884ac9f3c..d19c18dd5 100644 --- a/herdr/tests/model.test.mjs +++ b/herdr/tests/model.test.mjs @@ -61,7 +61,7 @@ test("hooks combine declarations and planned changes, including disabled entries assert.equal(by.conflict.reason, "claude: conflict · import it or explicitly replace it"); assert.equal(by.clean.src, "claude"); assert.equal(counts(items).hooks, 6); - assert.deepEqual(Object.values(groupItems(items)).map((g) => g.length), [0, 4, 2]); + assert.deepEqual(Object.values(groupItems(items)).map((g) => g.length), [0, 4, 2, 0]); assert.deepEqual(filterItems(items, { scope: "all", kind: "hooks", query: "codex" }).map((i) => i.name), ["pending", "removed"]); }); @@ -431,15 +431,18 @@ test("extras and memory notes are rows; a target that is not synced waits, named const items = buildItems("global", raw); // A missing source is neither in sync nor waiting: sync can't fix it, so it needs a look. assert.deepEqual(items.map((i) => [i.state, rowState(i, false), needsLook(i)]), - [["ok", "AGENTS.md · 1 target", false], ["sync", "changed", false], ["broken", "source missing", true], ["ok", "memory note", false]]); + [["ok", "AGENTS.md · 1 target", false], ["sync", "changed", false], ["broken", "source missing", true], ["note", "memory note", false]]); assert.deepEqual(previewTargets(items[0]), [{ name: "claude", warn: false, text: "import as CLAUDE.md" }]); assert.deepEqual(previewTargets(items[1]), [{ name: "opencode", warn: true, text: "drift · merge" }, { name: "/home/me/notes", warn: false, text: "copy" }]); assert.deepEqual(previewTargets(items[2]), [{ name: "claude", warn: false, text: "no source · merge" }]); - assert.equal(counts(items).extras, 4); + // A memory note is a file inside the memory extra, not a resource of its own: it is not counted. + assert.deepEqual([counts(items).extras, counts(items).all], [3, 3]); assert.deepEqual([waitsForSync(items[2]), items[2].state], [false, "broken"]); - assert.deepEqual(groupItems(items).ok.map((i) => i.name), ["agents", "INDEX.md"]); + assert.deepEqual([groupItems(items).ok.map((i) => i.name), groupItems(items).notes.map((i) => i.name)], [["agents"], ["INDEX.md"]]); assert.deepEqual(targetList({ global: raw }, "all", items).list, [{ name: "opencode", n: 1 }, { name: "claude", n: 0 }]); - assert.deepEqual(buildItems("global", { ...raw, pending: ["extras"] }).map((i) => i.state), ["unknown", "unknown", "unknown", "ok"]); + assert.deepEqual(buildItems("global", { ...raw, pending: ["extras"] }).map((i) => i.state), ["unknown", "unknown", "unknown", "note"]); + // A note has no sync state to lose while the memory read runs again or fails. + for (const read of [{ pending: ["memory"] }, { errors: { memory: "timed out" } }]) assert.equal(buildItems("global", { ...raw, ...read }).at(-1).state, "note"); }); test("an extra's target matches its target whether written relative, with other slashes, or in another case", () => { @@ -463,6 +466,9 @@ test("an extra's target matches its target whether written relative, with other // A Windows project folder, as Herdr reports it. const win = [{ name: "claude", path: "C:\\Work\\App\\.claude\\skills" }]; assert.equal(name(extra(".claude/rules"), win, "C:\\Work\\App", "project"), "claude"); + // On a POSIX machine, folders that differ only in case are different folders. + assert.equal(name(extra("/home/me/.claude/rules"), [{ name: "custom", path: "/home/me/.Claude/skills" }]), "/home/me/.claude/rules"); + assert.equal(name(extra(".claude/rules"), [{ name: "custom", path: "/work/app/.Claude/skills" }], "/work/app", "project"), ".claude/rules"); // The deepest shared folder wins: ~/.config/opencode over a target in ~/.config. const nested = [{ name: "opencode", path: "/home/me/.config/opencode/skills" }, { name: "other", path: "/home/me/.config/skills" }]; assert.equal(name(extra("/home/me/.config/opencode/rules"), nested), "opencode"); @@ -479,6 +485,14 @@ test("targets that share a folder name an extra's target the same way whatever o } }); +test("an extra waiting on two folders of one target counts once on that target", () => { + const raw = { extras: [{ name: "rules", source_dir: "/src/rules", file_count: 1, targets: [ + { path: "/home/me/.claude/rules", mode: "merge", status: "drift" }, { path: "/home/me/.claude/commands", mode: "merge", status: "not synced" }] }], + targetPaths: [{ name: "claude", path: "/home/me/.claude/skills" }] }; + const items = buildItems("global", raw); + assert.deepEqual(targetList({ global: { targets: ["claude"] } }, "all", items).list, [{ name: "claude", n: 1 }]); +}); + test("an extra whose source is gone needs a look even with no targets", () => { const [gone] = buildItems("global", { extras: [{ name: "agents", file: "AGENTS.md", source_dir: "/src/agents", source_exists: false, file_count: 0, targets: [] }] }); assert.deepEqual([gone.state, gone.sourceMissing, needsLook(gone)], ["broken", true, true]); @@ -501,13 +515,11 @@ test("memory notes never wait for a sync, so a failed memory read leaves sync st assert.deepEqual(memory.errors, ["global memory: unknown extras subcommand: memory"]); assert.equal(resourceProgress(one({ extras: "offline" })).incomplete, true); assert.equal(resourceProgress({ global: { extras: [], pending: ["memory"], errors: {} } }).incomplete, false); - // The Extras count is the extras that were read, not "…" for good; a memory read still running holds it. + // Notes are not counted, so the memory read never holds the Extras count; the extras read does. assert.equal(memory.unknown.has("extras"), false); - assert.equal(resourceProgress({ global: { extras: [], pending: ["memory"], errors: {} } }).unknown.has("extras"), true); + assert.equal(resourceProgress({ global: { extras: [], pending: ["memory"], errors: {} } }).unknown.has("extras"), false); + assert.equal(resourceProgress({ global: { extras: [], memory: { root: "/m", notes: [{ path: "a.md" }] }, pending: [], errors: { memory: "timed out" } } }).unknown.has("extras"), false); assert.equal(resourceProgress(one({ extras: "offline" })).unknown.has("extras"), true); - // Notes kept from an earlier read are not confirmed by a read that failed, so the count waits. - const stale = resourceProgress({ global: { extras: [], memory: { root: "/m", notes: [{ path: "a.md" }] }, pending: [], errors: { memory: "timed out" } } }); - assert.deepEqual([stale.unknown.has("extras"), stale.incomplete], [true, false]); }); // ---- Detached jobs (START, ALIVE) ---- diff --git a/herdr/tests/render.test.mjs b/herdr/tests/render.test.mjs index 0a79706ec..3e3538938 100644 --- a/herdr/tests/render.test.mjs +++ b/herdr/tests/render.test.mjs @@ -197,6 +197,21 @@ test("the preview of an extra whose source is missing says so in every tab, with assert.doesNotMatch(targets, /In sync with/); }); +test("memory notes are listed apart from the extras, without a sync state or a count", async () => { + const { view } = await panel(); + view.kind = "extras"; + view.raw = { global: { list: [], diff: { targets: [] }, targets: ["claude"], pending: ["memory"], errors: {}, + extras: [{ name: "memory", source_dir: "/src/memory", source_exists: true, file_count: 2, targets: [] }], + memory: { root: "/src/memory", notes: [{ path: "INDEX.md" }, { path: "LEARNED.md" }] } } }; + view.rebuild(); + const library = label(view.renderLibrary({}, view.ctx)); + assert.match(library, /Extras 1/); + assert.match(library, /IN SYNC · 1/); + assert.match(library, /MEMORY NOTES · 2/); + assert.match(library, /LEARNED\.md/); + assert.doesNotMatch(library, /sync status unknown/); +}); + test("an extra's preview shows its frontmatter above the document, and highlights the file it shows", async () => { const { view } = await panel({ role: "preview" }, { TextView: { markdown: element }, loadPreview: async () => ({ files: ["SKILL.md", "rules.md"], file: "rules.md", dir: "/src/rules", meta: [{ key: "paths", value: "src/**" }], body: "Body" }) }); diff --git a/website/docs/learn/with-herdr.md b/website/docs/learn/with-herdr.md index 9983bdf25..606b0aa8a 100644 --- a/website/docs/learn/with-herdr.md +++ b/website/docs/learn/with-herdr.md @@ -58,7 +58,7 @@ A panel installed before this button existed has no update check. Copy `mods/ski The panel follows the space Herdr shows. It runs skillshare on that space's machine, in the focused terminal's folder. - **Overview** answers first: *Everything is in sync*, or how many targets need one, with a single Sync button. Under it, a count of each kind in the source and a line to every target show which ones are waiting. The rest of the tab lists only what needs you: what waits for a sync, what has an update, hook notices, and extras whose source is missing. In a project with `.skillshare/config.yaml`, an All · Project · Global switch beside the tabs picks the scope. -- **Library** lists skills, agents, MCP servers, plugins, hooks and extras (file and folder extras, and memory notes), grouped into *Needs sync*, *Update available*, *In sync* and *Off* for disabled entries. For skills and agents, *In sync* groups entries from the same repository into collapsible rows; switch to List for a flat list. +- **Library** lists skills, agents, MCP servers, plugins, hooks and extras (file and folder extras), grouped into *Needs sync*, *Update available*, *In sync* and *Off* for disabled entries. Memory notes are listed on their own under the extras, without a sync state. For skills and agents, *In sync* groups entries from the same repository into collapsible rows; switch to List for a flat list. - **Rows** open a preview. A skill shows its `SKILL.md` and files, an MCP server its settings with secret values hidden, an extra its file or a folder's files, and the preview's Targets tab shows the state per target. Skills and agents offer Update, Diff, Disable (or Enable for a disabled one; the next sync applies it), Uninstall, and *Ask <agent> to audit…*, which sends the item to the focused Herdr agent after you confirm. Top-level declared hooks offer Enable, Disable and Remove, each after confirmation; Sync applies the saved changes. - Hook counts include named entries and pending cleanup; diagnostic notices get rows of their own. Hook conflicts block syncing all resource kinds until resolved in the CLI or dashboard. If the plan cannot be read, entries show unknown sync status outside the groups. - **Install** takes a repository URL. A repository with several skills shows a pick list. The panel clones it, runs [`skillshare audit`](/docs/reference/commands/audit) on the clone, and installs only when the audit passes. A blocked audit shows the findings, with *Install anyway* (`--force`) and *Ask <agent> to review…*. diff --git a/website/i18n/ja/docusaurus-plugin-content-docs/current/learn/with-herdr.md b/website/i18n/ja/docusaurus-plugin-content-docs/current/learn/with-herdr.md index 9d4031a26..9eb9d4592 100644 --- a/website/i18n/ja/docusaurus-plugin-content-docs/current/learn/with-herdr.md +++ b/website/i18n/ja/docusaurus-plugin-content-docs/current/learn/with-herdr.md @@ -58,7 +58,7 @@ Read ~/.config/herdr-app/AGENTS.md, then add this layout: herdr.dev/layouts/runk パネルは Herdr が表示している space に追従し、その space のマシン上で、フォーカス中のターミナルのフォルダで skillshare を実行します。 - **Overview** は最初に答えを示します。「Everything is in sync」か、同期が必要なターゲットの数と、1 つの Sync ボタンです。その下には、source にある各種類の件数と各ターゲットへの 1 行が並び、どれが待機中かがわかります。タブの残りには、対応が必要なものだけを表示します。同期待ちのもの、更新があるもの、hooks の通知、ソースが見つからない extras です。`.skillshare/config.yaml` のあるプロジェクトでは、タブの横にある All · Project · Global でスコープを選べます。 -- **Library** は skills、agents、MCP サーバー、plugins、hooks、extras(ファイルとフォルダーの extras、メモリノート)を「Needs sync」「Update available」「In sync」に分け、無効な項目は「Off」にまとめて表示します。skills と agents では、「In sync」が同じリポジトリの項目を折りたためるグループにまとめます。List に切り替えると一覧表示になります。 +- **Library** は skills、agents、MCP サーバー、plugins、hooks、extras(ファイルとフォルダーの extras)を「Needs sync」「Update available」「In sync」に分け、無効な項目は「Off」にまとめて表示します。メモリノートは同期状態を持たないため、extras の下に別にまとめて表示します。skills と agents では、「In sync」が同じリポジトリの項目を折りたためるグループにまとめます。List に切り替えると一覧表示になります。 - **行**を開くとプレビューが表示されます。skill では `SKILL.md` とファイル、MCP サーバーでは秘密の値を隠した設定、extra ではそのファイルまたはフォルダー内のファイルが見られ、プレビューの Targets タブはターゲットごとの状態を示します。skills と agents には Update、Diff、Disable(無効なものには Enable。次の sync で反映されます)、Uninstall と「Ask <agent> to audit…」があり、確認後にその項目を Herdr でフォーカス中のエージェントに渡します。トップレベルで宣言された hooks には Enable、Disable、Remove があり、それぞれ確認後に保存され、Sync で適用されます。 - hooks の件数には名前付きエントリと削除待ちが含まれ、診断通知は専用の行で表示されます。hooks の競合は CLI またはダッシュボードで解決するまで全種類の同期をブロックします。プランを読み取れない場合、エントリは同期状態が不明としてグループ外に表示されます。 - **Install** はリポジトリ URL を受け取ります。複数の skills を含むリポジトリでは一覧から選べます。パネルはクローンに対して [`skillshare audit`](/docs/reference/commands/audit) を実行し、通過した場合だけインストールします。audit でブロックされると findings を表示し、「Install anyway」(`--force`)と「Ask <agent> to review…」を提示します。 diff --git a/website/i18n/ko/docusaurus-plugin-content-docs/current/learn/with-herdr.md b/website/i18n/ko/docusaurus-plugin-content-docs/current/learn/with-herdr.md index d03932032..52683e812 100644 --- a/website/i18n/ko/docusaurus-plugin-content-docs/current/learn/with-herdr.md +++ b/website/i18n/ko/docusaurus-plugin-content-docs/current/learn/with-herdr.md @@ -58,7 +58,7 @@ Read ~/.config/herdr-app/AGENTS.md, then add this layout: herdr.dev/layouts/runk 패널은 Herdr가 보여 주는 space를 따라가며, 그 space의 머신에서 포커스된 터미널의 폴더를 기준으로 skillshare를 실행합니다. - **Overview**는 먼저 답을 보여 줍니다. "Everything is in sync"이거나, 동기화가 필요한 타깃의 수와 Sync 버튼 하나입니다. 그 아래에는 source에 있는 종류별 개수와 각 타깃으로 이어지는 줄이 있어 어느 타깃이 대기 중인지 알 수 있습니다. 탭의 나머지에는 처리가 필요한 것만 나열합니다. 동기화를 기다리는 항목, 업데이트가 있는 항목, hooks 알림, 소스가 없는 extras입니다. `.skillshare/config.yaml`이 있는 프로젝트에서는 탭 옆의 All · Project · Global로 범위를 고릅니다. -- **Library**는 skills, agents, MCP 서버, plugins, hooks, extras(파일·폴더 extras와 메모리 노트)를 "Needs sync", "Update available", "In sync"로 나누고, 비활성화된 항목은 "Off"로 묶어 보여 줍니다. skills와 agents는 "In sync"에서 같은 저장소의 항목을 접을 수 있는 그룹으로 묶으며, List로 바꾸면 목록으로 보여 줍니다. +- **Library**는 skills, agents, MCP 서버, plugins, hooks, extras(파일·폴더 extras)를 "Needs sync", "Update available", "In sync"로 나누고, 비활성화된 항목은 "Off"로 묶어 보여 줍니다. 메모리 노트는 동기화 상태가 없으므로 extras 아래에 따로 보여 줍니다. skills와 agents는 "In sync"에서 같은 저장소의 항목을 접을 수 있는 그룹으로 묶으며, List로 바꾸면 목록으로 보여 줍니다. - **행**을 열면 미리보기가 나타납니다. skill은 `SKILL.md`와 파일을, MCP 서버는 비밀 값을 가린 설정을, extra는 그 파일이나 폴더 안의 파일을 보여 주고, 미리보기의 Targets 탭은 타깃별 상태를 보여 줍니다. skills와 agents에는 Update, Diff, Disable(비활성화된 항목은 Enable, 다음 sync에서 적용), Uninstall, 그리고 확인 후 해당 항목을 Herdr에서 포커스된 에이전트에 넘기는 "Ask <agent> to audit…"가 있습니다. 최상위에 선언된 hooks는 확인 후 Enable, Disable, Remove를 제공하며, 저장된 변경은 Sync로 적용합니다. - hooks 개수에는 이름이 있는 항목과 정리 대기 항목이 포함되며, 진단 알림은 별도의 행으로 표시됩니다. hooks 충돌은 CLI나 대시보드에서 해결할 때까지 모든 리소스의 동기화를 차단합니다. 계획을 읽을 수 없으면 항목은 그룹 밖에서 동기화 상태를 알 수 없음으로 표시됩니다. - **Install**은 저장소 URL을 받습니다. skills가 여러 개인 저장소는 목록에서 고를 수 있습니다. 패널은 클론에 [`skillshare audit`](/docs/reference/commands/audit)을 실행하고 통과한 경우에만 설치합니다. audit에 막히면 findings와 함께 "Install anyway"(`--force`)와 "Ask <agent> to review…"를 보여 줍니다. diff --git a/website/i18n/zh-Hans/docusaurus-plugin-content-docs/current/learn/with-herdr.md b/website/i18n/zh-Hans/docusaurus-plugin-content-docs/current/learn/with-herdr.md index bf1537d0f..da0de4eca 100644 --- a/website/i18n/zh-Hans/docusaurus-plugin-content-docs/current/learn/with-herdr.md +++ b/website/i18n/zh-Hans/docusaurus-plugin-content-docs/current/learn/with-herdr.md @@ -57,8 +57,8 @@ tab bar 会出现 **skillshare** 按钮,用来显示或隐藏面板。切换 s 面板跟随 Herdr 显示的 space,在该 space 的机器上、聚焦中 terminal 的文件夹里运行 skillshare。 -- **Overview** 先给出答案:“Everything is in sync”,或者有多少个 target 需要同步,并提供一个 Sync 按钮。下面列出 source 中每种资源的数量,以及通向每个 target 的一行,可以看出哪些 target 在等待同步。标签页其余部分只列出需要你处理的内容:等待同步的、有更新的、hooks 通知,以及源文件缺失的 extras。在有 `.skillshare/config.yaml` 的项目中,标签页旁边的 All · Project · Global 可以切换 scope。 -- **Library** 列出 skills、agents、MCP servers、plugins、hooks 和 extras(文件和文件夹 extras,以及 memory 笔记),分为“Needs sync”“Update available”“In sync”三组,已禁用的项目归入“Off”。对于 skills 和 agents,“In sync”会把同一个仓库的项目收进可折叠的分组;切换到 List 则显示为平铺列表。 +- **Overview** 先给出答案:“Everything is in sync”,或者有多少个 target 需要同步,并提供一个 Sync 按钮。下面列出 source 中每种资源的数量,以及通向每个 target 的一行,可以看出哪些 target 在等待同步。标签页其余部分只列出需要你处理的内容:等待同步的、有更新的、hooks 通知,以及来源缺失的 extras。在有 `.skillshare/config.yaml` 的项目中,标签页旁边的 All · Project · Global 可以切换 scope。 +- **Library** 列出 skills、agents、MCP servers、plugins、hooks 和 extras(文件和文件夹 extras),分为“Needs sync”“Update available”“In sync”三组,已禁用的项目归入“Off”。memory 笔记没有同步状态,单独列在 extras 下方。对于 skills 和 agents,“In sync”会把同一个仓库的项目收进可折叠的分组;切换到 List 则显示为平铺列表。 - **行**会打开预览。skill 显示其 `SKILL.md` 和文件,MCP server 显示隐藏了密钥值的设置,extra 显示其文件或文件夹中的文件,预览的 Targets 标签页显示各 target 的状态。skills 和 agents 提供 Update、Diff、Disable(已禁用的则是 Enable;下次 sync 时应用)、Uninstall,以及“Ask <agent> to audit…”:确认后把该项交给 Herdr 中聚焦的 agent。顶层声明的 hooks 提供 Enable、Disable 和 Remove,每项都先确认;Sync 会应用保存的更改。 - hooks 计数包含具名条目和待清理条目;诊断通知有单独的行。hooks 冲突会阻止所有资源同步,需先在 CLI 或仪表板中解决。无法读取计划时,条目会在分组外显示同步状态未知。 - **Install** 接受仓库 URL。包含多个 skills 的仓库会列出清单供你挑选。面板会先 clone,对 clone 运行 [`skillshare audit`](/docs/reference/commands/audit),通过才安装。audit 拦下时会显示 findings,并提供“Install anyway”(`--force`)和“Ask <agent> to review…”。 diff --git a/website/i18n/zh-Hant/docusaurus-plugin-content-docs/current/learn/with-herdr.md b/website/i18n/zh-Hant/docusaurus-plugin-content-docs/current/learn/with-herdr.md index 3dde2610c..c852ac1f4 100644 --- a/website/i18n/zh-Hant/docusaurus-plugin-content-docs/current/learn/with-herdr.md +++ b/website/i18n/zh-Hant/docusaurus-plugin-content-docs/current/learn/with-herdr.md @@ -58,7 +58,7 @@ tab bar 會出現 **skillshare** 按鈕,用來顯示或隱藏面板。切換 s 面板跟著 Herdr 顯示的 space 走,在該 space 的機器上、聚焦中 terminal 的資料夾裡執行 skillshare。 - **Overview** 先給出答案:「Everything is in sync」,或是有多少個 target 需要同步,並提供一個 Sync 按鈕。下面列出 source 中每種資源的數量,以及通往每個 target 的一列,可以看出哪些 target 在等待同步。分頁其餘部分只列出需要你處理的內容:等待同步的、有更新的、hooks 通知,以及來源遺失的 extras。在有 `.skillshare/config.yaml` 的專案裡,分頁旁邊的 All · Project · Global 可以切換 scope。 -- **Library** 列出 skills、agents、MCP servers、plugins、hooks 和 extras(檔案和資料夾 extras,以及 memory 筆記),分成「Needs sync」、「Update available」、「In sync」三組,已停用的項目歸入「Off」。對於 skills 和 agents,「In sync」會把同一個 repo 的項目收進可收合的分組;切換到 List 則顯示為平鋪清單。 +- **Library** 列出 skills、agents、MCP servers、plugins、hooks 和 extras(檔案和資料夾 extras),分成「Needs sync」、「Update available」、「In sync」三組,已停用的項目歸入「Off」。memory 筆記沒有同步狀態,另外列在 extras 下方。對於 skills 和 agents,「In sync」會把同一個 repo 的項目收進可收合的分組;切換到 List 則顯示為平鋪清單。 - **列**會開啟預覽。skill 顯示其 `SKILL.md` 和檔案,MCP server 顯示隱藏了機密值的設定,extra 顯示其檔案或資料夾中的檔案,預覽的 Targets 分頁顯示各 target 的狀態。skills 和 agents 提供 Update、Diff、Disable(已停用的則是 Enable;下次 sync 時套用)、Uninstall,以及「Ask <agent> to audit…」:確認後把該項目交給 Herdr 中聚焦的 agent。頂層宣告的 hooks 提供 Enable、Disable 和 Remove,每項都先確認;Sync 會套用儲存的變更。 - hooks 計數包含具名項目和待清理項目;診斷通知有獨立的列。hooks 衝突會阻止所有資源同步,需先在 CLI 或儀表板中解決。無法讀取計畫時,項目會在分組外顯示同步狀態未知。 - **Install** 接受 repository URL。含多個 skills 的 repository 會列出清單讓你挑選。面板會先 clone,對 clone 執行 [`skillshare audit`](/docs/reference/commands/audit),通過才安裝。audit 擋下時會顯示 findings,並提供「Install anyway」(`--force`)和「Ask <agent> to review…」。