Skip to content

Add proofline agent status for local MCP configuration diagnostics - #137

Open
vanshksingh wants to merge 1 commit into
prooflinedev:mainfrom
vanshksingh:feat/agent-status-diagnostic-upstream
Open

vanshksingh wants to merge 1 commit into
prooflinedev:mainfrom
vanshksingh:feat/agent-status-diagnostic-upstream

Conversation

@vanshksingh

Copy link
Copy Markdown

Problem

proofline agent install CLIENT writes the MCP server entry for claude-code, codex, cursor, gemini, and kiro, but there is no read-only command to inspect whether an existing user-level registration is missing, malformed, or valid. In addition, Clap's eager env parsing on global flags (PROOFLINE_BASE_URL, PROOFLINE_ORGANIZATION_ID, PROOFLINE_CA_CERT) would fail a local diagnostic command when inherited environment variables are malformed.

Approach

  • Added proofline agent status CLIENT (src/agent/status.rs, src/agent/config.rs, src/agent/store.rs, src/agent.rs, README.md) as a read-only, offline diagnostic across all five supported clients (claude-code, codex, cursor, gemini, kiro).
  • Classified inspections into four explicit outcomes: Configuration valid: (exit 0), Unable to verify: (exit 0, for custom dirs like CLAUDE_CONFIG_DIR, relative CODEX_HOME, oversized files, or broken symlinks), Missing registration: (exit 1), and Invalid registration: (exit 1).
  • Validated JSON (UniqueJson duplicate-key check, type == "stdio", command, args, env entries) and TOML (toml_edit::DocumentMut table and inline-table shapes, NUL checks, env entries) without executing any configured command, writing any files, making network calls, or leaking secrets from config values or PROOFLINE_TOKEN.
  • Moved global environment resolution out of Clap derive attributes into synchronous Cli::resolve_environment() in src/main.rs (and idempotently in run() for library callers via env_resolved). agent status bypasses inherited environment variables and rejects explicit --base-url, --org, and --ca-cert, while all other commands preserve Clap usage-formatted errors and startup behavior.

Verification

Ran on origin/main (f95504f, v0.11.6):

  • cargo fmt --check (exit 0)
  • cargo clippy --locked --all-targets -- -D warnings (exit 0)
  • TMPDIR=/private/tmp cargo test --locked (exit 0: 79 lib tests including agent::status::tests, 11 agent_status integration tests, and all existing integration suites; 1 hooks test ignored because pre-commit is not installed)
  • git diff --check (exit 0)

Proofline review evaluation

Ran Proofline (prooflinedev[bot]) on this branch in my fork (vanshksingh/cli_proofline#1).

  • Fixed from Proofline feedback: added UniqueJson duplicate-key validation and type == "stdio" checks in inspect_json, handled broken vs. valid parent directory symlinks in inspect(), added Stamp re-verification after canonicalization, guarded run() for direct library callers while skipping agent status in resolve_environment(), rejected empty PROOFLINE_CA_CERT, removed raw-argv agent status matching in src/update.rs, documented exit codes/labels in README.md, and hardened the loopback reviews test, NUL fixtures (\u0000), and JSON redaction tests.
  • Intentionally kept: exit 0 for Unable to verify: (Status::Unverified such as CLAUDE_CONFIG_DIR) so scripts do not fail when custom config directories are used; existing Layout::read_file open semantics without adding a direct libc dependency; and keeping Rustdoc backticks/<...> in Cli doc comments to satisfy -D clippy::doc-markdown.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant