Compare commits

..

9 Commits

19 changed files with 880 additions and 623 deletions

View File

@@ -1,24 +1,4 @@
import { resolvePath } from '@kevisual/use-config'; import { buildWithBun } from '@kevisual/code-builder'
import { execSync } from 'node:child_process'; await buildWithBun({ naming: 'opencode', entry: 'agent/opencode.ts', dts: true });
await buildWithBun({ naming: 'keep', entry: 'src/keep.ts', dts: true });
const buildFn = async (opts: { entry?: string, naming?: string }) => { await buildWithBun({ naming: 'routes', entry: 'agent/index.ts', dts: true });
const entry = opts.entry || 'agent/opencode.ts';
const naming = opts.naming || 'opencode';
const external: string[] = ["bun", "ws"];
await Bun.build({
target: 'node',
format: 'esm',
entrypoints: [resolvePath(entry, { meta: import.meta })],
outdir: resolvePath('./dist', { meta: import.meta }),
naming: {
entry: `${naming}.js`,
},
external,
});
const cmd = `dts -i ${entry} -o ${naming}.d.ts`;
execSync(cmd);
};
await buildFn({ naming: 'opencode', entry: 'agent/opencode.ts' });
await buildFn({ naming: 'keep', entry: 'src/keep.ts' });
await buildFn({ naming: 'routes', entry: 'agent/index.ts' });

18
demo/index.ts Normal file
View File

@@ -0,0 +1,18 @@
import { createKeepAlive } from "@kevisual/cnb/keep";
const config = {
"wss": "wss://cnb-d98-1jgeskb82-001.cnb.space:443/stable-3c0b449c6e6e37b44a8a7938c0d8a3049926a64c?reconnectionToken=aac306fc-b934-4035-8276-3dd429b7c4c0&reconnection=false&skipWebSocketFrames=false",
"cookie": "orange:workspace:cookie-session:cnb-d98-1jgeskb82-001=15aa8d88-e1f4-47f8-b6bf-761f94b021d0",
"url": "https://cnb-d98-1jgeskb82-001.cnb.space/?folder=/workspace"
}
createKeepAlive({
wsUrl: config.wss,
cookie: config.cookie,
debug: true,
});
setTimeout(() => {
console.log("停止保持 WebSocket 连接...");
process.exit(0);
}, 5 * 60 * 60 * 1000);

17
demo/package.json Normal file
View File

@@ -0,0 +1,17 @@
{
"name": "demo",
"version": "0.0.1",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
"author": "abearxiong <xiongxiao@xiongxiao.me> (https://www.xiongxiao.me)",
"license": "MIT",
"packageManager": "pnpm@10.28.2",
"type": "module",
"dependencies": {
"@kevisual/cnb": "^0.0.13"
}
}

View File

