raiton 6.8.9-beta.25 → 6.10.0-beta.28
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +44 -0
- package/README.md +46 -1
- package/benchmarks/README.md +16 -0
- package/benchmarks/latest.json +172 -0
- package/benchmarks/latest.md +66 -0
- package/build/bin/index.mjs +33550 -21725
- package/build/types/bin/bootstrapper.d.ts +2 -0
- package/build/types/bin/cli-output.d.ts +46 -0
- package/build/types/bin/cli-tools.d.ts +13 -0
- package/build/types/bin/cli.d.ts +3 -0
- package/build/types/bin/commands.registry.d.ts +4 -0
- package/build/types/bin/constants.d.ts +3 -0
- package/build/types/bin/file-utils.d.ts +21 -0
- package/build/types/bin/index.d.ts +2 -0
- package/build/types/bin/name-utils.d.ts +4 -0
- package/build/types/bin/project-utils.d.ts +12 -0
- package/build/types/commands/artifact.command.d.ts +7 -0
- package/build/types/commands/build.command.d.ts +8 -0
- package/build/types/commands/client.command.d.ts +7 -0
- package/build/types/commands/contract.command.d.ts +8 -0
- package/build/types/commands/develop.command.d.ts +9 -0
- package/build/types/commands/docs.command.d.ts +8 -0
- package/build/types/commands/doctor.command.d.ts +9 -0
- package/build/types/commands/generate.command.d.ts +7 -0
- package/build/types/commands/inspect.command.d.ts +7 -0
- package/build/types/commands/mcp.command.d.ts +11 -0
- package/build/types/commands/new.command.d.ts +7 -0
- package/build/types/commands/openapi.command.d.ts +7 -0
- package/build/types/commands/routes.command.d.ts +7 -0
- package/build/types/commands/start.command.d.ts +9 -0
- package/build/types/commands/why.command.d.ts +7 -0
- package/build/types/contracts/decorators.d.ts +41 -0
- package/build/types/contracts/errors.d.ts +42 -0
- package/build/types/contracts/index.d.ts +4 -0
- package/build/types/contracts/schema.d.ts +70 -0
- package/build/types/contracts/typebox.d.ts +81 -0
- package/build/types/core/application.d.ts +37 -0
- package/build/types/core/artifacts/artifact.d.ts +3 -0
- package/build/types/core/artifacts/index.d.ts +1 -0
- package/build/types/core/artifacts/runner.d.ts +1 -0
- package/build/types/core/builder.d.ts +42 -0
- package/build/types/core/bytes.util.d.ts +3 -0
- package/build/types/core/command.d.ts +13 -0
- package/build/types/core/commands.d.ts +10 -0
- package/build/types/core/config/config.d.ts +27 -0
- package/build/types/core/config/define.d.ts +8 -0
- package/build/types/core/config/index.d.ts +3 -0
- package/build/types/core/config/schema.d.ts +24 -0
- package/build/types/core/context.d.ts +11 -0
- package/build/types/core/controller/builder.d.ts +26 -0
- package/build/types/core/controller/compiler.d.ts +2 -0
- package/build/types/core/controller/index.d.ts +4 -0
- package/build/types/core/controller/metadata.d.ts +3 -0
- package/build/types/core/controller/tracker.d.ts +9 -0
- package/build/types/core/directories.d.ts +10 -0
- package/build/types/core/guards.d.ts +11 -0
- package/build/types/core/helpers/index.d.ts +1 -0
- package/build/types/core/helpers/raiton.d.ts +1 -0
- package/build/types/core/hooks.d.ts +14 -0
- package/build/types/core/index.d.ts +17 -0
- package/build/types/core/injection/index.d.ts +1 -0
- package/build/types/core/injection/injection.d.ts +37 -0
- package/build/types/core/mcp/builder.d.ts +2 -0
- package/build/types/core/mcp/index.d.ts +3 -0
- package/build/types/core/mcp/metadata.d.ts +9 -0
- package/build/types/core/mcp/tracker.d.ts +9 -0
- package/build/types/core/middleware/compose.d.ts +8 -0
- package/build/types/core/middleware/index.d.ts +2 -0
- package/build/types/core/middleware/pipeline.d.ts +12 -0
- package/build/types/core/plugins/index.d.ts +2 -0
- package/build/types/core/plugins/plugin.d.ts +2 -0
- package/build/types/core/plugins/scope.d.ts +15 -0
- package/build/types/core/process.util.d.ts +1 -0
- package/build/types/core/raiton.d.ts +15 -0
- package/build/types/core/router/handler.d.ts +2 -0
- package/build/types/core/router/handler.utils.d.ts +37 -0
- package/build/types/core/router/index.d.ts +4 -0
- package/build/types/core/router/matcher.d.ts +50 -0
- package/build/types/core/router/route.d.ts +52 -0
- package/build/types/core/router/router.d.ts +23 -0
- package/build/types/core/scheduler/builder.d.ts +2 -0
- package/build/types/core/scheduler/cron.d.ts +32 -0
- package/build/types/core/scheduler/duration.d.ts +7 -0
- package/build/types/core/scheduler/index.d.ts +6 -0
- package/build/types/core/scheduler/manager.d.ts +47 -0
- package/build/types/core/scheduler/metadata.d.ts +8 -0
- package/build/types/core/scheduler/queue/backend.d.ts +42 -0
- package/build/types/core/scheduler/queue/index.d.ts +3 -0
- package/build/types/core/scheduler/queue/rabbitmq.backend.d.ts +37 -0
- package/build/types/core/scheduler/queue/redis.backend.d.ts +38 -0
- package/build/types/core/server.d.ts +9 -0
- package/build/types/core/socket/builder.d.ts +1 -0
- package/build/types/core/socket/index.d.ts +2 -0
- package/build/types/core/socket/metadata.d.ts +14 -0
- package/build/types/core/thread.d.ts +21 -0
- package/build/types/framework/artifacts.d.ts +20 -0
- package/build/types/framework/cache/cache.d.ts +84 -0
- package/build/types/framework/cache/cache.decorator.d.ts +21 -0
- package/build/types/framework/cache/etag.d.ts +62 -0
- package/build/types/framework/cache/index.d.ts +4 -0
- package/build/types/framework/cache/types.d.ts +89 -0
- package/build/types/framework/constants/decorators.constant.d.ts +28 -0
- package/build/types/framework/constants/index.d.ts +2 -0
- package/build/types/framework/constants/microservices.constant.d.ts +3 -0
- package/build/types/framework/controllers.d.ts +2 -0
- package/build/types/framework/data-transfer-object.d.ts +5 -0
- package/build/types/framework/decorators/access-guard.decorator.d.ts +1 -0
- package/build/types/framework/decorators/api-response.decorator.d.ts +66 -0
- package/build/types/framework/decorators/api.decorator.d.ts +160 -0
- package/build/types/framework/decorators/controllable.decorator.d.ts +3 -0
- package/build/types/framework/decorators/csrf-guard.decorator.d.ts +2 -0
- package/build/types/framework/decorators/csrf-token.decorator.d.ts +1 -0
- package/build/types/framework/decorators/guard.decorator.d.ts +2 -0
- package/build/types/framework/decorators/health-check.decorator.d.ts +17 -0
- package/build/types/framework/decorators/index.d.ts +15 -0
- package/build/types/framework/decorators/injection.decorator.d.ts +5 -0
- package/build/types/framework/decorators/mcp.decorator.d.ts +68 -0
- package/build/types/framework/decorators/middleware.decorator.d.ts +3 -0
- package/build/types/framework/decorators/parametrable.decorator.d.ts +9 -0
- package/build/types/framework/decorators/routable.decorator.d.ts +12 -0
- package/build/types/framework/decorators/route-interaction.decorator.d.ts +81 -0
- package/build/types/framework/decorators/scheduler.decorator.d.ts +54 -0
- package/build/types/framework/decorators/socket.decorator.d.ts +5 -0
- package/build/types/framework/encryption.d.ts +25 -0
- package/build/types/framework/enums/csrf.enum.d.ts +4 -0
- package/build/types/framework/enums/encrypted.enum.d.ts +20 -0
- package/build/types/framework/enums/event.message.enum.d.ts +4 -0
- package/build/types/framework/enums/http-method.enum.d.ts +10 -0
- package/build/types/framework/enums/http-parameters.enum.d.ts +11 -0
- package/build/types/framework/enums/http-status.enum.d.ts +64 -0
- package/build/types/framework/enums/index.d.ts +9 -0
- package/build/types/framework/enums/runtime.enum.d.ts +5 -0
- package/build/types/framework/enums/scheduler.enum.d.ts +21 -0
- package/build/types/framework/enums/timestamp.enum.d.ts +6 -0
- package/build/types/framework/env.d.ts +3 -0
- package/build/types/framework/errors/catalog.d.ts +42 -0
- package/build/types/framework/exceptions/http-exception.d.ts +18 -0
- package/build/types/framework/exceptions/index.d.ts +2 -0
- package/build/types/framework/exceptions/throwable.d.ts +76 -0
- package/build/types/framework/health-check.d.ts +42 -0
- package/build/types/framework/index.d.ts +20 -0
- package/build/types/framework/mcp/audit.d.ts +12 -0
- package/build/types/framework/mcp/conformance.d.ts +31 -0
- package/build/types/framework/mcp/handler.d.ts +11 -0
- package/build/types/framework/mcp/index.d.ts +5 -0
- package/build/types/framework/mcp/protocol.d.ts +17 -0
- package/build/types/framework/mcp/rate-limit.d.ts +10 -0
- package/build/types/framework/mcp/stdio.d.ts +40 -0
- package/build/types/framework/mcp/streamable-http.d.ts +17 -0
- package/build/types/framework/observability/index.d.ts +6 -0
- package/build/types/framework/observability/metrics.d.ts +23 -0
- package/build/types/framework/observability/plugin.d.ts +20 -0
- package/build/types/framework/observability/readiness.d.ts +9 -0
- package/build/types/framework/observability/request.d.ts +7 -0
- package/build/types/framework/observability/shutdown.d.ts +21 -0
- package/build/types/framework/observability/trace.d.ts +96 -0
- package/build/types/framework/parameter-bag.d.ts +14 -0
- package/build/types/framework/plugins/body-parser.plugin.d.ts +3 -0
- package/build/types/framework/plugins/dev.plugin.d.ts +12 -0
- package/build/types/framework/plugins/index.d.ts +5 -0
- package/build/types/framework/plugins/mcp.plugin.d.ts +15 -0
- package/build/types/framework/plugins/openapi.plugin.d.ts +58 -0
- package/build/types/framework/plugins/security/body-limit.d.ts +1 -0
- package/build/types/framework/plugins/security/cors.d.ts +10 -0
- package/build/types/framework/plugins/security/csrf.d.ts +2 -0
- package/build/types/framework/plugins/security/headers.d.ts +1 -0
- package/build/types/framework/plugins/security/index.d.ts +13 -0
- package/build/types/framework/plugins/security/method-guard.d.ts +1 -0
- package/build/types/framework/plugins/security/rate-limit.d.ts +5 -0
- package/build/types/framework/repositories.d.ts +5 -0
- package/build/types/framework/responses/error.d.ts +13 -0
- package/build/types/framework/responses/helpers.d.ts +7 -0
- package/build/types/framework/responses/http-throwable.d.ts +14 -0
- package/build/types/framework/responses/http.d.ts +13 -0
- package/build/types/framework/responses/index.d.ts +4 -0
- package/build/types/framework/runtime/bun/server.d.ts +2 -0
- package/build/types/framework/runtime/deno/server.d.ts +2 -0
- package/build/types/framework/runtime/index.d.ts +17 -0
- package/build/types/framework/runtime/node/reply.d.ts +12 -0
- package/build/types/framework/runtime/node/request.d.ts +33 -0
- package/build/types/framework/runtime/node/server.d.ts +2 -0
- package/build/types/framework/runtime/web/server.d.ts +1 -0
- package/build/types/framework/services.d.ts +5 -0
- package/build/types/framework/utilities/alias-path.util.d.ts +1 -0
- package/build/types/framework/utilities/artifact.util.d.ts +7 -0
- package/build/types/framework/utilities/callable.util.d.ts +1 -0
- package/build/types/framework/utilities/cookie.util.d.ts +1 -0
- package/build/types/framework/utilities/csrf.util.d.ts +26 -0
- package/build/types/framework/utilities/https.util.d.ts +49 -0
- package/build/types/framework/utilities/index.d.ts +12 -0
- package/build/types/framework/utilities/ip.util.d.ts +15 -0
- package/build/types/framework/utilities/json.util.d.ts +10 -0
- package/build/types/framework/utilities/openapi.utils.d.ts +7 -0
- package/build/types/framework/utilities/openapi.utils.impl.d.ts +18 -0
- package/build/types/framework/utilities/path.util.d.ts +3 -0
- package/build/types/framework/utilities/route-suggestion.util.d.ts +10 -0
- package/build/types/framework/utilities/url.util.d.ts +1 -0
- package/build/types/framework/utilities/utilities.util.d.ts +3 -0
- package/build/types/framework/utilities/validation.util.d.ts +8 -0
- package/build/types/framework/view-model.d.ts +4 -0
- package/build/types/generators/artifact.templates.d.ts +7 -0
- package/build/types/generators/index.d.ts +2 -0
- package/build/types/generators/project.templates.d.ts +21 -0
- package/build/types/manifest/client.d.ts +12 -0
- package/build/types/manifest/contract.d.ts +25 -0
- package/build/types/manifest/index.d.ts +5 -0
- package/build/types/manifest/introspect.d.ts +18 -0
- package/build/types/manifest/manifest.d.ts +18 -0
- package/build/types/manifest/schema.d.ts +177 -0
- package/build/types/requirements.d.ts +1 -0
- package/build/types/types/access-guards.d.ts +4 -0
- package/build/types/types/application.d.ts +32 -0
- package/build/types/types/artifact.d.ts +8 -0
- package/build/types/types/builder.d.ts +37 -0
- package/build/types/types/config.d.ts +62 -0
- package/build/types/types/controller.d.ts +27 -0
- package/build/types/types/contruct.d.ts +1 -0
- package/build/types/types/core.d.ts +11 -0
- package/build/types/types/csrf.d.ts +33 -0
- package/build/types/types/directory.d.ts +6 -0
- package/build/types/types/encryption.d.ts +14 -0
- package/build/types/types/generic.d.ts +2 -0
- package/build/types/types/guard.d.ts +9 -0
- package/build/types/types/http-responses.d.ts +7 -0
- package/build/types/types/index.d.ts +27 -0
- package/build/types/types/injection.d.ts +11 -0
- package/build/types/types/lifecycle.d.ts +9 -0
- package/build/types/types/mcp.d.ts +148 -0
- package/build/types/types/middleware.d.ts +12 -0
- package/build/types/types/parseable.d.ts +3 -0
- package/build/types/types/plugin.d.ts +6 -0
- package/build/types/types/raiton.d.ts +13 -0
- package/build/types/types/responses.d.ts +20 -0
- package/build/types/types/router.d.ts +13 -0
- package/build/types/types/runtime.d.ts +48 -0
- package/build/types/types/scheduler.d.ts +140 -0
- package/build/types/types/scheme.d.ts +125 -0
- package/build/types/types/server.d.ts +10 -0
- package/build/types/types/socket.d.ts +11 -0
- package/build/types/types/thread.d.ts +25 -0
- package/build/types/types/utilities.d.ts +4 -0
- package/build/types/types/values.d.ts +2 -0
- package/docs/AGENTS.md +55 -0
- package/docs/CLAUDE.md +55 -0
- package/docs/README.md +5 -0
- package/docs/contributors/cli/README.md +17 -3
- package/docs/contributors/cli/commands.md +28 -17
- package/docs/contributors/framework/plugins/openapi.md +12 -3
- package/docs/generated/cli/commands.md +26 -0
- package/docs/generated/config-schema.json +150 -0
- package/docs/generated/manifest-schema.json +236 -0
- package/docs/generated/manifest.json +101 -0
- package/docs/llms-full.txt +1271 -0
- package/docs/llms.txt +46 -0
- package/docs/user-guide/README.md +18 -12
- package/docs/user-guide/cli.md +21 -0
- package/docs/user-guide/config.md +14 -0
- package/docs/user-guide/contracts.md +67 -0
- package/docs/user-guide/en/README.md +83 -0
- package/docs/user-guide/getting-started.md +13 -1
- package/docs/user-guide/mcp.md +45 -2
- package/docs/user-guide/observability.md +74 -0
- package/docs/user-guide/openapi/plugin.md +10 -0
- package/docs/user-guide/recipes/README.md +32 -0
- package/docs/user-guide/recipes/contracts.md +52 -0
- package/docs/user-guide/recipes/doctor.md +16 -0
- package/docs/user-guide/recipes/generate.md +28 -0
- package/docs/user-guide/recipes/manifest.md +17 -0
- package/docs/user-guide/recipes/mcp-stdio.md +35 -0
- package/docs/user-guide/recipes/new-project.md +34 -0
- package/docs/user-guide/recipes/observability.md +17 -0
- package/package.json +40 -7
- package/scripts/bench.ts +586 -0
- package/scripts/postinstall.mjs +15 -0
- package/source/bin/cli-output.ts +139 -0
- package/source/bin/commands.registry.ts +23 -3
- package/source/bin/file-utils.ts +95 -0
- package/source/bin/name-utils.ts +26 -0
- package/source/bin/project-utils.ts +78 -0
- package/source/commands/artifact.command.ts +30 -15
- package/source/commands/client.command.ts +64 -0
- package/source/commands/contract.command.ts +104 -0
- package/source/commands/docs.command.ts +263 -0
- package/source/commands/doctor.command.ts +226 -0
- package/source/commands/generate.command.ts +58 -0
- package/source/commands/inspect.command.ts +108 -0
- package/source/commands/mcp.command.ts +258 -0
- package/source/commands/new.command.ts +135 -0
- package/source/commands/openapi.command.ts +95 -0
- package/source/commands/routes.command.ts +39 -0
- package/source/commands/why.command.ts +61 -0
- package/source/contracts/decorators.ts +151 -0
- package/source/contracts/errors.ts +76 -0
- package/source/contracts/index.ts +4 -0
- package/source/contracts/schema.ts +377 -0
- package/source/contracts/typebox.ts +193 -0
- package/source/core/application.ts +215 -73
- package/source/core/builder.ts +6 -2
- package/source/core/config/config.ts +144 -26
- package/source/core/config/define.ts +35 -8
- package/source/core/config/index.ts +2 -1
- package/source/core/config/schema.ts +263 -0
- package/source/core/controller/builder.ts +38 -13
- package/source/core/controller/compiler.ts +14 -7
- package/source/core/controller/metadata.ts +1 -1
- package/source/core/hooks.ts +13 -1
- package/source/core/injection/injection.ts +47 -9
- package/source/core/mcp/builder.ts +13 -2
- package/source/core/mcp/metadata.ts +2 -1
- package/source/core/middleware/compose.ts +48 -0
- package/source/core/middleware/pipeline.ts +69 -46
- package/source/core/raiton.ts +8 -0
- package/source/core/router/handler.ts +91 -31
- package/source/core/router/handler.utils.ts +107 -51
- package/source/core/router/matcher.ts +195 -24
- package/source/core/router/route.ts +100 -31
- package/source/core/router/router.ts +27 -2
- package/source/core/scheduler/metadata.ts +1 -1
- package/source/core/socket/metadata.ts +1 -1
- package/source/core/thread.ts +37 -2
- package/source/framework/artifacts.ts +47 -15
- package/source/framework/cache/cache.ts +48 -3
- package/source/framework/constants/decorators.constant.ts +5 -0
- package/source/framework/data-transfer-object.ts +4 -3
- package/source/framework/decorators/controllable.decorator.ts +3 -3
- package/source/framework/decorators/csrf-guard.decorator.ts +3 -2
- package/source/framework/decorators/csrf-token.decorator.ts +1 -1
- package/source/framework/decorators/guard.decorator.ts +3 -2
- package/source/framework/decorators/health-check.decorator.ts +1 -1
- package/source/framework/decorators/mcp.decorator.ts +38 -7
- package/source/framework/decorators/middleware.decorator.ts +2 -2
- package/source/framework/decorators/parametrable.decorator.ts +2 -1
- package/source/framework/decorators/routable.decorator.ts +3 -3
- package/source/framework/decorators/route-interaction.decorator.ts +2 -2
- package/source/framework/decorators/scheduler.decorator.ts +3 -3
- package/source/framework/decorators/socket.decorator.ts +3 -3
- package/source/framework/encryption.ts +46 -7
- package/source/framework/errors/catalog.ts +159 -0
- package/source/framework/exceptions/http-exception.ts +1 -1
- package/source/framework/health-check.ts +18 -0
- package/source/framework/index.ts +2 -0
- package/source/framework/mcp/audit.ts +57 -0
- package/source/framework/mcp/conformance.ts +195 -0
- package/source/framework/mcp/handler.ts +131 -9
- package/source/framework/mcp/index.ts +6 -1
- package/source/framework/mcp/protocol.ts +6 -0
- package/source/framework/mcp/rate-limit.ts +33 -0
- package/source/framework/mcp/stdio.ts +150 -0
- package/source/framework/mcp/streamable-http.ts +36 -5
- package/source/framework/observability/index.ts +6 -0
- package/source/framework/observability/metrics.ts +162 -0
- package/source/framework/observability/plugin.ts +151 -0
- package/source/framework/observability/readiness.ts +22 -0
- package/source/framework/observability/request.ts +31 -0
- package/source/framework/observability/shutdown.ts +68 -0
- package/source/framework/observability/trace.ts +241 -0
- package/source/framework/plugins/body-parser.plugin.ts +88 -85
- package/source/framework/plugins/dev.plugin.ts +227 -0
- package/source/framework/plugins/index.ts +2 -1
- package/source/framework/plugins/mcp.plugin.ts +14 -3
- package/source/framework/plugins/openapi.plugin.ts +56 -13
- package/source/framework/responses/helpers.ts +4 -4
- package/source/framework/responses/http-throwable.ts +1 -1
- package/source/framework/runtime/bun/server.ts +2 -1
- package/source/framework/runtime/deno/server.ts +2 -1
- package/source/framework/runtime/index.ts +45 -13
- package/source/framework/runtime/node/request.ts +59 -13
- package/source/framework/utilities/index.ts +3 -1
- package/source/framework/utilities/openapi.utils.impl.ts +705 -0
- package/source/framework/utilities/openapi.utils.ts +6 -636
- package/source/framework/utilities/route-suggestion.util.ts +59 -0
- package/source/framework/utilities/validation.util.ts +20 -0
- package/source/generators/artifact.templates.ts +230 -0
- package/source/generators/index.ts +2 -0
- package/source/generators/project.templates.ts +392 -0
- package/source/manifest/client.ts +299 -0
- package/source/manifest/contract.ts +138 -0
- package/source/manifest/index.ts +5 -0
- package/source/manifest/introspect.ts +52 -0
- package/source/manifest/manifest.ts +341 -0
- package/source/manifest/schema.ts +149 -0
- package/source/types/builder.ts +5 -0
- package/source/types/config.ts +64 -2
- package/source/types/mcp.ts +63 -1
- package/tsconfig.build.json +13 -0
- package/source/commands/grafts.command.ts +0 -27
- package/tests/artifact-resolution.test.ts +0 -60
package/docs/llms.txt
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
# Raiton
|
|
2
|
+
|
|
3
|
+
> Modular TypeScript backend framework with dependency injection, plugins, schema-first contracts, MCP (HTTP + stdio), observability and typed CLI tooling.
|
|
4
|
+
|
|
5
|
+
## Start
|
|
6
|
+
|
|
7
|
+
- [Getting started](user-guide/getting-started.md): create, run and test a project in under five minutes.
|
|
8
|
+
- [Configuration](user-guide/config.md): `raiton.config.ts` is typed and validated before the port opens.
|
|
9
|
+
- [Contracts](user-guide/recipes/contracts.md): one schema feeds validation, TypeScript types, OpenAPI and the generated client.
|
|
10
|
+
- [MCP](user-guide/mcp.md): expose tools over HTTP and stdio with safety annotations.
|
|
11
|
+
- [Observability](user-guide/observability.md): correlation ids, Prometheus metrics, OTLP traces and graceful shutdown.
|
|
12
|
+
|
|
13
|
+
## Commands
|
|
14
|
+
|
|
15
|
+
- `raiton new <name>`: Create a project from a template
|
|
16
|
+
- `raiton generate <type> <name>`: Generate controller, service, repository, dto, mcp-tool, test or resource
|
|
17
|
+
- `raiton routes`: List mounted routes
|
|
18
|
+
- `raiton inspect`: Emit the versioned project manifest
|
|
19
|
+
- `raiton why <method> <path>`: Explain which file registered a route
|
|
20
|
+
- `raiton doctor`: Diagnose runtime, configuration and prerequisites
|
|
21
|
+
- `raiton openapi export`: Export the OpenAPI document
|
|
22
|
+
- `raiton client`: Generate a typed client
|
|
23
|
+
- `raiton contract check`: Detect breaking contract changes
|
|
24
|
+
- `raiton contract snapshot`: Write a contract baseline
|
|
25
|
+
- `raiton mcp list`: List MCP servers
|
|
26
|
+
- `raiton mcp inspect <server>`: Inspect MCP schemas and safety annotations
|
|
27
|
+
- `raiton mcp test <server>.<tool>`: Call an MCP tool
|
|
28
|
+
- `raiton mcp serve [server]`: Serve an MCP server over stdio
|
|
29
|
+
- `raiton mcp conformance [server]`: Run the HTTP + stdio conformance suite
|
|
30
|
+
- `raiton docs agents`: Generate llms.txt, llms-full.txt, AGENTS.md and CLAUDE.md
|
|
31
|
+
- `raiton artifact --dump`: Inspect detected artifacts
|
|
32
|
+
- `raiton dev`: Run the application with HMR
|
|
33
|
+
- `raiton build`: Build the application
|
|
34
|
+
- `raiton start`: Run the application in production
|
|
35
|
+
|
|
36
|
+
## Project inventory
|
|
37
|
+
|
|
38
|
+
- Framework: raiton 6.8.9-beta.25
|
|
39
|
+
- Runtime: unknown
|
|
40
|
+
- Manifest schema: 1.0.0
|
|
41
|
+
- Routes: 0
|
|
42
|
+
- MCP servers: 0
|
|
43
|
+
|
|
44
|
+
## Routes
|
|
45
|
+
|
|
46
|
+
No route is currently mounted.
|
|
@@ -17,6 +17,10 @@ Ce dossier décrit comment utiliser Raiton pour créer un serveur d'API.
|
|
|
17
17
|
| [injection.md](injection.md) | Injecter des services et séparer la logique métier |
|
|
18
18
|
| [middleware.md](middleware.md) | Exécuter des règles transverses sur les requêtes |
|
|
19
19
|
| [responses.md](responses.md) | Structurer les réponses et les erreurs |
|
|
20
|
+
| [contracts.md](contracts.md) | Contrats schema-first : validation, types, OpenAPI et client |
|
|
21
|
+
| [observability.md](observability.md) | Corrélation, métriques, traces et arrêt gracieux |
|
|
22
|
+
| [recipes/README.md](recipes/README.md) | Recettes exécutables par fonctionnalité |
|
|
23
|
+
| [en/README.md](en/README.md) | English reference |
|
|
20
24
|
| [body-parser.md](body-parser.md) | Lire JSON, formulaires et fichiers |
|
|
21
25
|
| [security.md](security.md) | Sécurité HTTP, CORS, rate-limit, body-limit |
|
|
22
26
|
| [cache.md](cache.md) | ETag (validation) et cache de routes (`@Cache`) |
|
|
@@ -45,18 +49,20 @@ Ce dossier décrit comment utiliser Raiton pour créer un serveur d'API.
|
|
|
45
49
|
9. lire [injection.md](injection.md)
|
|
46
50
|
10. lire [middleware.md](middleware.md)
|
|
47
51
|
11. lire [responses.md](responses.md)
|
|
48
|
-
12. lire [
|
|
49
|
-
13. lire [
|
|
50
|
-
14. lire [
|
|
51
|
-
15. lire [
|
|
52
|
-
16. lire [
|
|
53
|
-
17. lire [
|
|
54
|
-
18. lire [
|
|
55
|
-
19. lire [
|
|
56
|
-
20. lire [
|
|
57
|
-
21. lire [
|
|
58
|
-
22. lire [
|
|
59
|
-
23. lire [
|
|
52
|
+
12. lire [contracts.md](contracts.md)
|
|
53
|
+
13. lire [observability.md](observability.md)
|
|
54
|
+
14. lire [body-parser.md](body-parser.md)
|
|
55
|
+
15. lire [security.md](security.md)
|
|
56
|
+
16. lire [https.md](https.md)
|
|
57
|
+
17. lire [openapi/README.md](openapi/README.md)
|
|
58
|
+
18. lire [sockets.md](sockets.md)
|
|
59
|
+
19. lire [mcp.md](mcp.md)
|
|
60
|
+
20. lire [scheduler.md](scheduler.md)
|
|
61
|
+
21. lire [health-check.md](health-check.md)
|
|
62
|
+
22. lire [types.md](types.md)
|
|
63
|
+
23. lire [tutorial.md](tutorial.md)
|
|
64
|
+
24. lire [plugins.md](plugins.md)
|
|
65
|
+
25. lire [cli.md](cli.md)
|
|
60
66
|
|
|
61
67
|
## Ce que couvre ce guide
|
|
62
68
|
|
package/docs/user-guide/cli.md
CHANGED
|
@@ -35,6 +35,27 @@ deno task compile # génère un binaire autonome (build/bin/raiton)
|
|
|
35
35
|
- `build` génère un artefact exécutable
|
|
36
36
|
- `start` démarre l’application compilée (sans HMR)
|
|
37
37
|
|
|
38
|
+
## Onboarding, contrats et diagnostic
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
bun raiton new my-api --template api --runtime bun --yes
|
|
42
|
+
bun raiton generate resource users
|
|
43
|
+
bun raiton routes --json
|
|
44
|
+
bun raiton inspect --json
|
|
45
|
+
bun raiton why GET /api/users/:id
|
|
46
|
+
bun raiton doctor --json
|
|
47
|
+
bun raiton openapi export --out openapi.json
|
|
48
|
+
bun raiton client --out ./sdk
|
|
49
|
+
bun raiton contract check --baseline openapi.baseline.json
|
|
50
|
+
bun raiton mcp list --json
|
|
51
|
+
bun raiton mcp conformance --json
|
|
52
|
+
bun raiton docs agents
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
Toutes les commandes machine écrivent un document JSON unique sur `stdout`
|
|
56
|
+
(logs sur `stderr`) et utilisent des codes de sortie stables : `0` succès,
|
|
57
|
+
`1` usage, `2` prérequis manquant, `3` conflit de fichiers, `4` diagnostic.
|
|
58
|
+
|
|
38
59
|
## Commandes utiles
|
|
39
60
|
|
|
40
61
|
```bash
|
|
@@ -26,11 +26,25 @@ export default {
|
|
|
26
26
|
}
|
|
27
27
|
```
|
|
28
28
|
|
|
29
|
+
## Chargement et validation
|
|
30
|
+
|
|
31
|
+
Ordre de chargement documenté :
|
|
32
|
+
|
|
33
|
+
```text
|
|
34
|
+
raiton.config.ts → .mts → .cts → .js → .mjs → .cjs → .json
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
La configuration est validée **avant l’ouverture du port**. Une valeur
|
|
38
|
+
invalide produit des erreurs par champ et empêche l’écoute. Le schéma JSON
|
|
39
|
+
publié est disponible dans `docs/generated/config-schema.json` ou via
|
|
40
|
+
`raiton inspect --config-schema`.
|
|
41
|
+
|
|
29
42
|
## Comment l’utiliser
|
|
30
43
|
|
|
31
44
|
- placez le fichier à la racine du projet
|
|
32
45
|
- gardez `source/main.ts` comme point d’entrée applicatif
|
|
33
46
|
- ajustez `rootDir` si votre code source n’est pas dans `source/`
|
|
47
|
+
- utilisez `defineConfigSync` pour le typage et la validation à la définition
|
|
34
48
|
|
|
35
49
|
## Avantages
|
|
36
50
|
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
# Contrats schema-first
|
|
2
|
+
|
|
3
|
+
Une seule définition alimente la validation runtime, les types TypeScript, OpenAPI et le client généré.
|
|
4
|
+
|
|
5
|
+
## Déclarer un contrat
|
|
6
|
+
|
|
7
|
+
```ts
|
|
8
|
+
import {t} from "raiton/contracts"
|
|
9
|
+
|
|
10
|
+
export const CreateUser = t.object({
|
|
11
|
+
email: t.string().email(),
|
|
12
|
+
name: t.string().min(2),
|
|
13
|
+
age: t.integer().min(0).optional(),
|
|
14
|
+
})
|
|
15
|
+
|
|
16
|
+
export type CreateUser = t.infer<typeof CreateUser>
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Brancher une route
|
|
20
|
+
|
|
21
|
+
```ts
|
|
22
|
+
import {Body, Controllable, Post} from "raiton/framework"
|
|
23
|
+
import {Input, Output, t} from "raiton/contracts"
|
|
24
|
+
|
|
25
|
+
const User = t.object({id: t.string(), name: t.string()})
|
|
26
|
+
|
|
27
|
+
@Controllable("/users")
|
|
28
|
+
export class UsersController {
|
|
29
|
+
@Post("/")
|
|
30
|
+
@Input(CreateUser)
|
|
31
|
+
@Output(User)
|
|
32
|
+
create(@Body() input: CreateUser) {
|
|
33
|
+
return this.users.create(input)
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## Erreur stable
|
|
39
|
+
|
|
40
|
+
Une entrée invalide n'exécute jamais le handler :
|
|
41
|
+
|
|
42
|
+
```json
|
|
43
|
+
{
|
|
44
|
+
"error": true,
|
|
45
|
+
"code": "VALIDATION_ERROR",
|
|
46
|
+
"message": "Invalid request",
|
|
47
|
+
"statusCode": 400,
|
|
48
|
+
"details": [{"path": "email", "code": "invalid_format", "message": "Expected string to match 'email' format"}],
|
|
49
|
+
"docsUrl": "https://github.com/protorians/raiton/blob/main/docs/user-guide/recipes/contracts.md"
|
|
50
|
+
}
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
## Validation de sortie
|
|
54
|
+
|
|
55
|
+
- `validation.responses: "auto"` (défaut) : active en développement, désactive en production.
|
|
56
|
+
- `true` / `false` : force le comportement.
|
|
57
|
+
- En développement, un écart retourne `OUTPUT_VALIDATION_ERROR` avec la route et le champ fautif.
|
|
58
|
+
- En production, aucun coût n'est ajouté.
|
|
59
|
+
|
|
60
|
+
## OpenAPI et client
|
|
61
|
+
|
|
62
|
+
```bash
|
|
63
|
+
raiton openapi export --out openapi.json
|
|
64
|
+
raiton client --out ./sdk
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
Les schémas d'entrée/sortie OpenAPI proviennent des mêmes `@Input`/`@Output`. Le client généré n'utilise jamais `any` : les schémas inconnus deviennent `unknown`.
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
# Raiton user guide (English)
|
|
2
|
+
|
|
3
|
+
This is the English reference for the same contract as the French guide.
|
|
4
|
+
|
|
5
|
+
## Start
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
bun raiton new my-api --template api --runtime bun --yes
|
|
9
|
+
cd my-api
|
|
10
|
+
bun raiton dev
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
- `GET /api/health` — health check.
|
|
14
|
+
- Example controller route under `/api/<project>`.
|
|
15
|
+
- `bun test` — generated tests.
|
|
16
|
+
|
|
17
|
+
## Configuration
|
|
18
|
+
|
|
19
|
+
`raiton.config.ts` is typed and validated before the port opens. Invalid fields prevent listening and report each field.
|
|
20
|
+
|
|
21
|
+
```ts
|
|
22
|
+
import {defineConfigSync} from "raiton/core"
|
|
23
|
+
|
|
24
|
+
export default defineConfigSync({
|
|
25
|
+
rootDir: "./source",
|
|
26
|
+
port: 5711,
|
|
27
|
+
prefix: "/api",
|
|
28
|
+
observability: {mode: "off"},
|
|
29
|
+
validation: {responses: "auto"},
|
|
30
|
+
})
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## Contracts
|
|
34
|
+
|
|
35
|
+
One schema feeds runtime validation, TypeScript types, OpenAPI and the generated client:
|
|
36
|
+
|
|
37
|
+
```ts
|
|
38
|
+
import {t} from "raiton/contracts"
|
|
39
|
+
|
|
40
|
+
export const CreateUser = t.object({email: t.string().email()})
|
|
41
|
+
export type CreateUser = t.infer<typeof CreateUser>
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
Use `@Input(CreateUser)` / `@Output(User)`. Invalid input is rejected before the handler with a stable `VALIDATION_ERROR` payload.
|
|
45
|
+
|
|
46
|
+
## CLI
|
|
47
|
+
|
|
48
|
+
All diagnostic and generation commands support `--json`, stable exit codes and non-interactive operation.
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
raiton routes --json
|
|
52
|
+
raiton inspect --json
|
|
53
|
+
raiton why GET /api/users/:id
|
|
54
|
+
raiton doctor --json
|
|
55
|
+
raiton openapi export --out openapi.json
|
|
56
|
+
raiton client --out ./sdk
|
|
57
|
+
raiton contract check --baseline openapi.baseline.json
|
|
58
|
+
raiton mcp list --json
|
|
59
|
+
raiton mcp conformance --json
|
|
60
|
+
raiton docs agents
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
Exit codes: `0` success, `1` usage, `2` missing prerequisite, `3` file conflict, `4` diagnostic failure.
|
|
64
|
+
|
|
65
|
+
## MCP
|
|
66
|
+
|
|
67
|
+
```ts
|
|
68
|
+
@McpServer({name: "math", path: "/mcp"})
|
|
69
|
+
export class MathServer {
|
|
70
|
+
@McpTool({name: "add", annotations: {readOnlyHint: true}})
|
|
71
|
+
add(@McpArg("a", "First", Number) a: number, @McpArg("b", "Second", Number) b: number) {
|
|
72
|
+
return {result: a + b}
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
- HTTP and stdio transports share the same conformance suite.
|
|
78
|
+
- Destructive tools are hidden unless `mcp.exposeDestructive` or the server option is explicit.
|
|
79
|
+
- Tool calls are audited and secrets are redacted.
|
|
80
|
+
|
|
81
|
+
## Observability
|
|
82
|
+
|
|
83
|
+
See [observability](../observability.md) for correlation ids, Prometheus metrics, OTLP traces and graceful shutdown.
|
|
@@ -10,7 +10,19 @@ La séparation attendue est la suivante :
|
|
|
10
10
|
- `source/main.ts` crée et démarre le serveur
|
|
11
11
|
- `source/modules/`, `source/controllers/`, `source/services/` et `source/repositories/` contiennent la logique applicative
|
|
12
12
|
|
|
13
|
-
##
|
|
13
|
+
## Créer un projet en une commande
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
bun raiton new my-api --template api --runtime bun --yes
|
|
17
|
+
cd my-api
|
|
18
|
+
bun raiton dev
|
|
19
|
+
bun test
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
`--template` accepte `api`, `minimal` et `mcp-agent`. `--dry-run` affiche le
|
|
23
|
+
plan sans écrire, `--offline` et `--no-install` désactivent l'installation.
|
|
24
|
+
|
|
25
|
+
## Installer dans un projet existant
|
|
14
26
|
|
|
15
27
|
```bash
|
|
16
28
|
bun add raiton reflect-metadata
|
package/docs/user-guide/mcp.md
CHANGED
|
@@ -98,6 +98,50 @@ La version du protocole est vérifiée : une version non supportée renvoie `406
|
|
|
98
98
|
|
|
99
99
|
Les fichiers `*.mcp.ts` bénéficient du **hot reload** : une modification recharge le serveur MCP sans redémarrer le process, exactement comme les contrôleurs et les sockets.
|
|
100
100
|
|
|
101
|
+
## Transports HTTP et stdio
|
|
102
|
+
|
|
103
|
+
Le même registre d'outils est servi par :
|
|
104
|
+
|
|
105
|
+
- **Streamable HTTP** sur le chemin déclaré (`/mcp` par défaut) ;
|
|
106
|
+
- **stdio**, pour les clients qui lancent le serveur comme sous-processus :
|
|
107
|
+
|
|
108
|
+
```bash
|
|
109
|
+
raiton mcp serve math --stdio
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
Les deux transports passent la même suite de conformité :
|
|
113
|
+
|
|
114
|
+
```bash
|
|
115
|
+
raiton mcp conformance math --json
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
## Schémas et sûreté
|
|
119
|
+
|
|
120
|
+
```ts
|
|
121
|
+
@McpTool({
|
|
122
|
+
name: "refund",
|
|
123
|
+
description: "Rembourse une commande",
|
|
124
|
+
inputSchema: RefundInput,
|
|
125
|
+
outputSchema: RefundOutput,
|
|
126
|
+
scopes: ["payments:write"],
|
|
127
|
+
annotations: {readOnlyHint: false, destructiveHint: true, idempotentHint: false},
|
|
128
|
+
})
|
|
129
|
+
refund(@McpArg("orderId", "Identifiant", String) orderId: string) {
|
|
130
|
+
return this.payments.refund(orderId)
|
|
131
|
+
}
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
- `inputSchema` / `outputSchema` sont exposés à `tools/list`.
|
|
135
|
+
- Un outil `destructiveHint: true` est **masqué par défaut** ; il faut
|
|
136
|
+
`mcp.exposeDestructive: true` dans `raiton.config.ts` ou
|
|
137
|
+
`@McpServer({exposeDestructive: true})`.
|
|
138
|
+
- Les scopes sont vérifiés lorsqu'ils sont fournis (`x-mcp-scopes` en HTTP,
|
|
139
|
+
contexte du transport en stdio).
|
|
140
|
+
- Les appels sont audités (identifiant, outil, durée, acteur, résultat) et les
|
|
141
|
+
secrets sont expurgés.
|
|
142
|
+
- Une limite de débit par outil peut être configurée
|
|
143
|
+
(`mcp.rateLimitPerMinute`).
|
|
144
|
+
|
|
101
145
|
## OpenAPI
|
|
102
146
|
|
|
103
147
|
Les serveurs MCP sont documentés dans le contrat OpenAPI généré, avec une extension `x-mcp` listant outils, prompts et ressources.
|
|
@@ -107,11 +151,10 @@ Les serveurs MCP sont documentés dans le contrat OpenAPI généré, avec une ex
|
|
|
107
151
|
- intégration native avec le serveur HTTP existant
|
|
108
152
|
- réutilise l’injection de dépendances
|
|
109
153
|
- HMR, artifacts et OpenAPI homogènes avec le reste du framework
|
|
110
|
-
-
|
|
154
|
+
- transport stdio pour les agents locaux
|
|
111
155
|
|
|
112
156
|
## Inconvénients
|
|
113
157
|
|
|
114
|
-
- transport limité au Streamable HTTP (pas de stdio fourni)
|
|
115
158
|
- les notifications serveur `GET` (SSE) restent basiques
|
|
116
159
|
- le protocole évolue vite, la liste des versions supportées doit être suivie
|
|
117
160
|
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
# Observabilité et exploitation
|
|
2
|
+
|
|
3
|
+
L'observabilité est opt-in. Désactivée, elle n'ajoute aucun travail sur le chemin chaud.
|
|
4
|
+
|
|
5
|
+
## Activer
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
RAITON_OBSERVABILITY=off|metrics|traces|all
|
|
9
|
+
RAITON_METRICS_PATH=/metrics
|
|
10
|
+
RAITON_OTEL_ENDPOINT=http://localhost:4318
|
|
11
|
+
RAITON_REQUEST_ID_HEADER=x-request-id
|
|
12
|
+
RAITON_SHUTDOWN_TIMEOUT_MS=10000
|
|
13
|
+
RAITON_ACCESS_LOG=1
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
`RAITON_ACCESS_LOG=1` ajoute une ligne par requête avec l'identifiant de
|
|
17
|
+
corrélation et celui de trace. Les logs d'erreur portent toujours
|
|
18
|
+
l'identifiant.
|
|
19
|
+
|
|
20
|
+
Ou dans `raiton.config.ts` :
|
|
21
|
+
|
|
22
|
+
```ts
|
|
23
|
+
export default {
|
|
24
|
+
observability: {mode: "all", metricsPath: "/metrics"},
|
|
25
|
+
shutdown: {timeoutMs: 10000},
|
|
26
|
+
}
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## Corrélation
|
|
30
|
+
|
|
31
|
+
Chaque requête reçoit un identifiant :
|
|
32
|
+
|
|
33
|
+
- repris de `x-request-id` s'il est valide ;
|
|
34
|
+
- sinon généré ;
|
|
35
|
+
- présent dans la réponse, les logs et le contexte (`ctx.state.requestId`).
|
|
36
|
+
|
|
37
|
+
## Métriques
|
|
38
|
+
|
|
39
|
+
`GET /metrics` expose le format texte Prometheus :
|
|
40
|
+
|
|
41
|
+
- `http_requests_total{method,route,status}`
|
|
42
|
+
- `http_request_duration_seconds` (histogramme)
|
|
43
|
+
- `http_errors_total{method,route,status}`
|
|
44
|
+
|
|
45
|
+
Le chemin est relatif au préfixe de l'application.
|
|
46
|
+
|
|
47
|
+
## Traces
|
|
48
|
+
|
|
49
|
+
- Les spans entrants utilisent `traceparent` lorsqu'il est fourni.
|
|
50
|
+
- Les appels sortants doivent utiliser `tracedFetch` (exporté par `raiton/framework`) pour partager la trace.
|
|
51
|
+
- Export OTLP/HTTP JSON vers `RAITON_OTEL_ENDPOINT`.
|
|
52
|
+
|
|
53
|
+
## Erreurs
|
|
54
|
+
|
|
55
|
+
Toutes les erreurs HTTP publiques suivent le catalogue `code → statut → message → docsUrl`. En production, aucune pile d'appels n'est retournée.
|
|
56
|
+
|
|
57
|
+
## Arrêt gracieux
|
|
58
|
+
|
|
59
|
+
Sur `SIGINT`/`SIGTERM` :
|
|
60
|
+
|
|
61
|
+
1. readiness passe immédiatement à `false` (`/health` répond 503) ;
|
|
62
|
+
2. les nouvelles connexions sont refusées ;
|
|
63
|
+
3. les requêtes en cours sont drainées jusqu'à `shutdown.timeoutMs` ;
|
|
64
|
+
4. le processus sort en `0`.
|
|
65
|
+
|
|
66
|
+
## Budgets
|
|
67
|
+
|
|
68
|
+
Les budgets de la spec 001 restent la référence :
|
|
69
|
+
|
|
70
|
+
| Mode | Surcoût cible p50 |
|
|
71
|
+
|---|---|
|
|
72
|
+
| `off` | 0 mesurable |
|
|
73
|
+
| `metrics` | ≤ 5 % |
|
|
74
|
+
| `traces` | ≤ 10 % |
|
|
@@ -30,6 +30,16 @@ app.register(openApiPlugin({
|
|
|
30
30
|
|
|
31
31
|
`route` désigne la page de documentation et `endpoint` le point d’accès au document JSON. Le titre et la version apparaissent dans les informations du contrat.
|
|
32
32
|
|
|
33
|
+
Sans fonction `ui`, le plugin sert une interface **Redoc** par défaut. Le même
|
|
34
|
+
document est exportable sans démarrer le serveur :
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
raiton openapi export --out openapi.json
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
Les schémas `@Input`/`@Output` (schema-first) remplacent les heuristiques et
|
|
41
|
+
alimentent l'OpenAPI depuis la même définition que la validation runtime.
|
|
42
|
+
|
|
33
43
|
## Décrire les routes
|
|
34
44
|
|
|
35
45
|
Le plugin exploite les métadonnées ajoutées avec les décorateurs :
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# Recettes exécutables
|
|
2
|
+
|
|
3
|
+
Chaque fonctionnalité publique dispose d'une recette : objectif, fichier complet, commande, sortie attendue.
|
|
4
|
+
Une recette qui ne s'exécute pas en CI est considérée comme cassée.
|
|
5
|
+
|
|
6
|
+
| Fonctionnalité | Recette | Commande |
|
|
7
|
+
|---|---|---|
|
|
8
|
+
| Création de projet | [new-project.md](new-project.md) | `raiton new demo --template api --yes` |
|
|
9
|
+
| Génération d'artifacts | [generate.md](generate.md) | `raiton generate resource users` |
|
|
10
|
+
| Contrats schema-first | [contracts.md](contracts.md) | `raiton contract check --baseline baseline.json` |
|
|
11
|
+
| MCP HTTP + stdio | [mcp-stdio.md](mcp-stdio.md) | `raiton mcp conformance --json` |
|
|
12
|
+
| Manifeste et découverte | [manifest.md](manifest.md) | `raiton inspect --json` |
|
|
13
|
+
| Observabilité | [observability.md](observability.md) | `RAITON_OBSERVABILITY=all raiton dev` |
|
|
14
|
+
| Diagnostic | [doctor.md](doctor.md) | `raiton doctor --json` |
|
|
15
|
+
|
|
16
|
+
## Couverture des décorateurs
|
|
17
|
+
|
|
18
|
+
| Décorateur | Documentation |
|
|
19
|
+
|---|---|
|
|
20
|
+
| `@Controllable` | [../decorators/controllable.md](../decorators/controllable.md) |
|
|
21
|
+
| `@Get/@Post/@Put/@Patch/@Delete` | [../decorators/routes.md](../decorators/routes.md) |
|
|
22
|
+
| `@Body/@Query/@Param/@Headers/@Cookie` | [../decorators/parameters.md](../decorators/parameters.md) |
|
|
23
|
+
| `@Injectable/@Inject` | [../decorators/injection.md](../decorators/injection.md) |
|
|
24
|
+
| `@Middleware` | [../decorators/middleware.md](../decorators/middleware.md) |
|
|
25
|
+
| `@Guard` | [../decorators/guard.md](../decorators/guard.md) |
|
|
26
|
+
| `@Cache` | [../decorators/cache.md](../decorators/cache.md) |
|
|
27
|
+
| `@HealthCheck` | [../decorators/health-check.md](../decorators/health-check.md) |
|
|
28
|
+
| `@McpServer/@McpTool/@McpArg` | [../decorators/mcp.md](../decorators/mcp.md) |
|
|
29
|
+
| `@Scheduler` | [../decorators/scheduler.md](../decorators/scheduler.md) |
|
|
30
|
+
| `@Socket` | [../decorators/socket.md](../decorators/socket.md) |
|
|
31
|
+
| `@ApiOperation/@ApiResponse/@ApiProperty` | [../decorators/api-operation.md](../decorators/api-operation.md) |
|
|
32
|
+
| `@Input/@Output` | [contracts.md](contracts.md) |
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
# Recette — contrats schema-first
|
|
2
|
+
|
|
3
|
+
**Objectif** : validation, types, OpenAPI et client depuis une seule définition.
|
|
4
|
+
|
|
5
|
+
**Fichier** (`source/contracts/user.contract.ts`)
|
|
6
|
+
|
|
7
|
+
```ts
|
|
8
|
+
import {t} from "raiton/contracts"
|
|
9
|
+
|
|
10
|
+
export const CreateUser = t.object({
|
|
11
|
+
email: t.string().email(),
|
|
12
|
+
name: t.string().min(2),
|
|
13
|
+
})
|
|
14
|
+
|
|
15
|
+
export type CreateUser = t.infer<typeof CreateUser>
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
**Route**
|
|
19
|
+
|
|
20
|
+
```ts
|
|
21
|
+
@Controllable("/users")
|
|
22
|
+
export class UsersController {
|
|
23
|
+
@Post("/")
|
|
24
|
+
@Input(CreateUser)
|
|
25
|
+
create(@Body() input: CreateUser) {
|
|
26
|
+
return input
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
**Commandes**
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
curl -i -X POST localhost:5711/api/users -H 'content-type: application/json' -d '{"email":"no","name":"x"}'
|
|
35
|
+
raiton openapi export --out openapi.json
|
|
36
|
+
raiton client --out ./sdk
|
|
37
|
+
raiton contract snapshot --out contract.baseline.json
|
|
38
|
+
raiton contract check --baseline contract.baseline.json
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
**Attendu**
|
|
42
|
+
|
|
43
|
+
```json
|
|
44
|
+
{
|
|
45
|
+
"error": true,
|
|
46
|
+
"code": "VALIDATION_ERROR",
|
|
47
|
+
"statusCode": 400,
|
|
48
|
+
"details": [{"path": "email", "code": "invalid_format", "message": "Expected string to match 'email' format"}]
|
|
49
|
+
}
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
Le client généré compile en TypeScript strict sans `any`.
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# Recette — diagnostic
|
|
2
|
+
|
|
3
|
+
**Objectif** : obtenir une action corrective par problème.
|
|
4
|
+
|
|
5
|
+
```bash
|
|
6
|
+
raiton doctor
|
|
7
|
+
raiton doctor --json
|
|
8
|
+
raiton doctor --fix
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
**Attendu**
|
|
12
|
+
|
|
13
|
+
- chaque problème expose un code stable, une sévérité, une action et un lien de documentation ;
|
|
14
|
+
- `--fix` applique uniquement les corrections sûres (par exemple `.env.example`) ;
|
|
15
|
+
- une erreur de sévérité `error` retourne le code de sortie `4` ;
|
|
16
|
+
- une configuration invalide empêche l'écoute et liste les champs fautifs.
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# Recette — générer une ressource
|
|
2
|
+
|
|
3
|
+
**Objectif** : produire des fichiers qui compilent et dont le test passe.
|
|
4
|
+
|
|
5
|
+
```bash
|
|
6
|
+
raiton generate resource users
|
|
7
|
+
raiton generate mcp-tool refund
|
|
8
|
+
```
|
|
9
|
+
|
|
10
|
+
**Fichiers produits**
|
|
11
|
+
|
|
12
|
+
```text
|
|
13
|
+
source/dtos/users.dto.ts
|
|
14
|
+
source/repositories/users.repository.ts
|
|
15
|
+
source/services/users.service.ts
|
|
16
|
+
source/controllers/users.controller.ts
|
|
17
|
+
tests/users.test.ts
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
**Simulation et conflits**
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
raiton generate resource users --dry-run
|
|
24
|
+
raiton generate resource users --force
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
**Attendu** : sans `--force`, un fichier existant n'est jamais écrasé (code de sortie `3`).
|
|
28
|
+
Avec `--dry-run`, aucun fichier n'est écrit.
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# Recette — inventaire et origine d'une route
|
|
2
|
+
|
|
3
|
+
**Objectif** : obtenir une vérité machine sur le projet.
|
|
4
|
+
|
|
5
|
+
```bash
|
|
6
|
+
raiton inspect --json > manifest.json
|
|
7
|
+
raiton inspect --check
|
|
8
|
+
raiton routes --json
|
|
9
|
+
raiton why GET /api/users/:id --json
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
**Attendu**
|
|
13
|
+
|
|
14
|
+
- `manifest.json` valide `schemaVersion: "1.0.0"` ;
|
|
15
|
+
- routes, artifacts, graphe d'injection, clés de configuration, variables d'environnement, outils MCP et emplacements source ;
|
|
16
|
+
- `why` retourne le fichier, la ligne, le décorateur et l'artifact ;
|
|
17
|
+
- en développement, `GET /__dev` affiche la même information.
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# Recette — MCP HTTP et stdio
|
|
2
|
+
|
|
3
|
+
**Objectif** : servir les mêmes outils sur les deux transports, avec default-deny sur les outils destructifs.
|
|
4
|
+
|
|
5
|
+
```ts
|
|
6
|
+
@McpServer({name: "math", path: "/mcp"})
|
|
7
|
+
export class MathServer {
|
|
8
|
+
@McpTool({name: "add", annotations: {readOnlyHint: true}})
|
|
9
|
+
add(@McpArg("a", "First", Number) a: number, @McpArg("b", "Second", Number) b: number) {
|
|
10
|
+
return {result: a + b}
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
@McpTool({name: "drop", annotations: {destructiveHint: true}})
|
|
14
|
+
drop() {
|
|
15
|
+
return {dropped: true}
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
**Commandes**
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
raiton mcp list --json
|
|
24
|
+
raiton mcp inspect math --json
|
|
25
|
+
raiton mcp test math.add --args '{"a":1,"b":2}' --json
|
|
26
|
+
raiton mcp serve math --stdio
|
|
27
|
+
raiton mcp conformance math --json
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
**Attendu**
|
|
31
|
+
|
|
32
|
+
- `tools/list` contient `add`, pas `drop`.
|
|
33
|
+
- `tools/call` sur `drop` retourne `Tool not found`.
|
|
34
|
+
- HTTP et stdio passent la même suite de conformité.
|
|
35
|
+
- Les journaux d'audit vont sur stderr et les secrets sont expurgés.
|