The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
feat(pm): pm update --skip-target leaves a target's pins alone
ethernet3fa571a51a6b
diff --git a/pm/cli.py b/pm/cli.pyindex 6a42abe3d37..55eb1dc771f 100644--- a/pm/cli.py+++ b/pm/cli.py@@ -541,13 +541,14 @@ def _run_live(cmd: list[str], *, cwd, env, timeout: int = 3600) -> tuple[int, streturn result.returncode, result.stderr-def _resolve_updates(names: list[str], lockfile, only_target: str | None) -> tuple[list, list[str]]:+def _resolve_updates(names: list[str], lockfile, only_target: str | None,+ skip_targets: frozenset[str] = frozenset()) -> tuple[list, list[str]]:"""Resolve each package's latest; an upstream outage records a failure instead of aborting."""resolved = []failures = []for name in names:package = get_package(name)- targets = [t for t in ALL_TARGETS if package.missing_reason(t) is None]+ targets = [t for t in ALL_TARGETS if package.missing_reason(t) is None and t not in skip_targets]if only_target: # cross-target check: only the requested target matterstargets = [t for t in targets if t == only_target]if not targets:@@ -663,7 +664,7 @@ def _refresh_npm_lock() -> int:def cmd_update(args) -> int:- """`hermes pm update [names...] [--check] [--target T] [--uv] [--npm] [--termux]`.+ """`hermes pm update [names...] [--check] [--target T] [--skip-target T] [--uv] [--npm] [--termux]`.Resolve each package's latest via its own latest_versions() hook,intersect across targets, and (real mode) re-pin the lockfile + install@@ -684,7 +685,7 @@ def cmd_update(args) -> int:print("::warning::--target is a CHECK-only cross-resolution flag; ignoring it for apply (the lockfile pins every target)")args.target = None- resolved, failures = _resolve_updates(names, lockfile, args.target)+ resolved, failures = _resolve_updates(names, lockfile, args.target, frozenset(args.skip_target))changed = [d for d in resolved if d.changed]if not resolved:print("pm update: nothing to check (no resolvable packages)")@@ -873,6 +874,9 @@ def main(argv=None) -> int:p.add_argument("--check", action="store_true",help="dry-run: print what would change, write nothing (exit 1 if updates exist)")p.add_argument("--target", help="resolve for a different target instead of this machine (e.g. win32-arm64)")+ p.add_argument("--skip-target", action="append", default=[], choices=ALL_TARGETS, metavar="TARGET",+ help="leave TARGET's pins as they are, e.g. linux-arm64-bionic while the termux "+ "pool lags upstream (repeatable)")p.add_argument("--uv", action="store_true", help="also refresh uv.lock + venv (uv update + sync)")p.add_argument("--npm", action="store_true", help="also refresh package-lock.json (npm update)")p.add_argument("--termux", action="store_true",diff --git a/tests/pm/test_source_update_launch.py b/tests/pm/test_source_update_launch.pyindex 7d16ba8be13..6ee7948b806 100644--- a/tests/pm/test_source_update_launch.py+++ b/tests/pm/test_source_update_launch.py@@ -166,7 +166,7 @@ def test_source_python_pin_update_survives_real_gc(source_launch, tmp_path, monkmonkeypatch.setattr(cli, "resolve_package", lambda *a, **k: Resolved("python", "A", "semver", "B"))monkeypatch.setattr(cli, "_pin_artifacts", lambda *a: {})monkeypatch.setattr(importlib.import_module("pm.install"), "sync_venv", pm.sync_venv)- assert cli.cmd_update(SimpleNamespace(names=["python"], target=None, check=False, uv=False, npm=False, termux=False)) == 0+ assert cli.cmd_update(SimpleNamespace(names=["python"], target=None, skip_target=[], check=False, uv=False, npm=False, termux=False)) == 0assert Lockfile(paths.lockfile_path()).version("python") == "B"assert pm.venv_is_current(project_root=root)assert selected_venv(root) != previousdiff --git a/tests/pm/test_update_artifact_refresh.py b/tests/pm/test_update_artifact_refresh.pyindex 23d7bb1c54f..2082736c913 100644--- a/tests/pm/test_update_artifact_refresh.py+++ b/tests/pm/test_update_artifact_refresh.py@@ -66,7 +66,7 @@ def test_same_minor_refresh_updates_real_bytes_and_preserves_unresolved_targets(engine = importlib.import_module("pm.install")monkeypatch.setattr(engine, "sync_venv", lambda **kwargs: syncs.append(kwargs))before = lock.path.read_bytes()- args = Namespace(names=["rolling-tool"], target=None, check=True, uv=False, npm=False, termux=False)+ args = Namespace(names=["rolling-tool"], target=None, skip_target=[], check=True, uv=False, npm=False, termux=False)assert cli.cmd_update(args) == 1assert lock.path.read_bytes() == before and not requests and not syncsassert not store.exists()diff --git a/tests/pm/test_update_dependency_legs.py b/tests/pm/test_update_dependency_legs.pyindex 8ebae205b2e..c1dc5fd4f84 100644--- a/tests/pm/test_update_dependency_legs.py+++ b/tests/pm/test_update_dependency_legs.py@@ -99,7 +99,7 @@ def test_uv_refresh_uses_real_installed_tool_and_only_the_owned_project(tmp_pathsyncs = []ensure = importlib.import_module('pm.install')monkeypatch.setattr(ensure, 'sync_venv', lambda **kw: syncs.append(kw))- args = Namespace(names=['manual-fixture'], target=None, check=True, uv=True, npm=False, termux=False)+ args = Namespace(names=['manual-fixture'], target=None, skip_target=[], check=True, uv=True, npm=False, termux=False)assert cli.cmd_update(args) == 0assert not (repo / 'uv.lock').exists()assert not syncs@@ -192,7 +192,7 @@ def test_npm_refresh_uses_its_installed_entry_and_owned_project(monkeypatch, capmonkeypatch.setenv('npm_config_cache', str(root / 'ambient-cache'))before = dict(os.environ)before_lock = lock.path.read_bytes()- args = Namespace(names=['manual-fixture'], target=None, check=True, uv=False, npm=True, termux=False)+ args = Namespace(names=['manual-fixture'], target=None, skip_target=[], check=True, uv=False, npm=True, termux=False)assert cli.cmd_update(args) == 0assert not (repo / 'package-lock.json').exists()args.check = Falsediff --git a/tests/pm/test_update_failure_status.py b/tests/pm/test_update_failure_status.pyindex 09b53d2eac3..5601076e87d 100644--- a/tests/pm/test_update_failure_status.py+++ b/tests/pm/test_update_failure_status.py@@ -54,7 +54,7 @@ def test_failed_resolution_stops_every_apply_path(tmp_path, monkeypatch, capsys,packages = [failed, healthy] if mixed else [failed]lock = prepare(tmp_path, monkeypatch, packages)before = lock.path.read_bytes()- args = Namespace(names=[p.name for p in packages], target=None, check=check, uv=True, npm=True, termux=False)+ args = Namespace(names=[p.name for p in packages], target=None, skip_target=[], check=check, uv=True, npm=True, termux=False)assert cli.cmd_update(args) == 1assert "fixture index unavailable" in capsys.readouterr().outassert lock.path.read_bytes() == before@@ -69,7 +69,7 @@ def test_current_and_manual_results_are_successful_without_writes(tmp_path, monklock = prepare(tmp_path, monkeypatch, [package])before = lock.path.read_bytes()for check in (True, False):- args = Namespace(names=[package.name], target=None, check=check, uv=False, npm=False, termux=False)+ args = Namespace(names=[package.name], target=None, skip_target=[], check=check, uv=False, npm=False, termux=False)assert cli.cmd_update(args) == 0assert lock.path.read_bytes() == beforeassert not (tmp_path / "tools").exists()diff --git a/website/docs/reference/package-management.md b/website/docs/reference/package-management.mdindex 341ef30f33e..14eed929746 100644--- a/website/docs/reference/package-management.md+++ b/website/docs/reference/package-management.md@@ -552,6 +552,7 @@ not substitutes for an installed application's update mechanism.| `pm update [names...]` | Query upstream versions, change tool pins, and install changed tools. || `pm update --check` | Query without writing. Exit 1 can mean updates exist; inspect output to distinguish an error. || `pm update --target TARGET` | Resolve versions for the specified target. |+| `pm update --skip-target TARGET` | Leave TARGET's pins unchanged (repeatable), for example `linux-arm64-bionic` while the termux pool lags upstream. Later runs still report the package as current. `pm lock --bump NAME VERSION` re-pins every target at a version, and `pm update --termux` repins a retired `linux-arm64-bionic` row. || `pm update --uv` / `--npm` | Also refresh the Python or npm dependency resolution. || `pm update --termux [--check]` | Repin the termux pool archives the rolling pool has retired (the runtime-lib pin table and the bionic lock rows). `--check` reports without writing and exits 1 when a pin is retired. || `pm install --target TARGET NAME...` | Stage explicit cross-target packages without recording them as the host's installed runtime. The win32 `git` target pins a self-extracting PortableGit archive: staging it runs the vendor extractor and therefore requires a Windows host. |