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/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 \ diff --git a/package.json b/package.json index 02ab404..1ccd6fd 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { - "name": "@octomind/cli", - "version": "1.0.2", + "name": "@octomind/octomind", + "version": "1.0.4", "description": "a command line client for octomind apis", "main": "./dist/index.js", "packageManager": "pnpm@9.15.6+sha512.139cab068fdf0b751268179ac5f909b5be72afb4a75c513d1905d151befc8977b593d3cf8671ed83d4d6637c5c94b98ffbce108125de4a5a27a31233601a99de", @@ -8,14 +8,14 @@ "node": ">=20.0.0" }, "bin": { - "cli": "./dist/index.js" + "octomind": "./dist/index.js" }, "scripts": { - "lint": "eslint src/**/*.ts tests/**/*.ts --max-warnings=0", - "build": "tsc --project tsconfig.build.json", - "octomind-cli": "tsx src/cli.ts", - "test": "jest", - "test:watch": "jest --watch" + "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 -des src/version.ts && jest", + "test:watch": "npx genversion -e src/version.ts && jest --watch" }, "keywords": [], "author": "", diff --git a/src/api.ts b/src/api.ts index e37d20c..4e326fb 100644 --- a/src/api.ts +++ b/src/api.ts @@ -74,6 +74,7 @@ export const executeTests = async ( }, environmentName: options.environment, tags: options.tags, + variablesToOverwrite: options.variablesToOverwrite, }; const response = await apiCall( diff --git a/src/cli.ts b/src/cli.ts index 1669f8e..a8b93c8 100644 --- a/src/cli.ts +++ b/src/cli.ts @@ -1,4 +1,5 @@ import { program, Option, Command } from "commander"; +import { version } from "./version"; import { createEnvironment, deleteEnvironment, @@ -32,8 +33,9 @@ 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); 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",