modified
.memory/history.md +8 -0 | @@ -387,3 +387,11 @@ | ||
| 387 | 387 | - **2026-11-15 — #113 closed** (owner); feature/113-agent-instructions merged into main (not pushed). |
| 388 | 388 | - **2026-11-15 — agent header line shortened** (owner: "ready · sandbox mini-coder-sbx · /Users/…/mini-coder · in #general, #various" far too long; branch feature/agent-header-short, no ticket): agentHeader.ts placeOf (no path; local → 'on this computer') + fewChannels (2 then +N), one line with ellipsis, full text in the tooltip. Xvfb checked. Not committed. |
| 389 | 389 | - Merged into main (owner OK). |
| 390 | + | |
| 391 | +## 2026-11-15 — #112 agent skills (branch feature/112-agent-skills) | |
| 392 | + | |
| 393 | +- Asked: "go for 112". Research: Agent Skills format everywhere; folders mm `skills/` (agent.yaml skillsDir), Claude `.claude/skills/`, Codex/Antigravity/Copilot `.agents/skills/`, Vibe `.vibe/skills/`. | |
| 394 | +- Applied #113's protection rule (no new question): skills folders protected in Files, written only by the Skills tab, never removed. | |
| 395 | +- Done: agents.SkillsDir/IsMiniMe, config.Agent.ConfigFile, WorkspaceService Skills/CreateSkill/SaveSkill/ImportSkill/ChooseSkillFolder (skills.go; frontMatter via yaml; skillFiles walk split for gocyclo), SkillsTab.svelte, lib/skills.ts (+tests). Xvfb: list, create via form, editor. make verify green. Docs EN/FR, release notes v1.7.0. Not committed; #112 open for the owner's test. | |
| 396 | +- **#112 fix** (owner: "sandbox mini-coder-sbx: mkdir: Read-only file system"): mini-me's sbxenv mounts .mm read-only and skillsDir is .mm/skills; instructions and skills are now read/written in the agent's host folder when it exists (Core.settingsWorkspaceOf), not via sbx/docker exec; mini-me <name>.md skills listed/read/saved (ReadSkill, inSkills). Test reproduces mini-coder. make verify green. | |
| 397 | +- **2026-11-15 — #112 closed** (owner); feature/112-agent-skills merged into main (not pushed). | |
| @@ -387,3 +387,11 @@ | |||
| 387 | - **2026-11-15 — #113 closed** (owner); feature/113-agent-instructions merged into main (not pushed). | 387 | - **2026-11-15 — #113 closed** (owner); feature/113-agent-instructions merged into main (not pushed). |
| 388 | - **2026-11-15 — agent header line shortened** (owner: "ready · sandbox mini-coder-sbx · /Users/…/mini-coder · in #general, #various" far too long; branch feature/agent-header-short, no ticket): agentHeader.ts placeOf (no path; local → 'on this computer') + fewChannels (2 then +N), one line with ellipsis, full text in the tooltip. Xvfb checked. Not committed. | 388 | - **2026-11-15 — agent header line shortened** (owner: "ready · sandbox mini-coder-sbx · /Users/…/mini-coder · in #general, #various" far too long; branch feature/agent-header-short, no ticket): agentHeader.ts placeOf (no path; local → 'on this computer') + fewChannels (2 then +N), one line with ellipsis, full text in the tooltip. Xvfb checked. Not committed. |
| 389 | - Merged into main (owner OK). | 389 | - Merged into main (owner OK). |
| 390 | + | ||
| 391 | +## 2026-11-15 — #112 agent skills (branch feature/112-agent-skills) | ||
| 392 | + | ||
| 393 | +- Asked: "go for 112". Research: Agent Skills format everywhere; folders mm `skills/` (agent.yaml skillsDir), Claude `.claude/skills/`, Codex/Antigravity/Copilot `.agents/skills/`, Vibe `.vibe/skills/`. | ||
| 394 | +- Applied #113's protection rule (no new question): skills folders protected in Files, written only by the Skills tab, never removed. | ||
| 395 | +- Done: agents.SkillsDir/IsMiniMe, config.Agent.ConfigFile, WorkspaceService Skills/CreateSkill/SaveSkill/ImportSkill/ChooseSkillFolder (skills.go; frontMatter via yaml; skillFiles walk split for gocyclo), SkillsTab.svelte, lib/skills.ts (+tests). Xvfb: list, create via form, editor. make verify green. Docs EN/FR, release notes v1.7.0. Not committed; #112 open for the owner's test. | ||
| 396 | +- **#112 fix** (owner: "sandbox mini-coder-sbx: mkdir: Read-only file system"): mini-me's sbxenv mounts .mm read-only and skillsDir is .mm/skills; instructions and skills are now read/written in the agent's host folder when it exists (Core.settingsWorkspaceOf), not via sbx/docker exec; mini-me <name>.md skills listed/read/saved (ReadSkill, inSkills). Test reproduces mini-coder. make verify green. | ||
| 397 | +- **2026-11-15 — #112 closed** (owner); feature/112-agent-skills merged into main (not pushed). | ||
modified
.memory/summary.md +1 -1 | @@ -28,7 +28,7 @@ What exists: | ||
| 28 | 28 | - Agent forms (#95): every conversation agent is started with `acp.Spec.Forms` (advertises `elicitation.form`); a form goes to the session named in `_meta["mm.elicitationScope"]`, else to the only session with a prompt in flight, and is shown as a `FormCard` under the answer (`form:requested`/`form:resolved`, `ChannelService.AnswerForm`); Stop cancels it. Fields rendered by `chat/FormFields.svelte`, shared with the creator. |
| 29 | 29 | - Sandbox creation assistant (#96, `SbxCreatorService`, page `CreateSbxAgent.svelte`, package `internal/sbxcreate`): catalogue of kinds (Claude `claude-agent-acp`, Antigravity (kind id `antigravity` since #108, was `gemini`) `agy acp` with kit `docker.io/sbx/antigravity`, Codex `codex-acp`, Vibe `vibe-acp` with kit `docker.io/sbx/vibe-kit`, service `mistral` — #86; Copilot `copilot --acp --stdio` with kit `docker.io/sbx/copilot-kit`, service `copilot` = a GitHub token, `Kind.Token` switches the key step to "token" texts — #103); writes `<agentsFolder>/<name>/sbxenv.yaml` (English comments) + `workspace/`; name = agent = folder = sandbox (`^[a-z][a-z0-9-]{0,31}$`); API key checked with `sbx secret ls --service`, set with `sbx secret set <service>` on stdin (never in args, files or logs). `appState.creator` is `'' | 'mini-me' | 'sbx'`. |
| 30 | 30 | - Agent icons (#100): `icon` may be `logo:<name>` (`config.LogoNames` = claude, gemini, antigravity, openai, mistral, copilot — copilot is GitHub Octicons, MIT, antigravity LobeHub Icons, MIT; drawn by `frontend/src/lib/logos.ts` from Simple Icons, CC0 — OpenAI from 13.21.0; a Go test checks both lists; unknown name = warning, shows a letter). Start progress (#98): `agent:progress` {agent, step checking|preparing|connecting, line, since} from `agents.Manager`, card `chat/StartProgress.svelte` (no log link since 2026-11-15, owner's request; `showLog` in state.svelte.ts is now unused). Assistants' @ name follows the name shown until edited, free variant from Go's `taken` list (#99). |
| 31 | -- Agent instructions (#113): an agent's instruction file is chosen from its program (`agents.InstructionsFiles`: Claude → `CLAUDE.md` then `AGENTS.md`; Antigravity → `AGENTS.md` then `GEMINI.md`; else `AGENTS.md`). `config.AlwaysProtected` = `AGENTS.md`, `CLAUDE.md`, `GEMINI.md`, `skills/**`: the Files tab may neither change nor delete them; **only the agent's Instructions tab writes an instruction file** (create from template / save with version / import), never deletes it — owner's decision amending #54. | |
| 31 | +- Agent instructions (#113): an agent's instruction file is chosen from its program (`agents.InstructionsFiles`: Claude → `CLAUDE.md` then `AGENTS.md`; Antigravity → `AGENTS.md` then `GEMINI.md`; else `AGENTS.md`). `config.AlwaysProtected` = `AGENTS.md`, `CLAUDE.md`, `GEMINI.md`, `skills/**`: the Files tab may neither change nor delete them; **only the agent's Instructions tab writes an instruction file** (create from template / save with version / import), never deletes it — owner's decision amending #54. Same rule for skills (#112): `agents.SkillsDir` (mm `skills` or its agent.yaml `skillsDir`, Claude `.claude/skills`, Vibe `.vibe/skills`, else `.agents/skills`); `.claude/skills/**`, `.agents/skills/**`, `.vibe/skills/**` are in AlwaysProtected too; only the Skills tab writes there, nothing is ever removed. | |
| 32 | 32 | - Interface language: ADR 0005 — `ui.language` defaults to `en`; every UI text is a key of `frontend/src/lib/i18n/messages.ts` (`fr` typed `Record<MessageKey,string>`, test checks keys and variables); config errors use the Go catalogue in the same language; agent titles and channel names are user data, never translated. Default config file and `examples/test-agents.yaml` are in English. |
| 33 | 33 | - Packages and data model: ADR 0003 + Amendments 1 and 2 (main at the root, only main.go imports Wails, `internal/events` with an `Emitter` interface, LRU eviction of idle agents at the limit). |
| 34 | 34 | - Frontend dependencies with **pnpm 12.11.2** and `frontend/pnpm-workspace.yaml` `supportedArchitectures` (darwin+linux): the repository folder is shared between the Mac and the Linux sandbox. Never use npm in `frontend/`. |
| @@ -28,7 +28,7 @@ What exists: | |||
| 28 | - Agent forms (#95): every conversation agent is started with `acp.Spec.Forms` (advertises `elicitation.form`); a form goes to the session named in `_meta["mm.elicitationScope"]`, else to the only session with a prompt in flight, and is shown as a `FormCard` under the answer (`form:requested`/`form:resolved`, `ChannelService.AnswerForm`); Stop cancels it. Fields rendered by `chat/FormFields.svelte`, shared with the creator. | 28 | - Agent forms (#95): every conversation agent is started with `acp.Spec.Forms` (advertises `elicitation.form`); a form goes to the session named in `_meta["mm.elicitationScope"]`, else to the only session with a prompt in flight, and is shown as a `FormCard` under the answer (`form:requested`/`form:resolved`, `ChannelService.AnswerForm`); Stop cancels it. Fields rendered by `chat/FormFields.svelte`, shared with the creator. |
| 29 | - Sandbox creation assistant (#96, `SbxCreatorService`, page `CreateSbxAgent.svelte`, package `internal/sbxcreate`): catalogue of kinds (Claude `claude-agent-acp`, Antigravity (kind id `antigravity` since #108, was `gemini`) `agy acp` with kit `docker.io/sbx/antigravity`, Codex `codex-acp`, Vibe `vibe-acp` with kit `docker.io/sbx/vibe-kit`, service `mistral` — #86; Copilot `copilot --acp --stdio` with kit `docker.io/sbx/copilot-kit`, service `copilot` = a GitHub token, `Kind.Token` switches the key step to "token" texts — #103); writes `<agentsFolder>/<name>/sbxenv.yaml` (English comments) + `workspace/`; name = agent = folder = sandbox (`^[a-z][a-z0-9-]{0,31}$`); API key checked with `sbx secret ls --service`, set with `sbx secret set <service>` on stdin (never in args, files or logs). `appState.creator` is `'' | 'mini-me' | 'sbx'`. | 29 | - Sandbox creation assistant (#96, `SbxCreatorService`, page `CreateSbxAgent.svelte`, package `internal/sbxcreate`): catalogue of kinds (Claude `claude-agent-acp`, Antigravity (kind id `antigravity` since #108, was `gemini`) `agy acp` with kit `docker.io/sbx/antigravity`, Codex `codex-acp`, Vibe `vibe-acp` with kit `docker.io/sbx/vibe-kit`, service `mistral` — #86; Copilot `copilot --acp --stdio` with kit `docker.io/sbx/copilot-kit`, service `copilot` = a GitHub token, `Kind.Token` switches the key step to "token" texts — #103); writes `<agentsFolder>/<name>/sbxenv.yaml` (English comments) + `workspace/`; name = agent = folder = sandbox (`^[a-z][a-z0-9-]{0,31}$`); API key checked with `sbx secret ls --service`, set with `sbx secret set <service>` on stdin (never in args, files or logs). `appState.creator` is `'' | 'mini-me' | 'sbx'`. |
| 30 | - Agent icons (#100): `icon` may be `logo:<name>` (`config.LogoNames` = claude, gemini, antigravity, openai, mistral, copilot — copilot is GitHub Octicons, MIT, antigravity LobeHub Icons, MIT; drawn by `frontend/src/lib/logos.ts` from Simple Icons, CC0 — OpenAI from 13.21.0; a Go test checks both lists; unknown name = warning, shows a letter). Start progress (#98): `agent:progress` {agent, step checking|preparing|connecting, line, since} from `agents.Manager`, card `chat/StartProgress.svelte` (no log link since 2026-11-15, owner's request; `showLog` in state.svelte.ts is now unused). Assistants' @ name follows the name shown until edited, free variant from Go's `taken` list (#99). | 30 | - Agent icons (#100): `icon` may be `logo:<name>` (`config.LogoNames` = claude, gemini, antigravity, openai, mistral, copilot — copilot is GitHub Octicons, MIT, antigravity LobeHub Icons, MIT; drawn by `frontend/src/lib/logos.ts` from Simple Icons, CC0 — OpenAI from 13.21.0; a Go test checks both lists; unknown name = warning, shows a letter). Start progress (#98): `agent:progress` {agent, step checking|preparing|connecting, line, since} from `agents.Manager`, card `chat/StartProgress.svelte` (no log link since 2026-11-15, owner's request; `showLog` in state.svelte.ts is now unused). Assistants' @ name follows the name shown until edited, free variant from Go's `taken` list (#99). |
| 31 | -- Agent instructions (#113): an agent's instruction file is chosen from its program (`agents.InstructionsFiles`: Claude → `CLAUDE.md` then `AGENTS.md`; Antigravity → `AGENTS.md` then `GEMINI.md`; else `AGENTS.md`). `config.AlwaysProtected` = `AGENTS.md`, `CLAUDE.md`, `GEMINI.md`, `skills/**`: the Files tab may neither change nor delete them; **only the agent's Instructions tab writes an instruction file** (create from template / save with version / import), never deletes it — owner's decision amending #54. | 31 | +- Agent instructions (#113): an agent's instruction file is chosen from its program (`agents.InstructionsFiles`: Claude → `CLAUDE.md` then `AGENTS.md`; Antigravity → `AGENTS.md` then `GEMINI.md`; else `AGENTS.md`). `config.AlwaysProtected` = `AGENTS.md`, `CLAUDE.md`, `GEMINI.md`, `skills/**`: the Files tab may neither change nor delete them; **only the agent's Instructions tab writes an instruction file** (create from template / save with version / import), never deletes it — owner's decision amending #54. Same rule for skills (#112): `agents.SkillsDir` (mm `skills` or its agent.yaml `skillsDir`, Claude `.claude/skills`, Vibe `.vibe/skills`, else `.agents/skills`); `.claude/skills/**`, `.agents/skills/**`, `.vibe/skills/**` are in AlwaysProtected too; only the Skills tab writes there, nothing is ever removed. |
| 32 | - Interface language: ADR 0005 — `ui.language` defaults to `en`; every UI text is a key of `frontend/src/lib/i18n/messages.ts` (`fr` typed `Record<MessageKey,string>`, test checks keys and variables); config errors use the Go catalogue in the same language; agent titles and channel names are user data, never translated. Default config file and `examples/test-agents.yaml` are in English. | 32 | - Interface language: ADR 0005 — `ui.language` defaults to `en`; every UI text is a key of `frontend/src/lib/i18n/messages.ts` (`fr` typed `Record<MessageKey,string>`, test checks keys and variables); config errors use the Go catalogue in the same language; agent titles and channel names are user data, never translated. Default config file and `examples/test-agents.yaml` are in English. |
| 33 | - Packages and data model: ADR 0003 + Amendments 1 and 2 (main at the root, only main.go imports Wails, `internal/events` with an `Emitter` interface, LRU eviction of idle agents at the limit). | 33 | - Packages and data model: ADR 0003 + Amendments 1 and 2 (main at the root, only main.go imports Wails, `internal/events` with an `Emitter` interface, LRU eviction of idle agents at the limit). |
| 34 | - Frontend dependencies with **pnpm 12.11.2** and `frontend/pnpm-workspace.yaml` `supportedArchitectures` (darwin+linux): the repository folder is shared between the Mac and the Linux sandbox. Never use npm in `frontend/`. | 34 | - Frontend dependencies with **pnpm 12.11.2** and `frontend/pnpm-workspace.yaml` `supportedArchitectures` (darwin+linux): the repository folder is shared between the Mac and the Linux sandbox. Never use npm in `frontend/`. |
modified
.tickets/issues/0112-skills-des-agents-creer-modifier-et-importer-des.yaml +59 -7 | @@ -1,12 +1,12 @@ | ||
| 1 | 1 | # Managed by IssueSpec. Hand edits are welcome; keep the schema valid. |
| 2 | 2 | id: 112 |
| 3 | 3 | title: "Skills des agents : créer, modifier et importer des skills depuis Sidekicks" |
| 4 | -state: open | |
| 4 | +state: closed | |
| 5 | 5 | author: |
| 6 | 6 | name: k33g |
| 7 | 7 | email: ph.charriere@gmail.com |
| 8 | 8 | createdAt: 2026-11-15T17:22:23.000Z |
| 9 | -updatedAt: 2026-11-15T17:22:23.000Z | |
| 9 | +updatedAt: 2026-11-15T20:07:17.000Z | |
| 10 | 10 | labels: |
| 11 | 11 | - kind::feature |
| 12 | 12 | - area::workspace |
| @@ -43,34 +43,86 @@ body: | | ||
| 43 | 43 | tasks: |
| 44 | 44 | - id: 1 |
| 45 | 45 | title: "Relever où chaque type d'agent lit ses skills et leur format" |
| 46 | - state: open | |
| 46 | + state: closed | |
| 47 | 47 | priority: high |
| 48 | 48 | author: |
| 49 | 49 | name: k33g |
| 50 | 50 | email: ph.charriere@gmail.com |
| 51 | 51 | createdAt: 2026-11-15T17:22:23.000Z |
| 52 | + updatedAt: 2026-11-15T19:46:27.000Z | |
| 53 | + closedAt: 2026-11-15T19:46:27.000Z | |
| 52 | 54 | - id: 2 |
| 53 | 55 | title: "Concevoir la vue Skills (liste, créer, modifier, importer) et la proposer à l'owner" |
| 54 | - state: open | |
| 56 | + state: closed | |
| 55 | 57 | priority: high |
| 56 | 58 | author: |
| 57 | 59 | name: k33g |
| 58 | 60 | email: ph.charriere@gmail.com |
| 59 | 61 | createdAt: 2026-11-15T17:22:23.000Z |
| 62 | + updatedAt: 2026-11-15T19:46:27.000Z | |
| 63 | + closedAt: 2026-11-15T19:46:27.000Z | |
| 60 | 64 | - id: 3 |
| 61 | 65 | title: "Implémenter : création (modèle SKILL.md), modification (éditeur), import (dossier / archive)" |
| 62 | - state: open | |
| 66 | + state: closed | |
| 63 | 67 | priority: high |
| 64 | 68 | author: |
| 65 | 69 | name: k33g |
| 66 | 70 | email: ph.charriere@gmail.com |
| 67 | 71 | createdAt: 2026-11-15T17:22:23.000Z |
| 72 | + updatedAt: 2026-11-15T19:46:27.000Z | |
| 73 | + closedAt: 2026-11-15T19:46:27.000Z | |
| 68 | 74 | - id: 4 |
| 69 | 75 | title: "Prise en compte par l'agent (rechargement des commandes), tests, doc EN + FR" |
| 70 | - state: open | |
| 76 | + state: closed | |
| 71 | 77 | priority: medium |
| 72 | 78 | author: |
| 73 | 79 | name: k33g |
| 74 | 80 | email: ph.charriere@gmail.com |
| 75 | 81 | createdAt: 2026-11-15T17:22:23.000Z |
| 76 | -comments: [] | |
| 82 | + updatedAt: 2026-11-15T19:46:27.000Z | |
| 83 | + closedAt: 2026-11-15T19:46:27.000Z | |
| 84 | +comments: | |
| 85 | + - id: 1 | |
| 86 | + author: | |
| 87 | + name: k33g | |
| 88 | + email: ph.charriere@gmail.com | |
| 89 | + createdAt: 2026-11-15T19:46:27.000Z | |
| 90 | + body: | | |
| 91 | + Fait sur `feature/112-agent-skills`. | |
| 92 | + | |
| 93 | + **Où chaque agent lit ses skills (recherche du 2026-11-15)** — même format Agent Skills partout (un dossier par | |
| 94 | + skill avec un `SKILL.md`, en-tête `name` + `description`) : mini-me `skills/` (ou le `skillsDir` de son | |
| 95 | + `agent.yaml`), Claude Code `.claude/skills/`, Codex / Antigravity / Copilot `.agents/skills/` (dossier du standard ; | |
| 96 | + Antigravity : doc officielle), Vibe `.vibe/skills/`. `agents.SkillsDir` d'après le programme. | |
| 97 | + | |
| 98 | + **Protection** : même règle que #113 (décision de l'owner) — `.claude/skills/**`, `.agents/skills/**`, | |
| 99 | + `.vibe/skills/**` rejoignent `skills/**` dans `config.AlwaysProtected` ; seul l'onglet Skills y écrit, rien n'est | |
| 100 | + jamais supprimé. | |
| 101 | + | |
| 102 | + - Go : `WorkspaceService.Skills / CreateSkill / SaveSkill (conflit par version, seulement un SKILL.md du dossier) / | |
| 103 | + ImportSkill (dossier avec SKILL.md, fichiers cachés exclus, 200 fichiers / 20 Mio ; ou un .md qui devient | |
| 104 | + `<nom>/SKILL.md`) / ChooseSkillFolder` ; une skill existante n'est jamais remplacée. | |
| 105 | + - Front : `SkillsTab.svelte` (liste nom + description, éditeur, « Nouvelle skill » : titre → nom du dossier, | |
| 106 | + description « quand l'utiliser », modèle EN/FR ; imports ; rappel de redémarrage), `lib/skills.ts`. | |
| 107 | + - Vérifié sous Xvfb : liste, création depuis le formulaire, éditeur. Imports : sélecteurs natifs non pilotables ici, | |
| 108 | + couverts par les tests Go. `make verify` vert. Doc EN + FR (guide, configuration, référence), notes v1.7.0. | |
| 109 | + - id: 2 | |
| 110 | + author: | |
| 111 | + name: k33g | |
| 112 | + email: ph.charriere@gmail.com | |
| 113 | + createdAt: 2026-11-15T19:53:34.000Z | |
| 114 | + body: | | |
| 115 | + Retour de l'owner : « sandbox mini-coder-sbx: mkdir: Read-only file system ». mini-coder est mini-me en sandbox : | |
| 116 | + `skillsDir: .mm/skills`, et son sbxenv monte `.mm` en lecture seule (voulu : l'agent ne change pas ses | |
| 117 | + propres skills) — Sidekicks écrivait par `sbx exec`. Corrigé : les instructions et les skills d'un agent en | |
| 118 | + conteneur ou en sandbox s'écrivent (et se lisent) dans son dossier sur le Mac quand il existe | |
| 119 | + (`Core.settingsWorkspaceOf`), sans que la sandbox tourne. Aussi : les skills d'un seul fichier de mini-me | |
| 120 | + (`<nom>.md`) sont listées, lues et enregistrées ; `ReadSkill`. Test qui reproduit mini-coder (sbx qui refuse | |
| 121 | + tout). `make verify` vert. | |
| 122 | + - id: 3 | |
| 123 | + author: | |
| 124 | + name: k33g | |
| 125 | + email: ph.charriere@gmail.com | |
| 126 | + createdAt: 2026-11-15T20:07:17.000Z | |
| 127 | + body: | | |
| 128 | + Testé sur le Mac par l'owner : ça fonctionne. Mergé dans main. Ticket fermé. | |
| @@ -1,12 +1,12 @@ | |||
| 1 | # Managed by IssueSpec. Hand edits are welcome; keep the schema valid. | 1 | # Managed by IssueSpec. Hand edits are welcome; keep the schema valid. |
| 2 | id: 112 | 2 | id: 112 |
| 3 | title: "Skills des agents : créer, modifier et importer des skills depuis Sidekicks" | 3 | title: "Skills des agents : créer, modifier et importer des skills depuis Sidekicks" |
| 4 | -state: open | 4 | +state: closed |
| 5 | author: | 5 | author: |
| 6 | name: k33g | 6 | name: k33g |
| 7 | email: ph.charriere@gmail.com | 7 | email: ph.charriere@gmail.com |
| 8 | createdAt: 2026-11-15T17:22:23.000Z | 8 | createdAt: 2026-11-15T17:22:23.000Z |
| 9 | -updatedAt: 2026-11-15T17:22:23.000Z | 9 | +updatedAt: 2026-11-15T20:07:17.000Z |
| 10 | labels: | 10 | labels: |
| 11 | - kind::feature | 11 | - kind::feature |
| 12 | - area::workspace | 12 | - area::workspace |
| @@ -43,34 +43,86 @@ body: | | |||
| 43 | tasks: | 43 | tasks: |
| 44 | - id: 1 | 44 | - id: 1 |
| 45 | title: "Relever où chaque type d'agent lit ses skills et leur format" | 45 | title: "Relever où chaque type d'agent lit ses skills et leur format" |
| 46 | - state: open | 46 | + state: closed |
| 47 | priority: high | 47 | priority: high |
| 48 | author: | 48 | author: |
| 49 | name: k33g | 49 | name: k33g |
| 50 | email: ph.charriere@gmail.com | 50 | email: ph.charriere@gmail.com |
| 51 | createdAt: 2026-11-15T17:22:23.000Z | 51 | createdAt: 2026-11-15T17:22:23.000Z |
| 52 | + updatedAt: 2026-11-15T19:46:27.000Z | ||
| 53 | + closedAt: 2026-11-15T19:46:27.000Z | ||
| 52 | - id: 2 | 54 | - id: 2 |
| 53 | title: "Concevoir la vue Skills (liste, créer, modifier, importer) et la proposer à l'owner" | 55 | title: "Concevoir la vue Skills (liste, créer, modifier, importer) et la proposer à l'owner" |
| 54 | - state: open | 56 | + state: closed |
| 55 | priority: high | 57 | priority: high |
| 56 | author: | 58 | author: |
| 57 | name: k33g | 59 | name: k33g |
| 58 | email: ph.charriere@gmail.com | 60 | email: ph.charriere@gmail.com |
| 59 | createdAt: 2026-11-15T17:22:23.000Z | 61 | createdAt: 2026-11-15T17:22:23.000Z |
| 62 | + updatedAt: 2026-11-15T19:46:27.000Z | ||
| 63 | + closedAt: 2026-11-15T19:46:27.000Z | ||
| 60 | - id: 3 | 64 | - id: 3 |
| 61 | title: "Implémenter : création (modèle SKILL.md), modification (éditeur), import (dossier / archive)" | 65 | title: "Implémenter : création (modèle SKILL.md), modification (éditeur), import (dossier / archive)" |
| 62 | - state: open | 66 | + state: closed |
| 63 | priority: high | 67 | priority: high |
| 64 | author: | 68 | author: |
| 65 | name: k33g | 69 | name: k33g |
| 66 | email: ph.charriere@gmail.com | 70 | email: ph.charriere@gmail.com |
| 67 | createdAt: 2026-11-15T17:22:23.000Z | 71 | createdAt: 2026-11-15T17:22:23.000Z |
| 72 | + updatedAt: 2026-11-15T19:46:27.000Z | ||
| 73 | + closedAt: 2026-11-15T19:46:27.000Z | ||
| 68 | - id: 4 | 74 | - id: 4 |
| 69 | title: "Prise en compte par l'agent (rechargement des commandes), tests, doc EN + FR" | 75 | title: "Prise en compte par l'agent (rechargement des commandes), tests, doc EN + FR" |
| 70 | - state: open | 76 | + state: closed |
| 71 | priority: medium | 77 | priority: medium |
| 72 | author: | 78 | author: |
| 73 | name: k33g | 79 | name: k33g |
| 74 | email: ph.charriere@gmail.com | 80 | email: ph.charriere@gmail.com |
| 75 | createdAt: 2026-11-15T17:22:23.000Z | 81 | createdAt: 2026-11-15T17:22:23.000Z |
| 76 | -comments: [] | 82 | + updatedAt: 2026-11-15T19:46:27.000Z |
| 83 | + closedAt: 2026-11-15T19:46:27.000Z | ||
| 84 | +comments: | ||
| 85 | + - id: 1 | ||
| 86 | + author: | ||
| 87 | + name: k33g | ||
| 88 | + email: ph.charriere@gmail.com | ||
| 89 | + createdAt: 2026-11-15T19:46:27.000Z | ||
| 90 | + body: | | ||
| 91 | + Fait sur `feature/112-agent-skills`. | ||
| 92 | + | ||
| 93 | + **Où chaque agent lit ses skills (recherche du 2026-11-15)** — même format Agent Skills partout (un dossier par | ||
| 94 | + skill avec un `SKILL.md`, en-tête `name` + `description`) : mini-me `skills/` (ou le `skillsDir` de son | ||
| 95 | + `agent.yaml`), Claude Code `.claude/skills/`, Codex / Antigravity / Copilot `.agents/skills/` (dossier du standard ; | ||
| 96 | + Antigravity : doc officielle), Vibe `.vibe/skills/`. `agents.SkillsDir` d'après le programme. | ||
| 97 | + | ||
| 98 | + **Protection** : même règle que #113 (décision de l'owner) — `.claude/skills/**`, `.agents/skills/**`, | ||
| 99 | + `.vibe/skills/**` rejoignent `skills/**` dans `config.AlwaysProtected` ; seul l'onglet Skills y écrit, rien n'est | ||
| 100 | + jamais supprimé. | ||
| 101 | + | ||
| 102 | + - Go : `WorkspaceService.Skills / CreateSkill / SaveSkill (conflit par version, seulement un SKILL.md du dossier) / | ||
| 103 | + ImportSkill (dossier avec SKILL.md, fichiers cachés exclus, 200 fichiers / 20 Mio ; ou un .md qui devient | ||
| 104 | + `<nom>/SKILL.md`) / ChooseSkillFolder` ; une skill existante n'est jamais remplacée. | ||
| 105 | + - Front : `SkillsTab.svelte` (liste nom + description, éditeur, « Nouvelle skill » : titre → nom du dossier, | ||
| 106 | + description « quand l'utiliser », modèle EN/FR ; imports ; rappel de redémarrage), `lib/skills.ts`. | ||
| 107 | + - Vérifié sous Xvfb : liste, création depuis le formulaire, éditeur. Imports : sélecteurs natifs non pilotables ici, | ||
| 108 | + couverts par les tests Go. `make verify` vert. Doc EN + FR (guide, configuration, référence), notes v1.7.0. | ||
| 109 | + - id: 2 | ||
| 110 | + author: | ||
| 111 | + name: k33g | ||
| 112 | + email: ph.charriere@gmail.com | ||
| 113 | + createdAt: 2026-11-15T19:53:34.000Z | ||
| 114 | + body: | | ||
| 115 | + Retour de l'owner : « sandbox mini-coder-sbx: mkdir: Read-only file system ». mini-coder est mini-me en sandbox : | ||
| 116 | + `skillsDir: .mm/skills`, et son sbxenv monte `.mm` en lecture seule (voulu : l'agent ne change pas ses | ||
| 117 | + propres skills) — Sidekicks écrivait par `sbx exec`. Corrigé : les instructions et les skills d'un agent en | ||
| 118 | + conteneur ou en sandbox s'écrivent (et se lisent) dans son dossier sur le Mac quand il existe | ||
| 119 | + (`Core.settingsWorkspaceOf`), sans que la sandbox tourne. Aussi : les skills d'un seul fichier de mini-me | ||
| 120 | + (`<nom>.md`) sont listées, lues et enregistrées ; `ReadSkill`. Test qui reproduit mini-coder (sbx qui refuse | ||
| 121 | + tout). `make verify` vert. | ||
| 122 | + - id: 3 | ||
| 123 | + author: | ||
| 124 | + name: k33g | ||
| 125 | + email: ph.charriere@gmail.com | ||
| 126 | + createdAt: 2026-11-15T20:07:17.000Z | ||
| 127 | + body: | | ||
| 128 | + Testé sur le Mac par l'owner : ça fonctionne. Mergé dans main. Ticket fermé. | ||
modified
docs/en/how-to/work-with-an-agents-files.md +11 -0 | @@ -61,6 +61,17 @@ An agent reads its **instructions** when its session starts: its role, its tone, | ||
| 61 | 61 | |
| 62 | 62 | The instruction file stays protected in the **Files** tab (below): only the **Instructions** tab writes it, and nothing deletes it. It works the same for an agent on this computer, in a Docker container or in an sbx sandbox. |
| 63 | 63 | |
| 64 | +## Give the agent skills | |
| 65 | + | |
| 66 | +A **skill** teaches the agent how to do one kind of task: a folder holding a `SKILL.md`, whose name and description tell the agent when to use it (the Agent Skills format every agent reads). The agent uses a skill when its description fits what you ask, or when you call it with `/` (issue #112). Open the **Skills** tab of the agent's workspace: it says where the agent reads its skills — `.claude/skills` for Claude, `.agents/skills` for Codex, Antigravity and Copilot, `.vibe/skills` for Vibe, `skills` (or the `skillsDir` of its `agent.yaml`) for mini-me — and lists them. | |
| 67 | + | |
| 68 | +- **New skill**: say what it does (its folder's name follows, in lowercase letters, digits and `-`) and when to use it, then **Create the skill**. Sidekicks writes a `SKILL.md` to fill in: when to use it, how to do it, an example. | |
| 69 | +- Pick a skill to read or change its `SKILL.md`, then **Save** (⌘S); a change made meanwhile is reported, as for the instructions. | |
| 70 | +- **Import a skill folder…** copies a folder holding a `SKILL.md`, with its other files (scripts, examples) and without hidden ones; **Import a Markdown file…** turns one file into the `SKILL.md` of a new skill, named after the name of its front matter, else after the file. A skill that has the same name is never replaced. | |
| 71 | +- The agent finds its skills when its session starts: when it is running, **Restart the agent**. | |
| 72 | + | |
| 73 | +The skills folders stay protected in the **Files** tab: only the **Skills** tab writes there, and nothing deletes a skill from Sidekicks. For an agent in a container or a sandbox, Sidekicks writes its instructions and its skills in its folder on this computer: it works even when the agent sees that folder read-only (mini-me's `.mm`), and without the sandbox running. mini-me's one-file skills (`<name>.md`) are listed too. | |
| 74 | + | |
| 64 | 75 | ## Protect files |
| 65 | 76 | |
| 66 | 77 | Some files must not be changed or deleted by mistake. Without writing anything, the agent's instructions (`AGENTS.md`, `CLAUDE.md`, `GEMINI.md` — written only from the **Instructions** tab), its skills (`skills/` and all it holds), its configuration file (after `--config` or `serve acp` in its `args`) and, for an agent in a container or a sandbox, the files it is built from (`compose.yaml`, `Dockerfile`, `sbxenv.yaml` named by its `runtime.lifecycle`) are protected. To protect others, list them under the agent in **Settings**: |
| @@ -61,6 +61,17 @@ An agent reads its **instructions** when its session starts: its role, its tone, | |||
| 61 | 61 | ||
| 62 | The instruction file stays protected in the **Files** tab (below): only the **Instructions** tab writes it, and nothing deletes it. It works the same for an agent on this computer, in a Docker container or in an sbx sandbox. | 62 | The instruction file stays protected in the **Files** tab (below): only the **Instructions** tab writes it, and nothing deletes it. It works the same for an agent on this computer, in a Docker container or in an sbx sandbox. |
| 63 | 63 | ||
| 64 | +## Give the agent skills | ||
| 65 | + | ||
| 66 | +A **skill** teaches the agent how to do one kind of task: a folder holding a `SKILL.md`, whose name and description tell the agent when to use it (the Agent Skills format every agent reads). The agent uses a skill when its description fits what you ask, or when you call it with `/` (issue #112). Open the **Skills** tab of the agent's workspace: it says where the agent reads its skills — `.claude/skills` for Claude, `.agents/skills` for Codex, Antigravity and Copilot, `.vibe/skills` for Vibe, `skills` (or the `skillsDir` of its `agent.yaml`) for mini-me — and lists them. | ||
| 67 | + | ||
| 68 | +- **New skill**: say what it does (its folder's name follows, in lowercase letters, digits and `-`) and when to use it, then **Create the skill**. Sidekicks writes a `SKILL.md` to fill in: when to use it, how to do it, an example. | ||
| 69 | +- Pick a skill to read or change its `SKILL.md`, then **Save** (⌘S); a change made meanwhile is reported, as for the instructions. | ||
| 70 | +- **Import a skill folder…** copies a folder holding a `SKILL.md`, with its other files (scripts, examples) and without hidden ones; **Import a Markdown file…** turns one file into the `SKILL.md` of a new skill, named after the name of its front matter, else after the file. A skill that has the same name is never replaced. | ||
| 71 | +- The agent finds its skills when its session starts: when it is running, **Restart the agent**. | ||
| 72 | + | ||
| 73 | +The skills folders stay protected in the **Files** tab: only the **Skills** tab writes there, and nothing deletes a skill from Sidekicks. For an agent in a container or a sandbox, Sidekicks writes its instructions and its skills in its folder on this computer: it works even when the agent sees that folder read-only (mini-me's `.mm`), and without the sandbox running. mini-me's one-file skills (`<name>.md`) are listed too. | ||
| 74 | + | ||
| 64 | ## Protect files | 75 | ## Protect files |
| 65 | 76 | ||
| 66 | Some files must not be changed or deleted by mistake. Without writing anything, the agent's instructions (`AGENTS.md`, `CLAUDE.md`, `GEMINI.md` — written only from the **Instructions** tab), its skills (`skills/` and all it holds), its configuration file (after `--config` or `serve acp` in its `args`) and, for an agent in a container or a sandbox, the files it is built from (`compose.yaml`, `Dockerfile`, `sbxenv.yaml` named by its `runtime.lifecycle`) are protected. To protect others, list them under the agent in **Settings**: | 77 | Some files must not be changed or deleted by mistake. Without writing anything, the agent's instructions (`AGENTS.md`, `CLAUDE.md`, `GEMINI.md` — written only from the **Instructions** tab), its skills (`skills/` and all it holds), its configuration file (after `--config` or `serve acp` in its `args`) and, for an agent in a container or a sandbox, the files it is built from (`compose.yaml`, `Dockerfile`, `sbxenv.yaml` named by its `runtime.lifecycle`) are protected. To protect others, list them under the agent in **Settings**: |
modified
docs/en/reference/agents-and-events.md +1 -0 | @@ -192,6 +192,7 @@ A file opened for editing has `path, content, version`; `version` identifies the | ||
| 192 | 192 | | `Read(agent, path)` | A text file of at most 1 MB; a binary or larger file is an error. | |
| 193 | 193 | | `Instructions(agent)` | The agent's instructions (issue #113): `{file, exists, content, version, files}` — the first of `files` (from its program: `CLAUDE.md` then `AGENTS.md` for Claude, `AGENTS.md` then `GEMINI.md` for Antigravity, else `AGENTS.md`) that exists at the root of its folder, else the first one, to create. | |
| 194 | 194 | | `CreateInstructions(agent, content)`, `SaveInstructions(agent, content, version)`, `ImportInstructions(agent, hostPath)`, `ChooseInstructions()` | Write the instruction file — the only way to, as it is protected (`protect`): from a template (refused when it exists), edited over `version` (`{instructions, conflict}`; `conflict` and nothing written when it changed), or copied from a UTF-8 text file of this computer (1 MiB at most; replaces it). Never removed. | |
| 195 | +| `Skills(agent)`, `CreateSkill(agent, name, content)`, `SaveSkill(agent, path, content, version)`, `ImportSkill(agent, hostPath)`, `ChooseSkillFolder()` | The agent's skills (issue #112): `{dir, skills: [{folder, name, description, path}]}` — the folders of its skills folder (from its program: `.claude/skills` for Claude, `.vibe/skills` for Vibe, `skills` or the `skillsDir` of its `agent.yaml` for mini-me, else `.agents/skills`) that hold a `SKILL.md`, with the `name` and `description` of its front matter. Create (`name`: lowercase letters, digits and `-`; refused when taken), save a `SKILL.md` over `version` (`{file, conflict}`), import a folder holding a `SKILL.md` (its files, hidden ones aside; 200 files and 20 MiB at most) or one Markdown file (becomes `<name>/SKILL.md`). Never removes anything. | | |
| 195 | 196 | | `Save(agent, path, content, version)` | Writes the file if it still has `version`; otherwise `{conflict: true}` and nothing is written. An empty `version` overwrites. The file is written next to its place and moved over it. | |
| 196 | 197 | | `Create(agent, dir, name)` | Creates an empty file; refused if the name exists or contains `/`. | |
| 197 | 198 | | `Remove(agent, path)` | Deletes a file or a folder with its content (see the table above). | |
| @@ -192,6 +192,7 @@ A file opened for editing has `path, content, version`; `version` identifies the | |||
| 192 | | `Read(agent, path)` | A text file of at most 1 MB; a binary or larger file is an error. | | 192 | | `Read(agent, path)` | A text file of at most 1 MB; a binary or larger file is an error. | |
| 193 | | `Instructions(agent)` | The agent's instructions (issue #113): `{file, exists, content, version, files}` — the first of `files` (from its program: `CLAUDE.md` then `AGENTS.md` for Claude, `AGENTS.md` then `GEMINI.md` for Antigravity, else `AGENTS.md`) that exists at the root of its folder, else the first one, to create. | | 193 | | `Instructions(agent)` | The agent's instructions (issue #113): `{file, exists, content, version, files}` — the first of `files` (from its program: `CLAUDE.md` then `AGENTS.md` for Claude, `AGENTS.md` then `GEMINI.md` for Antigravity, else `AGENTS.md`) that exists at the root of its folder, else the first one, to create. | |
| 194 | | `CreateInstructions(agent, content)`, `SaveInstructions(agent, content, version)`, `ImportInstructions(agent, hostPath)`, `ChooseInstructions()` | Write the instruction file — the only way to, as it is protected (`protect`): from a template (refused when it exists), edited over `version` (`{instructions, conflict}`; `conflict` and nothing written when it changed), or copied from a UTF-8 text file of this computer (1 MiB at most; replaces it). Never removed. | | 194 | | `CreateInstructions(agent, content)`, `SaveInstructions(agent, content, version)`, `ImportInstructions(agent, hostPath)`, `ChooseInstructions()` | Write the instruction file — the only way to, as it is protected (`protect`): from a template (refused when it exists), edited over `version` (`{instructions, conflict}`; `conflict` and nothing written when it changed), or copied from a UTF-8 text file of this computer (1 MiB at most; replaces it). Never removed. | |
| 195 | +| `Skills(agent)`, `CreateSkill(agent, name, content)`, `SaveSkill(agent, path, content, version)`, `ImportSkill(agent, hostPath)`, `ChooseSkillFolder()` | The agent's skills (issue #112): `{dir, skills: [{folder, name, description, path}]}` — the folders of its skills folder (from its program: `.claude/skills` for Claude, `.vibe/skills` for Vibe, `skills` or the `skillsDir` of its `agent.yaml` for mini-me, else `.agents/skills`) that hold a `SKILL.md`, with the `name` and `description` of its front matter. Create (`name`: lowercase letters, digits and `-`; refused when taken), save a `SKILL.md` over `version` (`{file, conflict}`), import a folder holding a `SKILL.md` (its files, hidden ones aside; 200 files and 20 MiB at most) or one Markdown file (becomes `<name>/SKILL.md`). Never removes anything. | | ||
| 195 | | `Save(agent, path, content, version)` | Writes the file if it still has `version`; otherwise `{conflict: true}` and nothing is written. An empty `version` overwrites. The file is written next to its place and moved over it. | | 196 | | `Save(agent, path, content, version)` | Writes the file if it still has `version`; otherwise `{conflict: true}` and nothing is written. An empty `version` overwrites. The file is written next to its place and moved over it. | |
| 196 | | `Create(agent, dir, name)` | Creates an empty file; refused if the name exists or contains `/`. | | 197 | | `Create(agent, dir, name)` | Creates an empty file; refused if the name exists or contains `/`. | |
| 197 | | `Remove(agent, path)` | Deletes a file or a folder with its content (see the table above). | | 198 | | `Remove(agent, path)` | Deletes a file or a folder with its content (see the table above). | |
modified
docs/en/reference/configuration.md +1 -1 | @@ -90,7 +90,7 @@ agentTools: | ||
| 90 | 90 | | `env` | map text → text | no | | Extra environment variables. | |
| 91 | 91 | | `afterStop` | list of text, at least one | no | | Command run each time the agent's process ends — stopped, crashed, stopped to make room, or Sidekicks quitting: the program (a bare name is looked up in PATH, a path is relative to this file), then its arguments. It runs in `workspace` with `env`, for 30 s at most; its output goes to the agent's log; Sidekicks waits for it before quitting. A program that cannot be found is a warning. Example: `[../scripts/agents.sh, unload, alice]` to unload the model. | |
| 92 | 92 | | `workspace` | path | no | the configuration folder | The agent's folder: the process starts there and it is the `cwd` of its ACP sessions. mm reads `AGENTS.md` and `skills/` from it. | |
| 93 | -| `protect` | list of text | no | | Files of the agent's folder the interface (Files tab) may neither change nor delete: paths relative to the folder, or patterns where `*` and `?` match within a name and `**` any number of folders (`[AGENTS.md, "skills/**"]`). A folder holding a protected file cannot be deleted. Always protected, when they are in its folder: `AGENTS.md`, `CLAUDE.md`, `GEMINI.md` (the agent's instructions, written only by its Instructions tab, issue #113), `skills/**`, the agent's configuration file (the argument after `--config`, `-config` or `serve acp` in `args`), and the files `runtime.lifecycle` builds the container or the sandbox from — the Compose file (after `-f`/`--file`, or `compose.yaml`… without it), the `Dockerfile` of the lifecycle folder for a container, the sbx environment file (`sbxenv.yaml` or the one named). Only the configuration lifts a protection; the agent itself, the terminal or the Finder are not bound by it. | | |
| 93 | +| `protect` | list of text | no | | Files of the agent's folder the interface (Files tab) may neither change nor delete: paths relative to the folder, or patterns where `*` and `?` match within a name and `**` any number of folders (`[AGENTS.md, "skills/**"]`). A folder holding a protected file cannot be deleted. Always protected, when they are in its folder: `AGENTS.md`, `CLAUDE.md`, `GEMINI.md` (the agent's instructions, written only by its Instructions tab, issue #113), `skills/**`, `.claude/skills/**`, `.agents/skills/**`, `.vibe/skills/**` (its skills, written only by its Skills tab, issue #112), the agent's configuration file (the argument after `--config`, `-config` or `serve acp` in `args`), and the files `runtime.lifecycle` builds the container or the sandbox from — the Compose file (after `-f`/`--file`, or `compose.yaml`… without it), the `Dockerfile` of the lifecycle folder for a container, the sbx environment file (`sbxenv.yaml` or the one named). Only the configuration lifts a protection; the agent itself, the terminal or the Finder are not bound by it. | | |
| 94 | 94 | | `runtime` | object | no | `{type: local}` | Where the agent runs (see below). | |
| 95 | 95 | |
| 96 | 96 | ### `runtime` |
| @@ -90,7 +90,7 @@ agentTools: | |||
| 90 | | `env` | map text → text | no | | Extra environment variables. | | 90 | | `env` | map text → text | no | | Extra environment variables. | |
| 91 | | `afterStop` | list of text, at least one | no | | Command run each time the agent's process ends — stopped, crashed, stopped to make room, or Sidekicks quitting: the program (a bare name is looked up in PATH, a path is relative to this file), then its arguments. It runs in `workspace` with `env`, for 30 s at most; its output goes to the agent's log; Sidekicks waits for it before quitting. A program that cannot be found is a warning. Example: `[../scripts/agents.sh, unload, alice]` to unload the model. | | 91 | | `afterStop` | list of text, at least one | no | | Command run each time the agent's process ends — stopped, crashed, stopped to make room, or Sidekicks quitting: the program (a bare name is looked up in PATH, a path is relative to this file), then its arguments. It runs in `workspace` with `env`, for 30 s at most; its output goes to the agent's log; Sidekicks waits for it before quitting. A program that cannot be found is a warning. Example: `[../scripts/agents.sh, unload, alice]` to unload the model. | |
| 92 | | `workspace` | path | no | the configuration folder | The agent's folder: the process starts there and it is the `cwd` of its ACP sessions. mm reads `AGENTS.md` and `skills/` from it. | | 92 | | `workspace` | path | no | the configuration folder | The agent's folder: the process starts there and it is the `cwd` of its ACP sessions. mm reads `AGENTS.md` and `skills/` from it. | |
| 93 | -| `protect` | list of text | no | | Files of the agent's folder the interface (Files tab) may neither change nor delete: paths relative to the folder, or patterns where `*` and `?` match within a name and `**` any number of folders (`[AGENTS.md, "skills/**"]`). A folder holding a protected file cannot be deleted. Always protected, when they are in its folder: `AGENTS.md`, `CLAUDE.md`, `GEMINI.md` (the agent's instructions, written only by its Instructions tab, issue #113), `skills/**`, the agent's configuration file (the argument after `--config`, `-config` or `serve acp` in `args`), and the files `runtime.lifecycle` builds the container or the sandbox from — the Compose file (after `-f`/`--file`, or `compose.yaml`… without it), the `Dockerfile` of the lifecycle folder for a container, the sbx environment file (`sbxenv.yaml` or the one named). Only the configuration lifts a protection; the agent itself, the terminal or the Finder are not bound by it. | | 93 | +| `protect` | list of text | no | | Files of the agent's folder the interface (Files tab) may neither change nor delete: paths relative to the folder, or patterns where `*` and `?` match within a name and `**` any number of folders (`[AGENTS.md, "skills/**"]`). A folder holding a protected file cannot be deleted. Always protected, when they are in its folder: `AGENTS.md`, `CLAUDE.md`, `GEMINI.md` (the agent's instructions, written only by its Instructions tab, issue #113), `skills/**`, `.claude/skills/**`, `.agents/skills/**`, `.vibe/skills/**` (its skills, written only by its Skills tab, issue #112), the agent's configuration file (the argument after `--config`, `-config` or `serve acp` in `args`), and the files `runtime.lifecycle` builds the container or the sandbox from — the Compose file (after `-f`/`--file`, or `compose.yaml`… without it), the `Dockerfile` of the lifecycle folder for a container, the sbx environment file (`sbxenv.yaml` or the one named). Only the configuration lifts a protection; the agent itself, the terminal or the Finder are not bound by it. | |
| 94 | | `runtime` | object | no | `{type: local}` | Where the agent runs (see below). | | 94 | | `runtime` | object | no | `{type: local}` | Where the agent runs (see below). | |
| 95 | 95 | ||
| 96 | ### `runtime` | 96 | ### `runtime` |
modified
docs/fr/how-to/fichiers-et-terminal-d-un-agent.md +11 -0 | @@ -61,6 +61,17 @@ Un agent lit ses **instructions** au début de sa session : son rôle, son ton, | ||
| 61 | 61 | |
| 62 | 62 | Le fichier d'instructions reste protégé dans l'onglet **Fichiers** (ci-dessous) : seul l'onglet **Instructions** l'écrit, et rien ne le supprime. C'est pareil pour un agent sur cet ordinateur, dans un conteneur Docker ou dans une sandbox sbx. |
| 63 | 63 | |
| 64 | +## Donner des skills à l'agent | |
| 65 | + | |
| 66 | +Une **skill** apprend à l'agent à faire un type de tâche : un dossier qui contient un `SKILL.md`, dont le nom et la description disent à l'agent quand l'utiliser (le format Agent Skills que lisent tous les agents). L'agent utilise une skill quand sa description correspond à votre demande, ou quand vous l'appelez avec `/` (issue #112). Ouvrez l'onglet **Skills** du workspace de l'agent : il dit où l'agent lit ses skills — `.claude/skills` pour Claude, `.agents/skills` pour Codex, Antigravity et Copilot, `.vibe/skills` pour Vibe, `skills` (ou le `skillsDir` de son `agent.yaml`) pour mini-me — et les liste. | |
| 67 | + | |
| 68 | +- **Nouvelle skill** : dites ce qu'elle fait (le nom de son dossier suit, en minuscules, chiffres et `-`) et quand l'utiliser, puis **Créer la skill**. Sidekicks écrit un `SKILL.md` à compléter : quand l'utiliser, comment faire, un exemple. | |
| 69 | +- Choisissez une skill pour lire ou modifier son `SKILL.md`, puis **Enregistrer** (⌘S) ; un changement fait entre-temps est signalé, comme pour les instructions. | |
| 70 | +- **Importer le dossier d'une skill…** copie un dossier qui contient un `SKILL.md`, avec ses autres fichiers (scripts, exemples) et sans les fichiers cachés ; **Importer un fichier Markdown…** fait d'un fichier le `SKILL.md` d'une nouvelle skill, nommée d'après le nom de son en-tête, sinon d'après le fichier. Une skill qui porte déjà ce nom n'est jamais remplacée. | |
| 71 | +- L'agent découvre ses skills au début de sa session : s'il tourne, **Redémarrer l'agent**. | |
| 72 | + | |
| 73 | +Les dossiers de skills restent protégés dans l'onglet **Fichiers** : seul l'onglet **Skills** y écrit, et rien ne supprime une skill depuis Sidekicks. Pour un agent dans un conteneur ou une sandbox, Sidekicks écrit ses instructions et ses skills dans son dossier sur cet ordinateur : ça marche même quand l'agent voit ce dossier en lecture seule (le `.mm` de mini-me), et sans que la sandbox tourne. Les skills d'un seul fichier de mini-me (`<nom>.md`) sont listées aussi. | |
| 74 | + | |
| 64 | 75 | ## Protéger des fichiers |
| 65 | 76 | |
| 66 | 77 | Certains fichiers ne doivent pas être modifiés ou supprimés par erreur. Sans rien écrire, les instructions de l'agent (`AGENTS.md`, `CLAUDE.md`, `GEMINI.md` — écrites seulement depuis l'onglet **Instructions**), ses skills (`skills/` et tout ce qu'il contient), son fichier de configuration (après `--config` ou `serve acp` dans ses `args`) et, pour un agent en conteneur ou en sandbox, les fichiers à partir desquels il est construit (`compose.yaml`, `Dockerfile`, `sbxenv.yaml` cités par son `runtime.lifecycle`) sont protégés. Pour en protéger d'autres, listez-les sous l'agent dans **Settings** : |
| @@ -61,6 +61,17 @@ Un agent lit ses **instructions** au début de sa session : son rôle, son ton, | |||
| 61 | 61 | ||
| 62 | Le fichier d'instructions reste protégé dans l'onglet **Fichiers** (ci-dessous) : seul l'onglet **Instructions** l'écrit, et rien ne le supprime. C'est pareil pour un agent sur cet ordinateur, dans un conteneur Docker ou dans une sandbox sbx. | 62 | Le fichier d'instructions reste protégé dans l'onglet **Fichiers** (ci-dessous) : seul l'onglet **Instructions** l'écrit, et rien ne le supprime. C'est pareil pour un agent sur cet ordinateur, dans un conteneur Docker ou dans une sandbox sbx. |
| 63 | 63 | ||
| 64 | +## Donner des skills à l'agent | ||
| 65 | + | ||
| 66 | +Une **skill** apprend à l'agent à faire un type de tâche : un dossier qui contient un `SKILL.md`, dont le nom et la description disent à l'agent quand l'utiliser (le format Agent Skills que lisent tous les agents). L'agent utilise une skill quand sa description correspond à votre demande, ou quand vous l'appelez avec `/` (issue #112). Ouvrez l'onglet **Skills** du workspace de l'agent : il dit où l'agent lit ses skills — `.claude/skills` pour Claude, `.agents/skills` pour Codex, Antigravity et Copilot, `.vibe/skills` pour Vibe, `skills` (ou le `skillsDir` de son `agent.yaml`) pour mini-me — et les liste. | ||
| 67 | + | ||
| 68 | +- **Nouvelle skill** : dites ce qu'elle fait (le nom de son dossier suit, en minuscules, chiffres et `-`) et quand l'utiliser, puis **Créer la skill**. Sidekicks écrit un `SKILL.md` à compléter : quand l'utiliser, comment faire, un exemple. | ||
| 69 | +- Choisissez une skill pour lire ou modifier son `SKILL.md`, puis **Enregistrer** (⌘S) ; un changement fait entre-temps est signalé, comme pour les instructions. | ||
| 70 | +- **Importer le dossier d'une skill…** copie un dossier qui contient un `SKILL.md`, avec ses autres fichiers (scripts, exemples) et sans les fichiers cachés ; **Importer un fichier Markdown…** fait d'un fichier le `SKILL.md` d'une nouvelle skill, nommée d'après le nom de son en-tête, sinon d'après le fichier. Une skill qui porte déjà ce nom n'est jamais remplacée. | ||
| 71 | +- L'agent découvre ses skills au début de sa session : s'il tourne, **Redémarrer l'agent**. | ||
| 72 | + | ||
| 73 | +Les dossiers de skills restent protégés dans l'onglet **Fichiers** : seul l'onglet **Skills** y écrit, et rien ne supprime une skill depuis Sidekicks. Pour un agent dans un conteneur ou une sandbox, Sidekicks écrit ses instructions et ses skills dans son dossier sur cet ordinateur : ça marche même quand l'agent voit ce dossier en lecture seule (le `.mm` de mini-me), et sans que la sandbox tourne. Les skills d'un seul fichier de mini-me (`<nom>.md`) sont listées aussi. | ||
| 74 | + | ||
| 64 | ## Protéger des fichiers | 75 | ## Protéger des fichiers |
| 65 | 76 | ||
| 66 | Certains fichiers ne doivent pas être modifiés ou supprimés par erreur. Sans rien écrire, les instructions de l'agent (`AGENTS.md`, `CLAUDE.md`, `GEMINI.md` — écrites seulement depuis l'onglet **Instructions**), ses skills (`skills/` et tout ce qu'il contient), son fichier de configuration (après `--config` ou `serve acp` dans ses `args`) et, pour un agent en conteneur ou en sandbox, les fichiers à partir desquels il est construit (`compose.yaml`, `Dockerfile`, `sbxenv.yaml` cités par son `runtime.lifecycle`) sont protégés. Pour en protéger d'autres, listez-les sous l'agent dans **Settings** : | 77 | Certains fichiers ne doivent pas être modifiés ou supprimés par erreur. Sans rien écrire, les instructions de l'agent (`AGENTS.md`, `CLAUDE.md`, `GEMINI.md` — écrites seulement depuis l'onglet **Instructions**), ses skills (`skills/` et tout ce qu'il contient), son fichier de configuration (après `--config` ou `serve acp` dans ses `args`) et, pour un agent en conteneur ou en sandbox, les fichiers à partir desquels il est construit (`compose.yaml`, `Dockerfile`, `sbxenv.yaml` cités par son `runtime.lifecycle`) sont protégés. Pour en protéger d'autres, listez-les sous l'agent dans **Settings** : |
modified
docs/fr/reference/agents-et-evenements.md +1 -0 | @@ -192,6 +192,7 @@ Un fichier ouvert pour modification a `path, content, version` ; `version` ident | ||
| 192 | 192 | | `Read(agent, path)` | Un fichier texte de 1 Mo au plus ; un fichier binaire ou plus gros est une erreur. | |
| 193 | 193 | | `Instructions(agent)` | Les instructions de l'agent (issue #113) : `{file, exists, content, version, files}` — le premier de `files` (d'après son programme : `CLAUDE.md` puis `AGENTS.md` pour Claude, `AGENTS.md` puis `GEMINI.md` pour Antigravity, sinon `AGENTS.md`) qui existe à la racine de son dossier, sinon le premier, à créer. | |
| 194 | 194 | | `CreateInstructions(agent, content)`, `SaveInstructions(agent, content, version)`, `ImportInstructions(agent, hostPath)`, `ChooseInstructions()` | Écrivent le fichier d'instructions — seul moyen de le faire, puisqu'il est protégé (`protect`) : depuis un modèle (refusé s'il existe), modifié par-dessus `version` (`{instructions, conflict}` ; `conflict` et rien d'écrit s'il a changé), ou copié depuis un fichier texte UTF-8 de cet ordinateur (1 Mio au plus ; il le remplace). Jamais supprimé. | |
| 195 | +| `Skills(agent)`, `CreateSkill(agent, name, content)`, `SaveSkill(agent, path, content, version)`, `ImportSkill(agent, hostPath)`, `ChooseSkillFolder()` | Les skills de l'agent (issue #112) : `{dir, skills: [{folder, name, description, path}]}` — les dossiers de son dossier de skills (d'après son programme : `.claude/skills` pour Claude, `.vibe/skills` pour Vibe, `skills` ou le `skillsDir` de son `agent.yaml` pour mini-me, sinon `.agents/skills`) qui contiennent un `SKILL.md`, avec le `name` et la `description` de son en-tête. Créer (`name` : minuscules, chiffres et `-` ; refusé s'il est pris), enregistrer un `SKILL.md` par-dessus `version` (`{file, conflict}`), importer un dossier qui contient un `SKILL.md` (ses fichiers, sauf les cachés ; 200 fichiers et 20 Mio au plus) ou un fichier Markdown (devient `<nom>/SKILL.md`). Ne supprime jamais rien. | | |
| 195 | 196 | | `Save(agent, path, content, version)` | Écrit le fichier s'il a toujours `version` ; sinon `{conflict: true}` et rien n'est écrit. Une `version` vide écrase. Le fichier est écrit à côté puis déplacé à sa place. | |
| 196 | 197 | | `Create(agent, dir, name)` | Crée un fichier vide ; refusé si le nom existe ou contient `/`. | |
| 197 | 198 | | `Remove(agent, path)` | Supprime un fichier ou un dossier avec son contenu (voir le tableau ci-dessus). | |
| @@ -192,6 +192,7 @@ Un fichier ouvert pour modification a `path, content, version` ; `version` ident | |||
| 192 | | `Read(agent, path)` | Un fichier texte de 1 Mo au plus ; un fichier binaire ou plus gros est une erreur. | | 192 | | `Read(agent, path)` | Un fichier texte de 1 Mo au plus ; un fichier binaire ou plus gros est une erreur. | |
| 193 | | `Instructions(agent)` | Les instructions de l'agent (issue #113) : `{file, exists, content, version, files}` — le premier de `files` (d'après son programme : `CLAUDE.md` puis `AGENTS.md` pour Claude, `AGENTS.md` puis `GEMINI.md` pour Antigravity, sinon `AGENTS.md`) qui existe à la racine de son dossier, sinon le premier, à créer. | | 193 | | `Instructions(agent)` | Les instructions de l'agent (issue #113) : `{file, exists, content, version, files}` — le premier de `files` (d'après son programme : `CLAUDE.md` puis `AGENTS.md` pour Claude, `AGENTS.md` puis `GEMINI.md` pour Antigravity, sinon `AGENTS.md`) qui existe à la racine de son dossier, sinon le premier, à créer. | |
| 194 | | `CreateInstructions(agent, content)`, `SaveInstructions(agent, content, version)`, `ImportInstructions(agent, hostPath)`, `ChooseInstructions()` | Écrivent le fichier d'instructions — seul moyen de le faire, puisqu'il est protégé (`protect`) : depuis un modèle (refusé s'il existe), modifié par-dessus `version` (`{instructions, conflict}` ; `conflict` et rien d'écrit s'il a changé), ou copié depuis un fichier texte UTF-8 de cet ordinateur (1 Mio au plus ; il le remplace). Jamais supprimé. | | 194 | | `CreateInstructions(agent, content)`, `SaveInstructions(agent, content, version)`, `ImportInstructions(agent, hostPath)`, `ChooseInstructions()` | Écrivent le fichier d'instructions — seul moyen de le faire, puisqu'il est protégé (`protect`) : depuis un modèle (refusé s'il existe), modifié par-dessus `version` (`{instructions, conflict}` ; `conflict` et rien d'écrit s'il a changé), ou copié depuis un fichier texte UTF-8 de cet ordinateur (1 Mio au plus ; il le remplace). Jamais supprimé. | |
| 195 | +| `Skills(agent)`, `CreateSkill(agent, name, content)`, `SaveSkill(agent, path, content, version)`, `ImportSkill(agent, hostPath)`, `ChooseSkillFolder()` | Les skills de l'agent (issue #112) : `{dir, skills: [{folder, name, description, path}]}` — les dossiers de son dossier de skills (d'après son programme : `.claude/skills` pour Claude, `.vibe/skills` pour Vibe, `skills` ou le `skillsDir` de son `agent.yaml` pour mini-me, sinon `.agents/skills`) qui contiennent un `SKILL.md`, avec le `name` et la `description` de son en-tête. Créer (`name` : minuscules, chiffres et `-` ; refusé s'il est pris), enregistrer un `SKILL.md` par-dessus `version` (`{file, conflict}`), importer un dossier qui contient un `SKILL.md` (ses fichiers, sauf les cachés ; 200 fichiers et 20 Mio au plus) ou un fichier Markdown (devient `<nom>/SKILL.md`). Ne supprime jamais rien. | | ||
| 195 | | `Save(agent, path, content, version)` | Écrit le fichier s'il a toujours `version` ; sinon `{conflict: true}` et rien n'est écrit. Une `version` vide écrase. Le fichier est écrit à côté puis déplacé à sa place. | | 196 | | `Save(agent, path, content, version)` | Écrit le fichier s'il a toujours `version` ; sinon `{conflict: true}` et rien n'est écrit. Une `version` vide écrase. Le fichier est écrit à côté puis déplacé à sa place. | |
| 196 | | `Create(agent, dir, name)` | Crée un fichier vide ; refusé si le nom existe ou contient `/`. | | 197 | | `Create(agent, dir, name)` | Crée un fichier vide ; refusé si le nom existe ou contient `/`. | |
| 197 | | `Remove(agent, path)` | Supprime un fichier ou un dossier avec son contenu (voir le tableau ci-dessus). | | 198 | | `Remove(agent, path)` | Supprime un fichier ou un dossier avec son contenu (voir le tableau ci-dessus). | |
modified
docs/fr/reference/configuration.md +1 -1 | @@ -90,7 +90,7 @@ agentTools: | ||
| 90 | 90 | | `env` | dictionnaire texte → texte | non | | Variables d'environnement supplémentaires. | |
| 91 | 91 | | `afterStop` | liste de textes, au moins un | non | | Commande lancée à chaque fin du processus de l'agent — arrêt, crash, arrêt pour faire de la place, ou fermeture de Sidekicks : le programme (un nom seul est cherché dans le PATH, un chemin est relatif à ce fichier), puis ses arguments. Elle tourne dans `workspace` avec `env`, 30 s au plus ; sa sortie va dans le journal de l'agent ; Sidekicks l'attend avant de se fermer. Un programme introuvable est un avertissement. Exemple : `[../scripts/agents.sh, unload, alice]` pour décharger le modèle. | |
| 92 | 92 | | `workspace` | chemin | non | le dossier de la configuration | Le dossier de l'agent : le processus y démarre et c'est le `cwd` de ses sessions ACP. mm y lit `AGENTS.md` et `skills/`. | |
| 93 | -| `protect` | liste de textes | non | | Fichiers du dossier de l'agent que l'interface (onglet Files) ne peut ni modifier ni supprimer : chemins relatifs au dossier, ou motifs où `*` et `?` remplacent des caractères d'un nom et `**` un nombre quelconque de dossiers (`[AGENTS.md, "skills/**"]`). Un dossier qui contient un fichier protégé ne peut pas être supprimé. Toujours protégés, s'ils sont dans son dossier : `AGENTS.md`, `CLAUDE.md`, `GEMINI.md` (les instructions de l'agent, écrites seulement par son onglet Instructions, issue #113), `skills/**`, le fichier de configuration de l'agent (l'argument qui suit `--config`, `-config` ou `serve acp` dans `args`), et les fichiers à partir desquels `runtime.lifecycle` construit le conteneur ou la sandbox — le fichier Compose (après `-f`/`--file`, ou `compose.yaml`… sans lui), le `Dockerfile` du dossier des commandes pour un conteneur, le fichier d'environnement sbx (`sbxenv.yaml` ou celui nommé). Seule la configuration lève une protection ; l'agent lui-même, le terminal ou le Finder n'y sont pas soumis. | | |
| 93 | +| `protect` | liste de textes | non | | Fichiers du dossier de l'agent que l'interface (onglet Files) ne peut ni modifier ni supprimer : chemins relatifs au dossier, ou motifs où `*` et `?` remplacent des caractères d'un nom et `**` un nombre quelconque de dossiers (`[AGENTS.md, "skills/**"]`). Un dossier qui contient un fichier protégé ne peut pas être supprimé. Toujours protégés, s'ils sont dans son dossier : `AGENTS.md`, `CLAUDE.md`, `GEMINI.md` (les instructions de l'agent, écrites seulement par son onglet Instructions, issue #113), `skills/**`, `.claude/skills/**`, `.agents/skills/**`, `.vibe/skills/**` (ses skills, écrites seulement par son onglet Skills, issue #112), le fichier de configuration de l'agent (l'argument qui suit `--config`, `-config` ou `serve acp` dans `args`), et les fichiers à partir desquels `runtime.lifecycle` construit le conteneur ou la sandbox — le fichier Compose (après `-f`/`--file`, ou `compose.yaml`… sans lui), le `Dockerfile` du dossier des commandes pour un conteneur, le fichier d'environnement sbx (`sbxenv.yaml` ou celui nommé). Seule la configuration lève une protection ; l'agent lui-même, le terminal ou le Finder n'y sont pas soumis. | | |
| 94 | 94 | | `runtime` | objet | non | `{type: local}` | Où tourne l'agent (voir ci-dessous). | |
| 95 | 95 | |
| 96 | 96 | ### `runtime` |
| @@ -90,7 +90,7 @@ agentTools: | |||
| 90 | | `env` | dictionnaire texte → texte | non | | Variables d'environnement supplémentaires. | | 90 | | `env` | dictionnaire texte → texte | non | | Variables d'environnement supplémentaires. | |
| 91 | | `afterStop` | liste de textes, au moins un | non | | Commande lancée à chaque fin du processus de l'agent — arrêt, crash, arrêt pour faire de la place, ou fermeture de Sidekicks : le programme (un nom seul est cherché dans le PATH, un chemin est relatif à ce fichier), puis ses arguments. Elle tourne dans `workspace` avec `env`, 30 s au plus ; sa sortie va dans le journal de l'agent ; Sidekicks l'attend avant de se fermer. Un programme introuvable est un avertissement. Exemple : `[../scripts/agents.sh, unload, alice]` pour décharger le modèle. | | 91 | | `afterStop` | liste de textes, au moins un | non | | Commande lancée à chaque fin du processus de l'agent — arrêt, crash, arrêt pour faire de la place, ou fermeture de Sidekicks : le programme (un nom seul est cherché dans le PATH, un chemin est relatif à ce fichier), puis ses arguments. Elle tourne dans `workspace` avec `env`, 30 s au plus ; sa sortie va dans le journal de l'agent ; Sidekicks l'attend avant de se fermer. Un programme introuvable est un avertissement. Exemple : `[../scripts/agents.sh, unload, alice]` pour décharger le modèle. | |
| 92 | | `workspace` | chemin | non | le dossier de la configuration | Le dossier de l'agent : le processus y démarre et c'est le `cwd` de ses sessions ACP. mm y lit `AGENTS.md` et `skills/`. | | 92 | | `workspace` | chemin | non | le dossier de la configuration | Le dossier de l'agent : le processus y démarre et c'est le `cwd` de ses sessions ACP. mm y lit `AGENTS.md` et `skills/`. | |
| 93 | -| `protect` | liste de textes | non | | Fichiers du dossier de l'agent que l'interface (onglet Files) ne peut ni modifier ni supprimer : chemins relatifs au dossier, ou motifs où `*` et `?` remplacent des caractères d'un nom et `**` un nombre quelconque de dossiers (`[AGENTS.md, "skills/**"]`). Un dossier qui contient un fichier protégé ne peut pas être supprimé. Toujours protégés, s'ils sont dans son dossier : `AGENTS.md`, `CLAUDE.md`, `GEMINI.md` (les instructions de l'agent, écrites seulement par son onglet Instructions, issue #113), `skills/**`, le fichier de configuration de l'agent (l'argument qui suit `--config`, `-config` ou `serve acp` dans `args`), et les fichiers à partir desquels `runtime.lifecycle` construit le conteneur ou la sandbox — le fichier Compose (après `-f`/`--file`, ou `compose.yaml`… sans lui), le `Dockerfile` du dossier des commandes pour un conteneur, le fichier d'environnement sbx (`sbxenv.yaml` ou celui nommé). Seule la configuration lève une protection ; l'agent lui-même, le terminal ou le Finder n'y sont pas soumis. | | 93 | +| `protect` | liste de textes | non | | Fichiers du dossier de l'agent que l'interface (onglet Files) ne peut ni modifier ni supprimer : chemins relatifs au dossier, ou motifs où `*` et `?` remplacent des caractères d'un nom et `**` un nombre quelconque de dossiers (`[AGENTS.md, "skills/**"]`). Un dossier qui contient un fichier protégé ne peut pas être supprimé. Toujours protégés, s'ils sont dans son dossier : `AGENTS.md`, `CLAUDE.md`, `GEMINI.md` (les instructions de l'agent, écrites seulement par son onglet Instructions, issue #113), `skills/**`, `.claude/skills/**`, `.agents/skills/**`, `.vibe/skills/**` (ses skills, écrites seulement par son onglet Skills, issue #112), le fichier de configuration de l'agent (l'argument qui suit `--config`, `-config` ou `serve acp` dans `args`), et les fichiers à partir desquels `runtime.lifecycle` construit le conteneur ou la sandbox — le fichier Compose (après `-f`/`--file`, ou `compose.yaml`… sans lui), le `Dockerfile` du dossier des commandes pour un conteneur, le fichier d'environnement sbx (`sbxenv.yaml` ou celui nommé). Seule la configuration lève une protection ; l'agent lui-même, le terminal ou le Finder n'y sont pas soumis. | |
| 94 | | `runtime` | objet | non | `{type: local}` | Où tourne l'agent (voir ci-dessous). | | 94 | | `runtime` | objet | non | `{type: local}` | Où tourne l'agent (voir ci-dessous). | |
| 95 | 95 | ||
| 96 | ### `runtime` | 96 | ### `runtime` |
modified
docs/release-notes/v1.7.0.fr.md +7 -0 | @@ -20,6 +20,13 @@ Brouillon — complété au fil des tickets de la 1.7.0. | ||
| 20 | 20 | |
| 21 | 21 | → [Les fichiers et le terminal d'un agent](https://rickub.com/bots-garden/sidekicks/blob/v1.7.0/docs/fr/how-to/fichiers-et-terminal-d-un-agent.md) |
| 22 | 22 | |
| 23 | +### Donner des skills à un agent (#112) | |
| 24 | + | |
| 25 | +- Un nouvel onglet **Skills** dans le workspace d'un agent liste ses skills — le format Agent Skills que lisent tous les agents, dans le dossier de son type (`.claude/skills`, `.agents/skills`, `.vibe/skills`, `skills` de mini-me) : créez-en une depuis un modèle, modifiez son `SKILL.md`, ou importez le dossier d'une skill ou un fichier Markdown de cet ordinateur. **Redémarrer l'agent** lui fait découvrir les nouvelles. | |
| 26 | +- Les dossiers de skills restent protégés dans l'onglet Fichiers : seul l'onglet Skills y écrit. | |
| 27 | + | |
| 28 | +→ [Les fichiers et le terminal d'un agent](https://rickub.com/bots-garden/sidekicks/blob/v1.7.0/docs/fr/how-to/fichiers-et-terminal-d-un-agent.md) | |
| 29 | + | |
| 23 | 30 | ### Petits changements |
| 24 | 31 | |
| 25 | 32 | - Le code d'un fichier dont un agent donne le lien dans sa réponse est maintenant coloré dans le panneau à côté de la conversation, comme dans l'onglet Fichiers, en lecture seule (#117). |
| @@ -20,6 +20,13 @@ Brouillon — complété au fil des tickets de la 1.7.0. | |||
| 20 | 20 | ||
| 21 | → [Les fichiers et le terminal d'un agent](https://rickub.com/bots-garden/sidekicks/blob/v1.7.0/docs/fr/how-to/fichiers-et-terminal-d-un-agent.md) | 21 | → [Les fichiers et le terminal d'un agent](https://rickub.com/bots-garden/sidekicks/blob/v1.7.0/docs/fr/how-to/fichiers-et-terminal-d-un-agent.md) |
| 22 | 22 | ||
| 23 | +### Donner des skills à un agent (#112) | ||
| 24 | + | ||
| 25 | +- Un nouvel onglet **Skills** dans le workspace d'un agent liste ses skills — le format Agent Skills que lisent tous les agents, dans le dossier de son type (`.claude/skills`, `.agents/skills`, `.vibe/skills`, `skills` de mini-me) : créez-en une depuis un modèle, modifiez son `SKILL.md`, ou importez le dossier d'une skill ou un fichier Markdown de cet ordinateur. **Redémarrer l'agent** lui fait découvrir les nouvelles. | ||
| 26 | +- Les dossiers de skills restent protégés dans l'onglet Fichiers : seul l'onglet Skills y écrit. | ||
| 27 | + | ||
| 28 | +→ [Les fichiers et le terminal d'un agent](https://rickub.com/bots-garden/sidekicks/blob/v1.7.0/docs/fr/how-to/fichiers-et-terminal-d-un-agent.md) | ||
| 29 | + | ||
| 23 | ### Petits changements | 30 | ### Petits changements |
| 24 | 31 | ||
| 25 | - Le code d'un fichier dont un agent donne le lien dans sa réponse est maintenant coloré dans le panneau à côté de la conversation, comme dans l'onglet Fichiers, en lecture seule (#117). | 32 | - Le code d'un fichier dont un agent donne le lien dans sa réponse est maintenant coloré dans le panneau à côté de la conversation, comme dans l'onglet Fichiers, en lecture seule (#117). |
modified
docs/release-notes/v1.7.0.md +7 -0 | @@ -20,6 +20,13 @@ Draft — completed as the 1.7.0 tickets are done. | ||
| 20 | 20 | |
| 21 | 21 | → [Work with an agent's files and terminal](https://rickub.com/bots-garden/sidekicks/blob/v1.7.0/docs/en/how-to/work-with-an-agents-files.md#give-the-agent-its-instructions) |
| 22 | 22 | |
| 23 | +### Give an agent skills (#112) | |
| 24 | + | |
| 25 | +- A new **Skills** tab in an agent's workspace lists its skills — the Agent Skills format every agent reads, in the folder its kind uses (`.claude/skills`, `.agents/skills`, `.vibe/skills`, mini-me's `skills`): create one from a template, edit its `SKILL.md`, or import a skill folder or a Markdown file of this computer. **Restart the agent** makes it find the new ones. | |
| 26 | +- The skills folders stay protected in the Files tab: only the Skills tab writes there. | |
| 27 | + | |
| 28 | +→ [Work with an agent's files and terminal](https://rickub.com/bots-garden/sidekicks/blob/v1.7.0/docs/en/how-to/work-with-an-agents-files.md#give-the-agent-skills) | |
| 29 | + | |
| 23 | 30 | ### Smaller changes |
| 24 | 31 | |
| 25 | 32 | - The code of a file an agent links to in its answer is now coloured in the panel beside the conversation, like in the Files tab, read-only (#117). |
| @@ -20,6 +20,13 @@ Draft — completed as the 1.7.0 tickets are done. | |||
| 20 | 20 | ||
| 21 | → [Work with an agent's files and terminal](https://rickub.com/bots-garden/sidekicks/blob/v1.7.0/docs/en/how-to/work-with-an-agents-files.md#give-the-agent-its-instructions) | 21 | → [Work with an agent's files and terminal](https://rickub.com/bots-garden/sidekicks/blob/v1.7.0/docs/en/how-to/work-with-an-agents-files.md#give-the-agent-its-instructions) |
| 22 | 22 | ||
| 23 | +### Give an agent skills (#112) | ||
| 24 | + | ||
| 25 | +- A new **Skills** tab in an agent's workspace lists its skills — the Agent Skills format every agent reads, in the folder its kind uses (`.claude/skills`, `.agents/skills`, `.vibe/skills`, mini-me's `skills`): create one from a template, edit its `SKILL.md`, or import a skill folder or a Markdown file of this computer. **Restart the agent** makes it find the new ones. | ||
| 26 | +- The skills folders stay protected in the Files tab: only the Skills tab writes there. | ||
| 27 | + | ||
| 28 | +→ [Work with an agent's files and terminal](https://rickub.com/bots-garden/sidekicks/blob/v1.7.0/docs/en/how-to/work-with-an-agents-files.md#give-the-agent-skills) | ||
| 29 | + | ||
| 23 | ### Smaller changes | 30 | ### Smaller changes |
| 24 | 31 | ||
| 25 | - The code of a file an agent links to in its answer is now coloured in the panel beside the conversation, like in the Files tab, read-only (#117). | 32 | - The code of a file an agent links to in its answer is now coloured in the panel beside the conversation, like in the Files tab, read-only (#117). |
modified
frontend/bindings/git.rickub.com/bots-garden/sidekicks/internal/app/index.ts +3 -0 | @@ -38,6 +38,9 @@ export type { | ||
| 38 | 38 | SaveResult, |
| 39 | 39 | SbxCheck, |
| 40 | 40 | SbxCreateForm, |
| 41 | + Skill, | |
| 42 | + SkillSave, | |
| 43 | + Skills, | |
| 41 | 44 | UnloadResult, |
| 42 | 45 | WorkspaceInfo |
| 43 | 46 | } from "./models.js"; |
| @@ -38,6 +38,9 @@ export type { | |||
| 38 | SaveResult, | 38 | SaveResult, |
| 39 | SbxCheck, | 39 | SbxCheck, |
| 40 | SbxCreateForm, | 40 | SbxCreateForm, |
| 41 | + Skill, | ||
| 42 | + SkillSave, | ||
| 43 | + Skills, | ||
| 41 | UnloadResult, | 44 | UnloadResult, |
| 42 | WorkspaceInfo | 45 | WorkspaceInfo |
| 43 | } from "./models.js"; | 46 | } from "./models.js"; |
modified
frontend/bindings/git.rickub.com/bots-garden/sidekicks/internal/app/models.ts +28 -0 | @@ -310,6 +310,34 @@ export interface SbxCreateForm { | ||
| 310 | 310 | "icon": string; |
| 311 | 311 | } |
| 312 | 312 | |
| 313 | +/** | |
| 314 | + * Skill is one skill of an agent: its folder's name, the name and the | |
| 315 | + * description of its SKILL.md, and that file's path in the agent's folder. | |
| 316 | + */ | |
| 317 | +export interface Skill { | |
| 318 | + "folder": string; | |
| 319 | + "name": string; | |
| 320 | + "description": string; | |
| 321 | + "path": string; | |
| 322 | +} | |
| 323 | + | |
| 324 | +/** | |
| 325 | + * SkillSave is the result of SaveSkill: the file written, or Conflict when | |
| 326 | + * it changed since it was read — nothing was written then. | |
| 327 | + */ | |
| 328 | +export interface SkillSave { | |
| 329 | + "file": workspace$0.File; | |
| 330 | + "conflict": boolean; | |
| 331 | +} | |
| 332 | + | |
| 333 | +/** | |
| 334 | + * Skills is an agent's skills folder and what it holds. | |
| 335 | + */ | |
| 336 | +export interface Skills { | |
| 337 | + "dir": string; | |
| 338 | + "skills": Skill[] | null; | |
| 339 | +} | |
| 340 | + | |
| 313 | 341 | /** |
| 314 | 342 | * UnloadResult says which agents unloaded their model, and which running |
| 315 | 343 | * agents were left alone: answering, unable to unload, or failing. |
| @@ -310,6 +310,34 @@ export interface SbxCreateForm { | |||
| 310 | "icon": string; | 310 | "icon": string; |
| 311 | } | 311 | } |
| 312 | 312 | ||
| 313 | +/** | ||
| 314 | + * Skill is one skill of an agent: its folder's name, the name and the | ||
| 315 | + * description of its SKILL.md, and that file's path in the agent's folder. | ||
| 316 | + */ | ||
| 317 | +export interface Skill { | ||
| 318 | + "folder": string; | ||
| 319 | + "name": string; | ||
| 320 | + "description": string; | ||
| 321 | + "path": string; | ||
| 322 | +} | ||
| 323 | + | ||
| 324 | +/** | ||
| 325 | + * SkillSave is the result of SaveSkill: the file written, or Conflict when | ||
| 326 | + * it changed since it was read — nothing was written then. | ||
| 327 | + */ | ||
| 328 | +export interface SkillSave { | ||
| 329 | + "file": workspace$0.File; | ||
| 330 | + "conflict": boolean; | ||
| 331 | +} | ||
| 332 | + | ||
| 333 | +/** | ||
| 334 | + * Skills is an agent's skills folder and what it holds. | ||
| 335 | + */ | ||
| 336 | +export interface Skills { | ||
| 337 | + "dir": string; | ||
| 338 | + "skills": Skill[] | null; | ||
| 339 | +} | ||
| 340 | + | ||
| 313 | /** | 341 | /** |
| 314 | * UnloadResult says which agents unloaded their model, and which running | 342 | * UnloadResult says which agents unloaded their model, and which running |
| 315 | * agents were left alone: answering, unable to unload, or failing. | 343 | * agents were left alone: answering, unable to unload, or failing. |
modified
frontend/bindings/git.rickub.com/bots-garden/sidekicks/internal/app/workspaceservice.ts +50 -0 | @@ -50,6 +50,14 @@ export function ChooseInstructions(): $CancellablePromise<string> { | ||
| 50 | 50 | return $Call.ByID(4180143450); |
| 51 | 51 | } |
| 52 | 52 | |
| 53 | +/** | |
| 54 | + * ChooseSkillFolder asks the user for a skill folder to import; "" when | |
| 55 | + * they cancelled. A single Markdown file is chosen with ChooseInstructions. | |
| 56 | + */ | |
| 57 | +export function ChooseSkillFolder(): $CancellablePromise<string> { | |
| 58 | + return $Call.ByID(4121538608); | |
| 59 | +} | |
| 60 | + | |
| 53 | 61 | /** |
| 54 | 62 | * Create creates an empty file in folder dir. |
| 55 | 63 | */ |
| @@ -73,6 +81,14 @@ export function CreateInstructions(agent: string, content: string): $Cancellable | ||
| 73 | 81 | return $Call.ByID(623963639, agent, content); |
| 74 | 82 | } |
| 75 | 83 | |
| 84 | +/** | |
| 85 | + * CreateSkill creates the skill name — a folder of the skills folder with | |
| 86 | + * content as its SKILL.md (a template the interface fills in). | |
| 87 | + */ | |
| 88 | +export function CreateSkill(agent: string, name: string, content: string): $CancellablePromise<$models.Skill> { | |
| 89 | + return $Call.ByID(993126163, agent, name, content); | |
| 90 | +} | |
| 91 | + | |
| 76 | 92 | /** |
| 77 | 93 | * Duplicate copies files and folders next to themselves, under a free name |
| 78 | 94 | * with "-copy" before the extension (plan.md → plan-copy.md, then |
| @@ -104,6 +120,16 @@ export function ImportInstructions(agent: string, hostPath: string): $Cancellabl | ||
| 104 | 120 | return $Call.ByID(1158620406, agent, hostPath); |
| 105 | 121 | } |
| 106 | 122 | |
| 123 | +/** | |
| 124 | + * ImportSkill copies a skill of this computer into the agent's skills | |
| 125 | + * folder: a folder holding a SKILL.md (with its other files: scripts, | |
| 126 | + * examples…), or a single Markdown file that becomes the SKILL.md of a new | |
| 127 | + * folder named after its front matter's name, else after the file. | |
| 128 | + */ | |
| 129 | +export function ImportSkill(agent: string, hostPath: string): $CancellablePromise<$models.Skill> { | |
| 130 | + return $Call.ByID(4089885336, agent, hostPath); | |
| 131 | +} | |
| 132 | + | |
| 107 | 133 | /** |
| 108 | 134 | * Info describes the agent's folder. |
| 109 | 135 | */ |
| @@ -154,6 +180,14 @@ export function Read(agent: string, file: string): $CancellablePromise<workspace | ||
| 154 | 180 | return $Call.ByID(2730751246, agent, file); |
| 155 | 181 | } |
| 156 | 182 | |
| 183 | +/** | |
| 184 | + * ReadSkill reads a skill's file, from the agent's folder on this computer | |
| 185 | + * when it has one (see settingsWorkspaceOf): the sandbox need not run. | |
| 186 | + */ | |
| 187 | +export function ReadSkill(agent: string, file: string): $CancellablePromise<workspace$0.File> { | |
| 188 | + return $Call.ByID(3036087191, agent, file); | |
| 189 | +} | |
| 190 | + | |
| 157 | 191 | /** |
| 158 | 192 | * Remove removes a file or a folder; on this computer it goes to the trash. |
| 159 | 193 | * A protected file, or a folder that holds one, is refused. |
| @@ -206,6 +240,22 @@ export function SaveInstructions(agent: string, content: string, version: string | ||
| 206 | 240 | return $Call.ByID(1925077950, agent, content, version); |
| 207 | 241 | } |
| 208 | 242 | |
| 243 | +/** | |
| 244 | + * SaveSkill writes a skill's SKILL.md edited in the Skills tab, over the | |
| 245 | + * version read; only a SKILL.md of the agent's skills folder. | |
| 246 | + */ | |
| 247 | +export function SaveSkill(agent: string, file: string, content: string, version: string): $CancellablePromise<$models.SkillSave> { | |
| 248 | + return $Call.ByID(3661463072, agent, file, content, version); | |
| 249 | +} | |
| 250 | + | |
| 251 | +/** | |
| 252 | + * Skills lists the agent's skills: every folder of its skills folder that | |
| 253 | + * holds a SKILL.md, by name. | |
| 254 | + */ | |
| 255 | +export function Skills(agent: string): $CancellablePromise<$models.Skills> { | |
| 256 | + return $Call.ByID(43803700, agent); | |
| 257 | +} | |
| 258 | + | |
| 209 | 259 | /** |
| 210 | 260 | * Unwatch stops following changes. |
| 211 | 261 | */ |
| @@ -50,6 +50,14 @@ export function ChooseInstructions(): $CancellablePromise<string> { | |||
| 50 | return $Call.ByID(4180143450); | 50 | return $Call.ByID(4180143450); |
| 51 | } | 51 | } |
| 52 | 52 | ||
| 53 | +/** | ||
| 54 | + * ChooseSkillFolder asks the user for a skill folder to import; "" when | ||
| 55 | + * they cancelled. A single Markdown file is chosen with ChooseInstructions. | ||
| 56 | + */ | ||
| 57 | +export function ChooseSkillFolder(): $CancellablePromise<string> { | ||
| 58 | + return $Call.ByID(4121538608); | ||
| 59 | +} | ||
| 60 | + | ||
| 53 | /** | 61 | /** |
| 54 | * Create creates an empty file in folder dir. | 62 | * Create creates an empty file in folder dir. |
| 55 | */ | 63 | */ |
| @@ -73,6 +81,14 @@ export function CreateInstructions(agent: string, content: string): $Cancellable | |||
| 73 | return $Call.ByID(623963639, agent, content); | 81 | return $Call.ByID(623963639, agent, content); |
| 74 | } | 82 | } |
| 75 | 83 | ||
| 84 | +/** | ||
| 85 | + * CreateSkill creates the skill name — a folder of the skills folder with | ||
| 86 | + * content as its SKILL.md (a template the interface fills in). | ||
| 87 | + */ | ||
| 88 | +export function CreateSkill(agent: string, name: string, content: string): $CancellablePromise<$models.Skill> { | ||
| 89 | + return $Call.ByID(993126163, agent, name, content); | ||
| 90 | +} | ||
| 91 | + | ||
| 76 | /** | 92 | /** |
| 77 | * Duplicate copies files and folders next to themselves, under a free name | 93 | * Duplicate copies files and folders next to themselves, under a free name |
| 78 | * with "-copy" before the extension (plan.md → plan-copy.md, then | 94 | * with "-copy" before the extension (plan.md → plan-copy.md, then |
| @@ -104,6 +120,16 @@ export function ImportInstructions(agent: string, hostPath: string): $Cancellabl | |||
| 104 | return $Call.ByID(1158620406, agent, hostPath); | 120 | return $Call.ByID(1158620406, agent, hostPath); |
| 105 | } | 121 | } |
| 106 | 122 | ||
| 123 | +/** | ||
| 124 | + * ImportSkill copies a skill of this computer into the agent's skills | ||
| 125 | + * folder: a folder holding a SKILL.md (with its other files: scripts, | ||
| 126 | + * examples…), or a single Markdown file that becomes the SKILL.md of a new | ||
| 127 | + * folder named after its front matter's name, else after the file. | ||
| 128 | + */ | ||
| 129 | +export function ImportSkill(agent: string, hostPath: string): $CancellablePromise<$models.Skill> { | ||
| 130 | + return $Call.ByID(4089885336, agent, hostPath); | ||
| 131 | +} | ||
| 132 | + | ||
| 107 | /** | 133 | /** |
| 108 | * Info describes the agent's folder. | 134 | * Info describes the agent's folder. |
| 109 | */ | 135 | */ |
| @@ -154,6 +180,14 @@ export function Read(agent: string, file: string): $CancellablePromise<workspace | |||
| 154 | return $Call.ByID(2730751246, agent, file); | 180 | return $Call.ByID(2730751246, agent, file); |
| 155 | } | 181 | } |
| 156 | 182 | ||
| 183 | +/** | ||
| 184 | + * ReadSkill reads a skill's file, from the agent's folder on this computer | ||
| 185 | + * when it has one (see settingsWorkspaceOf): the sandbox need not run. | ||
| 186 | + */ | ||
| 187 | +export function ReadSkill(agent: string, file: string): $CancellablePromise<workspace$0.File> { | ||
| 188 | + return $Call.ByID(3036087191, agent, file); | ||
| 189 | +} | ||
| 190 | + | ||
| 157 | /** | 191 | /** |
| 158 | * Remove removes a file or a folder; on this computer it goes to the trash. | 192 | * Remove removes a file or a folder; on this computer it goes to the trash. |
| 159 | * A protected file, or a folder that holds one, is refused. | 193 | * A protected file, or a folder that holds one, is refused. |
| @@ -206,6 +240,22 @@ export function SaveInstructions(agent: string, content: string, version: string | |||
| 206 | return $Call.ByID(1925077950, agent, content, version); | 240 | return $Call.ByID(1925077950, agent, content, version); |
| 207 | } | 241 | } |
| 208 | 242 | ||
| 243 | +/** | ||
| 244 | + * SaveSkill writes a skill's SKILL.md edited in the Skills tab, over the | ||
| 245 | + * version read; only a SKILL.md of the agent's skills folder. | ||
| 246 | + */ | ||
| 247 | +export function SaveSkill(agent: string, file: string, content: string, version: string): $CancellablePromise<$models.SkillSave> { | ||
| 248 | + return $Call.ByID(3661463072, agent, file, content, version); | ||
| 249 | +} | ||
| 250 | + | ||
| 251 | +/** | ||
| 252 | + * Skills lists the agent's skills: every folder of its skills folder that | ||
| 253 | + * holds a SKILL.md, by name. | ||
| 254 | + */ | ||
| 255 | +export function Skills(agent: string): $CancellablePromise<$models.Skills> { | ||
| 256 | + return $Call.ByID(43803700, agent); | ||
| 257 | +} | ||
| 258 | + | ||
| 209 | /** | 259 | /** |
| 210 | * Unwatch stops following changes. | 260 | * Unwatch stops following changes. |
| 211 | */ | 261 | */ |
modified
frontend/src/lib/agent/AgentView.svelte +7 -3 | @@ -2,7 +2,7 @@ | ||
| 2 | 2 | <script lang="ts" module> |
| 3 | 3 | // The tab shown last for each agent: coming back to an agent shows its |
| 4 | 4 | // terminals again if they were in view (issue #72). |
| 5 | - const lastTab: Record<string, 'files' | 'instructions' | 'terminal' | 'log'> = {} | |
| 5 | + const lastTab: Record<string, 'files' | 'instructions' | 'skills' | 'terminal' | 'log'> = {} | |
| 6 | 6 | </script> |
| 7 | 7 | |
| 8 | 8 | <script lang="ts"> |
| @@ -18,6 +18,7 @@ | ||
| 18 | 18 | import FilesTab from './FilesTab.svelte' |
| 19 | 19 | import TerminalView from './TerminalView.svelte' |
| 20 | 20 | import InstructionsTab from './InstructionsTab.svelte' |
| 21 | + import SkillsTab from './SkillsTab.svelte' | |
| 21 | 22 | import { fewChannels, placeOf } from '../agentHeader' |
| 22 | 23 | import { signInKey } from '../signin' |
| 23 | 24 | import ErrorText from '../chat/ErrorText.svelte' |
| @@ -36,7 +37,7 @@ | ||
| 36 | 37 | return text ? t('workspace.channels', { channels: text }) : t('workspace.noChannel') |
| 37 | 38 | } |
| 38 | 39 | |
| 39 | - type Tab = 'files' | 'instructions' | 'terminal' | 'log' | |
| 40 | + type Tab = 'files' | 'instructions' | 'skills' | 'terminal' | 'log' | |
| 40 | 41 | // svelte-ignore state_referenced_locally |
| 41 | 42 | let tab: Tab = $state(lastTab[name] ?? 'files') |
| 42 | 43 | // The terminals of the agent (issues #72 and #73) live outside this view: |
| @@ -122,7 +123,7 @@ | ||
| 122 | 123 | {/if} |
| 123 | 124 | |
| 124 | 125 | <div class="tabs" role="tablist"> |
| 125 | - {#each ['files', 'instructions', 'terminal', 'log'] as const as each (each)} | |
| 126 | + {#each ['files', 'instructions', 'skills', 'terminal', 'log'] as const as each (each)} | |
| 126 | 127 | <button role="tab" aria-selected={tab === each} class:active={tab === each} onclick={() => show(each)}> |
| 127 | 128 | {t(`workspace.tab.${each}`)}{#if each === 'terminal' && runningTerminals(name) > 0}<span class="count" title={t('terminal.running', { count: runningTerminals(name) })}>{runningTerminals(name)}</span>{/if} |
| 128 | 129 | </button> |
| @@ -141,6 +142,9 @@ | ||
| 141 | 142 | {#if tab === 'instructions'} |
| 142 | 143 | <div class="pane"><InstructionsTab agent={name} /></div> |
| 143 | 144 | {/if} |
| 145 | + {#if tab === 'skills'} | |
| 146 | + <div class="pane"><SkillsTab agent={name} /></div> | |
| 147 | + {/if} | |
| 144 | 148 | {#if tab === 'terminal'} |
| 145 | 149 | <div class="pane terminals"> |
| 146 | 150 | {#if appState.signInAgent === name} |
| @@ -2,7 +2,7 @@ | |||
| 2 | <script lang="ts" module> | 2 | <script lang="ts" module> |
| 3 | // The tab shown last for each agent: coming back to an agent shows its | 3 | // The tab shown last for each agent: coming back to an agent shows its |
| 4 | // terminals again if they were in view (issue #72). | 4 | // terminals again if they were in view (issue #72). |
| 5 | - const lastTab: Record<string, 'files' | 'instructions' | 'terminal' | 'log'> = {} | 5 | + const lastTab: Record<string, 'files' | 'instructions' | 'skills' | 'terminal' | 'log'> = {} |
| 6 | </script> | 6 | </script> |
| 7 | 7 | ||
| 8 | <script lang="ts"> | 8 | <script lang="ts"> |
| @@ -18,6 +18,7 @@ | |||
| 18 | import FilesTab from './FilesTab.svelte' | 18 | import FilesTab from './FilesTab.svelte' |
| 19 | import TerminalView from './TerminalView.svelte' | 19 | import TerminalView from './TerminalView.svelte' |
| 20 | import InstructionsTab from './InstructionsTab.svelte' | 20 | import InstructionsTab from './InstructionsTab.svelte' |
| 21 | + import SkillsTab from './SkillsTab.svelte' | ||
| 21 | import { fewChannels, placeOf } from '../agentHeader' | 22 | import { fewChannels, placeOf } from '../agentHeader' |
| 22 | import { signInKey } from '../signin' | 23 | import { signInKey } from '../signin' |
| 23 | import ErrorText from '../chat/ErrorText.svelte' | 24 | import ErrorText from '../chat/ErrorText.svelte' |
| @@ -36,7 +37,7 @@ | |||
| 36 | return text ? t('workspace.channels', { channels: text }) : t('workspace.noChannel') | 37 | return text ? t('workspace.channels', { channels: text }) : t('workspace.noChannel') |
| 37 | } | 38 | } |
| 38 | 39 | ||
| 39 | - type Tab = 'files' | 'instructions' | 'terminal' | 'log' | 40 | + type Tab = 'files' | 'instructions' | 'skills' | 'terminal' | 'log' |
| 40 | // svelte-ignore state_referenced_locally | 41 | // svelte-ignore state_referenced_locally |
| 41 | let tab: Tab = $state(lastTab[name] ?? 'files') | 42 | let tab: Tab = $state(lastTab[name] ?? 'files') |
| 42 | // The terminals of the agent (issues #72 and #73) live outside this view: | 43 | // The terminals of the agent (issues #72 and #73) live outside this view: |
| @@ -122,7 +123,7 @@ | |||
| 122 | {/if} | 123 | {/if} |
| 123 | 124 | ||
| 124 | <div class="tabs" role="tablist"> | 125 | <div class="tabs" role="tablist"> |
| 125 | - {#each ['files', 'instructions', 'terminal', 'log'] as const as each (each)} | 126 | + {#each ['files', 'instructions', 'skills', 'terminal', 'log'] as const as each (each)} |
| 126 | <button role="tab" aria-selected={tab === each} class:active={tab === each} onclick={() => show(each)}> | 127 | <button role="tab" aria-selected={tab === each} class:active={tab === each} onclick={() => show(each)}> |
| 127 | {t(`workspace.tab.${each}`)}{#if each === 'terminal' && runningTerminals(name) > 0}<span class="count" title={t('terminal.running', { count: runningTerminals(name) })}>{runningTerminals(name)}</span>{/if} | 128 | {t(`workspace.tab.${each}`)}{#if each === 'terminal' && runningTerminals(name) > 0}<span class="count" title={t('terminal.running', { count: runningTerminals(name) })}>{runningTerminals(name)}</span>{/if} |
| 128 | </button> | 129 | </button> |
| @@ -141,6 +142,9 @@ | |||
| 141 | {#if tab === 'instructions'} | 142 | {#if tab === 'instructions'} |
| 142 | <div class="pane"><InstructionsTab agent={name} /></div> | 143 | <div class="pane"><InstructionsTab agent={name} /></div> |
| 143 | {/if} | 144 | {/if} |
| 145 | + {#if tab === 'skills'} | ||
| 146 | + <div class="pane"><SkillsTab agent={name} /></div> | ||
| 147 | + {/if} | ||
| 144 | {#if tab === 'terminal'} | 148 | {#if tab === 'terminal'} |
| 145 | <div class="pane terminals"> | 149 | <div class="pane terminals"> |
| 146 | {#if appState.signInAgent === name} | 150 | {#if appState.signInAgent === name} |
added
frontend/src/lib/agent/SkillsTab.svelte +238 -0 | new file mode 100644 | ||
| @@ -0,0 +1,238 @@ | ||
| 1 | +<!-- Copyright (c) 2026 Philippe Charrière — Sidekicks Source-Available License 1.0, see LICENSE --> | |
| 2 | +<script lang="ts"> | |
| 3 | + // An agent's skills (issue #112): the folder its program reads them in | |
| 4 | + // (.claude/skills for Claude, .agents/skills for Codex, Antigravity and | |
| 5 | + // Copilot, .vibe/skills for Vibe, skills — or its agent.yaml's skillsDir — | |
| 6 | + // for mini-me), one folder per skill with its SKILL.md. Listed, created | |
| 7 | + // from a template, edited, imported from a folder or a file of this | |
| 8 | + // computer. Like the instructions, the folder is protected in the Files | |
| 9 | + // tab: this tab writes there, and never removes anything. | |
| 10 | + import { onMount } from 'svelte' | |
| 11 | + import { AgentService, WorkspaceService } from '../../../bindings/git.rickub.com/bots-garden/sidekicks/internal/app' | |
| 12 | + import type { Skill, Skills } from '../../../bindings/git.rickub.com/bots-garden/sidekicks/internal/app' | |
| 13 | + import type { File } from '../../../bindings/git.rickub.com/bots-garden/sidekicks/internal/workspace' | |
| 14 | + import { t } from '../i18n/index.svelte' | |
| 15 | + import { act, appState } from '../state.svelte' | |
| 16 | + import { skillNameOf, skillTemplate, validSkillName } from '../skills' | |
| 17 | + import ErrorText from '../chat/ErrorText.svelte' | |
| 18 | + import FileEditor from './FileEditor.svelte' | |
| 19 | + | |
| 20 | + let { agent }: { agent: string } = $props() | |
| 21 | + | |
| 22 | + const status = $derived(appState.agents.find((candidate) => candidate.name === agent)) | |
| 23 | + const running = $derived(['ready', 'busy'].includes(status?.state ?? '')) | |
| 24 | + let skills = $state<Skills | null>(null) | |
| 25 | + let selected = $state<Skill | null>(null) | |
| 26 | + let file = $state<File | null>(null) | |
| 27 | + let text = $state('') | |
| 28 | + let conflict = $state(false) | |
| 29 | + let problem = $state('') | |
| 30 | + let busy = $state(false) | |
| 31 | + let written = $state(false) | |
| 32 | + // The "new skill" form. | |
| 33 | + let creating = $state(false) | |
| 34 | + let newTitle = $state('') | |
| 35 | + let newName = $state('') | |
| 36 | + let nameTouched = $state(false) | |
| 37 | + let newDescription = $state('') | |
| 38 | + const dirty = $derived(file !== null && text !== file.content) | |
| 39 | + | |
| 40 | + function errorOf(error: unknown): string { | |
| 41 | + return error instanceof Error ? error.message : String(error) | |
| 42 | + } | |
| 43 | + | |
| 44 | + async function load(open = selected?.folder) { | |
| 45 | + problem = '' | |
| 46 | + try { | |
| 47 | + skills = await WorkspaceService.Skills(agent) | |
| 48 | + const again = skills?.skills?.find((skill) => skill.folder === open) | |
| 49 | + if (again) await select(again) | |
| 50 | + } catch (error) { | |
| 51 | + problem = errorOf(error) | |
| 52 | + } | |
| 53 | + } | |
| 54 | + onMount(() => load()) | |
| 55 | + | |
| 56 | + async function select(skill: Skill) { | |
| 57 | + creating = false | |
| 58 | + selected = skill | |
| 59 | + conflict = false | |
| 60 | + try { | |
| 61 | + file = await WorkspaceService.ReadSkill(agent, skill.path) | |
| 62 | + text = file?.content ?? '' | |
| 63 | + } catch (error) { | |
| 64 | + problem = errorOf(error) | |
| 65 | + } | |
| 66 | + } | |
| 67 | + | |
| 68 | + async function save() { | |
| 69 | + if (!file || !selected || !dirty) return | |
| 70 | + busy = true | |
| 71 | + problem = '' | |
| 72 | + try { | |
| 73 | + const result = await WorkspaceService.SaveSkill(agent, selected.path, text, file.version) | |
| 74 | + if (result?.conflict) conflict = true | |
| 75 | + else { | |
| 76 | + written = true | |
| 77 | + await load(selected.folder) | |
| 78 | + } | |
| 79 | + } catch (error) { | |
| 80 | + problem = errorOf(error) | |
| 81 | + } finally { | |
| 82 | + busy = false | |
| 83 | + } | |
| 84 | + } | |
| 85 | + | |
| 86 | + function startCreating() { | |
| 87 | + creating = true | |
| 88 | + selected = null | |
| 89 | + file = null | |
| 90 | + newTitle = '' | |
| 91 | + newName = '' | |
| 92 | + nameTouched = false | |
| 93 | + newDescription = '' | |
| 94 | + } | |
| 95 | + | |
| 96 | + async function create(event: SubmitEvent) { | |
| 97 | + event.preventDefault() | |
| 98 | + if (!validSkillName(newName) || !newDescription.trim()) return | |
| 99 | + busy = true | |
| 100 | + problem = '' | |
| 101 | + try { | |
| 102 | + const skill = await WorkspaceService.CreateSkill(agent, newName, skillTemplate(newName, newDescription, newTitle)) | |
| 103 | + written = true | |
| 104 | + creating = false | |
| 105 | + await load(skill?.folder) | |
| 106 | + } catch (error) { | |
| 107 | + problem = errorOf(error) | |
| 108 | + } finally { | |
| 109 | + busy = false | |
| 110 | + } | |
| 111 | + } | |
| 112 | + | |
| 113 | + async function importFrom(choose: () => Promise<string>) { | |
| 114 | + problem = '' | |
| 115 | + const path = await choose().catch((error) => ((problem = errorOf(error)), '')) | |
| 116 | + if (!path) return | |
| 117 | + busy = true | |
| 118 | + try { | |
| 119 | + const skill = await WorkspaceService.ImportSkill(agent, path) | |
| 120 | + written = true | |
| 121 | + await load(skill?.folder) | |
| 122 | + } catch (error) { | |
| 123 | + problem = errorOf(error) | |
| 124 | + } finally { | |
| 125 | + busy = false | |
| 126 | + } | |
| 127 | + } | |
| 128 | + | |
| 129 | + function restart() { | |
| 130 | + written = false | |
| 131 | + void act(() => AgentService.Restart(agent)) | |
| 132 | + } | |
| 133 | +</script> | |
| 134 | + | |
| 135 | +<div class="skills"> | |
| 136 | + {#if skills} | |
| 137 | + <p class="intro">{t('skills.intro', { agent: status?.title || agent, dir: skills.dir })}</p> | |
| 138 | + {#if problem}<div class="problem" role="alert"><ErrorText raw={problem} /></div>{/if} | |
| 139 | + {#if written && running} | |
| 140 | + <div class="note" role="status"> | |
| 141 | + <span>{t('skills.restart', { agent: status?.title || agent })}</span> | |
| 142 | + <button type="button" onclick={restart}>{t('instructions.restartButton')}</button> | |
| 143 | + </div> | |
| 144 | + {/if} | |
| 145 | + <div class="columns"> | |
| 146 | + <aside class="list"> | |
| 147 | + {#each skills.skills ?? [] as skill (skill.folder)} | |
| 148 | + <button type="button" class="skill" class:active={selected?.folder === skill.folder} onclick={() => select(skill)} title={skill.description}> | |
| 149 | + <strong>{skill.name}</strong> | |
| 150 | + {#if skill.description}<small>{skill.description}</small>{/if} | |
| 151 | + </button> | |
| 152 | + {:else} | |
| 153 | + <p class="muted">{t('skills.none')}</p> | |
| 154 | + {/each} | |
| 155 | + <div class="list-actions"> | |
| 156 | + <button type="button" class="primary" onclick={startCreating} disabled={busy}>{t('skills.new')}</button> | |
| 157 | + <button type="button" onclick={() => importFrom(WorkspaceService.ChooseSkillFolder)} disabled={busy}>{t('skills.importFolder')}</button> | |
| 158 | + <button type="button" onclick={() => importFrom(WorkspaceService.ChooseInstructions)} disabled={busy}>{t('skills.importFile')}</button> | |
| 159 | + </div> | |
| 160 | + </aside> | |
| 161 | + <section class="detail"> | |
| 162 | + {#if creating} | |
| 163 | + <form class="new" onsubmit={create}> | |
| 164 | + <h3>{t('skills.new')}</h3> | |
| 165 | + <label> | |
| 166 | + {t('skills.title')} | |
| 167 | + <!-- svelte-ignore a11y_autofocus --> | |
| 168 | + <input bind:value={newTitle} oninput={() => { if (!nameTouched) newName = skillNameOf(newTitle) }} autofocus /> | |
| 169 | + </label> | |
| 170 | + <label> | |
| 171 | + {t('skills.name')} | |
| 172 | + <input bind:value={newName} oninput={() => (nameTouched = true)} spellcheck="false" autocapitalize="off" /> | |
| 173 | + <small class:bad={newName !== '' && !validSkillName(newName)}>{t('skills.nameHint', { dir: `${skills.dir}/${newName || '…'}/SKILL.md` })}</small> | |
| 174 | + </label> | |
| 175 | + <label> | |
| 176 | + {t('skills.description')} | |
| 177 | + <textarea bind:value={newDescription} rows="3"></textarea> | |
| 178 | + <small>{t('skills.descriptionHint')}</small> | |
| 179 | + </label> | |
| 180 | + <div class="actions"> | |
| 181 | + <button type="button" onclick={() => (creating = false)}>{t('creator.cancel')}</button> | |
| 182 | + <button type="submit" class="primary" disabled={busy || !validSkillName(newName) || !newDescription.trim()}>{t('skills.create')}</button> | |
| 183 | + </div> | |
| 184 | + </form> | |
| 185 | + {:else if selected && file} | |
| 186 | + {#if conflict} | |
| 187 | + <div class="problem" role="alert"> | |
| 188 | + {t('instructions.conflict', { file: selected.path })} | |
| 189 | + <button type="button" onclick={() => selected && select(selected)}>{t('instructions.reload')}</button> | |
| 190 | + </div> | |
| 191 | + {/if} | |
| 192 | + <p class="path">{selected.path}</p> | |
| 193 | + <div class="editor"> | |
| 194 | + {#key file.version} | |
| 195 | + <FileEditor content={file.content} language="markdown" onChange={(next) => (text = next)} onSave={save} /> | |
| 196 | + {/key} | |
| 197 | + </div> | |
| 198 | + <div class="actions"> | |
| 199 | + <span class="grow"></span> | |
| 200 | + <button type="button" onclick={() => selected && select(selected)} disabled={busy || !dirty}>{t('instructions.revert')}</button> | |
| 201 | + <button type="button" class="primary" onclick={save} disabled={busy || !dirty}>{t('instructions.save')}</button> | |
| 202 | + </div> | |
| 203 | + {:else} | |
| 204 | + <p class="muted">{t('skills.pick')}</p> | |
| 205 | + {/if} | |
| 206 | + </section> | |
| 207 | + </div> | |
| 208 | + {:else if problem} | |
| 209 | + <div class="problem" role="alert"><ErrorText raw={problem} /></div> | |
| 210 | + {:else} | |
| 211 | + <p class="muted">…</p> | |
| 212 | + {/if} | |
| 213 | +</div> | |
| 214 | + | |
| 215 | +<style> | |
| 216 | + .skills { height: 100%; display: flex; flex-direction: column; gap: 10px; min-height: 0; } | |
| 217 | + p, h3 { margin: 0; } | |
| 218 | + .intro, .muted, .path { color: var(--muted); font-size: 13px; } | |
| 219 | + .path { font-family: var(--mono); font-size: 12px; } | |
| 220 | + .columns { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(200px, 30%) 1fr; gap: 12px; } | |
| 221 | + .list { display: flex; flex-direction: column; gap: 6px; overflow-y: auto; min-height: 0; border: 1px solid var(--border); border-radius: 6px; padding: 8px; } | |
| 222 | + .skill { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; text-align: left; padding: 6px 8px; border: 1px solid transparent; border-radius: 6px; background: none; } | |
| 223 | + .skill small { color: var(--muted); font-size: 12px; display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; } | |
| 224 | + .skill.active { border-color: var(--accent); background: var(--panel); } | |
| 225 | + .list-actions { margin-top: auto; display: flex; flex-direction: column; gap: 6px; padding-top: 8px; border-top: 1px solid var(--border); } | |
| 226 | + .detail { display: flex; flex-direction: column; gap: 8px; min-height: 0; } | |
| 227 | + .editor { flex: 1; min-height: 160px; } | |
| 228 | + .actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: flex-end; } | |
| 229 | + .grow { flex: 1; } | |
| 230 | + .new { display: flex; flex-direction: column; gap: 10px; max-width: 560px; } | |
| 231 | + .new label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; } | |
| 232 | + .new small { color: var(--muted); font-size: 12px; } | |
| 233 | + .new small.bad { color: var(--danger); } | |
| 234 | + .note { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; border: 1px solid var(--accent); border-radius: var(--radius); padding: 8px 12px; font-size: 13px; } | |
| 235 | + .note span { flex: 1; min-width: 200px; } | |
| 236 | + .problem { border: 1px solid var(--danger); border-radius: var(--radius); color: var(--danger); padding: 8px 12px; font-size: 13px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; } | |
| 237 | + .primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; } | |
| 238 | +</style> | |
| new file mode 100644 | |||
| @@ -0,0 +1,238 @@ | |||
| 1 | +<!-- Copyright (c) 2026 Philippe Charrière — Sidekicks Source-Available License 1.0, see LICENSE --> | ||
| 2 | +<script lang="ts"> | ||
| 3 | + // An agent's skills (issue #112): the folder its program reads them in | ||
| 4 | + // (.claude/skills for Claude, .agents/skills for Codex, Antigravity and | ||
| 5 | + // Copilot, .vibe/skills for Vibe, skills — or its agent.yaml's skillsDir — | ||
| 6 | + // for mini-me), one folder per skill with its SKILL.md. Listed, created | ||
| 7 | + // from a template, edited, imported from a folder or a file of this | ||
| 8 | + // computer. Like the instructions, the folder is protected in the Files | ||
| 9 | + // tab: this tab writes there, and never removes anything. | ||
| 10 | + import { onMount } from 'svelte' | ||
| 11 | + import { AgentService, WorkspaceService } from '../../../bindings/git.rickub.com/bots-garden/sidekicks/internal/app' | ||
| 12 | + import type { Skill, Skills } from '../../../bindings/git.rickub.com/bots-garden/sidekicks/internal/app' | ||
| 13 | + import type { File } from '../../../bindings/git.rickub.com/bots-garden/sidekicks/internal/workspace' | ||
| 14 | + import { t } from '../i18n/index.svelte' | ||
| 15 | + import { act, appState } from '../state.svelte' | ||
| 16 | + import { skillNameOf, skillTemplate, validSkillName } from '../skills' | ||
| 17 | + import ErrorText from '../chat/ErrorText.svelte' | ||
| 18 | + import FileEditor from './FileEditor.svelte' | ||
| 19 | + | ||
| 20 | + let { agent }: { agent: string } = $props() | ||
| 21 | + | ||
| 22 | + const status = $derived(appState.agents.find((candidate) => candidate.name === agent)) | ||
| 23 | + const running = $derived(['ready', 'busy'].includes(status?.state ?? '')) | ||
| 24 | + let skills = $state<Skills | null>(null) | ||
| 25 | + let selected = $state<Skill | null>(null) | ||
| 26 | + let file = $state<File | null>(null) | ||
| 27 | + let text = $state('') | ||
| 28 | + let conflict = $state(false) | ||
| 29 | + let problem = $state('') | ||
| 30 | + let busy = $state(false) | ||
| 31 | + let written = $state(false) | ||
| 32 | + // The "new skill" form. | ||
| 33 | + let creating = $state(false) | ||
| 34 | + let newTitle = $state('') | ||
| 35 | + let newName = $state('') | ||
| 36 | + let nameTouched = $state(false) | ||
| 37 | + let newDescription = $state('') | ||
| 38 | + const dirty = $derived(file !== null && text !== file.content) | ||
| 39 | + | ||
| 40 | + function errorOf(error: unknown): string { | ||
| 41 | + return error instanceof Error ? error.message : String(error) | ||
| 42 | + } | ||
| 43 | + | ||
| 44 | + async function load(open = selected?.folder) { | ||
| 45 | + problem = '' | ||
| 46 | + try { | ||
| 47 | + skills = await WorkspaceService.Skills(agent) | ||
| 48 | + const again = skills?.skills?.find((skill) => skill.folder === open) | ||
| 49 | + if (again) await select(again) | ||
| 50 | + } catch (error) { | ||
| 51 | + problem = errorOf(error) | ||
| 52 | + } | ||
| 53 | + } | ||
| 54 | + onMount(() => load()) | ||
| 55 | + | ||
| 56 | + async function select(skill: Skill) { | ||
| 57 | + creating = false | ||
| 58 | + selected = skill | ||
| 59 | + conflict = false | ||
| 60 | + try { | ||
| 61 | + file = await WorkspaceService.ReadSkill(agent, skill.path) | ||
| 62 | + text = file?.content ?? '' | ||
| 63 | + } catch (error) { | ||
| 64 | + problem = errorOf(error) | ||
| 65 | + } | ||
| 66 | + } | ||
| 67 | + | ||
| 68 | + async function save() { | ||
| 69 | + if (!file || !selected || !dirty) return | ||
| 70 | + busy = true | ||
| 71 | + problem = '' | ||
| 72 | + try { | ||
| 73 | + const result = await WorkspaceService.SaveSkill(agent, selected.path, text, file.version) | ||
| 74 | + if (result?.conflict) conflict = true | ||
| 75 | + else { | ||
| 76 | + written = true | ||
| 77 | + await load(selected.folder) | ||
| 78 | + } | ||
| 79 | + } catch (error) { | ||
| 80 | + problem = errorOf(error) | ||
| 81 | + } finally { | ||
| 82 | + busy = false | ||
| 83 | + } | ||
| 84 | + } | ||
| 85 | + | ||
| 86 | + function startCreating() { | ||
| 87 | + creating = true | ||
| 88 | + selected = null | ||
| 89 | + file = null | ||
| 90 | + newTitle = '' | ||
| 91 | + newName = '' | ||
| 92 | + nameTouched = false | ||
| 93 | + newDescription = '' | ||
| 94 | + } | ||
| 95 | + | ||
| 96 | + async function create(event: SubmitEvent) { | ||
| 97 | + event.preventDefault() | ||
| 98 | + if (!validSkillName(newName) || !newDescription.trim()) return | ||
| 99 | + busy = true | ||
| 100 | + problem = '' | ||
| 101 | + try { | ||
| 102 | + const skill = await WorkspaceService.CreateSkill(agent, newName, skillTemplate(newName, newDescription, newTitle)) | ||
| 103 | + written = true | ||
| 104 | + creating = false | ||
| 105 | + await load(skill?.folder) | ||
| 106 | + } catch (error) { | ||
| 107 | + problem = errorOf(error) | ||
| 108 | + } finally { | ||
| 109 | + busy = false | ||
| 110 | + } | ||
| 111 | + } | ||
| 112 | + | ||
| 113 | + async function importFrom(choose: () => Promise<string>) { | ||
| 114 | + problem = '' | ||
| 115 | + const path = await choose().catch((error) => ((problem = errorOf(error)), '')) | ||
| 116 | + if (!path) return | ||
| 117 | + busy = true | ||
| 118 | + try { | ||
| 119 | + const skill = await WorkspaceService.ImportSkill(agent, path) | ||
| 120 | + written = true | ||
| 121 | + await load(skill?.folder) | ||
| 122 | + } catch (error) { | ||
| 123 | + problem = errorOf(error) | ||
| 124 | + } finally { | ||
| 125 | + busy = false | ||
| 126 | + } | ||
| 127 | + } | ||
| 128 | + | ||
| 129 | + function restart() { | ||
| 130 | + written = false | ||
| 131 | + void act(() => AgentService.Restart(agent)) | ||
| 132 | + } | ||
| 133 | +</script> | ||
| 134 | + | ||
| 135 | +<div class="skills"> | ||
| 136 | + {#if skills} | ||
| 137 | + <p class="intro">{t('skills.intro', { agent: status?.title || agent, dir: skills.dir })}</p> | ||
| 138 | + {#if problem}<div class="problem" role="alert"><ErrorText raw={problem} /></div>{/if} | ||
| 139 | + {#if written && running} | ||
| 140 | + <div class="note" role="status"> | ||
| 141 | + <span>{t('skills.restart', { agent: status?.title || agent })}</span> | ||
| 142 | + <button type="button" onclick={restart}>{t('instructions.restartButton')}</button> | ||
| 143 | + </div> | ||
| 144 | + {/if} | ||
| 145 | + <div class="columns"> | ||
| 146 | + <aside class="list"> | ||
| 147 | + {#each skills.skills ?? [] as skill (skill.folder)} | ||
| 148 | + <button type="button" class="skill" class:active={selected?.folder === skill.folder} onclick={() => select(skill)} title={skill.description}> | ||
| 149 | + <strong>{skill.name}</strong> | ||
| 150 | + {#if skill.description}<small>{skill.description}</small>{/if} | ||
| 151 | + </button> | ||
| 152 | + {:else} | ||
| 153 | + <p class="muted">{t('skills.none')}</p> | ||
| 154 | + {/each} | ||
| 155 | + <div class="list-actions"> | ||
| 156 | + <button type="button" class="primary" onclick={startCreating} disabled={busy}>{t('skills.new')}</button> | ||
| 157 | + <button type="button" onclick={() => importFrom(WorkspaceService.ChooseSkillFolder)} disabled={busy}>{t('skills.importFolder')}</button> | ||
| 158 | + <button type="button" onclick={() => importFrom(WorkspaceService.ChooseInstructions)} disabled={busy}>{t('skills.importFile')}</button> | ||
| 159 | + </div> | ||
| 160 | + </aside> | ||
| 161 | + <section class="detail"> | ||
| 162 | + {#if creating} | ||
| 163 | + <form class="new" onsubmit={create}> | ||
| 164 | + <h3>{t('skills.new')}</h3> | ||
| 165 | + <label> | ||
| 166 | + {t('skills.title')} | ||
| 167 | + <!-- svelte-ignore a11y_autofocus --> | ||
| 168 | + <input bind:value={newTitle} oninput={() => { if (!nameTouched) newName = skillNameOf(newTitle) }} autofocus /> | ||
| 169 | + </label> | ||
| 170 | + <label> | ||
| 171 | + {t('skills.name')} | ||
| 172 | + <input bind:value={newName} oninput={() => (nameTouched = true)} spellcheck="false" autocapitalize="off" /> | ||
| 173 | + <small class:bad={newName !== '' && !validSkillName(newName)}>{t('skills.nameHint', { dir: `${skills.dir}/${newName || '…'}/SKILL.md` })}</small> | ||
| 174 | + </label> | ||
| 175 | + <label> | ||
| 176 | + {t('skills.description')} | ||
| 177 | + <textarea bind:value={newDescription} rows="3"></textarea> | ||
| 178 | + <small>{t('skills.descriptionHint')}</small> | ||
| 179 | + </label> | ||
| 180 | + <div class="actions"> | ||
| 181 | + <button type="button" onclick={() => (creating = false)}>{t('creator.cancel')}</button> | ||
| 182 | + <button type="submit" class="primary" disabled={busy || !validSkillName(newName) || !newDescription.trim()}>{t('skills.create')}</button> | ||
| 183 | + </div> | ||
| 184 | + </form> | ||
| 185 | + {:else if selected && file} | ||
| 186 | + {#if conflict} | ||
| 187 | + <div class="problem" role="alert"> | ||
| 188 | + {t('instructions.conflict', { file: selected.path })} | ||
| 189 | + <button type="button" onclick={() => selected && select(selected)}>{t('instructions.reload')}</button> | ||
| 190 | + </div> | ||
| 191 | + {/if} | ||
| 192 | + <p class="path">{selected.path}</p> | ||
| 193 | + <div class="editor"> | ||
| 194 | + {#key file.version} | ||
| 195 | + <FileEditor content={file.content} language="markdown" onChange={(next) => (text = next)} onSave={save} /> | ||
| 196 | + {/key} | ||
| 197 | + </div> | ||
| 198 | + <div class="actions"> | ||
| 199 | + <span class="grow"></span> | ||
| 200 | + <button type="button" onclick={() => selected && select(selected)} disabled={busy || !dirty}>{t('instructions.revert')}</button> | ||
| 201 | + <button type="button" class="primary" onclick={save} disabled={busy || !dirty}>{t('instructions.save')}</button> | ||
| 202 | + </div> | ||
| 203 | + {:else} | ||
| 204 | + <p class="muted">{t('skills.pick')}</p> | ||
| 205 | + {/if} | ||
| 206 | + </section> | ||
| 207 | + </div> | ||
| 208 | + {:else if problem} | ||
| 209 | + <div class="problem" role="alert"><ErrorText raw={problem} /></div> | ||
| 210 | + {:else} | ||
| 211 | + <p class="muted">…</p> | ||
| 212 | + {/if} | ||
| 213 | +</div> | ||
| 214 | + | ||
| 215 | +<style> | ||
| 216 | + .skills { height: 100%; display: flex; flex-direction: column; gap: 10px; min-height: 0; } | ||
| 217 | + p, h3 { margin: 0; } | ||
| 218 | + .intro, .muted, .path { color: var(--muted); font-size: 13px; } | ||
| 219 | + .path { font-family: var(--mono); font-size: 12px; } | ||
| 220 | + .columns { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(200px, 30%) 1fr; gap: 12px; } | ||
| 221 | + .list { display: flex; flex-direction: column; gap: 6px; overflow-y: auto; min-height: 0; border: 1px solid var(--border); border-radius: 6px; padding: 8px; } | ||
| 222 | + .skill { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; text-align: left; padding: 6px 8px; border: 1px solid transparent; border-radius: 6px; background: none; } | ||
| 223 | + .skill small { color: var(--muted); font-size: 12px; display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; } | ||
| 224 | + .skill.active { border-color: var(--accent); background: var(--panel); } | ||
| 225 | + .list-actions { margin-top: auto; display: flex; flex-direction: column; gap: 6px; padding-top: 8px; border-top: 1px solid var(--border); } | ||
| 226 | + .detail { display: flex; flex-direction: column; gap: 8px; min-height: 0; } | ||
| 227 | + .editor { flex: 1; min-height: 160px; } | ||
| 228 | + .actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: flex-end; } | ||
| 229 | + .grow { flex: 1; } | ||
| 230 | + .new { display: flex; flex-direction: column; gap: 10px; max-width: 560px; } | ||
| 231 | + .new label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; } | ||
| 232 | + .new small { color: var(--muted); font-size: 12px; } | ||
| 233 | + .new small.bad { color: var(--danger); } | ||
| 234 | + .note { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; border: 1px solid var(--accent); border-radius: var(--radius); padding: 8px 12px; font-size: 13px; } | ||
| 235 | + .note span { flex: 1; min-width: 200px; } | ||
| 236 | + .problem { border: 1px solid var(--danger); border-radius: var(--radius); color: var(--danger); padding: 8px 12px; font-size: 13px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; } | ||
| 237 | + .primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; } | ||
| 238 | +</style> | ||
modified
frontend/src/lib/i18n/messages.ts +30 -0 | @@ -272,6 +272,21 @@ export const en = { | ||
| 272 | 272 | 'workspace.tab.terminal': 'Terminal', |
| 273 | 273 | 'workspace.tab.log': 'Log', |
| 274 | 274 | 'workspace.tab.instructions': 'Instructions', |
| 275 | + 'workspace.tab.skills': 'Skills', | |
| 276 | + 'skills.intro': '{agent} reads its skills in {dir}: one folder per skill, with a SKILL.md that says what the skill is for and how to do it. The agent uses a skill when its description fits what you ask, or when you call it with /.', | |
| 277 | + 'skills.none': 'No skill yet.', | |
| 278 | + 'skills.pick': 'Pick a skill to read or change it, or create a new one.', | |
| 279 | + 'skills.new': 'New skill', | |
| 280 | + 'skills.importFolder': 'Import a skill folder…', | |
| 281 | + 'skills.importFile': 'Import a Markdown file…', | |
| 282 | + 'skills.title': 'What the skill does', | |
| 283 | + 'skills.name': 'Name of its folder', | |
| 284 | + 'skills.nameHint': 'Lowercase letters, digits and -: {dir}', | |
| 285 | + 'skills.description': 'When to use it', | |
| 286 | + 'skills.descriptionHint': 'One or two sentences: the agent reads them to choose the skill.', | |
| 287 | + 'skills.create': 'Create the skill', | |
| 288 | + 'skills.restart': '{agent} finds its skills when its session starts: restart it so that it sees the new ones.', | |
| 289 | + 'skills.template': '# {name}\n\n## When to use this skill\n\n(What should make the agent use it.)\n\n## How to do it\n\n1. …\n2. …\n\n## Example\n\n(A short example of what the user asks, and of the answer.)\n', | |
| 275 | 290 | 'instructions.intro': '{agent} reads its instructions in {file}, in its folder, when its session starts: its role, its tone, its rules. Write them in plain words.', |
| 276 | 291 | 'instructions.none': 'There is no {file} yet. Start from a template, or import a file you already have.', |
| 277 | 292 | 'instructions.create': 'Create from a template', |
| @@ -815,6 +830,21 @@ export const fr: Record<MessageKey, string> = { | ||
| 815 | 830 | 'workspace.tab.terminal': 'Terminal', |
| 816 | 831 | 'workspace.tab.log': 'Journal', |
| 817 | 832 | 'workspace.tab.instructions': 'Instructions', |
| 833 | + 'workspace.tab.skills': 'Skills', | |
| 834 | + 'skills.intro': "{agent} lit ses skills dans {dir} : un dossier par skill, avec un SKILL.md qui dit à quoi sert la skill et comment faire. L'agent utilise une skill quand sa description correspond à votre demande, ou quand vous l'appelez avec /.", | |
| 835 | + 'skills.none': 'Pas encore de skill.', | |
| 836 | + 'skills.pick': 'Choisissez une skill pour la lire ou la modifier, ou créez-en une.', | |
| 837 | + 'skills.new': 'Nouvelle skill', | |
| 838 | + 'skills.importFolder': "Importer le dossier d'une skill…", | |
| 839 | + 'skills.importFile': 'Importer un fichier Markdown…', | |
| 840 | + 'skills.title': 'Ce que fait la skill', | |
| 841 | + 'skills.name': 'Nom de son dossier', | |
| 842 | + 'skills.nameHint': 'Minuscules, chiffres et - : {dir}', | |
| 843 | + 'skills.description': "Quand l'utiliser", | |
| 844 | + 'skills.descriptionHint': "Une ou deux phrases : l'agent les lit pour choisir la skill.", | |
| 845 | + 'skills.create': 'Créer la skill', | |
| 846 | + 'skills.restart': "{agent} découvre ses skills au début de sa session : redémarrez-le pour qu'il voie les nouvelles.", | |
| 847 | + 'skills.template': "# {name}\n\n## Quand utiliser cette skill\n\n(Ce qui doit amener l'agent à l'utiliser.)\n\n## Comment faire\n\n1. …\n2. …\n\n## Exemple\n\n(Un court exemple de demande, et de la réponse.)\n", | |
| 818 | 848 | 'instructions.intro': "{agent} lit ses instructions dans {file}, dans son dossier, au début de sa session : son rôle, son ton, ses règles. Écrivez-les avec des mots simples.", |
| 819 | 849 | 'instructions.none': "Il n'y a pas encore de {file}. Partez d'un modèle, ou importez un fichier que vous avez déjà.", |
| 820 | 850 | 'instructions.create': "Créer depuis un modèle", |
| @@ -272,6 +272,21 @@ export const en = { | |||
| 272 | 'workspace.tab.terminal': 'Terminal', | 272 | 'workspace.tab.terminal': 'Terminal', |
| 273 | 'workspace.tab.log': 'Log', | 273 | 'workspace.tab.log': 'Log', |
| 274 | 'workspace.tab.instructions': 'Instructions', | 274 | 'workspace.tab.instructions': 'Instructions', |
| 275 | + 'workspace.tab.skills': 'Skills', | ||
| 276 | + 'skills.intro': '{agent} reads its skills in {dir}: one folder per skill, with a SKILL.md that says what the skill is for and how to do it. The agent uses a skill when its description fits what you ask, or when you call it with /.', | ||
| 277 | + 'skills.none': 'No skill yet.', | ||
| 278 | + 'skills.pick': 'Pick a skill to read or change it, or create a new one.', | ||
| 279 | + 'skills.new': 'New skill', | ||
| 280 | + 'skills.importFolder': 'Import a skill folder…', | ||
| 281 | + 'skills.importFile': 'Import a Markdown file…', | ||
| 282 | + 'skills.title': 'What the skill does', | ||
| 283 | + 'skills.name': 'Name of its folder', | ||
| 284 | + 'skills.nameHint': 'Lowercase letters, digits and -: {dir}', | ||
| 285 | + 'skills.description': 'When to use it', | ||
| 286 | + 'skills.descriptionHint': 'One or two sentences: the agent reads them to choose the skill.', | ||
| 287 | + 'skills.create': 'Create the skill', | ||
| 288 | + 'skills.restart': '{agent} finds its skills when its session starts: restart it so that it sees the new ones.', | ||
| 289 | + 'skills.template': '# {name}\n\n## When to use this skill\n\n(What should make the agent use it.)\n\n## How to do it\n\n1. …\n2. …\n\n## Example\n\n(A short example of what the user asks, and of the answer.)\n', | ||
| 275 | 'instructions.intro': '{agent} reads its instructions in {file}, in its folder, when its session starts: its role, its tone, its rules. Write them in plain words.', | 290 | 'instructions.intro': '{agent} reads its instructions in {file}, in its folder, when its session starts: its role, its tone, its rules. Write them in plain words.', |
| 276 | 'instructions.none': 'There is no {file} yet. Start from a template, or import a file you already have.', | 291 | 'instructions.none': 'There is no {file} yet. Start from a template, or import a file you already have.', |
| 277 | 'instructions.create': 'Create from a template', | 292 | 'instructions.create': 'Create from a template', |
| @@ -815,6 +830,21 @@ export const fr: Record<MessageKey, string> = { | |||
| 815 | 'workspace.tab.terminal': 'Terminal', | 830 | 'workspace.tab.terminal': 'Terminal', |
| 816 | 'workspace.tab.log': 'Journal', | 831 | 'workspace.tab.log': 'Journal', |
| 817 | 'workspace.tab.instructions': 'Instructions', | 832 | 'workspace.tab.instructions': 'Instructions', |
| 833 | + 'workspace.tab.skills': 'Skills', | ||
| 834 | + 'skills.intro': "{agent} lit ses skills dans {dir} : un dossier par skill, avec un SKILL.md qui dit à quoi sert la skill et comment faire. L'agent utilise une skill quand sa description correspond à votre demande, ou quand vous l'appelez avec /.", | ||
| 835 | + 'skills.none': 'Pas encore de skill.', | ||
| 836 | + 'skills.pick': 'Choisissez une skill pour la lire ou la modifier, ou créez-en une.', | ||
| 837 | + 'skills.new': 'Nouvelle skill', | ||
| 838 | + 'skills.importFolder': "Importer le dossier d'une skill…", | ||
| 839 | + 'skills.importFile': 'Importer un fichier Markdown…', | ||
| 840 | + 'skills.title': 'Ce que fait la skill', | ||
| 841 | + 'skills.name': 'Nom de son dossier', | ||
| 842 | + 'skills.nameHint': 'Minuscules, chiffres et - : {dir}', | ||
| 843 | + 'skills.description': "Quand l'utiliser", | ||
| 844 | + 'skills.descriptionHint': "Une ou deux phrases : l'agent les lit pour choisir la skill.", | ||
| 845 | + 'skills.create': 'Créer la skill', | ||
| 846 | + 'skills.restart': "{agent} découvre ses skills au début de sa session : redémarrez-le pour qu'il voie les nouvelles.", | ||
| 847 | + 'skills.template': "# {name}\n\n## Quand utiliser cette skill\n\n(Ce qui doit amener l'agent à l'utiliser.)\n\n## Comment faire\n\n1. …\n2. …\n\n## Exemple\n\n(Un court exemple de demande, et de la réponse.)\n", | ||
| 818 | 'instructions.intro': "{agent} lit ses instructions dans {file}, dans son dossier, au début de sa session : son rôle, son ton, ses règles. Écrivez-les avec des mots simples.", | 848 | 'instructions.intro': "{agent} lit ses instructions dans {file}, dans son dossier, au début de sa session : son rôle, son ton, ses règles. Écrivez-les avec des mots simples.", |
| 819 | 'instructions.none': "Il n'y a pas encore de {file}. Partez d'un modèle, ou importez un fichier que vous avez déjà.", | 849 | 'instructions.none': "Il n'y a pas encore de {file}. Partez d'un modèle, ou importez un fichier que vous avez déjà.", |
| 820 | 'instructions.create': "Créer depuis un modèle", | 850 | 'instructions.create': "Créer depuis un modèle", |
added
frontend/src/lib/skills.test.ts +20 -0 | new file mode 100644 | ||
| @@ -0,0 +1,20 @@ | ||
| 1 | +// Copyright (c) 2026 Philippe Charrière — Sidekicks Source-Available License 1.0, see LICENSE | |
| 2 | +import { describe, expect, it } from 'vitest' | |
| 3 | +import { skillNameOf, skillTemplate, validSkillName } from './skills' | |
| 4 | +import { setLanguage } from './i18n/index.svelte' | |
| 5 | + | |
| 6 | +describe('a new skill (issue #112)', () => { | |
| 7 | + it('gets a folder name of lowercase letters, digits and -', () => { | |
| 8 | + expect(skillNameOf('Résumé de réunion')).toBe('resume-de-reunion') | |
| 9 | + expect(skillNameOf(' PDF tools! ')).toBe('pdf-tools') | |
| 10 | + expect(validSkillName('pdf-tools')).toBe(true) | |
| 11 | + expect(validSkillName('PDF tools')).toBe(false) | |
| 12 | + expect(validSkillName('-x')).toBe(false) | |
| 13 | + }) | |
| 14 | + it('starts with a front matter holding its name and its description', () => { | |
| 15 | + setLanguage('en') | |
| 16 | + const skill = skillTemplate('meeting-notes', 'Summarise a meeting:\n who, what, when.', 'Meeting notes') | |
| 17 | + expect(skill.startsWith('---\nname: meeting-notes\ndescription: "Summarise a meeting: who, what, when."\n---\n\n# Meeting notes\n')).toBe(true) | |
| 18 | + expect(skillTemplate('pdf-tools', 'Read PDFs.')).toContain('\n# pdf-tools\n') | |
| 19 | + }) | |
| 20 | +}) | |
| new file mode 100644 | |||
| @@ -0,0 +1,20 @@ | |||
| 1 | +// Copyright (c) 2026 Philippe Charrière — Sidekicks Source-Available License 1.0, see LICENSE | ||
| 2 | +import { describe, expect, it } from 'vitest' | ||
| 3 | +import { skillNameOf, skillTemplate, validSkillName } from './skills' | ||
| 4 | +import { setLanguage } from './i18n/index.svelte' | ||
| 5 | + | ||
| 6 | +describe('a new skill (issue #112)', () => { | ||
| 7 | + it('gets a folder name of lowercase letters, digits and -', () => { | ||
| 8 | + expect(skillNameOf('Résumé de réunion')).toBe('resume-de-reunion') | ||
| 9 | + expect(skillNameOf(' PDF tools! ')).toBe('pdf-tools') | ||
| 10 | + expect(validSkillName('pdf-tools')).toBe(true) | ||
| 11 | + expect(validSkillName('PDF tools')).toBe(false) | ||
| 12 | + expect(validSkillName('-x')).toBe(false) | ||
| 13 | + }) | ||
| 14 | + it('starts with a front matter holding its name and its description', () => { | ||
| 15 | + setLanguage('en') | ||
| 16 | + const skill = skillTemplate('meeting-notes', 'Summarise a meeting:\n who, what, when.', 'Meeting notes') | ||
| 17 | + expect(skill.startsWith('---\nname: meeting-notes\ndescription: "Summarise a meeting: who, what, when."\n---\n\n# Meeting notes\n')).toBe(true) | ||
| 18 | + expect(skillTemplate('pdf-tools', 'Read PDFs.')).toContain('\n# pdf-tools\n') | ||
| 19 | + }) | ||
| 20 | +}) | ||
added
frontend/src/lib/skills.ts +42 -0 | new file mode 100644 | ||
| @@ -0,0 +1,42 @@ | ||
| 1 | +// Copyright (c) 2026 Philippe Charrière — Sidekicks Source-Available License 1.0, see LICENSE | |
| 2 | + | |
| 3 | +// A new skill of an agent (issue #112): its folder's name, checked like the | |
| 4 | +// Go side does (lowercase letters, digits and -), and the SKILL.md it starts | |
| 5 | +// with — the Agent Skills format every agent reads: a front matter with its | |
| 6 | +// name and its description, then its instructions. | |
| 7 | + | |
| 8 | +import { t } from './i18n/index.svelte' | |
| 9 | + | |
| 10 | +/** Whether name can be a skill's folder. */ | |
| 11 | +export function validSkillName(name: string): boolean { | |
| 12 | + return /^[a-z0-9][a-z0-9-]{0,63}$/.test(name) | |
| 13 | +} | |
| 14 | + | |
| 15 | +/** | |
| 16 | + * A skill name made of what the user typed: "Résumé de réunion" → "resume-de-reunion". | |
| 17 | + * | |
| 18 | + * @example | |
| 19 | + * skillNameOf('Meeting notes') // 'meeting-notes' | |
| 20 | + */ | |
| 21 | +export function skillNameOf(text: string): string { | |
| 22 | + return text | |
| 23 | + .normalize('NFKD') | |
| 24 | + .replace(/[̀-ͯ]/g, '') | |
| 25 | + .toLowerCase() | |
| 26 | + .replace(/[^a-z0-9]+/g, '-') | |
| 27 | + .replace(/^-+|-+$/g, '') | |
| 28 | + .slice(0, 64) | |
| 29 | + .replace(/-+$/, '') | |
| 30 | +} | |
| 31 | + | |
| 32 | +/** | |
| 33 | + * The SKILL.md a new skill starts with. The description says when the agent | |
| 34 | + * should use the skill: it is what the agent reads to choose it. | |
| 35 | + * | |
| 36 | + * @example | |
| 37 | + * skillTemplate('meeting-notes', 'Summarise a meeting.', 'Meeting notes') // '---\nname: meeting-notes\n…\n# Meeting notes\n…' | |
| 38 | + */ | |
| 39 | +export function skillTemplate(name: string, description: string, title = ''): string { | |
| 40 | + const oneLine = description.replace(/\s+/g, ' ').trim() | |
| 41 | + return `---\nname: ${name}\ndescription: ${JSON.stringify(oneLine)}\n---\n\n${t('skills.template', { name: title.trim() || name })}` | |
| 42 | +} | |
| new file mode 100644 | |||
| @@ -0,0 +1,42 @@ | |||
| 1 | +// Copyright (c) 2026 Philippe Charrière — Sidekicks Source-Available License 1.0, see LICENSE | ||
| 2 | + | ||
| 3 | +// A new skill of an agent (issue #112): its folder's name, checked like the | ||
| 4 | +// Go side does (lowercase letters, digits and -), and the SKILL.md it starts | ||
| 5 | +// with — the Agent Skills format every agent reads: a front matter with its | ||
| 6 | +// name and its description, then its instructions. | ||
| 7 | + | ||
| 8 | +import { t } from './i18n/index.svelte' | ||
| 9 | + | ||
| 10 | +/** Whether name can be a skill's folder. */ | ||
| 11 | +export function validSkillName(name: string): boolean { | ||
| 12 | + return /^[a-z0-9][a-z0-9-]{0,63}$/.test(name) | ||
| 13 | +} | ||
| 14 | + | ||
| 15 | +/** | ||
| 16 | + * A skill name made of what the user typed: "Résumé de réunion" → "resume-de-reunion". | ||
| 17 | + * | ||
| 18 | + * @example | ||
| 19 | + * skillNameOf('Meeting notes') // 'meeting-notes' | ||
| 20 | + */ | ||
| 21 | +export function skillNameOf(text: string): string { | ||
| 22 | + return text | ||
| 23 | + .normalize('NFKD') | ||
| 24 | + .replace(/[̀-ͯ]/g, '') | ||
| 25 | + .toLowerCase() | ||
| 26 | + .replace(/[^a-z0-9]+/g, '-') | ||
| 27 | + .replace(/^-+|-+$/g, '') | ||
| 28 | + .slice(0, 64) | ||
| 29 | + .replace(/-+$/, '') | ||
| 30 | +} | ||
| 31 | + | ||
| 32 | +/** | ||
| 33 | + * The SKILL.md a new skill starts with. The description says when the agent | ||
| 34 | + * should use the skill: it is what the agent reads to choose it. | ||
| 35 | + * | ||
| 36 | + * @example | ||
| 37 | + * skillTemplate('meeting-notes', 'Summarise a meeting.', 'Meeting notes') // '---\nname: meeting-notes\n…\n# Meeting notes\n…' | ||
| 38 | + */ | ||
| 39 | +export function skillTemplate(name: string, description: string, title = ''): string { | ||
| 40 | + const oneLine = description.replace(/\s+/g, ' ').trim() | ||
| 41 | + return `---\nname: ${name}\ndescription: ${JSON.stringify(oneLine)}\n---\n\n${t('skills.template', { name: title.trim() || name })}` | ||
| 42 | +} | ||
modified
internal/agents/instructions_test.go +22 -0 | @@ -28,3 +28,25 @@ func TestInstructionsFilesFollowTheAgentsProgram(t *testing.T) { | ||
| 28 | 28 | } |
| 29 | 29 | } |
| 30 | 30 | } |
| 31 | + | |
| 32 | +// Issue #112: the skills folder each kind of agent reads. | |
| 33 | +func TestSkillsDirFollowsTheAgentsProgram(t *testing.T) { | |
| 34 | + sbx := config.Runtime{Type: "sbx"} | |
| 35 | + for _, test := range []struct { | |
| 36 | + agent config.Agent | |
| 37 | + want string | |
| 38 | + }{ | |
| 39 | + {config.Agent{Command: "sbx", Args: []string{"exec", "-i", "claude", "claude-agent-acp"}, Runtime: sbx}, ".claude/skills"}, | |
| 40 | + {config.Agent{Command: "sbx", Args: []string{"exec", "-i", "vibe", "vibe-acp"}, Runtime: sbx}, ".vibe/skills"}, | |
| 41 | + {config.Agent{Command: "sbx", Args: []string{"exec", "-i", "codex", "codex-acp"}, Runtime: sbx}, ".agents/skills"}, | |
| 42 | + {config.Agent{Command: "sbx", Args: []string{"exec", "-i", "antigravity", "agy", "acp"}, Runtime: sbx}, ".agents/skills"}, | |
| 43 | + {config.Agent{Command: "/usr/local/bin/mm", Args: []string{"--acp"}}, "skills"}, | |
| 44 | + } { | |
| 45 | + if got := agents.SkillsDir(test.agent); got != test.want { | |
| 46 | + t.Errorf("%s %v: %q, want %q", test.agent.Command, test.agent.Args, got, test.want) | |
| 47 | + } | |
| 48 | + } | |
| 49 | + if !agents.IsMiniMe(config.Agent{Command: "sbx", Args: []string{"exec", "-i", "box", "mm", "--acp"}}) { | |
| 50 | + t.Fatal("mm in a sandbox is mini-me") | |
| 51 | + } | |
| 52 | +} | |
| @@ -28,3 +28,25 @@ func TestInstructionsFilesFollowTheAgentsProgram(t *testing.T) { | |||
| 28 | } | 28 | } |
| 29 | } | 29 | } |
| 30 | } | 30 | } |
| 31 | + | ||
| 32 | +// Issue #112: the skills folder each kind of agent reads. | ||
| 33 | +func TestSkillsDirFollowsTheAgentsProgram(t *testing.T) { | ||
| 34 | + sbx := config.Runtime{Type: "sbx"} | ||
| 35 | + for _, test := range []struct { | ||
| 36 | + agent config.Agent | ||
| 37 | + want string | ||
| 38 | + }{ | ||
| 39 | + {config.Agent{Command: "sbx", Args: []string{"exec", "-i", "claude", "claude-agent-acp"}, Runtime: sbx}, ".claude/skills"}, | ||
| 40 | + {config.Agent{Command: "sbx", Args: []string{"exec", "-i", "vibe", "vibe-acp"}, Runtime: sbx}, ".vibe/skills"}, | ||
| 41 | + {config.Agent{Command: "sbx", Args: []string{"exec", "-i", "codex", "codex-acp"}, Runtime: sbx}, ".agents/skills"}, | ||
| 42 | + {config.Agent{Command: "sbx", Args: []string{"exec", "-i", "antigravity", "agy", "acp"}, Runtime: sbx}, ".agents/skills"}, | ||
| 43 | + {config.Agent{Command: "/usr/local/bin/mm", Args: []string{"--acp"}}, "skills"}, | ||
| 44 | + } { | ||
| 45 | + if got := agents.SkillsDir(test.agent); got != test.want { | ||
| 46 | + t.Errorf("%s %v: %q, want %q", test.agent.Command, test.agent.Args, got, test.want) | ||
| 47 | + } | ||
| 48 | + } | ||
| 49 | + if !agents.IsMiniMe(config.Agent{Command: "sbx", Args: []string{"exec", "-i", "box", "mm", "--acp"}}) { | ||
| 50 | + t.Fatal("mm in a sandbox is mini-me") | ||
| 51 | + } | ||
| 52 | +} | ||
added
internal/agents/skills.go +51 -0 | new file mode 100644 | ||
| @@ -0,0 +1,51 @@ | ||
| 1 | +// Copyright (c) 2026 Philippe Charrière — Sidekicks Source-Available License 1.0, see LICENSE | |
| 2 | + | |
| 3 | +package agents | |
| 4 | + | |
| 5 | +import ( | |
| 6 | + "path" | |
| 7 | + "strings" | |
| 8 | + | |
| 9 | + "git.rickub.com/bots-garden/sidekicks/internal/config" | |
| 10 | +) | |
| 11 | + | |
| 12 | +// An agent's skills (issue #112): every agent reads the same Agent Skills | |
| 13 | +// format — a folder per skill holding a SKILL.md with a name and a | |
| 14 | +// description — but each in its own folder of its workspace. | |
| 15 | + | |
| 16 | +// DefaultSkillsDir is the folder of the Agent Skills standard, read by | |
| 17 | +// Codex, Antigravity and Copilot. | |
| 18 | +const DefaultSkillsDir = ".agents/skills" | |
| 19 | + | |
| 20 | +var skillsByProgram = map[string]string{ | |
| 21 | + "mm": "skills", // mini-me: its agent.yaml may name another one (skillsDir) | |
| 22 | + "claude-agent-acp": ".claude/skills", | |
| 23 | + "claude": ".claude/skills", | |
| 24 | + "vibe-acp": ".vibe/skills", | |
| 25 | + "vibe": ".vibe/skills", | |
| 26 | +} | |
| 27 | + | |
| 28 | +// SkillsDir is the folder of definition's agent where it reads its skills, | |
| 29 | +// relative to its folder, from its program. | |
| 30 | +// | |
| 31 | +// SkillsDir(config.Agent{Command: "sbx", Args: []string{"exec", "-i", "claude", "claude-agent-acp"}}) // ".claude/skills" | |
| 32 | +// SkillsDir(config.Agent{Command: "sbx", Args: []string{"exec", "-i", "codex", "codex-acp"}}) // ".agents/skills" | |
| 33 | +func SkillsDir(definition config.Agent) string { | |
| 34 | + for _, word := range append([]string{definition.Command}, definition.Args...) { | |
| 35 | + if dir, ok := skillsByProgram[path.Base(strings.TrimSpace(word))]; ok { | |
| 36 | + return dir | |
| 37 | + } | |
| 38 | + } | |
| 39 | + return DefaultSkillsDir | |
| 40 | +} | |
| 41 | + | |
| 42 | +// IsMiniMe reports whether definition's agent is mini-me (mm), whose | |
| 43 | +// agent.yaml may set its skills folder. | |
| 44 | +func IsMiniMe(definition config.Agent) bool { | |
| 45 | + for _, word := range append([]string{definition.Command}, definition.Args...) { | |
| 46 | + if path.Base(strings.TrimSpace(word)) == "mm" { | |
| 47 | + return true | |
| 48 | + } | |
| 49 | + } | |
| 50 | + return false | |
| 51 | +} | |
| new file mode 100644 | |||
| @@ -0,0 +1,51 @@ | |||
| 1 | +// Copyright (c) 2026 Philippe Charrière — Sidekicks Source-Available License 1.0, see LICENSE | ||
| 2 | + | ||
| 3 | +package agents | ||
| 4 | + | ||
| 5 | +import ( | ||
| 6 | + "path" | ||
| 7 | + "strings" | ||
| 8 | + | ||
| 9 | + "git.rickub.com/bots-garden/sidekicks/internal/config" | ||
| 10 | +) | ||
| 11 | + | ||
| 12 | +// An agent's skills (issue #112): every agent reads the same Agent Skills | ||
| 13 | +// format — a folder per skill holding a SKILL.md with a name and a | ||
| 14 | +// description — but each in its own folder of its workspace. | ||
| 15 | + | ||
| 16 | +// DefaultSkillsDir is the folder of the Agent Skills standard, read by | ||
| 17 | +// Codex, Antigravity and Copilot. | ||
| 18 | +const DefaultSkillsDir = ".agents/skills" | ||
| 19 | + | ||
| 20 | +var skillsByProgram = map[string]string{ | ||
| 21 | + "mm": "skills", // mini-me: its agent.yaml may name another one (skillsDir) | ||
| 22 | + "claude-agent-acp": ".claude/skills", | ||
| 23 | + "claude": ".claude/skills", | ||
| 24 | + "vibe-acp": ".vibe/skills", | ||
| 25 | + "vibe": ".vibe/skills", | ||
| 26 | +} | ||
| 27 | + | ||
| 28 | +// SkillsDir is the folder of definition's agent where it reads its skills, | ||
| 29 | +// relative to its folder, from its program. | ||
| 30 | +// | ||
| 31 | +// SkillsDir(config.Agent{Command: "sbx", Args: []string{"exec", "-i", "claude", "claude-agent-acp"}}) // ".claude/skills" | ||
| 32 | +// SkillsDir(config.Agent{Command: "sbx", Args: []string{"exec", "-i", "codex", "codex-acp"}}) // ".agents/skills" | ||
| 33 | +func SkillsDir(definition config.Agent) string { | ||
| 34 | + for _, word := range append([]string{definition.Command}, definition.Args...) { | ||
| 35 | + if dir, ok := skillsByProgram[path.Base(strings.TrimSpace(word))]; ok { | ||
| 36 | + return dir | ||
| 37 | + } | ||
| 38 | + } | ||
| 39 | + return DefaultSkillsDir | ||
| 40 | +} | ||
| 41 | + | ||
| 42 | +// IsMiniMe reports whether definition's agent is mini-me (mm), whose | ||
| 43 | +// agent.yaml may set its skills folder. | ||
| 44 | +func IsMiniMe(definition config.Agent) bool { | ||
| 45 | + for _, word := range append([]string{definition.Command}, definition.Args...) { | ||
| 46 | + if path.Base(strings.TrimSpace(word)) == "mm" { | ||
| 47 | + return true | ||
| 48 | + } | ||
| 49 | + } | ||
| 50 | + return false | ||
| 51 | +} | ||
modified
internal/app/instructions.go +2 -2 | @@ -45,7 +45,7 @@ func (s *WorkspaceService) Instructions(ctx context.Context, agent string) (Inst | ||
| 45 | 45 | if !ok { |
| 46 | 46 | return Instructions{}, fmt.Errorf("%w: %s", agents.ErrUnknownAgent, agent) |
| 47 | 47 | } |
| 48 | - ws, err := s.Core.workspaceOf(agent) | |
| 48 | + ws, err := s.Core.settingsWorkspaceOf(agent) | |
| 49 | 49 | if err != nil { |
| 50 | 50 | return Instructions{}, err |
| 51 | 51 | } |
| @@ -131,7 +131,7 @@ func (s *WorkspaceService) SaveInstructions(ctx context.Context, agent, content, | ||
| 131 | 131 | // protected (config.AlwaysProtected) against the Files tab, not against this |
| 132 | 132 | // tab made for it (the owner's choice, issue #113); it is never removed. |
| 133 | 133 | func (s *WorkspaceService) writeInstructions(ctx context.Context, agent string, current Instructions, content string) (Instructions, error) { |
| 134 | - ws, err := s.Core.workspaceOf(agent) | |
| 134 | + ws, err := s.Core.settingsWorkspaceOf(agent) | |
| 135 | 135 | if err != nil { |
| 136 | 136 | return Instructions{}, err |
| 137 | 137 | } |
| @@ -45,7 +45,7 @@ func (s *WorkspaceService) Instructions(ctx context.Context, agent string) (Inst | |||
| 45 | if !ok { | 45 | if !ok { |
| 46 | return Instructions{}, fmt.Errorf("%w: %s", agents.ErrUnknownAgent, agent) | 46 | return Instructions{}, fmt.Errorf("%w: %s", agents.ErrUnknownAgent, agent) |
| 47 | } | 47 | } |
| 48 | - ws, err := s.Core.workspaceOf(agent) | 48 | + ws, err := s.Core.settingsWorkspaceOf(agent) |
| 49 | if err != nil { | 49 | if err != nil { |
| 50 | return Instructions{}, err | 50 | return Instructions{}, err |
| 51 | } | 51 | } |
| @@ -131,7 +131,7 @@ func (s *WorkspaceService) SaveInstructions(ctx context.Context, agent, content, | |||
| 131 | // protected (config.AlwaysProtected) against the Files tab, not against this | 131 | // protected (config.AlwaysProtected) against the Files tab, not against this |
| 132 | // tab made for it (the owner's choice, issue #113); it is never removed. | 132 | // tab made for it (the owner's choice, issue #113); it is never removed. |
| 133 | func (s *WorkspaceService) writeInstructions(ctx context.Context, agent string, current Instructions, content string) (Instructions, error) { | 133 | func (s *WorkspaceService) writeInstructions(ctx context.Context, agent string, current Instructions, content string) (Instructions, error) { |
| 134 | - ws, err := s.Core.workspaceOf(agent) | 134 | + ws, err := s.Core.settingsWorkspaceOf(agent) |
| 135 | if err != nil { | 135 | if err != nil { |
| 136 | return Instructions{}, err | 136 | return Instructions{}, err |
| 137 | } | 137 | } |
added
internal/app/skills.go +390 -0 | new file mode 100644 | ||
| @@ -0,0 +1,390 @@ | ||
| 1 | +// Copyright (c) 2026 Philippe Charrière — Sidekicks Source-Available License 1.0, see LICENSE | |
| 2 | + | |
| 3 | +package app | |
| 4 | + | |
| 5 | +import ( | |
| 6 | + "context" | |
| 7 | + "errors" | |
| 8 | + "fmt" | |
| 9 | + "io/fs" | |
| 10 | + "os" | |
| 11 | + "path" | |
| 12 | + "path/filepath" | |
| 13 | + "regexp" | |
| 14 | + "sort" | |
| 15 | + "strings" | |
| 16 | + "unicode/utf8" | |
| 17 | + | |
| 18 | + "go.yaml.in/yaml/v3" | |
| 19 | + | |
| 20 | + "git.rickub.com/bots-garden/sidekicks/internal/agents" | |
| 21 | + "git.rickub.com/bots-garden/sidekicks/internal/workspace" | |
| 22 | +) | |
| 23 | + | |
| 24 | +// An agent's skills (issue #112): created, edited and imported from its | |
| 25 | +// Skills tab, in the folder its program reads (agents.SkillsDir) — on this | |
| 26 | +// computer, in its container or in its sandbox alike, through its | |
| 27 | +// workspace. Like its instructions (issue #113), the skills folders are | |
| 28 | +// protected in the Files tab: only this tab writes there, and it never | |
| 29 | +// removes anything. | |
| 30 | + | |
| 31 | +// SkillFile is the file every skill folder holds. | |
| 32 | +const SkillFile = "SKILL.md" | |
| 33 | + | |
| 34 | +// Skill is one skill of an agent: its folder's name, the name and the | |
| 35 | +// description of its SKILL.md, and that file's path in the agent's folder. | |
| 36 | +type Skill struct { | |
| 37 | + Folder string `json:"folder"` | |
| 38 | + Name string `json:"name"` | |
| 39 | + Description string `json:"description"` | |
| 40 | + Path string `json:"path"` | |
| 41 | +} | |
| 42 | + | |
| 43 | +// Skills is an agent's skills folder and what it holds. | |
| 44 | +type Skills struct { | |
| 45 | + Dir string `json:"dir"` | |
| 46 | + Skills []Skill `json:"skills"` | |
| 47 | +} | |
| 48 | + | |
| 49 | +// SkillSave is the result of SaveSkill: the file written, or Conflict when | |
| 50 | +// it changed since it was read — nothing was written then. | |
| 51 | +type SkillSave struct { | |
| 52 | + File workspace.File `json:"file"` | |
| 53 | + Conflict bool `json:"conflict"` | |
| 54 | +} | |
| 55 | + | |
| 56 | +var ( | |
| 57 | + // ErrSkillExists is returned when a skill folder already has that name. | |
| 58 | + ErrSkillExists = errors.New("the agent already has a skill with this name") | |
| 59 | + // ErrSkillName is returned for a name that cannot be a skill's folder. | |
| 60 | + ErrSkillName = errors.New("a skill name is made of lowercase letters, digits and -") | |
| 61 | + // ErrNotASkill is returned when an imported folder has no SKILL.md. | |
| 62 | + ErrNotASkill = errors.New("this folder is not a skill: it has no SKILL.md") | |
| 63 | +) | |
| 64 | + | |
| 65 | +// skillName: the folder of a skill, as the Agent Skills standard names them. | |
| 66 | +var skillName = regexp.MustCompile(`^[a-z0-9][a-z0-9-]{0,63}$`) | |
| 67 | + | |
| 68 | +// The limits of an imported skill folder. | |
| 69 | +const ( | |
| 70 | + maxSkillFiles = 200 | |
| 71 | + maxSkillSize = 20 << 20 | |
| 72 | +) | |
| 73 | + | |
| 74 | +// skillsDir is where the agent reads its skills: from its program, or the | |
| 75 | +// skillsDir of a mini-me agent's agent.yaml. | |
| 76 | +func (s *WorkspaceService) skillsDir(ctx context.Context, agent string) (string, workspace.Workspace, error) { | |
| 77 | + definition, ok := s.Core.manager.Definition(agent) | |
| 78 | + if !ok { | |
| 79 | + return "", nil, fmt.Errorf("%w: %s", agents.ErrUnknownAgent, agent) | |
| 80 | + } | |
| 81 | + ws, err := s.Core.settingsWorkspaceOf(agent) | |
| 82 | + if err != nil { | |
| 83 | + return "", nil, err | |
| 84 | + } | |
| 85 | + dir := agents.SkillsDir(definition) | |
| 86 | + if file := definition.ConfigFile(); file != "" && agents.IsMiniMe(definition) { | |
| 87 | + if read, err := ws.Read(ctx, file); err == nil { | |
| 88 | + var mm struct { | |
| 89 | + SkillsDir string `yaml:"skillsDir"` | |
| 90 | + } | |
| 91 | + if yaml.Unmarshal([]byte(read.Content), &mm) == nil && mm.SkillsDir != "" { | |
| 92 | + if clean := path.Clean(strings.TrimPrefix(mm.SkillsDir, "./")); clean != "." && !strings.HasPrefix(clean, "..") && !path.IsAbs(clean) { | |
| 93 | + dir = clean | |
| 94 | + } | |
| 95 | + } | |
| 96 | + } | |
| 97 | + } | |
| 98 | + return dir, ws, nil | |
| 99 | +} | |
| 100 | + | |
| 101 | +// Skills lists the agent's skills: every folder of its skills folder that | |
| 102 | +// holds a SKILL.md, by name. | |
| 103 | +func (s *WorkspaceService) Skills(ctx context.Context, agent string) (Skills, error) { | |
| 104 | + dir, ws, err := s.skillsDir(ctx, agent) | |
| 105 | + if err != nil { | |
| 106 | + return Skills{}, err | |
| 107 | + } | |
| 108 | + result := Skills{Dir: dir, Skills: []Skill{}} | |
| 109 | + entries, err := ws.List(ctx, dir) | |
| 110 | + if errors.Is(err, workspace.ErrNotFound) { | |
| 111 | + return result, nil | |
| 112 | + } | |
| 113 | + if err != nil { | |
| 114 | + return Skills{}, err | |
| 115 | + } | |
| 116 | + for _, entry := range entries { | |
| 117 | + if !entry.Dir { | |
| 118 | + // mini-me also reads a skill that is one <name>.md file. | |
| 119 | + if strings.HasSuffix(entry.Name, ".md") && !strings.EqualFold(entry.Name, "README.md") { | |
| 120 | + result.Skills = append(result.Skills, skillOf(ctx, ws, strings.TrimSuffix(entry.Name, ".md"), path.Join(dir, entry.Name))) | |
| 121 | + } | |
| 122 | + continue | |
| 123 | + } | |
| 124 | + file := path.Join(dir, entry.Name, SkillFile) | |
| 125 | + read, err := ws.Read(ctx, file) | |
| 126 | + if err != nil { | |
| 127 | + continue | |
| 128 | + } | |
| 129 | + name, description := frontMatter(read.Content) | |
| 130 | + if name == "" { | |
| 131 | + name = entry.Name | |
| 132 | + } | |
| 133 | + result.Skills = append(result.Skills, Skill{Folder: entry.Name, Name: name, Description: description, Path: file}) | |
| 134 | + } | |
| 135 | + sort.Slice(result.Skills, func(i, j int) bool { return result.Skills[i].Folder < result.Skills[j].Folder }) | |
| 136 | + return result, nil | |
| 137 | +} | |
| 138 | + | |
| 139 | +// skillOf is the skill whose SKILL.md (or <name>.md) is file. | |
| 140 | +func skillOf(ctx context.Context, ws workspace.Workspace, folder, file string) Skill { | |
| 141 | + skill := Skill{Folder: folder, Name: folder, Path: file} | |
| 142 | + if read, err := ws.Read(ctx, file); err == nil { | |
| 143 | + name, description := frontMatter(read.Content) | |
| 144 | + if name != "" { | |
| 145 | + skill.Name = name | |
| 146 | + } | |
| 147 | + skill.Description = description | |
| 148 | + } | |
| 149 | + return skill | |
| 150 | +} | |
| 151 | + | |
| 152 | +// ReadSkill reads a skill's file, from the agent's folder on this computer | |
| 153 | +// when it has one (see settingsWorkspaceOf): the sandbox need not run. | |
| 154 | +func (s *WorkspaceService) ReadSkill(ctx context.Context, agent, file string) (workspace.File, error) { | |
| 155 | + dir, ws, err := s.skillsDir(ctx, agent) | |
| 156 | + if err != nil { | |
| 157 | + return workspace.File{}, err | |
| 158 | + } | |
| 159 | + if !inSkills(dir, file) { | |
| 160 | + return workspace.File{}, fmt.Errorf("%s is not a skill of %s", file, agent) | |
| 161 | + } | |
| 162 | + return ws.Read(ctx, file) | |
| 163 | +} | |
| 164 | + | |
| 165 | +// inSkills: file is a skill's file of the skills folder dir — its | |
| 166 | +// <folder>/SKILL.md, or a <name>.md right in dir (mini-me). | |
| 167 | +func inSkills(dir, file string) bool { | |
| 168 | + clean := path.Clean(file) | |
| 169 | + if path.Base(clean) == SkillFile && path.Dir(path.Dir(clean)) == dir { | |
| 170 | + return true | |
| 171 | + } | |
| 172 | + return strings.HasSuffix(clean, ".md") && path.Dir(clean) == dir | |
| 173 | +} | |
| 174 | + | |
| 175 | +// frontMatter reads the name and the description of a SKILL.md's YAML | |
| 176 | +// front matter (between two "---" lines at its top). | |
| 177 | +func frontMatter(content string) (name, description string) { | |
| 178 | + rest, ok := strings.CutPrefix(strings.TrimLeft(content, "\uFEFF"), "---") | |
| 179 | + if !ok { | |
| 180 | + return "", "" | |
| 181 | + } | |
| 182 | + head, _, ok := strings.Cut(rest, "\n---") | |
| 183 | + if !ok { | |
| 184 | + return "", "" | |
| 185 | + } | |
| 186 | + var fields struct { | |
| 187 | + Name string `yaml:"name"` | |
| 188 | + Description string `yaml:"description"` | |
| 189 | + } | |
| 190 | + if yaml.Unmarshal([]byte(head), &fields) != nil { | |
| 191 | + return "", "" | |
| 192 | + } | |
| 193 | + return strings.TrimSpace(fields.Name), strings.TrimSpace(fields.Description) | |
| 194 | +} | |
| 195 | + | |
| 196 | +// CreateSkill creates the skill name — a folder of the skills folder with | |
| 197 | +// content as its SKILL.md (a template the interface fills in). | |
| 198 | +func (s *WorkspaceService) CreateSkill(ctx context.Context, agent, name, content string) (Skill, error) { | |
| 199 | + dir, ws, err := s.skillsDir(ctx, agent) | |
| 200 | + if err != nil { | |
| 201 | + return Skill{}, err | |
| 202 | + } | |
| 203 | + if !skillName.MatchString(name) { | |
| 204 | + return Skill{}, ErrSkillName | |
| 205 | + } | |
| 206 | + if err := freeSkill(ctx, ws, dir, name); err != nil { | |
| 207 | + return Skill{}, err | |
| 208 | + } | |
| 209 | + file := path.Join(dir, name, SkillFile) | |
| 210 | + if err := ws.MakeDir(ctx, path.Join(dir, name)); err != nil && !errors.Is(err, workspace.ErrExists) { | |
| 211 | + return Skill{}, err | |
| 212 | + } | |
| 213 | + if _, err := ws.Write(ctx, file, content, ""); err != nil { | |
| 214 | + return Skill{}, err | |
| 215 | + } | |
| 216 | + title, description := frontMatter(content) | |
| 217 | + if title == "" { | |
| 218 | + title = name | |
| 219 | + } | |
| 220 | + return Skill{Folder: name, Name: title, Description: description, Path: file}, nil | |
| 221 | +} | |
| 222 | + | |
| 223 | +// freeSkill is ErrSkillExists when the skills folder has name already. | |
| 224 | +func freeSkill(ctx context.Context, ws workspace.Workspace, dir, name string) error { | |
| 225 | + entries, err := ws.List(ctx, dir) | |
| 226 | + if errors.Is(err, workspace.ErrNotFound) { | |
| 227 | + return nil | |
| 228 | + } | |
| 229 | + if err != nil { | |
| 230 | + return err | |
| 231 | + } | |
| 232 | + for _, entry := range entries { | |
| 233 | + if entry.Name == name || entry.Name == name+".md" { | |
| 234 | + return ErrSkillExists | |
| 235 | + } | |
| 236 | + } | |
| 237 | + return nil | |
| 238 | +} | |
| 239 | + | |
| 240 | +// SaveSkill writes a skill's SKILL.md edited in the Skills tab, over the | |
| 241 | +// version read; only a SKILL.md of the agent's skills folder. | |
| 242 | +func (s *WorkspaceService) SaveSkill(ctx context.Context, agent, file, content, version string) (SkillSave, error) { | |
| 243 | + dir, ws, err := s.skillsDir(ctx, agent) | |
| 244 | + if err != nil { | |
| 245 | + return SkillSave{}, err | |
| 246 | + } | |
| 247 | + if !inSkills(dir, file) { | |
| 248 | + return SkillSave{}, fmt.Errorf("%s is not a skill of %s", file, agent) | |
| 249 | + } | |
| 250 | + written, err := ws.Write(ctx, file, content, version) | |
| 251 | + if errors.Is(err, workspace.ErrConflict) { | |
| 252 | + return SkillSave{Conflict: true}, nil | |
| 253 | + } | |
| 254 | + return SkillSave{File: written}, err | |
| 255 | +} | |
| 256 | + | |
| 257 | +// ImportSkill copies a skill of this computer into the agent's skills | |
| 258 | +// folder: a folder holding a SKILL.md (with its other files: scripts, | |
| 259 | +// examples…), or a single Markdown file that becomes the SKILL.md of a new | |
| 260 | +// folder named after its front matter's name, else after the file. | |
| 261 | +func (s *WorkspaceService) ImportSkill(ctx context.Context, agent, hostPath string) (Skill, error) { | |
| 262 | + dir, ws, err := s.skillsDir(ctx, agent) | |
| 263 | + if err != nil { | |
| 264 | + return Skill{}, err | |
| 265 | + } | |
| 266 | + info, err := os.Stat(hostPath) | |
| 267 | + if err != nil { | |
| 268 | + return Skill{}, err | |
| 269 | + } | |
| 270 | + if info.IsDir() { | |
| 271 | + return importSkillFolder(ctx, ws, dir, hostPath) | |
| 272 | + } | |
| 273 | + data, err := os.ReadFile(hostPath) | |
| 274 | + if err != nil { | |
| 275 | + return Skill{}, err | |
| 276 | + } | |
| 277 | + if len(data) > workspace.MaxFileSize || !utf8.Valid(data) { | |
| 278 | + return Skill{}, fmt.Errorf("%s is not a Markdown text file a skill is made of", filepath.Base(hostPath)) | |
| 279 | + } | |
| 280 | + title, description := frontMatter(string(data)) | |
| 281 | + name := slugOf(title) | |
| 282 | + if name == "" { | |
| 283 | + name = slugOf(strings.TrimSuffix(filepath.Base(hostPath), filepath.Ext(hostPath))) | |
| 284 | + } | |
| 285 | + if strings.EqualFold(name, "skill") { | |
| 286 | + name = slugOf(filepath.Base(filepath.Dir(hostPath))) | |
| 287 | + } | |
| 288 | + if !skillName.MatchString(name) { | |
| 289 | + return Skill{}, ErrSkillName | |
| 290 | + } | |
| 291 | + if err := freeSkill(ctx, ws, dir, name); err != nil { | |
| 292 | + return Skill{}, err | |
| 293 | + } | |
| 294 | + if _, err := ws.Import(ctx, path.Join(dir, name), SkillFile, data); err != nil { | |
| 295 | + return Skill{}, err | |
| 296 | + } | |
| 297 | + if title == "" { | |
| 298 | + title = name | |
| 299 | + } | |
| 300 | + return Skill{Folder: name, Name: title, Description: description, Path: path.Join(dir, name, SkillFile)}, nil | |
| 301 | +} | |
| 302 | + | |
| 303 | +func importSkillFolder(ctx context.Context, ws workspace.Workspace, dir, hostDir string) (Skill, error) { | |
| 304 | + data, err := os.ReadFile(filepath.Join(hostDir, SkillFile)) | |
| 305 | + if err != nil { | |
| 306 | + return Skill{}, ErrNotASkill | |
| 307 | + } | |
| 308 | + name := slugOf(filepath.Base(hostDir)) | |
| 309 | + if !skillName.MatchString(name) { | |
| 310 | + return Skill{}, ErrSkillName | |
| 311 | + } | |
| 312 | + if err := freeSkill(ctx, ws, dir, name); err != nil { | |
| 313 | + return Skill{}, err | |
| 314 | + } | |
| 315 | + files, err := skillFiles(hostDir) | |
| 316 | + if err != nil { | |
| 317 | + return Skill{}, err | |
| 318 | + } | |
| 319 | + target := path.Join(dir, name) | |
| 320 | + for _, file := range files { | |
| 321 | + content, err := os.ReadFile(file) | |
| 322 | + if err != nil { | |
| 323 | + return Skill{}, err | |
| 324 | + } | |
| 325 | + rel, err := filepath.Rel(hostDir, file) | |
| 326 | + if err != nil { | |
| 327 | + return Skill{}, err | |
| 328 | + } | |
| 329 | + rel = filepath.ToSlash(rel) | |
| 330 | + if _, err := ws.Import(ctx, path.Join(target, path.Dir(rel)), path.Base(rel), content); err != nil { | |
| 331 | + return Skill{}, fmt.Errorf("%s: %w", rel, err) | |
| 332 | + } | |
| 333 | + } | |
| 334 | + title, description := frontMatter(string(data)) | |
| 335 | + if title == "" { | |
| 336 | + title = name | |
| 337 | + } | |
| 338 | + return Skill{Folder: name, Name: title, Description: description, Path: path.Join(target, SkillFile)}, nil | |
| 339 | +} | |
| 340 | + | |
| 341 | +// skillFiles is what is copied of a skill folder: its files, hidden ones | |
| 342 | +// and links aside, within maxSkillFiles and maxSkillSize. | |
| 343 | +func skillFiles(hostDir string) ([]string, error) { | |
| 344 | + var files []string | |
| 345 | + total := 0 | |
| 346 | + err := filepath.WalkDir(hostDir, func(file string, entry fs.DirEntry, err error) error { | |
| 347 | + switch { | |
| 348 | + case err != nil: | |
| 349 | + return err | |
| 350 | + case strings.HasPrefix(entry.Name(), ".") && file != hostDir && entry.IsDir(): | |
| 351 | + return filepath.SkipDir | |
| 352 | + case strings.HasPrefix(entry.Name(), ".") || !entry.Type().IsRegular(): | |
| 353 | + return nil | |
| 354 | + } | |
| 355 | + info, err := entry.Info() | |
| 356 | + if err != nil { | |
| 357 | + return err | |
| 358 | + } | |
| 359 | + total += int(info.Size()) | |
| 360 | + files = append(files, file) | |
| 361 | + if len(files) > maxSkillFiles || total > maxSkillSize { | |
| 362 | + return fmt.Errorf("%s: %w (%d files, %d MiB at most)", filepath.Base(hostDir), workspace.ErrTooLarge, maxSkillFiles, maxSkillSize>>20) | |
| 363 | + } | |
| 364 | + return nil | |
| 365 | + }) | |
| 366 | + return files, err | |
| 367 | +} | |
| 368 | + | |
| 369 | +// slugOf makes a skill folder name of text: lowercase letters, digits and -. | |
| 370 | +func slugOf(text string) string { | |
| 371 | + var b strings.Builder | |
| 372 | + dash := false | |
| 373 | + for _, r := range strings.ToLower(strings.TrimSpace(text)) { | |
| 374 | + switch { | |
| 375 | + case r >= 'a' && r <= 'z' || r >= '0' && r <= '9': | |
| 376 | + b.WriteRune(r) | |
| 377 | + dash = false | |
| 378 | + case !dash && b.Len() > 0: | |
| 379 | + b.WriteByte('-') | |
| 380 | + dash = true | |
| 381 | + } | |
| 382 | + } | |
| 383 | + return strings.Trim(b.String(), "-") | |
| 384 | +} | |
| 385 | + | |
| 386 | +// ChooseSkillFolder asks the user for a skill folder to import; "" when | |
| 387 | +// they cancelled. A single Markdown file is chosen with ChooseInstructions. | |
| 388 | +func (s *WorkspaceService) ChooseSkillFolder() (string, error) { | |
| 389 | + return (&ConfigService{Core: s.Core}).ChooseFolder() | |
| 390 | +} | |
| new file mode 100644 | |||
| @@ -0,0 +1,390 @@ | |||
| 1 | +// Copyright (c) 2026 Philippe Charrière — Sidekicks Source-Available License 1.0, see LICENSE | ||
| 2 | + | ||
| 3 | +package app | ||
| 4 | + | ||
| 5 | +import ( | ||
| 6 | + "context" | ||
| 7 | + "errors" | ||
| 8 | + "fmt" | ||
| 9 | + "io/fs" | ||
| 10 | + "os" | ||
| 11 | + "path" | ||
| 12 | + "path/filepath" | ||
| 13 | + "regexp" | ||
| 14 | + "sort" | ||
| 15 | + "strings" | ||
| 16 | + "unicode/utf8" | ||
| 17 | + | ||
| 18 | + "go.yaml.in/yaml/v3" | ||
| 19 | + | ||
| 20 | + "git.rickub.com/bots-garden/sidekicks/internal/agents" | ||
| 21 | + "git.rickub.com/bots-garden/sidekicks/internal/workspace" | ||
| 22 | +) | ||
| 23 | + | ||
| 24 | +// An agent's skills (issue #112): created, edited and imported from its | ||
| 25 | +// Skills tab, in the folder its program reads (agents.SkillsDir) — on this | ||
| 26 | +// computer, in its container or in its sandbox alike, through its | ||
| 27 | +// workspace. Like its instructions (issue #113), the skills folders are | ||
| 28 | +// protected in the Files tab: only this tab writes there, and it never | ||
| 29 | +// removes anything. | ||
| 30 | + | ||
| 31 | +// SkillFile is the file every skill folder holds. | ||
| 32 | +const SkillFile = "SKILL.md" | ||
| 33 | + | ||
| 34 | +// Skill is one skill of an agent: its folder's name, the name and the | ||
| 35 | +// description of its SKILL.md, and that file's path in the agent's folder. | ||
| 36 | +type Skill struct { | ||
| 37 | + Folder string `json:"folder"` | ||
| 38 | + Name string `json:"name"` | ||
| 39 | + Description string `json:"description"` | ||
| 40 | + Path string `json:"path"` | ||
| 41 | +} | ||
| 42 | + | ||
| 43 | +// Skills is an agent's skills folder and what it holds. | ||
| 44 | +type Skills struct { | ||
| 45 | + Dir string `json:"dir"` | ||
| 46 | + Skills []Skill `json:"skills"` | ||
| 47 | +} | ||
| 48 | + | ||
| 49 | +// SkillSave is the result of SaveSkill: the file written, or Conflict when | ||
| 50 | +// it changed since it was read — nothing was written then. | ||
| 51 | +type SkillSave struct { | ||
| 52 | + File workspace.File `json:"file"` | ||
| 53 | + Conflict bool `json:"conflict"` | ||
| 54 | +} | ||
| 55 | + | ||
| 56 | +var ( | ||
| 57 | + // ErrSkillExists is returned when a skill folder already has that name. | ||
| 58 | + ErrSkillExists = errors.New("the agent already has a skill with this name") | ||
| 59 | + // ErrSkillName is returned for a name that cannot be a skill's folder. | ||
| 60 | + ErrSkillName = errors.New("a skill name is made of lowercase letters, digits and -") | ||
| 61 | + // ErrNotASkill is returned when an imported folder has no SKILL.md. | ||
| 62 | + ErrNotASkill = errors.New("this folder is not a skill: it has no SKILL.md") | ||
| 63 | +) | ||
| 64 | + | ||
| 65 | +// skillName: the folder of a skill, as the Agent Skills standard names them. | ||
| 66 | +var skillName = regexp.MustCompile(`^[a-z0-9][a-z0-9-]{0,63}$`) | ||
| 67 | + | ||
| 68 | +// The limits of an imported skill folder. | ||
| 69 | +const ( | ||
| 70 | + maxSkillFiles = 200 | ||
| 71 | + maxSkillSize = 20 << 20 | ||
| 72 | +) | ||
| 73 | + | ||
| 74 | +// skillsDir is where the agent reads its skills: from its program, or the | ||
| 75 | +// skillsDir of a mini-me agent's agent.yaml. | ||
| 76 | +func (s *WorkspaceService) skillsDir(ctx context.Context, agent string) (string, workspace.Workspace, error) { | ||
| 77 | + definition, ok := s.Core.manager.Definition(agent) | ||
| 78 | + if !ok { | ||
| 79 | + return "", nil, fmt.Errorf("%w: %s", agents.ErrUnknownAgent, agent) | ||
| 80 | + } | ||
| 81 | + ws, err := s.Core.settingsWorkspaceOf(agent) | ||
| 82 | + if err != nil { | ||
| 83 | + return "", nil, err | ||
| 84 | + } | ||
| 85 | + dir := agents.SkillsDir(definition) | ||
| 86 | + if file := definition.ConfigFile(); file != "" && agents.IsMiniMe(definition) { | ||
| 87 | + if read, err := ws.Read(ctx, file); err == nil { | ||
| 88 | + var mm struct { | ||
| 89 | + SkillsDir string `yaml:"skillsDir"` | ||
| 90 | + } | ||
| 91 | + if yaml.Unmarshal([]byte(read.Content), &mm) == nil && mm.SkillsDir != "" { | ||
| 92 | + if clean := path.Clean(strings.TrimPrefix(mm.SkillsDir, "./")); clean != "." && !strings.HasPrefix(clean, "..") && !path.IsAbs(clean) { | ||
| 93 | + dir = clean | ||
| 94 | + } | ||
| 95 | + } | ||
| 96 | + } | ||
| 97 | + } | ||
| 98 | + return dir, ws, nil | ||
| 99 | +} | ||
| 100 | + | ||
| 101 | +// Skills lists the agent's skills: every folder of its skills folder that | ||
| 102 | +// holds a SKILL.md, by name. | ||
| 103 | +func (s *WorkspaceService) Skills(ctx context.Context, agent string) (Skills, error) { | ||
| 104 | + dir, ws, err := s.skillsDir(ctx, agent) | ||
| 105 | + if err != nil { | ||
| 106 | + return Skills{}, err | ||
| 107 | + } | ||
| 108 | + result := Skills{Dir: dir, Skills: []Skill{}} | ||
| 109 | + entries, err := ws.List(ctx, dir) | ||
| 110 | + if errors.Is(err, workspace.ErrNotFound) { | ||
| 111 | + return result, nil | ||
| 112 | + } | ||
| 113 | + if err != nil { | ||
| 114 | + return Skills{}, err | ||
| 115 | + } | ||
| 116 | + for _, entry := range entries { | ||
| 117 | + if !entry.Dir { | ||
| 118 | + // mini-me also reads a skill that is one <name>.md file. | ||
| 119 | + if strings.HasSuffix(entry.Name, ".md") && !strings.EqualFold(entry.Name, "README.md") { | ||
| 120 | + result.Skills = append(result.Skills, skillOf(ctx, ws, strings.TrimSuffix(entry.Name, ".md"), path.Join(dir, entry.Name))) | ||
| 121 | + } | ||
| 122 | + continue | ||
| 123 | + } | ||
| 124 | + file := path.Join(dir, entry.Name, SkillFile) | ||
| 125 | + read, err := ws.Read(ctx, file) | ||
| 126 | + if err != nil { | ||
| 127 | + continue | ||
| 128 | + } | ||
| 129 | + name, description := frontMatter(read.Content) | ||
| 130 | + if name == "" { | ||
| 131 | + name = entry.Name | ||
| 132 | + } | ||
| 133 | + result.Skills = append(result.Skills, Skill{Folder: entry.Name, Name: name, Description: description, Path: file}) | ||
| 134 | + } | ||
| 135 | + sort.Slice(result.Skills, func(i, j int) bool { return result.Skills[i].Folder < result.Skills[j].Folder }) | ||
| 136 | + return result, nil | ||
| 137 | +} | ||
| 138 | + | ||
| 139 | +// skillOf is the skill whose SKILL.md (or <name>.md) is file. | ||
| 140 | +func skillOf(ctx context.Context, ws workspace.Workspace, folder, file string) Skill { | ||
| 141 | + skill := Skill{Folder: folder, Name: folder, Path: file} | ||
| 142 | + if read, err := ws.Read(ctx, file); err == nil { | ||
| 143 | + name, description := frontMatter(read.Content) | ||
| 144 | + if name != "" { | ||
| 145 | + skill.Name = name | ||
| 146 | + } | ||
| 147 | + skill.Description = description | ||
| 148 | + } | ||
| 149 | + return skill | ||
| 150 | +} | ||
| 151 | + | ||
| 152 | +// ReadSkill reads a skill's file, from the agent's folder on this computer | ||
| 153 | +// when it has one (see settingsWorkspaceOf): the sandbox need not run. | ||
| 154 | +func (s *WorkspaceService) ReadSkill(ctx context.Context, agent, file string) (workspace.File, error) { | ||
| 155 | + dir, ws, err := s.skillsDir(ctx, agent) | ||
| 156 | + if err != nil { | ||
| 157 | + return workspace.File{}, err | ||
| 158 | + } | ||
| 159 | + if !inSkills(dir, file) { | ||
| 160 | + return workspace.File{}, fmt.Errorf("%s is not a skill of %s", file, agent) | ||
| 161 | + } | ||
| 162 | + return ws.Read(ctx, file) | ||
| 163 | +} | ||
| 164 | + | ||
| 165 | +// inSkills: file is a skill's file of the skills folder dir — its | ||
| 166 | +// <folder>/SKILL.md, or a <name>.md right in dir (mini-me). | ||
| 167 | +func inSkills(dir, file string) bool { | ||
| 168 | + clean := path.Clean(file) | ||
| 169 | + if path.Base(clean) == SkillFile && path.Dir(path.Dir(clean)) == dir { | ||
| 170 | + return true | ||
| 171 | + } | ||
| 172 | + return strings.HasSuffix(clean, ".md") && path.Dir(clean) == dir | ||
| 173 | +} | ||
| 174 | + | ||
| 175 | +// frontMatter reads the name and the description of a SKILL.md's YAML | ||
| 176 | +// front matter (between two "---" lines at its top). | ||
| 177 | +func frontMatter(content string) (name, description string) { | ||
| 178 | + rest, ok := strings.CutPrefix(strings.TrimLeft(content, "\uFEFF"), "---") | ||
| 179 | + if !ok { | ||
| 180 | + return "", "" | ||
| 181 | + } | ||
| 182 | + head, _, ok := strings.Cut(rest, "\n---") | ||
| 183 | + if !ok { | ||
| 184 | + return "", "" | ||
| 185 | + } | ||
| 186 | + var fields struct { | ||
| 187 | + Name string `yaml:"name"` | ||
| 188 | + Description string `yaml:"description"` | ||
| 189 | + } | ||
| 190 | + if yaml.Unmarshal([]byte(head), &fields) != nil { | ||
| 191 | + return "", "" | ||
| 192 | + } | ||
| 193 | + return strings.TrimSpace(fields.Name), strings.TrimSpace(fields.Description) | ||
| 194 | +} | ||
| 195 | + | ||
| 196 | +// CreateSkill creates the skill name — a folder of the skills folder with | ||
| 197 | +// content as its SKILL.md (a template the interface fills in). | ||
| 198 | +func (s *WorkspaceService) CreateSkill(ctx context.Context, agent, name, content string) (Skill, error) { | ||
| 199 | + dir, ws, err := s.skillsDir(ctx, agent) | ||
| 200 | + if err != nil { | ||
| 201 | + return Skill{}, err | ||
| 202 | + } | ||
| 203 | + if !skillName.MatchString(name) { | ||
| 204 | + return Skill{}, ErrSkillName | ||
| 205 | + } | ||
| 206 | + if err := freeSkill(ctx, ws, dir, name); err != nil { | ||
| 207 | + return Skill{}, err | ||
| 208 | + } | ||
| 209 | + file := path.Join(dir, name, SkillFile) | ||
| 210 | + if err := ws.MakeDir(ctx, path.Join(dir, name)); err != nil && !errors.Is(err, workspace.ErrExists) { | ||
| 211 | + return Skill{}, err | ||
| 212 | + } | ||
| 213 | + if _, err := ws.Write(ctx, file, content, ""); err != nil { | ||
| 214 | + return Skill{}, err | ||
| 215 | + } | ||
| 216 | + title, description := frontMatter(content) | ||
| 217 | + if title == "" { | ||
| 218 | + title = name | ||
| 219 | + } | ||
| 220 | + return Skill{Folder: name, Name: title, Description: description, Path: file}, nil | ||
| 221 | +} | ||
| 222 | + | ||
| 223 | +// freeSkill is ErrSkillExists when the skills folder has name already. | ||
| 224 | +func freeSkill(ctx context.Context, ws workspace.Workspace, dir, name string) error { | ||
| 225 | + entries, err := ws.List(ctx, dir) | ||
| 226 | + if errors.Is(err, workspace.ErrNotFound) { | ||
| 227 | + return nil | ||
| 228 | + } | ||
| 229 | + if err != nil { | ||
| 230 | + return err | ||
| 231 | + } | ||
| 232 | + for _, entry := range entries { | ||
| 233 | + if entry.Name == name || entry.Name == name+".md" { | ||
| 234 | + return ErrSkillExists | ||
| 235 | + } | ||
| 236 | + } | ||
| 237 | + return nil | ||
| 238 | +} | ||
| 239 | + | ||
| 240 | +// SaveSkill writes a skill's SKILL.md edited in the Skills tab, over the | ||
| 241 | +// version read; only a SKILL.md of the agent's skills folder. | ||
| 242 | +func (s *WorkspaceService) SaveSkill(ctx context.Context, agent, file, content, version string) (SkillSave, error) { | ||
| 243 | + dir, ws, err := s.skillsDir(ctx, agent) | ||
| 244 | + if err != nil { | ||
| 245 | + return SkillSave{}, err | ||
| 246 | + } | ||
| 247 | + if !inSkills(dir, file) { | ||
| 248 | + return SkillSave{}, fmt.Errorf("%s is not a skill of %s", file, agent) | ||
| 249 | + } | ||
| 250 | + written, err := ws.Write(ctx, file, content, version) | ||
| 251 | + if errors.Is(err, workspace.ErrConflict) { | ||
| 252 | + return SkillSave{Conflict: true}, nil | ||
| 253 | + } | ||
| 254 | + return SkillSave{File: written}, err | ||
| 255 | +} | ||
| 256 | + | ||
| 257 | +// ImportSkill copies a skill of this computer into the agent's skills | ||
| 258 | +// folder: a folder holding a SKILL.md (with its other files: scripts, | ||
| 259 | +// examples…), or a single Markdown file that becomes the SKILL.md of a new | ||
| 260 | +// folder named after its front matter's name, else after the file. | ||
| 261 | +func (s *WorkspaceService) ImportSkill(ctx context.Context, agent, hostPath string) (Skill, error) { | ||
| 262 | + dir, ws, err := s.skillsDir(ctx, agent) | ||
| 263 | + if err != nil { | ||
| 264 | + return Skill{}, err | ||
| 265 | + } | ||
| 266 | + info, err := os.Stat(hostPath) | ||
| 267 | + if err != nil { | ||
| 268 | + return Skill{}, err | ||
| 269 | + } | ||
| 270 | + if info.IsDir() { | ||
| 271 | + return importSkillFolder(ctx, ws, dir, hostPath) | ||
| 272 | + } | ||
| 273 | + data, err := os.ReadFile(hostPath) | ||
| 274 | + if err != nil { | ||
| 275 | + return Skill{}, err | ||
| 276 | + } | ||
| 277 | + if len(data) > workspace.MaxFileSize || !utf8.Valid(data) { | ||
| 278 | + return Skill{}, fmt.Errorf("%s is not a Markdown text file a skill is made of", filepath.Base(hostPath)) | ||
| 279 | + } | ||
| 280 | + title, description := frontMatter(string(data)) | ||
| 281 | + name := slugOf(title) | ||
| 282 | + if name == "" { | ||
| 283 | + name = slugOf(strings.TrimSuffix(filepath.Base(hostPath), filepath.Ext(hostPath))) | ||
| 284 | + } | ||
| 285 | + if strings.EqualFold(name, "skill") { | ||
| 286 | + name = slugOf(filepath.Base(filepath.Dir(hostPath))) | ||
| 287 | + } | ||
| 288 | + if !skillName.MatchString(name) { | ||
| 289 | + return Skill{}, ErrSkillName | ||
| 290 | + } | ||
| 291 | + if err := freeSkill(ctx, ws, dir, name); err != nil { | ||
| 292 | + return Skill{}, err | ||
| 293 | + } | ||
| 294 | + if _, err := ws.Import(ctx, path.Join(dir, name), SkillFile, data); err != nil { | ||
| 295 | + return Skill{}, err | ||
| 296 | + } | ||
| 297 | + if title == "" { | ||
| 298 | + title = name | ||
| 299 | + } | ||
| 300 | + return Skill{Folder: name, Name: title, Description: description, Path: path.Join(dir, name, SkillFile)}, nil | ||
| 301 | +} | ||
| 302 | + | ||
| 303 | +func importSkillFolder(ctx context.Context, ws workspace.Workspace, dir, hostDir string) (Skill, error) { | ||
| 304 | + data, err := os.ReadFile(filepath.Join(hostDir, SkillFile)) | ||
| 305 | + if err != nil { | ||
| 306 | + return Skill{}, ErrNotASkill | ||
| 307 | + } | ||
| 308 | + name := slugOf(filepath.Base(hostDir)) | ||
| 309 | + if !skillName.MatchString(name) { | ||
| 310 | + return Skill{}, ErrSkillName | ||
| 311 | + } | ||
| 312 | + if err := freeSkill(ctx, ws, dir, name); err != nil { | ||
| 313 | + return Skill{}, err | ||
| 314 | + } | ||
| 315 | + files, err := skillFiles(hostDir) | ||
| 316 | + if err != nil { | ||
| 317 | + return Skill{}, err | ||
| 318 | + } | ||
| 319 | + target := path.Join(dir, name) | ||
| 320 | + for _, file := range files { | ||
| 321 | + content, err := os.ReadFile(file) | ||
| 322 | + if err != nil { | ||
| 323 | + return Skill{}, err | ||
| 324 | + } | ||
| 325 | + rel, err := filepath.Rel(hostDir, file) | ||
| 326 | + if err != nil { | ||
| 327 | + return Skill{}, err | ||
| 328 | + } | ||
| 329 | + rel = filepath.ToSlash(rel) | ||
| 330 | + if _, err := ws.Import(ctx, path.Join(target, path.Dir(rel)), path.Base(rel), content); err != nil { | ||
| 331 | + return Skill{}, fmt.Errorf("%s: %w", rel, err) | ||
| 332 | + } | ||
| 333 | + } | ||
| 334 | + title, description := frontMatter(string(data)) | ||
| 335 | + if title == "" { | ||
| 336 | + title = name | ||
| 337 | + } | ||
| 338 | + return Skill{Folder: name, Name: title, Description: description, Path: path.Join(target, SkillFile)}, nil | ||
| 339 | +} | ||
| 340 | + | ||
| 341 | +// skillFiles is what is copied of a skill folder: its files, hidden ones | ||
| 342 | +// and links aside, within maxSkillFiles and maxSkillSize. | ||
| 343 | +func skillFiles(hostDir string) ([]string, error) { | ||
| 344 | + var files []string | ||
| 345 | + total := 0 | ||
| 346 | + err := filepath.WalkDir(hostDir, func(file string, entry fs.DirEntry, err error) error { | ||
| 347 | + switch { | ||
| 348 | + case err != nil: | ||
| 349 | + return err | ||
| 350 | + case strings.HasPrefix(entry.Name(), ".") && file != hostDir && entry.IsDir(): | ||
| 351 | + return filepath.SkipDir | ||
| 352 | + case strings.HasPrefix(entry.Name(), ".") || !entry.Type().IsRegular(): | ||
| 353 | + return nil | ||
| 354 | + } | ||
| 355 | + info, err := entry.Info() | ||
| 356 | + if err != nil { | ||
| 357 | + return err | ||
| 358 | + } | ||
| 359 | + total += int(info.Size()) | ||
| 360 | + files = append(files, file) | ||
| 361 | + if len(files) > maxSkillFiles || total > maxSkillSize { | ||
| 362 | + return fmt.Errorf("%s: %w (%d files, %d MiB at most)", filepath.Base(hostDir), workspace.ErrTooLarge, maxSkillFiles, maxSkillSize>>20) | ||
| 363 | + } | ||
| 364 | + return nil | ||
| 365 | + }) | ||
| 366 | + return files, err | ||
| 367 | +} | ||
| 368 | + | ||
| 369 | +// slugOf makes a skill folder name of text: lowercase letters, digits and -. | ||
| 370 | +func slugOf(text string) string { | ||
| 371 | + var b strings.Builder | ||
| 372 | + dash := false | ||
| 373 | + for _, r := range strings.ToLower(strings.TrimSpace(text)) { | ||
| 374 | + switch { | ||
| 375 | + case r >= 'a' && r <= 'z' || r >= '0' && r <= '9': | ||
| 376 | + b.WriteRune(r) | ||
| 377 | + dash = false | ||
| 378 | + case !dash && b.Len() > 0: | ||
| 379 | + b.WriteByte('-') | ||
| 380 | + dash = true | ||
| 381 | + } | ||
| 382 | + } | ||
| 383 | + return strings.Trim(b.String(), "-") | ||
| 384 | +} | ||
| 385 | + | ||
| 386 | +// ChooseSkillFolder asks the user for a skill folder to import; "" when | ||
| 387 | +// they cancelled. A single Markdown file is chosen with ChooseInstructions. | ||
| 388 | +func (s *WorkspaceService) ChooseSkillFolder() (string, error) { | ||
| 389 | + return (&ConfigService{Core: s.Core}).ChooseFolder() | ||
| 390 | +} | ||
added
internal/app/skills_test.go +177 -0 | new file mode 100644 | ||
| @@ -0,0 +1,177 @@ | ||
| 1 | +// Copyright (c) 2026 Philippe Charrière — Sidekicks Source-Available License 1.0, see LICENSE | |
| 2 | + | |
| 3 | +package app_test | |
| 4 | + | |
| 5 | +import ( | |
| 6 | + "context" | |
| 7 | + "errors" | |
| 8 | + "os" | |
| 9 | + "path/filepath" | |
| 10 | + "testing" | |
| 11 | + | |
| 12 | + "git.rickub.com/bots-garden/sidekicks/internal/app" | |
| 13 | + "git.rickub.com/bots-garden/sidekicks/internal/config" | |
| 14 | +) | |
| 15 | + | |
| 16 | +// skillsSetup: alice is mini-me, with its skills in "abilities" (its | |
| 17 | +// agent.yaml says so); claude runs Claude Code's adapter. | |
| 18 | +func skillsSetup(t *testing.T) (*app.WorkspaceService, string) { | |
| 19 | + t.Helper() | |
| 20 | + directory := t.TempDir() | |
| 21 | + for _, name := range []string{"alice", "claude"} { | |
| 22 | + if err := os.MkdirAll(filepath.Join(directory, name), 0o755); err != nil { | |
| 23 | + t.Fatal(err) | |
| 24 | + } | |
| 25 | + } | |
| 26 | + write(t, filepath.Join(directory, "alice", "agent.yaml"), "name: alice\nskillsDir: abilities\n") | |
| 27 | + path := filepath.Join(directory, "config.yaml") | |
| 28 | + write(t, path, "version: 1\nagents:\n - name: alice\n command: mm\n args: [--acp, --config, agent.yaml]\n workspace: alice\n"+ | |
| 29 | + " - name: claude\n command: claude-agent-acp\n workspace: claude\n") | |
| 30 | + core := app.New(config.Location{Path: path, Source: config.SourceFlag}, app.Options{Starter: starter}) | |
| 31 | + t.Cleanup(func() { core.Shutdown(context.Background()) }) | |
| 32 | + return &app.WorkspaceService{Core: core}, directory | |
| 33 | +} | |
| 34 | + | |
| 35 | +const translate = "---\nname: translate\ndescription: Translate a text into English.\n---\n\n# Translate\n" | |
| 36 | + | |
| 37 | +// Issue #112: a skill is created in the folder the agent reads, listed with | |
| 38 | +// the name and the description of its SKILL.md. | |
| 39 | +func TestSkillsAreCreatedAndListedInTheAgentsSkillsFolder(t *testing.T) { | |
| 40 | + service, directory := skillsSetup(t) | |
| 41 | + ctx := context.Background() | |
| 42 | + if got, err := service.Skills(ctx, "alice"); err != nil || got.Dir != "abilities" || len(got.Skills) != 0 { | |
| 43 | + t.Fatalf("none yet, in mini-me's skillsDir: %+v %v", got, err) | |
| 44 | + } | |
| 45 | + created, err := service.CreateSkill(ctx, "alice", "translate", translate) | |
| 46 | + if err != nil || created.Path != "abilities/translate/SKILL.md" || created.Description != "Translate a text into English." { | |
| 47 | + t.Fatalf("created: %+v %v", created, err) | |
| 48 | + } | |
| 49 | + if data, _ := os.ReadFile(filepath.Join(directory, "alice", "abilities", "translate", "SKILL.md")); string(data) != translate { | |
| 50 | + t.Fatalf("written: %q", data) | |
| 51 | + } | |
| 52 | + if _, err := service.CreateSkill(ctx, "alice", "translate", "x"); !errors.Is(err, app.ErrSkillExists) { | |
| 53 | + t.Fatalf("taken: %v", err) | |
| 54 | + } | |
| 55 | + if _, err := service.CreateSkill(ctx, "alice", "My Skill", "x"); !errors.Is(err, app.ErrSkillName) { | |
| 56 | + t.Fatalf("a bad name: %v", err) | |
| 57 | + } | |
| 58 | + if got, _ := service.Skills(ctx, "claude"); got.Dir != ".claude/skills" { | |
| 59 | + t.Fatalf("Claude's: %+v", got) | |
| 60 | + } | |
| 61 | + listed, _ := service.Skills(ctx, "alice") | |
| 62 | + if len(listed.Skills) != 1 || listed.Skills[0].Name != "translate" { | |
| 63 | + t.Fatalf("listed: %+v", listed) | |
| 64 | + } | |
| 65 | +} | |
| 66 | + | |
| 67 | +func TestASkillIsSavedOverTheVersionRead(t *testing.T) { | |
| 68 | + service, directory := skillsSetup(t) | |
| 69 | + ctx := context.Background() | |
| 70 | + created, _ := service.CreateSkill(ctx, "claude", "review", "v1") | |
| 71 | + read, _ := service.Read(ctx, "claude", created.Path) | |
| 72 | + saved, err := service.SaveSkill(ctx, "claude", created.Path, "v2", read.Version) | |
| 73 | + if err != nil || saved.Conflict || saved.File.Content != "v2" { | |
| 74 | + t.Fatalf("saved: %+v %v", saved, err) | |
| 75 | + } | |
| 76 | + write(t, filepath.Join(directory, "claude", ".claude", "skills", "review", "SKILL.md"), "changed") | |
| 77 | + if late, _ := service.SaveSkill(ctx, "claude", created.Path, "v3", saved.File.Version); !late.Conflict { | |
| 78 | + t.Fatalf("a conflict: %+v", late) | |
| 79 | + } | |
| 80 | + if _, err := service.SaveSkill(ctx, "claude", "CLAUDE.md", "x", ""); err == nil { | |
| 81 | + t.Fatal("only a SKILL.md of the skills folder") | |
| 82 | + } | |
| 83 | +} | |
| 84 | + | |
| 85 | +func TestASkillIsImportedFromAFolderOrAMarkdownFile(t *testing.T) { | |
| 86 | + service, directory := skillsSetup(t) | |
| 87 | + ctx := context.Background() | |
| 88 | + folder := filepath.Join(directory, "Downloads", "pdf-tools") | |
| 89 | + for file, content := range map[string]string{ | |
| 90 | + "SKILL.md": "---\nname: pdf-tools\ndescription: Read PDF files.\n---\n", "scripts/extract.py": "print('x')", ".git/config": "secret", | |
| 91 | + } { | |
| 92 | + if err := os.MkdirAll(filepath.Dir(filepath.Join(folder, file)), 0o755); err != nil { | |
| 93 | + t.Fatal(err) | |
| 94 | + } | |
| 95 | + write(t, filepath.Join(folder, file), content) | |
| 96 | + } | |
| 97 | + imported, err := service.ImportSkill(ctx, "claude", folder) | |
| 98 | + if err != nil || imported.Folder != "pdf-tools" || imported.Description != "Read PDF files." { | |
| 99 | + t.Fatalf("folder: %+v %v", imported, err) | |
| 100 | + } | |
| 101 | + base := filepath.Join(directory, "claude", ".claude", "skills", "pdf-tools") | |
| 102 | + if data, _ := os.ReadFile(filepath.Join(base, "scripts", "extract.py")); string(data) != "print('x')" { | |
| 103 | + t.Fatalf("its files: %q", data) | |
| 104 | + } | |
| 105 | + if _, err := os.Stat(filepath.Join(base, ".git")); err == nil { | |
| 106 | + t.Fatal("hidden folders stay behind") | |
| 107 | + } | |
| 108 | + if _, err := service.ImportSkill(ctx, "claude", folder); !errors.Is(err, app.ErrSkillExists) { | |
| 109 | + t.Fatalf("taken: %v", err) | |
| 110 | + } | |
| 111 | + single := filepath.Join(directory, "Meeting notes.md") | |
| 112 | + write(t, single, "# Notes\nSummarise a meeting.\n") | |
| 113 | + if one, err := service.ImportSkill(ctx, "claude", single); err != nil || one.Folder != "meeting-notes" { | |
| 114 | + t.Fatalf("a file: %+v %v", one, err) | |
| 115 | + } | |
| 116 | + if _, err := service.ImportSkill(ctx, "claude", filepath.Join(directory, "Downloads")); !errors.Is(err, app.ErrNotASkill) { | |
| 117 | + t.Fatalf("not a skill: %v", err) | |
| 118 | + } | |
| 119 | +} | |
| 120 | + | |
| 121 | +// miniCoderSetup is the owner's mini-coder: mini-me in a sandbox whose .mm | |
| 122 | +// folder — its skills with it — is mounted read-only; its sbx refuses | |
| 123 | +// every write, as that mount would. | |
| 124 | +func miniCoderSetup(t *testing.T) (*app.WorkspaceService, string) { | |
| 125 | + t.Helper() | |
| 126 | + directory := t.TempDir() | |
| 127 | + folder := filepath.Join(directory, "mini-coder") | |
| 128 | + if err := os.MkdirAll(filepath.Join(folder, ".mm", "skills"), 0o755); err != nil { | |
| 129 | + t.Fatal(err) | |
| 130 | + } | |
| 131 | + write(t, filepath.Join(folder, ".mm", "agent.yaml"), "skillsDir: .mm/skills\n") | |
| 132 | + write(t, filepath.Join(folder, ".mm", "skills", "commit.md"), "---\nname: commit\ndescription: Write a commit message.\n---\n") | |
| 133 | + // An sbx that refuses everything, as a read-only mount would. | |
| 134 | + write(t, filepath.Join(directory, "sbx"), "#!/bin/sh\necho 'mkdir: Read-only file system' >&2\nexit 1\n") | |
| 135 | + if err := os.Chmod(filepath.Join(directory, "sbx"), 0o755); err != nil { | |
| 136 | + t.Fatal(err) | |
| 137 | + } | |
| 138 | + path := filepath.Join(directory, "config.yaml") | |
| 139 | + write(t, path, "version: 1\nagents:\n - name: mini-coder\n command: sbx\n args: [exec, -i, mini-coder-sbx, mm, --acp, -config, .mm/agent.yaml]\n"+ | |
| 140 | + " workspace: mini-coder\n runtime:\n type: sbx\n sandbox: mini-coder-sbx\n") | |
| 141 | + core := app.New(config.Location{Path: path, Source: config.SourceFlag}, app.Options{Starter: starter, Sbx: filepath.Join(directory, "sbx")}) | |
| 142 | + t.Cleanup(func() { core.Shutdown(context.Background()) }) | |
| 143 | + return &app.WorkspaceService{Core: core}, folder | |
| 144 | +} | |
| 145 | + | |
| 146 | +// The skills are written in the | |
| 147 | +// agent's folder on this computer, not through sbx; a <name>.md is a skill. | |
| 148 | +func TestTheSkillsOfASandboxAgentAreWrittenInItsFolderOnThisComputer(t *testing.T) { | |
| 149 | + service, folder := miniCoderSetup(t) | |
| 150 | + ctx := context.Background() | |
| 151 | + listed, err := service.Skills(ctx, "mini-coder") | |
| 152 | + if err != nil || listed.Dir != ".mm/skills" || len(listed.Skills) != 1 || listed.Skills[0].Name != "commit" || listed.Skills[0].Path != ".mm/skills/commit.md" { | |
| 153 | + t.Fatalf("listed: %+v %v", listed, err) | |
| 154 | + } | |
| 155 | + if _, err := service.CreateSkill(ctx, "mini-coder", "commit", "x"); !errors.Is(err, app.ErrSkillExists) { | |
| 156 | + t.Fatalf("commit.md takes the name: %v", err) | |
| 157 | + } | |
| 158 | + if _, err := service.CreateSkill(ctx, "mini-coder", "review", translate); err != nil { | |
| 159 | + t.Fatalf("written on this computer: %v", err) | |
| 160 | + } | |
| 161 | + if _, err := os.Stat(filepath.Join(folder, ".mm", "skills", "review", "SKILL.md")); err != nil { | |
| 162 | + t.Fatal(err) | |
| 163 | + } | |
| 164 | + read, err := service.ReadSkill(ctx, "mini-coder", ".mm/skills/commit.md") | |
| 165 | + if err != nil { | |
| 166 | + t.Fatalf("read without the sandbox: %v", err) | |
| 167 | + } | |
| 168 | + if saved, err := service.SaveSkill(ctx, "mini-coder", ".mm/skills/commit.md", "v2", read.Version); err != nil || saved.Conflict { | |
| 169 | + t.Fatalf("a <name>.md is saved too: %+v %v", saved, err) | |
| 170 | + } | |
| 171 | + if _, err := service.ReadSkill(ctx, "mini-coder", ".mm/agent.yaml"); err == nil { | |
| 172 | + t.Fatal("only skills") | |
| 173 | + } | |
| 174 | + if _, err := service.CreateInstructions(ctx, "mini-coder", "# Mini coder\n"); err != nil { | |
| 175 | + t.Fatalf("instructions too: %v", err) | |
| 176 | + } | |
| 177 | +} | |
| new file mode 100644 | |||
| @@ -0,0 +1,177 @@ | |||
| 1 | +// Copyright (c) 2026 Philippe Charrière — Sidekicks Source-Available License 1.0, see LICENSE | ||
| 2 | + | ||
| 3 | +package app_test | ||
| 4 | + | ||
| 5 | +import ( | ||
| 6 | + "context" | ||
| 7 | + "errors" | ||
| 8 | + "os" | ||
| 9 | + "path/filepath" | ||
| 10 | + "testing" | ||
| 11 | + | ||
| 12 | + "git.rickub.com/bots-garden/sidekicks/internal/app" | ||
| 13 | + "git.rickub.com/bots-garden/sidekicks/internal/config" | ||
| 14 | +) | ||
| 15 | + | ||
| 16 | +// skillsSetup: alice is mini-me, with its skills in "abilities" (its | ||
| 17 | +// agent.yaml says so); claude runs Claude Code's adapter. | ||
| 18 | +func skillsSetup(t *testing.T) (*app.WorkspaceService, string) { | ||
| 19 | + t.Helper() | ||
| 20 | + directory := t.TempDir() | ||
| 21 | + for _, name := range []string{"alice", "claude"} { | ||
| 22 | + if err := os.MkdirAll(filepath.Join(directory, name), 0o755); err != nil { | ||
| 23 | + t.Fatal(err) | ||
| 24 | + } | ||
| 25 | + } | ||
| 26 | + write(t, filepath.Join(directory, "alice", "agent.yaml"), "name: alice\nskillsDir: abilities\n") | ||
| 27 | + path := filepath.Join(directory, "config.yaml") | ||
| 28 | + write(t, path, "version: 1\nagents:\n - name: alice\n command: mm\n args: [--acp, --config, agent.yaml]\n workspace: alice\n"+ | ||
| 29 | + " - name: claude\n command: claude-agent-acp\n workspace: claude\n") | ||
| 30 | + core := app.New(config.Location{Path: path, Source: config.SourceFlag}, app.Options{Starter: starter}) | ||
| 31 | + t.Cleanup(func() { core.Shutdown(context.Background()) }) | ||
| 32 | + return &app.WorkspaceService{Core: core}, directory | ||
| 33 | +} | ||
| 34 | + | ||
| 35 | +const translate = "---\nname: translate\ndescription: Translate a text into English.\n---\n\n# Translate\n" | ||
| 36 | + | ||
| 37 | +// Issue #112: a skill is created in the folder the agent reads, listed with | ||
| 38 | +// the name and the description of its SKILL.md. | ||
| 39 | +func TestSkillsAreCreatedAndListedInTheAgentsSkillsFolder(t *testing.T) { | ||
| 40 | + service, directory := skillsSetup(t) | ||
| 41 | + ctx := context.Background() | ||
| 42 | + if got, err := service.Skills(ctx, "alice"); err != nil || got.Dir != "abilities" || len(got.Skills) != 0 { | ||
| 43 | + t.Fatalf("none yet, in mini-me's skillsDir: %+v %v", got, err) | ||
| 44 | + } | ||
| 45 | + created, err := service.CreateSkill(ctx, "alice", "translate", translate) | ||
| 46 | + if err != nil || created.Path != "abilities/translate/SKILL.md" || created.Description != "Translate a text into English." { | ||
| 47 | + t.Fatalf("created: %+v %v", created, err) | ||
| 48 | + } | ||
| 49 | + if data, _ := os.ReadFile(filepath.Join(directory, "alice", "abilities", "translate", "SKILL.md")); string(data) != translate { | ||
| 50 | + t.Fatalf("written: %q", data) | ||
| 51 | + } | ||
| 52 | + if _, err := service.CreateSkill(ctx, "alice", "translate", "x"); !errors.Is(err, app.ErrSkillExists) { | ||
| 53 | + t.Fatalf("taken: %v", err) | ||
| 54 | + } | ||
| 55 | + if _, err := service.CreateSkill(ctx, "alice", "My Skill", "x"); !errors.Is(err, app.ErrSkillName) { | ||
| 56 | + t.Fatalf("a bad name: %v", err) | ||
| 57 | + } | ||
| 58 | + if got, _ := service.Skills(ctx, "claude"); got.Dir != ".claude/skills" { | ||
| 59 | + t.Fatalf("Claude's: %+v", got) | ||
| 60 | + } | ||
| 61 | + listed, _ := service.Skills(ctx, "alice") | ||
| 62 | + if len(listed.Skills) != 1 || listed.Skills[0].Name != "translate" { | ||
| 63 | + t.Fatalf("listed: %+v", listed) | ||
| 64 | + } | ||
| 65 | +} | ||
| 66 | + | ||
| 67 | +func TestASkillIsSavedOverTheVersionRead(t *testing.T) { | ||
| 68 | + service, directory := skillsSetup(t) | ||
| 69 | + ctx := context.Background() | ||
| 70 | + created, _ := service.CreateSkill(ctx, "claude", "review", "v1") | ||
| 71 | + read, _ := service.Read(ctx, "claude", created.Path) | ||
| 72 | + saved, err := service.SaveSkill(ctx, "claude", created.Path, "v2", read.Version) | ||
| 73 | + if err != nil || saved.Conflict || saved.File.Content != "v2" { | ||
| 74 | + t.Fatalf("saved: %+v %v", saved, err) | ||
| 75 | + } | ||
| 76 | + write(t, filepath.Join(directory, "claude", ".claude", "skills", "review", "SKILL.md"), "changed") | ||
| 77 | + if late, _ := service.SaveSkill(ctx, "claude", created.Path, "v3", saved.File.Version); !late.Conflict { | ||
| 78 | + t.Fatalf("a conflict: %+v", late) | ||
| 79 | + } | ||
| 80 | + if _, err := service.SaveSkill(ctx, "claude", "CLAUDE.md", "x", ""); err == nil { | ||
| 81 | + t.Fatal("only a SKILL.md of the skills folder") | ||
| 82 | + } | ||
| 83 | +} | ||
| 84 | + | ||
| 85 | +func TestASkillIsImportedFromAFolderOrAMarkdownFile(t *testing.T) { | ||
| 86 | + service, directory := skillsSetup(t) | ||
| 87 | + ctx := context.Background() | ||
| 88 | + folder := filepath.Join(directory, "Downloads", "pdf-tools") | ||
| 89 | + for file, content := range map[string]string{ | ||
| 90 | + "SKILL.md": "---\nname: pdf-tools\ndescription: Read PDF files.\n---\n", "scripts/extract.py": "print('x')", ".git/config": "secret", | ||
| 91 | + } { | ||
| 92 | + if err := os.MkdirAll(filepath.Dir(filepath.Join(folder, file)), 0o755); err != nil { | ||
| 93 | + t.Fatal(err) | ||
| 94 | + } | ||
| 95 | + write(t, filepath.Join(folder, file), content) | ||
| 96 | + } | ||
| 97 | + imported, err := service.ImportSkill(ctx, "claude", folder) | ||
| 98 | + if err != nil || imported.Folder != "pdf-tools" || imported.Description != "Read PDF files." { | ||
| 99 | + t.Fatalf("folder: %+v %v", imported, err) | ||
| 100 | + } | ||
| 101 | + base := filepath.Join(directory, "claude", ".claude", "skills", "pdf-tools") | ||
| 102 | + if data, _ := os.ReadFile(filepath.Join(base, "scripts", "extract.py")); string(data) != "print('x')" { | ||
| 103 | + t.Fatalf("its files: %q", data) | ||
| 104 | + } | ||
| 105 | + if _, err := os.Stat(filepath.Join(base, ".git")); err == nil { | ||
| 106 | + t.Fatal("hidden folders stay behind") | ||
| 107 | + } | ||
| 108 | + if _, err := service.ImportSkill(ctx, "claude", folder); !errors.Is(err, app.ErrSkillExists) { | ||
| 109 | + t.Fatalf("taken: %v", err) | ||
| 110 | + } | ||
| 111 | + single := filepath.Join(directory, "Meeting notes.md") | ||
| 112 | + write(t, single, "# Notes\nSummarise a meeting.\n") | ||
| 113 | + if one, err := service.ImportSkill(ctx, "claude", single); err != nil || one.Folder != "meeting-notes" { | ||
| 114 | + t.Fatalf("a file: %+v %v", one, err) | ||
| 115 | + } | ||
| 116 | + if _, err := service.ImportSkill(ctx, "claude", filepath.Join(directory, "Downloads")); !errors.Is(err, app.ErrNotASkill) { | ||
| 117 | + t.Fatalf("not a skill: %v", err) | ||
| 118 | + } | ||
| 119 | +} | ||
| 120 | + | ||
| 121 | +// miniCoderSetup is the owner's mini-coder: mini-me in a sandbox whose .mm | ||
| 122 | +// folder — its skills with it — is mounted read-only; its sbx refuses | ||
| 123 | +// every write, as that mount would. | ||
| 124 | +func miniCoderSetup(t *testing.T) (*app.WorkspaceService, string) { | ||
| 125 | + t.Helper() | ||
| 126 | + directory := t.TempDir() | ||
| 127 | + folder := filepath.Join(directory, "mini-coder") | ||
| 128 | + if err := os.MkdirAll(filepath.Join(folder, ".mm", "skills"), 0o755); err != nil { | ||
| 129 | + t.Fatal(err) | ||
| 130 | + } | ||
| 131 | + write(t, filepath.Join(folder, ".mm", "agent.yaml"), "skillsDir: .mm/skills\n") | ||
| 132 | + write(t, filepath.Join(folder, ".mm", "skills", "commit.md"), "---\nname: commit\ndescription: Write a commit message.\n---\n") | ||
| 133 | + // An sbx that refuses everything, as a read-only mount would. | ||
| 134 | + write(t, filepath.Join(directory, "sbx"), "#!/bin/sh\necho 'mkdir: Read-only file system' >&2\nexit 1\n") | ||
| 135 | + if err := os.Chmod(filepath.Join(directory, "sbx"), 0o755); err != nil { | ||
| 136 | + t.Fatal(err) | ||
| 137 | + } | ||
| 138 | + path := filepath.Join(directory, "config.yaml") | ||
| 139 | + write(t, path, "version: 1\nagents:\n - name: mini-coder\n command: sbx\n args: [exec, -i, mini-coder-sbx, mm, --acp, -config, .mm/agent.yaml]\n"+ | ||
| 140 | + " workspace: mini-coder\n runtime:\n type: sbx\n sandbox: mini-coder-sbx\n") | ||
| 141 | + core := app.New(config.Location{Path: path, Source: config.SourceFlag}, app.Options{Starter: starter, Sbx: filepath.Join(directory, "sbx")}) | ||
| 142 | + t.Cleanup(func() { core.Shutdown(context.Background()) }) | ||
| 143 | + return &app.WorkspaceService{Core: core}, folder | ||
| 144 | +} | ||
| 145 | + | ||
| 146 | +// The skills are written in the | ||
| 147 | +// agent's folder on this computer, not through sbx; a <name>.md is a skill. | ||
| 148 | +func TestTheSkillsOfASandboxAgentAreWrittenInItsFolderOnThisComputer(t *testing.T) { | ||
| 149 | + service, folder := miniCoderSetup(t) | ||
| 150 | + ctx := context.Background() | ||
| 151 | + listed, err := service.Skills(ctx, "mini-coder") | ||
| 152 | + if err != nil || listed.Dir != ".mm/skills" || len(listed.Skills) != 1 || listed.Skills[0].Name != "commit" || listed.Skills[0].Path != ".mm/skills/commit.md" { | ||
| 153 | + t.Fatalf("listed: %+v %v", listed, err) | ||
| 154 | + } | ||
| 155 | + if _, err := service.CreateSkill(ctx, "mini-coder", "commit", "x"); !errors.Is(err, app.ErrSkillExists) { | ||
| 156 | + t.Fatalf("commit.md takes the name: %v", err) | ||
| 157 | + } | ||
| 158 | + if _, err := service.CreateSkill(ctx, "mini-coder", "review", translate); err != nil { | ||
| 159 | + t.Fatalf("written on this computer: %v", err) | ||
| 160 | + } | ||
| 161 | + if _, err := os.Stat(filepath.Join(folder, ".mm", "skills", "review", "SKILL.md")); err != nil { | ||
| 162 | + t.Fatal(err) | ||
| 163 | + } | ||
| 164 | + read, err := service.ReadSkill(ctx, "mini-coder", ".mm/skills/commit.md") | ||
| 165 | + if err != nil { | ||
| 166 | + t.Fatalf("read without the sandbox: %v", err) | ||
| 167 | + } | ||
| 168 | + if saved, err := service.SaveSkill(ctx, "mini-coder", ".mm/skills/commit.md", "v2", read.Version); err != nil || saved.Conflict { | ||
| 169 | + t.Fatalf("a <name>.md is saved too: %+v %v", saved, err) | ||
| 170 | + } | ||
| 171 | + if _, err := service.ReadSkill(ctx, "mini-coder", ".mm/agent.yaml"); err == nil { | ||
| 172 | + t.Fatal("only skills") | ||
| 173 | + } | ||
| 174 | + if _, err := service.CreateInstructions(ctx, "mini-coder", "# Mini coder\n"); err != nil { | ||
| 175 | + t.Fatalf("instructions too: %v", err) | ||
| 176 | + } | ||
| 177 | +} | ||
modified
internal/app/workspaces.go +20 -0 | @@ -6,6 +6,7 @@ import ( | ||
| 6 | 6 | "context" |
| 7 | 7 | "errors" |
| 8 | 8 | "fmt" |
| 9 | + "os" | |
| 9 | 10 | "path" |
| 10 | 11 | |
| 11 | 12 | "git.rickub.com/bots-garden/sidekicks/internal/agents" |
| @@ -35,6 +36,25 @@ func (c *Core) workspaceOf(name string) (workspace.Workspace, error) { | ||
| 35 | 36 | return workspace.For(definition, c.workspaces.options) |
| 36 | 37 | } |
| 37 | 38 | |
| 39 | +// settingsWorkspaceOf is where the agent's instructions and skills are | |
| 40 | +// written (issues #112, #113): its folder on this computer when it has one — | |
| 41 | +// the folder a container or a sandbox mounts — rather than through docker or | |
| 42 | +// sbx exec. The agent's own view of that folder may be read-only (mini-me's | |
| 43 | +// sbxenv mounts .mm read-only, so that the agent cannot change its own | |
| 44 | +// skills); the user, from Sidekicks, still can. | |
| 45 | +func (c *Core) settingsWorkspaceOf(name string) (workspace.Workspace, error) { | |
| 46 | + definition, ok := c.manager.Definition(name) | |
| 47 | + if !ok { | |
| 48 | + return nil, fmt.Errorf("%w: %s", agents.ErrUnknownAgent, name) | |
| 49 | + } | |
| 50 | + if definition.Runtime.Type != "" && definition.Runtime.Type != "local" && definition.Workspace != "" { | |
| 51 | + if info, err := os.Stat(definition.Workspace); err == nil && info.IsDir() { | |
| 52 | + return workspace.NewLocal(definition.Workspace), nil | |
| 53 | + } | |
| 54 | + } | |
| 55 | + return workspace.For(definition, c.workspaces.options) | |
| 56 | +} | |
| 57 | + | |
| 38 | 58 | // protectionOf returns the files of an agent the interface may neither |
| 39 | 59 | // change nor remove (issue #54). |
| 40 | 60 | func (c *Core) protectionOf(name string) workspace.Protection { |
| @@ -6,6 +6,7 @@ import ( | |||
| 6 | "context" | 6 | "context" |
| 7 | "errors" | 7 | "errors" |
| 8 | "fmt" | 8 | "fmt" |
| 9 | + "os" | ||
| 9 | "path" | 10 | "path" |
| 10 | 11 | ||
| 11 | "git.rickub.com/bots-garden/sidekicks/internal/agents" | 12 | "git.rickub.com/bots-garden/sidekicks/internal/agents" |
| @@ -35,6 +36,25 @@ func (c *Core) workspaceOf(name string) (workspace.Workspace, error) { | |||
| 35 | return workspace.For(definition, c.workspaces.options) | 36 | return workspace.For(definition, c.workspaces.options) |
| 36 | } | 37 | } |
| 37 | 38 | ||
| 39 | +// settingsWorkspaceOf is where the agent's instructions and skills are | ||
| 40 | +// written (issues #112, #113): its folder on this computer when it has one — | ||
| 41 | +// the folder a container or a sandbox mounts — rather than through docker or | ||
| 42 | +// sbx exec. The agent's own view of that folder may be read-only (mini-me's | ||
| 43 | +// sbxenv mounts .mm read-only, so that the agent cannot change its own | ||
| 44 | +// skills); the user, from Sidekicks, still can. | ||
| 45 | +func (c *Core) settingsWorkspaceOf(name string) (workspace.Workspace, error) { | ||
| 46 | + definition, ok := c.manager.Definition(name) | ||
| 47 | + if !ok { | ||
| 48 | + return nil, fmt.Errorf("%w: %s", agents.ErrUnknownAgent, name) | ||
| 49 | + } | ||
| 50 | + if definition.Runtime.Type != "" && definition.Runtime.Type != "local" && definition.Workspace != "" { | ||
| 51 | + if info, err := os.Stat(definition.Workspace); err == nil && info.IsDir() { | ||
| 52 | + return workspace.NewLocal(definition.Workspace), nil | ||
| 53 | + } | ||
| 54 | + } | ||
| 55 | + return workspace.For(definition, c.workspaces.options) | ||
| 56 | +} | ||
| 57 | + | ||
| 38 | // protectionOf returns the files of an agent the interface may neither | 58 | // protectionOf returns the files of an agent the interface may neither |
| 39 | // change nor remove (issue #54). | 59 | // change nor remove (issue #54). |
| 40 | func (c *Core) protectionOf(name string) workspace.Protection { | 60 | func (c *Core) protectionOf(name string) workspace.Protection { |
modified
internal/config/config.go +11 -2 | @@ -134,7 +134,11 @@ var configFlags = map[string]bool{"--config": true, "-config": true} | ||
| 134 | 134 | // GEMINI.md that Claude Code and Gemini read (issue #113) — and its skills. |
| 135 | 135 | // Only the agent's Instructions tab writes an instruction file (never |
| 136 | 136 | // removes it): a deliberate edit, not a slip in the Files tab. |
| 137 | -var AlwaysProtected = []string{"AGENTS.md", "CLAUDE.md", "GEMINI.md", "skills/**"} | |
| 137 | +// The skills folders are those of mini-me (skills), Claude Code | |
| 138 | +// (.claude/skills), the Agent Skills standard read by Codex, Antigravity and | |
| 139 | +// Copilot (.agents/skills) and Vibe (.vibe/skills): only the agent's Skills | |
| 140 | +// tab writes there (issue #112). | |
| 141 | +var AlwaysProtected = []string{"AGENTS.md", "CLAUDE.md", "GEMINI.md", "skills/**", ".claude/skills/**", ".agents/skills/**", ".vibe/skills/**"} | |
| 138 | 142 | |
| 139 | 143 | // Protected returns the files of the agent's folder the interface may |
| 140 | 144 | // neither change nor remove, without repetition: Protect, the agent's |
| @@ -144,7 +148,7 @@ var AlwaysProtected = []string{"AGENTS.md", "CLAUDE.md", "GEMINI.md", "skills/** | ||
| 144 | 148 | // lifecycleFiles), then AlwaysProtected. |
| 145 | 149 | // |
| 146 | 150 | // agent.Args = []string{"--acp", "--config", "agent.yaml"}; agent.Protect = []string{"notes/**"} |
| 147 | -// agent.Protected() // [notes/** agent.yaml AGENTS.md CLAUDE.md GEMINI.md skills/**] | |
| 151 | +// agent.Protected() // [notes/** agent.yaml AGENTS.md CLAUDE.md GEMINI.md skills/** …] | |
| 148 | 152 | func (a Agent) Protected() []string { |
| 149 | 153 | candidates := append([]string(nil), a.Protect...) |
| 150 | 154 | if file := a.configFile(); file != "" { |
| @@ -244,6 +248,11 @@ func sbxEnvFiles(arguments []string) []string { | ||
| 244 | 248 | return files |
| 245 | 249 | } |
| 246 | 250 | |
| 251 | +// ConfigFile is the agent's own configuration file, relative to its folder | |
| 252 | +// (the argument after --config or -config for mm, after "serve acp" for | |
| 253 | +// docker-agent), or "". | |
| 254 | +func (a Agent) ConfigFile() string { return a.configFile() } | |
| 255 | + | |
| 247 | 256 | // configFile is the agent's configuration file relative to its folder, or |
| 248 | 257 | // "" when its arguments name none in the folder. |
| 249 | 258 | func (a Agent) configFile() string { |
| @@ -134,7 +134,11 @@ var configFlags = map[string]bool{"--config": true, "-config": true} | |||
| 134 | // GEMINI.md that Claude Code and Gemini read (issue #113) — and its skills. | 134 | // GEMINI.md that Claude Code and Gemini read (issue #113) — and its skills. |
| 135 | // Only the agent's Instructions tab writes an instruction file (never | 135 | // Only the agent's Instructions tab writes an instruction file (never |
| 136 | // removes it): a deliberate edit, not a slip in the Files tab. | 136 | // removes it): a deliberate edit, not a slip in the Files tab. |
| 137 | -var AlwaysProtected = []string{"AGENTS.md", "CLAUDE.md", "GEMINI.md", "skills/**"} | 137 | +// The skills folders are those of mini-me (skills), Claude Code |
| 138 | +// (.claude/skills), the Agent Skills standard read by Codex, Antigravity and | ||
| 139 | +// Copilot (.agents/skills) and Vibe (.vibe/skills): only the agent's Skills | ||
| 140 | +// tab writes there (issue #112). | ||
| 141 | +var AlwaysProtected = []string{"AGENTS.md", "CLAUDE.md", "GEMINI.md", "skills/**", ".claude/skills/**", ".agents/skills/**", ".vibe/skills/**"} | ||
| 138 | 142 | ||
| 139 | // Protected returns the files of the agent's folder the interface may | 143 | // Protected returns the files of the agent's folder the interface may |
| 140 | // neither change nor remove, without repetition: Protect, the agent's | 144 | // neither change nor remove, without repetition: Protect, the agent's |
| @@ -144,7 +148,7 @@ var AlwaysProtected = []string{"AGENTS.md", "CLAUDE.md", "GEMINI.md", "skills/** | |||
| 144 | // lifecycleFiles), then AlwaysProtected. | 148 | // lifecycleFiles), then AlwaysProtected. |
| 145 | // | 149 | // |
| 146 | // agent.Args = []string{"--acp", "--config", "agent.yaml"}; agent.Protect = []string{"notes/**"} | 150 | // agent.Args = []string{"--acp", "--config", "agent.yaml"}; agent.Protect = []string{"notes/**"} |
| 147 | -// agent.Protected() // [notes/** agent.yaml AGENTS.md CLAUDE.md GEMINI.md skills/**] | 151 | +// agent.Protected() // [notes/** agent.yaml AGENTS.md CLAUDE.md GEMINI.md skills/** …] |
| 148 | func (a Agent) Protected() []string { | 152 | func (a Agent) Protected() []string { |
| 149 | candidates := append([]string(nil), a.Protect...) | 153 | candidates := append([]string(nil), a.Protect...) |
| 150 | if file := a.configFile(); file != "" { | 154 | if file := a.configFile(); file != "" { |
| @@ -244,6 +248,11 @@ func sbxEnvFiles(arguments []string) []string { | |||
| 244 | return files | 248 | return files |
| 245 | } | 249 | } |
| 246 | 250 | ||
| 251 | +// ConfigFile is the agent's own configuration file, relative to its folder | ||
| 252 | +// (the argument after --config or -config for mm, after "serve acp" for | ||
| 253 | +// docker-agent), or "". | ||
| 254 | +func (a Agent) ConfigFile() string { return a.configFile() } | ||
| 255 | + | ||
| 247 | // configFile is the agent's configuration file relative to its folder, or | 256 | // configFile is the agent's configuration file relative to its folder, or |
| 248 | // "" when its arguments name none in the folder. | 257 | // "" when its arguments name none in the folder. |
| 249 | func (a Agent) configFile() string { | 258 | func (a Agent) configFile() string { |
modified
internal/config/config_test.go +9 -9 | @@ -505,11 +505,11 @@ agents: | ||
| 505 | 505 | t.Fatal(err) |
| 506 | 506 | } |
| 507 | 507 | want := map[string]string{ |
| 508 | - "mm": "[AGENTS.md skills/** agent.yaml CLAUDE.md GEMINI.md]", | |
| 509 | - "dag": "[dag.yaml AGENTS.md CLAUDE.md GEMINI.md skills/**]", | |
| 510 | - "outside": "[AGENTS.md CLAUDE.md GEMINI.md skills/**]", | |
| 511 | - "boxed": "[agent.yaml AGENTS.md CLAUDE.md GEMINI.md skills/**]", | |
| 512 | - "plain": "[AGENTS.md CLAUDE.md GEMINI.md skills/**]", | |
| 508 | + "mm": "[AGENTS.md skills/** agent.yaml CLAUDE.md GEMINI.md .claude/skills/** .agents/skills/** .vibe/skills/**]", | |
| 509 | + "dag": "[dag.yaml AGENTS.md CLAUDE.md GEMINI.md skills/** .claude/skills/** .agents/skills/** .vibe/skills/**]", | |
| 510 | + "outside": "[AGENTS.md CLAUDE.md GEMINI.md skills/** .claude/skills/** .agents/skills/** .vibe/skills/**]", | |
| 511 | + "boxed": "[agent.yaml AGENTS.md CLAUDE.md GEMINI.md skills/** .claude/skills/** .agents/skills/** .vibe/skills/**]", | |
| 512 | + "plain": "[AGENTS.md CLAUDE.md GEMINI.md skills/** .claude/skills/** .agents/skills/** .vibe/skills/**]", | |
| 513 | 513 | } |
| 514 | 514 | for _, agent := range cfg.Agents { |
| 515 | 515 | if got := fmt.Sprint(agent.Protected()); got != want[agent.Name] { |
| @@ -562,10 +562,10 @@ agents: | ||
| 562 | 562 | t.Fatal(err) |
| 563 | 563 | } |
| 564 | 564 | want := map[string]string{ |
| 565 | - "mario": "[compose.yaml Dockerfile AGENTS.md CLAUDE.md GEMINI.md skills/**]", | |
| 566 | - "bare": "[AGENTS.md CLAUDE.md GEMINI.md skills/**]", // the folder of the commands is outside the agent's | |
| 567 | - "milo": "[AGENTS.md CLAUDE.md GEMINI.md skills/**]", // sbxenv.yaml is in agents/milo, outside agents/milo/workspace | |
| 568 | - "kit": "[dev.yaml AGENTS.md CLAUDE.md GEMINI.md skills/**]", | |
| 565 | + "mario": "[compose.yaml Dockerfile AGENTS.md CLAUDE.md GEMINI.md skills/** .claude/skills/** .agents/skills/** .vibe/skills/**]", | |
| 566 | + "bare": "[AGENTS.md CLAUDE.md GEMINI.md skills/** .claude/skills/** .agents/skills/** .vibe/skills/**]", // the folder of the commands is outside the agent's | |
| 567 | + "milo": "[AGENTS.md CLAUDE.md GEMINI.md skills/** .claude/skills/** .agents/skills/** .vibe/skills/**]", // sbxenv.yaml is in agents/milo, outside agents/milo/workspace | |
| 568 | + "kit": "[dev.yaml AGENTS.md CLAUDE.md GEMINI.md skills/** .claude/skills/** .agents/skills/** .vibe/skills/**]", | |
| 569 | 569 | } |
| 570 | 570 | for _, agent := range cfg.Agents { |
| 571 | 571 | if got := fmt.Sprint(agent.Protected()); got != want[agent.Name] { |
| @@ -505,11 +505,11 @@ agents: | |||
| 505 | t.Fatal(err) | 505 | t.Fatal(err) |
| 506 | } | 506 | } |
| 507 | want := map[string]string{ | 507 | want := map[string]string{ |
| 508 | - "mm": "[AGENTS.md skills/** agent.yaml CLAUDE.md GEMINI.md]", | 508 | + "mm": "[AGENTS.md skills/** agent.yaml CLAUDE.md GEMINI.md .claude/skills/** .agents/skills/** .vibe/skills/**]", |
| 509 | - "dag": "[dag.yaml AGENTS.md CLAUDE.md GEMINI.md skills/**]", | 509 | + "dag": "[dag.yaml AGENTS.md CLAUDE.md GEMINI.md skills/** .claude/skills/** .agents/skills/** .vibe/skills/**]", |
| 510 | - "outside": "[AGENTS.md CLAUDE.md GEMINI.md skills/**]", | 510 | + "outside": "[AGENTS.md CLAUDE.md GEMINI.md skills/** .claude/skills/** .agents/skills/** .vibe/skills/**]", |
| 511 | - "boxed": "[agent.yaml AGENTS.md CLAUDE.md GEMINI.md skills/**]", | 511 | + "boxed": "[agent.yaml AGENTS.md CLAUDE.md GEMINI.md skills/** .claude/skills/** .agents/skills/** .vibe/skills/**]", |
| 512 | - "plain": "[AGENTS.md CLAUDE.md GEMINI.md skills/**]", | 512 | + "plain": "[AGENTS.md CLAUDE.md GEMINI.md skills/** .claude/skills/** .agents/skills/** .vibe/skills/**]", |
| 513 | } | 513 | } |
| 514 | for _, agent := range cfg.Agents { | 514 | for _, agent := range cfg.Agents { |
| 515 | if got := fmt.Sprint(agent.Protected()); got != want[agent.Name] { | 515 | if got := fmt.Sprint(agent.Protected()); got != want[agent.Name] { |
| @@ -562,10 +562,10 @@ agents: | |||
| 562 | t.Fatal(err) | 562 | t.Fatal(err) |
| 563 | } | 563 | } |
| 564 | want := map[string]string{ | 564 | want := map[string]string{ |
| 565 | - "mario": "[compose.yaml Dockerfile AGENTS.md CLAUDE.md GEMINI.md skills/**]", | 565 | + "mario": "[compose.yaml Dockerfile AGENTS.md CLAUDE.md GEMINI.md skills/** .claude/skills/** .agents/skills/** .vibe/skills/**]", |
| 566 | - "bare": "[AGENTS.md CLAUDE.md GEMINI.md skills/**]", // the folder of the commands is outside the agent's | 566 | + "bare": "[AGENTS.md CLAUDE.md GEMINI.md skills/** .claude/skills/** .agents/skills/** .vibe/skills/**]", // the folder of the commands is outside the agent's |
| 567 | - "milo": "[AGENTS.md CLAUDE.md GEMINI.md skills/**]", // sbxenv.yaml is in agents/milo, outside agents/milo/workspace | 567 | + "milo": "[AGENTS.md CLAUDE.md GEMINI.md skills/** .claude/skills/** .agents/skills/** .vibe/skills/**]", // sbxenv.yaml is in agents/milo, outside agents/milo/workspace |
| 568 | - "kit": "[dev.yaml AGENTS.md CLAUDE.md GEMINI.md skills/**]", | 568 | + "kit": "[dev.yaml AGENTS.md CLAUDE.md GEMINI.md skills/** .claude/skills/** .agents/skills/** .vibe/skills/**]", |
| 569 | } | 569 | } |
| 570 | for _, agent := range cfg.Agents { | 570 | for _, agent := range cfg.Agents { |
| 571 | if got := fmt.Sprint(agent.Protected()); got != want[agent.Name] { | 571 | if got := fmt.Sprint(agent.Protected()); got != want[agent.Name] { |