This commit is contained in:
xiongxiao
2026-01-15 23:41:10 +08:00
parent 33d1c2b5ec
commit 65da3f8c60
9 changed files with 89 additions and 159 deletions

View File

@@ -97,10 +97,10 @@
docker:
image: docker.cnb.cool/kevisual/dev-env:latest
stages:
- name: 软链 .env 文件到工作目录(仓库根目录)
- name: 软链 .env.development 文件到工作目录(仓库根目录)
script: |
if [ -e "/root/.cnb/.env" ]; then
ln -sf /root/.cnb/.env ./.env
if [ -e "/root/.cnb/.env.development" ]; then
ln -sf /root/.cnb/.env.development ./.env
else
echo "文件不存在"
fi
@@ -113,3 +113,8 @@
else
echo "文件不存在"
fi
.end_state_template: &end_state_template
endStages:
- name: '结束'
script: echo "流水线执行完毕,当前状态:${CNB_PIPELINE_STATUS}"

View File

@@ -1,12 +1,22 @@
import { app, cnb } from '../../app.ts';
import { createSkill, Skill } from '@kevisual/router'
import { tool } from "@opencode-ai/plugin/tool"
app.route({
path: 'cnb',
key: 'repo-create',
key: 'create-repo',
description: '创建代码仓库, 参数name, visibility, description',
middleware: ['auth'],
metadata: {
tags: ['opencode']
tags: ['opencode'],
...createSkill({
skill: 'create-repo',
title: '创建代码仓库',
args: {
name: tool.schema.string().describe('代码仓库名称'),
description: tool.schema.string().describe('代码仓库描述'),
},
summary: '创建一个新的代码仓库',
})
}
}).define(async (ctx) => {
const name = ctx.query?.name;
@@ -27,11 +37,22 @@ app.route({
app.route({
path: 'cnb',
key: 'repo-create-file',
key: 'create-repo-file',
description: '在代码仓库中创建文件, 参数repoName, path, content, encoding',
middleware: ['auth'],
metadata: {
tags: ['opencode']
tags: ['opencode'],
...createSkill({
skill: 'create-repo-file',
title: '在代码仓库中创建文件',
args: {
repoName: tool.schema.string().describe('代码仓库名称'),
path: tool.schema.string().describe('文件路径, 如 src/index.ts'),
content: tool.schema.string().describe('文件内容'),
encoding: tool.schema.string().describe('编码方式, 默认为 raw').optional(),
},
summary: '在代码仓库中创建文件',
})
}
}).define(async (ctx) => {
const repoName = ctx.query?.repoName;

2
bun-test/.gitignore vendored
View File

@@ -1,2 +0,0 @@
node_modules
dist

View File

@@ -1,22 +0,0 @@
{
"name": "bun-test",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
"author": "",
"license": "ISC",
"packageManager": "pnpm@10.25.0",
"devDependencies": {
"@types/bun": "^1.3.4"
},
"dependencies": {
"@rollup/plugin-node-resolve": "^16.0.3",
"esbuild": "^0.27.2",
"lodash-es": "^4.17.22",
"rollup": "^4.54.0"
}
}

View File

@@ -1,31 +0,0 @@
// rollup.config.ts
import type { Plugin, RollupOptions } from 'rollup';
import { nodeResolve } from '@rollup/plugin-node-resolve';
const cdnRewritePlugin: Plugin = {
name: 'rewrite-lodash-to-cdn',
resolveId(id) {
if (id === 'lodash-es') {
return 'https://esm.sh/lodash-es@5';
}
if (id.startsWith('lodash-es/')) {
const [, sub] = id.split('/', 2);
return `https://esm.sh/lodash-es@5/${sub}`;
}
return null;
},
};
const config: RollupOptions = {
input: 'src/index.ts',
output: {
dir: 'dist',
format: 'esm',
},
plugins: [cdnRewritePlugin, nodeResolve({ browser: true })],
external(id) {
return id.startsWith('https://');
},
};
export default config;

View File

@@ -1,3 +0,0 @@
import { debounce } from 'lodash-es';
export const debounceFn = debounce;

View File

@@ -1,47 +0,0 @@
{
"permissions": {
"allow": [
"Read(*)",
"Write(*)",
"Edit(*)",
"Glob(*)",
"Grep(*)",
"Bash(node:*)",
"Bash(npm:*)",
"Bash(npx:*)",
"Bash(pnpm:*)",
"Bash(deno:*)",
"Bash(bun:*)",
"Bash(kubectl:*)",
"Bash(git:*)",
"Bash(git:*:*)",
"Bash(python:*)",
"Bash(pip:*)",
"Bash(mkdir:*)",
"Bash(rm:*)",
"Bash(cp:*)",
"Bash(mv:*)",
"Bash(ls:*)",
"Bash(cat:*)",
"Bash(rm:*)",
"Bash(du:*)",
"Bash(df:*)",
"Bash(pwd:*)",
"Bash(whoami:*)",
"Bash(test:*)",
"Bash(echo:*)",
"Bash(timeout:*:*)",
"Bash(touch:*)",
"Bash(file:*)",
"Bash(type:*)",
"Bash(ev:*)",
"Bash(opencode:*)"
],
"deny": [],
"ask": [
"Bash(rm:-rf)",
"Bash(rm:-R)",
"Bash(rm:-r)"
]
}
}

View File

@@ -18,10 +18,10 @@
"type": "module",
"devDependencies": {
"@kevisual/context": "^0.0.4",
"@kevisual/types": "^0.0.10",
"@opencode-ai/plugin": "^1.1.16",
"@types/bun": "^1.3.5",
"@types/node": "^25.0.7",
"@kevisual/types": "^0.0.11",
"@opencode-ai/plugin": "^1.1.21",
"@types/bun": "^1.3.6",
"@types/node": "^25.0.8",
"dotenv": "^17.2.3"
},
"publishConfig": {
@@ -29,9 +29,10 @@
},
"dependencies": {
"@kevisual/query": "^0.0.35",
"@kevisual/router": "^0.0.53",
"@kevisual/use-config": "^1.0.26",
"@kevisual/router": "^0.0.54",
"@kevisual/use-config": "^1.0.28",
"es-toolkit": "^1.43.0",
"nanoid": "^5.1.6"
"nanoid": "^5.1.6",
"zod": "^4.3.5"
}
}

86
pnpm-lock.yaml generated
View File

@@ -12,33 +12,36 @@ importers:
specifier: ^0.0.35
version: 0.0.35
'@kevisual/router':
specifier: ^0.0.53
version: 0.0.53
specifier: ^0.0.54
version: 0.0.54
'@kevisual/use-config':
specifier: ^1.0.26
version: 1.0.26(dotenv@17.2.3)
specifier: ^1.0.28
version: 1.0.28(dotenv@17.2.3)
es-toolkit:
specifier: ^1.43.0
version: 1.43.0
nanoid:
specifier: ^5.1.6
version: 5.1.6
zod:
specifier: ^4.3.5
version: 4.3.5
devDependencies:
'@kevisual/context':
specifier: ^0.0.4
version: 0.0.4
'@kevisual/types':
specifier: ^0.0.10
version: 0.0.10
specifier: ^0.0.11
version: 0.0.11
'@opencode-ai/plugin':
specifier: ^1.1.16
version: 1.1.16
specifier: ^1.1.21
version: 1.1.21
'@types/bun':
specifier: ^1.3.5
version: 1.3.5
specifier: ^1.3.6
version: 1.3.6
'@types/node':
specifier: ^25.0.7
version: 25.0.7
specifier: ^25.0.8
version: 25.0.8
dotenv:
specifier: ^17.2.3
version: 17.2.3
@@ -54,31 +57,31 @@ packages:
'@kevisual/query@0.0.35':
resolution: {integrity: sha512-80dyy2LMCmEC72g+X4QWUKlZErhawQPgnGSBNR4yhrBcFgHIJQ14LR1Z+bS5S1I7db+1PDNpaxBTjIaoYoXunw==}
'@kevisual/router@0.0.53':
resolution: {integrity: sha512-Bw9xYVWyxRhd230nF1ac7cyvzWDYKI/3V+Fr1Ew1Bfr0Ey8KuWb1MgPPopHkRHCCcUcysLtWXfu/JRiTAoBmGA==}
'@kevisual/router@0.0.54':
resolution: {integrity: sha512-/D349QnAkTI2GWF0Kt549VvU3WC3NRZc9JW/56rkSYpJqTfU1kAztW6NhOgJhxHyqQiXrwgBBpObG0dfHrI/PA==}
'@kevisual/types@0.0.10':
resolution: {integrity: sha512-Q73uzzjk9UidumnmCvOpgzqDDvQxsblz22bIFuoiioUFJWwaparx8bpd8ArRyFojicYL1YJoFDzDZ9j9NN8grA==}
'@kevisual/types@0.0.11':
resolution: {integrity: sha512-idNLDTEKVdNXZHFQq8PTN62nflh94kvGtx+v8YDcMxt0Zo+HWVZTFElm+dMQxAs/vn4wo8F2r3VwzWNX/vcqwQ==}
'@kevisual/use-config@1.0.26':
resolution: {integrity: sha512-e5jgEALn4Pb5ReXnqVkK0XyQdRXLyciqmLFY7XVDyXCu7ieh6gxDCb41rsSfBj5ofpG8jH6afOlgWqt2A4BcWg==}
'@kevisual/use-config@1.0.28':
resolution: {integrity: sha512-ngF+LDbjxpXWrZNmnShIKF/jPpAa+ezV+DcgoZIIzHlRnIjE+rr9sLkN/B7WJbiH9C/j1tQXOILY8ujBqILrow==}
peerDependencies:
dotenv: ^17
'@opencode-ai/plugin@1.1.16':
resolution: {integrity: sha512-t+Jg/rGlZkzaMABul1zu7Z7PtsjNh8UVUDc9sYh50YwO4n4ZgcVUoUllJ9AmPKdQ8MDYAFM62V29x2VVWITrwg==}
'@opencode-ai/plugin@1.1.21':
resolution: {integrity: sha512-oAWVlKG7LACGFYawfdHGMN6e+6lyN6F+zPVncFUB99BrTl/TjELE5gTZwU7MalGpjwfU77yslBOZm4BXVAYGvw==}
'@opencode-ai/sdk@1.1.16':
resolution: {integrity: sha512-J77pyb370VvzycqXQE/kvTs7P+tEb0wfsWZDHScBoqstQOV7Ya9uXp2XSO5aPuzjP9WJGfnNZ8MmUwMfv8vIZQ==}
'@opencode-ai/sdk@1.1.21':
resolution: {integrity: sha512-4M6lBjRPlPz99Rb5rS5ZqKrb0UDDxOT9VTG06JpNxvA7ynTd8C50ckc2NGzWtvjarmxfaAk1VeuBYN/cq2pIKQ==}
'@types/bun@1.3.5':
resolution: {integrity: sha512-RnygCqNrd3srIPEWBd5LFeUYG7plCoH2Yw9WaZGyNmdTEei+gWaHqydbaIRkIkcbXwhBT94q78QljxN0Sk838w==}
'@types/bun@1.3.6':
resolution: {integrity: sha512-uWCv6FO/8LcpREhenN1d1b6fcspAB+cefwD7uti8C8VffIv0Um08TKMn98FynpTiU38+y2dUO55T11NgDt8VAA==}
'@types/node@25.0.7':
resolution: {integrity: sha512-C/er7DlIZgRJO7WtTdYovjIFzGsz0I95UlMyR9anTb4aCpBSRWe5Jc1/RvLKUfzmOxHPGjSE5+63HgLtndxU4w==}
'@types/node@25.0.8':
resolution: {integrity: sha512-powIePYMmC3ibL0UJ2i2s0WIbq6cg6UyVFQxSCpaPxxzAaziRfimGivjdF943sSGV6RADVbk0Nvlm5P/FB44Zg==}
bun-types@1.3.5:
resolution: {integrity: sha512-inmAYe2PFLs0SUbFOWSVD24sg1jFlMPxOjOSSCYqUgn4Hsc3rDc7dFvfVYjFPNHtov6kgUeulV4SxbuIV/stPw==}
bun-types@1.3.6:
resolution: {integrity: sha512-OlFwHcnNV99r//9v5IIOgQ9Uk37gZqrNMCcqEaExdkVq3Avwqok1bJFmvGMCkCE0FqzdY8VMOZpfpR3lwI+CsQ==}
dotenv@17.2.3:
resolution: {integrity: sha512-JVUnt+DUIzu87TABbhPmNfVdBDt18BLOWjMUFJMSi/Qqg7NTYtabbvSNJGOJ7afbRuv9D/lngizHtP7QyLQ+9w==}
@@ -104,6 +107,9 @@ packages:
zod@4.1.8:
resolution: {integrity: sha512-5R1P+WwQqmmMIEACyzSvo4JXHY5WiAFHRMg+zBZKgKS+Q1viRa0C1hmUKtHltoIFKtIdki3pRxkmpP74jnNYHQ==}
zod@4.3.5:
resolution: {integrity: sha512-k7Nwx6vuWx1IJ9Bjuf4Zt1PEllcwe7cls3VNzm4CQ1/hgtFUK2bRNG3rvnpPUhFjmqJKAKtjV576KnUkHocg/g==}
snapshots:
'@kevisual/context@0.0.4': {}
@@ -116,33 +122,33 @@ snapshots:
dependencies:
tslib: 2.8.1
'@kevisual/router@0.0.53': {}
'@kevisual/router@0.0.54': {}
'@kevisual/types@0.0.10': {}
'@kevisual/types@0.0.11': {}
'@kevisual/use-config@1.0.26(dotenv@17.2.3)':
'@kevisual/use-config@1.0.28(dotenv@17.2.3)':
dependencies:
'@kevisual/load': 0.0.6
dotenv: 17.2.3
'@opencode-ai/plugin@1.1.16':
'@opencode-ai/plugin@1.1.21':
dependencies:
'@opencode-ai/sdk': 1.1.16
'@opencode-ai/sdk': 1.1.21
zod: 4.1.8
'@opencode-ai/sdk@1.1.16': {}
'@opencode-ai/sdk@1.1.21': {}
'@types/bun@1.3.5':
'@types/bun@1.3.6':
dependencies:
bun-types: 1.3.5
bun-types: 1.3.6
'@types/node@25.0.7':
'@types/node@25.0.8':
dependencies:
undici-types: 7.16.0
bun-types@1.3.5:
bun-types@1.3.6:
dependencies:
'@types/node': 25.0.7
'@types/node': 25.0.8
dotenv@17.2.3: {}
@@ -157,3 +163,5 @@ snapshots:
undici-types@7.16.0: {}
zod@4.1.8: {}
zod@4.3.5: {}