@gitterm/cli 0.0.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 +73 -0
- package/dist/index.js +10239 -0
- package/package.json +45 -0
package/README.md
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
# gitterm
|
|
2
|
+
|
|
3
|
+
Command-line interface for [GitTerm](https://gitterm.dev) to manage your cloud
|
|
4
|
+
workspaces from the terminal.
|
|
5
|
+
|
|
6
|
+
## Installation
|
|
7
|
+
|
|
8
|
+
```bash
|
|
9
|
+
# Run directly with npx
|
|
10
|
+
npx gitterm --help
|
|
11
|
+
|
|
12
|
+
# Or install globally
|
|
13
|
+
npm install -g gitterm
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
## Quick Start
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
# 1. Sign in (device-code flow: visit the printed URL and enter the code)
|
|
20
|
+
gitterm login
|
|
21
|
+
|
|
22
|
+
# 2. List your workspaces
|
|
23
|
+
gitterm workspace list
|
|
24
|
+
|
|
25
|
+
# 3. Manage a workspace
|
|
26
|
+
gitterm workspace pause <workspaceId>
|
|
27
|
+
gitterm workspace restart <workspaceId>
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## Commands
|
|
31
|
+
|
|
32
|
+
| Command | Description |
|
|
33
|
+
| ------------------------------------------------------------------------------------ | --------------------------------- |
|
|
34
|
+
| `gitterm login [--server <url>]` | Sign in via device-code flow |
|
|
35
|
+
| `gitterm logout` | Clear saved credentials |
|
|
36
|
+
| `gitterm auth status [--json]` | Show the logged-in account |
|
|
37
|
+
| `gitterm workspace list [--status <active\|all\|terminated>] [--limit <n>] [--json]` | List your workspaces |
|
|
38
|
+
| `gitterm workspace get <workspaceId> [--json]` | Show details for a workspace |
|
|
39
|
+
| `gitterm workspace pause <workspaceId> [--json]` | Pause a running workspace |
|
|
40
|
+
| `gitterm workspace restart <workspaceId> [--json]` | Restart a paused workspace |
|
|
41
|
+
| `gitterm workspace terminate <workspaceId> [--yes] [--json]` | Terminate a workspace permanently |
|
|
42
|
+
|
|
43
|
+
`ws` works as a shorthand for `workspace`. All read/write commands accept `--json`
|
|
44
|
+
for machine-readable output (errors are emitted as JSON on stderr too), which makes
|
|
45
|
+
the CLI easy to drive from scripts and editor plugins.
|
|
46
|
+
|
|
47
|
+
## Authentication
|
|
48
|
+
|
|
49
|
+
`gitterm login` uses a device-code flow: it prints a verification URL and a short
|
|
50
|
+
code, you approve the device in your browser, and the CLI receives a user API token.
|
|
51
|
+
|
|
52
|
+
- Credentials are stored in `~/.config/gitterm/cli.json`
|
|
53
|
+
- The same token works with [`@gitterm/sdk`](https://www.npmjs.com/package/@gitterm/sdk)
|
|
54
|
+
and other GitTerm integrations
|
|
55
|
+
- `GITTERM_API_TOKEN` / `GITTERM_SERVER_URL` environment variables override the
|
|
56
|
+
saved config, useful with revocable tokens created in the dashboard under
|
|
57
|
+
**Settings → Account → API tokens** (e.g. for CI)
|
|
58
|
+
|
|
59
|
+
## Programmatic use
|
|
60
|
+
|
|
61
|
+
This CLI is a thin layer over `@gitterm/sdk`. If you are building an integration,
|
|
62
|
+
use the SDK directly:
|
|
63
|
+
|
|
64
|
+
```ts
|
|
65
|
+
import { createGittermClient } from "@gitterm/sdk";
|
|
66
|
+
|
|
67
|
+
const client = createGittermClient(); // reads the CLI's saved login
|
|
68
|
+
const { workspaces } = await client.workspaces.list();
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
## License
|
|
72
|
+
|
|
73
|
+
MIT
|