@kevisual/router 0.2.2 → 0.2.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/package",
3
3
  "name": "@kevisual/router",
4
- "version": "0.2.2",
4
+ "version": "0.2.3",
5
5
  "description": "",
6
6
  "type": "module",
7
7
  "main": "./dist/router.js",
@@ -30,7 +30,7 @@
30
30
  "@kevisual/query": "^0.0.55",
31
31
  "@kevisual/remote-app": "^0.0.7",
32
32
  "@kevisual/use-config": "^1.0.30",
33
- "@opencode-ai/plugin": "^1.3.0",
33
+ "@opencode-ai/plugin": "^1.3.2",
34
34
  "@types/bun": "^1.3.11",
35
35
  "@types/crypto-js": "^4.2.2",
36
36
  "@types/node": "^25.5.0",
@@ -42,11 +42,10 @@
42
42
  "es-toolkit": "^1.45.1",
43
43
  "eventemitter3": "^5.0.4",
44
44
  "fast-glob": "^3.3.3",
45
- "hono": "^4.12.8",
46
45
  "nanoid": "^5.1.7",
47
46
  "path-to-regexp": "^8.3.0",
48
47
  "send": "^1.2.1",
49
- "typescript": "^5.9.3",
48
+ "typescript": "^6.0.2",
50
49
  "ws": "npm:@kevisual/ws",
51
50
  "xml2js": "^0.6.2"
52
51
  },
package/src/commander.ts CHANGED
@@ -18,7 +18,7 @@ export const parseArgs = (args: string) => {
18
18
  } catch {
19
19
  // 尝试解析 a=b b=c 格式
20
20
  const result: Record<string, string> = {};
21
- const pairs = args.match(/(\S+?)=(\S+)/g);
21
+ const pairs = args.match(/(\S+?)=(.*?)(?=\s|$)/g);
22
22
  if (pairs && pairs.length > 0) {
23
23
  for (const pair of pairs) {
24
24
  const idx = pair.indexOf('=');
@@ -27,7 +27,8 @@ export const parseArgs = (args: string) => {
27
27
  let value: string | number | boolean = raw;
28
28
  if (raw === 'true') value = true;
29
29
  else if (raw === 'false') value = false;
30
- else if (raw !== '' && !isNaN(Number(raw))) value = Number(raw);
30
+ else if (raw === '') value = true;
31
+ else if (!isNaN(Number(raw))) value = Number(raw);
31
32
  result[key] = value as string;
32
33
  }
33
34
  return result;
@@ -72,7 +73,6 @@ export const createCommand = (opts: { app: any, program: Command }) => {
72
73
  const app = opts.app as App;
73
74
  const routes = app.routes;
74
75
 
75
-
76
76
  const groupRoutes = groupByPath(routes);
77
77
  for (const path in groupRoutes) {
78
78
  const routeList = groupRoutes[path];
@@ -174,7 +174,7 @@ const createCliList = (app: App) => {
174
174
  q: z.string().optional().describe('查询关键词,支持模糊匹配命令'),
175
175
  path: z.string().optional().describe('按路径前缀过滤,如 user、admin'),
176
176
  tags: z.string().optional().describe('按标签过滤,多个标签用逗号分隔'),
177
- sort: z.enum(['key', 'path', 'name']).optional().describe('排序方式'),
177
+ sort: z.enum(['key', 'path', '-key', '-path']).optional().describe('排序方式'),
178
178
  limit: z.number().optional().describe('限制返回数量'),
179
179
  offset: z.number().optional().describe('偏移量,用于分页'),
180
180
  format: z.enum(['table', 'simple', 'json']).optional().describe('输出格式'),
@@ -222,6 +222,8 @@ const createCliList = (app: App) => {
222
222
  routes.sort((a, b) => {
223
223
  if (sort === 'path') return a.path.localeCompare(b.path);
224
224
  if (sort === 'key') return a.key.localeCompare(b.key);
225
+ if (sort === '-path') return b.path.localeCompare(a.path);
226
+ if (sort === '-key') return b.key.localeCompare(a.key);
225
227
  return a.key.localeCompare(b.key); // name 默认为 key
226
228
  });
227
229
  }
package/dist/app.d.ts DELETED
@@ -1,5 +0,0 @@
1
- import * as _opencode_ai_plugin from '@opencode-ai/plugin';
2
-
3
- declare const routerAgentPlugin: _opencode_ai_plugin.Plugin;
4
-
5
- export { routerAgentPlugin };