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
22 changes: 22 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,25 @@ jobs:
- run: cargo clippy --locked --all-targets -- -D warnings
- run: cargo test --locked
- run: cargo install cargo-deny --locked --version 0.20.2 && cargo deny check

windows:
runs-on: windows-2025
timeout-minutes: 30
defaults:
run:
shell: bash
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- run: cargo build --release --locked --target x86_64-pc-windows-msvc
- run: python scripts/archive.py x86_64-pc-windows-msvc
- shell: pwsh
run: |
tar -xzf artifacts/proofline-x86_64-pc-windows-msvc.tar.gz -C artifacts
& ./artifacts/proofline.exe --version
if ($LASTEXITCODE -ne 0) { throw "Windows executable failed" }
& ./artifacts/proofline.exe setup --print
if ($LASTEXITCODE -ne 0) { throw "Setup handoff failed" }
& ./artifacts/proofline.exe review --schema | ConvertFrom-Json | Out-Null
if ($LASTEXITCODE -ne 0) { throw "Review schema failed" }
11 changes: 9 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,15 @@ jobs:
target: aarch64-unknown-linux-musl
- runner: macos-15-intel
target: x86_64-apple-darwin
- runner: windows-2025
target: x86_64-pc-windows-msvc
- runner: macos-15
target: aarch64-apple-darwin
runs-on: ${{ matrix.runner }}
timeout-minutes: 30
defaults:
run:
shell: bash
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
Expand All @@ -63,7 +68,9 @@ jobs:
TARGET: ${{ matrix.target }}
VERSION: ${{ needs.version.outputs.version }}
run: |
test "$(target/"$TARGET"/release/proofline --version)" = "proofline $VERSION"
binary=proofline
if [[ "$TARGET" == *windows* ]]; then binary=proofline.exe; fi
test "$(target/"$TARGET"/release/"$binary" --version)" = "proofline $VERSION"
python3 scripts/archive.py "$TARGET"
- uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
with:
Expand Down Expand Up @@ -94,7 +101,7 @@ jobs:
GH_TOKEN: ${{ github.token }}
run: |
set -euo pipefail
test "$(find artifacts -name '*.tar.gz' | wc -l)" -eq 4
test "$(find artifacts -name '*.tar.gz' | wc -l)" -eq 5
(cd artifacts && LC_ALL=C sha256sum proofline-*.tar.gz > SHA256SUMS)
printf '%s\n' "$VERSION" > artifacts/latest
# Creating the draft reserves the GitHub version atomically.
Expand Down
2 changes: 1 addition & 1 deletion 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
@@ -1,6 +1,6 @@
[package]
name = "proofline-cli"
version = "0.1.3"
version = "0.1.4"
edition = "2024"
rust-version = "1.95"
description = "Proofline command-line client for the review API"
Expand Down
42 changes: 42 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,3 +64,45 @@ The bucket-scoped credential is the `CLI_RELEASE_R2_CREDENTIALS` environment sec
`CLOUDFLARE_ACCOUNT_ID` is an environment variable. R2 versions are reserved
with a conditional write. A failed publication retains its reservation; raise
the package version before another release. Install and update URLs stay on proofline.sh.

## Review and knowledge tools

`proofline reviews --repository-id UUID --cursor CURSOR` returns one page with its
continuation metadata. All flags are optional. `proofline routing REVIEW_ID` reads
recorded routing. `proofline run --repo owner/name --pr 7 --run 2` reads one retained run.

`proofline session prompt FINDING_ID` returns the protected prompt and eligible
connections. After reviewing it, use `proofline session start FINDING_ID
--connection-id UUID --prompt-digest DIGEST`. This starts once and can incur vendor
charges. `proofline session get SESSION_ID` reads status. These commands need a
personal token with `agent_sessions:start`; device sign-in cannot grant this authority.

Knowledge commands return the MCP tool result as JSON, including untrusted-text
wrappers, citations and `isError`. A refused tool exits nonzero. They use the same
origin and credential as the MCP bridge and never retry a tool call.

```sh
proofline wiki list --repo owner/name
proofline wiki get index --repo owner/name --commit FULL_COMMIT_SHA
proofline ask --repo owner/name 'Where is authentication enforced?'
proofline architecture ENVIRONMENT_ID
proofline plan get PLAN_ID
proofline plan implement PLAN_ID
proofline plan implementation IMPLEMENTATION_ID
```

