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