From e9c499c2ed6ce6dcc4a3feeb50e5e772afc6089b Mon Sep 17 00:00:00 2001 From: Stefan Rinke Date: Tue, 4 Mar 2025 12:02:05 +0100 Subject: [PATCH 01/10] version and name --- package.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index 02ab404..325a414 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { - "name": "@octomind/cli", - "version": "1.0.2", + "name": "@octomind/octomind", + "version": "1.0.3", "description": "a command line client for octomind apis", "main": "./dist/index.js", "packageManager": "pnpm@9.15.6+sha512.139cab068fdf0b751268179ac5f909b5be72afb4a75c513d1905d151befc8977b593d3cf8671ed83d4d6637c5c94b98ffbce108125de4a5a27a31233601a99de", @@ -8,7 +8,7 @@ "node": ">=20.0.0" }, "bin": { - "cli": "./dist/index.js" + "octomind": "./dist/index.js" }, "scripts": { "lint": "eslint src/**/*.ts tests/**/*.ts --max-warnings=0", From d78886a56c1c36f4912584a99ba7b1ff114ce064 Mon Sep 17 00:00:00 2001 From: Stefan Rinke Date: Tue, 4 Mar 2025 12:05:58 +0100 Subject: [PATCH 02/10] adjust README --- README.md | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index 0479f8b..07665df 100644 --- a/README.md +++ b/README.md @@ -8,8 +8,8 @@ See [API documentation](https://octomind.dev/docs/api-reference/) ## Usage -1. Install the package - `npm i -g @octomind/cli` and use it directly e.g. `@octomind/cli -h` -2. Use the cli through npx e.g. `npx @octomind/cli -h` +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` ## Commands @@ -18,7 +18,7 @@ See [API documentation](https://octomind.dev/docs/api-reference/) Run test cases against a specified URL. ```bash -npx @octomind/cli execute \ +octomind execute \ --api-key \ --test-target-id \ --url \ @@ -46,7 +46,7 @@ Options: Retrieve details about a specific test report. ```bash -npx @octomind/cli report \ +octomind report \ --api-key \ --test-target-id \ --report-id \ @@ -103,7 +103,7 @@ Example JSON output: Register a new private location worker. If you use the [private location worker](https://github.com/OctoMind-dev/private-location-worker) it will register itself on startup automatically. ```bash -npx @octomind/cli register-location \ +octomind register-location \ --api-key \ --name \ --proxypass \ @@ -125,7 +125,7 @@ Options: Remove a registered private location worker. If you use the [private location worker](https://github.com/OctoMind-dev/private-location-worker) it will unregister itself when going offline automatically. ```bash -npx @octomind/cli unregister-location \ +octomind unregister-location \ --api-key \ --name \ [--json] @@ -141,7 +141,7 @@ Options: List all registered private locations. ```bash -npx @octomind/cli list-private-locations \ +octomind list-private-locations \ --api-key \ [--json] ``` @@ -166,7 +166,7 @@ Private Locations: List all available environments. ```bash -npx @octomind/cli list-environments \ +octomind list-environments \ --api-key \ --test-target-id \ [--json] @@ -182,7 +182,7 @@ Options: Create a new environment for a test target. ```bash -npx @octomind/cli create-environment \ +octomind create-environment \ --api-key \ --test-target-id \ --name \ @@ -216,7 +216,7 @@ Options: Update an existing environment. ```bash -npx @octomind/cli update-environment \ +octomind update-environment \ --api-key \ --test-target-id \ --environment-id \ @@ -252,7 +252,7 @@ Options: Delete an existing environment. ```bash -npx @octomind/cli delete-environment \ +octomind delete-environment \ --api-key \ --test-target-id \ --environment-id \ From 65ae3be8cfd2184602e8f75eae51a9a7e8fac6ca Mon Sep 17 00:00:00 2001 From: Stefan Rinke Date: Thu, 6 Mar 2025 16:09:48 +0100 Subject: [PATCH 03/10] - add version from package.json --- .eslintrc.json | 1 + src/cli.ts | 4 +++- tsconfig.json | 3 ++- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/.eslintrc.json b/.eslintrc.json index b266243..557b057 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -19,6 +19,7 @@ "@typescript-eslint/no-floating-promises": "warn", "prettier/prettier": "warn", "no-console": "off", + "import/extensions": "off", "no-unused-vars": "off", "github/array-foreach": "off", "i18n-text/no-en": "off", diff --git a/src/cli.ts b/src/cli.ts index 1669f8e..ade085d 100644 --- a/src/cli.ts +++ b/src/cli.ts @@ -1,4 +1,5 @@ import { program, Option, Command } from "commander"; +import { version } from "../package.json"; import { createEnvironment, deleteEnvironment, @@ -33,7 +34,8 @@ export const buildCmd = (): Command => { .name("octomind-cli") .description( "Octomind CLI tool. see https://octomind.dev/docs/api-reference/", - ); + ) + .version(version); createCommandWithCommonOptions("execute") .description("Execute test cases") diff --git a/tsconfig.json b/tsconfig.json index 74151e3..64641af 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -10,7 +10,8 @@ "rootDir": ".", "strict": true, "noImplicitAny": true, - "esModuleInterop": true + "esModuleInterop": true, + "resolveJsonModule": true }, "exclude": [ "node_modules", From 44d972a337dd75c33642a00502a997daa1dd546f Mon Sep 17 00:00:00 2001 From: Stefan Rinke Date: Thu, 6 Mar 2025 16:25:25 +0100 Subject: [PATCH 04/10] - embed version --- .eslintrc.json | 1 - .gitignore | 1 + package.json | 2 +- src/cli.ts | 2 +- 4 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.eslintrc.json b/.eslintrc.json index 557b057..b266243 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -19,7 +19,6 @@ "@typescript-eslint/no-floating-promises": "warn", "prettier/prettier": "warn", "no-console": "off", - "import/extensions": "off", "no-unused-vars": "off", "github/array-foreach": "off", "i18n-text/no-en": "off", diff --git a/.gitignore b/.gitignore index 5c13444..1fb2798 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ notes.txt dist/ +src/version.ts node_modules/ .idea diff --git a/package.json b/package.json index 325a414..783b496 100644 --- a/package.json +++ b/package.json @@ -12,7 +12,7 @@ }, "scripts": { "lint": "eslint src/**/*.ts tests/**/*.ts --max-warnings=0", - "build": "tsc --project tsconfig.build.json", + "build": "npx genversion -e src/version.ts && tsc --project tsconfig.build.json", "octomind-cli": "tsx src/cli.ts", "test": "jest", "test:watch": "jest --watch" diff --git a/src/cli.ts b/src/cli.ts index ade085d..9b5c0fc 100644 --- a/src/cli.ts +++ b/src/cli.ts @@ -1,5 +1,5 @@ import { program, Option, Command } from "commander"; -import { version } from "../package.json"; +import { version } from "./version"; import { createEnvironment, deleteEnvironment, From 8d66b66e7a1f3ea29f36e2b7e6cf03712647ee9d Mon Sep 17 00:00:00 2001 From: Stefan Rinke Date: Thu, 6 Mar 2025 16:27:18 +0100 Subject: [PATCH 05/10] - show version in usage --- src/cli.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cli.ts b/src/cli.ts index 9b5c0fc..a8b93c8 100644 --- a/src/cli.ts +++ b/src/cli.ts @@ -33,7 +33,7 @@ export const buildCmd = (): Command => { program .name("octomind-cli") .description( - "Octomind CLI tool. see https://octomind.dev/docs/api-reference/", + `Octomind CLI tool. Version: ${version}. see https://octomind.dev/docs/api-reference/`, ) .version(version); From 43c3969ce0540ff0605d06c2a7605218fd5936f2 Mon Sep 17 00:00:00 2001 From: Stefan Rinke Date: Thu, 6 Mar 2025 16:32:34 +0100 Subject: [PATCH 06/10] genversion always --- package.json | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index 783b496..7f1e114 100644 --- a/package.json +++ b/package.json @@ -11,11 +11,11 @@ "octomind": "./dist/index.js" }, "scripts": { - "lint": "eslint src/**/*.ts tests/**/*.ts --max-warnings=0", + "lint": "npx genversion -e src/version.ts && eslint src/**/*.ts tests/**/*.ts --max-warnings=0", "build": "npx genversion -e src/version.ts && tsc --project tsconfig.build.json", - "octomind-cli": "tsx src/cli.ts", - "test": "jest", - "test:watch": "jest --watch" + "octomind": "tsx src/cli.ts", + "test": "npx genversion -e src/version.ts && jest", + "test:watch": "npx genversion -e src/version.ts && jest --watch" }, "keywords": [], "author": "", From 54f7536af44901afc83c96f7728e7857dd2ddc68 Mon Sep 17 00:00:00 2001 From: Stefan Rinke Date: Thu, 6 Mar 2025 16:36:12 +0100 Subject: [PATCH 07/10] double quotes --- package.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index 7f1e114..592bdd6 100644 --- a/package.json +++ b/package.json @@ -11,10 +11,10 @@ "octomind": "./dist/index.js" }, "scripts": { - "lint": "npx genversion -e src/version.ts && eslint src/**/*.ts tests/**/*.ts --max-warnings=0", - "build": "npx genversion -e src/version.ts && tsc --project tsconfig.build.json", + "lint": "npx genversion -d -e src/version.ts && eslint src/**/*.ts tests/**/*.ts --max-warnings=0", + "build": "npx genversion -d -e src/version.ts && tsc --project tsconfig.build.json", "octomind": "tsx src/cli.ts", - "test": "npx genversion -e src/version.ts && jest", + "test": "npx genversion -d -e src/version.ts && jest", "test:watch": "npx genversion -e src/version.ts && jest --watch" }, "keywords": [], From 02f95c1a2fc1c2dd65cd3273ff44ebba715ff616 Mon Sep 17 00:00:00 2001 From: Stefan Rinke Date: Thu, 6 Mar 2025 16:47:56 +0100 Subject: [PATCH 08/10] semicolon --- package.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index 592bdd6..2cdd61e 100644 --- a/package.json +++ b/package.json @@ -11,10 +11,10 @@ "octomind": "./dist/index.js" }, "scripts": { - "lint": "npx genversion -d -e src/version.ts && eslint src/**/*.ts tests/**/*.ts --max-warnings=0", - "build": "npx genversion -d -e src/version.ts && tsc --project tsconfig.build.json", + "lint": "npx genversion -des src/version.ts && eslint src/**/*.ts tests/**/*.ts --max-warnings=0", + "build": "npx genversion -des src/version.ts && tsc --project tsconfig.build.json", "octomind": "tsx src/cli.ts", - "test": "npx genversion -d -e src/version.ts && jest", + "test": "npx genversion -des src/version.ts && jest", "test:watch": "npx genversion -e src/version.ts && jest --watch" }, "keywords": [], From 0a074fadb5bcd47879f99bf89e6e3bd6878f1e67 Mon Sep 17 00:00:00 2001 From: Stefan Rinke Date: Thu, 6 Mar 2025 18:42:24 +0100 Subject: [PATCH 09/10] version vars fix --- package.json | 2 +- src/api.ts | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 2cdd61e..1ccd6fd 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@octomind/octomind", - "version": "1.0.3", + "version": "1.0.4", "description": "a command line client for octomind apis", "main": "./dist/index.js", "packageManager": "pnpm@9.15.6+sha512.139cab068fdf0b751268179ac5f909b5be72afb4a75c513d1905d151befc8977b593d3cf8671ed83d4d6637c5c94b98ffbce108125de4a5a27a31233601a99de", diff --git a/src/api.ts b/src/api.ts index e37d20c..c5c3f23 100644 --- a/src/api.ts +++ b/src/api.ts @@ -74,8 +74,9 @@ export const executeTests = async ( }, environmentName: options.environment, tags: options.tags, + variablesToOverwrite: options.variablesToOverwrite }; - + const response = await apiCall( "post", "/apiKey/v2/execute", From 0757ead917d62ceee37641fe450969b28fa70e29 Mon Sep 17 00:00:00 2001 From: Stefan Rinke Date: Thu, 6 Mar 2025 22:46:37 +0100 Subject: [PATCH 10/10] lint --- src/api.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/api.ts b/src/api.ts index c5c3f23..4e326fb 100644 --- a/src/api.ts +++ b/src/api.ts @@ -74,9 +74,9 @@ export const executeTests = async ( }, environmentName: options.environment, tags: options.tags, - variablesToOverwrite: options.variablesToOverwrite + variablesToOverwrite: options.variablesToOverwrite, }; - + const response = await apiCall( "post", "/apiKey/v2/execute",