@srobroek/pi-dep-update 0.0.0-stage → 0.7.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,36 @@
1
1
  {
2
2
  "name": "@srobroek/pi-dep-update",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.7.1",
4
+ "description": "Classify dependency updates by semver safety and apply confirmed patch and minor bumps.",
5
+ "keywords": [
6
+ "pi-package"
7
+ ],
8
+ "license": "Apache-2.0",
9
+ "repository": {
10
+ "type": "git",
11
+ "url": "git+https://github.com/srobroek/harness-plugins.git",
12
+ "directory": "plugins/dep-update/pi"
13
+ },
14
+ "files": [
15
+ "CHANGELOG.md",
16
+ "LICENSE",
17
+ "README.md",
18
+ "extensions",
19
+ "skills"
20
+ ],
21
+ "publishConfig": {
22
+ "access": "public",
23
+ "provenance": true
24
+ },
25
+ "peerDependencies": {
26
+ "typebox": "*"
27
+ },
28
+ "pi": {
29
+ "extensions": [
30
+ "./extensions/index.js"
31
+ ],
32
+ "skills": [
33
+ "./skills"
34
+ ]
35
+ }
36
+ }
@@ -0,0 +1,110 @@
1
+ ---
2
+ name: dep-update
3
+ description: "Use when asked to upgrade dependencies: classifies bumps by semver safety and applies patch/minor ones one at a time."
4
+ ---
5
+
6
+ # Dependency Update / Upgrade Advisory
7
+
8
+ TRIGGER
9
+ + "upgrade dependencies", "update my dependencies", "bump versions", "apply safe bumps"
10
+ + "what's outdated", "check for stale packages", "check for outdated packages", "update lockfile", "dep update", "renovate"
11
+ - choosing a project's initial dependencies: this skill only moves versions a repo
12
+ already declares, and its output is time-varying by design (the same repo yields
13
+ a different plan next month)
14
+ - researching what changed without upgrading: use the `whats-new` skill
15
+
16
+ ## Workflow
17
+
18
+ 1. Run the `dep_scan` tool (param: optional `path`). It enumerates deps and
19
+ classifies every bump. For Rust and Go, use the endpoints in
20
+ `references/recipes.md`.
21
+ 2. Run the CVE scanners below.
22
+ 3. For MINOR-CHECK and MAJOR-ADVISORY, fetch changelog prose in the order given
23
+ in `references/recipes.md` and cite every source by URL or git tag.
24
+ 4. Present the plan, then run the apply loop.
25
+ 5. Summarize: N applied, M skipped, K advisory majors, J CVEs needing action.
26
+
27
+ ## Plan format
28
+
29
+ Five groups in this priority order, sorted by name within each group:
30
+
31
+ ```
32
+ CVE-FLAGGED <name> <current> → <latest> [CVE-XXXX-XXXX] <scanner> <advisory-url>
33
+ PATCH-SAFE <name> <current> → <latest> [cite]
34
+ MINOR-CHECK <name> <current> → <latest> [cite]
35
+ MAJOR-ADVISORY <name> <current> → <latest> breaking: <summary> [cite]
36
+ UNRESOLVABLE <name> <declaration> → <latest> reason: <unresolved version or registry failure>
37
+ ```
38
+
39
+ Manifest ranges alone do not establish installed versions; resolve the declared
40
+ version before classifying it. Classes for `A.B.C` against latest `X.Y.Z`:
41
+ `C<Z` PATCH-SAFE · `B<Y` MINOR-CHECK · `A<X` MAJOR-ADVISORY · equal omitted.
42
+ Unresolved declarations are `UNRESOLVABLE`, not minor upgrades. Resolve exact versions before planning or applying a bump.
43
+ A scan stopped by cancellation or its deadline returns `complete: false` and marks every unqueried dependency `UNCHECKED`: report those as unchecked, never as current.
44
+
45
+ ## Apply loop
46
+
47
+ Present each PATCH-SAFE and MINOR-CHECK dep alone, in plan order, showing the
48
+ changelog cite for MINOR:
49
+
50
+ ```
51
+ name: old → new (PATCH|MINOR) [cite]
52
+ ```
53
+
54
+ Then run the `dep_apply` tool (`ecosystem`, `name`, `version`, optional `path`).
55
+ The user's permission rules decide whether it runs, asks (one prompt naming that
56
+ exact bump, `<name>@<version>`) or is denied; do not ask a separate chat `[Y/n]` first. A rejection
57
+ with feedback, or a permission rule that denies `dep_apply`, comes back as a tool
58
+ error: record the bump as skipped and follow the feedback. A plain rejection ends
59
+ the step: stop the loop and wait for the user.
60
+
61
+ MUST issue one `dep_apply` call per bump: no batching, no yes-to-all.
62
+ NOT approving a permission prompt on the user's behalf.
63
+ MUST treat loading this skill as a workflow handoff, never as approval for a bump.
64
+ MUST inspect manifests and lockfiles after cancellation, deadline, output-limit, or package-manager failure; partial changes can remain.
65
+ MUST keep majors, Rust, and Go out of the loop: named, cited, stopped.
66
+ NOT writing a lockfile or manifest by hand: apply every bump with `dep_apply`.
67
+ MUST report coverage as observed: ecosystems detected, lockfiles read, scanners
68
+ that ran, scanners that were absent. An unrun scanner never reads as clean.
69
+
70
+ ## CVE scanners
71
+
72
+ | Ecosystem | Scanner | Ephemeral runner |
73
+ |-----------|---------|------------------|
74
+ | python | `pip-audit`; optional `uv audit` | `uvx pip-audit` (pin the version for repeatable CI). `uv audit` exists as a preview option: validate the pinned uv version's preview policy before making it a gate. |
75
+ | node | `bun audit` / `pnpm audit` / `npm audit` / `yarn npm audit` | Use the project package manager's audit command; do not install a persistent scanner. |
76
+ | rust | `cargo-audit` or configured `cargo deny check` | None: `cargo install`/`cargo binstall` are persistent installs. Use the project-pinned tool; deny also checks licences/source policy, so avoid redundant mandatory scans. |
77
+ | go | `govulncheck` | Project-pinned `go tool govulncheck ./...`, or the pinned binary; never resolve `@latest` inside a scan. |
78
+ | any | OSV-Scanner v2 (supplemental) | Project-pinned `osv-scanner scan source -r .`; or `go tool osv-scanner scan source -r .` when its v2 module is already pinned in `go.mod` (not published to npm). |
79
+
80
+ Guard each with `command -v`; missing → report "scanner not available: `<name>`" plus the runner.
81
+ For Go `tool` directives, check the project pin and `go tool` availability instead of
82
+ requiring a standalone binary. Pin scanner versions during setup, not this scan.
83
+ A missing scanner is a reported coverage gap, not a task: provisioning one
84
+ permanently is separate work on the user's ask. The plugin appends an advisory to
85
+ the result of a shell call that installed a scanner persistently; it does not stop
86
+ the install.
87
+
88
+ ## Tools
89
+
90
+ | Tool | Purpose |
91
+ |------|---------|
92
+ | `dep_scan` | Enumerate deps, query PyPI/npm, classify bumps. Transitive lockfile entries are listed, not queried. |
93
+ | `dep_apply` | Apply one bump via the package manager under the user's permission rules, then verify the manifest. |
94
+
95
+ `references/recipes.md` holds what the tools do not: the Go proxy and crates.io
96
+ endpoints, the advisory-only apply commands, and the changelog fetch order.
97
+
98
+ ## Out of scope
99
+
100
+ The detector reads root `package.json` (+ `package-lock.json` for resolved versions), `Cargo.toml`, `go.mod`, `Gemfile`, and `composer.json`.
101
+ Python declarations come from `pyproject.toml` (PEP 621, dependency groups, Poetry tables), else `requirements.txt`; `uv.lock`/`poetry.lock` only supply resolved versions, and undeclared lock entries are transitive (never bumped). Local path/editable sources are skipped.
102
+ Python apply: `poetry add` when `poetry.lock` or `[tool.poetry]` exists; else `uv add` (`--frozen` when there is no `uv.lock`); a requirements-only project gets a manual instruction, never an install.
103
+ `Cargo.lock`, `go.sum`, `Pipfile.lock`, Ruby/PHP lockfiles, other Node lockfiles, and workspace child manifests are not scanned.
104
+ Report these coverage gaps; do not describe declaration ranges as installed versions. It does not cover:
105
+
106
+ - Docker image tag lookup (`FROM` lines, Hub/GHCR tags)
107
+ - GitHub Actions pinning (`uses:` version pins in workflow YAML)
108
+
109
+ Those are not dependency-upgrade work under this skill's contract. Do not
110
+ implement them here and do not invent a scanner for them.
@@ -0,0 +1,66 @@
1
+ # dep-update: what the tools do not implement
2
+
3
+ `dep_scan` queries PyPI and npm only. Everything below covers the gaps:
4
+ the rust/go endpoints, the apply commands per package manager, and the changelog
5
+ fetch order.
6
+
7
+ All version data comes from machine-readable JSON endpoints -- never scrape
8
+ rendered HTML for a version number. Reserve web-fetch for changelog prose
9
+ (migration guides, breaking-change posts) that has no structured endpoint.
10
+
11
+ ## Registry endpoints not in dep_scan
12
+
13
+ Go modules (advisory only -- no apply):
14
+
15
+ ```sh
16
+ curl -fsSL "https://proxy.golang.org/<module>/@latest" # {"Version":"v1.2.3","Time":"..."}
17
+ curl -fsSL "https://proxy.golang.org/<module>/@v/list" # newline-separated tags
18
+ ```
19
+
20
+ Rust / crates.io (advisory only -- no apply): `max_stable_version` and
21
+ `repository` live under `.crate` in
22
+
23
+ ```sh
24
+ curl -fsSL -A 'opencode-dep-update (+https://github.com/srobroek/opencode-plugins)' \
25
+ "https://crates.io/api/v1/crates/<name>"
26
+ ```
27
+
28
+ ## Ecosystem → lockfile → apply command
29
+
30
+ | Lockfile / manifest | Ecosystem | Apply command | Notes |
31
+ |---------------------|-----------|---------------|-------|
32
+ | `poetry.lock` or `[tool.poetry]` in `pyproject.toml` | python | `poetry add "name==ver"` | Failures can leave partial changes |
33
+ | `pyproject.toml` + `uv.lock` | python | `uv add "name==ver"` | Failures can leave partial changes |
34
+ | `pyproject.toml`, no `uv.lock` | python | `uv add --frozen "name==ver"` | Edits pyproject only; creates no lockfile |
35
+ | `requirements.txt` only | python | none (manual) | `dep_apply` prints the pin to set; it never runs `pip install` |
36
+ | `pnpm-lock.yaml` | node | `pnpm update "name@ver"` | |
37
+ | `bun.lock` / `bun.lockb` | node | `bun add "name@ver"` | |
38
+ | `yarn.lock` | node | `yarn add "name@ver"` | |
39
+ | `package-lock.json` / `npm-shrinkwrap.json` | node | `npm install "name@ver"` | |
40
+ | `Cargo.toml` | rust | `cargo update -p name --precise ver` | Advisory only; Cargo.lock is not scanned |
41
+ | `go.mod` | go | `go get module@ver && go mod tidy` | Advisory only; go.sum is not scanned |
42
+
43
+ Node package manager precedence: `DEP_UPDATE_PKG_MANAGER` first, else lockfile
44
+ order `pnpm-lock.yaml` → `bun.lock`/`bun.lockb` → `yarn.lock` →
45
+ `package-lock.json`.
46
+
47
+ Only `package-lock.json` supplies resolved Node versions to the scan; the other Node lockfiles select the package manager. `Pipfile.lock` is not scanned.
48
+
49
+ Offer a pre-release candidate (`rc`, `alpha`, `beta`, `a`, `b`, `dev`) only when
50
+ the installed version is pre-release. Otherwise offer the latest stable version.
51
+
52
+ ## Changelog fetch order (MINOR-CHECK + MAJOR-ADVISORY)
53
+
54
+ 1. Registry metadata URLs: `info.project_urls.Source` (PyPI), `repository` (npm).
55
+ 2. Blobless bare clone at the tag span, reading the changelog at the target tag:
56
+ ```sh
57
+ git clone --bare --filter=blob:none "$REPO" "$TMP/r.git"
58
+ G="git --git-dir=$TMP/r.git"
59
+ $G tag --list | grep -E "(^|[-@/])v?${TO}$" # tags carry v-, @-, path- prefixes
60
+ $G show "${TO}:CHANGELOG.md" # or CHANGELOG, CHANGES.md, HISTORY.md, NEWS.md
61
+ ```
62
+ 3. Migration prose (MAJOR-ADVISORY only): locate it in-repo first with
63
+ `$G ls-tree -r --name-only "$TO" | grep -iE 'migrat|upgrad|breaking'`. Prefer
64
+ the project's own guide; flag third-party blogs as derivative. Only then is a
65
+ targeted web fetch justified.
66
+ 4. Nothing found → report "no changelog found" and point the user upstream.