Skip to content
This repository was archived by the owner on Jul 14, 2026. It is now read-only.

Commit 26443c5

Browse files
Set up config, add api key (#156)
* set up config, add api key * lint * test * test target id in config * options for apiKey and testTargetId in init * refactor * readme, rename file * resolve test target id * tests * refactor * fix tests, refactor * update readme
1 parent de9a446 commit 26443c5

8 files changed

Lines changed: 250 additions & 78 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@ dist/
33
src/version.ts
44
node_modules/
55
.idea
6+
octomind.config.json

README.md

Lines changed: 48 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -13,50 +13,66 @@ See [API documentation](https://octomind.dev/docs/api-reference/)
1313

1414
## Commands
1515

16+
### Init
17+
18+
Initialize configuration by setting up your API key and optionally a test target ID. This allows you to avoid passing these parameters for subsequent commands.
19+
20+
```bash
21+
octomind init \
22+
[--api-key <key>] \
23+
[--test-target-id <id>] \
24+
[--force]
25+
```
26+
27+
Options:
28+
- `-k, --api-key`: Your Octomind API key (will prompt if not provided)
29+
- `-t, --test-target-id`: Test target ID (optional)
30+
- `-f, --force`: Force overwrite existing configuration
31+
32+
If you don't provide the API key via the command line option, the CLI will prompt you to enter it interactively. You can get your API key from https://octomind.dev/docs/run-tests/execution-curl#create-an-api-key.
33+
1634
### Execute Tests
1735

1836
Run test cases against a specified URL.
1937

2038
```bash
2139
octomind execute \
22-
--api-key <key> \
23-
--test-target-id <id> \
2440
--url <url> \
41+
[--api-key <key>] \
42+
[--test-target-id <id>] \
2543
[--environment <name>] \
2644
[--tags <list of tags>] \
2745
[-v, --variables-to-overwrite <variables>] \
2846
[--description <text>] \
29-
[--tags <tags> ] \
3047
[--json]
3148
```
3249

3350
Options:
34-
- `-k, --api-key` (required): Your Octomind API key
35-
- `-t, --test-target-id` (required): Test target ID
3651
- `-u, --url` (required): URL to test
52+
- `-k, --api-key`: Your Octomind API key (optional if configured via `init`)
53+
- `-t, --test-target-id`: Test target ID (optional if configured via `init`)
3754
- `-e, --environment`: Environment name (default: "default")
3855
- `-d, --description`: Test description
3956
- `-g, --tags`: comma separated list of tags for tests to execute
4057
- `-v, --variables-to-overwrite`: JSON object for variables to override for this run e.g. `{ "key": ["v1", "v2"]}`
4158
- `-j, --json`: Output raw JSON response
42-
- `-g, --tags <tags>`: comma separated list of tags
4359

4460
### Get Test Report
4561

4662
Retrieve details about a specific test report.
4763

4864
```bash
4965
octomind report \
50-
--api-key <key> \
51-
--test-target-id <id> \
5266
--report-id <id> \
67+
[--api-key <key>] \
68+
[--test-target-id <id>] \
5369
[--json]
5470
```
5571

5672
Options:
57-
- `-k, --api-key` (required): Your Octomind API key
58-
- `-t, --test-target-id` (required): Test target ID
5973
- `-r, --report-id` (required): Test report ID
74+
- `-k, --api-key`: Your Octomind API key (optional if configured via `init`)
75+
- `-t, --test-target-id`: Test target ID (optional if configured via `init`)
6076
- `-j, --json`: Output raw JSON response
6177

6278
Example text output:
@@ -104,20 +120,20 @@ Register a new private location worker. If you use the [private location worker]
104120

105121
```bash
106122
octomind register-location \
107-
--api-key <key> \
108123
--name <name> \
109124
--proxypass <password> \
110125
--proxyuser <user> \
111126
--address <address> \
127+
[--api-key <key>] \
112128
[--json]
113129
```
114130

115131
Options:
116-
- `-k, --api-key` (required): Your Octomind API key
117132
- `-n, --name` (required): Location name
118133
- `-p, --proxypass` (required): Proxy password
119134
- `-u, --proxyuser` (required): Proxy user
120135
- `-a, --address` (required): Location address (format: IP:PORT)
136+
- `-k, --api-key`: Your Octomind API key (optional if configured via `init`)
121137
- `-j, --json`: Output raw JSON response
122138

123139
### Unregister Private Location
@@ -126,14 +142,14 @@ Remove a registered private location worker. If you use the [private location wo
126142

127143
```bash
128144
octomind unregister-location \
129-
--api-key <key> \
130145
--name <name> \
146+
[--api-key <key>] \
131147
[--json]
132148
```
133149

134150
Options:
135-
- `-k, --api-key` (required): Your Octomind API key
136151
- `-n, --name` (required): Location name
152+
- `-k, --api-key`: Your Octomind API key (optional if configured via `init`)
137153
- `-j, --json`: Output raw JSON response
138154

139155
### List Private Locations
@@ -142,12 +158,12 @@ List all registered private locations.
142158

143159
```bash
144160
octomind list-private-locations \
145-
--api-key <key> \
161+
[--api-key <key>] \
146162
[--json]
147163
```
148164

149165
Options:
150-
- `-k, --api-key` (required): Your Octomind API key
166+
- `-k, --api-key`: Your Octomind API key (optional if configured via `init`)
151167
- `-j, --json`: Output raw JSON response
152168

153169
Example text output:
@@ -167,14 +183,14 @@ List all available environments.
167183

168184
```bash
169185
octomind list-environments \
170-
--api-key <key> \
171-
--test-target-id <id> \
186+
[--api-key <key>] \
187+
[--test-target-id <id>] \
172188
[--json]
173189
```
174190

175191
Options:
176-
- `-k, --api-key` (required): Your Octomind API key
177-
- `-t, --test-target-id` (required): Test target ID
192+
- `-k, --api-key`: Your Octomind API key (optional if configured via `init`)
193+
- `-t, --test-target-id`: Test target ID (optional if configured via `init`)
178194
- `-j, --json`: Output raw JSON response
179195

180196
### Create Environment
@@ -183,10 +199,10 @@ Create a new environment for a test target.
183199

184200
```bash
185201
octomind create-environment \
186-
--api-key <key> \
187-
--test-target-id <id> \
188202
--name <name> \
189203
--discovery-url <url> \
204+
[--api-key <key>] \
205+
[--test-target-id <id>] \
190206
[--test-account-username <username>] \
191207
[--test-account-password <password>] \
192208
[--test-account-otp-initializer-key <key>] \
@@ -198,10 +214,10 @@ octomind create-environment \
198214
```
199215

200216
Options:
201-
- `-k, --api-key` (required): Your Octomind API key
202-
- `-t, --test-target-id` (required): Test target ID
203217
- `-n, --name` (required): Environment name
204218
- `-d, --discovery-url` (required): Discovery URL
219+
- `-k, --api-key`: Your Octomind API key (optional if configured via `init`)
220+
- `-t, --test-target-id`: Test target ID (optional if configured via `init`)
205221
- `--test-account-username`: Test account username
206222
- `--test-account-password`: Test account password
207223
- `--test-account-otp-initializer-key`: OTP initializer key for test account
@@ -217,9 +233,9 @@ Update an existing environment.
217233

218234
```bash
219235
octomind update-environment \
220-
--api-key <key> \
221-
--test-target-id <id> \
222236
--environment-id <id> \
237+
[--api-key <key>] \
238+
[--test-target-id <id>] \
223239
[--name <name>] \
224240
[--discovery-url <url>] \
225241
[--test-account-username <username>] \
@@ -233,9 +249,9 @@ octomind update-environment \
233249
```
234250

235251
Options:
236-
- `-k, --api-key` (required): Your Octomind API key
237-
- `-t, --test-target-id` (required): Test target ID
238252
- `-e, --environment-id` (required): Environment ID
253+
- `-k, --api-key`: Your Octomind API key (optional if configured via `init`)
254+
- `-t, --test-target-id`: Test target ID (optional if configured via `init`)
239255
- `-n, --name`: New environment name
240256
- `-d, --discovery-url`: New discovery URL
241257
- `--test-account-username`: New test account username
@@ -253,16 +269,16 @@ Delete an existing environment.
253269

254270
```bash
255271
octomind delete-environment \
256-
--api-key <key> \
257-
--test-target-id <id> \
258272
--environment-id <id> \
273+
[--api-key <key>] \
274+
[--test-target-id <id>] \
259275
[--json]
260276
```
261277

262278
Options:
263-
- `-k, --api-key` (required): Your Octomind API key
264-
- `-t, --test-target-id` (required): Test target ID
265279
- `-e, --environment-id` (required): Environment ID
280+
- `-k, --api-key`: Your Octomind API key (optional if configured via `init`)
281+
- `-t, --test-target-id`: Test target ID (optional if configured via `init`)
266282
- `-j, --json`: Output raw JSON response
267283

268284
## Output Formats
@@ -305,7 +321,6 @@ pnpm install
305321

306322
The CLI is written in TypeScript and uses the following dependencies:
307323
- `commander`: For command-line argument parsing
308-
- `axios`: For making HTTP requests
309324

310325
To build from source:
311326
```bash

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
"lint": "npx genversion -des src/version.ts && eslint src/**/*.ts tests/**/*.ts --max-warnings=0",
1515
"apigen": "openapi-typescript ./openapi.yaml --output src/api.ts",
1616
"build": "npx genversion -des src/version.ts && pnpm apigen && tsc --project tsconfig.build.json",
17-
"octomind": "tsx src/cli.ts",
17+
"octomind": "tsx src/index.ts",
1818
"test": "npx genversion -des src/version.ts && jest",
1919
"test:watch": "npx genversion -e src/version.ts && jest --watch"
2020
},
@@ -45,4 +45,4 @@
4545
"tsx": "^4.19.3",
4646
"typescript": "^5.0.4"
4747
}
48-
}
48+
}

0 commit comments

Comments
 (0)