Skip to content

feat(import): import cli skills, commands and marketplaces - #317

Merged
nixuuu merged 1 commit into
feat/cli-import-6from
feat/cli-import-7
Nov 7, 2026
Merged

nixuuu merged 1 commit into
feat/cli-import-6from
feat/cli-import-7

Conversation

@nixuuu

@nixuuu nixuuu commented Nov 7, 2026 •

Copy link
Copy Markdown
Member

Stage 7 of the CLI import (stack B). Design: docs/import.md ("Skille i pluginy").

What

  • Skills: skills/<name>/ in the Claude, Codex and Grok homes, and the device's ~/.agents/skills/.
    • They are read through the confined reader (regular files only, no links) and text files are masked.
    • They are validated by the library rules (SKILL.md with name and description; limits of 1000 files, 1 MiB per file, 25 MiB in total), so the scan's digest is the checksum the library will store.
    • The same skill in several CLIs is one item. Two versions with one name are both shown, and the gateway accepts one.
  • Commands and prompts as skills: Claude commands/**.md and Codex prompts/*.md get a generated SKILL.md. They are unticked by default.
  • Saving: through SaveLibrarySkill (same validation, limits and audit as an upload), assigned to the source worker's Canopy platform homes only. Replace adds a new version. Undo removes the skill or restores the previous full definition, including repository provenance, unless the definition changed since.
  • Marketplaces:
    • Claude known_marketplaces.json and Codex [marketplaces.*] (git over HTTPS) are added as on manual add.
    • Local-directory marketplaces are listed with the reason.
    • Undo keeps a marketplace a plugin was approved from.
  • Plugins are listed with their version and "Plugins run code. Approve each one in Agent environment." An import never activates code.

Why

Skills and commands are the reusable part of a CLI setup. Bringing them into the Agent environment library makes them available in Canopy threads with the library's review and audit. Plugins stay a deliberate, per-file approval.

Verification

  • tests/integration/import-library-skills.test.ts (gRPC):
    • a skill shared across CLIs becomes one item;
    • masked file contents;
    • a link or a file outside the home reads nothing;
    • Replace and Undo with versions;
    • marketplace add and Undo;
    • plugins never activated;
    • command → skill.
  • Worker tests: skill validation, sorting, version conflicts, ~/.agents lock origin.
  • Gates on this stage: typecheck, lint, format check, import unit tests (67 pass), integration file above.
  • Current validation is recorded in “Re-check fixes” below and on the top stage (feat(import): import mcp servers as connected accounts #318).
  • Original implementation browser check: light and dark, desktop and phone, long skill names and descriptions.

Copy audit (docs/copy.md §8)

  • New strings:
    • section description: "Defaults for new threads, instructions, skills and marketplaces. Undo puts back what was there, unless you changed it since." (extended again in feat(import): import mcp servers as connected accounts #318);
    • outcomes: "New skill for {CLIs}", "New version {version} in Agent environment", "New version of the library skill", "New marketplace in Agent environment", "Added to Agent environment as {name}";
    • badge: "Marketplace";
    • reasons: "A marketplace on this computer. Add it in Agent environment.", "Plugins run code. Approve each one in Agent environment.", "Canopy can't read this kind of marketplace source.", "Its name can't be a skill name.", "Another version has this name. Choose one.", "A skill with this name is in Agent environment.", "Canopy masks {n} possible secret(s) in this skill.";
    • errors: "Choose one version of {name}.", "A skill named {name} is in Agent environment. Scan again.";
    • generated description: "Imported {command|prompt} /{name}".
  • Checks: reasons name the next action; glossary terms ("skill", "marketplace", "plugin", "Agent environment") are used throughout; no banned synonyms; long names truncate.

Security review fixes

  • Non-UTF-8 skill files (P1): fail closed. A skill with any file that isn't UTF-8 text (another encoding or binary) isn't imported, and its reason names the file. Nothing of it leaves the worker (reading it by key is refused).
  • Marketplace URL credentials (P1): a source with user info or a credential-like parameter is listed masked and marked "Its URL holds a credential…". The gateway independently refuses any marketplace whose source still shows user info or masking, before any plan is stored.
  • Skill undo (P2): the receipt stores a fingerprint of the whole skill definition: version, harnesses, selector and per-machine overrides, homes, source. Undo keeps the skill if any of it changed, not only the version.
  • Receipts: skill and marketplace saves and removals take the same in-transaction receipt as feat(import): import cli defaults and instruction documents #316.
  • Tests:
    • library.test.ts: a Latin-1 config.env with a known credential blocks the skill and its read; marketplace URLs with ?token= and user info are masked and unavailable.
    • import-library-skills.test.ts: an assignment change at the same version keeps the skill on Undo.

Re-check fixes

  • Marketplace URLs use the shared WHATWG credential check. The gateway independently checks decoded parameter names and canonical userinfo, including unusual HTTPS spellings and long userinfo, before plan insertion. Gateway responses also redact credential URLs independently of worker masking. Worker fixtures and the gateway integration regression cover %74oken, each authority variant, masked responses and absent plan rows.
  • Skills containing NULs or binary controls are refused as a whole, including BOM-less UTF-16 ASCII. The reason names the file; read-by-key also refuses it. Worker fixtures cover UTF-16 and binary controls; the integration test confirms no artifact is saved.
  • Replace receipts save the previous full skill definition. An internal owner-scoped restore path restores repository/ref/path/commit, credential association and update policy with the Undo receipt in one transaction. The fingerprint covers every source field, including autoUpdate and credentialAccountId. Regressions verify the restored source/artifact, receipt-failure rollback, all source fields and the existing assignment-change guard.
  • Validation: install, generation, typecheck, lint and format check passed. Worker/gateway import tests and both stage integration files: 98 passed, 3 live tests skipped, 0 failed.
  • Copy audit (§8): the unavailable marketplace reason is reused; the plan boundary error says to add the marketplace in Agent environment. Binary-file reasons name the file and the same action. No controls or layouts changed; browser checks were not rerun.

Round 3

  • Marketplace checks inherit feat(import): import cli defaults and instruction documents #316's shared bounded decoder: %2574oken, deeper encoding and malformed escapes are unavailable and redacted. Worker fixtures verify masked scan metadata; the gateway regression independently verifies masked lists, rejected StartImport and no persisted credential plan.
  • A benign repository URL with ?design=compact#authentication stays readable and available in both worker metadata and gateway lists. Classification uses actual name=value pairs and whole credential-name tokens.
  • Gates: install, generation, typecheck, lint and format check passed. Worker/gateway import tests plus both stage integrations: 98 passed, 3 live tests skipped, 0 failed. Copy audit: existing reasons are reused; no UI text, controls or layout changed.

Final targeted fixes

  • Inherits feat(import): import cli defaults and instruction documents #316's conservative authority/value boundaries and unconditional OAuth code classification. Multiline/quoted userinfo, spaced/quoted query values and code values containing dots are masked and unavailable.
  • The same synthetic matrix is exercised in actual worker marketplace scan metadata and independently forged gateway metadata. ListImportLibrary stays redacted, StartImport rejects every case, and SQL confirms that none of the supplied URLs enters a persisted plan. The benign documentation query/anchor remains readable and available.
  • Final stack gate on feat(import): import mcp servers as connected accounts #318: bun run check:tmp passed (1,695 passed, 161 skipped, 0 failed; nothing left in its temp directory), and the web production build passed.

@nixuuu
nixuuu added this pull request to stack #319 November 7, 2026 03:35
@nixuuu
nixuuu force-pushed the feat/cli-import-7 branch from 30f9a24 to 8c9a070 Compare November 7, 2026 09:02
@nixuuu
nixuuu force-pushed the feat/cli-import-7 branch 2 times, most recently from b480e8b to d77b9e2 Compare November 7, 2026 10:14
@nixuuu
nixuuu force-pushed the feat/cli-import-7 branch from d77b9e2 to be0b5f2 Compare November 7, 2026 10:18
@nixuuu
nixuuu force-pushed the feat/cli-import-7 branch from be0b5f2 to 622ac74 Compare November 7, 2026 10:26
Settings → Import lists the skills of every CLI home and of the device's
~/.agents, once per skill across CLIs, and imports them into the library
for the source worker's Canopy homes. Claude commands and Codex prompts
become skills when chosen. Marketplaces are added from their
repositories; plugins are listed for approval in Agent environment and
never activated by an import.

See docs/import.md.
@nixuuu
nixuuu force-pushed the feat/cli-import-7 branch from 622ac74 to 9cc77b0 Compare November 7, 2026 10:56
@nixuuu
nixuuu marked this pull request as ready for review November 7, 2026 11:13
@nixuuu
nixuuu merged commit cb17a57 into dev Nov 7, 2026
21 of 26 checks passed
@nixuuu
nixuuu deleted the feat/cli-import-7 branch November 7, 2026 11:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant