@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,342 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CLI entry point for Syrin.
|
|
3
|
+
* Sets up command parsing and routes to command handlers.
|
|
4
|
+
*/
|
|
5
|
+
import { Command } from 'commander';
|
|
6
|
+
import { executeInit } from '../cli/commands/init.js';
|
|
7
|
+
import { executeDoctor } from '../cli/commands/doctor.js';
|
|
8
|
+
import { executeTest } from '../cli/commands/test.js';
|
|
9
|
+
import { executeList } from '../cli/commands/list.js';
|
|
10
|
+
import { executeAnalyse } from '../cli/commands/analyse.js';
|
|
11
|
+
import { executeDev } from '../cli/commands/dev.js';
|
|
12
|
+
import { executeUpdate } from '../cli/commands/update.js';
|
|
13
|
+
import { executeRollback } from '../cli/commands/rollback.js';
|
|
14
|
+
import { logger, log } from '../utils/logger.js';
|
|
15
|
+
import { Messages, ListTypes } from '../constants/index.js';
|
|
16
|
+
import { getCurrentVersion } from '../utils/version-checker.js';
|
|
17
|
+
/**
|
|
18
|
+
* Report analyse command error with consolidated logging.
|
|
19
|
+
* Logs full error to internal logger and concise message to user.
|
|
20
|
+
*/
|
|
21
|
+
function reportAnalyseError(error) {
|
|
22
|
+
logger.error('Analyse command failed', error);
|
|
23
|
+
log.error(`Analyse command failed: ${error.message}`);
|
|
24
|
+
}
|
|
25
|
+
const program = new Command();
|
|
26
|
+
/**
|
|
27
|
+
* Initialize the CLI program.
|
|
28
|
+
*/
|
|
29
|
+
export function setupCLI() {
|
|
30
|
+
// Get current version
|
|
31
|
+
const currentVersion = getCurrentVersion();
|
|
32
|
+
program
|
|
33
|
+
.name('syrin')
|
|
34
|
+
.description('Syrin - Runtime intelligence system for MCP servers')
|
|
35
|
+
.version(currentVersion, '-v, --version', 'Display version number');
|
|
36
|
+
// init command
|
|
37
|
+
program
|
|
38
|
+
.command('init')
|
|
39
|
+
.description('Initialize a new Syrin project')
|
|
40
|
+
.option('-y, --yes', 'Skip interactive prompts and use default values')
|
|
41
|
+
.option('--project-root <path>', 'Project root directory (defaults to current directory)')
|
|
42
|
+
.action(async (options) => {
|
|
43
|
+
try {
|
|
44
|
+
await executeInit({
|
|
45
|
+
yes: options.yes || false,
|
|
46
|
+
projectRoot: options.projectRoot,
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
catch (error) {
|
|
50
|
+
// Handle ALREADY_INITIALIZED case first with early return
|
|
51
|
+
if (error instanceof Error && error.message === 'ALREADY_INITIALIZED') {
|
|
52
|
+
// Already handled in executeInit, just exit
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
// Handle other Error cases
|
|
56
|
+
if (error instanceof Error) {
|
|
57
|
+
logger.error('Init command failed', error);
|
|
58
|
+
log.blank();
|
|
59
|
+
log.error(`Error: ${error.message}`);
|
|
60
|
+
log.blank();
|
|
61
|
+
process.exit(1);
|
|
62
|
+
}
|
|
63
|
+
// Re-throw non-Error values
|
|
64
|
+
throw error;
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
|
+
// doctor command
|
|
68
|
+
program
|
|
69
|
+
.command('doctor')
|
|
70
|
+
.description('Validate Syrin project configuration and setup')
|
|
71
|
+
.option('--project-root <path>', 'Project root directory (defaults to current directory)')
|
|
72
|
+
.action(async (options) => {
|
|
73
|
+
try {
|
|
74
|
+
await executeDoctor(options.projectRoot);
|
|
75
|
+
}
|
|
76
|
+
catch (error) {
|
|
77
|
+
// Error handling is done in executeDoctor, this is a safety net
|
|
78
|
+
if (error instanceof Error) {
|
|
79
|
+
logger.error('Doctor command failed', error);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
});
|
|
83
|
+
// test command
|
|
84
|
+
program
|
|
85
|
+
.command('test')
|
|
86
|
+
.description('Validate tool contracts (default) or test MCP connection (--connection)')
|
|
87
|
+
.argument('[url-or-script]', 'MCP URL (for http transport) or script (for stdio transport). Only used with --connection flag')
|
|
88
|
+
.option('--connection', 'Test MCP connection only (legacy behavior). Without this flag, validates tool contracts.')
|
|
89
|
+
.option('--tool <name>', 'Test specific tool only (for tool validation mode)')
|
|
90
|
+
.option('--path <path>', 'Test all tools in a specific path (relative to tools directory, e.g., "weather" or "server")')
|
|
91
|
+
.option('--strict', 'Treat warnings as errors')
|
|
92
|
+
.option('--json', 'Output results as JSON')
|
|
93
|
+
.option('--ci', 'CI mode: minimal output, exit code 1 on errors')
|
|
94
|
+
.option('--show-errors', 'Show sandbox process error output (stderr from MCP server)')
|
|
95
|
+
.option('--tools-dir <path>', 'Tools directory (overrides config, default: tools)')
|
|
96
|
+
.option('--transport <type>', 'Transport type (http or stdio). Only used with --connection flag')
|
|
97
|
+
.option('--url <url>', 'MCP URL to test (for http transport). Only used with --connection flag')
|
|
98
|
+
.option('--script <script>', 'Script to test (for stdio transport). Only used with --connection flag')
|
|
99
|
+
.option('--project-root <path>', 'Project root directory (defaults to current directory)')
|
|
100
|
+
.option('--env <key=value>', 'Environment variable to pass to MCP server (for stdio transport). Can be specified multiple times. Format: KEY=value or KEY (uses process.env[KEY])', (value, previous = []) => {
|
|
101
|
+
previous.push(value);
|
|
102
|
+
return previous;
|
|
103
|
+
})
|
|
104
|
+
.option('--auth-header <header>', 'Authentication header (for HTTP transport). Can be specified multiple times. Format: "Header: Value" or "Header=Value" or token (treated as Bearer token)', (value, previous = []) => {
|
|
105
|
+
previous.push(value);
|
|
106
|
+
return previous;
|
|
107
|
+
})
|
|
108
|
+
.action(async (urlOrScript, options) => {
|
|
109
|
+
try {
|
|
110
|
+
const { parseEnvOptions, parseAuthHeaderOptions } = await import('../cli/utils/option-parsers.js');
|
|
111
|
+
// If --connection flag, use legacy connection testing
|
|
112
|
+
if (options.connection) {
|
|
113
|
+
// Check for conflicting options that will be ignored
|
|
114
|
+
const ignoredOptions = [];
|
|
115
|
+
if (options.tool)
|
|
116
|
+
ignoredOptions.push('--tool');
|
|
117
|
+
if (options.strict)
|
|
118
|
+
ignoredOptions.push('--strict');
|
|
119
|
+
if (options.toolsDir)
|
|
120
|
+
ignoredOptions.push('--tools-dir');
|
|
121
|
+
if (ignoredOptions.length > 0) {
|
|
122
|
+
console.warn(`Warning: The following options are ignored when using --connection mode: ${ignoredOptions.join(', ')}`);
|
|
123
|
+
}
|
|
124
|
+
// Determine if positional argument is URL or script based on transport
|
|
125
|
+
let finalUrl = options.url;
|
|
126
|
+
let finalScript = options.script;
|
|
127
|
+
if (urlOrScript) {
|
|
128
|
+
const transport = options.transport;
|
|
129
|
+
if (transport === 'http' ||
|
|
130
|
+
(!transport && urlOrScript.startsWith('http'))) {
|
|
131
|
+
finalUrl = urlOrScript;
|
|
132
|
+
}
|
|
133
|
+
else {
|
|
134
|
+
finalScript = urlOrScript;
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
await executeTest({
|
|
138
|
+
connection: true,
|
|
139
|
+
transport: options.transport,
|
|
140
|
+
url: finalUrl,
|
|
141
|
+
script: finalScript,
|
|
142
|
+
projectRoot: options.projectRoot,
|
|
143
|
+
env: parseEnvOptions(options.env),
|
|
144
|
+
authHeaders: parseAuthHeaderOptions(options.authHeader),
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
else {
|
|
148
|
+
// Tool validation mode - check for unused connection-related options
|
|
149
|
+
const unusedOptions = [];
|
|
150
|
+
if (urlOrScript)
|
|
151
|
+
unusedOptions.push('positional URL/script argument');
|
|
152
|
+
if (options.transport && !options.url && !options.script)
|
|
153
|
+
unusedOptions.push('--transport');
|
|
154
|
+
if (unusedOptions.length > 0) {
|
|
155
|
+
console.warn(`Warning: The following connection-related options are unused in tool validation mode: ${unusedOptions.join(', ')}`);
|
|
156
|
+
}
|
|
157
|
+
await executeTest({
|
|
158
|
+
tool: options.tool,
|
|
159
|
+
path: options.path,
|
|
160
|
+
strict: options.strict,
|
|
161
|
+
json: options.json,
|
|
162
|
+
ci: options.ci,
|
|
163
|
+
showErrors: options.showErrors,
|
|
164
|
+
toolsDir: options.toolsDir,
|
|
165
|
+
projectRoot: options.projectRoot,
|
|
166
|
+
env: parseEnvOptions(options.env),
|
|
167
|
+
authHeaders: parseAuthHeaderOptions(options.authHeader),
|
|
168
|
+
});
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
catch (error) {
|
|
172
|
+
// Error handling is done in executeTest
|
|
173
|
+
if (error instanceof Error) {
|
|
174
|
+
logger.error('Test command failed', error);
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
});
|
|
178
|
+
// list command
|
|
179
|
+
program
|
|
180
|
+
.command('list')
|
|
181
|
+
.description('List tools, resources, or prompts from an MCP server')
|
|
182
|
+
.argument('[type]', `Type to list: ${ListTypes.TOOLS}, ${ListTypes.RESOURCES}, or ${ListTypes.PROMPTS} (default: ${ListTypes.TOOLS})`, ListTypes.TOOLS)
|
|
183
|
+
.option('--transport <type>', 'Transport type (http or stdio). If not provided, uses transport from config.yaml')
|
|
184
|
+
.option('--url <url>', 'MCP URL (for http transport). If not provided, uses URL from config.yaml')
|
|
185
|
+
.option('--script <script>', 'Script (for stdio transport). If not provided, uses script from config.yaml')
|
|
186
|
+
.option('--project-root <path>', 'Project root directory (defaults to current directory)')
|
|
187
|
+
.option('--env <key=value>', 'Environment variable to pass to MCP server (for stdio transport). Can be specified multiple times. Format: KEY=value or KEY (uses process.env[KEY])', (value, previous = []) => {
|
|
188
|
+
previous.push(value);
|
|
189
|
+
return previous;
|
|
190
|
+
})
|
|
191
|
+
.option('--auth-header <header>', 'Authentication header (for HTTP transport). Can be specified multiple times. Format: "Header: Value" or "Header=Value" or token (treated as Bearer token)', (value, previous = []) => {
|
|
192
|
+
previous.push(value);
|
|
193
|
+
return previous;
|
|
194
|
+
})
|
|
195
|
+
.action(async (type, options) => {
|
|
196
|
+
try {
|
|
197
|
+
const listType = type;
|
|
198
|
+
if (![ListTypes.TOOLS, ListTypes.RESOURCES, ListTypes.PROMPTS].includes(listType)) {
|
|
199
|
+
log.blank();
|
|
200
|
+
log.error(Messages.LIST_INVALID_TYPE(type));
|
|
201
|
+
log.plain(Messages.LIST_VALID_TYPES);
|
|
202
|
+
log.blank();
|
|
203
|
+
process.exit(1);
|
|
204
|
+
}
|
|
205
|
+
const { parseEnvOptions, parseAuthHeaderOptions } = await import('../cli/utils/option-parsers.js');
|
|
206
|
+
await executeList({
|
|
207
|
+
type: listType,
|
|
208
|
+
transport: options.transport,
|
|
209
|
+
url: options.url,
|
|
210
|
+
script: options.script,
|
|
211
|
+
projectRoot: options.projectRoot,
|
|
212
|
+
env: parseEnvOptions(options.env),
|
|
213
|
+
authHeaders: parseAuthHeaderOptions(options.authHeader),
|
|
214
|
+
});
|
|
215
|
+
}
|
|
216
|
+
catch (error) {
|
|
217
|
+
// Error handling is done in executeList
|
|
218
|
+
if (error instanceof Error) {
|
|
219
|
+
logger.error('List command failed', error);
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
});
|
|
223
|
+
// analyse command
|
|
224
|
+
program
|
|
225
|
+
.command('analyse')
|
|
226
|
+
.alias('analyze')
|
|
227
|
+
.description('Perform static analysis on MCP tool contracts')
|
|
228
|
+
.option('--ci', 'CI mode: minimal output, exit code 1 on errors')
|
|
229
|
+
.option('--json', 'Output results as JSON')
|
|
230
|
+
.option('--graph', 'Include dependency graph in output')
|
|
231
|
+
.option('--transport <type>', 'Transport type (http or stdio). If not provided, uses transport from config.yaml')
|
|
232
|
+
.option('--url <url>', 'MCP URL (for http transport). If not provided, uses URL from config.yaml')
|
|
233
|
+
.option('--script <script>', 'Script (for stdio transport). If not provided, uses script from config.yaml')
|
|
234
|
+
.option('--project-root <path>', 'Project root directory (defaults to current directory)')
|
|
235
|
+
.option('--env <key=value>', 'Environment variable to pass to MCP server (for stdio transport). Can be specified multiple times. Format: KEY=value or KEY (uses process.env[KEY])', (value, previous = []) => {
|
|
236
|
+
previous.push(value);
|
|
237
|
+
return previous;
|
|
238
|
+
})
|
|
239
|
+
.option('--auth-header <header>', 'Authentication header (for HTTP transport). Can be specified multiple times. Format: "Header: Value" or "Header=Value" or token (treated as Bearer token)', (value, previous = []) => {
|
|
240
|
+
previous.push(value);
|
|
241
|
+
return previous;
|
|
242
|
+
})
|
|
243
|
+
.action(async (options) => {
|
|
244
|
+
try {
|
|
245
|
+
const { parseEnvOptions, parseAuthHeaderOptions } = await import('../cli/utils/option-parsers.js');
|
|
246
|
+
await executeAnalyse({
|
|
247
|
+
ci: options.ci,
|
|
248
|
+
json: options.json,
|
|
249
|
+
graph: options.graph,
|
|
250
|
+
transport: options.transport,
|
|
251
|
+
url: options.url,
|
|
252
|
+
script: options.script,
|
|
253
|
+
projectRoot: options.projectRoot,
|
|
254
|
+
env: parseEnvOptions(options.env),
|
|
255
|
+
authHeaders: parseAuthHeaderOptions(options.authHeader),
|
|
256
|
+
});
|
|
257
|
+
}
|
|
258
|
+
catch (error) {
|
|
259
|
+
// Error handling is done in executeAnalyse, but ensure we log if something unexpected happens
|
|
260
|
+
if (error instanceof Error) {
|
|
261
|
+
reportAnalyseError(error);
|
|
262
|
+
}
|
|
263
|
+
// Don't exit here - executeAnalyse handles exit codes
|
|
264
|
+
}
|
|
265
|
+
});
|
|
266
|
+
// dev command
|
|
267
|
+
program
|
|
268
|
+
.command('dev')
|
|
269
|
+
.description('Enter interactive development mode for testing MCP tools')
|
|
270
|
+
.option('--exec', 'Execute tool calls (default: preview mode, shows what would be executed)')
|
|
271
|
+
.option('--llm <provider>', 'Override default LLM provider (e.g., openai, claude, ollama)')
|
|
272
|
+
.option('--project-root <path>', 'Project root directory (defaults to current directory)')
|
|
273
|
+
.option('--save-events', 'Save events to file for debugging')
|
|
274
|
+
.option('--event-file <path>', 'Directory path for event files (default: .syrin/events). Events are saved as {sessionId}.jsonl')
|
|
275
|
+
.option('--run-script', 'Run script to spawn server internally. If not provided, stdio uses script automatically, http connects to existing server')
|
|
276
|
+
.action(async (options) => {
|
|
277
|
+
try {
|
|
278
|
+
await executeDev({
|
|
279
|
+
exec: options.exec || false,
|
|
280
|
+
llm: options.llm,
|
|
281
|
+
projectRoot: options.projectRoot,
|
|
282
|
+
saveEvents: options.saveEvents || false,
|
|
283
|
+
eventFile: options.eventFile,
|
|
284
|
+
runScript: options.runScript || false,
|
|
285
|
+
});
|
|
286
|
+
}
|
|
287
|
+
catch (error) {
|
|
288
|
+
// Error handling is done in executeDev
|
|
289
|
+
if (error instanceof Error) {
|
|
290
|
+
logger.error('Dev command failed', error);
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
});
|
|
294
|
+
// update command
|
|
295
|
+
program
|
|
296
|
+
.command('update')
|
|
297
|
+
.description('Update Syrin to the latest version')
|
|
298
|
+
.action(async () => {
|
|
299
|
+
try {
|
|
300
|
+
await executeUpdate();
|
|
301
|
+
}
|
|
302
|
+
catch (error) {
|
|
303
|
+
// Error handling is done in executeUpdate
|
|
304
|
+
if (error instanceof Error) {
|
|
305
|
+
logger.error('Update command failed', error);
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
});
|
|
309
|
+
// rollback command
|
|
310
|
+
program
|
|
311
|
+
.command('rollback')
|
|
312
|
+
.description('Rollback Syrin to a previous version')
|
|
313
|
+
.argument('<version>', 'Version to rollback to (e.g., 1.0.0 or v1.0.0)')
|
|
314
|
+
.action(async (version) => {
|
|
315
|
+
try {
|
|
316
|
+
await executeRollback({ version });
|
|
317
|
+
}
|
|
318
|
+
catch (error) {
|
|
319
|
+
// Error handling is done in executeRollback
|
|
320
|
+
if (error instanceof Error) {
|
|
321
|
+
logger.error('Rollback command failed', error);
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
});
|
|
325
|
+
// Parse command line arguments
|
|
326
|
+
program.parse();
|
|
327
|
+
}
|
|
328
|
+
/**
|
|
329
|
+
* Run the CLI.
|
|
330
|
+
*/
|
|
331
|
+
export function run() {
|
|
332
|
+
try {
|
|
333
|
+
setupCLI();
|
|
334
|
+
}
|
|
335
|
+
catch (error) {
|
|
336
|
+
const err = error instanceof Error ? error : new Error(String(error));
|
|
337
|
+
logger.error('CLI setup failed', err);
|
|
338
|
+
log.error(Messages.CLI_START_FAILED);
|
|
339
|
+
process.exit(1);
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Interactive prompts for the `syrin init` command.
|
|
3
|
+
*/
|
|
4
|
+
import type { InitOptions } from '../../config/types.js';
|
|
5
|
+
/**
|
|
6
|
+
* Prompt user for project initialization details.
|
|
7
|
+
* @param defaults - Default values for non-interactive mode
|
|
8
|
+
* @returns User's answers
|
|
9
|
+
*/
|
|
10
|
+
export declare function promptInitOptions(defaults?: Partial<InitOptions>): Promise<InitOptions>;
|
|
11
|
+
/**
|
|
12
|
+
* Create default init options for non-interactive mode.
|
|
13
|
+
* @param projectRoot - Root directory of the project
|
|
14
|
+
* @returns Default options
|
|
15
|
+
*/
|
|
16
|
+
export declare function getDefaultInitOptions(projectRoot: string): InitOptions;
|
|
17
|
+
//# sourceMappingURL=init-prompt.d.ts.map
|
|
@@ -0,0 +1,263 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Interactive prompts for the `syrin init` command.
|
|
3
|
+
*/
|
|
4
|
+
import inquirer from 'inquirer';
|
|
5
|
+
import * as path from 'path';
|
|
6
|
+
import { makeProjectName, makeAgentName, makeMCPURL, makeAPIKey, makeModelName, makeScriptCommand, } from '../../types/factories.js';
|
|
7
|
+
import { Messages, TransportTypes, LLMProviders, LLMProviderDisplayNames, Defaults, EnvVars, } from '../../constants/index.js';
|
|
8
|
+
/**
|
|
9
|
+
* Prompt user for project initialization details.
|
|
10
|
+
* @param defaults - Default values for non-interactive mode
|
|
11
|
+
* @returns User's answers
|
|
12
|
+
*/
|
|
13
|
+
export async function promptInitOptions(defaults) {
|
|
14
|
+
const currentDirName = path.basename(process.cwd());
|
|
15
|
+
const defaultProjectName = defaults?.projectName ||
|
|
16
|
+
currentDirName.replace(/[^a-z0-9-]/gi, '-').toLowerCase();
|
|
17
|
+
const answers = await inquirer.prompt([
|
|
18
|
+
{
|
|
19
|
+
type: 'input',
|
|
20
|
+
name: 'projectName',
|
|
21
|
+
message: 'Project name:',
|
|
22
|
+
default: defaultProjectName,
|
|
23
|
+
validate: (input) => {
|
|
24
|
+
if (!input.trim()) {
|
|
25
|
+
return Messages.PROMPT_PROJECT_NAME_REQUIRED;
|
|
26
|
+
}
|
|
27
|
+
if (!/^[a-z0-9-]+$/i.test(input)) {
|
|
28
|
+
return Messages.PROMPT_PROJECT_NAME_INVALID;
|
|
29
|
+
}
|
|
30
|
+
return true;
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
type: 'input',
|
|
35
|
+
name: 'agentName',
|
|
36
|
+
message: 'Agent name:',
|
|
37
|
+
default: defaults?.agentName
|
|
38
|
+
? String(defaults.agentName)
|
|
39
|
+
: Defaults.AGENT_NAME,
|
|
40
|
+
validate: (input) => {
|
|
41
|
+
if (!input.trim()) {
|
|
42
|
+
return Messages.PROMPT_AGENT_NAME_REQUIRED;
|
|
43
|
+
}
|
|
44
|
+
return true;
|
|
45
|
+
},
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
type: 'list',
|
|
49
|
+
name: 'transport',
|
|
50
|
+
message: 'Transport type:',
|
|
51
|
+
choices: [
|
|
52
|
+
{
|
|
53
|
+
name: `${TransportTypes.STDIO} - Spawn MCP server as a subprocess`,
|
|
54
|
+
value: TransportTypes.STDIO,
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
name: `${TransportTypes.HTTP} - Connect to a running MCP server via HTTP`,
|
|
58
|
+
value: TransportTypes.HTTP,
|
|
59
|
+
},
|
|
60
|
+
],
|
|
61
|
+
default: defaults?.transport || Defaults.TRANSPORT,
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
type: 'input',
|
|
65
|
+
name: 'mcpUrl',
|
|
66
|
+
message: 'MCP server URL:',
|
|
67
|
+
default: defaults?.mcpUrl ? String(defaults.mcpUrl) : Defaults.MCP_URL,
|
|
68
|
+
when: (answers) => answers?.transport === TransportTypes.HTTP,
|
|
69
|
+
validate: (input, answers) => {
|
|
70
|
+
if (answers?.transport === TransportTypes.HTTP) {
|
|
71
|
+
if (!input.trim()) {
|
|
72
|
+
return Messages.PROMPT_MCP_URL_REQUIRED;
|
|
73
|
+
}
|
|
74
|
+
try {
|
|
75
|
+
new URL(input);
|
|
76
|
+
return true;
|
|
77
|
+
}
|
|
78
|
+
catch {
|
|
79
|
+
return Messages.PROMPT_URL_INVALID;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
return true;
|
|
83
|
+
},
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
type: 'input',
|
|
87
|
+
name: 'script',
|
|
88
|
+
message: 'Script command to run MCP server:',
|
|
89
|
+
default: defaults?.script ? String(defaults.script) : 'python3 server.py',
|
|
90
|
+
validate: (input) => {
|
|
91
|
+
if (!input.trim()) {
|
|
92
|
+
return Messages.PROMPT_SCRIPT_REQUIRED;
|
|
93
|
+
}
|
|
94
|
+
return true;
|
|
95
|
+
},
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
type: 'checkbox',
|
|
99
|
+
name: 'llmProviders',
|
|
100
|
+
message: 'Select LLM providers to configure:',
|
|
101
|
+
choices: [
|
|
102
|
+
{
|
|
103
|
+
name: LLMProviderDisplayNames.OPENAI,
|
|
104
|
+
value: LLMProviders.OPENAI,
|
|
105
|
+
checked: true,
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
name: LLMProviderDisplayNames.CLAUDE,
|
|
109
|
+
value: LLMProviders.CLAUDE,
|
|
110
|
+
},
|
|
111
|
+
{
|
|
112
|
+
name: LLMProviderDisplayNames.OLLAMA,
|
|
113
|
+
value: LLMProviders.OLLAMA,
|
|
114
|
+
},
|
|
115
|
+
],
|
|
116
|
+
default: defaults?.llmProviders
|
|
117
|
+
? Object.keys(defaults.llmProviders)
|
|
118
|
+
: [LLMProviders.OPENAI],
|
|
119
|
+
validate: (input) => {
|
|
120
|
+
if (input.length === 0) {
|
|
121
|
+
return Messages.PROMPT_LLM_PROVIDER_REQUIRED;
|
|
122
|
+
}
|
|
123
|
+
return true;
|
|
124
|
+
},
|
|
125
|
+
},
|
|
126
|
+
{
|
|
127
|
+
type: 'input',
|
|
128
|
+
name: 'openaiApiKey',
|
|
129
|
+
message: 'OpenAI API Key (env var name or direct value):',
|
|
130
|
+
default: EnvVars.OPENAI_API_KEY,
|
|
131
|
+
when: (answers) => answers.llmProviders?.includes(LLMProviders.OPENAI) ?? false,
|
|
132
|
+
validate: (input, answers) => {
|
|
133
|
+
if (answers?.llmProviders?.includes(LLMProviders.OPENAI) &&
|
|
134
|
+
!input.trim()) {
|
|
135
|
+
return 'OpenAI API key is required';
|
|
136
|
+
}
|
|
137
|
+
return true;
|
|
138
|
+
},
|
|
139
|
+
},
|
|
140
|
+
{
|
|
141
|
+
type: 'input',
|
|
142
|
+
name: 'openaiModel',
|
|
143
|
+
message: 'OpenAI Model Name (env var name or direct value):',
|
|
144
|
+
default: EnvVars.OPENAI_MODEL_NAME,
|
|
145
|
+
when: (answers) => answers.llmProviders?.includes(LLMProviders.OPENAI) ?? false,
|
|
146
|
+
validate: (input, answers) => {
|
|
147
|
+
if (answers?.llmProviders?.includes(LLMProviders.OPENAI) &&
|
|
148
|
+
!input.trim()) {
|
|
149
|
+
return Messages.PROMPT_OPENAI_MODEL_REQUIRED;
|
|
150
|
+
}
|
|
151
|
+
return true;
|
|
152
|
+
},
|
|
153
|
+
},
|
|
154
|
+
{
|
|
155
|
+
type: 'input',
|
|
156
|
+
name: 'claudeApiKey',
|
|
157
|
+
message: 'Claude API Key (env var name or direct value):',
|
|
158
|
+
default: EnvVars.CLAUDE_API_KEY,
|
|
159
|
+
when: (answers) => answers.llmProviders?.includes(LLMProviders.CLAUDE) ?? false,
|
|
160
|
+
validate: (input, answers) => {
|
|
161
|
+
if (answers?.llmProviders?.includes(LLMProviders.CLAUDE) &&
|
|
162
|
+
!input.trim()) {
|
|
163
|
+
return Messages.PROMPT_CLAUDE_API_KEY_REQUIRED;
|
|
164
|
+
}
|
|
165
|
+
return true;
|
|
166
|
+
},
|
|
167
|
+
},
|
|
168
|
+
{
|
|
169
|
+
type: 'input',
|
|
170
|
+
name: 'claudeModel',
|
|
171
|
+
message: 'Claude Model Name (env var name or direct value):',
|
|
172
|
+
default: EnvVars.CLAUDE_MODEL_NAME,
|
|
173
|
+
when: (answers) => answers.llmProviders?.includes(LLMProviders.CLAUDE) ?? false,
|
|
174
|
+
validate: (input, answers) => {
|
|
175
|
+
if (answers?.llmProviders?.includes(LLMProviders.CLAUDE) &&
|
|
176
|
+
!input.trim()) {
|
|
177
|
+
return Messages.PROMPT_CLAUDE_MODEL_REQUIRED;
|
|
178
|
+
}
|
|
179
|
+
return true;
|
|
180
|
+
},
|
|
181
|
+
},
|
|
182
|
+
{
|
|
183
|
+
type: 'input',
|
|
184
|
+
name: 'ollamaModelName',
|
|
185
|
+
message: 'Ollama Model Name (e.g., "llama2", "mistral", "codellama"):',
|
|
186
|
+
default: EnvVars.OLLAMA_MODEL_NAME,
|
|
187
|
+
when: (answers) => answers.llmProviders?.includes(LLMProviders.OLLAMA) ?? false,
|
|
188
|
+
validate: (input, answers) => {
|
|
189
|
+
if (answers?.llmProviders?.includes(LLMProviders.OLLAMA) &&
|
|
190
|
+
!input.trim()) {
|
|
191
|
+
return Messages.PROMPT_OLLAMA_MODEL_REQUIRED;
|
|
192
|
+
}
|
|
193
|
+
return true;
|
|
194
|
+
},
|
|
195
|
+
},
|
|
196
|
+
{
|
|
197
|
+
type: 'list',
|
|
198
|
+
name: 'defaultProvider',
|
|
199
|
+
message: 'Default LLM provider:',
|
|
200
|
+
choices: (answers) => answers.llmProviders || [],
|
|
201
|
+
default: (answers) => answers.llmProviders?.[0] || 'openai',
|
|
202
|
+
},
|
|
203
|
+
]);
|
|
204
|
+
// Build LLM providers config
|
|
205
|
+
const llmProviders = {};
|
|
206
|
+
if (answers.llmProviders.includes('openai')) {
|
|
207
|
+
llmProviders.openai = {
|
|
208
|
+
apiKey: makeAPIKey(answers.openaiApiKey || ''),
|
|
209
|
+
modelName: makeModelName(answers.openaiModel || ''),
|
|
210
|
+
default: answers.defaultProvider === 'openai' || false,
|
|
211
|
+
};
|
|
212
|
+
}
|
|
213
|
+
if (answers.llmProviders.includes('claude')) {
|
|
214
|
+
llmProviders.claude = {
|
|
215
|
+
apiKey: makeAPIKey(answers.claudeApiKey || ''),
|
|
216
|
+
modelName: makeModelName(answers.claudeModel || ''),
|
|
217
|
+
default: answers.defaultProvider === 'claude' || false,
|
|
218
|
+
};
|
|
219
|
+
}
|
|
220
|
+
if (answers.llmProviders.includes('ollama')) {
|
|
221
|
+
llmProviders.ollama = {
|
|
222
|
+
modelName: answers.ollamaModelName
|
|
223
|
+
? makeModelName(answers.ollamaModelName)
|
|
224
|
+
: undefined,
|
|
225
|
+
default: answers.defaultProvider === 'ollama' || false,
|
|
226
|
+
};
|
|
227
|
+
}
|
|
228
|
+
return {
|
|
229
|
+
projectName: makeProjectName(answers.projectName),
|
|
230
|
+
agentName: makeAgentName(answers.agentName),
|
|
231
|
+
transport: answers.transport,
|
|
232
|
+
mcpUrl: answers.mcpUrl ? makeMCPURL(answers.mcpUrl) : undefined,
|
|
233
|
+
script: makeScriptCommand(answers.script),
|
|
234
|
+
llmProviders,
|
|
235
|
+
nonInteractive: false,
|
|
236
|
+
};
|
|
237
|
+
}
|
|
238
|
+
/**
|
|
239
|
+
* Create default init options for non-interactive mode.
|
|
240
|
+
* @param projectRoot - Root directory of the project
|
|
241
|
+
* @returns Default options
|
|
242
|
+
*/
|
|
243
|
+
export function getDefaultInitOptions(projectRoot) {
|
|
244
|
+
const currentDirName = path.basename(projectRoot);
|
|
245
|
+
const defaultProjectNameStr = currentDirName
|
|
246
|
+
.replace(/[^a-z0-9-]/gi, '-')
|
|
247
|
+
.toLowerCase();
|
|
248
|
+
return {
|
|
249
|
+
projectName: makeProjectName(defaultProjectNameStr),
|
|
250
|
+
agentName: makeAgentName(Defaults.AGENT_NAME),
|
|
251
|
+
transport: Defaults.TRANSPORT,
|
|
252
|
+
script: makeScriptCommand(Defaults.SCRIPT_COMMAND),
|
|
253
|
+
llmProviders: {
|
|
254
|
+
openai: {
|
|
255
|
+
apiKey: makeAPIKey(EnvVars.OPENAI_API_KEY),
|
|
256
|
+
modelName: makeModelName(EnvVars.OPENAI_MODEL_NAME),
|
|
257
|
+
default: true,
|
|
258
|
+
},
|
|
259
|
+
},
|
|
260
|
+
nonInteractive: true,
|
|
261
|
+
};
|
|
262
|
+
}
|
|
263
|
+
//# sourceMappingURL=init-prompt.js.map
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Command error handling utilities.
|
|
3
|
+
* Provides consistent error handling patterns for CLI commands.
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Handle and display command errors with consistent formatting.
|
|
7
|
+
* This ensures all commands have uniform error handling.
|
|
8
|
+
*
|
|
9
|
+
* @param error - The error to handle
|
|
10
|
+
* @param defaultMessage - Default error message if error is not an Error instance
|
|
11
|
+
* @returns Never returns (always exits process)
|
|
12
|
+
*/
|
|
13
|
+
export declare function handleCommandError(error: unknown, defaultMessage?: string): never;
|
|
14
|
+
//# sourceMappingURL=command-error-handler.d.ts.map
|