diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index c3f4de814..39c26a77d 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -43,6 +43,9 @@ jobs: - name: Check AI context routes run: python3 scripts/ai-context.py check + - name: Herdr mod tests + run: make test-herdr + - name: Set up Go uses: actions/setup-go@v5 with: diff --git a/AGENTS.md b/AGENTS.md index b95f502b9..7eef3a107 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -54,7 +54,7 @@ The router runs on the host and needs only Python 3.8+. On Windows, use `py` or | `cli-development` | Adding or changing Go CLI commands, flags, handlers, TUIs, or mutating behavior | | `testing` | Building, testing, reproducing bugs, or using the devcontainer/ssenv | | `e2e-runbooks` | Writing or running `ai_docs/tests` E2E runbooks, or verifying on a Windows guest | -| `frontend` | Changing React, CSS, layout, or visual behavior in `ui/` or `website/` | +| `frontend` | Changing React, CSS, layout, or visual behavior in `ui/`, `website/`, or `herdr/` | | `documentation` | Updating README files, website docs, command flags, translations, or the built-in skill | | `release` | Writing changelogs or release notes, bumping versions, tagging, or releasing | | `audit` | Read-only consistency checks for flags, docs, tests, targets, handler splits, oplog, or Web API | diff --git a/Makefile b/Makefile index 1c8b8a780..f89b9d735 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -.PHONY: help build build-meta build-windows run test test-unit test-int test-docker test-docker-online test-redteam test-redteam-signal test-redteam-rules-signal playground playground-down devc devc-up devc-down devc-restart devc-reset devc-status dev-docker dev-docker-down docker-build docker-build-multiarch lint fmt fmt-check docs-check check install clean ui-install ui-build ui-dev build-all verify verify-shell verify-down verify-status verify-reset +.PHONY: help build build-meta build-windows run test test-herdr test-unit test-int test-docker test-docker-online test-redteam test-redteam-signal test-redteam-rules-signal playground playground-down devc devc-up devc-down devc-restart devc-reset devc-status dev-docker dev-docker-down docker-build docker-build-multiarch lint fmt fmt-check docs-check check install clean ui-install ui-build ui-dev build-all verify verify-shell verify-down verify-status verify-reset help: @echo "Common tasks:" @@ -7,6 +7,7 @@ help: @echo " make test # unit + integration tests" @echo " make test-unit # unit tests only" @echo " make test-int # integration tests only" + @echo " make test-herdr # Herdr panel mod tests (node)" @echo " make test-docker # docker offline sandbox (build + unit + integration)" @echo " make test-docker-online # docker online install/update tests" @echo " make test-redteam # red team supply-chain security tests" @@ -143,7 +144,10 @@ fmt-check: docs-check: python3 scripts/ai-context.py check -check: docs-check fmt-check lint test +test-herdr: + node --test herdr/tests/*.test.mjs + +check: docs-check fmt-check lint test test-herdr install: go install ./cmd/skillshare diff --git a/README-de.md b/README-de.md index 3d89bbe3f..80b47b973 100644 --- a/README-de.md +++ b/README-de.md @@ -279,6 +279,10 @@ skillshare commit --dry-run skillshare ui ``` +**Herdr-Panel** — skillshare neben deinen Agents in [Herdr](https://herdr.dev): Updates, Sync, geprüfte Installationen und das Quell-Repository in einem Panel + +[Herdr-Panel einrichten →](https://skillshare.runkids.cc/docs/learn/with-herdr) + [Alle Befehle und Anleitungen →](https://skillshare.runkids.cc/docs/reference/commands) ## Mitwirken diff --git a/README-es.md b/README-es.md index 7679b4997..40e6a67a6 100644 --- a/README-es.md +++ b/README-es.md @@ -279,6 +279,10 @@ skillshare commit --dry-run skillshare ui ``` +**Panel de Herdr** — skillshare junto a tus agentes en [Herdr](https://herdr.dev): actualizaciones, sync, instalaciones auditadas y el repositorio fuente en un solo panel + +[Configurar el panel de Herdr →](https://skillshare.runkids.cc/docs/learn/with-herdr) + [Todos los comandos y guías →](https://skillshare.runkids.cc/docs/reference/commands) ## Contribuir diff --git a/README-fr.md b/README-fr.md index 07a314869..1b205ec70 100644 --- a/README-fr.md +++ b/README-fr.md @@ -279,6 +279,10 @@ skillshare commit --dry-run skillshare ui ``` +**Panneau Herdr** — skillshare à côté de vos agents dans [Herdr](https://herdr.dev) : mises à jour, sync, installations auditées et dépôt source dans un seul panneau + +[Configurer le panneau Herdr →](https://skillshare.runkids.cc/docs/learn/with-herdr) + [Toutes les commandes et guides →](https://skillshare.runkids.cc/docs/reference/commands) ## Contribuer diff --git a/README-ja.md b/README-ja.md index d2c80c716..0b1f79e41 100644 --- a/README-ja.md +++ b/README-ja.md @@ -278,6 +278,10 @@ skillshare commit --dry-run skillshare ui ``` +**Herdr パネル** — [Herdr](https://herdr.dev) のエージェントの横に skillshare:更新、sync、監査付きインストール、ソースリポジトリを 1 つのパネルで + +[Herdr パネルを設定 →](https://skillshare.runkids.cc/docs/learn/with-herdr) + [すべてのコマンドとガイド →](https://skillshare.runkids.cc/docs/reference/commands) ## コントリビュート diff --git a/README-ko.md b/README-ko.md index 5b9272664..1e76d280d 100644 --- a/README-ko.md +++ b/README-ko.md @@ -278,6 +278,10 @@ skillshare commit --dry-run skillshare ui ``` +**Herdr 패널** — [Herdr](https://herdr.dev)의 에이전트 옆에 skillshare: 업데이트, sync, 감사를 거친 설치, 소스 저장소를 한 패널에서 + +[Herdr 패널 설정 →](https://skillshare.runkids.cc/docs/learn/with-herdr) + [모든 명령과 가이드 →](https://skillshare.runkids.cc/docs/reference/commands) ## 기여하기 diff --git a/README-pt-BR.md b/README-pt-BR.md index bf6a62880..f07a367ab 100644 --- a/README-pt-BR.md +++ b/README-pt-BR.md @@ -279,6 +279,10 @@ skillshare commit --dry-run skillshare ui ``` +**Painel do Herdr** — skillshare ao lado dos seus agentes no [Herdr](https://herdr.dev): atualizações, sync, instalações auditadas e o repositório de origem em um só painel + +[Configurar o painel do Herdr →](https://skillshare.runkids.cc/docs/learn/with-herdr) + [Todos os comandos e guias →](https://skillshare.runkids.cc/docs/reference/commands) ## Contribuindo diff --git a/README-zh-CN.md b/README-zh-CN.md index baf1da1d4..99c378cf6 100644 --- a/README-zh-CN.md +++ b/README-zh-CN.md @@ -278,6 +278,10 @@ skillshare commit --dry-run skillshare ui ``` +**Herdr 面板** — 在 [Herdr](https://herdr.dev) 的 agents 旁边使用 skillshare:更新、sync、经过审计的安装和 source 仓库都在一个面板里 + +[设置 Herdr 面板 →](https://skillshare.runkids.cc/docs/learn/with-herdr) + [所有命令与指南 →](https://skillshare.runkids.cc/docs/reference/commands) ## 参与贡献 diff --git a/README-zh-TW.md b/README-zh-TW.md index c1bbe6275..b38b2b6d9 100644 --- a/README-zh-TW.md +++ b/README-zh-TW.md @@ -278,6 +278,10 @@ skillshare commit --dry-run skillshare ui ``` +**Herdr 面板** — 在 [Herdr](https://herdr.dev) 的 agents 旁使用 skillshare:更新、sync、經過 audit 的安裝和 source repository 都在一個面板裡 + +[設定 Herdr 面板 →](https://skillshare.runkids.cc/docs/learn/with-herdr) + [所有指令與指南 →](https://skillshare.runkids.cc/docs/reference/commands) ## 參與貢獻 diff --git a/README.md b/README.md index 26cedfb15..6de23dfca 100644 --- a/README.md +++ b/README.md @@ -280,6 +280,10 @@ skillshare commit --dry-run skillshare ui ``` +**Herdr panel** — skillshare beside your agents in [Herdr](https://herdr.dev): updates, sync, audited installs and the source repo in one panel + +[Set up the Herdr panel →](https://skillshare.runkids.cc/docs/learn/with-herdr) + [All commands & guides →](https://skillshare.runkids.cc/docs/reference/commands) ## Contributing diff --git a/herdr/.gitignore b/herdr/.gitignore new file mode 100644 index 000000000..15a4e3460 --- /dev/null +++ b/herdr/.gitignore @@ -0,0 +1,2 @@ +gpui-kit.d.ts +jsconfig.json diff --git a/herdr/AGENTS.md b/herdr/AGENTS.md new file mode 100644 index 000000000..05e2c856b --- /dev/null +++ b/herdr/AGENTS.md @@ -0,0 +1,10 @@ +# AGENTS.md — herdr/ + +A Herdr mod and layout for skillshare. Herdr runs mods in QuickJS with its own UI kit; nothing here is part of the Go build. + +- `skillshare/` is one share folder: `RECIPE.md`, `preview.png`, `layouts/herdr-skillshare.json` (+ its png) and `mods/skillshare/`. +- `mods/skillshare/model.js` has no Herdr imports, so `herdr/tests/*.test.mjs` cover it with `make test-herdr` (part of `make check` and CI). Put new parsing there and test it. +- `main.js` imports `herdr`; check it with `herdr-app check ` on a machine with Herdr. QuickJS rejects `??` mixed with `||`/`&&` without parentheses, which node accepts. +- Use Herdr theme tokens only. Never keep a `cx` past its callback, call `setShared`/`notify` during render, or pass `null` to `.child`. +- `model.js` reads the CLI's `--json` output and mirrors `internal/install/metadata_merge.go`. Change both sides together. +- Keep `README.md`, `RECIPE.md` and the code in step. `RECIPE.md` describes only what the build does; `preview.png` is the design board's Main page, not a capture of private data. diff --git a/herdr/skillshare/README.md b/herdr/skillshare/README.md new file mode 100644 index 000000000..068e90120 --- /dev/null +++ b/herdr/skillshare/README.md @@ -0,0 +1,45 @@ +# skillshare for Herdr + +A Herdr panel for the skillshare CLI. It shows what the focused space's project and the +global source hold and what needs an update or a sync. It updates, syncs, installs from a +URL, uninstalls, hands an audit to the focused agent, syncs the source repository both +ways, and shows each Herdr machine's skillshare on a Machines tab. + +## Install + +1. Copy `mods/skillshare/` to `~/.config/herdr-app/mods/skillshare/`. +2. Copy `layouts/herdr-skillshare.json` and `layouts/herdr-skillshare.png` to + `~/.config/herdr-app/layouts/` and switch to it (`layout.switch {name: "herdr-skillshare"}`). + `RECIPE.md` describes it in full and `preview.png` shows it. Or, in your own layout, add: + - a toggle block to the tab bar row: + `{ "id": "skillshare-toggle", "type": "block", "content": { "mod": "skillshare", "props": { "role": "toggle" } }, "size": { "px": 118 } }` + - a column beside the work area: + `{ "id": "skillshare-panel", "type": "column", "children": [{ "id": "skillshare", "type": "block", "content": { "mod": "skillshare" } }], "size": { "px": 400 }, "min": 320, "max": 720 }` +3. Run `herdr-app check ~/.config/herdr-app/mods/skillshare`. + +The panel lives in its own layout node instead of the per-space `panel` stack. Herdr's tabs mod +restores that stack per space, so a panel there closes when you switch spaces. This node's +shown or hidden state is a layout click, which Herdr keeps across spaces and restarts. + +## How it reads + +- It runs on the shown space's machine (`exec` with `on`), in the focused terminal's folder. +- A folder with `.skillshare/config.yaml` or `skillshare/config.yaml` is a project; both + scopes show and the All · Project · Global filter appears. +- Per scope, one detached script runs `list --all`, `diff`, `mcp list` and `plugin list` + with `--json`. `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 CLI's install dry-run does not list a repository's skills, so the install dialog + shallow-clones the repository to a temp folder to offer the pick list. It then runs + `skillshare audit --json` on that clone, because `install --json` names a blocked + skill but not its findings. A block shows the findings before anything is written; + "Install anyway" reruns the install with `--force`. +- The source dialog runs `skillshare pull` and `skillshare push -m`. When a pull or + `push --pull` stops on files both sides changed, the panel reads both versions with + `git show HEAD:` and `git show @{u}:`, puts the repository back, and asks + which version to keep for each file. + +## Tests + +`make test-herdr` (`node --test herdr/tests/*.test.mjs`) covers `model.js`, which has no +Herdr imports. It runs in `make check` and CI. Check `main.js` with `herdr-app check`. diff --git a/herdr/skillshare/RECIPE.md b/herdr/skillshare/RECIPE.md new file mode 100644 index 000000000..2afe0e368 --- /dev/null +++ b/herdr/skillshare/RECIPE.md @@ -0,0 +1,93 @@ +# Herdr + skillshare + +Herdr's default window with a skillshare button in the tab bar and a skillshare panel beside the work area. The panel shows what the focused space's project and your global skillshare source hold: which skills, agents, MCP servers and plugins need an update or a sync. From the panel you can update, sync, install from a URL, uninstall, ask the focused agent to audit something, and sync the source repository both ways. + +![Herdr + skillshare](preview.png) + +## What you see + +Left to right, everything as in Herdr's `main` layout, plus two blocks: + +- **Sidebar**, 268px: Herdr's own brand bar, Spaces, Agents and footer. +- **Work column**: the tab bar row, now `tabs` (weight 1) beside a 118px `skillshare-toggle` block. The toggle draws the 16px skillshare mark and "skillshare", on `selected` while the panel shows. Under it the shown tab and Herdr's Files/Changes side panel, then the status bar. +- **skillshare panel**, a 400px column (320–720px) right of the work area, top to bottom: + - a 42px header: the mark, "skillshare", the CLI version in `muted`, and a close button; + - Resources and Machines tabs, the shown one underlined in `foreground`; + - Resources: + - the project card: a folder icon, the folder name, "follows the focused pane" and the machine as a pill; outside a project, "Global" and " is not a skillshare project"; + - in a skillshare project, an All · Project · Global switch with counts for the selected kind; + - a Skills · Agents · MCP · Plugins switch with counts; + - a filter field and an Install button; + - the list, the only part that scrolls, in three groups: + - "Updates available · n" in `accent`, with Update all; + - "Needs sync · n" in `blocked`, with Sync, or Sync project / Sync global when only one scope needs it; + - "In sync · n" in `muted`. + - Each row is 48px: a dot (filled `accent`, `blocked` or `ansi2`; hollow `ansi1` when never synced or `muted` when disabled), the name, one line of detail with no target names, and a chevron. A row opens in place on `raised`. + - Machines: one card per Herdr machine, with its version, its source repository state, doctor errors and warnings when there are any, a Pull and sync button, and "Update to …" when a newer skillshare exists. + - a 34px status line while work runs, with a spinning ring in `working`, or a notice: a done notice fades after 4 s, a warning or error stays until closed, 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. +- Dialogs open as Herdr overlays: install, uninstall, audit hand-off, source repository, sync both ways, pull conflicts, update skillshare, command output. + +## How it behaves + +- The panel follows the space the window shows. It runs the CLI on that space's machine, in the focused terminal's folder or the space's folder. A folder with `.skillshare/config.yaml` or `skillshare/config.yaml` is a project. It refreshes every 20 s while shown and runs `skillshare check` every 10 minutes. It does no work while hidden. +- The toggle and the close button run `layout.toggle` / `layout.hide {id: "skillshare-panel"}`. The node's hidden state is a layout click, so the panel stays open or closed across space switches and restarts. +- Clicking a row opens it: + - skills and agents that have an update offer Update, and skills also See changes; + - skills and agents that need a sync offer Diff; + - skills and agents offer Uninstall, and "Ask to audit…" when Herdr knows an agent: the one focused, or the last one focused; + - MCP and plugin rows show their state and pending targets, with no actions; Sync handles them. +- Sync syncs the shown scope. With All, it syncs every scope that has work in the shown kind. On the Plugins tab it also runs `sync plugins`. +- Install opens a URL dialog with recent sources: + - a repository with several skills shows a pick list, marking the ones that would replace an installed skill; + - a progress view then runs Download (a shallow clone), Audit (`skillshare audit --json` on the clone) and Install; + - a blocked audit stops before anything is written and shows its findings, with "Ask to review…", Cancel and Install anyway (`--force`). +- The source dialog lists uncommitted files and offers: + - Sync both ways…; + - Pull, which stays disabled while there are uncommitted changes or nothing to pull; + - Commit and push with a commit message field when files are uncommitted, or Push n commits when only commits are waiting. +- When a pull stops on files both machines changed, the conflict dialog shows each file's two versions with the differing lines marked. You keep one version per file and then apply. `.metadata.json` merges per entry the way skillshare's own pull does, so only real files ask. +- Uninstall, the audit hand-off, conflict choices and updating skillshare itself each ask first. + +## Built from + +- `layouts/herdr-skillshare.json`: a `layout.clone` of `main` (Herdr 0.1.12, `cloned_from` recorded) with two changes: + - the tab bar block becomes `{ "id": "tabs-row", "type": "row", "size": { "px": 42 }, "resizable": false, "children": [ the tabs block with "size": { "weight": 1 }, { "id": "skillshare-toggle", "type": "block", "content": { "mod": "skillshare", "props": { "role": "toggle" } }, "size": { "px": 118 } } ] }`; + - `work-body` gains `{ "id": "skillshare-panel", "type": "column", "size": { "px": 400 }, "min": 320, "max": 720, "children": [{ "id": "skillshare", "type": "block", "content": { "mod": "skillshare" } }] }`. + - Root `"preview": "layouts/herdr-skillshare.png"` is the picture Settings shows. +- `mods/skillshare/`: + - `main.js` holds the panel and its roles (`props.role`): the panel by default, `toggle`, and the dialogs. + - `model.js` holds the parsing and the shell scripts, with no Herdr imports. + - `mark.svg` is the 16px mark, and `icons/` holds the stroke icons. +- Herdr functions: + - `exec` with `on`; + - `readTextFile`; + - `spaces`, `focused`, `machines`, `agents`, `layout`; + - `shared` / `setShared`, `settings`, `theme`, `props`; + - `openOverlay` / `closeOverlay`, `nextCommand`, `run`, `hc`. +- Commands: `layout.toggle`, `layout.hide`, `agent.focus`. +- Programs: + - `skillshare` (found in `~/.local/bin`, `~/go/bin`, `/opt/homebrew/bin` or `/usr/local/bin`); + - `git`, which clones the install URL you type from the network; + - `sh`, `mktemp` and `rm` for temp folders (`rm -rf` only on folders it made with `mktemp -d`); + - `hc send` for the audit hand-off. +- Files read: only the temp folders it made, through `readTextFile`. +- Its look is Herdr's: theme tokens only, no theme or fonts of its own. + +## Watch out + +- Herdr stops an `exec` after 30 s. Long commands (the list snapshot, check, doctor, install, update, sync, pull, push, upgrade) run detached into a temp folder on that machine, and the panel polls for their exit code. +- The CLI has no JSON for git state. Git state comes from `git status --porcelain=v1 --branch`. +- The CLI's install dry-run does not list a repository's skills, and `install --json` names a blocked skill without its findings. That is why the install dialog clones and audits on its own. +- `install --json` overwrites a skill of the same name. The dialog asks before replacing one. +- Keep the panel out of the `panel` stack. Herdr's tabs mod restores that stack per space, so a panel there closes on every space switch. +- QuickJS rejects `??` mixed with `||` or `&&` without parentheses. `herdr-app check` catches it; `node --check` does not. +- If a `skillshare` mod is already installed, rename this one and the `mod` names in the layout. +- A layout clone is never updated: rebuild from this recipe on a new Herdr version. + +## Done when + +- `herdr-app check ~/.config/herdr-app/mods/skillshare` passes. +- `layout.switch {name: "herdr-skillshare"}` shows the layout with no `herdr-skillshare.error`. +- The tab bar shows Files, Changes and skillshare. The skillshare button shows the panel, and a second click hides it. Switching spaces keeps it as it was. +- In a skillshare project the panel shows the All · Project · Global switch with real counts. Outside one, it says the folder is not a skillshare project and shows the global source. diff --git a/herdr/skillshare/layouts/herdr-skillshare.json b/herdr/skillshare/layouts/herdr-skillshare.json new file mode 100644 index 000000000..e7d1d3767 --- /dev/null +++ b/herdr/skillshare/layouts/herdr-skillshare.json @@ -0,0 +1,229 @@ +{ + "id": "root", + "cloned_from": { + "name": "main", + "version": "0.1.12" + }, + "preview": "layouts/herdr-skillshare.png", + "type": "row", + "titlebar": "none", + "traffic_lights": [ + 12, + 16 + ], + "background": "canvas", + "terminal_padding": [ + 14, + 12 + ], + "divider": { + "width": 1, + "color": "border" + }, + "children": [ + { + "id": "sidebar", + "type": "column", + "size": { + "px": 268 + }, + "min": 44, + "max": 480, + "background": "chrome", + "resizable": false, + "children": [ + { + "id": "brand", + "type": "block", + "size": { + "px": 46 + }, + "window_drag": true, + "content": { + "mod": "workspace-chrome" + } + }, + { + "id": "sidebar-lists", + "type": "column", + "children": [ + { + "id": "spaces", + "type": "block", + "size": { + "weight": 1 + }, + "min": 90, + "content": { + "mod": "spaces" + } + }, + { + "id": "agents", + "type": "block", + "size": { + "weight": 1 + }, + "min": 90, + "content": { + "mod": "agents" + } + } + ] + }, + { + "id": "sidebar-footer", + "type": "block", + "size": { + "px": 69 + }, + "content": { + "mod": "workspace-chrome", + "props": { + "footer": true + } + } + } + ] + }, + { + "id": "work", + "type": "column", + "resizable": false, + "children": [ + { + "id": "tabs-row", + "type": "row", + "size": { + "px": 42 + }, + "resizable": false, + "children": [ + { + "id": "tabs", + "type": "block", + "size": { + "weight": 1 + }, + "window_drag": true, + "content": { + "mod": "tabs" + } + }, + { + "id": "skillshare-toggle", + "type": "block", + "content": { + "mod": "skillshare", + "props": { + "role": "toggle" + } + }, + "size": { + "px": 118 + } + } + ] + }, + { + "id": "work-body", + "type": "row", + "padding": 8, + "gap": 8, + "children": [ + { + "id": "main", + "type": "block", + "content": { + "tab": "active", + "pane": { + "gap": 8, + "radius": 10, + "background": "background", + "lone": true, + "border": { + "width": 1, + "color": "border" + }, + "focus": { + "width": 1, + "color": "accent" + }, + "header": { + "content": { + "mod": "pane" + }, + "height": 30, + "position": "top", + "reveal": "always" + } + } + } + }, + { + "id": "panel", + "type": "column", + "hidden": true, + "size": { + "px": 368 + }, + "min": 280, + "max": 900, + "children": [ + { + "id": "panel-body", + "type": "stack", + "active": "files", + "children": [ + { + "id": "files", + "type": "block", + "content": { + "mod": "files" + } + }, + { + "id": "changes", + "type": "block", + "content": { + "mod": "changes" + } + } + ] + } + ] + }, + { + "id": "skillshare-panel", + "type": "column", + "size": { + "px": 400 + }, + "min": 320, + "max": 720, + "children": [ + { + "id": "skillshare", + "type": "block", + "content": { + "mod": "skillshare" + } + } + ] + } + ] + }, + { + "id": "status", + "type": "block", + "size": { + "px": 28 + }, + "content": { + "mod": "workspace-status" + } + } + ] + } + ] +} diff --git a/herdr/skillshare/layouts/herdr-skillshare.png b/herdr/skillshare/layouts/herdr-skillshare.png new file mode 100644 index 000000000..1b0d20f74 Binary files /dev/null and b/herdr/skillshare/layouts/herdr-skillshare.png differ diff --git a/herdr/skillshare/mods/skillshare/icons/alert.svg b/herdr/skillshare/mods/skillshare/icons/alert.svg new file mode 100644 index 000000000..941c8fc2d --- /dev/null +++ b/herdr/skillshare/mods/skillshare/icons/alert.svg @@ -0,0 +1 @@ + diff --git a/herdr/skillshare/mods/skillshare/icons/both.svg b/herdr/skillshare/mods/skillshare/icons/both.svg new file mode 100644 index 000000000..8529849ab --- /dev/null +++ b/herdr/skillshare/mods/skillshare/icons/both.svg @@ -0,0 +1 @@ + diff --git a/herdr/skillshare/mods/skillshare/icons/check.svg b/herdr/skillshare/mods/skillshare/icons/check.svg new file mode 100644 index 000000000..9f8a6c7d0 --- /dev/null +++ b/herdr/skillshare/mods/skillshare/icons/check.svg @@ -0,0 +1 @@ + diff --git a/herdr/skillshare/mods/skillshare/icons/chevron-down.svg b/herdr/skillshare/mods/skillshare/icons/chevron-down.svg new file mode 100644 index 000000000..8209ab9b4 --- /dev/null +++ b/herdr/skillshare/mods/skillshare/icons/chevron-down.svg @@ -0,0 +1 @@ + diff --git a/herdr/skillshare/mods/skillshare/icons/chevron-right.svg b/herdr/skillshare/mods/skillshare/icons/chevron-right.svg new file mode 100644 index 000000000..83258263c --- /dev/null +++ b/herdr/skillshare/mods/skillshare/icons/chevron-right.svg @@ -0,0 +1 @@ + diff --git a/herdr/skillshare/mods/skillshare/icons/close.svg b/herdr/skillshare/mods/skillshare/icons/close.svg new file mode 100644 index 000000000..a03a7cfe8 --- /dev/null +++ b/herdr/skillshare/mods/skillshare/icons/close.svg @@ -0,0 +1 @@ + diff --git a/herdr/skillshare/mods/skillshare/icons/external.svg b/herdr/skillshare/mods/skillshare/icons/external.svg new file mode 100644 index 000000000..4b6f512d9 --- /dev/null +++ b/herdr/skillshare/mods/skillshare/icons/external.svg @@ -0,0 +1 @@ + diff --git a/herdr/skillshare/mods/skillshare/icons/folder.svg b/herdr/skillshare/mods/skillshare/icons/folder.svg new file mode 100644 index 000000000..37531f9fd --- /dev/null +++ b/herdr/skillshare/mods/skillshare/icons/folder.svg @@ -0,0 +1 @@ + diff --git a/herdr/skillshare/mods/skillshare/icons/git.svg b/herdr/skillshare/mods/skillshare/icons/git.svg new file mode 100644 index 000000000..b8e1318b5 --- /dev/null +++ b/herdr/skillshare/mods/skillshare/icons/git.svg @@ -0,0 +1 @@ + diff --git a/herdr/skillshare/mods/skillshare/icons/plus.svg b/herdr/skillshare/mods/skillshare/icons/plus.svg new file mode 100644 index 000000000..7bdd87486 --- /dev/null +++ b/herdr/skillshare/mods/skillshare/icons/plus.svg @@ -0,0 +1 @@ + diff --git a/herdr/skillshare/mods/skillshare/icons/ring.svg b/herdr/skillshare/mods/skillshare/icons/ring.svg new file mode 100644 index 000000000..5a1cc4d91 --- /dev/null +++ b/herdr/skillshare/mods/skillshare/icons/ring.svg @@ -0,0 +1 @@ + diff --git a/herdr/skillshare/mods/skillshare/icons/search.svg b/herdr/skillshare/mods/skillshare/icons/search.svg new file mode 100644 index 000000000..743ae5392 --- /dev/null +++ b/herdr/skillshare/mods/skillshare/icons/search.svg @@ -0,0 +1 @@ + diff --git a/herdr/skillshare/mods/skillshare/icons/shield.svg b/herdr/skillshare/mods/skillshare/icons/shield.svg new file mode 100644 index 000000000..2249102e5 --- /dev/null +++ b/herdr/skillshare/mods/skillshare/icons/shield.svg @@ -0,0 +1 @@ + diff --git a/herdr/skillshare/mods/skillshare/icons/sync.svg b/herdr/skillshare/mods/skillshare/icons/sync.svg new file mode 100644 index 000000000..f01b9e667 --- /dev/null +++ b/herdr/skillshare/mods/skillshare/icons/sync.svg @@ -0,0 +1 @@ + diff --git a/herdr/skillshare/mods/skillshare/icons/trash.svg b/herdr/skillshare/mods/skillshare/icons/trash.svg new file mode 100644 index 000000000..8e3f3674c --- /dev/null +++ b/herdr/skillshare/mods/skillshare/icons/trash.svg @@ -0,0 +1 @@ + diff --git a/herdr/skillshare/mods/skillshare/main.js b/herdr/skillshare/mods/skillshare/main.js new file mode 100644 index 000000000..9fc98a4db --- /dev/null +++ b/herdr/skillshare/mods/skillshare/main.js @@ -0,0 +1,1016 @@ +// skillshare beside your agents: what the focused space's project and your global source hold, +// what needs an update or a sync, install from a URL, and git sync of the source both ways. +// Roles (props.role): the panel (default); "toggle", the tab-bar button that shows or hides the +// layout's "skillshare-panel" node; dialogs: "install", "uninstall", "audit", "source", +// "syncboth", "conflict", "upgrade", "text". Dialogs hand long work to the panel through shared +// REQUEST, because an overlay's tasks end when it closes. Install is the exception: its dialog +// shows each step, and the install itself runs detached, so closing the dialog does not stop it. +import { View, div, image, svg } from "gpui-kit"; +import { v_flex, h_flex, InputState, Input } from "gpui-base"; +import { exec, hc, run, spaces, agents, focused, machines, shared, setShared, theme, settings, layout, openOverlay, closeOverlay, nextCommand, readTextFile, props as blockProps } from "herdr"; +import { + KINDS, SCOPES, SNAPSHOT, parseSnapshot, GIT_STATUS, PROJECT, DISCOVER, AUDIT, PREVIEW, CONFLICTS, RESOLVE, ABORT, METADATA_STAGES, METADATA_WRITE, mergeMetadata, parseStages, + parseJSON, lastLine, failure, parseGitStatus, sourceLine, buildItems, rowSub, filterItems, groupItems, counts, + cloneUrl, skillChoices, newerVersion, ago, auditMessage, driftFrom, parseDiscover, parseAudit, parsePreview, diffSides, +} from "./model.js"; + +const PANEL = "skillshare-panel"; // the layout node the toggle shows and hides; hidden state is the layout's, so it survives space switches +const NOTICE = "skillshare.notice.v1"; // { kind, text, at } +const REQUEST = "skillshare.request.v1"; // { id, op, ... }: work a dialog hands to the panel +const RECENT = "skillshare.recent.v1"; // install sources, newest first +const BUSY = "skillshare.busy.v1"; // what the panel is doing, so dialogs can wait +const POLL = 20000, CHECK_EVERY = 10 * 60 * 1000, MACHINES_POLL = 60000, NOTICE_MS = 4000; +const PATHS = 'PATH="$HOME/.local/bin:$HOME/go/bin:/opt/homebrew/bin:/usr/local/bin:$PATH"; export PATH'; + +// ---- Running skillshare on the space's machine ---- + +const sh = (script, args = [], on = null) => exec("sh", ["-c", `${PATHS}\n${script}`, "skillshare-panel", ...args], { on }) + .catch((e) => ({ code: 127, stdout: "", stderr: String(e.message ?? e) })); + +// Short reads: one exec (Herdr stops an exec after 30 s). +const ss = (args, { on = null, cwd = null } = {}) => sh('cd "$1" 2>/dev/null || cd; shift; exec skillshare "$@"', [cwd ?? "", ...args], on); + +// Work that can take longer than an exec may (update, install, push, check): started detached, +// its output kept in a temp folder on that machine, polled until it writes its exit code. +const START = 'd=$(mktemp -d); dir=$1; shift; ( cd "$dir" 2>/dev/null || cd; skillshare "$@" >"$d/out" 2>"$d/err" "$d/code" ) >/dev/null 2>&1 & printf %s "$d"'; +// The same, for a script of ours: sh -c START_SCRIPT