Skip to main content

Ninchi CLI

Thin HTTP client for running Ninchi checks from a terminal, hook, or CI job. The CLI does not import the backend or core engine; it talks to the public API.

Install

pipx install .

From this repo during development:

cd cli
python -m pip install -e ".[dev]"

Auth

Interactive login uses the Ninchi device-code flow and stores a personal access token in ~/.config/ninchi/credentials with mode 0600:

ninchi login

CI can skip the credentials file:

export NINCHI_API_TOKEN="ninchi_pat_example_for_docs"

Use NINCHI_API_URL or --api-url to target a local/dev backend.

Checks

Submit a diff from stdin and answer the generated challenge interactively:

git diff | ninchi check --stdin --org-id "$NINCHI_ORG_ID"

Other subject sources:

ninchi check --staged --org-id "$NINCHI_ORG_ID"
ninchi check --commit HEAD --org-id "$NINCHI_ORG_ID"
ninchi check --file src/app.py --language python --org-id "$NINCHI_ORG_ID"

Automation mode uses JSON output and exit codes:

git diff --staged | ninchi check --stdin --answer "$ANSWER" --json --org-id "$NINCHI_ORG_ID"

Exit codes:

  • 0: challenge passed
  • 1: challenge failed
  • 2: pending, configuration, auth, API, or other operational error

When an answer is typed interactively, the CLI submits answering_actor=human_attested. When --answer is supplied or the process has no terminal to prompt from, it submits answering_actor=agent_assisted unless --actor overrides it. The server enforces org policy.

Pre-push Hook

Example .git/hooks/pre-push:

#!/usr/bin/env bash
set -euo pipefail

base="${NINCHI_BASE_REF:-origin/main}"
git diff --patch "$base"...HEAD | ninchi check \
  --stdin \
  --org-id "${NINCHI_ORG_ID:?set NINCHI_ORG_ID}" \

For human-attested hook usage, omit --answer and let the CLI prompt in the terminal.

MCP Server (ninchi mcp)

The same client, served over the Model Context Protocol for agent-capable editors (Cursor, Claude Code, etc.). Authenticate once with ninchi login, then register the server — e.g. in Cursor (.cursor/mcp.json or global MCP settings):

{
  "mcpServers": {
    "ninchi": { "command": "ninchi", "args": ["mcp"] }
  }
}

Tools: submit_check, get_challenge, submit_answer, get_result, list_history.

Two things agents (and their humans) should know:

  • submit_answer requires an honest actor argument (human_attested / agent_assisted / agent_autonomous). Provenance is recorded with the attempt; organizations may block agent-authored answers by policy, in which case the tool returns guidance to hand the question to the human. There is no client-side human-only rule — policy lives with the org.
  • Submissions carry client_attribution: "mcp:<client-name>" from the MCP handshake, which feeds Ninchi's AI-authorship analytics.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ninchi_cli-0.2.0.tar.gz (18.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ninchi_cli-0.2.0-py3-none-any.whl (14.8 kB view details)

Uploaded Python 3

File details

Details for the file ninchi_cli-0.2.0.tar.gz.

File metadata

  • Download URL: ninchi_cli-0.2.0.tar.gz
  • Upload date:
  • Size: 18.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for ninchi_cli-0.2.0.tar.gz
Algorithm Hash digest
SHA256 e7859f01818c7412fe99e8f3320dd90e2ba7cac46267d28c9fe5466e9475a5bb
MD5 fd9f32b0a418bcdb27b31b09b39fdf09
BLAKE2b-256 5138e4198bd1d467944305530530381b1021b5e58889d68379028eadb4307605

See more details on using hashes here.

Provenance

The following attestation bundles were made for ninchi_cli-0.2.0.tar.gz:

Publisher: publish-cli.yml on ninchi-ai/ninchi-saas

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file ninchi_cli-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: ninchi_cli-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 14.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for ninchi_cli-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 191af032c0ec205becc879c46d147be8ce45269a79e6cd403615f097795f970f
MD5 1e14b4d2cf10e1c9890fae3d676d2378
BLAKE2b-256 5b5d10bb6847d7833dbe935cef0cb6605311407f0aeca74647a6dc424d61d58f

See more details on using hashes here.

Provenance

The following attestation bundles were made for ninchi_cli-0.2.0-py3-none-any.whl:

Publisher: publish-cli.yml on ninchi-ai/ninchi-saas

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page