chore: 更新 @opencode-ai/plugin 版本至 1.2.21,并调整 commander 模块中的类型导入

This commit is contained in:
2026-03-09 01:13:45 +08:00
parent b375e5ac23
commit 3c56849cfa
3 changed files with 20 additions and 19 deletions

View File

@@ -1,7 +1,7 @@
{
"$schema": "https://json.schemastore.org/package",
"name": "@kevisual/router",
"version": "0.0.88",
"version": "0.0.89",
"description": "",
"type": "module",
"main": "./dist/router.js",
@@ -29,7 +29,7 @@
"@kevisual/local-proxy": "^0.0.8",
"@kevisual/query": "^0.0.53",
"@kevisual/use-config": "^1.0.30",
"@opencode-ai/plugin": "^1.2.20",
"@opencode-ai/plugin": "^1.2.21",
"@types/bun": "^1.3.10",
"@types/node": "^25.3.5",
"@types/send": "^1.2.1",

18
pnpm-lock.yaml generated
View File

@@ -34,8 +34,8 @@ importers:
specifier: ^1.0.30
version: 1.0.30(dotenv@17.2.3)
'@opencode-ai/plugin':
specifier: ^1.2.20
version: 1.2.20
specifier: ^1.2.21
version: 1.2.21
'@types/bun':
specifier: ^1.3.10
version: 1.3.10
@@ -169,11 +169,11 @@ packages:
resolution: {integrity: sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==}
engines: {node: '>= 8'}
'@opencode-ai/plugin@1.2.20':
resolution: {integrity: sha512-BE6TOXVxgF24g5QgtlogSY5B+/AmZJ3cYaVjHZhUVuAli9JEg4RblrbrK2rfgbyZBoZDpjBLGTYtIRTVmOccEA==}
'@opencode-ai/plugin@1.2.21':
resolution: {integrity: sha512-2/JhdD19bu9fxPIzZun2x57KA4Q4EsY/yRQZO54GTsVugZ+T0b5GZkFFYIyOVE6bU4PCoSYBK5MAU+VCEyxvEA==}
'@opencode-ai/sdk@1.2.20':
resolution: {integrity: sha512-U5ROpG21D8jg9rkc1IgKAk1g5dn6X/rkOBfveupd0peSDO9n6VM9aikYccVLaMObxVqdjtG08IeQOFTPVS8ySQ==}
'@opencode-ai/sdk@1.2.21':
resolution: {integrity: sha512-7XF7QlXDP5iAbGcAsxsrmKlIjRtSzKgbwuDHPPuZbILkhGOfCo05XwPidAZrVWucZ/re44oc/psw2zDECaZOpQ==}
'@rollup/plugin-commonjs@29.0.0':
resolution: {integrity: sha512-U2YHaxR2cU/yAiwKJtJRhnyLk7cifnQw0zUpISsocBDoHDJn+HTV74ABqnwr5bEgWUwFZC9oFL6wLe21lHu5eQ==}
@@ -772,12 +772,12 @@ snapshots:
'@nodelib/fs.scandir': 2.1.5
fastq: 1.20.1
'@opencode-ai/plugin@1.2.20':
'@opencode-ai/plugin@1.2.21':
dependencies:
'@opencode-ai/sdk': 1.2.20
'@opencode-ai/sdk': 1.2.21
zod: 4.1.8
'@opencode-ai/sdk@1.2.20': {}
'@opencode-ai/sdk@1.2.21': {}
'@rollup/plugin-commonjs@29.0.0(rollup@4.57.1)':
dependencies:

View File

@@ -1,4 +1,4 @@
import { program } from 'commander';
import { Command, program } from 'commander';
import { App, QueryRouterServer } from './app.ts';
export const groupByPath = (routes: App['routes']) => {
@@ -62,7 +62,7 @@ export const parseDescription = (route: App['routes'][number]) => {
}
return desc;
}
export const createCommand = (opts: { app: App, program: typeof program }) => {
export const createCommand = (opts: { app: App, program: Command }) => {
const { app, program } = opts;
const routes = app.routes;
@@ -71,7 +71,7 @@ export const createCommand = (opts: { app: App, program: typeof program }) => {
for (const path in groupRoutes) {
const routeList = groupRoutes[path];
const keys = routeList.map(route => route.key).filter(Boolean);
const subProgram = program.command(path).description(`路由${path} ${keys.length > 0 ? ': ' + keys.join(', ') : ''}`);
const subProgram = program.command(path).description(`路由[${path}] ${keys.length > 0 ? ': ' + keys.join(', ') : ''}`);
routeList.forEach(route => {
if (!route.key) return;
const description = parseDescription(route);
@@ -103,11 +103,12 @@ export const createCommand = (opts: { app: App, program: typeof program }) => {
}
}
export const parse = (opts: { app: QueryRouterServer, description?: string, parse?: boolean }) => {
const { app, description, parse = true } = opts;
program.description(description || 'Router 命令行工具');
createCommand({ app: app as App, program });
export const parse = (opts: { app: QueryRouterServer, description?: string, parse?: boolean, program?: Command }) => {
const { app, description, parse = true, } = opts;
const _program = opts.program || program;
_program.description(description || 'Router 命令行工具');
createCommand({ app: app as App, program: _program });
if (parse) {
program.parse(process.argv);
_program.parse(process.argv);
}
}