@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,197 @@
|
|
|
1
|
+
import { Option } from 'commander';
|
|
2
|
+
import { isPatternDescriptor } from '../patterns/schemas';
|
|
3
|
+
import { allowedRootFallbackGroups, findScopeMissingGroups, findUnexpectedMissingGroups } from './command-group-policy';
|
|
4
|
+
import { attachTuiAction } from './attach-tui-action';
|
|
5
|
+
import { getLogger } from '../logging';
|
|
6
|
+
import { getCLIDiscovery } from './discovery-cache';
|
|
7
|
+
const logger = getLogger('surface').child('register-commands');
|
|
8
|
+
export async function registerCommands(params) {
|
|
9
|
+
const { runtime, options } = params;
|
|
10
|
+
const { verbose } = options;
|
|
11
|
+
const discovery = getCLIDiscovery(runtime, options);
|
|
12
|
+
const commands = discovery.commands;
|
|
13
|
+
if (verbose)
|
|
14
|
+
logger.debug(`Discovered ${commands.length} commands`);
|
|
15
|
+
const sorted = discovery.sortedCommands;
|
|
16
|
+
const rootFallbackGroups = allowedRootFallbackGroups(options);
|
|
17
|
+
const registeredGroupIds = new Set(params.groups.keys());
|
|
18
|
+
const declaredGroupIds = new Set(discovery.allGroups.map((descriptor) => descriptor.id));
|
|
19
|
+
const scopeMissingGroups = findScopeMissingGroups(sorted, registeredGroupIds, declaredGroupIds, rootFallbackGroups);
|
|
20
|
+
const missingGroups = findUnexpectedMissingGroups(sorted, declaredGroupIds, rootFallbackGroups);
|
|
21
|
+
if (missingGroups.size > 0) {
|
|
22
|
+
const message = [
|
|
23
|
+
'[CLI] Command descriptors reference unknown groups:',
|
|
24
|
+
...Array.from(missingGroups.entries()).map(([groupId, commandIds]) => ` - ${groupId}: ${commandIds.join(', ')}`)
|
|
25
|
+
].join('\n');
|
|
26
|
+
if (options.strictCommandGroups ?? true)
|
|
27
|
+
throw new Error(message);
|
|
28
|
+
if (verbose)
|
|
29
|
+
logger.warn(message);
|
|
30
|
+
}
|
|
31
|
+
const skippedByScope = new Set(scopeMissingGroups.keys());
|
|
32
|
+
if (verbose && skippedByScope.size > 0) {
|
|
33
|
+
const message = [
|
|
34
|
+
'[CLI] Skipping commands because their groups are not registered in this scope:',
|
|
35
|
+
...Array.from(scopeMissingGroups.entries()).map(([groupId, commandIds]) => ` - ${groupId}: ${commandIds.join(', ')}`)
|
|
36
|
+
].join('\n');
|
|
37
|
+
logger.warn(message);
|
|
38
|
+
}
|
|
39
|
+
const scopedCommands = sorted.filter((command) => !skippedByScope.has(command.group));
|
|
40
|
+
for (const command of scopedCommands)
|
|
41
|
+
await registerCommand(params, command, rootFallbackGroups);
|
|
42
|
+
}
|
|
43
|
+
async function registerCommand(params, descriptor, rootFallbackGroups) {
|
|
44
|
+
const { runtime, options } = params;
|
|
45
|
+
const { verbose } = options;
|
|
46
|
+
const groupParent = params.groups.get(descriptor.group);
|
|
47
|
+
const parent = groupParent ??
|
|
48
|
+
(rootFallbackGroups.has(descriptor.group) || !(options.strictCommandGroups ?? true)
|
|
49
|
+
? params.program
|
|
50
|
+
: null);
|
|
51
|
+
if (!parent) {
|
|
52
|
+
throw new Error(`[CLI] Missing group '${descriptor.group}' for command '${descriptor.id}'. Add a cli/group descriptor or explicitly allow root fallback.`);
|
|
53
|
+
}
|
|
54
|
+
if (!groupParent && verbose) {
|
|
55
|
+
const message = `[CLI] Command '${descriptor.id}' registered at root via fallback group '${descriptor.group}'.`;
|
|
56
|
+
if (rootFallbackGroups.has(descriptor.group)) {
|
|
57
|
+
logger.debug(message);
|
|
58
|
+
}
|
|
59
|
+
else {
|
|
60
|
+
logger.warn(message);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
if (params.patternResolver && isPatternDescriptor(descriptor)) {
|
|
64
|
+
const ctx = await params.buildContext();
|
|
65
|
+
await params.patternResolver.resolve(descriptor, parent, ctx);
|
|
66
|
+
if (verbose) {
|
|
67
|
+
logger.debug(`Pattern '${descriptor.pattern}' applied to: ${descriptor.id}`);
|
|
68
|
+
}
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
const cmd = parent.command(descriptor.name).description(descriptor.description);
|
|
72
|
+
if (descriptor.arguments) {
|
|
73
|
+
for (const arg of descriptor.arguments) {
|
|
74
|
+
const variadic = arg.variadic ? '...' : '';
|
|
75
|
+
const spec = arg.required ? `<${arg.name}${variadic}>` : `[${arg.name}${variadic}]`;
|
|
76
|
+
cmd.argument(spec, arg.description, arg.default);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
if (descriptor.options) {
|
|
80
|
+
for (const opt of descriptor.options) {
|
|
81
|
+
const option = new Option(opt.flags, opt.description);
|
|
82
|
+
if (opt.choices)
|
|
83
|
+
option.choices(opt.choices);
|
|
84
|
+
if (opt.type === 'number') {
|
|
85
|
+
option.argParser((value) => {
|
|
86
|
+
const n = Number(value);
|
|
87
|
+
if (Number.isNaN(n)) {
|
|
88
|
+
throw new Error(`Expected a number for ${opt.flags}, got: ${value}`);
|
|
89
|
+
}
|
|
90
|
+
return n;
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
if (opt.default !== undefined)
|
|
94
|
+
option.default(coerceDefault(opt.default, opt.type));
|
|
95
|
+
cmd.addOption(option);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
if (descriptor.aliases)
|
|
99
|
+
for (const alias of descriptor.aliases)
|
|
100
|
+
cmd.alias(alias);
|
|
101
|
+
const groupDescriptor = params.groupDescriptors.get(descriptor.group);
|
|
102
|
+
const logBuffer = resolveLogBufferBehavior(descriptor, groupDescriptor);
|
|
103
|
+
if (descriptor.tuiAppId) {
|
|
104
|
+
await attachTuiAction(cmd, runtime, descriptor, {
|
|
105
|
+
beforeExecute: async ({ args, options: commandOptions }) => {
|
|
106
|
+
await emitCommandExecutionStart(params.options, {
|
|
107
|
+
command: descriptor,
|
|
108
|
+
group: groupDescriptor,
|
|
109
|
+
args,
|
|
110
|
+
options: commandOptions,
|
|
111
|
+
logBuffer
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
});
|
|
115
|
+
if (verbose)
|
|
116
|
+
logger.debug(`Command (tui/app: ${descriptor.tuiAppId}): ${descriptor.id}`);
|
|
117
|
+
return;
|
|
118
|
+
}
|
|
119
|
+
cmd.action(async (...args) => {
|
|
120
|
+
args.pop();
|
|
121
|
+
const cmdOptions = args.pop();
|
|
122
|
+
const positionalArgs = {};
|
|
123
|
+
if (descriptor.arguments) {
|
|
124
|
+
descriptor.arguments.forEach((arg, i) => {
|
|
125
|
+
if (i < args.length)
|
|
126
|
+
positionalArgs[arg.name] = args[i];
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
await emitCommandExecutionStart(params.options, {
|
|
130
|
+
command: descriptor,
|
|
131
|
+
group: groupDescriptor,
|
|
132
|
+
args: positionalArgs,
|
|
133
|
+
options: cmdOptions,
|
|
134
|
+
logBuffer
|
|
135
|
+
});
|
|
136
|
+
const impl = await resolveCommandImpl(runtime, descriptor, verbose);
|
|
137
|
+
if (!impl) {
|
|
138
|
+
throw new Error(`[CLI] Command '${descriptor.id}' is registered but has no resolvable implementation in this runtime scope.`);
|
|
139
|
+
}
|
|
140
|
+
await impl.execute(positionalArgs, cmdOptions);
|
|
141
|
+
});
|
|
142
|
+
if (verbose)
|
|
143
|
+
logger.debug(`Command: ${descriptor.id}`);
|
|
144
|
+
}
|
|
145
|
+
async function resolveCommandImpl(runtime, descriptor, verbose) {
|
|
146
|
+
try {
|
|
147
|
+
const impl = (await runtime.query('cli/command').withId(descriptor.id).resolve());
|
|
148
|
+
if (!impl || typeof impl.execute !== 'function') {
|
|
149
|
+
if (verbose)
|
|
150
|
+
logger.warn(`Invalid implementation for: ${descriptor.id}`);
|
|
151
|
+
return null;
|
|
152
|
+
}
|
|
153
|
+
return { execute: impl.execute.bind(impl) };
|
|
154
|
+
}
|
|
155
|
+
catch {
|
|
156
|
+
if (verbose)
|
|
157
|
+
logger.warn(`No implementation for: ${descriptor.id}`);
|
|
158
|
+
return null;
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
function resolveLogBufferBehavior(command, group) {
|
|
162
|
+
const groupBehavior = group?.logBuffer;
|
|
163
|
+
const commandBehavior = command.logBuffer;
|
|
164
|
+
if (!groupBehavior && !commandBehavior) {
|
|
165
|
+
if (command.tuiAppId) {
|
|
166
|
+
return {
|
|
167
|
+
enabled: true,
|
|
168
|
+
sinks: ['stdout'],
|
|
169
|
+
fallbackToStdout: true
|
|
170
|
+
};
|
|
171
|
+
}
|
|
172
|
+
return null;
|
|
173
|
+
}
|
|
174
|
+
const merged = {
|
|
175
|
+
enabled: commandBehavior?.enabled ?? groupBehavior?.enabled ?? true,
|
|
176
|
+
sinks: commandBehavior?.sinks ?? groupBehavior?.sinks,
|
|
177
|
+
fallbackToStdout: commandBehavior?.fallbackToStdout ?? groupBehavior?.fallbackToStdout ?? true
|
|
178
|
+
};
|
|
179
|
+
if (!merged.enabled)
|
|
180
|
+
return null;
|
|
181
|
+
if (command.tuiAppId && (!merged.sinks || merged.sinks.length === 0)) {
|
|
182
|
+
merged.sinks = ['stdout'];
|
|
183
|
+
}
|
|
184
|
+
return merged;
|
|
185
|
+
}
|
|
186
|
+
function coerceDefault(value, type) {
|
|
187
|
+
if (type !== 'number' || typeof value !== 'string')
|
|
188
|
+
return value;
|
|
189
|
+
const n = Number(value);
|
|
190
|
+
return Number.isNaN(n) ? value : n;
|
|
191
|
+
}
|
|
192
|
+
async function emitCommandExecutionStart(options, info) {
|
|
193
|
+
if (!options.onCommandExecutionStart)
|
|
194
|
+
return;
|
|
195
|
+
await options.onCommandExecutionStart(info);
|
|
196
|
+
}
|
|
197
|
+
//# sourceMappingURL=register-commands.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"register-commands.js","sourceRoot":"","sources":["../../src/surface/register-commands.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAQnC,OAAO,EAAE,mBAAmB,EAA6B,MAAM,qBAAqB,CAAC;AAMrF,OAAO,EACN,yBAAyB,EACzB,sBAAsB,EACtB,2BAA2B,EAC3B,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AACvC,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEpD,MAAM,MAAM,GAAG,SAAS,CAAC,SAAS,CAAC,CAAC,KAAK,CAAC,mBAAmB,CAAC,CAAC;AAE/D,MAAM,CAAC,KAAK,UAAU,gBAAgB,CAAC,MAQtC;IACA,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,GAAG,MAAM,CAAC;IACpC,MAAM,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC;IAC5B,MAAM,SAAS,GAAG,eAAe,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;IACpD,MAAM,QAAQ,GAAG,SAAS,CAAC,QAAQ,CAAC;IAEpC,IAAI,OAAO;QAAE,MAAM,CAAC,KAAK,CAAC,cAAc,QAAQ,CAAC,MAAM,WAAW,CAAC,CA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AAC,IAAI,CAAC,CAAC;AAC7C,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { Command } from 'commander';
|
|
2
|
+
import type { VibesRuntime } from '@vibesdotdev/runtime/api/runtime';
|
|
3
|
+
import type { PatternResolver } from '../patterns';
|
|
4
|
+
import type { CLIGroupAssetDescriptor } from '../schemas/descriptors';
|
|
5
|
+
import type { CLISurfaceOptions, CommandContext } from '../schemas/surface';
|
|
6
|
+
export declare function registerGroups(params: {
|
|
7
|
+
runtime: VibesRuntime;
|
|
8
|
+
program: Command;
|
|
9
|
+
groups: Map<string, Command>;
|
|
10
|
+
groupDescriptors: Map<string, CLIGroupAssetDescriptor>;
|
|
11
|
+
options: CLISurfaceOptions;
|
|
12
|
+
patternResolver: PatternResolver | null;
|
|
13
|
+
buildContext: () => Promise<CommandContext>;
|
|
14
|
+
}): Promise<void>;
|
|
15
|
+
//# sourceMappingURL=register-groups.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"register-groups.d.ts","sourceRoot":"","sources":["../../src/surface/register-groups.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAC;AACrE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAEnD,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,wBAAwB,CAAC;AACtE,OAAO,KAAK,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAM5E,wBAAsB,cAAc,CAAC,MAAM,EAAE;IAC5C,OAAO,EAAE,YAAY,CAAC;IACtB,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC7B,gBAAgB,EAAE,GAAG,CAAC,MAAM,EAAE,uBAAuB,CAAC,CAAC;IACvD,OAAO,EAAE,iBAAiB,CAAC;IAC3B,eAAe,EAAE,eAAe,GAAG,IAAI,CAAC;IACxC,YAAY,EAAE,MAAM,OAAO,CAAC,cAAc,CAAC,CAAC;CAC5C,GAAG,OAAO,CAAC,IAAI,CAAC,CAahB"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { isPatternDescriptor } from '../patterns/schemas.js';
|
|
2
|
+
import { getLogger } from '../logging.js';
|
|
3
|
+
import { getCLIDiscovery } from './discovery-cache.js';
|
|
4
|
+
const logger = getLogger('surface').child('register-groups');
|
|
5
|
+
export async function registerGroups(params) {
|
|
6
|
+
const { runtime, options } = params;
|
|
7
|
+
const { verbose } = options;
|
|
8
|
+
const discovery = getCLIDiscovery(runtime, options);
|
|
9
|
+
const groups = discovery.groups;
|
|
10
|
+
if (verbose) {
|
|
11
|
+
logger.debug(`Discovered ${groups.length} groups`);
|
|
12
|
+
}
|
|
13
|
+
for (const group of discovery.sortedGroups) {
|
|
14
|
+
await registerGroup(params, group);
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
async function registerGroup(params, descriptor) {
|
|
18
|
+
const { verbose } = params.options;
|
|
19
|
+
let parent = params.program;
|
|
20
|
+
if (descriptor.parent) {
|
|
21
|
+
const parentGroup = params.groups.get(descriptor.parent);
|
|
22
|
+
if (!parentGroup) {
|
|
23
|
+
const message = `[CLI] Group '${descriptor.id}' references missing parent '${descriptor.parent}'.`;
|
|
24
|
+
if (params.options.strictGroupParents === true)
|
|
25
|
+
throw new Error(message);
|
|
26
|
+
if (verbose)
|
|
27
|
+
logger.warn(message);
|
|
28
|
+
}
|
|
29
|
+
else {
|
|
30
|
+
parent = parentGroup;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
const groupCmd = parent.command(descriptor.name).description(descriptor.description);
|
|
34
|
+
if (descriptor.aliases) {
|
|
35
|
+
for (const alias of descriptor.aliases) {
|
|
36
|
+
groupCmd.alias(alias);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
params.groups.set(descriptor.id, groupCmd);
|
|
40
|
+
params.groupDescriptors.set(descriptor.id, descriptor);
|
|
41
|
+
if (verbose) {
|
|
42
|
+
logger.debug(`Group: ${descriptor.id}`);
|
|
43
|
+
}
|
|
44
|
+
if (params.patternResolver && isPatternDescriptor(descriptor)) {
|
|
45
|
+
const ctx = await params.buildContext();
|
|
46
|
+
await params.patternResolver.resolve(descriptor, groupCmd, ctx);
|
|
47
|
+
if (verbose) {
|
|
48
|
+
logger.debug(`Pattern '${descriptor.pattern}' applied to: ${descriptor.id}`);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
//# sourceMappingURL=register-groups.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"register-groups.js","sourceRoot":"","sources":["../../src/surface/register-groups.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,mBAAmB,EAA6B,MAAM,qBAAqB,CAAC;AAGrF,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AACvC,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEpD,MAAM,MAAM,GAAG,SAAS,CAAC,SAAS,CAAC,CAAC,KAAK,CAAC,iBAAiB,CAAC,CAAC;AAE7D,MAAM,CAAC,KAAK,UAAU,cAAc,CAAC,MAQpC;IACA,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,GAAG,MAAM,CAAC;IACpC,MAAM,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC;IAC5B,MAAM,SAAS,GAAG,eAAe,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;IACpD,MAAM,MAAM,GAAG,SAAS,CAAC,MAAM,CAAC;IAEhC,IAAI,OAAO,EAAE,CAAC;QACb,MAAM,CAAC,KAAK,CAAC,cAAc,MAAM,CAAC,MAAM,SAAS,CAAC,CAAC;IACpD,CAAC;IAED,KAAK,MAAM,KAAK,IAAI,SAAS,CAAC,YAAY,EAAE,CAAC;QAC5C,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C;QACb,MAAM,CAAC,KAAK,CAAC,UAAU,UAAU,CAAC,EAAE,EAAE,CAAC,CAAC;IACzC,CAAC;IAED,IAAI,MAAM,CAAC,eAAe,IAAI,mBAAmB,CAAC,UAAU,CAAC,EAAE,CAAC;QAC/D,MAAM,GAAG,GAAG,MAAM,MAAM,CAAC,YAAY,EAAE,CAAC;QACxC,MAAM,MAAM,CAAC,eAAe,CAAC,OAAO,CAAC,UAAkC,EAAE,QAAQ,EAAE,GAAG,CAAC,CAAC;QAExF,IAAI,OAAO,EAAE,CAAC;YACb,MAAM,CAAC,KAAK,CACX,YAAa,UAAmC,CAAC,OAAO,iBAAiB,UAAU,CAAC,EAAE,EAAE,CACxF,CAAC;QACH,CAAC;IACF,CAAC;AACF,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CLI Surface
|
|
3
|
+
*
|
|
4
|
+
* The Commander.js integration for the universal runtime.
|
|
5
|
+
* Discovers cli/group and cli/command descriptors and builds a command tree.
|
|
6
|
+
*/
|
|
7
|
+
export { CLISurface } from './surface/CLISurface';
|
|
8
|
+
export type { CLISurfaceOptions, CommandContext } from './schemas/surface';
|
|
9
|
+
//# sourceMappingURL=surface.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"surface.d.ts","sourceRoot":"","sources":["../src/surface.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAClD,YAAY,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC"}
|
package/dist/surface.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"surface.js","sourceRoot":"","sources":["../src/surface.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC"}
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AACjD,YAAY,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAChE,YAAY,EAAE,SAAS,IAAI,SAAS,EAAE,MAAM,gBAAgB,CAAC"}
|
package/dist/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/ui/schemas/types.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,SAAS,IAAI,SAAS,EAAE,MAAM,oBAAoB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/ui/schemas/types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"VibesUIToolkit.d.ts","sourceRoot":"","sources":["../../../src/ui/toolkit/VibesUIToolkit.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"VibesUIToolkit.js","sourceRoot":"","sources":["../../../src/ui/toolkit/VibesUIToolkit.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CLI UI Context Descriptor
|
|
3
|
+
*
|
|
4
|
+
* Provides UI toolkit for terminal output (CLI surface only).
|
|
5
|
+
*/
|
|
6
|
+
declare const _default: {
|
|
7
|
+
id: string;
|
|
8
|
+
kind: "context";
|
|
9
|
+
name?: string | undefined;
|
|
10
|
+
description?: string | undefined;
|
|
11
|
+
tags?: string[] | undefined;
|
|
12
|
+
hardware?: string[] | undefined;
|
|
13
|
+
enabled?: boolean | undefined;
|
|
14
|
+
priority?: number | undefined;
|
|
15
|
+
requiredContext?: string[] | undefined;
|
|
16
|
+
optionalContext?: string[] | undefined;
|
|
17
|
+
config?: Record<string, unknown> | undefined;
|
|
18
|
+
valueSchema?: unknown;
|
|
19
|
+
};
|
|
20
|
+
export default _default;
|
|
21
|
+
//# sourceMappingURL=ui.context.descriptor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ui.context.descriptor.d.ts","sourceRoot":"","sources":["../src/ui.context.descriptor.ts"],"names":[],"mappings":"AAAA;;;;GAIG;;;;;;;;;;;;;;;AAIH,wBAIG"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CLI UI Context Descriptor
|
|
3
|
+
*
|
|
4
|
+
* Provides UI toolkit for terminal output (CLI surface only).
|
|
5
|
+
*/
|
|
6
|
+
import { createContextDescriptor } from '@vibesdotdev/runtime/factory/context';
|
|
7
|
+
export default createContextDescriptor({
|
|
8
|
+
id: 'cli/ui',
|
|
9
|
+
description: 'UI toolkit for terminal output and user interaction.',
|
|
10
|
+
hardware: ['consumer']
|
|
11
|
+
});
|
|
12
|
+
//# sourceMappingURL=ui.context.descriptor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ui.context.descriptor.js","sourceRoot":"","sources":["../src/ui.context.descriptor.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,uBAAuB,EAAE,MAAM,sCAAsC,CAAC;AAE/E,eAAe,uBAAuB,CAAC;IACtC,EAAE,EAAE,QAAQ;IACZ,WAAW,EAAE,sDAAsD;IACnE,QAAQ,EAAE,CAAC,UAAU,CAAC;CACtB,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"open.d.ts","sourceRoot":"","sources":["../../src/utils/open.ts"],"names":[],"mappings":"AAkBA,wBAAsB,IAAI,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAiBrD"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { spawn } from 'bun';
|
|
2
|
+
const ALLOWED_SCHEMES = new Set(['http:', 'https:']);
|
|
3
|
+
function validateUrl(url) {
|
|
4
|
+
let parsed;
|
|
5
|
+
try {
|
|
6
|
+
parsed = new URL(url);
|
|
7
|
+
}
|
|
8
|
+
catch {
|
|
9
|
+
throw new Error(`Invalid URL: ${url}`);
|
|
10
|
+
}
|
|
11
|
+
if (!ALLOWED_SCHEMES.has(parsed.protocol)) {
|
|
12
|
+
throw new Error(`URL scheme not allowed: ${parsed.protocol}. Only http:// and https:// are permitted.`);
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
export async function open(url) {
|
|
16
|
+
validateUrl(url);
|
|
17
|
+
const platform = process.platform;
|
|
18
|
+
const command = platform === 'darwin' ? 'open' : platform === 'win32' ? 'start' : 'xdg-open';
|
|
19
|
+
const proc = spawn({
|
|
20
|
+
cmd: [command, url],
|
|
21
|
+
stdout: 'ignore',
|
|
22
|
+
stderr: 'pipe'
|
|
23
|
+
});
|
|
24
|
+
const exitCode = await proc.exited;
|
|
25
|
+
if (exitCode !== 0) {
|
|
26
|
+
const stderr = await new Response(proc.stderr).text();
|
|
27
|
+
throw new Error(`Failed to open browser: ${stderr.trim() || `exit code ${exitCode}`}`);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=open.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"open.js","sourceRoot":"","sources":["../../src/utils/open.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,KAAK,CAAC;AAE5B,MAAM,eAAe,GAAG,IAAI,GAAG,CAAC,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC,CAAC;AAErD,SA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ourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":"AAQA,eAAO,MAAM,aAAa,EAAE,MACsC,CAAC"}
|
package/dist/version.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"version.js","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":"AAQA,MAAM,CAAC,MAAM,aAAa,GACzB,OAAO,iBAAiB,KAAK,QAAQ,CAAC,CAAC,CAAC,iBAAiB,CAAC,CAAC,CAAC,KAAK,CAAC"}
|