Knowledge reads need `reviews:read` and `knowledge:read`. Implementation also needs
`plans:implement`, a personal token and approval of the exact published plan version.
`proofline setup` opens the browser organization selector. `--organization NAME`
opens that GitHub organization's installation page; `--print` only prints its address.
Cloud trust and connection changes still require a signed-in administrator browser.

## Windows

Official releases include `proofline-x86_64-pc-windows-msvc.tar.gz` with `proofline.exe`.
Download it and `SHA256SUMS` from the same GitHub release. Compare its SHA-256 using
`Get-FileHash -Algorithm SHA256`, then extract with `tar -xzf` and put `proofline.exe`
in a directory on PATH. Run `proofline login` to store credentials in Windows
Credential Manager. To update, close running Proofline processes and replace the
executable from a verified release. The Unix shell installer and self-update command
do not install Windows binaries.
5 changes: 3 additions & 2 deletions scripts/archive.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,14 @@
import tarfile

target = sys.argv[1]
source = Path("target") / target / "release/proofline"
binary = "proofline.exe" if "windows" in target else "proofline"
source = Path("target") / target / "release" / binary
data = source.read_bytes()
Path("artifacts").mkdir(exist_ok=True)
with Path(f"artifacts/proofline-{target}.tar.gz").open("wb") as output:
with gzip.GzipFile(filename="", fileobj=output, mode="wb", mtime=0) as compressed:
with tarfile.open(fileobj=compressed, mode="w") as archive:
entry = tarfile.TarInfo("proofline")
entry = tarfile.TarInfo(binary)
entry.size = len(data)
entry.mode = 0o755
entry.mtime = 0
Expand Down
8 changes: 4 additions & 4 deletions scripts/publish-r2.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,16 @@ unset CLI_RELEASE_R2_CREDENTIALS

temporary=$(mktemp -d)
trap 'rm -rf "$temporary"' EXIT
targets='aarch64-apple-darwin aarch64-unknown-linux-musl x86_64-apple-darwin x86_64-unknown-linux-musl'
targets='aarch64-apple-darwin aarch64-unknown-linux-musl x86_64-apple-darwin x86_64-pc-windows-msvc x86_64-unknown-linux-musl'
# Verify every archive before the first upload. The manifest names exactly
# the four files the installer can download, with their actual digests.
# the five files the installer can download, with their actual digests.
for target in $targets; do
archive="proofline-$target.tar.gz"
[ -f "$dist/$archive" ] || refuse "missing $archive"
digest=$(sha256sum "$dist/$archive" | cut -d ' ' -f 1)
printf '%s %s\n' "$digest" "$archive" >> "$temporary/SHA256SUMS"
done
cmp -s "$temporary/SHA256SUMS" "$dist/SHA256SUMS" || refuse 'SHA256SUMS does not match the four release archives'
cmp -s "$temporary/SHA256SUMS" "$dist/SHA256SUMS" || refuse 'SHA256SUMS does not match the five release archives'

