alloy-runtime-cli 0.1.0__py3-none-any.whl
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.
- alloy_runtime_cli-0.1.0.dist-info/METADATA +61 -0
- alloy_runtime_cli-0.1.0.dist-info/RECORD +451 -0
- alloy_runtime_cli-0.1.0.dist-info/WHEEL +5 -0
- alloy_runtime_cli-0.1.0.dist-info/entry_points.txt +2 -0
- alloy_runtime_cli-0.1.0.dist-info/top_level.txt +1 -0
- cli/__init__.py +0 -0
- cli/commands/__init__.py +0 -0
- cli/commands/admin/__init__.py +0 -0
- cli/commands/admin/bootstrap_command.py +118 -0
- cli/commands/admin/credentials/__init__.py +0 -0
- cli/commands/admin/credentials/create/__init__.py +0 -0
- cli/commands/admin/credentials/create/command.py +148 -0
- cli/commands/admin/credentials/create/presenter.py +16 -0
- cli/commands/admin/credentials/grant/__init__.py +0 -0
- cli/commands/admin/credentials/grant/command.py +119 -0
- cli/commands/admin/credentials/grant/fields.py +33 -0
- cli/commands/admin/credentials/grant/presenter.py +23 -0
- cli/commands/agents/__init__.py +0 -0
- cli/commands/agents/create/__init__.py +0 -0
- cli/commands/agents/create/command.py +475 -0
- cli/commands/agents/create/fields.py +64 -0
- cli/commands/agents/create/presenter.py +68 -0
- cli/commands/agents/delete/__init__.py +0 -0
- cli/commands/agents/delete/command.py +47 -0
- cli/commands/agents/delete/presenter.py +16 -0
- cli/commands/agents/get/command.py +37 -0
- cli/commands/agents/get/presenter.py +32 -0
- cli/commands/agents/list/__init__.py +1 -0
- cli/commands/agents/list/command.py +54 -0
- cli/commands/agents/list/presenter.py +82 -0
- cli/commands/agents/update/__init__.py +0 -0
- cli/commands/agents/update/command.py +435 -0
- cli/commands/agents/update/fields.py +40 -0
- cli/commands/agents/update/presenter.py +68 -0
- cli/commands/audio/__init__.py +0 -0
- cli/commands/audio/transcribe/__init__.py +0 -0
- cli/commands/audio/transcribe/command.py +144 -0
- cli/commands/audio/transcribe/presenter.py +15 -0
- cli/commands/auth/__init__.py +0 -0
- cli/commands/auth/login/__init__.py +0 -0
- cli/commands/auth/login/command.py +80 -0
- cli/commands/auth/signup/__init__.py +0 -0
- cli/commands/auth/signup/command.py +115 -0
- cli/commands/billing/__init__.py +1 -0
- cli/commands/billing/costs/__init__.py +1 -0
- cli/commands/billing/costs/by_agent/__init__.py +1 -0
- cli/commands/billing/costs/by_agent/command.py +57 -0
- cli/commands/billing/costs/by_agent/presenter.py +81 -0
- cli/commands/billing/costs/by_model/__init__.py +1 -0
- cli/commands/billing/costs/by_model/command.py +57 -0
- cli/commands/billing/costs/by_model/presenter.py +80 -0
- cli/commands/billing/costs/daily/__init__.py +1 -0
- cli/commands/billing/costs/daily/command.py +55 -0
- cli/commands/billing/costs/daily/presenter.py +75 -0
- cli/commands/billing/costs/summary/__init__.py +1 -0
- cli/commands/billing/costs/summary/command.py +57 -0
- cli/commands/billing/costs/summary/presenter.py +42 -0
- cli/commands/billing/projects/__init__.py +1 -0
- cli/commands/billing/projects/create/__init__.py +1 -0
- cli/commands/billing/projects/create/command.py +60 -0
- cli/commands/billing/projects/create/presenter.py +26 -0
- cli/commands/billing/projects/get/__init__.py +1 -0
- cli/commands/billing/projects/get/command.py +33 -0
- cli/commands/billing/projects/get/presenter.py +32 -0
- cli/commands/billing/projects/list/__init__.py +1 -0
- cli/commands/billing/projects/list/command.py +40 -0
- cli/commands/billing/projects/list/presenter.py +57 -0
- cli/commands/content/__init__.py +1 -0
- cli/commands/content/delete/__init__.py +0 -0
- cli/commands/content/delete/command.py +49 -0
- cli/commands/content/delete/presenter.py +18 -0
- cli/commands/content/edit/__init__.py +1 -0
- cli/commands/content/edit/command.py +155 -0
- cli/commands/content/edit/editor.py +150 -0
- cli/commands/content/edit/presenter.py +146 -0
- cli/commands/content/get/__init__.py +1 -0
- cli/commands/content/get/command.py +39 -0
- cli/commands/content/get/presenter.py +176 -0
- cli/commands/content/list/__init__.py +1 -0
- cli/commands/content/list/command.py +347 -0
- cli/commands/content/list/export_formatters.py +409 -0
- cli/commands/content/list/export_handler.py +165 -0
- cli/commands/content/list/presenter.py +190 -0
- cli/commands/credentials/__init__.py +0 -0
- cli/commands/credentials/create/__init__.py +0 -0
- cli/commands/credentials/create/command.py +165 -0
- cli/commands/credentials/create/fields.py +38 -0
- cli/commands/credentials/create/presenter.py +20 -0
- cli/commands/credentials/update/__init__.py +0 -0
- cli/commands/credentials/update/command.py +53 -0
- cli/commands/credentials/update/fields.py +71 -0
- cli/commands/credentials/update/presenter.py +16 -0
- cli/commands/flag_utils.py +366 -0
- cli/commands/generate/__init__.py +0 -0
- cli/commands/generate/cancel/__init__.py +1 -0
- cli/commands/generate/cancel/command.py +44 -0
- cli/commands/generate/cancel/presenter.py +26 -0
- cli/commands/generate/status/__init__.py +1 -0
- cli/commands/generate/status/command.py +58 -0
- cli/commands/generate/status/presenter.py +78 -0
- cli/commands/generate/text/__init__.py +0 -0
- cli/commands/generate/text/command.py +1325 -0
- cli/commands/generate/text/concurrent_renderer.py +355 -0
- cli/commands/generate/text/presenter.py +287 -0
- cli/commands/generate/text/stream_renderer.py +129 -0
- cli/commands/knowledge/__init__.py +0 -0
- cli/commands/knowledge/collections/__init__.py +0 -0
- cli/commands/knowledge/collections/cluster/__init__.py +0 -0
- cli/commands/knowledge/collections/cluster/command.py +64 -0
- cli/commands/knowledge/collections/cluster/presenter.py +74 -0
- cli/commands/knowledge/collections/cluster_status/__init__.py +0 -0
- cli/commands/knowledge/collections/cluster_status/command.py +46 -0
- cli/commands/knowledge/collections/cluster_status/presenter.py +10 -0
- cli/commands/knowledge/collections/create/__init__.py +0 -0
- cli/commands/knowledge/collections/create/command.py +137 -0
- cli/commands/knowledge/collections/create/presenter.py +38 -0
- cli/commands/knowledge/collections/delete/__init__.py +1 -0
- cli/commands/knowledge/collections/delete/command.py +47 -0
- cli/commands/knowledge/collections/delete/presenter.py +20 -0
- cli/commands/knowledge/collections/get/__init__.py +1 -0
- cli/commands/knowledge/collections/get/command.py +30 -0
- cli/commands/knowledge/collections/get/presenter.py +44 -0
- cli/commands/knowledge/collections/list/__init__.py +1 -0
- cli/commands/knowledge/collections/list/command.py +41 -0
- cli/commands/knowledge/collections/list/presenter.py +68 -0
- cli/commands/knowledge/collections/update/__init__.py +0 -0
- cli/commands/knowledge/collections/update/command.py +97 -0
- cli/commands/knowledge/collections/update/presenter.py +42 -0
- cli/commands/knowledge/documents/__init__.py +0 -0
- cli/commands/knowledge/documents/bulk_metadata/__init__.py +0 -0
- cli/commands/knowledge/documents/bulk_metadata/command.py +119 -0
- cli/commands/knowledge/documents/bulk_metadata/presenter.py +36 -0
- cli/commands/knowledge/documents/delete/__init__.py +0 -0
- cli/commands/knowledge/documents/delete/command.py +47 -0
- cli/commands/knowledge/documents/delete/presenter.py +20 -0
- cli/commands/knowledge/documents/get/__init__.py +0 -0
- cli/commands/knowledge/documents/get/command.py +39 -0
- cli/commands/knowledge/documents/get/presenter.py +78 -0
- cli/commands/knowledge/documents/ingest/__init__.py +0 -0
- cli/commands/knowledge/documents/ingest/command.py +222 -0
- cli/commands/knowledge/documents/ingest/presenter.py +41 -0
- cli/commands/knowledge/documents/list/__init__.py +0 -0
- cli/commands/knowledge/documents/list/command.py +69 -0
- cli/commands/knowledge/documents/list/presenter.py +86 -0
- cli/commands/knowledge/documents/reingest/__init__.py +0 -0
- cli/commands/knowledge/documents/reingest/command.py +102 -0
- cli/commands/knowledge/documents/reingest/presenter.py +70 -0
- cli/commands/knowledge/documents/update/__init__.py +0 -0
- cli/commands/knowledge/documents/update/command.py +85 -0
- cli/commands/knowledge/documents/update/presenter.py +37 -0
- cli/commands/knowledge/recover/__init__.py +0 -0
- cli/commands/knowledge/recover/command.py +46 -0
- cli/commands/knowledge/recover/presenter.py +79 -0
- cli/commands/knowledge/search/__init__.py +0 -0
- cli/commands/knowledge/search/command.py +218 -0
- cli/commands/knowledge/search/presenter.py +111 -0
- cli/commands/knowledge/synthesis/__init__.py +0 -0
- cli/commands/knowledge/synthesis/create/__init__.py +0 -0
- cli/commands/knowledge/synthesis/create/command.py +127 -0
- cli/commands/knowledge/synthesis/create/presenter.py +33 -0
- cli/commands/knowledge/synthesis/delete/__init__.py +0 -0
- cli/commands/knowledge/synthesis/delete/command.py +53 -0
- cli/commands/knowledge/synthesis/delete/presenter.py +31 -0
- cli/commands/knowledge/synthesis/get/__init__.py +0 -0
- cli/commands/knowledge/synthesis/get/command.py +55 -0
- cli/commands/knowledge/synthesis/get/presenter.py +114 -0
- cli/commands/knowledge/synthesis/list/__init__.py +0 -0
- cli/commands/knowledge/synthesis/list/command.py +132 -0
- cli/commands/knowledge/synthesis/list/presenter.py +84 -0
- cli/commands/knowledge/synthesis/refresh/__init__.py +0 -0
- cli/commands/knowledge/synthesis/refresh/command.py +42 -0
- cli/commands/knowledge/synthesis/refresh/presenter.py +33 -0
- cli/commands/knowledge/synthesis/update/__init__.py +0 -0
- cli/commands/knowledge/synthesis/update/command.py +76 -0
- cli/commands/knowledge/synthesis/update/presenter.py +41 -0
- cli/commands/models/__init__.py +0 -0
- cli/commands/models/list/__init__.py +0 -0
- cli/commands/models/list/command.py +84 -0
- cli/commands/models/list/presenter.py +114 -0
- cli/commands/organizations/__init__.py +0 -0
- cli/commands/organizations/create/command.py +32 -0
- cli/commands/organizations/create/presenter.py +9 -0
- cli/commands/pipelines/__init__.py +1 -0
- cli/commands/pipelines/approvals/__init__.py +1 -0
- cli/commands/pipelines/approvals/decide_command.py +77 -0
- cli/commands/pipelines/approvals/get_command.py +44 -0
- cli/commands/pipelines/approvals/presenter.py +56 -0
- cli/commands/pipelines/costs/__init__.py +1 -0
- cli/commands/pipelines/costs/command.py +57 -0
- cli/commands/pipelines/costs/daily_command.py +54 -0
- cli/commands/pipelines/costs/daily_presenter.py +59 -0
- cli/commands/pipelines/costs/presenter.py +37 -0
- cli/commands/pipelines/create/__init__.py +1 -0
- cli/commands/pipelines/create/command.py +103 -0
- cli/commands/pipelines/create/presenter.py +22 -0
- cli/commands/pipelines/env_vars/__init__.py +1 -0
- cli/commands/pipelines/env_vars/command.py +51 -0
- cli/commands/pipelines/env_vars/presenter.py +16 -0
- cli/commands/pipelines/execute/__init__.py +1 -0
- cli/commands/pipelines/execute/command.py +142 -0
- cli/commands/pipelines/execute/presenter.py +47 -0
- cli/commands/pipelines/executions/__init__.py +1 -0
- cli/commands/pipelines/executions/costs/__init__.py +1 -0
- cli/commands/pipelines/executions/costs/command.py +48 -0
- cli/commands/pipelines/executions/costs/presenter.py +29 -0
- cli/commands/pipelines/executions/costs_by_model/__init__.py +1 -0
- cli/commands/pipelines/executions/costs_by_model/command.py +50 -0
- cli/commands/pipelines/executions/costs_by_model/presenter.py +78 -0
- cli/commands/pipelines/executions/costs_by_step/__init__.py +1 -0
- cli/commands/pipelines/executions/costs_by_step/command.py +50 -0
- cli/commands/pipelines/executions/costs_by_step/presenter.py +72 -0
- cli/commands/pipelines/executions/get_command.py +38 -0
- cli/commands/pipelines/executions/list_command.py +123 -0
- cli/commands/pipelines/executions/presenter.py +131 -0
- cli/commands/pipelines/executions/rerun_command.py +41 -0
- cli/commands/pipelines/executions/update/__init__.py +1 -0
- cli/commands/pipelines/executions/update/command.py +110 -0
- cli/commands/pipelines/executions/update/presenter.py +28 -0
- cli/commands/pipelines/get/__init__.py +1 -0
- cli/commands/pipelines/get/command.py +33 -0
- cli/commands/pipelines/get/presenter.py +48 -0
- cli/commands/pipelines/list/__init__.py +1 -0
- cli/commands/pipelines/list/command.py +53 -0
- cli/commands/pipelines/list/presenter.py +66 -0
- cli/commands/pipelines/schedules/__init__.py +1 -0
- cli/commands/pipelines/schedules/create_command.py +119 -0
- cli/commands/pipelines/schedules/create_presenter.py +35 -0
- cli/commands/pipelines/schedules/delete_command.py +52 -0
- cli/commands/pipelines/schedules/env_vars_command.py +59 -0
- cli/commands/pipelines/schedules/env_vars_presenter.py +16 -0
- cli/commands/pipelines/schedules/get_command.py +38 -0
- cli/commands/pipelines/schedules/list_command.py +33 -0
- cli/commands/pipelines/schedules/once_command.py +90 -0
- cli/commands/pipelines/schedules/once_presenter.py +30 -0
- cli/commands/pipelines/schedules/presenter.py +104 -0
- cli/commands/pipelines/schedules/update_command.py +139 -0
- cli/commands/pipelines/schedules/update_presenter.py +29 -0
- cli/commands/render/__init__.py +0 -0
- cli/commands/render/html_to_image/__init__.py +0 -0
- cli/commands/render/html_to_image/command.py +170 -0
- cli/commands/schemas/__init__.py +0 -0
- cli/commands/schemas/create/__init__.py +0 -0
- cli/commands/schemas/create/command.py +122 -0
- cli/commands/schemas/create/presenter.py +53 -0
- cli/commands/schemas/delete/command.py +45 -0
- cli/commands/schemas/delete/presenter.py +9 -0
- cli/commands/schemas/get/__init__.py +0 -0
- cli/commands/schemas/get/command.py +56 -0
- cli/commands/schemas/get/presenter.py +129 -0
- cli/commands/schemas/list/__init__.py +0 -0
- cli/commands/schemas/list/command.py +64 -0
- cli/commands/schemas/list/presenter.py +133 -0
- cli/commands/schemas/update/__init__.py +0 -0
- cli/commands/schemas/update/command.py +369 -0
- cli/commands/schemas/update/presenter.py +53 -0
- cli/commands/sessions/__init__.py +1 -0
- cli/commands/sessions/delete/__init__.py +1 -0
- cli/commands/sessions/delete/command.py +47 -0
- cli/commands/sessions/delete/presenter.py +10 -0
- cli/commands/sessions/get/__init__.py +1 -0
- cli/commands/sessions/get/command.py +42 -0
- cli/commands/sessions/get/presenter.py +59 -0
- cli/commands/sessions/list/__init__.py +1 -0
- cli/commands/sessions/list/command.py +61 -0
- cli/commands/sessions/list/presenter.py +68 -0
- cli/commands/sessions/messages/__init__.py +1 -0
- cli/commands/sessions/messages/command.py +78 -0
- cli/commands/sessions/messages/presenter.py +79 -0
- cli/commands/shared_flags.py +500 -0
- cli/commands/sync/__init__.py +0 -0
- cli/commands/sync/command.py +45 -0
- cli/commands/sync/presenter.py +49 -0
- cli/commands/tags/__init__.py +1 -0
- cli/commands/tags/create/__init__.py +1 -0
- cli/commands/tags/create/command.py +60 -0
- cli/commands/tags/delete/__init__.py +1 -0
- cli/commands/tags/delete/command.py +47 -0
- cli/commands/tags/delete/presenter.py +10 -0
- cli/commands/tags/get/command.py +31 -0
- cli/commands/tags/get/presenter.py +23 -0
- cli/commands/tags/list/__init__.py +1 -0
- cli/commands/tags/list/command.py +52 -0
- cli/commands/tags/list/presenter.py +49 -0
- cli/commands/tags/update/command.py +64 -0
- cli/commands/tags/update/presenter.py +9 -0
- cli/commands/templates/__init__.py +0 -0
- cli/commands/templates/create/__init__.py +0 -0
- cli/commands/templates/create/command.py +152 -0
- cli/commands/templates/create/presenter.py +86 -0
- cli/commands/templates/delete/__init__.py +0 -0
- cli/commands/templates/delete/command.py +47 -0
- cli/commands/templates/delete/presenter.py +16 -0
- cli/commands/templates/get/__init__.py +0 -0
- cli/commands/templates/get/command.py +52 -0
- cli/commands/templates/get/presenter.py +233 -0
- cli/commands/templates/get_by_version/command.py +32 -0
- cli/commands/templates/get_by_version/presenter.py +30 -0
- cli/commands/templates/list/__init__.py +1 -0
- cli/commands/templates/list/command.py +102 -0
- cli/commands/templates/list/presenter.py +93 -0
- cli/commands/templates/render/__init__.py +0 -0
- cli/commands/templates/render/command.py +115 -0
- cli/commands/templates/render/presenter.py +276 -0
- cli/commands/templates/update/__init__.py +0 -0
- cli/commands/templates/update/command.py +199 -0
- cli/commands/templates/update/presenter.py +94 -0
- cli/commands/templates/version/__init__.py +1 -0
- cli/commands/templates/version/command.py +116 -0
- cli/commands/templates/version/presenter.py +100 -0
- cli/commands/tool_configs/__init__.py +0 -0
- cli/commands/tool_configs/create/__init__.py +0 -0
- cli/commands/tool_configs/create/command.py +118 -0
- cli/commands/tool_configs/create/presenter.py +53 -0
- cli/commands/tool_configs/delete/__init__.py +0 -0
- cli/commands/tool_configs/delete/command.py +47 -0
- cli/commands/tool_configs/delete/presenter.py +18 -0
- cli/commands/tool_configs/get/__init__.py +0 -0
- cli/commands/tool_configs/get/command.py +31 -0
- cli/commands/tool_configs/get/presenter.py +62 -0
- cli/commands/tool_configs/list/__init__.py +0 -0
- cli/commands/tool_configs/list/command.py +59 -0
- cli/commands/tool_configs/list/presenter.py +60 -0
- cli/commands/tool_configs/update/__init__.py +0 -0
- cli/commands/tool_configs/update/command.py +128 -0
- cli/commands/tool_configs/update/presenter.py +53 -0
- cli/commands/tools/__init__.py +1 -0
- cli/commands/tools/get/__init__.py +1 -0
- cli/commands/tools/get/command.py +42 -0
- cli/commands/tools/get/presenter.py +45 -0
- cli/commands/tools/list/__init__.py +1 -0
- cli/commands/tools/list/command.py +56 -0
- cli/commands/tools/list/presenter.py +44 -0
- cli/commands/users/__init__.py +0 -0
- cli/commands/users/create/command.py +53 -0
- cli/commands/users/create/presenter.py +9 -0
- cli/commands/whoami/__init__.py +0 -0
- cli/commands/whoami/command.py +42 -0
- cli/infrastructure/__init__.py +0 -0
- cli/infrastructure/auth_storage.py +71 -0
- cli/infrastructure/client_factory.py +36 -0
- cli/infrastructure/command.py +75 -0
- cli/infrastructure/config.py +188 -0
- cli/infrastructure/console.py +27 -0
- cli/infrastructure/editor.py +138 -0
- cli/infrastructure/error_display.py +178 -0
- cli/infrastructure/field_extractor.py +360 -0
- cli/infrastructure/file_content.py +210 -0
- cli/infrastructure/filter_parser.py +256 -0
- cli/infrastructure/formatters/__init__.py +0 -0
- cli/infrastructure/formatters/base.py +99 -0
- cli/infrastructure/formatters/compact_formatter.py +245 -0
- cli/infrastructure/formatters/json_formatter.py +84 -0
- cli/infrastructure/formatters/lines_formatter.py +102 -0
- cli/infrastructure/formatting/__init__.py +0 -0
- cli/infrastructure/formatting/fields.py +193 -0
- cli/infrastructure/forms/__init__.py +0 -0
- cli/infrastructure/forms/agent_picker.py +123 -0
- cli/infrastructure/forms/agent_tool_editor.py +384 -0
- cli/infrastructure/forms/agent_tools_manager.py +212 -0
- cli/infrastructure/forms/base_picker.py +469 -0
- cli/infrastructure/forms/components.py +126 -0
- cli/infrastructure/forms/json_schema_builder.py +149 -0
- cli/infrastructure/forms/model_picker.py +134 -0
- cli/infrastructure/forms/parsers.py +173 -0
- cli/infrastructure/forms/resolution_modal.py +302 -0
- cli/infrastructure/forms/schema_picker.py +137 -0
- cli/infrastructure/forms/tag_management_modal.py +103 -0
- cli/infrastructure/forms/tag_picker.py +207 -0
- cli/infrastructure/forms/template_picker.py +131 -0
- cli/infrastructure/forms/tool_config_picker.py +130 -0
- cli/infrastructure/forms/tool_picker.py +103 -0
- cli/infrastructure/injection/__init__.py +0 -0
- cli/infrastructure/injection/parser.py +302 -0
- cli/infrastructure/injection/resolver.py +399 -0
- cli/infrastructure/kv_parser.py +130 -0
- cli/infrastructure/local_storage.py +227 -0
- cli/infrastructure/macro_parser.py +215 -0
- cli/infrastructure/output.py +192 -0
- cli/infrastructure/provider_setup.py +81 -0
- cli/infrastructure/renderers/__init__.py +0 -0
- cli/infrastructure/renderers/entity_renderer.py +77 -0
- cli/infrastructure/renderers/list_renderer.py +114 -0
- cli/infrastructure/scope_utils.py +47 -0
- cli/infrastructure/spinner.py +101 -0
- cli/infrastructure/tui/__init__.py +0 -0
- cli/infrastructure/tui/clipboard.py +41 -0
- cli/infrastructure/tui/formatters.py +105 -0
- cli/infrastructure/tui/preview.py +14 -0
- cli/infrastructure/tui/selectable.py +198 -0
- cli/infrastructure/validation/__init__.py +0 -0
- cli/infrastructure/validation/tag_validation.py +74 -0
- cli/main.py +759 -0
- cli/tui/__init__.py +0 -0
- cli/tui/app.py +199 -0
- cli/tui/app_store.py +73 -0
- cli/tui/chat/__init__.py +0 -0
- cli/tui/chat/commands/__init__.py +0 -0
- cli/tui/chat/commands/base.py +65 -0
- cli/tui/chat/commands/create_session.py +135 -0
- cli/tui/chat/commands/load_session.py +119 -0
- cli/tui/chat/commands/regenerate.py +120 -0
- cli/tui/chat/commands/reload_session.py +63 -0
- cli/tui/chat/commands/send_message.py +190 -0
- cli/tui/chat/commands/undo.py +66 -0
- cli/tui/chat/editor.py +71 -0
- cli/tui/chat/messages.py +223 -0
- cli/tui/chat/pane.py +141 -0
- cli/tui/chat/renderers/__init__.py +0 -0
- cli/tui/chat/renderers/base.py +72 -0
- cli/tui/chat/renderers/markdown.py +250 -0
- cli/tui/chat/renderers/plain.py +83 -0
- cli/tui/chat/screen.py +1155 -0
- cli/tui/chat/services/__init__.py +0 -0
- cli/tui/chat/services/injection.py +386 -0
- cli/tui/chat/services/name_generator.py +256 -0
- cli/tui/chat/slash_commands.py +424 -0
- cli/tui/chat/store.py +280 -0
- cli/tui/chat/types.py +220 -0
- cli/tui/chat/widgets/__init__.py +0 -0
- cli/tui/chat/widgets/chat_header.py +75 -0
- cli/tui/chat/widgets/chat_input.py +362 -0
- cli/tui/chat/widgets/injection_popup.py +161 -0
- cli/tui/chat/widgets/message_display.py +287 -0
- cli/tui/chat/widgets/session_sidebar.py +214 -0
- cli/tui/chat/widgets/welcome_screen.py +290 -0
- cli/tui/screens/__init__.py +0 -0
- cli/tui/screens/agents.py +344 -0
- cli/tui/screens/base.py +301 -0
- cli/tui/screens/content.py +508 -0
- cli/tui/screens/dashboard.py +89 -0
- cli/tui/screens/models.py +96 -0
- cli/tui/screens/nav_screen.py +186 -0
- cli/tui/screens/schemas.py +522 -0
- cli/tui/screens/templates.py +734 -0
- cli/tui/screens/tool_configs.py +335 -0
- cli/tui/styles/__init__.py +0 -0
- cli/tui/widgets/__init__.py +0 -0
- cli/tui/widgets/agent_create_modal.py +139 -0
- cli/tui/widgets/agent_form_modal.py +659 -0
- cli/tui/widgets/agent_update_modal.py +299 -0
- cli/tui/widgets/base_form_modal.py +77 -0
- cli/tui/widgets/confirm_modal.py +75 -0
- cli/tui/widgets/help_modal.py +145 -0
- cli/tui/widgets/new_session_modal.py +328 -0
- cli/tui/widgets/schema_create_modal.py +271 -0
- cli/tui/widgets/schema_update_modal.py +188 -0
- cli/tui/widgets/status_footer.py +147 -0
- cli/tui/widgets/template_create_modal.py +502 -0
- cli/tui/widgets/template_update_modal.py +308 -0
- cli/tui/widgets/tool_config_create_modal.py +216 -0
- cli/tui/widgets/tool_config_update_modal.py +208 -0
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
"""Pipeline schedule update command implementation."""
|
|
2
|
+
|
|
3
|
+
import json
|
|
4
|
+
from typing import Annotated
|
|
5
|
+
from uuid import UUID
|
|
6
|
+
|
|
7
|
+
import typer
|
|
8
|
+
|
|
9
|
+
from alloy_runtime_types.dtos.schedule import UpdateScheduleRequest
|
|
10
|
+
from cli.commands.flag_utils import validate_uuid
|
|
11
|
+
from cli.commands.pipelines.schedules.update_presenter import present_update_result
|
|
12
|
+
from cli.infrastructure.command import async_command, authenticated_client
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
def pipelines_schedules_update_command(
|
|
16
|
+
pipeline_id: str = typer.Argument(
|
|
17
|
+
...,
|
|
18
|
+
help="Pipeline UUID",
|
|
19
|
+
),
|
|
20
|
+
schedule_id: str = typer.Argument(
|
|
21
|
+
...,
|
|
22
|
+
help="Schedule UUID",
|
|
23
|
+
),
|
|
24
|
+
name: Annotated[
|
|
25
|
+
str | None,
|
|
26
|
+
typer.Option(
|
|
27
|
+
"-n",
|
|
28
|
+
"--name",
|
|
29
|
+
help="New schedule name",
|
|
30
|
+
),
|
|
31
|
+
] = None,
|
|
32
|
+
description: Annotated[
|
|
33
|
+
str | None,
|
|
34
|
+
typer.Option(
|
|
35
|
+
"-d",
|
|
36
|
+
"--description",
|
|
37
|
+
help="New schedule description",
|
|
38
|
+
),
|
|
39
|
+
] = None,
|
|
40
|
+
input_params: Annotated[
|
|
41
|
+
str | None,
|
|
42
|
+
typer.Option(
|
|
43
|
+
"--input-params",
|
|
44
|
+
"-i",
|
|
45
|
+
help="Input parameters as JSON string",
|
|
46
|
+
),
|
|
47
|
+
] = None,
|
|
48
|
+
timeout: Annotated[
|
|
49
|
+
int | None,
|
|
50
|
+
typer.Option(
|
|
51
|
+
"--timeout",
|
|
52
|
+
"-t",
|
|
53
|
+
help="Execution timeout in seconds (1-3600)",
|
|
54
|
+
min=1,
|
|
55
|
+
max=3600,
|
|
56
|
+
),
|
|
57
|
+
] = None,
|
|
58
|
+
enable: Annotated[
|
|
59
|
+
bool | None,
|
|
60
|
+
typer.Option(
|
|
61
|
+
"--enable/--disable",
|
|
62
|
+
help="Enable or disable the schedule",
|
|
63
|
+
),
|
|
64
|
+
] = None,
|
|
65
|
+
allow_concurrent: Annotated[
|
|
66
|
+
bool | None,
|
|
67
|
+
typer.Option(
|
|
68
|
+
"--allow-concurrent/--no-concurrent",
|
|
69
|
+
help="Allow or disallow concurrent executions",
|
|
70
|
+
),
|
|
71
|
+
] = None,
|
|
72
|
+
max_failures: Annotated[
|
|
73
|
+
int | None,
|
|
74
|
+
typer.Option(
|
|
75
|
+
"--max-failures",
|
|
76
|
+
help="Auto-disable after this many consecutive failures (0 = never)",
|
|
77
|
+
min=0,
|
|
78
|
+
),
|
|
79
|
+
] = None,
|
|
80
|
+
) -> None:
|
|
81
|
+
"""Update a pipeline schedule.
|
|
82
|
+
|
|
83
|
+
Examples:
|
|
84
|
+
ai pipelines schedules update 123e4567... 456e7890... -n 'New Name'
|
|
85
|
+
ai pipelines schedules update 123e4567... 456e7890... --disable
|
|
86
|
+
ai pipelines schedules update 123e4567... 456e7890... --timeout 600
|
|
87
|
+
"""
|
|
88
|
+
p_uuid = validate_uuid(pipeline_id, "pipeline")
|
|
89
|
+
s_uuid = validate_uuid(schedule_id, "schedule")
|
|
90
|
+
|
|
91
|
+
params = None
|
|
92
|
+
if input_params:
|
|
93
|
+
try:
|
|
94
|
+
params = json.loads(input_params)
|
|
95
|
+
except json.JSONDecodeError as e:
|
|
96
|
+
raise typer.BadParameter(f"Invalid JSON for --input-params: {e}")
|
|
97
|
+
|
|
98
|
+
# Check at least one update flag was provided
|
|
99
|
+
if all(
|
|
100
|
+
v is None
|
|
101
|
+
for v in [
|
|
102
|
+
name,
|
|
103
|
+
description,
|
|
104
|
+
input_params,
|
|
105
|
+
timeout,
|
|
106
|
+
enable,
|
|
107
|
+
allow_concurrent,
|
|
108
|
+
max_failures,
|
|
109
|
+
]
|
|
110
|
+
):
|
|
111
|
+
raise typer.BadParameter(
|
|
112
|
+
"At least one update flag required: --name, --description, --input-params, "
|
|
113
|
+
"--timeout, --enable/--disable, --allow-concurrent/--no-concurrent, --max-failures"
|
|
114
|
+
)
|
|
115
|
+
|
|
116
|
+
request = UpdateScheduleRequest(
|
|
117
|
+
name=name,
|
|
118
|
+
description=description,
|
|
119
|
+
input_parameters=params,
|
|
120
|
+
timeout_seconds=timeout,
|
|
121
|
+
is_enabled=enable,
|
|
122
|
+
allow_concurrent=allow_concurrent,
|
|
123
|
+
max_consecutive_failures=max_failures,
|
|
124
|
+
)
|
|
125
|
+
|
|
126
|
+
_execute_update(pipeline_id=p_uuid, schedule_id=s_uuid, request=request)
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
@async_command
|
|
130
|
+
async def _execute_update(
|
|
131
|
+
pipeline_id: UUID, schedule_id: UUID, request: UpdateScheduleRequest
|
|
132
|
+
) -> None:
|
|
133
|
+
"""Execute update schedule operation."""
|
|
134
|
+
async with authenticated_client() as (_config, client):
|
|
135
|
+
response = await client.update_pipeline_schedule(
|
|
136
|
+
pipeline_id, schedule_id, request
|
|
137
|
+
)
|
|
138
|
+
|
|
139
|
+
present_update_result(response)
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"""Presenter for pipeline schedule update command output."""
|
|
2
|
+
|
|
3
|
+
from alloy_runtime_types.dtos.schedule import UpdateScheduleResponse
|
|
4
|
+
|
|
5
|
+
from cli.infrastructure.output import OutputService
|
|
6
|
+
from cli.infrastructure.renderers.entity_renderer import FieldConfig
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
def present_update_result(response: UpdateScheduleResponse) -> None:
|
|
10
|
+
"""Present updated schedule details."""
|
|
11
|
+
output = OutputService.get()
|
|
12
|
+
|
|
13
|
+
fields = [
|
|
14
|
+
FieldConfig("id", "Schedule ID", str),
|
|
15
|
+
FieldConfig("name", "Name"),
|
|
16
|
+
FieldConfig("is_enabled", "Enabled", lambda v: "Yes" if v else "No"),
|
|
17
|
+
FieldConfig(
|
|
18
|
+
"next_run_at",
|
|
19
|
+
"Next Run",
|
|
20
|
+
lambda v: v.strftime("%Y-%m-%d %H:%M:%S %Z") if v else "N/A",
|
|
21
|
+
),
|
|
22
|
+
FieldConfig(
|
|
23
|
+
"updated_at",
|
|
24
|
+
"Updated",
|
|
25
|
+
lambda v: v.strftime("%Y-%m-%d %H:%M:%S %Z") if v else "N/A",
|
|
26
|
+
),
|
|
27
|
+
]
|
|
28
|
+
|
|
29
|
+
output.entity(response, f"Updated schedule: {response.name}", fields)
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
"""Render HTML to image command implementation."""
|
|
2
|
+
|
|
3
|
+
import base64
|
|
4
|
+
from pathlib import Path
|
|
5
|
+
|
|
6
|
+
import typer
|
|
7
|
+
|
|
8
|
+
from cli.infrastructure.command import async_command, authenticated_client
|
|
9
|
+
from cli.infrastructure.console import get_console
|
|
10
|
+
from cli.infrastructure.file_content import FileContentError, resolve_content
|
|
11
|
+
from alloy_runtime_types.dtos.render import RenderHtmlToImageRequest
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
def render_html_to_image_command(
|
|
15
|
+
html: str = typer.Option(
|
|
16
|
+
...,
|
|
17
|
+
"-h",
|
|
18
|
+
"--html",
|
|
19
|
+
help="HTML text to render (or @file to read from file)",
|
|
20
|
+
),
|
|
21
|
+
output_file: str = typer.Option(
|
|
22
|
+
...,
|
|
23
|
+
"-o",
|
|
24
|
+
"--output",
|
|
25
|
+
help="Output file path for the PNG image",
|
|
26
|
+
),
|
|
27
|
+
bg_color: str = typer.Option(
|
|
28
|
+
"#ffffff",
|
|
29
|
+
"--bg",
|
|
30
|
+
"--background",
|
|
31
|
+
help="Background color in hex format (default: white)",
|
|
32
|
+
),
|
|
33
|
+
text_color: str = typer.Option(
|
|
34
|
+
"#000000",
|
|
35
|
+
"--fg",
|
|
36
|
+
"--foreground",
|
|
37
|
+
help="Text color in hex format (default: black)",
|
|
38
|
+
),
|
|
39
|
+
font_family: str = typer.Option(
|
|
40
|
+
"Georgia, serif",
|
|
41
|
+
"--font",
|
|
42
|
+
help="CSS font-family value (used as fallback when --font-url is provided)",
|
|
43
|
+
),
|
|
44
|
+
font_url: str | None = typer.Option(
|
|
45
|
+
None,
|
|
46
|
+
"--font-url",
|
|
47
|
+
help="Google Fonts URL (font name is auto-extracted from URL)",
|
|
48
|
+
),
|
|
49
|
+
width: int = typer.Option(
|
|
50
|
+
1080,
|
|
51
|
+
"-W",
|
|
52
|
+
"--width",
|
|
53
|
+
min=100,
|
|
54
|
+
max=4096,
|
|
55
|
+
help="Image width in pixels (default: 1080 for social media)",
|
|
56
|
+
),
|
|
57
|
+
height: int = typer.Option(
|
|
58
|
+
1080,
|
|
59
|
+
"-H",
|
|
60
|
+
"--height",
|
|
61
|
+
min=100,
|
|
62
|
+
max=4096,
|
|
63
|
+
help="Image height in pixels (default: 1080 for social media)",
|
|
64
|
+
),
|
|
65
|
+
) -> None:
|
|
66
|
+
"""Render HTML text to a PNG image.
|
|
67
|
+
|
|
68
|
+
Creates a square 1080x1080 image by default, perfect for social media ads
|
|
69
|
+
(Instagram, Facebook). Uses white background with black text.
|
|
70
|
+
|
|
71
|
+
Examples:
|
|
72
|
+
|
|
73
|
+
# Basic usage with inline HTML
|
|
74
|
+
ai render image -h "<strong>Hello</strong> World!" -o output.png
|
|
75
|
+
|
|
76
|
+
# Read HTML from file
|
|
77
|
+
ai render image -h @content.html -o output.png
|
|
78
|
+
|
|
79
|
+
# Custom colors (dark mode)
|
|
80
|
+
ai render image -h "Dark mode" -o dark.png --bg "#1a1a1a" --fg "#ffffff"
|
|
81
|
+
|
|
82
|
+
# Custom dimensions (Instagram story: 1080x1920)
|
|
83
|
+
ai render image -h "Story" -o story.png -W 1080 -H 1920
|
|
84
|
+
|
|
85
|
+
# Custom font
|
|
86
|
+
ai render image -h "Custom" -o custom.png --font "Arial, sans-serif"
|
|
87
|
+
|
|
88
|
+
# Google Font (font name auto-extracted from URL)
|
|
89
|
+
ai render image -h "Elegant" -o elegant.png \\
|
|
90
|
+
--font-url "https://fonts.googleapis.com/css2?family=Playfair+Display:wght@700"
|
|
91
|
+
"""
|
|
92
|
+
# Resolve @file references for HTML content
|
|
93
|
+
try:
|
|
94
|
+
resolved_html = resolve_content(html)
|
|
95
|
+
except FileContentError as e:
|
|
96
|
+
raise typer.BadParameter(str(e))
|
|
97
|
+
|
|
98
|
+
if not resolved_html:
|
|
99
|
+
raise typer.BadParameter("HTML content cannot be empty")
|
|
100
|
+
|
|
101
|
+
# Validate hex color format
|
|
102
|
+
import re
|
|
103
|
+
|
|
104
|
+
hex_pattern = r"^#[0-9a-fA-F]{6}$"
|
|
105
|
+
if not re.match(hex_pattern, bg_color):
|
|
106
|
+
raise typer.BadParameter(
|
|
107
|
+
f"Invalid background color '{bg_color}'. Use hex format like #ffffff"
|
|
108
|
+
)
|
|
109
|
+
if not re.match(hex_pattern, text_color):
|
|
110
|
+
raise typer.BadParameter(
|
|
111
|
+
f"Invalid text color '{text_color}'. Use hex format like #000000"
|
|
112
|
+
)
|
|
113
|
+
|
|
114
|
+
_execute_render(
|
|
115
|
+
html=resolved_html,
|
|
116
|
+
output_file=output_file,
|
|
117
|
+
bg_color=bg_color,
|
|
118
|
+
text_color=text_color,
|
|
119
|
+
font_family=font_family,
|
|
120
|
+
font_url=font_url,
|
|
121
|
+
width=width,
|
|
122
|
+
height=height,
|
|
123
|
+
)
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
@async_command
|
|
127
|
+
async def _execute_render(
|
|
128
|
+
html: str,
|
|
129
|
+
output_file: str,
|
|
130
|
+
bg_color: str,
|
|
131
|
+
text_color: str,
|
|
132
|
+
font_family: str,
|
|
133
|
+
font_url: str | None,
|
|
134
|
+
width: int,
|
|
135
|
+
height: int,
|
|
136
|
+
) -> None:
|
|
137
|
+
"""Execute the render HTML to image API call."""
|
|
138
|
+
console = get_console()
|
|
139
|
+
|
|
140
|
+
async with authenticated_client() as (_config, client):
|
|
141
|
+
request = RenderHtmlToImageRequest(
|
|
142
|
+
html_text=html,
|
|
143
|
+
bg_color=bg_color,
|
|
144
|
+
text_color=text_color,
|
|
145
|
+
font_family=font_family,
|
|
146
|
+
font_url=font_url,
|
|
147
|
+
width=width,
|
|
148
|
+
height=height,
|
|
149
|
+
)
|
|
150
|
+
|
|
151
|
+
console.print(f"[dim]Rendering {width}x{height} image...[/dim]")
|
|
152
|
+
response = await client.render_html_to_image(request)
|
|
153
|
+
|
|
154
|
+
# Decode base64 and write to file
|
|
155
|
+
image_bytes = base64.b64decode(response.image_base64)
|
|
156
|
+
output_path = Path(output_file)
|
|
157
|
+
|
|
158
|
+
# Create parent directories if needed
|
|
159
|
+
output_path.parent.mkdir(parents=True, exist_ok=True)
|
|
160
|
+
|
|
161
|
+
# Write the image
|
|
162
|
+
output_path.write_bytes(image_bytes)
|
|
163
|
+
|
|
164
|
+
# Report success
|
|
165
|
+
file_size_kb = len(image_bytes) / 1024
|
|
166
|
+
console.print(
|
|
167
|
+
f"[green]Image saved:[/green] {output_file} "
|
|
168
|
+
f"({response.width}x{response.height}, {file_size_kb:.1f} KB, "
|
|
169
|
+
f"{response.render_time_ms}ms)"
|
|
170
|
+
)
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
"""Schema create command implementation."""
|
|
2
|
+
|
|
3
|
+
from pathlib import Path
|
|
4
|
+
from typing import Optional
|
|
5
|
+
|
|
6
|
+
import typer
|
|
7
|
+
|
|
8
|
+
from cli.commands.flag_utils import (
|
|
9
|
+
require_one_of,
|
|
10
|
+
validate_schema_format,
|
|
11
|
+
validate_scope,
|
|
12
|
+
)
|
|
13
|
+
from cli.commands.schemas.create.presenter import present_schema_create_success
|
|
14
|
+
from cli.infrastructure.command import async_command, authenticated_client
|
|
15
|
+
from cli.infrastructure.file_content import FileContentError, resolve_content
|
|
16
|
+
from alloy_runtime_types.dtos.schemas import CreateSchemaRequest
|
|
17
|
+
from alloy_runtime_types.enums.ownership_scope import OwnershipScope
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
def schemas_create_command(
|
|
21
|
+
name: str = typer.Option(
|
|
22
|
+
...,
|
|
23
|
+
"-n",
|
|
24
|
+
"--name",
|
|
25
|
+
help="Schema name",
|
|
26
|
+
),
|
|
27
|
+
schema_format: str = typer.Option(
|
|
28
|
+
...,
|
|
29
|
+
"--schema-format",
|
|
30
|
+
help="Format: json_schema or regex",
|
|
31
|
+
),
|
|
32
|
+
definition: Optional[str] = typer.Option(
|
|
33
|
+
None,
|
|
34
|
+
"-D",
|
|
35
|
+
"--definition",
|
|
36
|
+
help="Schema definition (or @file)",
|
|
37
|
+
),
|
|
38
|
+
definition_file: Optional[Path] = typer.Option(
|
|
39
|
+
None,
|
|
40
|
+
"-f",
|
|
41
|
+
"--file",
|
|
42
|
+
help="Read definition from file",
|
|
43
|
+
exists=True,
|
|
44
|
+
readable=True,
|
|
45
|
+
),
|
|
46
|
+
description: Optional[str] = typer.Option(
|
|
47
|
+
None,
|
|
48
|
+
"-d",
|
|
49
|
+
"--description",
|
|
50
|
+
help="Schema description",
|
|
51
|
+
),
|
|
52
|
+
scope: Optional[str] = typer.Option(
|
|
53
|
+
None,
|
|
54
|
+
"--scope",
|
|
55
|
+
help="Scope: user, organization, global",
|
|
56
|
+
),
|
|
57
|
+
) -> None:
|
|
58
|
+
"""Create a new schema.
|
|
59
|
+
|
|
60
|
+
Examples:
|
|
61
|
+
ai schemas create -n user-profile --schema-format json_schema -D '{"type": "object"}'
|
|
62
|
+
ai schemas create -n api-response --schema-format json_schema -f schema.json
|
|
63
|
+
ai schemas create -n email-pattern --schema-format regex -D '^[a-z]+@.*$'
|
|
64
|
+
"""
|
|
65
|
+
require_one_of(("--definition", definition), ("--file", definition_file))
|
|
66
|
+
|
|
67
|
+
_execute_create_from_flags(
|
|
68
|
+
name=name,
|
|
69
|
+
schema_format=schema_format,
|
|
70
|
+
definition=definition,
|
|
71
|
+
definition_file=definition_file,
|
|
72
|
+
description=description,
|
|
73
|
+
scope=scope,
|
|
74
|
+
)
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
@async_command
|
|
78
|
+
async def _execute_create(request: CreateSchemaRequest) -> None:
|
|
79
|
+
"""Execute the schema creation."""
|
|
80
|
+
async with authenticated_client() as (_config, client):
|
|
81
|
+
response = await client.create_schema(request)
|
|
82
|
+
|
|
83
|
+
present_schema_create_success(response)
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
def _execute_create_from_flags(
|
|
87
|
+
name: str,
|
|
88
|
+
schema_format: str,
|
|
89
|
+
definition: Optional[str],
|
|
90
|
+
definition_file: Optional[Path],
|
|
91
|
+
description: Optional[str],
|
|
92
|
+
scope: Optional[str],
|
|
93
|
+
) -> None:
|
|
94
|
+
"""Build and execute schema creation."""
|
|
95
|
+
try:
|
|
96
|
+
definition = resolve_content(definition)
|
|
97
|
+
except FileContentError as e:
|
|
98
|
+
raise typer.BadParameter(str(e))
|
|
99
|
+
|
|
100
|
+
format_enum = validate_schema_format(schema_format)
|
|
101
|
+
|
|
102
|
+
if definition_file:
|
|
103
|
+
schema_definition = definition_file.read_text()
|
|
104
|
+
else:
|
|
105
|
+
schema_definition = definition or ""
|
|
106
|
+
|
|
107
|
+
if not schema_definition.strip():
|
|
108
|
+
raise typer.BadParameter("Schema definition cannot be empty")
|
|
109
|
+
|
|
110
|
+
ownership_scope = OwnershipScope.USER
|
|
111
|
+
if scope:
|
|
112
|
+
ownership_scope = validate_scope(scope)
|
|
113
|
+
|
|
114
|
+
request = CreateSchemaRequest(
|
|
115
|
+
name=name,
|
|
116
|
+
schema_format=format_enum,
|
|
117
|
+
schema_definition=schema_definition,
|
|
118
|
+
description=description,
|
|
119
|
+
scope=ownership_scope,
|
|
120
|
+
)
|
|
121
|
+
|
|
122
|
+
_execute_create(request)
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"""Presenter for schema creation output."""
|
|
2
|
+
|
|
3
|
+
from cli.infrastructure.formatting.fields import (
|
|
4
|
+
format_datetime,
|
|
5
|
+
format_optional,
|
|
6
|
+
format_uuid,
|
|
7
|
+
)
|
|
8
|
+
from cli.infrastructure.output import OutputService
|
|
9
|
+
from cli.infrastructure.renderers.entity_renderer import FieldConfig
|
|
10
|
+
from alloy_runtime_types.dtos.schemas import CreateSchemaResponse
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
def _derive_scope(response: CreateSchemaResponse) -> str:
|
|
14
|
+
"""Derive scope string from organization_id and user_id fields."""
|
|
15
|
+
if response.organization_id is not None and response.user_id is None:
|
|
16
|
+
return "organization"
|
|
17
|
+
elif response.user_id is not None:
|
|
18
|
+
return "user"
|
|
19
|
+
else:
|
|
20
|
+
return "global"
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
def present_schema_create_success(response: CreateSchemaResponse) -> None:
|
|
24
|
+
"""Present successful schema creation.
|
|
25
|
+
|
|
26
|
+
Args:
|
|
27
|
+
response: Schema creation response from server
|
|
28
|
+
"""
|
|
29
|
+
output = OutputService.get()
|
|
30
|
+
output.success("Schema created successfully")
|
|
31
|
+
|
|
32
|
+
fields = [
|
|
33
|
+
FieldConfig("id", "ID", lambda v: format_uuid(v, short=False)),
|
|
34
|
+
FieldConfig("schema_name", "Name"),
|
|
35
|
+
FieldConfig("schema_format_id", "Format"),
|
|
36
|
+
FieldConfig("version", "Version", str),
|
|
37
|
+
FieldConfig("description", "Description", format_optional),
|
|
38
|
+
FieldConfig("scope", "Scope", lambda _: _derive_scope(response)),
|
|
39
|
+
FieldConfig(
|
|
40
|
+
"organization_id",
|
|
41
|
+
"Organization ID",
|
|
42
|
+
lambda v: format_optional(v, lambda x: format_uuid(x, short=True)),
|
|
43
|
+
),
|
|
44
|
+
FieldConfig(
|
|
45
|
+
"user_id",
|
|
46
|
+
"User ID",
|
|
47
|
+
lambda v: format_optional(v, lambda x: format_uuid(x, short=True)),
|
|
48
|
+
),
|
|
49
|
+
FieldConfig("is_latest", "Is Latest", str),
|
|
50
|
+
FieldConfig("created_at", "Created At", format_datetime),
|
|
51
|
+
]
|
|
52
|
+
|
|
53
|
+
output.entity(response, f"Schema: {response.schema_name}", fields)
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"""Schemas delete command implementation."""
|
|
2
|
+
|
|
3
|
+
import typer
|
|
4
|
+
|
|
5
|
+
from cli.commands.schemas.delete.presenter import present_delete_result
|
|
6
|
+
from cli.infrastructure.command import async_command, authenticated_client
|
|
7
|
+
from cli.infrastructure.console import Confirm
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
def schemas_delete_command(
|
|
11
|
+
schema: str = typer.Argument(
|
|
12
|
+
...,
|
|
13
|
+
help="Schema name or UUID",
|
|
14
|
+
),
|
|
15
|
+
yes: bool = typer.Option(
|
|
16
|
+
False,
|
|
17
|
+
"-y",
|
|
18
|
+
"--yes",
|
|
19
|
+
help="Skip confirmation",
|
|
20
|
+
),
|
|
21
|
+
) -> None:
|
|
22
|
+
"""Delete a schema.
|
|
23
|
+
|
|
24
|
+
Permanently removes the schema and all its versions.
|
|
25
|
+
Cannot delete schemas referenced by agents or pipelines.
|
|
26
|
+
|
|
27
|
+
Examples:
|
|
28
|
+
ai schemas delete my-schema
|
|
29
|
+
ai schemas delete my-schema -y
|
|
30
|
+
ai schemas delete 123e4567-89ab-cdef-0123-456789abcdef
|
|
31
|
+
"""
|
|
32
|
+
if not yes:
|
|
33
|
+
confirmed = Confirm.ask(f"[yellow]Delete schema {schema}?[/yellow]")
|
|
34
|
+
if not confirmed:
|
|
35
|
+
raise typer.Abort()
|
|
36
|
+
|
|
37
|
+
_execute_delete(schema_identifier=schema)
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
@async_command
|
|
41
|
+
async def _execute_delete(schema_identifier: str) -> None:
|
|
42
|
+
async with authenticated_client() as (_config, client):
|
|
43
|
+
response = await client.delete_schema(schema_identifier)
|
|
44
|
+
|
|
45
|
+
present_delete_result(response)
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"""Presenter for schemas delete command output."""
|
|
2
|
+
|
|
3
|
+
from cli.infrastructure.output import OutputService
|
|
4
|
+
from alloy_runtime_types.dtos.schemas import DeleteSchemaResponse
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
def present_delete_result(response: DeleteSchemaResponse) -> None:
|
|
8
|
+
output = OutputService.get()
|
|
9
|
+
output.success(f"Deleted schema: {response.deleted_schema.schema_name}")
|
|
File without changes
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"""Schemas get command implementation."""
|
|
2
|
+
|
|
3
|
+
import typer
|
|
4
|
+
|
|
5
|
+
from cli.commands.schemas.get.presenter import present_schema_details
|
|
6
|
+
from cli.infrastructure.command import async_command, authenticated_client
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
def schemas_get_command(
|
|
10
|
+
schema: str = typer.Argument(
|
|
11
|
+
...,
|
|
12
|
+
help="Schema name or UUID",
|
|
13
|
+
),
|
|
14
|
+
) -> None:
|
|
15
|
+
"""Get details of a single schema.
|
|
16
|
+
|
|
17
|
+
Retrieves the full schema metadata and definition.
|
|
18
|
+
The schema can be specified by name (recommended) or UUID.
|
|
19
|
+
|
|
20
|
+
When looking up by name, returns the latest version of the schema.
|
|
21
|
+
|
|
22
|
+
Output is piping-friendly:
|
|
23
|
+
- Metadata goes to stderr (visible in terminal but not piped)
|
|
24
|
+
- Schema definition goes to stdout (for piping to other commands)
|
|
25
|
+
|
|
26
|
+
Examples:
|
|
27
|
+
# Get by name
|
|
28
|
+
ai schemas get my-schema
|
|
29
|
+
ai schemas get user-profile-schema
|
|
30
|
+
|
|
31
|
+
# Get by UUID
|
|
32
|
+
ai schemas get 019405e0-8000-7000-a000-000000000001
|
|
33
|
+
|
|
34
|
+
# Pipe schema definition to jq or file
|
|
35
|
+
ai schemas get my-schema | jq .
|
|
36
|
+
ai schemas get my-schema > schema.json
|
|
37
|
+
"""
|
|
38
|
+
_execute_get(schema_identifier=schema)
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
@async_command
|
|
42
|
+
async def _execute_get(schema_identifier: str) -> None:
|
|
43
|
+
"""Execute get schema operation.
|
|
44
|
+
|
|
45
|
+
Args:
|
|
46
|
+
schema_identifier: Schema name or UUID
|
|
47
|
+
|
|
48
|
+
Raises:
|
|
49
|
+
NotFoundError: If schema not found or user lacks access
|
|
50
|
+
AuthenticationError: If API key is invalid
|
|
51
|
+
ServerError: If server returns 5xx error
|
|
52
|
+
"""
|
|
53
|
+
async with authenticated_client() as (_config, client):
|
|
54
|
+
response = await client.get_schema(schema_identifier)
|
|
55
|
+
|
|
56
|
+
present_schema_details(response)
|