@syrin/cli 1.3.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/LICENSE +15 -0
- package/README.md +302 -0
- package/dist/cli/commands/analyse.d.ts +16 -0
- package/dist/cli/commands/analyse.js +61 -0
- package/dist/cli/commands/dev.d.ts +23 -0
- package/dist/cli/commands/dev.js +419 -0
- package/dist/cli/commands/doctor.d.ts +10 -0
- package/dist/cli/commands/doctor.js +195 -0
- package/dist/cli/commands/index.d.ts +12 -0
- package/dist/cli/commands/index.js +12 -0
- package/dist/cli/commands/init.d.ts +16 -0
- package/dist/cli/commands/init.js +90 -0
- package/dist/cli/commands/list.d.ts +15 -0
- package/dist/cli/commands/list.js +50 -0
- package/dist/cli/commands/rollback.d.ts +12 -0
- package/dist/cli/commands/rollback.js +101 -0
- package/dist/cli/commands/test.d.ts +31 -0
- package/dist/cli/commands/test.js +88 -0
- package/dist/cli/commands/update.d.ts +9 -0
- package/dist/cli/commands/update.js +76 -0
- package/dist/cli/index.d.ts +13 -0
- package/dist/cli/index.js +342 -0
- package/dist/cli/prompts/index.d.ts +5 -0
- package/dist/cli/prompts/index.js +5 -0
- package/dist/cli/prompts/init-prompt.d.ts +17 -0
- package/dist/cli/prompts/init-prompt.js +263 -0
- package/dist/cli/utils/command-error-handler.d.ts +14 -0
- package/dist/cli/utils/command-error-handler.js +35 -0
- package/dist/cli/utils/common-types.d.ts +24 -0
- package/dist/cli/utils/common-types.js +6 -0
- package/dist/cli/utils/connection-handler.d.ts +37 -0
- package/dist/cli/utils/connection-handler.js +90 -0
- package/dist/cli/utils/index.d.ts +11 -0
- package/dist/cli/utils/index.js +11 -0
- package/dist/cli/utils/option-parsers.d.ts +41 -0
- package/dist/cli/utils/option-parsers.js +92 -0
- package/dist/cli/utils/output-utils.d.ts +12 -0
- package/dist/cli/utils/output-utils.js +21 -0
- package/dist/cli/utils/transport-resolver.d.ts +33 -0
- package/dist/cli/utils/transport-resolver.js +82 -0
- package/dist/cli/utils/version-banner.d.ts +10 -0
- package/dist/cli/utils/version-banner.js +26 -0
- package/dist/config/env-checker.d.ts +37 -0
- package/dist/config/env-checker.js +136 -0
- package/dist/config/generator.d.ts +19 -0
- package/dist/config/generator.js +196 -0
- package/dist/config/index.d.ts +9 -0
- package/dist/config/index.js +9 -0
- package/dist/config/loader.d.ts +19 -0
- package/dist/config/loader.js +57 -0
- package/dist/config/schema.d.ts +42 -0
- package/dist/config/schema.js +181 -0
- package/dist/config/syrin.template.yaml +127 -0
- package/dist/config/types.d.ts +87 -0
- package/dist/config/types.js +6 -0
- package/dist/constants/app.d.ts +9 -0
- package/dist/constants/app.js +9 -0
- package/dist/constants/commands.d.ts +43 -0
- package/dist/constants/commands.js +43 -0
- package/dist/constants/defaults.d.ts +18 -0
- package/dist/constants/defaults.js +18 -0
- package/dist/constants/env-vars.d.ts +11 -0
- package/dist/constants/env-vars.js +11 -0
- package/dist/constants/icons.d.ts +23 -0
- package/dist/constants/icons.js +23 -0
- package/dist/constants/index.d.ts +17 -0
- package/dist/constants/index.js +17 -0
- package/dist/constants/labels.d.ts +38 -0
- package/dist/constants/labels.js +42 -0
- package/dist/constants/links.d.ts +10 -0
- package/dist/constants/links.js +11 -0
- package/dist/constants/list.d.ts +10 -0
- package/dist/constants/list.js +9 -0
- package/dist/constants/llm.d.ts +26 -0
- package/dist/constants/llm.js +25 -0
- package/dist/constants/messages.d.ts +107 -0
- package/dist/constants/messages.js +138 -0
- package/dist/constants/paths.d.ts +29 -0
- package/dist/constants/paths.js +29 -0
- package/dist/constants/transport.d.ts +9 -0
- package/dist/constants/transport.js +8 -0
- package/dist/events/emitter.d.ts +64 -0
- package/dist/events/emitter.js +142 -0
- package/dist/events/event-type.d.ts +66 -0
- package/dist/events/event-type.js +81 -0
- package/dist/events/payloads/diagnostics.d.ts +24 -0
- package/dist/events/payloads/diagnostics.js +5 -0
- package/dist/events/payloads/index.d.ts +15 -0
- package/dist/events/payloads/index.js +6 -0
- package/dist/events/payloads/llm.d.ts +58 -0
- package/dist/events/payloads/llm.js +6 -0
- package/dist/events/payloads/registry.d.ts +28 -0
- package/dist/events/payloads/registry.js +5 -0
- package/dist/events/payloads/session.d.ts +32 -0
- package/dist/events/payloads/session.js +5 -0
- package/dist/events/payloads/testing.d.ts +17 -0
- package/dist/events/payloads/testing.js +5 -0
- package/dist/events/payloads/tool.d.ts +29 -0
- package/dist/events/payloads/tool.js +5 -0
- package/dist/events/payloads/transport.d.ts +30 -0
- package/dist/events/payloads/transport.js +5 -0
- package/dist/events/payloads/validation.d.ts +37 -0
- package/dist/events/payloads/validation.js +5 -0
- package/dist/events/payloads/workflow.d.ts +45 -0
- package/dist/events/payloads/workflow.js +5 -0
- package/dist/events/store/file-store.d.ts +37 -0
- package/dist/events/store/file-store.js +113 -0
- package/dist/events/store/index.d.ts +7 -0
- package/dist/events/store/index.js +6 -0
- package/dist/events/store/memory-store.d.ts +26 -0
- package/dist/events/store/memory-store.js +39 -0
- package/dist/events/store.d.ts +11 -0
- package/dist/events/store.js +2 -0
- package/dist/events/types.d.ts +14 -0
- package/dist/events/types.js +2 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.js +30 -0
- package/dist/presentation/analysis-ui.d.ts +24 -0
- package/dist/presentation/analysis-ui.js +158 -0
- package/dist/presentation/dev/chat-ui-types.d.ts +68 -0
- package/dist/presentation/dev/chat-ui-types.js +5 -0
- package/dist/presentation/dev/chat-ui.d.ts +61 -0
- package/dist/presentation/dev/chat-ui.js +714 -0
- package/dist/presentation/dev/components/assistant-message.d.ts +19 -0
- package/dist/presentation/dev/components/assistant-message.js +36 -0
- package/dist/presentation/dev/components/header.d.ts +16 -0
- package/dist/presentation/dev/components/header.js +22 -0
- package/dist/presentation/dev/components/index.d.ts +13 -0
- package/dist/presentation/dev/components/index.js +13 -0
- package/dist/presentation/dev/components/input-panel.d.ts +22 -0
- package/dist/presentation/dev/components/input-panel.js +43 -0
- package/dist/presentation/dev/components/message-component.d.ts +16 -0
- package/dist/presentation/dev/components/message-component.js +51 -0
- package/dist/presentation/dev/components/messages-list.d.ts +24 -0
- package/dist/presentation/dev/components/messages-list.js +48 -0
- package/dist/presentation/dev/components/system-message.d.ts +16 -0
- package/dist/presentation/dev/components/system-message.js +26 -0
- package/dist/presentation/dev/components/user-message.d.ts +21 -0
- package/dist/presentation/dev/components/user-message.js +35 -0
- package/dist/presentation/dev/components/welcome-banner.d.ts +24 -0
- package/dist/presentation/dev/components/welcome-banner.js +146 -0
- package/dist/presentation/dev/goodbye-messages.d.ts +31 -0
- package/dist/presentation/dev/goodbye-messages.js +100 -0
- package/dist/presentation/dev/index.d.ts +5 -0
- package/dist/presentation/dev/index.js +5 -0
- package/dist/presentation/dev/text-wrapper.d.ts +30 -0
- package/dist/presentation/dev/text-wrapper.js +74 -0
- package/dist/presentation/dev-ui.d.ts +33 -0
- package/dist/presentation/dev-ui.js +246 -0
- package/dist/presentation/doctor-ui.d.ts +40 -0
- package/dist/presentation/doctor-ui.js +157 -0
- package/dist/presentation/init-ui.d.ts +14 -0
- package/dist/presentation/init-ui.js +41 -0
- package/dist/presentation/list-ui.d.ts +44 -0
- package/dist/presentation/list-ui.js +139 -0
- package/dist/presentation/test-ui.d.ts +49 -0
- package/dist/presentation/test-ui.js +358 -0
- package/dist/runtime/analysis/analyser.d.ts +14 -0
- package/dist/runtime/analysis/analyser.js +88 -0
- package/dist/runtime/analysis/dependencies.d.ts +10 -0
- package/dist/runtime/analysis/dependencies.js +140 -0
- package/dist/runtime/analysis/index.d.ts +10 -0
- package/dist/runtime/analysis/index.js +10 -0
- package/dist/runtime/analysis/indexer.d.ts +10 -0
- package/dist/runtime/analysis/indexer.js +62 -0
- package/dist/runtime/analysis/loader.d.ts +15 -0
- package/dist/runtime/analysis/loader.js +47 -0
- package/dist/runtime/analysis/normalizer.d.ts +14 -0
- package/dist/runtime/analysis/normalizer.js +184 -0
- package/dist/runtime/analysis/rules/__test-helpers__.d.ts +18 -0
- package/dist/runtime/analysis/rules/__test-helpers__.js +40 -0
- package/dist/runtime/analysis/rules/base.d.ts +38 -0
- package/dist/runtime/analysis/rules/base.js +23 -0
- package/dist/runtime/analysis/rules/error-codes.d.ts +64 -0
- package/dist/runtime/analysis/rules/error-codes.js +73 -0
- package/dist/runtime/analysis/rules/errors/e000-tool-not-found.d.ts +35 -0
- package/dist/runtime/analysis/rules/errors/e000-tool-not-found.js +32 -0
- package/dist/runtime/analysis/rules/errors/e001-missing-output-schema.d.ts +22 -0
- package/dist/runtime/analysis/rules/errors/e001-missing-output-schema.js +30 -0
- package/dist/runtime/analysis/rules/errors/e002-underspecified-input.d.ts +24 -0
- package/dist/runtime/analysis/rules/errors/e002-underspecified-input.js +52 -0
- package/dist/runtime/analysis/rules/errors/e003-type-mismatch.d.ts +23 -0
- package/dist/runtime/analysis/rules/errors/e003-type-mismatch.js +73 -0
- package/dist/runtime/analysis/rules/errors/e004-free-text-propagation.d.ts +23 -0
- package/dist/runtime/analysis/rules/errors/e004-free-text-propagation.js +47 -0
- package/dist/runtime/analysis/rules/errors/e005-tool-ambiguity.d.ts +25 -0
- package/dist/runtime/analysis/rules/errors/e005-tool-ambiguity.js +73 -0
- package/dist/runtime/analysis/rules/errors/e006-param-not-in-description.d.ts +22 -0
- package/dist/runtime/analysis/rules/errors/e006-param-not-in-description.js +57 -0
- package/dist/runtime/analysis/rules/errors/e007-output-not-guaranteed.d.ts +23 -0
- package/dist/runtime/analysis/rules/errors/e007-output-not-guaranteed.js +56 -0
- package/dist/runtime/analysis/rules/errors/e008-circular-dependency.d.ts +22 -0
- package/dist/runtime/analysis/rules/errors/e008-circular-dependency.js +84 -0
- package/dist/runtime/analysis/rules/errors/e009-implicit-user-input.d.ts +23 -0
- package/dist/runtime/analysis/rules/errors/e009-implicit-user-input.js +89 -0
- package/dist/runtime/analysis/rules/errors/e010-non-serializable.d.ts +25 -0
- package/dist/runtime/analysis/rules/errors/e010-non-serializable.js +46 -0
- package/dist/runtime/analysis/rules/errors/e011-missing-tool-description.d.ts +24 -0
- package/dist/runtime/analysis/rules/errors/e011-missing-tool-description.js +33 -0
- package/dist/runtime/analysis/rules/errors/e012-side-effect-detected.d.ts +39 -0
- package/dist/runtime/analysis/rules/errors/e012-side-effect-detected.js +40 -0
- package/dist/runtime/analysis/rules/errors/e013-non-deterministic-output.d.ts +37 -0
- package/dist/runtime/analysis/rules/errors/e013-non-deterministic-output.js +34 -0
- package/dist/runtime/analysis/rules/errors/e013-output-explosion.d.ts +39 -0
- package/dist/runtime/analysis/rules/errors/e013-output-explosion.js +36 -0
- package/dist/runtime/analysis/rules/errors/e014-hidden-dependency.d.ts +42 -0
- package/dist/runtime/analysis/rules/errors/e014-hidden-dependency.js +46 -0
- package/dist/runtime/analysis/rules/errors/e014-output-explosion.d.ts +39 -0
- package/dist/runtime/analysis/rules/errors/e014-output-explosion.js +36 -0
- package/dist/runtime/analysis/rules/errors/e015-hidden-dependency.d.ts +42 -0
- package/dist/runtime/analysis/rules/errors/e015-hidden-dependency.js +46 -0
- package/dist/runtime/analysis/rules/errors/e015-unbounded-execution.d.ts +44 -0
- package/dist/runtime/analysis/rules/errors/e015-unbounded-execution.js +66 -0
- package/dist/runtime/analysis/rules/errors/e016-output-validation-failed.d.ts +43 -0
- package/dist/runtime/analysis/rules/errors/e016-output-validation-failed.js +42 -0
- package/dist/runtime/analysis/rules/errors/e016-unbounded-execution.d.ts +44 -0
- package/dist/runtime/analysis/rules/errors/e016-unbounded-execution.js +66 -0
- package/dist/runtime/analysis/rules/errors/e017-input-validation-failed.d.ts +57 -0
- package/dist/runtime/analysis/rules/errors/e017-input-validation-failed.js +80 -0
- package/dist/runtime/analysis/rules/errors/e017-output-validation-failed.d.ts +43 -0
- package/dist/runtime/analysis/rules/errors/e017-output-validation-failed.js +42 -0
- package/dist/runtime/analysis/rules/errors/e018-input-validation-failed.d.ts +57 -0
- package/dist/runtime/analysis/rules/errors/e018-input-validation-failed.js +80 -0
- package/dist/runtime/analysis/rules/errors/e018-tool-execution-failed.d.ts +38 -0
- package/dist/runtime/analysis/rules/errors/e018-tool-execution-failed.js +37 -0
- package/dist/runtime/analysis/rules/errors/e019-tool-execution-failed.d.ts +38 -0
- package/dist/runtime/analysis/rules/errors/e019-tool-execution-failed.js +37 -0
- package/dist/runtime/analysis/rules/errors/e019-unexpected-test-result.d.ts +65 -0
- package/dist/runtime/analysis/rules/errors/e019-unexpected-test-result.js +109 -0
- package/dist/runtime/analysis/rules/errors/e020-unexpected-test-result.d.ts +65 -0
- package/dist/runtime/analysis/rules/errors/e020-unexpected-test-result.js +109 -0
- package/dist/runtime/analysis/rules/errors/e100-missing-output-schema.d.ts +22 -0
- package/dist/runtime/analysis/rules/errors/e100-missing-output-schema.js +30 -0
- package/dist/runtime/analysis/rules/errors/e101-missing-tool-description.d.ts +24 -0
- package/dist/runtime/analysis/rules/errors/e101-missing-tool-description.js +33 -0
- package/dist/runtime/analysis/rules/errors/e102-underspecified-input.d.ts +24 -0
- package/dist/runtime/analysis/rules/errors/e102-underspecified-input.js +52 -0
- package/dist/runtime/analysis/rules/errors/e103-type-mismatch.d.ts +23 -0
- package/dist/runtime/analysis/rules/errors/e103-type-mismatch.js +72 -0
- package/dist/runtime/analysis/rules/errors/e104-param-not-in-description.d.ts +22 -0
- package/dist/runtime/analysis/rules/errors/e104-param-not-in-description.js +57 -0
- package/dist/runtime/analysis/rules/errors/e105-free-text-propagation.d.ts +23 -0
- package/dist/runtime/analysis/rules/errors/e105-free-text-propagation.js +47 -0
- package/dist/runtime/analysis/rules/errors/e106-output-not-guaranteed.d.ts +23 -0
- package/dist/runtime/analysis/rules/errors/e106-output-not-guaranteed.js +58 -0
- package/dist/runtime/analysis/rules/errors/e107-circular-dependency.d.ts +22 -0
- package/dist/runtime/analysis/rules/errors/e107-circular-dependency.js +84 -0
- package/dist/runtime/analysis/rules/errors/e108-implicit-user-input.d.ts +23 -0
- package/dist/runtime/analysis/rules/errors/e108-implicit-user-input.js +94 -0
- package/dist/runtime/analysis/rules/errors/e109-non-serializable.d.ts +25 -0
- package/dist/runtime/analysis/rules/errors/e109-non-serializable.js +44 -0
- package/dist/runtime/analysis/rules/errors/e110-tool-ambiguity.d.ts +25 -0
- package/dist/runtime/analysis/rules/errors/e110-tool-ambiguity.js +73 -0
- package/dist/runtime/analysis/rules/errors/e200-input-validation-failed.d.ts +57 -0
- package/dist/runtime/analysis/rules/errors/e200-input-validation-failed.js +71 -0
- package/dist/runtime/analysis/rules/errors/e300-output-validation-failed.d.ts +43 -0
- package/dist/runtime/analysis/rules/errors/e300-output-validation-failed.js +44 -0
- package/dist/runtime/analysis/rules/errors/e301-output-explosion.d.ts +39 -0
- package/dist/runtime/analysis/rules/errors/e301-output-explosion.js +36 -0
- package/dist/runtime/analysis/rules/errors/e400-tool-execution-failed.d.ts +38 -0
- package/dist/runtime/analysis/rules/errors/e400-tool-execution-failed.js +37 -0
- package/dist/runtime/analysis/rules/errors/e403-unbounded-execution.d.ts +44 -0
- package/dist/runtime/analysis/rules/errors/e403-unbounded-execution.js +66 -0
- package/dist/runtime/analysis/rules/errors/e500-side-effect-detected.d.ts +39 -0
- package/dist/runtime/analysis/rules/errors/e500-side-effect-detected.js +40 -0
- package/dist/runtime/analysis/rules/errors/e501-hidden-dependency.d.ts +47 -0
- package/dist/runtime/analysis/rules/errors/e501-hidden-dependency.js +46 -0
- package/dist/runtime/analysis/rules/errors/e600-unexpected-test-result.d.ts +65 -0
- package/dist/runtime/analysis/rules/errors/e600-unexpected-test-result.js +109 -0
- package/dist/runtime/analysis/rules/index.d.ts +18 -0
- package/dist/runtime/analysis/rules/index.js +94 -0
- package/dist/runtime/analysis/rules/warnings/w001-implicit-dependency.d.ts +22 -0
- package/dist/runtime/analysis/rules/warnings/w001-implicit-dependency.js +39 -0
- package/dist/runtime/analysis/rules/warnings/w002-free-text-without-normalization.d.ts +24 -0
- package/dist/runtime/analysis/rules/warnings/w002-free-text-without-normalization.js +40 -0
- package/dist/runtime/analysis/rules/warnings/w003-missing-examples.d.ts +22 -0
- package/dist/runtime/analysis/rules/warnings/w003-missing-examples.js +84 -0
- package/dist/runtime/analysis/rules/warnings/w004-overloaded-responsibility.d.ts +23 -0
- package/dist/runtime/analysis/rules/warnings/w004-overloaded-responsibility.js +96 -0
- package/dist/runtime/analysis/rules/warnings/w005-generic-description.d.ts +53 -0
- package/dist/runtime/analysis/rules/warnings/w005-generic-description.js +108 -0
- package/dist/runtime/analysis/rules/warnings/w006-optional-as-required.d.ts +22 -0
- package/dist/runtime/analysis/rules/warnings/w006-optional-as-required.js +44 -0
- package/dist/runtime/analysis/rules/warnings/w007-broad-output-schema.d.ts +23 -0
- package/dist/runtime/analysis/rules/warnings/w007-broad-output-schema.js +37 -0
- package/dist/runtime/analysis/rules/warnings/w008-multiple-entry-points.d.ts +22 -0
- package/dist/runtime/analysis/rules/warnings/w008-multiple-entry-points.js +97 -0
- package/dist/runtime/analysis/rules/warnings/w009-hidden-side-effects.d.ts +23 -0
- package/dist/runtime/analysis/rules/warnings/w009-hidden-side-effects.js +88 -0
- package/dist/runtime/analysis/rules/warnings/w010-output-not-reusable.d.ts +22 -0
- package/dist/runtime/analysis/rules/warnings/w010-output-not-reusable.js +81 -0
- package/dist/runtime/analysis/rules/warnings/w021-weak-schema.d.ts +40 -0
- package/dist/runtime/analysis/rules/warnings/w021-weak-schema.js +32 -0
- package/dist/runtime/analysis/rules/warnings/w022-high-entropy-output.d.ts +39 -0
- package/dist/runtime/analysis/rules/warnings/w022-high-entropy-output.js +36 -0
- package/dist/runtime/analysis/rules/warnings/w023-unstable-defaults.d.ts +38 -0
- package/dist/runtime/analysis/rules/warnings/w023-unstable-defaults.js +36 -0
- package/dist/runtime/analysis/rules/warnings/w100-implicit-dependency.d.ts +22 -0
- package/dist/runtime/analysis/rules/warnings/w100-implicit-dependency.js +89 -0
- package/dist/runtime/analysis/rules/warnings/w101-free-text-without-normalization.d.ts +24 -0
- package/dist/runtime/analysis/rules/warnings/w101-free-text-without-normalization.js +40 -0
- package/dist/runtime/analysis/rules/warnings/w102-missing-examples.d.ts +22 -0
- package/dist/runtime/analysis/rules/warnings/w102-missing-examples.js +76 -0
- package/dist/runtime/analysis/rules/warnings/w103-overloaded-responsibility.d.ts +23 -0
- package/dist/runtime/analysis/rules/warnings/w103-overloaded-responsibility.js +91 -0
- package/dist/runtime/analysis/rules/warnings/w104-generic-description.d.ts +53 -0
- package/dist/runtime/analysis/rules/warnings/w104-generic-description.js +108 -0
- package/dist/runtime/analysis/rules/warnings/w105-optional-as-required.d.ts +22 -0
- package/dist/runtime/analysis/rules/warnings/w105-optional-as-required.js +45 -0
- package/dist/runtime/analysis/rules/warnings/w106-broad-output-schema.d.ts +23 -0
- package/dist/runtime/analysis/rules/warnings/w106-broad-output-schema.js +37 -0
- package/dist/runtime/analysis/rules/warnings/w107-multiple-entry-points.d.ts +22 -0
- package/dist/runtime/analysis/rules/warnings/w107-multiple-entry-points.js +97 -0
- package/dist/runtime/analysis/rules/warnings/w108-hidden-side-effects.d.ts +23 -0
- package/dist/runtime/analysis/rules/warnings/w108-hidden-side-effects.js +94 -0
- package/dist/runtime/analysis/rules/warnings/w109-output-not-reusable.d.ts +22 -0
- package/dist/runtime/analysis/rules/warnings/w109-output-not-reusable.js +63 -0
- package/dist/runtime/analysis/rules/warnings/w110-weak-schema.d.ts +40 -0
- package/dist/runtime/analysis/rules/warnings/w110-weak-schema.js +32 -0
- package/dist/runtime/analysis/rules/warnings/w300-high-entropy-output.d.ts +39 -0
- package/dist/runtime/analysis/rules/warnings/w300-high-entropy-output.js +47 -0
- package/dist/runtime/analysis/rules/warnings/w301-unstable-defaults.d.ts +38 -0
- package/dist/runtime/analysis/rules/warnings/w301-unstable-defaults.js +36 -0
- package/dist/runtime/analysis/strict-mode.d.ts +21 -0
- package/dist/runtime/analysis/strict-mode.js +44 -0
- package/dist/runtime/analysis/types.d.ts +133 -0
- package/dist/runtime/analysis/types.js +6 -0
- package/dist/runtime/analysis/utils.d.ts +19 -0
- package/dist/runtime/analysis/utils.js +21 -0
- package/dist/runtime/dev/data-manager.d.ts +55 -0
- package/dist/runtime/dev/data-manager.js +87 -0
- package/dist/runtime/dev/event-mapper.d.ts +100 -0
- package/dist/runtime/dev/event-mapper.js +400 -0
- package/dist/runtime/dev/formatter.d.ts +94 -0
- package/dist/runtime/dev/formatter.js +236 -0
- package/dist/runtime/dev/index.d.ts +9 -0
- package/dist/runtime/dev/index.js +9 -0
- package/dist/runtime/dev/repl.d.ts +114 -0
- package/dist/runtime/dev/repl.js +310 -0
- package/dist/runtime/dev/session.d.ts +86 -0
- package/dist/runtime/dev/session.js +447 -0
- package/dist/runtime/dev/stack-trace.d.ts +77 -0
- package/dist/runtime/dev/stack-trace.js +286 -0
- package/dist/runtime/dev/types.d.ts +54 -0
- package/dist/runtime/dev/types.js +5 -0
- package/dist/runtime/llm/claude.d.ts +27 -0
- package/dist/runtime/llm/claude.js +150 -0
- package/dist/runtime/llm/factory.d.ts +30 -0
- package/dist/runtime/llm/factory.js +78 -0
- package/dist/runtime/llm/index.d.ts +10 -0
- package/dist/runtime/llm/index.js +10 -0
- package/dist/runtime/llm/ollama.d.ts +45 -0
- package/dist/runtime/llm/ollama.js +449 -0
- package/dist/runtime/llm/openai.d.ts +27 -0
- package/dist/runtime/llm/openai.js +170 -0
- package/dist/runtime/llm/provider.d.ts +32 -0
- package/dist/runtime/llm/provider.js +6 -0
- package/dist/runtime/llm/types.d.ts +55 -0
- package/dist/runtime/llm/types.js +6 -0
- package/dist/runtime/mcp/client/base.d.ts +40 -0
- package/dist/runtime/mcp/client/base.js +157 -0
- package/dist/runtime/mcp/client/manager.d.ts +91 -0
- package/dist/runtime/mcp/client/manager.js +248 -0
- package/dist/runtime/mcp/client/process.d.ts +31 -0
- package/dist/runtime/mcp/client/process.js +82 -0
- package/dist/runtime/mcp/connection.d.ts +63 -0
- package/dist/runtime/mcp/connection.js +449 -0
- package/dist/runtime/mcp/index.d.ts +9 -0
- package/dist/runtime/mcp/index.js +9 -0
- package/dist/runtime/mcp/list.d.ts +50 -0
- package/dist/runtime/mcp/list.js +65 -0
- package/dist/runtime/mcp/stdio-transport.d.ts +23 -0
- package/dist/runtime/mcp/stdio-transport.js +71 -0
- package/dist/runtime/mcp/types.d.ts +85 -0
- package/dist/runtime/mcp/types.js +6 -0
- package/dist/runtime/sandbox/executor.d.ts +102 -0
- package/dist/runtime/sandbox/executor.js +537 -0
- package/dist/runtime/sandbox/index.d.ts +9 -0
- package/dist/runtime/sandbox/index.js +9 -0
- package/dist/runtime/sandbox/io-monitor.d.ts +78 -0
- package/dist/runtime/sandbox/io-monitor.js +98 -0
- package/dist/runtime/sandbox/time-parser.d.ts +19 -0
- package/dist/runtime/sandbox/time-parser.js +67 -0
- package/dist/runtime/sandbox/types.d.ts +58 -0
- package/dist/runtime/sandbox/types.js +23 -0
- package/dist/runtime/test/behavior-observer.d.ts +61 -0
- package/dist/runtime/test/behavior-observer.js +140 -0
- package/dist/runtime/test/contract-loader.d.ts +41 -0
- package/dist/runtime/test/contract-loader.js +158 -0
- package/dist/runtime/test/contract-schema.d.ts +46 -0
- package/dist/runtime/test/contract-schema.js +107 -0
- package/dist/runtime/test/contract-types.d.ts +106 -0
- package/dist/runtime/test/contract-types.js +6 -0
- package/dist/runtime/test/dependency-tracker.d.ts +66 -0
- package/dist/runtime/test/dependency-tracker.js +80 -0
- package/dist/runtime/test/formatters.d.ts +18 -0
- package/dist/runtime/test/formatters.js +172 -0
- package/dist/runtime/test/index.d.ts +12 -0
- package/dist/runtime/test/index.js +13 -0
- package/dist/runtime/test/input-generator.d.ts +33 -0
- package/dist/runtime/test/input-generator.js +498 -0
- package/dist/runtime/test/mcp-root-detector.d.ts +31 -0
- package/dist/runtime/test/mcp-root-detector.js +105 -0
- package/dist/runtime/test/orchestrator.d.ts +131 -0
- package/dist/runtime/test/orchestrator.js +738 -0
- package/dist/runtime/test/output-validator.d.ts +44 -0
- package/dist/runtime/test/output-validator.js +262 -0
- package/dist/runtime/test/retry-tester.d.ts +44 -0
- package/dist/runtime/test/retry-tester.js +103 -0
- package/dist/runtime/test/runner.d.ts +28 -0
- package/dist/runtime/test/runner.js +55 -0
- package/dist/runtime/test/synthetic-input-generator.d.ts +11 -0
- package/dist/runtime/test/synthetic-input-generator.js +154 -0
- package/dist/runtime/test/test-runner.d.ts +28 -0
- package/dist/runtime/test/test-runner.js +55 -0
- package/dist/types/factories.d.ts +16 -0
- package/dist/types/factories.js +43 -0
- package/dist/types/ids.d.ts +16 -0
- package/dist/types/ids.js +2 -0
- package/dist/types/opaque.d.ts +4 -0
- package/dist/types/opaque.js +2 -0
- package/dist/utils/errors.d.ts +92 -0
- package/dist/utils/errors.js +97 -0
- package/dist/utils/gitignore.d.ts +11 -0
- package/dist/utils/gitignore.js +59 -0
- package/dist/utils/json-file-saver.d.ts +17 -0
- package/dist/utils/json-file-saver.js +81 -0
- package/dist/utils/json-formatter.d.ts +63 -0
- package/dist/utils/json-formatter.js +344 -0
- package/dist/utils/logger.d.ts +184 -0
- package/dist/utils/logger.js +330 -0
- package/dist/utils/package-manager.d.ts +30 -0
- package/dist/utils/package-manager.js +157 -0
- package/dist/utils/version-checker.d.ts +47 -0
- package/dist/utils/version-checker.js +167 -0
- package/dist/utils/version-display.d.ts +10 -0
- package/dist/utils/version-display.js +20 -0
- package/package.json +106 -0
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Command error handling utilities.
|
|
3
|
+
* Provides consistent error handling patterns for CLI commands.
|
|
4
|
+
*/
|
|
5
|
+
import { logger, log } from '../../utils/logger.js';
|
|
6
|
+
import { ConfigurationError, normalizeError, getErrorMessage, } from '../../utils/errors.js';
|
|
7
|
+
import { Messages } from '../../constants/index.js';
|
|
8
|
+
/**
|
|
9
|
+
* Handle and display command errors with consistent formatting.
|
|
10
|
+
* This ensures all commands have uniform error handling.
|
|
11
|
+
*
|
|
12
|
+
* @param error - The error to handle
|
|
13
|
+
* @param defaultMessage - Default error message if error is not an Error instance
|
|
14
|
+
* @returns Never returns (always exits process)
|
|
15
|
+
*/
|
|
16
|
+
export function handleCommandError(error, defaultMessage = Messages.ERROR_UNEXPECTED) {
|
|
17
|
+
if (error instanceof ConfigurationError) {
|
|
18
|
+
// For user-facing errors, don't show verbose structured logs
|
|
19
|
+
// The structured logger will only output in debug mode (set via setLevel)
|
|
20
|
+
// For now, we skip structured logging for user-facing errors to keep output clean
|
|
21
|
+
log.blank();
|
|
22
|
+
log.error(error.message);
|
|
23
|
+
log.blank();
|
|
24
|
+
process.exit(1);
|
|
25
|
+
}
|
|
26
|
+
const err = normalizeError(error);
|
|
27
|
+
// Only log to structured logger (won't output unless debug mode is enabled)
|
|
28
|
+
logger.error('Command failed', err);
|
|
29
|
+
const message = getErrorMessage(error) || defaultMessage;
|
|
30
|
+
log.blank();
|
|
31
|
+
log.error(message);
|
|
32
|
+
log.blank();
|
|
33
|
+
process.exit(1);
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=command-error-handler.js.map
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Common types and interfaces shared across CLI commands.
|
|
3
|
+
* This centralizes common option interfaces to avoid duplication.
|
|
4
|
+
*/
|
|
5
|
+
import type { TransportType } from '../../config/types.js';
|
|
6
|
+
/**
|
|
7
|
+
* Common transport-related options used by multiple commands.
|
|
8
|
+
* Commands that need transport configuration should extend this interface.
|
|
9
|
+
*/
|
|
10
|
+
export interface TransportCommandOptions {
|
|
11
|
+
/** Transport type override */
|
|
12
|
+
transport?: TransportType;
|
|
13
|
+
/** MCP server URL (for HTTP transport) */
|
|
14
|
+
url?: string;
|
|
15
|
+
/** Command/script to run (for stdio transport) */
|
|
16
|
+
script?: string;
|
|
17
|
+
/** Project root directory */
|
|
18
|
+
projectRoot?: string;
|
|
19
|
+
/** Environment variables to pass to MCP server (for stdio transport) */
|
|
20
|
+
env?: Record<string, string>;
|
|
21
|
+
/** Authentication headers (for HTTP transport) */
|
|
22
|
+
authHeaders?: Record<string, string>;
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=common-types.d.ts.map
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Connection handling utilities.
|
|
3
|
+
* Provides shared logic for establishing MCP connections with consistent error handling.
|
|
4
|
+
*/
|
|
5
|
+
import type { TransportType } from '../../config/types.js';
|
|
6
|
+
import type { Client } from '@modelcontextprotocol/sdk/client/index.js';
|
|
7
|
+
import type { StreamableHTTPClientTransport } from '@modelcontextprotocol/sdk/client/streamableHttp.js';
|
|
8
|
+
import type { StdioClientTransport } from '@modelcontextprotocol/sdk/client/stdio.js';
|
|
9
|
+
export interface ConnectionResult {
|
|
10
|
+
client: Client;
|
|
11
|
+
transport: StreamableHTTPClientTransport | StdioClientTransport;
|
|
12
|
+
}
|
|
13
|
+
export interface ConnectionOptions {
|
|
14
|
+
transport: TransportType;
|
|
15
|
+
url?: string;
|
|
16
|
+
script?: string;
|
|
17
|
+
urlSource?: 'config' | 'cli';
|
|
18
|
+
env?: Record<string, string>;
|
|
19
|
+
authHeaders?: Record<string, string>;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Establish an MCP connection with proper error handling.
|
|
23
|
+
* This centralizes connection logic and error handling for all commands.
|
|
24
|
+
*
|
|
25
|
+
* @param options - Connection options including transport type and connection details
|
|
26
|
+
* @returns Connected client and transport instances
|
|
27
|
+
* @throws ConfigurationError with helpful error messages for common connection failures
|
|
28
|
+
*/
|
|
29
|
+
export declare function establishConnection(options: ConnectionOptions): Promise<ConnectionResult>;
|
|
30
|
+
/**
|
|
31
|
+
* Safely close a connection, handling any errors gracefully.
|
|
32
|
+
* This ensures connections are always cleaned up even if errors occur.
|
|
33
|
+
*
|
|
34
|
+
* @param transport - The transport to close (may be undefined)
|
|
35
|
+
*/
|
|
36
|
+
export declare function safeCloseConnection(transport: StreamableHTTPClientTransport | StdioClientTransport | undefined): Promise<void>;
|
|
37
|
+
//# sourceMappingURL=connection-handler.d.ts.map
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Connection handling utilities.
|
|
3
|
+
* Provides shared logic for establishing MCP connections with consistent error handling.
|
|
4
|
+
*/
|
|
5
|
+
import { getConnectedClient, getConnectedStdioClient, closeConnection, } from '../../runtime/mcp/index.js';
|
|
6
|
+
import { ConfigurationError } from '../../utils/errors.js';
|
|
7
|
+
import { Messages, TransportTypes } from '../../constants/index.js';
|
|
8
|
+
/**
|
|
9
|
+
* Establish an MCP connection with proper error handling.
|
|
10
|
+
* This centralizes connection logic and error handling for all commands.
|
|
11
|
+
*
|
|
12
|
+
* @param options - Connection options including transport type and connection details
|
|
13
|
+
* @returns Connected client and transport instances
|
|
14
|
+
* @throws ConfigurationError with helpful error messages for common connection failures
|
|
15
|
+
*/
|
|
16
|
+
export async function establishConnection(options) {
|
|
17
|
+
const { transport, url, script, urlSource, env, authHeaders } = options;
|
|
18
|
+
try {
|
|
19
|
+
if (transport === TransportTypes.HTTP) {
|
|
20
|
+
if (!url) {
|
|
21
|
+
throw new ConfigurationError(Messages.TRANSPORT_URL_REQUIRED);
|
|
22
|
+
}
|
|
23
|
+
const connection = await getConnectedClient(url, authHeaders);
|
|
24
|
+
return {
|
|
25
|
+
client: connection.client,
|
|
26
|
+
transport: connection.transport,
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
else {
|
|
30
|
+
if (!script) {
|
|
31
|
+
throw new ConfigurationError(Messages.TRANSPORT_SCRIPT_REQUIRED);
|
|
32
|
+
}
|
|
33
|
+
const connection = await getConnectedStdioClient(script, env);
|
|
34
|
+
return {
|
|
35
|
+
client: connection.client,
|
|
36
|
+
transport: connection.transport,
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
catch (connectionError) {
|
|
41
|
+
// Provide helpful error messages for connection failures
|
|
42
|
+
const errorMessage = connectionError instanceof Error
|
|
43
|
+
? connectionError.message
|
|
44
|
+
: String(connectionError);
|
|
45
|
+
if (transport === TransportTypes.HTTP) {
|
|
46
|
+
// Check for common HTTP connection errors
|
|
47
|
+
if (errorMessage.includes('fetch failed') ||
|
|
48
|
+
errorMessage.includes('ECONNREFUSED') ||
|
|
49
|
+
errorMessage.includes('NetworkError') ||
|
|
50
|
+
errorMessage.includes('ENOTFOUND')) {
|
|
51
|
+
const configSource = urlSource === 'config'
|
|
52
|
+
? Messages.LIST_SOURCE_CONFIG
|
|
53
|
+
: Messages.LIST_SOURCE_CLI_URL;
|
|
54
|
+
throw new ConfigurationError(Messages.CONNECTION_FAILED(url || '', configSource, 'http'));
|
|
55
|
+
}
|
|
56
|
+
else if (errorMessage.includes('timeout')) {
|
|
57
|
+
throw new ConfigurationError(Messages.CONNECTION_TIMEOUT_HTTP(url || ''));
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
else {
|
|
61
|
+
// stdio transport errors
|
|
62
|
+
if (errorMessage.includes('spawn') || errorMessage.includes('ENOENT')) {
|
|
63
|
+
throw new ConfigurationError(Messages.CONNECTION_FAILED_STDIO(script || ''));
|
|
64
|
+
}
|
|
65
|
+
else if (errorMessage.includes('timeout')) {
|
|
66
|
+
throw new ConfigurationError(Messages.CONNECTION_TIMEOUT_STDIO);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
// Re-throw if we don't have a specific handler
|
|
70
|
+
throw connectionError;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Safely close a connection, handling any errors gracefully.
|
|
75
|
+
* This ensures connections are always cleaned up even if errors occur.
|
|
76
|
+
*
|
|
77
|
+
* @param transport - The transport to close (may be undefined)
|
|
78
|
+
*/
|
|
79
|
+
export async function safeCloseConnection(transport) {
|
|
80
|
+
if (transport) {
|
|
81
|
+
try {
|
|
82
|
+
await closeConnection(transport);
|
|
83
|
+
}
|
|
84
|
+
catch {
|
|
85
|
+
// Log but don't throw - cleanup errors shouldn't fail the command
|
|
86
|
+
// The structured logger will capture this if needed
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
//# sourceMappingURL=connection-handler.js.map
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CLI utilities exports.
|
|
3
|
+
*/
|
|
4
|
+
export * from './command-error-handler.js';
|
|
5
|
+
export * from './common-types.js';
|
|
6
|
+
export * from './connection-handler.js';
|
|
7
|
+
export * from './option-parsers.js';
|
|
8
|
+
export * from './output-utils.js';
|
|
9
|
+
export * from './transport-resolver.js';
|
|
10
|
+
export * from './version-banner.js';
|
|
11
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CLI utilities exports.
|
|
3
|
+
*/
|
|
4
|
+
export * from './command-error-handler.js';
|
|
5
|
+
export * from './common-types.js';
|
|
6
|
+
export * from './connection-handler.js';
|
|
7
|
+
export * from './option-parsers.js';
|
|
8
|
+
export * from './output-utils.js';
|
|
9
|
+
export * from './transport-resolver.js';
|
|
10
|
+
export * from './version-banner.js';
|
|
11
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CLI option parsing utilities.
|
|
3
|
+
* Provides functions to parse complex CLI options like env vars and headers.
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Parse environment variable option from CLI.
|
|
7
|
+
* Supports format: KEY=value or KEY (uses process.env[KEY])
|
|
8
|
+
*
|
|
9
|
+
* @param envOption - Environment variable string in format "KEY=value" or "KEY"
|
|
10
|
+
* @returns Parsed key-value pair
|
|
11
|
+
*/
|
|
12
|
+
export declare function parseEnvOption(envOption: string): {
|
|
13
|
+
key: string;
|
|
14
|
+
value: string;
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* Parse multiple environment variable options.
|
|
18
|
+
*
|
|
19
|
+
* @param envOptions - Array of environment variable strings
|
|
20
|
+
* @returns Record of key-value pairs
|
|
21
|
+
*/
|
|
22
|
+
export declare function parseEnvOptions(envOptions: string[] | undefined): Record<string, string>;
|
|
23
|
+
/**
|
|
24
|
+
* Parse authentication header option from CLI.
|
|
25
|
+
* Supports format: "Header: Value" or "Header=Value"
|
|
26
|
+
*
|
|
27
|
+
* @param headerOption - Header string in format "Header: Value" or "Header=Value"
|
|
28
|
+
* @returns Parsed key-value pair
|
|
29
|
+
*/
|
|
30
|
+
export declare function parseAuthHeaderOption(headerOption: string): {
|
|
31
|
+
key: string;
|
|
32
|
+
value: string;
|
|
33
|
+
};
|
|
34
|
+
/**
|
|
35
|
+
* Parse multiple authentication header options.
|
|
36
|
+
*
|
|
37
|
+
* @param headerOptions - Array of header strings
|
|
38
|
+
* @returns Record of header key-value pairs
|
|
39
|
+
*/
|
|
40
|
+
export declare function parseAuthHeaderOptions(headerOptions: string[] | undefined): Record<string, string>;
|
|
41
|
+
//# sourceMappingURL=option-parsers.d.ts.map
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CLI option parsing utilities.
|
|
3
|
+
* Provides functions to parse complex CLI options like env vars and headers.
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Parse environment variable option from CLI.
|
|
7
|
+
* Supports format: KEY=value or KEY (uses process.env[KEY])
|
|
8
|
+
*
|
|
9
|
+
* @param envOption - Environment variable string in format "KEY=value" or "KEY"
|
|
10
|
+
* @returns Parsed key-value pair
|
|
11
|
+
*/
|
|
12
|
+
export function parseEnvOption(envOption) {
|
|
13
|
+
const equalIndex = envOption.indexOf('=');
|
|
14
|
+
if (equalIndex === -1) {
|
|
15
|
+
// No = sign, treat as env var name and get from process.env
|
|
16
|
+
const key = envOption.trim();
|
|
17
|
+
const value = process.env[key] || '';
|
|
18
|
+
return { key, value };
|
|
19
|
+
}
|
|
20
|
+
const key = envOption.slice(0, equalIndex).trim();
|
|
21
|
+
const value = envOption.slice(equalIndex + 1).trim();
|
|
22
|
+
return { key, value };
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Parse multiple environment variable options.
|
|
26
|
+
*
|
|
27
|
+
* @param envOptions - Array of environment variable strings
|
|
28
|
+
* @returns Record of key-value pairs
|
|
29
|
+
*/
|
|
30
|
+
export function parseEnvOptions(envOptions) {
|
|
31
|
+
if (!envOptions || envOptions.length === 0) {
|
|
32
|
+
return {};
|
|
33
|
+
}
|
|
34
|
+
const env = {};
|
|
35
|
+
for (const option of envOptions) {
|
|
36
|
+
const { key, value } = parseEnvOption(option);
|
|
37
|
+
if (key) {
|
|
38
|
+
env[key] = value;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
return env;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Parse authentication header option from CLI.
|
|
45
|
+
* Supports format: "Header: Value" or "Header=Value"
|
|
46
|
+
*
|
|
47
|
+
* @param headerOption - Header string in format "Header: Value" or "Header=Value"
|
|
48
|
+
* @returns Parsed key-value pair
|
|
49
|
+
*/
|
|
50
|
+
export function parseAuthHeaderOption(headerOption) {
|
|
51
|
+
// Try "Header: Value" format first
|
|
52
|
+
const colonIndex = headerOption.indexOf(':');
|
|
53
|
+
if (colonIndex !== -1) {
|
|
54
|
+
const key = headerOption.slice(0, colonIndex).trim();
|
|
55
|
+
const value = headerOption.slice(colonIndex + 1).trim();
|
|
56
|
+
return { key, value };
|
|
57
|
+
}
|
|
58
|
+
// Try "Header=Value" format
|
|
59
|
+
const equalIndex = headerOption.indexOf('=');
|
|
60
|
+
if (equalIndex !== -1) {
|
|
61
|
+
const key = headerOption.slice(0, equalIndex).trim();
|
|
62
|
+
const value = headerOption.slice(equalIndex + 1).trim();
|
|
63
|
+
return { key, value };
|
|
64
|
+
}
|
|
65
|
+
// If no separator and not empty, treat as Bearer token
|
|
66
|
+
const trimmed = headerOption.trim();
|
|
67
|
+
if (!trimmed) {
|
|
68
|
+
return { key: '', value: '' };
|
|
69
|
+
}
|
|
70
|
+
return { key: 'Authorization', value: `Bearer ${trimmed}` };
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Parse multiple authentication header options.
|
|
74
|
+
*
|
|
75
|
+
* @param headerOptions - Array of header strings
|
|
76
|
+
* @returns Record of header key-value pairs
|
|
77
|
+
*/
|
|
78
|
+
export function parseAuthHeaderOptions(headerOptions) {
|
|
79
|
+
if (!headerOptions || headerOptions.length === 0) {
|
|
80
|
+
return {};
|
|
81
|
+
}
|
|
82
|
+
const headers = {};
|
|
83
|
+
for (const option of headerOptions) {
|
|
84
|
+
const { key, value } = parseAuthHeaderOption(option);
|
|
85
|
+
// Skip entries without both key and value
|
|
86
|
+
if (key && value && value.trim()) {
|
|
87
|
+
headers[key] = value;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
return headers;
|
|
91
|
+
}
|
|
92
|
+
//# sourceMappingURL=option-parsers.js.map
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Output utility functions for CLI commands.
|
|
3
|
+
* Provides shared utilities for output handling and formatting.
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Flush stdout to ensure all output is written before process exit.
|
|
7
|
+
* This is useful for commands that exit immediately after output.
|
|
8
|
+
*
|
|
9
|
+
* @returns Promise that resolves when output is flushed
|
|
10
|
+
*/
|
|
11
|
+
export declare function flushOutput(): Promise<void>;
|
|
12
|
+
//# sourceMappingURL=output-utils.d.ts.map
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Output utility functions for CLI commands.
|
|
3
|
+
* Provides shared utilities for output handling and formatting.
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Flush stdout to ensure all output is written before process exit.
|
|
7
|
+
* This is useful for commands that exit immediately after output.
|
|
8
|
+
*
|
|
9
|
+
* @returns Promise that resolves when output is flushed
|
|
10
|
+
*/
|
|
11
|
+
export async function flushOutput() {
|
|
12
|
+
return new Promise(resolve => {
|
|
13
|
+
if (process.stdout.writable) {
|
|
14
|
+
process.stdout.write('', () => resolve());
|
|
15
|
+
}
|
|
16
|
+
else {
|
|
17
|
+
resolve();
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=output-utils.js.map
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Transport configuration resolution utilities.
|
|
3
|
+
* Provides functions to resolve transport, URL, and script options from config and command options.
|
|
4
|
+
*/
|
|
5
|
+
import type { TransportType, SyrinConfig } from '../../config/types.js';
|
|
6
|
+
export interface TransportOptions {
|
|
7
|
+
transport?: TransportType;
|
|
8
|
+
url?: string;
|
|
9
|
+
script?: string;
|
|
10
|
+
projectRoot?: string;
|
|
11
|
+
env?: Record<string, string>;
|
|
12
|
+
authHeaders?: Record<string, string>;
|
|
13
|
+
}
|
|
14
|
+
export interface ResolvedTransportConfig {
|
|
15
|
+
transport: TransportType;
|
|
16
|
+
url?: string;
|
|
17
|
+
script?: string;
|
|
18
|
+
config: SyrinConfig;
|
|
19
|
+
urlSource?: 'config' | 'cli';
|
|
20
|
+
scriptSource?: 'config' | 'cli';
|
|
21
|
+
env?: Record<string, string>;
|
|
22
|
+
authHeaders?: Record<string, string>;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Resolve transport configuration from command options and config file.
|
|
26
|
+
* This centralizes the logic for determining transport type, URL, and script.
|
|
27
|
+
*
|
|
28
|
+
* @param options - Command options containing transport, url, script, and projectRoot
|
|
29
|
+
* @returns Resolved transport configuration
|
|
30
|
+
* @throws ConfigurationError if required parameters are missing
|
|
31
|
+
*/
|
|
32
|
+
export declare function resolveTransportConfig(options: TransportOptions): ResolvedTransportConfig;
|
|
33
|
+
//# sourceMappingURL=transport-resolver.d.ts.map
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Transport configuration resolution utilities.
|
|
3
|
+
* Provides functions to resolve transport, URL, and script options from config and command options.
|
|
4
|
+
*/
|
|
5
|
+
import { loadConfig } from '../../config/loader.js';
|
|
6
|
+
import { ConfigurationError } from '../../utils/errors.js';
|
|
7
|
+
import { Messages, TransportTypes } from '../../constants/index.js';
|
|
8
|
+
/**
|
|
9
|
+
* Resolve transport configuration from command options and config file.
|
|
10
|
+
* This centralizes the logic for determining transport type, URL, and script.
|
|
11
|
+
*
|
|
12
|
+
* @param options - Command options containing transport, url, script, and projectRoot
|
|
13
|
+
* @returns Resolved transport configuration
|
|
14
|
+
* @throws ConfigurationError if required parameters are missing
|
|
15
|
+
*/
|
|
16
|
+
export function resolveTransportConfig(options) {
|
|
17
|
+
const { transport, url, script, projectRoot } = options;
|
|
18
|
+
// Load config to get default values
|
|
19
|
+
const config = loadConfig(projectRoot);
|
|
20
|
+
// Determine transport type
|
|
21
|
+
// If --script is provided, force stdio transport
|
|
22
|
+
// If --url is provided, force http transport
|
|
23
|
+
// Otherwise use explicit transport option or config default
|
|
24
|
+
let transportType;
|
|
25
|
+
if (script) {
|
|
26
|
+
transportType = TransportTypes.STDIO;
|
|
27
|
+
}
|
|
28
|
+
else if (url) {
|
|
29
|
+
transportType = TransportTypes.HTTP;
|
|
30
|
+
}
|
|
31
|
+
else {
|
|
32
|
+
transportType = transport || config.transport;
|
|
33
|
+
}
|
|
34
|
+
let mcpUrl;
|
|
35
|
+
let mcpScript;
|
|
36
|
+
let urlSource;
|
|
37
|
+
let scriptSource;
|
|
38
|
+
if (transportType === TransportTypes.HTTP) {
|
|
39
|
+
// Use provided URL or fall back to config
|
|
40
|
+
if (url) {
|
|
41
|
+
mcpUrl = url;
|
|
42
|
+
urlSource = 'cli';
|
|
43
|
+
}
|
|
44
|
+
else {
|
|
45
|
+
mcpUrl = config.mcp_url;
|
|
46
|
+
if (mcpUrl) {
|
|
47
|
+
urlSource = 'config';
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
else {
|
|
52
|
+
// Use provided script or fall back to config.script
|
|
53
|
+
if (script) {
|
|
54
|
+
mcpScript = script;
|
|
55
|
+
scriptSource = 'cli';
|
|
56
|
+
}
|
|
57
|
+
else {
|
|
58
|
+
mcpScript = config.script ? String(config.script) : undefined;
|
|
59
|
+
if (mcpScript) {
|
|
60
|
+
scriptSource = 'config';
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
// Validate required parameters
|
|
65
|
+
if (transportType === TransportTypes.HTTP && !mcpUrl) {
|
|
66
|
+
throw new ConfigurationError(Messages.TRANSPORT_URL_REQUIRED);
|
|
67
|
+
}
|
|
68
|
+
if (transportType === TransportTypes.STDIO && !mcpScript) {
|
|
69
|
+
throw new ConfigurationError(Messages.TRANSPORT_SCRIPT_REQUIRED);
|
|
70
|
+
}
|
|
71
|
+
return {
|
|
72
|
+
transport: transportType,
|
|
73
|
+
url: mcpUrl,
|
|
74
|
+
script: mcpScript,
|
|
75
|
+
config,
|
|
76
|
+
urlSource,
|
|
77
|
+
scriptSource,
|
|
78
|
+
env: options.env,
|
|
79
|
+
authHeaders: options.authHeaders,
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
//# sourceMappingURL=transport-resolver.js.map
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Version banner utility for CLI commands.
|
|
3
|
+
* Displays version information at the start of commands.
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Display version banner for a command.
|
|
7
|
+
* Shows version with update information.
|
|
8
|
+
*/
|
|
9
|
+
export declare function showVersionBanner(): Promise<void>;
|
|
10
|
+
//# sourceMappingURL=version-banner.d.ts.map
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Version banner utility for CLI commands.
|
|
3
|
+
* Displays version information at the start of commands.
|
|
4
|
+
*/
|
|
5
|
+
import { getVersionDisplayString } from '../../utils/version-display.js';
|
|
6
|
+
import { log } from '../../utils/logger.js';
|
|
7
|
+
/**
|
|
8
|
+
* Display version banner for a command.
|
|
9
|
+
* Shows version with update information.
|
|
10
|
+
*/
|
|
11
|
+
export async function showVersionBanner() {
|
|
12
|
+
try {
|
|
13
|
+
const versionString = await getVersionDisplayString();
|
|
14
|
+
log.label(`Syrin ${versionString}`);
|
|
15
|
+
log.blank();
|
|
16
|
+
}
|
|
17
|
+
catch {
|
|
18
|
+
// If version check fails, just show current version
|
|
19
|
+
// This should rarely happen, but we don't want to break commands
|
|
20
|
+
const { getCurrentVersion } = await import('../../utils/version-checker.js');
|
|
21
|
+
const currentVersion = getCurrentVersion();
|
|
22
|
+
log.label(`Syrin v${currentVersion}`);
|
|
23
|
+
log.blank();
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=version-banner.js.map
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Environment variable checker.
|
|
3
|
+
* Validates that required environment variables are set.
|
|
4
|
+
*/
|
|
5
|
+
export interface EnvCheckResult {
|
|
6
|
+
/** Whether the environment variable is set */
|
|
7
|
+
isSet: boolean;
|
|
8
|
+
/** The value of the environment variable (if set) */
|
|
9
|
+
value?: string;
|
|
10
|
+
/** Whether .env file exists */
|
|
11
|
+
envFileExists: boolean;
|
|
12
|
+
/** Whether the key exists in .env file */
|
|
13
|
+
keyExistsInEnvFile?: boolean;
|
|
14
|
+
/** Error message explaining why the variable is not set */
|
|
15
|
+
errorMessage?: string;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Check if an environment variable is set.
|
|
19
|
+
* Checks both process.env and .env file, providing detailed error messages.
|
|
20
|
+
* @param varName - Name of the environment variable
|
|
21
|
+
* @param projectRoot - Root directory of the project
|
|
22
|
+
* @returns Check result with detailed error information
|
|
23
|
+
*/
|
|
24
|
+
export declare function checkEnvVar(varName: string, projectRoot?: string): EnvCheckResult;
|
|
25
|
+
/**
|
|
26
|
+
* Check if a command exists and is executable.
|
|
27
|
+
* @param command - Command to check (e.g., "python3", "node")
|
|
28
|
+
* @returns true if command exists
|
|
29
|
+
*/
|
|
30
|
+
export declare function checkCommandExists(command: string): boolean;
|
|
31
|
+
/**
|
|
32
|
+
* Extract command name from a script string.
|
|
33
|
+
* @param script - Script command (e.g., "python3 server.py")
|
|
34
|
+
* @returns Command name (e.g., "python3")
|
|
35
|
+
*/
|
|
36
|
+
export declare function extractCommandName(script: string): string;
|
|
37
|
+
//# sourceMappingURL=env-checker.d.ts.map
|