neatlogs-cli 0.2.0 → 0.2.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.
package/CHANGELOG.md CHANGED
@@ -2,7 +2,15 @@
2
2
 
3
3
  All notable changes to `neatlogs-cli` are documented in this file.
4
4
 
5
- ## Unreleased
5
+ ## 0.2.1
6
+
7
+ - Verify `auth status` against the Public API instead of treating a configured
8
+ credential as authenticated; return exit 3 for rejected or missing credentials.
9
+ - Add explicit `--credential-source profile|token|auto` selection so SDK keys
10
+ can coexist with stored OAuth or service-account credentials. Automatic
11
+ precedence, conflict rejection, and host binding remain unchanged.
12
+ - Explain host selection, project discovery and credential recovery in JSON
13
+ and terminal diagnostics; update the onboarding and installation guidance.
6
14
 
7
15
  ## 0.2.0
8
16
 
package/README.md CHANGED
@@ -34,20 +34,18 @@ flowchart LR
34
34
 
35
35
  ## Human quickstart
36
36
 
37
- The stable release candidate in this checkout is `neatlogs-cli@0.1.0`, under
38
- the MIT license in [LICENSE](LICENSE). It is not published by a source change.
39
- Verify `npm view neatlogs-cli@0.1.0 version` before using the stable install
40
- command; the currently published team-test release remains available through
41
- `npm install --global neatlogs-cli@team-test` until the reviewed release ships.
37
+ This checkout prepares `neatlogs-cli@0.2.1`, under the MIT license in
38
+ [LICENSE](LICENSE). Release changes are described in [CHANGELOG.md](CHANGELOG.md).
39
+ Publication is a separate release step; check `npm view neatlogs-cli version`
40
+ for the current stable release.
42
41
 
43
42
  1. Install the CLI and confirm that it runs.
44
43
 
45
44
  ```bash
46
- npm install --global neatlogs-cli@0.1.0
45
+ npm install --global neatlogs-cli
47
46
  neatlogs --version
48
47
  ```
49
48
 
50
- The stable candidate is `0.1.0`; publication must be independently verified.
51
49
  Use Node.js 22 or
52
50
  24. The complete dev setup and verification flow is in the
53
51
  [team quickstart](../backend/docs/public-api/dev-team-quickstart.md).
@@ -55,34 +53,57 @@ command; the currently published team-test release remains available through
55
53
  2. Save the host, select the profile, and sign in.
56
54
 
57
55
  ```bash
58
- neatlogs profile set work --host '<https-app-origin>'
56
+ neatlogs profile set work --host 'https://app.neatlogs.com'
59
57
  neatlogs profile use work
60
- neatlogs auth login
58
+ neatlogs --host https://app.neatlogs.com --profile work auth login --device
61
59
  ```
62
60
 
63
- An interactive terminal opens browser OAuth and prints the URL as a
64
- copy/paste fallback. A non-interactive or headless terminal automatically
65
- uses Device Flow; `--device` selects it explicitly.
61
+ Approve the displayed code in your browser. Omit `--device` for browser
62
+ OAuth on an interactive terminal; headless terminals use Device Flow.
66
63
 
67
64
  3. List the projects you can access.
68
65
 
69
66
  ```bash
70
- neatlogs projects list
67
+ env -u NEATLOGS_API_KEY -u NEATLOGS_TOKEN -u NEATLOGS_PROJECT_ID neatlogs --profile work projects list
71
68
  ```
72
69
 
73
70
  4. Save the project you want this profile to use.
74
71
 
75
72
  ```bash
76
- neatlogs profile set work --host '<https-app-origin>' --project '<project-uuid>'
73
+ neatlogs profile set work --host 'https://app.neatlogs.com' --project '<project-uuid>'
77
74
  ```
78
75
 
79
76
  5. Check your identity and read recent traces.
80
77
 
