@tsuga/cli 1.0.19 → 1.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 (3) hide show
  1. package/README.md +51 -6
  2. package/dist/cli.js +147 -66
  3. package/package.json +3 -3
package/README.md CHANGED
@@ -22,18 +22,63 @@ tsuga self-update
22
22
 
23
23
  This runs `npm install -g @tsuga/cli@latest`. The CLI also checks for new versions once a day and prints a notice when one is available.
24
24
 
25
+ ## Shell completion
26
+
27
+ Tab-complete commands and flags in `bash`, `zsh`, or `fish`.
28
+
29
+ For `bash` and `zsh`, add the matching line to your shell startup file:
30
+
31
+ ```bash
32
+ # ~/.bashrc
33
+ eval "$(tsuga completion bash)"
34
+
35
+ # ~/.zshrc
36
+ eval "$(tsuga completion zsh)"
37
+ ```
38
+
39
+ Then open a new shell (or `source` the file).
40
+
41
+ For `fish`, write the script to your completions directory:
42
+
43
+ ```fish
44
+ tsuga completion fish > ~/.config/fish/completions/tsuga.fish
45
+ ```
46
+
47
+ Fish loads it automatically in new shells.
48
+
25
49
  ## Authentication
26
50
 
27
- Before authenticating, generate an Operation API key from your [Tsuga account settings](https://app.tsuga.com/settings/api-keys?operation=true).
51
+ All authentication lives under `tsuga auth`.
52
+
53
+ ### Log in as a user (recommended)
54
+
55
+ For interactive use, log in as a user with a browser authorization flow:
56
+
57
+ ```bash
58
+ # Prints an authorization URL. On macOS, also opens it in your browser.
59
+ tsuga auth login
60
+
61
+ # Print the saved user access token
62
+ tsuga auth token
63
+
64
+ # Show the current authentication method
65
+ tsuga auth status
66
+
67
+ # Clear the saved user session
68
+ tsuga auth logout
69
+ ```
70
+
71
+ After `tsuga auth login`, commands work without an Operation API key.
72
+
73
+ ### Operation API key
28
74
 
29
- The recommended way to authenticate is to save your Operation API key once:
75
+ For non-interactive use (CI, scripts), authenticate with an Operation API key. Generate one from your [Tsuga account settings](https://app.tsuga.com/settings/api-keys?operation=true), then save it once:
30
76
 
31
77
  ```bash
32
- tsuga auth <operation-api-key>
78
+ tsuga auth operation-key <operation-api-key>
33
79
  ```
34
80
 
35
- This writes your operation-api-key to `~/.config/tsuga/config.json`.
36
- Alternatively, set credentials per-session without saving:
81
+ This writes your operation-api-key to `~/.config/tsuga/config.json`. Alternatively, set it per-session without saving:
37
82
 
38
83
  ```bash
39
84
  # Environment variable
@@ -43,7 +88,7 @@ export TSUGA_OPERATION_API_KEY=<operation-api-key>
43
88
  tsuga --operation-api-key <operation-api-key> dashboards list
44
89
  ```
45
90
 
46
- Priority order: `--operation-api-key` flag → `TSUGA_OPERATION_API_KEY` env var → saved config.
91
+ A `--operation-api-key` flag or `TSUGA_OPERATION_API_KEY` env var overrides the saved credential for that one invocation.
47
92
 
48
93
  ## Configuration
49
94