-
Notifications
You must be signed in to change notification settings - Fork 161
enhancement: apm install --root <dir> to target a directory other than $PWD #888
Copy link
Copy link
Open
Labels
area/cliCLI command surface, flags, help text (cross-cutting).CLI command surface, flags, help text (cross-cutting).area/docs-sitedocs/src/content (Starlight), README, doc generation.docs/src/content (Starlight), README, doc generation.priority/lowAccepted but not time-sensitiveAccepted but not time-sensitivestatus/acceptedDirection approved, safe to start work.Direction approved, safe to start work.status/triagedInitial agentic triage complete; pending maintainer ratification (silence = approval).Initial agentic triage complete; pending maintainer ratification (silence = approval).theme/portabilityOne manifest, every target. Multi-target deploy, marketplace, packaging, install.One manifest, every target. Multi-target deploy, marketplace, packaging, install.type/featureNew capability, new flag, new primitive.New capability, new flag, new primitive.
Milestone
Metadata
Metadata
Assignees
Labels
area/cliCLI command surface, flags, help text (cross-cutting).CLI command surface, flags, help text (cross-cutting).area/docs-sitedocs/src/content (Starlight), README, doc generation.docs/src/content (Starlight), README, doc generation.priority/lowAccepted but not time-sensitiveAccepted but not time-sensitivestatus/acceptedDirection approved, safe to start work.Direction approved, safe to start work.status/triagedInitial agentic triage complete; pending maintainer ratification (silence = approval).Initial agentic triage complete; pending maintainer ratification (silence = approval).theme/portabilityOne manifest, every target. Multi-target deploy, marketplace, packaging, install.One manifest, every target. Multi-target deploy, marketplace, packaging, install.type/featureNew capability, new flag, new primitive.New capability, new flag, new primitive.
Type
Projects
Status
In Progress
Problem
apm installalways writes relative to$PWD. There's no flag to redirect deployment to a different root.This forces scratch-dir verification workflows (see #684) to physically stage every input file in the scratch tree and
cdinto it, rather than runningapm install --root <scratch>against inputs that stay in place.Concrete workaround in the wild
juspay/kolu runs
apm installin a scratch directory as part ofjust ci— the motivating use case on #684. The workaround currently spans ~20 lines of a justfile recipe (agents/ai.just:49-77):Every line between
scratch=$(mktemp -d)and(cd "$scratch" && apm install ...)exists only becauseapm installcan't take a target directory. With a--rootflag this collapses to roughly:Why
--root(notcd-based workaround) is the right primitivecpfallbacks for user-owned runtime files, andmkdirs to satisfy target auto-detection). A--rootflag keeps sources in place —apm.yml, the lockfile, and local-path packages all resolve from$PWDwhile writes land under--root.pip install --target,npm install --prefix,cargo install --root— redirecting output root is a standard package-manager affordance.Scope
Two sub-questions the implementation will need to resolve:
--rootredirect? I'd expect: deployed-file writes (.claude/,.codex/,.agents/,.opencode/),apm_modules/, and the lockfile. Sources (apm.yml, local-path package roots) should continue resolving from$PWDunless a separate--manifestflag is added.apm compile.compilehas the same scratch-dir use case (see the(cd "$scratch" && apm compile ...)line above). Worth applying the same flag tocompileand any other command that writes to the working directory.References
audit --ci— Sergio + Daniel both mentioned--rootin their triage replies)agents/ai.just:49-77Path.cwd()/get_deploy_root(scope):src/apm_cli/commands/install.py:1191,1271,1283,1424Environment
uvx --from git+https://github.com/juspay/apm apm— pinned to juspay fork for an unrelated fix)