freshpin 0.1.0__tar.gz

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.
Files changed (78) hide show
  1. freshpin-0.1.0/.claude-plugin/icon.png +0 -0
  2. freshpin-0.1.0/.claude-plugin/marketplace.json +27 -0
  3. freshpin-0.1.0/.claude-plugin/plugin.json +24 -0
  4. freshpin-0.1.0/.gitignore +18 -0
  5. freshpin-0.1.0/CONTRIBUTING.md +73 -0
  6. freshpin-0.1.0/LICENSE-MIT +21 -0
  7. freshpin-0.1.0/PKG-INFO +334 -0
  8. freshpin-0.1.0/PUBLISHING.md +235 -0
  9. freshpin-0.1.0/README.md +303 -0
  10. freshpin-0.1.0/ROADMAP.md +128 -0
  11. freshpin-0.1.0/assets/icon-256.png +0 -0
  12. freshpin-0.1.0/docs/RESEARCH.md +205 -0
  13. freshpin-0.1.0/docs/VALIDATION.md +190 -0
  14. freshpin-0.1.0/evals/README.md +30 -0
  15. freshpin-0.1.0/evals/fastapi-stack/graders/ci-checkout.md +7 -0
  16. freshpin-0.1.0/evals/fastapi-stack/graders/ci-python-version.md +7 -0
  17. freshpin-0.1.0/evals/fastapi-stack/graders/ci-setup-python.md +7 -0
  18. freshpin-0.1.0/evals/fastapi-stack/graders/compose-postgres.md +7 -0
  19. freshpin-0.1.0/evals/fastapi-stack/graders/compose-redis.md +7 -0
  20. freshpin-0.1.0/evals/fastapi-stack/graders/dockerfile-python.md +8 -0
  21. freshpin-0.1.0/evals/fastapi-stack/graders/requirements-fastapi.md +8 -0
  22. freshpin-0.1.0/evals/fastapi-stack/graders/skill-used.md +7 -0
  23. freshpin-0.1.0/evals/fastapi-stack/prompt.md +19 -0
  24. freshpin-0.1.0/evals/nextjs-app/graders/ci-node-version.md +7 -0
  25. freshpin-0.1.0/evals/nextjs-app/graders/ci-setup-node.md +7 -0
  26. freshpin-0.1.0/evals/nextjs-app/graders/dockerfile-node.md +8 -0
  27. freshpin-0.1.0/evals/nextjs-app/graders/package-next.md +7 -0
  28. freshpin-0.1.0/evals/nextjs-app/graders/package-react.md +7 -0
  29. freshpin-0.1.0/evals/nextjs-app/graders/package-typescript.md +7 -0
  30. freshpin-0.1.0/evals/nextjs-app/graders/skill-used.md +7 -0
  31. freshpin-0.1.0/evals/nextjs-app/prompt.md +18 -0
  32. freshpin-0.1.0/hooks/check_written_file.py +300 -0
  33. freshpin-0.1.0/hooks/freshpin-hook.sh +13 -0
  34. freshpin-0.1.0/hooks/hooks.json +17 -0
  35. freshpin-0.1.0/pyproject.toml +134 -0
  36. freshpin-0.1.0/skills/freshpin/SKILL.md +74 -0
  37. freshpin-0.1.0/skills/freshpin/scripts/freshpin +15 -0
  38. freshpin-0.1.0/skills/freshpin/scripts/freshpin.py +33 -0
  39. freshpin-0.1.0/src/freshpin/__init__.py +5 -0
  40. freshpin-0.1.0/src/freshpin/__main__.py +5 -0
  41. freshpin-0.1.0/src/freshpin/auditors/__init__.py +366 -0
  42. freshpin-0.1.0/src/freshpin/auditors/base.py +445 -0
  43. freshpin-0.1.0/src/freshpin/auditors/cargo_toml.py +186 -0
  44. freshpin-0.1.0/src/freshpin/auditors/docker.py +163 -0
  45. freshpin-0.1.0/src/freshpin/auditors/github_workflows.py +142 -0
  46. freshpin-0.1.0/src/freshpin/auditors/package_json.py +106 -0
  47. freshpin-0.1.0/src/freshpin/auditors/pyproject.py +229 -0
  48. freshpin-0.1.0/src/freshpin/cache.py +172 -0
  49. freshpin-0.1.0/src/freshpin/cli.py +290 -0
  50. freshpin-0.1.0/src/freshpin/py.typed +0 -0
  51. freshpin-0.1.0/src/freshpin/registries/__init__.py +241 -0
  52. freshpin-0.1.0/src/freshpin/registries/base.py +230 -0
  53. freshpin-0.1.0/src/freshpin/registries/crates.py +44 -0
  54. freshpin-0.1.0/src/freshpin/registries/dockerhub.py +73 -0
  55. freshpin-0.1.0/src/freshpin/registries/endoflife.py +342 -0
  56. freshpin-0.1.0/src/freshpin/registries/github_actions.py +242 -0
  57. freshpin-0.1.0/src/freshpin/registries/npm.py +73 -0
  58. freshpin-0.1.0/src/freshpin/registries/pypi.py +70 -0
  59. freshpin-0.1.0/src/freshpin/report.py +197 -0
  60. freshpin-0.1.0/src/freshpin/versioning.py +507 -0
  61. freshpin-0.1.0/tests/conftest.py +338 -0
  62. freshpin-0.1.0/tests/fixtures/stale/.github/workflows/ci.yml +24 -0
  63. freshpin-0.1.0/tests/fixtures/stale/Cargo.toml +20 -0
  64. freshpin-0.1.0/tests/fixtures/stale/Dockerfile +10 -0
  65. freshpin-0.1.0/tests/fixtures/stale/docker-compose.yml +11 -0
  66. freshpin-0.1.0/tests/fixtures/stale/frontend/package.json +21 -0
  67. freshpin-0.1.0/tests/fixtures/stale/pyproject.toml +37 -0
  68. freshpin-0.1.0/tests/fixtures/stale/requirements.txt +8 -0
  69. freshpin-0.1.0/tests/test_auditors.py +600 -0
  70. freshpin-0.1.0/tests/test_cache.py +142 -0
  71. freshpin-0.1.0/tests/test_cli.py +246 -0
  72. freshpin-0.1.0/tests/test_hook.py +395 -0
  73. freshpin-0.1.0/tests/test_registries.py +683 -0
  74. freshpin-0.1.0/tests/test_versioning.py +262 -0
  75. freshpin-0.1.0/validation/accuracy.py +504 -0
  76. freshpin-0.1.0/validation/corpus.py +199 -0
  77. freshpin-0.1.0/validation/results/accuracy.md +190 -0
  78. freshpin-0.1.0/validation/results/corpus.md +137 -0
