Refactor code structure for improved readability and maintainability
This commit is contained in:
@@ -10,7 +10,7 @@
|
||||
],
|
||||
"author": "abearxiong <xiongxiao@xiongxiao.me> (https://www.xiongxiao.me)",
|
||||
"license": "MIT",
|
||||
"packageManager": "pnpm@10.29.3",
|
||||
"packageManager": "pnpm@10.30.0",
|
||||
"type": "module",
|
||||
"files": [
|
||||
"dist",
|
||||
@@ -44,16 +44,16 @@
|
||||
"devDependencies": {
|
||||
"@inquirer/prompts": "^8.2.1",
|
||||
"@kevisual/ai": "^0.0.24",
|
||||
"@kevisual/api": "^0.0.50",
|
||||
"@kevisual/api": "^0.0.51",
|
||||
"@kevisual/load": "^0.0.6",
|
||||
"@kevisual/local-app-manager": "^0.1.32",
|
||||
"@kevisual/logger": "^0.0.4",
|
||||
"@kevisual/query": "0.0.40",
|
||||
"@kevisual/query": "0.0.44",
|
||||
"@kevisual/query-login": "0.0.7",
|
||||
"@kevisual/router": "^0.0.70",
|
||||
"@kevisual/router": "^0.0.74",
|
||||
"@kevisual/types": "^0.0.12",
|
||||
"@kevisual/use-config": "^1.0.30",
|
||||
"@opencode-ai/plugin": "^1.2.4",
|
||||
"@opencode-ai/plugin": "^1.2.6",
|
||||
"@types/bun": "^1.3.9",
|
||||
"@types/node": "^25.2.3",
|
||||
"@types/send": "^1.2.1",
|
||||
@@ -77,11 +77,11 @@
|
||||
"access": "public"
|
||||
},
|
||||
"dependencies": {
|
||||
"@aws-sdk/client-s3": "^3.990.0",
|
||||
"@aws-sdk/client-s3": "^3.991.0",
|
||||
"@kevisual/js-filter": "^0.0.5",
|
||||
"@kevisual/oss": "^0.0.19",
|
||||
"@kevisual/video-tools": "^0.0.13",
|
||||
"@opencode-ai/sdk": "^1.2.4",
|
||||
"@opencode-ai/sdk": "^1.2.6",
|
||||
"es-toolkit": "^1.44.0",
|
||||
"eventemitter3": "^5.0.4",
|
||||
"lowdb": "^7.0.1",
|
||||
|
||||
@@ -54,15 +54,4 @@ export const simpleRouter = useContextKey('simpleRouter', () => {
|
||||
return new SimpleRouter();
|
||||
});
|
||||
|
||||
app.route({
|
||||
path: 'router',
|
||||
key: 'list',
|
||||
description: '获取路由列表',
|
||||
}).define(async (ctx) => {
|
||||
const list = ctx.app.getList((item) => {
|
||||
if (item?.path?.includes?.('auth') || item?.id?.includes?.('auth')) return false;
|
||||
return true;
|
||||
})
|
||||
console.log('路由列表:', list.length);
|
||||
ctx.body = { list }
|
||||
}).addTo(app);
|
||||
app.createRouteList()
|
||||
@@ -11,7 +11,7 @@ app
|
||||
path: 'ai',
|
||||
key: 'chat',
|
||||
description: '与 AI 进行对话, 调用 GPT 的AI 服务,生成结果,并返回。',
|
||||
middleware: ['admin-auth'],
|
||||
middleware: ['auth-admin'],
|
||||
metadata: {
|
||||
admin: true,
|
||||
}
|
||||
|
||||
@@ -59,7 +59,7 @@ app.route({
|
||||
path: 'client',
|
||||
key: 'restart',
|
||||
description: '重启客户端',
|
||||
middleware: ['admin-auth'],
|
||||
middleware: ['auth-admin'],
|
||||
metadata: {
|
||||
tags: ['opencode'],
|
||||
...createSkill({
|
||||
|
||||
@@ -5,7 +5,7 @@ app
|
||||
.route({
|
||||
path: 'config',
|
||||
description: '获取配置',
|
||||
middleware: ['admin-auth'],
|
||||
middleware: ['auth-admin'],
|
||||
})
|
||||
.define(async (ctx) => {
|
||||
ctx.body = assistantConfig.getCacheAssistantConfig();
|
||||
@@ -17,7 +17,7 @@ app
|
||||
path: 'config',
|
||||
key: 'set',
|
||||
description: '设置配置',
|
||||
middleware: ['admin-auth'],
|
||||
middleware: ['auth-admin'],
|
||||
})
|
||||
.define(async (ctx) => {
|
||||
const { data } = ctx.query;
|
||||
|
||||
@@ -118,8 +118,8 @@ app
|
||||
.addTo(app);
|
||||
app
|
||||
.route({
|
||||
path: 'admin-auth',
|
||||
id: 'admin-auth',
|
||||
path: 'auth-admin',
|
||||
id: 'auth-admin',
|
||||
description: '管理员鉴权, 获取用户信息,并验证是否为管理员。',
|
||||
})
|
||||
.define(async (ctx) => {
|
||||
|
||||
@@ -8,7 +8,7 @@ app.route({
|
||||
path: 'kevisual',
|
||||
key: ' me',
|
||||
description: '查看 ev cli 是否登录',
|
||||
middleware: ['admin-auth'],
|
||||
middleware: ['auth-admin'],
|
||||
metadata: {
|
||||
tags: ['opencode'],
|
||||
...createSkill({
|
||||
@@ -36,7 +36,7 @@ app.route({
|
||||
path: 'kevisual',
|
||||
key: 'loginByAdmin',
|
||||
description: '通过当前登录用户 ev cli',
|
||||
middleware: ['admin-auth'],
|
||||
middleware: ['auth-admin'],
|
||||
metadata: {
|
||||
tags: ['opencode'],
|
||||
...createSkill({
|
||||
|
||||
@@ -7,7 +7,7 @@ app.route({
|
||||
path: 'kevisual',
|
||||
key: 'deploy',
|
||||
description: '部署一个网页',
|
||||
middleware: ['admin-auth'],
|
||||
middleware: ['auth-admin'],
|
||||
metadata: {
|
||||
tags: ['kevisual'],
|
||||
...createSkill({
|
||||
|
||||
@@ -5,7 +5,7 @@ import { AssistantApp } from "@/lib.ts";
|
||||
app.route({
|
||||
path: 'remote',
|
||||
key: 'status',
|
||||
middleware: ['admin-auth'],
|
||||
middleware: ['auth-admin'],
|
||||
description: '获取远程app连接状态',
|
||||
}).define(async (ctx) => {
|
||||
const manager = useContextKey('manager') as AssistantApp;
|
||||
@@ -24,7 +24,7 @@ app.route({
|
||||
app.route({
|
||||
path: 'remote',
|
||||
key: 'connect',
|
||||
middleware: ['admin-auth'],
|
||||
middleware: ['auth-admin'],
|
||||
description: '连接远程app',
|
||||
}).define(async (ctx) => {
|
||||
const manager = useContextKey('manager') as AssistantApp;
|
||||
|
||||
@@ -6,7 +6,7 @@ app
|
||||
path: 'shop',
|
||||
key: 'get-registry',
|
||||
description: '获取应用商店注册表信息',
|
||||
middleware: ['admin-auth'],
|
||||
middleware: ['auth-admin'],
|
||||
metadata: {
|
||||
admin: true,
|
||||
}
|
||||
@@ -23,7 +23,7 @@ app
|
||||
path: 'shop',
|
||||
key: 'list-installed',
|
||||
description: '列出当前已安装的所有应用',
|
||||
middleware: ['admin-auth'],
|
||||
middleware: ['auth-admin'],
|
||||
metadata: {
|
||||
admin: true,
|
||||
}
|
||||
@@ -41,7 +41,7 @@ app
|
||||
path: 'shop',
|
||||
key: 'install',
|
||||
description: '安装指定的应用,可以指定 id、type、force 和 yes 参数',
|
||||
middleware: ['admin-auth'],
|
||||
middleware: ['auth-admin'],
|
||||
metadata: {
|
||||
admin: true,
|
||||
}
|
||||
@@ -68,7 +68,7 @@ app
|
||||
path: 'shop',
|
||||
key: 'uninstall',
|
||||
description: '卸载指定的应用,可以指定 id 和 type 参数',
|
||||
middleware: ['admin-auth'],
|
||||
middleware: ['auth-admin'],
|
||||
metadata: {
|
||||
admin: true,
|
||||
}
|
||||
|
||||
12
package.json
12
package.json
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@kevisual/cli",
|
||||
"version": "0.1.4",
|
||||
"version": "0.1.5",
|
||||
"description": "envision 命令行工具",
|
||||
"type": "module",
|
||||
"basename": "/root/cli",
|
||||
@@ -46,7 +46,7 @@
|
||||
"@kevisual/auth": "^2.0.3",
|
||||
"@kevisual/context": "^0.0.6",
|
||||
"@kevisual/use-config": "^1.0.30",
|
||||
"@opencode-ai/sdk": "^1.2.4",
|
||||
"@opencode-ai/sdk": "^1.2.6",
|
||||
"@types/busboy": "^1.5.4",
|
||||
"busboy": "^1.6.0",
|
||||
"eventemitter3": "^5.0.4",
|
||||
@@ -59,12 +59,12 @@
|
||||
"unstorage": "^1.17.4"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@kevisual/api": "^0.0.50",
|
||||
"@kevisual/api": "^0.0.51",
|
||||
"@kevisual/cnb": "^0.0.26",
|
||||
"@kevisual/dts": "^0.0.3",
|
||||
"@kevisual/dts": "^0.0.4",
|
||||
"@kevisual/load": "^0.0.6",
|
||||
"@kevisual/logger": "^0.0.4",
|
||||
"@kevisual/query": "0.0.40",
|
||||
"@kevisual/query": "0.0.44",
|
||||
"@kevisual/query-login": "0.0.7",
|
||||
"@types/bun": "^1.3.9",
|
||||
"@types/crypto-js": "^4.2.2",
|
||||
@@ -81,7 +81,7 @@
|
||||
"ignore": "^7.0.5",
|
||||
"jsonwebtoken": "^9.0.3",
|
||||
"pm2": "^6.0.14",
|
||||
"tar": "^7.5.7",
|
||||
"tar": "^7.5.9",
|
||||
"zustand": "^5.0.11"
|
||||
},
|
||||
"engines": {
|
||||
|
||||
568
pnpm-lock.yaml
generated
568
pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user