Skip to content

Commit 14d8756

Browse files
authored
2 parents 92b557a + 5295a3f commit 14d8756

104 files changed

Lines changed: 5063 additions & 3484 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/ci.yaml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,16 @@ on:
88
push:
99
branches:
1010
- main
11+
workflow_dispatch:
1112

1213
jobs:
1314
build:
1415
runs-on: ubuntu-latest
1516
steps:
16-
- uses: actions/checkout@v4
17+
- uses: actions/checkout@v5
1718
with:
1819
fetch-depth: 0
19-
- uses: actions/setup-node@v4
20+
- uses: actions/setup-node@v5
2021
with:
2122
node-version: '22'
2223
- run: npm ci
@@ -28,12 +29,12 @@ jobs:
2829

2930
integration:
3031
runs-on: ubuntu-latest
31-
if: github.event_name == 'push'
32+
if: github.event_name == 'push' || github.event_name == 'workflow_dispatch'
3233
steps:
33-
- uses: actions/checkout@v4
34+
- uses: actions/checkout@v5
3435
with:
3536
fetch-depth: 0
36-
- uses: actions/setup-node@v4
37+
- uses: actions/setup-node@v5
3738
with:
3839
node-version: '22'
3940
- run: npm ci

.github/workflows/release.yaml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,20 +21,21 @@ jobs:
2121

2222
steps:
2323
# Checkout code with full history to get tags
24-
- uses: actions/checkout@v4
24+
- uses: actions/checkout@v5
2525
with:
2626
fetch-depth: 0
2727

2828
# Set up Node.js
29-
- uses: actions/setup-node@v4
29+
- uses: actions/setup-node@v5
3030
with:
3131
node-version: '22'
3232

3333
# Install dependencies, test, and build
3434
- run: npm ci
3535
- run: npm run lint
3636
- run: npm run build
37-
- run: npm run test:all
37+
- run: npm run test
38+
- run: npm run test:integration
3839
env:
3940
TIGRIS_STORAGE_ACCESS_KEY_ID: ${{ secrets.TIGRIS_STORAGE_ACCESS_KEY_ID }}
4041
TIGRIS_STORAGE_SECRET_ACCESS_KEY: ${{ secrets.TIGRIS_STORAGE_SECRET_ACCESS_KEY }}
@@ -60,11 +61,11 @@ jobs:
6061

6162
steps:
6263
# Checkout the release tag
63-
- uses: actions/checkout@v4
64+
- uses: actions/checkout@v5
6465
with:
6566
ref: v${{ needs.release.outputs.new_release_version }}
6667

67-
- uses: actions/setup-node@v4
68+
- uses: actions/setup-node@v5
6869
with:
6970
node-version: '22'
7071

AUTHENTICATION.md

