From 676de90e0ada8399054babd08a8fb8547a917d13 Mon Sep 17 00:00:00 2001 From: Naing Linn Khant Date: Wed, 1 Oct 2025 01:52:18 +0700 Subject: [PATCH 1/2] chore: rename vector stores to stores --- CLAUDE.md | 8 +- README.md | 16 +-- packages/cli/README.md | 122 +++++++++--------- packages/cli/scripts/setup-cli.js | 4 +- packages/cli/src/commands/completion.ts | 24 ++-- .../cli/src/commands/vector-store/create.ts | 14 +- .../cli/src/commands/vector-store/delete.ts | 16 +-- .../src/commands/vector-store/files/delete.ts | 6 +- .../src/commands/vector-store/files/get.ts | 2 +- .../src/commands/vector-store/files/index.ts | 2 +- .../src/commands/vector-store/files/list.ts | 4 +- packages/cli/src/commands/vector-store/get.ts | 12 +- .../cli/src/commands/vector-store/index.ts | 28 ++-- .../cli/src/commands/vector-store/list.ts | 30 ++--- packages/cli/src/commands/vector-store/qa.ts | 4 +- .../cli/src/commands/vector-store/search.ts | 8 +- .../cli/src/commands/vector-store/sync.ts | 30 ++--- .../cli/src/commands/vector-store/update.ts | 18 ++- .../cli/src/commands/vector-store/upload.ts | 4 +- packages/cli/src/utils/completion-cache.ts | 2 +- packages/cli/src/utils/sync-state.ts | 2 +- packages/cli/src/utils/sync.ts | 4 +- packages/cli/src/utils/upload.ts | 6 +- packages/cli/src/utils/vector-store.ts | 24 ++-- .../cli/tests/commands/completion.test.ts | 40 +++--- .../cli/tests/commands/config/get.test.ts | 15 ++- .../cli/tests/commands/config/set.test.ts | 4 +- .../commands/vector-store/create.test.ts | 16 +-- .../commands/vector-store/delete.test.ts | 14 +- .../tests/commands/vector-store/files.test.ts | 6 +- .../tests/commands/vector-store/get.test.ts | 24 ++-- .../tests/commands/vector-store/list.test.ts | 10 +- .../tests/commands/vector-store/qa.test.ts | 6 +- .../commands/vector-store/search.test.ts | 12 +- .../tests/commands/vector-store/sync.test.ts | 2 +- .../commands/vector-store/update.test.ts | 22 ++-- .../commands/vector-store/upload.test.ts | 10 +- packages/cli/tests/helpers/test-utils.ts | 2 +- .../cli/tests/utils/completion-cache.test.ts | 16 +-- packages/cli/tests/utils/config.test.ts | 18 +-- packages/cli/tests/utils/output.test.ts | 69 +++++----- packages/cli/tests/utils/vector-store.test.ts | 20 +-- .../search/src/search/hooks/use-search.ts | 2 +- packages/search/src/search/lib/fumadocs.ts | 2 +- 44 files changed, 348 insertions(+), 352 deletions(-) diff --git a/CLAUDE.md b/CLAUDE.md index a75a1c6..5f6a54e 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -4,8 +4,8 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co ## Repository Overview -Openbread is an open-source toolkit for Mixedbread's vector store platform. This monorepo contains: -- `@mixedbread/cli` - Command-line interface for managing vector stores +Openbread is an open-source toolkit for Mixedbread's store platform. This monorepo contains: +- `@mixedbread/cli` - Command-line interface for managing stores ## Development Commands @@ -99,8 +99,8 @@ export MXBAI_API_KEY="your-api-key" 3. Add tests in `packages/cli/tests/commands/` 4. Register command in appropriate index file -### Working with Vector Stores -- CLI provides full CRUD operations for vector stores +### Working with Stores +- CLI provides full CRUD operations for stores - File upload with processing strategies (high_quality, fast, auto) - Git-based and hash-based sync capabilities - Manifest-based bulk uploads via YAML configuration diff --git a/README.md b/README.md index 9ca1b55..86786c0 100644 --- a/README.md +++ b/README.md @@ -3,16 +3,16 @@ [![npm version](https://badge.fury.io/js/@mixedbread%2Fcli.svg)](https://www.npmjs.com/package/@mixedbread/cli) [![License: Apache 2.0](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0) -Openbread is an open-source monorepo containing tools for interacting with [Mixedbread](https://www.mixedbread.com/)'s vector store platform. Currently, it houses the command-line interface (CLI) that enables seamless vector store management, file processing, and intelligent search capabilities. +Openbread is an open-source monorepo containing tools for interacting with [Mixedbread](https://www.mixedbread.com/)'s store platform. Currently, it houses the command-line interface (CLI) that enables seamless store management, file processing, and intelligent search capabilities. ## Packages ### šŸ› ļø [@mixedbread/cli](./packages/cli) -A comprehensive command-line interface for managing Mixedbread vector stores. +A comprehensive command-line interface for managing Mixedbread stores. **Key Features:** -- Vector store management (create, update, delete, list) +- Store management (create, update, delete, list) - Intelligent file upload with processing strategies - Advanced sync with git-based and hash-based change detections - Vector search and Q&A capabilities @@ -29,14 +29,14 @@ npm install -g @mixedbread/cli # Set your API key export MXBAI_API_KEY=mxb_xxxxx -# Create a vector store -mxbai vs create "My Documents" +# Create a store +mxbai store create "My Documents" # Upload files with high-quality processing -mxbai vs upload "My Documents" "**/*.md" --strategy high_quality --contextualization +mxbai store upload "My Documents" "**/*.md" --strategy high_quality --contextualization # Search your content -mxbai vs search "My Documents" "how to get started" +mxbai store search "My Documents" "how to get started" ``` ## Prerequisites @@ -60,7 +60,7 @@ mxbai vs search "My Documents" "how to get started" ``` 4. **Start building:** - - Create vector stores for your documents + - Create stores for your documents - Upload and process files with different strategies - Search and interact with your content diff --git a/packages/cli/README.md b/packages/cli/README.md index 4471aa3..14044de 100644 --- a/packages/cli/README.md +++ b/packages/cli/README.md @@ -1,6 +1,6 @@ # @mixedbread/cli -CLI tool for managing Mixedbread vector stores and files. +CLI tool for managing Mixedbread stores and files. ## Installation @@ -23,66 +23,66 @@ mxbai completion install ## Check available commands and their options mxbai --help -# List vector stores -mxbai vs list +# List stores +mxbai store list -# Create a new vector store -mxbai vs create "My Documents" +# Create a new store +mxbai store create "My Documents" # Upload files -mxbai vs upload "My Documents" "*.md" "docs/**/*.pdf" +mxbai store upload "My Documents" "*.md" "docs/**/*.pdf" # Upload with high-quality processing and contextualization -mxbai vs upload "My Documents" "**/*.md" --strategy high_quality --contextualization +mxbai store upload "My Documents" "**/*.md" --strategy high_quality --contextualization # Search content -mxbai vs search "My Documents" "how to get started" +mxbai store search "My Documents" "how to get started" # Sync files with change detection -mxbai vs sync "My Documents" "docs/**" --from-git HEAD~1 +mxbai store sync "My Documents" "docs/**" --from-git HEAD~1 # Sync with processing options -mxbai vs sync "My Documents" "**/*.md" --parallel 8 +mxbai store sync "My Documents" "**/*.md" --parallel 8 # Upload with manifest file (JSON or YAML) -mxbai vs upload "My Documents" --manifest upload-manifest.json -mxbai vs upload "My Documents" --manifest upload-manifest.yaml +mxbai store upload "My Documents" --manifest upload-manifest.json +mxbai store upload "My Documents" --manifest upload-manifest.yaml ``` ## Commands -### Vector Store Management +### Store Management -- `mxbai vs list` - List all vector stores +- `mxbai store list` - List all stores - Options: `--filter `, `--limit ` -- `mxbai vs create ` - Create a new vector store +- `mxbai store create ` - Create a new store - Options: `--description `, `--expires-after `, `--metadata ` -- `mxbai vs get ` - Get vector store details -- `mxbai vs update ` - Update vector store +- `mxbai store get ` - Get store details +- `mxbai store update ` - Update store - Options: `--name `, `--description `, `--expires-after `, `--metadata ` -- `mxbai vs delete ` - Delete vector store (alias: `rm`) +- `mxbai store delete ` - Delete store (alias: `rm`) - Options: `--yes/-y` (skip confirmation) ### File Management -- `mxbai vs upload ` - Upload files to vector store +- `mxbai store upload ` - Upload files to store - Options: `--strategy fast|high_quality`, `--contextualization`, `--metadata `, `--dry-run`, `--parallel ` (1-200), `--unique`, `--manifest ` -- `mxbai vs files list ` - List files in vector store (alias: `ls`) +- `mxbai store files list ` - List files in store (alias: `ls`) - Options: `--status ` (pending|in_progress|cancelled|completed|failed), `--limit ` -- `mxbai vs files get ` - Get file details -- `mxbai vs files delete ` - Delete file (alias: `rm`) +- `mxbai store files get ` - Get file details +- `mxbai store files delete ` - Delete file (alias: `rm`) - Options: `--yes/-y` (skip confirmation) ### Search & Query -- `mxbai vs search ` - Search vector store +- `mxbai store search ` - Search store - Options: `--top-k `, `--threshold `, `--return-metadata`, `--rerank`, `--file-search` -- `mxbai vs qa ` - Ask questions about content +- `mxbai store qa ` - Ask questions about content - Options: `--top-k `, `--threshold `, `--return-metadata` ### Advanced Features -- `mxbai vs sync ` - Sync files with intelligent change detection +- `mxbai store sync ` - Sync files with intelligent change detection - Options: `--strategy `, `--contextualization`, `--from-git `, `--dry-run`, `--yes/-y`, `--force/-f`, `--metadata `, `--parallel ` (1-200) ### Configuration @@ -97,7 +97,7 @@ mxbai vs upload "My Documents" --manifest upload-manifest.yaml - `mxbai completion install` - Install shell completion - Options: `--shell ` (manually specify shell: bash, zsh, fish, pwsh) - `mxbai completion uninstall` - Uninstall shell completion -- `mxbai completion refresh` - Refresh completion cache for vector store names +- `mxbai completion refresh` - Refresh completion cache for store names ## Features @@ -204,22 +204,22 @@ The sync command provides intelligent change detection and robust error handling **Example Usage:** ```bash # Sync with git-based detection (fastest) -mxbai vs sync "My Docs" "docs/**" --from-git HEAD~1 +mxbai store sync "My Docs" "docs/**" --from-git HEAD~1 # Sync with hash-based detection and custom parallel processing -mxbai vs sync "My Docs" "**/*.md" --parallel 10 +mxbai store sync "My Docs" "**/*.md" --parallel 10 # Sync with high-quality processing and contextualization -mxbai vs sync "My Docs" "**/*.md" --strategy high_quality --contextualization +mxbai store sync "My Docs" "**/*.md" --strategy high_quality --contextualization # Dry run to preview changes -mxbai vs sync "My Docs" "src/**" --dry-run +mxbai store sync "My Docs" "src/**" --dry-run # Force re-upload all files without confirmation -mxbai vs sync "My Docs" "**/*.pdf" --yes --force +mxbai store sync "My Docs" "**/*.pdf" --yes --force # Same as above using short flags -mxbai vs sync "My Docs" "**/*.pdf" -y -f +mxbai store sync "My Docs" "**/*.pdf" -y -f ``` ### Configuration Management @@ -256,13 +256,13 @@ mxbai config keys remove personal # Remove an API key without confirmation mxbai config keys remove personal --yes -# Create aliases for frequently used vector stores +# Create aliases for frequently used stores mxbai config set aliases.docs "My Documentation" mxbai config set aliases.kb "Knowledge Base" # Then use aliases instead of full names -mxbai vs upload docs "*.md" # Instead of: mxbai vs upload "My Documentation" "*.md" -mxbai vs search kb "how to get started" # Instead of: mxbai vs search "Knowledge Base" "how to get started" +mxbai store upload docs "*.md" # Instead of: mxbai store upload "My Documentation" "*.md" +mxbai store search kb "how to get started" # Instead of: mxbai store search "Knowledge Base" "how to get started" # View all configuration mxbai config get @@ -293,11 +293,11 @@ mxbai config keys add mxb_xxxxx work mxbai config keys add mxb_xxxxx personal # Use a specific saved API key for a command -mxbai vs upload "My Docs" "*.md" --saved-key work -mxbai vs search "Knowledge Base" "query" --saved-key personal +mxbai store upload "My Docs" "*.md" --saved-key work +mxbai store search "Knowledge Base" "query" --saved-key personal # Or use an actual API key directly -mxbai vs upload "My Docs" "*.md" --api-key mxb_xxxxx +mxbai store upload "My Docs" "*.md" --api-key mxb_xxxxx # The last added key becomes default automatically # Or explicitly set a default @@ -306,7 +306,7 @@ mxbai config keys set-default personal ## Shell Completion -The CLI supports intelligent tab completion for commands, subcommands, and **vector store names**. +The CLI supports intelligent tab completion for commands, subcommands, and **store names**. ### Installation @@ -332,29 +332,29 @@ After installation, restart your shell or reload your shell configuration: - **fish**: Completion is ready to use (fish auto-loads completions) - **pwsh**: `. $PROFILE` or restart terminal -### Dynamic Vector Store Name Completion +### Dynamic Store Name Completion -The CLI provides intelligent tab completion for vector store names in commands: +The CLI provides intelligent tab completion for store names in commands: ```bash -# Tab completion shows your vector store names -mxbai vs get [TAB] # Shows: store1 store2 my-docs ... -mxbai vs delete [TAB] # Shows: store1 store2 my-docs ... -mxbai vs sync [TAB] # Shows: store1 store2 my-docs ... -mxbai vs upload [TAB] # Shows: store1 store2 my-docs ... +# Tab completion shows your store names +mxbai store get [TAB] # Shows: store1 store2 my-docs ... +mxbai store delete [TAB] # Shows: store1 store2 my-docs ... +mxbai store sync [TAB] # Shows: store1 store2 my-docs ... +mxbai store upload [TAB] # Shows: store1 store2 my-docs ... # Also works with files subcommands -mxbai vs files list [TAB] # Shows: store1 store2 my-docs ... +mxbai store files list [TAB] # Shows: store1 store2 my-docs ... ``` **How it works:** -- Vector store names are cached locally for instant completion (no API latency) -- Cache updates automatically when you create, update, delete, or list vector stores +- Store names are cached locally for instant completion (no API latency) +- Cache updates automatically when you create, update, delete, or list stores - Supports multiple API keys - completions show stores for your current default key - Manual refresh available: `mxbai completion refresh` **Cache management:** -- Caches up to 50 most recent vector store names per API key +- Caches up to 50 most recent store names per API key - Cache location follows your config directory: - Linux/Unix: `~/.config/mixedbread/completion-cache.json` - macOS: `~/Library/Application Support/mixedbread/completion-cache.json` @@ -416,8 +416,8 @@ This CLI is built on top of the `@mixedbread/sdk` and provides a convenient comm **Option A: Quick testing** (no tab completion) ```bash - pnpm mxbai vs --help - pnpm mxbai vs list + pnpm mxbai store --help + pnpm mxbai store list ``` **Option B: Full CLI experience with tab completion** @@ -429,7 +429,7 @@ This CLI is built on top of the `@mixedbread/sdk` and provides a convenient comm cd packages/cli && npm link # Now test with full CLI features - mxbai vs --help + mxbai store --help mxbai [TAB] # Tab completion works! # To unlink when done @@ -467,20 +467,20 @@ src/ │ │ ā”œā”€ā”€ get.ts # Get config values │ │ ā”œā”€ā”€ set.ts # Set config values │ │ └── index.ts -│ └── vector-store/ # Vector store commands +│ └── vector-store/ # Store commands │ ā”œā”€ā”€ files/ # File management subcommands │ │ ā”œā”€ā”€ delete.ts │ │ ā”œā”€ā”€ get.ts │ │ ā”œā”€ā”€ list.ts │ │ └── index.ts -│ ā”œā”€ā”€ create.ts # Create vector store -│ ā”œā”€ā”€ delete.ts # Delete vector store -│ ā”œā”€ā”€ get.ts # Get vector store details -│ ā”œā”€ā”€ list.ts # List vector stores +│ ā”œā”€ā”€ create.ts # Create store +│ ā”œā”€ā”€ delete.ts # Delete store +│ ā”œā”€ā”€ get.ts # Get store details +│ ā”œā”€ā”€ list.ts # List stores │ ā”œā”€ā”€ qa.ts # Q&A functionality │ ā”œā”€ā”€ search.ts # Search functionality │ ā”œā”€ā”€ sync.ts # Sync files -│ ā”œā”€ā”€ update.ts # Update vector store +│ ā”œā”€ā”€ update.ts # Update store │ ā”œā”€ā”€ upload.ts # Upload files │ └── index.ts ā”œā”€ā”€ utils/ # Shared utilities @@ -496,7 +496,7 @@ src/ │ ā”œā”€ā”€ sync-state.ts # Sync state management │ ā”œā”€ā”€ sync.ts # Sync logic │ ā”œā”€ā”€ upload.ts # Upload utilities -│ └── vector-store.ts # Vector store helpers +│ └── vector-store.ts # Store helpers └── index.ts # Package exports tests/ @@ -549,7 +549,7 @@ tests/ #### Debugging -- Use `--debug` flag for verbose output: `pnpm mxbai --debug vs list` +- Use `--debug` flag for verbose output: `pnpm mxbai --debug store list` - Set `MXBAI_DEBUG=true` environment variable for debug output - Debug output includes command hierarchy options and merged options - Tests include detailed error messages and mock setups diff --git a/packages/cli/scripts/setup-cli.js b/packages/cli/scripts/setup-cli.js index 49e5a55..3c5c6e2 100755 --- a/packages/cli/scripts/setup-cli.js +++ b/packages/cli/scripts/setup-cli.js @@ -178,8 +178,8 @@ async function main() { if (isInstalled || install?.toLowerCase() === "y") { console.log("Get started with the mxbai CLI:"); console.log(" mxbai --help # Show all commands"); - console.log(" mxbai vs list # List your vector stores"); - console.log(' mxbai vs create "My Docs" # Create a new vector store'); + console.log(" mxbai store list # List your stores"); + console.log(' mxbai store create "My Docs" # Create a new store'); console.log(" mxbai config get # View configuration"); console.log("\nUseful resources:"); diff --git a/packages/cli/src/commands/completion.ts b/packages/cli/src/commands/completion.ts index e87a565..82de683 100644 --- a/packages/cli/src/commands/completion.ts +++ b/packages/cli/src/commands/completion.ts @@ -213,13 +213,13 @@ export function createCompletionServerCommand(): Command { // Root level completions - "mxbai " (when no previous command) if (env.words === 1) { return log( - ["config", "vs", "completion", "--help", "--version"], + ["config", "store", "completion", "--help", "--version"], shell, console.log ); } - // Vector store name completions + // Store name completions const STORE_NAME_COMMANDS = [ "get", "delete", @@ -232,8 +232,8 @@ export function createCompletionServerCommand(): Command { if (STORE_NAME_COMMANDS.includes(env.prev)) { const words = env.line.trim().split(/\s+/); - // Check if previous word is "vs" - if (words.length >= 3 && words[words.length - 2] === "vs") { + // Check if previous word is "store" + if (words.length >= 3 && words[words.length - 2] === "store") { const keyName = getCurrentKeyName(); if (keyName) { const stores = getStoresForCompletion(keyName); @@ -244,8 +244,8 @@ export function createCompletionServerCommand(): Command { } } - // Vector store completions - if (env.prev === "vs") { + // Store completions + if (env.prev === "store") { return log( [ "create", @@ -264,23 +264,23 @@ export function createCompletionServerCommand(): Command { ); } - // Vector store files completions + // Store files completions if (env.prev === "files") { - // Check if we're in "mxbai vs files " context + // Check if we're in "mxbai store files " context const words = env.line.trim().split(/\s+/); - if (words.length >= 3 && words[1] === "vs") { + if (words.length >= 3 && words[1] === "store") { return log(["list", "get", "delete"], shell, console.log); } } - // Vector store name completions for files subcommands + // Store name completions for files subcommands const FILES_SUBCOMMANDS = ["list", "get", "delete"]; if (FILES_SUBCOMMANDS.includes(env.prev)) { const words = env.line.trim().split(/\s+/); - // Check for "mxbai vs files [subcommand] " context + // Check for "mxbai store files [subcommand] " context if ( words.length >= 4 && - words[1] === "vs" && + words[1] === "store" && words[2] === "files" && FILES_SUBCOMMANDS.includes(words[3]) ) { diff --git a/packages/cli/src/commands/vector-store/create.ts b/packages/cli/src/commands/vector-store/create.ts index badba82..66a6048 100644 --- a/packages/cli/src/commands/vector-store/create.ts +++ b/packages/cli/src/commands/vector-store/create.ts @@ -37,9 +37,9 @@ interface CreateOptions extends GlobalOptions { export function createCreateCommand(): Command { const command = addGlobalOptions( new Command("create") - .description("Create a new vector store") - .argument("", "Name of the vector store") - .option("--description ", "Description of the vector store") + .description("Create a new store") + .argument("", "Name of the store") + .option("--description ", "Description of the store") .option("--expires-after ", "Expire after number of days") .option("--metadata ", "Additional metadata as JSON string") ); @@ -58,7 +58,7 @@ export function createCreateCommand(): Command { const metadata = validateMetadata(parsedOptions.metadata); - spinner = ora("Creating vector store...").start(); + spinner = ora("Creating store...").start(); const vectorStore = await client.vectorStores.create({ name: parsedOptions.name, @@ -72,7 +72,7 @@ export function createCreateCommand(): Command { metadata, }); - spinner.succeed(`Vector store "${name}" created successfully`); + spinner.succeed(`Store "${name}" created successfully`); formatOutput( { @@ -94,11 +94,11 @@ export function createCreateCommand(): Command { updateCacheAfterCreate(keyName, vectorStore.name); } } catch (error) { - spinner?.fail("Failed to create vector store"); + spinner?.fail("Failed to create store"); if (error instanceof Error) { console.error(chalk.red("\nāœ—"), error.message); } else { - console.error(chalk.red("\nāœ—"), "Failed to create vector store"); + console.error(chalk.red("\nāœ—"), "Failed to create store"); } process.exit(1); } diff --git a/packages/cli/src/commands/vector-store/delete.ts b/packages/cli/src/commands/vector-store/delete.ts index fe01383..19f733b 100644 --- a/packages/cli/src/commands/vector-store/delete.ts +++ b/packages/cli/src/commands/vector-store/delete.ts @@ -30,8 +30,8 @@ export function createDeleteCommand(): Command { const command = addGlobalOptions( new Command("delete") .alias("rm") - .description("Delete a vector store") - .argument("", "Name or ID of the vector store") + .description("Delete a store") + .argument("", "Name or ID of the store") .option("-y, --yes", "Skip confirmation prompt") ); @@ -58,7 +58,7 @@ export function createDeleteCommand(): Command { { type: "confirm", name: "confirmed", - message: `Are you sure you want to delete vector store "${vectorStore.name}" (${vectorStore.id})? This action cannot be undone.`, + message: `Are you sure you want to delete store "${vectorStore.name}" (${vectorStore.id})? This action cannot be undone.`, default: false, }, ]); @@ -69,13 +69,11 @@ export function createDeleteCommand(): Command { } } - spinner = ora("Deleting vector store...").start(); + spinner = ora("Deleting store...").start(); await client.vectorStores.delete(vectorStore.id); - spinner.succeed( - `Vector store "${vectorStore.name}" deleted successfully` - ); + spinner.succeed(`Store "${vectorStore.name}" deleted successfully`); // Update completion cache by removing the deleted store const keyName = getCurrentKeyName(); @@ -83,11 +81,11 @@ export function createDeleteCommand(): Command { updateCacheAfterDelete(keyName, vectorStore.name); } } catch (error) { - spinner?.fail("Failed to delete vector store"); + spinner?.fail("Failed to delete store"); if (error instanceof Error) { console.error(chalk.red("\nāœ—"), error.message); } else { - console.error(chalk.red("\nāœ—"), "Failed to delete vector store"); + console.error(chalk.red("\nāœ—"), "Failed to delete store"); } process.exit(1); } diff --git a/packages/cli/src/commands/vector-store/files/delete.ts b/packages/cli/src/commands/vector-store/files/delete.ts index 7f5d926..7d39e0e 100644 --- a/packages/cli/src/commands/vector-store/files/delete.ts +++ b/packages/cli/src/commands/vector-store/files/delete.ts @@ -23,8 +23,8 @@ export function createDeleteCommand(): Command { const deleteCommand = addGlobalOptions( new Command("delete") .alias("rm") - .description("Delete a file from vector store") - .argument("", "Name or ID of the vector store") + .description("Delete a file from store") + .argument("", "Name or ID of the store") .argument("", "ID of the file") .option("-y, --yes", "Skip confirmation prompt") ); @@ -53,7 +53,7 @@ export function createDeleteCommand(): Command { { type: "confirm", name: "confirmed", - message: `Are you sure you want to delete file "${parsedOptions.fileId}" from vector store "${vectorStore.name}" (${vectorStore.id})? This action cannot be undone.`, + message: `Are you sure you want to delete file "${parsedOptions.fileId}" from store "${vectorStore.name}" (${vectorStore.id})? This action cannot be undone.`, default: false, }, ]); diff --git a/packages/cli/src/commands/vector-store/files/get.ts b/packages/cli/src/commands/vector-store/files/get.ts index 42f7db8..ca74f91 100644 --- a/packages/cli/src/commands/vector-store/files/get.ts +++ b/packages/cli/src/commands/vector-store/files/get.ts @@ -22,7 +22,7 @@ export function createGetCommand(): Command { const getCommand = addGlobalOptions( new Command("get") .description("Get file details") - .argument("", "Name or ID of the vector store") + .argument("", "Name or ID of the store") .argument("", "ID of the file") ); diff --git a/packages/cli/src/commands/vector-store/files/index.ts b/packages/cli/src/commands/vector-store/files/index.ts index 49a89ca..dace415 100644 --- a/packages/cli/src/commands/vector-store/files/index.ts +++ b/packages/cli/src/commands/vector-store/files/index.ts @@ -11,7 +11,7 @@ export interface FilesOptions extends GlobalOptions { export function createFilesCommand(): Command { const filesCommand = new Command("files").description( - "Manage files in vector stores" + "Manage files in stores" ); // Add subcommands diff --git a/packages/cli/src/commands/vector-store/files/list.ts b/packages/cli/src/commands/vector-store/files/list.ts index 332c376..7f9bf02 100644 --- a/packages/cli/src/commands/vector-store/files/list.ts +++ b/packages/cli/src/commands/vector-store/files/list.ts @@ -37,8 +37,8 @@ export function createListCommand(): Command { const listCommand = addGlobalOptions( new Command("list") .alias("ls") - .description("List files in a vector store") - .argument("", "Name or ID of the vector store") + .description("List files in a store") + .argument("", "Name or ID of the store") .option( "--status ", "Filter by status (pending|in_progress|cancelled|completed|failed)", diff --git a/packages/cli/src/commands/vector-store/get.ts b/packages/cli/src/commands/vector-store/get.ts index 8804c37..09a6465 100644 --- a/packages/cli/src/commands/vector-store/get.ts +++ b/packages/cli/src/commands/vector-store/get.ts @@ -22,8 +22,8 @@ interface GetOptions extends GlobalOptions {} export function createGetCommand(): Command { const command = addGlobalOptions( new Command("get") - .description("Get vector store details") - .argument("", "Name or ID of the vector store") + .description("Get store details") + .argument("", "Name or ID of the store") ); command.action(async (nameOrId: string, options: GetOptions) => { @@ -38,13 +38,13 @@ export function createGetCommand(): Command { }); const client = createClient(parsedOptions); - spinner = ora("Loading vector store details...").start(); + spinner = ora("Loading store details...").start(); const vectorStore = await resolveVectorStore( client, parsedOptions.nameOrId ); - spinner.succeed("Vector store details loaded"); + spinner.succeed("Store details loaded"); const formattedData = { name: vectorStore.name, @@ -72,11 +72,11 @@ export function createGetCommand(): Command { formatOutput(formattedData, parsedOptions.format); } catch (error) { - spinner?.fail("Failed to load vector store details"); + spinner?.fail("Failed to load store details"); if (error instanceof Error) { console.error(chalk.red("\nāœ—"), error.message); } else { - console.error(chalk.red("\nāœ—"), "Failed to get vector store details"); + console.error(chalk.red("\nāœ—"), "Failed to get store details"); } process.exit(1); } diff --git a/packages/cli/src/commands/vector-store/index.ts b/packages/cli/src/commands/vector-store/index.ts index f3c3ab4..de37427 100644 --- a/packages/cli/src/commands/vector-store/index.ts +++ b/packages/cli/src/commands/vector-store/index.ts @@ -11,24 +11,24 @@ import { createUpdateCommand } from "./update"; import { createUploadCommand } from "./upload"; export function createVectorStoreCommand(): Command { - const vsCommand = new Command("vs").description("Manage vector stores"); + const storeCommand = new Command("store").description("Manage stores"); // Add subcommands - vsCommand.addCommand(createListCommand()); - vsCommand.addCommand(createCreateCommand()); - vsCommand.addCommand(createGetCommand()); - vsCommand.addCommand(createUpdateCommand()); - vsCommand.addCommand(createDeleteCommand()); - vsCommand.addCommand(createUploadCommand()); - vsCommand.addCommand(createFilesCommand()); - vsCommand.addCommand(createSearchCommand()); - vsCommand.addCommand(createQACommand()); - vsCommand.addCommand(createSyncCommand()); + storeCommand.addCommand(createListCommand()); + storeCommand.addCommand(createCreateCommand()); + storeCommand.addCommand(createGetCommand()); + storeCommand.addCommand(createUpdateCommand()); + storeCommand.addCommand(createDeleteCommand()); + storeCommand.addCommand(createUploadCommand()); + storeCommand.addCommand(createFilesCommand()); + storeCommand.addCommand(createSearchCommand()); + storeCommand.addCommand(createQACommand()); + storeCommand.addCommand(createSyncCommand()); // Show help without error exit code when no subcommand provided - vsCommand.action(() => { - vsCommand.help(); + storeCommand.action(() => { + storeCommand.help(); }); - return vsCommand; + return storeCommand; } diff --git a/packages/cli/src/commands/vector-store/list.ts b/packages/cli/src/commands/vector-store/list.ts index d1250f8..66d27ed 100644 --- a/packages/cli/src/commands/vector-store/list.ts +++ b/packages/cli/src/commands/vector-store/list.ts @@ -38,7 +38,7 @@ interface ListOptions extends GlobalOptions { export function createListCommand(): Command { const command = addGlobalOptions( new Command("list") - .description("List vector stores") + .description("List stores") .option("--filter ", "Filter by name pattern") .option("--limit ", "Maximum number of results", "10") ); @@ -54,7 +54,7 @@ export function createListCommand(): Command { ); const client = createClient(parsedOptions); - spinner = ora("Loading vector stores...").start(); + spinner = ora("Loading stores...").start(); const response = await client.vectorStores.list({ limit: parsedOptions.limit || 10, }); @@ -64,31 +64,31 @@ export function createListCommand(): Command { // Apply filter if provided if (parsedOptions.filter) { const filterPattern = parsedOptions.filter.toLowerCase(); - vectorStores = vectorStores.filter((vs) => - vs.name.toLowerCase().includes(filterPattern) + vectorStores = vectorStores.filter((store) => + store.name.toLowerCase().includes(filterPattern) ); } if (vectorStores.length === 0) { - spinner.info("No vector stores found."); + spinner.info("No stores found."); return; } // Format data for output - const formattedData = vectorStores.map((vs) => ({ - name: vs.name, - id: vs.id, + const formattedData = vectorStores.map((store) => ({ + name: store.name, + id: store.id, status: - vs.expires_at && new Date(vs.expires_at) < new Date() + store.expires_at && new Date(store.expires_at) < new Date() ? "expired" : "active", - files: vs.file_counts?.total, - usage: formatBytes(vs.usage_bytes), - created: new Date(vs.created_at).toLocaleDateString(), + files: store.file_counts?.total, + usage: formatBytes(store.usage_bytes), + created: new Date(store.created_at).toLocaleDateString(), })); spinner.succeed( - `Found ${formatCountWithSuffix(vectorStores.length, "vector store")}` + `Found ${formatCountWithSuffix(vectorStores.length, "store")}` ); formatOutput(formattedData, parsedOptions.format); @@ -98,11 +98,11 @@ export function createListCommand(): Command { refreshCacheForKey(keyName, client); } } catch (error) { - spinner?.fail("Failed to load vector stores"); + spinner?.fail("Failed to load stores"); if (error instanceof Error) { console.error(chalk.red("\nāœ—"), error.message); } else { - console.error(chalk.red("\nāœ—"), "Failed to list vector stores"); + console.error(chalk.red("\nāœ—"), "Failed to list stores"); } process.exit(1); } diff --git a/packages/cli/src/commands/vector-store/qa.ts b/packages/cli/src/commands/vector-store/qa.ts index b1139d1..6e966d1 100644 --- a/packages/cli/src/commands/vector-store/qa.ts +++ b/packages/cli/src/commands/vector-store/qa.ts @@ -44,8 +44,8 @@ interface QAOptions extends GlobalOptions { export function createQACommand(): Command { const command = addGlobalOptions( new Command("qa") - .description("Ask questions about vector store content") - .argument("", "Name or ID of the vector store") + .description("Ask questions about store content") + .argument("", "Name or ID of the store") .argument("", "Question to ask") .option("--top-k ", "Number of sources to consider") .option("--threshold ", "Minimum score threshold for sources") diff --git a/packages/cli/src/commands/vector-store/search.ts b/packages/cli/src/commands/vector-store/search.ts index 8179f09..80002fc 100644 --- a/packages/cli/src/commands/vector-store/search.ts +++ b/packages/cli/src/commands/vector-store/search.ts @@ -81,8 +81,8 @@ interface SearchOptions extends GlobalOptions { export function createSearchCommand(): Command { const command = addGlobalOptions( new Command("search") - .description("Search within a vector store") - .argument("", "Name or ID of the vector store") + .description("Search within a store") + .argument("", "Name or ID of the store") .argument("", "Search query") .option("--top-k ", "Number of results to return") .option("--threshold ", "Minimum score threshold") @@ -104,7 +104,7 @@ export function createSearchCommand(): Command { }); const client = createClient(parsedOptions); - spinner = ora("Searching vector store...").start(); + spinner = ora("Searching store...").start(); const vectorStore = await resolveVectorStore( client, parsedOptions.nameOrId @@ -168,7 +168,7 @@ export function createSearchCommand(): Command { if (error instanceof Error) { console.error(chalk.red("\nāœ—"), error.message); } else { - console.error(chalk.red("\nāœ—"), "Failed to search vector store"); + console.error(chalk.red("\nāœ—"), "Failed to search store"); } process.exit(1); } diff --git a/packages/cli/src/commands/vector-store/sync.ts b/packages/cli/src/commands/vector-store/sync.ts index e7ef3a5..399503d 100644 --- a/packages/cli/src/commands/vector-store/sync.ts +++ b/packages/cli/src/commands/vector-store/sync.ts @@ -60,10 +60,8 @@ interface SyncOptions extends GlobalOptions { export function createSyncCommand(): Command { const command = addGlobalOptions( new Command("sync") - .description( - "Sync files with vector store (intelligent change detection)" - ) - .argument("", "Name or ID of the vector store") + .description("Sync files with store (intelligent change detection)") + .argument("", "Name or ID of the store") .argument( "", "File patterns, folders, or paths to sync (supports ./** and folder names)" @@ -96,17 +94,17 @@ export function createSyncCommand(): Command { const client = createClient(parsedOptions); - console.log(chalk.bold.blue("šŸ”„ Starting Vector Store Sync\n")); + console.log(chalk.bold.blue("šŸ”„ Starting Store Sync\n")); - // Step 0: Resolve vector store + // Step 0: Resolve store const resolveSpinner = ora( - `Looking up vector store "${parsedOptions.nameOrId}"...` + `Looking up store "${parsedOptions.nameOrId}"...` ).start(); const vectorStore = await resolveVectorStore( client, parsedOptions.nameOrId ); - resolveSpinner.succeed(`Found vector store: ${vectorStore.name}`); + resolveSpinner.succeed(`Found store: ${vectorStore.name}`); // Parse metadata if provided const additionalMetadata = validateMetadata(parsedOptions.metadata); @@ -114,14 +112,12 @@ export function createSyncCommand(): Command { // Get git info const gitInfo = await getGitInfo(); - const spinner = ora( - "Loading existing files from vector store..." - ).start(); + const spinner = ora("Loading existing files from store...").start(); const syncedFiles = await getSyncedFiles(client, vectorStore.id); spinner.succeed( - `Found ${formatCountWithSuffix(syncedFiles.size, "existing file")} in vector store` + `Found ${formatCountWithSuffix(syncedFiles.size, "existing file")} in store` ); const fromGit = parsedOptions.fromGit; @@ -172,9 +168,7 @@ export function createSyncCommand(): Command { if (totalChanges === 0) { console.log( - chalk.green( - "āœ“ Vector store is already in sync - no changes needed!" - ) + chalk.green("āœ“ Store is already in sync - no changes needed!") ); return; } @@ -183,7 +177,7 @@ export function createSyncCommand(): Command { if (parsedOptions.force) { console.log(chalk.bold("\n--force enabled")); console.log( - `All ${formatCountWithSuffix(analysis.totalFiles, "file")} will be re-uploaded to the vector store.` + `All ${formatCountWithSuffix(analysis.totalFiles, "file")} will be re-uploaded to the store.` ); console.log(`Upload size: ${formatBytes(analysis.totalSize)}\n`); } else { @@ -208,7 +202,7 @@ export function createSyncCommand(): Command { { type: "confirm", name: "proceed", - message: "Apply these changes to the vector store?", + message: "Apply these changes to the store?", default: false, }, ]); @@ -244,7 +238,7 @@ export function createSyncCommand(): Command { if (error instanceof Error) { console.error(chalk.red("\nāœ—"), error.message); } else { - console.error(chalk.red("\nāœ—"), "Failed to sync vector store"); + console.error(chalk.red("\nāœ—"), "Failed to sync store"); } process.exit(1); } diff --git a/packages/cli/src/commands/vector-store/update.ts b/packages/cli/src/commands/vector-store/update.ts index 58b6e03..4aabde7 100644 --- a/packages/cli/src/commands/vector-store/update.ts +++ b/packages/cli/src/commands/vector-store/update.ts @@ -41,10 +41,10 @@ interface UpdateOptions extends GlobalOptions { export function createUpdateCommand(): Command { const command = addGlobalOptions( new Command("update") - .description("Update a vector store") - .argument("", "Name or ID of the vector store") - .option("--name ", "New name for the vector store") - .option("--description ", "New description for the vector store") + .description("Update a store") + .argument("", "Name or ID of the store") + .option("--name ", "New name for the store") + .option("--description ", "New description for the store") .option("--expires-after ", "Expire after number of days") .option( "--metadata ", @@ -91,16 +91,14 @@ export function createUpdateCommand(): Command { process.exit(1); } - spinner = ora("Updating vector store...").start(); + spinner = ora("Updating store...").start(); const updatedVectorStore = await client.vectorStores.update( vectorStore.id, updateData ); - spinner.succeed( - `Vector store "${vectorStore.name}" updated successfully` - ); + spinner.succeed(`Store "${vectorStore.name}" updated successfully`); formatOutput( { @@ -135,11 +133,11 @@ export function createUpdateCommand(): Command { } } } catch (error) { - spinner?.fail("Failed to update vector store"); + spinner?.fail("Failed to update store"); if (error instanceof Error) { console.error(chalk.red("\nāœ—"), error.message); } else { - console.error(chalk.red("\nāœ—"), "Failed to update vector store"); + console.error(chalk.red("\nāœ—"), "Failed to update store"); } process.exit(1); } diff --git a/packages/cli/src/commands/vector-store/upload.ts b/packages/cli/src/commands/vector-store/upload.ts index 8466d8b..a2aa4ad 100644 --- a/packages/cli/src/commands/vector-store/upload.ts +++ b/packages/cli/src/commands/vector-store/upload.ts @@ -59,8 +59,8 @@ export interface UploadOptions extends GlobalOptions { export function createUploadCommand(): Command { const command = addGlobalOptions( new Command("upload") - .description("Upload files to a vector store") - .argument("", "Name or ID of the vector store") + .description("Upload files to a store") + .argument("", "Name or ID of the store") .argument( "[patterns...]", 'File patterns to upload (e.g., "*.md", "docs/**/*.pdf")' diff --git a/packages/cli/src/utils/completion-cache.ts b/packages/cli/src/utils/completion-cache.ts index aac7757..f2d7427 100644 --- a/packages/cli/src/utils/completion-cache.ts +++ b/packages/cli/src/utils/completion-cache.ts @@ -98,7 +98,7 @@ export async function refreshCacheForKey( limit: MAX_STORES, }); - const storeNames = response.data.map((vs) => vs.name); + const storeNames = response.data.map((store) => store.name); const cache = loadCache(); cache.stores[keyName] = storeNames; diff --git a/packages/cli/src/utils/sync-state.ts b/packages/cli/src/utils/sync-state.ts index 60d478e..78bc1b2 100644 --- a/packages/cli/src/utils/sync-state.ts +++ b/packages/cli/src/utils/sync-state.ts @@ -11,7 +11,7 @@ export interface FileSyncMetadata { } /** - * Get all synced files from vector store + * Get all synced files from store */ export async function getSyncedFiles( client: Mixedbread, diff --git a/packages/cli/src/utils/sync.ts b/packages/cli/src/utils/sync.ts index 9dda4ad..647ae77 100644 --- a/packages/cli/src/utils/sync.ts +++ b/packages/cli/src/utils/sync.ts @@ -159,7 +159,7 @@ export async function analyzeChanges( if (gitStatus === "deleted") { const syncedFile = syncedFiles.get(filePath); if (syncedFile) { - // File was deleted in git and exists in vector store - mark for deletion + // File was deleted in git and exists in store - mark for deletion analysis.deleted.push({ path: filePath, type: "deleted", @@ -478,7 +478,7 @@ export function displaySyncResultsSummary( if (hasFailures) { console.log(chalk.yellow("\n⚠ Sync completed with errors")); } else { - console.log(chalk.green("\nāœ“ Vector store is now in sync")); + console.log(chalk.green("\nāœ“ Store is now in sync")); } if (fromGit && gitInfo.isRepo) { diff --git a/packages/cli/src/utils/upload.ts b/packages/cli/src/utils/upload.ts index 2cbad0a..e5c3d7a 100644 --- a/packages/cli/src/utils/upload.ts +++ b/packages/cli/src/utils/upload.ts @@ -60,7 +60,7 @@ function fixMimeTypes(file: File): File { } /** - * Upload a single file to a vector store + * Upload a single file to a store */ export async function uploadFile( client: Mixedbread, @@ -89,7 +89,7 @@ export async function uploadFile( } /** - * Upload multiple files to a vector store with batch processing + * Upload multiple files to a store with batch processing */ export async function uploadFilesInBatch( client: Mixedbread, @@ -109,7 +109,7 @@ export async function uploadFilesInBatch( ); console.log( - `\nUploading ${formatCountWithSuffix(files.length, "file")} to vector store...` + `\nUploading ${formatCountWithSuffix(files.length, "file")} to store...` ); const results: UploadResults = { diff --git a/packages/cli/src/utils/vector-store.ts b/packages/cli/src/utils/vector-store.ts index 40831ea..9cbb69a 100644 --- a/packages/cli/src/utils/vector-store.ts +++ b/packages/cli/src/utils/vector-store.ts @@ -24,13 +24,13 @@ export async function resolveVectorStore( const vectorStores = await client.vectorStores.list({ limit: 100 }); - const fuzzyMatches = vectorStores.data.filter((vs) => - vs.name.toLowerCase().includes(resolved.toLowerCase()) + const fuzzyMatches = vectorStores.data.filter((store) => + store.name.toLowerCase().includes(resolved.toLowerCase()) ); if (fuzzyMatches.length === 0) { - console.error(chalk.red("āœ—"), `Vector store "${nameOrId}" not found.\n`); - console.error("Run 'mxbai vs list' to see all vector stores."); + console.error(chalk.red("āœ—"), `Store "${nameOrId}" not found.\n`); + console.error("Run 'mxbai store list' to see all stores."); process.exit(1); } @@ -44,21 +44,21 @@ export async function resolveVectorStore( { type: "list", name: "selected", - message: "Multiple vector stores found. Select one:", - choices: fuzzyMatches.map((vs) => ({ - name: `${vs.name} (${vs.id})`, - value: vs, + message: "Multiple stores found. Select one:", + choices: fuzzyMatches.map((store) => ({ + name: `${store.name} (${store.id})`, + value: store, })), }, ]); return selected; } else { - console.error(chalk.red("āœ—"), `Vector store "${nameOrId}" not found.\n`); + console.error(chalk.red("āœ—"), `Store "${nameOrId}" not found.\n`); console.log("Did you mean one of these?"); - fuzzyMatches.forEach((vs) => { - console.log(` • ${vs.name}`); + fuzzyMatches.forEach((store) => { + console.log(` • ${store.name}`); }); - console.log("\nRun 'mxbai vs list' to see all vector stores."); + console.log("\nRun 'mxbai store list' to see all stores."); process.exit(1); } } diff --git a/packages/cli/tests/commands/completion.test.ts b/packages/cli/tests/commands/completion.test.ts index af93be4..b665e88 100644 --- a/packages/cli/tests/commands/completion.test.ts +++ b/packages/cli/tests/commands/completion.test.ts @@ -498,13 +498,13 @@ describe("Completion Commands", () => { await parseCommand(command, []); expect(mockLog).toHaveBeenCalledWith( - ["config", "vs", "completion", "--help", "--version"], + ["config", "store", "completion", "--help", "--version"], "bash", console.log ); }); - describe("vector store completions", () => { + describe("store completions", () => { const vectorStoreCommands = [ "create", "delete", @@ -518,16 +518,16 @@ describe("Completion Commands", () => { "files", ]; - it("should provide vector store completions for 'vs' command", async () => { + it("should provide store completions for 'store' command", async () => { mockParseEnv.mockReturnValue({ complete: true, words: 2, point: 0, - line: "mxbai vs ", + line: "mxbai store ", partial: "", - last: "vs", + last: "store", lastPartial: "", - prev: "vs", + prev: "store", }); mockGetShellFromEnv.mockReturnValue("zsh"); @@ -542,7 +542,7 @@ describe("Completion Commands", () => { }); }); - describe("vector store name completions", () => { + describe("store name completions", () => { beforeEach(() => { const completionCache = jest.mocked( require("../../src/utils/completion-cache") @@ -555,13 +555,13 @@ describe("Completion Commands", () => { ]); }); - it("should provide store name completions for vs commands that need a store name", async () => { + it("should provide store name completions for store commands that need a store name", async () => { // Test a representative command - the logic is the same for all mockParseEnv.mockReturnValue({ complete: true, words: 3, point: 0, - line: "mxbai vs get ", + line: "mxbai store get ", partial: "", last: "get", lastPartial: "", @@ -589,7 +589,7 @@ describe("Completion Commands", () => { complete: true, words: 3, point: 0, - line: "mxbai vs get ", + line: "mxbai store get ", partial: "", last: "get", lastPartial: "", @@ -614,7 +614,7 @@ describe("Completion Commands", () => { complete: true, words: 3, point: 0, - line: "mxbai vs sync ", + line: "mxbai store sync ", partial: "", last: "sync", lastPartial: "", @@ -628,7 +628,7 @@ describe("Completion Commands", () => { expect(mockLog).not.toHaveBeenCalled(); }); - it("should not provide store names for non-vs commands", async () => { + it("should not provide store names for non-store commands", async () => { mockParseEnv.mockReturnValue({ complete: true, words: 3, @@ -653,7 +653,7 @@ describe("Completion Commands", () => { complete: true, words: 3, point: 0, - line: "mxbai vs list ", + line: "mxbai store list ", partial: "", last: "list", lastPartial: "", @@ -671,12 +671,12 @@ describe("Completion Commands", () => { describe("files subcommand completions", () => { const filesCommands = ["list", "get", "delete"]; - it("should provide files completions for 'mxbai vs files' context", async () => { + it("should provide files completions for 'mxbai store files' context", async () => { mockParseEnv.mockReturnValue({ complete: true, words: 3, point: 0, - line: "mxbai vs files ", + line: "mxbai store files ", partial: "", last: "files", lastPartial: "", @@ -694,7 +694,7 @@ describe("Completion Commands", () => { ); }); - it("should provide store name completions for 'mxbai vs files list' context", async () => { + it("should provide store name completions for 'mxbai store files list' context", async () => { const completionCache = jest.mocked( require("../../src/utils/completion-cache") ); @@ -708,7 +708,7 @@ describe("Completion Commands", () => { complete: true, words: 4, point: 0, - line: "mxbai vs files list ", + line: "mxbai store files list ", partial: "", last: "list", lastPartial: "", @@ -726,7 +726,7 @@ describe("Completion Commands", () => { ); }); - it("should not provide files completions for non-vs contexts", async () => { + it("should not provide files completions for non-store contexts", async () => { mockParseEnv.mockReturnValue({ complete: true, words: 2, @@ -802,7 +802,7 @@ describe("Completion Commands", () => { complete: true, words: 2, point: 0, - line: "mxbai vs keys ", + line: "mxbai store keys ", partial: "", last: "keys", lastPartial: "", @@ -948,7 +948,7 @@ describe("Completion Commands", () => { await parseCommand(command, []); expect(mockLog).toHaveBeenCalledWith( - ["config", "vs", "completion", "--help", "--version"], + ["config", "store", "completion", "--help", "--version"], shell as "bash" | "zsh" | "fish" | "pwsh", console.log ); diff --git a/packages/cli/tests/commands/config/get.test.ts b/packages/cli/tests/commands/config/get.test.ts index 47f4738..34201f2 100644 --- a/packages/cli/tests/commands/config/get.test.ts +++ b/packages/cli/tests/commands/config/get.test.ts @@ -42,7 +42,7 @@ describe("Config Get Command", () => { api_key: "work", }, aliases: { - docs: "vs_abc123", + docs: "store_abc123", }, }; @@ -103,8 +103,8 @@ describe("Config Get Command", () => { api_key: "work", }, aliases: { - docs: "vs_abc123", - images: "vs_xyz789", + docs: "store_abc123", + images: "store_xyz789", }, }), }); @@ -163,7 +163,10 @@ describe("Config Get Command", () => { it("should get aliases", () => { command.parse(["node", "get", "aliases.docs"]); - expect(console.log).toHaveBeenCalledWith("aliases.docs:", '"vs_abc123"'); + expect(console.log).toHaveBeenCalledWith( + "aliases.docs:", + '"store_abc123"' + ); }); it("should get all aliases", () => { @@ -173,8 +176,8 @@ describe("Config Get Command", () => { "aliases:", JSON.stringify( { - docs: "vs_abc123", - images: "vs_xyz789", + docs: "store_abc123", + images: "store_xyz789", }, null, 2 diff --git a/packages/cli/tests/commands/config/set.test.ts b/packages/cli/tests/commands/config/set.test.ts index fa34e06..33fe3fd 100644 --- a/packages/cli/tests/commands/config/set.test.ts +++ b/packages/cli/tests/commands/config/set.test.ts @@ -96,10 +96,10 @@ describe("Config Set Command", () => { [configFile]: JSON.stringify({ version: "1.0" }), }); - command.parse(["node", "set", "aliases.docs", "vs_abc123"]); + command.parse(["node", "set", "aliases.docs", "store_abc123"]); const config = loadConfig(); - expect(config.aliases?.docs).toBe("vs_abc123"); + expect(config.aliases?.docs).toBe("store_abc123"); }); }); diff --git a/packages/cli/tests/commands/vector-store/create.test.ts b/packages/cli/tests/commands/vector-store/create.test.ts index ce819be..65fd776 100644 --- a/packages/cli/tests/commands/vector-store/create.test.ts +++ b/packages/cli/tests/commands/vector-store/create.test.ts @@ -24,7 +24,7 @@ const mockFormatOutput = outputUtils.formatOutput as jest.MockedFunction< typeof outputUtils.formatOutput >; -describe("Vector Store Create Command", () => { +describe("Store Create Command", () => { let command: Command; let mockClient: { vectorStores: { @@ -52,7 +52,7 @@ describe("Vector Store Create Command", () => { }); describe("Basic creation", () => { - it("should create vector store with name only", async () => { + it("should create store with name only", async () => { const mockResponse = { id: "550e8400-e29b-41d4-a716-446655440010", name: "test-store", @@ -76,9 +76,7 @@ describe("Vector Store Create Command", () => { expect(console.log).toHaveBeenCalledWith( expect.stringContaining("āœ“"), - expect.stringContaining( - 'Vector store "test-store" created successfully' - ) + expect.stringContaining('Store "test-store" created successfully') ); expect(mockFormatOutput).toHaveBeenCalledWith( @@ -93,7 +91,7 @@ describe("Vector Store Create Command", () => { ); }); - it("should create vector store with description", async () => { + it("should create store with description", async () => { const mockResponse = { id: "550e8400-e29b-41d4-a716-446655440010", name: "test-store", @@ -122,7 +120,7 @@ describe("Vector Store Create Command", () => { }); }); - it("should create vector store with expiration", async () => { + it("should create store with expiration", async () => { const mockResponse = { id: "550e8400-e29b-41d4-a716-446655440010", name: "temp-store", @@ -159,7 +157,7 @@ describe("Vector Store Create Command", () => { }); describe("Metadata handling", () => { - it("should create vector store with metadata", async () => { + it("should create store with metadata", async () => { const mockResponse = { id: "550e8400-e29b-41d4-a716-446655440010", name: "test-store", @@ -333,7 +331,7 @@ describe("Vector Store Create Command", () => { expect(console.error).toHaveBeenCalledWith( expect.any(String), - "Failed to create vector store" + "Failed to create store" ); expect(process.exit).toHaveBeenCalledWith(1); }); diff --git a/packages/cli/tests/commands/vector-store/delete.test.ts b/packages/cli/tests/commands/vector-store/delete.test.ts index 91346e5..2841c0f 100644 --- a/packages/cli/tests/commands/vector-store/delete.test.ts +++ b/packages/cli/tests/commands/vector-store/delete.test.ts @@ -57,7 +57,7 @@ describe("Delete Command", () => { }); describe("Basic deletion", () => { - it("should delete vector store with yes flag", async () => { + it("should delete store with yes flag", async () => { mockClient.vectorStores.delete.mockResolvedValue({ id: "550e8400-e29b-41d4-a716-446655440040", deleted: true, @@ -76,9 +76,7 @@ describe("Delete Command", () => { ); expect(console.log).toHaveBeenCalledWith( expect.any(String), - expect.stringContaining( - 'Vector store "test-store" deleted successfully' - ) + expect.stringContaining('Store "test-store" deleted successfully') ); }); @@ -110,8 +108,8 @@ describe("Delete Command", () => { expect(process.exit).toHaveBeenCalledWith(1); }); - it("should handle vector store resolution errors", async () => { - const error = new Error("Vector store not found"); + it("should handle store resolution errors", async () => { + const error = new Error("Store not found"); mockResolveVectorStore.mockRejectedValue(error); await command.parseAsync([ @@ -123,7 +121,7 @@ describe("Delete Command", () => { expect(console.error).toHaveBeenCalledWith( expect.any(String), - "Vector store not found" + "Store not found" ); expect(process.exit).toHaveBeenCalledWith(1); }); @@ -135,7 +133,7 @@ describe("Delete Command", () => { expect(console.error).toHaveBeenCalledWith( expect.any(String), - "Failed to delete vector store" + "Failed to delete store" ); expect(process.exit).toHaveBeenCalledWith(1); }); diff --git a/packages/cli/tests/commands/vector-store/files.test.ts b/packages/cli/tests/commands/vector-store/files.test.ts index 0348135..7021d41 100644 --- a/packages/cli/tests/commands/vector-store/files.test.ts +++ b/packages/cli/tests/commands/vector-store/files.test.ts @@ -531,15 +531,15 @@ describe("Files Command", () => { }); describe("Error handling", () => { - it("should handle vector store resolution errors", async () => { - const error = new Error("Vector store not found"); + it("should handle store resolution errors", async () => { + const error = new Error("Store not found"); mockResolveVectorStore.mockRejectedValue(error); await command.parseAsync(["node", "files", "list", "nonexistent-store"]); expect(console.error).toHaveBeenCalledWith( expect.any(String), - "Vector store not found" + "Store not found" ); expect(process.exit).toHaveBeenCalledWith(1); }); diff --git a/packages/cli/tests/commands/vector-store/get.test.ts b/packages/cli/tests/commands/vector-store/get.test.ts index 05e97ef..a3deff5 100644 --- a/packages/cli/tests/commands/vector-store/get.test.ts +++ b/packages/cli/tests/commands/vector-store/get.test.ts @@ -33,7 +33,7 @@ const mockFormatOutput = outputUtils.formatOutput as jest.MockedFunction< typeof outputUtils.formatOutput >; -describe("Vector Store Get Command", () => { +describe("Store Get Command", () => { let command: Command; let mockClient: { vectorStores: { @@ -67,11 +67,11 @@ describe("Vector Store Get Command", () => { }); describe("Basic retrieval", () => { - it("should get vector store details", async () => { + it("should get store details", async () => { mockResolveVectorStore.mockResolvedValue({ id: "550e8400-e29b-41d4-a716-446655440050", name: "test-store", - description: "A test vector store", + description: "A test store", created_at: "2024-01-01T00:00:00Z", updated_at: "2024-01-01T00:00:00Z", file_counts: { total: 5 }, @@ -92,7 +92,7 @@ describe("Vector Store Get Command", () => { expect.objectContaining({ id: "550e8400-e29b-41d4-a716-446655440050", name: "test-store", - description: "A test vector store", + description: "A test store", status: "active", "total files": 5, "completed files": 0, @@ -106,14 +106,14 @@ describe("Vector Store Get Command", () => { ); }); - it("should handle expired vector stores", async () => { + it("should handle expired stores", async () => { const expiredDate = new Date(); expiredDate.setDate(expiredDate.getDate() - 1); // Yesterday mockResolveVectorStore.mockResolvedValue({ id: "550e8400-e29b-41d4-a716-446655440050", name: "test-store", - description: "An expired vector store", + description: "An expired store", created_at: "2024-01-01T00:00:00Z", updated_at: "2024-01-01T00:00:00Z", file_counts: { total: 5 }, @@ -159,7 +159,7 @@ describe("Vector Store Get Command", () => { const mockVectorStore = { id: "550e8400-e29b-41d4-a716-446655440050", name: "test-store", - description: "A test vector store", + description: "A test store", created_at: "2024-01-01T00:00:00Z", updated_at: "2024-01-01T00:00:00Z", file_counts: { total: 5 }, @@ -221,15 +221,15 @@ describe("Vector Store Get Command", () => { }); describe("Error handling", () => { - it("should handle vector store resolution errors", async () => { - const error = new Error("Vector store not found"); + it("should handle store resolution errors", async () => { + const error = new Error("Store not found"); mockResolveVectorStore.mockRejectedValue(error); await command.parseAsync(["node", "get", "nonexistent-store"]); expect(console.error).toHaveBeenCalledWith( expect.any(String), - "Vector store not found" + "Store not found" ); expect(process.exit).toHaveBeenCalledWith(1); }); @@ -241,7 +241,7 @@ describe("Vector Store Get Command", () => { expect(console.error).toHaveBeenCalledWith( expect.any(String), - "Failed to get vector store details" + "Failed to get store details" ); expect(process.exit).toHaveBeenCalledWith(1); }); @@ -251,7 +251,7 @@ describe("Vector Store Get Command", () => { const mockVectorStore = { id: "550e8400-e29b-41d4-a716-446655440050", name: "test-store", - description: "A test vector store", + description: "A test store", created_at: "2024-01-01T00:00:00Z", updated_at: "2024-01-01T00:00:00Z", file_counts: { total: 5 }, diff --git a/packages/cli/tests/commands/vector-store/list.test.ts b/packages/cli/tests/commands/vector-store/list.test.ts index 7246c18..a0c3d0b 100644 --- a/packages/cli/tests/commands/vector-store/list.test.ts +++ b/packages/cli/tests/commands/vector-store/list.test.ts @@ -42,7 +42,7 @@ const createMockCursor = ( } as unknown as CursorResponse; }; -describe("Vector Store List Command", () => { +describe("Store List Command", () => { let command: Command; let mockClient: { vectorStores: { @@ -72,7 +72,7 @@ describe("Vector Store List Command", () => { }); describe("Basic listing", () => { - it("should list vector stores with default options", async () => { + it("should list stores with default options", async () => { const mockData = [ { id: "550e8400-e29b-41d4-a716-446655440021", @@ -185,7 +185,7 @@ describe("Vector Store List Command", () => { await command.parseAsync(["node", "list"]); - expect(console.log).toHaveBeenCalledWith("No vector stores found."); + expect(console.log).toHaveBeenCalledWith("No stores found."); expect(mockFormatOutput).not.toHaveBeenCalled(); }); }); @@ -315,7 +315,7 @@ describe("Vector Store List Command", () => { expect(console.error).toHaveBeenCalledWith( expect.any(String), - "Failed to list vector stores" + "Failed to list stores" ); expect(process.exit).toHaveBeenCalledWith(1); }); @@ -469,7 +469,7 @@ describe("Vector Store List Command", () => { }); describe("Edge cases", () => { - it("should handle vector stores with missing fields", async () => { + it("should handle stores with missing fields", async () => { const mockData = [ { id: "550e8400-e29b-41d4-a716-446655440021", diff --git a/packages/cli/tests/commands/vector-store/qa.test.ts b/packages/cli/tests/commands/vector-store/qa.test.ts index 2323a42..435e33c 100644 --- a/packages/cli/tests/commands/vector-store/qa.test.ts +++ b/packages/cli/tests/commands/vector-store/qa.test.ts @@ -512,15 +512,15 @@ describe("QA Command", () => { expect(process.exit).toHaveBeenCalledWith(1); }); - it("should handle vector store resolution errors", async () => { - const error = new Error("Vector store not found"); + it("should handle store resolution errors", async () => { + const error = new Error("Store not found"); mockResolveVectorStore.mockRejectedValue(error); await command.parseAsync(["node", "qa", "nonexistent-store", "question"]); expect(console.error).toHaveBeenCalledWith( expect.any(String), - "Vector store not found" + "Store not found" ); expect(process.exit).toHaveBeenCalledWith(1); }); diff --git a/packages/cli/tests/commands/vector-store/search.test.ts b/packages/cli/tests/commands/vector-store/search.test.ts index 1535156..fc311dd 100644 --- a/packages/cli/tests/commands/vector-store/search.test.ts +++ b/packages/cli/tests/commands/vector-store/search.test.ts @@ -40,7 +40,7 @@ const mockFormatOutput = outputUtils.formatOutput as jest.MockedFunction< typeof outputUtils.formatOutput >; -describe("Vector Store Search Command", () => { +describe("Store Search Command", () => { let command: Command; let mockClient: { vectorStores: { @@ -104,7 +104,7 @@ describe("Vector Store Search Command", () => { ], }; - it("should search chunks in vector store with default options", async () => { + it("should search chunks in store with default options", async () => { const mockChunkResults: VectorStoreSearchResponse = { data: [ { @@ -553,8 +553,8 @@ describe("Vector Store Search Command", () => { expect(process.exit).toHaveBeenCalledWith(1); }); - it("should handle vector store resolution errors", async () => { - const error = new Error("Vector store not found"); + it("should handle store resolution errors", async () => { + const error = new Error("Store not found"); mockResolveVectorStore.mockRejectedValue(error); await command.parseAsync([ @@ -566,7 +566,7 @@ describe("Vector Store Search Command", () => { expect(console.error).toHaveBeenCalledWith( expect.any(String), - "Vector store not found" + "Store not found" ); expect(process.exit).toHaveBeenCalledWith(1); }); @@ -578,7 +578,7 @@ describe("Vector Store Search Command", () => { expect(console.error).toHaveBeenCalledWith( expect.any(String), - "Failed to search vector store" + "Failed to search store" ); expect(process.exit).toHaveBeenCalledWith(1); }); diff --git a/packages/cli/tests/commands/vector-store/sync.test.ts b/packages/cli/tests/commands/vector-store/sync.test.ts index 052d428..91671b7 100644 --- a/packages/cli/tests/commands/vector-store/sync.test.ts +++ b/packages/cli/tests/commands/vector-store/sync.test.ts @@ -40,7 +40,7 @@ const mockResolveVectorStore = typeof vectorStoreUtils.resolveVectorStore >; -describe("Vector Store Sync Command", () => { +describe("Store Sync Command", () => { let command: Command; let mockClient: { vectorStores: { diff --git a/packages/cli/tests/commands/vector-store/update.test.ts b/packages/cli/tests/commands/vector-store/update.test.ts index bb71d9f..3cf1e3d 100644 --- a/packages/cli/tests/commands/vector-store/update.test.ts +++ b/packages/cli/tests/commands/vector-store/update.test.ts @@ -33,7 +33,7 @@ const mockFormatOutput = outputUtils.formatOutput as jest.MockedFunction< typeof outputUtils.formatOutput >; -describe("Vector Store Update Command", () => { +describe("Store Update Command", () => { let command: Command; let mockClient: { vectorStores: { @@ -67,7 +67,7 @@ describe("Vector Store Update Command", () => { }); describe("Basic updates", () => { - it("should update vector store name", async () => { + it("should update store name", async () => { const updatedVectorStore = { id: "550e8400-e29b-41d4-a716-446655440060", name: "updated-store", @@ -102,9 +102,7 @@ describe("Vector Store Update Command", () => { ); expect(console.log).toHaveBeenCalledWith( expect.any(String), - expect.stringContaining( - 'Vector store "test-store" updated successfully' - ) + expect.stringContaining('Store "test-store" updated successfully') ); expect(mockFormatOutput).toHaveBeenCalledWith( updatedVectorStore, @@ -112,7 +110,7 @@ describe("Vector Store Update Command", () => { ); }); - it("should update vector store description", async () => { + it("should update store description", async () => { const updatedVectorStore = { id: "550e8400-e29b-41d4-a716-446655440060", name: "test-store", @@ -141,7 +139,7 @@ describe("Vector Store Update Command", () => { ); }); - it("should update vector store expiration", async () => { + it("should update store expiration", async () => { const updatedVectorStore = { id: "550e8400-e29b-41d4-a716-446655440060", name: "test-store", @@ -173,7 +171,7 @@ describe("Vector Store Update Command", () => { ); }); - it("should update vector store metadata", async () => { + it("should update store metadata", async () => { const metadata = { key: "value", version: "2.0" }; const updatedVectorStore = { id: "550e8400-e29b-41d4-a716-446655440060", @@ -436,8 +434,8 @@ describe("Vector Store Update Command", () => { expect(process.exit).toHaveBeenCalledWith(1); }); - it("should handle vector store resolution errors", async () => { - const error = new Error("Vector store not found"); + it("should handle store resolution errors", async () => { + const error = new Error("Store not found"); mockResolveVectorStore.mockRejectedValue(error); await command.parseAsync([ @@ -450,7 +448,7 @@ describe("Vector Store Update Command", () => { expect(console.error).toHaveBeenCalledWith( expect.any(String), - "Vector store not found" + "Store not found" ); expect(process.exit).toHaveBeenCalledWith(1); }); @@ -468,7 +466,7 @@ describe("Vector Store Update Command", () => { expect(console.error).toHaveBeenCalledWith( expect.any(String), - "Failed to update vector store" + "Failed to update store" ); expect(process.exit).toHaveBeenCalledWith(1); }); diff --git a/packages/cli/tests/commands/vector-store/upload.test.ts b/packages/cli/tests/commands/vector-store/upload.test.ts index 2c817f2..8df67d4 100644 --- a/packages/cli/tests/commands/vector-store/upload.test.ts +++ b/packages/cli/tests/commands/vector-store/upload.test.ts @@ -50,7 +50,7 @@ const mockUploadFilesInBatch = typeof uploadUtils.uploadFilesInBatch >; -describe("Vector Store Upload Command", () => { +describe("Store Upload Command", () => { let command: Command; let mockClient: { vectorStores: { @@ -487,16 +487,14 @@ describe("Vector Store Upload Command", () => { expect(mockUploadFilesInBatch).toHaveBeenCalled(); }); - it("should handle vector store resolution errors", async () => { - mockResolveVectorStore.mockRejectedValue( - new Error("Vector store not found") - ); + it("should handle store resolution errors", async () => { + mockResolveVectorStore.mockRejectedValue(new Error("Store not found")); await command.parseAsync(["node", "upload", "invalid-store", "*.md"]); expect(console.error).toHaveBeenCalledWith( expect.any(String), - "Vector store not found" + "Store not found" ); expect(process.exit).toHaveBeenCalledWith(1); }); diff --git a/packages/cli/tests/helpers/test-utils.ts b/packages/cli/tests/helpers/test-utils.ts index 06cae99..6459e7c 100644 --- a/packages/cli/tests/helpers/test-utils.ts +++ b/packages/cli/tests/helpers/test-utils.ts @@ -225,7 +225,7 @@ export const createMockConsole = () => { }; }; -// Helper to create mock vector store data with required fields +// Helper to create mock store data with required fields export const createMockVectorStore = (overrides: Record = {}) => ({ id: "550e8400-e29b-41d4-a716-446655440000", name: "test-store", diff --git a/packages/cli/tests/utils/completion-cache.test.ts b/packages/cli/tests/utils/completion-cache.test.ts index c59a890..9d6e105 100644 --- a/packages/cli/tests/utils/completion-cache.test.ts +++ b/packages/cli/tests/utils/completion-cache.test.ts @@ -169,7 +169,7 @@ describe("Completion Cache", () => { }); describe("refreshCacheForKey", () => { - it("should fetch and cache vector stores for a key", async () => { + it("should fetch and cache stores for a key", async () => { mockFs({ [configDir]: {}, }); @@ -182,8 +182,8 @@ describe("Completion Cache", () => { >() .mockResolvedValue({ data: [ - { id: "vs1", name: "store1" }, - { id: "vs2", name: "store2" }, + { id: "store1", name: "store1" }, + { id: "store2", name: "store2" }, ], }); const mockClient = { @@ -216,7 +216,7 @@ describe("Completion Cache", () => { }) => Promise<{ data: Array<{ id: string; name: string }> }> >() .mockResolvedValue({ - data: [{ id: "vs1", name: "work-store" }], + data: [{ id: "store1", name: "work-store" }], }); const mockClient = { vectorStores: { @@ -270,7 +270,7 @@ describe("Completion Cache", () => { }) => Promise<{ data: Array<{ id: string; name: string }> }> >() .mockResolvedValue({ - data: [{ id: "vs1", name: "store1" }], + data: [{ id: "store1", name: "store1" }], }); const mockClient = { vectorStores: { @@ -306,10 +306,10 @@ describe("Completion Cache", () => { }) => Promise<{ data: Array<{ id: string; name: string }> }> >() .mockResolvedValueOnce({ - data: [{ id: "vs1", name: "work-store" }], + data: [{ id: "store1", name: "work-store" }], }) .mockResolvedValueOnce({ - data: [{ id: "vs2", name: "personal-store" }], + data: [{ id: "store2", name: "personal-store" }], }); const mockClient = { vectorStores: { @@ -522,7 +522,7 @@ describe("Completion Cache", () => { }) => Promise<{ data: Array<{ id: string; name: string }> }> >() .mockResolvedValue({ - data: [{ id: "vs1", name: "store1" }], + data: [{ id: "store1", name: "store1" }], }); const mockClient = { vectorStores: { diff --git a/packages/cli/tests/utils/config.test.ts b/packages/cli/tests/utils/config.test.ts index 37a67f5..c62031b 100644 --- a/packages/cli/tests/utils/config.test.ts +++ b/packages/cli/tests/utils/config.test.ts @@ -60,7 +60,7 @@ describe("Config Utils", () => { api_key: "work", }, aliases: { - docs: "vs_abc123", + docs: "store_abc123", }, }; @@ -74,7 +74,7 @@ describe("Config Utils", () => { expect(config.api_keys?.personal).toBe("mxb_personal123"); expect(config.defaults?.api_key).toBe("work"); expect(config.defaults?.upload?.strategy).toBe("high_quality"); - expect(config.aliases?.docs).toBe("vs_abc123"); + expect(config.aliases?.docs).toBe("store_abc123"); }); it("should return default config for invalid JSON", () => { @@ -412,26 +412,26 @@ describe("Config Utils", () => { mockFs({ [configFile]: JSON.stringify({ version: "1.0", - aliases: { docs: "vs_abc123" }, + aliases: { docs: "store_abc123" }, }), }); const resolved = resolveVectorStoreName("docs"); - expect(resolved).toBe("vs_abc123"); + expect(resolved).toBe("store_abc123"); }); it("should return original name if no alias exists", () => { mockFs({ [configFile]: JSON.stringify({ version: "1.0", - aliases: { other: "vs_xyz789" }, + aliases: { other: "store_xyz789" }, }), }); - const resolved = resolveVectorStoreName("vs_direct123"); + const resolved = resolveVectorStoreName("store_direct123"); - expect(resolved).toBe("vs_direct123"); + expect(resolved).toBe("store_direct123"); }); it("should handle missing aliases object", () => { @@ -471,7 +471,9 @@ describe("Config Utils", () => { expect(parseConfigValue("base_url", "https://api.example.com")).toBe( "https://api.example.com" ); - expect(parseConfigValue("aliases.docs", "vs_abc123")).toBe("vs_abc123"); + expect(parseConfigValue("aliases.docs", "store_abc123")).toBe( + "store_abc123" + ); }); it("should validate URL format", () => { diff --git a/packages/cli/tests/utils/output.test.ts b/packages/cli/tests/utils/output.test.ts index e9b9af9..6e979d8 100644 --- a/packages/cli/tests/utils/output.test.ts +++ b/packages/cli/tests/utils/output.test.ts @@ -47,7 +47,7 @@ describe("Output Utils", () => { MockTable.mockReturnValue(mockTableInstance as any); const data = { - id: "vs_123", + id: "store_123", name: "test-store", description: "A test store", }; @@ -58,7 +58,9 @@ describe("Output Utils", () => { style: { head: [], border: [] }, }); - expect(mockTableInstance.push).toHaveBeenCalledWith({ id: "vs_123" }); + expect(mockTableInstance.push).toHaveBeenCalledWith({ + id: "store_123", + }); expect(mockTableInstance.push).toHaveBeenCalledWith({ name: "test-store", }); @@ -76,14 +78,16 @@ describe("Output Utils", () => { MockTable.mockReturnValue(mockTableInstance as any); const data = { - id: "vs_123", + id: "store_123", description: null, metadata: undefined, }; formatOutput(data, "table"); - expect(mockTableInstance.push).toHaveBeenCalledWith({ id: "vs_123" }); + expect(mockTableInstance.push).toHaveBeenCalledWith({ + id: "store_123", + }); expect(mockTableInstance.push).toHaveBeenCalledWith({ description: "", }); @@ -98,14 +102,16 @@ describe("Output Utils", () => { MockTable.mockReturnValue(mockTableInstance as any); const data = { - id: "vs_123", + id: "store_123", metadata: { key: "value", nested: { deep: true } }, tags: ["tag1", "tag2"], }; formatOutput(data, "table"); - expect(mockTableInstance.push).toHaveBeenCalledWith({ id: "vs_123" }); + expect(mockTableInstance.push).toHaveBeenCalledWith({ + id: "store_123", + }); expect(mockTableInstance.push).toHaveBeenCalledWith({ metadata: JSON.stringify({ key: "value", nested: { deep: true } }), }); @@ -122,8 +128,8 @@ describe("Output Utils", () => { MockTable.mockReturnValue(mockTableInstance as any); const data = [ - { id: "vs_1", name: "store1", size: 100 }, - { id: "vs_2", name: "store2", size: 200 }, + { id: "store_1", name: "store1", size: 100 }, + { id: "store_2", name: "store2", size: 200 }, ]; formatOutput(data, "table"); @@ -134,12 +140,12 @@ describe("Output Utils", () => { }); expect(mockTableInstance.push).toHaveBeenCalledWith([ - "vs_1", + "store_1", "store1", "100", ]); expect(mockTableInstance.push).toHaveBeenCalledWith([ - "vs_2", + "store_2", "store2", "200", ]); @@ -159,8 +165,8 @@ describe("Output Utils", () => { MockTable.mockReturnValue(mockTableInstance as any); const data = [ - { id: "vs_1", name: "store1" }, - { id: "vs_2", description: "desc2" }, + { id: "store_1", name: "store1" }, + { id: "store_2", description: "desc2" }, { name: "store3", size: 300 }, ]; @@ -172,8 +178,11 @@ describe("Output Utils", () => { }); // The implementation uses headers from the first object - expect(mockTableInstance.push).toHaveBeenCalledWith(["vs_1", "store1"]); - expect(mockTableInstance.push).toHaveBeenCalledWith(["vs_2", ""]); + expect(mockTableInstance.push).toHaveBeenCalledWith([ + "store_1", + "store1", + ]); + expect(mockTableInstance.push).toHaveBeenCalledWith(["store_2", ""]); expect(mockTableInstance.push).toHaveBeenCalledWith(["", "store3"]); }); }); @@ -181,7 +190,7 @@ describe("Output Utils", () => { describe("json format", () => { it("should format as JSON", () => { const data = { - id: "vs_123", + id: "store_123", name: "test-store", metadata: { key: "value" }, }; @@ -193,8 +202,8 @@ describe("Output Utils", () => { it("should handle arrays", () => { const data = [ - { id: "vs_1", name: "store1" }, - { id: "vs_2", name: "store2" }, + { id: "store_1", name: "store1" }, + { id: "store_2", name: "store2" }, ]; formatOutput(data, "json"); @@ -206,7 +215,7 @@ describe("Output Utils", () => { describe("csv format", () => { it("should format object as CSV", () => { const data = { - id: "vs_123", + id: "store_123", name: "test-store", size: 1024, }; @@ -214,14 +223,14 @@ describe("Output Utils", () => { formatOutput(data, "csv"); expect(console.log).toHaveBeenCalledWith("key,value"); - expect(console.log).toHaveBeenCalledWith("id,vs_123"); + expect(console.log).toHaveBeenCalledWith("id,store_123"); expect(console.log).toHaveBeenCalledWith("name,test-store"); expect(console.log).toHaveBeenCalledWith("size,1024"); }); it("should escape CSV values with commas", () => { const data = { - id: "vs_123", + id: "store_123", name: "test, store", description: 'A "quoted" value', }; @@ -229,7 +238,7 @@ describe("Output Utils", () => { formatOutput(data, "csv"); expect(console.log).toHaveBeenCalledWith("key,value"); - expect(console.log).toHaveBeenCalledWith("id,vs_123"); + expect(console.log).toHaveBeenCalledWith("id,store_123"); expect(console.log).toHaveBeenCalledWith('name,"test, store"'); expect(console.log).toHaveBeenCalledWith( 'description,"A ""quoted"" value"' @@ -238,20 +247,20 @@ describe("Output Utils", () => { it("should format array as CSV", () => { const data = [ - { id: "vs_1", name: "store1", size: 100 }, - { id: "vs_2", name: "store2", size: 200 }, + { id: "store_1", name: "store1", size: 100 }, + { id: "store_2", name: "store2", size: 200 }, ]; formatOutput(data, "csv"); expect(console.log).toHaveBeenCalledWith("id,name,size"); - expect(console.log).toHaveBeenCalledWith("vs_1,store1,100"); - expect(console.log).toHaveBeenCalledWith("vs_2,store2,200"); + expect(console.log).toHaveBeenCalledWith("store_1,store1,100"); + expect(console.log).toHaveBeenCalledWith("store_2,store2,200"); }); it("should handle null and undefined in CSV", () => { const data = { - id: "vs_123", + id: "store_123", name: null, description: undefined, }; @@ -259,21 +268,21 @@ describe("Output Utils", () => { formatOutput(data, "csv"); expect(console.log).toHaveBeenCalledWith("key,value"); - expect(console.log).toHaveBeenCalledWith("id,vs_123"); + expect(console.log).toHaveBeenCalledWith("id,store_123"); expect(console.log).toHaveBeenCalledWith("name,"); expect(console.log).toHaveBeenCalledWith("description,"); }); it("should stringify complex values in CSV", () => { const data = { - id: "vs_123", + id: "store_123", metadata: { key: "value" }, }; formatOutput(data, "csv"); expect(console.log).toHaveBeenCalledWith("key,value"); - expect(console.log).toHaveBeenCalledWith("id,vs_123"); + expect(console.log).toHaveBeenCalledWith("id,store_123"); expect(console.log).toHaveBeenCalledWith( 'metadata,"{""key"":""value""}"' ); @@ -288,7 +297,7 @@ describe("Output Utils", () => { }; MockTable.mockReturnValue(mockTableInstance as any); - const data = { id: "vs_123" }; + const data = { id: "store_123" }; formatOutput(data); diff --git a/packages/cli/tests/utils/vector-store.test.ts b/packages/cli/tests/utils/vector-store.test.ts index 9b55c50..1a66b2d 100644 --- a/packages/cli/tests/utils/vector-store.test.ts +++ b/packages/cli/tests/utils/vector-store.test.ts @@ -14,7 +14,7 @@ import { resolveVectorStore } from "../../src/utils/vector-store"; // Mock config utils jest.mock("../../src/utils/config"); -describe("Vector Store Utils", () => { +describe("Store Utils", () => { describe("resolveVectorStore", () => { let mockClient: { vectorStores: { @@ -42,7 +42,7 @@ describe("Vector Store Utils", () => { jest.clearAllMocks(); }); - it("should resolve vector store ID directly", async () => { + it("should resolve store ID directly", async () => { const mockVectorStore = { id: "550e8400-e29b-41d4-a716-446655440010", name: "test-store", @@ -63,7 +63,7 @@ describe("Vector Store Utils", () => { expect(mockClient.vectorStores.list).not.toHaveBeenCalled(); }); - it("should resolve vector store by name", async () => { + it("should resolve store by name", async () => { const mockVectorStore = { id: "550e8400-e29b-41d4-a716-446655440011", name: "my-store", @@ -110,9 +110,9 @@ describe("Vector Store Utils", () => { ); }); - it("should handle vector store not found by ID", async () => { + it("should handle store not found by ID", async () => { mockClient.vectorStores.retrieve.mockRejectedValue( - new Error("Vector store not found") + new Error("Store not found") ); mockClient.vectorStores.list.mockResolvedValue({ data: [] }); @@ -124,13 +124,13 @@ describe("Vector Store Utils", () => { expect(console.error).toHaveBeenCalledWith( expect.any(String), expect.stringContaining( - 'Vector store "550e8400-e29b-41d4-a716-446655440002" not found' + 'Store "550e8400-e29b-41d4-a716-446655440002" not found' ) ); expect(process.exit).toHaveBeenCalledWith(1); }); - it("should handle vector store not found by name", async () => { + it("should handle store not found by name", async () => { // Mock retrieve to fail first mockClient.vectorStores.retrieve.mockRejectedValue( new Error("Not found") @@ -150,11 +150,11 @@ describe("Vector Store Utils", () => { expect(console.error).toHaveBeenCalledWith( expect.any(String), - expect.stringContaining('Vector store "nonexistent-store" not found') + expect.stringContaining('Store "nonexistent-store" not found') ); }); - it("should handle empty vector store list", async () => { + it("should handle empty store list", async () => { // Mock retrieve to fail first mockClient.vectorStores.retrieve.mockRejectedValue( new Error("Not found") @@ -169,7 +169,7 @@ describe("Vector Store Utils", () => { expect(console.error).toHaveBeenCalledWith( expect.any(String), - expect.stringContaining('Vector store "any-store" not found') + expect.stringContaining('Store "any-store" not found') ); }); diff --git a/packages/search/src/search/hooks/use-search.ts b/packages/search/src/search/hooks/use-search.ts index 371af9c..29bd8f3 100644 --- a/packages/search/src/search/hooks/use-search.ts +++ b/packages/search/src/search/hooks/use-search.ts @@ -42,7 +42,7 @@ export interface UseSearchReturn { } /** - * Custom hook for implementing search functionality with mixedbread vector store + * Custom hook for implementing search functionality with mixedbread store * * @param config - Configuration options for the search * @returns Search state and handlers diff --git a/packages/search/src/search/lib/fumadocs.ts b/packages/search/src/search/lib/fumadocs.ts index 001174b..73e67aa 100644 --- a/packages/search/src/search/lib/fumadocs.ts +++ b/packages/search/src/search/lib/fumadocs.ts @@ -4,7 +4,7 @@ import type { SearchMetadata } from "./types"; export interface MixedbreadOptions { /** - * The ID of the vector store to search in + * The ID of the store to search in */ vectorStoreId: string; From 97e08aac119b88bb7b6b3129a6d0439c7448e938 Mon Sep 17 00:00:00 2001 From: Naing Linn Khant Date: Wed, 1 Oct 2025 22:42:01 +0700 Subject: [PATCH 2/2] chore(release): add changeset --- .changeset/cold-things-warn.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/cold-things-warn.md diff --git a/.changeset/cold-things-warn.md b/.changeset/cold-things-warn.md new file mode 100644 index 0000000..ce25142 --- /dev/null +++ b/.changeset/cold-things-warn.md @@ -0,0 +1,5 @@ +--- +"@mixedbread/cli": major +--- + +Update `vs` to `store` in all commands