feat: add automatic OpenAPI documentation generation (#445)

* feat: add automatic OpenAPI documentation generation

Added script to auto-generate OpenAPI spec from existing Koa routes:
- Scans route files and extracts endpoint definitions
- Generates proper OpenAPI 3.0 specification
- No code changes or decorators required
- Preserves existing code structure

Usage: npm run openapi:generate

Generated 51 endpoints across 13 tags.

* feat: enhance OpenAPI generator with all endpoints

Enhanced the auto-generation script to capture all API endpoints:
- Added support for inline function handlers
- Captured group-chat endpoints
- Added proxy endpoints for upstream API forwarding
- Added WebSocket terminal endpoint
- Added SSE chat streaming endpoint
- Increased coverage from 51 to 94 endpoints
- Added 24 comprehensive tags for all features

Generated OpenAPI spec now includes:
- All HTTP REST endpoints
- Proxy wildcards for /api/hermes/* and /v1/*
- WebSocket terminal connection
- Server-Sent Events for chat streaming
This commit is contained in:
ekko
2026-05-04 20:30:04 +08:00
committed by GitHub
parent 25a8ae2f88
commit 99f9dcb2fe
3 changed files with 3418 additions and 1958 deletions
+5 -3
View File
@@ -54,7 +54,8 @@
"preview": "NODE_ENV=production vite preview",
"test": "vitest run",
"test:watch": "vitest",
"test:coverage": "vitest run --coverage"
"test:coverage": "vitest run --coverage",
"openapi:generate": "node scripts/generate-openapi.mjs"
},
"files": [
"bin/",
@@ -68,7 +69,6 @@
"socket.io-client": "^4.8.3"
},
"devDependencies": {
"esbuild": "^0.27.0",
"@koa/bodyparser": "^5.0.0",
"@koa/cors": "^5.0.0",
"@koa/router": "^15.4.0",
@@ -93,6 +93,7 @@
"@xterm/xterm": "^6.0.0",
"axios": "^1.9.0",
"concurrently": "^9.2.1",
"esbuild": "^0.27.0",
"highlight.js": "^11.11.1",
"js-yaml": "^4.1.1",
"jsdom": "^27.0.1",
@@ -110,6 +111,7 @@
"qrcode": "^1.5.4",
"sass": "^1.99.0",
"ts-node": "^10.9.2",
"tsoa": "^7.0.0-alpha.0",
"typescript": "~6.0.2",
"vite": "^8.0.4",
"vitest": "^3.2.4",
@@ -119,4 +121,4 @@
"vue-tsc": "^3.2.6",
"ws": "^8.20.0"
}
}
}