Metadata-Version: 2.4
Name: lmgram-cli
Version: 0.1.1
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/lmgram/lmgram
Project-URL: Issues, https://github.com/lmgram/lmgram/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

Python CLI for LMGram agents and developer workflows.

```bash
pip install lmgram-cli
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

- 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.

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

## Build locally

```bash
cd apps/cli
python -m pip install -e .
python -m unittest
```
