mcpmake 0.1.0 → 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 +24 -42
- 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/types/site.d.ts
DELETED
|
@@ -1,284 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Type definitions for the Website-to-MCP pipeline.
|
|
3
|
-
*
|
|
4
|
-
* These types represent DOM-based interactions (forms, buttons, links)
|
|
5
|
-
* rather than HTTP API calls. They form a parallel pipeline to the
|
|
6
|
-
* existing OperationDescriptor/ToolDefinition types in index.ts.
|
|
7
|
-
*/
|
|
8
|
-
import type { EnvVarDescriptor, TransportMode } from './index.js';
|
|
9
|
-
export type SelectorStrategy = 'data-testid' | 'id' | 'aria-label' | 'name' | 'role' | 'css-path' | 'xpath';
|
|
10
|
-
export interface SelectorSet {
|
|
11
|
-
/** Best available selector string */
|
|
12
|
-
primary: string;
|
|
13
|
-
/** Ordered fallback selectors */
|
|
14
|
-
fallbacks: string[];
|
|
15
|
-
/** Strategy used for the primary selector */
|
|
16
|
-
strategy: SelectorStrategy;
|
|
17
|
-
/** 0-1 confidence score for selector stability */
|
|
18
|
-
confidence: number;
|
|
19
|
-
/** LLM-inferred human-readable label, e.g. "Login button" */
|
|
20
|
-
humanLabel?: string;
|
|
21
|
-
}
|
|
22
|
-
export type FormFieldType = 'text' | 'email' | 'password' | 'number' | 'tel' | 'url' | 'search' | 'select' | 'checkbox' | 'radio' | 'textarea' | 'hidden' | 'file' | 'date' | 'datetime-local' | 'color' | 'range' | 'other';
|
|
23
|
-
export interface FormFieldDescriptor {
|
|
24
|
-
/** Form field name attribute */
|
|
25
|
-
name: string;
|
|
26
|
-
/** Input type */
|
|
27
|
-
fieldType: FormFieldType;
|
|
28
|
-
/** Selector set for this field */
|
|
29
|
-
selector: SelectorSet;
|
|
30
|
-
/** Associated <label> text or aria-label */
|
|
31
|
-
label?: string;
|
|
32
|
-
/** Placeholder text */
|
|
33
|
-
placeholder?: string;
|
|
34
|
-
/** Whether the field is required */
|
|
35
|
-
required: boolean;
|
|
36
|
-
/** Options for <select>, radio groups, and datalists */
|
|
37
|
-
options?: string[];
|
|
38
|
-
/** Default or current value */
|
|
39
|
-
defaultValue?: string;
|
|
40
|
-
}
|
|
41
|
-
export interface FormDescriptor {
|
|
42
|
-
/** Generated stable ID for this form */
|
|
43
|
-
formId: string;
|
|
44
|
-
/** Form action URL (if present) */
|
|
45
|
-
action?: string;
|
|
46
|
-
/** Form method */
|
|
47
|
-
method: 'get' | 'post';
|
|
48
|
-
/** Selector set for the <form> element */
|
|
49
|
-
selector: SelectorSet;
|
|
50
|
-
/** Fields within the form */
|
|
51
|
-
fields: FormFieldDescriptor[];
|
|
52
|
-
/** Submit button selector */
|
|
53
|
-
submitButton?: SelectorSet;
|
|
54
|
-
/** LLM-inferred semantic name, e.g. "login_form", "search_form" */
|
|
55
|
-
semanticName?: string;
|
|
56
|
-
/** LLM-inferred description of what this form does */
|
|
57
|
-
description?: string;
|
|
58
|
-
}
|
|
59
|
-
export interface ButtonDescriptor {
|
|
60
|
-
/** Generated stable ID */
|
|
61
|
-
buttonId: string;
|
|
62
|
-
/** Selector set for the button element */
|
|
63
|
-
selector: SelectorSet;
|
|
64
|
-
/** Visible button text */
|
|
65
|
-
text?: string;
|
|
66
|
-
/** aria-label value */
|
|
67
|
-
ariaLabel?: string;
|
|
68
|
-
/** LLM-inferred action, e.g. "add_to_cart", "submit_order" */
|
|
69
|
-
semanticAction?: string;
|
|
70
|
-
/** LLM-inferred description */
|
|
71
|
-
description?: string;
|
|
72
|
-
/** Button type */
|
|
73
|
-
type: 'submit' | 'button' | 'link' | 'other';
|
|
74
|
-
/** href for link-style buttons */
|
|
75
|
-
href?: string;
|
|
76
|
-
}
|
|
77
|
-
export interface LinkDescriptor {
|
|
78
|
-
/** Generated stable ID */
|
|
79
|
-
linkId: string;
|
|
80
|
-
/** Selector set for the <a> element */
|
|
81
|
-
selector: SelectorSet;
|
|
82
|
-
/** Visible link text */
|
|
83
|
-
text?: string;
|
|
84
|
-
/** Link destination */
|
|
85
|
-
href: string;
|
|
86
|
-
/** Whether this link navigates to a new page (vs anchor/JS action) */
|
|
87
|
-
isNavigation: boolean;
|
|
88
|
-
/** LLM-inferred semantic action */
|
|
89
|
-
semanticAction?: string;
|
|
90
|
-
}
|
|
91
|
-
export interface PageDescriptor {
|
|
92
|
-
/** Generated stable ID */
|
|
93
|
-
pageId: string;
|
|
94
|
-
/** Canonical URL of the page */
|
|
95
|
-
url: string;
|
|
96
|
-
/** URL pattern for parameterized pages (e.g. /products/:id) */
|
|
97
|
-
urlPattern?: string;
|
|
98
|
-
/** Page title from <title> or first <h1> */
|
|
99
|
-
title?: string;
|
|
100
|
-
/** LLM-inferred semantic name, e.g. "login_page", "search_results" */
|
|
101
|
-
semanticName?: string;
|
|
102
|
-
/** LLM-inferred description */
|
|
103
|
-
description?: string;
|
|
104
|
-
/** Forms discovered on this page */
|
|
105
|
-
forms: FormDescriptor[];
|
|
106
|
-
/** Standalone buttons (not inside forms) */
|
|
107
|
-
buttons: ButtonDescriptor[];
|
|
108
|
-
/** Links discovered on this page */
|
|
109
|
-
links: LinkDescriptor[];
|
|
110
|
-
/** SHA-256 hash of the analysis screenshot */
|
|
111
|
-
screenshotHash?: string;
|
|
112
|
-
/** ISO timestamp of when this page was analyzed */
|
|
113
|
-
analyzedAt: string;
|
|
114
|
-
}
|
|
115
|
-
export type AuthFlowType = 'form-login' | 'oauth-redirect' | 'basic-auth' | 'cookie-session' | 'unknown';
|
|
116
|
-
export interface AuthFlowDescriptor {
|
|
117
|
-
/** Detected auth mechanism */
|
|
118
|
-
type: AuthFlowType;
|
|
119
|
-
/** The page containing the login form */
|
|
120
|
-
loginPage?: PageDescriptor;
|
|
121
|
-
/** The login form descriptor */
|
|
122
|
-
loginForm?: FormDescriptor;
|
|
123
|
-
/** Selector for the username/email field */
|
|
124
|
-
usernameField?: SelectorSet;
|
|
125
|
-
/** Selector for the password field */
|
|
126
|
-
passwordField?: SelectorSet;
|
|
127
|
-
/** Selector for the submit/login button */
|
|
128
|
-
submitButton?: SelectorSet;
|
|
129
|
-
/** How to detect if the user is currently logged in */
|
|
130
|
-
sessionIndicator?: {
|
|
131
|
-
/** Element present when logged in (e.g. user avatar, logout button) */
|
|
132
|
-
selector?: SelectorSet;
|
|
133
|
-
/** Cookie name that indicates an active session */
|
|
134
|
-
cookie?: string;
|
|
135
|
-
/** URL pattern after successful login (e.g. /dashboard) */
|
|
136
|
-
urlPattern?: string;
|
|
137
|
-
};
|
|
138
|
-
}
|
|
139
|
-
export interface SiteDescriptor {
|
|
140
|
-
/** Unique identifier for this site analysis */
|
|
141
|
-
siteId: string;
|
|
142
|
-
/** Base URL of the site */
|
|
143
|
-
baseUrl: string;
|
|
144
|
-
/** All discovered pages */
|
|
145
|
-
pages: PageDescriptor[];
|
|
146
|
-
/** Detected authentication flow */
|
|
147
|
-
authFlow?: AuthFlowDescriptor;
|
|
148
|
-
/** ISO timestamp of the analysis */
|
|
149
|
-
analyzedAt: string;
|
|
150
|
-
/** Version number, incremented on rescan */
|
|
151
|
-
version: number;
|
|
152
|
-
/** How deep the crawler went */
|
|
153
|
-
crawlDepth: number;
|
|
154
|
-
/** Site metadata */
|
|
155
|
-
metadata: {
|
|
156
|
-
title?: string;
|
|
157
|
-
description?: string;
|
|
158
|
-
favicon?: string;
|
|
159
|
-
};
|
|
160
|
-
}
|
|
161
|
-
export type SiteToolType = 'page-action' | 'element-action' | 'navigation' | 'browser-lifecycle';
|
|
162
|
-
export interface SiteToolDefinition {
|
|
163
|
-
/** Tool name (kebab-case, MCP-compatible) */
|
|
164
|
-
name: string;
|
|
165
|
-
/** Human-readable title */
|
|
166
|
-
title: string;
|
|
167
|
-
/** Tool description */
|
|
168
|
-
description: string;
|
|
169
|
-
/** Zod schema code for tool input parameters */
|
|
170
|
-
inputSchemaCode: string;
|
|
171
|
-
/** Output file name */
|
|
172
|
-
fileName: string;
|
|
173
|
-
/** Generated function name (camelCase) */
|
|
174
|
-
functionName: string;
|
|
175
|
-
/** What kind of site tool this is */
|
|
176
|
-
toolType: SiteToolType;
|
|
177
|
-
/** Which page this tool operates on */
|
|
178
|
-
pageId?: string;
|
|
179
|
-
/** Page URL for navigation */
|
|
180
|
-
pageUrl?: string;
|
|
181
|
-
/** Form descriptor (for form-based page-action tools) */
|
|
182
|
-
form?: FormDescriptor;
|
|
183
|
-
/** Button descriptor (for element-action tools) */
|
|
184
|
-
button?: ButtonDescriptor;
|
|
185
|
-
/** Link descriptor (for navigation tools) */
|
|
186
|
-
link?: LinkDescriptor;
|
|
187
|
-
/** All selectors this tool depends on */
|
|
188
|
-
selectors: SelectorSet[];
|
|
189
|
-
/** Whether this tool returns a screenshot alongside text */
|
|
190
|
-
returnsScreenshot: boolean;
|
|
191
|
-
/** MCP tool annotations */
|
|
192
|
-
annotations?: {
|
|
193
|
-
readOnlyHint?: boolean;
|
|
194
|
-
destructiveHint?: boolean;
|
|
195
|
-
idempotentHint?: boolean;
|
|
196
|
-
};
|
|
197
|
-
}
|
|
198
|
-
export interface BrowserConfig {
|
|
199
|
-
/** Run browser in headless mode */
|
|
200
|
-
headless: boolean;
|
|
201
|
-
/** Idle timeout before auto-closing browser (ms) */
|
|
202
|
-
idleTimeoutMs: number;
|
|
203
|
-
/** Browser viewport dimensions */
|
|
204
|
-
viewport: {
|
|
205
|
-
width: number;
|
|
206
|
-
height: number;
|
|
207
|
-
};
|
|
208
|
-
/** Custom user agent string */
|
|
209
|
-
userAgent?: string;
|
|
210
|
-
/** Maximum concurrent browser sessions (default: 10) */
|
|
211
|
-
maxSessions?: number;
|
|
212
|
-
}
|
|
213
|
-
export interface SiteProjectManifest {
|
|
214
|
-
/** Server name (kebab-case) */
|
|
215
|
-
serverName: string;
|
|
216
|
-
/** Server version */
|
|
217
|
-
serverVersion: string;
|
|
218
|
-
/** Target website base URL */
|
|
219
|
-
baseUrl: string;
|
|
220
|
-
/** MCP transport mode */
|
|
221
|
-
transport: TransportMode;
|
|
222
|
-
/** Full site descriptor (embedded in generated project) */
|
|
223
|
-
siteDescriptor: SiteDescriptor;
|
|
224
|
-
/** Generated tools */
|
|
225
|
-
tools: SiteToolDefinition[];
|
|
226
|
-
/** Environment variables the generated server needs */
|
|
227
|
-
envVars: EnvVarDescriptor[];
|
|
228
|
-
/** Playwright browser configuration */
|
|
229
|
-
browserConfig: BrowserConfig;
|
|
230
|
-
}
|
|
231
|
-
/**
|
|
232
|
-
* Regeneration metadata written to the generated project root as
|
|
233
|
-
* `mcpmake.site.json` so `mcpmake rescan` can rebuild the project from a
|
|
234
|
-
* freshly crawled SiteDescriptor without re-specifying the original CLI flags.
|
|
235
|
-
* The SiteDescriptor itself lives in `src/site-descriptor.json` and the tools
|
|
236
|
-
* are regenerated deterministically, so neither is duplicated here.
|
|
237
|
-
*/
|
|
238
|
-
export interface SiteRegenMetadata {
|
|
239
|
-
serverName: string;
|
|
240
|
-
serverVersion: string;
|
|
241
|
-
transport: TransportMode;
|
|
242
|
-
baseUrl: string;
|
|
243
|
-
envVars: EnvVarDescriptor[];
|
|
244
|
-
browserConfig: BrowserConfig;
|
|
245
|
-
}
|
|
246
|
-
export type ChangeType = 'added' | 'removed' | 'modified' | 'selector-broken';
|
|
247
|
-
export type ElementType = 'page' | 'form' | 'button' | 'link' | 'field';
|
|
248
|
-
export interface SiteChangeEntry {
|
|
249
|
-
/** What kind of change */
|
|
250
|
-
changeType: ChangeType;
|
|
251
|
-
/** What kind of element changed */
|
|
252
|
-
elementType: ElementType;
|
|
253
|
-
/** ID of the element that changed */
|
|
254
|
-
elementId: string;
|
|
255
|
-
/** Page where the change occurred */
|
|
256
|
-
pageId: string;
|
|
257
|
-
/** Human-readable description of the change */
|
|
258
|
-
description: string;
|
|
259
|
-
/** ISO timestamp */
|
|
260
|
-
timestamp: string;
|
|
261
|
-
/** Previous value (for modified/removed) */
|
|
262
|
-
oldValue?: unknown;
|
|
263
|
-
/** New value (for added/modified) */
|
|
264
|
-
newValue?: unknown;
|
|
265
|
-
}
|
|
266
|
-
export interface RescanResult {
|
|
267
|
-
/** Previous site descriptor version */
|
|
268
|
-
previousVersion: number;
|
|
269
|
-
/** New version number */
|
|
270
|
-
newVersion: number;
|
|
271
|
-
/** All changes detected */
|
|
272
|
-
changes: SiteChangeEntry[];
|
|
273
|
-
/** Selectors that no longer resolve */
|
|
274
|
-
brokenSelectors: Array<{
|
|
275
|
-
toolName: string;
|
|
276
|
-
selector: SelectorSet;
|
|
277
|
-
/** New selector if self-healing succeeded */
|
|
278
|
-
healedSelector?: SelectorSet;
|
|
279
|
-
}>;
|
|
280
|
-
/** Updated site descriptor */
|
|
281
|
-
newSiteDescriptor: SiteDescriptor;
|
|
282
|
-
/** ISO timestamp of the rescan */
|
|
283
|
-
timestamp: string;
|
|
284
|
-
}
|
package/dist/types/site.js
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Type definitions for the Website-to-MCP pipeline.
|
|
3
|
-
*
|
|
4
|
-
* These types represent DOM-based interactions (forms, buttons, links)
|
|
5
|
-
* rather than HTTP API calls. They form a parallel pipeline to the
|
|
6
|
-
* existing OperationDescriptor/ToolDefinition types in index.ts.
|
|
7
|
-
*/
|
|
8
|
-
export {};
|
package/dist/utils/fail.d.ts
DELETED
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Centralized failure exit with opt-in, redacted error reporting.
|
|
3
|
-
*
|
|
4
|
-
* Why a shared helper instead of wrapping citty's `runMain`: the commands don't
|
|
5
|
-
* `throw` on user-facing failures — they call `logger.error(...)` and then
|
|
6
|
-
* `process.exit(1)` directly. `process.exit()` terminates the event loop
|
|
7
|
-
* synchronously and bypasses every `try/catch` (including citty's `runMain`
|
|
8
|
-
* handler), so a wrapper around `runMain` would never observe these exits. The
|
|
9
|
-
* only reliable place to hook reporting is the failure site itself, so each
|
|
10
|
-
* command calls `await fail(...)` where it used to log-and-exit.
|
|
11
|
-
*
|
|
12
|
-
* Telemetry is strictly opt-in (consent modes `prompt` | `auto` | `off`), never
|
|
13
|
-
* blocks or breaks the CLI (timeout + swallowed errors, mirroring
|
|
14
|
-
* `fetchPricing`), and auto-degrades to `off` in non-TTY / CI environments so it
|
|
15
|
-
* can never hang a pipeline waiting for input.
|
|
16
|
-
*/
|
|
17
|
-
type ConsentMode = 'prompt' | 'auto' | 'off';
|
|
18
|
-
/**
|
|
19
|
-
* Apply every redaction pass. Run on both errorMessage and stack before use.
|
|
20
|
-
*
|
|
21
|
-
* Exported (as `redactText`) so the redaction contract can be unit-tested
|
|
22
|
-
* directly without invoking `fail()` (which calls `process.exit`).
|
|
23
|
-
*/
|
|
24
|
-
export declare function redactText(input: string): string;
|
|
25
|
-
/** Inputs that decide telemetry consent, injectable so the logic is testable. */
|
|
26
|
-
export interface TelemetryEnv {
|
|
27
|
-
/** The mode read from config (anything else is treated as the `prompt` default). */
|
|
28
|
-
configured?: unknown;
|
|
29
|
-
/** Whether stdout is an interactive TTY. */
|
|
30
|
-
isTTY?: boolean;
|
|
31
|
-
/** Whether we are running in CI (truthy `$CI`). */
|
|
32
|
-
ci?: boolean;
|
|
33
|
-
}
|
|
34
|
-
/**
|
|
35
|
-
* Pure consent resolver: given the configured mode and the environment, decide
|
|
36
|
-
* the effective {@link ConsentMode}.
|
|
37
|
-
*
|
|
38
|
-
* Auto-degrades to `'off'` whenever there is no interactive TTY or we're in CI —
|
|
39
|
-
* otherwise the CLI could hang waiting for input that will never come. Exported
|
|
40
|
-
* so this branchy decision can be unit-tested without touching real env/config.
|
|
41
|
-
*/
|
|
42
|
-
export declare function resolveTelemetryMode(env: TelemetryEnv): ConsentMode;
|
|
43
|
-
/**
|
|
44
|
-
* Log a user-facing failure message, optionally report it (consent permitting),
|
|
45
|
-
* then exit with code 1. Never throws; always exits.
|
|
46
|
-
*/
|
|
47
|
-
export declare function fail(message: string, error?: unknown): Promise<never>;
|
|
48
|
-
export {};
|
package/dist/utils/fail.js
DELETED
|
@@ -1,204 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Centralized failure exit with opt-in, redacted error reporting.
|
|
3
|
-
*
|
|
4
|
-
* Why a shared helper instead of wrapping citty's `runMain`: the commands don't
|
|
5
|
-
* `throw` on user-facing failures — they call `logger.error(...)` and then
|
|
6
|
-
* `process.exit(1)` directly. `process.exit()` terminates the event loop
|
|
7
|
-
* synchronously and bypasses every `try/catch` (including citty's `runMain`
|
|
8
|
-
* handler), so a wrapper around `runMain` would never observe these exits. The
|
|
9
|
-
* only reliable place to hook reporting is the failure site itself, so each
|
|
10
|
-
* command calls `await fail(...)` where it used to log-and-exit.
|
|
11
|
-
*
|
|
12
|
-
* Telemetry is strictly opt-in (consent modes `prompt` | `auto` | `off`), never
|
|
13
|
-
* blocks or breaks the CLI (timeout + swallowed errors, mirroring
|
|
14
|
-
* `fetchPricing`), and auto-degrades to `off` in non-TTY / CI environments so it
|
|
15
|
-
* can never hang a pipeline waiting for input.
|
|
16
|
-
*/
|
|
17
|
-
import os from 'node:os';
|
|
18
|
-
import { consola } from 'consola';
|
|
19
|
-
import { logger } from './logger.js';
|
|
20
|
-
import { loadConfig, globalConfig } from '../config/mcpmake-config.js';
|
|
21
|
-
import { DEFAULT_PRICING_SERVER } from '../pricing.js';
|
|
22
|
-
/** Keep in sync with `meta.version` in src/index.ts. */
|
|
23
|
-
const CLI_VERSION = '0.1.0';
|
|
24
|
-
/** How long to wait for the report POST before giving up (never blocks longer). */
|
|
25
|
-
const REPORT_TIMEOUT_MS = 4_000;
|
|
26
|
-
/** Server-side caps — fields are truncated to these lengths before sending. */
|
|
27
|
-
const CAPS = {
|
|
28
|
-
command: 200,
|
|
29
|
-
errorMessage: 2000,
|
|
30
|
-
stack: 16_000,
|
|
31
|
-
cliVersion: 40,
|
|
32
|
-
platform: 60,
|
|
33
|
-
nodeVersion: 40,
|
|
34
|
-
};
|
|
35
|
-
// --- Redaction helpers -----------------------------------------------------
|
|
36
|
-
/** Replace the user's home directory (and generic /Users|/home/<name>) with `~`. */
|
|
37
|
-
function redactHomePaths(input) {
|
|
38
|
-
let out = input;
|
|
39
|
-
const home = os.homedir();
|
|
40
|
-
if (home) {
|
|
41
|
-
out = out.split(home).join('~');
|
|
42
|
-
}
|
|
43
|
-
// Catch home dirs other than the current user's (e.g. paths from logs/CI).
|
|
44
|
-
out = out.replace(/\/(?:Users|home)\/[^/\s]+/g, '~');
|
|
45
|
-
return out;
|
|
46
|
-
}
|
|
47
|
-
/** Strip bearer tokens: `Bearer <token>` → `Bearer [redacted]`. */
|
|
48
|
-
function redactBearerTokens(input) {
|
|
49
|
-
return input.replace(/Bearer\s+\S+/g, 'Bearer [redacted]');
|
|
50
|
-
}
|
|
51
|
-
/** Strip mcpmake-style tokens (`mf_<hex>`). */
|
|
52
|
-
function redactMfTokens(input) {
|
|
53
|
-
return input.replace(/mf_[a-f0-9]+/g, 'mf_[redacted]');
|
|
54
|
-
}
|
|
55
|
-
/** Strip URL query strings (`?foo=bar` → `?[redacted]`) so creds in URLs don't leak. */
|
|
56
|
-
function redactQueryStrings(input) {
|
|
57
|
-
return input.replace(/\?[^\s'"]+/g, '?[redacted]');
|
|
58
|
-
}
|
|
59
|
-
/**
|
|
60
|
-
* Apply every redaction pass. Run on both errorMessage and stack before use.
|
|
61
|
-
*
|
|
62
|
-
* Exported (as `redactText`) so the redaction contract can be unit-tested
|
|
63
|
-
* directly without invoking `fail()` (which calls `process.exit`).
|
|
64
|
-
*/
|
|
65
|
-
export function redactText(input) {
|
|
66
|
-
return redactQueryStrings(redactMfTokens(redactBearerTokens(redactHomePaths(input))));
|
|
67
|
-
}
|
|
68
|
-
/** @deprecated internal alias — prefer the exported `redactText`. */
|
|
69
|
-
const redact = redactText;
|
|
70
|
-
function truncate(input, max) {
|
|
71
|
-
return input.length > max ? input.slice(0, max) : input;
|
|
72
|
-
}
|
|
73
|
-
// --- Payload assembly ------------------------------------------------------
|
|
74
|
-
/**
|
|
75
|
-
* Best-effort command name from argv, e.g. `from openapi` or `deploy`. Joins the
|
|
76
|
-
* first one or two non-flag tokens (subcommands like `from openapi` need two).
|
|
77
|
-
*/
|
|
78
|
-
function deriveCommand() {
|
|
79
|
-
const tokens = process.argv.slice(2).filter((t) => !t.startsWith('-'));
|
|
80
|
-
return tokens.slice(0, 2).join(' ');
|
|
81
|
-
}
|
|
82
|
-
function buildPayload(message, error) {
|
|
83
|
-
const errorMessage = error instanceof Error && error.message ? error.message : message;
|
|
84
|
-
const stack = error instanceof Error && error.stack ? error.stack : '';
|
|
85
|
-
return {
|
|
86
|
-
// Redact the command too: a positional arg can be a path or URL with creds
|
|
87
|
-
// (e.g. a mistyped `mcpmake /Users/me/secret.yaml`).
|
|
88
|
-
command: truncate(redact(deriveCommand()), CAPS.command),
|
|
89
|
-
errorMessage: truncate(redact(errorMessage), CAPS.errorMessage),
|
|
90
|
-
stack: truncate(redact(stack), CAPS.stack),
|
|
91
|
-
cliVersion: truncate(CLI_VERSION, CAPS.cliVersion),
|
|
92
|
-
platform: truncate(`${process.platform} ${process.arch}`, CAPS.platform),
|
|
93
|
-
nodeVersion: truncate(process.version, CAPS.nodeVersion),
|
|
94
|
-
};
|
|
95
|
-
}
|
|
96
|
-
/**
|
|
97
|
-
* Pure consent resolver: given the configured mode and the environment, decide
|
|
98
|
-
* the effective {@link ConsentMode}.
|
|
99
|
-
*
|
|
100
|
-
* Auto-degrades to `'off'` whenever there is no interactive TTY or we're in CI —
|
|
101
|
-
* otherwise the CLI could hang waiting for input that will never come. Exported
|
|
102
|
-
* so this branchy decision can be unit-tested without touching real env/config.
|
|
103
|
-
*/
|
|
104
|
-
export function resolveTelemetryMode(env) {
|
|
105
|
-
const value = env.configured;
|
|
106
|
-
const mode = value === 'prompt' || value === 'auto' || value === 'off' ? value : 'prompt';
|
|
107
|
-
// Critical: never prompt or block when there is no interactive TTY or we're in
|
|
108
|
-
// CI — otherwise the CLI hangs waiting for input that will never come.
|
|
109
|
-
if (!env.isTTY || env.ci) {
|
|
110
|
-
return 'off';
|
|
111
|
-
}
|
|
112
|
-
return mode;
|
|
113
|
-
}
|
|
114
|
-
/** Read the `telemetry` global config key; default `prompt`. Then apply env gates. */
|
|
115
|
-
function resolveConsent() {
|
|
116
|
-
let configured;
|
|
117
|
-
try {
|
|
118
|
-
const loaded = loadConfig();
|
|
119
|
-
if (loaded) {
|
|
120
|
-
configured = globalConfig(loaded.data).telemetry;
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
catch {
|
|
124
|
-
// A malformed config must never block a failure exit — keep the default.
|
|
125
|
-
}
|
|
126
|
-
return resolveTelemetryMode({
|
|
127
|
-
// consola.prompt reads stdin and writes stdout, so require BOTH to be a TTY —
|
|
128
|
-
// otherwise a redirected stream could let a prompt appear (or block) wrongly.
|
|
129
|
-
configured,
|
|
130
|
-
isTTY: Boolean(process.stdout.isTTY) && Boolean(process.stdin.isTTY),
|
|
131
|
-
ci: Boolean(process.env.CI),
|
|
132
|
-
});
|
|
133
|
-
}
|
|
134
|
-
// --- Reporting -------------------------------------------------------------
|
|
135
|
-
function reportServer() {
|
|
136
|
-
return process.env.MCPMAKE_SERVER || DEFAULT_PRICING_SERVER;
|
|
137
|
-
}
|
|
138
|
-
/** Multi-line preview of exactly what will be sent (already redacted). */
|
|
139
|
-
function previewReport(payload) {
|
|
140
|
-
logger.info('');
|
|
141
|
-
logger.info('Opt-in error report (redacted) — exactly what would be sent:');
|
|
142
|
-
logger.info(` command: ${payload.command || '(none)'}`);
|
|
143
|
-
logger.info(` errorMessage: ${payload.errorMessage}`);
|
|
144
|
-
if (payload.stack) {
|
|
145
|
-
logger.info(` stack: ${payload.stack.split('\n')[0]} ...`);
|
|
146
|
-
}
|
|
147
|
-
logger.info(` cliVersion: ${payload.cliVersion}`);
|
|
148
|
-
logger.info(` platform: ${payload.platform}`);
|
|
149
|
-
logger.info(` nodeVersion: ${payload.nodeVersion}`);
|
|
150
|
-
logger.info('Not sent: no file contents, no environment variables, no secrets.');
|
|
151
|
-
logger.info('');
|
|
152
|
-
}
|
|
153
|
-
/**
|
|
154
|
-
* POST the report. Mirrors the AbortController + timeout + swallow-everything
|
|
155
|
-
* pattern in `fetchPricing`: this must never throw or block the CLI. The server
|
|
156
|
-
* rejects `Content-Encoding`, so we send a plain JSON body.
|
|
157
|
-
*/
|
|
158
|
-
async function sendReport(payload) {
|
|
159
|
-
const controller = new AbortController();
|
|
160
|
-
const timer = setTimeout(() => controller.abort(), REPORT_TIMEOUT_MS);
|
|
161
|
-
try {
|
|
162
|
-
const base = reportServer().replace(/\/+$/, '');
|
|
163
|
-
await fetch(`${base}/api/telemetry/report`, {
|
|
164
|
-
method: 'POST',
|
|
165
|
-
headers: { 'Content-Type': 'application/json' },
|
|
166
|
-
body: JSON.stringify(payload),
|
|
167
|
-
signal: controller.signal,
|
|
168
|
-
});
|
|
169
|
-
}
|
|
170
|
-
catch {
|
|
171
|
-
// Reporting is best-effort; a failure here must never affect the CLI.
|
|
172
|
-
}
|
|
173
|
-
finally {
|
|
174
|
-
clearTimeout(timer);
|
|
175
|
-
}
|
|
176
|
-
}
|
|
177
|
-
/**
|
|
178
|
-
* Log a user-facing failure message, optionally report it (consent permitting),
|
|
179
|
-
* then exit with code 1. Never throws; always exits.
|
|
180
|
-
*/
|
|
181
|
-
export async function fail(message, error) {
|
|
182
|
-
logger.error(message);
|
|
183
|
-
const consent = resolveConsent();
|
|
184
|
-
if (consent !== 'off') {
|
|
185
|
-
const payload = buildPayload(message, error);
|
|
186
|
-
try {
|
|
187
|
-
if (consent === 'prompt') {
|
|
188
|
-
previewReport(payload);
|
|
189
|
-
const ok = await consola.prompt('Send this report?', { type: 'confirm' });
|
|
190
|
-
if (ok === true) {
|
|
191
|
-
await sendReport(payload);
|
|
192
|
-
}
|
|
193
|
-
}
|
|
194
|
-
else {
|
|
195
|
-
// auto: send silently.
|
|
196
|
-
await sendReport(payload);
|
|
197
|
-
}
|
|
198
|
-
}
|
|
199
|
-
catch {
|
|
200
|
-
// Prompting/reporting must never get in the way of the exit.
|
|
201
|
-
}
|
|
202
|
-
}
|
|
203
|
-
process.exit(1);
|
|
204
|
-
}
|
package/dist/utils/fs.d.ts
DELETED
package/dist/utils/fs.js
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { mkdir, writeFile, access } from 'node:fs/promises';
|
|
2
|
-
import { dirname } from 'node:path';
|
|
3
|
-
export async function ensureDir(dir) {
|
|
4
|
-
await mkdir(dir, { recursive: true });
|
|
5
|
-
}
|
|
6
|
-
export async function writeFileSafe(filePath, content, options) {
|
|
7
|
-
if (!options.force) {
|
|
8
|
-
try {
|
|
9
|
-
await access(filePath);
|
|
10
|
-
return false; // file exists, skip
|
|
11
|
-
}
|
|
12
|
-
catch {
|
|
13
|
-
// file doesn't exist, proceed
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
await ensureDir(dirname(filePath));
|
|
17
|
-
await writeFile(filePath, content, 'utf-8');
|
|
18
|
-
return true;
|
|
19
|
-
}
|
|
20
|
-
export async function pathExists(filePath) {
|
|
21
|
-
try {
|
|
22
|
-
await access(filePath);
|
|
23
|
-
return true;
|
|
24
|
-
}
|
|
25
|
-
catch {
|
|
26
|
-
return false;
|
|
27
|
-
}
|
|
28
|
-
}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import type { OperationDescriptor } from '../types/index.js';
|
|
2
|
-
/**
|
|
3
|
-
* Show detected operations and let user confirm, skip, or rename before generation.
|
|
4
|
-
* Returns the filtered/modified list of operations to proceed with.
|
|
5
|
-
*/
|
|
6
|
-
export declare function confirmOperations(operations: OperationDescriptor[]): Promise<OperationDescriptor[]>;
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { createInterface } from 'node:readline';
|
|
2
|
-
import { logger } from './logger.js';
|
|
3
|
-
/**
|
|
4
|
-
* Show detected operations and let user confirm, skip, or rename before generation.
|
|
5
|
-
* Returns the filtered/modified list of operations to proceed with.
|
|
6
|
-
*/
|
|
7
|
-
export async function confirmOperations(operations) {
|
|
8
|
-
const rl = createInterface({ input: process.stdin, output: process.stderr });
|
|
9
|
-
const ask = (question) => new Promise((resolve) => rl.question(question, resolve));
|
|
10
|
-
logger.info('');
|
|
11
|
-
logger.info(`Detected ${operations.length} operations:`);
|
|
12
|
-
logger.info('');
|
|
13
|
-
for (let i = 0; i < operations.length; i++) {
|
|
14
|
-
const op = operations[i];
|
|
15
|
-
logger.info(` ${i + 1}. [${op.method.toUpperCase()}] ${op.path} → ${op.operationId}` +
|
|
16
|
-
(op.summary ? ` — ${op.summary}` : ''));
|
|
17
|
-
}
|
|
18
|
-
logger.info('');
|
|
19
|
-
const answer = await ask('Enter numbers to exclude (comma-separated), or press Enter to keep all: ');
|
|
20
|
-
rl.close();
|
|
21
|
-
if (!answer.trim())
|
|
22
|
-
return operations;
|
|
23
|
-
const excludeIndices = new Set(answer
|
|
24
|
-
.split(',')
|
|
25
|
-
.map((s) => parseInt(s.trim(), 10) - 1)
|
|
26
|
-
.filter((n) => !isNaN(n) && n >= 0 && n < operations.length));
|
|
27
|
-
const result = operations.filter((_, i) => !excludeIndices.has(i));
|
|
28
|
-
logger.info(`Proceeding with ${result.length} operations (excluded ${excludeIndices.size})`);
|
|
29
|
-
return result;
|
|
30
|
-
}
|
package/dist/utils/logger.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const logger: import("consola").ConsolaInstance;
|
package/dist/utils/logger.js
DELETED
package/dist/utils/sanitize.d.ts
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Sanitize a string for safe embedding in a JavaScript/TypeScript single-quoted string literal.
|
|
3
|
-
* Escapes backslashes, single quotes, and newlines.
|
|
4
|
-
*/
|
|
5
|
-
export declare function escapeStringLiteral(str: string): string;
|
|
6
|
-
/**
|
|
7
|
-
* Sanitize a string for safe embedding in a JavaScript/TypeScript template literal.
|
|
8
|
-
* Escapes backticks, ${} expressions, and backslashes.
|
|
9
|
-
*/
|
|
10
|
-
export declare function escapeTemplateLiteral(str: string): string;
|
|
11
|
-
/**
|
|
12
|
-
* Validate that an identifier (operationId, param name) contains only safe characters.
|
|
13
|
-
* Strips anything that isn't alphanumeric, underscore, or hyphen.
|
|
14
|
-
*/
|
|
15
|
-
export declare function sanitizeIdentifier(str: string): string;
|
|
16
|
-
/**
|
|
17
|
-
* Validate that a URL path template contains only safe characters.
|
|
18
|
-
* Allows: alphanumeric, /, {, }, -, _, .
|
|
19
|
-
*/
|
|
20
|
-
export declare function sanitizePathTemplate(str: string): string;
|
|
21
|
-
/**
|
|
22
|
-
* Sanitize a file name — strip path separators and traversal sequences.
|
|
23
|
-
*/
|
|
24
|
-
export declare function sanitizeFileName(str: string): string;
|
|
25
|
-
/**
|
|
26
|
-
* Check if a key is a dangerous prototype pollution key.
|
|
27
|
-
*/
|
|
28
|
-
export declare function isDangerousKey(key: string): boolean;
|