Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

pi-module

БесплатноБез исполняемых скриптовНе проверен

Install a pi (pi.dev coding agent) package/extension/skill into this nix flake declaratively, instead of running `pi install npm:...`. Use when the user gives…

fred-drakeот fred-drake★ 28 звёзд на GitHub

Об этом скилле

Adding a pi Package/Module to Nix

Pi packages are installed declaratively here, replacing pi install. The trick: pi install npm:X does two things — (1) drops the package under ~/.pi/agent/npm/ and (2) appends a reference to the packages array in ~/.pi/agent/settings.json. We reproduce both with nix: build the package into the store, then register that store path as a local-path entry in the packages array via an activation-script merge.

Key files (all already exist — extend them):

  • apps/pi-<name>.nix — derivation that assembles one pi package directory
  • apps/fetcher/pi-<name>.nix — auto-generated pin (versions + hashes); never hand-edit except to revert
  • apps/fetcher/pi-<name>-lock.json — generated lockfile, if GitHub source has none (see Step 2)
  • apps/fetcher/update-pi-<name>.sh — updater that re-resolves the pin
  • modules/home-manager/features/pi.nix — the piPackages list + piManagedPackages activation merge
  • justfile — update-pi-packages target (and update-pi for the CLI), both in update-all

The reference implementation is @quintinshaw/pi-dynamic-workflows (apps/pi-dynamic-workflows.nix). For the buildNpmPackage+injected-lockfile strategy, see apps/pi-web-access.nix and apps/pi-mcp-adapter.nix.

Read the real docs first

Pi ships authoritative docs inside the built package — read these, not the website (the website's npm view ... pi manifest can even be stale vs the published package.json):

# The docs dir is inside the built pi store path:
docs=$(find /nix/store -maxdepth 5 -type d -path '*pi-monorepo/docs' 2>/dev/null | sort | tail -1)
ls "$docs"                    # packages.md, settings.md, extensions.md, skills.md, ...

Critical facts (these bit me; don't relearn them)

  1. Local-path packages are NOT npm install-ed by pi. For npm:/git: sources pi runs npm install; for a local path it just loads the directory as-is. So the derivation must ship node_modules/ with all runtime dependencies already present. (Docs: packages.md "Local Paths".)
  2. Peer deps are provided by pi core — never bundle them. @earendil-works/pi-ai, @earendil-works/pi-agent-core, @earendil-works/pi-coding-agent, @earendil-works/pi-tui, typebox. They appear in peerDependencies by convention. Only real dependencies get vendored. Exception: if a package lists them in dependencies (not peerDependencies), they will be bundled — pi's separate module roots mean they coexist with pi core's own copies without conflict.
  3. Published npm tarballs have no lockfile → buildNpmPackage from the tarball fails. Two strategies depending on the dep tree (Step 2). Important: GitHub source repos also frequently have no lockfile — do not assume one exists; always check with ls "$src/package-lock.json" after prefetching the source.
  4. settings.json is mutable and pi writes to it (lastChangelogVersion on update, plus interactive /settings, /model). Do NOT manage it with read-only home.file (the claude-code style) — that breaks pi's own writes. Merge with jq in an activation script instead (already implemented; you just add to the piPackages list).
  5. The whole tarball is needed, not just dist/. Pi loads .ts extensions directly (via jiti); the package typically ships src/, dist/, and extensions/. Unpack all.
  6. git add all new files before evaluating. Nix flakes only see git-tracked files. A darwin-rebuild build will fail with "Path '...' is not tracked by Git" until you git add apps/pi-<name>.nix apps/fetcher/pi-<name>.nix apps/fetcher/pi-<name>-lock.json ....
  7. buildNpmPackage output layout for pi. The default installPhase copies to $out/lib/node_modules/<pkgname>, but pi needs the package root at $out (so it can find index.ts, skills/, etc. directly). Always override installPhase with cp -r . $out/. Also override buildPhase to be empty when there is no build script (pi loads TypeScript via jiti — no compile step needed).
  8. Use cp -r source/. dest/ not cp -rT source dest. macOS BSD cp does not support -T. The portable form is cp -r "$src"/. "$dst"/.

Step 1 — Inspect the package

npm view <pkg> version dependencies peerDependencies devDependencies pi
# Inspect the tarball manifest:
url=$(npm view <pkg> dist.tarball); f=$(nix store prefetch-file --json "$url" | jq -r .storePath)
tar -xzf "$f" -O package/package.json | jq '{main, files, pi, dependencies, peerDependencies}'
tar -tzf "$f" | grep -E 'extensions/|src/|skills/'   # what resources ship
# Check if GitHub source has a lockfile:
src=$(nix flake prefetch --json github:<owner>/<repo>/v<version> | jq -r .storePath)
ls "$src/package-lock.json" 2>/dev/null || echo "NO LOCKFILE IN GITHUB SOURCE"

For every entry in dependencies, check whether it is itself dependency-free: npm view <dep> dependencies. That d

Полный SKILL.md на GitHub

Установить pi-module в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

FAQ

Что делает скилл pi-module?

Install a pi (pi.dev coding agent) package/extension/skill into this nix flake declaratively, instead of running `pi install npm:...`. Use when the user gives a `pi install npm:<pkg>` / `pi install git:<repo>` command, links a https://pi.dev/packages/... page, or asks to add a pi extension/skill/theme/prompt to the nix config. Also covers bumping the pi CLI itself (pi-coding-agent). Pi calls these "packages"; the user may call them "modules".

Как установить скилл pi-module?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл pi-module запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить pi-module с