Skip to content
This repository was archived by the owner on Jul 14, 2026. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 15 additions & 3 deletions README-template.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,23 @@ A command-line interface for interacting with the Octomind API.
This CLI allows you to execute tests, retrieve test reports, and manage private locations as well as environments.
See [API documentation](https://octomind.dev/docs/api-reference/)

## Usage
## Usage / Installation

1. Install the package - `npm i -g @octomind/octomind` and use it directly e.g. `octomind -h`
2. Use the cli through npx e.g. `npx @octomind/octomind -h`
1. To install the package globally do **NOT** just a `npm i -g @octomind/octomind` but instead
```bash
mkdir -p ~/.local/packages
cd ~/.local/packages
npm install @octomind/octomind@latest
# either create an alias
alias octomind="node ~/.local/packages/node_modules/@octomind/octomind/dist/index.js"
# or create a symlink
sudo ln -s ~/.local/packages/node_modules/@octomind/octomind/dist/index.js /usr/local/bin/octomind
```

this will install the package to `~/.local/packages` and create symlinks in `/usr/local/bin` or creates an alias.
This is necessary for the cli to work and avoid dependency conflicts, when installing the package globally.

2. Use the cli through npx e.g. `npx @octomind/octomind -h`

${commands}

Expand Down
22 changes: 17 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,27 @@ A command-line interface for interacting with the Octomind API.
This CLI allows you to execute tests, retrieve test reports, and manage private locations as well as environments.
See [API documentation](https://octomind.dev/docs/api-reference/)

## Usage
## Usage / Installation

1. Install the package - `npm i -g @octomind/octomind` and use it directly e.g. `octomind -h`
2. Use the cli through npx e.g. `npx @octomind/octomind -h`
1. To install the package globally do **NOT** just a `npm i -g @octomind/octomind` but instead
```bash
mkdir -p ~/.local/packages
cd ~/.local/packages
npm install @octomind/octomind@latest
# either create an alias
alias octomind="node ~/.local/packages/node_modules/@octomind/octomind/dist/index.js"
# or create a symlink
sudo ln -s ~/.local/packages/node_modules/@octomind/octomind/dist/index.js /usr/local/bin/octomind
```

this will install the package to `~/.local/packages` and create symlinks in `/usr/local/bin` or creates an alias.
This is necessary for the cli to work and avoid dependency conflicts, when installing the package globally.

2. Use the cli through npx e.g. `npx @octomind/octomind -h`

# octomind

Octomind cli tool. Version: 1.1.1. Additional documentation see https://octomind.dev/docs/api-reference/
Octomind cli tool. Version: 1.1.2. Additional documentation see https://octomind.dev/docs/api-reference/

**Usage:** `octomind [options] [command]`

Expand All @@ -26,7 +38,7 @@ Octomind cli tool. Version: 1.1.1. Additional documentation see https://octomind

# octomind CLI Documentation

Octomind cli tool. Version: 1.1.1. Additional documentation see https://octomind.dev/docs/api-reference/
Octomind cli tool. Version: 1.1.2. Additional documentation see https://octomind.dev/docs/api-reference/

## Commands

Expand Down
11 changes: 9 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,16 @@
{
"name": "@octomind/octomind",
"version": "1.1.1",
"version": "1.1.2",
"description": "a command line client for octomind apis",
"main": "./dist/index.js",
"packageManager": "pnpm@10.13.1",
"files": [
"dist",
"src",
"README.md",
"LICENSE",
"package.json"
],
"engines": {
"node": ">=20.0.0"
},
Expand All @@ -26,7 +33,7 @@
"@playwright/test": "^1.54.1",
"commander": "^14.0.0",
"openapi-fetch": "^0.14.0",
"tsx": "^4.19.3"
"otplib": "^12.0.1"
},
"devDependencies": {
"@types/jest": "^30.0.0",
Expand Down
70 changes: 63 additions & 7 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 14 additions & 1 deletion src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,24 @@ export interface Config {
testTargetId?: string;
}

let configLoaded = false;
let config: Config = {};

export function resetConfig() {
configLoaded = false;
config = {};
}

export async function loadConfig(force?: boolean): Promise<Config> {
if(configLoaded && !force) {
return config;
}
try {
const configPath = await getConfigPath();
const data = await fs.readFile(configPath, "utf8");
return JSON.parse(data);
config = JSON.parse(data);
configLoaded = true;
return config;
} catch (error) {
// only exit on overwrite attempt
if (force) {
Expand Down
11 changes: 9 additions & 2 deletions src/tools/notifications.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import type { paths, components } from "../api"; // generated by openapi-typescript
import { client, handleError, ListOptions, logJson } from "./client";
import { getUrl } from "../url";

export type GetNotificationsParams =
paths["/apiKey/v2/test-targets/{testTargetId}/notifications"]["get"]["parameters"]["path"];
Expand Down Expand Up @@ -27,21 +28,27 @@ export const listNotifications = async (
}

console.log("Notifications:");
response.forEach((notification) => {
for (const notification of response) {
console.log(`\nID: ${notification.id}`);
console.log(`Type: ${notification.type}`);
console.log(`Created At: ${notification.createdAt}`);
if (notification.payload?.testReportId) {
console.log(`Test Report ID: ${notification.payload.testReportId}`);
console.log(
`URL: ${await getUrl({ testReportId: notification.payload.testReportId, entityType: "test-report" })}`,
);
}
if (notification.payload?.testCaseId) {
console.log(`Test Case ID: ${notification.payload.testCaseId}`);
console.log(
`URL: ${await getUrl({ testCaseId: notification.payload.testCaseId, entityType: "test-case" })}`,
);
}
if (notification.payload?.failed !== undefined) {
console.log(`Failed: ${notification.payload.failed}`);
}
if (notification.ack) {
console.log(`Acknowledged: ${notification.ack}`);
}
});
}
};
3 changes: 2 additions & 1 deletion tests/config.spec.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import fs from "fs/promises";
import path from "path";
import { loadConfig, Config } from "../src/config";
import { loadConfig, Config, resetConfig } from "../src/config";
import { homedir } from "os";
jest.mock("fs/promises");
const mockedFs = fs as jest.Mocked<typeof fs>;
Expand All @@ -10,6 +10,7 @@ const originalConsoleError = console.error;
describe("Config", () => {
beforeEach(() => {
console.error = jest.fn();
resetConfig();
});

afterEach(() => {
Expand Down