Lines changed: 136 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,136 @@
1+
# Authentication
2+
3+
The Tigris CLI supports multiple authentication methods. When more than one is configured, the CLI uses the first match in the following priority order:
4+
5+
| Priority | Method | How to set up |
6+
|----------|--------|---------------|
7+
| 1 | AWS Profile | `AWS_PROFILE` env var + `~/.aws/credentials` |
8+
| 2 | Environment variables (AWS_) | `AWS_ACCESS_KEY_ID` + `AWS_SECRET_ACCESS_KEY` |
9+
| 3 | Environment variables (TIGRIS_) | `TIGRIS_STORAGE_ACCESS_KEY_ID` + `TIGRIS_STORAGE_SECRET_ACCESS_KEY` |
10+
| 4 | OAuth login | `tigris login` or `tigris login oauth` |
11+
| 5 | Credentials login | `tigris login credentials` |
12+
| 6 | Configured credentials | `tigris configure` |
13+
14+
Run `tigris whoami` to see which method is currently active.
15+
16+
## OAuth Login
17+
18+
The recommended method for interactive use. Opens a browser for authentication via OAuth2 device flow.
19+
20+
```sh
21+
tigris login
22+
# or explicitly:
23+
tigris login oauth
24+
```
25+
26+
OAuth sessions support organization management (`tigris orgs list`, `tigris orgs select`) and IAM operations (users, policies). Tokens are refreshed automatically.
27+
28+
## Credentials Login
29+
30+
Creates a temporary session using an access key and secret. The session is cleared on `tigris logout`, but credentials saved via `tigris configure` are preserved.
31+
32+
```sh
33+
tigris login credentials --access-key tid_AaBb --access-secret tsec_XxYy
34+
# or interactively:
35+
tigris login credentials
36+
```
37+
38+
## Configured Credentials
39+
40+
Saves access key credentials permanently to `~/.tigris/config.json`. These persist across login/logout cycles and are used as a fallback when no other login method is active.
41+
42+
```sh
43+
tigris configure --access-key tid_AaBb --access-secret tsec_XxYy
44+
```
45+
46+
You can optionally specify a custom endpoint:
47+
48+
```sh
49+
tigris configure --access-key tid_AaBb --access-secret tsec_XxYy --endpoint https://custom.endpoint.dev
50+
```
51+
52+
## Environment Variables
53+
54+
Environment variables act as per-session overrides and take priority over stored login state. This is useful for CI/CD pipelines, scripts, and testing with different credentials without affecting your local config.
55+
56+
### AWS-standard variables (highest priority)
57+
58+
```sh
59+
export AWS_ACCESS_KEY_ID=tid_AaBb
60+
export AWS_SECRET_ACCESS_KEY=tsec_XxYy
61+
# Optional: override the storage endpoint
62+
export AWS_ENDPOINT_URL_S3=https://t3.storage.dev
63+
```
64+
65+
### Tigris-specific variables
66+
67+
```sh
68+
export TIGRIS_STORAGE_ACCESS_KEY_ID=tid_AaBb
69+
export TIGRIS_STORAGE_SECRET_ACCESS_KEY=tsec_XxYy
70+
# Optional: override the storage endpoint
71+
export TIGRIS_STORAGE_ENDPOINT=https://t3.storage.dev
72+
```
73+
74+
When both AWS_ and TIGRIS_ variables are set, AWS_ takes priority.
75+
76+
### Endpoint variables
77+
78+
You can override service endpoints independently:
79+
80+
| Variable | Description | Default |
81+
|----------|-------------|---------|
82+
| `AWS_ENDPOINT_URL_S3` | Storage endpoint | `https://t3.storage.dev` |
83+
| `AWS_ENDPOINT_URL_IAM` | IAM endpoint | `https://iam.storageapi.dev` |
84+
| `TIGRIS_STORAGE_ENDPOINT` | Storage endpoint | `https://t3.storage.dev` |
85+
| `TIGRIS_IAM_ENDPOINT` | IAM endpoint (fallback) | `https://iam.storageapi.dev` |
86+
87+
AWS_ endpoint variables take priority over TIGRIS_ endpoint variables.
88+
89+
## AWS Profile
90+
91+
If you have Tigris credentials configured in `~/.aws/credentials`, the CLI picks them up automatically when `AWS_PROFILE` is set.
92+
93+
```ini
94+
# ~/.aws/credentials
95+
[tigris]
96+
aws_access_key_id = tid_AaBb
97+
aws_secret_access_key = tsec_XxYy
98+
```
99+
100+
```ini
101+
# ~/.aws/config
102+
[profile tigris]
103+
endpoint_url_s3 = https://t3.storage.dev
104+
region = auto
105+
```
106+
107+
```sh
108+
export AWS_PROFILE=tigris
109+
tigris ls
110+
```
111+
112+
## Checking Auth Status
113+
114+
```sh
115+
tigris whoami
116+
```
117+
118+
Displays the active authentication method, user info, and organization. For OAuth users, shows a list of organizations with the active one highlighted.
119+
120+
```sh
121+
tigris whoami --json
122+
```
123+
124+
Returns machine-readable JSON output including `authMethod`, `email`, `userId`, and organization details.
125+
126+
## Logout
127+
128+
```sh
129+
tigris logout
130+
```
131+
132+
Clears the current login session (OAuth tokens and temporary credentials). Credentials saved via `tigris configure` are preserved.
133+
134+
## Configuration File
135+
136+
Auth state is stored in `~/.tigris/config.json` with restrictive file permissions (600). The file is managed automatically by the CLI — you should not need to edit it directly.