Binary file
@@ -0,0 +1,27 @@
1
+ {
2
+ "name": "freshpin",
3
+ "owner": {
4
+ "name": "freshpin contributors"
5
+ },
6
+ "metadata": {
7
+ "description": "freshpin: always use the latest stable versions instead of guessing from training data.",
8
+ "version": "0.1.0"
9
+ },
10
+ "plugins": [
11
+ {
12
+ "name": "freshpin",
13
+ "source": "./",
14
+ "description": "Skill + PostToolUse hook that resolve and audit the latest stable versions of packages (PyPI, npm, crates.io), GitHub Actions, Docker base images, databases and runtimes.",
15
+ "version": "0.1.0",
16
+ "license": "MIT",
17
+ "category": "development",
18
+ "keywords": [
19
+ "dependencies",
20
+ "versions",
21
+ "github-actions",
22
+ "docker",
23
+ "supply-chain"
24
+ ]
25
+ }
26
+ ]
27
+ }
@@ -0,0 +1,24 @@
1
+ {
2
+ "name": "freshpin",
3
+ "version": "0.1.0",
4
+ "description": "Stop AI agents from writing stale versions. A skill that makes Claude resolve the latest stable libraries, GitHub Actions, Docker images, databases and runtimes from live registries, plus a PostToolUse hook that flags outdated versions the moment they are written.",
5
+ "author": {
6
+ "name": "freshpin contributors"
7
+ },
8
+ "homepage": "https://github.com/chetanxrathore/freshpin",
9
+ "repository": "https://github.com/chetanxrathore/freshpin",
10
+ "license": "MIT",
11
+ "keywords": [
12
+ "dependencies",
13
+ "versions",
14
+ "pypi",
15
+ "npm",
16
+ "crates",
17
+ "github-actions",
18
+ "docker",
19
+ "endoflife",
20
+ "supply-chain",
21
+ "hooks",
22
+ "skills"
23
+ ]
24
+ }
@@ -0,0 +1,18 @@
1
+ __pycache__/
2
+ *.py[cod]
3
+ .venv/
4
+ .pytest_cache/
5
+ .mypy_cache/
6
+ .ruff_cache/
7
+ dist/
8
+ build/
9
+ *.egg-info/
10
+ .coverage
11
+ htmlcov/
12
+
13
+ # claude plugin eval output
14
+ evals/results/
15
+
16
+ # local research working files (the final report is docs/RESEARCH.md)
17
+ research_notes/
18
+ reports/
@@ -0,0 +1,73 @@
1
+ # Contributing to freshpin
2
+
3
+ Thanks for helping agents stop shipping stale versions. This guide covers the dev setup, the project rules and how to add a registry or an auditor.
4
+
5
+ ## Setup
6
+
7
+ ```bash
8
+ uv sync
9
+ ```
10
+
11
+ This creates `.venv` with the dev tools (pytest, ruff, mypy) and installs freshpin in editable mode.
12
+
13
+ ## Before you open a pull request
14
+
15
+ All four must pass:
16
+
17
+ ```bash
18
+ uv run ruff check src tests hooks
19
+ ```
20
+
21
+ ```bash
22
+ uv run ruff format --check src tests hooks
23
+ ```
24
+
25
+ ```bash
26
+ uv run mypy --strict src/freshpin
27
+ ```
28
+
29
+ ```bash
30
+ uv run pytest
31
+ ```
32
+
33
+ ## Live validation and agent evals (optional, need network)
34
+
35
+ ```bash
36
+ uv run --with packaging python validation/accuracy.py
37
+ ```
38
+
39
+ ```bash
40
+ uv run python validation/corpus.py --workdir /tmp/freshpin-corpus
41
+ ```
42
+
43
+ `accuracy.py` compares freshpin's answers with independent sources such as `npm view`, the PyPI simple index, `git ls-remote` and the official release feeds. It also checks that suggested Docker tags exist. `corpus.py` audits popular open-source repositories, looking for crashes, parse errors and suspicious suggestions. The A/B agent eval suite is in `evals/` (see `evals/README.md`); it needs a signed-in `claude`.
44
+
45
+ ## Ground rules
46
+
47
+ - **Zero runtime dependencies.** freshpin must stay installable anywhere in a second, so use the standard library only (`urllib.request`, `json`, `re`, `concurrent.futures`...). Dev tools are fine in the `dev` dependency group.
48
+ - **Python 3.9+.** macOS's built-in Python is 3.9, and Claude Code's sandbox may allow nothing else, so the hook and skill must run there:
49
+ - No `tomllib`, `typing.Self`, `StrEnum`, `datetime.UTC`, `match` statements or `zip(strict=...)`.
50
+ - Mypy 2.x can only target 3.10, so also run the suite on 3.9:
51
+ ```bash
52
+ uv run --no-project --python 3.9 --with "pytest<9" -- env PYTHONPATH=src python -m pytest
53
+ ```
54
+ - **Strict typing.** `mypy --strict` must stay clean.
55
+ - **Tests never touch the network.** `tests/conftest.py` blocks `urlopen` and provides `FakeHttp` plus a canned "registry world". Add payloads there, using dates far in the past or future so tests don't depend on today's date.
56
+ - **Never break the agent loop.** Registry and parse failures become `error` or `skipped` findings, never exceptions. The hook always exits 0.
57
+ - **Keep agent output terse.** `--format agent` is read by LLMs, so every token counts.
58
+
59
+ ## Adding a registry
60
+
61
+ 1. Create `src/freshpin/registries/<name>.py` with a `Registry` subclass. Set `ecosystem`, `aliases`, `title` and `example`, and implement `fetch()`. It returns `{"version": ..., "url": ..., "details": {...}}`, filters out pre-releases unless `include_pre` is set, and raises `RegistryError` on failure.
62
+ 2. Register it in `REGISTRIES` in `src/freshpin/registries/__init__.py`.
63
+ 3. Add mocked payloads to `tests/conftest.py` and tests to `tests/test_registries.py`.
64
+
65
+ ## Adding an auditor
66
+
67
+ 1. Create `src/freshpin/auditors/<name>.py` with a `parse_<name>(path, text) -> list[DependencyRef]` function. Record exact line numbers, a `template` showing how the declaration reads (with `{spec}` where the version goes), and the right `kind` so the shared evaluator interprets the constraint correctly.
68
+ 2. Hook it into `PARSERS` and `detect_kind()` in `src/freshpin/auditors/__init__.py`. If the hook should react to the new file name, also update `_CANDIDATE_RE` in `hooks/check_written_file.py`.
69
+ 3. Add a stale fixture under `tests/fixtures/` and expectations in `tests/test_auditors.py`.
70
+
71
+ ## Commit style
72
+
73
+ Use small, focused commits with an imperative subject line ("Add Maven registry"), and explain *why* in the body when it isn't obvious.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 freshpin contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,334 @@
1
+ Metadata-Version: 2.5
2
+ Name: freshpin
3
+ Version: 0.1.0
4
+ Summary: Stop AI coding agents from writing stale versions: resolve and audit the latest stable libraries, GitHub Actions, Docker images, databases and runtimes.
5
+ Project-URL: Homepage, https://github.com/chetanxrathore/freshpin
6
+ Project-URL: Repository, https://github.com/chetanxrathore/freshpin
7
+ Project-URL: Issues, https://github.com/chetanxrathore/freshpin/issues
8
+ Project-URL: Changelog, https://github.com/chetanxrathore/freshpin/releases
9
+ Author: freshpin contributors
10
+ License-Expression: MIT
11
+ License-File: LICENSE-MIT
12
+ Keywords: ai-agents,claude-code,crates,dependencies,docker,endoflife,github-actions,npm,pypi,versions
13
+ Classifier: Development Status :: 4 - Beta
14
+ Classifier: Environment :: Console
15
+ Classifier: Intended Audience :: Developers
16
+ Classifier: Operating System :: OS Independent
17
+ Classifier: Programming Language :: Python :: 3
18
+ Classifier: Programming Language :: Python :: 3 :: Only
19
+ Classifier: Programming Language :: Python :: 3.9
20
+ Classifier: Programming Language :: Python :: 3.10
21
+ Classifier: Programming Language :: Python :: 3.11
22
+ Classifier: Programming Language :: Python :: 3.12
23
+ Classifier: Programming Language :: Python :: 3.13
24
+ Classifier: Programming Language :: Python :: 3.14
25
+ Classifier: Programming Language :: Python :: 3.15
26
+ Classifier: Topic :: Software Development :: Build Tools
27
+ Classifier: Topic :: Software Development :: Quality Assurance
28
+ Classifier: Typing :: Typed
29
+ Requires-Python: >=3.9
30
+ Description-Content-Type: text/markdown
31
+
32
+ # freshpin
33
+
34
+ **Stop AI agents from writing `actions/checkout@v3` and `postgres:14`.**
35
+
36
+ [![PyPI](https://img.shields.io/pypi/v/freshpin)](https://pypi.org/project/freshpin/)
37
+ [![Python versions](https://img.shields.io/pypi/pyversions/freshpin)](https://pypi.org/project/freshpin/)
38
+ [![CI](https://github.com/chetanxrathore/freshpin/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/chetanxrathore/freshpin/actions/workflows/ci.yml)
39
+ [![Downloads](https://img.shields.io/pypi/dm/freshpin)](https://pypistats.org/packages/freshpin)
40
+ [![License](https://img.shields.io/badge/license-MIT-blue)](https://github.com/chetanxrathore/freshpin/blob/main/LICENSE-MIT)
41
+ [![Dependencies](https://img.shields.io/badge/dependencies-0-brightgreen)](https://github.com/chetanxrathore/freshpin/blob/main/pyproject.toml)
42
+ [![Claude Code plugin](https://img.shields.io/badge/Claude%20Code-plugin-D97757)](#install)
43
+ [![Typing](https://img.shields.io/badge/typing-mypy%20strict-blue)](https://mypy-lang.org/)
44
+ [![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff)
45
+
46
+ AI coding agents pick versions from training data that is months or years old. So they scaffold projects with GitHub Actions three majors behind, Docker images that are already end-of-life, and `"react": "^18.2.0"` long after 19 shipped. Nothing breaks right away, which is why it keeps happening.
47
+
48
+ `freshpin` makes the agent **look versions up instead of recalling them**:
49
+
50
+ | Layer | What it does |
51
+ |---|---|
52
+ | **CLI** (`freshpin`) | Queries PyPI, npm, crates.io, GitHub and endoflife.date concurrently, caches the results for 6 hours, and works offline from the cache. Pure Python standard library, so it has zero dependencies. |
53
+ | **Skill** (`skills/freshpin/SKILL.md`) | Tells Claude Code never to guess a version: run `freshpin resolve` before writing a manifest, and `freshpin audit` before finishing. |
54
+ | **Hook** (`hooks/`) | A `PostToolUse` hook. When Claude writes a stale version into a manifest, workflow or Dockerfile, the hook returns the fix right away and Claude upgrades it. |
55
+
56
+ ```text
57
+ $ freshpin audit . --format agent
58
+ freshpin: 11 outdated of 12 checked - upgrade to the latest stable versions:
59
+ .github/workflows/ci.yml:5 | actions/checkout@v3 -> actions/checkout@v7 [major]
60
+ .github/workflows/ci.yml:6 | actions/setup-node@v3 -> actions/setup-node@v7 [major]
61
+ .github/workflows/ci.yml:8 | node-version: "18" -> node-version: "26" [major] 18 is EOL since 2025-04-30
62
+ Dockerfile:1 | python:3.10-slim -> python:3.15-slim [minor] 3.10 is EOL since 2026-10-01
63
+ docker-compose.yml:3 | postgres:14 -> postgres:19 [major] 14 is EOL since 2026-11-12
64
+ docker-compose.yml:5 | redis:6.2 -> redis:8.12 [major]
65
+ package.json:3 | "next": "14.2.3" -> "next": "16.4.6" [major] constraint excludes the latest release
66
+ package.json:4 | "react": "^18.2.0" -> "react": "^19.3.1" [major] constraint excludes the latest release
67
+ pyproject.toml:3 | requires-python = ">=3.9" -> requires-python = ">=3.11" [minor] 3.9 is EOL since 2025-10-31
68
+ pyproject.toml:4 | fastapi>=0.100.0 -> fastapi>=0.165.0 [minor] floor is a breaking release behind
69
+ pyproject.toml:4 | pydantic>=1.10,<2 -> pydantic>=2.14.4 [major] constraint excludes the latest release
70
+ ```
71
+
72
+ <sub>Example output from November 2026. You will see whatever is current when you run it.</sub>
73
+
74
+ ### Why trust it
75
+
76
+ Every suggestion is checked against live sources, not guessed:
77
+
78
+ - **GitHub Actions** versions come from the repository's latest release, and the commit SHA comes from its git tags. SHA-pinned workflows get the exact SHA to pin.
79
+ - **Docker image tags** are confirmed on Docker Hub before they are suggested. If a short tag isn't published (`elasticsearch:9.5`), freshpin falls back to the full version (`9.5.7`). If an OS variant is retired (`python:3.15-buster`), it switches to a current one (`-trixie`).
80
+ - **Runtimes with LTS lines** (Node.js, Ubuntu, MySQL, Java) get the newest *LTS* release, never a pre-release.
81
+
82
+ Measured on 2026-11-26 (details in [docs/VALIDATION.md](docs/VALIDATION.md)):
83
+
84
+ - **It changes what the agent writes.** In an A/B `claude plugin eval`, Claude Sonnet 5.5 scaffolded a FastAPI and a Next.js project with and without freshpin. With freshpin, **39/39** version checks were current; without it, **0/39**. From memory it wrote `python:3.13`, `postgres:17`, `redis:7`, `node:24`, `actions/checkout@v4`/`@v5` and `typescript ^5.9`. With freshpin it wrote `python:3.15`, `postgres:19`, `redis:8.12`, `node:26`, `@v7` and `^7.0.2`.
85
+
86
+ - **100% agreement with independent sources:** 97/97 versions match across PyPI, npm, crates.io, GitHub and the official release feeds. 43/43 suggested Docker tags exist on Docker Hub, and 22/22 suggested `uses:` refs exist on GitHub.
87
+ - **Robust on real projects:** across 18 popular open-source repositories, freshpin parsed 1,321 files and 12,135 version declarations with 0 crashes and 0 parse errors. The audit took about 4 seconds with a warm cache.
88
+ - **Tested on every supported Python:** 317 offline tests pass on Python 3.9 through 3.15, including macOS's built-in 3.9, with 94% branch coverage.
89
+ - **The plugin passes Claude Code's validator:** `claude plugin validate --strict` reports nothing. The A/B eval suite ships in [`evals/`](evals/).
90
+
91
+ ---
92
+
93
+ ## Install
94
+
95
+ ### Claude Code (plugin: skill + hook)
96
+
97
+ ```text
98
+ /plugin marketplace add chetanxrathore/freshpin
99
+ /plugin install freshpin@freshpin
100
+ ```
101
+
102
+ The plugin ships with its own copy of the CLI. Both the skill and the hook work without any extra install; they only need a Python 3.9 or newer. The built-in `/usr/bin/python3` on macOS is enough; the launchers pick a working interpreter automatically.
103
+
104
+ **Skill only, no plugin:** copy the folder and install the CLI (below):
105
+
106
+ ```bash
107
+ cp -r skills/freshpin ~/.claude/skills/freshpin
108
+ ```
109
+
110
+ ### Standalone CLI
111
+
112
+ ```bash
113
+ uv tool install git+https://github.com/chetanxrathore/freshpin
114
+ ```
115
+
116
+ ```bash
117
+ pipx install git+https://github.com/chetanxrathore/freshpin
118
+ ```
119
+
120
+ Once a release is on PyPI (see [PUBLISHING.md](PUBLISHING.md)):
121
+
122
+ ```bash
123
+ uv tool install freshpin
124
+ ```
125
+
126
+ ```bash
127
+ pipx install freshpin
128
+ ```
129
+
130
+ ### Cursor, Codex, Gemini CLI and other agents
131
+
132
+ Install the CLI (above). Most agents now load the Agent Skills format (`SKILL.md`), so copy `skills/freshpin/` into the agent's skills directory:
133
+
134
+ | Agent | Project skills directory | User skills directory |
135
+ |---|---|---|
136
+ | Codex | `.agents/skills/` | `~/.agents/skills/` |
137
+ | Gemini CLI | `.gemini/skills/` (or `.agents/skills/`) | `~/.gemini/skills/` |
138
+ | Cursor | `.cursor/skills/` (also reads `.agents/` and `.claude/`) | `~/.cursor/skills/` |
139
+ | GitHub Copilot / VS Code | `.github/skills/` | `~/.copilot/skills/` |
140
+ | JetBrains Junie | `.junie/skills/` | `~/.junie/skills/` |
141
+
142
+ These paths come from each agent's documentation as of November 2026.
143
+
144
+ Skills are only advice. Agents without hooks may skip them, so also add a rule to the instructions file your agent reads: `AGENTS.md` for Codex and Cursor, or `GEMINI.md` for Gemini CLI.
145
+
146
+ ```bash
147
+ printf '\n## Dependency versions\nNever write a library, GitHub Action, Docker image, database or runtime version from memory. Before writing or editing a manifest, Dockerfile, compose file or workflow, run `freshpin resolve <ecosystem>:<name> ... --format agent` and use the versions it returns. Before finishing, run `freshpin audit . --format agent` and fix every line it reports.\n' >> AGENTS.md
148
+ ```
149
+
150
+
151
+ ### CI
152
+
153
+ Fail the build when something is outdated:
154
+
155
+ ```yaml
156
+ - uses: actions/checkout@v7
157
+ - uses: astral-sh/setup-uv@v10.4.0
158
+ - run: uvx --from git+https://github.com/chetanxrathore/freshpin freshpin audit . --fail-on-outdated
159
+ env:
160
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # optional: freshpin also works without a token
161
+ ```
162
+
163
+ ---
164
+
165
+ ## Usage
166
+
167
+ ### `freshpin resolve`: latest stable versions, live
168
+
169
+ ```text
170
+ $ freshpin resolve pypi:fastapi pypi:pydantic npm:next crates:tokio gha:actions/checkout eol:postgres eol:python eol:node docker:redis
171
+ QUERY LATEST NOTES
172
+ pypi:fastapi 0.165.0
173
+ pypi:pydantic 2.14.4
174
+ npm:next 16.4.6
175
+ crates:tokio 1.54.1
176
+ gha:actions/checkout v7.0.1 uses: actions/checkout@v7
177
+ eol:postgres 19.0 cycle 19 · EOL 2031-11-19 · docker postgres:19
178
+ eol:python 3.15.2 cycle 3.15 · EOL 2031-10-31 · docker python:3.15
179
+ eol:node 26.13.1 cycle 26 LTS · EOL 2029-04-30 · docker node:26
180
+ docker:redis 8.12.0 cycle 8.12 · no EOL date yet · docker redis:8.12
181
+ ```
182
+
183
+ `--format agent` prints compact, low-token output for LLMs. `--json` prints machine-readable output.
184
+
185
+ ```text
186
+ $ freshpin resolve pypi:fastapi gha:actions/checkout eol:postgres --format agent
187
+ pypi:fastapi 0.165.0
188
+ gha:actions/checkout v7.0.1 (uses: actions/checkout@v7)
189
+ eol:postgres 19.0 (cycle 19; EOL 2031-11-19; docker postgres:19)
190
+ ```
191
+
192
+ ### `freshpin audit`: find stale versions in a project
193
+
194
+ ```text
195
+ $ freshpin audit
196
+ LOCATION CURRENT LATEST STATUS ACTION / NOTE
197
+ .github/workflows/ci.yml:5 actions/checkout@v3 v7.0.1 outdated (major) -> actions/checkout@v7
198
+ Dockerfile:1 python:3.10-slim 3.15.2 outdated (minor) -> python:3.15-slim 3.10 is EOL since 2026-10-01
199
+ docker-compose.yml:3 postgres:14 19.0 outdated (major) -> postgres:19 14 is EOL since 2026-11-12
200
+ package.json:4 "react": "^18.2.0" 19.3.1 outdated (major) -> "react": "^19.3.1" constraint excludes the latest release
201
+ pyproject.toml:4 requests>=2.31 2.34.2 ok
202
+ ...
203
+ 12 checked in 5 files: 11 outdated, 1 ok
204
+ ```
205
+
206
+ | Flag | Meaning |
207
+ |---|---|
208
+ | `--format agent` / `--json` | Compact `file:line \| current -> latest` lines for agents, or JSON for tools. |
209
+ | `--fail-on-outdated` | Exit with status 1 if anything is outdated. Use it in CI and hooks. |
210
+ | `--level major\|minor\|patch` | Smallest bump to report. The default is `minor`, so patch-only drift is ignored. |
211
+ | `--ignore NAME` | Skip a dependency by name or glob. Repeatable. |
212
+ | `--exclude GLOB` | Skip paths, e.g. `--exclude 'examples/*'`. Repeatable. |
213
+ | `--all` | Also list skipped declarations, such as git or path dependencies and untracked images. |
214
+ | `--no-floor-check` | Library mode: report only constraints that **exclude** the latest release, not ranges whose lower bound is merely old (`packaging>=20`). |
215
+ | `--no-verify` | Skip the Docker Hub check on suggested image tags. |
216
+ | `--offline` / `--no-cache` / `--ttl 30m` / `--pre` / `--timeout 5` | Lookup behaviour. These also work with `resolve`. |
217
+
218
+ To keep an old version on purpose, add `# freshpin: ignore` on that line in TOML, YAML, Dockerfiles or requirements files.
219
+
220
+ ### The `PostToolUse` hook in action
221
+
222
+ Say Claude writes this `Dockerfile`:
223
+
224
+ ```dockerfile
225
+ FROM python:3.10-slim
226
+ FROM postgres:14-alpine
227
+ ```
228
+
229
+ The hook replies right away and Claude updates the file before moving on:
230
+
231
+ ```json
232
+ {"decision": "block", "reason": "freshpin: 2 outdated of 2 checked - upgrade to the latest stable versions:\nDockerfile:1 | python:3.10-slim -> python:3.15-slim [minor] 3.10 is EOL since 2026-10-01\nDockerfile:2 | postgres:14-alpine -> postgres:19-alpine [major] 14 is EOL since 2026-11-12\nUpdate these to the versions shown before continuing ..."}
233
+ ```
234
+
235
+ How the hook behaves:
236
+
237
+ - It runs after `Write`/`Edit`/`MultiEdit` **and after `Bash`**:
238
+ - Files written by shell commands (`cat > Dockerfile <<EOF`, `tee`, `>`) are audited.
239
+ - So are packages added with `npm install`, `pnpm/yarn/bun add`, `uv/poetry/pdm add` and `cargo add`.
240
+ - Agents write files through the shell more often than you'd think; the agent eval caught exactly that.
241
+ - It runs only on supported files and commands. Everything else returns immediately, before freshpin is even imported.
242
+ - After an `Edit`, it reports only the lines that edit wrote, so a deliberate old pin elsewhere in the file won't nag on every edit.
243
+ - It never breaks the agent loop: any internal error exits 0 silently. Set `FRESHPIN_HOOK_DEBUG=1` to see errors.
244
+ - `FRESHPIN_HOOK=off` disables it. `FRESHPIN_HOOK_MODE=context` adds the warning as context instead of a blocking decision.
245
+
246
+ ---
247
+
248
+ ## Supported ecosystems
249
+
250
+ | Prefix | Source | Notes |
251
+ |---|---|---|
252
+ | `pypi:` | `https://pypi.org/pypi/<pkg>/json` | Stable releases only. Excludes `a`/`b`/`rc`/`dev` and fully yanked releases. |
253
+ | `npm:` | `https://registry.npmjs.org/<pkg>/latest` | Scoped packages work (`npm:@types/node`). Deprecations are reported. |
254
+ | `crates:` | `https://crates.io/api/v1/crates/<crate>` | Uses `max_stable_version`. |
255
+ | `gha:` | `github.com/<owner>/<repo>/releases/latest` and git refs (no API quota); REST API when `GITHUB_TOKEN`/`GH_TOKEN` is set | Each path falls back to the other. Returns the tag and its commit SHA. Works for any GitHub release, not only Actions. |
256
+ | `eol:` | `https://endoflife.date/api/<product>.json` | Accepts any endoflife.date product, plus aliases (`postgres`, `node`, `golang`, `mongo`, `alpine`...). |
257
+ | `docker:` | endoflife.date, by image name | `python`, `node`, `postgres`, `mysql`, `mariadb`, `redis`, `valkey`, `mongo`, `golang`, `rust`, `ruby`, `php`, `ubuntu`, `debian`, `alpine`, `nginx`, `httpd`, `rabbitmq`, `elasticsearch`, `eclipse-temurin`, ... (`freshpin ecosystems` lists them all) |
258
+
259
+ | File | What is checked |
260
+ |---|---|
261
+ | `pyproject.toml` | `[project]` dependencies, optional dependencies, `[dependency-groups]`, `build-system.requires`, `tool.uv.dev-dependencies`, Poetry tables, `requires-python` |
262
+ | `requirements*.txt`, `requirements*.in`, `requirements/*.txt` | Every requirement line, including hash-pinned and continued lines |
263
+ | `package.json` | `dependencies`, `devDependencies`, `optionalDependencies`, `peerDependencies`, `npm:` aliases, `engines.node` |
264
+ | `Cargo.toml` | `[dependencies]`, `[dev-dependencies]`, `[build-dependencies]`, `[workspace.dependencies]`, `[target.*.dependencies]`, `[dependencies.<crate>]`, renamed packages |
265
+ | `.github/workflows/*.yml`, `action.yml` | `uses:` (including SHA pins with a `# vX.Y.Z` comment), `docker://` actions, service and container images, `python-version` / `node-version` / `go-version`, matrices (flags only EOL entries) |
266
+ | `Dockerfile`, `*.Dockerfile`, `Containerfile` | `FROM`, with `ARG` defaults substituted. Build stages and `scratch` are skipped. |
267
+ | `docker-compose*.yml`, `compose*.yaml` | `image:`, including `${VAR:-default}` |
268
+
269
+ ### How "outdated" is decided
270
+
271
+ - **Version constraints** (PEP 440, npm, Cargo, Poetry) are outdated when they **exclude** the latest stable release (`^18.2.0` vs 19.x, `<2`, `==2.28.0`). They are also outdated when they allow it but their floor is a **breaking** release behind (`fastapi>=0.100` while 0.165 is out, `django>=4.2` while 6.x is out). A floor that is only a minor or patch behind, like `requests>=2.31`, is fine.
272
+ - **Runtime floors** (`requires-python`, `engines.node`, Poetry `python`) are outdated when they still target an **end-of-life** release or exclude the current one. The suggestion is the oldest *supported* release.
273
+ - **Pinned images and runtimes** (`python:3.12-slim`, `node-version: 20`) are compared at the precision you wrote (`postgres:18` floats within 18) and are always flagged when **EOL**.
274
+ - **LTS policy:** for products with LTS lines (Node.js, Ubuntu, MySQL, Temurin...) freshpin recommends the newest **LTS** release. Everything else gets the newest supported release.
275
+ - **GitHub Actions** are compared at the tag's precision: `@v4` against the latest major, `@v4.1.1` against the full version.
276
+
277
+ ### Configuration
278
+
279
+ | Variable | Default | |
280
+ |---|---|---|
281
+ | `FRESHPIN_CACHE_DIR` | `$XDG_CACHE_HOME/freshpin` or `~/.cache/freshpin` | Cache location (`cache.json`). |
282
+ | `FRESHPIN_CACHE_TTL` | `6h` | How long results stay fresh, e.g. `30m`, `1d`. Expired entries are still used as an offline fallback. |
283
+ | `GITHUB_TOKEN` / `GH_TOKEN` | unset | Optional. When set, freshpin asks the GitHub REST API first; without it, it uses the token-free web and git endpoints. |
284
+ | `FRESHPIN_OFFLINE` | unset | Hook only: use cached data and never touch the network. |
285
+ | `FRESHPIN_HOOK`, `FRESHPIN_HOOK_MODE`, `FRESHPIN_HOOK_TIMEOUT`, `FRESHPIN_HOOK_DEBUG` | | Hook controls, described above. |
286
+ | `NO_COLOR` | unset | Disable coloured table output. |
287
+
288
+ `freshpin cache-clear` empties the cache. `freshpin ecosystems` lists every prefix, alias and tracked Docker image.
289
+
290
+ **Exit codes:** `0` OK · `1` outdated found (with `--fail-on-outdated`) or a `resolve` lookup failed · `2` usage error.
291
+
292
+ ---
293
+
294
+ ## How freshpin compares
295
+
296
+ | | Fixes stale versions **while the agent writes** | Packages | GitHub Actions | Docker images | EOL runtimes / DBs | Token or account needed |
297
+ |---|---|---|---|---|---|---|
298
+ | **freshpin** | ✅ PostToolUse hook + skill | PyPI, npm, crates.io | ✅ (incl. SHA pins) | ✅ verified tags | ✅ LTS-aware | No |
299
+ | Renovate / Dependabot | ❌ PRs after the commit | many | ✅ | ✅ | partial | Bot setup |
300
+ | npm-check-updates, taze, pur, `uv tree --outdated` | ❌ manual CLI | one each | taze only | ❌ | ❌ | No |
301
+ | Version MCP servers (e.g. package-version-check-mcp) | only if the model calls them | many | some | some | ❌ | No |
302
+ | Security MCPs (Snyk, Socket, Sonatype, Endor) | advisory, security-focused | many | ❌ | partial | ❌ | Yes |
303
+ | pinact / actions-up | ❌ manual or CI | ❌ | ✅ | ❌ | ❌ | No |
304
+
305
+ The full landscape study is in [docs/RESEARCH.md](docs/RESEARCH.md), and what comes next is in [ROADMAP.md](ROADMAP.md).
306
+
307
+ ## Development
308
+
309
+ ```bash
310
+ uv sync
311
+ ```
312
+
313
+ ```bash
314
+ uv run ruff check src tests hooks
315
+ ```
316
+
317
+ ```bash
318
+ uv run mypy --strict src/freshpin
319
+ ```
320
+
321
+ ```bash
322
+ uv run pytest -v
323
+ ```
324
+
325
+ The test suite mocks every network call, so it is fast, deterministic and works offline. Two live harnesses back it up:
326
+
327
+ - `validation/accuracy.py` checks freshpin's answers against independent sources.
328
+ - `validation/corpus.py` audits popular open-source repositories.
329
+
330
+ [`evals/`](evals/) holds the `claude plugin eval` A/B suite. See [CONTRIBUTING.md](CONTRIBUTING.md) for adding a registry or an auditor.
331
+
332
+ ## License
333
+
334
+ [MIT](LICENSE-MIT)