fix: resolve Pi CLI via process.argv[1] for Nix and non-standard installs#520
Open
chenxin-yan wants to merge 1 commit into
Open
fix: resolve Pi CLI via process.argv[1] for Nix and non-standard installs#520chenxin-yan wants to merge 1 commit into
chenxin-yan wants to merge 1 commit into
Conversation
…alls When taskplane runs as a Pi extension, the current process is already 'node dist/cli.js' — so process.argv[1] is exactly the CLI entrypoint we need to spawn worker agents. The previous implementation only checked npm global roots and static paths, none of which cover Nix (where pi lives in the Nix store, not in any npm prefix). The process.argv[1] candidate: - Is always correct when running inside Pi (it IS the file we're looking for) - Requires no subprocess overhead unlike npm root -g - Covers any non-standard install: Nix, custom node wrappers, symlinked bins - Is consistent with how resolveTaskplanePackageFile() already uses process.argv[1] to locate taskplane's own package files Also adds ~/.nix-profile and /run/current-system/sw as static Nix fallbacks for cases where process.argv[1] is a shell wrapper rather than cli.js directly.
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.
Fixes #519
Problem
resolvePiCliPath()fails to find the Pi CLI whenpiis installed via Nix. Nix places packages in the Nix store (/nix/store/<hash>-pi-coding-agent-<ver>/), not in any npm global prefix, so none of the existing resolution candidates match. Worker agents never spawn and tasks fail immediately.Fix
When taskplane runs as a Pi extension, the current process is already
node dist/cli.js— soprocess.argv[1]is the exact entrypoint we need. Adding it as the first candidate inresolvePiCliPath()solves the problem with zero subprocess overhead and covers any non-standard install (Nix, custom node wrappers, symlinked binaries, etc.).This technique is already used in
resolveTaskplanePackageFile()(candidate 8) to locate taskplane's own package files — this PR applies it consistently toresolvePiCliPath()as well.Also adds
~/.nix-profileand/run/current-system/swas static fallbacks for the edge case whereprocess.argv[1]is a shell wrapper rather thancli.jsdirectly.Changes
extensions/taskplane/path-resolver.ts: addprocess.argv[1]as candidate 1 inresolvePiCliPath(); add Nix static paths; update doc comment with new resolution orderTesting
Verified the reproduction case: Pi installed via
pkgs.pi-coding-agent(nixpkgs, nix-darwin), taskplane loaded viapi -e npm:taskplane. Before this fix: worker spawn fails immediately. After:process.argv[1]resolves to the Nix storecli.jspath and workers launch correctly.