Skip to content

greenproof 0.2.0

Choose a tag to compare

@technobasant technobasant released this 02 Nov 01:27
· 264 commits to main since this release

OpenCode 2.x support, one plugin for Claude Code, Codex and Cursor, one decision per stop when the gate is installed twice, and greenproof check inside sandboxes that cannot write .git.

Install: uvx greenproof@0.2.0 --version or pipx install greenproof==0.2.0 (PyPI).

Added

  • A plugin for Claude Code, Codex and Cursor (plugins/greenproof) that installs the Stop
    and SessionStart hooks without running greenproof init, with a marketplace file for each
    agent (.claude-plugin/, .agents/plugins/, .cursor-plugin/). Each manifest names its
    own hooks file, so no agent loads another's. The hooks run uvx greenproof@<version>,
    pinned to the release; the plugin also carries a skill that tells the agent how to answer
    a block.
  • scripts/bump_version.py X.Y.Z, which sets the version in _version.py, the manifests and
    every pinned command in the plugin, and tests/test_plugins.py, which fails when any of
    them differs from __version__ and checks each manifest against its vendor's format.
  • scripts/make_icon.py, the standard-library script that draws the plugin icon.
  • An OpenCode 2.x plugin (integrations/opencode, package opencode-greenproof, also
    packaged inside greenproof): on a top-level session going idle it runs
    greenproof check --hook opencode and continues the same run with ctx.session.synthetic
    on a block; a release is a console warning and every failure fails open. It starts a
    session on the first prompt of a top-level session (the prompt hook), skips subagent
    sessions, runs one check per session at a time and gives way to a second copy loaded in the
    same process. Plain ES module with only node: imports; 2.x only.
  • greenproof init --agents opencode writes .opencode/plugins/greenproof.js with the hook
    command set. The file is replaced only when its first line says greenproof wrote it; any
    other file there is a usage error (exit 4) and nothing is written. --agents auto also
    installs it when .opencode/, opencode.json or opencode.jsonc exists.
  • A CI job that runs node --test on the plugin (actions/setup-node pinned to a commit) and
    checks that npm pack lists only index.js, README.md, LICENSE and package.json.
  • scripts/e2e/opencode.py, an end-to-end run of the plugin in the real OpenCode CLI against
    a fake OpenAI-compatible model server (--self-test checks only the server). It is not
    part of pytest.
  • scripts/bump_version.py also sets the npm package's version and the command pinned in
    its copy of the plugin.
  • check --hook opencode and session-start --hook opencode, for the OpenCode plugin: the
    payload carries session_id and cwd, and the output is Codex's protocol (block, pass,
    release) and Claude Code's session-start output.
  • Duplicate hooks for one stop. The gate can be installed twice (a plugin and the hooks
    init writes), and the agent then runs both in parallel. Everything after repository
    discovery runs under an exclusive lock on <git-dir>/greenproof/hook.lock, the hook state
    records the payload's fingerprint (a sha256 of the sorted, compact payload), the decision
    and the block message, and a second hook for the same stop (same payload, same tree)
    outputs that decision again (at most three replays) instead of finding the first one's
    block and releasing the agent.
    When the lock file cannot be opened, the hook runs without the lock.
  • fork in the SessionStart matchers of the Claude Code and Codex CLI hooks init writes.
    Both agents document it as a source; the session marker is kept, as for resume.

Fixed

  • greenproof check in local mode no longer exits 4 when the git directory is read-only, as
    in an agent sandbox that lets the agent write the working tree but not .git (Codex's
    workspace-write): git add -A could not store the snapshot's objects. When the snapshot
    fails and a probe file cannot be created in the object directory, greenproof retries with
    a temporary object directory (GIT_OBJECT_DIRECTORY, with the repository's objects as
    GIT_ALTERNATE_OBJECT_DIRECTORIES) for every git command of the run, deletes it on exit
    and writes nothing under the git directory, so no pass is cached. The revert check is
    skipped with a note, --isolate exits 4, and the report carries a note. Hook and CI mode
    still fail closed on a git failure.

Changed

  • A pass is now recorded in the hook state instead of clearing it, so a duplicate hook for
    the same stop can replay it. Nothing to verify still clears the state. A state file
    written by 0.1.0 is read as a block with no fingerprint.
  • suppress.added applies each generic pattern only where it has an effect. || true,
    ; true, set +e and the git --no-verify pattern fire in shell-capable files (scripts,
    makefiles, justfiles, CI and container files, package.json, pyproject.toml,
    tox.ini, setup.cfg, .husky/ and .githooks/), and --passWithNoTests also in
    JavaScript and TypeScript. They no longer fire in .toml case files, .json data,
    prose or source files of other languages.
  • The README says that uvx hook commands need uv on PATH.

Full changelog: v0.1.0...v0.2.0