@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,173 @@
|
|
|
1
|
+
import { Command, CommanderError } from 'commander';
|
|
2
|
+
import { writeSync } from 'node:fs';
|
|
3
|
+
import { CLIExitSignal, registerCLIProviders, resetKeepAlive, shouldKeepAlive } from '../providers';
|
|
4
|
+
import { createPatternResolver } from '../patterns';
|
|
5
|
+
import { buildCommandContext } from './build-context';
|
|
6
|
+
import { registerGroups } from './register-groups';
|
|
7
|
+
import { registerCommands } from './register-commands';
|
|
8
|
+
import { getLogger } from '../logging';
|
|
9
|
+
const logger = getLogger('surface');
|
|
10
|
+
/**
|
|
11
|
+
* Strip frames pointing into the `bun build --compile` virtual filesystem
|
|
12
|
+
* (`/$bunfs/root/vibes.js:...`) and other bundle-only paths. These leak
|
|
13
|
+
* implementation details that aren't actionable for users.
|
|
14
|
+
*/
|
|
15
|
+
function stripBundlePaths(text) {
|
|
16
|
+
return text
|
|
17
|
+
.split('\n')
|
|
18
|
+
.filter((line) => {
|
|
19
|
+
if (line.includes('/$bunfs/'))
|
|
20
|
+
return false;
|
|
21
|
+
if (line.includes('B:/~BUN/'))
|
|
22
|
+
return false;
|
|
23
|
+
return true;
|
|
24
|
+
})
|
|
25
|
+
.join('\n')
|
|
26
|
+
.trim();
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Map common runtime errors to actionable, user-facing guidance.
|
|
30
|
+
* Falls back to the original message when no mapping applies.
|
|
31
|
+
*
|
|
32
|
+
* Returns `null` when no friendly mapping is known (caller falls back to
|
|
33
|
+
* the raw error message).
|
|
34
|
+
*/
|
|
35
|
+
function mapKnownError(rawMessage) {
|
|
36
|
+
// "No matching implementation found for query (filtered to: foo.bar)"
|
|
37
|
+
const noMatchingImpl = /No matching implementation found for query \(filtered to:\s*([^)]+)\)/i.exec(rawMessage);
|
|
38
|
+
if (noMatchingImpl) {
|
|
39
|
+
const target = noMatchingImpl[1].trim();
|
|
40
|
+
return (`No provider for "${target}". The plugin owning this query did not register, ` +
|
|
41
|
+
`or its dependencies are missing. Run with -v for plugin-load details.`);
|
|
42
|
+
}
|
|
43
|
+
// "No available adapter for record 'session.sessions'. Checked: storage.localdb"
|
|
44
|
+
const noAdapter = /No available adapter for record\s*'?([^'"\s]+)'?\.?\s*Checked:\s*([^\n]+)/i.exec(rawMessage);
|
|
45
|
+
if (noAdapter) {
|
|
46
|
+
const record = noAdapter[1].trim();
|
|
47
|
+
const checked = noAdapter[2].trim();
|
|
48
|
+
return (`No storage adapter is initialized for "${record}" (checked: ${checked}).\n` +
|
|
49
|
+
`Run \`vibes os init\` to set up local storage, or run with -v for details.`);
|
|
50
|
+
}
|
|
51
|
+
if (rawMessage.includes('getRuntimePathSync() called before the runtime path service was resolved')) {
|
|
52
|
+
return ('The runtime path service has not been initialized yet. ' +
|
|
53
|
+
'This is a bug — please report it. Run with -v for the full stack.');
|
|
54
|
+
}
|
|
55
|
+
return null;
|
|
56
|
+
}
|
|
57
|
+
function formatCliError(error, verbose) {
|
|
58
|
+
if (verbose) {
|
|
59
|
+
const text = error instanceof Error ? error.stack?.trim() || error.message.trim() : String(error);
|
|
60
|
+
return text;
|
|
61
|
+
}
|
|
62
|
+
const rawMessage = error instanceof Error ? error.message.trim() : String(error).trim();
|
|
63
|
+
const friendly = mapKnownError(rawMessage);
|
|
64
|
+
const body = friendly ?? rawMessage;
|
|
65
|
+
const cleaned = stripBundlePaths(body);
|
|
66
|
+
return cleaned || 'CLI command failed (run with -v for details).';
|
|
67
|
+
}
|
|
68
|
+
export class CLISurface {
|
|
69
|
+
runtime;
|
|
70
|
+
program;
|
|
71
|
+
options;
|
|
72
|
+
groups = new Map();
|
|
73
|
+
groupDescriptors = new Map();
|
|
74
|
+
patternResolver = null;
|
|
75
|
+
initialized = false;
|
|
76
|
+
constructor(runtime, program, options = {}) {
|
|
77
|
+
this.runtime = runtime;
|
|
78
|
+
this.program = program;
|
|
79
|
+
this.options = options;
|
|
80
|
+
}
|
|
81
|
+
async initialize() {
|
|
82
|
+
if (this.initialized)
|
|
83
|
+
throw new Error('CLISurface already initialized');
|
|
84
|
+
const { verbose, enablePatterns } = this.options;
|
|
85
|
+
this.program.exitOverride();
|
|
86
|
+
registerCLIProviders(this.runtime, this.options);
|
|
87
|
+
if (verbose)
|
|
88
|
+
logger.debug('Registered context providers');
|
|
89
|
+
if (enablePatterns) {
|
|
90
|
+
this.patternResolver = await createPatternResolver(this.runtime);
|
|
91
|
+
if (verbose) {
|
|
92
|
+
logger.debug(`Pattern resolver: ${this.patternResolver.getPatternTypes().join(', ')}`);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
const buildContext = async () => buildCommandContext(this.runtime);
|
|
96
|
+
if (verbose) {
|
|
97
|
+
logger.debug(`Registering groups...`);
|
|
98
|
+
logger.debug(`Runtime assets: cli/group=${this.runtime.assets('cli/group').descriptors().length}, cli/command=${this.runtime.assets('cli/command').descriptors().length}`);
|
|
99
|
+
}
|
|
100
|
+
await registerGroups({
|
|
101
|
+
runtime: this.runtime,
|
|
102
|
+
program: this.program,
|
|
103
|
+
groups: this.groups,
|
|
104
|
+
groupDescriptors: this.groupDescriptors,
|
|
105
|
+
options: this.options,
|
|
106
|
+
patternResolver: this.patternResolver,
|
|
107
|
+
buildContext
|
|
108
|
+
});
|
|
109
|
+
if (verbose)
|
|
110
|
+
logger.debug(`Registered ${this.groups.size} groups`);
|
|
111
|
+
await registerCommands({
|
|
112
|
+
runtime: this.runtime,
|
|
113
|
+
program: this.program,
|
|
114
|
+
groups: this.groups,
|
|
115
|
+
groupDescriptors: this.groupDescriptors,
|
|
116
|
+
options: this.options,
|
|
117
|
+
patternResolver: this.patternResolver,
|
|
118
|
+
buildContext
|
|
119
|
+
});
|
|
120
|
+
this.initialized = true;
|
|
121
|
+
if (verbose)
|
|
122
|
+
logger.debug('Surface initialized');
|
|
123
|
+
}
|
|
124
|
+
async run(argv = process.argv) {
|
|
125
|
+
if (!this.initialized)
|
|
126
|
+
await this.initialize();
|
|
127
|
+
// Ensure stale keepAlive state from eager module side effects never leaks into a new invocation.
|
|
128
|
+
resetKeepAlive();
|
|
129
|
+
let exitCode;
|
|
130
|
+
try {
|
|
131
|
+
if (argv.slice(2).length === 0) {
|
|
132
|
+
this.program.outputHelp();
|
|
133
|
+
exitCode = 0;
|
|
134
|
+
}
|
|
135
|
+
else {
|
|
136
|
+
await this.program.parseAsync(argv);
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
catch (error) {
|
|
140
|
+
if (error instanceof CLIExitSignal) {
|
|
141
|
+
exitCode = error.code;
|
|
142
|
+
}
|
|
143
|
+
else if (error instanceof CommanderError || ('exitCode' in error && 'code' in error)) {
|
|
144
|
+
// `commander.help` / `commander.helpDisplayed` / `commander.version`
|
|
145
|
+
// are not failures — they're successful help/version output. Map them
|
|
146
|
+
// to exit 0 so non-TTY callers (CI, subprocesses) treat them the
|
|
147
|
+
// same way TTY users see them.
|
|
148
|
+
const helpCodes = new Set([
|
|
149
|
+
'commander.help',
|
|
150
|
+
'commander.helpDisplayed',
|
|
151
|
+
'commander.version'
|
|
152
|
+
]);
|
|
153
|
+
exitCode = helpCodes.has(error.code) ? 0 : error.exitCode;
|
|
154
|
+
}
|
|
155
|
+
else {
|
|
156
|
+
exitCode = 1;
|
|
157
|
+
const formatted = formatCliError(error, !!this.options.verbose);
|
|
158
|
+
if (formatted) {
|
|
159
|
+
writeSync(2, `${formatted}\n`);
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
if (exitCode !== undefined) {
|
|
164
|
+
process.exitCode = exitCode;
|
|
165
|
+
}
|
|
166
|
+
if (!shouldKeepAlive()) {
|
|
167
|
+
if (this.options.onBeforeAutoExit)
|
|
168
|
+
await this.options.onBeforeAutoExit();
|
|
169
|
+
process.exit(exitCode ?? process.exitCode ?? 0);
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
//# sourceMappingURL=CLISurface.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CLISurface.js","sourceRoot":"","sources":["../../src/surface/CLISurface.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AACpD,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAEpC,OAAO,EAAE,aAAa,EAAE,oBAAoB,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AACpG,OAAO,EAAE,qBAAqB,EAAwB,MAAM,aAAa,CAAC;AAG1E,OAAO,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AACtD,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAEvC,MAAM,MAAM,GAAG,SAAS,CAAC,SAAS,CAAC,CAAC;AAEpC;;;;GAIG;AACH,SAAS,gBAAgB,CAAC,I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,GAAG,SAAS,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,QAAQ,CAAC;YAC3D,CAAC;iBAAM,CAAC;gBACP,QAAQ,GAAG,CAAC,CAAC;gBACb,MAAM,SAAS,GAAG,cAAc,CAAC,KAAK,EAAE,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;gBAChE,IAAI,SAAS,EAAE,CAAC;oBACf,SAAS,CAAC,CAAC,EAAE,GAAG,SAAS,IAAI,CAAC,CAAC;gBAChC,CAAC;YACF,CAAC;QACF,CAAC;QAED,IAAI,QAAQ,KAAK,SAAS,EAAE,CAAC;YAC5B,OAAO,CAAC,QAAQ,GAAG,QAAQ,CAAC;QAC7B,CAAC;QACD,IAAI,CAAC,eAAe,EAAE,EAAE,CAAC;YACxB,IAAI,IAAI,CAAC,OAAO,CAAC,gBAAgB;gBAAE,MAAM,IAAI,CAAC,OAAO,CAAC,gBAAgB,EAAE,CAAC;YACzE,OAAO,CAAC,IAAI,CAAC,QAAQ,IAAI,OAAO,CAAC,QAAQ,IAAI,CAAC,CAAC,CAAC;QACjD,CAAC;IACF,CAAC;CACD"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { Command } from 'commander';
|
|
2
|
+
import type { VibesRuntime } from '@vibesdotdev/runtime/api/runtime';
|
|
3
|
+
import type { CLICommandAssetDescriptor } from '../schemas/descriptors';
|
|
4
|
+
interface TuiActionHooks {
|
|
5
|
+
beforeExecute?: (params: {
|
|
6
|
+
args: Record<string, unknown>;
|
|
7
|
+
options: Record<string, unknown>;
|
|
8
|
+
}) => Promise<void>;
|
|
9
|
+
}
|
|
10
|
+
export declare function attachTuiAction(cmd: Command, runtime: VibesRuntime, descriptor: CLICommandAssetDescriptor, hooks?: TuiActionHooks): Promise<void>;
|
|
11
|
+
export {};
|
|
12
|
+
//# sourceMappingURL=attach-tui-action.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"attach-tui-action.d.ts","sourceRoot":"","sources":["../../src/surface/attach-tui-action.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAC;AACrE,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,wBAAwB,CAAC;AAExE,UAAU,cAAc;IACvB,aAAa,CAAC,EAAE,CAAC,MAAM,EAAE;QACxB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;QAC9B,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;KACjC,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;CACpB;AAED,wBAAsB,eAAe,CACpC,GAAG,EAAE,OAAO,EACZ,OAAO,EAAE,YAAY,EACrB,UAAU,EAAE,yBAAyB,EACrC,KAAK,GAAE,cAAmB,GACxB,OAAO,CAAC,IAAI,CAAC,CA2Df"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
var __rewriteRelativeImportExtension = (this && this.__rewriteRelativeImportExtension) || function (path, preserveJsx) {
|
|
2
|
+
if (typeof path === "string" && /^\.\.?\//.test(path)) {
|
|
3
|
+
return path.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i, function (m, tsx, d, ext, cm) {
|
|
4
|
+
return tsx ? preserveJsx ? ".jsx" : ".js" : d && (!ext || !cm) ? m : (d + ext + "." + cm.toLowerCase() + "js");
|
|
5
|
+
});
|
|
6
|
+
}
|
|
7
|
+
return path;
|
|
8
|
+
};
|
|
9
|
+
export async function attachTuiAction(cmd, runtime, descriptor, hooks = {}) {
|
|
10
|
+
const tuiAppId = descriptor.tuiAppId;
|
|
11
|
+
cmd.action(async (...actionArgs) => {
|
|
12
|
+
actionArgs.pop();
|
|
13
|
+
const options = actionArgs.pop();
|
|
14
|
+
const args = {};
|
|
15
|
+
if (descriptor.arguments) {
|
|
16
|
+
descriptor.arguments.forEach((arg, i) => {
|
|
17
|
+
if (i < actionArgs.length)
|
|
18
|
+
args[arg.name] = actionArgs[i];
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
if (hooks.beforeExecute) {
|
|
22
|
+
await hooks.beforeExecute({ args, options });
|
|
23
|
+
}
|
|
24
|
+
const { ensureOpenTuiReactRuntimePluginSupport } = (await import(__rewriteRelativeImportExtension('@vibesdotdev/tui/services/runtime-plugin-support.impl.consumer')));
|
|
25
|
+
ensureOpenTuiReactRuntimePluginSupport();
|
|
26
|
+
// Dynamic imports to avoid hard dependency on tui/react from cli
|
|
27
|
+
const { startTuiApp } = (await import(__rewriteRelativeImportExtension('@vibesdotdev/tui/services')));
|
|
28
|
+
const { TuiAppShell } = (await import(__rewriteRelativeImportExtension('@vibesdotdev/tui/shell')));
|
|
29
|
+
const _reactId = 'react';
|
|
30
|
+
const React = (await import(__rewriteRelativeImportExtension(/* @vite-ignore */ _reactId)));
|
|
31
|
+
const appDescriptor = runtime
|
|
32
|
+
.assets('tui/app')
|
|
33
|
+
.descriptors()
|
|
34
|
+
.find((d) => d.id === tuiAppId);
|
|
35
|
+
const appImpl = (await runtime.query('tui/app').withId(tuiAppId).resolve());
|
|
36
|
+
await startTuiApp({
|
|
37
|
+
errorBoundary: false,
|
|
38
|
+
keyboardProvider: false,
|
|
39
|
+
render: (onExit) => React.createElement(TuiAppShell, {
|
|
40
|
+
runtime,
|
|
41
|
+
states: appDescriptor?.states,
|
|
42
|
+
onExit,
|
|
43
|
+
children: React.createElement(appImpl.component, { runtime, onExit, options, args })
|
|
44
|
+
})
|
|
45
|
+
});
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
//# sourceMappingURL=attach-tui-action.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"attach-tui-action.js","sourceRoot":"","sources":["../../src/surface/att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F,MAAM,aAAa,GAAG,OAAO;aAC3B,MAAM,CAAC,SAAS,CAAC;aACjB,WAAW,EAAE;aACb,IAAI,CAAC,CAAC,CAAiB,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,QAAQ,CAEnC,CAAC;QAEb,MAAM,OAAO,GAAG,CAAC,MAAM,OAAO,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,OAAO,EAAE,CAEzE,CAAC;QAEF,MAAM,WAAW,CAAC;YACjB,aAAa,EAAE,KAAK;YACpB,gBAAgB,EAAE,KAAK;YACvB,MAAM,EAAE,CAAC,MAAkB,EAAE,EAAE,CAC9B,KAAK,CAAC,aAAa,CAAC,WAAsB,EAAE;gBAC3C,OAAO;gBACP,MAAM,EAAE,aAAa,EAAE,MAAM;gBAC7B,MAAM;gBACN,QAAQ,EAAE,KAAK,CAAC,aAAa,CAAC,OAAO,CAAC,SAAS,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;aACpF,CAAC;SACH,CAAC,CAAC;IACJ,CAAC,CAAC,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"build-context.d.ts","sourceRoot":"","sources":["../../src/surface/build-context.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAC;AAErE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAEzD,wBAAsB,mBAAmB,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,cAAc,CAAC,CA4CxF"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
export async function buildCommandContext(runtime) {
|
|
2
|
+
const ctx = { runtime };
|
|
3
|
+
try {
|
|
4
|
+
ctx.ui = await runtime.context('cli/ui');
|
|
5
|
+
}
|
|
6
|
+
catch {
|
|
7
|
+
try {
|
|
8
|
+
ctx.ui = await runtime.context('ui');
|
|
9
|
+
}
|
|
10
|
+
catch {
|
|
11
|
+
/* optional */
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
try {
|
|
15
|
+
ctx.logger = await runtime.context('cli/logger');
|
|
16
|
+
}
|
|
17
|
+
catch {
|
|
18
|
+
try {
|
|
19
|
+
ctx.logger = await runtime.context('logger');
|
|
20
|
+
}
|
|
21
|
+
catch {
|
|
22
|
+
/* optional */
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
try {
|
|
26
|
+
ctx.app = await runtime.context('cli/app');
|
|
27
|
+
}
|
|
28
|
+
catch {
|
|
29
|
+
try {
|
|
30
|
+
ctx.app = await runtime.context('app');
|
|
31
|
+
}
|
|
32
|
+
catch {
|
|
33
|
+
/* optional */
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
try {
|
|
37
|
+
ctx.config = await runtime.context('config/context');
|
|
38
|
+
}
|
|
39
|
+
catch {
|
|
40
|
+
try {
|
|
41
|
+
ctx.config = await runtime.context('config');
|
|
42
|
+
}
|
|
43
|
+
catch {
|
|
44
|
+
/* optional */
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
return ctx;
|
|
48
|
+
}
|
|
49
|
+
//# sourceMappingURL=build-context.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"build-context.js","sourceRoot":"","sources":["../../src/surface/build-context.ts"],"names":[],"mappings":"AAIA,MAAM,CAAC,KAAK,UAAU,mBAAmB,CAAC,OAAqB;IAC9D,MAAM,GAAG,GAAmB,EAAE,OAAO,EAAE,CAAC;IAExC,IAAI,CAAC;QACJ,GAAG,CAAC,EAAE,GAAG,MAAM,OAAO,CAAC,OAAO,CAAY,QAAQ,CAAC,CAAC;IACrD,CAAC;IAAC,MAAM,CAAC;QACR,IAAI,CAAC;YACJ,GAAG,CAAC,EAAE,GAAG,MAAM,OAAO,CAAC,OAAO,CAAY,IAAI,CAAC,CAAC;QACjD,CAAC;QAAC,MAAM,CAAC;YACR,cAAc;QACf,CAAC;IACF,CAAC;IAED,IAAI,CAAC;QACJ,GAAG,CAAC,MAAM,GAAG,MAAM,OAAO,CAAC,OAAO,CAAgB,YAAY,CAAC,CAAC;IACjE,CAAC;IAAC,MAAM,CAAC;QACR,IAAI,CAAC;YACJ,GAAG,CAAC,MAAM,GAAG,MAAM,OAAO,CAAC,OAAO,CAAgB,QAAQ,CAAC,CAAC;QAC7D,CAAC;QAAC,MAAM,CAAC;YACR,cAAc;QACf,CAAC;IACF,CAAC;IAED,IAAI,CAAC;QACJ,GAAG,CAAC,GAAG,GAAG,MAAM,OAAO,CAAC,OAAO,CAAa,SAAS,CAAC,CAAC;IACxD,CAAC;IAAC,MAAM,CAAC;QACR,IAAI,CAAC;YACJ,GAAG,CAAC,GAAG,GAAG,MAAM,OAAO,CAAC,OAAO,CAAa,KAAK,CAAC,CAAC;QACpD,CAAC;QAAC,MAAM,CAAC;YACR,cAAc;QACf,CAAC;IACF,CAAC;IAED,IAAI,CAAC;QACJ,GAAG,CAAC,MAAM,GAAG,MAAM,OAAO,CAAC,OAAO,CAAgB,gBAAgB,CAAC,CAAC;IACrE,CAAC;IAAC,MAAM,CAAC;QACR,IAAI,CAAC;YACJ,GAAG,CAAC,MAAM,GAAG,MAAM,OAAO,CAAC,OAAO,CAAgB,QAAQ,CAAC,CAAC;QAC7D,CAAC;QAAC,MAAM,CAAC;YACR,cAAc;QACf,CAAC;IACF,CAAC;IAED,OAAO,GAAG,CAAC;AACZ,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { CLICommandAssetDescriptor } from '../schemas/descriptors';
|
|
2
|
+
import type { CLISurfaceOptions } from '../schemas/surface';
|
|
3
|
+
export declare const DEFAULT_ROOT_FALLBACK_GROUPS: readonly string[];
|
|
4
|
+
export declare function allowedRootFallbackGroups(options: CLISurfaceOptions): Set<string>;
|
|
5
|
+
export declare function findUnexpectedMissingGroups(commands: Array<Pick<CLICommandAssetDescriptor, 'id' | 'group'>>, knownGroups: Set<string>, rootFallbackGroups: Set<string>): Map<string, string[]>;
|
|
6
|
+
export declare function findScopeMissingGroups(commands: Array<Pick<CLICommandAssetDescriptor, 'id' | 'group'>>, registeredGroups: Set<string>, declaredGroups: Set<string>, rootFallbackGroups: Set<string>): Map<string, string[]>;
|
|
7
|
+
//# sourceMappingURL=command-group-policy.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"command-group-policy.d.ts","sourceRoot":"","sources":["../../src/surface/command-group-policy.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,wBAAwB,CAAC;AACxE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAE5D,eAAO,MAAM,4BAA4B,mBAQvC,CAAC;AAEH,wBAAgB,yBAAyB,CAAC,OAAO,EAAE,iBAAiB,GAAG,GAAG,CAAC,MAAM,CAAC,CAGjF;AAED,wBAAgB,2BAA2B,CAC1C,QAAQ,EAAE,KAAK,CAAC,IAAI,CAAC,yBAAyB,EAAE,IAAI,GAAG,OAAO,CAAC,CAAC,EAChE,WAAW,EAAE,GAAG,CAAC,MAAM,CAAC,EACxB,kBAAkB,EAAE,GAAG,CAAC,MAAM,CAAC,GAC7B,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAUvB;AAED,wBAAgB,sBAAsB,CACrC,QAAQ,EAAE,KAAK,CAAC,IAAI,CAAC,yBAAyB,EAAE,IAAI,GAAG,OAAO,CAAC,CAAC,EAChE,gBAAgB,EAAE,GAAG,CAAC,MAAM,CAAC,EAC7B,cAAc,EAAE,GAAG,CAAC,MAAM,CAAC,EAC3B,kBAAkB,EAAE,GAAG,CAAC,MAAM,CAAC,GAC7B,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAYvB"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
export const DEFAULT_ROOT_FALLBACK_GROUPS = Object.freeze([
|
|
2
|
+
'chat',
|
|
3
|
+
'shell-integration',
|
|
4
|
+
'man',
|
|
5
|
+
'marshal',
|
|
6
|
+
'settings',
|
|
7
|
+
'studio',
|
|
8
|
+
'work'
|
|
9
|
+
]);
|
|
10
|
+
export function allowedRootFallbackGroups(options) {
|
|
11
|
+
const extra = options.rootFallbackGroups ?? [];
|
|
12
|
+
return new Set([...DEFAULT_ROOT_FALLBACK_GROUPS, ...extra]);
|
|
13
|
+
}
|
|
14
|
+
export function findUnexpectedMissingGroups(commands, knownGroups, rootFallbackGroups) {
|
|
15
|
+
const missing = new Map();
|
|
16
|
+
for (const descriptor of commands) {
|
|
17
|
+
const groupId = descriptor.group;
|
|
18
|
+
if (knownGroups.has(groupId) || rootFallbackGroups.has(groupId))
|
|
19
|
+
continue;
|
|
20
|
+
const commandIds = missing.get(groupId) ?? [];
|
|
21
|
+
commandIds.push(descriptor.id);
|
|
22
|
+
missing.set(groupId, commandIds);
|
|
23
|
+
}
|
|
24
|
+
return missing;
|
|
25
|
+
}
|
|
26
|
+
export function findScopeMissingGroups(commands, registeredGroups, declaredGroups, rootFallbackGroups) {
|
|
27
|
+
const missing = new Map();
|
|
28
|
+
for (const descriptor of commands) {
|
|
29
|
+
const groupId = descriptor.group;
|
|
30
|
+
if (registeredGroups.has(groupId))
|
|
31
|
+
continue;
|
|
32
|
+
if (rootFallbackGroups.has(groupId))
|
|
33
|
+
continue;
|
|
34
|
+
if (!declaredGroups.has(groupId))
|
|
35
|
+
continue;
|
|
36
|
+
const commandIds = missing.get(groupId) ?? [];
|
|
37
|
+
commandIds.push(descriptor.id);
|
|
38
|
+
missing.set(groupId, commandIds);
|
|
39
|
+
}
|
|
40
|
+
return missing;
|
|
41
|
+
}
|
|
42
|
+
//# sourceMappingURL=command-group-policy.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"command-group-policy.js","sourceRoot":"","sources":["../../src/surface/command-group-policy.ts"],"names":[],"mappings":"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C5C,IAAI,kBAAkB,CAAC,GAAG,CAAC,OAAO,CAAC;YAAE,SAAS;QAC9C,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,OAAO,CAAC;YAAE,SAAS;QAC3C,MAAM,UAAU,GAAG,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC;QAC9C,UAAU,CAAC,IAAI,CAAC,UAAU,CAAC,EAAE,CAAC,CAAC;QAC/B,OAAO,CAAC,GAAG,CAAC,OAAO,EAAE,UAAU,CAAC,CAAC;IAClC,CAAC;IACD,OAAO,OAAO,CAAC;AAChB,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { VibesRuntime } from '@vibesdotdev/runtime/api/runtime';
|
|
2
|
+
import type { CLICommandAssetDescriptor, CLIGroupAssetDescriptor } from '../schemas/descriptors';
|
|
3
|
+
export interface CLIDiscoveryOptions {
|
|
4
|
+
includeInternal?: boolean;
|
|
5
|
+
}
|
|
6
|
+
export interface CLIDiscovery {
|
|
7
|
+
allGroups: CLIGroupAssetDescriptor[];
|
|
8
|
+
allCommands: CLICommandAssetDescriptor[];
|
|
9
|
+
groups: CLIGroupAssetDescriptor[];
|
|
10
|
+
commands: CLICommandAssetDescriptor[];
|
|
11
|
+
groupsById: Map<string, CLIGroupAssetDescriptor>;
|
|
12
|
+
sortedGroups: CLIGroupAssetDescriptor[];
|
|
13
|
+
sortedCommands: CLICommandAssetDescriptor[];
|
|
14
|
+
}
|
|
15
|
+
export declare function getCLIDiscovery(runtime: VibesRuntime, options?: CLIDiscoveryOptions): CLIDiscovery;
|
|
16
|
+
export declare function clearCLIDiscoveryCache(runtime?: VibesRuntime): void;
|
|
17
|
+
//# sourceMappingURL=discovery-cache.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"discovery-cache.d.ts","sourceRoot":"","sources":["../../src/surface/discovery-cache.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAC;AACrE,OAAO,KAAK,EACX,yBAAyB,EACzB,uBAAuB,EACvB,MAAM,wBAAwB,CAAC;AAEhC,MAAM,WAAW,mBAAmB;IACnC,eAAe,CAAC,EAAE,OAAO,CAAC;CAC1B;AAED,MAAM,WAAW,YAAY;IAC5B,SAAS,EAAE,uBAAuB,EAAE,CAAC;IACrC,WAAW,EAAE,yBAAyB,EAAE,CAAC;IACzC,MAAM,EAAE,uBAAuB,EAAE,CAAC;IAClC,QAAQ,EAAE,yBAAyB,EAAE,CAAC;IACtC,UAAU,EAAE,GAAG,CAAC,MAAM,EAAE,uBAAuB,CAAC,CAAC;IACjD,YAAY,EAAE,uBAAuB,EAAE,CAAC;IACxC,cAAc,EAAE,yBAAyB,EAAE,CAAC;CAC5C;AASD,wBAAgB,eAAe,CAC9B,OAAO,EAAE,YAAY,EACrB,OAAO,GAAE,mBAAwB,GAC/B,YAAY,CAsDd;AAED,wBAAgB,sBAAsB,CAAC,OAAO,CAAC,EAAE,YAAY,GAAG,IAAI,CAOnE"}
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
const discoveryCache = new WeakMap();
|
|
2
|
+
export function getCLIDiscovery(runtime, options = {}) {
|
|
3
|
+
const includeInternal = options.includeInternal === true;
|
|
4
|
+
const allGroups = runtime.assets('cli/group').descriptors();
|
|
5
|
+
const allCommands = runtime.assets('cli/command').descriptors();
|
|
6
|
+
const scope = runtime.scope;
|
|
7
|
+
const cacheKey = [
|
|
8
|
+
scope.surface ?? '',
|
|
9
|
+
scope.hardware ?? '',
|
|
10
|
+
scope.purpose ?? '',
|
|
11
|
+
includeInternal ? 'internal' : 'public'
|
|
12
|
+
].join(':');
|
|
13
|
+
const fingerprint = buildFingerprint(allGroups, allCommands);
|
|
14
|
+
let runtimeCache = discoveryCache.get(runtime);
|
|
15
|
+
if (!runtimeCache) {
|
|
16
|
+
runtimeCache = new Map();
|
|
17
|
+
discoveryCache.set(runtime, runtimeCache);
|
|
18
|
+
}
|
|
19
|
+
const cached = runtimeCache.get(cacheKey);
|
|
20
|
+
if (cached?.fingerprint === fingerprint)
|
|
21
|
+
return cached.discovery;
|
|
22
|
+
const groupsById = new Map(allGroups.map((group) => [group.id, group]));
|
|
23
|
+
const groups = allGroups.filter((group) => {
|
|
24
|
+
if (group.enabled === false)
|
|
25
|
+
return false;
|
|
26
|
+
if (group.hardware?.length && !group.hardware.includes(scope.hardware))
|
|
27
|
+
return false;
|
|
28
|
+
if (group.surfaces?.length && !group.surfaces.includes(scope.surface))
|
|
29
|
+
return false;
|
|
30
|
+
if (!includeInternal && group.internal === true)
|
|
31
|
+
return false;
|
|
32
|
+
return true;
|
|
33
|
+
});
|
|
34
|
+
const commands = allCommands.filter((command) => {
|
|
35
|
+
if (command.enabled === false)
|
|
36
|
+
return false;
|
|
37
|
+
if (command.hardware?.length && !command.hardware.includes(scope.hardware))
|
|
38
|
+
return false;
|
|
39
|
+
if (command.surfaces?.length &&
|
|
40
|
+
!command.surfaces.includes(scope.surface))
|
|
41
|
+
return false;
|
|
42
|
+
if (!includeInternal && command.internal === true)
|
|
43
|
+
return false;
|
|
44
|
+
if (!includeInternal && groupsById.get(command.group)?.internal === true)
|
|
45
|
+
return false;
|
|
46
|
+
return true;
|
|
47
|
+
});
|
|
48
|
+
const discovery = {
|
|
49
|
+
allGroups,
|
|
50
|
+
allCommands,
|
|
51
|
+
groups,
|
|
52
|
+
commands,
|
|
53
|
+
groupsById,
|
|
54
|
+
sortedGroups: sortGroupsByDepth(groups),
|
|
55
|
+
sortedCommands: [...commands].sort(byOrder)
|
|
56
|
+
};
|
|
57
|
+
runtimeCache.set(cacheKey, { fingerprint, discovery });
|
|
58
|
+
return discovery;
|
|
59
|
+
}
|
|
60
|
+
export function clearCLIDiscoveryCache(runtime) {
|
|
61
|
+
if (runtime) {
|
|
62
|
+
discoveryCache.delete(runtime);
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
// WeakMap cannot be cleared. This helper intentionally supports targeted
|
|
66
|
+
// invalidation for tests or runtimes that mutate descriptors after bootstrap.
|
|
67
|
+
}
|
|
68
|
+
function sortGroupsByDepth(groups) {
|
|
69
|
+
const groupMap = new Map(groups.map((group) => [group.id, group]));
|
|
70
|
+
const depths = new Map();
|
|
71
|
+
const getDepth = (group) => {
|
|
72
|
+
const existing = depths.get(group.id);
|
|
73
|
+
if (existing !== undefined)
|
|
74
|
+
return existing;
|
|
75
|
+
if (!group.parent) {
|
|
76
|
+
depths.set(group.id, 0);
|
|
77
|
+
return 0;
|
|
78
|
+
}
|
|
79
|
+
const parent = groupMap.get(group.parent);
|
|
80
|
+
if (!parent) {
|
|
81
|
+
depths.set(group.id, 0);
|
|
82
|
+
return 0;
|
|
83
|
+
}
|
|
84
|
+
const depth = getDepth(parent) + 1;
|
|
85
|
+
depths.set(group.id, depth);
|
|
86
|
+
return depth;
|
|
87
|
+
};
|
|
88
|
+
for (const group of groups)
|
|
89
|
+
getDepth(group);
|
|
90
|
+
return [...groups].sort((a, b) => {
|
|
91
|
+
const depthDiff = (depths.get(a.id) ?? 0) - (depths.get(b.id) ?? 0);
|
|
92
|
+
if (depthDiff !== 0)
|
|
93
|
+
return depthDiff;
|
|
94
|
+
return byOrder(a, b);
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
function byOrder(a, b) {
|
|
98
|
+
const orderDiff = (a.order ?? 999) - (b.order ?? 999);
|
|
99
|
+
if (orderDiff !== 0)
|
|
100
|
+
return orderDiff;
|
|
101
|
+
return a.id.localeCompare(b.id);
|
|
102
|
+
}
|
|
103
|
+
function buildFingerprint(groups, commands) {
|
|
104
|
+
return JSON.stringify({ groups, commands });
|
|
105
|
+
}
|
|
106
|
+
//# sourceMappingURL=discovery-cache.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"discovery-cache.js","sourceRoot":"","sources":["../../src/surface/discovery-cache.ts"],"names":[],"mappings":"AAyBA,MAAM,cAAc,GAAG,IAAI,OAAO,EAA8C,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+
import type { VibesRuntime } from '@vibesdotdev/runtime/api/runtime';
|
|
3
|
+
import type { CLIGroupAssetDescriptor } from '../schemas/descriptors';
|
|
4
|
+
import type { PatternResolver } from '../patterns';
|
|
5
|
+
import type { CLISurfaceOptions, CommandContext } from '../schemas/surface';
|
|
6
|
+
export declare function registerCommands(params: {
|
|
7
|
+
runtime: VibesRuntime;
|
|
8
|
+
program: Command;
|
|
9
|
+
groups: Map<string, Command>;
|
|
10
|
+
groupDescriptors: Map<string, CLIGroupAssetDescriptor>;
|
|
11
|
+
options: CLISurfaceOptions;
|
|
12
|
+
patternResolver: PatternResolver | null;
|
|
13
|
+
buildContext: () => Promise<CommandContext>;
|
|
14
|
+
}): Promise<void>;
|
|
15
|
+
//# sourceMappingURL=register-commands.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"register-commands.d.ts","sourceRoot":"","sources":["../../src/surface/register-commands.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEzC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAC;AACrE,OAAO,KAAK,EAEX,uBAAuB,EAEvB,MAAM,wBAAwB,CAAC;AAChC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAEnD,OAAO,KAAK,EACX,iBAAiB,EACjB,cAAc,EAEd,MAAM,oBAAoB,CAAC;AAY5B,wBAAsB,gBAAgB,CAAC,MAAM,EAAE;IAC9C,OAAO,EAAE,YAAY,CAAC;IACtB,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC7B,gBAAgB,EAAE,GAAG,CAAC,MAAM,EAAE,uBAAuB,CAAC,CAAC;IACvD,OAAO,EAAE,iBAAiB,CAAC;IAC3B,eAAe,EAAE,eAAe,GAAG,IAAI,CAAC;IACxC,YAAY,EAAE,MAAM,OAAO,CAAC,cAAc,CAAC,CAAC;CAC5C,GAAG,OAAO,CAAC,IAAI,CAAC,CA2ChB"}
|