mcpmake 0.1.1 → 0.2.1
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/README.md +88 -635
- package/dist/commands/bundle.d.ts +1 -0
- package/dist/commands/bundle.d.ts.map +1 -0
- package/dist/commands/bundle.js +5 -4
- package/dist/commands/bundle.js.map +1 -0
- package/dist/commands/ci.d.ts +1 -0
- package/dist/commands/ci.d.ts.map +1 -0
- package/dist/commands/ci.js +3 -2
- package/dist/commands/ci.js.map +1 -0
- package/dist/commands/deploy.d.ts +1 -0
- package/dist/commands/deploy.d.ts.map +1 -0
- package/dist/commands/deploy.js +4 -3
- package/dist/commands/deploy.js.map +1 -0
- package/dist/commands/diff.d.ts +1 -0
- package/dist/commands/diff.d.ts.map +1 -0
- package/dist/commands/diff.js +5 -4
- package/dist/commands/diff.js.map +1 -0
- package/dist/commands/from/describe.d.ts +1 -0
- package/dist/commands/from/describe.d.ts.map +1 -0
- package/dist/commands/from/describe.js +11 -10
- package/dist/commands/from/describe.js.map +1 -0
- package/dist/commands/from/har.d.ts +1 -0
- package/dist/commands/from/har.d.ts.map +1 -0
- package/dist/commands/from/har.js +14 -13
- package/dist/commands/from/har.js.map +1 -0
- package/dist/commands/from/openapi.d.ts +1 -0
- package/dist/commands/from/openapi.d.ts.map +1 -0
- package/dist/commands/from/openapi.js +17 -16
- package/dist/commands/from/openapi.js.map +1 -0
- package/dist/commands/from/postman.d.ts +1 -0
- package/dist/commands/from/postman.d.ts.map +1 -0
- package/dist/commands/from/postman.js +13 -12
- package/dist/commands/from/postman.js.map +1 -0
- package/dist/commands/from/stainless.d.ts +110 -0
- package/dist/commands/from/stainless.d.ts.map +1 -0
- package/dist/commands/from/stainless.js +272 -0
- package/dist/commands/from/stainless.js.map +1 -0
- package/dist/commands/from/target-support.d.ts +1 -0
- package/dist/commands/from/target-support.d.ts.map +1 -0
- package/dist/commands/from/target-support.js +2 -1
- package/dist/commands/from/target-support.js.map +1 -0
- package/dist/commands/from/url.d.ts +1 -0
- package/dist/commands/from/url.d.ts.map +1 -0
- package/dist/commands/from/url.js +14 -13
- package/dist/commands/from/url.js.map +1 -0
- package/dist/commands/from/website.d.ts +1 -0
- package/dist/commands/from/website.d.ts.map +1 -0
- package/dist/commands/from/website.js +17 -16
- package/dist/commands/from/website.js.map +1 -0
- package/dist/commands/lint.d.ts +1 -0
- package/dist/commands/lint.d.ts.map +1 -0
- package/dist/commands/lint.js +6 -5
- package/dist/commands/lint.js.map +1 -0
- package/dist/commands/merge.d.ts +1 -0
- package/dist/commands/merge.d.ts.map +1 -0
- package/dist/commands/merge.js +3 -2
- package/dist/commands/merge.js.map +1 -0
- package/dist/commands/publish.d.ts +1 -0
- package/dist/commands/publish.d.ts.map +1 -0
- package/dist/commands/publish.js +4 -3
- package/dist/commands/publish.js.map +1 -0
- package/dist/commands/rescan.d.ts +1 -0
- package/dist/commands/rescan.d.ts.map +1 -0
- package/dist/commands/rescan.js +12 -11
- package/dist/commands/rescan.js.map +1 -0
- package/dist/commands/update.d.ts +1 -0
- package/dist/commands/update.d.ts.map +1 -0
- package/dist/commands/update.js +10 -9
- package/dist/commands/update.js.map +1 -0
- package/dist/commands/verify.d.ts +1 -0
- package/dist/commands/verify.d.ts.map +1 -0
- package/dist/commands/verify.js +7 -6
- package/dist/commands/verify.js.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +23 -2
- package/dist/index.js.map +1 -0
- package/dist/registry/official-registry.d.ts +1 -0
- package/dist/registry/official-registry.d.ts.map +1 -0
- package/dist/registry/official-registry.js +1 -0
- package/dist/registry/official-registry.js.map +1 -0
- package/package.json +20 -46
- package/dist/analyzer/auth-detector.d.ts +0 -12
- package/dist/analyzer/auth-detector.js +0 -142
- package/dist/analyzer/dom-parser.d.ts +0 -10
- package/dist/analyzer/dom-parser.js +0 -259
- package/dist/analyzer/goal-crawler.d.ts +0 -25
- package/dist/analyzer/goal-crawler.js +0 -177
- package/dist/analyzer/hybrid-detector.d.ts +0 -28
- package/dist/analyzer/hybrid-detector.js +0 -96
- package/dist/analyzer/index.d.ts +0 -12
- package/dist/analyzer/index.js +0 -8
- package/dist/analyzer/screenshot-capture.d.ts +0 -29
- package/dist/analyzer/screenshot-capture.js +0 -42
- package/dist/analyzer/selector-builder.d.ts +0 -19
- package/dist/analyzer/selector-builder.js +0 -199
- package/dist/analyzer/semantic-analyzer.d.ts +0 -13
- package/dist/analyzer/semantic-analyzer.js +0 -145
- package/dist/analyzer/site-crawler.d.ts +0 -38
- package/dist/analyzer/site-crawler.js +0 -235
- package/dist/cloud/billing/billing-engine.d.ts +0 -44
- package/dist/cloud/billing/billing-engine.js +0 -81
- package/dist/cloud/billing/credit-store.d.ts +0 -64
- package/dist/cloud/billing/credit-store.js +0 -168
- package/dist/cloud/billing/index.d.ts +0 -4
- package/dist/cloud/billing/index.js +0 -2
- package/dist/cloud/billing/usage-store.d.ts +0 -42
- package/dist/cloud/billing/usage-store.js +0 -85
- package/dist/cloud/billing/usage-tracker.d.ts +0 -38
- package/dist/cloud/billing/usage-tracker.js +0 -95
- package/dist/cloud/build-pipeline.d.ts +0 -39
- package/dist/cloud/build-pipeline.js +0 -310
- package/dist/cloud/build-queue.d.ts +0 -30
- package/dist/cloud/build-queue.js +0 -70
- package/dist/cloud/caddy-manager.d.ts +0 -18
- package/dist/cloud/caddy-manager.js +0 -97
- package/dist/cloud/container-backend.d.ts +0 -62
- package/dist/cloud/container-backend.js +0 -59
- package/dist/cloud/container-manager.d.ts +0 -64
- package/dist/cloud/container-manager.js +0 -301
- package/dist/cloud/crypto.d.ts +0 -27
- package/dist/cloud/crypto.js +0 -63
- package/dist/cloud/db/index.d.ts +0 -27
- package/dist/cloud/db/index.js +0 -53
- package/dist/cloud/db/migrations.d.ts +0 -12
- package/dist/cloud/db/migrations.js +0 -329
- package/dist/cloud/db/pg-store.d.ts +0 -45
- package/dist/cloud/db/pg-store.js +0 -336
- package/dist/cloud/failure-tracker.d.ts +0 -51
- package/dist/cloud/failure-tracker.js +0 -102
- package/dist/cloud/idle-monitor.d.ts +0 -30
- package/dist/cloud/idle-monitor.js +0 -70
- package/dist/cloud/mailer.d.ts +0 -21
- package/dist/cloud/mailer.js +0 -193
- package/dist/cloud/mcp-proxy.d.ts +0 -58
- package/dist/cloud/mcp-proxy.js +0 -203
- package/dist/cloud/metric-samples.d.ts +0 -43
- package/dist/cloud/metric-samples.js +0 -85
- package/dist/cloud/metrics.d.ts +0 -26
- package/dist/cloud/metrics.js +0 -59
- package/dist/cloud/multipart.d.ts +0 -26
- package/dist/cloud/multipart.js +0 -132
- package/dist/cloud/observability.d.ts +0 -27
- package/dist/cloud/observability.js +0 -98
- package/dist/cloud/rate-limiter.d.ts +0 -31
- package/dist/cloud/rate-limiter.js +0 -58
- package/dist/cloud/request-security.d.ts +0 -5
- package/dist/cloud/request-security.js +0 -74
- package/dist/cloud/resource-monitor.d.ts +0 -69
- package/dist/cloud/resource-monitor.js +0 -130
- package/dist/cloud/secret-store.d.ts +0 -38
- package/dist/cloud/secret-store.js +0 -103
- package/dist/cloud/security.d.ts +0 -26
- package/dist/cloud/security.js +0 -142
- package/dist/cloud/server.d.ts +0 -21
- package/dist/cloud/server.js +0 -1079
- package/dist/cloud/shared-state.d.ts +0 -72
- package/dist/cloud/shared-state.js +0 -159
- package/dist/cloud/ssrf.d.ts +0 -43
- package/dist/cloud/ssrf.js +0 -150
- package/dist/cloud/store.d.ts +0 -41
- package/dist/cloud/store.js +0 -75
- package/dist/cloud/stripe.d.ts +0 -78
- package/dist/cloud/stripe.js +0 -317
- package/dist/cloud/telemetry-store.d.ts +0 -53
- package/dist/cloud/telemetry-store.js +0 -108
- package/dist/cloud/web/auth.d.ts +0 -225
- package/dist/cloud/web/auth.js +0 -555
- package/dist/cloud/web/charts.d.ts +0 -70
- package/dist/cloud/web/charts.js +0 -178
- package/dist/cloud/web/csrf.d.ts +0 -14
- package/dist/cloud/web/csrf.js +0 -22
- package/dist/cloud/web/docs.d.ts +0 -40
- package/dist/cloud/web/docs.js +0 -174
- package/dist/cloud/web/router.d.ts +0 -25
- package/dist/cloud/web/router.js +0 -1921
- package/dist/cloud/web/static/alpine.min.js +0 -5
- package/dist/cloud/web/static/favicon.svg +0 -4
- package/dist/cloud/web/static/htmx-sse.js +0 -290
- package/dist/cloud/web/static/htmx.min.js +0 -1
- package/dist/cloud/web/static/style.css +0 -2683
- package/dist/cloud/web/static-server.d.ts +0 -13
- package/dist/cloud/web/static-server.js +0 -73
- package/dist/cloud/web/template-engine.d.ts +0 -27
- package/dist/cloud/web/template-engine.js +0 -146
- package/dist/cloud/web/templates/layouts/admin.hbs +0 -57
- package/dist/cloud/web/templates/layouts/auth.hbs +0 -138
- package/dist/cloud/web/templates/layouts/base.hbs +0 -16
- package/dist/cloud/web/templates/layouts/dashboard.hbs +0 -39
- package/dist/cloud/web/templates/layouts/landing.hbs +0 -82
- package/dist/cloud/web/templates/pages/admin/overview.hbs +0 -123
- package/dist/cloud/web/templates/pages/admin/servers.hbs +0 -129
- package/dist/cloud/web/templates/pages/admin/telemetry.hbs +0 -39
- package/dist/cloud/web/templates/pages/admin/user-edit.hbs +0 -91
- package/dist/cloud/web/templates/pages/admin/users.hbs +0 -179
- package/dist/cloud/web/templates/pages/auth/forgot-password.hbs +0 -25
- package/dist/cloud/web/templates/pages/auth/login.hbs +0 -33
- package/dist/cloud/web/templates/pages/auth/register.hbs +0 -32
- package/dist/cloud/web/templates/pages/auth/reset-password.hbs +0 -34
- package/dist/cloud/web/templates/pages/dashboard/billing.hbs +0 -140
- package/dist/cloud/web/templates/pages/dashboard/create.hbs +0 -173
- package/dist/cloud/web/templates/pages/dashboard/index.hbs +0 -8
- package/dist/cloud/web/templates/pages/dashboard/server-detail.hbs +0 -280
- package/dist/cloud/web/templates/pages/dashboard/server-logs.hbs +0 -35
- package/dist/cloud/web/templates/pages/dashboard/server-metrics.hbs +0 -63
- package/dist/cloud/web/templates/pages/dashboard/servers-partial.hbs +0 -21
- package/dist/cloud/web/templates/pages/dashboard/servers.hbs +0 -44
- package/dist/cloud/web/templates/pages/docs/show.hbs +0 -16
- package/dist/cloud/web/templates/pages/errors/404.hbs +0 -9
- package/dist/cloud/web/templates/pages/errors/500.hbs +0 -8
- package/dist/cloud/web/templates/pages/landing/index.hbs +0 -223
- package/dist/cloud/web/templates/pages/legal/privacy.hbs +0 -71
- package/dist/cloud/web/templates/pages/legal/terms.hbs +0 -73
- package/dist/cloud/web/templates/partials/admin-stats.hbs +0 -52
- package/dist/cloud/web/templates/partials/flash-message.hbs +0 -6
- package/dist/cloud/web/templates/partials/pricing-table.hbs +0 -103
- package/dist/cloud/web/templates/partials/server-card.hbs +0 -19
- package/dist/cloud/web/templates/partials/status-badge.hbs +0 -1
- package/dist/config/configurable-command.d.ts +0 -13
- package/dist/config/configurable-command.js +0 -70
- package/dist/config/mcpmake-config.d.ts +0 -68
- package/dist/config/mcpmake-config.js +0 -207
- package/dist/docs/cli.md +0 -400
- package/dist/docs/mcp-2026-07-28-migration.md +0 -78
- package/dist/docs/migrate-from-stainless.md +0 -94
- package/dist/docs/quickstart.md +0 -166
- package/dist/docs/show-hn.md +0 -26
- package/dist/docs/website-servers.md +0 -169
- package/dist/emitter/code-writer.d.ts +0 -8
- package/dist/emitter/code-writer.js +0 -25
- package/dist/emitter/index.d.ts +0 -32
- package/dist/emitter/index.js +0 -280
- package/dist/emitter/mcpb-bundler.d.ts +0 -31
- package/dist/emitter/mcpb-bundler.js +0 -172
- package/dist/emitter/project-scaffolder.d.ts +0 -4
- package/dist/emitter/project-scaffolder.js +0 -89
- package/dist/emitter/python-template-loader.d.ts +0 -4
- package/dist/emitter/python-template-loader.js +0 -30
- package/dist/emitter/python-templates/dockerfile.hbs +0 -14
- package/dist/emitter/python-templates/env.example.hbs +0 -6
- package/dist/emitter/python-templates/requirements.txt.hbs +0 -4
- package/dist/emitter/python-templates/server.py.hbs +0 -77
- package/dist/emitter/site-scaffolder.d.ts +0 -13
- package/dist/emitter/site-scaffolder.js +0 -70
- package/dist/emitter/site-template-loader.d.ts +0 -5
- package/dist/emitter/site-template-loader.js +0 -47
- package/dist/emitter/site-templates/browser-manager.ts.hbs +0 -233
- package/dist/emitter/site-templates/config.ts.hbs +0 -28
- package/dist/emitter/site-templates/dockerfile.hbs +0 -31
- package/dist/emitter/site-templates/env.example.hbs +0 -19
- package/dist/emitter/site-templates/package.json.hbs +0 -26
- package/dist/emitter/site-templates/server-main-http.ts.hbs +0 -108
- package/dist/emitter/site-templates/server-main.ts.hbs +0 -23
- package/dist/emitter/site-templates/tool-handler-action.ts.hbs +0 -86
- package/dist/emitter/site-templates/tool-handler-form.ts.hbs +0 -116
- package/dist/emitter/site-templates/tool-handler-lifecycle.ts.hbs +0 -146
- package/dist/emitter/site-templates/tool-index.ts.hbs +0 -11
- package/dist/emitter/template-loader.d.ts +0 -1
- package/dist/emitter/template-loader.js +0 -27
- package/dist/emitter/templates/auth-provider.ts.hbs +0 -57
- package/dist/emitter/templates/config.ts.hbs +0 -63
- package/dist/emitter/templates/discovery.ts.hbs +0 -301
- package/dist/emitter/templates/dockerfile.hbs +0 -34
- package/dist/emitter/templates/env.example.hbs +0 -28
- package/dist/emitter/templates/gitignore.hbs +0 -5
- package/dist/emitter/templates/http-executor.ts.hbs +0 -117
- package/dist/emitter/templates/oauth.ts.hbs +0 -188
- package/dist/emitter/templates/package.json.hbs +0 -25
- package/dist/emitter/templates/prompts.ts.hbs +0 -22
- package/dist/emitter/templates/readme.md.hbs +0 -123
- package/dist/emitter/templates/resources.ts.hbs +0 -63
- package/dist/emitter/templates/server-main-http.ts.hbs +0 -407
- package/dist/emitter/templates/server-main.ts.hbs +0 -40
- package/dist/emitter/templates/task-handlers.ts.hbs +0 -189
- package/dist/emitter/templates/task-manager.ts.hbs +0 -139
- package/dist/emitter/templates/task-sse.ts.hbs +0 -105
- package/dist/emitter/templates/tool-handler.ts.hbs +0 -124
- package/dist/emitter/templates/tool-index.ts.hbs +0 -11
- package/dist/emitter/templates/tool-test.ts.hbs +0 -57
- package/dist/emitter/templates/trace.ts.hbs +0 -79
- package/dist/emitter/templates/tsconfig.json.hbs +0 -16
- package/dist/emitter/templates/types.ts.hbs +0 -5
- package/dist/emitter/worker-template-loader.d.ts +0 -5
- package/dist/emitter/worker-template-loader.js +0 -33
- package/dist/emitter/worker-templates/config.ts.hbs +0 -54
- package/dist/emitter/worker-templates/dev-vars.example.hbs +0 -10
- package/dist/emitter/worker-templates/gitignore.hbs +0 -6
- package/dist/emitter/worker-templates/package.json.hbs +0 -24
- package/dist/emitter/worker-templates/readme.md.hbs +0 -53
- package/dist/emitter/worker-templates/server.test.ts.hbs +0 -20
- package/dist/emitter/worker-templates/tool-handler.ts.hbs +0 -85
- package/dist/emitter/worker-templates/tool-index.ts.hbs +0 -28
- package/dist/emitter/worker-templates/tsconfig.json.hbs +0 -17
- package/dist/emitter/worker-templates/worker.ts.hbs +0 -242
- package/dist/emitter/worker-templates/wrangler.toml.hbs +0 -19
- package/dist/generator/spec-generator.d.ts +0 -6
- package/dist/generator/spec-generator.js +0 -50
- package/dist/parser/har-filter.d.ts +0 -8
- package/dist/parser/har-filter.js +0 -71
- package/dist/parser/har-loader.d.ts +0 -2
- package/dist/parser/har-loader.js +0 -14
- package/dist/parser/har-normalizer.d.ts +0 -20
- package/dist/parser/har-normalizer.js +0 -78
- package/dist/parser/index.d.ts +0 -10
- package/dist/parser/index.js +0 -6
- package/dist/parser/openapi-loader.d.ts +0 -6
- package/dist/parser/openapi-loader.js +0 -308
- package/dist/parser/operation-extractor.d.ts +0 -13
- package/dist/parser/operation-extractor.js +0 -155
- package/dist/parser/overlay-loader.d.ts +0 -10
- package/dist/parser/overlay-loader.js +0 -184
- package/dist/parser/postman-loader.d.ts +0 -9
- package/dist/parser/postman-loader.js +0 -106
- package/dist/parser/schema-converter.d.ts +0 -12
- package/dist/parser/schema-converter.js +0 -117
- package/dist/plugins/adapter.d.ts +0 -40
- package/dist/plugins/adapter.js +0 -15
- package/dist/plugins/loader.d.ts +0 -25
- package/dist/plugins/loader.js +0 -58
- package/dist/pricing.d.ts +0 -55
- package/dist/pricing.js +0 -133
- package/dist/providers/index.d.ts +0 -15
- package/dist/providers/index.js +0 -56
- package/dist/recorder/browser-recorder.d.ts +0 -22
- package/dist/recorder/browser-recorder.js +0 -205
- package/dist/rescan/diff-engine.d.ts +0 -5
- package/dist/rescan/diff-engine.js +0 -312
- package/dist/rescan/index.d.ts +0 -3
- package/dist/rescan/index.js +0 -2
- package/dist/rescan/rescan-runner.d.ts +0 -42
- package/dist/rescan/rescan-runner.js +0 -69
- package/dist/rescan/rescan-scheduler.d.ts +0 -41
- package/dist/rescan/rescan-scheduler.js +0 -179
- package/dist/site-transformer/browser-tools.d.ts +0 -10
- package/dist/site-transformer/browser-tools.js +0 -59
- package/dist/site-transformer/index.d.ts +0 -2
- package/dist/site-transformer/index.js +0 -2
- package/dist/site-transformer/selector-healer.d.ts +0 -8
- package/dist/site-transformer/selector-healer.js +0 -106
- package/dist/site-transformer/tool-generator.d.ts +0 -13
- package/dist/site-transformer/tool-generator.js +0 -245
- package/dist/transformer/auth-detector.d.ts +0 -13
- package/dist/transformer/auth-detector.js +0 -90
- package/dist/transformer/catalog-builder.d.ts +0 -18
- package/dist/transformer/catalog-builder.js +0 -56
- package/dist/transformer/client-compat.d.ts +0 -6
- package/dist/transformer/client-compat.js +0 -44
- package/dist/transformer/har-clusterer.d.ts +0 -9
- package/dist/transformer/har-clusterer.js +0 -27
- package/dist/transformer/har-dedup.d.ts +0 -10
- package/dist/transformer/har-dedup.js +0 -81
- package/dist/transformer/har-schema-inferrer.d.ts +0 -15
- package/dist/transformer/har-schema-inferrer.js +0 -90
- package/dist/transformer/har-to-operations.d.ts +0 -13
- package/dist/transformer/har-to-operations.js +0 -192
- package/dist/transformer/index.d.ts +0 -8
- package/dist/transformer/index.js +0 -6
- package/dist/transformer/llm-namer.d.ts +0 -6
- package/dist/transformer/llm-namer.js +0 -59
- package/dist/transformer/naming.d.ts +0 -4
- package/dist/transformer/naming.js +0 -30
- package/dist/transformer/operation-filter.d.ts +0 -13
- package/dist/transformer/operation-filter.js +0 -52
- package/dist/transformer/resource-builder.d.ts +0 -12
- package/dist/transformer/resource-builder.js +0 -80
- package/dist/transformer/schema-merger.d.ts +0 -14
- package/dist/transformer/schema-merger.js +0 -65
- package/dist/transformer/tool-builder.d.ts +0 -3
- package/dist/transformer/tool-builder.js +0 -114
- package/dist/types/index.d.ts +0 -131
- package/dist/types/index.js +0 -1
- package/dist/types/site.d.ts +0 -284
- package/dist/types/site.js +0 -8
- package/dist/utils/fail.d.ts +0 -48
- package/dist/utils/fail.js +0 -204
- package/dist/utils/fs.d.ts +0 -5
- package/dist/utils/fs.js +0 -28
- package/dist/utils/interactive.d.ts +0 -6
- package/dist/utils/interactive.js +0 -30
- package/dist/utils/logger.d.ts +0 -1
- package/dist/utils/logger.js +0 -2
- package/dist/utils/sanitize.d.ts +0 -28
- package/dist/utils/sanitize.js +0 -44
- package/dist/utils/watcher.d.ts +0 -11
- package/dist/utils/watcher.js +0 -36
package/dist/cloud/web/charts.js
DELETED
|
@@ -1,178 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Server-rendered inline-SVG charts for the admin dashboard.
|
|
3
|
-
*
|
|
4
|
-
* The admin CSP forbids inline scripts and `unsafe-inline` (see `sendHtml` in
|
|
5
|
-
* router.ts), so charts MUST be pure static SVG: no `<script>`, no `onclick`,
|
|
6
|
-
* no inline JS. Hover values are exposed only via `<title>` elements.
|
|
7
|
-
*
|
|
8
|
-
* Every function is a pure `(numbers) -> string`, so they are trivially unit
|
|
9
|
-
* testable and have no runtime dependencies. SVGs use a fixed `viewBox` and NO
|
|
10
|
-
* width/height attributes — they scale to their container via CSS.
|
|
11
|
-
*
|
|
12
|
-
* SECURITY / CORRECTNESS: every numeric input is clamped to a finite number
|
|
13
|
-
* (NaN / Infinity / non-number -> 0) BEFORE it is interpolated into any
|
|
14
|
-
* `points=""`, `d=""`, or coordinate attribute. This is both a correctness
|
|
15
|
-
* guard (a single bad sample can't blow up the whole path) and an injection
|
|
16
|
-
* guard (no caller-controlled string ever reaches the SVG markup; only numbers
|
|
17
|
-
* we produced ourselves are emitted).
|
|
18
|
-
*/
|
|
19
|
-
/** Coerce any value to a finite number; NaN / Infinity / non-number -> 0. */
|
|
20
|
-
function finite(n) {
|
|
21
|
-
return typeof n === 'number' && Number.isFinite(n) ? n : 0;
|
|
22
|
-
}
|
|
23
|
-
/** Round to at most `dp` decimals and return a clean string (no trailing zeros). */
|
|
24
|
-
function fmt(n, dp = 2) {
|
|
25
|
-
const v = finite(n);
|
|
26
|
-
return Number(v.toFixed(dp)).toString();
|
|
27
|
-
}
|
|
28
|
-
/** Escape a label for safe inclusion in SVG text / title content. */
|
|
29
|
-
function esc(s) {
|
|
30
|
-
return String(s)
|
|
31
|
-
.replace(/&/g, '&')
|
|
32
|
-
.replace(/</g, '<')
|
|
33
|
-
.replace(/>/g, '>')
|
|
34
|
-
.replace(/"/g, '"');
|
|
35
|
-
}
|
|
36
|
-
const SPARK_W = 240;
|
|
37
|
-
const SPARK_H = 48;
|
|
38
|
-
/**
|
|
39
|
-
* A single-series trend line (`<polyline>`).
|
|
40
|
-
*
|
|
41
|
-
* Y is scaled to the data's own min/max so small variations stay visible. With
|
|
42
|
-
* 0 or 1 points an empty-but-valid SVG is returned (no NaN coordinates).
|
|
43
|
-
*/
|
|
44
|
-
export function renderSparkline(values, opts = {}) {
|
|
45
|
-
const width = finite(opts.width) || SPARK_W;
|
|
46
|
-
const height = finite(opts.height) || SPARK_H;
|
|
47
|
-
const color = opts.color ?? 'var(--color-primary-hover, #8b5cf6)';
|
|
48
|
-
const unit = opts.unit ?? '';
|
|
49
|
-
const label = opts.label ?? '';
|
|
50
|
-
const data = (Array.isArray(values) ? values : []).map(finite);
|
|
51
|
-
const pad = 3;
|
|
52
|
-
const innerW = width - pad * 2;
|
|
53
|
-
const innerH = height - pad * 2;
|
|
54
|
-
if (data.length === 0) {
|
|
55
|
-
return `<svg class="chart chart--sparkline" viewBox="0 0 ${width} ${height}" preserveAspectRatio="none" role="img" aria-label="${esc(label || 'No data')}"><title>${esc(label ? label + ': no data' : 'No data')}</title></svg>`;
|
|
56
|
-
}
|
|
57
|
-
let min = Math.min(...data);
|
|
58
|
-
let max = Math.max(...data);
|
|
59
|
-
if (min === max) {
|
|
60
|
-
// Flat series — render a centred line rather than divide by zero.
|
|
61
|
-
min -= 1;
|
|
62
|
-
max += 1;
|
|
63
|
-
}
|
|
64
|
-
const range = max - min;
|
|
65
|
-
const xStep = data.length > 1 ? innerW / (data.length - 1) : 0;
|
|
66
|
-
const points = data
|
|
67
|
-
.map((v, i) => {
|
|
68
|
-
const x = pad + i * xStep;
|
|
69
|
-
const y = pad + innerH - ((v - min) / range) * innerH;
|
|
70
|
-
return `${fmt(x)},${fmt(y)}`;
|
|
71
|
-
})
|
|
72
|
-
.join(' ');
|
|
73
|
-
const last = data[data.length - 1];
|
|
74
|
-
const lastX = pad + (data.length - 1) * xStep;
|
|
75
|
-
const lastY = pad + innerH - ((last - min) / range) * innerH;
|
|
76
|
-
const titleText = label
|
|
77
|
-
? `${label}: ${fmt(last, 1)}${unit} (latest)`
|
|
78
|
-
: `${fmt(last, 1)}${unit} (latest)`;
|
|
79
|
-
return (`<svg class="chart chart--sparkline" viewBox="0 0 ${width} ${height}" preserveAspectRatio="none" role="img" aria-label="${esc(titleText)}">` +
|
|
80
|
-
`<title>${esc(titleText)}</title>` +
|
|
81
|
-
`<polyline fill="none" stroke="${esc(color)}" stroke-width="2" stroke-linejoin="round" stroke-linecap="round" points="${points}" />` +
|
|
82
|
-
`<circle cx="${fmt(lastX)}" cy="${fmt(lastY)}" r="2.5" fill="${esc(color)}" />` +
|
|
83
|
-
`</svg>`);
|
|
84
|
-
}
|
|
85
|
-
const BARS_W = 240;
|
|
86
|
-
const BARS_H = 80;
|
|
87
|
-
/**
|
|
88
|
-
* A simple vertical bar chart. Bars are scaled to the data max (0-baselined).
|
|
89
|
-
*/
|
|
90
|
-
export function renderBars(values, opts = {}) {
|
|
91
|
-
const width = finite(opts.width) || BARS_W;
|
|
92
|
-
const height = finite(opts.height) || BARS_H;
|
|
93
|
-
const color = opts.color ?? 'var(--color-primary, #7c3aed)';
|
|
94
|
-
const unit = opts.unit ?? '';
|
|
95
|
-
const label = opts.label ?? '';
|
|
96
|
-
const labels = Array.isArray(opts.labels) ? opts.labels : [];
|
|
97
|
-
const data = (Array.isArray(values) ? values : []).map(finite);
|
|
98
|
-
const pad = 3;
|
|
99
|
-
const innerW = width - pad * 2;
|
|
100
|
-
const innerH = height - pad * 2;
|
|
101
|
-
if (data.length === 0) {
|
|
102
|
-
return `<svg class="chart chart--bars" viewBox="0 0 ${width} ${height}" preserveAspectRatio="none" role="img" aria-label="${esc(label || 'No data')}"><title>${esc(label ? label + ': no data' : 'No data')}</title></svg>`;
|
|
103
|
-
}
|
|
104
|
-
const max = Math.max(0, ...data);
|
|
105
|
-
const denom = max > 0 ? max : 1;
|
|
106
|
-
const slot = innerW / data.length;
|
|
107
|
-
const gap = Math.min(slot * 0.25, 3);
|
|
108
|
-
const barW = Math.max(slot - gap, 0.5);
|
|
109
|
-
const bars = data
|
|
110
|
-
.map((v, i) => {
|
|
111
|
-
const h = (Math.max(v, 0) / denom) * innerH;
|
|
112
|
-
const x = pad + i * slot + gap / 2;
|
|
113
|
-
const y = pad + innerH - h;
|
|
114
|
-
const lbl = labels[i] ? `${labels[i]}: ` : '';
|
|
115
|
-
const titleText = `${lbl}${fmt(v, 1)}${unit}`;
|
|
116
|
-
return (`<rect x="${fmt(x)}" y="${fmt(y)}" width="${fmt(barW)}" height="${fmt(h)}" rx="1" fill="${esc(color)}">` +
|
|
117
|
-
`<title>${esc(titleText)}</title>` +
|
|
118
|
-
`</rect>`);
|
|
119
|
-
})
|
|
120
|
-
.join('');
|
|
121
|
-
return (`<svg class="chart chart--bars" viewBox="0 0 ${width} ${height}" preserveAspectRatio="none" role="img" aria-label="${esc(label || 'Bar chart')}">` +
|
|
122
|
-
`<title>${esc(label || 'Bar chart')}</title>` +
|
|
123
|
-
bars +
|
|
124
|
-
`</svg>`);
|
|
125
|
-
}
|
|
126
|
-
const DUAL_W = 480;
|
|
127
|
-
const DUAL_H = 140;
|
|
128
|
-
/**
|
|
129
|
-
* Two overlaid trend lines on a shared Y scale — built for the
|
|
130
|
-
* requests-vs-errors time series. Both series share one min/max so they are
|
|
131
|
-
* visually comparable. Missing / short series degrade gracefully.
|
|
132
|
-
*/
|
|
133
|
-
export function renderDualLine(seriesA, seriesB, opts = {}) {
|
|
134
|
-
const width = finite(opts.width) || DUAL_W;
|
|
135
|
-
const height = finite(opts.height) || DUAL_H;
|
|
136
|
-
const colorA = opts.colorA ?? 'var(--color-primary-hover, #8b5cf6)';
|
|
137
|
-
const colorB = opts.colorB ?? 'var(--color-error, #ef4444)';
|
|
138
|
-
const labelA = opts.labelA ?? 'Series A';
|
|
139
|
-
const labelB = opts.labelB ?? 'Series B';
|
|
140
|
-
const unit = opts.unit ?? '';
|
|
141
|
-
const a = (Array.isArray(seriesA) ? seriesA : []).map(finite);
|
|
142
|
-
const b = (Array.isArray(seriesB) ? seriesB : []).map(finite);
|
|
143
|
-
const n = Math.max(a.length, b.length);
|
|
144
|
-
const pad = 6;
|
|
145
|
-
const innerW = width - pad * 2;
|
|
146
|
-
const innerH = height - pad * 2;
|
|
147
|
-
const ariaLabel = `${labelA} vs ${labelB}`;
|
|
148
|
-
if (n === 0) {
|
|
149
|
-
return `<svg class="chart chart--dual" viewBox="0 0 ${width} ${height}" preserveAspectRatio="none" role="img" aria-label="${esc(ariaLabel)}"><title>${esc(ariaLabel + ': no data')}</title></svg>`;
|
|
150
|
-
}
|
|
151
|
-
const all = [...a, ...b];
|
|
152
|
-
let min = Math.min(0, ...all);
|
|
153
|
-
let max = Math.max(...all);
|
|
154
|
-
if (min === max)
|
|
155
|
-
max = min + 1;
|
|
156
|
-
const range = max - min;
|
|
157
|
-
const xStep = n > 1 ? innerW / (n - 1) : 0;
|
|
158
|
-
const toPoints = (series) => series
|
|
159
|
-
.map((v, i) => {
|
|
160
|
-
const x = pad + i * xStep;
|
|
161
|
-
const y = pad + innerH - ((v - min) / range) * innerH;
|
|
162
|
-
return `${fmt(x)},${fmt(y)}`;
|
|
163
|
-
})
|
|
164
|
-
.join(' ');
|
|
165
|
-
const lastA = a.length ? a[a.length - 1] : 0;
|
|
166
|
-
const lastB = b.length ? b[b.length - 1] : 0;
|
|
167
|
-
const lineA = a.length
|
|
168
|
-
? `<polyline fill="none" stroke="${esc(colorA)}" stroke-width="2" stroke-linejoin="round" stroke-linecap="round" points="${toPoints(a)}"><title>${esc(`${labelA}: ${fmt(lastA, 1)}${unit} (latest)`)}</title></polyline>`
|
|
169
|
-
: '';
|
|
170
|
-
const lineB = b.length
|
|
171
|
-
? `<polyline fill="none" stroke="${esc(colorB)}" stroke-width="2" stroke-linejoin="round" stroke-linecap="round" points="${toPoints(b)}"><title>${esc(`${labelB}: ${fmt(lastB, 1)}${unit} (latest)`)}</title></polyline>`
|
|
172
|
-
: '';
|
|
173
|
-
return (`<svg class="chart chart--dual" viewBox="0 0 ${width} ${height}" preserveAspectRatio="none" role="img" aria-label="${esc(ariaLabel)}">` +
|
|
174
|
-
`<title>${esc(ariaLabel)}</title>` +
|
|
175
|
-
lineA +
|
|
176
|
-
lineB +
|
|
177
|
-
`</svg>`);
|
|
178
|
-
}
|
package/dist/cloud/web/csrf.d.ts
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* CSRF protection for form submissions.
|
|
3
|
-
*
|
|
4
|
-
* Validates the _csrf field in POST bodies against the session's csrf token.
|
|
5
|
-
*/
|
|
6
|
-
interface SessionLike {
|
|
7
|
-
csrfToken: string;
|
|
8
|
-
}
|
|
9
|
-
/**
|
|
10
|
-
* Validate CSRF token from a form submission against the session.
|
|
11
|
-
* Checks that `body._csrf` matches `session.csrfToken`.
|
|
12
|
-
*/
|
|
13
|
-
export declare function validateCsrf(_req: import('node:http').IncomingMessage, body: Record<string, string>, session: SessionLike): boolean;
|
|
14
|
-
export {};
|
package/dist/cloud/web/csrf.js
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* CSRF protection for form submissions.
|
|
3
|
-
*
|
|
4
|
-
* Validates the _csrf field in POST bodies against the session's csrf token.
|
|
5
|
-
*/
|
|
6
|
-
/**
|
|
7
|
-
* Validate CSRF token from a form submission against the session.
|
|
8
|
-
* Checks that `body._csrf` matches `session.csrfToken`.
|
|
9
|
-
*/
|
|
10
|
-
export function validateCsrf(_req, body, session) {
|
|
11
|
-
const formToken = body._csrf;
|
|
12
|
-
if (!formToken || typeof formToken !== 'string')
|
|
13
|
-
return false;
|
|
14
|
-
if (formToken.length !== session.csrfToken.length)
|
|
15
|
-
return false;
|
|
16
|
-
// Constant-time comparison
|
|
17
|
-
let diff = 0;
|
|
18
|
-
for (let i = 0; i < formToken.length; i++) {
|
|
19
|
-
diff |= formToken.charCodeAt(i) ^ session.csrfToken.charCodeAt(i);
|
|
20
|
-
}
|
|
21
|
-
return diff === 0;
|
|
22
|
-
}
|
package/dist/cloud/web/docs.d.ts
DELETED
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* In-app documentation: renders the project's Markdown docs to HTML so users
|
|
3
|
-
* can read them in the web app. The product is proprietary, so we never expose
|
|
4
|
-
* the raw `.md` files — only this rendered, curated subset is served.
|
|
5
|
-
*/
|
|
6
|
-
export interface DocMeta {
|
|
7
|
-
/** URL slug under /docs/ */
|
|
8
|
-
slug: string;
|
|
9
|
-
/** Display title (sidebar + page heading) */
|
|
10
|
-
title: string;
|
|
11
|
-
/** Source filename in the docs/ directory */
|
|
12
|
-
file: string;
|
|
13
|
-
/** Short description (index cards + meta description) */
|
|
14
|
-
description: string;
|
|
15
|
-
/** Sidebar grouping */
|
|
16
|
-
category: string;
|
|
17
|
-
}
|
|
18
|
-
/**
|
|
19
|
-
* The user-facing docs surfaced in the web app, in display order. Internal
|
|
20
|
-
* drafts (e.g. the Show HN copy, the spec-migration engineering note) are
|
|
21
|
-
* intentionally excluded.
|
|
22
|
-
*/
|
|
23
|
-
export declare const DOCS: DocMeta[];
|
|
24
|
-
export declare function getDoc(slug: string): DocMeta | undefined;
|
|
25
|
-
/** Sidebar model grouped by category, with the active doc flagged. */
|
|
26
|
-
export declare function getSidebar(activeSlug?: string): Array<{
|
|
27
|
-
category: string;
|
|
28
|
-
items: Array<{
|
|
29
|
-
slug: string;
|
|
30
|
-
title: string;
|
|
31
|
-
active: boolean;
|
|
32
|
-
}>;
|
|
33
|
-
}>;
|
|
34
|
-
/**
|
|
35
|
-
* Render a doc to HTML (cached). Returns null if the slug is unknown or the
|
|
36
|
-
* source file can't be read.
|
|
37
|
-
*/
|
|
38
|
-
export declare function renderDoc(slug: string): string | null;
|
|
39
|
-
/** Build the /docs overview HTML (cards grouped by category). */
|
|
40
|
-
export declare function renderDocsIndexHtml(): string;
|
package/dist/cloud/web/docs.js
DELETED
|
@@ -1,174 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* In-app documentation: renders the project's Markdown docs to HTML so users
|
|
3
|
-
* can read them in the web app. The product is proprietary, so we never expose
|
|
4
|
-
* the raw `.md` files — only this rendered, curated subset is served.
|
|
5
|
-
*/
|
|
6
|
-
import { readFileSync, existsSync } from 'node:fs';
|
|
7
|
-
import { resolve, dirname } from 'node:path';
|
|
8
|
-
import { fileURLToPath } from 'node:url';
|
|
9
|
-
import { marked } from 'marked';
|
|
10
|
-
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
11
|
-
/**
|
|
12
|
-
* The user-facing docs surfaced in the web app, in display order. Internal
|
|
13
|
-
* drafts (e.g. the Show HN copy, the spec-migration engineering note) are
|
|
14
|
-
* intentionally excluded.
|
|
15
|
-
*/
|
|
16
|
-
export const DOCS = [
|
|
17
|
-
{
|
|
18
|
-
slug: 'quickstart',
|
|
19
|
-
title: 'Cloud Quickstart',
|
|
20
|
-
file: 'quickstart.md',
|
|
21
|
-
description: 'Deploy a hosted MCP server and connect it to Claude, Cursor, or any MCP client.',
|
|
22
|
-
category: 'Getting started',
|
|
23
|
-
},
|
|
24
|
-
{
|
|
25
|
-
slug: 'website-servers',
|
|
26
|
-
title: 'Website MCP servers',
|
|
27
|
-
file: 'website-servers.md',
|
|
28
|
-
description: 'Generate, run, and keep website-based servers fresh (from url / from website / rescan).',
|
|
29
|
-
category: 'Guides',
|
|
30
|
-
},
|
|
31
|
-
{
|
|
32
|
-
slug: 'migrate-from-stainless',
|
|
33
|
-
title: 'Migrate off Stainless',
|
|
34
|
-
file: 'migrate-from-stainless.md',
|
|
35
|
-
description: 'Move from a generated Stainless SDK to an MCP server you own.',
|
|
36
|
-
category: 'Guides',
|
|
37
|
-
},
|
|
38
|
-
{
|
|
39
|
-
slug: 'cli',
|
|
40
|
-
title: 'CLI reference',
|
|
41
|
-
file: 'cli.md',
|
|
42
|
-
description: 'Every command, flag, default, and environment variable.',
|
|
43
|
-
category: 'Reference',
|
|
44
|
-
},
|
|
45
|
-
];
|
|
46
|
-
const DOC_BY_SLUG = new Map(DOCS.map((d) => [d.slug, d]));
|
|
47
|
-
const SLUG_BY_FILE = new Map(DOCS.map((d) => [d.file, d.slug]));
|
|
48
|
-
/** Resolve the docs/ directory across dev (tsx) and prod (dist) layouts. */
|
|
49
|
-
function resolveDocsDir() {
|
|
50
|
-
const candidates = [
|
|
51
|
-
process.env.MCPMAKE_DOCS_DIR,
|
|
52
|
-
resolve(__dirname, '../../docs'), // dist/cloud/web -> dist/docs (build copy)
|
|
53
|
-
resolve(__dirname, '../../../docs'), // repo root from src/ or dist/ layout
|
|
54
|
-
resolve(process.cwd(), 'docs'),
|
|
55
|
-
].filter((c) => Boolean(c));
|
|
56
|
-
for (const c of candidates) {
|
|
57
|
-
if (existsSync(resolve(c, 'cli.md')))
|
|
58
|
-
return c;
|
|
59
|
-
}
|
|
60
|
-
return resolve(__dirname, '../../../docs');
|
|
61
|
-
}
|
|
62
|
-
const DOCS_DIR = resolveDocsDir();
|
|
63
|
-
const htmlCache = new Map();
|
|
64
|
-
export function getDoc(slug) {
|
|
65
|
-
return DOC_BY_SLUG.get(slug);
|
|
66
|
-
}
|
|
67
|
-
/** Sidebar model grouped by category, with the active doc flagged. */
|
|
68
|
-
export function getSidebar(activeSlug) {
|
|
69
|
-
const groups = [];
|
|
70
|
-
for (const d of DOCS) {
|
|
71
|
-
let group = groups.find((g) => g.category === d.category);
|
|
72
|
-
if (!group) {
|
|
73
|
-
group = { category: d.category, items: [] };
|
|
74
|
-
groups.push(group);
|
|
75
|
-
}
|
|
76
|
-
group.items.push({ slug: d.slug, title: d.title, active: d.slug === activeSlug });
|
|
77
|
-
}
|
|
78
|
-
return groups;
|
|
79
|
-
}
|
|
80
|
-
/**
|
|
81
|
-
* Render a doc to HTML (cached). Returns null if the slug is unknown or the
|
|
82
|
-
* source file can't be read.
|
|
83
|
-
*/
|
|
84
|
-
export function renderDoc(slug) {
|
|
85
|
-
const meta = DOC_BY_SLUG.get(slug);
|
|
86
|
-
if (!meta)
|
|
87
|
-
return null;
|
|
88
|
-
const cached = htmlCache.get(slug);
|
|
89
|
-
if (cached !== undefined)
|
|
90
|
-
return cached;
|
|
91
|
-
let md;
|
|
92
|
-
try {
|
|
93
|
-
md = readFileSync(resolve(DOCS_DIR, meta.file), 'utf-8');
|
|
94
|
-
}
|
|
95
|
-
catch {
|
|
96
|
-
return null;
|
|
97
|
-
}
|
|
98
|
-
const html = renderMarkdown(md);
|
|
99
|
-
htmlCache.set(slug, html);
|
|
100
|
-
return html;
|
|
101
|
-
}
|
|
102
|
-
/** Build the /docs overview HTML (cards grouped by category). */
|
|
103
|
-
export function renderDocsIndexHtml() {
|
|
104
|
-
const groups = getSidebar();
|
|
105
|
-
const sections = groups
|
|
106
|
-
.map((g) => {
|
|
107
|
-
const cards = g.items
|
|
108
|
-
.map((item) => {
|
|
109
|
-
const meta = DOC_BY_SLUG.get(item.slug);
|
|
110
|
-
return `<a class="docs-card" href="/docs/${meta.slug}"><h3>${escapeHtml(meta.title)}</h3><p>${escapeHtml(meta.description)}</p></a>`;
|
|
111
|
-
})
|
|
112
|
-
.join('');
|
|
113
|
-
return `<h2 id="${slugify(g.category)}">${escapeHtml(g.category)}</h2><div class="docs-card-grid">${cards}</div>`;
|
|
114
|
-
})
|
|
115
|
-
.join('');
|
|
116
|
-
return `<h1>Documentation</h1><p>Guides and reference for generating, deploying, and maintaining MCP servers with mcpmake.</p>${sections}`;
|
|
117
|
-
}
|
|
118
|
-
// ---------------------------------------------------------------------------
|
|
119
|
-
// Markdown rendering
|
|
120
|
-
// ---------------------------------------------------------------------------
|
|
121
|
-
function renderMarkdown(md) {
|
|
122
|
-
const rewritten = rewriteInternalLinks(md);
|
|
123
|
-
const raw = marked.parse(rewritten, { gfm: true, async: false });
|
|
124
|
-
return addHeadingIds(raw);
|
|
125
|
-
}
|
|
126
|
-
/**
|
|
127
|
-
* Rewrite repo-relative Markdown links so they resolve inside the web app:
|
|
128
|
-
* website-servers.md#x -> /docs/website-servers#x
|
|
129
|
-
* ../README.md#x -> /#x (no in-app README page)
|
|
130
|
-
* External URLs, absolute paths, and bare anchors are left untouched.
|
|
131
|
-
*/
|
|
132
|
-
function rewriteInternalLinks(md) {
|
|
133
|
-
return md.replace(/\]\(([^)]+)\)/g, (match, rawTarget) => {
|
|
134
|
-
const target = rawTarget.trim();
|
|
135
|
-
if (/^(https?:|mailto:|#|\/)/.test(target))
|
|
136
|
-
return match;
|
|
137
|
-
const fileMatch = target.match(/^(?:\.\.\/)?([\w.-]+\.md)(#[^)]*)?$/i);
|
|
138
|
-
if (!fileMatch)
|
|
139
|
-
return match;
|
|
140
|
-
const file = fileMatch[1];
|
|
141
|
-
const anchor = fileMatch[2] ?? '';
|
|
142
|
-
const slug = SLUG_BY_FILE.get(file);
|
|
143
|
-
if (slug)
|
|
144
|
-
return `](/docs/${slug}${anchor})`;
|
|
145
|
-
if (/^readme\.md$/i.test(file))
|
|
146
|
-
return `](/${anchor})`;
|
|
147
|
-
// A doc we don't surface in-app: point at the docs index.
|
|
148
|
-
return `](/docs${anchor})`;
|
|
149
|
-
});
|
|
150
|
-
}
|
|
151
|
-
/** Add GitHub-style id attributes to headings so in-page anchors work. */
|
|
152
|
-
function addHeadingIds(html) {
|
|
153
|
-
return html.replace(/<h([1-6])>([\s\S]*?)<\/h\1>/g, (_m, level, inner) => {
|
|
154
|
-
const text = inner.replace(/<[^>]+>/g, '');
|
|
155
|
-
const id = slugify(text);
|
|
156
|
-
return id ? `<h${level} id="${id}">${inner}</h${level}>` : `<h${level}>${inner}</h${level}>`;
|
|
157
|
-
});
|
|
158
|
-
}
|
|
159
|
-
function slugify(text) {
|
|
160
|
-
return text
|
|
161
|
-
.toLowerCase()
|
|
162
|
-
.trim()
|
|
163
|
-
.replace(/[^\w\s-]/g, '')
|
|
164
|
-
.replace(/\s+/g, '-')
|
|
165
|
-
.replace(/-+/g, '-')
|
|
166
|
-
.replace(/^-+|-+$/g, '');
|
|
167
|
-
}
|
|
168
|
-
function escapeHtml(s) {
|
|
169
|
-
return s
|
|
170
|
-
.replace(/&/g, '&')
|
|
171
|
-
.replace(/</g, '<')
|
|
172
|
-
.replace(/>/g, '>')
|
|
173
|
-
.replace(/"/g, '"');
|
|
174
|
-
}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Web route handler — serves HTML pages and static assets.
|
|
3
|
-
*
|
|
4
|
-
* Called before API routes in the main server. Returns `true` if the
|
|
5
|
-
* request was handled, `false` to fall through to API routes.
|
|
6
|
-
*/
|
|
7
|
-
import http from 'node:http';
|
|
8
|
-
import type { ServerStore, PortAllocator } from '../store.js';
|
|
9
|
-
import type { MetricsStore } from '../metrics.js';
|
|
10
|
-
export interface WebContext {
|
|
11
|
-
domain: string;
|
|
12
|
-
store: ServerStore;
|
|
13
|
-
ports: PortAllocator;
|
|
14
|
-
metrics: MetricsStore;
|
|
15
|
-
}
|
|
16
|
-
/**
|
|
17
|
-
* Handle web requests (HTML pages and static files).
|
|
18
|
-
*
|
|
19
|
-
* @returns `true` if handled, `false` to fall through to API routes.
|
|
20
|
-
*/
|
|
21
|
-
export declare function handleWebRequest(req: http.IncomingMessage, res: http.ServerResponse, context: WebContext): Promise<boolean>;
|
|
22
|
-
/**
|
|
23
|
-
* Render a 500 error page. Exported for use in the main server error handler.
|
|
24
|
-
*/
|
|
25
|
-
export declare function render500Page(res: http.ServerResponse): void;
|