feat(cnb-board): add cnb-dev-env routes and related functionalities

- Implemented routes for cnb-board to fetch live environment configurations, repository info, build info, pull request info, NPC info, and comment info.
- Created a utility function to execute shell commands.
- Added a check to determine if the environment is a CNB environment.
- Introduced a method to retrieve live markdown content with detailed service access information.
- Enhanced system information retrieval with CPU, memory, and disk usage metrics.
- Established a module structure for better organization of cnb-board related functionalities.
This commit is contained in:
2026-03-06 02:26:13 +08:00
parent 5043392939
commit 841ed6ffa7
12 changed files with 932 additions and 225 deletions

View File

@@ -6,6 +6,7 @@ import './call/index.ts'
import './cnb-env/index.ts'
import './knowledge/index.ts'
import './issues/index.ts'
import './cnb-board/index.ts';
/**
* 验证上下文中的 App ID 是否与指定的 App ID 匹配
@@ -25,25 +26,23 @@ const checkAppId = (ctx: any, appId: string) => {
return false;
}
if (!app.hasRoute('auth')) {
app.route({
id: 'auth',
path: 'auth',
}).define(async (ctx) => {
// ctx.body = 'Auth Route';
if (checkAppId(ctx, app.appId)) {
return;
}
}).addTo(app);
app.route({
id: 'auth',
path: 'auth',
}).define(async (ctx) => {
// ctx.body = 'Auth Route';
if (checkAppId(ctx, app.appId)) {
return;
}
}).addTo(app, { overwrite: false });
app.route({
id: 'admin-auth',
path: 'admin-auth',
middleware: ['auth'],
}).define(async (ctx) => {
// ctx.body = 'Admin Auth Route';
if (checkAppId(ctx, app.appId)) {
return;
}
}).addTo(app);
}
app.route({
id: 'admin-auth',
path: 'admin-auth',
middleware: ['auth'],
}).define(async (ctx) => {
// ctx.body = 'Admin Auth Route';
if (checkAppId(ctx, app.appId)) {
return;
}
}).addTo(app, { overwrite: false });