put() {
local key=$1 source=$2 content_type=$3 cache_control=$4 condition=${5:-} digest
Expand Down Expand Up @@ -77,7 +77,7 @@ for target in $targets; do
put "$version/$archive" "$dist/$archive" application/gzip "$immutable"
done
put "$version/SHA256SUMS" "$dist/SHA256SUMS" 'text/plain; charset=utf-8' "$immutable"
# Installers see the version only after all five release objects exist.
# Installers see the version only after all six release objects exist.
printf '%s\n' "$version" > "$temporary/latest"
put latest "$temporary/latest" 'text/plain; charset=utf-8' 'public, max-age=60'
printf 'cli publish: uploaded CLI %s\n' "$version"
2 changes: 1 addition & 1 deletion scripts/test_publish_r2.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
SECRET = "c" * 64
TARGETS = sorted([
"x86_64-unknown-linux-musl", "aarch64-unknown-linux-musl",
"x86_64-apple-darwin", "aarch64-apple-darwin",
"x86_64-apple-darwin", "aarch64-apple-darwin", "x86_64-pc-windows-msvc",
])


Expand Down
42 changes: 42 additions & 0 deletions src/api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -373,6 +373,48 @@ impl Api {
self.decode(&reply.body)
}

pub(crate) async fn tool_get(&self, path: &[&str]) -> Result<serde_json::Value, ApiError> {
self.get(self.url(path)).await
}

pub(crate) async fn tool_post(
&self,
path: &[&str],
body: &serde_json::Value,
) -> Result<serde_json::Value, ApiError> {
let (reply, _) = self
.http
.send(self.request(Method::POST, self.url(path)).json(body))
.await?;
if !reply.status.is_success() {
return Err(self.http.problem(&reply));
}
self.decode(&reply.body)
}

pub(crate) async fn list_page(
&self,
repository: Option<Uuid>,
search: Option<&str>,
cursor: Option<&str>,
) -> Result<serde_json::Value, ApiError> {
let mut url = self.url(&["reviews"]);
{
let mut query = url.query_pairs_mut();
query.append_pair("limit", "50");
if let Some(repository) = repository {
query.append_pair("repository", &repository.to_string());
}
if let Some(search) = search {
query.append_pair("search", search);
}
if let Some(cursor) = cursor {
query.append_pair("cursor", cursor);
}
}
self.get(url).await
}

pub(crate) async fn history(
&self,
repository: &str,
Expand Down
108 changes: 108 additions & 0 deletions src/knowledge.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
//! Native knowledge commands over the existing MCP authorization boundary.
use crate::{Verdict, api::Http, credentials, git, mcp, origin::Origin, tools};
use clap::{Args, Subcommand};
use secrecy::SecretString;
use serde_json::{Value, json};
use uuid::Uuid;

type Request = (&'static str, Value);

#[derive(Debug, Args)]
pub(crate) struct Repository {
#[arg(long)]
repo: String,
/// Full indexed commit SHA; omit to use the newest completed build.
#[arg(long)]
commit: Option<String>,
}
impl Repository {
fn arguments(&self) -> anyhow::Result<Value> {
let mut value = json!({"repository": self.repo});
if let Some(commit) = &self.commit {
git::commit_sha(commit)?;
value["commit"] = json!(commit);
}
Ok(value)
}
}
#[derive(Debug, Subcommand)]
pub(crate) enum WikiCommand {
List(Repository),
Get {
page_key: String,
#[command(flatten)]
repository: Repository,
},
}
impl WikiCommand {
pub fn request(self) -> anyhow::Result<Request> {
match self {
Self::List(repository) => Ok(("list_wiki_pages", repository.arguments()?)),
Self::Get {
page_key,
repository,
} => {
let mut args = repository.arguments()?;
args["page_key"] = json!(page_key);
Ok(("get_wiki_page", args))
}
}
}
}
#[derive(Debug, Args)]
pub(crate) struct AskArgs {
question: String,
#[command(flatten)]
repository: Repository,
}
impl AskArgs {
pub fn request(self) -> anyhow::Result<Request> {
let mut args = self.repository.arguments()?;
args["question"] = json!(self.question);
Ok(("ask_codebase", args))
}
}
#[derive(Debug, Subcommand)]
pub(crate) enum PlanCommand {
Get {
plan_id: Uuid,
},
/// Start implementation of this exact approved, published plan version.
Implement {
plan_id: Uuid,
},
Implementation {
implementation_id: Uuid,
},
}
impl PlanCommand {
pub fn request(self) -> Request {
match self {
Self::Get { plan_id } => ("get_plan", json!({"plan_id": plan_id})),
Self::Implement { plan_id } => {
("start_plan_implementation", json!({"plan_id": plan_id}))
}
Self::Implementation { implementation_id } => (
"get_plan_implementation",
json!({"implementation_id": implementation_id}),
),
}
}
}
pub(crate) async fn run(
origin: Origin,
token: Option<SecretString>,
org: Option<Uuid>,
(name, arguments): Request,
) -> anyhow::Result<Verdict> {
let credential = credentials::load(&origin, token, org).await?;
let value = mcp::call(&Http::new(origin)?, &credential.token, name, arguments).await?;
tools::json(&value)?;
Ok(
if value.get("isError").and_then(Value::as_bool) == Some(true) {
Verdict::Blocked
} else {
Verdict::Done
},
)
}
Loading
Loading