Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 

README.md

Pi Coding Agent (pi-coding-agent)

Installs Pi with npm and optionally synchronizes selected Pi configuration into the dev container at startup.

Example Usage

"features": {
    "ghcr.io/RodriBus/devcontainer-features/pi-coding-agent:0": {}
}

Options

Options Id Description Type Default Value
version Version of @earendil-works/pi-coding-agent to install. string latest
configImportRoot In-container staging root from which selected Pi configuration files are copied at startup. string /mnt/pi-coding-agent-import
mapAllConfigurations Import all supported Pi configuration files and directories from configImportRoot. When enabled, individual map* options are ignored and a warning is logged if any are also set. boolean false
mapAuth Copy auth.json from the import root into ~/.pi/agent/auth.json if the source exists and is newer. boolean false
mapSettings Copy settings.json from the import root into ~/.pi/agent/settings.json if the source exists and is newer. boolean false
mapKeybindings Copy keybindings.json from the import root into ~/.pi/agent/keybindings.json if the source exists and is newer. boolean false
mapSkills Copy the skills directory from the import root into ~/.pi/agent/skills using copy-if-newer behavior. boolean false
mapPrompts Copy the prompts directory from the import root into ~/.pi/agent/prompts using copy-if-newer behavior. boolean false
mapThemes Copy the themes directory from the import root into ~/.pi/agent/themes using copy-if-newer behavior. boolean false
mapExtensions Copy the extensions directory from the import root into ~/.pi/agent/extensions using copy-if-newer behavior. boolean false
mapModels Copy models.json from the import root into ~/.pi/agent/models.json if the source exists and is newer. boolean false
sessionPersistenceMode Use a user-managed bind mount or a feature-managed named volume as Pi session storage. Volume mode mounts a per-devcontainer named volume automatically. string none
sessionStoragePath Mounted in-container path to use as live Pi session storage when sessionPersistenceMode is bind. Ignored when sessionPersistenceMode is volume. string /mnt/pi-coding-agent-sessions

Overview

This feature installs Pi with npm, runs pi update --extensions during feature setup for packages already visible during image build, verifies the installation with pi --version, and can import selected Pi configuration resources from a staging directory every time the container starts.

The feature does not install Node.js for the user and does not depend on the official Node feature. node and npm must already be present in the target image when installation starts, otherwise the install fails immediately.

Import Root Layout

When configuration import is enabled, the feature expects a single staging root mounted inside the container. The following files and directories are recognized:

/mnt/pi-coding-agent-import
├── auth.json
├── extensions/
├── keybindings.json
├── models.json
├── settings.json
├── prompts/
├── skills/
└── themes/

Mounting the host ~/.pi/agent directory directly to the import root works well because Pi already stores the same resources there. If mapAllConfigurations is enabled, all supported resources from this root are imported, including extensions/, and any individual map* flags are ignored with a warning.

Example: Reuse Host Pi Configuration

{
  "image": "mcr.microsoft.com/devcontainers/javascript-node:4.0.10-24-bookworm",
  "features": {
    "ghcr.io/rodribus/devcontainer-features/pi-coding-agent:0": {
      "configImportRoot": "/mnt/pi-coding-agent-import",
      "mapAllConfigurations": true
    }
  },
  "mounts": [
    {
      "source": "${localEnv:HOME}/.pi/agent",
      "target": "/mnt/pi-coding-agent-import",
      "type": "bind"
    }
  ]
}

Imports use copy-if-newer behavior. Missing staged sources only produce warnings and do not block container startup.

If settings.json is imported, the startup hook also runs pi update --extensions once per imported settings change. This preinstalls Pi packages referenced by the imported settings so the first interactive pi run does not need to install them again.

Example: Persistent Session Storage

The feature treats session persistence as live storage, not as a copied import. In volume mode, the feature mounts a per-devcontainer named volume automatically and updates ~/.pi/agent/settings.json so Pi uses that managed path as sessionDir. In bind mode, the user still defines the mount in devcontainer.json.

Bind mount example:

{
  "features": {
    "ghcr.io/rodribus/devcontainer-features/pi-coding-agent:0": {
      "sessionPersistenceMode": "bind",
      "sessionStoragePath": "/mnt/pi-coding-agent-sessions"
    }
  },
  "mounts": [
    {
      "source": "${localEnv:HOME}/.pi/agent/sessions",
      "target": "/mnt/pi-coding-agent-sessions",
      "type": "bind"
    }
  ]
}

Named volume example:

{
  "features": {
    "ghcr.io/rodribus/devcontainer-features/pi-coding-agent:0": {
      "sessionPersistenceMode": "volume"
    }
  }
}

Volume mode stores sessions in a feature-managed named volume mounted at /mnt/pi-coding-agent-managed-sessions. Do not add your own mount for that path.

If imported settings.json already defines sessionDir, the feature logs a warning and overrides that value while session persistence is enabled. If sessionStoragePath is set while sessionPersistenceMode=volume, the feature ignores it and uses the managed volume path instead.

Using the same live session storage from host Pi and container Pi at the same time can corrupt sessions.

Tested Base Image

The repository's scenario-style tests run the feature against mcr.microsoft.com/devcontainers/base:ubuntu.

The repository test suite also includes a duplicate-install assertion via test/pi-coding-agent/duplicate.sh, so devcontainer features test exercises the feature twice with distinct option sets to catch idempotency regressions.

The duplicate/idempotency test needs a Node-capable test base image because pi-coding-agent intentionally fails when node or npm is absent. CI and local full-suite runs should use mcr.microsoft.com/devcontainers/javascript-node:4.0.10-24-bookworm or another base image that already includes node and npm.


Note: This file was auto-generated from the devcontainer-feature.json. Add additional notes to a NOTES.md.