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
4 changes: 2 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ members = ["crates/core", "crates/cli"]
resolver = "2"

[workspace.package]
version = "0.1.1"
version = "0.2.0"
edition = "2024"
license = "MIT"
repository = "https://github.com/pickforge/complexity-gate"
Expand Down
79 changes: 79 additions & 0 deletions INSTALL_WITH_AGENT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
# Install complexity-gate

You are an AI coding agent. Install complexity-gate for the user. Perform the
installation and verification instead of only describing the commands.

## Choose integrations

Supported harnesses are Claude Code, Codex, Pi, OMP, Grok, Cursor, and
OpenCode.

If the user named the harnesses, use that selection. Otherwise, detect the
harnesses installed on the machine and ask one short question listing them.
Allow the user to choose a comma-separated list, `all`, or `none`. `none` means
install only the command-line tool.

Do not enable an integration the user declined. Preserve existing settings and
hooks.

## Install

Check that Node.js 22 or newer and npm are available. Then run:

```sh
npm install --global @pickforge/complexity-gate
```

Do not use `sudo` to work around npm permission errors. Use the user's existing
Node version manager or explain the permission problem.

If Node.js 22 cannot be used, install the binary from the verified archive on
[GitHub Releases](https://github.com/pickforge/complexity-gate/releases) or
build it with Cargo. Explain that Pi, OMP, and OpenCode plugin installation
still requires their package tooling.

## Configure hooks and plugins

Run the installer non-interactively with the user's selection. Replace the
example list with the chosen harnesses:

```sh
complexity-gate-install --harness claude,codex
```

Use `complexity-gate-install --all` only when the user selected all harnesses.
The installer merges JSON hooks without replacing unrelated configuration. It
uses the native Pi, OMP, and OpenCode package commands. Grok reuses compatible
Claude Code or Cursor hooks when present so the gate does not run twice.

## Add agent instructions

If the user wants complexity-gate used for every coding and review task, add
the following text to the project or global agent instruction file they choose.
Preserve the existing file. If they did not choose project or global scope, ask
before editing it.

```md
Use complexity-gate for every coding and code-review task. Run
`complexity-gate check --changed` before completion. Fix every `FAIL` without
raising limits or hiding branches. Report every `UNVERIFIED` file instead of
estimating its complexity.
```

## Verify

Run these commands from a Git repository:

```sh
complexity-gate --version
complexity-gate doctor
complexity-gate check --changed
```

Confirm the selected harness configuration contains `complexity-gate`, without
printing unrelated configuration or secrets. For Pi, OMP, and OpenCode, use
their plugin-list or resolved-config command when available.

Report the installed version, enabled harnesses, instruction-file scope, and
verification results. If anything failed, report the exact failed step and
leave existing configuration intact.
34 changes: 28 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,30 @@ flow depth, significant lines, and parameters without external linters.

## Install

Download the archive for your platform from
Want your coding agent to handle the setup? Send it the
[AI installation guide](INSTALL_WITH_AGENT.md). It tells the agent how to choose
integrations, install hooks and plugins, update agent instructions, and verify
the result.

Install the binary, then choose the coding harness integrations you want:

```sh
npm install --global @pickforge/complexity-gate
complexity-gate-install
```

The installer supports Claude Code, Codex, Pi, OMP, Grok, Cursor, and OpenCode.
The second command prompts for a comma-separated harness list, `all`, or `none`.
Choose non-interactively with `complexity-gate-install --harness claude,codex`
or `--all`. It preserves existing configuration and can print changes first
with `--print`.

The npm package requires Node.js 22 or newer. It downloads the matching binary,
verifies its SHA-256 checksum, and installs the selected hooks or plugins.

To install only the binary, download the archive for your platform from
[GitHub Releases](https://github.com/pickforge/complexity-gate/releases), verify
its checksum, and place `complexity-gate` on `PATH`. To build the current Git
version instead:
its checksum, and place `complexity-gate` on `PATH`. To build from source:

```sh
cargo install --git https://github.com/pickforge/complexity-gate --package complexity-gate --locked
Expand All @@ -34,7 +54,9 @@ values win. Defaults and language overrides are documented in

## Hooks

Use `complexity-gate hook claude` or `complexity-gate hook codex` as the command
for each harness's `PostToolUse` and `Stop` events. Field mappings, output
contracts, state location, and the Codex patch limitation are in
Hooks are the recommended mode. They check edited files during the turn and
block completion while changed functions exceed the limits. The npm installer
configures them automatically. Native adapters are available through
`complexity-gate hook claude|codex|cursor|grok`; Pi and OMP use their extension
API, and OpenCode uses its plugin API. Field mappings and limitations are in
[`docs/hooks.md`](docs/hooks.md).
2 changes: 1 addition & 1 deletion crates/cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ path = "src/main.rs"
[dependencies]
anyhow.workspace = true
clap.workspace = true
complexity-gate-core = { path = "../core", version = "=0.1.1" }
complexity-gate-core = { path = "../core", version = "=0.2.0" }
serde.workspace = true
serde_json.workspace = true

Expand Down
Loading
Loading