diff --git a/.github/workflows/documentation.yml b/.github/workflows/documentation.yml index 636b3d9..20ce68a 100644 --- a/.github/workflows/documentation.yml +++ b/.github/workflows/documentation.yml @@ -1,6 +1,9 @@ name: Deploy Documentation on: + pull_request: + branches: + - main push: branches: - main @@ -13,25 +16,27 @@ on: # Queue deploys instead of overlapping them, and retry once if Pages is still # finishing the previous deployment after this workflow starts. concurrency: - group: pages + group: ${{ github.event_name == 'pull_request' && format('pages-pr-{0}', github.event.pull_request.number) || 'pages' }} cancel-in-progress: false permissions: contents: read - pages: write - id-token: write jobs: - deploy: + build: + name: Build documentation runs-on: ubuntu-latest - environment: - name: github-pages - url: ${{ steps.deployment.outputs.page_url || steps.deployment_retry.outputs.page_url }} + permissions: + contents: read + pages: read steps: - name: Checkout repository uses: actions/checkout@v4 + with: + persist-credentials: false - name: Setup Pages + if: github.repository == '255BITS/patchling-py' && github.ref == 'refs/heads/main' && github.event_name != 'pull_request' uses: actions/configure-pages@v6 - name: Set up Python @@ -45,14 +50,28 @@ jobs: - name: Build site run: mkdocs build --strict --site-dir public - - name: Ensure CNAME is set - run: echo "gptdiff.255labs.xyz" > public/CNAME + - name: Record the site domain and source revision + run: | + printf '%s\n' 'gptdiff.255labs.xyz' > public/CNAME + printf '{"revision":"%s"}\n' "$(git rev-parse HEAD)" > public/pages-revision.json - name: Upload artifact + if: github.repository == '255BITS/patchling-py' && github.ref == 'refs/heads/main' && github.event_name != 'pull_request' uses: actions/upload-pages-artifact@v5 with: path: public + deploy: + if: github.repository == '255BITS/patchling-py' && github.ref == 'refs/heads/main' && github.event_name != 'pull_request' + needs: build + runs-on: ubuntu-latest + permissions: + pages: write + id-token: write + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url || steps.deployment_retry.outputs.page_url }} + steps: - name: Deploy to GitHub Pages id: deployment uses: actions/deploy-pages@v5 @@ -66,3 +85,18 @@ jobs: id: deployment_retry if: steps.deployment.outcome == 'failure' uses: actions/deploy-pages@v5 + + - name: Verify the public documentation revision + shell: bash + run: | + url="https://gptdiff.255labs.xyz/pages-revision.json" + for attempt in {1..12}; do + if revision=$(curl --silent --show-error --fail --location --max-time 10 \ + "$url?revision=$GITHUB_SHA&attempt=$attempt" | jq -er '.revision') && [[ "$revision" == "$GITHUB_SHA" ]]; then + printf 'Public documentation serves %s\n' "$revision" + exit 0 + fi + sleep 5 + done + printf 'Public documentation did not confirm revision %s\n' "$GITHUB_SHA" >&2 + exit 1 diff --git a/docs/cli.md b/docs/cli.md index 6f8f0e2..dff5678 100644 --- a/docs/cli.md +++ b/docs/cli.md @@ -82,7 +82,7 @@ patchling "Update config system" config/ utils/config_loader.py `--nowarn`: Disable the warning and confirmation prompt for large token usage `--verbose`: Enable verbose output for detailed information during execution -With `--apply`, a failed file application or an empty/invalid generated diff +Starting in 0.9.5, with `--apply`, a failed file application or an empty/invalid generated diff produces exit status `1`; successful application produces `0`. Files are processed independently, so successful changes may remain after another file fails. The summary lists the failed paths and reasons. Inspect those changes diff --git a/docs/installation.md b/docs/installation.md index 9430bde..cc41955 100644 --- a/docs/installation.md +++ b/docs/installation.md @@ -7,16 +7,18 @@ ## Install via pip -To install `patchling` from PyPI, run the following command: +Install the latest published version from PyPI: ```bash -pip install patchling -pip install tiktoken # For token counting +python -m pip install patchling ``` -## Development Installation (if no pip package is available yet) +The [PyPI release history](https://pypi.org/project/patchling/#history) lists +which versions `pip` can install by version number. -If the `patchling` package is not yet available on PyPI, you can install it from the source code: +## Install from source + +Use an editable checkout to develop Patchling or try changes ahead of PyPI: ```bash git clone https://github.com/255BITS/patchling-py.git @@ -24,7 +26,8 @@ cd patchling-py python -m pip install -e '.[test]' ``` -Package metadata lives in `pyproject.toml`. The version is read from `patchling.__version__` (currently 0.8.1). `setup.py` is only a shim for older install commands. +Package metadata lives in `pyproject.toml`. The version is read from +`patchling.__version__`. `setup.py` supports older install commands. ## Configuration @@ -76,4 +79,4 @@ Real users have run overnight loops that expanded test coverage from 18 to 127 t **Next steps:** - [Quickstart Guide](quickstart.md) - Make your first change -- [Agent Loops Guide](examples/automation.md) - Set up autonomous improvement \ No newline at end of file +- [Agent Loops Guide](examples/automation.md) - Set up autonomous improvement diff --git a/docs/patchling-apply.md b/docs/patchling-apply.md index 3ba1145..50786fc 100644 --- a/docs/patchling-apply.md +++ b/docs/patchling-apply.md @@ -29,7 +29,7 @@ patchling-apply path/to/diff.patch ## Options - **--project-dir**: Specify the target directory for applying the diff (default: current directory) -- **--model**: (Optional) Specify the model used to apply the diff. This overrides `GPTDIFF_SMARTAPPLY_MODEL`; when neither is set, the default is `openai/gpt-4.1-mini`. +- **--model**: (Optional) Starting in 0.9.5, selects the model used to apply the diff. This overrides `GPTDIFF_SMARTAPPLY_MODEL`. The default is `openai/gpt-4.1-mini`. - **--max_tokens**: (Optional) Maximum tokens to use for LLM responses - **--nobeep**: Disable the completion beep notification - **--dumb**: Attempt to apply the diff using standard patch logic (like git apply) before falling back to smart apply @@ -40,7 +40,7 @@ By default, patchling-apply uses an AI-powered smart apply mechanism to apply th ## Exit status and recovery -The command exits with status `0` when every file succeeds. Deleting a file +Starting in 0.9.5, the command exits with status `0` when every file succeeds. Deleting a file that is already absent is a successful no-op. An empty or invalid diff, an unsafe path, a model refusal or empty response, and a filesystem failure produce status `1`.