mcpmake 0.1.1 → 0.2.0
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/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/README.md +0 -691
- 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/plugins/loader.js
DELETED
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Plugin loader — discovers and loads McpmakeAdapter implementations.
|
|
3
|
-
*
|
|
4
|
-
* Plugins are loaded from:
|
|
5
|
-
* 1. Built-in adapters (openapi, har, url, describe)
|
|
6
|
-
* 2. npm packages named `mcpmake-adapter-*`
|
|
7
|
-
* 3. Local files specified via --adapter flag
|
|
8
|
-
*/
|
|
9
|
-
import { pathToFileURL } from 'node:url';
|
|
10
|
-
import { logger } from '../utils/logger.js';
|
|
11
|
-
const registry = new Map();
|
|
12
|
-
/**
|
|
13
|
-
* Register a plugin adapter.
|
|
14
|
-
*/
|
|
15
|
-
export function registerAdapter(adapter) {
|
|
16
|
-
if (registry.has(adapter.name)) {
|
|
17
|
-
logger.warn(`Adapter "${adapter.name}" already registered, overwriting`);
|
|
18
|
-
}
|
|
19
|
-
registry.set(adapter.name, adapter);
|
|
20
|
-
}
|
|
21
|
-
/**
|
|
22
|
-
* Get a registered adapter by name.
|
|
23
|
-
*/
|
|
24
|
-
export function getAdapter(name) {
|
|
25
|
-
return registry.get(name);
|
|
26
|
-
}
|
|
27
|
-
/**
|
|
28
|
-
* List all registered adapters.
|
|
29
|
-
*/
|
|
30
|
-
export function listAdapters() {
|
|
31
|
-
return [...registry.values()];
|
|
32
|
-
}
|
|
33
|
-
/**
|
|
34
|
-
* Load an adapter from a file path or npm package name.
|
|
35
|
-
*/
|
|
36
|
-
export async function loadAdapterFromPath(pathOrPackage) {
|
|
37
|
-
let module;
|
|
38
|
-
try {
|
|
39
|
-
if (pathOrPackage.startsWith('.') || pathOrPackage.startsWith('/')) {
|
|
40
|
-
// Local file
|
|
41
|
-
const url = pathToFileURL(pathOrPackage).href;
|
|
42
|
-
module = await import(url);
|
|
43
|
-
}
|
|
44
|
-
else {
|
|
45
|
-
// npm package
|
|
46
|
-
module = await import(pathOrPackage);
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
catch (err) {
|
|
50
|
-
throw new Error(`Failed to load adapter from "${pathOrPackage}": ${err instanceof Error ? err.message : err}`);
|
|
51
|
-
}
|
|
52
|
-
const adapter = module.default;
|
|
53
|
-
if (!adapter || typeof adapter.name !== 'string' || typeof adapter.parse !== 'function') {
|
|
54
|
-
throw new Error(`Invalid adapter: "${pathOrPackage}" must export a default McpmakeAdapter with name and parse()`);
|
|
55
|
-
}
|
|
56
|
-
registerAdapter(adapter);
|
|
57
|
-
return adapter;
|
|
58
|
-
}
|
package/dist/pricing.d.ts
DELETED
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Canonical pricing for mcpmake's lead commercial offering ("Family A").
|
|
3
|
-
*
|
|
4
|
-
* Family A is the *non-cloud* product: the local compiler (CLI), the CI sync
|
|
5
|
-
* subscription, the self-hosted license, and done-for-you migration services.
|
|
6
|
-
* Per MONEY.md this is what carries the business — software/services margins
|
|
7
|
-
* (~95–100%) with no per-tenant infrastructure exposure.
|
|
8
|
-
*
|
|
9
|
-
* Family B (managed cloud hosting) is a later convenience add-on; its limits
|
|
10
|
-
* and plan enforcement live in `src/cloud/billing/billing-engine.ts`, and its
|
|
11
|
-
* margin depends entirely on Playwright browser-minute utilization (see
|
|
12
|
-
* MONEY.md → "Margins & unit economics"). Do NOT anchor the product on it.
|
|
13
|
-
*
|
|
14
|
-
* Source of truth for the numbers below: MONEY.md (research June 2026). When a
|
|
15
|
-
* price changes, change it here and in MONEY.md together.
|
|
16
|
-
*/
|
|
17
|
-
export type BillingPeriod = 'monthly' | 'yearly' | 'one-off';
|
|
18
|
-
export interface PricePoint {
|
|
19
|
-
/** Stable internal id. */
|
|
20
|
-
id: string;
|
|
21
|
-
/** Display name. */
|
|
22
|
-
name: string;
|
|
23
|
-
/** Entry price in whole USD. 0 = free. */
|
|
24
|
-
priceUsd: number;
|
|
25
|
-
/**
|
|
26
|
-
* Upper bound for banded tiers (services/license priced by scope/support).
|
|
27
|
-
* `null` for a fixed price.
|
|
28
|
-
*/
|
|
29
|
-
priceMaxUsd: number | null;
|
|
30
|
-
period: BillingPeriod;
|
|
31
|
-
/** One-line description of what the tier delivers. */
|
|
32
|
-
summary: string;
|
|
33
|
-
}
|
|
34
|
-
/** Family A — the lead, non-cloud offering. Source of truth for docs/UI. */
|
|
35
|
-
export declare const FAMILY_A_PRICING: Record<string, PricePoint>;
|
|
36
|
-
/** Default backend that serves the authoritative pricing. */
|
|
37
|
-
export declare const DEFAULT_PRICING_SERVER = "https://mcpmake.dev";
|
|
38
|
-
/**
|
|
39
|
-
* Fetch the live Family A pricing from the backend so an outdated installed CLI
|
|
40
|
-
* never prints stale numbers. Falls back to the bundled {@link FAMILY_A_PRICING}
|
|
41
|
-
* when the backend is unreachable, slow, or returns anything unexpected — the
|
|
42
|
-
* CLI must still work offline.
|
|
43
|
-
*
|
|
44
|
-
* @param serverUrl Backend base URL (defaults to {@link DEFAULT_PRICING_SERVER}).
|
|
45
|
-
* @param timeoutMs Abort the request after this long (default 4000 ms).
|
|
46
|
-
*/
|
|
47
|
-
export declare function fetchPricing(serverUrl?: string, timeoutMs?: number): Promise<{
|
|
48
|
-
pricing: Record<string, PricePoint>;
|
|
49
|
-
source: 'backend' | 'bundled';
|
|
50
|
-
}>;
|
|
51
|
-
/**
|
|
52
|
-
* Human-readable price label, e.g. `"Free forever"`, `"$19/mo"`,
|
|
53
|
-
* `"from $8,000/yr"`, `"$5,000–$20,000 one-off"`.
|
|
54
|
-
*/
|
|
55
|
-
export declare function formatPrice(p: PricePoint): string;
|
package/dist/pricing.js
DELETED
|
@@ -1,133 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Canonical pricing for mcpmake's lead commercial offering ("Family A").
|
|
3
|
-
*
|
|
4
|
-
* Family A is the *non-cloud* product: the local compiler (CLI), the CI sync
|
|
5
|
-
* subscription, the self-hosted license, and done-for-you migration services.
|
|
6
|
-
* Per MONEY.md this is what carries the business — software/services margins
|
|
7
|
-
* (~95–100%) with no per-tenant infrastructure exposure.
|
|
8
|
-
*
|
|
9
|
-
* Family B (managed cloud hosting) is a later convenience add-on; its limits
|
|
10
|
-
* and plan enforcement live in `src/cloud/billing/billing-engine.ts`, and its
|
|
11
|
-
* margin depends entirely on Playwright browser-minute utilization (see
|
|
12
|
-
* MONEY.md → "Margins & unit economics"). Do NOT anchor the product on it.
|
|
13
|
-
*
|
|
14
|
-
* Source of truth for the numbers below: MONEY.md (research June 2026). When a
|
|
15
|
-
* price changes, change it here and in MONEY.md together.
|
|
16
|
-
*/
|
|
17
|
-
/** Family A — the lead, non-cloud offering. Source of truth for docs/UI. */
|
|
18
|
-
export const FAMILY_A_PRICING = {
|
|
19
|
-
cli: {
|
|
20
|
-
id: 'cli',
|
|
21
|
-
name: 'Local compiler (CLI)',
|
|
22
|
-
priceUsd: 0,
|
|
23
|
-
priceMaxUsd: null,
|
|
24
|
-
period: 'monthly',
|
|
25
|
-
summary: 'Generate editable code you own, run anywhere. Free forever — top of funnel + ownership story.',
|
|
26
|
-
},
|
|
27
|
-
syncSolo: {
|
|
28
|
-
id: 'sync-solo',
|
|
29
|
-
name: 'Sync — Solo',
|
|
30
|
-
priceUsd: 19,
|
|
31
|
-
priceMaxUsd: null,
|
|
32
|
-
period: 'monthly',
|
|
33
|
-
summary: 'CI drift-check + spec-currency auto-PRs, 1 repo.',
|
|
34
|
-
},
|
|
35
|
-
syncTeam: {
|
|
36
|
-
id: 'sync-team',
|
|
37
|
-
name: 'Sync — Team',
|
|
38
|
-
priceUsd: 499,
|
|
39
|
-
priceMaxUsd: null,
|
|
40
|
-
period: 'monthly',
|
|
41
|
-
summary: 'Multi-repo CI sync, policy checks, support.',
|
|
42
|
-
},
|
|
43
|
-
selfHostLicense: {
|
|
44
|
-
id: 'self-host-license',
|
|
45
|
-
name: 'Self-hosted license',
|
|
46
|
-
priceUsd: 8_000,
|
|
47
|
-
priceMaxUsd: 40_000,
|
|
48
|
-
period: 'yearly',
|
|
49
|
-
summary: 'Run the generator + sync on your own infra; governance + support SLA.',
|
|
50
|
-
},
|
|
51
|
-
migration: {
|
|
52
|
-
id: 'migration',
|
|
53
|
-
name: 'Migration engagement',
|
|
54
|
-
priceUsd: 5_000,
|
|
55
|
-
priceMaxUsd: 20_000,
|
|
56
|
-
period: 'one-off',
|
|
57
|
-
summary: 'Done-for-you API → owned MCP servers + CI wiring.',
|
|
58
|
-
},
|
|
59
|
-
};
|
|
60
|
-
/** Default backend that serves the authoritative pricing. */
|
|
61
|
-
export const DEFAULT_PRICING_SERVER = 'https://mcpmake.dev';
|
|
62
|
-
function isPricePoint(v) {
|
|
63
|
-
if (typeof v !== 'object' || v === null)
|
|
64
|
-
return false;
|
|
65
|
-
const p = v;
|
|
66
|
-
return (typeof p.id === 'string' &&
|
|
67
|
-
typeof p.name === 'string' &&
|
|
68
|
-
typeof p.priceUsd === 'number' &&
|
|
69
|
-
(p.priceMaxUsd === null || typeof p.priceMaxUsd === 'number') &&
|
|
70
|
-
(p.period === 'monthly' || p.period === 'yearly' || p.period === 'one-off') &&
|
|
71
|
-
typeof p.summary === 'string');
|
|
72
|
-
}
|
|
73
|
-
/**
|
|
74
|
-
* Fetch the live Family A pricing from the backend so an outdated installed CLI
|
|
75
|
-
* never prints stale numbers. Falls back to the bundled {@link FAMILY_A_PRICING}
|
|
76
|
-
* when the backend is unreachable, slow, or returns anything unexpected — the
|
|
77
|
-
* CLI must still work offline.
|
|
78
|
-
*
|
|
79
|
-
* @param serverUrl Backend base URL (defaults to {@link DEFAULT_PRICING_SERVER}).
|
|
80
|
-
* @param timeoutMs Abort the request after this long (default 4000 ms).
|
|
81
|
-
*/
|
|
82
|
-
export async function fetchPricing(serverUrl = DEFAULT_PRICING_SERVER, timeoutMs = 4_000) {
|
|
83
|
-
const controller = new AbortController();
|
|
84
|
-
const timer = setTimeout(() => controller.abort(), timeoutMs);
|
|
85
|
-
try {
|
|
86
|
-
const base = serverUrl.replace(/\/+$/, '');
|
|
87
|
-
const res = await fetch(`${base}/api/pricing`, {
|
|
88
|
-
headers: { accept: 'application/json' },
|
|
89
|
-
signal: controller.signal,
|
|
90
|
-
});
|
|
91
|
-
if (!res.ok)
|
|
92
|
-
return { pricing: FAMILY_A_PRICING, source: 'bundled' };
|
|
93
|
-
const body = (await res.json());
|
|
94
|
-
const familyA = body?.familyA;
|
|
95
|
-
if (typeof familyA !== 'object' || familyA === null) {
|
|
96
|
-
return { pricing: FAMILY_A_PRICING, source: 'bundled' };
|
|
97
|
-
}
|
|
98
|
-
// Only accept a well-formed payload; one bad entry falls back wholesale so
|
|
99
|
-
// we never mix live and stale prices in a single display.
|
|
100
|
-
const entries = Object.entries(familyA);
|
|
101
|
-
if (entries.length === 0 || !entries.every(([, v]) => isPricePoint(v))) {
|
|
102
|
-
return { pricing: FAMILY_A_PRICING, source: 'bundled' };
|
|
103
|
-
}
|
|
104
|
-
return { pricing: familyA, source: 'backend' };
|
|
105
|
-
}
|
|
106
|
-
catch {
|
|
107
|
-
return { pricing: FAMILY_A_PRICING, source: 'bundled' };
|
|
108
|
-
}
|
|
109
|
-
finally {
|
|
110
|
-
clearTimeout(timer);
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
const PERIOD_SUFFIX = {
|
|
114
|
-
monthly: '/mo',
|
|
115
|
-
yearly: '/yr',
|
|
116
|
-
'one-off': ' one-off',
|
|
117
|
-
};
|
|
118
|
-
/**
|
|
119
|
-
* Human-readable price label, e.g. `"Free forever"`, `"$19/mo"`,
|
|
120
|
-
* `"from $8,000/yr"`, `"$5,000–$20,000 one-off"`.
|
|
121
|
-
*/
|
|
122
|
-
export function formatPrice(p) {
|
|
123
|
-
if (p.priceUsd === 0)
|
|
124
|
-
return 'Free forever';
|
|
125
|
-
const usd = (n) => `$${n.toLocaleString('en-US')}`;
|
|
126
|
-
const suffix = PERIOD_SUFFIX[p.period];
|
|
127
|
-
if (p.priceMaxUsd != null) {
|
|
128
|
-
return p.period === 'one-off'
|
|
129
|
-
? `${usd(p.priceUsd)}–${usd(p.priceMaxUsd)}${suffix}`
|
|
130
|
-
: `from ${usd(p.priceUsd)}${suffix}`;
|
|
131
|
-
}
|
|
132
|
-
return `${usd(p.priceUsd)}${suffix}`;
|
|
133
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
export interface ProviderConfig {
|
|
2
|
-
name: string;
|
|
3
|
-
description: string;
|
|
4
|
-
specUrl: string;
|
|
5
|
-
baseUrl: string;
|
|
6
|
-
auth: {
|
|
7
|
-
type: 'apiKey' | 'bearer' | 'basic' | 'oauth2';
|
|
8
|
-
envVar: string;
|
|
9
|
-
headerName?: string;
|
|
10
|
-
};
|
|
11
|
-
suggestedIncludes?: string[];
|
|
12
|
-
}
|
|
13
|
-
export declare function getProvider(name: string): ProviderConfig | undefined;
|
|
14
|
-
export declare function listProviders(): ProviderConfig[];
|
|
15
|
-
export declare function getProviderNames(): string[];
|
package/dist/providers/index.js
DELETED
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
const providers = {
|
|
2
|
-
stripe: {
|
|
3
|
-
name: 'stripe',
|
|
4
|
-
description: 'Stripe payment processing',
|
|
5
|
-
specUrl: 'https://raw.githubusercontent.com/stripe/openapi/master/openapi/spec3.json',
|
|
6
|
-
baseUrl: 'https://api.stripe.com',
|
|
7
|
-
auth: { type: 'bearer', envVar: 'STRIPE_API_KEY' },
|
|
8
|
-
suggestedIncludes: ['customers', 'charges', 'payments', 'invoices', 'subscriptions'],
|
|
9
|
-
},
|
|
10
|
-
github: {
|
|
11
|
-
name: 'github',
|
|
12
|
-
description: 'GitHub REST API',
|
|
13
|
-
specUrl: 'https://raw.githubusercontent.com/github/rest-api-description/main/descriptions/api.github.com/api.github.com.json',
|
|
14
|
-
baseUrl: 'https://api.github.com',
|
|
15
|
-
auth: { type: 'bearer', envVar: 'GITHUB_TOKEN' },
|
|
16
|
-
suggestedIncludes: ['repos', 'issues', 'pulls', 'actions'],
|
|
17
|
-
},
|
|
18
|
-
slack: {
|
|
19
|
-
name: 'slack',
|
|
20
|
-
description: 'Slack Web API',
|
|
21
|
-
specUrl: 'https://raw.githubusercontent.com/slackapi/slack-api-specs/master/web-api/slack_web_openapi_v2.json',
|
|
22
|
-
baseUrl: 'https://slack.com/api',
|
|
23
|
-
auth: { type: 'bearer', envVar: 'SLACK_TOKEN' },
|
|
24
|
-
suggestedIncludes: ['chat', 'channels', 'users', 'files'],
|
|
25
|
-
},
|
|
26
|
-
notion: {
|
|
27
|
-
name: 'notion',
|
|
28
|
-
description: 'Notion API',
|
|
29
|
-
specUrl: 'https://bump.sh/notion-hq/doc/notion/specification',
|
|
30
|
-
baseUrl: 'https://api.notion.com/v1',
|
|
31
|
-
auth: { type: 'bearer', envVar: 'NOTION_API_KEY', headerName: 'Authorization' },
|
|
32
|
-
},
|
|
33
|
-
linear: {
|
|
34
|
-
name: 'linear',
|
|
35
|
-
description: 'Linear project management',
|
|
36
|
-
specUrl: 'https://studio.apollographql.com/public/Linear-API/variant/current/home',
|
|
37
|
-
baseUrl: 'https://api.linear.app',
|
|
38
|
-
auth: { type: 'bearer', envVar: 'LINEAR_API_KEY' },
|
|
39
|
-
},
|
|
40
|
-
shopify: {
|
|
41
|
-
name: 'shopify',
|
|
42
|
-
description: 'Shopify Admin API',
|
|
43
|
-
specUrl: 'https://shopify.dev/docs/admin-api/rest/reference',
|
|
44
|
-
baseUrl: 'https://{store}.myshopify.com/admin/api/2024-01',
|
|
45
|
-
auth: { type: 'bearer', envVar: 'SHOPIFY_ACCESS_TOKEN' },
|
|
46
|
-
},
|
|
47
|
-
};
|
|
48
|
-
export function getProvider(name) {
|
|
49
|
-
return providers[name.toLowerCase()];
|
|
50
|
-
}
|
|
51
|
-
export function listProviders() {
|
|
52
|
-
return Object.values(providers);
|
|
53
|
-
}
|
|
54
|
-
export function getProviderNames() {
|
|
55
|
-
return Object.keys(providers);
|
|
56
|
-
}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import type { Entry } from 'har-format';
|
|
2
|
-
export interface RecorderOptions {
|
|
3
|
-
url: string;
|
|
4
|
-
timeout?: number;
|
|
5
|
-
/**
|
|
6
|
-
* Run the browser headless and capture non-interactively (CI-friendly).
|
|
7
|
-
* In this mode there is no window for a human to drive, so traffic is
|
|
8
|
-
* captured from the initial load plus any `navigate` URLs, then the
|
|
9
|
-
* browser closes automatically.
|
|
10
|
-
*/
|
|
11
|
-
headless?: boolean;
|
|
12
|
-
/**
|
|
13
|
-
* Additional same-origin URLs (absolute or relative to `url`) to visit
|
|
14
|
-
* automatically in headless mode to surface more API calls.
|
|
15
|
-
*/
|
|
16
|
-
navigate?: string[];
|
|
17
|
-
}
|
|
18
|
-
export interface RecordingResult {
|
|
19
|
-
entries: Entry[];
|
|
20
|
-
baseUrl: string;
|
|
21
|
-
}
|
|
22
|
-
export declare function recordBrowserSession(options: RecorderOptions): Promise<RecordingResult>;
|
|
@@ -1,205 +0,0 @@
|
|
|
1
|
-
import { chromium } from 'playwright';
|
|
2
|
-
import { logger } from '../utils/logger.js';
|
|
3
|
-
const MAX_ENTRIES = 10_000;
|
|
4
|
-
const MAX_RESPONSE_BODY_BYTES = 5 * 1024 * 1024; // 5 MB
|
|
5
|
-
const SKIP_BODY_MIME_TYPES = ['image/', 'video/', 'audio/', 'font/', 'application/octet-stream'];
|
|
6
|
-
export async function recordBrowserSession(options) {
|
|
7
|
-
const idleTimeout = options.timeout ?? 5 * 60 * 1000;
|
|
8
|
-
const entries = [];
|
|
9
|
-
const pendingRequests = new Map();
|
|
10
|
-
let lastActivityTime = Date.now();
|
|
11
|
-
const parsedUrl = new URL(options.url);
|
|
12
|
-
if (!['http:', 'https:'].includes(parsedUrl.protocol)) {
|
|
13
|
-
throw new Error('Only http/https URLs are supported');
|
|
14
|
-
}
|
|
15
|
-
const baseUrl = `${parsedUrl.protocol}//${parsedUrl.host}`;
|
|
16
|
-
const headless = options.headless ?? false;
|
|
17
|
-
let browser;
|
|
18
|
-
try {
|
|
19
|
-
browser = await chromium.launch({ headless });
|
|
20
|
-
const context = await browser.newContext();
|
|
21
|
-
const page = await context.newPage();
|
|
22
|
-
// Capture requests
|
|
23
|
-
page.on('request', (request) => {
|
|
24
|
-
lastActivityTime = Date.now();
|
|
25
|
-
pendingRequests.set(request, { startTime: Date.now() });
|
|
26
|
-
});
|
|
27
|
-
// Capture responses
|
|
28
|
-
page.on('response', async (response) => {
|
|
29
|
-
lastActivityTime = Date.now();
|
|
30
|
-
if (entries.length >= MAX_ENTRIES)
|
|
31
|
-
return;
|
|
32
|
-
const request = response.request();
|
|
33
|
-
const pending = pendingRequests.get(request);
|
|
34
|
-
if (!pending)
|
|
35
|
-
return;
|
|
36
|
-
pendingRequests.delete(request);
|
|
37
|
-
try {
|
|
38
|
-
const entry = await buildHarEntry(request, response, pending.startTime);
|
|
39
|
-
entries.push(entry);
|
|
40
|
-
if (entries.length === MAX_ENTRIES) {
|
|
41
|
-
logger.warn(`Captured ${MAX_ENTRIES} entries — ignoring further requests.`);
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
catch {
|
|
45
|
-
// Some responses can't be read (e.g., redirects, aborted)
|
|
46
|
-
}
|
|
47
|
-
});
|
|
48
|
-
if (headless) {
|
|
49
|
-
// Non-interactive capture: load the page, then auto-visit any extra
|
|
50
|
-
// same-origin URLs, capturing their API traffic. No window to close.
|
|
51
|
-
logger.info(`Capturing (headless) from: ${options.url}`);
|
|
52
|
-
await page.goto(options.url, { waitUntil: 'networkidle', timeout: 30_000 }).catch(() => { });
|
|
53
|
-
const navTargets = resolveNavTargets(options.navigate ?? [], baseUrl);
|
|
54
|
-
for (const navUrl of navTargets) {
|
|
55
|
-
logger.info(` visiting: ${navUrl}`);
|
|
56
|
-
try {
|
|
57
|
-
await page.goto(navUrl, { waitUntil: 'networkidle', timeout: 30_000 });
|
|
58
|
-
}
|
|
59
|
-
catch {
|
|
60
|
-
// Skip navigations that fail (timeout, 4xx, etc.)
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
// Let any trailing XHRs settle before closing.
|
|
64
|
-
await page.waitForTimeout(1000);
|
|
65
|
-
await browser.close().catch(() => { });
|
|
66
|
-
browser = undefined;
|
|
67
|
-
}
|
|
68
|
-
else {
|
|
69
|
-
// Interactive capture: a human drives the visible window.
|
|
70
|
-
logger.info(`Opening browser at: ${options.url}`);
|
|
71
|
-
logger.info('Interact with the page to capture API calls.');
|
|
72
|
-
logger.info('Close the browser window when done.');
|
|
73
|
-
await page.goto(options.url, { waitUntil: 'domcontentloaded' });
|
|
74
|
-
// Wait for the user to close the browser or idle timeout
|
|
75
|
-
await new Promise((resolve) => {
|
|
76
|
-
const idleCheck = setInterval(() => {
|
|
77
|
-
if (Date.now() - lastActivityTime > idleTimeout) {
|
|
78
|
-
logger.warn(`Idle timeout (${Math.round(idleTimeout / 1000)}s). Closing browser.`);
|
|
79
|
-
clearInterval(idleCheck);
|
|
80
|
-
browser?.close().then(resolve).catch(resolve);
|
|
81
|
-
}
|
|
82
|
-
}, 5000);
|
|
83
|
-
browser.on('disconnected', () => {
|
|
84
|
-
clearInterval(idleCheck);
|
|
85
|
-
resolve();
|
|
86
|
-
});
|
|
87
|
-
});
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
catch (error) {
|
|
91
|
-
if (browser)
|
|
92
|
-
await browser.close().catch(() => { });
|
|
93
|
-
throw error;
|
|
94
|
-
}
|
|
95
|
-
return { entries, baseUrl };
|
|
96
|
-
}
|
|
97
|
-
/**
|
|
98
|
-
* Resolve auto-navigation targets against the base URL, keeping only
|
|
99
|
-
* same-origin http/https URLs (avoids wandering off to other hosts).
|
|
100
|
-
*/
|
|
101
|
-
function resolveNavTargets(navigate, baseUrl) {
|
|
102
|
-
const base = new URL(baseUrl);
|
|
103
|
-
const out = [];
|
|
104
|
-
for (const raw of navigate) {
|
|
105
|
-
const trimmed = raw.trim();
|
|
106
|
-
if (!trimmed)
|
|
107
|
-
continue;
|
|
108
|
-
try {
|
|
109
|
-
const resolved = new URL(trimmed, baseUrl);
|
|
110
|
-
if (!['http:', 'https:'].includes(resolved.protocol))
|
|
111
|
-
continue;
|
|
112
|
-
if (resolved.host !== base.host) {
|
|
113
|
-
logger.warn(`Skipping cross-origin navigate target: ${trimmed}`);
|
|
114
|
-
continue;
|
|
115
|
-
}
|
|
116
|
-
out.push(resolved.toString());
|
|
117
|
-
}
|
|
118
|
-
catch {
|
|
119
|
-
logger.warn(`Skipping invalid navigate target: ${trimmed}`);
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
return out;
|
|
123
|
-
}
|
|
124
|
-
async function buildHarEntry(request, response, startTime) {
|
|
125
|
-
const elapsed = Date.now() - startTime;
|
|
126
|
-
const url = request.url();
|
|
127
|
-
const parsedUrl = new URL(url);
|
|
128
|
-
// Request headers
|
|
129
|
-
const requestHeaders = Object.entries(request.headers()).map(([name, value]) => ({
|
|
130
|
-
name,
|
|
131
|
-
value,
|
|
132
|
-
}));
|
|
133
|
-
// Query string
|
|
134
|
-
const queryString = [...parsedUrl.searchParams.entries()].map(([name, value]) => ({
|
|
135
|
-
name,
|
|
136
|
-
value,
|
|
137
|
-
}));
|
|
138
|
-
// Request body
|
|
139
|
-
const postData = request.postData();
|
|
140
|
-
const contentTypeHeader = request.headers()['content-type'] ?? '';
|
|
141
|
-
// Response headers
|
|
142
|
-
const responseHeaders = Object.entries(response.headers()).map(([name, value]) => ({
|
|
143
|
-
name,
|
|
144
|
-
value,
|
|
145
|
-
}));
|
|
146
|
-
// Response body — skip large or binary responses
|
|
147
|
-
let responseText;
|
|
148
|
-
const responseMimeType = response.headers()['content-type'] ?? '';
|
|
149
|
-
const skipBody = SKIP_BODY_MIME_TYPES.some((m) => responseMimeType.startsWith(m));
|
|
150
|
-
const contentLength = parseInt(response.headers()['content-length'] ?? '0', 10);
|
|
151
|
-
if (!skipBody && contentLength <= MAX_RESPONSE_BODY_BYTES) {
|
|
152
|
-
try {
|
|
153
|
-
const body = await response.body();
|
|
154
|
-
if (body.length <= MAX_RESPONSE_BODY_BYTES) {
|
|
155
|
-
responseText = body.toString('utf-8');
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
catch {
|
|
159
|
-
// Body may not be available for some response types
|
|
160
|
-
}
|
|
161
|
-
}
|
|
162
|
-
return {
|
|
163
|
-
startedDateTime: new Date(startTime).toISOString(),
|
|
164
|
-
time: elapsed,
|
|
165
|
-
request: {
|
|
166
|
-
method: request.method(),
|
|
167
|
-
url,
|
|
168
|
-
httpVersion: 'HTTP/1.1',
|
|
169
|
-
headers: requestHeaders,
|
|
170
|
-
queryString,
|
|
171
|
-
cookies: [],
|
|
172
|
-
headersSize: -1,
|
|
173
|
-
bodySize: postData ? Buffer.byteLength(postData) : 0,
|
|
174
|
-
...(postData
|
|
175
|
-
? {
|
|
176
|
-
postData: {
|
|
177
|
-
mimeType: contentTypeHeader.split(';')[0].trim() || 'application/octet-stream',
|
|
178
|
-
text: postData,
|
|
179
|
-
},
|
|
180
|
-
}
|
|
181
|
-
: {}),
|
|
182
|
-
},
|
|
183
|
-
response: {
|
|
184
|
-
status: response.status(),
|
|
185
|
-
statusText: response.statusText(),
|
|
186
|
-
httpVersion: 'HTTP/1.1',
|
|
187
|
-
headers: responseHeaders,
|
|
188
|
-
cookies: [],
|
|
189
|
-
content: {
|
|
190
|
-
size: responseText ? Buffer.byteLength(responseText) : 0,
|
|
191
|
-
mimeType: responseMimeType.split(';')[0].trim() || 'application/octet-stream',
|
|
192
|
-
...(responseText ? { text: responseText } : {}),
|
|
193
|
-
},
|
|
194
|
-
redirectURL: '',
|
|
195
|
-
headersSize: -1,
|
|
196
|
-
bodySize: responseText ? Buffer.byteLength(responseText) : 0,
|
|
197
|
-
},
|
|
198
|
-
cache: {},
|
|
199
|
-
timings: {
|
|
200
|
-
send: 1,
|
|
201
|
-
wait: Math.max(1, elapsed - 2),
|
|
202
|
-
receive: 1,
|
|
203
|
-
},
|
|
204
|
-
};
|
|
205
|
-
}
|