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
19 changes: 18 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ This way even entityIds like environmentIds or testCaseIds will be autocompleted

# octomind

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

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

Expand Down Expand Up @@ -239,6 +239,23 @@ Create a new test case discovery
| `--assigned-tag-ids [ids]` | Comma-separated list of tag IDs | No | |
| `--folder-id [id]` | Folder ID | No | |

## batch-generation

Batch generation of test cases

**Usage:** `batch-generation [options]`

### Options

| Option | Description | Required | Default |
|:-------|:----------|:---------|:--------|
| `-j, --json` | Output raw JSON response | No | |
| `-p, --prompt <prompt>` | Batch generation prompt | Yes | |
| `-u, --url <url>` | Start url for generation | Yes | |
| `-e, --environment-id <id>` | Environment ID | Yes | |
| `-d, --prerequisite-id <id>` | Prerequisite ID | Yes | |
| `-t, --test-target-id [id]` | Test target ID, if not provided will use the test target id from the config | No | |

## Notifications

## notifications
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@octomind/octomind",
"version": "1.3.1",
"version": "1.3.2",
"description": "a command line client for octomind apis",
"main": "./dist/index.js",
"packageManager": "pnpm@10.13.1",
Expand Down
18 changes: 13 additions & 5 deletions src/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import { runDebugtopus } from "./debugtopus";
import { promptUser, resolveTestTargetId } from "./helpers";
import { startPrivateLocationWorker, stopPLW } from "./plw";
import {
batchGeneration,
CreateDiscoveryBody,
createDiscovery,
createEnvironment,
Expand Down Expand Up @@ -257,7 +258,6 @@ export const buildCmd = (): CompletableCommand => {
.action(addTestTargetWrapper(deleteEnvironment));

program

.completer(optionsCompleter)
.completableCommand("start-private-location")
.description(
Expand All @@ -276,22 +276,19 @@ export const buildCmd = (): CompletableCommand => {
.action(startPrivateLocationWorker);

program

.completableCommand("stop-private-location")
.completer(optionsCompleter)
.description(
"Stop a private location worker, see https://octomind.dev/docs/proxy/private-location",
)
.helpGroup("private-locations")

.action(stopPLW);

createCommandWithCommonOptions(program, "notifications")
.completer(testTargetIdCompleter)
.description("Get notifications for a test target")
.helpGroup("notifications")
.addOption(testTargetIdOption)

.action(addTestTargetWrapper(listNotifications));

createCommandWithCommonOptions(program, "delete-test-case")
Expand Down Expand Up @@ -328,7 +325,6 @@ export const buildCmd = (): CompletableCommand => {
splitter,
)
.option("--folder-id [id]", "Folder ID")

.action(addTestTargetWrapper(createDiscovery));

createCommandWithCommonOptions(program, "list-test-cases")
Expand All @@ -343,6 +339,18 @@ export const buildCmd = (): CompletableCommand => {
.helpGroup("test-targets")
.action(listTestTargets);

createCommandWithCommonOptions(program, "batch-generation")
.completer(testTargetIdCompleter)
.completer(optionsCompleter)
.description("Batch generation of test cases")
.requiredOption("-p, --prompt <prompt>", "Batch generation prompt")
.requiredOption("-u, --url <url>", "Start url for generation")
.option("-e, --environment-id <id>", "Environment ID")
.option("-d, --prerequisite-id <id>", "Prerequisite ID")
.helpGroup("execute")
.addOption(testTargetIdOption)
.action(addTestTargetWrapper(batchGeneration));

program
.completableCommand("install-completion")
.description("Install tab completion")
Expand Down
5 changes: 5 additions & 0 deletions src/tools/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,11 @@ export { client };
export const handleError = (error: ErrorResponse) => {
if (error) {
console.error(error);
if (typeof error === "string" && error.startsWith("403")) {
console.error(
"You are not authorized. Check your API key or do a 'octomind init' to set it up.",
);
}
process.exit(1);
}
};
Expand Down
50 changes: 50 additions & 0 deletions src/tools/discoveries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,56 @@ import { client, handleError, ListOptions, logJson } from "./client";
export type CreateDiscoveryBody =
components["schemas"]["ExternalDiscoveryBody"];
export type DiscoveryResponse = components["schemas"]["DiscoveryResponse"];
export type BatchGenerationResponse =
components["schemas"]["BatchGenerationResponse"];
export type BatchGenerationParams =
components["schemas"]["ExternalBatchGenerationBody"];
export const batchGeneration = async (
options: {
environmentId: string;
prompt: string;
prerequisiteId?: string;
testTargetId: string;
url: string;
} & ListOptions,
): Promise<void> => {
const { data, error } = await client.POST(
"/apiKey/v2/test-targets/{testTargetId}/batch-generations",
{
params: {
path: {
testTargetId: options.testTargetId,
},
},
body: {
environmentId: options.environmentId,
prompt: options.prompt,
prerequisiteId: options.prerequisiteId,
entryPointUrlPath: options.url,
},
},
);

handleError(error);

const response = data as BatchGenerationResponse;
if (options.json) {
logJson(response);
return;
}
if (!response.batchGenerationId) {
throw new Error("Batch generation ID is missing");
}

console.log("Batch generation created successfully!");
console.log(`Batch generation ID: ${response.batchGenerationId}`);
console.log(
`Batch generation URL: ${await getUrl({
batchGenerationId: response.batchGenerationId,
entityType: "batch-generation",
})}`,
);
};

export const createDiscovery = async (
options: CreateDiscoveryBody & { testTargetId: string } & ListOptions,
Expand Down
5 changes: 4 additions & 1 deletion src/url.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ export const getUrl = async (
testResultId: string;
entityType: "test-result";
}
| { testCaseId: string; entityType: "discovery" },
| { testCaseId: string; entityType: "discovery" }
| { batchGenerationId: string; entityType: "batch-generation" },
): Promise<string> => {
const relevantBaseUrl = new URL(BASE_URL).origin;
const config = await loadConfig();
Expand All @@ -30,5 +31,7 @@ export const getUrl = async (
return `${relevantBaseUrl}/testtargets/${configuredTestTargetId}/testreports/${input.testReportId}/testresults/${input.testResultId}`;
case "discovery":
return `${relevantBaseUrl}/testtargets/${configuredTestTargetId}/testcases/${input.testCaseId}`;
case "batch-generation":
return `${relevantBaseUrl}/testtargets/${configuredTestTargetId}/batch-generations/${input.batchGenerationId}`;
}
};