@vibesdotdev/cli 0.0.2 → 1.0.0-rc.3
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/LICENSE +18 -0
- package/README.md +261 -1
- package/dist/boot/action-lifetime.d.ts +16 -0
- package/dist/boot/action-lifetime.d.ts.map +1 -0
- package/dist/boot/action-lifetime.js +80 -0
- package/dist/boot/action-lifetime.js.map +1 -0
- package/dist/boot/bootstrap.d.ts +190 -0
- package/dist/boot/bootstrap.d.ts.map +1 -0
- package/dist/boot/bootstrap.js +737 -0
- package/dist/boot/bootstrap.js.map +1 -0
- package/dist/boot/cli-flags.d.ts +45 -0
- package/dist/boot/cli-flags.d.ts.map +1 -0
- package/dist/boot/cli-flags.js +113 -0
- package/dist/boot/cli-flags.js.map +1 -0
- package/dist/boot/config.d.ts +25 -0
- package/dist/boot/config.d.ts.map +1 -0
- package/dist/{config.js → boot/config.js} +1 -1
- package/dist/boot/config.js.map +1 -0
- package/dist/boot/external-url.d.ts +13 -0
- package/dist/boot/external-url.d.ts.map +1 -0
- package/dist/boot/external-url.js +66 -0
- package/dist/boot/external-url.js.map +1 -0
- package/dist/boot/host-argv.d.ts +7 -0
- package/dist/boot/host-argv.d.ts.map +1 -0
- package/dist/boot/host-argv.js +8 -0
- package/dist/boot/host-argv.js.map +1 -0
- package/dist/boot/host-bootstrap.d.ts +37 -0
- package/dist/boot/host-bootstrap.d.ts.map +1 -0
- package/dist/boot/host-bootstrap.js +60 -0
- package/dist/boot/host-bootstrap.js.map +1 -0
- package/dist/boot/providers.d.ts +35 -0
- package/dist/boot/providers.d.ts.map +1 -0
- package/dist/boot/providers.js +155 -0
- package/dist/boot/providers.js.map +1 -0
- package/dist/boot/schemas/external-url.d.ts +11 -0
- package/dist/boot/schemas/external-url.d.ts.map +1 -0
- package/dist/boot/schemas/external-url.js +3 -0
- package/dist/boot/schemas/external-url.js.map +1 -0
- package/dist/boot/schemas/host-bootstrap.d.ts +7 -0
- package/dist/boot/schemas/host-bootstrap.d.ts.map +1 -0
- package/dist/boot/schemas/host-bootstrap.js +3 -0
- package/dist/boot/schemas/host-bootstrap.js.map +1 -0
- package/dist/boot/schemas/providers.d.ts +23 -0
- package/dist/boot/schemas/providers.d.ts.map +1 -0
- package/dist/boot/schemas/providers.js +3 -0
- package/dist/boot/schemas/providers.js.map +1 -0
- package/dist/boot/schemas/types.d.ts +4 -0
- package/dist/boot/schemas/types.d.ts.map +1 -0
- package/dist/{api → boot}/schemas/types.js.map +1 -1
- package/dist/boot/tui-plugin-policy.d.ts +8 -0
- package/dist/boot/tui-plugin-policy.d.ts.map +1 -0
- package/dist/boot/tui-plugin-policy.js +26 -0
- package/dist/boot/tui-plugin-policy.js.map +1 -0
- package/dist/boot/version.d.ts +13 -0
- package/dist/boot/version.d.ts.map +1 -0
- package/dist/boot/version.js +14 -0
- package/dist/boot/version.js.map +1 -0
- package/dist/bun/index.d.ts +2 -0
- package/dist/bun/index.d.ts.map +1 -0
- package/dist/bun/index.js +2 -0
- package/dist/bun/index.js.map +1 -0
- package/dist/bun/interactive-host.d.ts +9 -0
- package/dist/bun/interactive-host.d.ts.map +1 -0
- package/dist/bun/interactive-host.js +18 -0
- package/dist/bun/interactive-host.js.map +1 -0
- package/dist/commands/cli.kinds.d.ts +1239 -0
- package/dist/commands/cli.kinds.d.ts.map +1 -0
- package/dist/commands/cli.kinds.js +138 -0
- package/dist/commands/cli.kinds.js.map +1 -0
- package/dist/commands/cli.plugin.d.ts +22 -0
- package/dist/commands/cli.plugin.d.ts.map +1 -0
- package/dist/commands/cli.plugin.js +138 -0
- package/dist/commands/cli.plugin.js.map +1 -0
- package/dist/commands/completion/bash.d.ts +1 -1
- package/dist/commands/completion/bash.d.ts.map +1 -1
- package/dist/commands/completion/bash.impl.consumer.d.ts +6 -0
- package/dist/commands/completion/bash.impl.consumer.d.ts.map +1 -0
- package/dist/commands/completion/bash.impl.consumer.js +6 -0
- package/dist/commands/completion/bash.impl.consumer.js.map +1 -0
- package/dist/commands/completion/bash.js +4 -2
- package/dist/commands/completion/bash.js.map +1 -1
- package/dist/commands/completion/completion.consumer.plugin.d.ts +3 -0
- package/dist/commands/completion/completion.consumer.plugin.d.ts.map +1 -0
- package/dist/commands/completion/completion.consumer.plugin.js +19 -0
- package/dist/commands/completion/completion.consumer.plugin.js.map +1 -0
- package/dist/commands/completion/completion.descriptor.d.ts +1 -2
- package/dist/commands/completion/completion.descriptor.d.ts.map +1 -1
- package/dist/commands/completion/completion.descriptor.js +11 -4
- package/dist/commands/completion/completion.descriptor.js.map +1 -1
- package/dist/commands/completion/completion.descriptors.d.ts +3 -0
- package/dist/commands/completion/completion.descriptors.d.ts.map +1 -0
- package/dist/commands/completion/completion.descriptors.js +56 -0
- package/dist/commands/completion/completion.descriptors.js.map +1 -0
- package/dist/commands/completion/completion.impl.d.ts +5 -4
- package/dist/commands/completion/completion.impl.d.ts.map +1 -1
- package/dist/commands/completion/completion.impl.js +104 -145
- package/dist/commands/completion/completion.impl.js.map +1 -1
- package/dist/commands/completion/completion.install.impl.consumer.d.ts +4 -0
- package/dist/commands/completion/completion.install.impl.consumer.d.ts.map +1 -0
- package/dist/commands/completion/completion.install.impl.consumer.js +102 -0
- package/dist/commands/completion/completion.install.impl.consumer.js.map +1 -0
- package/dist/commands/completion/completion.kinds.d.ts +43 -0
- package/dist/commands/completion/completion.kinds.d.ts.map +1 -0
- package/dist/commands/completion/completion.kinds.js +17 -0
- package/dist/commands/completion/completion.kinds.js.map +1 -0
- package/dist/commands/completion/fig.d.ts +1 -1
- package/dist/commands/completion/fig.d.ts.map +1 -1
- package/dist/commands/completion/fig.impl.consumer.d.ts +6 -0
- package/dist/commands/completion/fig.impl.consumer.d.ts.map +1 -0
- package/dist/commands/completion/fig.impl.consumer.js +6 -0
- package/dist/commands/completion/fig.impl.consumer.js.map +1 -0
- package/dist/commands/completion/fish.d.ts +1 -1
- package/dist/commands/completion/fish.d.ts.map +1 -1
- package/dist/commands/completion/fish.impl.consumer.d.ts +6 -0
- package/dist/commands/completion/fish.impl.consumer.d.ts.map +1 -0
- package/dist/commands/completion/fish.impl.consumer.js +6 -0
- package/dist/commands/completion/fish.impl.consumer.js.map +1 -0
- package/dist/commands/completion/tree.d.ts +5 -26
- package/dist/commands/completion/tree.d.ts.map +1 -1
- package/dist/commands/completion/tree.js +26 -25
- package/dist/commands/completion/tree.js.map +1 -1
- package/dist/commands/completion/zsh-widget.js +4 -4
- package/dist/commands/completion/zsh.d.ts +1 -1
- package/dist/commands/completion/zsh.d.ts.map +1 -1
- package/dist/commands/completion/zsh.impl.consumer.d.ts +6 -0
- package/dist/commands/completion/zsh.impl.consumer.d.ts.map +1 -0
- package/dist/commands/completion/zsh.impl.consumer.js +6 -0
- package/dist/commands/completion/zsh.impl.consumer.js.map +1 -0
- package/dist/commands/completion/zsh.js +1 -1
- package/dist/commands/completion/zsh.js.map +1 -1
- package/dist/commands/docs/cli.commands.docs.descriptor.d.ts +8 -0
- package/dist/commands/docs/cli.commands.docs.descriptor.d.ts.map +1 -0
- package/dist/commands/docs/cli.commands.docs.descriptor.js +55 -0
- package/dist/commands/docs/cli.commands.docs.descriptor.js.map +1 -0
- package/dist/commands/docs/cli.docs.descriptor.d.ts +4 -0
- package/dist/commands/docs/cli.docs.descriptor.d.ts.map +1 -0
- package/dist/commands/docs/cli.docs.descriptor.js +44 -0
- package/dist/commands/docs/cli.docs.descriptor.js.map +1 -0
- package/dist/commands/docs/cli.groups.docs.descriptor.d.ts +4 -0
- package/dist/commands/docs/cli.groups.docs.descriptor.d.ts.map +1 -0
- package/dist/commands/docs/cli.groups.docs.descriptor.js +40 -0
- package/dist/commands/docs/cli.groups.docs.descriptor.js.map +1 -0
- package/dist/commands/docs/cli.output.docs.descriptor.d.ts +4 -0
- package/dist/commands/docs/cli.output.docs.descriptor.d.ts.map +1 -0
- package/dist/commands/docs/cli.output.docs.descriptor.js +45 -0
- package/dist/commands/docs/cli.output.docs.descriptor.js.map +1 -0
- package/dist/commands/docs/content/cli-commands.json +1 -0
- package/dist/commands/docs/content/cli-groups.json +1 -0
- package/dist/commands/docs/content/cli-output.json +1 -0
- package/dist/commands/docs/doc-paths.d.ts +11 -0
- package/dist/commands/docs/doc-paths.d.ts.map +1 -0
- package/dist/commands/docs/doc-paths.js +32 -0
- package/dist/commands/docs/doc-paths.js.map +1 -0
- package/dist/commands/docs/generate.d.ts +48 -0
- package/dist/commands/docs/generate.d.ts.map +1 -0
- package/dist/commands/docs/generate.js +121 -0
- package/dist/commands/docs/generate.js.map +1 -0
- package/dist/commands/docs/render-command.d.ts +5 -0
- package/dist/commands/docs/render-command.d.ts.map +1 -0
- package/dist/commands/docs/render-command.js +117 -0
- package/dist/commands/docs/render-command.js.map +1 -0
- package/dist/commands/docs/render-group.d.ts +5 -0
- package/dist/commands/docs/render-group.d.ts.map +1 -0
- package/dist/commands/docs/render-group.js +62 -0
- package/dist/commands/docs/render-group.js.map +1 -0
- package/dist/commands/docs/schemas/generate.d.ts +14 -0
- package/dist/commands/docs/schemas/generate.d.ts.map +1 -0
- package/dist/commands/docs/schemas/generate.js +3 -0
- package/dist/commands/docs/schemas/generate.js.map +1 -0
- package/dist/commands/output.d.ts +27 -0
- package/dist/commands/output.d.ts.map +1 -0
- package/dist/commands/output.js +104 -0
- package/dist/commands/output.js.map +1 -0
- package/dist/commands/profile/_utils.d.ts +34 -9
- package/dist/commands/profile/_utils.d.ts.map +1 -1
- package/dist/commands/profile/_utils.js +65 -37
- package/dist/commands/profile/_utils.js.map +1 -1
- package/dist/commands/profile/profile-env.d.ts +42 -0
- package/dist/commands/profile/profile-env.d.ts.map +1 -0
- package/dist/commands/profile/profile-env.js +56 -0
- package/dist/commands/profile/profile-env.js.map +1 -0
- package/dist/commands/profile/profile-group.descriptor.d.ts +1 -1
- package/dist/commands/profile/profile-group.descriptor.d.ts.map +1 -1
- package/dist/commands/profile/profile.create.descriptor.d.ts +1 -1
- package/dist/commands/profile/profile.create.descriptor.d.ts.map +1 -1
- package/dist/commands/profile/profile.create.descriptor.js +12 -1
- package/dist/commands/profile/profile.create.descriptor.js.map +1 -1
- package/dist/commands/profile/profile.create.impl.d.ts +2 -6
- package/dist/commands/profile/profile.create.impl.d.ts.map +1 -1
- package/dist/commands/profile/profile.create.impl.js +32 -9
- package/dist/commands/profile/profile.create.impl.js.map +1 -1
- package/dist/commands/profile/profile.delete.descriptor.d.ts +1 -1
- package/dist/commands/profile/profile.delete.descriptor.d.ts.map +1 -1
- package/dist/commands/profile/profile.delete.impl.d.ts +2 -7
- package/dist/commands/profile/profile.delete.impl.d.ts.map +1 -1
- package/dist/commands/profile/profile.delete.impl.js +33 -16
- package/dist/commands/profile/profile.delete.impl.js.map +1 -1
- package/dist/commands/profile/profile.environment.descriptor.d.ts +4 -0
- package/dist/commands/profile/profile.environment.descriptor.d.ts.map +1 -0
- package/dist/commands/profile/profile.environment.descriptor.js +26 -0
- package/dist/commands/profile/profile.environment.descriptor.js.map +1 -0
- package/dist/commands/profile/profile.environment.impl.d.ts +14 -0
- package/dist/commands/profile/profile.environment.impl.d.ts.map +1 -0
- package/dist/commands/profile/profile.environment.impl.js +33 -0
- package/dist/commands/profile/profile.environment.impl.js.map +1 -0
- package/dist/commands/profile/profile.info.descriptor.d.ts +1 -1
- package/dist/commands/profile/profile.info.descriptor.d.ts.map +1 -1
- package/dist/commands/profile/profile.info.descriptor.js +5 -1
- package/dist/commands/profile/profile.info.descriptor.js.map +1 -1
- package/dist/commands/profile/profile.info.impl.d.ts +5 -2
- package/dist/commands/profile/profile.info.impl.d.ts.map +1 -1
- package/dist/commands/profile/profile.info.impl.js +31 -14
- package/dist/commands/profile/profile.info.impl.js.map +1 -1
- package/dist/commands/profile/profile.list.descriptor.d.ts +1 -1
- package/dist/commands/profile/profile.list.descriptor.d.ts.map +1 -1
- package/dist/commands/profile/profile.list.descriptor.js +5 -1
- package/dist/commands/profile/profile.list.descriptor.js.map +1 -1
- package/dist/commands/profile/profile.list.impl.d.ts +17 -2
- package/dist/commands/profile/profile.list.impl.d.ts.map +1 -1
- package/dist/commands/profile/profile.list.impl.js +52 -25
- package/dist/commands/profile/profile.list.impl.js.map +1 -1
- package/dist/commands/profile/profile.use.descriptor.d.ts +1 -1
- package/dist/commands/profile/profile.use.descriptor.d.ts.map +1 -1
- package/dist/commands/profile/profile.use.impl.d.ts +2 -6
- package/dist/commands/profile/profile.use.impl.d.ts.map +1 -1
- package/dist/commands/profile/profile.use.impl.js +40 -10
- package/dist/commands/profile/profile.use.impl.js.map +1 -1
- package/dist/commands/runtime/codegen.command.descriptor.d.ts +26 -12
- package/dist/commands/runtime/codegen.command.descriptor.d.ts.map +1 -1
- package/dist/commands/runtime/codegen.command.descriptor.js +24 -6
- package/dist/commands/runtime/codegen.command.descriptor.js.map +1 -1
- package/dist/commands/runtime/codegen.command.impl.d.ts +15 -2
- package/dist/commands/runtime/codegen.command.impl.d.ts.map +1 -1
- package/dist/commands/runtime/codegen.command.impl.js +17 -30
- package/dist/commands/runtime/codegen.command.impl.js.map +1 -1
- package/dist/commands/runtime/codegen.d.ts +10 -14
- package/dist/commands/runtime/codegen.d.ts.map +1 -1
- package/dist/commands/runtime/codegen.declarations.d.ts +6 -0
- package/dist/commands/runtime/codegen.declarations.d.ts.map +1 -0
- package/dist/commands/runtime/codegen.declarations.js +6 -0
- package/dist/commands/runtime/codegen.declarations.js.map +1 -0
- package/dist/commands/runtime/codegen.js +85 -58
- package/dist/commands/runtime/codegen.js.map +1 -1
- package/dist/commands/runtime/export/markdown-document.d.ts +25 -0
- package/dist/commands/runtime/export/markdown-document.d.ts.map +1 -0
- package/dist/commands/runtime/export/markdown-document.js +38 -0
- package/dist/commands/runtime/export/markdown-document.js.map +1 -0
- package/dist/commands/runtime/export/markdown.d.ts +17 -0
- package/dist/commands/runtime/export/markdown.d.ts.map +1 -0
- package/dist/commands/runtime/export/markdown.js +141 -0
- package/dist/commands/runtime/export/markdown.js.map +1 -0
- package/dist/commands/runtime/export/read.d.ts +27 -0
- package/dist/commands/runtime/export/read.d.ts.map +1 -0
- package/dist/commands/runtime/export/read.js +128 -0
- package/dist/commands/runtime/export/read.js.map +1 -0
- package/dist/commands/runtime/export/reading-notes.d.ts +11 -0
- package/dist/commands/runtime/export/reading-notes.d.ts.map +1 -0
- package/dist/commands/runtime/export/reading-notes.js +45 -0
- package/dist/commands/runtime/export/reading-notes.js.map +1 -0
- package/dist/commands/runtime/export/register.d.ts +34 -0
- package/dist/commands/runtime/export/register.d.ts.map +1 -0
- package/dist/commands/runtime/export/register.js +57 -0
- package/dist/commands/runtime/export/register.js.map +1 -0
- package/dist/commands/runtime/export/schemas.d.ts +104 -0
- package/dist/commands/runtime/export/schemas.d.ts.map +1 -0
- package/dist/commands/runtime/export/schemas.js +38 -0
- package/dist/commands/runtime/export/schemas.js.map +1 -0
- package/dist/commands/runtime/export/write.d.ts +16 -0
- package/dist/commands/runtime/export/write.d.ts.map +1 -0
- package/dist/commands/runtime/export/write.js +36 -0
- package/dist/commands/runtime/export/write.js.map +1 -0
- package/dist/commands/runtime/export.command.impl.d.ts +18 -0
- package/dist/commands/runtime/export.command.impl.d.ts.map +1 -0
- package/dist/commands/runtime/export.command.impl.js +39 -0
- package/dist/commands/runtime/export.command.impl.js.map +1 -0
- package/dist/commands/runtime/export.d.ts +28 -0
- package/dist/commands/runtime/export.d.ts.map +1 -0
- package/dist/commands/runtime/export.descriptor.d.ts +55 -0
- package/dist/commands/runtime/export.descriptor.d.ts.map +1 -0
- package/dist/commands/runtime/export.descriptor.js +58 -0
- package/dist/commands/runtime/export.descriptor.js.map +1 -0
- package/dist/commands/runtime/export.js +28 -0
- package/dist/commands/runtime/export.js.map +1 -0
- package/dist/commands/runtime/index.d.ts +2 -2
- package/dist/commands/runtime/index.d.ts.map +1 -1
- package/dist/commands/runtime/index.js +3 -3
- package/dist/commands/runtime/index.js.map +1 -1
- package/dist/commands/runtime/plugin.d.ts +1 -1
- package/dist/commands/runtime/plugin.d.ts.map +1 -1
- package/dist/commands/runtime/plugin.js +1 -1
- package/dist/commands/runtime/plugin.js.map +1 -1
- package/dist/commands/runtime/runtime-group.descriptor.d.ts +1 -1
- package/dist/commands/runtime/runtime-group.descriptor.d.ts.map +1 -1
- package/dist/commands/schemas/output.d.ts +26 -0
- package/dist/commands/schemas/output.d.ts.map +1 -0
- package/dist/commands/schemas/output.js +14 -0
- package/dist/commands/schemas/output.js.map +1 -0
- package/dist/commands/schemas/profile-environment.d.ts +6 -0
- package/dist/commands/schemas/profile-environment.d.ts.map +1 -0
- package/dist/commands/schemas/profile-environment.js +3 -0
- package/dist/commands/schemas/profile-environment.js.map +1 -0
- package/dist/commands/schemas/profile-list.d.ts +22 -0
- package/dist/commands/schemas/profile-list.d.ts.map +1 -0
- package/dist/commands/schemas/profile-list.js +3 -0
- package/dist/commands/schemas/profile-list.js.map +1 -0
- package/dist/commands/skills/_skills.d.ts +98 -0
- package/dist/commands/skills/_skills.d.ts.map +1 -0
- package/dist/commands/skills/_skills.js +183 -0
- package/dist/commands/skills/_skills.js.map +1 -0
- package/dist/commands/skills/skills-group.descriptor.d.ts +4 -0
- package/dist/commands/skills/skills-group.descriptor.d.ts.map +1 -0
- package/dist/commands/skills/skills-group.descriptor.js +12 -0
- package/dist/commands/skills/skills-group.descriptor.js.map +1 -0
- package/dist/commands/skills/skills.install.descriptor.d.ts +4 -0
- package/dist/commands/skills/skills.install.descriptor.d.ts.map +1 -0
- package/dist/commands/skills/skills.install.descriptor.js +37 -0
- package/dist/commands/skills/skills.install.descriptor.js.map +1 -0
- package/dist/commands/skills/skills.install.impl.d.ts +12 -0
- package/dist/commands/skills/skills.install.impl.d.ts.map +1 -0
- package/dist/commands/skills/skills.install.impl.js +65 -0
- package/dist/commands/skills/skills.install.impl.js.map +1 -0
- package/dist/commands/skills/skills.list.descriptor.d.ts +4 -0
- package/dist/commands/skills/skills.list.descriptor.d.ts.map +1 -0
- package/dist/commands/skills/skills.list.descriptor.js +23 -0
- package/dist/commands/skills/skills.list.descriptor.js.map +1 -0
- package/dist/commands/skills/skills.list.impl.d.ts +11 -0
- package/dist/commands/skills/skills.list.impl.d.ts.map +1 -0
- package/dist/commands/skills/skills.list.impl.js +69 -0
- package/dist/commands/skills/skills.list.impl.js.map +1 -0
- package/dist/core/runtime/shared/context.d.ts +16 -16
- package/dist/core/runtime/shared/context.d.ts.map +1 -1
- package/dist/core/runtime/shared/context.js +20 -35
- package/dist/core/runtime/shared/context.js.map +1 -1
- package/dist/core/runtime/shared/options.d.ts +5 -19
- package/dist/core/runtime/shared/options.d.ts.map +1 -1
- package/dist/core/runtime/shared/options.js +87 -42
- package/dist/core/runtime/shared/options.js.map +1 -1
- package/dist/design-inventory.d.ts +23 -0
- package/dist/design-inventory.d.ts.map +1 -0
- package/dist/design-inventory.js +66 -0
- package/dist/design-inventory.js.map +1 -0
- package/dist/index.d.ts +12 -21
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +15 -25
- package/dist/index.js.map +1 -1
- package/dist/invocation/client.d.ts +20 -0
- package/dist/invocation/client.d.ts.map +1 -0
- package/dist/invocation/client.js +25 -0
- package/dist/invocation/client.js.map +1 -0
- package/dist/invocation/state.d.ts +10 -0
- package/dist/invocation/state.d.ts.map +1 -0
- package/dist/invocation/state.js +32 -0
- package/dist/invocation/state.js.map +1 -0
- package/dist/patterns/builtins/config-namespace-commands.d.ts +10 -0
- package/dist/patterns/builtins/config-namespace-commands.d.ts.map +1 -0
- package/dist/patterns/builtins/config-namespace-commands.js +132 -0
- package/dist/patterns/builtins/config-namespace-commands.js.map +1 -0
- package/dist/patterns/builtins/config-namespace-output.d.ts +9 -0
- package/dist/patterns/builtins/config-namespace-output.d.ts.map +1 -0
- package/dist/patterns/builtins/config-namespace-output.js +31 -0
- package/dist/patterns/builtins/config-namespace-output.js.map +1 -0
- package/dist/patterns/builtins/config-namespace.d.ts +23 -0
- package/dist/patterns/builtins/config-namespace.d.ts.map +1 -0
- package/dist/patterns/builtins/config-namespace.js +70 -0
- package/dist/patterns/builtins/config-namespace.js.map +1 -0
- package/dist/patterns/builtins/crud-commands.d.ts +11 -0
- package/dist/patterns/builtins/crud-commands.d.ts.map +1 -0
- package/dist/patterns/builtins/crud-commands.js +105 -0
- package/dist/patterns/builtins/crud-commands.js.map +1 -0
- package/dist/patterns/builtins/crud-output.d.ts +7 -0
- package/dist/patterns/builtins/crud-output.d.ts.map +1 -0
- package/dist/patterns/builtins/crud-output.js +21 -0
- package/dist/patterns/builtins/crud-output.js.map +1 -0
- package/dist/patterns/builtins/crud.d.ts +16 -0
- package/dist/patterns/builtins/crud.d.ts.map +1 -0
- package/dist/patterns/builtins/crud.js +38 -0
- package/dist/patterns/builtins/crud.js.map +1 -0
- package/dist/patterns/{log-viewer.d.ts → builtins/log-viewer.d.ts} +5 -5
- package/dist/patterns/builtins/log-viewer.d.ts.map +1 -0
- package/dist/patterns/{log-viewer.js → builtins/log-viewer.js} +31 -9
- package/dist/patterns/builtins/log-viewer.js.map +1 -0
- package/dist/patterns/builtins/output.d.ts +5 -0
- package/dist/patterns/builtins/output.d.ts.map +1 -0
- package/dist/patterns/builtins/output.js +25 -0
- package/dist/patterns/builtins/output.js.map +1 -0
- package/dist/patterns/{process-manager.d.ts → builtins/process-manager.d.ts} +9 -4
- package/dist/patterns/builtins/process-manager.d.ts.map +1 -0
- package/dist/patterns/{process-manager.js → builtins/process-manager.js} +46 -29
- package/dist/patterns/builtins/process-manager.js.map +1 -0
- package/dist/patterns/builtins/tool-wrapper.d.ts +18 -0
- package/dist/patterns/builtins/tool-wrapper.d.ts.map +1 -0
- package/dist/patterns/builtins/tool-wrapper.js +124 -0
- package/dist/patterns/builtins/tool-wrapper.js.map +1 -0
- package/dist/patterns/cli-value.d.ts +3 -0
- package/dist/patterns/cli-value.d.ts.map +1 -0
- package/dist/patterns/cli-value.js +42 -0
- package/dist/patterns/cli-value.js.map +1 -0
- package/dist/patterns/index.d.ts +5 -9
- package/dist/patterns/index.d.ts.map +1 -1
- package/dist/patterns/index.js +5 -9
- package/dist/patterns/index.js.map +1 -1
- package/dist/patterns/pattern.kinds.d.ts +30 -0
- package/dist/patterns/pattern.kinds.d.ts.map +1 -0
- package/dist/patterns/pattern.kinds.js +8 -0
- package/dist/patterns/pattern.kinds.js.map +1 -0
- package/dist/patterns/resolver.d.ts +11 -32
- package/dist/patterns/resolver.d.ts.map +1 -1
- package/dist/patterns/resolver.js +14 -45
- package/dist/patterns/resolver.js.map +1 -1
- package/dist/patterns/schemas.d.ts +9 -492
- package/dist/patterns/schemas.d.ts.map +1 -1
- package/dist/patterns/schemas.js +5 -94
- package/dist/patterns/schemas.js.map +1 -1
- package/dist/schemas/bootstrap.d.ts +242 -0
- package/dist/schemas/bootstrap.d.ts.map +1 -0
- package/dist/schemas/bootstrap.js +7 -0
- package/dist/schemas/bootstrap.js.map +1 -0
- package/dist/schemas/command-implementation.d.ts +34 -0
- package/dist/schemas/command-implementation.d.ts.map +1 -0
- package/dist/schemas/command-implementation.js +31 -0
- package/dist/schemas/command-implementation.js.map +1 -0
- package/dist/schemas/command-recommendations.d.ts +9 -0
- package/dist/schemas/command-recommendations.d.ts.map +1 -0
- package/dist/schemas/command-recommendations.js +14 -0
- package/dist/schemas/command-recommendations.js.map +1 -0
- package/dist/schemas/completion.d.ts +118 -0
- package/dist/schemas/completion.d.ts.map +1 -0
- package/dist/schemas/completion.js +63 -0
- package/dist/schemas/completion.js.map +1 -0
- package/dist/schemas/descriptors.d.ts +1 -129
- package/dist/schemas/descriptors.d.ts.map +1 -1
- package/dist/schemas/descriptors.js +1 -95
- package/dist/schemas/descriptors.js.map +1 -1
- package/dist/schemas/design-inventory.d.ts +20 -0
- package/dist/schemas/design-inventory.d.ts.map +1 -0
- package/dist/schemas/design-inventory.js +10 -0
- package/dist/schemas/design-inventory.js.map +1 -0
- package/dist/schemas/discovery.d.ts +17 -0
- package/dist/schemas/discovery.d.ts.map +1 -0
- package/dist/schemas/discovery.js +15 -0
- package/dist/schemas/discovery.js.map +1 -0
- package/dist/schemas/exit.d.ts +33 -0
- package/dist/schemas/exit.d.ts.map +1 -0
- package/dist/schemas/exit.js +20 -0
- package/dist/schemas/exit.js.map +1 -0
- package/dist/schemas/interactive-host.d.ts +10 -0
- package/dist/schemas/interactive-host.d.ts.map +1 -0
- package/dist/schemas/interactive-host.js +11 -0
- package/dist/schemas/interactive-host.js.map +1 -0
- package/dist/schemas/output-format.d.ts +61 -0
- package/dist/schemas/output-format.d.ts.map +1 -0
- package/dist/schemas/output-format.js +26 -0
- package/dist/schemas/output-format.js.map +1 -0
- package/dist/schemas/pattern-implementation.d.ts +1572 -0
- package/dist/schemas/pattern-implementation.d.ts.map +1 -0
- package/dist/schemas/pattern-implementation.js +12 -0
- package/dist/schemas/pattern-implementation.js.map +1 -0
- package/dist/schemas/pattern-input.d.ts +152 -0
- package/dist/schemas/pattern-input.d.ts.map +1 -0
- package/dist/schemas/pattern-input.js +194 -0
- package/dist/schemas/pattern-input.js.map +1 -0
- package/dist/schemas/pm-context.d.ts +17 -0
- package/dist/schemas/pm-context.d.ts.map +1 -0
- package/dist/schemas/pm-context.js +13 -0
- package/dist/schemas/pm-context.js.map +1 -0
- package/dist/schemas/prompts.d.ts +61 -0
- package/dist/schemas/prompts.d.ts.map +1 -0
- package/dist/schemas/prompts.js +43 -0
- package/dist/schemas/prompts.js.map +1 -0
- package/dist/schemas/runtime-codegen.d.ts +191 -0
- package/dist/schemas/runtime-codegen.d.ts.map +1 -0
- package/dist/schemas/runtime-codegen.js +83 -0
- package/dist/schemas/runtime-codegen.js.map +1 -0
- package/dist/schemas/surface.d.ts +33 -20
- package/dist/schemas/surface.d.ts.map +1 -1
- package/dist/schemas/surface.js +2 -1
- package/dist/schemas/surface.js.map +1 -1
- package/dist/schemas/terminal-input.d.ts +15 -0
- package/dist/schemas/terminal-input.d.ts.map +1 -0
- package/dist/schemas/terminal-input.js +13 -0
- package/dist/schemas/terminal-input.js.map +1 -0
- package/dist/schemas/types.d.ts +1 -201
- package/dist/schemas/types.d.ts.map +1 -1
- package/dist/support/cli-inventory.generated.d.ts +4 -0
- package/dist/support/cli-inventory.generated.d.ts.map +1 -0
- package/dist/support/cli-inventory.generated.js +31 -0
- package/dist/support/cli-inventory.generated.js.map +1 -0
- package/dist/support/logging/cli-startup.logger.descriptor.d.ts.map +1 -0
- package/dist/support/logging/cli-startup.logger.descriptor.js.map +1 -0
- package/dist/support/logging/logging.d.ts +8 -0
- package/dist/support/logging/logging.d.ts.map +1 -0
- package/dist/support/logging/logging.js +13 -0
- package/dist/support/logging/logging.js.map +1 -0
- package/dist/support/terminal-input.d.ts +11 -0
- package/dist/support/terminal-input.d.ts.map +1 -0
- package/dist/support/terminal-input.js +39 -0
- package/dist/support/terminal-input.js.map +1 -0
- package/dist/support/ui/context.descriptor.d.ts +35 -0
- package/dist/support/ui/context.descriptor.d.ts.map +1 -0
- package/dist/{ui.context.descriptor.js → support/ui/context.descriptor.js} +2 -2
- package/dist/support/ui/context.descriptor.js.map +1 -0
- package/dist/support/ui/format.client.d.ts +42 -0
- package/dist/support/ui/format.client.d.ts.map +1 -0
- package/dist/support/ui/format.client.js +92 -0
- package/dist/support/ui/format.client.js.map +1 -0
- package/dist/support/ui/format.kinds.d.ts +30 -0
- package/dist/support/ui/format.kinds.d.ts.map +1 -0
- package/dist/support/ui/format.kinds.js +8 -0
- package/dist/support/ui/format.kinds.js.map +1 -0
- package/dist/support/ui/format.plugin.d.ts +7 -0
- package/dist/support/ui/format.plugin.d.ts.map +1 -0
- package/dist/support/ui/format.plugin.js +23 -0
- package/dist/support/ui/format.plugin.js.map +1 -0
- package/dist/support/ui/formats.d.ts +4 -0
- package/dist/support/ui/formats.d.ts.map +1 -0
- package/dist/support/ui/formats.js +34 -0
- package/dist/support/ui/formats.js.map +1 -0
- package/dist/support/ui/prompts.d.ts +9 -0
- package/dist/support/ui/prompts.d.ts.map +1 -0
- package/dist/support/ui/prompts.js +99 -0
- package/dist/support/ui/prompts.js.map +1 -0
- package/dist/support/ui/schemas/types.d.ts +2 -0
- package/dist/support/ui/schemas/types.d.ts.map +1 -0
- package/dist/support/ui/schemas/types.js.map +1 -0
- package/dist/support/ui/schemas/ui-toolkit.d.ts +45 -0
- package/dist/support/ui/schemas/ui-toolkit.d.ts.map +1 -0
- package/dist/support/ui/schemas/ui-toolkit.js +2 -0
- package/dist/support/ui/schemas/ui-toolkit.js.map +1 -0
- package/dist/support/ui/showcase.d.ts +18 -0
- package/dist/support/ui/showcase.d.ts.map +1 -0
- package/dist/support/ui/showcase.js +101 -0
- package/dist/support/ui/showcase.js.map +1 -0
- package/dist/support/ui/table.d.ts +28 -0
- package/dist/support/ui/table.d.ts.map +1 -0
- package/dist/support/ui/table.js +74 -0
- package/dist/support/ui/table.js.map +1 -0
- package/dist/support/ui/toolkit.d.ts +56 -0
- package/dist/support/ui/toolkit.d.ts.map +1 -0
- package/dist/support/ui/toolkit.js +130 -0
- package/dist/support/ui/toolkit.js.map +1 -0
- package/dist/support/vibesdev/index.d.ts +2 -0
- package/dist/support/vibesdev/index.d.ts.map +1 -0
- package/dist/support/vibesdev/index.js +3 -0
- package/dist/support/vibesdev/index.js.map +1 -0
- package/dist/surface/CLISurface.d.ts +77 -3
- package/dist/surface/CLISurface.d.ts.map +1 -1
- package/dist/surface/CLISurface.js +642 -98
- package/dist/surface/CLISurface.js.map +1 -1
- package/dist/surface/argument-name.d.ts +14 -0
- package/dist/surface/argument-name.d.ts.map +1 -0
- package/dist/surface/argument-name.js +23 -0
- package/dist/surface/argument-name.js.map +1 -0
- package/dist/surface/attach-tui-action.d.ts +35 -9
- package/dist/surface/attach-tui-action.d.ts.map +1 -1
- package/dist/surface/attach-tui-action.js +50 -43
- package/dist/surface/attach-tui-action.js.map +1 -1
- package/dist/surface/build-context.d.ts +2 -2
- package/dist/surface/build-context.d.ts.map +1 -1
- package/dist/surface/build-context.js +26 -44
- package/dist/surface/build-context.js.map +1 -1
- package/dist/surface/command-group-policy.d.ts +2 -3
- package/dist/surface/command-group-policy.d.ts.map +1 -1
- package/dist/surface/command-group-policy.js +1 -11
- package/dist/surface/command-group-policy.js.map +1 -1
- package/dist/surface/command-implementation.d.ts +9 -0
- package/dist/surface/command-implementation.d.ts.map +1 -0
- package/dist/surface/command-implementation.js +19 -0
- package/dist/surface/command-implementation.js.map +1 -0
- package/dist/surface/command-options.d.ts +29 -0
- package/dist/surface/command-options.d.ts.map +1 -0
- package/dist/surface/command-options.js +57 -0
- package/dist/surface/command-options.js.map +1 -0
- package/dist/surface/commander-action.d.ts +25 -0
- package/dist/surface/commander-action.d.ts.map +1 -0
- package/dist/surface/commander-action.js +38 -0
- package/dist/surface/commander-action.js.map +1 -0
- package/dist/surface/discovery-cache.d.ts +3 -15
- package/dist/surface/discovery-cache.d.ts.map +1 -1
- package/dist/surface/discovery-cache.js +6 -33
- package/dist/surface/discovery-cache.js.map +1 -1
- package/dist/surface/exit.d.ts +10 -0
- package/dist/surface/exit.d.ts.map +1 -0
- package/dist/surface/exit.js +33 -0
- package/dist/surface/exit.js.map +1 -0
- package/dist/surface/failure-of.d.ts +9 -0
- package/dist/surface/failure-of.d.ts.map +1 -0
- package/dist/surface/failure-of.js +17 -0
- package/dist/surface/failure-of.js.map +1 -0
- package/dist/surface/failure-output.d.ts +50 -0
- package/dist/surface/failure-output.d.ts.map +1 -0
- package/dist/surface/failure-output.js +84 -0
- package/dist/surface/failure-output.js.map +1 -0
- package/dist/surface/failure-report.d.ts +78 -0
- package/dist/surface/failure-report.d.ts.map +1 -0
- package/dist/surface/failure-report.js +229 -0
- package/dist/surface/failure-report.js.map +1 -0
- package/dist/surface/group-fallback.d.ts +32 -0
- package/dist/surface/group-fallback.d.ts.map +1 -0
- package/dist/surface/group-fallback.js +78 -0
- package/dist/surface/group-fallback.js.map +1 -0
- package/dist/surface/index.d.ts +10 -0
- package/dist/surface/index.d.ts.map +1 -0
- package/dist/surface/index.js +8 -0
- package/dist/surface/index.js.map +1 -0
- package/dist/surface/inherited-options.d.ts +28 -0
- package/dist/surface/inherited-options.d.ts.map +1 -0
- package/dist/surface/inherited-options.js +108 -0
- package/dist/surface/inherited-options.js.map +1 -0
- package/dist/surface/interactive-gate.d.ts +41 -0
- package/dist/surface/interactive-gate.d.ts.map +1 -0
- package/dist/surface/interactive-gate.js +112 -0
- package/dist/surface/interactive-gate.js.map +1 -0
- package/dist/surface/invocation-actions.d.ts +40 -0
- package/dist/surface/invocation-actions.d.ts.map +1 -0
- package/dist/surface/invocation-actions.js +78 -0
- package/dist/surface/invocation-actions.js.map +1 -0
- package/dist/surface/invocation-effects.d.ts +11 -0
- package/dist/surface/invocation-effects.d.ts.map +1 -0
- package/dist/surface/invocation-effects.js +52 -0
- package/dist/surface/invocation-effects.js.map +1 -0
- package/dist/surface/invocation-lifecycle.d.ts +49 -0
- package/dist/surface/invocation-lifecycle.d.ts.map +1 -0
- package/dist/surface/invocation-lifecycle.js +127 -0
- package/dist/surface/invocation-lifecycle.js.map +1 -0
- package/dist/surface/output-format-request.d.ts +23 -0
- package/dist/surface/output-format-request.d.ts.map +1 -0
- package/dist/surface/output-format-request.js +116 -0
- package/dist/surface/output-format-request.js.map +1 -0
- package/dist/surface/pm-context.d.ts +5 -0
- package/dist/surface/pm-context.d.ts.map +1 -0
- package/dist/surface/pm-context.js +69 -0
- package/dist/surface/pm-context.js.map +1 -0
- package/dist/surface/register-commands.d.ts +24 -4
- package/dist/surface/register-commands.d.ts.map +1 -1
- package/dist/surface/register-commands.js +156 -63
- package/dist/surface/register-commands.js.map +1 -1
- package/dist/surface/register-groups.d.ts +4 -4
- package/dist/surface/register-groups.d.ts.map +1 -1
- package/dist/surface/register-groups.js +71 -9
- package/dist/surface/register-groups.js.map +1 -1
- package/dist/surface/schemas/CLISurface.d.ts +31 -0
- package/dist/surface/schemas/CLISurface.d.ts.map +1 -0
- package/dist/surface/schemas/CLISurface.js +2 -0
- package/dist/surface/schemas/CLISurface.js.map +1 -0
- package/dist/surface/schemas/command-implementation.d.ts +20 -0
- package/dist/surface/schemas/command-implementation.d.ts.map +1 -0
- package/dist/surface/schemas/command-implementation.js +2 -0
- package/dist/surface/schemas/command-implementation.js.map +1 -0
- package/dist/surface/schemas/interactive-gate.d.ts +29 -0
- package/dist/surface/schemas/interactive-gate.d.ts.map +1 -0
- package/dist/surface/schemas/interactive-gate.js +2 -0
- package/dist/surface/schemas/interactive-gate.js.map +1 -0
- package/package.json +273 -136
- package/bin/vibes.ts +0 -26
- package/dist/api/client/factory.d.ts +0 -29
- package/dist/api/client/factory.d.ts.map +0 -1
- package/dist/api/client/factory.js +0 -189
- package/dist/api/client/factory.js.map +0 -1
- package/dist/api/schemas/common.d.ts +0 -58
- package/dist/api/schemas/common.d.ts.map +0 -1
- package/dist/api/schemas/common.js +0 -48
- package/dist/api/schemas/common.js.map +0 -1
- package/dist/api/schemas/types.d.ts +0 -30
- package/dist/api/schemas/types.d.ts.map +0 -1
- package/dist/api/services/api.d.ts +0 -14
- package/dist/api/services/api.d.ts.map +0 -1
- package/dist/api/services/api.js +0 -110
- package/dist/api/services/api.js.map +0 -1
- package/dist/api/types.d.ts +0 -6
- package/dist/api/types.d.ts.map +0 -1
- package/dist/api/types.js +0 -5
- package/dist/api/types.js.map +0 -1
- package/dist/bin.d.ts +0 -28
- package/dist/bin.d.ts.map +0 -1
- package/dist/bin.js +0 -73
- package/dist/bin.js.map +0 -1
- package/dist/bootstrap.d.ts +0 -14
- package/dist/bootstrap.d.ts.map +0 -1
- package/dist/bootstrap.js +0 -14
- package/dist/bootstrap.js.map +0 -1
- package/dist/cli.plugin.d.ts +0 -20
- package/dist/cli.plugin.d.ts.map +0 -1
- package/dist/cli.plugin.js +0 -170
- package/dist/cli.plugin.js.map +0 -1
- package/dist/commands/runtime/_logging.d.ts +0 -11
- package/dist/commands/runtime/_logging.d.ts.map +0 -1
- package/dist/commands/runtime/_logging.js +0 -40
- package/dist/commands/runtime/_logging.js.map +0 -1
- package/dist/config.d.ts +0 -17
- package/dist/config.d.ts.map +0 -1
- package/dist/config.js.map +0 -1
- package/dist/core/index.d.ts +0 -9
- package/dist/core/index.d.ts.map +0 -1
- package/dist/core/index.js +0 -5
- package/dist/core/index.js.map +0 -1
- package/dist/core/namespace/hook.d.ts +0 -12
- package/dist/core/namespace/hook.d.ts.map +0 -1
- package/dist/core/namespace/hook.js +0 -15
- package/dist/core/namespace/hook.js.map +0 -1
- package/dist/core/namespace/index.d.ts +0 -18
- package/dist/core/namespace/index.d.ts.map +0 -1
- package/dist/core/namespace/index.js +0 -214
- package/dist/core/namespace/index.js.map +0 -1
- package/dist/core/namespace/schemas/index.d.ts +0 -25
- package/dist/core/namespace/schemas/index.d.ts.map +0 -1
- package/dist/core/namespace/schemas/index.js +0 -2
- package/dist/core/namespace/schemas/index.js.map +0 -1
- package/dist/core/plugins/types.d.ts +0 -81
- package/dist/core/plugins/types.d.ts.map +0 -1
- package/dist/core/plugins/types.js +0 -6
- package/dist/core/plugins/types.js.map +0 -1
- package/dist/core/runtime/context.d.ts +0 -25
- package/dist/core/runtime/context.d.ts.map +0 -1
- package/dist/core/runtime/context.js +0 -30
- package/dist/core/runtime/context.js.map +0 -1
- package/dist/core/runtime/hooks.d.ts +0 -12
- package/dist/core/runtime/hooks.d.ts.map +0 -1
- package/dist/core/runtime/hooks.js +0 -2
- package/dist/core/runtime/hooks.js.map +0 -1
- package/dist/core/schemas/manifest.d.ts +0 -24
- package/dist/core/schemas/manifest.d.ts.map +0 -1
- package/dist/core/schemas/manifest.js +0 -6
- package/dist/core/schemas/manifest.js.map +0 -1
- package/dist/core/schemas/types.d.ts +0 -7
- package/dist/core/schemas/types.d.ts.map +0 -1
- package/dist/core/schemas/types.js.map +0 -1
- package/dist/core/ui/interface.d.ts +0 -12
- package/dist/core/ui/interface.d.ts.map +0 -1
- package/dist/core/ui/interface.js +0 -6
- package/dist/core/ui/interface.js.map +0 -1
- package/dist/docs/cli.commands.docs.descriptor.d.ts +0 -4
- package/dist/docs/cli.commands.docs.descriptor.d.ts.map +0 -1
- package/dist/docs/cli.commands.docs.descriptor.js +0 -207
- package/dist/docs/cli.commands.docs.descriptor.js.map +0 -1
- package/dist/docs/cli.groups.docs.descriptor.d.ts +0 -4
- package/dist/docs/cli.groups.docs.descriptor.d.ts.map +0 -1
- package/dist/docs/cli.groups.docs.descriptor.js +0 -330
- package/dist/docs/cli.groups.docs.descriptor.js.map +0 -1
- package/dist/docs/cli.output.docs.descriptor.d.ts +0 -4
- package/dist/docs/cli.output.docs.descriptor.d.ts.map +0 -1
- package/dist/docs/cli.output.docs.descriptor.js +0 -442
- package/dist/docs/cli.output.docs.descriptor.js.map +0 -1
- package/dist/docs/types.d.ts +0 -19
- package/dist/docs/types.d.ts.map +0 -1
- package/dist/docs/types.js +0 -2
- package/dist/docs/types.js.map +0 -1
- package/dist/errors.d.ts +0 -74
- package/dist/errors.d.ts.map +0 -1
- package/dist/errors.js +0 -113
- package/dist/errors.js.map +0 -1
- package/dist/logging/cli-startup.logger.descriptor.d.ts.map +0 -1
- package/dist/logging/cli-startup.logger.descriptor.js.map +0 -1
- package/dist/logging.d.ts +0 -4
- package/dist/logging.d.ts.map +0 -1
- package/dist/logging.js +0 -21
- package/dist/logging.js.map +0 -1
- package/dist/patterns/config-namespace.d.ts +0 -23
- package/dist/patterns/config-namespace.d.ts.map +0 -1
- package/dist/patterns/config-namespace.js +0 -218
- package/dist/patterns/config-namespace.js.map +0 -1
- package/dist/patterns/crud.d.ts +0 -23
- package/dist/patterns/crud.d.ts.map +0 -1
- package/dist/patterns/crud.js +0 -164
- package/dist/patterns/crud.js.map +0 -1
- package/dist/patterns/log-viewer.d.ts.map +0 -1
- package/dist/patterns/log-viewer.js.map +0 -1
- package/dist/patterns/pattern-types.d.ts +0 -21
- package/dist/patterns/pattern-types.d.ts.map +0 -1
- package/dist/patterns/pattern-types.js +0 -7
- package/dist/patterns/pattern-types.js.map +0 -1
- package/dist/patterns/process-manager.d.ts.map +0 -1
- package/dist/patterns/process-manager.js.map +0 -1
- package/dist/patterns/resolver.contracts.d.ts +0 -14
- package/dist/patterns/resolver.contracts.d.ts.map +0 -1
- package/dist/patterns/resolver.contracts.js +0 -9
- package/dist/patterns/resolver.contracts.js.map +0 -1
- package/dist/patterns/tool-wrapper.d.ts +0 -18
- package/dist/patterns/tool-wrapper.d.ts.map +0 -1
- package/dist/patterns/tool-wrapper.js +0 -130
- package/dist/patterns/tool-wrapper.js.map +0 -1
- package/dist/providers.d.ts +0 -105
- package/dist/providers.d.ts.map +0 -1
- package/dist/providers.js +0 -164
- package/dist/providers.js.map +0 -1
- package/dist/support/ui-toolkit.d.ts +0 -62
- package/dist/support/ui-toolkit.d.ts.map +0 -1
- package/dist/support/ui-toolkit.js +0 -172
- package/dist/support/ui-toolkit.js.map +0 -1
- package/dist/surface.d.ts +0 -9
- package/dist/surface.d.ts.map +0 -1
- package/dist/surface.js +0 -8
- package/dist/surface.js.map +0 -1
- package/dist/types.d.ts +0 -4
- package/dist/types.d.ts.map +0 -1
- package/dist/types.js +0 -2
- package/dist/types.js.map +0 -1
- package/dist/ui/schemas/types.d.ts +0 -2
- package/dist/ui/schemas/types.d.ts.map +0 -1
- package/dist/ui/schemas/types.js +0 -2
- package/dist/ui/schemas/types.js.map +0 -1
- package/dist/ui/toolkit/VibesUIToolkit.d.ts +0 -2
- package/dist/ui/toolkit/VibesUIToolkit.d.ts.map +0 -1
- package/dist/ui/toolkit/VibesUIToolkit.js +0 -2
- package/dist/ui/toolkit/VibesUIToolkit.js.map +0 -1
- package/dist/ui.context.descriptor.d.ts +0 -21
- package/dist/ui.context.descriptor.d.ts.map +0 -1
- package/dist/ui.context.descriptor.js.map +0 -1
- package/dist/utils/open.d.ts +0 -2
- package/dist/utils/open.d.ts.map +0 -1
- package/dist/utils/open.js +0 -30
- package/dist/utils/open.js.map +0 -1
- package/dist/version.d.ts +0 -2
- package/dist/version.d.ts.map +0 -1
- package/dist/version.js +0 -2
- package/dist/version.js.map +0 -1
- package/src/api/client/factory.ts +0 -265
- package/src/api/schemas/common.ts +0 -50
- package/src/api/schemas/types.ts +0 -32
- package/src/api/services/api.ts +0 -129
- package/src/api/types.ts +0 -12
- package/src/bin.ts +0 -84
- package/src/bootstrap.ts +0 -19
- package/src/cli.plugin.d.ts +0 -19
- package/src/cli.plugin.ts +0 -202
- package/src/commands/completion/bash.ts +0 -68
- package/src/commands/completion/completion.descriptor.ts +0 -48
- package/src/commands/completion/completion.impl.ts +0 -188
- package/src/commands/completion/fig.ts +0 -78
- package/src/commands/completion/fish.ts +0 -52
- package/src/commands/completion/tree.ts +0 -115
- package/src/commands/completion/zsh-widget.ts +0 -39
- package/src/commands/completion/zsh.ts +0 -165
- package/src/commands/profile/_utils.ts +0 -72
- package/src/commands/profile/profile-group.descriptor.ts +0 -14
- package/src/commands/profile/profile.create.descriptor.ts +0 -24
- package/src/commands/profile/profile.create.impl.ts +0 -44
- package/src/commands/profile/profile.delete.descriptor.ts +0 -31
- package/src/commands/profile/profile.delete.impl.ts +0 -71
- package/src/commands/profile/profile.info.descriptor.ts +0 -25
- package/src/commands/profile/profile.info.impl.ts +0 -51
- package/src/commands/profile/profile.list.descriptor.ts +0 -18
- package/src/commands/profile/profile.list.impl.ts +0 -46
- package/src/commands/profile/profile.use.descriptor.ts +0 -25
- package/src/commands/profile/profile.use.impl.ts +0 -39
- package/src/commands/runtime/_logging.ts +0 -47
- package/src/commands/runtime/codegen.command.descriptor.ts +0 -18
- package/src/commands/runtime/codegen.command.impl.ts +0 -44
- package/src/commands/runtime/codegen.ts +0 -84
- package/src/commands/runtime/index.ts +0 -14
- package/src/commands/runtime/plugin.ts +0 -7
- package/src/commands/runtime/runtime-group.descriptor.ts +0 -12
- package/src/config.ts +0 -22
- package/src/core/index.ts +0 -9
- package/src/core/namespace/hook.ts +0 -25
- package/src/core/namespace/index.ts +0 -298
- package/src/core/namespace/schemas/index.ts +0 -25
- package/src/core/plugins/types.ts +0 -87
- package/src/core/runtime/context.ts +0 -50
- package/src/core/runtime/hooks.ts +0 -12
- package/src/core/runtime/shared/context.ts +0 -65
- package/src/core/runtime/shared/options.ts +0 -60
- package/src/core/schemas/manifest.ts +0 -26
- package/src/core/schemas/types.ts +0 -6
- package/src/core/ui/interface.ts +0 -12
- package/src/docs/cli.commands.docs.descriptor.ts +0 -210
- package/src/docs/cli.groups.docs.descriptor.ts +0 -333
- package/src/docs/cli.output.docs.descriptor.ts +0 -445
- package/src/docs/types.ts +0 -18
- package/src/errors.ts +0 -123
- package/src/index.ts +0 -76
- package/src/logging/cli-startup.logger.descriptor.ts +0 -16
- package/src/logging.ts +0 -35
- package/src/patterns/config-namespace.ts +0 -251
- package/src/patterns/crud.ts +0 -217
- package/src/patterns/index.ts +0 -24
- package/src/patterns/log-viewer.ts +0 -118
- package/src/patterns/pattern-types.ts +0 -22
- package/src/patterns/process-manager.ts +0 -180
- package/src/patterns/resolver.contracts.ts +0 -15
- package/src/patterns/resolver.ts +0 -86
- package/src/patterns/schemas.ts +0 -146
- package/src/patterns/tool-wrapper.ts +0 -165
- package/src/providers.ts +0 -282
- package/src/schemas/descriptors.d.ts +0 -119
- package/src/schemas/descriptors.ts +0 -136
- package/src/schemas/surface.ts +0 -52
- package/src/schemas/types.d.ts +0 -195
- package/src/schemas/types.ts +0 -225
- package/src/support/ui-toolkit.ts +0 -224
- package/src/surface/CLISurface.ts +0 -193
- package/src/surface/attach-tui-action.ts +0 -76
- package/src/surface/build-context.ts +0 -49
- package/src/surface/command-group-policy.ts +0 -52
- package/src/surface/discovery-cache.ts +0 -143
- package/src/surface/register-commands.ts +0 -266
- package/src/surface/register-groups.ts +0 -84
- package/src/surface.ts +0 -9
- package/src/types.ts +0 -3
- package/src/ui/schemas/types.ts +0 -1
- package/src/ui/toolkit/VibesUIToolkit.ts +0 -1
- package/src/ui.context.descriptor.ts +0 -13
- package/src/utils/open.ts +0 -36
- package/src/version.ts +0 -10
- /package/dist/{api → boot}/schemas/types.js +0 -0
- /package/dist/{logging → support/logging}/cli-startup.logger.descriptor.d.ts +0 -0
- /package/dist/{logging → support/logging}/cli-startup.logger.descriptor.js +0 -0
- /package/dist/{core → support/ui}/schemas/types.js +0 -0
|
@@ -1,95 +1,405 @@
|
|
|
1
|
+
import { argvWantsJson, buildJsonFailureEnvelope, writeScrubbedEnvelope } from "./failure-output.js";
|
|
2
|
+
export { argvWantsJson } from "./failure-output.js";
|
|
3
|
+
import { getCLIInvocationClient } from "../invocation/state.js";
|
|
1
4
|
import { Command, CommanderError } from 'commander';
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
5
|
+
import * as z from 'zod/v4';
|
|
6
|
+
import { CapabilityError, CaughtFailureSchema, getRuntimeStdio, getRuntimeStdioOutputPlane, hasRuntimeStdioOutputPlane, isCapabilityError, valueFreeFailure } from '@vibesdotdev/kernel';
|
|
7
|
+
import { isCLIExitSignal, readCLIExitCode, registerCLIProviders, resolveOutputStripSgr, shouldKeepAlive } from "../boot/providers.js";
|
|
8
|
+
import { createPatternResolver } from "../patterns/resolver.js";
|
|
9
|
+
import { CLICommandRecommendationsSchema } from "../schemas/command-recommendations.js";
|
|
10
|
+
import { buildCommandContext } from "./build-context.js";
|
|
11
|
+
import { configureInheritedGlobalOptions, resolveScopedCommandOptions } from "./inherited-options.js";
|
|
12
|
+
import { resolveCLIInvocationEffects } from "./invocation-effects.js";
|
|
13
|
+
import { CLIInvocationController } from "./invocation-lifecycle.js";
|
|
14
|
+
import { failureOf } from "./failure-of.js";
|
|
15
|
+
import { resolveCliInvocationActor, routeActionsThrough } from "./invocation-actions.js";
|
|
16
|
+
import { registerGroups } from "./register-groups.js";
|
|
17
|
+
import { registerCommands } from "./register-commands.js";
|
|
18
|
+
import { hasWrittenJsonPayload } from "../commands/output.js";
|
|
19
|
+
import { getLogger } from "../support/logging/logging.js";
|
|
20
|
+
import { renderCliFailure, scrubCliText, stripBundlePaths } from "./failure-report.js";
|
|
21
|
+
const HELP_FLAGS = new Set(['-h', '--help']);
|
|
22
|
+
function resolveMaterializedCommand(program, destination) {
|
|
23
|
+
let command = program;
|
|
24
|
+
const segments = destination.trim().split(/\s+/);
|
|
25
|
+
for (let index = 0; index < segments.length; index++) {
|
|
26
|
+
const segment = segments[index];
|
|
27
|
+
const next = command.commands.find((candidate) => candidate.name() === segment || candidate.aliases().includes(segment));
|
|
28
|
+
if (!next) {
|
|
29
|
+
const arguments_ = segments.slice(index);
|
|
30
|
+
if (command.commands.length === 0 && command.registeredArguments.length > 0 && arguments_.length <= positionalCapacity(command)) {
|
|
31
|
+
return { command, arguments: arguments_ };
|
|
32
|
+
}
|
|
33
|
+
return undefined;
|
|
34
|
+
}
|
|
35
|
+
command = next;
|
|
36
|
+
}
|
|
37
|
+
return { command, arguments: [] };
|
|
27
38
|
}
|
|
28
39
|
/**
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
* Returns `null` when no friendly mapping is known (caller falls back to
|
|
33
|
-
* the raw error message).
|
|
40
|
+
* Find the next command operand without mistaking an option value for command
|
|
41
|
+
* intent. Unknown options are returned explicitly so help cannot hide one by
|
|
42
|
+
* short-circuiting before Commander's validation.
|
|
34
43
|
*/
|
|
35
|
-
function
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
44
|
+
function commandOperand(command, args) {
|
|
45
|
+
let optionsEnded = false;
|
|
46
|
+
for (let index = 0; index < args.length; index += 1) {
|
|
47
|
+
const token = args[index];
|
|
48
|
+
if (!optionsEnded && token === '--') {
|
|
49
|
+
optionsEnded = true;
|
|
50
|
+
continue;
|
|
51
|
+
}
|
|
52
|
+
if (!optionsEnded && token.startsWith('-') && token !== '-') {
|
|
53
|
+
if (HELP_FLAGS.has(token))
|
|
54
|
+
continue;
|
|
55
|
+
const option = commandOptionForToken(command, token);
|
|
56
|
+
if (!option)
|
|
57
|
+
return { kind: 'unknown-option', token, index };
|
|
58
|
+
if (option.required && !hasAttachedOptionValue(option, token)) {
|
|
59
|
+
index += 1;
|
|
60
|
+
}
|
|
61
|
+
else if (option.optional &&
|
|
62
|
+
!hasAttachedOptionValue(option, token) &&
|
|
63
|
+
args[index + 1] !== undefined &&
|
|
64
|
+
!args[index + 1].startsWith('-')) {
|
|
65
|
+
index += 1;
|
|
66
|
+
}
|
|
67
|
+
continue;
|
|
68
|
+
}
|
|
69
|
+
return { kind: 'operand', token, index };
|
|
70
|
+
}
|
|
71
|
+
return null;
|
|
72
|
+
}
|
|
73
|
+
function commandOptionForToken(command, token) {
|
|
74
|
+
return command.options.find((option) => token === option.short ||
|
|
75
|
+
token === option.long ||
|
|
76
|
+
(option.long !== undefined && token.startsWith(`${option.long}=`)) ||
|
|
77
|
+
(option.short !== undefined &&
|
|
78
|
+
(option.required || option.optional) &&
|
|
79
|
+
token.startsWith(option.short) &&
|
|
80
|
+
token.length > option.short.length));
|
|
81
|
+
}
|
|
82
|
+
function hasAttachedOptionValue(option, token) {
|
|
83
|
+
return ((option.long !== undefined && token.startsWith(`${option.long}=`)) ||
|
|
84
|
+
(option.short !== undefined && token.startsWith(option.short) && token !== option.short));
|
|
85
|
+
}
|
|
86
|
+
function findSubcommand(command, operand) {
|
|
87
|
+
const commands = [...command.commands, ...command.createHelp().visibleCommands(command)];
|
|
88
|
+
return commands.find((candidate) => candidate.name() === operand ||
|
|
89
|
+
candidate.aliases().includes(operand) ||
|
|
90
|
+
candidate.name() === '*');
|
|
91
|
+
}
|
|
92
|
+
/** Every operand in `args` for `command`, in order (option values and help flags skipped). */
|
|
93
|
+
function commandOperands(command, args) {
|
|
94
|
+
const operands = [];
|
|
95
|
+
let rest = args;
|
|
96
|
+
for (let found = commandOperand(command, rest); found?.kind === 'operand'; found = commandOperand(command, rest)) {
|
|
97
|
+
operands.push(found.token);
|
|
98
|
+
rest = rest.slice(found.index + 1);
|
|
99
|
+
}
|
|
100
|
+
return operands;
|
|
101
|
+
}
|
|
102
|
+
/** How many operands `command` accepts: its declared positionals, unbounded when one is variadic. */
|
|
103
|
+
function positionalCapacity(command) {
|
|
104
|
+
return command.registeredArguments.some((argument) => argument.variadic)
|
|
105
|
+
? Number.POSITIVE_INFINITY
|
|
106
|
+
: command.registeredArguments.length;
|
|
107
|
+
}
|
|
108
|
+
function isImplicitHelpCommand(command, operand) {
|
|
109
|
+
const explicitlyRegistered = command.commands.some((candidate) => candidate.name() === operand || candidate.aliases().includes(operand));
|
|
110
|
+
if (explicitlyRegistered)
|
|
111
|
+
return false;
|
|
112
|
+
return command
|
|
113
|
+
.createHelp()
|
|
114
|
+
.visibleCommands(command)
|
|
115
|
+
.some((candidate) => candidate.name() === operand);
|
|
116
|
+
}
|
|
117
|
+
function findUnknownCommandOption(command, args) {
|
|
118
|
+
for (let index = 0; index < args.length; index += 1) {
|
|
119
|
+
const token = args[index];
|
|
120
|
+
if (token === '--')
|
|
121
|
+
return null;
|
|
122
|
+
if (!token.startsWith('-') || token === '-' || HELP_FLAGS.has(token))
|
|
123
|
+
continue;
|
|
124
|
+
const option = commandOptionForToken(command, token);
|
|
125
|
+
if (!option)
|
|
126
|
+
return { kind: 'unknown-option', token, index };
|
|
127
|
+
if (option.required && !hasAttachedOptionValue(option, token)) {
|
|
128
|
+
index += 1;
|
|
129
|
+
}
|
|
130
|
+
else if (option.optional &&
|
|
131
|
+
!hasAttachedOptionValue(option, token) &&
|
|
132
|
+
args[index + 1] !== undefined &&
|
|
133
|
+
!args[index + 1].startsWith('-')) {
|
|
134
|
+
index += 1;
|
|
135
|
+
}
|
|
54
136
|
}
|
|
55
137
|
return null;
|
|
56
138
|
}
|
|
57
|
-
function
|
|
58
|
-
if (
|
|
59
|
-
|
|
60
|
-
|
|
139
|
+
function normalizedHelpArgv(argv, implicitHelpIndexes) {
|
|
140
|
+
if (implicitHelpIndexes.length === 0)
|
|
141
|
+
return argv;
|
|
142
|
+
const indexes = new Set(implicitHelpIndexes);
|
|
143
|
+
const args = argv.slice(2).filter((_, index) => !indexes.has(index));
|
|
144
|
+
if (!args.some((token) => HELP_FLAGS.has(token)))
|
|
145
|
+
args.push('--help');
|
|
146
|
+
return [argv[0] ?? 'node', argv[1] ?? 'vibes', ...args];
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* Resolve help intent against the materialized Commander tree. Commander's
|
|
150
|
+
* implicit `help <path>` command is syntax for the same lookup as
|
|
151
|
+
* `<path> --help`, not a positional leaf that may silently fall back to parent
|
|
152
|
+
* help.
|
|
153
|
+
*/
|
|
154
|
+
function commandHelpIntent(program, argv) {
|
|
155
|
+
let command = program;
|
|
156
|
+
let remaining = argv.slice(2);
|
|
157
|
+
let remainingOffset = 0;
|
|
158
|
+
const commandPath = [program.name()];
|
|
159
|
+
let helpRequested = remaining.some((token) => HELP_FLAGS.has(token));
|
|
160
|
+
const implicitHelpIndexes = [];
|
|
161
|
+
while (true) {
|
|
162
|
+
const operand = commandOperand(command, remaining);
|
|
163
|
+
const effectiveArgv = () => normalizedHelpArgv(argv, implicitHelpIndexes);
|
|
164
|
+
if (operand === null) {
|
|
165
|
+
return helpRequested ? { kind: 'resolved-help', argv: effectiveArgv() } : null;
|
|
166
|
+
}
|
|
167
|
+
if (operand.kind === 'unknown-option') {
|
|
168
|
+
return helpRequested
|
|
169
|
+
? {
|
|
170
|
+
kind: 'unknown-option',
|
|
171
|
+
argv: effectiveArgv(),
|
|
172
|
+
commandPath,
|
|
173
|
+
option: operand.token
|
|
174
|
+
}
|
|
175
|
+
: null;
|
|
176
|
+
}
|
|
177
|
+
if (isImplicitHelpCommand(command, operand.token)) {
|
|
178
|
+
helpRequested = true;
|
|
179
|
+
implicitHelpIndexes.push(remainingOffset + operand.index);
|
|
180
|
+
remainingOffset += operand.index + 1;
|
|
181
|
+
remaining = remaining.slice(operand.index + 1);
|
|
182
|
+
continue;
|
|
183
|
+
}
|
|
184
|
+
const subcommand = findSubcommand(command, operand.token);
|
|
185
|
+
if (subcommand) {
|
|
186
|
+
commandPath.push(operand.token);
|
|
187
|
+
command = subcommand;
|
|
188
|
+
remainingOffset += operand.index + 1;
|
|
189
|
+
remaining = remaining.slice(operand.index + 1);
|
|
190
|
+
continue;
|
|
191
|
+
}
|
|
192
|
+
if (command.registeredArguments.length > 0) {
|
|
193
|
+
const unknownOption = findUnknownCommandOption(command, remaining);
|
|
194
|
+
if (!helpRequested)
|
|
195
|
+
return null;
|
|
196
|
+
// More operands than the selected command accepts are a path, not its
|
|
197
|
+
// arguments: `vibes code deps analyze --help` names no command under
|
|
198
|
+
// the editor's `code` alias (whose one positional is a workspace), so
|
|
199
|
+
// it must not answer the editor's help.
|
|
200
|
+
const operands = commandOperands(command, remaining);
|
|
201
|
+
if (operands.length > positionalCapacity(command)) {
|
|
202
|
+
return { kind: 'unresolved-path', argv: effectiveArgv(), commandPath: [...commandPath, ...operands] };
|
|
203
|
+
}
|
|
204
|
+
return unknownOption
|
|
205
|
+
? {
|
|
206
|
+
kind: 'unknown-option',
|
|
207
|
+
argv: effectiveArgv(),
|
|
208
|
+
commandPath,
|
|
209
|
+
option: unknownOption.token
|
|
210
|
+
}
|
|
211
|
+
: { kind: 'resolved-help', argv: effectiveArgv() };
|
|
212
|
+
}
|
|
213
|
+
return helpRequested
|
|
214
|
+
? {
|
|
215
|
+
kind: 'unresolved-path',
|
|
216
|
+
argv: effectiveArgv(),
|
|
217
|
+
commandPath: [...commandPath, operand.token]
|
|
218
|
+
}
|
|
219
|
+
: null;
|
|
61
220
|
}
|
|
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
221
|
}
|
|
222
|
+
function rejectUnknownCommandHelp(program, commandPath) {
|
|
223
|
+
const attempted = commandPath.join(' ');
|
|
224
|
+
const codePoints = Array.from(attempted);
|
|
225
|
+
const boundedOperand = codePoints.length <= 256 ? attempted : `${codePoints.slice(0, 256).join('')}…`;
|
|
226
|
+
const path = JSON.stringify(boundedOperand);
|
|
227
|
+
program.error(`error: unknown command path ${path}\n` +
|
|
228
|
+
`Run "${program.name()} --help" to see available commands.`, { exitCode: 1, code: 'commander.unknownCommand' });
|
|
229
|
+
}
|
|
230
|
+
function rejectUnknownCommandHelpOption(program, commandPath, option) {
|
|
231
|
+
const codePoints = Array.from(option);
|
|
232
|
+
const boundedOption = codePoints.length <= 256 ? option : `${codePoints.slice(0, 256).join('')}…`;
|
|
233
|
+
program.error(`error: unknown option ${JSON.stringify(boundedOption)} while resolving ` +
|
|
234
|
+
`${JSON.stringify(commandPath.join(' '))} help`, { exitCode: 1, code: 'commander.unknownOption' });
|
|
235
|
+
}
|
|
236
|
+
/** Anything that carries both `code` and `exitCode`: a CommanderError, or a value shaped like one. */
|
|
237
|
+
const CommanderFailureSchema = z.custom((value) => typeof value === 'object' && value !== null && 'exitCode' in value && 'code' in value);
|
|
238
|
+
/** A Commander-shaped failure's fields, each read independently. */
|
|
239
|
+
const CommanderFieldsSchema = z.object({
|
|
240
|
+
code: z.union([z.string(), z.unknown().transform((code) => String(code ?? 'unknown'))]),
|
|
241
|
+
exitCode: z.number().optional().catch(undefined),
|
|
242
|
+
message: z.string().optional().catch(undefined)
|
|
243
|
+
});
|
|
244
|
+
/** The caught failure as a Commander outcome, when it is Commander-shaped. */
|
|
245
|
+
function commanderOutcome(failure) {
|
|
246
|
+
const candidate = failure instanceof Error ? failure : failure.value;
|
|
247
|
+
if (!(candidate instanceof CommanderError) && !CommanderFailureSchema.safeParse(candidate).success)
|
|
248
|
+
return undefined;
|
|
249
|
+
const fields = CommanderFieldsSchema.parse(candidate);
|
|
250
|
+
return {
|
|
251
|
+
code: fields.code,
|
|
252
|
+
exitCode: fields.exitCode,
|
|
253
|
+
message: fields.message,
|
|
254
|
+
commanderOwn: fields.code.startsWith('commander.')
|
|
255
|
+
};
|
|
256
|
+
}
|
|
257
|
+
export { buildJsonFailureEnvelope, writeJsonEnvelope, reportBootstrapFailure } from "./failure-output.js";
|
|
258
|
+
export { mapKnownError, renderCliFailure } from "./failure-report.js";
|
|
68
259
|
export class CLISurface {
|
|
69
260
|
runtime;
|
|
70
261
|
program;
|
|
71
262
|
options;
|
|
72
263
|
groups = new Map();
|
|
73
264
|
groupDescriptors = new Map();
|
|
265
|
+
commandRecommendations;
|
|
74
266
|
patternResolver = null;
|
|
75
267
|
initialized = false;
|
|
268
|
+
runtimeWriter;
|
|
269
|
+
invocationController;
|
|
270
|
+
invocationDescriptors = new WeakMap();
|
|
271
|
+
invocationPreparers = [];
|
|
272
|
+
/** The overlay the dispatched action runs with; set once its preparation completes. */
|
|
273
|
+
actionInvocation;
|
|
274
|
+
/** The host env snapshot failure text is scrubbed against; read before any runtime this surface holds is disposed. */
|
|
275
|
+
capturedHostEnv;
|
|
276
|
+
/** The host output plane this surface installed, and the runtime it was resolved on (its methods refuse once that runtime is disposed). */
|
|
277
|
+
outputPlane;
|
|
76
278
|
constructor(runtime, program, options = {}) {
|
|
77
279
|
this.runtime = runtime;
|
|
78
280
|
this.program = program;
|
|
79
281
|
this.options = options;
|
|
282
|
+
this.commandRecommendations = CLICommandRecommendationsSchema.parse(options.commandRecommendations ?? {});
|
|
283
|
+
// Observer failures never change the outcome; under -v the report also
|
|
284
|
+
// carries the failure rendered by the one renderer (cause chain, redacted).
|
|
285
|
+
this.invocationController = new CLIInvocationController(() => this.runtime, (failure) => (this.options.verbose ? renderCliFailure(failure, { verbose: true, env: this.hostEnv() }) : undefined));
|
|
286
|
+
// Every action runs as one invocation of this runtime, acting for the
|
|
287
|
+
// actor its preparation resolved (rc01 §2.1, interactiveSession).
|
|
288
|
+
routeActionsThrough(this.program, (action) => this.runtime.runInvocation(action, this.actionInvocation));
|
|
289
|
+
this.program.hook('preAction', async (_command, actionCommand) => {
|
|
290
|
+
const descriptor = this.invocationDescriptors.get(actionCommand);
|
|
291
|
+
const baseInfo = {
|
|
292
|
+
commandPath: resolveCommandPath(actionCommand),
|
|
293
|
+
effects: resolveCLIInvocationEffects(actionCommand, descriptor?.effects)
|
|
294
|
+
};
|
|
295
|
+
if (resolveScopedCommandOptions(actionCommand).finite === true)
|
|
296
|
+
baseInfo.lifecycle = 'finite';
|
|
297
|
+
// The host declared purpose and lifecycle once, before boot
|
|
298
|
+
// (`--finite ? finite : persistent`); nothing patches them here. A
|
|
299
|
+
// serve command becomes its own host instead (rc02-rc03 §2.3): the
|
|
300
|
+
// un-activated CLI runtime is disposed and the serve host, booted
|
|
301
|
+
// through the one entry, runs the action and every preparation.
|
|
302
|
+
if (baseInfo.effects.serve && descriptor) {
|
|
303
|
+
// The transition disposes this runtime: read the host env first.
|
|
304
|
+
this.hostEnv();
|
|
305
|
+
if (!this.options.serveTransition) {
|
|
306
|
+
throw new CapabilityError(`'${descriptor.id}' is a serve command, but this CLI host supplied no serve transition.`, 'INTERNAL', { reason: 'dependency-absent', details: { command: descriptor.id } });
|
|
307
|
+
}
|
|
308
|
+
this.runtime = await this.options.serveTransition({
|
|
309
|
+
descriptorId: descriptor.id,
|
|
310
|
+
serve: baseInfo.effects.serve
|
|
311
|
+
});
|
|
312
|
+
registerCLIProviders(this.runtime, this.options);
|
|
313
|
+
(await getCLIInvocationClient(this.runtime)).begin();
|
|
314
|
+
await this.resolveWriter();
|
|
315
|
+
}
|
|
316
|
+
// Admission happens here, in the action envelope, before any
|
|
317
|
+
// preparer or observer runs — never inside a handler after the
|
|
318
|
+
// outer lifecycle hooks have already fired unvetted (RC08/D-RC04
|
|
319
|
+
// U7). `resolveCliInvocationActor` reads only the host's own
|
|
320
|
+
// captured launch identity and (when the action writes home) the
|
|
321
|
+
// verified stored session; it never trusts a caller-declared
|
|
322
|
+
// value at this point.
|
|
323
|
+
const actor = await resolveCliInvocationActor(this.runtime, baseInfo);
|
|
324
|
+
const info = actor ? { ...baseInfo, actor } : baseInfo;
|
|
325
|
+
this.actionInvocation = actor ? { actor } : undefined;
|
|
326
|
+
for (const preparer of this.invocationPreparers) {
|
|
327
|
+
await preparer.prepare(info);
|
|
328
|
+
}
|
|
329
|
+
await this.invocationController.start(info);
|
|
330
|
+
});
|
|
331
|
+
}
|
|
332
|
+
/** The host env snapshot, read once while the held runtime is live. */
|
|
333
|
+
hostEnv() {
|
|
334
|
+
this.capturedHostEnv ??= this.runtime.getEnvSnapshot();
|
|
335
|
+
return this.capturedHostEnv;
|
|
336
|
+
}
|
|
337
|
+
/**
|
|
338
|
+
* The runtime the selected action runs on: the host's CLI runtime, or the
|
|
339
|
+
* serve host a serve command's transition booted (rc02-rc03 §2.3).
|
|
340
|
+
*/
|
|
341
|
+
get activeRuntime() {
|
|
342
|
+
return this.runtime;
|
|
343
|
+
}
|
|
344
|
+
setInvocationObserver(observer) {
|
|
345
|
+
this.invocationController.setObserver(observer);
|
|
346
|
+
}
|
|
347
|
+
/**
|
|
348
|
+
* Observer failures this surface could not log because the action's runtime
|
|
349
|
+
* had no logging to take them: typed `UNAVAILABLE`
|
|
350
|
+
* `observer-failure-unlogged` diagnostics (value-free observer facts in
|
|
351
|
+
* `details`, the logging refusal as `cause`). They never change an outcome.
|
|
352
|
+
*/
|
|
353
|
+
get invocationDiagnostics() {
|
|
354
|
+
return this.invocationController.undeliveredDiagnostics;
|
|
355
|
+
}
|
|
356
|
+
setInvocationPreparer(preparer) {
|
|
357
|
+
this.invocationPreparers.length = 0;
|
|
358
|
+
if (preparer)
|
|
359
|
+
this.invocationPreparers.push(preparer);
|
|
360
|
+
}
|
|
361
|
+
addInvocationPreparer(preparer) {
|
|
362
|
+
this.invocationPreparers.push(preparer);
|
|
363
|
+
}
|
|
364
|
+
prependInvocationPreparer(preparer) {
|
|
365
|
+
this.invocationPreparers.unshift(preparer);
|
|
80
366
|
}
|
|
81
367
|
async initialize() {
|
|
82
368
|
if (this.initialized)
|
|
83
369
|
throw new Error('CLISurface already initialized');
|
|
84
|
-
const {
|
|
370
|
+
const { enablePatterns } = this.options;
|
|
371
|
+
const logger = getLogger(this.runtime, 'surface');
|
|
372
|
+
let verbose = !!this.options.verbose;
|
|
373
|
+
if (verbose) {
|
|
374
|
+
const failure = await failureOf(() => logger.debug('Initializing CLI surface'));
|
|
375
|
+
if (failure) {
|
|
376
|
+
if (!isCapabilityError(failure) || failure.code !== 'UNAVAILABLE' || failure.reason !== 'logger-not-initialized')
|
|
377
|
+
throw failure;
|
|
378
|
+
// Setup diagnostics need Logging; failure rendering and observer
|
|
379
|
+
// diagnostics still honor the host's verbose option without it.
|
|
380
|
+
verbose = false;
|
|
381
|
+
}
|
|
382
|
+
}
|
|
383
|
+
const registrationOptions = { ...this.options, verbose };
|
|
85
384
|
this.program.exitOverride();
|
|
385
|
+
// The output plane owns two flags impls do not implement themselves:
|
|
386
|
+
// every write is tracked so the surface can join them before the host
|
|
387
|
+
// exits, and `--no-color` / `NO_COLOR` / JSON output strip SGR at the
|
|
388
|
+
// stream boundary (impls carry raw `\x1b[`). It is the host's
|
|
389
|
+
// (`runtime/stdio` `trackOutput`); a host without one tracks nothing.
|
|
390
|
+
if (await hasRuntimeStdioOutputPlane(this.runtime)) {
|
|
391
|
+
const plane = await getRuntimeStdioOutputPlane(this.runtime);
|
|
392
|
+
plane.trackOutput({ stripSgr: resolveOutputStripSgr(this.runtime, this.options) });
|
|
393
|
+
this.outputPlane = { plane, runtime: this.runtime };
|
|
394
|
+
}
|
|
86
395
|
registerCLIProviders(this.runtime, this.options);
|
|
396
|
+
await getCLIInvocationClient(this.runtime);
|
|
87
397
|
if (verbose)
|
|
88
398
|
logger.debug('Registered context providers');
|
|
89
399
|
if (enablePatterns) {
|
|
90
400
|
this.patternResolver = await createPatternResolver(this.runtime);
|
|
91
401
|
if (verbose) {
|
|
92
|
-
logger.debug(`
|
|
402
|
+
logger.debug(`Runtime cli/pattern: ${this.patternResolver.getPatternTypes().join(', ')}`);
|
|
93
403
|
}
|
|
94
404
|
}
|
|
95
405
|
const buildContext = async () => buildCommandContext(this.runtime);
|
|
@@ -102,7 +412,7 @@ export class CLISurface {
|
|
|
102
412
|
program: this.program,
|
|
103
413
|
groups: this.groups,
|
|
104
414
|
groupDescriptors: this.groupDescriptors,
|
|
105
|
-
options:
|
|
415
|
+
options: registrationOptions,
|
|
106
416
|
patternResolver: this.patternResolver,
|
|
107
417
|
buildContext
|
|
108
418
|
});
|
|
@@ -110,64 +420,298 @@ export class CLISurface {
|
|
|
110
420
|
logger.debug(`Registered ${this.groups.size} groups`);
|
|
111
421
|
await registerCommands({
|
|
112
422
|
runtime: this.runtime,
|
|
423
|
+
currentRuntime: () => this.runtime,
|
|
113
424
|
program: this.program,
|
|
114
425
|
groups: this.groups,
|
|
115
426
|
groupDescriptors: this.groupDescriptors,
|
|
116
|
-
options:
|
|
427
|
+
options: registrationOptions,
|
|
117
428
|
patternResolver: this.patternResolver,
|
|
118
|
-
buildContext
|
|
429
|
+
buildContext,
|
|
430
|
+
registerInvocationDescriptor: (command, descriptor) => {
|
|
431
|
+
this.invocationDescriptors.set(command, descriptor);
|
|
432
|
+
}
|
|
119
433
|
});
|
|
434
|
+
configureInheritedGlobalOptions(this.program);
|
|
120
435
|
this.initialized = true;
|
|
121
436
|
if (verbose)
|
|
122
437
|
logger.debug('Surface initialized');
|
|
123
438
|
}
|
|
124
|
-
async run(argv
|
|
439
|
+
async run(argv) {
|
|
125
440
|
if (!this.initialized)
|
|
126
441
|
await this.initialize();
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
442
|
+
await this.resolveWriter();
|
|
443
|
+
// Reset only the executing runtime's lifetime and output accounting.
|
|
444
|
+
(await getCLIInvocationClient(this.runtime)).begin();
|
|
445
|
+
// The host env, read once while a runtime is live (see `hostEnv`): every
|
|
446
|
+
// failure this run prints (the exit-boundary disposal's included) has its
|
|
447
|
+
// credential values scrubbed against it.
|
|
448
|
+
const render = () => ({ verbose: !!this.options.verbose, env: this.hostEnv() });
|
|
449
|
+
// One dispatch. A failure is parsed at its catch (`failureOf`), then
|
|
450
|
+
// rendered once and projected to the exit code by `reportRunFailure`.
|
|
451
|
+
const dispatched = {};
|
|
452
|
+
const undeliveredBefore = this.invocationController.undeliveredDiagnostics.length;
|
|
453
|
+
const failure = await failureOf(async () => {
|
|
454
|
+
dispatched.exitCode = await this.dispatch(argv);
|
|
455
|
+
await this.invocationController.finish('success');
|
|
456
|
+
});
|
|
457
|
+
let exitCode = failure
|
|
458
|
+
? await this.reportRunFailure(failure, argv, render)
|
|
459
|
+
: dispatched.exitCode ?? readCLIExitCode(this.runtime) ?? 0;
|
|
460
|
+
// An observer failure logging could not take is carried, never the
|
|
461
|
+
// outcome; under -v it is printed to stderr (stdout stays the output).
|
|
462
|
+
if (this.options.verbose) {
|
|
463
|
+
for (const diagnostic of this.invocationController.undeliveredDiagnostics.slice(undeliveredBefore)) {
|
|
464
|
+
this.writer.write('stderr', `${renderCliFailure(diagnostic, render())}\n`);
|
|
137
465
|
}
|
|
138
466
|
}
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
467
|
+
// Join the command's writes while the runtime is live, then once more
|
|
468
|
+
// after the exit-boundary disposal (through the host's own output).
|
|
469
|
+
await this.flushOutput();
|
|
470
|
+
if (!shouldKeepAlive(this.runtime)) {
|
|
471
|
+
exitCode = await this.finishBeforeAutoExit(argv, render, exitCode);
|
|
472
|
+
await this.flushOutput();
|
|
473
|
+
}
|
|
474
|
+
return exitCode;
|
|
475
|
+
}
|
|
476
|
+
/**
|
|
477
|
+
* Whether this invocation already put its JSON document on stdout, through
|
|
478
|
+
* the runtime its command was handed (`context.runtime`: the serve host
|
|
479
|
+
* after a serve transition), including the canonically bound free form.
|
|
480
|
+
*/
|
|
481
|
+
jsonDocumentWritten() {
|
|
482
|
+
return hasWrittenJsonPayload(this.runtime);
|
|
483
|
+
}
|
|
484
|
+
/**
|
|
485
|
+
* Where the surface writes: the executable host's output, else the text
|
|
486
|
+
* output of the runtime it holds (resolved by `resolveWriter` as a run
|
|
487
|
+
* starts, and again when a serve transition swaps the runtime).
|
|
488
|
+
*/
|
|
489
|
+
get writer() {
|
|
490
|
+
if (this.options.hostOutput)
|
|
491
|
+
return this.options.hostOutput;
|
|
492
|
+
if (this.runtimeWriter)
|
|
493
|
+
return this.runtimeWriter.writer;
|
|
494
|
+
throw new CapabilityError('The CLI surface has no host output and has not resolved its runtime\'s text output.', 'UNAVAILABLE', {
|
|
495
|
+
reason: 'stdio-unavailable',
|
|
496
|
+
retryable: false
|
|
497
|
+
});
|
|
498
|
+
}
|
|
499
|
+
/** Resolve the held runtime's text output as the surface's writer when no host output was handed. */
|
|
500
|
+
async resolveWriter() {
|
|
501
|
+
if (this.options.hostOutput || this.runtimeWriter?.runtime === this.runtime)
|
|
502
|
+
return;
|
|
503
|
+
const stdio = await getRuntimeStdio(this.runtime);
|
|
504
|
+
this.runtimeWriter = { runtime: this.runtime, writer: { write: (channel, text) => stdio.write(channel, text) } };
|
|
505
|
+
}
|
|
506
|
+
/**
|
|
507
|
+
* Join every tracked write: through the host's own output when it handed
|
|
508
|
+
* one (usable after any disposal), else through the installed plane while
|
|
509
|
+
* the runtime it was resolved on is live.
|
|
510
|
+
*/
|
|
511
|
+
async flushOutput() {
|
|
512
|
+
if (this.options.hostOutput) {
|
|
513
|
+
await this.options.hostOutput.flush();
|
|
514
|
+
return;
|
|
515
|
+
}
|
|
516
|
+
if (this.outputPlane && !this.outputPlane.runtime.disposed)
|
|
517
|
+
await this.outputPlane.plane.flush();
|
|
518
|
+
}
|
|
519
|
+
/**
|
|
520
|
+
* Answer help or dispatch the selected action. Answers the exit code a help
|
|
521
|
+
* path chose (`undefined` when the action ran and chose none); throws what
|
|
522
|
+
* Commander or the action threw.
|
|
523
|
+
*/
|
|
524
|
+
async dispatch(argv) {
|
|
525
|
+
if (argv.slice(2).length === 0) {
|
|
526
|
+
this.program.outputHelp();
|
|
527
|
+
return 0;
|
|
528
|
+
}
|
|
529
|
+
const helpIntent = commandHelpIntent(this.program, argv);
|
|
530
|
+
if (helpIntent?.kind === 'unresolved-path') {
|
|
531
|
+
const canonicalExitCode = await this.options.canonicalCommandHelp?.(helpIntent.argv);
|
|
532
|
+
if (canonicalExitCode === undefined) {
|
|
533
|
+
rejectUnknownCommandHelp(this.program, helpIntent.commandPath);
|
|
142
534
|
}
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
535
|
+
return canonicalExitCode;
|
|
536
|
+
}
|
|
537
|
+
if (helpIntent?.kind === 'unknown-option') {
|
|
538
|
+
rejectUnknownCommandHelpOption(this.program, helpIntent.commandPath, helpIntent.option);
|
|
539
|
+
}
|
|
540
|
+
await this.program.parseAsync(helpIntent?.argv ?? argv);
|
|
541
|
+
return undefined;
|
|
542
|
+
}
|
|
543
|
+
/**
|
|
544
|
+
* Close the invocation with the failure's outcome, render the failure once
|
|
545
|
+
* (a JSON envelope under --json, otherwise the one renderer's text), and
|
|
546
|
+
* answer the exit code it projects to.
|
|
547
|
+
*/
|
|
548
|
+
async reportRunFailure(failure, argv, render) {
|
|
549
|
+
// Every field the projection needs is read once, inside one guard.
|
|
550
|
+
const classified = classifyRunFailure(failure);
|
|
551
|
+
const successfulExit = classified.kind === 'exit' && classified.code === 0;
|
|
552
|
+
const failureCause = successfulExit
|
|
553
|
+
? undefined
|
|
554
|
+
: classified.kind === 'exit' && classified.cause !== undefined
|
|
555
|
+
? valueFreeFailure(classified.cause)
|
|
556
|
+
: classified.kind === 'capability'
|
|
557
|
+
? valueFreeFailure(classified.error)
|
|
558
|
+
: undefined;
|
|
559
|
+
await this.invocationController.finish(successfulExit ? 'success' : 'failure', successfulExit ? undefined : invocationFailureCode(classified), failureCause);
|
|
560
|
+
if (classified.kind === 'exit')
|
|
561
|
+
return classified.code;
|
|
562
|
+
if (classified.kind === 'capability') {
|
|
563
|
+
// The cross-surface outcome contract: the impl chose a stable code;
|
|
564
|
+
// the surface projects it. Exit code comes from the code (never 0 for
|
|
565
|
+
// a real failure); the failure renders as a JSON envelope under --json,
|
|
566
|
+
// a stack under -v, otherwise a friendly message + recovery hint.
|
|
567
|
+
if (argvWantsJson(argv)) {
|
|
568
|
+
writeScrubbedEnvelope(classified.envelope, render().env, this.writer, this.jsonDocumentWritten());
|
|
154
569
|
}
|
|
155
570
|
else {
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
571
|
+
this.writer.write('stderr', `${renderCliFailure(classified.error, render())}\n`);
|
|
572
|
+
}
|
|
573
|
+
return classified.exitCode;
|
|
574
|
+
}
|
|
575
|
+
if (classified.kind === 'commander') {
|
|
576
|
+
const commander = classified.outcome;
|
|
577
|
+
if (commander.code === 'commander.unknownCommand') {
|
|
578
|
+
const attempted = argv.slice(2).find((a) => !a.startsWith('-'));
|
|
579
|
+
const recommendation = attempted && Object.hasOwn(this.commandRecommendations, attempted)
|
|
580
|
+
? this.commandRecommendations[attempted]
|
|
581
|
+
: undefined;
|
|
582
|
+
const destination = recommendation
|
|
583
|
+
? resolveMaterializedCommand(this.program, recommendation)
|
|
584
|
+
: undefined;
|
|
585
|
+
if (destination && !argvWantsJson(argv)) {
|
|
586
|
+
this.writer.write('stderr', `Try: ${[...resolveCommandPath(destination.command), ...destination.arguments].join(' ')}\n`);
|
|
160
587
|
}
|
|
161
588
|
}
|
|
589
|
+
// `commander.help` / `commander.helpDisplayed` / `commander.version`
|
|
590
|
+
// are not failures — they're successful help/version output. Map them
|
|
591
|
+
// to exit 0 so non-TTY callers (CI, subprocesses) treat them the
|
|
592
|
+
// same way TTY users see them.
|
|
593
|
+
const helpCodes = new Set([
|
|
594
|
+
'commander.help',
|
|
595
|
+
'commander.helpDisplayed',
|
|
596
|
+
'commander.version'
|
|
597
|
+
]);
|
|
598
|
+
const code = commander.code;
|
|
599
|
+
const exitCode = helpCodes.has(code) ? 0 : (commander.exitCode ?? 1);
|
|
600
|
+
// Machine callers: never leave bare commander text as the only signal.
|
|
601
|
+
const message = () => commander.message?.trim()
|
|
602
|
+
? scrubCliText(stripBundlePaths(commander.message.trim()), render().env)
|
|
603
|
+
: `CLI error (${code})`;
|
|
604
|
+
if (exitCode !== 0 && argvWantsJson(argv)) {
|
|
605
|
+
writeScrubbedEnvelope(buildJsonFailureEnvelope(message(), 'INVALID_INPUT'), render().env, this.writer, this.jsonDocumentWritten());
|
|
606
|
+
}
|
|
607
|
+
else if (exitCode !== 0 && !commander.commanderOwn) {
|
|
608
|
+
// Commander's own errors have already printed themselves; anything
|
|
609
|
+
// ELSE that merely looks like one (any object carrying `code` and
|
|
610
|
+
// `exitCode` — which every CapabilityError does) has not. Staying
|
|
611
|
+
// silent here is how a non-zero exit ended up with no explanation
|
|
612
|
+
// whenever the CapabilityError branch above was missed.
|
|
613
|
+
this.writer.write('stderr', `${message()}\n`);
|
|
614
|
+
}
|
|
615
|
+
return exitCode;
|
|
162
616
|
}
|
|
163
|
-
|
|
164
|
-
|
|
617
|
+
// Any other failure, or one whose own fields could not be read: the one
|
|
618
|
+
// renderer (total) describes it; under -v an unreadable one also prints
|
|
619
|
+
// why it could not be classified.
|
|
620
|
+
const formatted = renderCliFailure(failure, render()) || 'CLI command failed (run with -v for details).';
|
|
621
|
+
if (argvWantsJson(argv)) {
|
|
622
|
+
// Scripts must get a parseable envelope, not prose on stderr
|
|
623
|
+
// (work 6f1aa9e5 / cli-audit: --json bare "disk I/O error").
|
|
624
|
+
writeScrubbedEnvelope(buildJsonFailureEnvelope(formatted), render().env, this.writer, this.jsonDocumentWritten());
|
|
165
625
|
}
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
await this.options.onBeforeAutoExit();
|
|
169
|
-
process.exit(exitCode ?? process.exitCode ?? 0);
|
|
626
|
+
else {
|
|
627
|
+
this.writer.write('stderr', `${formatted}\n`);
|
|
170
628
|
}
|
|
629
|
+
if (classified.kind === 'unreadable' && render().verbose) {
|
|
630
|
+
this.writer.write('stderr', `${renderCliFailure(classified.refusal, render())}\n`);
|
|
631
|
+
}
|
|
632
|
+
return 1;
|
|
171
633
|
}
|
|
634
|
+
/**
|
|
635
|
+
* The host's exit-boundary work (disposal of the active runtime). Its
|
|
636
|
+
* failure is a failure of the invocation: reported once through the one
|
|
637
|
+
* renderer — an `AggregateError` lists each plugin and its typed reason —
|
|
638
|
+
* and the exit code becomes non-zero. It never escapes as an unhandled
|
|
639
|
+
* rejection with only the aggregate's message.
|
|
640
|
+
*/
|
|
641
|
+
async finishBeforeAutoExit(argv, renderOptions, exitCode) {
|
|
642
|
+
const beforeAutoExit = this.options.onBeforeAutoExit;
|
|
643
|
+
if (!beforeAutoExit)
|
|
644
|
+
return exitCode;
|
|
645
|
+
// Read before disposal: a disposed runtime no longer answers its env.
|
|
646
|
+
const render = renderOptions();
|
|
647
|
+
const documentWritten = this.jsonDocumentWritten();
|
|
648
|
+
const failure = await failureOf(beforeAutoExit);
|
|
649
|
+
if (!failure)
|
|
650
|
+
return exitCode;
|
|
651
|
+
const formatted = renderCliFailure(failure, render) || 'CLI shutdown failed (run with -v for details).';
|
|
652
|
+
if (argvWantsJson(argv)) {
|
|
653
|
+
const classified = classifyRunFailure(failure);
|
|
654
|
+
writeScrubbedEnvelope(classified.kind === 'capability' ? classified.envelope : buildJsonFailureEnvelope(formatted), render.env, this.writer, documentWritten);
|
|
655
|
+
}
|
|
656
|
+
else {
|
|
657
|
+
this.writer.write('stderr', `${formatted}\n`);
|
|
658
|
+
}
|
|
659
|
+
// A disposal failure after a successful action still fails the invocation.
|
|
660
|
+
return exitCode === 0 ? 1 : exitCode;
|
|
661
|
+
}
|
|
662
|
+
}
|
|
663
|
+
function resolveCommandPath(command) {
|
|
664
|
+
const path = [];
|
|
665
|
+
let cursor = command;
|
|
666
|
+
while (cursor) {
|
|
667
|
+
path.unshift(cursor.name());
|
|
668
|
+
cursor = cursor.parent;
|
|
669
|
+
}
|
|
670
|
+
return path;
|
|
671
|
+
}
|
|
672
|
+
/** The classification itself; reading a hostile failure's fields may throw, so callers use {@link classifyRunFailure}. */
|
|
673
|
+
function readRunFailureClass(failure) {
|
|
674
|
+
if (isCLIExitSignal(failure)) {
|
|
675
|
+
const code = failure.outcome.ok ? 0 : failure.code;
|
|
676
|
+
return failure.cause === undefined ? { kind: 'exit', code } : { kind: 'exit', code, cause: failure.cause };
|
|
677
|
+
}
|
|
678
|
+
// Structural, not `instanceof`: a second copy of the runtime module makes a
|
|
679
|
+
// genuine CapabilityError fail the identity test, and this would then log
|
|
680
|
+
// every one of them as UNHANDLED_ERROR instead of its real code.
|
|
681
|
+
if (failure instanceof Error && isCapabilityError(failure)) {
|
|
682
|
+
return { kind: 'capability', error: failure, exitCode: failure.exitCode, envelope: failure.toEnvelope() };
|
|
683
|
+
}
|
|
684
|
+
const outcome = commanderOutcome(failure);
|
|
685
|
+
return outcome ? { kind: 'commander', outcome } : { kind: 'other' };
|
|
686
|
+
}
|
|
687
|
+
/**
|
|
688
|
+
* The one guard over a caught failure's fields: never throws. A failure whose
|
|
689
|
+
* own fields throw when read is `unreadable`, carrying that read failure's
|
|
690
|
+
* value-free facts as the cause of a typed `INTERNAL` `cli-failure-unreadable`
|
|
691
|
+
* refusal.
|
|
692
|
+
*/
|
|
693
|
+
function classifyRunFailure(failure) {
|
|
694
|
+
try {
|
|
695
|
+
return readRunFailureClass(failure);
|
|
696
|
+
}
|
|
697
|
+
catch (error) {
|
|
698
|
+
return {
|
|
699
|
+
kind: 'unreadable',
|
|
700
|
+
refusal: new CapabilityError('The thrown value could not be classified; it is reported as an unhandled failure.', 'INTERNAL', {
|
|
701
|
+
reason: 'cli-failure-unreadable',
|
|
702
|
+
retryable: false,
|
|
703
|
+
// The read failure came from the hostile value itself (a trap's own
|
|
704
|
+
// throw), so its text may carry that value: only its value-free facts.
|
|
705
|
+
cause: valueFreeFailure(CaughtFailureSchema.parse(error))
|
|
706
|
+
})
|
|
707
|
+
};
|
|
708
|
+
}
|
|
709
|
+
}
|
|
710
|
+
function invocationFailureCode(classified) {
|
|
711
|
+
if (classified.kind === 'capability')
|
|
712
|
+
return classified.error.code;
|
|
713
|
+
if (classified.kind === 'exit')
|
|
714
|
+
return 'CLI_EXIT_NONZERO';
|
|
715
|
+
return 'UNHANDLED_ERROR';
|
|
172
716
|
}
|
|
173
717
|
//# sourceMappingURL=CLISurface.js.map
|