@@ -1,10 +1,11 @@
{ {
"name": "@kevisual/cnb", "name": "@kevisual/cnb",
"version": "0.0.13", "version": "0.0.19",
"description": "", "description": "",
"main": "index.js", "main": "index.js",
"scripts": { "scripts": {
"build": "bun run bun.config.ts" "build": "bun bun.config.ts",
"flow":"ev npm patch && pnpm build && ev npm publish npm -p"
}, },
"keywords": [], "keywords": [],
"files": [ "files": [
@@ -19,11 +20,12 @@
"type": "module", "type": "module",
"devDependencies": { "devDependencies": {
"@kevisual/ai": "^0.0.24", "@kevisual/ai": "^0.0.24",
"@kevisual/code-builder": "^0.0.6",
"@kevisual/context": "^0.0.4", "@kevisual/context": "^0.0.4",
"@kevisual/types": "^0.0.12", "@kevisual/types": "^0.0.12",
"@opencode-ai/plugin": "^1.1.44", "@opencode-ai/plugin": "^1.1.51",
"@types/bun": "^1.3.8", "@types/bun": "^1.3.8",
"@types/node": "^25.1.0", "@types/node": "^25.2.1",
"@types/ws": "^8.18.1", "@types/ws": "^8.18.1",
"dayjs": "^1.11.19", "dayjs": "^1.11.19",
"dotenv": "^17.2.3" "dotenv": "^17.2.3"
@@ -35,9 +37,9 @@
"zod": "^4.3.6" "zod": "^4.3.6"
}, },
"dependencies": { "dependencies": {
"@kevisual/query": "^0.0.38", "@kevisual/query": "^0.0.39",
"@kevisual/router": "^0.0.64", "@kevisual/router": "^0.0.70",
"@kevisual/use-config": "^1.0.28", "@kevisual/use-config": "^1.0.30",
"es-toolkit": "^1.44.0", "es-toolkit": "^1.44.0",
"nanoid": "^5.1.6", "nanoid": "^5.1.6",
"unstorage": "^1.17.4", "unstorage": "^1.17.4",

598
pnpm-lock.yaml generated
View File

@@ -12,14 +12,14 @@ importers:
.: .:
dependencies: dependencies:
'@kevisual/query': '@kevisual/query':
specifier: ^0.0.38 specifier: ^0.0.39
version: 0.0.38 version: 0.0.39
'@kevisual/router': '@kevisual/router':
specifier: ^0.0.64 specifier: ^0.0.70
version: 0.0.64(typescript@5.9.3) version: 0.0.70
'@kevisual/use-config': '@kevisual/use-config':
specifier: ^1.0.28 specifier: ^1.0.30
version: 1.0.28(dotenv@17.2.3) version: 1.0.30(dotenv@17.2.3)
es-toolkit: es-toolkit:
specifier: ^1.44.0 specifier: ^1.44.0
version: 1.44.0 version: 1.44.0
@@ -39,6 +39,9 @@ importers:
'@kevisual/ai': '@kevisual/ai':
specifier: ^0.0.24 specifier: ^0.0.24
version: 0.0.24 version: 0.0.24
'@kevisual/code-builder':
specifier: ^0.0.6
version: 0.0.6
'@kevisual/context': '@kevisual/context':
specifier: ^0.0.4 specifier: ^0.0.4
version: 0.0.4 version: 0.0.4
@@ -46,14 +49,14 @@ importers:
specifier: ^0.0.12 specifier: ^0.0.12
version: 0.0.12 version: 0.0.12
'@opencode-ai/plugin': '@opencode-ai/plugin':
specifier: ^1.1.44 specifier: ^1.1.51
version: 1.1.44 version: 1.1.51
'@types/bun': '@types/bun':
specifier: ^1.3.8 specifier: ^1.3.8
version: 1.3.8 version: 1.3.8
'@types/node': '@types/node':
specifier: ^25.1.0 specifier: ^25.2.1
version: 25.1.0 version: 25.2.1
'@types/ws': '@types/ws':
specifier: ^8.18.1 specifier: ^8.18.1
version: 8.18.1 version: 8.18.1
@@ -66,27 +69,16 @@ importers:
packages: packages:
'@babel/code-frame@7.28.6':
resolution: {integrity: sha512-JYgintcMjRiCvS8mMECzaEn+m3PfoQiyqukOMCCVQtoJGYJw8j/8LBJEiqkHLkfwCcs74E3pbAUFNg7d9VNJ+Q==}
engines: {node: '>=6.9.0'}
'@babel/helper-validator-identifier@7.28.5':
resolution: {integrity: sha512-qSs4ifwzKJSV39ucNjsvc6WVHs6b7S03sOh2OcHF9UHfVPqWWALUsNUVzhSBiItjRZoLHx7nIarVjqKVusUZ1Q==}
engines: {node: '>=6.9.0'}
'@jridgewell/sourcemap-codec@1.5.5':
resolution: {integrity: sha512-cYQ9310grqxueWbl+WuIUIaiUaDcj7WOq5fVhEljNVgRfOUhY9fy2zTvfoqWsnebh8Sl70VScFbICvJnLKB0Og==}
'@kevisual/ai@0.0.24': '@kevisual/ai@0.0.24':
resolution: {integrity: sha512-7jvZk1/L//VIClK7usuNgN4ZA9Etgbooka1Sj5quE/0UywR+NNnwqXVZ89Y1fBhI1TkhauDsdJBAtcQ7r/vbVw==} resolution: {integrity: sha512-7jvZk1/L//VIClK7usuNgN4ZA9Etgbooka1Sj5quE/0UywR+NNnwqXVZ89Y1fBhI1TkhauDsdJBAtcQ7r/vbVw==}
'@kevisual/code-builder@0.0.6':
resolution: {integrity: sha512-0aqATB31/yw4k4s5/xKnfr4DKbUnx8e3Z3BmKbiXTrc+CqWiWTdlGe9bKI9dZ2Df+xNp6g11W4xM2NICNyyCCw==}
hasBin: true
'@kevisual/context@0.0.4': '@kevisual/context@0.0.4':
resolution: {integrity: sha512-HJeLeZQLU+7tCluSfOyvkgKLs0HjCZrdJlZgEgKRSa8XTwZfMAUt6J7qZTbrZAHBlPtX68EPu/PI8JMCeu3WAQ==} resolution: {integrity: sha512-HJeLeZQLU+7tCluSfOyvkgKLs0HjCZrdJlZgEgKRSa8XTwZfMAUt6J7qZTbrZAHBlPtX68EPu/PI8JMCeu3WAQ==}
'@kevisual/dts@0.0.3':
resolution: {integrity: sha512-4T/m2LqhtwWEW+lWmg7jLxKFW7VtIAftsWFDDZvh10bZunqFf8iXxChHcVSQWikghJb4cq1IkWzPkvc2l+Asdw==}
hasBin: true
'@kevisual/load@0.0.6': '@kevisual/load@0.0.6':
resolution: {integrity: sha512-+3YTFehRcZ1haGel5DKYMUwmi5i6f2psyaPZlfkKU/cOXgkpwoG9/BEqPCnPjicKqqnksEpixVRkyHJ+5bjLVA==} resolution: {integrity: sha512-+3YTFehRcZ1haGel5DKYMUwmi5i6f2psyaPZlfkKU/cOXgkpwoG9/BEqPCnPjicKqqnksEpixVRkyHJ+5bjLVA==}
@@ -99,14 +91,17 @@ packages:
'@kevisual/query@0.0.38': '@kevisual/query@0.0.38':
resolution: {integrity: sha512-bfvbSodsZyMfwY+1T2SvDeOCKsT/AaIxlVe0+B1R/fNhlg2MDq2CP0L9HKiFkEm+OXrvXcYDMKPUituVUM5J6Q==} resolution: {integrity: sha512-bfvbSodsZyMfwY+1T2SvDeOCKsT/AaIxlVe0+B1R/fNhlg2MDq2CP0L9HKiFkEm+OXrvXcYDMKPUituVUM5J6Q==}
'@kevisual/router@0.0.64': '@kevisual/query@0.0.39':
resolution: {integrity: sha512-EYz1MZxrltgySUL0Y+/MtZf2FEmqC5U8GmFAqvHNjgtS5FJdHpxRjo6zab4+0wSUlVyCxCpZXFY5vHB/g+nQBw==} resolution: {integrity: sha512-3UEPBIvtdykNkrby3hvrgrHdgd17Uq+Pnr4zs+JBzATkU2eKaOqtTUJqdyIEwuySCwzGTxrnlUzWP4tziDQDLQ==}
'@kevisual/router@0.0.70':
resolution: {integrity: sha512-vXlIj9jRufhcIfeuPWemjSI+dxdzSmIBq5eRxQzqEfAJ7k+mBPhoI4KxH8vHnwyL30bqm8EdODL/p6Wg8uBw3g==}
'@kevisual/types@0.0.12': '@kevisual/types@0.0.12':
resolution: {integrity: sha512-zJXH2dosir3jVrQ6QG4i0+iLQeT9gJ3H+cKXs8ReWboxBSYzUZO78XssVeVrFPsJ33iaAqo4q3DWbSS1dWGn7Q==} resolution: {integrity: sha512-zJXH2dosir3jVrQ6QG4i0+iLQeT9gJ3H+cKXs8ReWboxBSYzUZO78XssVeVrFPsJ33iaAqo4q3DWbSS1dWGn7Q==}
'@kevisual/use-config@1.0.28': '@kevisual/use-config@1.0.30':
resolution: {integrity: sha512-ngF+LDbjxpXWrZNmnShIKF/jPpAa+ezV+DcgoZIIzHlRnIjE+rr9sLkN/B7WJbiH9C/j1tQXOILY8ujBqILrow==} resolution: {integrity: sha512-kPdna0FW/X7D600aMdiZ5UTjbCo6d8d4jjauSc8RMmBwUU6WliFDSPUNKVpzm2BsDX5Nth1IXFPYMqH+wxqAmw==}
peerDependencies: peerDependencies:
dotenv: ^17 dotenv: ^17
@@ -114,201 +109,17 @@ packages:
resolution: {integrity: sha512-jLsL80wBBKkrJZrfk3SQpJ9JA/zREdlUROj7eCkmzqduAWKSI0wVcXuCKf+mLFCHB0Q0Tkh2rgzjSlurt3JQgw==} resolution: {integrity: sha512-jLsL80wBBKkrJZrfk3SQpJ9JA/zREdlUROj7eCkmzqduAWKSI0wVcXuCKf+mLFCHB0Q0Tkh2rgzjSlurt3JQgw==}
engines: {node: '>=10.0.0'} engines: {node: '>=10.0.0'}
'@opencode-ai/plugin@1.1.44': '@opencode-ai/plugin@1.1.51':
resolution: {integrity: sha512-5w66Dq2Fugwgr2yrd8obvnlIEjBOuya82UgfR/3z3EzlyNDi2sitQSYbz7CcOtwd89eZ0n/tH/JX2KDGVuzxTQ==} resolution: {integrity: sha512-FMtwIEG1HdXaQ4qtzRelF++qjKL4QKtJOB5Atud0Xu5c9T48TGCDDQJONTAjgVleyq3bb73tUt+ACBK0QSEOyw==}
'@opencode-ai/sdk@1.1.44': '@opencode-ai/sdk@1.1.51':
resolution: {integrity: sha512-coQgtSSCbY46/GY+M5zG0rChiLSJWSjPERRt5L1hbjvDWvErelVV0ILPbd1+3CwJLFTedBYgotby2TcO8U0IfQ==} resolution: {integrity: sha512-UL66X46AGgui5xURGEenXsIsgNVmgfkmJJeRtdeOMLhi/RcbTBikfPjjtmym3VLnqp855Wt7dZ/vAjOXqiUKXA==}
'@rollup/plugin-commonjs@28.0.9':
resolution: {integrity: sha512-PIR4/OHZ79romx0BVVll/PkwWpJ7e5lsqFa3gFfcrFPWwLXLV39JVUzQV9RKjWerE7B845Hqjj9VYlQeieZ2dA==}
engines: {node: '>=16.0.0 || 14 >= 14.17'}
peerDependencies:
rollup: ^2.68.0||^3.0.0||^4.0.0
peerDependenciesMeta:
rollup:
optional: true
'@rollup/plugin-node-resolve@16.0.3':
resolution: {integrity: sha512-lUYM3UBGuM93CnMPG1YocWu7X802BrNF3jW2zny5gQyLQgRFJhV1Sq0Zi74+dh/6NBx1DxFC4b4GXg9wUCG5Qg==}
engines: {node: '>=14.0.0'}
peerDependencies:
rollup: ^2.78.0||^3.0.0||^4.0.0
peerDependenciesMeta:
rollup:
optional: true
'@rollup/plugin-typescript@12.3.0':
resolution: {integrity: sha512-7DP0/p7y3t67+NabT9f8oTBFE6gGkto4SA6Np2oudYmZE/m1dt8RB0SjL1msMxFpLo631qjRCcBlAbq1ml/Big==}
engines: {node: '>=14.0.0'}
peerDependencies:
rollup: ^2.14.0||^3.0.0||^4.0.0
tslib: '*'
typescript: '>=3.7.0'
peerDependenciesMeta:
rollup:
optional: true
tslib:
optional: true
'@rollup/pluginutils@5.3.0':
resolution: {integrity: sha512-5EdhGZtnu3V88ces7s53hhfK5KSASnJZv8Lulpc04cWO3REESroJXg73DFsOmgbU2BhwV0E20bu2IDZb3VKW4Q==}
engines: {node: '>=14.0.0'}
peerDependencies:
rollup: ^1.20.0||^2.0.0||^3.0.0||^4.0.0
peerDependenciesMeta:
rollup:
optional: true
'@rollup/rollup-android-arm-eabi@4.57.0':
resolution: {integrity: sha512-tPgXB6cDTndIe1ah7u6amCI1T0SsnlOuKgg10Xh3uizJk4e5M1JGaUMk7J4ciuAUcFpbOiNhm2XIjP9ON0dUqA==}
cpu: [arm]
os: [android]
'@rollup/rollup-android-arm64@4.57.0':
resolution: {integrity: sha512-sa4LyseLLXr1onr97StkU1Nb7fWcg6niokTwEVNOO7awaKaoRObQ54+V/hrF/BP1noMEaaAW6Fg2d/CfLiq3Mg==}
cpu: [arm64]
os: [android]
'@rollup/rollup-darwin-arm64@4.57.0':
resolution: {integrity: sha512-/NNIj9A7yLjKdmkx5dC2XQ9DmjIECpGpwHoGmA5E1AhU0fuICSqSWScPhN1yLCkEdkCwJIDu2xIeLPs60MNIVg==}
cpu: [arm64]
os: [darwin]
'@rollup/rollup-darwin-x64@4.57.0':
resolution: {integrity: sha512-xoh8abqgPrPYPr7pTYipqnUi1V3em56JzE/HgDgitTqZBZ3yKCWI+7KUkceM6tNweyUKYru1UMi7FC060RyKwA==}
cpu: [x64]
os: [darwin]
'@rollup/rollup-freebsd-arm64@4.57.0':
resolution: {integrity: sha512-PCkMh7fNahWSbA0OTUQ2OpYHpjZZr0hPr8lId8twD7a7SeWrvT3xJVyza+dQwXSSq4yEQTMoXgNOfMCsn8584g==}
cpu: [arm64]
os: [freebsd]
'@rollup/rollup-freebsd-x64@4.57.0':
resolution: {integrity: sha512-1j3stGx+qbhXql4OCDZhnK7b01s6rBKNybfsX+TNrEe9JNq4DLi1yGiR1xW+nL+FNVvI4D02PUnl6gJ/2y6WJA==}
cpu: [x64]
os: [freebsd]
'@rollup/rollup-linux-arm-gnueabihf@4.57.0':
resolution: {integrity: sha512-eyrr5W08Ms9uM0mLcKfM/Uzx7hjhz2bcjv8P2uynfj0yU8GGPdz8iYrBPhiLOZqahoAMB8ZiolRZPbbU2MAi6Q==}
cpu: [arm]
os: [linux]
libc: [glibc]
'@rollup/rollup-linux-arm-musleabihf@4.57.0':
resolution: {integrity: sha512-Xds90ITXJCNyX9pDhqf85MKWUI4lqjiPAipJ8OLp8xqI2Ehk+TCVhF9rvOoN8xTbcafow3QOThkNnrM33uCFQA==}
cpu: [arm]
os: [linux]
libc: [musl]
'@rollup/rollup-linux-arm64-gnu@4.57.0':
resolution: {integrity: sha512-Xws2KA4CLvZmXjy46SQaXSejuKPhwVdaNinldoYfqruZBaJHqVo6hnRa8SDo9z7PBW5x84SH64+izmldCgbezw==}
cpu: [arm64]
os: [linux]
libc: [glibc]
'@rollup/rollup-linux-arm64-musl@4.57.0':
resolution: {integrity: sha512-hrKXKbX5FdaRJj7lTMusmvKbhMJSGWJ+w++4KmjiDhpTgNlhYobMvKfDoIWecy4O60K6yA4SnztGuNTQF+Lplw==}
cpu: [arm64]
os: [linux]
libc: [musl]
'@rollup/rollup-linux-loong64-gnu@4.57.0':
resolution: {integrity: sha512-6A+nccfSDGKsPm00d3xKcrsBcbqzCTAukjwWK6rbuAnB2bHaL3r9720HBVZ/no7+FhZLz/U3GwwZZEh6tOSI8Q==}
cpu: [loong64]
os: [linux]
libc: [glibc]
'@rollup/rollup-linux-loong64-musl@4.57.0':
resolution: {integrity: sha512-4P1VyYUe6XAJtQH1Hh99THxr0GKMMwIXsRNOceLrJnaHTDgk1FTcTimDgneRJPvB3LqDQxUmroBclQ1S0cIJwQ==}
cpu: [loong64]
os: [linux]
libc: [musl]
'@rollup/rollup-linux-ppc64-gnu@4.57.0':
resolution: {integrity: sha512-8Vv6pLuIZCMcgXre6c3nOPhE0gjz1+nZP6T+hwWjr7sVH8k0jRkH+XnfjjOTglyMBdSKBPPz54/y1gToSKwrSQ==}
cpu: [ppc64]
os: [linux]
libc: [glibc]
'@rollup/rollup-linux-ppc64-musl@4.57.0':
resolution: {integrity: sha512-r1te1M0Sm2TBVD/RxBPC6RZVwNqUTwJTA7w+C/IW5v9Ssu6xmxWEi+iJQlpBhtUiT1raJ5b48pI8tBvEjEFnFA==}
cpu: [ppc64]
os: [linux]
libc: [musl]
'@rollup/rollup-linux-riscv64-gnu@4.57.0':
resolution: {integrity: sha512-say0uMU/RaPm3CDQLxUUTF2oNWL8ysvHkAjcCzV2znxBr23kFfaxocS9qJm+NdkRhF8wtdEEAJuYcLPhSPbjuQ==}
cpu: [riscv64]
os: [linux]
libc: [glibc]
'@rollup/rollup-linux-riscv64-musl@4.57.0':
resolution: {integrity: sha512-/MU7/HizQGsnBREtRpcSbSV1zfkoxSTR7wLsRmBPQ8FwUj5sykrP1MyJTvsxP5KBq9SyE6kH8UQQQwa0ASeoQQ==}
cpu: [riscv64]
os: [linux]
libc: [musl]
'@rollup/rollup-linux-s390x-gnu@4.57.0':
resolution: {integrity: sha512-Q9eh+gUGILIHEaJf66aF6a414jQbDnn29zeu0eX3dHMuysnhTvsUvZTCAyZ6tJhUjnvzBKE4FtuaYxutxRZpOg==}
cpu: [s390x]
os: [linux]
libc: [glibc]
'@rollup/rollup-linux-x64-gnu@4.57.0':
resolution: {integrity: sha512-OR5p5yG5OKSxHReWmwvM0P+VTPMwoBS45PXTMYaskKQqybkS3Kmugq1W+YbNWArF8/s7jQScgzXUhArzEQ7x0A==}
cpu: [x64]
os: [linux]
libc: [glibc]
'@rollup/rollup-linux-x64-musl@4.57.0':
resolution: {integrity: sha512-XeatKzo4lHDsVEbm1XDHZlhYZZSQYym6dg2X/Ko0kSFgio+KXLsxwJQprnR48GvdIKDOpqWqssC3iBCjoMcMpw==}
cpu: [x64]
os: [linux]
libc: [musl]
'@rollup/rollup-openbsd-x64@4.57.0':
resolution: {integrity: sha512-Lu71y78F5qOfYmubYLHPcJm74GZLU6UJ4THkf/a1K7Tz2ycwC2VUbsqbJAXaR6Bx70SRdlVrt2+n5l7F0agTUw==}
cpu: [x64]
os: [openbsd]
'@rollup/rollup-openharmony-arm64@4.57.0':
resolution: {integrity: sha512-v5xwKDWcu7qhAEcsUubiav7r+48Uk/ENWdr82MBZZRIm7zThSxCIVDfb3ZeRRq9yqk+oIzMdDo6fCcA5DHfMyA==}
cpu: [arm64]
os: [openharmony]
'@rollup/rollup-win32-arm64-msvc@4.57.0':
resolution: {integrity: sha512-XnaaaSMGSI6Wk8F4KK3QP7GfuuhjGchElsVerCplUuxRIzdvZ7hRBpLR0omCmw+kI2RFJB80nenhOoGXlJ5TfQ==}
cpu: [arm64]
os: [win32]
'@rollup/rollup-win32-ia32-msvc@4.57.0':
resolution: {integrity: sha512-3K1lP+3BXY4t4VihLw5MEg6IZD3ojSYzqzBG571W3kNQe4G4CcFpSUQVgurYgib5d+YaCjeFow8QivWp8vuSvA==}
cpu: [ia32]
os: [win32]
'@rollup/rollup-win32-x64-gnu@4.57.0':
resolution: {integrity: sha512-MDk610P/vJGc5L5ImE4k5s+GZT3en0KoK1MKPXCRgzmksAMk79j4h3k1IerxTNqwDLxsGxStEZVBqG0gIqZqoA==}
cpu: [x64]
os: [win32]
'@rollup/rollup-win32-x64-msvc@4.57.0':
resolution: {integrity: sha512-Zv7v6q6aV+VslnpwzqKAmrk5JdVkLUzok2208ZXGipjb+msxBr/fJPZyeEXiFgH7k62Ak0SLIfxQRZQvTuf7rQ==}
cpu: [x64]
os: [win32]
'@types/bun@1.3.8': '@types/bun@1.3.8':
resolution: {integrity: sha512-3LvWJ2q5GerAXYxO2mffLTqOzEu5qnhEAlh48Vnu8WQfnmSwbgagjGZV6BoHKJztENYEDn6QmVd949W4uESRJA==} resolution: {integrity: sha512-3LvWJ2q5GerAXYxO2mffLTqOzEu5qnhEAlh48Vnu8WQfnmSwbgagjGZV6BoHKJztENYEDn6QmVd949W4uESRJA==}
'@types/estree@1.0.8': '@types/node@25.2.1':
resolution: {integrity: sha512-dWHzHa2WqEXI/O1E9OjrocMTKJl2mSrEolh1Iomrv6U+JuNwaHXsXx9bLu5gG7BUWFIN0skIQJQ/L1rIex4X6w==} resolution: {integrity: sha512-CPrnr8voK8vC6eEtyRzvMpgp3VyVRhgclonE7qYi6P9sXwYb59ucfrnmFBTaP0yUi8Gk4yZg/LlTJULGxvTNsg==}
'@types/node@25.1.0':
resolution: {integrity: sha512-t7frlewr6+cbx+9Ohpl0NOTKXZNV9xHRmNOvql47BFJKcEG1CxtxlPEEe+gR9uhVWM4DwhnvTF110mIL4yP9RA==}
'@types/resolve@1.20.2':
resolution: {integrity: sha512-60BCwRFOZCQhDncwQdxxeOEEkbc5dIMccYLwbxsS4TUNeVECQ/pBJ0j09mrHOl/JJvpRPGwO9SvE4nR2Nb/a4Q==}
'@types/ws@8.18.1': '@types/ws@8.18.1':
resolution: {integrity: sha512-ThVF6DCVhA8kUGy+aazFQ4kXQ7E1Ty7A3ypFOe0IcJV8O/M511G99AW24irKrW56Wt44yG9+ij8FaqoBGkuBXg==} resolution: {integrity: sha512-ThVF6DCVhA8kUGy+aazFQ4kXQ7E1Ty7A3ypFOe0IcJV8O/M511G99AW24irKrW56Wt44yG9+ij8FaqoBGkuBXg==}
@@ -324,9 +135,6 @@ packages:
resolution: {integrity: sha512-TQMmc3w+5AxjpL8iIiwebF73dRDF4fBIieAqGn9RGCWaEVwQ6Fb2cGe31Yns0RRIzii5goJ1Y7xbMwo1TxMplw==} resolution: {integrity: sha512-TQMmc3w+5AxjpL8iIiwebF73dRDF4fBIieAqGn9RGCWaEVwQ6Fb2cGe31Yns0RRIzii5goJ1Y7xbMwo1TxMplw==}
engines: {node: '>= 20.19.0'} engines: {node: '>= 20.19.0'}
commondir@1.0.1:
resolution: {integrity: sha512-W9pAhw0ja1Edb5GVdIF1mjZw/ASI0AlShXM83UUGe2DVr5TdAPEA1OA8m/g8zWp9x6On7gqufY+FatDbC3MDQg==}
cookie-es@1.2.2: cookie-es@1.2.2:
resolution: {integrity: sha512-+W7VmiVINB+ywl1HGXJXmrqkOhpKrIiVZV6tQuV54ZyQC7MMuBt81Vc336GMLoHBq5hV/F9eXgt5Mnx0Rha5Fg==} resolution: {integrity: sha512-+W7VmiVINB+ywl1HGXJXmrqkOhpKrIiVZV6tQuV54ZyQC7MMuBt81Vc336GMLoHBq5hV/F9eXgt5Mnx0Rha5Fg==}
@@ -336,10 +144,6 @@ packages:
dayjs@1.11.19: dayjs@1.11.19:
resolution: {integrity: sha512-t5EcLVS6QPBNqM2z8fakk/NKel+Xzshgt8FFKAn+qwlD1pzZWxh0nVCrvFK7ZDb6XucZeF9z8C7CBWTRIVApAw==} resolution: {integrity: sha512-t5EcLVS6QPBNqM2z8fakk/NKel+Xzshgt8FFKAn+qwlD1pzZWxh0nVCrvFK7ZDb6XucZeF9z8C7CBWTRIVApAw==}
deepmerge@4.3.1:
resolution: {integrity: sha512-3sUqbMEc77XqpdNO7FRyRog+eW3ph+GYCbj+rK+uYyRMuwsVy0rMiVtPn+QJlKFvWP/1PYpapqYn0Me2knFn+A==}
engines: {node: '>=0.10.0'}
defu@6.1.4: defu@6.1.4:
resolution: {integrity: sha512-mEQCMmwJu317oSz8CwdIOdwf3xMif1ttiM8LTufzc3g6kR+9Pe236twL8j3IYT1F7GfRgGcW6MWxzZjLIkuHIg==} resolution: {integrity: sha512-mEQCMmwJu317oSz8CwdIOdwf3xMif1ttiM8LTufzc3g6kR+9Pe236twL8j3IYT1F7GfRgGcW6MWxzZjLIkuHIg==}
@@ -353,63 +157,19 @@ packages:
es-toolkit@1.44.0: es-toolkit@1.44.0:
resolution: {integrity: sha512-6penXeZalaV88MM3cGkFZZfOoLGWshWWfdy0tWw/RlVVyhvMaWSBTOvXNeiW3e5FwdS5ePW0LGEu17zT139ktg==} resolution: {integrity: sha512-6penXeZalaV88MM3cGkFZZfOoLGWshWWfdy0tWw/RlVVyhvMaWSBTOvXNeiW3e5FwdS5ePW0LGEu17zT139ktg==}
estree-walker@2.0.2:
resolution: {integrity: sha512-Rfkk/Mp/DL7JVje3u18FxFujQlTNR2q6QfMSMB7AvCBx91NGj/ba3kCfza0f6dVDbw7YlRf/nDrn7pQrCCyQ/w==}
eventemitter3@5.0.1: eventemitter3@5.0.1:
resolution: {integrity: sha512-GWkBvjiSZK87ELrYOSESUYeVIc9mvLLf/nXalMOS5dYrgZq9o5OVkbZAVM06CVxYsCwH9BDZFPlQTlPA1j4ahA==} resolution: {integrity: sha512-GWkBvjiSZK87ELrYOSESUYeVIc9mvLLf/nXalMOS5dYrgZq9o5OVkbZAVM06CVxYsCwH9BDZFPlQTlPA1j4ahA==}
fdir@6.5.0:
resolution: {integrity: sha512-tIbYtZbucOs0BRGqPJkshJUYdL+SDH7dVM8gjy+ERp3WAUjLEFJE+02kanyHtwjWOnwrKYBiwAmM0p4kLJAnXg==}
engines: {node: '>=12.0.0'}
peerDependencies:
picomatch: ^3 || ^4
peerDependenciesMeta:
picomatch:
optional: true
fsevents@2.3.3:
resolution: {integrity: sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==}
engines: {node: ^8.16.0 || ^10.6.0 || >=11.0.0}
os: [darwin]
function-bind@1.1.2:
resolution: {integrity: sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==}
h3@1.15.5: h3@1.15.5:
resolution: {integrity: sha512-xEyq3rSl+dhGX2Lm0+eFQIAzlDN6Fs0EcC4f7BNUmzaRX/PTzeuM+Tr2lHB8FoXggsQIeXLj8EDVgs5ywxyxmg==} resolution: {integrity: sha512-xEyq3rSl+dhGX2Lm0+eFQIAzlDN6Fs0EcC4f7BNUmzaRX/PTzeuM+Tr2lHB8FoXggsQIeXLj8EDVgs5ywxyxmg==}
hasown@2.0.2:
resolution: {integrity: sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ==}
engines: {node: '>= 0.4'}
hono@4.11.7:
resolution: {integrity: sha512-l7qMiNee7t82bH3SeyUCt9UF15EVmaBvsppY2zQtrbIhl/yzBTny+YUxsVjSjQ6gaqaeVtZmGocom8TzBlA4Yw==}
engines: {node: '>=16.9.0'}
iron-webcrypto@1.2.1: iron-webcrypto@1.2.1:
resolution: {integrity: sha512-feOM6FaSr6rEABp/eDfVseKyTMDt+KGpeB35SkVn9Tyn0CqvVsY3EwI0v5i8nMHyJnzCIQf7nsy3p41TPkJZhg==} resolution: {integrity: sha512-feOM6FaSr6rEABp/eDfVseKyTMDt+KGpeB35SkVn9Tyn0CqvVsY3EwI0v5i8nMHyJnzCIQf7nsy3p41TPkJZhg==}
is-core-module@2.16.1:
resolution: {integrity: sha512-UfoeMA6fIJ8wTYFEUjelnaGI67v6+N7qXJEvQuIGa99l4xsCruSYOVSQ0uPANn4dAzm8lkYPaKLrrijLq7x23w==}
engines: {node: '>= 0.4'}
is-module@1.0.0:
resolution: {integrity: sha512-51ypPSPCoTEIN9dy5Oy+h4pShgJmPCygKfyRCISBI+JoWT/2oJvK8QPxmwv7b/p239jXrm9M1mlQbyKJ5A152g==}
is-reference@1.2.1:
resolution: {integrity: sha512-U82MsXXiFIrjCK4otLT+o2NA2Cd2g5MLoOVXUZjIOhLurrRxpEXzI8O0KZHr3IjLvlAH1kTPYSuqer5T9ZVBKQ==}
js-tokens@4.0.0:
resolution: {integrity: sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==}
lru-cache@11.2.5: lru-cache@11.2.5:
resolution: {integrity: sha512-vFrFJkWtJvJnD5hg+hJvVE8Lh/TcMzKnTgCWmtBipwI5yLX/iX+5UB2tfuyODF5E7k9xEzMdYgGqaSb1c0c5Yw==} resolution: {integrity: sha512-vFrFJkWtJvJnD5hg+hJvVE8Lh/TcMzKnTgCWmtBipwI5yLX/iX+5UB2tfuyODF5E7k9xEzMdYgGqaSb1c0c5Yw==}
engines: {node: 20 || >=22} engines: {node: 20 || >=22}
magic-string@0.30.21:
resolution: {integrity: sha512-vd2F4YUyEXKGcLHoq+TEyCjxueSeHnFxyyjNp80yg0XV4vUhnDer/lvvlqM/arB5bXQN5K2/3oinyCRyx8T2CQ==}
nanoid@5.1.6: nanoid@5.1.6:
resolution: {integrity: sha512-c7+7RQ+dMB5dPwwCp4ee1/iV/q2P6aK1mTZcfr1BTuVlyW9hJYiMPybJCcnBlQtuSmTIWNeazm/zqNoZSSElBg==} resolution: {integrity: sha512-c7+7RQ+dMB5dPwwCp4ee1/iV/q2P6aK1mTZcfr1BTuVlyW9hJYiMPybJCcnBlQtuSmTIWNeazm/zqNoZSSElBg==}
engines: {node: ^18 || >=20} engines: {node: ^18 || >=20}
@@ -428,20 +188,10 @@ packages:
ofetch@1.5.1: ofetch@1.5.1:
resolution: {integrity: sha512-2W4oUZlVaqAPAil6FUg/difl6YhqhUR7x2eZY4bQCko22UXg3hptq9KLQdqFClV+Wu85UX7hNtdGTngi/1BxcA==} resolution: {integrity: sha512-2W4oUZlVaqAPAil6FUg/difl6YhqhUR7x2eZY4bQCko22UXg3hptq9KLQdqFClV+Wu85UX7hNtdGTngi/1BxcA==}
path-parse@1.0.7:
resolution: {integrity: sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==}
picocolors@1.1.1:
resolution: {integrity: sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==}
picomatch@2.3.1: picomatch@2.3.1:
resolution: {integrity: sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==} resolution: {integrity: sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==}
engines: {node: '>=8.6'} engines: {node: '>=8.6'}
picomatch@4.0.3:
resolution: {integrity: sha512-5gTmgEY/sqK6gFXLIsQNH19lWb4ebPDLA4SdLP7dsWkIXHWlG66oPuVvXSGFPppYZz8ZDZq0dYYrbHfBCVUb1Q==}
engines: {node: '>=12'}
radix3@1.1.2: radix3@1.1.2:
resolution: {integrity: sha512-b484I/7b8rDEdSDKckSSBA8knMpcdsXudlE/LNL639wFoHKwLbEkQFZHWEYwDC0wa0FKUcCY+GAF73Z7wxNVFA==} resolution: {integrity: sha512-b484I/7b8rDEdSDKckSSBA8knMpcdsXudlE/LNL639wFoHKwLbEkQFZHWEYwDC0wa0FKUcCY+GAF73Z7wxNVFA==}
@@ -449,35 +199,9 @@ packages:
resolution: {integrity: sha512-9u/XQ1pvrQtYyMpZe7DXKv2p5CNvyVwzUB6uhLAnQwHMSgKMBR62lc7AHljaeteeHXn11XTAaLLUVZYVZyuRBQ==} resolution: {integrity: sha512-9u/XQ1pvrQtYyMpZe7DXKv2p5CNvyVwzUB6uhLAnQwHMSgKMBR62lc7AHljaeteeHXn11XTAaLLUVZYVZyuRBQ==}
engines: {node: '>= 20.19.0'} engines: {node: '>= 20.19.0'}
resolve@1.22.11:
resolution: {integrity: sha512-RfqAvLnMl313r7c9oclB1HhUEAezcpLjz95wFH4LVuhk9JF/r22qmVP9AMmOU4vMX7Q8pN8jwNg/CSpdFnMjTQ==}
engines: {node: '>= 0.4'}
hasBin: true
rollup-plugin-dts@6.3.0:
resolution: {integrity: sha512-d0UrqxYd8KyZ6i3M2Nx7WOMy708qsV/7fTHMHxCMCBOAe3V/U7OMPu5GkX8hC+cmkHhzGnfeYongl1IgiooddA==}
engines: {node: '>=16'}
peerDependencies:
rollup: ^3.29.4 || ^4
typescript: ^4.5 || ^5.0
rollup@4.57.0:
resolution: {integrity: sha512-e5lPJi/aui4TO1LpAXIRLySmwXSE8k3b9zoGfd42p67wzxog4WHjiZF3M2uheQih4DGyc25QEV4yRBbpueNiUA==}
engines: {node: '>=18.0.0', npm: '>=8.0.0'}
hasBin: true
supports-preserve-symlinks-flag@1.0.0:
resolution: {integrity: sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==}
engines: {node: '>= 0.4'}
tslib@2.8.1: tslib@2.8.1:
resolution: {integrity: sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==} resolution: {integrity: sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==}
typescript@5.9.3:
resolution: {integrity: sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw==}
engines: {node: '>=14.17'}
hasBin: true
ufo@1.6.3: ufo@1.6.3:
resolution: {integrity: sha512-yDJTmhydvl5lJzBmy/hyOAA0d+aqCBuwl818haVdYCRrWV84o7YyeVm4QlVHStqNrrJSTb6jKuFAVqAFsr+K3Q==} resolution: {integrity: sha512-yDJTmhydvl5lJzBmy/hyOAA0d+aqCBuwl818haVdYCRrWV84o7YyeVm4QlVHStqNrrJSTb6jKuFAVqAFsr+K3Q==}
@@ -554,36 +278,15 @@ packages:
snapshots: snapshots:
'@babel/code-frame@7.28.6':
dependencies:
'@babel/helper-validator-identifier': 7.28.5
js-tokens: 4.0.0
picocolors: 1.1.1
optional: true
'@babel/helper-validator-identifier@7.28.5':
optional: true
'@jridgewell/sourcemap-codec@1.5.5': {}
'@kevisual/ai@0.0.24': '@kevisual/ai@0.0.24':
dependencies: dependencies:
'@kevisual/logger': 0.0.4 '@kevisual/logger': 0.0.4
'@kevisual/permission': 0.0.3 '@kevisual/permission': 0.0.3
'@kevisual/query': 0.0.38 '@kevisual/query': 0.0.38
'@kevisual/context@0.0.4': {} '@kevisual/code-builder@0.0.6': {}
'@kevisual/dts@0.0.3(typescript@5.9.3)': '@kevisual/context@0.0.4': {}
dependencies:
'@rollup/plugin-commonjs': 28.0.9(rollup@4.57.0)
'@rollup/plugin-node-resolve': 16.0.3(rollup@4.57.0)
'@rollup/plugin-typescript': 12.3.0(rollup@4.57.0)(tslib@2.8.1)(typescript@5.9.3)
rollup: 4.57.0
rollup-plugin-dts: 6.3.0(rollup@4.57.0)(typescript@5.9.3)
tslib: 2.8.1
transitivePeerDependencies:
- typescript
'@kevisual/load@0.0.6': '@kevisual/load@0.0.6':
dependencies: dependencies:
@@ -597,158 +300,41 @@ snapshots:
dependencies: dependencies:
tslib: 2.8.1 tslib: 2.8.1
'@kevisual/router@0.0.64(typescript@5.9.3)': '@kevisual/query@0.0.39':
dependencies: dependencies:
'@kevisual/dts': 0.0.3(typescript@5.9.3) tslib: 2.8.1
hono: 4.11.7
transitivePeerDependencies: '@kevisual/router@0.0.70':
- typescript dependencies:
es-toolkit: 1.44.0
'@kevisual/types@0.0.12': {} '@kevisual/types@0.0.12': {}
'@kevisual/use-config@1.0.28(dotenv@17.2.3)': '@kevisual/use-config@1.0.30(dotenv@17.2.3)':
dependencies: dependencies:
'@kevisual/load': 0.0.6 '@kevisual/load': 0.0.6
dotenv: 17.2.3 dotenv: 17.2.3
'@kevisual/ws@8.19.0': {} '@kevisual/ws@8.19.0': {}
'@opencode-ai/plugin@1.1.44': '@opencode-ai/plugin@1.1.51':
dependencies: dependencies:
'@opencode-ai/sdk': 1.1.44 '@opencode-ai/sdk': 1.1.51
zod: 4.3.6 zod: 4.3.6
'@opencode-ai/sdk@1.1.44': {} '@opencode-ai/sdk@1.1.51': {}
'@rollup/plugin-commonjs@28.0.9(rollup@4.57.0)':
dependencies:
'@rollup/pluginutils': 5.3.0(rollup@4.57.0)
commondir: 1.0.1
estree-walker: 2.0.2
fdir: 6.5.0(picomatch@4.0.3)
is-reference: 1.2.1
magic-string: 0.30.21
picomatch: 4.0.3
optionalDependencies:
rollup: 4.57.0
'@rollup/plugin-node-resolve@16.0.3(rollup@4.57.0)':
dependencies:
'@rollup/pluginutils': 5.3.0(rollup@4.57.0)
'@types/resolve': 1.20.2
deepmerge: 4.3.1
is-module: 1.0.0
resolve: 1.22.11
optionalDependencies:
rollup: 4.57.0
'@rollup/plugin-typescript@12.3.0(rollup@4.57.0)(tslib@2.8.1)(typescript@5.9.3)':
dependencies:
'@rollup/pluginutils': 5.3.0(rollup@4.57.0)
resolve: 1.22.11
typescript: 5.9.3
optionalDependencies:
rollup: 4.57.0
tslib: 2.8.1
'@rollup/pluginutils@5.3.0(rollup@4.57.0)':
dependencies:
'@types/estree': 1.0.8
estree-walker: 2.0.2
picomatch: 4.0.3
optionalDependencies:
rollup: 4.57.0
'@rollup/rollup-android-arm-eabi@4.57.0':
optional: true
'@rollup/rollup-android-arm64@4.57.0':
optional: true
'@rollup/rollup-darwin-arm64@4.57.0':
optional: true
'@rollup/rollup-darwin-x64@4.57.0':
optional: true
'@rollup/rollup-freebsd-arm64@4.57.0':
optional: true
'@rollup/rollup-freebsd-x64@4.57.0':
optional: true
'@rollup/rollup-linux-arm-gnueabihf@4.57.0':
optional: true
'@rollup/rollup-linux-arm-musleabihf@4.57.0':
optional: true
'@rollup/rollup-linux-arm64-gnu@4.57.0':
optional: true
'@rollup/rollup-linux-arm64-musl@4.57.0':
optional: true
'@rollup/rollup-linux-loong64-gnu@4.57.0':
optional: true
'@rollup/rollup-linux-loong64-musl@4.57.0':
optional: true
'@rollup/rollup-linux-ppc64-gnu@4.57.0':
optional: true
'@rollup/rollup-linux-ppc64-musl@4.57.0':
optional: true
'@rollup/rollup-linux-riscv64-gnu@4.57.0':
optional: true
'@rollup/rollup-linux-riscv64-musl@4.57.0':
optional: true
'@rollup/rollup-linux-s390x-gnu@4.57.0':
optional: true
'@rollup/rollup-linux-x64-gnu@4.57.0':
optional: true
'@rollup/rollup-linux-x64-musl@4.57.0':
optional: true
'@rollup/rollup-openbsd-x64@4.57.0':
optional: true
'@rollup/rollup-openharmony-arm64@4.57.0':
optional: true
'@rollup/rollup-win32-arm64-msvc@4.57.0':
optional: true
'@rollup/rollup-win32-ia32-msvc@4.57.0':
optional: true
'@rollup/rollup-win32-x64-gnu@4.57.0':
optional: true
'@rollup/rollup-win32-x64-msvc@4.57.0':
optional: true
'@types/bun@1.3.8': '@types/bun@1.3.8':
dependencies: dependencies:
bun-types: 1.3.8 bun-types: 1.3.8
'@types/estree@1.0.8': {} '@types/node@25.2.1':
'@types/node@25.1.0':
dependencies: dependencies:
undici-types: 7.16.0 undici-types: 7.16.0
'@types/resolve@1.20.2': {}
'@types/ws@8.18.1': '@types/ws@8.18.1':
dependencies: dependencies:
'@types/node': 25.1.0 '@types/node': 25.2.1
anymatch@3.1.3: anymatch@3.1.3:
dependencies: dependencies:
@@ -757,14 +343,12 @@ snapshots:
bun-types@1.3.8: bun-types@1.3.8:
dependencies: dependencies:
'@types/node': 25.1.0 '@types/node': 25.2.1
chokidar@5.0.0: chokidar@5.0.0:
dependencies: dependencies:
readdirp: 5.0.0 readdirp: 5.0.0
commondir@1.0.1: {}
cookie-es@1.2.2: {} cookie-es@1.2.2: {}
crossws@0.3.5: crossws@0.3.5:
@@ -773,8 +357,6 @@ snapshots:
dayjs@1.11.19: {} dayjs@1.11.19: {}
deepmerge@4.3.1: {}
defu@6.1.4: {} defu@6.1.4: {}
destr@2.0.5: {} destr@2.0.5: {}
@@ -783,19 +365,8 @@ snapshots:
es-toolkit@1.44.0: {} es-toolkit@1.44.0: {}
estree-walker@2.0.2: {}
eventemitter3@5.0.1: {} eventemitter3@5.0.1: {}
fdir@6.5.0(picomatch@4.0.3):
optionalDependencies:
picomatch: 4.0.3
fsevents@2.3.3:
optional: true
function-bind@1.1.2: {}
h3@1.15.5: h3@1.15.5:
dependencies: dependencies:
cookie-es: 1.2.2 cookie-es: 1.2.2
@@ -808,33 +379,10 @@ snapshots:
ufo: 1.6.3 ufo: 1.6.3
uncrypto: 0.1.3 uncrypto: 0.1.3
hasown@2.0.2:
dependencies:
function-bind: 1.1.2
hono@4.11.7: {}
iron-webcrypto@1.2.1: {} iron-webcrypto@1.2.1: {}
is-core-module@2.16.1:
dependencies:
hasown: 2.0.2
is-module@1.0.0: {}
is-reference@1.2.1:
dependencies:
'@types/estree': 1.0.8
js-tokens@4.0.0:
optional: true
lru-cache@11.2.5: {} lru-cache@11.2.5: {}
magic-string@0.30.21:
dependencies:
'@jridgewell/sourcemap-codec': 1.5.5
nanoid@5.1.6: {} nanoid@5.1.6: {}
node-fetch-native@1.6.7: {} node-fetch-native@1.6.7: {}
@@ -849,70 +397,14 @@ snapshots:
node-fetch-native: 1.6.7 node-fetch-native: 1.6.7
ufo: 1.6.3 ufo: 1.6.3
path-parse@1.0.7: {}
picocolors@1.1.1:
optional: true
picomatch@2.3.1: {} picomatch@2.3.1: {}
picomatch@4.0.3: {}
radix3@1.1.2: {} radix3@1.1.2: {}
readdirp@5.0.0: {} readdirp@5.0.0: {}
resolve@1.22.11:
dependencies:
is-core-module: 2.16.1
path-parse: 1.0.7
supports-preserve-symlinks-flag: 1.0.0
rollup-plugin-dts@6.3.0(rollup@4.57.0)(typescript@5.9.3):
dependencies:
magic-string: 0.30.21
rollup: 4.57.0
typescript: 5.9.3
optionalDependencies:
'@babel/code-frame': 7.28.6
rollup@4.57.0:
dependencies:
'@types/estree': 1.0.8
optionalDependencies:
'@rollup/rollup-android-arm-eabi': 4.57.0
'@rollup/rollup-android-arm64': 4.57.0
'@rollup/rollup-darwin-arm64': 4.57.0
'@rollup/rollup-darwin-x64': 4.57.0
'@rollup/rollup-freebsd-arm64': 4.57.0
'@rollup/rollup-freebsd-x64': 4.57.0
'@rollup/rollup-linux-arm-gnueabihf': 4.57.0
'@rollup/rollup-linux-arm-musleabihf': 4.57.0
'@rollup/rollup-linux-arm64-gnu': 4.57.0
'@rollup/rollup-linux-arm64-musl': 4.57.0
'@rollup/rollup-linux-loong64-gnu': 4.57.0
'@rollup/rollup-linux-loong64-musl': 4.57.0
'@rollup/rollup-linux-ppc64-gnu': 4.57.0
'@rollup/rollup-linux-ppc64-musl': 4.57.0
'@rollup/rollup-linux-riscv64-gnu': 4.57.0
'@rollup/rollup-linux-riscv64-musl': 4.57.0
'@rollup/rollup-linux-s390x-gnu': 4.57.0
'@rollup/rollup-linux-x64-gnu': 4.57.0
'@rollup/rollup-linux-x64-musl': 4.57.0
'@rollup/rollup-openbsd-x64': 4.57.0
'@rollup/rollup-openharmony-arm64': 4.57.0
'@rollup/rollup-win32-arm64-msvc': 4.57.0
'@rollup/rollup-win32-ia32-msvc': 4.57.0
'@rollup/rollup-win32-x64-gnu': 4.57.0
'@rollup/rollup-win32-x64-msvc': 4.57.0
fsevents: 2.3.3
supports-preserve-symlinks-flag@1.0.0: {}
tslib@2.8.1: {} tslib@2.8.1: {}
typescript@5.9.3: {}
ufo@1.6.3: {} ufo@1.6.3: {}
uncrypto@0.1.3: {} uncrypto@0.1.3: {}

View File

@@ -3,7 +3,7 @@ import { CNBCore, CNBCoreOptions, RequestOptions, Result } from "../cnb-core.ts"
class AiBase extends CNBCore { class AiBase extends CNBCore {
group: string; group: string;
constructor(options: CNBCoreOptions) { constructor(options: CNBCoreOptions) {
super({ token: options.token, cookie: options.cookie }); super(options);
} }
autoPr(repo: string, data: { body: string, branch?: string, title: string }): Promise<Result<any>> { autoPr(repo: string, data: { body: string, branch?: string, title: string }): Promise<Result<any>> {
const url = `/${repo}/-/build/ai/auto-pr`; const url = `/${repo}/-/build/ai/auto-pr`;

View File

@@ -3,7 +3,7 @@ import { CNBCore, CNBCoreOptions, RequestOptions, Result } from "../cnb-core.ts"
export class Build extends CNBCore { export class Build extends CNBCore {
constructor(options: CNBCoreOptions ) { constructor(options: CNBCoreOptions ) {
super({ token: options.token, cookie: options.cookie }); super(options);
} }
startBuild(repo: string, data: StartBuildData): Promise<any> { startBuild(repo: string, data: StartBuildData): Promise<any> {
const url = `/${repo}/-/build/start`; const url = `/${repo}/-/build/start`;

View File

@@ -5,6 +5,9 @@ export type CNBCoreOptions<T = {}> = {
*/ */
cookie?: string; cookie?: string;
cnb?: CNBCore; cnb?: CNBCore;
cors?: {
baseUrl?: string
}
} & T; } & T;
export type RequestOptions = { export type RequestOptions = {
@@ -17,10 +20,14 @@ export type RequestOptions = {
useCookie?: boolean; useCookie?: boolean;
useOrigin?: boolean; useOrigin?: boolean;
}; };
const API_BASER_URL = 'https://api.cnb.cool'
const API_HACK_URL = 'https://cnb.cool'
export class CNBCore { export class CNBCore {
baseURL = 'https://api.cnb.cool'; baseURL = API_BASER_URL;
hackURL = API_HACK_URL;
public token: string; public token: string;
public cookie?: string; public cookie?: string;
isCors: boolean;
constructor(options: CNBCoreOptions) { constructor(options: CNBCoreOptions) {
this.token = options.token; this.token = options.token;
this.cookie = options.cookie; this.cookie = options.cookie;
@@ -32,6 +39,11 @@ export class CNBCore {
this.cookie = options.cnb.cookie; this.cookie = options.cnb.cookie;
} }
} }
if (options?.cors?.baseUrl) {
this.baseURL = options.cors.baseUrl + '/' + API_BASER_URL.replace('https://', '');
this.hackURL = options.cors.baseUrl + '/' + API_HACK_URL.replace('https://', '');
}
this.isCors = !!options?.cors?.baseUrl;
} }
async request({ url, method = 'GET', data, params, headers, body, useCookie, useOrigin }: RequestOptions): Promise<any> { async request({ url, method = 'GET', data, params, headers, body, useCookie, useOrigin }: RequestOptions): Promise<any> {
@@ -60,10 +72,14 @@ export class CNBCore {
delete _headers.Authorization; delete _headers.Authorization;
} }
if (useCookie) { if (useCookie) {
if (this.isCors) {
_headers['app-cookie'] = this.cookie || "";
} else {
_headers['Cookie'] = this.cookie || ""; _headers['Cookie'] = this.cookie || "";
}
delete _headers.Authorization; delete _headers.Authorization;
} }
// console.log('Request URL:', url, data, _headers); console.log('Request URL:', url, data, _headers);
const response = await fetch(url || '', { const response = await fetch(url || '', {
method, method,
headers: _headers, headers: _headers,
@@ -99,7 +115,11 @@ export class CNBCore {
if (url && url.startsWith('http')) { if (url && url.startsWith('http')) {
return url; return url;
} }
return new URL(url || '', this.baseURL).toString(); console.log('url', url, this.baseURL)
if (url.startsWith('/')) {
return this.baseURL + url;
}
return this.baseURL + '/' + url;
} }
get<T = any>({ url, ...REST }: RequestOptions): Promise<T> { get<T = any>({ url, ...REST }: RequestOptions): Promise<T> {
const fullUrl = this.makeUrl(url); const fullUrl = this.makeUrl(url);

676
src/git/index.ts Normal file
View File

@@ -0,0 +1,676 @@
import { CNBCore, CNBCoreOptions, Result } from "../cnb-core.ts";
/**
* Git 提交信息
*/
export type Commit = {
sha: string;
short_sha: string;
title: string;
message: string;
author: {
name: string;
email: string;
username: string;
avatar_url: string;
};
committer: {
name: string;
email: string;
username: string;
avatar_url: string;
};
parents: Array<{ sha: string }>;
created_at: string;
};
/**
* Git 分支信息
*/
export type Branch = {
name: string;
commit: {
sha: string;
url: string;
};
};
/**
* Git 分支详细信息
*/
export type BranchDetail = Branch & {
protected: boolean;
default: boolean;
};
/**
* Git 标签信息
*/
export type Tag = {
name: string;
commit: {
sha: string;
url: string;
};
message: string;
annotation: Record<string, any>;
created_at: string;
};
/**
* Git 文件内容信息
*/
export type Content = {
name: string;
path: string;
sha: string;
size: number;
url: string;
html_url: string;
git_url: string;
download_url: string;
type: string;
content?: string;
encoding?: string;
};
/**
* Git Blob 对象
*/
export type Blob = {
sha: string;
size: number;
url: string;
content?: string;
};
/**
* Git 比较结果
*/
export type CompareResponse = {
status: string;
ahead_by: number;
behind_by: number;
total_commits: number;
commits: Commit[];
files: Array<{
sha: string;
filename: string;
status: string;
additions: number;
deletions: number;
changes: number;
patch?: string;
}>;
};
/**
* Git 提交状态
*/
export type CommitStatus = {
id: string;
state: string;
description: string;
target_url: string;
context: string;
created_at: string;
updated_at: string;
};
/**
* Git 提交附件
*/
export type CommitAsset = {
id: string;
name: string;
path: string;
sha1: string;
size: number;
created_at: string;
uploader: {
username: string;
nickname: string;
avatar_url: string;
};
};
/**
* Git 提交附件上传 URL
*/
export type CommitAssetUploadURL = {
upload_url: string;
verify_url: string;
upload_token: string;
};
/**
* Git 标签注释
*/
export type TagAnnotation = {
key: string;
value: string;
creator: string;
created_at: string;
};
/**
* Git 头引用
*/
export type HeadRef = {
default_branch: string;
};
/**
* Git 操作类
* 提供 Git 相关的 API 操作,包括提交、分支、标签、文件等
*/
export class Git extends CNBCore {
constructor(options: CNBCoreOptions) {
super(options);
}
/**
* 查询提交列表
* @param repo 仓库名称,格式:组织名称/仓库名称
* @param params 查询参数
* @returns 提交列表
*/
async listCommits(repo: string, params?: ListCommitsParams): Promise<Result<Commit[]>> {
const url = `/${repo}/-/git/commits`;
return this.get({ url, params });
}
/**
* 查询指定提交
* @param repo 仓库名称,格式:组织名称/仓库名称
* @param ref 提交的哈希值或分支名称
* @returns 提交信息
*/
async getCommit(repo: string, ref: string): Promise<Result<Commit>> {
const url = `/${repo}/-/git/commits/${ref}`;
return this.get({ url });
}
/**
* 查询指定提交的提交状态
* @param repo 仓库名称,格式:组织名称/仓库名称
* @param commitish Git 引用标识符,分支名称、提交哈希值或标签名称
* @returns 提交状态列表
*/
async getCommitStatuses(repo: string, commitish: string): Promise<Result<CommitStatus[]>> {
const url = `/${repo}/-/git/commit-statuses/${commitish}`;
return this.get({ url });
}
/**
* 查询分支列表
* @param repo 仓库名称,格式:组织名称/仓库名称
* @param params 分页参数
* @returns 分支列表
*/
async listBranches(repo: string, params?: PaginationParams): Promise<Result<Branch[]>> {
const url = `/${repo}/-/git/branches`;
return this.get({ url, params });
}
/**
* 创建新分支
* @param repo 仓库名称,格式:组织名称/仓库名称
* @param data 创建分支的数据
* @returns 创建结果
*/
async createBranch(repo: string, data: CreateBranchData): Promise<Result<void>> {
const url = `/${repo}/-/git/branches`;
return this.post({ url, data });
}
/**
* 查询指定分支
* @param repo 仓库名称,格式:组织名称/仓库名称
* @param branch 分支名称
* @returns 分支详细信息
*/
async getBranch(repo: string, branch: string): Promise<Result<BranchDetail>> {
const url = `/${repo}/-/git/branches/${branch}`;
return this.get({ url });
}
/**
* 删除指定分支
* @param repo 仓库名称,格式:组织名称/仓库名称
* @param branch 分支名称
* @returns 删除结果
*/
async deleteBranch(repo: string, branch: string): Promise<Result<void>> {
const url = `/${repo}/-/git/branches/${branch}`;
return this.delete({ url });
}
/**
* 查询标签列表
* @param repo 仓库名称,格式:组织名称/仓库名称
* @param params 分页参数
* @returns 标签列表
*/
async listTags(repo: string, params?: PaginationParams): Promise<Result<Tag[]>> {
const url = `/${repo}/-/git/tags`;
return this.get({ url, params });
}
/**
* 创建标签
* @param repo 仓库名称,格式:组织名称/仓库名称
* @param data 创建标签的数据
* @returns 创建的标签信息
*/
async createTag(repo: string, data: CreateTagData): Promise<Result<Tag>> {
const url = `/${repo}/-/git/tags`;
return this.post({ url, data });
}
/**
* 查询指定标签
* @param repo 仓库名称,格式:组织名称/仓库名称
* @param tag 标签名称
* @returns 标签信息
*/
async getTag(repo: string, tag: string): Promise<Result<Tag>> {
const url = `/${repo}/-/git/tags/${tag}`;
return this.get({ url });
}
/**
* 删除指定标签
* @param repo 仓库名称,格式:组织名称/仓库名称
* @param tag 标签名称
* @returns 删除结果
*/
async deleteTag(repo: string, tag: string): Promise<Result<void>> {
const url = `/${repo}/-/git/tags/${tag}`;
return this.delete({ url });
}
/**
* 创建 Blob 对象
* @param repo 仓库名称,格式:组织名称/仓库名称
* @param data 创建 Blob 的数据
* @returns 创建的 Blob 信息
*/
async createBlob(repo: string, data: CreateBlobData): Promise<Result<Blob>> {
const url = `/${repo}/-/git/blobs`;
return this.post({ url, data });
}
/**
* 查询仓库文件内容(根目录)
* @param repo 仓库名称,格式:组织名称/仓库名称
* @param params 查询参数
* @returns 文件或目录内容
*/
async getContent(repo: string, params?: GetContentParams): Promise<Result<Content>> {
const url = `/${repo}/-/git/contents`;
return this.get({ url, params });
}
/**
* 查询指定路径的文件内容
* @param repo 仓库名称,格式:组织名称/仓库名称
* @param filePath 文件路径
* @param params 查询参数
* @returns 文件内容
*/
async getContentWithPath(repo: string, filePath: string, params?: GetContentWithPathParams): Promise<Result<Content>> {
const url = `/${repo}/-/git/contents/${filePath}`;
return this.get({ url, params });
}
/**
* 获取原始文件内容
* @param repo 仓库名称,格式:组织名称/仓库名称
* @param refWithPath Git 引用(分支、标签、提交哈希)和文件路径
* @param params 查询参数
* @returns 原始文件内容
*/
async getRaw(repo: string, refWithPath: string, params?: GetRawParams): Promise<string> {
const url = `/${repo}/-/git/raw/${refWithPath}`;
const response = await this.get({ url, params, useOrigin: true });
return response;
}
/**
* 下载仓库内容归档
* @param repo 仓库名称,格式:组织名称/仓库名称
* @param refWithPath Git 引用(分支名、标签名、提交哈希或分支名/文件路径)
* @param useOrigin 是否返回原始响应
* @returns 归档文件
*/
async getArchive(repo: string, refWithPath: string, useOrigin?: boolean): Promise<any> {
const url = `/${repo}/-/git/archive/${refWithPath}`;
return this.get({ url, useOrigin });
}
/**
* 打包下载提交变更文件
* @param repo 仓库名称,格式:组织名称/仓库名称
* @param sha1 提交的哈希值
* @returns 变更文件归档
*/
async getArchiveCommitChangedFiles(repo: string, sha1: string): Promise<any> {
const url = `/${repo}/-/git/archive-commit-changed-files/${sha1}`;
return this.get({ url, useOrigin: true });
}
/**
* 打包下载两次引用之间的变更文件
* @param repo 仓库名称,格式:组织名称/仓库名称
* @param baseHead 用于 Git 比较操作的基准和头部分支或提交的 SHA 值格式base...head
* @returns 变更文件归档
*/
async getArchiveCompareChangedFiles(repo: string, baseHead: string): Promise<any> {
const url = `/${repo}/-/git/archive-compare-changed-files/${baseHead}`;
return this.get({ url, useOrigin: true });
}
/**
* 查询指定提交的元数据
* @param repo 仓库名称,格式:组织名称/仓库名称
* @param sha 提交的哈希值
* @returns 提交元数据列表
*/
async getCommitAnnotations(repo: string, sha: string): Promise<Result<TagAnnotation[]>> {
const url = `/${repo}/-/git/commit-annotations/${sha}`;
return this.get({ url });
}
/**
* 设定指定提交的元数据
* @param repo 仓库名称,格式:组织名称/仓库名称
* @param sha 提交的哈希值
* @param data 提交的元数据
* @returns 设置结果
*/
async putCommitAnnotations(repo: string, sha: string, data: PutCommitAnnotationsData): Promise<Result<void>> {
const url = `/${repo}/-/git/commit-annotations/${sha}`;
return this.put({ url, data });
}
/**
* 删除指定提交的元数据
* @param repo 仓库名称,格式:组织名称/仓库名称
* @param sha 提交的哈希值
* @param key 提交的元数据键名
* @returns 删除结果
*/
async deleteCommitAnnotation(repo: string, sha: string, key: string): Promise<Result<void>> {
const url = `/${repo}/-/git/commit-annotations/${sha}/${key}`;
return this.delete({ url });
}
/**
* 批量查询提交的元数据
* @param repo 仓库名称,格式:组织名称/仓库名称
* @param data 包含多个提交哈希的请求数据
* @returns 提交元数据列表
*/
async getCommitAnnotationsInBatch(repo: string, data: GetCommitAnnotationsInBatchData): Promise<Result<TagAnnotation[]>> {
const url = `/${repo}/-/git/commit-annotations-in-batch`;
return this.post({ url, data });
}
/**
* 查询指定提交的附件列表
* @param repo 仓库名称,格式:组织名称/仓库名称
* @param sha1 提交的哈希值
* @returns 附件列表
*/
async getCommitAssetsBySha(repo: string, sha1: string): Promise<Result<CommitAsset[]>> {
const url = `/${repo}/-/git/commit-assets/${sha1}`;
return this.get({ url });
}
/**
* 新增提交附件(获取上传 URL
* @param repo 仓库名称,格式:组织名称/仓库名称
* @param sha1 提交的哈希值
* @param data 创建附件上传 URL 的数据
* @returns 上传 URL 信息
*/
async postCommitAssetUploadURL(repo: string, sha1: string, data: PostCommitAssetUploadURLData): Promise<Result<CommitAssetUploadURL>> {
const url = `/${repo}/-/git/commit-assets/${sha1}/asset-upload-url`;
return this.post({ url, data });
}
/**
* 确认提交附件上传完成
* @param repo 仓库名称,格式:组织名称/仓库名称
* @param sha1 提交的哈希值
* @param uploadToken 上传令牌
* @param assetPath 附件路径
* @param params 确认参数
* @returns 确认结果
*/
async postCommitAssetUploadConfirmation(repo: string, sha1: string, uploadToken: string, assetPath: string, params?: PostCommitAssetUploadConfirmationParams): Promise<Result<void>> {
const url = `/${repo}/-/git/commit-assets/${sha1}/asset-upload-confirmation/${uploadToken}/${assetPath}`;
return this.post({ url, params });
}
/**
* 删除指定提交的附件
* @param repo 仓库名称,格式:组织名称/仓库名称
* @param sha1 提交的哈希值
* @param assetId 附件唯一标识符
* @returns 删除结果
*/
async deleteCommitAsset(repo: string, sha1: string, assetId: string): Promise<Result<void>> {
const url = `/${repo}/-/git/commit-assets/${sha1}/${assetId}`;
return this.delete({ url });
}
/**
* 获取提交附件下载链接
* @param repo 仓库名称,格式:组织名称/仓库名称
* @param commitId 提交的哈希值
* @param filename 文件名称
* @param params 查询参数
* @returns 302 重定向到下载地址
*/
async getCommitAssets(repo: string, commitId: string, filename: string, params?: GetCommitAssetsParams): Promise<any> {
const url = `/${repo}/-/commit-assets/download/${commitId}/${filename}`;
return this.get({ url, params, useOrigin: true });
}
/**
* 比较两个提交、分支或标签之间的差异
* @param repo 仓库名称,格式:组织名称/仓库名称
* @param baseHead 用于 Git 比较操作的基准和头部分支或提交的 SHA 值格式base...head
* @returns 比较结果
*/
async getCompareCommits(repo: string, baseHead: string): Promise<Result<CompareResponse>> {
const url = `/${repo}/-/git/compare/${baseHead}`;
return this.get({ url });
}
/**
* 获取仓库默认分支
* @param repo 仓库名称,格式:组织名称/仓库名称
* @returns 默认分支信息
*/
async getHead(repo: string): Promise<Result<HeadRef>> {
const url = `/${repo}/-/git/head`;
return this.get({ url });
}
/**
* 查询指定标签的元数据
* @param repo 仓库名称,格式:组织名称/仓库名称
* @param tag 标签名称
* @returns 标签元数据列表
*/
async getTagAnnotations(repo: string, tag: string): Promise<Result<TagAnnotation[]>> {
const url = `/${repo}/-/git/tag-annotations/${tag}`;
return this.get({ url });
}
/**
* 设定指定标签的元数据
* @param repo 仓库名称,格式:组织名称/仓库名称
* @param tag 标签名称
* @param data 标签元数据
* @returns 设置结果
*/
async putTagAnnotations(repo: string, tag: string, data: PutTagAnnotationsData): Promise<Result<void>> {
const url = `/${repo}/-/git/tag-annotations/${tag}`;
return this.put({ url, data });
}
/**
* 删除指定标签的元数据
* @param repo 仓库名称,格式:组织名称/仓库名称
* @param tagWithKey 标签名称和键名组合
* @returns 删除结果
*/
async deleteTagAnnotation(repo: string, tagWithKey: string): Promise<Result<void>> {
const url = `/${repo}/-/git/tag-annotations/${tagWithKey}`;
return this.delete({ url });
}
}
/**
* 分页参数
*/
type PaginationParams = {
/** 分页页码,默认: 1 */
page?: number;
/** 分页页大小,默认: 30 */
page_size?: number;
};
/**
* 查询提交列表参数
*/
type ListCommitsParams = PaginationParams & {
/** 提交标识符,分支名称或提交哈希值 */
sha?: string;
/** 作者匹配模式,支持 Git 原生正则表达式 */
author?: string;
/** 提交者匹配模式,支持 Git 原生正则表达式 */
committer?: string;
/** 提交时间起始范围示例2025-01-01T00:00:00Z */
since?: string;
/** 提交时间结束范围示例2025-12-31T23:59:59Z */
until?: string;
};
/**
* 创建分支参数
*/
type CreateBranchData = {
/** 分支名称 */
branch_name: string;
/** 起始点,默认使用仓库默认分支 */
start_point?: string;
};
/**
* 创建标签参数
*/
type CreateTagData = {
/** 标签名称 */
tag_name: string;
/** 目标提交或分支,默认使用当前分支 */
target?: string;
/** 标签消息 */
message?: string;
/** 标签注释 */
annotation?: Record<string, any>;
};
/**
* 创建 Blob 参数
*/
type CreateBlobData = {
/** 文件内容 */
content: string;
/** 编码格式,默认: utf-8 */
encoding?: string;
};
/**
* 查询内容参数
*/
type GetContentParams = {
/** Git 引用,分支名、标签名或提交哈希 */
ref?: string;
};
/**
* 查询指定路径内容参数
*/
type GetContentWithPathParams = {
/** Git 引用,分支名、标签名或提交哈希 */
ref?: string;
};
/**
* 获取原始文件参数
*/
type GetRawParams = {
/** 最大 Blob 大小限制(字节) */
max_in_byte?: number;
};
/**
* 设置提交注释参数
*/
type PutCommitAnnotationsData = {
/** 注释键值对 */
annotations: Record<string, string>;
};
/**
* 批量查询提交注释参数
*/
type GetCommitAnnotationsInBatchData = {
/** 提交哈希值列表 */
shas: string[];
};
/**
* 创建提交附件上传 URL 参数
*/
type PostCommitAssetUploadURLData = {
/** 附件名称 */
name: string;
/** 附件路径 */
path: string;
/** 内容长度 */
content_length: number;
/** 内容类型 */
content_type: string;
/** 内容摘要 */
digest: string;
};
/**
* 确认附件上传参数
*/
type PostCommitAssetUploadConfirmationParams = {
/** 附件保持的天数0 表示永久,最大 180 天 */
ttl?: number;
};
/**
* 获取提交附件参数
*/
type GetCommitAssetsParams = {
/** 是否可分享true 表示下载地址有效期 12 小时,最多下载 10 次 */
share?: boolean;
};
/**
* 设置标签注释参数
*/
type PutTagAnnotationsData = {
/** 注释键值对 */
annotations: Record<string, string>;
};

View File

@@ -21,21 +21,23 @@ export class CNB extends CNBCore {
mission!: Mission; mission!: Mission;
ai!: AiBase; ai!: AiBase;
constructor(options: CNBOptions) { constructor(options: CNBOptions) {
super({ token: options.token, cookie: options.cookie, cnb: options.cnb }); super({ ...options, token: options.token, cookie: options.cookie, cnb: options.cnb });
this.init(options); this.init(options);
} }
init(cnbOptions?: CNBOptions) { init(cnbOptions?: CNBOptions) {
const token = this.token; const token = this.token;
const cookie = this.cookie; const cookie = this.cookie;
const options = { token, cookie }; const cors = cnbOptions?.cors || {}
this.workspace = new Workspace(options.token); const cnb = cnbOptions?.cnb
this.knowledgeBase = new KnowledgeBase({ token: options.token, cookie: options.cookie }); const options = { token, cookie, cors, cnb };
this.repo = new Repo({ token: options.token, cookie: options.cookie }); this.workspace = new Workspace(options);
this.user = new User({ token: options.token, cookie: options.cookie }); this.knowledgeBase = new KnowledgeBase(options);
this.build = new Build({ token: options.token, cookie: options.cookie }); this.repo = new Repo(options);
this.issue = new Issue({ token: options.token, cookie: options.cookie }); this.user = new User(options);
this.mission = new Mission({ token: options.token, cookie: options.cookie }); this.build = new Build(options);
this.ai = new AiBase({ token: options.token, cookie: options.cookie }); this.issue = new Issue(options);
this.mission = new Mission(options);
this.ai = new AiBase(options);
} }
setToken(token: string) { setToken(token: string) {
this.token = token; this.token = token;

View File

@@ -38,7 +38,7 @@ export type IssueItem = {
}; };
export class Issue extends CNBCore { export class Issue extends CNBCore {
constructor(options: CNBCoreOptions) { constructor(options: CNBCoreOptions) {
super({ token: options.token, cookie: options.cookie }); super(options);
} }
createIssue(repo: string, data: Partial<IssueItem>): Promise<any> { createIssue(repo: string, data: Partial<IssueItem>): Promise<any> {

View File

@@ -2,7 +2,7 @@ import { CNBCore, CNBCoreOptions, Result } from "../cnb-core.ts";
export class KnowledgeBase extends CNBCore { export class KnowledgeBase extends CNBCore {
constructor(options: CNBCoreOptions) { constructor(options: CNBCoreOptions) {
super({ token: options.token, cookie: options.cookie }); super(options);
} }
queryKnowledgeBase(repo: string, data: { queryKnowledgeBase(repo: string, data: {

View File

@@ -2,7 +2,7 @@ import { CNBCore, CNBCoreOptions, RequestOptions, Result } from "../cnb-core.ts"
export class Mission extends CNBCore { export class Mission extends CNBCore {
constructor(options: CNBCoreOptions) { constructor(options: CNBCoreOptions) {
super({ token: options.token, cookie: options.cookie }); super(options);
} }
/** /**

View File

@@ -2,7 +2,7 @@ import { CNBCore, CNBCoreOptions, RequestOptions, Result } from "../cnb-core.ts"
export class Repo extends CNBCore { export class Repo extends CNBCore {
constructor(options: CNBCoreOptions) { constructor(options: CNBCoreOptions) {
super({ token: options.token, cookie: options.cookie }); super(options);
} }
/** /**
* 创建代码仓库 * 创建代码仓库
@@ -23,7 +23,7 @@ export class Repo extends CNBCore {
return this.post({ url, data: postData }); return this.post({ url, data: postData });
} }
deleteRepo(name: string): Promise<any> { deleteRepo(name: string): Promise<any> {
const url = `https://cnb.cool/${name}`; const url = `${this.hackURL}/${name}`;
return this.delete({ url, useCookie: true }); return this.delete({ url, useCookie: true });
} }
async createCommit(repo: string, data: CreateCommitData): Promise<any> { async createCommit(repo: string, data: CreateCommitData): Promise<any> {
@@ -38,7 +38,7 @@ export class Repo extends CNBCore {
if (!data.parent_commit_sha && preCommitSha) { if (!data.parent_commit_sha && preCommitSha) {
data.parent_commit_sha = preCommitSha; data.parent_commit_sha = preCommitSha;
} }
const url = `https://cnb.cool/${repo}/-/git/commits`; const url = `${this.hackURL}/${repo}/-/git/commits`;
const postData: CreateCommitData = { const postData: CreateCommitData = {
...data, ...data,
base_branch: data.base_branch || 'refs/heads/main', base_branch: data.base_branch || 'refs/heads/main',

View File

@@ -2,7 +2,7 @@ import { CNBCore, CNBCoreOptions } from "../cnb-core.ts";
import { Result } from "@kevisual/query"; import { Result } from "@kevisual/query";
export class User extends CNBCore { export class User extends CNBCore {
constructor(options: CNBCoreOptions<{}>) { constructor(options: CNBCoreOptions<{}>) {
super({ token: options.token, cookie: options.cookie }); super(options);
} }
/** /**
@@ -10,7 +10,7 @@ export class User extends CNBCore {
* @returns * @returns
*/ */
getCurrentUser(): Promise<Result<UserInfo>> { getCurrentUser(): Promise<Result<UserInfo>> {
const url = `https://cnb.cool/user`; const url = `${this.hackURL}/user`;
return this.get({ return this.get({
url, url,
useCookie: true, useCookie: true,
@@ -26,7 +26,7 @@ export class User extends CNBCore {
} }
createAccessToken(data?: { description?: string, scope?: string }): Promise<AccessTokenResponse> { createAccessToken(data?: { description?: string, scope?: string }): Promise<AccessTokenResponse> {
const scope = data?.scope || 'mission-manage:rw,mission-delete:rw,group-delete:rw,group-manage:rw,group-resource:rw,account-engage:rw,account-email:r,account-profile:rw,registry-delete:rw,registry-manage:rw,registry-package-delete:rw,registry-package:rw,repo-security:r,repo-delete:rw,repo-manage:rw,repo-basic-info:r,repo-cnb-detail:rw,repo-cnb-history:r,repo-cnb-trigger:rw,repo-commit-status:rw,repo-contents:rw,repo-notes:rw,repo-issue:rw,repo-pr:rw,repo-code:rw' const scope = data?.scope || 'mission-manage:rw,mission-delete:rw,group-delete:rw,group-manage:rw,group-resource:rw,account-engage:rw,account-email:r,account-profile:rw,registry-delete:rw,registry-manage:rw,registry-package-delete:rw,registry-package:rw,repo-security:r,repo-delete:rw,repo-manage:rw,repo-basic-info:r,repo-cnb-detail:rw,repo-cnb-history:r,repo-cnb-trigger:rw,repo-commit-status:rw,repo-contents:rw,repo-notes:rw,repo-issue:rw,repo-pr:rw,repo-code:rw'
const url = 'https://cnb.cool/user/personal_access_tokens' const url = `${this.hackURL}/user/personal_access_tokens`
return this.post({ return this.post({
url, url,
useCookie: true, useCookie: true,
@@ -37,7 +37,7 @@ export class User extends CNBCore {
}) })
} }
getAccessTokens(params?: { page?: number, page_size?: number }): Promise<AccessTokenResponse[]> { getAccessTokens(params?: { page?: number, page_size?: number }): Promise<AccessTokenResponse[]> {
const url = 'https://cnb.cool/user/personal_access_tokens' const url = `${this.hackURL}/user/personal_access_tokens`
return this.get({ return this.get({
url, url,
useCookie: true, useCookie: true,
@@ -49,7 +49,7 @@ export class User extends CNBCore {
}) })
} }
deleteAccessToken(tokenId: string): Promise<any> { deleteAccessToken(tokenId: string): Promise<any> {
const url = `https://cnb.cool/user/personal_access_tokens/${tokenId}` const url = `${this.hackURL}/user/personal_access_tokens/${tokenId}`
return this.delete({ return this.delete({
url, url,
useCookie: true, useCookie: true,

View File

@@ -6,7 +6,7 @@
*/ */
import { Result } from "@kevisual/query/query"; import { Result } from "@kevisual/query/query";
import { CNBCore } from "../cnb-core.ts"; import { CNBCore, CNBCoreOptions } from "../cnb-core.ts";
/** /**
* 工作空间列表查询参数 * 工作空间列表查询参数
@@ -33,8 +33,8 @@ export interface ListParams {
* https://api.cnb.cool/#/operations/GetWorkspaceDetail * https://api.cnb.cool/#/operations/GetWorkspaceDetail
*/ */
export class Workspace extends CNBCore { export class Workspace extends CNBCore {
constructor(token: string) { constructor(options: CNBCoreOptions) {
super({ token }); super(options);
} }
/** /**
* 删除我的云原生开发环境 * 删除我的云原生开发环境

View File

@@ -1,3 +1,14 @@
import { cnb, showMore } from './common.ts'; import { cnb, showMore, cookie, token } from './common.ts';
const res = await cnb.user.getCurrentUser(); import { User } from '../src';
console.log("get-ueserinfo: getCurrentUser", res); // const res = await cnb.user.getCurrentUser();
// console.log("get-ueserinfo: getCurrentUser", res);
const user = new User({
token, cookie,
cors: {
baseUrl: 'https://cors.kevisual.cn'
}
})
const res2 = await user.getCurrentUser()
console.log("get-ueserinfo: getCurrentUser", res2);

32
test/git.ts Normal file
View File

@@ -0,0 +1,32 @@
import { Git } from '../src/git/index.ts'
import { token, cookie, showMore } from './common.ts';
const git = new Git({ token, cookie });
const repo = 'kevisual/cnb';
const listFiles = async () => {
// const res = await git.getContentWithPath(repo, 'README.md');
// console.log("res", showMore(res));
const res2 = await git.getContentWithPath(repo, 'src/issue');
console.log("res2", showMore(res2));
const res3 = await git.getContentWithPath(repo, 'src/issue/index.ts');
console.log("res3", showMore(res3));
}
// listFiles();
const createBlob = async () => {
const res = await git.createBlob(repo, {
content: 'Hello, CNB!',
encoding: 'utf-8',
});
console.log("createBlob res", showMore(res));
}
createBlob();
const getRaw = async () => {
const res = await git.getRaw(repo, 'main:README.md');
console.log("getRaw res", showMore(res));
}

View File

@@ -2,7 +2,14 @@ import { Issue } from "../src/issue/index.ts";
import { token, showMore, cookie } from "./common.ts"; import { token, showMore, cookie } from "./common.ts";
// group: "kevisual", // group: "kevisual",
const issue = new Issue({ token: token, cookie: cookie }); const issue = new Issue({
token: token, cookie: cookie,
cors: {
// baseUrl: 'http://localhost:8080'
baseUrl: 'https://cors.kevisual.cn'
// baseUrl: 'http://cors.kevisual.cn:11111'
}
});
// const res = await issue.createIssue("cnb", { // const res = await issue.createIssue("cnb", {
// title: "测试通过 API 创建 Issue", // title: "测试通过 API 创建 Issue",
// }) // })
@@ -16,13 +23,13 @@ const issue = new Issue({ token: token, cookie: cookie });
// }); // });
// console.log(showMore(updateIssueRes)); // console.log(showMore(updateIssueRes));
const itemIssueRes = await issue.getItem("cnb", 1); // const itemIssueRes = await issue.getItem("cnb", 1);
console.log(showMore(itemIssueRes)); // console.log(showMore(itemIssueRes));
const listIssueRes = await issue.getList("cnb", { const listIssueRes = await issue.getList("kevisual/kevisual", {
state: "open", state: "open",
}); });
console.log(showMore(listIssueRes)); console.log(showMore(listIssueRes));
const commentListRes = await issue.getCommentList("cnb", 1); // const commentListRes = await issue.getCommentList("kevisual/kevisual", 1);
console.log(showMore(commentListRes)); // console.log(showMore(commentListRes));