@vibesdotdev/cli 0.0.1
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/README.md +41 -0
- package/SPEC.md +97 -0
- package/bin/vibes.ts +26 -0
- package/dist/api/client/factory.d.ts +29 -0
- package/dist/api/client/factory.d.ts.map +1 -0
- package/dist/api/client/factory.js +189 -0
- package/dist/api/client/factory.js.map +1 -0
- package/dist/api/schemas/common.d.ts +58 -0
- package/dist/api/schemas/common.d.ts.map +1 -0
- package/dist/api/schemas/common.js +48 -0
- package/dist/api/schemas/common.js.map +1 -0
- package/dist/api/schemas/types.d.ts +30 -0
- package/dist/api/schemas/types.d.ts.map +1 -0
- package/dist/api/schemas/types.js +2 -0
- package/dist/api/schemas/types.js.map +1 -0
- package/dist/api/services/api.d.ts +14 -0
- package/dist/api/services/api.d.ts.map +1 -0
- package/dist/api/services/api.js +110 -0
- package/dist/api/services/api.js.map +1 -0
- package/dist/api/types.d.ts +6 -0
- package/dist/api/types.d.ts.map +1 -0
- package/dist/api/types.js +5 -0
- package/dist/api/types.js.map +1 -0
- package/dist/bin.d.ts +28 -0
- package/dist/bin.d.ts.map +1 -0
- package/dist/bin.js +73 -0
- package/dist/bin.js.map +1 -0
- package/dist/bootstrap.d.ts +14 -0
- package/dist/bootstrap.d.ts.map +1 -0
- package/dist/bootstrap.js +14 -0
- package/dist/bootstrap.js.map +1 -0
- package/dist/cli.plugin.d.ts +20 -0
- package/dist/cli.plugin.d.ts.map +1 -0
- package/dist/cli.plugin.js +170 -0
- package/dist/cli.plugin.js.map +1 -0
- package/dist/commands/completion/bash.d.ts +8 -0
- package/dist/commands/completion/bash.d.ts.map +1 -0
- package/dist/commands/completion/bash.js +60 -0
- package/dist/commands/completion/bash.js.map +1 -0
- package/dist/commands/completion/completion.descriptor.d.ts +10 -0
- package/dist/commands/completion/completion.descriptor.d.ts.map +1 -0
- package/dist/commands/completion/completion.descriptor.js +41 -0
- package/dist/commands/completion/completion.descriptor.js.map +1 -0
- package/dist/commands/completion/completion.impl.d.ts +12 -0
- package/dist/commands/completion/completion.impl.d.ts.map +1 -0
- package/dist/commands/completion/completion.impl.js +167 -0
- package/dist/commands/completion/completion.impl.js.map +1 -0
- package/dist/commands/completion/fig.d.ts +12 -0
- package/dist/commands/completion/fig.d.ts.map +1 -0
- package/dist/commands/completion/fig.js +71 -0
- package/dist/commands/completion/fig.js.map +1 -0
- package/dist/commands/completion/fish.d.ts +8 -0
- package/dist/commands/completion/fish.d.ts.map +1 -0
- package/dist/commands/completion/fish.js +38 -0
- package/dist/commands/completion/fish.js.map +1 -0
- package/dist/commands/completion/tree.d.ts +33 -0
- package/dist/commands/completion/tree.d.ts.map +1 -0
- package/dist/commands/completion/tree.js +75 -0
- package/dist/commands/completion/tree.js.map +1 -0
- package/dist/commands/completion/zsh-widget.d.ts +13 -0
- package/dist/commands/completion/zsh-widget.d.ts.map +1 -0
- package/dist/commands/completion/zsh-widget.js +39 -0
- package/dist/commands/completion/zsh-widget.js.map +1 -0
- package/dist/commands/completion/zsh.d.ts +9 -0
- package/dist/commands/completion/zsh.d.ts.map +1 -0
- package/dist/commands/completion/zsh.js +146 -0
- package/dist/commands/completion/zsh.js.map +1 -0
- package/dist/commands/profile/_utils.d.ts +21 -0
- package/dist/commands/profile/_utils.d.ts.map +1 -0
- package/dist/commands/profile/_utils.js +61 -0
- package/dist/commands/profile/_utils.js.map +1 -0
- package/dist/commands/profile/profile-group.descriptor.d.ts +4 -0
- package/dist/commands/profile/profile-group.descriptor.d.ts.map +1 -0
- package/dist/commands/profile/profile-group.descriptor.js +12 -0
- package/dist/commands/profile/profile-group.descriptor.js.map +1 -0
- package/dist/commands/profile/profile.create.descriptor.d.ts +4 -0
- package/dist/commands/profile/profile.create.descriptor.d.ts.map +1 -0
- package/dist/commands/profile/profile.create.descriptor.js +22 -0
- package/dist/commands/profile/profile.create.descriptor.js.map +1 -0
- package/dist/commands/profile/profile.create.impl.d.ts +10 -0
- package/dist/commands/profile/profile.create.impl.d.ts.map +1 -0
- package/dist/commands/profile/profile.create.impl.js +29 -0
- package/dist/commands/profile/profile.create.impl.js.map +1 -0
- package/dist/commands/profile/profile.delete.descriptor.d.ts +4 -0
- package/dist/commands/profile/profile.delete.descriptor.d.ts.map +1 -0
- package/dist/commands/profile/profile.delete.descriptor.js +29 -0
- package/dist/commands/profile/profile.delete.descriptor.js.map +1 -0
- package/dist/commands/profile/profile.delete.impl.d.ts +11 -0
- package/dist/commands/profile/profile.delete.impl.d.ts.map +1 -0
- package/dist/commands/profile/profile.delete.impl.js +50 -0
- package/dist/commands/profile/profile.delete.impl.js.map +1 -0
- package/dist/commands/profile/profile.info.descriptor.d.ts +4 -0
- package/dist/commands/profile/profile.info.descriptor.d.ts.map +1 -0
- package/dist/commands/profile/profile.info.descriptor.js +23 -0
- package/dist/commands/profile/profile.info.descriptor.js.map +1 -0
- package/dist/commands/profile/profile.info.impl.d.ts +10 -0
- package/dist/commands/profile/profile.info.impl.d.ts.map +1 -0
- package/dist/commands/profile/profile.info.impl.js +33 -0
- package/dist/commands/profile/profile.info.impl.js.map +1 -0
- package/dist/commands/profile/profile.list.descriptor.d.ts +4 -0
- package/dist/commands/profile/profile.list.descriptor.d.ts.map +1 -0
- package/dist/commands/profile/profile.list.descriptor.js +16 -0
- package/dist/commands/profile/profile.list.descriptor.js.map +1 -0
- package/dist/commands/profile/profile.list.impl.d.ts +10 -0
- package/dist/commands/profile/profile.list.impl.d.ts.map +1 -0
- package/dist/commands/profile/profile.list.impl.js +33 -0
- package/dist/commands/profile/profile.list.impl.js.map +1 -0
- package/dist/commands/profile/profile.use.descriptor.d.ts +4 -0
- package/dist/commands/profile/profile.use.descriptor.d.ts.map +1 -0
- package/dist/commands/profile/profile.use.descriptor.js +23 -0
- package/dist/commands/profile/profile.use.descriptor.js.map +1 -0
- package/dist/commands/profile/profile.use.impl.d.ts +10 -0
- package/dist/commands/profile/profile.use.impl.d.ts.map +1 -0
- package/dist/commands/profile/profile.use.impl.js +24 -0
- package/dist/commands/profile/profile.use.impl.js.map +1 -0
- package/dist/commands/runtime/_logging.d.ts +11 -0
- package/dist/commands/runtime/_logging.d.ts.map +1 -0
- package/dist/commands/runtime/_logging.js +40 -0
- package/dist/commands/runtime/_logging.js.map +1 -0
- package/dist/commands/runtime/codegen.command.descriptor.d.ts +15 -0
- package/dist/commands/runtime/codegen.command.descriptor.d.ts.map +1 -0
- package/dist/commands/runtime/codegen.command.descriptor.js +18 -0
- package/dist/commands/runtime/codegen.command.descriptor.js.map +1 -0
- package/dist/commands/runtime/codegen.command.impl.d.ts +4 -0
- package/dist/commands/runtime/codegen.command.impl.d.ts.map +1 -0
- package/dist/commands/runtime/codegen.command.impl.js +39 -0
- package/dist/commands/runtime/codegen.command.impl.js.map +1 -0
- package/dist/commands/runtime/codegen.d.ts +17 -0
- package/dist/commands/runtime/codegen.d.ts.map +1 -0
- package/dist/commands/runtime/codegen.js +65 -0
- package/dist/commands/runtime/codegen.js.map +1 -0
- package/dist/commands/runtime/index.d.ts +4 -0
- package/dist/commands/runtime/index.d.ts.map +1 -0
- package/dist/commands/runtime/index.js +8 -0
- package/dist/commands/runtime/index.js.map +1 -0
- package/dist/commands/runtime/plugin.d.ts +2 -0
- package/dist/commands/runtime/plugin.d.ts.map +1 -0
- package/dist/commands/runtime/plugin.js +7 -0
- package/dist/commands/runtime/plugin.js.map +1 -0
- package/dist/commands/runtime/runtime-group.descriptor.d.ts +4 -0
- package/dist/commands/runtime/runtime-group.descriptor.d.ts.map +1 -0
- package/dist/commands/runtime/runtime-group.descriptor.js +10 -0
- package/dist/commands/runtime/runtime-group.descriptor.js.map +1 -0
- package/dist/config.d.ts +17 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +11 -0
- package/dist/config.js.map +1 -0
- package/dist/core/index.d.ts +9 -0
- package/dist/core/index.d.ts.map +1 -0
- package/dist/core/index.js +5 -0
- package/dist/core/index.js.map +1 -0
- package/dist/core/namespace/hook.d.ts +12 -0
- package/dist/core/namespace/hook.d.ts.map +1 -0
- package/dist/core/namespace/hook.js +15 -0
- package/dist/core/namespace/hook.js.map +1 -0
- package/dist/core/namespace/index.d.ts +18 -0
- package/dist/core/namespace/index.d.ts.map +1 -0
- package/dist/core/namespace/index.js +214 -0
- package/dist/core/namespace/index.js.map +1 -0
- package/dist/core/namespace/schemas/index.d.ts +25 -0
- package/dist/core/namespace/schemas/index.d.ts.map +1 -0
- package/dist/core/namespace/schemas/index.js +2 -0
- package/dist/core/namespace/schemas/index.js.map +1 -0
- package/dist/core/plugins/types.d.ts +81 -0
- package/dist/core/plugins/types.d.ts.map +1 -0
- package/dist/core/plugins/types.js +6 -0
- package/dist/core/plugins/types.js.map +1 -0
- package/dist/core/runtime/context.d.ts +25 -0
- package/dist/core/runtime/context.d.ts.map +1 -0
- package/dist/core/runtime/context.js +30 -0
- package/dist/core/runtime/context.js.map +1 -0
- package/dist/core/runtime/hooks.d.ts +12 -0
- package/dist/core/runtime/hooks.d.ts.map +1 -0
- package/dist/core/runtime/hooks.js +2 -0
- package/dist/core/runtime/hooks.js.map +1 -0
- package/dist/core/runtime/shared/context.d.ts +33 -0
- package/dist/core/runtime/shared/context.d.ts.map +1 -0
- package/dist/core/runtime/shared/context.js +51 -0
- package/dist/core/runtime/shared/context.js.map +1 -0
- package/dist/core/runtime/shared/options.d.ts +20 -0
- package/dist/core/runtime/shared/options.d.ts.map +1 -0
- package/dist/core/runtime/shared/options.js +61 -0
- package/dist/core/runtime/shared/options.js.map +1 -0
- package/dist/core/schemas/manifest.d.ts +24 -0
- package/dist/core/schemas/manifest.d.ts.map +1 -0
- package/dist/core/schemas/manifest.js +6 -0
- package/dist/core/schemas/manifest.js.map +1 -0
- package/dist/core/schemas/types.d.ts +7 -0
- package/dist/core/schemas/types.d.ts.map +1 -0
- package/dist/core/schemas/types.js +2 -0
- package/dist/core/schemas/types.js.map +1 -0
- package/dist/core/ui/interface.d.ts +12 -0
- package/dist/core/ui/interface.d.ts.map +1 -0
- package/dist/core/ui/interface.js +6 -0
- package/dist/core/ui/interface.js.map +1 -0
- package/dist/docs/cli.commands.docs.descriptor.d.ts +4 -0
- package/dist/docs/cli.commands.docs.descriptor.d.ts.map +1 -0
- package/dist/docs/cli.commands.docs.descriptor.js +207 -0
- package/dist/docs/cli.commands.docs.descriptor.js.map +1 -0
- package/dist/docs/cli.groups.docs.descriptor.d.ts +4 -0
- package/dist/docs/cli.groups.docs.descriptor.d.ts.map +1 -0
- package/dist/docs/cli.groups.docs.descriptor.js +330 -0
- package/dist/docs/cli.groups.docs.descriptor.js.map +1 -0
- package/dist/docs/cli.output.docs.descriptor.d.ts +4 -0
- package/dist/docs/cli.output.docs.descriptor.d.ts.map +1 -0
- package/dist/docs/cli.output.docs.descriptor.js +442 -0
- package/dist/docs/cli.output.docs.descriptor.js.map +1 -0
- package/dist/docs/types.d.ts +19 -0
- package/dist/docs/types.d.ts.map +1 -0
- package/dist/docs/types.js +2 -0
- package/dist/docs/types.js.map +1 -0
- package/dist/errors.d.ts +74 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +113 -0
- package/dist/errors.js.map +1 -0
- package/dist/index.d.ts +22 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +29 -0
- package/dist/index.js.map +1 -0
- package/dist/logging/cli-startup.logger.descriptor.d.ts +7 -0
- package/dist/logging/cli-startup.logger.descriptor.d.ts.map +1 -0
- package/dist/logging/cli-startup.logger.descriptor.js +13 -0
- package/dist/logging/cli-startup.logger.descriptor.js.map +1 -0
- package/dist/logging.d.ts +4 -0
- package/dist/logging.d.ts.map +1 -0
- package/dist/logging.js +21 -0
- package/dist/logging.js.map +1 -0
- package/dist/patterns/config-namespace.d.ts +23 -0
- package/dist/patterns/config-namespace.d.ts.map +1 -0
- package/dist/patterns/config-namespace.js +218 -0
- package/dist/patterns/config-namespace.js.map +1 -0
- package/dist/patterns/crud.d.ts +23 -0
- package/dist/patterns/crud.d.ts.map +1 -0
- package/dist/patterns/crud.js +164 -0
- package/dist/patterns/crud.js.map +1 -0
- package/dist/patterns/index.d.ts +13 -0
- package/dist/patterns/index.d.ts.map +1 -0
- package/dist/patterns/index.js +13 -0
- package/dist/patterns/index.js.map +1 -0
- package/dist/patterns/log-viewer.d.ts +19 -0
- package/dist/patterns/log-viewer.d.ts.map +1 -0
- package/dist/patterns/log-viewer.js +74 -0
- package/dist/patterns/log-viewer.js.map +1 -0
- package/dist/patterns/pattern-types.d.ts +21 -0
- package/dist/patterns/pattern-types.d.ts.map +1 -0
- package/dist/patterns/pattern-types.js +7 -0
- package/dist/patterns/pattern-types.js.map +1 -0
- package/dist/patterns/process-manager.d.ts +21 -0
- package/dist/patterns/process-manager.d.ts.map +1 -0
- package/dist/patterns/process-manager.js +134 -0
- package/dist/patterns/process-manager.js.map +1 -0
- package/dist/patterns/resolver.contracts.d.ts +14 -0
- package/dist/patterns/resolver.contracts.d.ts.map +1 -0
- package/dist/patterns/resolver.contracts.js +9 -0
- package/dist/patterns/resolver.contracts.js.map +1 -0
- package/dist/patterns/resolver.d.ts +40 -0
- package/dist/patterns/resolver.d.ts.map +1 -0
- package/dist/patterns/resolver.js +63 -0
- package/dist/patterns/resolver.js.map +1 -0
- package/dist/patterns/schemas.d.ts +496 -0
- package/dist/patterns/schemas.d.ts.map +1 -0
- package/dist/patterns/schemas.js +105 -0
- package/dist/patterns/schemas.js.map +1 -0
- package/dist/patterns/tool-wrapper.d.ts +18 -0
- package/dist/patterns/tool-wrapper.d.ts.map +1 -0
- package/dist/patterns/tool-wrapper.js +130 -0
- package/dist/patterns/tool-wrapper.js.map +1 -0
- package/dist/providers.d.ts +105 -0
- package/dist/providers.d.ts.map +1 -0
- package/dist/providers.js +164 -0
- package/dist/providers.js.map +1 -0
- package/dist/schemas/descriptors.d.ts +130 -0
- package/dist/schemas/descriptors.d.ts.map +1 -0
- package/dist/schemas/descriptors.js +96 -0
- package/dist/schemas/descriptors.js.map +1 -0
- package/dist/schemas/surface.d.ts +40 -0
- package/dist/schemas/surface.d.ts.map +1 -0
- package/dist/schemas/surface.js +2 -0
- package/dist/schemas/surface.js.map +1 -0
- package/dist/schemas/types.d.ts +202 -0
- package/dist/schemas/types.d.ts.map +1 -0
- package/dist/schemas/types.js +2 -0
- package/dist/schemas/types.js.map +1 -0
- package/dist/support/ui-toolkit.d.ts +62 -0
- package/dist/support/ui-toolkit.d.ts.map +1 -0
- package/dist/support/ui-toolkit.js +172 -0
- package/dist/support/ui-toolkit.js.map +1 -0
- package/dist/surface/CLISurface.d.ts +16 -0
- package/dist/surface/CLISurface.d.ts.map +1 -0
- package/dist/surface/CLISurface.js +173 -0
- package/dist/surface/CLISurface.js.map +1 -0
- package/dist/surface/attach-tui-action.d.ts +12 -0
- package/dist/surface/attach-tui-action.d.ts.map +1 -0
- package/dist/surface/attach-tui-action.js +48 -0
- package/dist/surface/attach-tui-action.js.map +1 -0
- package/dist/surface/build-context.d.ts +4 -0
- package/dist/surface/build-context.d.ts.map +1 -0
- package/dist/surface/build-context.js +49 -0
- package/dist/surface/build-context.js.map +1 -0
- package/dist/surface/command-group-policy.d.ts +7 -0
- package/dist/surface/command-group-policy.d.ts.map +1 -0
- package/dist/surface/command-group-policy.js +42 -0
- package/dist/surface/command-group-policy.js.map +1 -0
- package/dist/surface/discovery-cache.d.ts +17 -0
- package/dist/surface/discovery-cache.d.ts.map +1 -0
- package/dist/surface/discovery-cache.js +106 -0
- package/dist/surface/discovery-cache.js.map +1 -0
- package/dist/surface/register-commands.d.ts +15 -0
- package/dist/surface/register-commands.d.ts.map +1 -0
- package/dist/surface/register-commands.js +197 -0
- package/dist/surface/register-commands.js.map +1 -0
- package/dist/surface/register-groups.d.ts +15 -0
- package/dist/surface/register-groups.d.ts.map +1 -0
- package/dist/surface/register-groups.js +52 -0
- package/dist/surface/register-groups.js.map +1 -0
- package/dist/surface.d.ts +9 -0
- package/dist/surface.d.ts.map +1 -0
- package/dist/surface.js +8 -0
- package/dist/surface.js.map +1 -0
- package/dist/types.d.ts +4 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -0
- package/dist/ui/schemas/types.d.ts +2 -0
- package/dist/ui/schemas/types.d.ts.map +1 -0
- package/dist/ui/schemas/types.js +2 -0
- package/dist/ui/schemas/types.js.map +1 -0
- package/dist/ui/toolkit/VibesUIToolkit.d.ts +2 -0
- package/dist/ui/toolkit/VibesUIToolkit.d.ts.map +1 -0
- package/dist/ui/toolkit/VibesUIToolkit.js +2 -0
- package/dist/ui/toolkit/VibesUIToolkit.js.map +1 -0
- package/dist/ui.context.descriptor.d.ts +21 -0
- package/dist/ui.context.descriptor.d.ts.map +1 -0
- package/dist/ui.context.descriptor.js +12 -0
- package/dist/ui.context.descriptor.js.map +1 -0
- package/dist/utils/open.d.ts +2 -0
- package/dist/utils/open.d.ts.map +1 -0
- package/dist/utils/open.js +30 -0
- package/dist/utils/open.js.map +1 -0
- package/dist/version.d.ts +2 -0
- package/dist/version.d.ts.map +1 -0
- package/dist/version.js +2 -0
- package/dist/version.js.map +1 -0
- package/package.json +186 -0
- package/src/api/client/factory.ts +265 -0
- package/src/api/schemas/common.ts +50 -0
- package/src/api/schemas/types.ts +32 -0
- package/src/api/services/api.ts +129 -0
- package/src/api/types.ts +12 -0
- package/src/bin.ts +84 -0
- package/src/bootstrap.ts +19 -0
- package/src/cli.plugin.d.ts +19 -0
- package/src/cli.plugin.ts +202 -0
- package/src/commands/completion/bash.ts +68 -0
- package/src/commands/completion/completion.descriptor.ts +48 -0
- package/src/commands/completion/completion.impl.ts +188 -0
- package/src/commands/completion/fig.ts +78 -0
- package/src/commands/completion/fish.ts +52 -0
- package/src/commands/completion/tree.ts +115 -0
- package/src/commands/completion/zsh-widget.ts +39 -0
- package/src/commands/completion/zsh.ts +165 -0
- package/src/commands/profile/_utils.ts +72 -0
- package/src/commands/profile/profile-group.descriptor.ts +14 -0
- package/src/commands/profile/profile.create.descriptor.ts +24 -0
- package/src/commands/profile/profile.create.impl.ts +44 -0
- package/src/commands/profile/profile.delete.descriptor.ts +31 -0
- package/src/commands/profile/profile.delete.impl.ts +71 -0
- package/src/commands/profile/profile.info.descriptor.ts +25 -0
- package/src/commands/profile/profile.info.impl.ts +51 -0
- package/src/commands/profile/profile.list.descriptor.ts +18 -0
- package/src/commands/profile/profile.list.impl.ts +46 -0
- package/src/commands/profile/profile.use.descriptor.ts +25 -0
- package/src/commands/profile/profile.use.impl.ts +39 -0
- package/src/commands/runtime/_logging.ts +47 -0
- package/src/commands/runtime/codegen.command.descriptor.ts +18 -0
- package/src/commands/runtime/codegen.command.impl.ts +44 -0
- package/src/commands/runtime/codegen.ts +84 -0
- package/src/commands/runtime/index.ts +14 -0
- package/src/commands/runtime/plugin.ts +7 -0
- package/src/commands/runtime/runtime-group.descriptor.ts +12 -0
- package/src/config.ts +22 -0
- package/src/core/index.ts +9 -0
- package/src/core/namespace/hook.ts +25 -0
- package/src/core/namespace/index.ts +298 -0
- package/src/core/namespace/schemas/index.ts +25 -0
- package/src/core/plugins/types.ts +87 -0
- package/src/core/runtime/context.ts +50 -0
- package/src/core/runtime/hooks.ts +12 -0
- package/src/core/runtime/shared/context.ts +65 -0
- package/src/core/runtime/shared/options.ts +60 -0
- package/src/core/schemas/manifest.ts +26 -0
- package/src/core/schemas/types.ts +6 -0
- package/src/core/ui/interface.ts +12 -0
- package/src/docs/cli.commands.docs.descriptor.ts +210 -0
- package/src/docs/cli.groups.docs.descriptor.ts +333 -0
- package/src/docs/cli.output.docs.descriptor.ts +445 -0
- package/src/docs/types.ts +18 -0
- package/src/errors.ts +123 -0
- package/src/index.ts +76 -0
- package/src/logging/cli-startup.logger.descriptor.ts +16 -0
- package/src/logging.ts +35 -0
- package/src/patterns/config-namespace.ts +251 -0
- package/src/patterns/crud.ts +217 -0
- package/src/patterns/index.ts +24 -0
- package/src/patterns/log-viewer.ts +118 -0
- package/src/patterns/pattern-types.ts +22 -0
- package/src/patterns/process-manager.ts +180 -0
- package/src/patterns/resolver.contracts.ts +15 -0
- package/src/patterns/resolver.ts +86 -0
- package/src/patterns/schemas.ts +146 -0
- package/src/patterns/tool-wrapper.ts +165 -0
- package/src/providers.ts +282 -0
- package/src/schemas/descriptors.d.ts +119 -0
- package/src/schemas/descriptors.ts +136 -0
- package/src/schemas/surface.ts +52 -0
- package/src/schemas/types.d.ts +195 -0
- package/src/schemas/types.ts +225 -0
- package/src/support/ui-toolkit.ts +224 -0
- package/src/surface/CLISurface.ts +193 -0
- package/src/surface/attach-tui-action.ts +76 -0
- package/src/surface/build-context.ts +49 -0
- package/src/surface/command-group-policy.ts +52 -0
- package/src/surface/discovery-cache.ts +143 -0
- package/src/surface/register-commands.ts +266 -0
- package/src/surface/register-groups.ts +84 -0
- package/src/surface.ts +9 -0
- package/src/types.ts +3 -0
- package/src/ui/schemas/types.ts +1 -0
- package/src/ui/toolkit/VibesUIToolkit.ts +1 -0
- package/src/ui.context.descriptor.ts +13 -0
- package/src/utils/open.ts +36 -0
- package/src/version.ts +10 -0
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
import type { RuntimeDescriptor } from '@vibesdotdev/runtime/schemas/descriptor';
|
|
2
|
+
export type CLISurfaceTarget = 'cli' | 'web' | 'worker' | 'bridge';
|
|
3
|
+
export interface PatternTarget {
|
|
4
|
+
kind: string;
|
|
5
|
+
id: string;
|
|
6
|
+
variant?: string;
|
|
7
|
+
}
|
|
8
|
+
export interface CLILogBufferBehavior {
|
|
9
|
+
enabled?: boolean;
|
|
10
|
+
sinks?: string[];
|
|
11
|
+
fallbackToStdout?: boolean;
|
|
12
|
+
}
|
|
13
|
+
export interface CLIGroupAssetDescriptor extends RuntimeDescriptor {
|
|
14
|
+
kind: 'cli/group';
|
|
15
|
+
name: string;
|
|
16
|
+
description: string;
|
|
17
|
+
parent?: string;
|
|
18
|
+
aliases?: string[];
|
|
19
|
+
surfaces?: CLISurfaceTarget[];
|
|
20
|
+
internal?: boolean;
|
|
21
|
+
order?: number;
|
|
22
|
+
logBuffer?: CLILogBufferBehavior;
|
|
23
|
+
}
|
|
24
|
+
export interface CLICommandArgument {
|
|
25
|
+
name: string;
|
|
26
|
+
description: string;
|
|
27
|
+
required?: boolean;
|
|
28
|
+
variadic?: boolean;
|
|
29
|
+
default?: unknown;
|
|
30
|
+
}
|
|
31
|
+
export interface CLICommandOption {
|
|
32
|
+
flags: string;
|
|
33
|
+
description: string;
|
|
34
|
+
default?: unknown;
|
|
35
|
+
choices?: string[];
|
|
36
|
+
}
|
|
37
|
+
export interface CLICommandExample {
|
|
38
|
+
command: string;
|
|
39
|
+
description: string;
|
|
40
|
+
}
|
|
41
|
+
export interface CLICommandAssetDescriptor extends RuntimeDescriptor {
|
|
42
|
+
kind: 'cli/command';
|
|
43
|
+
name: string;
|
|
44
|
+
description: string;
|
|
45
|
+
group: string;
|
|
46
|
+
arguments?: CLICommandArgument[];
|
|
47
|
+
options?: CLICommandOption[];
|
|
48
|
+
aliases?: string[];
|
|
49
|
+
surfaces?: CLISurfaceTarget[];
|
|
50
|
+
internal?: boolean;
|
|
51
|
+
examples?: CLICommandExample[];
|
|
52
|
+
order?: number;
|
|
53
|
+
tuiAppId?: string;
|
|
54
|
+
logBuffer?: CLILogBufferBehavior;
|
|
55
|
+
}
|
|
56
|
+
export interface CRUDPatternConfig {
|
|
57
|
+
list?: {
|
|
58
|
+
enabled?: boolean;
|
|
59
|
+
defaultFormat?: 'table' | 'json' | 'yaml';
|
|
60
|
+
columns?: string[];
|
|
61
|
+
sortBy?: string;
|
|
62
|
+
paginate?: boolean;
|
|
63
|
+
};
|
|
64
|
+
get?: {
|
|
65
|
+
enabled?: boolean;
|
|
66
|
+
idParam?: string;
|
|
67
|
+
};
|
|
68
|
+
create?: {
|
|
69
|
+
enabled?: boolean;
|
|
70
|
+
interactive?: boolean;
|
|
71
|
+
promptFields?: string[];
|
|
72
|
+
};
|
|
73
|
+
update?: {
|
|
74
|
+
enabled?: boolean;
|
|
75
|
+
editableFields?: string[];
|
|
76
|
+
};
|
|
77
|
+
delete?: {
|
|
78
|
+
enabled?: boolean;
|
|
79
|
+
confirm?: boolean;
|
|
80
|
+
bulk?: boolean;
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
export interface ToolWrapperPatternConfig {
|
|
84
|
+
arguments?: Array<{
|
|
85
|
+
name: string;
|
|
86
|
+
toolParam: string;
|
|
87
|
+
description?: string;
|
|
88
|
+
required?: boolean;
|
|
89
|
+
variadic?: boolean;
|
|
90
|
+
}>;
|
|
91
|
+
options?: Array<{
|
|
92
|
+
flags: string;
|
|
93
|
+
toolParam: string;
|
|
94
|
+
description?: string;
|
|
95
|
+
default?: unknown;
|
|
96
|
+
choices?: string[];
|
|
97
|
+
}>;
|
|
98
|
+
output?: {
|
|
99
|
+
format?: 'raw' | 'json' | 'yaml' | 'table';
|
|
100
|
+
extractField?: string;
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
export interface LogViewerPatternConfig {
|
|
104
|
+
source: 'worker' | 'file' | 'stream';
|
|
105
|
+
defaultLines?: number;
|
|
106
|
+
follow?: boolean;
|
|
107
|
+
defaultLevels?: string[];
|
|
108
|
+
filters?: Array<{
|
|
109
|
+
name: string;
|
|
110
|
+
flag: string;
|
|
111
|
+
description: string;
|
|
112
|
+
}>;
|
|
113
|
+
}
|
|
114
|
+
export interface ProcessManagerPatternConfig {
|
|
115
|
+
processId: string;
|
|
116
|
+
commands?: {
|
|
117
|
+
start?: boolean;
|
|
118
|
+
stop?: boolean;
|
|
119
|
+
restart?: boolean;
|
|
120
|
+
status?: boolean;
|
|
121
|
+
logs?: boolean;
|
|
122
|
+
};
|
|
123
|
+
healthCheck?: {
|
|
124
|
+
url?: string;
|
|
125
|
+
interval?: number;
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
export interface ConfigNamespacePatternConfig {
|
|
129
|
+
namespace: string;
|
|
130
|
+
schema?: string;
|
|
131
|
+
defaults?: Record<string, unknown>;
|
|
132
|
+
commands?: {
|
|
133
|
+
get?: boolean;
|
|
134
|
+
set?: boolean;
|
|
135
|
+
reset?: boolean;
|
|
136
|
+
edit?: boolean;
|
|
137
|
+
};
|
|
138
|
+
}
|
|
139
|
+
export interface CLICRUDGroupDescriptor extends RuntimeDescriptor {
|
|
140
|
+
kind: 'cli/group';
|
|
141
|
+
name: string;
|
|
142
|
+
description: string;
|
|
143
|
+
parent?: string;
|
|
144
|
+
pattern: 'crud';
|
|
145
|
+
target: PatternTarget;
|
|
146
|
+
crud: CRUDPatternConfig;
|
|
147
|
+
surfaces?: CLISurfaceTarget[];
|
|
148
|
+
internal?: boolean;
|
|
149
|
+
}
|
|
150
|
+
export interface CLIToolWrapperCommandDescriptor extends RuntimeDescriptor {
|
|
151
|
+
kind: 'cli/command';
|
|
152
|
+
name: string;
|
|
153
|
+
description?: string;
|
|
154
|
+
group: string;
|
|
155
|
+
pattern: 'tool-wrapper';
|
|
156
|
+
target: PatternTarget;
|
|
157
|
+
toolWrapper: ToolWrapperPatternConfig;
|
|
158
|
+
surfaces?: CLISurfaceTarget[];
|
|
159
|
+
internal?: boolean;
|
|
160
|
+
order?: number;
|
|
161
|
+
}
|
|
162
|
+
export interface CLILogViewerGroupDescriptor extends RuntimeDescriptor {
|
|
163
|
+
kind: 'cli/group';
|
|
164
|
+
name: string;
|
|
165
|
+
description: string;
|
|
166
|
+
parent?: string;
|
|
167
|
+
pattern: 'log-viewer';
|
|
168
|
+
target: PatternTarget;
|
|
169
|
+
logViewer: LogViewerPatternConfig;
|
|
170
|
+
surfaces?: CLISurfaceTarget[];
|
|
171
|
+
internal?: boolean;
|
|
172
|
+
}
|
|
173
|
+
export interface CLIProcessManagerGroupDescriptor extends RuntimeDescriptor {
|
|
174
|
+
kind: 'cli/group';
|
|
175
|
+
name: string;
|
|
176
|
+
description: string;
|
|
177
|
+
parent?: string;
|
|
178
|
+
pattern: 'process-manager';
|
|
179
|
+
target: PatternTarget;
|
|
180
|
+
processManager: ProcessManagerPatternConfig;
|
|
181
|
+
surfaces?: CLISurfaceTarget[];
|
|
182
|
+
internal?: boolean;
|
|
183
|
+
}
|
|
184
|
+
export interface CLIConfigNamespaceGroupDescriptor extends RuntimeDescriptor {
|
|
185
|
+
kind: 'cli/group';
|
|
186
|
+
name: string;
|
|
187
|
+
description: string;
|
|
188
|
+
parent?: string;
|
|
189
|
+
pattern: 'config-namespace';
|
|
190
|
+
target?: PatternTarget;
|
|
191
|
+
configNamespace: ConfigNamespacePatternConfig;
|
|
192
|
+
surfaces?: CLISurfaceTarget[];
|
|
193
|
+
internal?: boolean;
|
|
194
|
+
}
|
|
195
|
+
export type CLIPatternDescriptor = CLICRUDGroupDescriptor | CLIToolWrapperCommandDescriptor | CLILogViewerGroupDescriptor | CLIProcessManagerGroupDescriptor | CLIConfigNamespaceGroupDescriptor;
|
|
@@ -0,0 +1,225 @@
|
|
|
1
|
+
import type { RuntimeDescriptor } from '@vibesdotdev/runtime/schemas/descriptor';
|
|
2
|
+
|
|
3
|
+
export type CLISurfaceTarget = 'cli' | 'web' | 'worker' | 'bridge';
|
|
4
|
+
|
|
5
|
+
export interface PatternTarget {
|
|
6
|
+
kind: string;
|
|
7
|
+
id: string;
|
|
8
|
+
variant?: string;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export interface CLILogBufferBehavior {
|
|
12
|
+
enabled?: boolean;
|
|
13
|
+
sinks?: string[];
|
|
14
|
+
fallbackToStdout?: boolean;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export interface CLIGroupAssetDescriptor extends RuntimeDescriptor {
|
|
18
|
+
kind: 'cli/group';
|
|
19
|
+
name: string;
|
|
20
|
+
description: string;
|
|
21
|
+
parent?: string;
|
|
22
|
+
aliases?: string[];
|
|
23
|
+
surfaces?: CLISurfaceTarget[];
|
|
24
|
+
internal?: boolean;
|
|
25
|
+
order?: number;
|
|
26
|
+
logBuffer?: CLILogBufferBehavior;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export interface CLICommandArgument {
|
|
30
|
+
name: string;
|
|
31
|
+
description: string;
|
|
32
|
+
required?: boolean;
|
|
33
|
+
variadic?: boolean;
|
|
34
|
+
default?: unknown;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export interface CLICommandOption {
|
|
38
|
+
flags: string;
|
|
39
|
+
description: string;
|
|
40
|
+
default?: unknown;
|
|
41
|
+
choices?: string[];
|
|
42
|
+
/**
|
|
43
|
+
* Coerce parsed option value. Commander returns user-supplied option values
|
|
44
|
+
* as strings by default; declaring `type: 'number'` makes the surface call
|
|
45
|
+
* `.argParser(Number)` so impls receive a real number.
|
|
46
|
+
*/
|
|
47
|
+
type?: 'string' | 'number' | 'boolean';
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export interface CLICommandExample {
|
|
51
|
+
command: string;
|
|
52
|
+
description: string;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export interface CLICommandAssetDescriptor extends RuntimeDescriptor {
|
|
56
|
+
kind: 'cli/command';
|
|
57
|
+
name: string;
|
|
58
|
+
description: string;
|
|
59
|
+
group: string;
|
|
60
|
+
arguments?: CLICommandArgument[];
|
|
61
|
+
options?: CLICommandOption[];
|
|
62
|
+
aliases?: string[];
|
|
63
|
+
surfaces?: CLISurfaceTarget[];
|
|
64
|
+
internal?: boolean;
|
|
65
|
+
examples?: CLICommandExample[];
|
|
66
|
+
order?: number;
|
|
67
|
+
tuiAppId?: string;
|
|
68
|
+
logBuffer?: CLILogBufferBehavior;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
export interface CRUDPatternConfig {
|
|
72
|
+
list?: {
|
|
73
|
+
enabled?: boolean;
|
|
74
|
+
defaultFormat?: 'table' | 'json' | 'yaml';
|
|
75
|
+
columns?: string[];
|
|
76
|
+
sortBy?: string;
|
|
77
|
+
paginate?: boolean;
|
|
78
|
+
};
|
|
79
|
+
get?: {
|
|
80
|
+
enabled?: boolean;
|
|
81
|
+
idParam?: string;
|
|
82
|
+
};
|
|
83
|
+
create?: {
|
|
84
|
+
enabled?: boolean;
|
|
85
|
+
interactive?: boolean;
|
|
86
|
+
promptFields?: string[];
|
|
87
|
+
};
|
|
88
|
+
update?: {
|
|
89
|
+
enabled?: boolean;
|
|
90
|
+
editableFields?: string[];
|
|
91
|
+
};
|
|
92
|
+
delete?: {
|
|
93
|
+
enabled?: boolean;
|
|
94
|
+
confirm?: boolean;
|
|
95
|
+
bulk?: boolean;
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
export interface ToolWrapperPatternConfig {
|
|
100
|
+
arguments?: Array<{
|
|
101
|
+
name: string;
|
|
102
|
+
toolParam: string;
|
|
103
|
+
description?: string;
|
|
104
|
+
required?: boolean;
|
|
105
|
+
variadic?: boolean;
|
|
106
|
+
}>;
|
|
107
|
+
options?: Array<{
|
|
108
|
+
flags: string;
|
|
109
|
+
toolParam: string;
|
|
110
|
+
description?: string;
|
|
111
|
+
default?: unknown;
|
|
112
|
+
choices?: string[];
|
|
113
|
+
}>;
|
|
114
|
+
output?: {
|
|
115
|
+
format?: 'raw' | 'json' | 'yaml' | 'table';
|
|
116
|
+
extractField?: string;
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
export interface LogViewerPatternConfig {
|
|
121
|
+
source: 'worker' | 'file' | 'stream';
|
|
122
|
+
defaultLines?: number;
|
|
123
|
+
follow?: boolean;
|
|
124
|
+
defaultLevels?: string[];
|
|
125
|
+
filters?: Array<{
|
|
126
|
+
name: string;
|
|
127
|
+
flag: string;
|
|
128
|
+
description: string;
|
|
129
|
+
}>;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
export interface ProcessManagerPatternConfig {
|
|
133
|
+
processId: string;
|
|
134
|
+
commands?: {
|
|
135
|
+
start?: boolean;
|
|
136
|
+
stop?: boolean;
|
|
137
|
+
restart?: boolean;
|
|
138
|
+
status?: boolean;
|
|
139
|
+
logs?: boolean;
|
|
140
|
+
};
|
|
141
|
+
healthCheck?: {
|
|
142
|
+
url?: string;
|
|
143
|
+
interval?: number;
|
|
144
|
+
};
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
export interface ConfigNamespacePatternConfig {
|
|
148
|
+
namespace: string;
|
|
149
|
+
schema?: string;
|
|
150
|
+
defaults?: Record<string, unknown>;
|
|
151
|
+
commands?: {
|
|
152
|
+
get?: boolean;
|
|
153
|
+
set?: boolean;
|
|
154
|
+
reset?: boolean;
|
|
155
|
+
edit?: boolean;
|
|
156
|
+
};
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
export interface CLICRUDGroupDescriptor extends RuntimeDescriptor {
|
|
160
|
+
kind: 'cli/group';
|
|
161
|
+
name: string;
|
|
162
|
+
description: string;
|
|
163
|
+
parent?: string;
|
|
164
|
+
pattern: 'crud';
|
|
165
|
+
target: PatternTarget;
|
|
166
|
+
crud: CRUDPatternConfig;
|
|
167
|
+
surfaces?: CLISurfaceTarget[];
|
|
168
|
+
internal?: boolean;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
export interface CLIToolWrapperCommandDescriptor extends RuntimeDescriptor {
|
|
172
|
+
kind: 'cli/command';
|
|
173
|
+
name: string;
|
|
174
|
+
description?: string;
|
|
175
|
+
group: string;
|
|
176
|
+
pattern: 'tool-wrapper';
|
|
177
|
+
target: PatternTarget;
|
|
178
|
+
toolWrapper: ToolWrapperPatternConfig;
|
|
179
|
+
surfaces?: CLISurfaceTarget[];
|
|
180
|
+
internal?: boolean;
|
|
181
|
+
order?: number;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
export interface CLILogViewerGroupDescriptor extends RuntimeDescriptor {
|
|
185
|
+
kind: 'cli/group';
|
|
186
|
+
name: string;
|
|
187
|
+
description: string;
|
|
188
|
+
parent?: string;
|
|
189
|
+
pattern: 'log-viewer';
|
|
190
|
+
target: PatternTarget;
|
|
191
|
+
logViewer: LogViewerPatternConfig;
|
|
192
|
+
surfaces?: CLISurfaceTarget[];
|
|
193
|
+
internal?: boolean;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
export interface CLIProcessManagerGroupDescriptor extends RuntimeDescriptor {
|
|
197
|
+
kind: 'cli/group';
|
|
198
|
+
name: string;
|
|
199
|
+
description: string;
|
|
200
|
+
parent?: string;
|
|
201
|
+
pattern: 'process-manager';
|
|
202
|
+
target: PatternTarget;
|
|
203
|
+
processManager: ProcessManagerPatternConfig;
|
|
204
|
+
surfaces?: CLISurfaceTarget[];
|
|
205
|
+
internal?: boolean;
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
export interface CLIConfigNamespaceGroupDescriptor extends RuntimeDescriptor {
|
|
209
|
+
kind: 'cli/group';
|
|
210
|
+
name: string;
|
|
211
|
+
description: string;
|
|
212
|
+
parent?: string;
|
|
213
|
+
pattern: 'config-namespace';
|
|
214
|
+
target?: PatternTarget;
|
|
215
|
+
configNamespace: ConfigNamespacePatternConfig;
|
|
216
|
+
surfaces?: CLISurfaceTarget[];
|
|
217
|
+
internal?: boolean;
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
export type CLIPatternDescriptor =
|
|
221
|
+
| CLICRUDGroupDescriptor
|
|
222
|
+
| CLIToolWrapperCommandDescriptor
|
|
223
|
+
| CLILogViewerGroupDescriptor
|
|
224
|
+
| CLIProcessManagerGroupDescriptor
|
|
225
|
+
| CLIConfigNamespaceGroupDescriptor;
|
|
@@ -0,0 +1,224 @@
|
|
|
1
|
+
import YAML from 'yaml';
|
|
2
|
+
import { createInterface } from 'node:readline/promises';
|
|
3
|
+
import { stdin as input, stdout as output } from 'node:process';
|
|
4
|
+
|
|
5
|
+
function isInteractive(): boolean {
|
|
6
|
+
return Boolean(process.stdin.isTTY && process.stdout.isTTY);
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
function writeOut(message: string): void {
|
|
10
|
+
process.stdout.write(`${message}\n`);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
function writeErr(message: string): void {
|
|
14
|
+
process.stderr.write(`${message}\n`);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export class VibesUIToolkit {
|
|
18
|
+
private format: 'json' | 'yaml' | 'table' | 'markdown' = 'table';
|
|
19
|
+
|
|
20
|
+
constructor(_options: { mode?: 'rich' | 'plain'; compact?: boolean; autoExit?: boolean } = {}) {}
|
|
21
|
+
|
|
22
|
+
static createSync(
|
|
23
|
+
options: { mode?: 'rich' | 'plain'; compact?: boolean; autoExit?: boolean } = {}
|
|
24
|
+
): VibesUIToolkit {
|
|
25
|
+
return new VibesUIToolkit(options);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
setFormat(format: 'json' | 'yaml' | 'table' | 'markdown'): void {
|
|
29
|
+
this.format = format;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
info(message: string): void {
|
|
33
|
+
writeOut(message);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
success(message: string): void {
|
|
37
|
+
writeOut(message);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
warn(message: string): void {
|
|
41
|
+
writeErr(message);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
warning(message: string): void {
|
|
45
|
+
this.warn(message);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
error(message: string): void {
|
|
49
|
+
writeErr(message);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
log(message: string): void {
|
|
53
|
+
writeOut(message);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
async prompt(message: string, options: { default?: string } = {}): Promise<string | null> {
|
|
57
|
+
if (!isInteractive()) {
|
|
58
|
+
return options.default ?? null;
|
|
59
|
+
}
|
|
60
|
+
const rl = createInterface({ input, output });
|
|
61
|
+
try {
|
|
62
|
+
const suffix = options.default ? ` [${options.default}]` : '';
|
|
63
|
+
const answer = await rl.question(`${message}${suffix}: `);
|
|
64
|
+
const trimmed = answer.trim();
|
|
65
|
+
if (trimmed.length > 0) {
|
|
66
|
+
return trimmed;
|
|
67
|
+
}
|
|
68
|
+
return options.default ?? null;
|
|
69
|
+
} finally {
|
|
70
|
+
rl.close();
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
async confirm(
|
|
75
|
+
message: string | { message: string; defaultValue?: boolean },
|
|
76
|
+
defaultValue = false
|
|
77
|
+
): Promise<boolean> {
|
|
78
|
+
const promptText = typeof message === 'string' ? message : message.message;
|
|
79
|
+
const initial =
|
|
80
|
+
typeof message === 'string' ? defaultValue : (message.defaultValue ?? defaultValue);
|
|
81
|
+
const response = await this.prompt(`${promptText} [y/N]`, { default: initial ? 'y' : 'n' });
|
|
82
|
+
return response?.toLowerCase().startsWith('y') ?? initial;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
async select<T>(
|
|
86
|
+
message: string,
|
|
87
|
+
options: Array<{ label: string; value: T }>,
|
|
88
|
+
defaultValue?: T
|
|
89
|
+
): Promise<T | null> {
|
|
90
|
+
if (options.length === 0) {
|
|
91
|
+
return null;
|
|
92
|
+
}
|
|
93
|
+
if (!isInteractive()) {
|
|
94
|
+
return defaultValue ?? options[0]?.value ?? null;
|
|
95
|
+
}
|
|
96
|
+
this.info(message);
|
|
97
|
+
options.forEach((option, index) => this.info(`${index + 1}. ${option.label}`));
|
|
98
|
+
const response = await this.prompt('Select option number', { default: '1' });
|
|
99
|
+
const index = Math.max(1, Number(response || '1')) - 1;
|
|
100
|
+
return options[index]?.value ?? defaultValue ?? null;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
async multiselect<T>(
|
|
104
|
+
message: string,
|
|
105
|
+
options: Array<{ label: string; value: T }>,
|
|
106
|
+
required = false
|
|
107
|
+
): Promise<T[]> {
|
|
108
|
+
if (options.length === 0) {
|
|
109
|
+
return [];
|
|
110
|
+
}
|
|
111
|
+
if (!isInteractive()) {
|
|
112
|
+
return required ? [options[0].value] : [];
|
|
113
|
+
}
|
|
114
|
+
this.info(message);
|
|
115
|
+
options.forEach((option, index) => this.info(`${index + 1}. ${option.label}`));
|
|
116
|
+
const response = await this.prompt('Select comma-separated option numbers');
|
|
117
|
+
if (!response) {
|
|
118
|
+
return required ? [options[0].value] : [];
|
|
119
|
+
}
|
|
120
|
+
const values = response
|
|
121
|
+
.split(',')
|
|
122
|
+
.map((part) => Number(part.trim()) - 1)
|
|
123
|
+
.filter((index) => Number.isInteger(index) && index >= 0 && index < options.length)
|
|
124
|
+
.map((index) => options[index].value);
|
|
125
|
+
return values.length > 0 || !required ? values : [options[0].value];
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
table(data: unknown[], options?: { columns?: string[] } | string | string[]): void {
|
|
129
|
+
if (this.format === 'json') return this.json(data);
|
|
130
|
+
if (this.format === 'yaml') return this.yaml(data);
|
|
131
|
+
const normalized = Array.isArray(options)
|
|
132
|
+
? { columns: options }
|
|
133
|
+
: typeof options === 'string'
|
|
134
|
+
? { title: options }
|
|
135
|
+
: options;
|
|
136
|
+
if (normalized && 'title' in normalized && normalized.title) writeOut(normalized.title);
|
|
137
|
+
if (
|
|
138
|
+
Array.isArray(data) &&
|
|
139
|
+
normalized &&
|
|
140
|
+
'columns' in normalized &&
|
|
141
|
+
normalized.columns?.length
|
|
142
|
+
) {
|
|
143
|
+
const rows = data.map((row) =>
|
|
144
|
+
!row || typeof row !== 'object'
|
|
145
|
+
? row
|
|
146
|
+
: Object.fromEntries(
|
|
147
|
+
normalized.columns!.map((column) => [
|
|
148
|
+
column,
|
|
149
|
+
(row as Record<string, unknown>)[column]
|
|
150
|
+
])
|
|
151
|
+
)
|
|
152
|
+
);
|
|
153
|
+
console.table(rows);
|
|
154
|
+
return;
|
|
155
|
+
}
|
|
156
|
+
console.table(data);
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
json(data: unknown): void {
|
|
160
|
+
writeOut(JSON.stringify(data, null, 2));
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
yaml(data: unknown): void {
|
|
164
|
+
writeOut(YAML.stringify(data));
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
keyValue(data: Record<string, unknown>): void {
|
|
168
|
+
this.table(Object.entries(data).map(([key, value]) => ({ key, value })));
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
/**
|
|
172
|
+
* Render a value in a caller-selected format. Convenience over `json`/`yaml`/
|
|
173
|
+
* `table` for command impls that defer format to an `--output` flag.
|
|
174
|
+
*/
|
|
175
|
+
render(
|
|
176
|
+
data: unknown,
|
|
177
|
+
options: { format?: 'json' | 'yaml' | 'table' | 'markdown' | 'text' } = {}
|
|
178
|
+
): void {
|
|
179
|
+
const format = options.format ?? this.format;
|
|
180
|
+
switch (format) {
|
|
181
|
+
case 'json':
|
|
182
|
+
this.json(data);
|
|
183
|
+
return;
|
|
184
|
+
case 'yaml':
|
|
185
|
+
this.yaml(data);
|
|
186
|
+
return;
|
|
187
|
+
case 'table':
|
|
188
|
+
this.table(Array.isArray(data) ? data : [data]);
|
|
189
|
+
return;
|
|
190
|
+
case 'markdown':
|
|
191
|
+
case 'text':
|
|
192
|
+
default:
|
|
193
|
+
writeOut(typeof data === 'string' ? data : JSON.stringify(data, null, 2));
|
|
194
|
+
return;
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
progress(message?: string): {
|
|
199
|
+
update: (nextMessage?: string) => void;
|
|
200
|
+
complete: (nextMessage?: string) => void;
|
|
201
|
+
fail: (nextMessage?: string) => void;
|
|
202
|
+
} {
|
|
203
|
+
if (message) writeOut(message);
|
|
204
|
+
return {
|
|
205
|
+
update: (nextMessage?: string) => nextMessage && writeOut(nextMessage),
|
|
206
|
+
complete: (nextMessage?: string) => nextMessage && writeOut(nextMessage),
|
|
207
|
+
fail: (nextMessage?: string) => nextMessage && writeErr(nextMessage)
|
|
208
|
+
};
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
async withCommand<T>(
|
|
212
|
+
_command: { name?: string; description?: string },
|
|
213
|
+
handler: (toolkit: VibesUIToolkit) => Promise<T> | T
|
|
214
|
+
): Promise<T> {
|
|
215
|
+
return await handler(this);
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
async withInteractiveCommand<T>(
|
|
219
|
+
command: { name?: string; description?: string },
|
|
220
|
+
handler: (toolkit: VibesUIToolkit) => Promise<T> | T
|
|
221
|
+
): Promise<T> {
|
|
222
|
+
return this.withCommand(command, handler);
|
|
223
|
+
}
|
|
224
|
+
}
|