Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/free-places-visit.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@mixedbread/cli": patch
---

Updated mixedbread SDK version
26 changes: 21 additions & 5 deletions packages/cli/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,23 @@

### Major Changes

- aa54a04: Update `vs` to `store` in all commands
- aa54a04: Renamed command structure from `vs` to `store` for clarity

### Breaking Changes

All `vs` commands have been renamed to `store`:

- `mxbai vs` → `mxbai store`
- `mxbai vs create` → `mxbai store create`
- `mxbai vs list` → `mxbai store list`
- `mxbai vs get` → `mxbai store get`
- `mxbai vs update` → `mxbai store update`
- `mxbai vs delete` → `mxbai store delete`
- `mxbai vs files` → `mxbai store files`
- `mxbai vs sync` → `mxbai store sync`
- `mxbai vs upload` → `mxbai store upload`
- `mxbai vs search` → `mxbai store search`
- `mxbai vs qa` → `mxbai store qa`

## 1.2.1

Expand All @@ -30,7 +46,7 @@
- **Multi-key support**: Completions work seamlessly with multiple API keys, showing stores for the current default key
- **New command**: `mxbai completion refresh` to manually refresh the completion cache

Breaking changes:
### Breaking changes

- Removed undocumented `vector-store` alias (use `vs` instead)

Expand All @@ -46,15 +62,15 @@

- 617f988: Added force upload option and standardize CLI flags (breaking changes)

## Breaking Changes
### Breaking Changes

### Sync Command Changes
#### Sync Command Changes

- **REMOVED**: `--ci` flag - use `--yes/-y` instead for non-interactive mode
- **CHANGED**: `--force/-f` behavior - now forces re-upload of all files (ignoring change detection)
- **NEW**: `--yes/-y` flag - skips confirmation prompts (replaces old `--force` behavior)

### Flag Standardization Across Commands
#### Flag Standardization Across Commands

All confirmation-skipping flags have been standardized from `--force` to `--yes/-y`:

Expand Down
20 changes: 10 additions & 10 deletions packages/cli/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -443,7 +443,7 @@ This CLI is built on top of the `@mixedbread/sdk` and provides a convenient comm
pnpm test

# Run specific test file
pnpm test tests/commands/vector-store/upload.test.ts
pnpm test tests/commands/store/upload.test.ts

# Run tests in watch mode
pnpm test --watch
Expand All @@ -467,7 +467,7 @@ src/
│ │ ├── get.ts # Get config values
│ │ ├── set.ts # Set config values
│ │ └── index.ts
│ └── vector-store/ # Store commands
│ └── store/ # Store commands
│ ├── files/ # File management subcommands
│ │ ├── delete.ts
│ │ ├── get.ts
Expand Down Expand Up @@ -496,7 +496,7 @@ src/
│ ├── sync-state.ts # Sync state management
│ ├── sync.ts # Sync logic
│ ├── upload.ts # Upload utilities
│ └── vector-store.ts # Store helpers
│ └── store.ts # Store helpers
└── index.ts # Package exports

tests/
Expand All @@ -507,10 +507,10 @@ tests/

#### Adding New Commands

1. **Create command file** in `src/commands/vector-store/`:
1. **Create command file** in `src/commands/store/`:

```typescript
// src/commands/vector-store/my-command.ts
// src/commands/store/my-command.ts
import { Command } from 'commander';
import { addGlobalOptions } from '../../utils/global-options';

Expand All @@ -526,19 +526,19 @@ tests/
}
```

2. **Register command** in `src/commands/vector-store/index.ts`:
2. **Register command** in `src/commands/store/index.ts`:

```typescript
import { createMyCommand } from './my-command';

// Add to vectorStoreCommand
vectorStoreCommand.addCommand(createMyCommand());
// Add to storeCommand
storeCommand.addCommand(createMyCommand());
```

3. **Add tests** in `tests/commands/vector-store/my-command.test.ts`:
3. **Add tests** in `tests/commands/store/my-command.test.ts`:

```typescript
import { createMyCommand } from '../../../src/commands/vector-store/my-command';
import { createMyCommand } from '../../../src/commands/store/my-command';

describe('My Command', () => {
it('should work correctly', async () => {
Expand Down
4 changes: 2 additions & 2 deletions packages/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"keywords": [
"mixedbread",
"cli",
"vector-store",
"store",
"embeddings",
"command-line"
],
Expand Down Expand Up @@ -49,7 +49,7 @@
"setup-cli": "node ./scripts/setup-cli.js"
},
"dependencies": {
"@mixedbread/sdk": "^0.26.0",
"@mixedbread/sdk": "^0.31.1",
"@pnpm/tabtab": "^0.5.4",
"chalk": "^5.3.0",
"cli-table3": "^0.6.5",
Expand Down
4 changes: 2 additions & 2 deletions packages/cli/src/bin/mxbai.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ import {
createCompletionServerCommand,
} from "../commands/completion";
import { createConfigCommand } from "../commands/config";
import { createVectorStoreCommand } from "../commands/vector-store";
import { createStoreCommand } from "../commands/store";
import { setupGlobalOptions } from "../utils/global-options";

const program = new Command();
Expand All @@ -46,7 +46,7 @@ program
setupGlobalOptions(program);

// Add commands
program.addCommand(createVectorStoreCommand());
program.addCommand(createStoreCommand());
program.addCommand(createConfigCommand());
program.addCommand(createCompletionCommand());
program.addCommand(createCompletionServerCommand());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import {
import { validateMetadata } from "../../utils/metadata";
import { formatOutput } from "../../utils/output";

const CreateVectorStoreSchema = extendGlobalOptions({
const CreateStoreSchema = extendGlobalOptions({
name: z.string().min(1, { error: '"name" is required' }),
description: z.string().optional(),
expiresAfter: z.coerce
Expand Down Expand Up @@ -51,7 +51,7 @@ export function createCreateCommand(): Command {
const mergedOptions = mergeCommandOptions(command, options);
const client = createClient(mergedOptions);

const parsedOptions = parseOptions(CreateVectorStoreSchema, {
const parsedOptions = parseOptions(CreateStoreSchema, {
...mergedOptions,
name,
});
Expand All @@ -60,7 +60,7 @@ export function createCreateCommand(): Command {

spinner = ora("Creating store...").start();

const vectorStore = await client.vectorStores.create({
const store = await client.stores.create({
name: parsedOptions.name,
description: parsedOptions.description,
expires_after: parsedOptions.expiresAfter
Expand All @@ -76,22 +76,22 @@ export function createCreateCommand(): Command {

formatOutput(
{
id: vectorStore.id,
name: vectorStore.name,
description: vectorStore.description,
expires_after: vectorStore.expires_after,
id: store.id,
name: store.name,
description: store.description,
expires_after: store.expires_after,
metadata:
parsedOptions.format === "table"
? JSON.stringify(vectorStore.metadata, null, 2)
: vectorStore.metadata,
? JSON.stringify(store.metadata, null, 2)
: store.metadata,
},
parsedOptions.format
);

// Update completion cache with the new store
const keyName = getCurrentKeyName();
if (keyName) {
updateCacheAfterCreate(keyName, vectorStore.name);
updateCacheAfterCreate(keyName, store.name);
}
} catch (error) {
spinner?.fail("Failed to create store");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ import {
mergeCommandOptions,
parseOptions,
} from "../../utils/global-options";
import { resolveVectorStore } from "../../utils/vector-store";
import { resolveStore } from "../../utils/store";

const DeleteVectorStoreSchema = extendGlobalOptions({
const DeleteStoreSchema = extendGlobalOptions({
nameOrId: z.string().min(1, { error: '"name-or-id" is required' }),
yes: z.boolean().optional(),
});
Expand All @@ -41,24 +41,21 @@ export function createDeleteCommand(): Command {
try {
const mergedOptions = mergeCommandOptions(command, options);

const parsedOptions = parseOptions(DeleteVectorStoreSchema, {
const parsedOptions = parseOptions(DeleteStoreSchema, {
...mergedOptions,
nameOrId,
});

const client = createClient(parsedOptions);
const vectorStore = await resolveVectorStore(
client,
parsedOptions.nameOrId
);
const store = await resolveStore(client, parsedOptions.nameOrId);

// Confirmation prompt unless --yes is used
if (!parsedOptions.yes) {
const { confirmed } = await inquirer.prompt([
{
type: "confirm",
name: "confirmed",
message: `Are you sure you want to delete store "${vectorStore.name}" (${vectorStore.id})? This action cannot be undone.`,
message: `Are you sure you want to delete store "${store.name}" (${store.id})? This action cannot be undone.`,
default: false,
},
]);
Expand All @@ -71,14 +68,14 @@ export function createDeleteCommand(): Command {

spinner = ora("Deleting store...").start();

await client.vectorStores.delete(vectorStore.id);
await client.stores.delete(store.id);

spinner.succeed(`Store "${vectorStore.name}" deleted successfully`);
spinner.succeed(`Store "${store.name}" deleted successfully`);

// Update completion cache by removing the deleted store
const keyName = getCurrentKeyName();
if (keyName) {
updateCacheAfterDelete(keyName, vectorStore.name);
updateCacheAfterDelete(keyName, store.name);
}
} catch (error) {
spinner?.fail("Failed to delete store");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {
mergeCommandOptions,
parseOptions,
} from "../../../utils/global-options";
import { resolveVectorStore } from "../../../utils/vector-store";
import { resolveStore } from "../../../utils/store";

const DeleteFileSchema = extendGlobalOptions({
nameOrId: z.string().min(1, { error: '"name-or-id" is required' }),
Expand Down Expand Up @@ -42,18 +42,15 @@ export function createDeleteCommand(): Command {
});

const client = createClient(parsedOptions);
const vectorStore = await resolveVectorStore(
client,
parsedOptions.nameOrId
);
const store = await resolveStore(client, parsedOptions.nameOrId);

// Confirmation prompt unless --yes is used
if (!parsedOptions.yes) {
const { confirmed } = await inquirer.prompt([
{
type: "confirm",
name: "confirmed",
message: `Are you sure you want to delete file "${parsedOptions.fileId}" from store "${vectorStore.name}" (${vectorStore.id})? This action cannot be undone.`,
message: `Are you sure you want to delete file "${parsedOptions.fileId}" from store "${store.name}" (${store.id})? This action cannot be undone.`,
default: false,
},
]);
Expand All @@ -66,8 +63,8 @@ export function createDeleteCommand(): Command {

spinner = ora("Deleting file...").start();

await client.vectorStores.files.delete(parsedOptions.fileId, {
vector_store_identifier: vectorStore.id,
await client.stores.files.delete(parsedOptions.fileId, {
store_identifier: store.id,
});

spinner.succeed(`File ${parsedOptions.fileId} deleted successfully`);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {
parseOptions,
} from "../../../utils/global-options";
import { formatBytes, formatOutput } from "../../../utils/output";
import { resolveVectorStore } from "../../../utils/vector-store";
import { resolveStore } from "../../../utils/store";

const GetFileSchema = extendGlobalOptions({
nameOrId: z.string().min(1, { error: '"name-or-id" is required' }),
Expand Down Expand Up @@ -41,17 +41,11 @@ export function createGetCommand(): Command {

const client = createClient(parsedOptions);
spinner = ora("Loading file details...").start();
const vectorStore = await resolveVectorStore(
client,
parsedOptions.nameOrId
);
const store = await resolveStore(client, parsedOptions.nameOrId);

const file = await client.vectorStores.files.retrieve(
parsedOptions.fileId,
{
vector_store_identifier: vectorStore.id,
}
);
const file = await client.stores.files.retrieve(parsedOptions.fileId, {
store_identifier: store.id,
});

spinner.succeed("File details loaded");

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { VectorStoreFile } from "@mixedbread/sdk/resources/vector-stores";
import type { StoreFile } from "@mixedbread/sdk/resources/stores";
import chalk from "chalk";
import { Command } from "commander";
import ora, { type Ora } from "ora";
Expand All @@ -15,7 +15,7 @@ import {
formatCountWithSuffix,
formatOutput,
} from "../../../utils/output";
import { resolveVectorStore } from "../../../utils/vector-store";
import { resolveStore } from "../../../utils/store";
import type { FilesOptions } from ".";

const ListFilesSchema = extendGlobalOptions({
Expand Down Expand Up @@ -59,12 +59,9 @@ export function createListCommand(): Command {

const client = createClient(parsedOptions);
spinner = ora("Loading files...").start();
const vectorStore = await resolveVectorStore(
client,
parsedOptions.nameOrId
);
const store = await resolveStore(client, parsedOptions.nameOrId);

const response = await client.vectorStores.files.list(vectorStore.id, {
const response = await client.stores.files.list(store.id, {
limit: parsedOptions.limit || 10,
});

Expand All @@ -73,7 +70,7 @@ export function createListCommand(): Command {
// Apply status filter
if (parsedOptions.status && parsedOptions.status !== "all") {
files = files.filter(
(file: VectorStoreFile) => file.status === parsedOptions.status
(file: StoreFile) => file.status === parsedOptions.status
);
}

Expand Down
Loading