INSTALL.md

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ curl -fsSL https://raw.githubusercontent.com/tigrisdata/cli/main/scripts/install
3030

3131
| Environment Variable | Description |
3232
| -------------------- | --------------------------------------------------- |
33-
| `TIGRIS_VERSION` | Install a specific version (e.g., `v2.9.0`) |
34-
| `TIGRIS_INSTALL_DIR` | Custom install directory (default: `~/.tigris/bin`) |
33+
| `TIGRIS_VERSION` | Install a specific version (e.g., `v2.9.0`) |
34+
| `TIGRIS_INSTALL_DIR` | Custom install directory (default: `/usr/local/bin`) |
3535

3636
Example:
3737

@@ -41,18 +41,14 @@ TIGRIS_VERSION=v2.9.0 curl -fsSL https://raw.githubusercontent.com/tigrisdata/cl
4141

4242
#### Uninstall (macOS / Linux)
4343

44-
```sh
45-
rm -rf ~/.tigris/bin
46-
```
47-
48-
Remove the PATH entry from your shell config (`~/.zshrc`, `~/.bashrc`, etc.):
44+
Remove the binaries from the install directory:
4945

5046
```sh
51-
# Delete these lines:
52-
# Tigris CLI
53-
export PATH="$HOME/.tigris/bin:$PATH"
47+
sudo rm /usr/local/bin/tigris /usr/local/bin/t3
5448
```
5549

50+
If you used a custom `TIGRIS_INSTALL_DIR`, remove from that directory instead and clean up the PATH entry from your shell config (`~/.zshrc`, `~/.bashrc`, etc.).
51+
5652
### Windows (PowerShell)
5753

5854
```powershell
@@ -106,8 +102,22 @@ t3 --version
106102

107103
## Getting Started
108104

105+
After installation, authenticate with your Tigris account:
106+
109107
```sh
108+
# Interactive login via browser (recommended)
110109
tigris login
110+
111+
# Or use access key credentials directly
112+
tigris configure --access-key <key> --access-secret <secret>
113+
```
114+
115+
Verify your authentication:
116+
117+
```sh
118+
tigris whoami
111119
```
112120

121+
See [AUTHENTICATION.md](AUTHENTICATION.md) for all supported authentication methods including environment variables and AWS profiles.
122+
113123
For more information, visit the [documentation](https://www.tigrisdata.com/docs/cli/).

eslint.config.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,29 @@
11
import eslint from "@eslint/js";
2+
import simpleImportSort from "eslint-plugin-simple-import-sort";
23
import tseslint from "typescript-eslint";
34

45
export default tseslint.config(
56
eslint.configs.recommended,
67
...tseslint.configs.recommended,
78
{
9+
plugins: { "simple-import-sort": simpleImportSort },
810
rules: {
911
"@typescript-eslint/no-unused-vars": "error",
1012
"@typescript-eslint/no-explicit-any": "warn",
1113
"@typescript-eslint/explicit-function-return-type": "off",
1214
"@typescript-eslint/explicit-module-boundary-types": "off",
1315
"@typescript-eslint/no-inferrable-types": "off",
16+
"@typescript-eslint/consistent-type-imports": [
17+
"error",
18+
{ prefer: "type-imports", fixStyle: "separate-type-imports" },
19+
],
20+
"simple-import-sort/imports": "error",
21+
"simple-import-sort/exports": "error",
1422
"prefer-const": "error",
1523
"no-var": "error",
1624
},
1725
},
1826
{
19-
ignores: ["dist/", "node_modules/", "**/*.cjs"],
27+
ignores: ["dist/", "node_modules/", "**/*.cjs", "src/command-registry.ts"],
2028
},
2129
);

0 commit comments

Comments
 (0)