Add pi coding agent devcontainer feature#1
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
Adds a new pi-coding-agent Dev Container Feature that installs Pi via npm and provides a post-start hook to import/configure Pi agent state (settings/auth/etc.), optionally manage persistent session storage, and optionally sync extension packages when imported settings change.
Changes:
- Introduces the
pi-coding-agentfeature (install scripts, runtime post-start hook, settings helper). - Adds scenario-based feature tests covering version pinning, non-root imports, copy-if-newer behavior, session persistence (bind/volume), and settings-driven package sync.
- Updates repository CI/release workflows and docs to support publishing and running feature tests with a Node-capable base image.
Reviewed changes
Copilot reviewed 24 out of 24 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| test/pi-coding-agent/test.sh | Autogenerated smoke test for basic install/runtime hook presence. |
| test/pi-coding-agent/settings_package_sync.sh | Scenario test for settings import triggering pi update --extensions only on change. |
| test/pi-coding-agent/settings_helper.sh | Scenario test for the Node settings helper module behavior. |
| test/pi-coding-agent/session_volume.sh | Scenario test for volume-backed session persistence configuration. |
| test/pi-coding-agent/session_bind/session-bind-data/.keep | Placeholder content for bind-mount scenario data directory. |
| test/pi-coding-agent/session_bind.sh | Scenario test for bind-mounted session persistence overriding sessionDir. |
| test/pi-coding-agent/scenarios.json | Defines all test scenarios for the feature. |
| test/pi-coding-agent/pinned_version.sh | Scenario test ensuring a pinned Pi version is installed. |
| test/pi-coding-agent/non_root_imports.sh | Scenario test covering non-root config imports + permission normalization. |
| test/pi-coding-agent/latest_with_node.sh | Scenario test validating “latest” install behavior. |
| test/pi-coding-agent/duplicate.sh | Duplicate-install/idempotency test coverage. |
| test/pi-coding-agent/copy_if_newer.sh | Scenario test validating copy-if-newer behavior for files/dirs. |
| src/pi-coding-agent/runtime/settings-helper.mjs | Node helper to safely update settings.json for session storage. |
| src/pi-coding-agent/runtime/post-start.sh | Post-start hook to import config, configure sessionDir, and optionally sync extensions. |
| src/pi-coding-agent/README.md | Feature documentation (usage/options). |
| src/pi-coding-agent/NOTES.md | Additional guidance (import root layout, session persistence, testing notes). |
| src/pi-coding-agent/install.sh | OS/runtime prerequisites and entrypoint to main installer. |
| src/pi-coding-agent/install-main.sh | Installs Pi via npm, installs extensions, installs runtime hook, persists options. |
| src/pi-coding-agent/devcontainer-feature.json | Feature metadata/options, mounts, postStartCommand wiring. |
| README.md | Repository-level documentation updated for the new feature and test commands. |
| .github/workflows/test.yaml | CI runs feature tests with a Node-capable base image. |
| .github/workflows/release.yaml | Publishing workflow using devcontainers/action + PR for generated docs. |
| .devcontainer/devcontainer.json | Authoring devcontainer updated for this repo’s workflow/tooling. |
| .devcontainer/devcontainer-lock.json | Locks authoring devcontainer feature dependencies. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Comment on lines
+24
to
+39
| | 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 | | ||
|
|
Comment on lines
+73
to
+85
| mkdir -p "$(dirname "${target_path}")" | ||
|
|
||
| if [[ -e "${target_path}" && ! "${target_path}" -ot "${source_path}" ]]; then | ||
| log "Skipped ${label}; destination is up to date." | ||
| return 0 | ||
| fi | ||
|
|
||
| cp -f "${source_path}" "${target_path}" | ||
| touch -r "${source_path}" "${target_path}" | ||
|
|
||
| if [[ "$(basename "${target_path}")" == "auth.json" ]]; then | ||
| chmod 600 "${target_path}" || true | ||
| fi |
| warn "Requested ${label} import but '${source_path}' is not a directory." | ||
| return 0 | ||
| fi | ||
|
|
Comment on lines
+7
to
+15
| expected_version="$(npm view @earendil-works/pi-coding-agent version 2>/dev/null | tr -d '\r\n')" | ||
|
|
||
| if [[ -z "${expected_version}" ]]; then | ||
| echo "Failed to determine the latest Pi version from npm metadata" >&2 | ||
| exit 1 | ||
| fi | ||
|
|
||
| check "pi command available" pi --version | ||
| check "latest Pi version installed" bash -c 'test "$(pi --version 2>&1 | tr -d "\r\n")" = "$1"' _ "${expected_version}" |
Comment on lines
+97
to
+103
| "mounts": [ | ||
| { | ||
| "source": "${localWorkspaceFolder}/.devcontainer/session-bind-data", | ||
| "target": "/mnt/pi-coding-agent-sessions", | ||
| "type": "bind" | ||
| } | ||
| ], |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.