@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,330 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Unified logging utility for Syrin.
|
|
3
|
+
* Combines structured logging with styled console output.
|
|
4
|
+
*/
|
|
5
|
+
import { Icons } from '../constants/icons.js';
|
|
6
|
+
export var LogLevel;
|
|
7
|
+
(function (LogLevel) {
|
|
8
|
+
LogLevel[LogLevel["DEBUG"] = 0] = "DEBUG";
|
|
9
|
+
LogLevel[LogLevel["INFO"] = 1] = "INFO";
|
|
10
|
+
LogLevel[LogLevel["WARN"] = 2] = "WARN";
|
|
11
|
+
LogLevel[LogLevel["ERROR"] = 3] = "ERROR";
|
|
12
|
+
LogLevel[LogLevel["SILENT"] = 4] = "SILENT";
|
|
13
|
+
})(LogLevel || (LogLevel = {}));
|
|
14
|
+
export const Icon = {
|
|
15
|
+
ERROR: Icons.ERROR,
|
|
16
|
+
WARNING: Icons.WARNING,
|
|
17
|
+
TIP: Icons.TIP,
|
|
18
|
+
SUCCESS: Icons.SUCCESS,
|
|
19
|
+
FAILURE: Icons.FAILURE,
|
|
20
|
+
CHECK: Icons.CHECK,
|
|
21
|
+
FOLDER: Icons.FOLDER,
|
|
22
|
+
DOCUMENT: Icons.DOCUMENT,
|
|
23
|
+
};
|
|
24
|
+
// ANSI color codes
|
|
25
|
+
const colors = {
|
|
26
|
+
reset: '\x1b[0m',
|
|
27
|
+
bold: '\x1b[1m',
|
|
28
|
+
dim: '\x1b[2m',
|
|
29
|
+
green: '\x1b[32m',
|
|
30
|
+
yellow: '\x1b[33m',
|
|
31
|
+
red: '\x1b[31m',
|
|
32
|
+
cyan: '\x1b[36m',
|
|
33
|
+
blue: '\x1b[34m',
|
|
34
|
+
};
|
|
35
|
+
/**
|
|
36
|
+
* Unified logger class with structured logging and styled output.
|
|
37
|
+
*/
|
|
38
|
+
export class Log {
|
|
39
|
+
level;
|
|
40
|
+
context;
|
|
41
|
+
useStructuredLogging;
|
|
42
|
+
constructor(level = LogLevel.INFO, context = {}, useStructuredLogging = false) {
|
|
43
|
+
this.level = level;
|
|
44
|
+
this.context = context;
|
|
45
|
+
this.useStructuredLogging = useStructuredLogging;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Create a child logger with additional context.
|
|
49
|
+
*/
|
|
50
|
+
child(additionalContext) {
|
|
51
|
+
return new Log(this.level, { ...this.context, ...additionalContext }, this.useStructuredLogging);
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Set the log level.
|
|
55
|
+
*/
|
|
56
|
+
setLevel(level) {
|
|
57
|
+
this.level = level;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Enable or disable structured logging.
|
|
61
|
+
*/
|
|
62
|
+
setStructuredLogging(enabled) {
|
|
63
|
+
this.useStructuredLogging = enabled;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Style text with colors and formatting.
|
|
67
|
+
*/
|
|
68
|
+
style(text, ...styles) {
|
|
69
|
+
const styleCodes = styles.map(s => colors[s]).join('');
|
|
70
|
+
return `${styleCodes}${text}${colors.reset}`;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Internal structured logging method.
|
|
74
|
+
*/
|
|
75
|
+
structuredLog(level, message, context, error) {
|
|
76
|
+
if (level < this.level) {
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
79
|
+
const mergedContext = {
|
|
80
|
+
...this.context,
|
|
81
|
+
};
|
|
82
|
+
if (context) {
|
|
83
|
+
for (const [key, value] of Object.entries(context)) {
|
|
84
|
+
if (typeof value === 'string' ||
|
|
85
|
+
typeof value === 'number' ||
|
|
86
|
+
typeof value === 'boolean' ||
|
|
87
|
+
value === null ||
|
|
88
|
+
value === undefined) {
|
|
89
|
+
mergedContext[key] = value;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
const entry = {
|
|
94
|
+
timestamp: new Date().toISOString(),
|
|
95
|
+
level,
|
|
96
|
+
message,
|
|
97
|
+
context: mergedContext,
|
|
98
|
+
error,
|
|
99
|
+
};
|
|
100
|
+
const levelName = LogLevel[level];
|
|
101
|
+
const prefix = `[${entry.timestamp}] [${levelName}]`;
|
|
102
|
+
if (error) {
|
|
103
|
+
// Use console.error for structured logging errors to maintain proper error output
|
|
104
|
+
console.error(`${prefix} ${message}`, {
|
|
105
|
+
...entry.context,
|
|
106
|
+
error: error.message,
|
|
107
|
+
stack: error.stack,
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
else if (context && Object.keys(context).length > 0) {
|
|
111
|
+
// Use console.log for structured logging to maintain proper log format
|
|
112
|
+
console.log(`${prefix} ${message}`, entry.context);
|
|
113
|
+
}
|
|
114
|
+
else {
|
|
115
|
+
// Use console.log for structured logging to maintain proper log format
|
|
116
|
+
console.log(`${prefix} ${message}`);
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* Print styled text to console.
|
|
121
|
+
*/
|
|
122
|
+
print(text, ...styles) {
|
|
123
|
+
if (this.useStructuredLogging) {
|
|
124
|
+
this.structuredLog(LogLevel.INFO, text);
|
|
125
|
+
}
|
|
126
|
+
else {
|
|
127
|
+
console.log(this.style(text, ...styles));
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
// ==================== Unified Logging Methods ====================
|
|
131
|
+
// These methods behave differently based on useStructuredLogging flag:
|
|
132
|
+
// - If useStructuredLogging is true: structured logging with levels
|
|
133
|
+
// - If useStructuredLogging is false: styled output with icons
|
|
134
|
+
/**
|
|
135
|
+
* Print a heading (green, bold).
|
|
136
|
+
*/
|
|
137
|
+
heading(text) {
|
|
138
|
+
this.print(text, 'bold', 'green');
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* Print a label (dim).
|
|
142
|
+
*/
|
|
143
|
+
label(text) {
|
|
144
|
+
this.print(text, 'dim');
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* Print a value (cyan).
|
|
148
|
+
*/
|
|
149
|
+
value(text) {
|
|
150
|
+
this.print(text, 'cyan');
|
|
151
|
+
}
|
|
152
|
+
/**
|
|
153
|
+
* Log/print success message (green) with success icon.
|
|
154
|
+
* For structured logging: logs at INFO level
|
|
155
|
+
* For styled output: prints with green color and success icon
|
|
156
|
+
*/
|
|
157
|
+
success(text, icon) {
|
|
158
|
+
if (this.useStructuredLogging) {
|
|
159
|
+
this.structuredLog(LogLevel.INFO, text);
|
|
160
|
+
}
|
|
161
|
+
else {
|
|
162
|
+
const iconText = icon ? `${icon} ` : `${Icon.SUCCESS} `;
|
|
163
|
+
this.print(`${iconText}${text}`, 'green');
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
/**
|
|
167
|
+
* Log/print error message (red) with error icon.
|
|
168
|
+
* For structured logging: logs at ERROR level (can include Error object)
|
|
169
|
+
* For styled output: prints with red color and error icon
|
|
170
|
+
*/
|
|
171
|
+
error(message, errorOrIcon, contextOrIcon) {
|
|
172
|
+
if (this.useStructuredLogging) {
|
|
173
|
+
// Structured logging: errorOrIcon is Error, contextOrIcon is context
|
|
174
|
+
const err = errorOrIcon instanceof Error ? errorOrIcon : undefined;
|
|
175
|
+
const context = errorOrIcon instanceof Error
|
|
176
|
+
? contextOrIcon
|
|
177
|
+
: errorOrIcon;
|
|
178
|
+
this.structuredLog(LogLevel.ERROR, message, context, err);
|
|
179
|
+
}
|
|
180
|
+
else {
|
|
181
|
+
// Styled output: errorOrIcon is optional Icon
|
|
182
|
+
const icon = errorOrIcon;
|
|
183
|
+
const iconText = icon ? `${icon} ` : `${Icon.ERROR} `;
|
|
184
|
+
this.print(`${iconText}${message}`, 'red');
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
warning(text, contextOrIcon) {
|
|
188
|
+
if (this.useStructuredLogging) {
|
|
189
|
+
// For structured logging, second param is always context
|
|
190
|
+
const context = contextOrIcon;
|
|
191
|
+
this.structuredLog(LogLevel.WARN, text, context);
|
|
192
|
+
}
|
|
193
|
+
else {
|
|
194
|
+
// For styled output, second param is always icon
|
|
195
|
+
const icon = contextOrIcon;
|
|
196
|
+
const iconText = icon ? `${icon} ` : `${Icon.WARNING} `;
|
|
197
|
+
this.print(`${iconText}${text}`, 'yellow');
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
warn(text, contextOrIcon) {
|
|
201
|
+
if (this.useStructuredLogging) {
|
|
202
|
+
// For structured logging, second param is always context
|
|
203
|
+
const context = contextOrIcon;
|
|
204
|
+
this.structuredLog(LogLevel.WARN, text, context);
|
|
205
|
+
}
|
|
206
|
+
else {
|
|
207
|
+
// For styled output, second param is always icon
|
|
208
|
+
const icon = contextOrIcon;
|
|
209
|
+
const iconText = icon ? `${icon} ` : `${Icon.WARNING} `;
|
|
210
|
+
this.print(`${iconText}${text}`, 'yellow');
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
info(text, contextOrIcon) {
|
|
214
|
+
if (this.useStructuredLogging) {
|
|
215
|
+
// For structured logging, second param is always context
|
|
216
|
+
const context = contextOrIcon;
|
|
217
|
+
this.structuredLog(LogLevel.INFO, text, context);
|
|
218
|
+
}
|
|
219
|
+
else {
|
|
220
|
+
// For styled output, second param is always icon
|
|
221
|
+
const icon = contextOrIcon;
|
|
222
|
+
const iconText = icon ? `${icon} ` : `${Icon.TIP} `;
|
|
223
|
+
this.print(`${iconText}${text}`, 'cyan');
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
debug(text, contextOrIcon) {
|
|
227
|
+
if (this.useStructuredLogging) {
|
|
228
|
+
// For structured logging, second param is always context
|
|
229
|
+
const context = contextOrIcon;
|
|
230
|
+
this.structuredLog(LogLevel.DEBUG, text, context);
|
|
231
|
+
}
|
|
232
|
+
else {
|
|
233
|
+
// For styled output, second param is always icon
|
|
234
|
+
const icon = contextOrIcon;
|
|
235
|
+
const iconText = icon ? `${icon} ` : '';
|
|
236
|
+
this.print(`${iconText}${text}`, 'dim');
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
/**
|
|
240
|
+
* Print a line with label and value.
|
|
241
|
+
*/
|
|
242
|
+
labelValue(labelText, valueText) {
|
|
243
|
+
const output = `${this.style(labelText, 'dim')} ${this.style(valueText, 'cyan')}`;
|
|
244
|
+
if (this.useStructuredLogging) {
|
|
245
|
+
this.structuredLog(LogLevel.INFO, `${labelText} ${valueText}`);
|
|
246
|
+
}
|
|
247
|
+
else {
|
|
248
|
+
console.log(output);
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
/**
|
|
252
|
+
* Print a numbered item.
|
|
253
|
+
*/
|
|
254
|
+
numberedItem(number, text, ...additionalStyles) {
|
|
255
|
+
this.print(`${number}. ${text}`, 'bold', 'green', ...additionalStyles);
|
|
256
|
+
}
|
|
257
|
+
/**
|
|
258
|
+
* Print a checkmark with text.
|
|
259
|
+
*/
|
|
260
|
+
checkmark(text) {
|
|
261
|
+
this.print(`${Icons.SUCCESS} ${text}`, 'green', 'bold');
|
|
262
|
+
}
|
|
263
|
+
/**
|
|
264
|
+
* Print an X mark with text.
|
|
265
|
+
*/
|
|
266
|
+
xmark(text) {
|
|
267
|
+
this.print(`${Icons.FAILURE} ${text}`, 'red', 'bold');
|
|
268
|
+
}
|
|
269
|
+
/**
|
|
270
|
+
* Get a styled tick/checkmark (✓) in green.
|
|
271
|
+
* Returns a styled string that can be used in other messages.
|
|
272
|
+
*/
|
|
273
|
+
tick() {
|
|
274
|
+
return this.styleText(Icons.SUCCESS, 'green');
|
|
275
|
+
}
|
|
276
|
+
/**
|
|
277
|
+
* Get a styled cross/X mark (✗) in red.
|
|
278
|
+
* Returns a styled string that can be used in other messages.
|
|
279
|
+
*/
|
|
280
|
+
cross() {
|
|
281
|
+
return this.styleText(Icons.FAILURE, 'red');
|
|
282
|
+
}
|
|
283
|
+
/**
|
|
284
|
+
* Print a warning symbol with text.
|
|
285
|
+
*/
|
|
286
|
+
warnSymbol(text) {
|
|
287
|
+
this.print(`⚠ ${text}`, 'yellow');
|
|
288
|
+
}
|
|
289
|
+
/**
|
|
290
|
+
* Print plain text (no styling).
|
|
291
|
+
*/
|
|
292
|
+
plain(text) {
|
|
293
|
+
if (this.useStructuredLogging) {
|
|
294
|
+
this.structuredLog(LogLevel.INFO, text);
|
|
295
|
+
}
|
|
296
|
+
else {
|
|
297
|
+
console.log(text);
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
/**
|
|
301
|
+
* Print an empty line.
|
|
302
|
+
*/
|
|
303
|
+
blank() {
|
|
304
|
+
console.log('');
|
|
305
|
+
}
|
|
306
|
+
/**
|
|
307
|
+
* Style text with colors and formatting (returns styled string).
|
|
308
|
+
* This is a public method that can be used to get styled strings without printing.
|
|
309
|
+
*/
|
|
310
|
+
styleText(text, ...styles) {
|
|
311
|
+
return this.style(text, ...styles);
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
/**
|
|
315
|
+
* Default logger instance for styled output (non-structured).
|
|
316
|
+
* Use this for UI/presentation output.
|
|
317
|
+
*/
|
|
318
|
+
export const log = new Log(LogLevel.INFO, {}, false);
|
|
319
|
+
/**
|
|
320
|
+
* Default structured logger instance.
|
|
321
|
+
* Use this for application logging with levels and context.
|
|
322
|
+
*/
|
|
323
|
+
export const logger = new Log(LogLevel.INFO, {}, true);
|
|
324
|
+
/**
|
|
325
|
+
* Create a logger with a specific context.
|
|
326
|
+
*/
|
|
327
|
+
export function createLogger(context) {
|
|
328
|
+
return logger.child(context);
|
|
329
|
+
}
|
|
330
|
+
//# sourceMappingURL=logger.js.map
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Package management utilities.
|
|
3
|
+
* Provides functions to interact with npm for updating/installing packages.
|
|
4
|
+
*/
|
|
5
|
+
export interface InstallResult {
|
|
6
|
+
success: boolean;
|
|
7
|
+
error?: string;
|
|
8
|
+
version?: string;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Detect if the package is installed globally or locally.
|
|
12
|
+
*/
|
|
13
|
+
export declare function detectInstallType(): 'global' | 'local';
|
|
14
|
+
/**
|
|
15
|
+
* Update package to latest version.
|
|
16
|
+
*/
|
|
17
|
+
export declare function updatePackage(packageName?: string): Promise<InstallResult>;
|
|
18
|
+
/**
|
|
19
|
+
* Install a specific version of the package.
|
|
20
|
+
*/
|
|
21
|
+
export declare function installPackageVersion(version: string, packageName?: string): Promise<InstallResult>;
|
|
22
|
+
/**
|
|
23
|
+
* Validate version string format.
|
|
24
|
+
*/
|
|
25
|
+
export declare function isValidVersion(version: string): boolean;
|
|
26
|
+
/**
|
|
27
|
+
* Normalize version string (remove 'v' prefix if present).
|
|
28
|
+
*/
|
|
29
|
+
export declare function normalizeVersion(version: string): string;
|
|
30
|
+
//# sourceMappingURL=package-manager.d.ts.map
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Package management utilities.
|
|
3
|
+
* Provides functions to interact with npm for updating/installing packages.
|
|
4
|
+
*/
|
|
5
|
+
import { spawn } from 'child_process';
|
|
6
|
+
import * as fs from 'fs';
|
|
7
|
+
import * as path from 'path';
|
|
8
|
+
import { PACKAGE_NAME } from '../constants/app.js';
|
|
9
|
+
/**
|
|
10
|
+
* Detect if the package is installed globally or locally.
|
|
11
|
+
*/
|
|
12
|
+
export function detectInstallType() {
|
|
13
|
+
// Check if we're running from a global installation
|
|
14
|
+
// Global npm packages are typically in:
|
|
15
|
+
// - macOS/Linux: /usr/local/lib/node_modules or ~/.npm-global
|
|
16
|
+
// - Windows: %APPDATA%\npm\node_modules
|
|
17
|
+
const packageJsonPath = path.join(__dirname, '../../package.json');
|
|
18
|
+
const resolvedPath = fs.realpathSync(packageJsonPath);
|
|
19
|
+
const nodeModulesPath = path.join(resolvedPath, '../../..');
|
|
20
|
+
// Check if node_modules parent is a global location
|
|
21
|
+
if (nodeModulesPath.includes('node_modules') &&
|
|
22
|
+
(nodeModulesPath.includes('npm') ||
|
|
23
|
+
nodeModulesPath.includes('.npm-global') ||
|
|
24
|
+
nodeModulesPath.startsWith('/usr/local') ||
|
|
25
|
+
nodeModulesPath.startsWith('/opt'))) {
|
|
26
|
+
return 'global';
|
|
27
|
+
}
|
|
28
|
+
return 'local';
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Execute npm command and return result.
|
|
32
|
+
*/
|
|
33
|
+
function executeNpmCommand(args, cwd) {
|
|
34
|
+
return new Promise((resolve, reject) => {
|
|
35
|
+
const npm = spawn('npm', args, {
|
|
36
|
+
cwd: cwd || process.cwd(),
|
|
37
|
+
stdio: ['ignore', 'pipe', 'pipe'],
|
|
38
|
+
shell: true,
|
|
39
|
+
});
|
|
40
|
+
let stdout = '';
|
|
41
|
+
let stderr = '';
|
|
42
|
+
npm.stdout.on('data', (data) => {
|
|
43
|
+
stdout += data.toString();
|
|
44
|
+
});
|
|
45
|
+
npm.stderr.on('data', (data) => {
|
|
46
|
+
stderr += data.toString();
|
|
47
|
+
});
|
|
48
|
+
npm.on('close', code => {
|
|
49
|
+
if (code === 0) {
|
|
50
|
+
resolve({ success: true, stdout, stderr });
|
|
51
|
+
}
|
|
52
|
+
else {
|
|
53
|
+
resolve({ success: false, stdout, stderr });
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
npm.on('error', error => {
|
|
57
|
+
reject(error);
|
|
58
|
+
});
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Update package to latest version.
|
|
63
|
+
*/
|
|
64
|
+
export async function updatePackage(packageName = PACKAGE_NAME) {
|
|
65
|
+
const installType = detectInstallType();
|
|
66
|
+
const args = installType === 'global'
|
|
67
|
+
? ['install', '-g', `${packageName}@latest`]
|
|
68
|
+
: ['install', `${packageName}@latest`];
|
|
69
|
+
try {
|
|
70
|
+
const result = await executeNpmCommand(args);
|
|
71
|
+
if (result.success) {
|
|
72
|
+
// Try to get the installed version from package.json
|
|
73
|
+
const packageJsonPath = path.join(__dirname, '../../package.json');
|
|
74
|
+
let version;
|
|
75
|
+
try {
|
|
76
|
+
if (fs.existsSync(packageJsonPath)) {
|
|
77
|
+
const packageJsonContent = fs.readFileSync(packageJsonPath, 'utf-8');
|
|
78
|
+
const packageJson = JSON.parse(packageJsonContent);
|
|
79
|
+
version = packageJson.version;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
catch {
|
|
83
|
+
// Ignore errors reading version
|
|
84
|
+
}
|
|
85
|
+
return {
|
|
86
|
+
success: true,
|
|
87
|
+
version,
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
return {
|
|
91
|
+
success: false,
|
|
92
|
+
error: result.stderr || 'Update failed',
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
catch (error) {
|
|
96
|
+
return {
|
|
97
|
+
success: false,
|
|
98
|
+
error: error instanceof Error ? error.message : String(error),
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Install a specific version of the package.
|
|
104
|
+
*/
|
|
105
|
+
export async function installPackageVersion(version, packageName = PACKAGE_NAME) {
|
|
106
|
+
const installType = detectInstallType();
|
|
107
|
+
const args = installType === 'global'
|
|
108
|
+
? ['install', '-g', `${packageName}@${version}`]
|
|
109
|
+
: ['install', `${packageName}@${version}`];
|
|
110
|
+
try {
|
|
111
|
+
const result = await executeNpmCommand(args);
|
|
112
|
+
if (result.success) {
|
|
113
|
+
// Try to get the installed version from package.json
|
|
114
|
+
const packageJsonPath = path.join(__dirname, '../../package.json');
|
|
115
|
+
let installedVersion;
|
|
116
|
+
try {
|
|
117
|
+
if (fs.existsSync(packageJsonPath)) {
|
|
118
|
+
const packageJsonContent = fs.readFileSync(packageJsonPath, 'utf-8');
|
|
119
|
+
const packageJson = JSON.parse(packageJsonContent);
|
|
120
|
+
installedVersion = packageJson.version;
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
catch {
|
|
124
|
+
// Ignore errors reading version
|
|
125
|
+
}
|
|
126
|
+
return {
|
|
127
|
+
success: true,
|
|
128
|
+
version: installedVersion || version,
|
|
129
|
+
};
|
|
130
|
+
}
|
|
131
|
+
return {
|
|
132
|
+
success: false,
|
|
133
|
+
error: result.stderr || 'Installation failed',
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
catch (error) {
|
|
137
|
+
return {
|
|
138
|
+
success: false,
|
|
139
|
+
error: error instanceof Error ? error.message : String(error),
|
|
140
|
+
};
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* Validate version string format.
|
|
145
|
+
*/
|
|
146
|
+
export function isValidVersion(version) {
|
|
147
|
+
// Basic semver validation: major.minor.patch or vmajor.minor.patch
|
|
148
|
+
const semverPattern = /^v?\d+\.\d+\.\d+(-[\w.]+)?(\+[\w.]+)?$/;
|
|
149
|
+
return semverPattern.test(version);
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* Normalize version string (remove 'v' prefix if present).
|
|
153
|
+
*/
|
|
154
|
+
export function normalizeVersion(version) {
|
|
155
|
+
return version.replace(/^v/, '');
|
|
156
|
+
}
|
|
157
|
+
//# sourceMappingURL=package-manager.js.map
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Version checking utilities.
|
|
3
|
+
* Provides functions to check current version and compare with npm registry.
|
|
4
|
+
*/
|
|
5
|
+
export interface VersionInfo {
|
|
6
|
+
current: string;
|
|
7
|
+
latest?: string;
|
|
8
|
+
isLatest: boolean;
|
|
9
|
+
updateAvailable: boolean;
|
|
10
|
+
}
|
|
11
|
+
export interface RegistryPackageInfo {
|
|
12
|
+
'dist-tags': {
|
|
13
|
+
latest: string;
|
|
14
|
+
};
|
|
15
|
+
versions: Record<string, unknown>;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Get the current version from package.json.
|
|
19
|
+
* Works in both development and installed package contexts.
|
|
20
|
+
*/
|
|
21
|
+
export declare function getCurrentVersion(): string;
|
|
22
|
+
/**
|
|
23
|
+
* Fetch package information from npm registry.
|
|
24
|
+
*/
|
|
25
|
+
export declare function fetchPackageInfo(packageName?: string): Promise<RegistryPackageInfo>;
|
|
26
|
+
/**
|
|
27
|
+
* Get the latest version from npm registry.
|
|
28
|
+
*/
|
|
29
|
+
export declare function getLatestVersion(packageName?: string): Promise<string | undefined>;
|
|
30
|
+
/**
|
|
31
|
+
* Compare two version strings using simple semantic version comparison.
|
|
32
|
+
* Returns: -1 if v1 < v2, 0 if v1 === v2, 1 if v1 > v2
|
|
33
|
+
*/
|
|
34
|
+
export declare function compareVersions(v1: string, v2: string): number;
|
|
35
|
+
/**
|
|
36
|
+
* Check Syrin version information including update availability.
|
|
37
|
+
*/
|
|
38
|
+
export declare function checkSyrinVersion(): Promise<VersionInfo>;
|
|
39
|
+
/**
|
|
40
|
+
* Check version information including update availability.
|
|
41
|
+
*/
|
|
42
|
+
export declare function checkVersion(packageName?: string): Promise<VersionInfo>;
|
|
43
|
+
/**
|
|
44
|
+
* Format version string with update information.
|
|
45
|
+
*/
|
|
46
|
+
export declare function formatVersionWithUpdate(versionInfo: VersionInfo, packageName?: string): string;
|
|
47
|
+
//# sourceMappingURL=version-checker.d.ts.map
|