Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 43 additions & 9 deletions .github/workflows/documentation.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
name: Deploy Documentation

on:
pull_request:
branches:
- main
push:
branches:
- main
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
2 changes: 1 addition & 1 deletion docs/cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
17 changes: 10 additions & 7 deletions docs/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,24 +7,27 @@

## 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
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

Expand Down Expand Up @@ -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
- [Agent Loops Guide](examples/automation.md) - Set up autonomous improvement
4 changes: 2 additions & 2 deletions docs/patchling-apply.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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`.
Expand Down
Loading