@tailglow/cli 0.5.1 → 0.6.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/README.md +46 -8
- package/package.json +1 -1
- package/src/commands.generated.js +531 -46
- package/src/config-command.js +14 -10
- package/src/config.js +210 -16
- package/src/docs-command.js +139 -0
- package/src/docs.generated.js +73 -0
- package/src/help.js +59 -14
- package/src/index.js +96 -28
- package/src/login-command.js +957 -0
- package/src/output.js +28 -0
- package/src/request.js +125 -12
- package/src/types.d.ts +41 -1
package/README.md
CHANGED
|
@@ -6,7 +6,7 @@ same API by construction.
|
|
|
6
6
|
|
|
7
7
|
```bash
|
|
8
8
|
npm install -g @tailglow/cli
|
|
9
|
-
tglow
|
|
9
|
+
tglow login
|
|
10
10
|
tglow projects list
|
|
11
11
|
```
|
|
12
12
|
|
|
@@ -24,7 +24,7 @@ alias tg=tglow
|
|
|
24
24
|
tglow <resource> <command> [flags]
|
|
25
25
|
```
|
|
26
26
|
|
|
27
|
-
Run `tglow` for the resources, `tglow <resource>` for its commands, and
|
|
27
|
+
Run `tglow help` for the resources, `tglow <resource>` for its commands, and
|
|
28
28
|
`tglow <resource> <command> --help` for the flags, their types, allowed values and requiredness.
|
|
29
29
|
|
|
30
30
|
```bash
|
|
@@ -42,8 +42,31 @@ tglow views create-join --project prj_x --joins '[{"view_id":"view_b","on":"user
|
|
|
42
42
|
|
|
43
43
|
## Credentials
|
|
44
44
|
|
|
45
|
-
|
|
46
|
-
|
|
45
|
+
In a terminal, `tglow` offers sign-in when no credential is configured for the selected API.
|
|
46
|
+
Choose an account, an API key, or Cancel. `tglow help` and `tglow --help` always show help.
|
|
47
|
+
When a credential is configured, or without an interactive terminal, `tglow` shows help.
|
|
48
|
+
|
|
49
|
+
`tglow login` signs in through the browser: it opens an approval page, you check the code matches
|
|
50
|
+
and approve, and the CLI stores the credential in `~/.tailglow/config.json` (mode 0600). Choose your
|
|
51
|
+
account (a CLI session that acts as you, in the team you choose) or an API key for one team.
|
|
52
|
+
In a terminal it counts down to the code's expiry, ten minutes after creation. It makes a final
|
|
53
|
+
poll to collect an approval given just before expiry, then ends cleanly if the code expired.
|
|
54
|
+
Run `tglow login` to try again. If the server still reports pending, the CLI keeps the sign-in and
|
|
55
|
+
shows `tglow login --wait` to resume. These normal interactive endings exit `0`; `--wait` retains
|
|
56
|
+
exit `75` while pending. A request in progress can finish after expiry to avoid losing a credential.
|
|
57
|
+
Without a terminal (an agent, a script) it prints the link and exits; approve it, then run
|
|
58
|
+
`tglow login --wait`.
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
tglow login # asks which method in a terminal
|
|
62
|
+
tglow login --method api-key # skip the question
|
|
63
|
+
tglow login --wait # collect a sign-in started without a terminal
|
|
64
|
+
tglow whoami # who the CLI is acting as, in which team
|
|
65
|
+
tglow logout # end the credential and remove it
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
An API key works too. Precedence is `--api-key`, then `TAILGLOW_API_KEY`, then the `tglow login`
|
|
69
|
+
credential, then a stored `api_key`:
|
|
47
70
|
|
|
48
71
|
```bash
|
|
49
72
|
tglow projects list --api-key tg_api_... # this call only
|
|
@@ -51,7 +74,8 @@ TAILGLOW_API_KEY=tg_api_... tglow projects list
|
|
|
51
74
|
tglow config set api_key tg_api_... # ~/.tailglow/config.json, mode 0600
|
|
52
75
|
```
|
|
53
76
|
|
|
54
|
-
A
|
|
77
|
+
A login credential is only ever sent to the API that issued it, and no credential is printed
|
|
78
|
+
back, by `config get` or anything else.
|
|
55
79
|
|
|
56
80
|
`tglow config` also stores a default `project` and `team`, which is what lets
|
|
57
81
|
`tglow metrics list` work without repeating the project on every call. Those two are the only
|
|
@@ -92,13 +116,27 @@ and `--limit` on its own when you want a single page.
|
|
|
92
116
|
A delete asks for confirmation in a terminal. `--yes` skips the prompt, and a non-interactive run
|
|
93
117
|
proceeds without one, so scripts and agents are not blocked on a question they cannot answer.
|
|
94
118
|
|
|
119
|
+
## Docs
|
|
120
|
+
|
|
121
|
+
Every guide and API reference page ships with the CLI, so reading them needs no network:
|
|
122
|
+
|
|
123
|
+
```bash
|
|
124
|
+
tglow docs # the index of every page
|
|
125
|
+
tglow docs guides/sdk # one page, as markdown
|
|
126
|
+
tglow docs /api/drains.md # any link from the index works as it is
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
Pages print as markdown even when piped; `--json` returns `{ path, url, content }` for a page, or
|
|
130
|
+
`{ index, pages, online }` for the index.
|
|
131
|
+
|
|
95
132
|
## Development
|
|
96
133
|
|
|
97
134
|
```bash
|
|
98
135
|
bun run tglow <resource> <command> # run from source, without installing
|
|
99
136
|
bun run test:cli # unit tests, no network
|
|
100
|
-
bun run build:llms # regenerate src/commands.generated.js
|
|
137
|
+
bun run build:llms # regenerate src/commands.generated.js and src/docs.generated.js
|
|
101
138
|
```
|
|
102
139
|
|
|
103
|
-
`src/commands.generated.js`
|
|
104
|
-
Adding a route to the API adds its command here with no change to this
|
|
140
|
+
`src/commands.generated.js` and `src/docs.generated.js` are written by `scripts/build/llms.build.js`
|
|
141
|
+
and are never edited by hand. Adding a route to the API adds its command here with no change to this
|
|
142
|
+
package, and editing a guide changes the bundled page the same way.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tailglow/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "The Tailglow command line. Every command is generated from the Tailglow API reference, so the CLI and the documentation can never describe different APIs.",
|
|
6
6
|
"bin": {
|