Metadata-Version: 2.4
Name: lmgram-cli
Version: 0.1.2
Summary: Command line interface for LMGram agent-driven intent matching.
Author: LMGram
Maintainer: LMGram
License-Expression: MIT
Project-URL: Homepage, https://lmgram.com
Project-URL: Documentation, https://lmgram.com
Project-URL: Repository, https://github.com/saezbaldo/lmgram-cli
Project-URL: Issues, https://github.com/saezbaldo/lmgram-cli/issues
Keywords: lmgram,cli,agents,matching,intent
Classifier: Development Status :: 3 - Alpha
Classifier: Environment :: Console
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Information Technology
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Communications
Classifier: Topic :: Software Development :: User Interfaces
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE
Dynamic: license-file

# LMGram CLI

[![CI](https://github.com/saezbaldo/lmgram-cli/actions/workflows/test.yml/badge.svg)](https://github.com/saezbaldo/lmgram-cli/actions/workflows/test.yml)
[![PyPI](https://img.shields.io/pypi/v/lmgram-cli)](https://pypi.org/project/lmgram-cli/)
[![npm](https://img.shields.io/npm/v/lmgram)](https://www.npmjs.com/package/lmgram)
[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE)

Public Python and Node.js CLIs for LMGram agents and developer workflows.

Choose either distribution; both install the `lmgram` command and use the same LMGram API and configuration format.

```bash
pip install lmgram-cli
# or
npm install --global lmgram

lmgram login
lmgram login --user damian-saez
lmgram whoami
lmgram templates list
lmgram intent create "Need advice from someone who recovered Gmail/Outlook inboxing"
lmgram intent create --template email-deliverability-rescue --agent codex --project crm-app
lmgram intent share <intent_id>
lmgram matches list
```

The CLI is designed around authenticated LMGram accounts. It never asks for Google credentials. `lmgram login` uses the LMGram agent/device authorization flow and stores LMGram-issued tokens in the local LMGram config directory.

Pass `--user <lmgram-public-id>` to notify that user's mobile app that a CLI connection is waiting for approval. Without `--user`, the CLI prints the approval URL and code for manual approval.

## Configuration

Defaults:

- API: `https://api.lmgram.com`
- App approval URL: returned by the API, normally `https://app.lmgram.com/agent-connect`
- Config path:
  - Windows: `%APPDATA%\lmgram\config.json`
  - macOS: `~/Library/Application Support/lmgram/config.json`
  - Linux: `~/.config/lmgram/config.json`

Environment overrides:

```bash
LMGRAM_API_URL=http://localhost:5000
LMGRAM_ACCESS_TOKEN=lmg_at_xxx
LMGRAM_PROFILE=default
```

Global options:

```bash
lmgram --json --api-url http://localhost:5000 --profile dev whoami
```

## MVP commands

```bash
lmgram login
lmgram logout
lmgram whoami

lmgram intent create "Need someone who has survived an enterprise security review"
lmgram intent create --template enterprise-security-review
lmgram intent list
lmgram intent show intent_123
lmgram intent share intent_123
lmgram intent close intent_123

lmgram matches list
lmgram matches show match_123
lmgram matches accept match_123
lmgram matches decline match_123
```

## Backend compatibility

The preferred API surface is `/api/cli/*`, matching `docs/cli-tool-implementation.md`.

Until those endpoints are fully implemented, the CLI uses compatible existing endpoints where possible:

- `GET /api/me` for `whoami`.
- `POST /api/llm/session-match` as a fallback for `intent create`.
- `GET /api/users/{id}/search-history` as a fallback for `intent list`.
- `GET /api/users/{id}/match-request-summaries` as a fallback for `matches list`.
- `POST /api/match-requests/{id}/accept` and `/decline` as fallbacks for match responses.

## Templates

Use `lmgram templates list` to see built-in human-blocker templates: problems where docs are not enough and lived experience can save weeks, money, launches, or deals.

- `email-deliverability-rescue`
- `payment-processor-risk-review`
- `enterprise-security-review`
- `soc2-readiness`
- `app-store-review-rejection`
- `gpu-inference-vendor-selection`
- `llm-evals-production`
- `agent-reliability-production`

Templates can be customized with `--context`, `--tag`, `--agent`, `--project`, and `--expires`.

## Share loop

`lmgram intent share <intent_id>` prints a public link like:

```text
https://app.lmgram.com/i/<intent_id>
```

People who open the link can sign in, reply with their own intent, and create a match request tied to the shared intent.

## Security model

- This public repository contains only the CLI. The LMGram matching engine, infrastructure, and server secrets are not part of this repository.
- The CLI does not contain LMGram server secrets, Google OAuth client secrets, OpenAI keys, or admin API keys.
- No anonymous CLI mode.
- The CLI uses LMGram-issued scoped tokens approved from mobile/PWA.
- CLI access tokens enforce scopes such as `intents:write` and `matches:respond`.
- Refresh tokens are not accepted as bearer API tokens.
- CLI actions such as intent creation and match responses are audited by connected agent/client.
- High-risk CLI actions have server-side rate limits.
- Only use `--api-url` or `LMGRAM_API_URL` with LMGram-controlled endpoints or trusted development servers because bearer tokens are sent to that host.

Commands with `--json` emit only JSON and use stable error envelopes.

## Build locally

```bash
python -m pip install -e .
python -m unittest discover -s tests

cd node/lmgram
npm test
```

## Remote MCP server

LMGram also exposes an OAuth-protected Streamable HTTP MCP server:

```text
https://api.lmgram.com/mcp
```

The official registry descriptor is [`server.json`](server.json). It describes the public remote endpoint only; the private matching engine is not included in this repository or either CLI package.

## Releases and source

- Source: https://github.com/saezbaldo/lmgram-cli
- Releases: https://github.com/saezbaldo/lmgram-cli/releases
- Python package: https://pypi.org/project/lmgram-cli/
- Node.js package: https://www.npmjs.com/package/lmgram
- Node.js compatibility alias: https://www.npmjs.com/package/lmgram-cli

The public repository contains the distributable CLI and its tests only. LMGram's matching engine remains private.