81
78
  ```bash
82
- neatlogs whoami
83
- neatlogs traces list --limit 10
79
+ env -u NEATLOGS_API_KEY -u NEATLOGS_TOKEN neatlogs --profile work whoami
80
+ env -u NEATLOGS_API_KEY -u NEATLOGS_TOKEN neatlogs --profile work traces list --limit 10
81
+ env -u NEATLOGS_API_KEY -u NEATLOGS_TOKEN neatlogs --profile work traces get <trace-id>
84
82
  ```
85
83
 
84
+ The read commands use POSIX `env -u` to exclude SDK credentials only from the
85
+ CLI process, keeping them available to the application. In other shells, use
86
+ an equivalent clean credential environment. These examples work with the
87
+ published 0.2.0 package.
88
+
89
+ These examples use the US dashboard host; use `https://eu.app.neatlogs.com`
90
+ for EU. `projects list` must run without `--project` or `NEATLOGS_PROJECT_ID`.
91
+ A saved profile's project is automatically omitted for discovery.
92
+
93
+ `--credential-source profile` (available in 0.2.1) ignores both credential environment
94
+ variables and uses the selected or active profile's stored OAuth login. This
95
+ lets an SDK application keep its `NEATLOGS_API_KEY` in the same shell. With the
96
+ published 0.2.0 CLI, omit this new option and run each OAuth CLI command through
97
+ `env -u NEATLOGS_API_KEY -u NEATLOGS_TOKEN` on POSIX shells, or use an equivalent
98
+ clean credential environment on other platforms. Do not remove the SDK key
99
+ from the application's configuration.
100
+
101
+ A key-only user can verify SDK ingestion/readback with the SDK's documented
102
+ `doctor --local` and `doctor --probe` commands without CLI login. Report CLI
103
+ readback as **waiting on a human** unless OAuth approval or a suitable service
104
+ account is available. A synthetic probe proves the telemetry pipeline; verify
105
+ the application's actual trace separately.
106
+
86
107
  `profile set` stores non-secret host and project preferences. Login stores the
87
108
  OAuth credentials separately in the native operating-system vault.
88
109
 
@@ -587,8 +608,26 @@ request.
587
608
  ## Configuration and output
588
609
 
589
610
  - `NEATLOGS_TOKEN` is the primary credential source; `NEATLOGS_API_KEY` is the
590
- legacy fallback. An environment credential takes precedence over a selected
591
- stored profile and is identified as `environment` by `auth status`.
611
+ legacy public API key fallback, not an SDK project key. In the default
612
+ `--credential-source auto` mode, environment credentials take precedence over
613
+ a selected stored profile and differing token/key values fail closed.
614
+ - `--credential-source profile` explicitly ignores both credential environment
615
+ variables and uses the saved login, including its host/project defaults.
616
+ Host overrides must still match the credential-bound host.
617
+ - `--credential-source token` reads only `NEATLOGS_TOKEN`, ignoring the SDK's
618
+ `NEATLOGS_API_KEY`. A missing or invalid token fails without falling back to
619
+ another identity. Use this for service-account automation sharing an SDK shell.
620
+ - `auth status` now verifies access against the public API. OAuth and service
621
+ tokens use project discovery (`context:read`); legacy public API keys use
622
+ their bound `whoami` context. No selected project is needed. Rejected/missing
623
+ credentials report `authenticated: false` and exit 3. Scope failures and
624
+ network failures retain their distinct errors instead of claiming the user
625
+ is signed out. Success reports `verification: "public_api"`; this does not
626
+ guarantee permission to read every project's traces.
627
+ Older published clients only checked local credential presence, so use
628
+ project-scoped `whoami` and a trace read when validating those versions.
629
+ - Authentication and configuration diagnostics include a static, secret-free
630
+ `hint` in JSON and human output with the recovery steps.
592
631
  - `--profile <name>` selects non-secret host/project preferences and its
593
632
  separately stored OAuth credential. Stored tokens are never sent when a
594
633
  `--host` or `NEATLOGS_HOST` override differs from the credential-bound host.