From 01ca957d13b4a5dc97d726192003ffd016f64b51 Mon Sep 17 00:00:00 2001 From: Stefan Rinke Date: Thu, 31 Jul 2025 09:26:37 +0200 Subject: [PATCH 1/5] install notofications with urls cache loaded config --- README-template.md | 2 +- install.sh | 138 +++++++++++++++++++++++++++++++++++++ package.json | 9 ++- pnpm-lock.yaml | 70 +++++++++++++++++-- src/config.ts | 10 ++- src/tools/notifications.ts | 7 +- 6 files changed, 224 insertions(+), 12 deletions(-) create mode 100755 install.sh diff --git a/README-template.md b/README-template.md index 570e0b7..1e95341 100644 --- a/README-template.md +++ b/README-template.md @@ -8,7 +8,7 @@ See [API documentation](https://octomind.dev/docs/api-reference/) ## Usage -1. Install the package - `npm i -g @octomind/octomind` and use it directly e.g. `octomind -h` +1. To install the package, run `curl https://github.com/OctoMind-dev/cli/blob/main/install.sh | bash` this will install the package to `~/.local/packages` and create symlinks in `~/.local/bin`. This is necessary for the cli to work and avoid dependency conflicts. 2. Use the cli through npx e.g. `npx @octomind/octomind -h` diff --git a/install.sh b/install.sh new file mode 100755 index 0000000..d4027ed --- /dev/null +++ b/install.sh @@ -0,0 +1,138 @@ +#!/bin/bash + +# Install script for @octomind/octomind@latest +# Installs to ~/.local/packages with dependencies and creates symlinks in ~/.local/bin + +set -e # Exit on any error + +PACKAGE_NAME="@octomind/octomind" +PACKAGE_VERSION="latest" +INSTALL_DIR="$HOME/.local/packages" +BIN_DIR="$HOME/.local/bin" +PACKAGE_DIR="$INSTALL_DIR/octomind" + +echo "Installing $PACKAGE_NAME@$PACKAGE_VERSION with dependencies..." + +# Create directories +mkdir -p "$INSTALL_DIR" +mkdir -p "$BIN_DIR" + +# Remove existing installation if it exists +if [ -d "$PACKAGE_DIR" ]; then + echo "Removing existing installation..." + rm -rf "$PACKAGE_DIR" +fi + +# Create package directory +mkdir -p "$PACKAGE_DIR" +cd "$PACKAGE_DIR" + +# Install the package and its dependencies using npm +echo "Installing package and dependencies..." +npm install "$PACKAGE_NAME@$PACKAGE_VERSION" --omit=dev --no-save + +# The package will be in node_modules/@octomind/octomind +# Move it to the root and keep node_modules for dependencies +if [ -d "node_modules/@octomind/octomind" ]; then + # Copy package files to root + cp -r node_modules/@octomind/octomind/* . + cp -r node_modules/@octomind/octomind/.[^.]* . 2>/dev/null || true + + # Remove the package from node_modules to avoid duplication + rm -rf node_modules/@octomind/octomind + + # If @octomind directory is now empty, remove it + if [ -d "node_modules/@octomind" ] && [ -z "$(ls -A node_modules/@octomind)" ]; then + rmdir node_modules/@octomind + fi +else + echo "Warning: Package not found in expected location" +fi + +echo "Package installed at: $PACKAGE_DIR" +echo "Dependencies installed in: $PACKAGE_DIR/node_modules" + +# Check if package has executables +if [ -f "$PACKAGE_DIR/package.json" ]; then + # Extract bin field from package.json + BIN_COMMANDS=$(node -e " + const pkg = require('$PACKAGE_DIR/package.json'); + if (pkg.bin) { + if (typeof pkg.bin === 'string') { + console.log('octomind:' + pkg.bin); + } else { + Object.entries(pkg.bin).forEach(([name, path]) => { + console.log(name + ':' + path); + }); + } + } + " 2>/dev/null || echo "") + + if [ -n "$BIN_COMMANDS" ]; then + echo "" + echo "Creating symlinks for executables..." + + # Process each command + echo "$BIN_COMMANDS" | while IFS=':' read -r cmd_name cmd_path; do + if [ -n "$cmd_name" ] && [ -n "$cmd_path" ]; then + SOURCE_PATH="$PACKAGE_DIR/$cmd_path" + LINK_PATH="$BIN_DIR/$cmd_name" + + if [ -f "$SOURCE_PATH" ]; then + # Try to create symlink + if ln -sf "$SOURCE_PATH" "$LINK_PATH" 2>/dev/null; then + echo "✓ Created symlink: $cmd_name -> $SOURCE_PATH" + chmod +x "$SOURCE_PATH" 2>/dev/null || true + else + echo "✗ Failed to create symlink for $cmd_name" + echo " Run manually: ln -sf '$SOURCE_PATH' '$LINK_PATH'" + fi + else + echo "✗ Executable not found: $SOURCE_PATH" + fi + fi + done + + # Check if ~/.local/bin is in PATH + echo "" + if echo "$PATH" | grep -q "$BIN_DIR"; then + echo "✓ $BIN_DIR is already in your PATH" + echo "You can now run: octomind" + else + echo "⚠ $BIN_DIR is not in your PATH" + echo "" + echo "Add this to your shell profile (~/.bashrc, ~/.zshrc, etc.):" + echo "export PATH=\"\$HOME/.local/bin:\$PATH\"" + echo "" + echo "Or run this command to add it for the current session:" + echo "export PATH=\"$BIN_DIR:\$PATH\"" + echo "" + echo "Then you can run: octomind" + fi + else + echo "No executable commands found in package.json" + fi +else + echo "Warning: package.json not found" +fi + +echo "" +echo "Installation complete!" +echo "Package installed at: $PACKAGE_DIR" + +# Show installation info +if [ -f "$PACKAGE_DIR/package.json" ]; then + VERSION=$(node -e "console.log(require('$PACKAGE_DIR/package.json').version)" 2>/dev/null || echo "unknown") + echo "Version: $VERSION" +fi + +# Show size info +if [ -d "$PACKAGE_DIR/node_modules" ]; then + DEP_COUNT=$(find "$PACKAGE_DIR/node_modules" -maxdepth 2 -name "package.json" | wc -l) + echo "Dependencies installed: $DEP_COUNT packages" +fi + +echo "" +echo "To uninstall, run:" +echo "rm -rf '$PACKAGE_DIR'" +echo "rm -f '$BIN_DIR'/octomind" \ No newline at end of file diff --git a/package.json b/package.json index 67dacfd..29ab2d6 100644 --- a/package.json +++ b/package.json @@ -4,6 +4,13 @@ "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" }, @@ -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", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 89bff17..147e8d8 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -17,9 +17,9 @@ importers: openapi-fetch: specifier: ^0.14.0 version: 0.14.0 - tsx: - specifier: ^4.19.3 - version: 4.20.3 + otplib: + specifier: ^12.0.1 + version: 12.0.1 devDependencies: '@types/jest': specifier: ^30.0.0 @@ -41,7 +41,7 @@ importers: version: 4.4.4(eslint-plugin-import@2.32.0)(eslint@8.57.1) eslint-plugin-github: specifier: ^5.0.0 - version: 5.1.8(eslint-import-resolver-typescript@4.4.4)(eslint@8.57.1)(typescript@5.7.3) + version: 5.1.8(eslint-import-resolver-typescript@4.4.4(eslint-plugin-import@2.32.0)(eslint@8.57.1))(eslint@8.57.1)(typescript@5.7.3) eslint-plugin-import: specifier: ^2.27.5 version: 2.32.0(@typescript-eslint/parser@8.38.0(eslint@8.57.1)(typescript@5.7.3))(eslint-import-resolver-typescript@4.4.4)(eslint@8.57.1) @@ -66,6 +66,9 @@ importers: ts-node: specifier: ^10.9.1 version: 10.9.2(@types/node@24.1.0)(typescript@5.7.3) + tsx: + specifier: ^4.19.3 + version: 4.20.3 typescript: specifier: ^5.0.4 version: 5.7.3 @@ -625,6 +628,21 @@ packages: resolution: {integrity: sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==} engines: {node: '>= 8'} + '@otplib/core@12.0.1': + resolution: {integrity: sha512-4sGntwbA/AC+SbPhbsziRiD+jNDdIzsZ3JUyfZwjtKyc/wufl1pnSIaG4Uqx8ymPagujub0o92kgBnB89cuAMA==} + + '@otplib/plugin-crypto@12.0.1': + resolution: {integrity: sha512-qPuhN3QrT7ZZLcLCyKOSNhuijUi9G5guMRVrxq63r9YNOxxQjPm59gVxLM+7xGnHnM6cimY57tuKsjK7y9LM1g==} + + '@otplib/plugin-thirty-two@12.0.1': + resolution: {integrity: sha512-MtT+uqRso909UkbrrYpJ6XFjj9D+x2Py7KjTO9JDPhL0bJUYVu5kFP4TFZW4NFAywrAtFRxOVY261u0qwb93gA==} + + '@otplib/preset-default@12.0.1': + resolution: {integrity: sha512-xf1v9oOJRyXfluBhMdpOkr+bsE+Irt+0D5uHtvg6x1eosfmHCsCC6ej/m7FXiWqdo0+ZUI6xSKDhJwc8yfiOPQ==} + + '@otplib/preset-v11@12.0.1': + resolution: {integrity: sha512-9hSetMI7ECqbFiKICrNa4w70deTUfArtwXykPUvSHWOdzOlfa9ajglu7mNCntlvxycTiOAXkQGwjQCzzDEMRMg==} + '@pkgjs/parseargs@0.11.0': resolution: {integrity: sha512-+1VkjdD0QBLPodGrJUeqarH8VAIvQODIbwh9XpP5Syisf7YoQgsJKPNFoqqLQlu+VQ/tVSshMR6loPMn8U+dPg==} engines: {node: '>=14'} @@ -2410,6 +2428,9 @@ packages: resolution: {integrity: sha512-6IpQ7mKUxRcZNLIObR0hz7lxsapSSIYNZJwXPGeF0mTVqGKFIXj1DQcMoT22S3ROcLyY/rz0PWaWZ9ayWmad9g==} engines: {node: '>= 0.8.0'} + otplib@12.0.1: + resolution: {integrity: sha512-xDGvUOQjop7RDgxTQ+o4pOol0/3xSZzawTiPKRrHnQWAy0WjhNs/5HdIDJCrqC4MBynmjXgULc6YfioaxZeFgg==} + own-keys@1.0.1: resolution: {integrity: sha512-qFOyK5PjiWZd+QQIh+1jhdb9LpxTF0qs7Pm8o5QHYZ0M3vKqSqzsZaEB6oWlxZ+q2sJBMI/Ktgd2N5ZwQoRHfg==} engines: {node: '>= 0.4'} @@ -2763,6 +2784,10 @@ packages: text-table@0.2.0: resolution: {integrity: sha512-N+8UisAXDGk8PFXP4HAzVR9nbfmVJ3zYLAWiTIoqC5v5isinhr+r5uaO8+7r3BMfuNIufIsA7RdpVgacC2cSpw==} + thirty-two@1.0.2: + resolution: {integrity: sha512-OEI0IWCe+Dw46019YLl6V10Us5bi574EvlJEOcAkB29IzQ/mYD1A6RyNHLjZPiHCmuodxvgF6U+vZO1L15lxVA==} + engines: {node: '>=0.2.6'} + tinyglobby@0.2.14: resolution: {integrity: sha512-tX5e7OM1HnYr2+a2C/4V0htOcSQcoSTH9KgJnVvNm5zm/cyEWKJ7j7YutsH9CxMdtOkkLFy2AHrMci9IM8IPZQ==} engines: {node: '>=12.0.0'} @@ -3634,6 +3659,29 @@ snapshots: '@nodelib/fs.scandir': 2.1.5 fastq: 1.19.0 + '@otplib/core@12.0.1': {} + + '@otplib/plugin-crypto@12.0.1': + dependencies: + '@otplib/core': 12.0.1 + + '@otplib/plugin-thirty-two@12.0.1': + dependencies: + '@otplib/core': 12.0.1 + thirty-two: 1.0.2 + + '@otplib/preset-default@12.0.1': + dependencies: + '@otplib/core': 12.0.1 + '@otplib/plugin-crypto': 12.0.1 + '@otplib/plugin-thirty-two': 12.0.1 + + '@otplib/preset-v11@12.0.1': + dependencies: + '@otplib/core': 12.0.1 + '@otplib/plugin-crypto': 12.0.1 + '@otplib/plugin-thirty-two': 12.0.1 + '@pkgjs/parseargs@0.11.0': optional: true @@ -4592,7 +4640,7 @@ snapshots: transitivePeerDependencies: - supports-color - eslint-module-utils@2.12.1(@typescript-eslint/parser@8.38.0(eslint@8.57.1)(typescript@5.7.3))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@4.4.4)(eslint@8.57.1): + eslint-module-utils@2.12.1(@typescript-eslint/parser@8.38.0(eslint@8.57.1)(typescript@5.7.3))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@4.4.4(eslint-plugin-import@2.32.0)(eslint@8.57.1))(eslint@8.57.1): dependencies: debug: 3.2.7 optionalDependencies: @@ -4622,7 +4670,7 @@ snapshots: lodash.snakecase: 4.1.1 lodash.upperfirst: 4.3.1 - eslint-plugin-github@5.1.8(eslint-import-resolver-typescript@4.4.4)(eslint@8.57.1)(typescript@5.7.3): + eslint-plugin-github@5.1.8(eslint-import-resolver-typescript@4.4.4(eslint-plugin-import@2.32.0)(eslint@8.57.1))(eslint@8.57.1)(typescript@5.7.3): dependencies: '@eslint/compat': 1.2.7(eslint@8.57.1) '@eslint/eslintrc': 3.3.0 @@ -4669,7 +4717,7 @@ snapshots: doctrine: 2.1.0 eslint: 8.57.1 eslint-import-resolver-node: 0.3.9 - eslint-module-utils: 2.12.1(@typescript-eslint/parser@8.38.0(eslint@8.57.1)(typescript@5.7.3))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@4.4.4)(eslint@8.57.1) + eslint-module-utils: 2.12.1(@typescript-eslint/parser@8.38.0(eslint@8.57.1)(typescript@5.7.3))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@4.4.4(eslint-plugin-import@2.32.0)(eslint@8.57.1))(eslint@8.57.1) hasown: 2.0.2 is-core-module: 2.16.1 is-glob: 4.0.3 @@ -5801,6 +5849,12 @@ snapshots: type-check: 0.4.0 word-wrap: 1.2.5 + otplib@12.0.1: + dependencies: + '@otplib/core': 12.0.1 + '@otplib/preset-default': 12.0.1 + '@otplib/preset-v11': 12.0.1 + own-keys@1.0.1: dependencies: get-intrinsic: 1.3.0 @@ -6154,6 +6208,8 @@ snapshots: text-table@0.2.0: {} + thirty-two@1.0.2: {} + tinyglobby@0.2.14: dependencies: fdir: 6.4.6(picomatch@4.0.2) diff --git a/src/config.ts b/src/config.ts index 9a8da42..e4c5e62 100644 --- a/src/config.ts +++ b/src/config.ts @@ -23,11 +23,19 @@ export interface Config { testTargetId?: string; } +let configLoaded = false; +let config: Config = {}; + export async function loadConfig(force?: boolean): Promise { + 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) { diff --git a/src/tools/notifications.ts b/src/tools/notifications.ts index 193a2cc..417ea70 100644 --- a/src/tools/notifications.ts +++ b/src/tools/notifications.ts @@ -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"]; @@ -27,15 +28,17 @@ 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}`); @@ -43,5 +46,5 @@ export const listNotifications = async ( if (notification.ack) { console.log(`Acknowledged: ${notification.ack}`); } - }); + } }; From 2d42b24d0437c29d41fca094a38da49d88b05dca Mon Sep 17 00:00:00 2001 From: Stefan Rinke Date: Thu, 31 Jul 2025 09:27:47 +0200 Subject: [PATCH 2/5] version bump --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 29ab2d6..a1ff7ab 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "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", From 12a827cbe05232b7f54c7cae7c267e650fa6da78 Mon Sep 17 00:00:00 2001 From: Stefan Rinke Date: Thu, 31 Jul 2025 09:29:10 +0200 Subject: [PATCH 3/5] lint --- src/tools/notifications.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/tools/notifications.ts b/src/tools/notifications.ts index 417ea70..a6b496b 100644 --- a/src/tools/notifications.ts +++ b/src/tools/notifications.ts @@ -34,11 +34,15 @@ export const listNotifications = async ( 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" })}`); + 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" })}`); + console.log( + `URL: ${await getUrl({ testCaseId: notification.payload.testCaseId, entityType: "test-case" })}`, + ); } if (notification.payload?.failed !== undefined) { console.log(`Failed: ${notification.payload.failed}`); From 257a3dee8d77fe0b76959620d38460285665265a Mon Sep 17 00:00:00 2001 From: Stefan Rinke Date: Thu, 31 Jul 2025 10:18:31 +0200 Subject: [PATCH 4/5] fix test with cached config --- src/config.ts | 5 +++++ tests/config.spec.ts | 3 ++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/config.ts b/src/config.ts index e4c5e62..3311e93 100644 --- a/src/config.ts +++ b/src/config.ts @@ -26,6 +26,11 @@ export interface Config { let configLoaded = false; let config: Config = {}; +export function resetConfig() { + configLoaded = false; + config = {}; +} + export async function loadConfig(force?: boolean): Promise { if(configLoaded && !force) { return config; diff --git a/tests/config.spec.ts b/tests/config.spec.ts index 29e738e..3a1e531 100644 --- a/tests/config.spec.ts +++ b/tests/config.spec.ts @@ -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; @@ -10,6 +10,7 @@ const originalConsoleError = console.error; describe("Config", () => { beforeEach(() => { console.error = jest.fn(); + resetConfig(); }); afterEach(() => { From c35f2ec147840a152ae6a035d2b3895f51559c7c Mon Sep 17 00:00:00 2001 From: Stefan Rinke Date: Thu, 31 Jul 2025 14:27:01 +0200 Subject: [PATCH 5/5] fixed install doc --- README-template.md | 18 +++++- README.md | 22 ++++++-- install.sh | 138 --------------------------------------------- 3 files changed, 32 insertions(+), 146 deletions(-) delete mode 100755 install.sh diff --git a/README-template.md b/README-template.md index 1e95341..a48e7ac 100644 --- a/README-template.md +++ b/README-template.md @@ -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. To install the package, run `curl https://github.com/OctoMind-dev/cli/blob/main/install.sh | bash` this will install the package to `~/.local/packages` and create symlinks in `~/.local/bin`. This is necessary for the cli to work and avoid dependency conflicts. -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} diff --git a/README.md b/README.md index 17472c2..2480eb1 100644 --- a/README.md +++ b/README.md @@ -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]` @@ -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 diff --git a/install.sh b/install.sh deleted file mode 100755 index d4027ed..0000000 --- a/install.sh +++ /dev/null @@ -1,138 +0,0 @@ -#!/bin/bash - -# Install script for @octomind/octomind@latest -# Installs to ~/.local/packages with dependencies and creates symlinks in ~/.local/bin - -set -e # Exit on any error - -PACKAGE_NAME="@octomind/octomind" -PACKAGE_VERSION="latest" -INSTALL_DIR="$HOME/.local/packages" -BIN_DIR="$HOME/.local/bin" -PACKAGE_DIR="$INSTALL_DIR/octomind" - -echo "Installing $PACKAGE_NAME@$PACKAGE_VERSION with dependencies..." - -# Create directories -mkdir -p "$INSTALL_DIR" -mkdir -p "$BIN_DIR" - -# Remove existing installation if it exists -if [ -d "$PACKAGE_DIR" ]; then - echo "Removing existing installation..." - rm -rf "$PACKAGE_DIR" -fi - -# Create package directory -mkdir -p "$PACKAGE_DIR" -cd "$PACKAGE_DIR" - -# Install the package and its dependencies using npm -echo "Installing package and dependencies..." -npm install "$PACKAGE_NAME@$PACKAGE_VERSION" --omit=dev --no-save - -# The package will be in node_modules/@octomind/octomind -# Move it to the root and keep node_modules for dependencies -if [ -d "node_modules/@octomind/octomind" ]; then - # Copy package files to root - cp -r node_modules/@octomind/octomind/* . - cp -r node_modules/@octomind/octomind/.[^.]* . 2>/dev/null || true - - # Remove the package from node_modules to avoid duplication - rm -rf node_modules/@octomind/octomind - - # If @octomind directory is now empty, remove it - if [ -d "node_modules/@octomind" ] && [ -z "$(ls -A node_modules/@octomind)" ]; then - rmdir node_modules/@octomind - fi -else - echo "Warning: Package not found in expected location" -fi - -echo "Package installed at: $PACKAGE_DIR" -echo "Dependencies installed in: $PACKAGE_DIR/node_modules" - -# Check if package has executables -if [ -f "$PACKAGE_DIR/package.json" ]; then - # Extract bin field from package.json - BIN_COMMANDS=$(node -e " - const pkg = require('$PACKAGE_DIR/package.json'); - if (pkg.bin) { - if (typeof pkg.bin === 'string') { - console.log('octomind:' + pkg.bin); - } else { - Object.entries(pkg.bin).forEach(([name, path]) => { - console.log(name + ':' + path); - }); - } - } - " 2>/dev/null || echo "") - - if [ -n "$BIN_COMMANDS" ]; then - echo "" - echo "Creating symlinks for executables..." - - # Process each command - echo "$BIN_COMMANDS" | while IFS=':' read -r cmd_name cmd_path; do - if [ -n "$cmd_name" ] && [ -n "$cmd_path" ]; then - SOURCE_PATH="$PACKAGE_DIR/$cmd_path" - LINK_PATH="$BIN_DIR/$cmd_name" - - if [ -f "$SOURCE_PATH" ]; then - # Try to create symlink - if ln -sf "$SOURCE_PATH" "$LINK_PATH" 2>/dev/null; then - echo "✓ Created symlink: $cmd_name -> $SOURCE_PATH" - chmod +x "$SOURCE_PATH" 2>/dev/null || true - else - echo "✗ Failed to create symlink for $cmd_name" - echo " Run manually: ln -sf '$SOURCE_PATH' '$LINK_PATH'" - fi - else - echo "✗ Executable not found: $SOURCE_PATH" - fi - fi - done - - # Check if ~/.local/bin is in PATH - echo "" - if echo "$PATH" | grep -q "$BIN_DIR"; then - echo "✓ $BIN_DIR is already in your PATH" - echo "You can now run: octomind" - else - echo "⚠ $BIN_DIR is not in your PATH" - echo "" - echo "Add this to your shell profile (~/.bashrc, ~/.zshrc, etc.):" - echo "export PATH=\"\$HOME/.local/bin:\$PATH\"" - echo "" - echo "Or run this command to add it for the current session:" - echo "export PATH=\"$BIN_DIR:\$PATH\"" - echo "" - echo "Then you can run: octomind" - fi - else - echo "No executable commands found in package.json" - fi -else - echo "Warning: package.json not found" -fi - -echo "" -echo "Installation complete!" -echo "Package installed at: $PACKAGE_DIR" - -# Show installation info -if [ -f "$PACKAGE_DIR/package.json" ]; then - VERSION=$(node -e "console.log(require('$PACKAGE_DIR/package.json').version)" 2>/dev/null || echo "unknown") - echo "Version: $VERSION" -fi - -# Show size info -if [ -d "$PACKAGE_DIR/node_modules" ]; then - DEP_COUNT=$(find "$PACKAGE_DIR/node_modules" -maxdepth 2 -name "package.json" | wc -l) - echo "Dependencies installed: $DEP_COUNT packages" -fi - -echo "" -echo "To uninstall, run:" -echo "rm -rf '$PACKAGE_DIR'" -echo "rm -f '$BIN_DIR'/octomind" \ No newline at end of file