Skip to main content

Module package_manager_cli

Module package_manager_cli 

Source
Expand description

pi install/remove/update/list/config subcommand router.

Ports .references/pi/packages/coding-agent/src/package-manager-cli.ts into a thin parser + dispatcher. The parser is pure and infallible; the dispatcher maps parsed options onto exit codes and verbatim status/error strings, driving all side effects through an injected PackageHandler trait so tests never spawn real subprocesses or touch the network.

§Exit code map (matches the TypeScript reference)

pathexitnotes
--help0prints usage
unknown option / missing val1verbatim error + usage hint
install/remove without source1Missing {cmd} source. + usage
untrusted local install/remove1Project is not trusted. …
install success0Installed {source}
remove no-match1No matching package found for {src}
remove success0Removed {source}
list (any)0formatted list
update models error1
update extensions error1
update self error1
update self success0win32: drain_quirk flag set
update self already-latest0no-op

Structs§

ListedPackage
One configured package row reported by PackageHandler::list.
PackageCommandOptions
Parsed pi <subcommand> … options.
PackageOutcome
Outcome of dispatching one subcommand.

Enums§

DispatchPlatform
Platform-specific dispatch behavior.
ExtensionsSkippedNotice
Whether the default self-update should explain that extensions were skipped.
ListedScope
Scope of a configured package.
PackageCommand
Known subcommand discriminant.
UpdateTarget
Update target resolution (the TS UpdateTarget union).

Traits§

PackageHandler
Side-effect surface injected by the caller.
PackageOutput
Output sink for status/error lines. Implementations capture into a buffer (tests) or write to stdout/stderr (production, via ProductOutput).

Functions§

config_command_usage
Usage string for the config command.
format_config_command_help
Render the config help block (printConfigCommandHelp).
format_package_command_help
Render the per-subcommand help block (printPackageCommandHelp).
handle_config_command
Route pi config … if recognized. Returns None when argv[0] is not config.
handle_package_command
Mirrors the verbatim status/error strings and exit-code mapping of handlePackageCommand (package-manager-cli.ts:676-887).
is_config_command
Whether argv[0] is the config command.
package_command_kind
Whether argv[0] is a recognized package subcommand.
package_command_usage
Usage string for one subcommand.
parse_package_command
Parse pi <subcommand> [rest…].