@gitterm/cli 0.0.1 → 0.0.4
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 +67 -6
- package/dist/index.js +1433 -1202
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# gitterm
|
|
1
|
+
# @gitterm/cli
|
|
2
2
|
|
|
3
3
|
Command-line interface for [GitTerm](https://gitterm.dev) to manage your cloud
|
|
4
4
|
workspaces from the terminal.
|
|
@@ -7,10 +7,10 @@ workspaces from the terminal.
|
|
|
7
7
|
|
|
8
8
|
```bash
|
|
9
9
|
# Run directly with npx
|
|
10
|
-
npx gitterm --help
|
|
10
|
+
npx @gitterm/cli --help
|
|
11
11
|
|
|
12
12
|
# Or install globally
|
|
13
|
-
npm install -g gitterm
|
|
13
|
+
npm install -g @gitterm/cli
|
|
14
14
|
```
|
|
15
15
|
|
|
16
16
|
## Quick Start
|
|
@@ -27,6 +27,52 @@ gitterm workspace pause <workspaceId>
|
|
|
27
27
|
gitterm workspace restart <workspaceId>
|
|
28
28
|
```
|
|
29
29
|
|
|
30
|
+
## Switching servers (hosted vs self-hosted)
|
|
31
|
+
|
|
32
|
+
By default the CLI talks to the hosted GitTerm API at `https://api.gitterm.dev`.
|
|
33
|
+
If you run your own GitTerm instance, point the CLI at that server instead.
|
|
34
|
+
|
|
35
|
+
### Option 1: Login with `--server`
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
# Hosted (default)
|
|
39
|
+
gitterm login
|
|
40
|
+
|
|
41
|
+
# Self-hosted
|
|
42
|
+
gitterm login --server https://gitterm.example.com
|
|
43
|
+
|
|
44
|
+
# Local development
|
|
45
|
+
gitterm login --server http://localhost:3000
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
The chosen URL is saved in `~/.config/gitterm/cli.json` and used by later commands.
|
|
49
|
+
|
|
50
|
+
### Option 2: Environment variables
|
|
51
|
+
|
|
52
|
+
Env vars override the saved config (useful for CI or one-off commands):
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
export GITTERM_SERVER_URL=https://gitterm.example.com
|
|
56
|
+
export GITTERM_API_TOKEN=gt_... # from Settings → Account → API tokens
|
|
57
|
+
|
|
58
|
+
gitterm auth status
|
|
59
|
+
gitterm workspace list
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
| Variable | Purpose |
|
|
63
|
+
| -------------------- | --------------------------------------- |
|
|
64
|
+
| `GITTERM_SERVER_URL` | API base URL (no trailing path) |
|
|
65
|
+
| `GITTERM_API_TOKEN` | `gt_...` token; skips device-code login |
|
|
66
|
+
|
|
67
|
+
Resolution order for each request: **explicit options / env vars → saved CLI config → default hosted URL** (for login only).
|
|
68
|
+
|
|
69
|
+
Check which server you are on:
|
|
70
|
+
|
|
71
|
+
```bash
|
|
72
|
+
gitterm auth status
|
|
73
|
+
# Server: http://localhost:3000
|
|
74
|
+
```
|
|
75
|
+
|
|
30
76
|
## Commands
|
|
31
77
|
|
|
32
78
|
| Command | Description |
|
|
@@ -52,9 +98,24 @@ code, you approve the device in your browser, and the CLI receives a user API to
|
|
|
52
98
|
- Credentials are stored in `~/.config/gitterm/cli.json`
|
|
53
99
|
- The same token works with [`@gitterm/sdk`](https://www.npmjs.com/package/@gitterm/sdk)
|
|
54
100
|
and other GitTerm integrations
|
|
55
|
-
-
|
|
56
|
-
|
|
57
|
-
|
|
101
|
+
- Create revocable tokens in the dashboard under **Settings → Account → API tokens**
|
|
102
|
+
and pass them via `GITTERM_API_TOKEN` (with optional `GITTERM_SERVER_URL`)
|
|
103
|
+
|
|
104
|
+
## Inside a GitTerm workspace
|
|
105
|
+
|
|
106
|
+
GitTerm injects a separate workspace identity and installs the CLI in supported agent
|
|
107
|
+
images. When those credentials are present, the CLI switches to a restricted command set:
|
|
108
|
+
|
|
109
|
+
```bash
|
|
110
|
+
gitterm workspace info
|
|
111
|
+
gitterm ports list
|
|
112
|
+
gitterm ports open 3000 --name app
|
|
113
|
+
gitterm ports close 3000
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
No account commands are exposed in this mode. The workspace cannot list or operate on
|
|
117
|
+
other workspaces and cannot create a workspace. The CLI does not fall back to a saved user
|
|
118
|
+
login when any workspace identity variable is present.
|
|
58
119
|
|
|
59
120
|
## Programmatic use
|
|
60
121
|
|