Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
d1cd268
Honour CLAUDE_CONFIG_DIR for Claude's state directory
frenchie4111 Nov 17, 2026
e5be892
Rust build of loch, starting with the hook, and an equivalence harness
frenchie4111 Nov 17, 2026
8fabb12
Rust stop hook writes to S3 too, checked against moto with IAM auth on
frenchie4111 Nov 17, 2026
baebba3
npm packaging sketch for the Rust build, and CLAUDE.md for all of it
frenchie4111 Nov 17, 2026
0dfee97
CLAUDE.md: don't point at a conversation for the squash design
frenchie4111 Nov 17, 2026
3dc9c1a
Bundle refs no longer depend on the Python version or platform
frenchie4111 Nov 17, 2026
47a12d7
An undecodable transcript no longer takes down list, or save
frenchie4111 Nov 17, 2026
84659be
Port every command to Rust (harness coverage for the new ones follows)
frenchie4111 Nov 17, 2026
d5e937d
Hold every command to the reference, and make save reproducible
frenchie4111 Nov 17, 2026
441f778
Linear-time redaction in the Rust build, and a corpus check for every…
frenchie4111 Nov 18, 2026
a887781
S3 commands held to the reference too; CLAUDE.md for the full port
frenchie4111 Nov 18, 2026
3a05855
README: the native build and how to check it against the Python
frenchie4111 Nov 18, 2026
53387b8
Move the crate to the repository root and split it into lib and bin
frenchie4111 Nov 18, 2026
e8640f5
CI and releases for the binary alone
frenchie4111 Nov 18, 2026
10535cd
Delete the Python; its tests survive as Rust integration tests
frenchie4111 Nov 18, 2026
5b60d9d
Attribute lines to turns by content, and stop writing to git
frenchie4111 Nov 18, 2026
b1e08bb
Close every turn, and collect the snapshots nothing needs
frenchie4111 Nov 19, 2026
4d95998
Backfill attribution from transcripts and commits, and follow renames
frenchie4111 Nov 19, 2026
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
18 changes: 8 additions & 10 deletions .claude/settings.json
Original file line number Diff line number Diff line change
@@ -1,33 +1,31 @@
{
"hooks": {
"PreToolUse": [
"Stop": [
{
"hooks": [
{
"type": "command",
"command": "loch hook pre-tool 2>/dev/null || true"
"command": "loch hook stop 2>/dev/null || true"
}
],
"matcher": "Bash"
]
}
],
"PostToolUse": [
"UserPromptSubmit": [
{
"hooks": [
{
"type": "command",
"command": "loch hook post-tool 2>/dev/null || true"
"command": "loch hook prompt 2>/dev/null || true"
}
],
"matcher": "Bash"
]
}
],
"Stop": [
"SessionEnd": [
{
"hooks": [
{
"type": "command",
"command": "loch hook stop 2>/dev/null || true"
"command": "loch hook end 2>/dev/null || true"
}
]
}
Expand Down
101 changes: 80 additions & 21 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,49 +1,108 @@
name: release

# A tag builds every platform's binary, attaches them to a GitHub release and
# assembles the npm packages beside them. Run by hand (workflow_dispatch) it
# does everything but publish, which is how to rehearse a release.
on:
push:
tags: ["v*"]
workflow_dispatch:

jobs:
test:
uses: ./.github/workflows/test.yml

release:
build:
needs: test
runs-on: ubuntu-latest
permissions:
contents: write
strategy:
fail-fast: false
matrix:
include:
- { target: aarch64-apple-darwin, os: macos-latest }
- { target: x86_64-apple-darwin, os: macos-latest }
# musl, statically linked: one binary per architecture runs on any
# distribution, glibc or not, which is why npm has no -musl packages.
- { target: x86_64-unknown-linux-musl, os: ubuntu-latest, musl: true }
- { target: aarch64-unknown-linux-musl, os: ubuntu-24.04-arm, musl: true }
- { target: x86_64-pc-windows-msvc, os: windows-latest }
- { target: aarch64-pc-windows-msvc, os: windows-11-arm }
runs-on: ${{ matrix.os }}
defaults:
run:
shell: bash

steps:
- uses: actions/checkout@v7
# setup-uv stopped publishing floating major tags after v7, so `@v10`
# resolves to nothing — it has to be a full version.
- uses: astral-sh/setup-uv@v10.0.1

# A mismatch would publish v0.2.0 as an asset named loch-0.1.0, and the
# A mismatch would publish v0.2.0 as assets named after 0.1.0, and the
# install path is a pinned asset URL, so it is not something to discover
# afterwards.
- name: Check the tag against the packaged version
- name: Check the tag against the crate version
if: startsWith(github.ref, 'refs/tags/')
run: |
packaged=$(python3 -c 'import pathlib, tomllib; print(tomllib.loads(pathlib.Path("pyproject.toml").read_text())["project"]["version"])')
packaged=$(sed -n 's/^version = "\(.*\)"$/\1/p' Cargo.toml | head -1)
if [ "${GITHUB_REF_NAME#v}" != "$packaged" ]; then
echo "tag ${GITHUB_REF_NAME} does not match pyproject version ${packaged}" >&2
echo "tag ${GITHUB_REF_NAME} does not match Cargo.toml version ${packaged}" >&2
exit 1
fi

# py3-none-any, so one build serves every platform and there is no
# matrix here. The build is byte-reproducible; keep it that way.
- run: uv build
# ring compiles C, and a static musl build needs musl's own compiler.
- if: matrix.musl
run: sudo apt-get update && sudo apt-get install -y musl-tools
- run: rustup target add ${{ matrix.target }}
- run: cargo build --release --locked --target ${{ matrix.target }}

- name: Check a Linux binary really is static
if: matrix.musl
run: file target/${{ matrix.target }}/release/loch | grep -q "statically linked"

- name: Package
run: |
version=$(sed -n 's/^version = "\(.*\)"$/\1/p' Cargo.toml | head -1)
name=loch-$version-${{ matrix.target }}
mkdir -p "dist/$name"
bin=loch; [[ "${{ matrix.target }}" == *windows* ]] && bin=loch.exe
cp "target/${{ matrix.target }}/release/$bin" "dist/$name/"
cp LICENSE README.md "dist/$name/"
(cd dist && tar czf "$name.tar.gz" "$name")
echo "ASSET=dist/$name.tar.gz" >> "$GITHUB_ENV"

- uses: actions/upload-artifact@v4
with:
name: loch-${{ matrix.target }}
path: ${{ env.ASSET }}

- name: Check the wheel installs and runs
publish:
needs: build
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v7
- uses: actions/download-artifact@v4
with:
path: artifacts
merge-multiple: true

- name: Assemble the npm packages
run: |
python3 -m venv /tmp/smoke
/tmp/smoke/bin/pip install --quiet dist/*.whl
test "$(/tmp/smoke/bin/loch --version)" = "loch ${GITHUB_REF_NAME#v}"
version=$(sed -n 's/^version = "\(.*\)"$/\1/p' Cargo.toml | head -1)
args=()
for archive in artifacts/*.tar.gz; do
target=$(basename "$archive" .tar.gz); target=${target#loch-$version-}
mkdir -p "unpacked/$target"
tar xzf "$archive" -C "unpacked/$target" --strip-components 1
args+=("$target=$(ls "unpacked/$target"/loch*)")
done
node npm/assemble.mjs "$version" npm-dist "${args[@]}"
for pkg in npm-dist/@ness-dev/*; do (cd "$pkg" && npm pack --pack-destination "$GITHUB_WORKSPACE/artifacts"); done

- run: (cd artifacts && sha256sum * > SHA256SUMS)

# Both artifacts: the wheel is what `uv tool install` points at, the
# sdist is what anyone building from source needs.
# Rehearsals stop here, with everything built and checked. Publishing to
# npm needs the @ness-dev org and a token, and is not wired up yet.
- name: Publish the release
if: startsWith(github.ref, 'refs/tags/')
env:
GH_TOKEN: ${{ github.token }}
run: gh release create "$GITHUB_REF_NAME" dist/* --generate-notes
run: gh release create "$GITHUB_REF_NAME" artifacts/* --generate-notes
32 changes: 11 additions & 21 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: test

on:
# Tags are excluded because the release workflow calls this one, and a tag
# push would otherwise run the whole matrix twice.
# push would otherwise run it twice.
push:
tags-ignore: ["**"]
pull_request:
Expand All @@ -14,29 +14,19 @@ concurrency:

jobs:
test:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
# The floor and the ceiling of the supported range, where breakage
# appears; 3.12 is what development happens on.
python: ["3.10", "3.12", "3.13"]
# Linux and macOS because the hooks' native git fast path is Unix-only
# and its filesystem details (realpath, ownership) differ between them.
os: [ubuntu-latest, macos-latest]
runs-on: ${{ matrix.os }}

steps:
- uses: actions/checkout@v7

- uses: actions/setup-python@v7
with:
python-version: ${{ matrix.python }}

- run: pipx install poetry

# Poetry otherwise builds the environment against its own interpreter
# rather than the one this matrix leg is for.
- run: poetry env use python
- run: poetry install

- run: poetry run ruff check
- run: poetry run ruff format --check
- run: poetry run mypy .
- run: poetry run pytest
# rustup ships on both runner images and installs the version
# rust-toolchain.toml pins on first use; this makes that explicit.
- run: rustup show active-toolchain || rustup toolchain install
- run: cargo fmt --check
- run: cargo clippy --release --all-targets --locked -- -D warnings
- run: cargo test --release --locked
14 changes: 5 additions & 9 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
.venv/
__pycache__/
*.pyc
.mypy_cache/
.ruff_cache/
.pytest_cache/
dist/
*.loch
!test/fixtures/*.loch
target/
.DS_Store
.claude/settings.local.json
*.loch
# Python tooling a contributor might still run beside the repo.
__pycache__/
.venv/
Loading
Loading