@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,251 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Config Namespace Pattern Implementation
|
|
3
|
+
*
|
|
4
|
+
* Generates get/set/reset/list commands for a config namespace.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import type { Command } from 'commander';
|
|
8
|
+
import type { VibesRuntime } from '@vibesdotdev/runtime/api/runtime';
|
|
9
|
+
import type { CLIConfigNamespaceGroupDescriptor } from './schemas';
|
|
10
|
+
import type { PatternImplementation } from './pattern-types';
|
|
11
|
+
import type { CommandContext } from '../schemas/surface';
|
|
12
|
+
import type { ConfigContext } from '../providers';
|
|
13
|
+
|
|
14
|
+
function isConfigContext(value: unknown): value is ConfigContext {
|
|
15
|
+
return (
|
|
16
|
+
!!value &&
|
|
17
|
+
typeof value === 'object' &&
|
|
18
|
+
'get' in value &&
|
|
19
|
+
typeof value.get === 'function' &&
|
|
20
|
+
'set' in value &&
|
|
21
|
+
typeof value.set === 'function' &&
|
|
22
|
+
'getNamespace' in value &&
|
|
23
|
+
typeof value.getNamespace === 'function' &&
|
|
24
|
+
'delete' in value &&
|
|
25
|
+
typeof value.delete === 'function'
|
|
26
|
+
);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export class ConfigNamespacePatternImpl implements PatternImplementation<CLIConfigNamespaceGroupDescriptor> {
|
|
30
|
+
constructor(private runtime: VibesRuntime) {}
|
|
31
|
+
|
|
32
|
+
async register(
|
|
33
|
+
descriptor: CLIConfigNamespaceGroupDescriptor,
|
|
34
|
+
parent: Command,
|
|
35
|
+
context: CommandContext
|
|
36
|
+
): Promise<void> {
|
|
37
|
+
const { name, description, configNamespace } = descriptor;
|
|
38
|
+
const cmds = configNamespace.commands ?? {};
|
|
39
|
+
|
|
40
|
+
const groupCmd = parent.command(name).description(description);
|
|
41
|
+
|
|
42
|
+
if (cmds.get !== false) this.registerGet(groupCmd, descriptor, context);
|
|
43
|
+
if (cmds.set !== false) this.registerSet(groupCmd, descriptor, context);
|
|
44
|
+
if (cmds.reset !== false) this.registerReset(groupCmd, descriptor, context);
|
|
45
|
+
this.registerList(groupCmd, descriptor, context);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
private async getConfigService(ctx: CommandContext): Promise<ConfigContext | null> {
|
|
49
|
+
if (isConfigContext(ctx.config)) return ctx.config;
|
|
50
|
+
|
|
51
|
+
try {
|
|
52
|
+
const config = await this.runtime.context<ConfigContext>('config/context');
|
|
53
|
+
return isConfigContext(config) ? config : null;
|
|
54
|
+
} catch {
|
|
55
|
+
return null;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
private registerGet(
|
|
60
|
+
parent: Command,
|
|
61
|
+
d: CLIConfigNamespaceGroupDescriptor,
|
|
62
|
+
ctx: CommandContext
|
|
63
|
+
): void {
|
|
64
|
+
const ns = d.configNamespace.namespace;
|
|
65
|
+
|
|
66
|
+
parent
|
|
67
|
+
.command('get [key]')
|
|
68
|
+
.description(`Get config value(s) for ${ns}`)
|
|
69
|
+
.option('-f, --format <format>', 'Output format', 'yaml')
|
|
70
|
+
.action(async (key: string | undefined, opts) => {
|
|
71
|
+
const svc = await this.getConfigService(ctx);
|
|
72
|
+
if (!svc) {
|
|
73
|
+
ctx.ui?.error('Config service not available');
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
if (key) {
|
|
78
|
+
const val = await svc.get(`${ns}.${key}`);
|
|
79
|
+
if (val === undefined) {
|
|
80
|
+
ctx.ui?.warn(`Not found: ${ns}.${key}`);
|
|
81
|
+
return;
|
|
82
|
+
}
|
|
83
|
+
this.output(val, opts.format, ctx);
|
|
84
|
+
} else {
|
|
85
|
+
const vals = await svc.getNamespace(ns);
|
|
86
|
+
this.output(vals, opts.format, ctx);
|
|
87
|
+
}
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
private registerSet(
|
|
92
|
+
parent: Command,
|
|
93
|
+
d: CLIConfigNamespaceGroupDescriptor,
|
|
94
|
+
ctx: CommandContext
|
|
95
|
+
): void {
|
|
96
|
+
const ns = d.configNamespace.namespace;
|
|
97
|
+
|
|
98
|
+
parent
|
|
99
|
+
.command('set <key> <value>')
|
|
100
|
+
.description(`Set config value for ${ns}`)
|
|
101
|
+
.option('--json', 'Parse value as JSON')
|
|
102
|
+
.action(async (key: string, value: string, opts) => {
|
|
103
|
+
const svc = await this.getConfigService(ctx);
|
|
104
|
+
if (!svc) {
|
|
105
|
+
ctx.ui?.error('Config service not available');
|
|
106
|
+
return;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
let parsed: unknown = value;
|
|
110
|
+
if (opts.json) {
|
|
111
|
+
try {
|
|
112
|
+
parsed = JSON.parse(value);
|
|
113
|
+
} catch (e) {
|
|
114
|
+
ctx.ui?.error(`Invalid JSON: ${e}`);
|
|
115
|
+
return;
|
|
116
|
+
}
|
|
117
|
+
} else {
|
|
118
|
+
parsed = this.parseValue(value);
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
await svc.set(`${ns}.${key}`, parsed);
|
|
122
|
+
ctx.ui?.success(`Set ${ns}.${key} = ${JSON.stringify(parsed)}`);
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
private registerReset(
|
|
127
|
+
parent: Command,
|
|
128
|
+
d: CLIConfigNamespaceGroupDescriptor,
|
|
129
|
+
ctx: CommandContext
|
|
130
|
+
): void {
|
|
131
|
+
const ns = d.configNamespace.namespace;
|
|
132
|
+
const defaults = d.configNamespace.defaults ?? {};
|
|
133
|
+
|
|
134
|
+
parent
|
|
135
|
+
.command('reset [key]')
|
|
136
|
+
.description(`Reset config to defaults for ${ns}`)
|
|
137
|
+
.option('--all', 'Reset all keys')
|
|
138
|
+
.option('-y, --yes', 'Skip confirmation')
|
|
139
|
+
.action(async (key: string | undefined, opts) => {
|
|
140
|
+
const svc = await this.getConfigService(ctx);
|
|
141
|
+
if (!svc) {
|
|
142
|
+
ctx.ui?.error('Config service not available');
|
|
143
|
+
return;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
if (opts.all) {
|
|
147
|
+
if (!opts.yes) {
|
|
148
|
+
ctx.ui?.warn(`Use --yes to confirm reset of all ${ns} config`);
|
|
149
|
+
return;
|
|
150
|
+
}
|
|
151
|
+
for (const [k, v] of Object.entries(defaults)) {
|
|
152
|
+
await svc.set(`${ns}.${k}`, v);
|
|
153
|
+
}
|
|
154
|
+
ctx.ui?.success(`Reset all ${ns} config to defaults`);
|
|
155
|
+
} else if (key) {
|
|
156
|
+
const def = defaults[key];
|
|
157
|
+
if (def === undefined) {
|
|
158
|
+
await svc.delete(`${ns}.${key}`);
|
|
159
|
+
ctx.ui?.success(`Deleted ${ns}.${key}`);
|
|
160
|
+
} else {
|
|
161
|
+
await svc.set(`${ns}.${key}`, def);
|
|
162
|
+
ctx.ui?.success(`Reset ${ns}.${key} to ${JSON.stringify(def)}`);
|
|
163
|
+
}
|
|
164
|
+
} else {
|
|
165
|
+
ctx.ui?.error('Specify a key or use --all');
|
|
166
|
+
}
|
|
167
|
+
});
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
private registerList(
|
|
171
|
+
parent: Command,
|
|
172
|
+
d: CLIConfigNamespaceGroupDescriptor,
|
|
173
|
+
ctx: CommandContext
|
|
174
|
+
): void {
|
|
175
|
+
const ns = d.configNamespace.namespace;
|
|
176
|
+
const defaults = d.configNamespace.defaults ?? {};
|
|
177
|
+
|
|
178
|
+
parent
|
|
179
|
+
.command('list')
|
|
180
|
+
.alias('ls')
|
|
181
|
+
.description(`List config keys for ${ns}`)
|
|
182
|
+
.option('--with-values', 'Include values')
|
|
183
|
+
.option('--with-defaults', 'Include defaults')
|
|
184
|
+
.action(async (opts) => {
|
|
185
|
+
const svc = await this.getConfigService(ctx);
|
|
186
|
+
if (!svc) {
|
|
187
|
+
ctx.ui?.error('Config service not available');
|
|
188
|
+
return;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
const current = await svc.getNamespace(ns);
|
|
192
|
+
const allKeys = new Set([...Object.keys(defaults), ...Object.keys(current)]);
|
|
193
|
+
|
|
194
|
+
const rows: Array<{ key: string; value?: unknown; default?: unknown }> = [];
|
|
195
|
+
for (const key of allKeys) {
|
|
196
|
+
const row: { key: string; value?: unknown; default?: unknown } = { key };
|
|
197
|
+
if (opts.withValues) row.value = current[key];
|
|
198
|
+
if (opts.withDefaults) row.default = defaults[key];
|
|
199
|
+
rows.push(row);
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
if (rows.length === 0) {
|
|
203
|
+
ctx.ui?.info(`No keys in ${ns}`);
|
|
204
|
+
return;
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
ctx.ui?.table(rows);
|
|
208
|
+
});
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
private output(data: unknown, format: string, ctx: CommandContext): void {
|
|
212
|
+
if (!ctx.ui) {
|
|
213
|
+
process.stdout.write(`${JSON.stringify(data, null, 2)}\n`);
|
|
214
|
+
return;
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
switch (format) {
|
|
218
|
+
case 'json':
|
|
219
|
+
ctx.ui.json(data);
|
|
220
|
+
break;
|
|
221
|
+
case 'yaml':
|
|
222
|
+
ctx.ui.yaml(data);
|
|
223
|
+
break;
|
|
224
|
+
case 'table':
|
|
225
|
+
if (typeof data === 'object' && data && !Array.isArray(data)) {
|
|
226
|
+
const rows = Object.entries(data).map(([k, v]) => ({
|
|
227
|
+
key: k,
|
|
228
|
+
value: typeof v === 'object' ? JSON.stringify(v) : v
|
|
229
|
+
}));
|
|
230
|
+
ctx.ui.table(rows);
|
|
231
|
+
} else {
|
|
232
|
+
ctx.ui.yaml(data);
|
|
233
|
+
}
|
|
234
|
+
break;
|
|
235
|
+
default:
|
|
236
|
+
ctx.ui.yaml(data);
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
private parseValue(value: string): unknown {
|
|
241
|
+
if (value === 'true') return true;
|
|
242
|
+
if (value === 'false') return false;
|
|
243
|
+
const num = Number(value);
|
|
244
|
+
if (!isNaN(num) && value.trim() !== '') return num;
|
|
245
|
+
try {
|
|
246
|
+
return JSON.parse(value);
|
|
247
|
+
} catch {
|
|
248
|
+
return value;
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
}
|
|
@@ -0,0 +1,217 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CRUD Pattern Implementation
|
|
3
|
+
*
|
|
4
|
+
* Generates list/get/create/update/delete commands for a storage kind.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import type { Command } from 'commander';
|
|
8
|
+
import type { VibesRuntime } from '@vibesdotdev/runtime/api/runtime';
|
|
9
|
+
import type { CLICRUDGroupDescriptor } from './schemas';
|
|
10
|
+
import type { PatternImplementation } from './pattern-types';
|
|
11
|
+
import type { CommandContext } from '../schemas/surface';
|
|
12
|
+
import { requestCLIExit } from '../providers';
|
|
13
|
+
|
|
14
|
+
interface StorageAdapter<T = unknown> {
|
|
15
|
+
list(options?: { limit?: number; offset?: number; sortBy?: string }): Promise<T[]>;
|
|
16
|
+
get(id: string): Promise<T | null>;
|
|
17
|
+
create(data: Partial<T>): Promise<T>;
|
|
18
|
+
update(id: string, data: Partial<T>): Promise<T>;
|
|
19
|
+
delete(id: string): Promise<void>;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export class CRUDPatternImpl implements PatternImplementation<CLICRUDGroupDescriptor> {
|
|
23
|
+
constructor(private runtime: VibesRuntime) {}
|
|
24
|
+
|
|
25
|
+
async register(
|
|
26
|
+
descriptor: CLICRUDGroupDescriptor,
|
|
27
|
+
parent: Command,
|
|
28
|
+
context: CommandContext
|
|
29
|
+
): Promise<void> {
|
|
30
|
+
const { target, crud, name, description } = descriptor;
|
|
31
|
+
|
|
32
|
+
const groupCmd = parent.command(name).description(description);
|
|
33
|
+
|
|
34
|
+
const getAdapter = async (): Promise<StorageAdapter> => {
|
|
35
|
+
return this.runtime.query(target.kind).withId(target.id).resolve() as Promise<StorageAdapter>;
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
if (crud?.list?.enabled !== false) {
|
|
39
|
+
this.registerList(groupCmd, descriptor, getAdapter, context);
|
|
40
|
+
}
|
|
41
|
+
if (crud?.get?.enabled !== false) {
|
|
42
|
+
this.registerGet(groupCmd, descriptor, getAdapter, context);
|
|
43
|
+
}
|
|
44
|
+
if (crud?.create?.enabled !== false) {
|
|
45
|
+
this.registerCreate(groupCmd, descriptor, getAdapter, context);
|
|
46
|
+
}
|
|
47
|
+
if (crud?.update?.enabled !== false) {
|
|
48
|
+
this.registerUpdate(groupCmd, descriptor, getAdapter, context);
|
|
49
|
+
}
|
|
50
|
+
if (crud?.delete?.enabled !== false) {
|
|
51
|
+
this.registerDelete(groupCmd, descriptor, getAdapter, context);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
private registerList(
|
|
56
|
+
parent: Command,
|
|
57
|
+
descriptor: CLICRUDGroupDescriptor,
|
|
58
|
+
getAdapter: () => Promise<StorageAdapter>,
|
|
59
|
+
ctx: CommandContext
|
|
60
|
+
): void {
|
|
61
|
+
const cfg = descriptor.crud?.list ?? {};
|
|
62
|
+
|
|
63
|
+
parent
|
|
64
|
+
.command('list')
|
|
65
|
+
.alias('ls')
|
|
66
|
+
.description(`List all ${descriptor.name}`)
|
|
67
|
+
.option('-f, --format <format>', 'Output format', cfg.defaultFormat ?? 'table')
|
|
68
|
+
.option('-l, --limit <n>', 'Limit results', '50')
|
|
69
|
+
.option('--offset <n>', 'Offset', '0')
|
|
70
|
+
.option('--sort <field>', 'Sort by', cfg.sortBy)
|
|
71
|
+
.action(async (opts) => {
|
|
72
|
+
const adapter = await getAdapter();
|
|
73
|
+
const items = await adapter.list({
|
|
74
|
+
limit: parseInt(opts.limit, 10),
|
|
75
|
+
offset: parseInt(opts.offset, 10),
|
|
76
|
+
sortBy: opts.sort
|
|
77
|
+
});
|
|
78
|
+
this.output(items, opts.format, ctx, cfg.columns);
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
private registerGet(
|
|
83
|
+
parent: Command,
|
|
84
|
+
descriptor: CLICRUDGroupDescriptor,
|
|
85
|
+
getAdapter: () => Promise<StorageAdapter>,
|
|
86
|
+
ctx: CommandContext
|
|
87
|
+
): void {
|
|
88
|
+
const cfg = descriptor.crud?.get ?? {};
|
|
89
|
+
|
|
90
|
+
parent
|
|
91
|
+
.command(`get <${cfg.idParam ?? 'id'}>`)
|
|
92
|
+
.description(`Get a ${descriptor.name} by ID`)
|
|
93
|
+
.option('-f, --format <format>', 'Output format', 'yaml')
|
|
94
|
+
.action(async (id: string, opts) => {
|
|
95
|
+
const adapter = await getAdapter();
|
|
96
|
+
const item = await adapter.get(id);
|
|
97
|
+
if (!item) {
|
|
98
|
+
ctx.ui?.error(`Not found: ${id}`);
|
|
99
|
+
requestCLIExit(1);
|
|
100
|
+
}
|
|
101
|
+
this.output(item, opts.format, ctx);
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
private registerCreate(
|
|
106
|
+
parent: Command,
|
|
107
|
+
descriptor: CLICRUDGroupDescriptor,
|
|
108
|
+
getAdapter: () => Promise<StorageAdapter>,
|
|
109
|
+
ctx: CommandContext
|
|
110
|
+
): void {
|
|
111
|
+
parent
|
|
112
|
+
.command('create')
|
|
113
|
+
.description(`Create a new ${descriptor.name}`)
|
|
114
|
+
.option('-f, --format <format>', 'Output format', 'yaml')
|
|
115
|
+
.option('--json <data>', 'JSON data')
|
|
116
|
+
.action(async (opts) => {
|
|
117
|
+
if (!opts.json) {
|
|
118
|
+
ctx.ui?.error('--json required');
|
|
119
|
+
requestCLIExit(2);
|
|
120
|
+
}
|
|
121
|
+
const adapter = await getAdapter();
|
|
122
|
+
const created = await adapter.create(JSON.parse(opts.json));
|
|
123
|
+
ctx.ui?.success(`Created ${descriptor.name}`);
|
|
124
|
+
this.output(created, opts.format, ctx);
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
private registerUpdate(
|
|
129
|
+
parent: Command,
|
|
130
|
+
descriptor: CLICRUDGroupDescriptor,
|
|
131
|
+
getAdapter: () => Promise<StorageAdapter>,
|
|
132
|
+
ctx: CommandContext
|
|
133
|
+
): void {
|
|
134
|
+
parent
|
|
135
|
+
.command('update <id>')
|
|
136
|
+
.description(`Update a ${descriptor.name}`)
|
|
137
|
+
.option('-f, --format <format>', 'Output format', 'yaml')
|
|
138
|
+
.option('--json <data>', 'JSON data')
|
|
139
|
+
.option('--set <key=value...>', 'Set fields')
|
|
140
|
+
.action(async (id: string, opts) => {
|
|
141
|
+
let data: Record<string, unknown> = {};
|
|
142
|
+
if (opts.json) {
|
|
143
|
+
data = JSON.parse(opts.json);
|
|
144
|
+
} else if (opts.set) {
|
|
145
|
+
for (const pair of opts.set) {
|
|
146
|
+
const [key, ...rest] = pair.split('=');
|
|
147
|
+
data[key] = this.parseValue(rest.join('='));
|
|
148
|
+
}
|
|
149
|
+
} else {
|
|
150
|
+
ctx.ui?.error('--json or --set required');
|
|
151
|
+
requestCLIExit(2);
|
|
152
|
+
}
|
|
153
|
+
const adapter = await getAdapter();
|
|
154
|
+
const updated = await adapter.update(id, data);
|
|
155
|
+
ctx.ui?.success(`Updated: ${id}`);
|
|
156
|
+
this.output(updated, opts.format, ctx);
|
|
157
|
+
});
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
private registerDelete(
|
|
161
|
+
parent: Command,
|
|
162
|
+
descriptor: CLICRUDGroupDescriptor,
|
|
163
|
+
getAdapter: () => Promise<StorageAdapter>,
|
|
164
|
+
ctx: CommandContext
|
|
165
|
+
): void {
|
|
166
|
+
const cfg = descriptor.crud?.delete ?? {};
|
|
167
|
+
|
|
168
|
+
const cmd = parent.command('delete <id>').description(`Delete a ${descriptor.name}`);
|
|
169
|
+
|
|
170
|
+
if (cfg.confirm !== false) {
|
|
171
|
+
cmd.option('-y, --yes', 'Skip confirmation');
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
cmd.action(async (id: string, opts) => {
|
|
175
|
+
if (cfg.confirm !== false && !opts.yes) {
|
|
176
|
+
ctx.ui?.warn(`Use --yes to confirm deletion of: ${id}`);
|
|
177
|
+
requestCLIExit(2);
|
|
178
|
+
}
|
|
179
|
+
const adapter = await getAdapter();
|
|
180
|
+
await adapter.delete(id);
|
|
181
|
+
ctx.ui?.success(`Deleted: ${id}`);
|
|
182
|
+
});
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
private output(data: unknown, format: string, ctx: CommandContext, columns?: string[]): void {
|
|
186
|
+
if (!ctx.ui) {
|
|
187
|
+
process.stdout.write(`${JSON.stringify(data, null, 2)}\n`);
|
|
188
|
+
return;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
switch (format) {
|
|
192
|
+
case 'json':
|
|
193
|
+
ctx.ui.json(data);
|
|
194
|
+
break;
|
|
195
|
+
case 'yaml':
|
|
196
|
+
ctx.ui.yaml(data);
|
|
197
|
+
break;
|
|
198
|
+
case 'table':
|
|
199
|
+
if (Array.isArray(data)) {
|
|
200
|
+
ctx.ui.table(data, { columns });
|
|
201
|
+
} else {
|
|
202
|
+
ctx.ui.yaml(data);
|
|
203
|
+
}
|
|
204
|
+
break;
|
|
205
|
+
default:
|
|
206
|
+
ctx.ui.json(data);
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
private parseValue(value: string): unknown {
|
|
211
|
+
try {
|
|
212
|
+
return JSON.parse(value);
|
|
213
|
+
} catch {
|
|
214
|
+
return value;
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CLI Patterns
|
|
3
|
+
*
|
|
4
|
+
* Pattern-based command generation for the CLI surface.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
export { PatternResolver, createPatternResolver, type PatternImplementation } from './resolver';
|
|
8
|
+
|
|
9
|
+
export {
|
|
10
|
+
isPatternDescriptor,
|
|
11
|
+
getPatternType,
|
|
12
|
+
type CLIPatternDescriptor,
|
|
13
|
+
type CLICRUDGroupDescriptor,
|
|
14
|
+
type CLIToolWrapperCommandDescriptor,
|
|
15
|
+
type CLILogViewerGroupDescriptor,
|
|
16
|
+
type CLIProcessManagerGroupDescriptor,
|
|
17
|
+
type CLIConfigNamespaceGroupDescriptor
|
|
18
|
+
} from './schemas';
|
|
19
|
+
|
|
20
|
+
export { CRUDPatternImpl } from './crud';
|
|
21
|
+
export { ToolWrapperPatternImpl } from './tool-wrapper';
|
|
22
|
+
export { LogViewerPatternImpl } from './log-viewer';
|
|
23
|
+
export { ProcessManagerPatternImpl } from './process-manager';
|
|
24
|
+
export { ConfigNamespacePatternImpl } from './config-namespace';
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Log Viewer Pattern Implementation
|
|
3
|
+
*
|
|
4
|
+
* Generates commands for viewing logs.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import type { Command } from 'commander';
|
|
8
|
+
import type { VibesRuntime } from '@vibesdotdev/runtime/api/runtime';
|
|
9
|
+
import type { CLILogViewerGroupDescriptor } from './schemas';
|
|
10
|
+
import type { PatternImplementation } from './pattern-types';
|
|
11
|
+
import type { CommandContext } from '../schemas/surface';
|
|
12
|
+
|
|
13
|
+
interface PMLogContext extends CommandContext {
|
|
14
|
+
pm?: {
|
|
15
|
+
tailLogs(
|
|
16
|
+
targetId: string,
|
|
17
|
+
options: {
|
|
18
|
+
lines: number;
|
|
19
|
+
levels?: string[];
|
|
20
|
+
follow?: boolean;
|
|
21
|
+
}
|
|
22
|
+
): Promise<void>;
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export class LogViewerPatternImpl implements PatternImplementation<CLILogViewerGroupDescriptor> {
|
|
27
|
+
constructor(private runtime: VibesRuntime) {}
|
|
28
|
+
|
|
29
|
+
async register(
|
|
30
|
+
descriptor: CLILogViewerGroupDescriptor,
|
|
31
|
+
parent: Command,
|
|
32
|
+
context: CommandContext
|
|
33
|
+
): Promise<void> {
|
|
34
|
+
const { name, description, logViewer } = descriptor;
|
|
35
|
+
|
|
36
|
+
const groupCmd = parent.command(name).description(description);
|
|
37
|
+
|
|
38
|
+
this.registerTail(groupCmd, descriptor, context);
|
|
39
|
+
this.registerSearch(groupCmd, descriptor, context);
|
|
40
|
+
this.registerLevels(groupCmd, descriptor, context);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
private registerTail(
|
|
44
|
+
parent: Command,
|
|
45
|
+
descriptor: CLILogViewerGroupDescriptor,
|
|
46
|
+
ctx: CommandContext
|
|
47
|
+
): void {
|
|
48
|
+
const cfg = descriptor.logViewer;
|
|
49
|
+
|
|
50
|
+
const cmd = parent
|
|
51
|
+
.command('tail')
|
|
52
|
+
.alias('logs')
|
|
53
|
+
.description(`View recent logs for ${descriptor.name}`)
|
|
54
|
+
.option('-n, --lines <n>', 'Number of lines', String(cfg.defaultLines))
|
|
55
|
+
.option('-l, --level <levels...>', 'Filter by level', cfg.defaultLevels);
|
|
56
|
+
|
|
57
|
+
if (cfg.follow) {
|
|
58
|
+
cmd.option('-f, --follow', 'Follow output');
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
if (cfg.filters) {
|
|
62
|
+
for (const f of cfg.filters) {
|
|
63
|
+
cmd.option(f.flag, f.description);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
cmd.action(async (opts) => {
|
|
68
|
+
const pm = (ctx as PMLogContext).pm;
|
|
69
|
+
if (!pm?.tailLogs) {
|
|
70
|
+
ctx.ui?.warn('Log streaming not available');
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
await pm.tailLogs(descriptor.target.id, {
|
|
75
|
+
lines: parseInt(opts.lines, 10),
|
|
76
|
+
levels: opts.level,
|
|
77
|
+
follow: opts.follow
|
|
78
|
+
});
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
private registerSearch(
|
|
83
|
+
parent: Command,
|
|
84
|
+
descriptor: CLILogViewerGroupDescriptor,
|
|
85
|
+
ctx: CommandContext
|
|
86
|
+
): void {
|
|
87
|
+
parent
|
|
88
|
+
.command('search <pattern>')
|
|
89
|
+
.description(`Search logs for ${descriptor.name}`)
|
|
90
|
+
.option('-n, --lines <n>', 'Context lines', '3')
|
|
91
|
+
.option('-l, --level <levels...>', 'Filter by level')
|
|
92
|
+
.option('--since <time>', 'Since time')
|
|
93
|
+
.option('--until <time>', 'Until time')
|
|
94
|
+
.action(async (pattern: string, opts) => {
|
|
95
|
+
ctx.ui?.warn('Log search not yet implemented');
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
private registerLevels(
|
|
100
|
+
parent: Command,
|
|
101
|
+
descriptor: CLILogViewerGroupDescriptor,
|
|
102
|
+
ctx: CommandContext
|
|
103
|
+
): void {
|
|
104
|
+
parent
|
|
105
|
+
.command('levels')
|
|
106
|
+
.description('Show available log levels')
|
|
107
|
+
.action(() => {
|
|
108
|
+
const levels = ['trace', 'debug', 'info', 'warn', 'error', 'fatal'];
|
|
109
|
+
const defaults = descriptor.logViewer.defaultLevels ?? [];
|
|
110
|
+
|
|
111
|
+
ctx.ui?.info('Available log levels:');
|
|
112
|
+
for (const level of levels) {
|
|
113
|
+
const marker = defaults.includes(level) ? ' (default)' : '';
|
|
114
|
+
ctx.ui?.info(` - ${level}${marker}`);
|
|
115
|
+
}
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CLI Pattern Type Definitions
|
|
3
|
+
*
|
|
4
|
+
* Shared types to avoid circular dependencies between resolver and pattern implementations.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import type { Command } from 'commander';
|
|
8
|
+
import type { CLIPatternDescriptor } from './schemas';
|
|
9
|
+
import type { CommandContext } from '../schemas/surface';
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Pattern implementation interface
|
|
13
|
+
*
|
|
14
|
+
* All pattern implementations must implement this interface to register
|
|
15
|
+
* their commands with the CLI.
|
|
16
|
+
*/
|
|
17
|
+
export interface PatternImplementation<TDescriptor extends CLIPatternDescriptor> {
|
|
18
|
+
/**
|
|
19
|
+
* Register a pattern descriptor as commands on the parent command
|
|
20
|
+
*/
|
|
21
|
+
register(descriptor: TDescriptor, parent: Command, context: CommandContext): Promise<void>;
|
|
22
|
+
}
|