@pydantic/logfire-cli-linux-x64 0.1.1

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 (4) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +168 -0
  3. package/bin/logfire +0 -0
  4. package/package.json +18 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2023 - present Pydantic Services inc.
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,168 @@
1
+ # Logfire CLI
2
+
3
+ Rust command-line tools for [Pydantic Logfire](https://pydantic.dev/logfire).
4
+
5
+ `logfire` authenticates against the hosted (or self-hosted) Logfire API, drives
6
+ the public Logfire MCP server, points a project at Logfire, and exposes the typed
7
+ Platform API — with first-class machine output for scripts and coding agents.
8
+
9
+ ## Quickstart
10
+
11
+ ```bash
12
+ cargo install --path crates/logfire-cli # see docs/installation.md for details
13
+ logfire auth # browser OAuth into the OS keychain
14
+ logfire mcp tools list # use that session against public MCP
15
+ ```
16
+
17
+ ## Commands
18
+
19
+ | Command | What it does |
20
+ | --- | --- |
21
+ | [`logfire auth`](docs/authentication.md) | Browser OAuth shared by CLI and MCP |
22
+ | [`logfire init`](docs/commands/init.md) | Point a directory at a Logfire project |
23
+ | [`logfire project`](docs/commands/project.md) | Validate and show the configured SDK project |
24
+ | [`logfire token`](docs/commands/token.md) | Mint a project read/write token and print it |
25
+ | [`logfire api-key`](docs/commands/api-key.md) | Mint a project-scoped API key and print it |
26
+ | [`logfire api`](docs/commands/api.md) | Typed Platform API endpoints |
27
+ | [`logfire mcp`](docs/commands/mcp.md) | Discover and call the public Logfire MCP server |
28
+ | [`logfire doctor`](docs/commands/doctor.md) | Diagnose local prerequisites without exposing secrets |
29
+
30
+ Every command and group accepts `--help`.
31
+
32
+ ## Documentation
33
+
34
+ The [**User Guide**](docs/README.md) covers everything in task-oriented pages:
35
+
36
+ - [Installation](docs/installation.md) — the binary and shell completions
37
+ - [Authentication](docs/authentication.md) — logins, regions, `LOGFIRE_TOKEN`, and OS-keychain storage
38
+ - [Output contracts](docs/output-contracts.md) — human vs. `--output json`/`jsonl`, the envelope, exit codes, and flag precedence
39
+
40
+ Global options apply before or after every command. `--region us|eu` (env
41
+ `PYDANTIC_LOGFIRE_REGION`) chooses a hosted region, while `--base-url <URL>`
42
+ (env `LOGFIRE_BASE_URL`) targets a self-hosted or staging instance and overrides
43
+ it. `--output human|json|jsonl`, `--no-input`, and `--color auto|always|never`
44
+ provide the shared presentation and prompting contract.
45
+
46
+ ## Architecture
47
+
48
+ The CLI is a Cargo workspace of small, single-purpose crates:
49
+
50
+ | Crate | Role |
51
+ | --- | --- |
52
+ | `logfire-cli` | The `logfire` binary: argument parsing (clap) and command dispatch. |
53
+ | `logfire-api` | The typed `logfire api` command surface over the generated client. |
54
+ | `logfire-api-client` | Generated from the OpenAPI schemas (see below); never hand-edited. |
55
+ | `logfire-auth` | Standards-based browser OAuth orchestration. |
56
+ | `logfire-config` | Credential resolution, regions / base-URL, and the request context. |
57
+ | `logfire-init` | `logfire init` project setup and the `.logfire/` credentials file. |
58
+ | `logfire-mcp-core` | Pure, I/O-free decision core for global input/output, envelope, limit, and error-category contracts. |
59
+ | `logfire-mcp-client` | Official `rmcp` transport, standards OAuth, bounded protocol I/O, and protocol-faithful fakes. |
60
+
61
+ See [`dev-docs/ARCHITECTURE.md`](dev-docs/ARCHITECTURE.md) for the product
62
+ boundaries and trust model, and [`dev-docs/CRATE_RULES.md`](dev-docs/CRATE_RULES.md)
63
+ for each crate's dependency and I/O contract.
64
+
65
+ ### Design notes
66
+
67
+ - **No `unsafe`.** The workspace sets `unsafe_code = "forbid"`; safe `std`/`nix`
68
+ APIs have covered every need, and `forbid` (unlike `deny`) can't be overridden
69
+ locally.
70
+ - **Small release binary.** The release profile trades a little compile time for
71
+ size (`opt-level = "z"`, fat LTO, one codegen unit, `strip`, `panic = "abort"`),
72
+ taking the macOS arm64 binary from ~15 MB to ~3.6 MB. Because `panic = "abort"`
73
+ skips unwinding, a panic ends the process without running destructors — fine for
74
+ a CLI, but note a task panic aborts the whole process rather than just that task.
75
+ - **TLS via `ring`, not `aws-lc`.** `reqwest`/`rustls` use the `ring` crypto
76
+ provider — much smaller, and no `cmake` at build time. Trade-off: `ring` cannot
77
+ verify P-521-signed certificates, so TLS can fail behind a corporate
78
+ TLS-inspection proxy or Cloudflare WARP that uses a P-521 CA. If you hit that,
79
+ the crypto provider is why; switching `reqwest` back to the default `rustls`
80
+ (`aws-lc`) provider fixes it.
81
+ - **Quality bars are enforced in CI, not by convention.** Clippy runs at
82
+ `-D warnings` with the `pedantic` group and `unwrap`/`expect`/`panic` denied in
83
+ library and binary code; `cargo-deny` gates licenses and duplicate dependencies;
84
+ 100% line/function coverage for every handwritten crate
85
+ (`scripts/check_coverage.py`) and an architecture
86
+ policy check (`scripts/check_policy.py`) block regressions; `cargo doc` runs
87
+ with warnings as errors. See [`CLAUDE.md`](CLAUDE.md) for the code-style rules
88
+ and [`dev-docs/RUST-CONVENTIONS.md`](dev-docs/RUST-CONVENTIONS.md) for the
89
+ reviewed conventions.
90
+
91
+ ## Generated API Client
92
+
93
+ `crates/logfire-api-client` is generated exclusively from Logfire's documented
94
+ Platform schema at `/api/openapi.json`. The client lives under
95
+ `logfire_api_client::platform`; private or compatibility schemas are not shipped.
96
+
97
+ The normalized inputs and their provenance are committed under `openapi/`. To
98
+ refresh the snapshot from its reviewed public HTTPS URL, inspect the schema diff,
99
+ and then regenerate the client:
100
+
101
+ ```bash
102
+ make refresh-openapi
103
+ make generate-api-client
104
+ ```
105
+
106
+ `make refresh-openapi` replaces the snapshot and its SHA-256 provenance as one
107
+ validated set. It deliberately leaves the generated checksum failing until
108
+ `make generate-api-client` succeeds, so refreshed inputs cannot masquerade as a
109
+ current client.
110
+
111
+ The crate is derived output: **never hand-edit it.** The generator cannot produce
112
+ it correctly on its own, so `scripts/generate-api-client.sh` applies a handful of
113
+ fix-ups afterwards (crate-relative import rewriting, missing recursive-schema type
114
+ aliases, bounded response reads, channel discriminators, and the lint config).
115
+ Anything that needs to persist across a
116
+ regeneration belongs in that script's fix-up section.
117
+
118
+ The script requires Docker and uses OpenAPI Generator 7.22.0 through the exact OCI
119
+ image digest recorded in `openapi/provenance.toml`. It constructs and formats a
120
+ staging workspace, tests it against the exact lockfile, and only then replaces the
121
+ client; a final locked compile remains rollback-protected. The committed checksum
122
+ binds the schema snapshots, provenance, generation recipe, formatting config, and
123
+ complete output tree, so ordinary CI detects input or generated-client drift without
124
+ network access.
125
+
126
+ ## Development
127
+
128
+ The hosted Logfire MCP server is the primary boundary for new remote product
129
+ capabilities; the documented Platform OpenAPI is the secondary typed automation
130
+ surface, and handwritten `/v1` calls are forbidden. See
131
+ [`dev-docs/ARCHITECTURE.md`](dev-docs/ARCHITECTURE.md) and
132
+ [`dev-docs/adr/0001-mcp-first-client.md`](dev-docs/adr/0001-mcp-first-client.md)
133
+ before adding a command or remote dependency, and
134
+ [`dev-docs/CHANGE_MAP.md`](dev-docs/CHANGE_MAP.md) for the files, tests, and docs
135
+ that must change together. Pure MCP command contracts live in `logfire-mcp-core`;
136
+ transport and OAuth stay in separate adapters.
137
+
138
+ Run the fast stable checks used by CI:
139
+
140
+ ```bash
141
+ make ci
142
+ ```
143
+
144
+ Before handing work off, run the pinned nightly formatter and Clippy lane too:
145
+
146
+ ```bash
147
+ make ci-all
148
+ ```
149
+
150
+ Enforce 100% line and function coverage for every handwritten crate and render
151
+ text/HTML reports:
152
+
153
+ ```bash
154
+ make coverage
155
+ ```
156
+
157
+ The stable compiler is pinned in `rust-toolchain.toml`; the nightly formatter
158
+ and lint toolchain is pinned by `NIGHTLY_TOOLCHAIN` in the `Makefile`. See
159
+ [`dev-docs/VERIFICATION.md`](dev-docs/VERIFICATION.md) for scope, tool installation,
160
+ and the rules for raising coverage floors.
161
+
162
+ ## Contributing and security
163
+
164
+ See [`CONTRIBUTING.md`](CONTRIBUTING.md) for the development and pull-request
165
+ contract. Report vulnerabilities through the private process in
166
+ [`SECURITY.md`](SECURITY.md), never through a public issue.
167
+
168
+ The Logfire CLI is released under the [MIT License](LICENSE).
package/bin/logfire ADDED
Binary file
package/package.json ADDED
@@ -0,0 +1,18 @@
1
+ {
2
+ "cpu": [
3
+ "x64"
4
+ ],
5
+ "description": "Native binary for @pydantic/logfire-cli-linux-x64.",
6
+ "homepage": "https://pydantic.dev/logfire",
7
+ "libc": [
8
+ "glibc"
9
+ ],
10
+ "license": "MIT",
11
+ "name": "@pydantic/logfire-cli-linux-x64",
12
+ "os": [
13
+ "linux"
14
+ ],
15
+ "preferUnplugged": true,
16
+ "repository": "https://github.com/pydantic/logfire-cli",
17
+ "version": "0.1.1"
18
+ }