@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
package/src/bin.ts
ADDED
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CLI Binary Path Resolution
|
|
3
|
+
*
|
|
4
|
+
* Provides utilities for resolving the path to the vibes CLI binary.
|
|
5
|
+
* Used by PM and workers to spawn the CLI correctly.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import { dirname, resolve } from 'node:path';
|
|
9
|
+
import { existsSync } from 'node:fs';
|
|
10
|
+
import { fileURLToPath } from 'node:url';
|
|
11
|
+
|
|
12
|
+
const MODULE_DIR = dirname(fileURLToPath(import.meta.url));
|
|
13
|
+
const MONOREPO_ENTRY_SEGMENTS = ['apps', 'cli-bin', 'src', 'bin', 'vibes.ts'] as const;
|
|
14
|
+
|
|
15
|
+
function findMonorepoCliEntry(startDir: string, searched: Set<string>): string | undefined {
|
|
16
|
+
let current = resolve(startDir);
|
|
17
|
+
|
|
18
|
+
while (true) {
|
|
19
|
+
const candidate = resolve(current, ...MONOREPO_ENTRY_SEGMENTS);
|
|
20
|
+
searched.add(candidate);
|
|
21
|
+
if (existsSync(candidate)) return candidate;
|
|
22
|
+
|
|
23
|
+
const parent = dirname(current);
|
|
24
|
+
if (parent === current) break;
|
|
25
|
+
current = parent;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
return undefined;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Resolve the vibes CLI entry point path.
|
|
33
|
+
* Searches in order: apps/cli-bin, single-app layout, flat layout.
|
|
34
|
+
*
|
|
35
|
+
* @throws Error if no CLI entry point is found
|
|
36
|
+
*/
|
|
37
|
+
export function resolveCliEntry(): string {
|
|
38
|
+
const searched = new Set<string>();
|
|
39
|
+
const monorepoStarts = [process.cwd(), MODULE_DIR];
|
|
40
|
+
|
|
41
|
+
for (const start of monorepoStarts) {
|
|
42
|
+
const monorepoEntry = findMonorepoCliEntry(start, searched);
|
|
43
|
+
if (monorepoEntry) return monorepoEntry;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
const fallbackEntries = [
|
|
47
|
+
resolve(process.cwd(), 'src', 'bin', 'vibes.ts'),
|
|
48
|
+
resolve(process.cwd(), 'bin', 'vibes.ts'),
|
|
49
|
+
resolve(MODULE_DIR, 'src', 'bin', 'vibes.ts'),
|
|
50
|
+
resolve(MODULE_DIR, 'bin', 'vibes.ts'),
|
|
51
|
+
resolve(MODULE_DIR, '..', 'src', 'bin', 'vibes.ts'),
|
|
52
|
+
resolve(MODULE_DIR, '..', 'bin', 'vibes.ts')
|
|
53
|
+
];
|
|
54
|
+
|
|
55
|
+
for (const candidate of fallbackEntries) {
|
|
56
|
+
searched.add(candidate);
|
|
57
|
+
if (existsSync(candidate)) return candidate;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
throw new Error(`Failed to resolve CLI entry point. Searched:\n${[...searched].join('\n')}`);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* Resolve the bun command to invoke the CLI.
|
|
65
|
+
* Returns the appropriate args to run the CLI.
|
|
66
|
+
*
|
|
67
|
+
* @param target - Worker target (consumer or cloud)
|
|
68
|
+
* @param options.hot - Enable hot reload (default: false)
|
|
69
|
+
* @returns Object with command and args array
|
|
70
|
+
*/
|
|
71
|
+
export function resolveCliInvocation(
|
|
72
|
+
target: 'consumer' | 'cloud',
|
|
73
|
+
options: { hot?: boolean } = {}
|
|
74
|
+
): { command: string; args: string[] } {
|
|
75
|
+
const cliEntry = resolveCliEntry();
|
|
76
|
+
const hot = options.hot ?? false;
|
|
77
|
+
|
|
78
|
+
return {
|
|
79
|
+
command: 'bun',
|
|
80
|
+
args: hot
|
|
81
|
+
? ['run', '--hot', '--bun', cliEntry, 'workers', 'serve', target]
|
|
82
|
+
: ['run', '--bun', cliEntry, 'workers', 'serve', target]
|
|
83
|
+
};
|
|
84
|
+
}
|
package/src/bootstrap.ts
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CLI Bootstrap (compatibility re-export)
|
|
3
|
+
*
|
|
4
|
+
* @deprecated Prefer importing from '@vibesdotdev/runtime-surface-cli' for new code.
|
|
5
|
+
*
|
|
6
|
+
* This file is now a thin re-export shim for backward compatibility during the
|
|
7
|
+
* surface package migration. All real bootstrap logic (runtime initialization,
|
|
8
|
+
* umbrella plugin loading, etc.) lives in the dedicated surface package.
|
|
9
|
+
*
|
|
10
|
+
* Canonical usage:
|
|
11
|
+
* import { createVibesCliApp } from '@vibesdotdev/runtime-surface-cli';
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
export {
|
|
15
|
+
createVibesCliApp,
|
|
16
|
+
type VibesCliAppOptions,
|
|
17
|
+
type VibesCliApp,
|
|
18
|
+
type CliPluginLoader,
|
|
19
|
+
} from '@vibesdotdev/runtime-surface-cli';
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CLI Plugin
|
|
3
|
+
*
|
|
4
|
+
* Registers CLI kinds with the universal runtime:
|
|
5
|
+
* - cli/group: Command groups for organizing commands
|
|
6
|
+
* - cli/command: Executable CLI commands
|
|
7
|
+
*
|
|
8
|
+
* This plugin does NOT create a separate runtime - it extends the universal
|
|
9
|
+
* runtime with CLI-specific asset kinds that CLISurface uses to build
|
|
10
|
+
* the Commander.js command tree.
|
|
11
|
+
*/
|
|
12
|
+
/**
|
|
13
|
+
* CLI Plugin
|
|
14
|
+
*
|
|
15
|
+
* Registers cli/group and cli/command kinds with the universal runtime.
|
|
16
|
+
* CLISurface queries these kinds to build the Commander.js command tree.
|
|
17
|
+
*/
|
|
18
|
+
declare const _default: import("@vibesdotdev/runtime").RuntimePlugin;
|
|
19
|
+
export default _default;
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CLI Plugin
|
|
3
|
+
*
|
|
4
|
+
* Registers CLI kinds with the universal runtime:
|
|
5
|
+
* - cli/group: Command groups for organizing commands
|
|
6
|
+
* - cli/command: Executable CLI commands
|
|
7
|
+
*
|
|
8
|
+
* This plugin does NOT create a separate runtime - it extends the universal
|
|
9
|
+
* runtime with CLI-specific asset kinds that CLISurface uses to build
|
|
10
|
+
* the Commander.js command tree.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
import {
|
|
14
|
+
createRuntimePlugin,
|
|
15
|
+
loader,
|
|
16
|
+
type KindContext,
|
|
17
|
+
type RuntimeKindDescriptorRecord
|
|
18
|
+
} from '@vibesdotdev/runtime';
|
|
19
|
+
import type { RuntimeDescriptor } from '@vibesdotdev/runtime/schemas/descriptor';
|
|
20
|
+
import type { RuntimeScope } from '@vibesdotdev/runtime/schemas/scope';
|
|
21
|
+
import {
|
|
22
|
+
CLIGroupDescriptorSchema,
|
|
23
|
+
CLICommandDescriptorSchema,
|
|
24
|
+
type CLIGroupAssetDescriptor,
|
|
25
|
+
type CLICommandAssetDescriptor
|
|
26
|
+
} from './schemas/descriptors';
|
|
27
|
+
|
|
28
|
+
// CLI command descriptors
|
|
29
|
+
import completionDescriptor from './commands/completion/completion.descriptor';
|
|
30
|
+
import { runtimeCodegenCommandDescriptor } from './commands/runtime/codegen.command.descriptor';
|
|
31
|
+
import { runtimeCodegenCommandImpl } from './commands/runtime/codegen.command.impl';
|
|
32
|
+
import uiContextDescriptor from './ui.context.descriptor';
|
|
33
|
+
import cliStartupLogger from './logging/cli-startup.logger.descriptor';
|
|
34
|
+
import runtimeGroup from './commands/runtime/runtime-group.descriptor';
|
|
35
|
+
|
|
36
|
+
// Profile descriptors
|
|
37
|
+
import profileGroupDescriptor from './commands/profile/profile-group.descriptor';
|
|
38
|
+
import profileListDescriptor from './commands/profile/profile.list.descriptor';
|
|
39
|
+
import profileCreateDescriptor from './commands/profile/profile.create.descriptor';
|
|
40
|
+
import profileUseDescriptor from './commands/profile/profile.use.descriptor';
|
|
41
|
+
import profileDeleteDescriptor from './commands/profile/profile.delete.descriptor';
|
|
42
|
+
import profileInfoDescriptor from './commands/profile/profile.info.descriptor';
|
|
43
|
+
|
|
44
|
+
// Docs
|
|
45
|
+
import cliCommandsDescriptor from './docs/cli.commands.docs.descriptor.ts';
|
|
46
|
+
import cliGroupsDescriptor from './docs/cli.groups.docs.descriptor.ts';
|
|
47
|
+
import cliOutputDescriptor from './docs/cli.output.docs.descriptor.ts';
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* CLI Group kind - metadata only, no implementation needed
|
|
51
|
+
*/
|
|
52
|
+
function isCLIGroupAssetDescriptor(
|
|
53
|
+
descriptor: RuntimeDescriptor
|
|
54
|
+
): descriptor is CLIGroupAssetDescriptor {
|
|
55
|
+
return descriptor.kind === 'cli/group' && typeof descriptor.id === 'string';
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
class DefaultCLIGroupImplementation {
|
|
59
|
+
constructor(public readonly descriptor: CLIGroupAssetDescriptor) {}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
const cliGroupKind = {
|
|
63
|
+
id: 'cli/group',
|
|
64
|
+
descriptorSchema: CLIGroupDescriptorSchema,
|
|
65
|
+
defaultImplementation: class {
|
|
66
|
+
readonly descriptor: CLIGroupAssetDescriptor;
|
|
67
|
+
|
|
68
|
+
constructor(descriptor: RuntimeDescriptor) {
|
|
69
|
+
if (!isCLIGroupAssetDescriptor(descriptor)) {
|
|
70
|
+
throw new Error(`Invalid cli/group descriptor '${descriptor.id ?? 'unknown'}'`);
|
|
71
|
+
}
|
|
72
|
+
this.descriptor = descriptor;
|
|
73
|
+
}
|
|
74
|
+
},
|
|
75
|
+
|
|
76
|
+
// Resolution: prefer explicit scope matches
|
|
77
|
+
resolve: (candidates: RuntimeDescriptor[], scope: RuntimeScope) => {
|
|
78
|
+
const descriptors = candidates.filter(isCLIGroupAssetDescriptor);
|
|
79
|
+
if (descriptors.length === 0) return undefined;
|
|
80
|
+
if (descriptors.length === 1) return descriptors[0];
|
|
81
|
+
|
|
82
|
+
// Filter by surface
|
|
83
|
+
let matches = descriptors.filter((d) => {
|
|
84
|
+
if (!d.surfaces || d.surfaces.length === 0) return true;
|
|
85
|
+
return d.surfaces.includes(scope.surface as (typeof d.surfaces)[number]);
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
if (matches.length === 0) return undefined;
|
|
89
|
+
|
|
90
|
+
// Filter by hardware
|
|
91
|
+
matches = matches.filter((d) => {
|
|
92
|
+
if (!d.hardware || d.hardware.length === 0) return true;
|
|
93
|
+
return d.hardware.includes(scope.hardware);
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
// Sort by order, return first
|
|
97
|
+
matches.sort((a, b) => (a.order ?? 999) - (b.order ?? 999));
|
|
98
|
+
return matches[0];
|
|
99
|
+
},
|
|
100
|
+
|
|
101
|
+
contexts: []
|
|
102
|
+
} satisfies RuntimeKindDescriptorRecord<DefaultCLIGroupImplementation>;
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* CLI Command kind - requires implementation with execute()
|
|
106
|
+
*/
|
|
107
|
+
function isCLICommandAssetDescriptor(
|
|
108
|
+
descriptor: RuntimeDescriptor
|
|
109
|
+
): descriptor is CLICommandAssetDescriptor {
|
|
110
|
+
return (
|
|
111
|
+
descriptor.kind === 'cli/command' && typeof descriptor.id === 'string' && 'group' in descriptor
|
|
112
|
+
);
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
class DefaultCLICommandImplementation {
|
|
116
|
+
readonly descriptor: CLICommandAssetDescriptor;
|
|
117
|
+
|
|
118
|
+
constructor(descriptor: RuntimeDescriptor) {
|
|
119
|
+
if (!isCLICommandAssetDescriptor(descriptor)) {
|
|
120
|
+
throw new Error(`Invalid cli/command descriptor '${descriptor.id ?? 'unknown'}'`);
|
|
121
|
+
}
|
|
122
|
+
this.descriptor = descriptor;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
async execute(_args: Record<string, unknown>, _opts: Record<string, unknown>): Promise<void> {
|
|
126
|
+
throw new Error(`No implementation for command: ${this.descriptor.id}`);
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
const cliCommandKind = {
|
|
131
|
+
id: 'cli/command',
|
|
132
|
+
descriptorSchema: CLICommandDescriptorSchema,
|
|
133
|
+
defaultImplementation: DefaultCLICommandImplementation,
|
|
134
|
+
|
|
135
|
+
// Resolution: prefer explicit scope matches
|
|
136
|
+
resolve: (candidates: RuntimeDescriptor[], scope: RuntimeScope) => {
|
|
137
|
+
const descriptors = candidates.filter(isCLICommandAssetDescriptor);
|
|
138
|
+
if (descriptors.length === 0) return undefined;
|
|
139
|
+
if (descriptors.length === 1) return descriptors[0];
|
|
140
|
+
|
|
141
|
+
// Filter by surface
|
|
142
|
+
let matches = descriptors.filter((d) => {
|
|
143
|
+
if (!d.surfaces || d.surfaces.length === 0) return true;
|
|
144
|
+
return d.surfaces.includes(scope.surface as (typeof d.surfaces)[number]);
|
|
145
|
+
});
|
|
146
|
+
|
|
147
|
+
if (matches.length === 0) return undefined;
|
|
148
|
+
|
|
149
|
+
// Filter by hardware
|
|
150
|
+
matches = matches.filter((d) => {
|
|
151
|
+
if (!d.hardware || d.hardware.length === 0) return true;
|
|
152
|
+
return d.hardware.includes(scope.hardware);
|
|
153
|
+
});
|
|
154
|
+
|
|
155
|
+
// Sort by order, return first
|
|
156
|
+
matches.sort((a, b) => (a.order ?? 999) - (b.order ?? 999));
|
|
157
|
+
return matches[0];
|
|
158
|
+
},
|
|
159
|
+
|
|
160
|
+
// Commands receive runtime context
|
|
161
|
+
contexts: ['runtime']
|
|
162
|
+
} satisfies RuntimeKindDescriptorRecord<DefaultCLICommandImplementation>;
|
|
163
|
+
|
|
164
|
+
/**
|
|
165
|
+
* CLI Plugin
|
|
166
|
+
*
|
|
167
|
+
* Registers cli/group and cli/command kinds with the universal runtime.
|
|
168
|
+
* CLISurface queries these kinds to build the Commander.js command tree.
|
|
169
|
+
*/
|
|
170
|
+
export default createRuntimePlugin({
|
|
171
|
+
id: 'cli',
|
|
172
|
+
name: 'CLI Surface',
|
|
173
|
+
description: 'CLI command system using Commander.js',
|
|
174
|
+
dependencies: ['context'],
|
|
175
|
+
kinds: [cliGroupKind, cliCommandKind],
|
|
176
|
+
|
|
177
|
+
descriptors: [
|
|
178
|
+
completionDescriptor,
|
|
179
|
+
runtimeCodegenCommandDescriptor,
|
|
180
|
+
uiContextDescriptor,
|
|
181
|
+
cliStartupLogger,
|
|
182
|
+
runtimeGroup,
|
|
183
|
+
profileGroupDescriptor,
|
|
184
|
+
profileListDescriptor,
|
|
185
|
+
profileCreateDescriptor,
|
|
186
|
+
profileUseDescriptor,
|
|
187
|
+
profileDeleteDescriptor,
|
|
188
|
+
profileInfoDescriptor,
|
|
189
|
+
cliCommandsDescriptor,
|
|
190
|
+
cliGroupsDescriptor,
|
|
191
|
+
cliOutputDescriptor
|
|
192
|
+
],
|
|
193
|
+
|
|
194
|
+
loaders: [
|
|
195
|
+
loader('completion', () => import('./commands/completion/completion.impl.ts')),
|
|
196
|
+
loader('profile.list', () => import('./commands/profile/profile.list.impl.ts')),
|
|
197
|
+
loader('profile.create', () => import('./commands/profile/profile.create.impl.ts')),
|
|
198
|
+
loader('profile.use', () => import('./commands/profile/profile.use.impl.ts')),
|
|
199
|
+
loader('profile.delete', () => import('./commands/profile/profile.delete.impl.ts')),
|
|
200
|
+
loader('profile.info', () => import('./commands/profile/profile.info.impl.ts'))
|
|
201
|
+
]
|
|
202
|
+
});
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Bash Completion Generator
|
|
3
|
+
*
|
|
4
|
+
* Generates a bash completion function from the command tree.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import type { CommandNode } from './tree';
|
|
8
|
+
|
|
9
|
+
function generateCaseBlock(path: string, node: CommandNode, indent: string): string[] {
|
|
10
|
+
const lines: string[] = [];
|
|
11
|
+
if (node.children.length === 0) return lines;
|
|
12
|
+
|
|
13
|
+
const childNames = node.children.flatMap((c) => [c.name, ...c.aliases]).join(' ');
|
|
14
|
+
lines.push(`${indent}${path})`);
|
|
15
|
+
lines.push(`${indent} COMPREPLY=( $(compgen -W "${childNames}" -- "\${cur}") )`);
|
|
16
|
+
lines.push(`${indent} return 0`);
|
|
17
|
+
lines.push(`${indent} ;;`);
|
|
18
|
+
|
|
19
|
+
for (const child of node.children) {
|
|
20
|
+
if (child.children.length > 0) {
|
|
21
|
+
lines.push(...generateCaseBlock(`${path} ${child.name}`, child, indent));
|
|
22
|
+
for (const alias of child.aliases) {
|
|
23
|
+
lines.push(...generateCaseBlock(`${path} ${alias}`, child, indent));
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
return lines;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export function generateBashCompletion(tree: CommandNode): string {
|
|
32
|
+
const cases = generateCaseBlock('vibes', tree, ' ');
|
|
33
|
+
|
|
34
|
+
return `# vibes bash completion — generated by vibes completion bash
|
|
35
|
+
# Add to ~/.bashrc: eval "$(vibes completion bash)"
|
|
36
|
+
|
|
37
|
+
_vibes_completions() {
|
|
38
|
+
local cur prev words cword
|
|
39
|
+
_init_completion || return
|
|
40
|
+
|
|
41
|
+
local cmd="\${words[*]:0:cword}"
|
|
42
|
+
|
|
43
|
+
case "\${cmd}" in
|
|
44
|
+
${cases.join('\n')}
|
|
45
|
+
esac
|
|
46
|
+
|
|
47
|
+
# Option completion
|
|
48
|
+
if [[ "\${cur}" == -* ]]; then
|
|
49
|
+
local opts=""
|
|
50
|
+
case "\${cmd}" in
|
|
51
|
+
${tree.children
|
|
52
|
+
.flatMap((g) =>
|
|
53
|
+
g.children.map((c) => {
|
|
54
|
+
const opts = c.options.map((o) => (o.short ? `-${o.short} --${o.long}` : `--${o.long}`)).join(' ');
|
|
55
|
+
return opts ? ` vibes ${g.name} ${c.name}) opts="${opts}" ;;` : '';
|
|
56
|
+
})
|
|
57
|
+
)
|
|
58
|
+
.filter(Boolean)
|
|
59
|
+
.join('\n')}
|
|
60
|
+
esac
|
|
61
|
+
COMPREPLY=( $(compgen -W "\${opts}" -- "\${cur}") )
|
|
62
|
+
return 0
|
|
63
|
+
fi
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
complete -F _vibes_completions vibes
|
|
67
|
+
`;
|
|
68
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shell Completion Generator Command Descriptor
|
|
3
|
+
*
|
|
4
|
+
* Generates shell completions and autosuggestions from runtime descriptors.
|
|
5
|
+
* Supports bash, zsh (with inline autosuggestion widget), fish, and fig specs.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import type { CLICommandAssetDescriptor } from '../../schemas/descriptors';
|
|
9
|
+
|
|
10
|
+
const descriptor: CLICommandAssetDescriptor = {
|
|
11
|
+
kind: 'cli/command',
|
|
12
|
+
id: 'completion',
|
|
13
|
+
name: 'completion',
|
|
14
|
+
description: 'Generate shell completions and autosuggestions',
|
|
15
|
+
group: 'shell-integration',
|
|
16
|
+
|
|
17
|
+
arguments: [
|
|
18
|
+
{
|
|
19
|
+
name: 'shell',
|
|
20
|
+
description: 'Target shell: bash, zsh, fish, or fig',
|
|
21
|
+
required: true
|
|
22
|
+
}
|
|
23
|
+
],
|
|
24
|
+
|
|
25
|
+
options: [
|
|
26
|
+
{
|
|
27
|
+
flags: '--json',
|
|
28
|
+
description: 'Output command tree as JSON (for tooling)'
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
flags: '--install',
|
|
32
|
+
description: 'Install to standard shell completion directory'
|
|
33
|
+
}
|
|
34
|
+
],
|
|
35
|
+
|
|
36
|
+
examples: [
|
|
37
|
+
{ command: 'vibes completion zsh', description: 'Output zsh completions with autosuggestions' },
|
|
38
|
+
{ command: 'eval "$(vibes completion zsh)"', description: 'Enable in current shell' },
|
|
39
|
+
{ command: 'vibes completion fig', description: 'Generate Fig/Amazon Q completion spec' },
|
|
40
|
+
{ command: 'vibes completion --json', description: 'Output raw command tree as JSON' }
|
|
41
|
+
],
|
|
42
|
+
|
|
43
|
+
surfaces: ['cli'],
|
|
44
|
+
hardware: ['consumer'],
|
|
45
|
+
enabled: true
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
export default descriptor;
|
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shell Completion Generator Implementation
|
|
3
|
+
*
|
|
4
|
+
* Builds the CLI command tree from runtime descriptors and generates
|
|
5
|
+
* shell-specific completion scripts. The zsh output includes an inline
|
|
6
|
+
* autosuggestion widget with history-based ranking.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import { getVibesRuntime } from '@vibesdotdev/runtime';
|
|
10
|
+
import { existsSync, readFileSync, appendFileSync, mkdirSync } from 'fs';
|
|
11
|
+
import { homedir } from 'os';
|
|
12
|
+
import { join, dirname } from 'path';
|
|
13
|
+
import { buildCommandTree } from './tree';
|
|
14
|
+
import { generateBashCompletion } from './bash';
|
|
15
|
+
import { generateZshCompletion } from './zsh';
|
|
16
|
+
import { generateFishCompletion } from './fish';
|
|
17
|
+
import { generateFigSpec } from './fig';
|
|
18
|
+
|
|
19
|
+
interface CompletionOptions {
|
|
20
|
+
json?: boolean;
|
|
21
|
+
install?: boolean;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
const SHELLS = ['bash', 'zsh', 'fish', 'fig'] as const;
|
|
25
|
+
type Shell = (typeof SHELLS)[number];
|
|
26
|
+
|
|
27
|
+
const GREEN = '\x1b[32m';
|
|
28
|
+
const GRAY = '\x1b[90m';
|
|
29
|
+
const YELLOW = '\x1b[33m';
|
|
30
|
+
const RED = '\x1b[31m';
|
|
31
|
+
const BOLD = '\x1b[1m';
|
|
32
|
+
const RESET = '\x1b[0m';
|
|
33
|
+
|
|
34
|
+
function getInstallPath(shell: Shell): string {
|
|
35
|
+
const home = homedir();
|
|
36
|
+
switch (shell) {
|
|
37
|
+
case 'bash':
|
|
38
|
+
return join(home, '.bash_completion.d', 'vibes');
|
|
39
|
+
case 'zsh':
|
|
40
|
+
return join(home, '.zsh', 'completions', '_vibes');
|
|
41
|
+
case 'fish':
|
|
42
|
+
return join(home, '.config', 'fish', 'completions', 'vibes.fish');
|
|
43
|
+
case 'fig':
|
|
44
|
+
return join(home, '.fig', 'autocomplete', 'vibes.ts');
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
function getProfilePath(shell: Shell): string | null {
|
|
49
|
+
const home = homedir();
|
|
50
|
+
switch (shell) {
|
|
51
|
+
case 'bash': {
|
|
52
|
+
const bashrc = join(home, '.bashrc');
|
|
53
|
+
const profile = join(home, '.bash_profile');
|
|
54
|
+
return existsSync(bashrc) ? bashrc : profile;
|
|
55
|
+
}
|
|
56
|
+
case 'zsh':
|
|
57
|
+
return join(home, '.zshrc');
|
|
58
|
+
case 'fish':
|
|
59
|
+
return null;
|
|
60
|
+
case 'fig':
|
|
61
|
+
return null;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
function getProfileLine(shell: Shell, installPath: string): string | null {
|
|
66
|
+
switch (shell) {
|
|
67
|
+
case 'bash':
|
|
68
|
+
return `[[ -f "${installPath}" ]] && source "${installPath}"`;
|
|
69
|
+
case 'zsh':
|
|
70
|
+
return `[[ -f "${installPath}" ]] && source "${installPath}"`;
|
|
71
|
+
case 'fish':
|
|
72
|
+
case 'fig':
|
|
73
|
+
return null;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
function profileAlreadyConfigured(profilePath: string, shell: Shell): boolean {
|
|
78
|
+
if (!existsSync(profilePath)) return false;
|
|
79
|
+
const content = readFileSync(profilePath, 'utf-8');
|
|
80
|
+
return content.includes('vibes completion') || content.includes('_vibes');
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
function generateScript(shell: Shell, tree: ReturnType<typeof buildCommandTree>): string {
|
|
84
|
+
switch (shell) {
|
|
85
|
+
case 'bash':
|
|
86
|
+
return generateBashCompletion(tree);
|
|
87
|
+
case 'zsh':
|
|
88
|
+
return generateZshCompletion(tree);
|
|
89
|
+
case 'fish':
|
|
90
|
+
return generateFishCompletion(tree);
|
|
91
|
+
case 'fig':
|
|
92
|
+
return generateFigSpec(tree);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
function log(msg: string): void {
|
|
97
|
+
process.stderr.write(msg + '\n');
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
export default {
|
|
101
|
+
async execute(args: Record<string, unknown>, opts: Record<string, unknown>): Promise<void> {
|
|
102
|
+
const options = opts as CompletionOptions;
|
|
103
|
+
const runtime = getVibesRuntime();
|
|
104
|
+
const tree = buildCommandTree(runtime);
|
|
105
|
+
|
|
106
|
+
if (options.json) {
|
|
107
|
+
process.stdout.write(`${JSON.stringify(tree, null, 2)}\n`);
|
|
108
|
+
return;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
const shell = args.shell as string;
|
|
112
|
+
if (!SHELLS.includes(shell as Shell)) {
|
|
113
|
+
log(`${RED}✗${RESET} Unknown shell: ${BOLD}${shell}${RESET}`);
|
|
114
|
+
log(` Supported: ${SHELLS.join(', ')}`);
|
|
115
|
+
process.exit(1);
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
const script = generateScript(shell as Shell, tree);
|
|
119
|
+
|
|
120
|
+
if (!options.install) {
|
|
121
|
+
process.stdout.write(script);
|
|
122
|
+
return;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
const installPath = getInstallPath(shell as Shell);
|
|
126
|
+
const cmdCount = countCommands(tree);
|
|
127
|
+
|
|
128
|
+
log('');
|
|
129
|
+
log(`${BOLD}vibes completion${RESET} ${GRAY}${shell}${RESET}`);
|
|
130
|
+
log(`${'─'.repeat(50)}`);
|
|
131
|
+
|
|
132
|
+
// Write completion script
|
|
133
|
+
const dir = dirname(installPath);
|
|
134
|
+
if (!existsSync(dir)) mkdirSync(dir, { recursive: true });
|
|
135
|
+
await Bun.write(installPath, script);
|
|
136
|
+
log(` ${GREEN}✓${RESET} Wrote completion script ${GRAY}(${cmdCount} commands)${RESET}`);
|
|
137
|
+
log(` ${GRAY}${installPath}${RESET}`);
|
|
138
|
+
|
|
139
|
+
// Append to profile if needed
|
|
140
|
+
const profilePath = getProfilePath(shell as Shell);
|
|
141
|
+
const profileLine = getProfileLine(shell as Shell, installPath);
|
|
142
|
+
|
|
143
|
+
if (profilePath && profileLine) {
|
|
144
|
+
if (profileAlreadyConfigured(profilePath, shell as Shell)) {
|
|
145
|
+
log(` ${GREEN}✓${RESET} Shell profile already configured`);
|
|
146
|
+
log(` ${GRAY}${profilePath}${RESET}`);
|
|
147
|
+
} else {
|
|
148
|
+
const marker = '\n# vibes shell completion\n';
|
|
149
|
+
appendFileSync(profilePath, marker + profileLine + '\n');
|
|
150
|
+
log(` ${GREEN}✓${RESET} Appended to shell profile`);
|
|
151
|
+
log(` ${GRAY}${profilePath}${RESET}`);
|
|
152
|
+
}
|
|
153
|
+
} else if (shell === 'fish') {
|
|
154
|
+
log(` ${GREEN}✓${RESET} Fish loads completions automatically`);
|
|
155
|
+
} else if (shell === 'fig') {
|
|
156
|
+
log(` ${GREEN}✓${RESET} Amazon Q / Inshellisense will load spec automatically`);
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
// Features summary
|
|
160
|
+
log('');
|
|
161
|
+
log(` ${BOLD}Features:${RESET}`);
|
|
162
|
+
log(` ${GREEN}✓${RESET} Tab completion for all vibes commands`);
|
|
163
|
+
if (shell === 'zsh') {
|
|
164
|
+
log(` ${GREEN}✓${RESET} zsh-autosuggestions integration ${GRAY}(inline ghost-text)${RESET}`);
|
|
165
|
+
log(` ${GREEN}✓${RESET} Custom vibes strategy ${GRAY}(suggests from 296 known commands)${RESET}`);
|
|
166
|
+
}
|
|
167
|
+
if (shell === 'fig') {
|
|
168
|
+
log(` ${GREEN}✓${RESET} Rich dropdown UI in supported terminals`);
|
|
169
|
+
log(` ${GREEN}✓${RESET} Dynamic argument generators`);
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
log('');
|
|
173
|
+
log(` ${YELLOW}⏭${RESET} Restart your shell or run: ${BOLD}source ${profilePath ?? installPath}${RESET}`);
|
|
174
|
+
log('');
|
|
175
|
+
}
|
|
176
|
+
};
|
|
177
|
+
|
|
178
|
+
function countCommands(tree: ReturnType<typeof buildCommandTree>): number {
|
|
179
|
+
let count = 0;
|
|
180
|
+
for (const child of tree.children) {
|
|
181
|
+
if (child.children.length > 0) {
|
|
182
|
+
count += countCommands(child);
|
|
183
|
+
} else {
|
|
184
|
+
count++;
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
return count;
|
|
188
|
+
}
|