From 4e5512dc61bbc23328acd3f3aa378cb7ffe627d2 Mon Sep 17 00:00:00 2001 From: 0XFANGO Date: Wed, 10 Jun 2026 01:32:37 +0800 Subject: [PATCH 1/2] feat(image): add `image delete ` batch delete command (#198) - New `listenhub image delete ` -> client.deleteAIImages({ ids }) (mirrors `creation delete`); covers the SDK 0.0.12 image batch-delete feature. - Bump @marswave/listenhub-sdk ^0.0.11 -> ^0.0.12 (deleteAIImages requires it). - Bump CLI 0.0.10 -> 0.0.11. README (en + zh) command tables updated. GATED on @marswave/listenhub-sdk@0.0.12 being published to npm. After publish, run `pnpm install` to refresh pnpm-lock.yaml, then release CLI 0.0.11. Part of marswaveai/listenhub-ralph#198 --- README.md | 11 ++++++----- README.zh-CN.md | 11 ++++++----- package.json | 4 ++-- source/image/_cli.ts | 14 ++++++++++++++ source/image/image.ts | 14 ++++++++++++++ 5 files changed, 42 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index 8c138a5..f561e50 100644 --- a/README.md +++ b/README.md @@ -111,11 +111,12 @@ listenhub openapi subscription -j ### Images -| Command | Description | -| -------------------------- | -------------------- | -| `listenhub image create` | Generate an AI image | -| `listenhub image list` | List AI images | -| `listenhub image get ` | Get image details | +| Command | Description | +| -------------------------------- | ---------------------------- | +| `listenhub image create` | Generate an AI image | +| `listenhub image list` | List AI images | +| `listenhub image get ` | Get image details | +| `listenhub image delete ` | Delete one or more AI images | ### Video Generation diff --git a/README.zh-CN.md b/README.zh-CN.md index 9b8543f..1d83c73 100644 --- a/README.zh-CN.md +++ b/README.zh-CN.md @@ -111,11 +111,12 @@ listenhub openapi subscription -j ### 图片 -| 命令 | 说明 | -| -------------------------- | ------------ | -| `listenhub image create` | AI 生图 | -| `listenhub image list` | 列出图片 | -| `listenhub image get ` | 查看图片详情 | +| 命令 | 说明 | +| -------------------------------- | ------------------ | +| `listenhub image create` | AI 生图 | +| `listenhub image list` | 列出图片 | +| `listenhub image get ` | 查看图片详情 | +| `listenhub image delete ` | 删除一个或多个图片 | ### 视频生成 diff --git a/package.json b/package.json index 2319e23..253ce95 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@marswave/listenhub-cli", - "version": "0.0.10", + "version": "0.0.11", "description": "Command-line interface for ListenHub", "license": "MIT", "repository": "marswaveai/listenhub-cli", @@ -25,7 +25,7 @@ "prepublishOnly": "pnpm run build" }, "dependencies": { - "@marswave/listenhub-sdk": "^0.0.11", + "@marswave/listenhub-sdk": "^0.0.12", "commander": "^14.0.3", "open": "^10.0.0", "ora": "^8.0.0" diff --git a/source/image/_cli.ts b/source/image/_cli.ts index e7ffbd9..d1809c3 100644 --- a/source/image/_cli.ts +++ b/source/image/_cli.ts @@ -5,6 +5,7 @@ import { type ImageCreateOptions, type ImageListOptions, createImage, + deleteImages, getImage, listImages, } from './image.js'; @@ -75,4 +76,17 @@ export function register(program: Command) { handleError(error, options.json); } }); + + cmd + .command('delete ') + .description('Delete one or more AI images') + .option('-j, --json', 'Output JSON', false) + .action(async (ids: string[], options: {json: boolean}) => { + try { + const client = await getClient(); + await deleteImages(client, ids, options.json); + } catch (error) { + handleError(error, options.json); + } + }); } diff --git a/source/image/image.ts b/source/image/image.ts index aa85ad5..24c0844 100644 --- a/source/image/image.ts +++ b/source/image/image.ts @@ -122,3 +122,17 @@ export async function getImage( ['Created:', new Date(item.createdAt).toISOString()], ]); } + +export async function deleteImages( + client: ListenHubClient, + ids: string[], + json: boolean, +): Promise { + await client.deleteAIImages({ids}); + + if (json) { + printJson({deleted: ids}); + } else { + console.log(`✓ Deleted ${String(ids.length)} image(s)`); + } +} From 534b13fde64a0010b3d94edd10ffab5e6745833f Mon Sep 17 00:00:00 2001 From: 0XFANGO Date: Wed, 10 Jun 2026 01:42:21 +0800 Subject: [PATCH 2/2] chore(deps): bump @marswave/listenhub-sdk to ^0.0.13 (published) + refresh lockfile (#198) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit SDK 0.0.13 is live on npm (contains deleteAIImages; 0.0.12 was skipped). Lockfile now resolves the real package — gate lifted, `image delete` builds against published SDK. Verified: tsc --noEmit 0, check (lint+fmt+types) 0, build ok, test 29/29. Part of marswaveai/listenhub-ralph#198 --- package.json | 2 +- pnpm-lock.yaml | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/package.json b/package.json index 253ce95..1e799c6 100644 --- a/package.json +++ b/package.json @@ -25,7 +25,7 @@ "prepublishOnly": "pnpm run build" }, "dependencies": { - "@marswave/listenhub-sdk": "^0.0.12", + "@marswave/listenhub-sdk": "^0.0.13", "commander": "^14.0.3", "open": "^10.0.0", "ora": "^8.0.0" diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index d175b9d..0da6b4c 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -9,8 +9,8 @@ importers: .: dependencies: '@marswave/listenhub-sdk': - specifier: ^0.0.11 - version: 0.0.11 + specifier: ^0.0.13 + version: 0.0.13 commander: specifier: ^14.0.3 version: 14.0.3 @@ -57,8 +57,8 @@ packages: '@jridgewell/sourcemap-codec@1.5.5': resolution: {integrity: sha512-cYQ9310grqxueWbl+WuIUIaiUaDcj7WOq5fVhEljNVgRfOUhY9fy2zTvfoqWsnebh8Sl70VScFbICvJnLKB0Og==} - '@marswave/listenhub-sdk@0.0.11': - resolution: {integrity: sha512-DpRRbCMcjT56qPmCX3ndNpjS8IY7PkqfTT9B6iSZvhVvWwp2VWRxtI5VFIP2aLjKCjJVXC17el2j+xHujWngPw==} + '@marswave/listenhub-sdk@0.0.13': + resolution: {integrity: sha512-70DDiyk+z8onExIOimGq5SzPBz/P5KZlBXZeliFRoiZS13L89dwKPiRrp2bYvY+2xjxspbgT+9HWYFOjhbFvMQ==} engines: {node: '>=20'} '@napi-rs/wasm-runtime@1.1.4': @@ -1118,7 +1118,7 @@ snapshots: '@jridgewell/sourcemap-codec@1.5.5': {} - '@marswave/listenhub-sdk@0.0.11': + '@marswave/listenhub-sdk@0.0.13': dependencies: ky: 1.14.3