diff --git a/.github/ISSUE_TEMPLATE/bug.md b/.github/ISSUE_TEMPLATE/bug.md new file mode 100644 index 0000000..54ce79f --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug.md @@ -0,0 +1,17 @@ +--- +name: Bug +about: tend did something wrong or nothing at all +labels: bug +--- + +**What happened** + + + +**What you expected** + +**Project** + +- Ecosystem(s): +- tend version (`tend version`): +- Ran locally or on GitHub Actions: diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml new file mode 100644 index 0000000..0086358 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -0,0 +1 @@ +blank_issues_enabled: true diff --git a/.github/ISSUE_TEMPLATE/ecosystem.md b/.github/ISSUE_TEMPLATE/ecosystem.md new file mode 100644 index 0000000..86161de --- /dev/null +++ b/.github/ISSUE_TEMPLATE/ecosystem.md @@ -0,0 +1,15 @@ +--- +name: Ecosystem or API +about: Ask tend to watch something it does not yet +labels: ecosystem +--- + +**What to watch** + + + +**Where versions live** + + + +**A public repo that uses it** diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md new file mode 100644 index 0000000..e715c3e --- /dev/null +++ b/.github/pull_request_template.md @@ -0,0 +1,14 @@ +## What + + + +## Why + + + +## How I checked + + + +- [ ] `make lint` and `make test` pass +- [ ] New behavior has a test diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a2ed77e..e52d8d5 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,8 +1,6 @@ name: ci on: - push: - branches: [main] pull_request: permissions: @@ -25,4 +23,3 @@ jobs: run: test -z "$(gofmt -l .)" || { gofmt -l .; exit 1; } - run: go vet ./... - run: go test -race ./... - - run: go test ./internal/e2e -count=1 diff --git a/.github/workflows/tend.yml b/.github/workflows/tend.yml index 7685608..4590fc8 100644 --- a/.github/workflows/tend.yml +++ b/.github/workflows/tend.yml @@ -2,7 +2,7 @@ name: tend on: schedule: - - cron: "17 6 * * *" + - cron: "17 6 * * 1" workflow_dispatch: permissions: diff --git a/README.md b/README.md index f49da25..0d9c27e 100644 --- a/README.md +++ b/README.md @@ -1,31 +1,37 @@ # tend -Dependabot for breaking API changes, with proof. +A plugin that keeps your project's dependencies and APIs current through +GitHub Actions, one tested PR at a time. tend watches the packages your project depends on and the external APIs it -calls. When something changes in a way that matters to your code, it fixes it, -runs your own build and tests on the fix, checks its own patch, and opens one -pull request with the evidence in the body. When an update touches nothing, it -stays quiet. +calls. When something changes in a way that matters to your code, it fixes +the code, runs your own build and tests on the fix, and opens one pull request +with the evidence. When an update touches nothing, it stays quiet. -``` -$ tend check -tend: 4 queued, 9 skipped, no open PR - - 1 security golang.org/x/mod v0.33.0 → v0.40.0 GO-2026-6179 · 43 sites - 2 breaking billing API GET /v1/orders field total_cents removed · 2 sites - 3 deprecation node (Dockerfile) 16-alpine → 24-alpine EOL 2023-09-11 · 2 sites - 4 deprecation @acme/pay 1.4.0 → 2.0.0 2 sites +## Add it to your project -skipped: 8 noise, 1 cooldown (tend check --all) +1. Add [.github/workflows/tend.yml](docs/github-actions.md#the-workflow) to + your repository, or run `tend init --ci` to write it. +2. Under Settings > Actions > General, turn on "Allow GitHub Actions to create + and approve pull requests". +3. Optional: to let tend migrate code no codemod covers, add a model to + `tend.yml` and its key as the `TEND_MODEL_KEY` secret. -$ tend run -tend: opened #12 Bump golang.org/x/mod to v0.40.0 (fixes GO-2026-6179 +1 more) https://github.com/acme/shop/pull/12 +```yaml +# tend.yml +model: groq/openai/gpt-oss-120b ``` -The pull request says what changed upstream, which lines of your code it -touched, what ran on the base commit and on the patched tree, and what the -self-review checked. An excerpt: +Merge the workflow and tend runs once right away. Its first pull request is a +tidy-up with a short welcome: it removes dependencies nothing in the project +uses and moves the code off deprecated libraries, proven by your own tests. +After that, tend runs on a schedule and opens one PR at a time, only for +changes that touch your code. + +## What a pull request looks like + +Each PR says what changed upstream, which lines of your code it touched, what +ran on the base commit and on the fix, and what tend checked in its own patch: ```markdown ### Proof @@ -41,219 +47,72 @@ self-review checked. An excerpt: - symbols: every changed call resolves in the new version ``` -[docs/pr-anatomy.md](docs/pr-anatomy.md) walks through a whole PR body. - -## Quick start - -```sh -go install github.com/mohsensc/tend-cli/cmd/tend@latest -cd your-project -tend check # the queue, most important first; changes nothing -tend run --dry-run # work the top change and print its PR instead of sending it -tend run # open the PR; needs GITHUB_TOKEN or `gh auth login` -``` - -The first PR on a repo is a tidy-up with a short welcome: it removes the -dependencies nothing in the project uses and moves the code off deprecated -libraries, proven by your own build and tests like every tend PR, and lists -what only looks unused for you to decide. A repo with nothing to tidy gets a -PR that adds a commented `tend.yml`. After that, tend opens one PR at a time, -only for changes that touch your code. `onboarding: quiet` in `tend.yml` -skips the first PR; [docs/pr-anatomy.md](docs/pr-anatomy.md#the-first-pull-request) -shows one. `tend init` writes `tend.yml` and offers to run tend right away -(`--now` runs it without asking). - -Without Go, download the archive for your platform from -[Releases](https://github.com/mohsensc/tend-cli/releases) and check it -against `checksums.txt`; [docs/self-update.md](docs/self-update.md) shows how -to check the signature too. - -To run it daily on GitHub, `tend init --ci` writes this workflow (the cron -follows `schedule` in `tend.yml`). It also runs once when the workflow file -lands on your default branch, so adding tend starts the first run at once: - -```yaml -name: tend -on: - push: - branches: ["main"] - paths: [.github/workflows/tend.yml] - schedule: [{cron: "17 6 * * *"}] - workflow_dispatch: -permissions: {contents: write, pull-requests: write} -concurrency: {group: tend, cancel-in-progress: false} -jobs: - tend: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v7 - with: {persist-credentials: false} - - uses: mohsensc/tend-cli@v1 - with: {model-key: "${{ secrets.TEND_MODEL_KEY }}"} -``` - -The `model-key` line is only needed if you configure a model. Turn on "Allow -GitHub Actions to create and approve pull requests" under Settings > Actions > -General, or GitHub refuses the PR. The default `GITHUB_TOKEN` has two more -limits: PRs it opens do not start your other workflows, so your CI and -auto-merge never run on them, and it cannot push changes to -`.github/workflows`, so Action bumps fail. Pass a fine-grained token with the -workflows permission, or a GitHub App token from -`actions/create-github-app-token`, as `token:` to lift both. The other inputs -are `command` (`run` or `check`), `args`, `config` and `version`. +[docs/pr-anatomy.md](docs/pr-anatomy.md) walks through a whole PR, including +the first one. ## What it watches -- Packages in every ecosystem it finds: npm, pnpm and yarn, Go modules, pip, - poetry and uv, Maven, Gradle, Cargo, RubyGems, Composer and NuGet. +- Packages: npm, pnpm and yarn, Go modules, pip, poetry and uv, Maven, + Gradle, Cargo, RubyGems, Composer and NuGet. - Docker base images, GitHub Actions, Terraform providers and modules, and Helm charts. -- Runtime pins (`.nvmrc`, `.python-version`, `.tool-versions`, `go.mod`) and - the oldest runtime the project says it supports, as release lines reach end - of life. +- Runtime pins (`.nvmrc`, `.python-version`, `.tool-versions`, `go.mod`) as + release lines reach end of life. - External APIs, called through an SDK or by raw HTTP, matched against the provider's OpenAPI document or changelog. -- The deprecation warnings your runtime prints while your tests run. +- Deprecation warnings your runtime prints while your tests run. - Anything else, through a `deps` entry in `tend.yml`. -What it finds and cannot follow is listed under `untracked` by `tend check`, -with the `tend.yml` lines that would fix it; [limitations](docs/limitations.md) -has the exact rule for API hosts. - ## How it decides -- A security fix, a deprecation and a breaking change to something your code - uses get a pull request. Breaking means a removed endpoint, field or - parameter, or a release whose number or notes say it breaks a symbol you - call. -- A bump that touches none of that is recorded in local state and shown by - `tend check --all`. `updates: {major: true, minor: true, patch: true}` turns - on plain bump PRs. -- Releases younger than `cooldown` (3 days) wait. Security fixes, - deprecations and API changes do not. -- Anything an `ignore` entry matches, and any change whose PR you closed, is - left alone until a newer target exists. A PR a bot closed does not count: - only a person closing it, or `tend skip`, says no. -- tend never has more than one PR open, and that PR holds the whole change: - manifest, lockfile, every call site, config and the tests that had to move. - Re-running updates it. The next change waits until it is merged or closed. - -The queue runs security first, then API changes that break your code, then -deprecations, then breaking releases, then the rest. A security fix that shows -up while another PR is open takes its place, and the other change comes back -after it merges. - -When there is no single replacement for something deprecated, tend opens a PR -that changes nothing and lists the options with their trade-offs; staying put -is always one. Comment `tend apply 2` and the next run applies option 2, -proves it and updates the PR. `tend skip` closes the PR and leaves that -release alone, and `tend retry` does the change again, once. +- Security fixes, deprecations, and breaking changes to something your code + uses get a PR. Plain version bumps do not, unless you turn them on. +- There is never more than one tend PR open, and it holds the whole change: + manifest, lockfile, every call site, and the tests that had to move. +- Security comes first, then API changes that break your code, then + deprecations, then breaking releases. +- When there is no single replacement, the PR changes nothing and lists the + options. Comment `tend apply 2` to pick one, `tend skip` to say no, or + `tend retry` to try again. +- Releases younger than three days wait, except security fixes, deprecations + and API changes. ## Configuration -No config is needed. `tend init` writes a `tend.yml` with every key at its -default and commented out, and [docs/config.md](docs/config.md) describes each -one. A typical file is a few lines: +No config is needed. A typical `tend.yml` is a few lines: ```yaml +schedule: 7d cooldown: 7d ignore: - {name: "@types/*"} -model: groq/openai/gpt-oss-120b deliver: {automerge: security} ``` -| key | default | what it sets | -|---|---|---| -| `base` | the repo's default branch | the branch PRs target | -| `cooldown` | `3d` | how old a release must be before tend takes it | -| `schedule` | `1d` | how often `watch` runs, and the cron `init --ci` writes | -| `onboarding` | `pr` | the first run's tidy-up PR: `pr`, `quiet` (no PR) or `off` | -| `ecosystems` | all | the only ecosystems tend reads | -| `updates` | security and deprecations on, plain bumps off | which changes get a PR | -| `ignore` | nothing | packages, versions or APIs to leave alone | -| `groups` | same source repo | packages that move together in one PR | -| `apis` | the built-in catalog | more API providers: hosts, spec, changelog | -| `deps` | nothing | versions written where no ecosystem looks | -| `model` | `none` | the provider for migrations no codemod covers | -| `verify` | detected per ecosystem | install, build and test commands, timeout, container, env | -| `deliver` | `mode: pr` | PR or commit, labels, draft, automerge, reviewers | - -## Proof and vetting - -The fix is made in a git worktree of the base commit under tend's state -directory; your checkout and index are never touched. tend runs the project's -own install, build and test commands on the base commit and on the patched -tree, with tokens and secrets removed from their environment, and the PR shows -both. A patch is proven when its run passes, or when it stops at the very step -where the base already stops; that PR opens as a draft and says why. Set -`verify.container` to an image and every command runs through `docker run` -with only the worktree mounted. +[docs/config.md](docs/config.md) describes every key. `deliver: {mode: commit}` +commits to the branch instead of opening PRs. -Before anything is pushed, the patch goes through vetting, a skeptical pass -that asks short questions and reports only what it checked. Does every changed -call exist in the new version? Does every field the patch reads exist in the -spec? Is the old symbol still used anywhere? Did the lockfile move more than -the bump needs? Was debug output or a comment added? Is anything now -unreferenced? Does the diff touch only files this change explains? Each -finding is fixed, dropped, or flagged in the PR, and a flag makes the PR a -draft. A patch that vetting changed is proven again. - -## Self-update - -Every release carries `checksums.txt` and an ed25519 signature over it, and -the public key is compiled into the binary. `tend update` checks the -signature, then the archive's checksum, then replaces itself; any mismatch -changes nothing. `run` and `watch` print one line when a newer release exists -and never update on their own. The Action verifies the same way before it puts -the binary on the path. `@v1` moves to the newest `v1.x.y`; pin `@v1.2.3` to -stay put. tend runs daily on its own repository. - -## Commands - -``` -tend check [--json] [--all] [--fail-on security|breaking|deprecation|any] [--reset] -tend run [--dry-run] [--json] [--keep] -tend watch [--every 6h] -tend init [--ci] [--force] [--now] -tend update [--check] -tend version [--check] - -global: -C