@pydantic/logfire-cli-darwin-x64 0.1.3 → 0.1.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/README.md +112 -152
  2. package/bin/logfire +0 -0
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -1,180 +1,140 @@
1
1
  # Logfire CLI
2
2
 
3
- Rust command-line tools for [Pydantic Logfire](https://pydantic.dev/logfire).
3
+ Set up [Pydantic Logfire](https://pydantic.dev/logfire), query your telemetry,
4
+ and manage projects and tokens without leaving the terminal.
4
5
 
5
- `logfire` authenticates against the hosted (or self-hosted) Logfire API, drives
6
- the public Logfire MCP server, runs bundled agent skills, points a project
7
- at Logfire, and exposes the typed Platform API — with first-class machine output
8
- for scripts and coding agents.
6
+ [Getting started](docs/getting-started.md) · [Install](docs/installation.md) ·
7
+ [User guide](docs/README.md) · [Develop the CLI](dev-docs/README.md)
9
8
 
10
- ## Quickstart
9
+ ## Get started
10
+
11
+ Install the native CLI with `uv`:
11
12
 
12
13
  ```bash
13
- cargo install --path crates/logfire-cli # see docs/installation.md for details
14
- logfire --region us signup --org acme --project my-project
15
- logfire auth # browser OAuth into the OS keychain
16
- logfire mcp tools list # use that session against public MCP
14
+ uv tool install logfire-cli
15
+ logfire --version
17
16
  ```
18
17
 
19
- ## Commands
20
-
21
- | Command | What it does |
22
- | --- | --- |
23
- | [`logfire auth`](docs/authentication.md) | Browser OAuth shared by CLI and MCP |
24
- | [`logfire signup`](docs/commands/signup.md) | Create an account, first project, and local SDK credentials |
25
- | [`logfire init`](docs/commands/init.md) | Point a directory at a Logfire project |
26
- | [`logfire project`](docs/commands/project.md) | Validate and show the configured SDK project |
27
- | [`logfire setup`](docs/commands/setup.md) | Hand off repository instrumentation to Codex or Claude Code |
28
- | [`logfire skill`](docs/commands/skill.md) | Discover and run CLI-bundled Logfire agent skills |
29
- | [`logfire token`](docs/commands/token.md) | Mint a project read/write token and print it |
30
- | [`logfire api-key`](docs/commands/api-key.md) | Mint a project-scoped API key and print it |
31
- | [`logfire api`](docs/commands/api.md) | Typed Platform API endpoints |
32
- | [`logfire mcp`](docs/commands/mcp.md) | Discover and call the public Logfire MCP server |
33
- | [`logfire doctor`](docs/commands/doctor.md) | Diagnose local prerequisites without exposing secrets |
34
-
35
- Every command and group accepts concise `-h`/`--help`; use
36
- `logfire help <command>` for the detailed option reference.
37
-
38
- ## Documentation
39
-
40
- The [**User Guide**](docs/README.md) covers everything in task-oriented pages:
41
-
42
- - [Installation](docs/installation.md) — the binary and shell completions
43
- - [Authentication](docs/authentication.md) — logins, regions, `LOGFIRE_TOKEN`, and OS-keychain storage
44
- - [Output contracts](docs/output-contracts.md) — human vs. `--output json`/`jsonl`, the envelope, exit codes, and flag precedence
45
-
46
- Global options apply before or after every command. `--region us|eu` (env
47
- `PYDANTIC_LOGFIRE_REGION`) chooses a hosted region, while `--base-url <URL>`
48
- (env `LOGFIRE_BASE_URL`) targets a self-hosted or staging instance and overrides
49
- it. `--org <ORGANIZATION>` selects a saved organization-specific OAuth profile;
50
- `logfire auth status` lists profiles and `logfire auth switch <ORGANIZATION>`
51
- changes the default without opening the credential store.
52
- `--output human|json|jsonl`, `--no-input`, and `--color auto|always|never`
53
- provide the shared presentation and prompting contract.
54
-
55
- ## Architecture
56
-
57
- The CLI is a Cargo workspace of small, single-purpose crates:
58
-
59
- | Crate | Role |
60
- | --- | --- |
61
- | `logfire-cli` | The `logfire` binary: argument parsing (clap) and command dispatch. |
62
- | `logfire-api` | The typed `logfire api` command surface over the generated client. |
63
- | `logfire-api-client` | Generated from the OpenAPI schemas (see below); never hand-edited. |
64
- | `logfire-auth` | Terminal UX, organization verification, and profile persistence around browser OAuth. |
65
- | `logfire-config` | Credential resolution, regions / base-URL, and the request context. |
66
- | `logfire-init` | `logfire init` project setup and the `.logfire/` credentials file. |
67
- | `logfire-mcp-core` | Pure, I/O-free decision core for global input/output, envelope, limit, and error-category contracts. |
68
- | `logfire-mcp-client` | Official `rmcp` transport, MCP challenge and token-exchange policy, bounded protocol I/O, and protocol-faithful fakes. |
69
- | `logfire-oauth` | Platform OAuth, strict SDK/HTTP policy, loopback callback, and confidential session lifecycle. |
70
-
71
- See [`dev-docs/ARCHITECTURE.md`](dev-docs/ARCHITECTURE.md) for the product
72
- boundaries and trust model, and [`dev-docs/CRATE_RULES.md`](dev-docs/CRATE_RULES.md)
73
- for each crate's dependency and I/O contract. The
74
- [`assurance model`](dev-docs/ASSURANCE_MODEL.md) maps critical invariants to unit,
75
- property, state-machine, mutation, boundary, smoke, and end-to-end evidence.
76
-
77
- ### Design notes
78
-
79
- - **No `unsafe`.** The workspace sets `unsafe_code = "forbid"`; safe `std`/`nix`
80
- APIs have covered every need, and `forbid` (unlike `deny`) can't be overridden
81
- locally.
82
- - **Small release binary.** The release profile trades a little compile time for
83
- size (`opt-level = "z"`, fat LTO, one codegen unit, `strip`, `panic = "abort"`),
84
- taking the macOS arm64 binary from ~15 MB to ~3.6 MB. Because `panic = "abort"`
85
- skips unwinding, a panic ends the process without running destructors — fine for
86
- a CLI, but note a task panic aborts the whole process rather than just that task.
87
- - **TLS via `ring`, not `aws-lc`.** `reqwest`/`rustls` use the `ring` crypto
88
- provider — much smaller, and no `cmake` at build time. Trade-off: `ring` cannot
89
- verify P-521-signed certificates, so TLS can fail behind a corporate
90
- TLS-inspection proxy or Cloudflare WARP that uses a P-521 CA. If you hit that,
91
- the crypto provider is why; switching `reqwest` back to the default `rustls`
92
- (`aws-lc`) provider fixes it.
93
- - **Quality bars are enforced in CI, not by convention.** Clippy runs at
94
- `-D warnings` with the `pedantic` group and `unwrap`/`expect`/`panic` denied in
95
- library and binary code; `cargo-deny` gates licenses and duplicate dependencies;
96
- 100% line/function coverage for every handwritten crate
97
- (`scripts/check_coverage.py`) and an architecture
98
- policy check (`scripts/check_policy.py`) block regressions; `cargo doc` runs
99
- with warnings as errors. See [`CLAUDE.md`](CLAUDE.md) for the code-style rules
100
- and [`dev-docs/RUST-CONVENTIONS.md`](dev-docs/RUST-CONVENTIONS.md) for the
101
- reviewed conventions.
102
-
103
- ## Generated API Client
104
-
105
- `crates/logfire-api-client` is generated exclusively from Logfire's documented
106
- Platform schema at `/api/openapi.json`. The client lives under
107
- `logfire_api_client::platform`; private or compatibility schemas are not shipped.
108
-
109
- The normalized inputs and their provenance are committed under `openapi/`. To
110
- refresh the snapshot from its reviewed public HTTPS URL, inspect the schema diff,
111
- and then regenerate the client:
18
+ Want to try it first? Run either command without installing anything:
112
19
 
113
20
  ```bash
114
- make refresh-openapi
115
- make generate-api-client
21
+ uvx logfire-cli --help
22
+ npx logfire-cli --help
116
23
  ```
117
24
 
118
- `make refresh-openapi` replaces the snapshot and its SHA-256 provenance as one
119
- validated set. It deliberately leaves the generated checksum failing until
120
- `make generate-api-client` succeeds, so refreshed inputs cannot masquerade as a
121
- current client.
122
-
123
- The crate is derived output: **never hand-edit it.** The generator cannot produce
124
- it correctly on its own, so `scripts/generate-api-client.sh` applies a handful of
125
- fix-ups afterwards (crate-relative import rewriting, missing recursive-schema type
126
- aliases, bounded response reads, channel discriminators, and the lint config).
127
- Anything that needs to persist across a
128
- regeneration belongs in that script's fix-up section.
129
-
130
- The script requires Docker and uses OpenAPI Generator 7.22.0 through the exact OCI
131
- image digest recorded in `openapi/provenance.toml`. It constructs and formats a
132
- staging workspace, tests it against the exact lockfile, and only then replaces the
133
- client; a final locked compile remains rollback-protected. The committed checksum
134
- binds the schema snapshots, provenance, generation recipe, formatting config, and
135
- complete output tree, so ordinary CI detects input or generated-client drift without
136
- network access.
137
-
138
- ## Development
139
-
140
- The hosted Logfire MCP server is the primary boundary for new remote product
141
- capabilities; the documented Platform OpenAPI is the secondary typed automation
142
- surface, and handwritten `/v1` calls are forbidden. See
143
- [`dev-docs/ARCHITECTURE.md`](dev-docs/ARCHITECTURE.md) and
144
- [`dev-docs/adr/0001-mcp-first-client.md`](dev-docs/adr/0001-mcp-first-client.md)
145
- before adding a command or remote dependency, and
146
- [`dev-docs/CHANGE_MAP.md`](dev-docs/CHANGE_MAP.md) for the files, tests, and docs
147
- that must change together. Pure MCP command contracts live in `logfire-mcp-core`;
148
- transport and OAuth stay in separate adapters.
149
-
150
- Run the fast stable checks used by CI:
25
+ You can also install it with npm:
151
26
 
152
27
  ```bash
153
- make ci
28
+ npm install --global logfire-cli
29
+ logfire --version
154
30
  ```
155
31
 
156
- Before handing work off, run the pinned nightly formatter and Clippy lane too:
32
+ ### New to Logfire?
33
+
34
+ From your application's directory, choose the organization and first project
35
+ names you want:
157
36
 
158
37
  ```bash
159
- make ci-all
38
+ logfire --region us signup --org acme --project my-app
160
39
  ```
161
40
 
162
- Enforce 100% line and function coverage for every handwritten crate and render
163
- text/HTML reports:
41
+ The CLI opens a short-lived signup page in your browser. After you approve the
42
+ signup, it creates the organization and project and connects the current
43
+ directory to that project. Use `--region eu` if your Logfire account belongs in
44
+ the EU region.
45
+
46
+ ### Already have a Logfire account?
47
+
48
+ Sign in, then create or choose a project interactively:
164
49
 
165
50
  ```bash
166
- make coverage
51
+ logfire --region us auth --org acme
52
+ logfire --org acme init
167
53
  ```
168
54
 
169
- The stable compiler is pinned in `rust-toolchain.toml`; the nightly formatter
170
- and lint toolchain is pinned by `NIGHTLY_TOOLCHAIN` in the `Makefile`. See
171
- [`dev-docs/VERIFICATION.md`](dev-docs/VERIFICATION.md) for scope, tool installation,
172
- and the rules for raising coverage floors.
55
+ Browser credentials stay in your operating system's credential store. `init`
56
+ writes the project's SDK credential to `.logfire/logfire_credentials.json` and
57
+ keeps it out of version control.
58
+
59
+ ### Check it and do something useful
60
+
61
+ ```bash
62
+ logfire --org acme project current
63
+ logfire --org acme setup
64
+ logfire --org acme mcp query run 'SELECT message FROM records LIMIT 20' --project my-app
65
+ ```
66
+
67
+ - `project current` verifies which Logfire project this directory uses.
68
+ - `project open` opens that validated project, while `--no-open` prints its URL.
69
+ - `setup` prepares the account and project, then asks an installed Codex or
70
+ Claude Code agent to instrument and verify your application.
71
+ - `mcp query run` queries your Logfire data through the hosted MCP server.
72
+
73
+ For the complete walkthrough, including existing-project and automation flows,
74
+ see [Getting started](docs/getting-started.md).
75
+
76
+ ## Common jobs
77
+
78
+ | I want to… | Command | Guide |
79
+ | --- | --- | --- |
80
+ | Create my Logfire account and first project | `logfire signup` | [Signup](docs/commands/signup.md) |
81
+ | Sign in to an existing account | `logfire auth` | [Authentication](docs/authentication.md) |
82
+ | Connect this directory to a project | `logfire init` | [Project setup](docs/commands/init.md) |
83
+ | Add application instrumentation | `logfire setup` | [Agent-assisted setup](docs/commands/setup.md) |
84
+ | Try the beta AI Gateway integration | `logfire --beta agent gateway` or `logfire --beta agent proxy launch` | [Gateway setup](docs/commands/proxy.md) |
85
+ | Run Python with automatic instrumentation | `logfire run` | [Run Python](docs/commands/run.md) |
86
+ | Query traces and logs | `logfire mcp query` | [MCP](docs/commands/mcp.md) |
87
+ | Open or inspect the current project | `logfire project` | [Project](docs/commands/project.md) |
88
+ | Create a project read or write token | `logfire token` | [Tokens](docs/commands/token.md) |
89
+ | Diagnose credentials or local setup | `logfire doctor` | [Doctor](docs/commands/doctor.md) |
90
+
91
+ The CLI also includes beta typed Platform API commands, safe generic MCP calls,
92
+ agent skills, and beta Codex telemetry setup. The [user guide](docs/README.md) lists
93
+ every command by task.
94
+
95
+ ## Help that starts small
96
+
97
+ ```bash
98
+ logfire --help
99
+ logfire help signup
100
+ logfire help init
101
+ logfire help mcp query
102
+ ```
103
+
104
+ Short help keeps common choices visible. `logfire help <command>` adds examples,
105
+ effects, and advanced options.
106
+
107
+ For scripts and coding agents, add `--no-input` and request `--output json` or
108
+ `--output jsonl` instead of parsing human-readable output. See
109
+ [Output contracts](docs/output-contracts.md).
110
+
111
+ ## Credentials stay in the right place
112
+
113
+ - Browser OAuth credentials are scoped to one Logfire origin and organization
114
+ and stored in the operating system credential store.
115
+ - Project write credentials stay with the local project under `.logfire/`.
116
+ - Newly created secrets are printed once only when a token-creation command is
117
+ explicitly used.
118
+ - `--org` always means the real organization name shown in Logfire.
119
+
120
+ See [Authentication](docs/authentication.md) for multiple organizations,
121
+ headless API keys, logout, and credential precedence.
122
+
123
+ ## Installation and updates
124
+
125
+ PyPI provides native binaries for all 17 supported targets. npm covers the five
126
+ common macOS, GNU/Linux, and Windows combinations. Repository readers can also
127
+ download every prebuilt archive, plus checksums and verification evidence, from
128
+ [GitHub Releases](https://github.com/pydantic/logfire-cli/releases/latest). Until
129
+ this repository is public, that GitHub route requires Pydantic repository access.
130
+
131
+ See [Installation](docs/installation.md) for supported platforms, one-off use,
132
+ updates, and shell completions.
173
133
 
174
134
  ## Contributing and security
175
135
 
176
- See [`CONTRIBUTING.md`](CONTRIBUTING.md) for the development and pull-request
177
- contract. Report vulnerabilities through the private process in
178
- [`SECURITY.md`](SECURITY.md), never through a public issue.
136
+ Developing the CLI itself? Start with the [developer guide](dev-docs/README.md)
137
+ and [contribution guide](CONTRIBUTING.md). Report vulnerabilities through the
138
+ private process in [SECURITY.md](SECURITY.md), never through a public issue.
179
139
 
180
- The Logfire CLI is released under the [MIT License](LICENSE).
140
+ Logfire CLI is released under the [MIT License](LICENSE).
package/bin/logfire CHANGED
Binary file
package/package.json CHANGED
@@ -11,5 +11,5 @@
11
11
  ],
12
12
  "preferUnplugged": true,
13
13
  "repository": "https://github.com/pydantic/logfire-cli",
14
- "version": "0.1.3"
14
+ "version": "0.1.5"
15
15
  }