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
59 changes: 32 additions & 27 deletions src/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export const buildCmd = (): Command => {
program
.name("octomind-cli")
.description(
`Octomind CLI tool. Version: ${version}. see https://octomind.dev/docs/api-reference/`,
`Octomind CLI tool. Version: ${version}. see https://octomind.dev/docs/api-reference/`
)
.version(version);

Expand All @@ -57,7 +57,7 @@ export const buildCmd = (): Command => {
if (existingConfig.apiKey && !options.force) {
console.log("⚠️ Configuration already exists.");
const overwrite = await promptUser(
"Do you want to overwrite it? (y/N): ",
"Do you want to overwrite it? (y/N): "
);

if (
Expand All @@ -72,7 +72,7 @@ export const buildCmd = (): Command => {
let apiKey;
if (!options.apiKey) {
apiKey = await promptUser(
"Enter your API key. Go to https://octomind.dev/docs/run-tests/execution-curl#create-an-api-key to learn how to generate one: ",
"Enter your API key. Go to https://octomind.dev/docs/run-tests/execution-curl#create-an-api-key to learn how to generate one: "
);
if (!apiKey) {
console.log("❌ API key is required.");
Expand All @@ -82,7 +82,7 @@ export const buildCmd = (): Command => {
let testTargetId;
if (!options.testTargetId) {
testTargetId = await promptUser(
"Enter test target id (optional, press Enter to skip): ",
"Enter test target id (optional, press Enter to skip): "
);
}

Expand All @@ -98,40 +98,40 @@ export const buildCmd = (): Command => {
} catch (error) {
console.error(
"❌ Error during initialization:",
(error as Error).message,
(error as Error).message
);
process.exit(1);
}
},
}
);

createCommandWithCommonOptions("debug")
.description("run test cases against local build")
.requiredOption("-u, --url <url>", "url the tests should run against")
.option(
"-i, --id <uuid>",
"id of the test case you want to run, if not provided will run all test cases in the test target",
"id of the test case you want to run, if not provided will run all test cases in the test target"
)
.option(
"-e, --environmentId <uuid>",
"id of the environment you want to run against, if not provided will run all test cases against the default environment",
"id of the environment you want to run against, if not provided will run all test cases against the default environment"
)
.option(
"-a, --testTargetId <uuid>",
"id of the test target of the test case",
"id of the test target of the test case"
)
.option(
"--headless",
"if we should run headless without the UI of playwright and the browser",
"if we should run headless without the UI of playwright and the browser"
)
.option(
"--persist",
"if we should write playwright config and files to current directory, you can then run 'npx playwright test' to run them again",
"if we should write playwright config and files to current directory, you can then run 'npx playwright test' to run them again"
)
.option("--grep <substring>", "filter test cases by substring")
.action(async (options, command) => {
const resolvedTestTargetId = await resolveTestTargetId(
options.testTargetId,
options.testTargetId
);
command.setOptionValue("testTargetId", resolvedTestTargetId);
void runDebugtopus(options);
Expand All @@ -147,7 +147,7 @@ export const buildCmd = (): Command => {
.option(
"-v, --variables-to-overwrite <variables>",
"JSON object of variables to overwrite",
toJSON,
toJSON
)
.action(async (options) => {
const testTargetId = await resolveTestTargetId(options.testTargetId);
Expand Down Expand Up @@ -191,7 +191,7 @@ export const buildCmd = (): Command => {
.option("-t, --test-target-id <id>", "Test target ID")
.action(async (options, command) => {
const resolvedTestTargetId = await resolveTestTargetId(
options.testTargetId,
options.testTargetId
);
command.setOptionValue("testTargetId", resolvedTestTargetId);
void listEnvironments(options);
Expand All @@ -206,7 +206,7 @@ export const buildCmd = (): Command => {
.option("--test-account-password <password>", "Test account password")
.option(
"--test-account-otp-initializer-key <key>",
"Test account OTP initializer key",
"Test account OTP initializer key"
)
.option("--basic-auth-username <username>", "Basic auth username")
.option("--basic-auth-password <password>", "Basic auth password")
Expand All @@ -215,7 +215,7 @@ export const buildCmd = (): Command => {
createEnvironment({
...options,
testTargetId: await resolveTestTargetId(options.testTargetId),
}),
})
);

createCommandWithCommonOptions("update-environment")
Expand All @@ -228,7 +228,7 @@ export const buildCmd = (): Command => {
.option("--test-account-password <password>", "Test account password")
.option(
"--test-account-otp-initializer-key <key>",
"Test account OTP initializer key",
"Test account OTP initializer key"
)
.option("--basic-auth-username <username>", "Basic auth username")
.option("--basic-auth-password <password>", "Basic auth password")
Expand All @@ -237,7 +237,7 @@ export const buildCmd = (): Command => {
updateEnvironment({
...options,
testTargetId: await resolveTestTargetId(options.testTargetId),
}),
})
);

createCommandWithCommonOptions("delete-environment")
Expand All @@ -246,25 +246,30 @@ export const buildCmd = (): Command => {
.option("-t, --test-target-id <id>", "Test target ID")
.action(deleteEnvironment);


program.command("start-private-location")
program
.command("start-private-location")
.description("Start a private location worker")
.option("-n, --name <name>", "Location name")
.option("-u, --username <username>", "Proxy user")
.option("-p, --password <password>", "Proxy password")
.option("-l, --host-network", "Use host network (default: false). If set you can use localhost directly", false)
.option(
"-l, --host-network",
"Use host network (default: false). If set you can use localhost directly",
false
)
.action(startPrivateLocationWorker);

program.command("stop-private-location")
program
.command("stop-private-location")
.description("Stop a private location worker")
.action(stopPLW)
.action(stopPLW);

createCommandWithCommonOptions("notifications")
.description("Get notifications for a test target")
.option("-t, --test-target-id <id>", "Test target ID")
.action(async (options, command) => {
const resolvedTestTargetId = await resolveTestTargetId(
options.testTargetId,
options.testTargetId
);
command.setOptionValue("testTargetId", resolvedTestTargetId);
void getNotifications(options);
Expand All @@ -276,7 +281,7 @@ export const buildCmd = (): Command => {
.option("-t, --test-target-id <id>", "Test target ID")
.action(async (options, command) => {
const resolvedTestTargetId = await resolveTestTargetId(
options.testTargetId,
options.testTargetId
);
command.setOptionValue("testTargetId", resolvedTestTargetId);
void getTestCase(options);
Expand All @@ -293,12 +298,12 @@ export const buildCmd = (): Command => {
.option(
"--assigned-tag-ids <ids>",
"Comma-separated list of tag IDs",
splitter,
splitter
)
.option("--folder-id <id>", "Folder ID")
.action(async (options, command) => {
const resolvedTestTargetId = await resolveTestTargetId(
options.testTargetId,
options.testTargetId
);
command.setOptionValue("testTargetId", resolvedTestTargetId);
void createDiscovery(options);
Expand Down
Loading