@ngocsangairvds/vsaf 3.1.27 → 3.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +2 -2
- package/src/global.js +70 -10
- package/tools/skills/vds-scripts-skill/.openskills.json +6 -0
- package/tools/skills/vds-scripts-skill/QUALITY.md +44 -0
- package/tools/skills/vds-scripts-skill/SKILL.md +135 -0
- package/tools/skills/vds-scripts-skill/references/audit-commands.md +171 -0
- package/tools/skills/vds-scripts-skill/references/capability-index.md +34 -0
- package/tools/skills/vds-scripts-skill/references/development-commands.md +12 -0
- package/tools/skills/vds-scripts-skill/references/google-sheets.md +73 -0
- package/tools/skills/vds-scripts-skill/references/integration-commands.md +17 -0
- package/tools/skills/vds-scripts-skill/references/platform-bootstrap.md +31 -0
- package/tools/skills/vds-scripts-skill/references/specialist-routing.md +14 -0
- package/tools/skills/vds-scripts-skill/references/validation-commands.md +15 -0
- package/tools/skills/vsaf-build/SKILL.md +32 -2
- package/tools/skills/vsaf-ship/SKILL.md +41 -10
- package/tools/skills/vsaf-test/SKILL.md +8 -0
- package/tools/vds-scripts/.mcp.json +11 -0
- package/tools/vds-scripts/.secrets.baseline +133 -0
- package/tools/vds-scripts/AGENTS.md +152 -0
- package/tools/vds-scripts/CLAUDE.md +101 -0
- package/tools/vds-scripts/CLI_COMMAND_OPTIMIZATION.md +156 -0
- package/tools/vds-scripts/PACKAGE_P125B_IMPLEMENTATION_SUMMARY.md +131 -0
- package/tools/vds-scripts/PROJECT_COMPLETION_SUMMARY.md +45 -0
- package/tools/vds-scripts/README.md +97 -0
- package/tools/vds-scripts/bitbucket_manifest_mapping.toml +34 -0
- package/tools/vds-scripts/bitbucket_orchestrator/ARCHITECTURE_ANALYSIS.md +258 -0
- package/tools/vds-scripts/bitbucket_orchestrator/BITBUCKET_API_PRACTICES.md +393 -0
- package/tools/vds-scripts/bitbucket_orchestrator/EVALUATION_REPORT.md +61 -0
- package/tools/vds-scripts/bitbucket_orchestrator/FEATURES.md +908 -0
- package/tools/vds-scripts/bitbucket_orchestrator/README.md +687 -0
- package/tools/vds-scripts/bitbucket_orchestrator/pyproject.toml +40 -0
- package/tools/vds-scripts/bitbucket_orchestrator/src/vds_bitbucket_orchestrator/__init__.py +20 -0
- package/tools/vds-scripts/bitbucket_orchestrator/src/vds_bitbucket_orchestrator/async_client.py +657 -0
- package/tools/vds-scripts/bitbucket_orchestrator/src/vds_bitbucket_orchestrator/cli.py +2108 -0
- package/tools/vds-scripts/bitbucket_orchestrator/src/vds_bitbucket_orchestrator/client.py +2534 -0
- package/tools/vds-scripts/bitbucket_orchestrator/src/vds_bitbucket_orchestrator/config.py +171 -0
- package/tools/vds-scripts/bitbucket_orchestrator/src/vds_bitbucket_orchestrator/errors.py +67 -0
- package/tools/vds-scripts/bitbucket_orchestrator/src/vds_bitbucket_orchestrator/factory.py +185 -0
- package/tools/vds-scripts/bitbucket_orchestrator/src/vds_bitbucket_orchestrator/protocols.py +244 -0
- package/tools/vds-scripts/bitbucket_orchestrator/tests/__init__.py +8 -0
- package/tools/vds-scripts/bitbucket_orchestrator/tests/conftest.py +65 -0
- package/tools/vds-scripts/bitbucket_orchestrator/tests/test_advanced_search.py +151 -0
- package/tools/vds-scripts/bitbucket_orchestrator/tests/test_async_client.py +546 -0
- package/tools/vds-scripts/bitbucket_orchestrator/tests/test_branch_permissions.py +145 -0
- package/tools/vds-scripts/bitbucket_orchestrator/tests/test_cli.py +115 -0
- package/tools/vds-scripts/bitbucket_orchestrator/tests/test_client.py +157 -0
- package/tools/vds-scripts/bitbucket_orchestrator/tests/test_client_branch_conditions.py +79 -0
- package/tools/vds-scripts/bitbucket_orchestrator/tests/test_client_code_advanced.py +163 -0
- package/tools/vds-scripts/bitbucket_orchestrator/tests/test_client_code_file.py +32 -0
- package/tools/vds-scripts/bitbucket_orchestrator/tests/test_client_deployment_environments.py +194 -0
- package/tools/vds-scripts/bitbucket_orchestrator/tests/test_client_issues.py +164 -0
- package/tools/vds-scripts/bitbucket_orchestrator/tests/test_client_pipelines_advanced.py +179 -0
- package/tools/vds-scripts/bitbucket_orchestrator/tests/test_client_pr_blockers.py +119 -0
- package/tools/vds-scripts/bitbucket_orchestrator/tests/test_client_repository_variables.py +156 -0
- package/tools/vds-scripts/bitbucket_orchestrator/tests/test_code.py +98 -0
- package/tools/vds-scripts/bitbucket_orchestrator/tests/test_code_advanced.py +282 -0
- package/tools/vds-scripts/bitbucket_orchestrator/tests/test_code_insights.py +335 -0
- package/tools/vds-scripts/bitbucket_orchestrator/tests/test_conditions.py +147 -0
- package/tools/vds-scripts/bitbucket_orchestrator/tests/test_config.py +131 -0
- package/tools/vds-scripts/bitbucket_orchestrator/tests/test_deployment_env.py +352 -0
- package/tools/vds-scripts/bitbucket_orchestrator/tests/test_factory.py +371 -0
- package/tools/vds-scripts/bitbucket_orchestrator/tests/test_fork_operations.py +204 -0
- package/tools/vds-scripts/bitbucket_orchestrator/tests/test_issue_cli.py +261 -0
- package/tools/vds-scripts/bitbucket_orchestrator/tests/test_pipeline_advanced.py +270 -0
- package/tools/vds-scripts/bitbucket_orchestrator/tests/test_pr_blocker.py +204 -0
- package/tools/vds-scripts/bitbucket_orchestrator/tests/test_protocols.py +334 -0
- package/tools/vds-scripts/bitbucket_orchestrator/tests/test_repo_settings.py +343 -0
- package/tools/vds-scripts/bitbucket_orchestrator/tests/test_repo_variables.py +270 -0
- package/tools/vds-scripts/bitbucket_orchestrator/tests/test_webhooks.py +189 -0
- package/tools/vds-scripts/bitbucket_orchestrator/tests/test_workspace.py +233 -0
- package/tools/vds-scripts/bitbucket_orchestrator/uv.lock +742 -0
- package/tools/vds-scripts/confluence_orchestrator/Dockerfile +19 -0
- package/tools/vds-scripts/confluence_orchestrator/README.md +412 -0
- package/tools/vds-scripts/confluence_orchestrator/SYNC_SCRIPTS.md +127 -0
- package/tools/vds-scripts/confluence_orchestrator/SYNC_STANDARDIZATION.md +108 -0
- package/tools/vds-scripts/confluence_orchestrator/pyproject.toml +48 -0
- package/tools/vds-scripts/confluence_orchestrator/src/confluence_orchestrator/__init__.py +20 -0
- package/tools/vds-scripts/confluence_orchestrator/src/confluence_orchestrator/cli.py +2532 -0
- package/tools/vds-scripts/confluence_orchestrator/src/confluence_orchestrator/config.py +175 -0
- package/tools/vds-scripts/confluence_orchestrator/src/confluence_orchestrator/content.py +290 -0
- package/tools/vds-scripts/confluence_orchestrator/src/confluence_orchestrator/content_v2.py +94 -0
- package/tools/vds-scripts/confluence_orchestrator/src/confluence_orchestrator/crawl_tree.py +1835 -0
- package/tools/vds-scripts/confluence_orchestrator/src/confluence_orchestrator/errors.py +80 -0
- package/tools/vds-scripts/confluence_orchestrator/src/confluence_orchestrator/eventing.py +109 -0
- package/tools/vds-scripts/confluence_orchestrator/src/confluence_orchestrator/http.py +1114 -0
- package/tools/vds-scripts/confluence_orchestrator/src/confluence_orchestrator/orchestration.py +165 -0
- package/tools/vds-scripts/confluence_orchestrator/src/confluence_orchestrator/reporting.py +78 -0
- package/tools/vds-scripts/confluence_orchestrator/src/confluence_orchestrator/tree.py +121 -0
- package/tools/vds-scripts/confluence_orchestrator/sync_pdfs_from_markdown.py +213 -0
- package/tools/vds-scripts/confluence_orchestrator/sync_pdfs_to_confluence.py +305 -0
- package/tools/vds-scripts/confluence_orchestrator/sync_png_attachments.py +305 -0
- package/tools/vds-scripts/confluence_orchestrator/tests/__init__.py +0 -0
- package/tools/vds-scripts/confluence_orchestrator/tests/conftest.py +8 -0
- package/tools/vds-scripts/confluence_orchestrator/tests/test_advanced_content.py +224 -0
- package/tools/vds-scripts/confluence_orchestrator/tests/test_advanced_search.py +188 -0
- package/tools/vds-scripts/confluence_orchestrator/tests/test_cache_management.py +247 -0
- package/tools/vds-scripts/confluence_orchestrator/tests/test_cli.py +499 -0
- package/tools/vds-scripts/confluence_orchestrator/tests/test_config.py +83 -0
- package/tools/vds-scripts/confluence_orchestrator/tests/test_content.py +186 -0
- package/tools/vds-scripts/confluence_orchestrator/tests/test_content_flags.py +27 -0
- package/tools/vds-scripts/confluence_orchestrator/tests/test_crawl_tree.py +2250 -0
- package/tools/vds-scripts/confluence_orchestrator/tests/test_draft_management.py +223 -0
- package/tools/vds-scripts/confluence_orchestrator/tests/test_eventing.py +71 -0
- package/tools/vds-scripts/confluence_orchestrator/tests/test_eventing_chaos.py +37 -0
- package/tools/vds-scripts/confluence_orchestrator/tests/test_eventing_rate_limit.py +44 -0
- package/tools/vds-scripts/confluence_orchestrator/tests/test_eventing_timeout.py +49 -0
- package/tools/vds-scripts/confluence_orchestrator/tests/test_export.py +230 -0
- package/tools/vds-scripts/confluence_orchestrator/tests/test_history.py +204 -0
- package/tools/vds-scripts/confluence_orchestrator/tests/test_http.py +117 -0
- package/tools/vds-scripts/confluence_orchestrator/tests/test_orchestration.py +91 -0
- package/tools/vds-scripts/confluence_orchestrator/tests/test_reporting.py +24 -0
- package/tools/vds-scripts/confluence_orchestrator/tests/test_search_cql.py +34 -0
- package/tools/vds-scripts/confluence_orchestrator/tests/test_space_management.py +237 -0
- package/tools/vds-scripts/confluence_orchestrator/tests/test_space_permissions.py +332 -0
- package/tools/vds-scripts/confluence_orchestrator/tests/test_user_group_management.py +388 -0
- package/tools/vds-scripts/confluence_orchestrator/uv.lock +1023 -0
- package/tools/vds-scripts/git_orchestrator/ENHANCEMENT_SUMMARY.md +119 -0
- package/tools/vds-scripts/git_orchestrator/README.md +280 -0
- package/tools/vds-scripts/git_orchestrator/VERIFICATION_REPORT.md +152 -0
- package/tools/vds-scripts/git_orchestrator/pyproject.toml +35 -0
- package/tools/vds-scripts/git_orchestrator/src/vds_git_orchestrator/__init__.py +7 -0
- package/tools/vds-scripts/git_orchestrator/src/vds_git_orchestrator/__main__.py +4 -0
- package/tools/vds-scripts/git_orchestrator/src/vds_git_orchestrator/cli.py +847 -0
- package/tools/vds-scripts/git_orchestrator/src/vds_git_orchestrator/logging_config.py +63 -0
- package/tools/vds-scripts/git_orchestrator/src/vds_git_orchestrator/manifest.py +129 -0
- package/tools/vds-scripts/git_orchestrator/src/vds_git_orchestrator/orchestrator.py +819 -0
- package/tools/vds-scripts/git_orchestrator/src/vds_git_orchestrator/reporting.py +53 -0
- package/tools/vds-scripts/git_orchestrator/tests/__init__.py +0 -0
- package/tools/vds-scripts/git_orchestrator/tests/test_cli_settings.py +21 -0
- package/tools/vds-scripts/git_orchestrator/tests/test_integration.py +74 -0
- package/tools/vds-scripts/git_orchestrator/tests/test_manifest.py +79 -0
- package/tools/vds-scripts/git_orchestrator/tests/test_orchestrator.py +204 -0
- package/tools/vds-scripts/git_orchestrator/tests/test_public_api.py +236 -0
- package/tools/vds-scripts/git_orchestrator/tests/test_resilience.py +345 -0
- package/tools/vds-scripts/git_orchestrator/uv.lock +271 -0
- package/tools/vds-scripts/jira_orchestrator/README.md +770 -0
- package/tools/vds-scripts/jira_orchestrator/pyproject.toml +39 -0
- package/tools/vds-scripts/jira_orchestrator/src/vds_jira_orchestrator/__init__.py +1 -0
- package/tools/vds-scripts/jira_orchestrator/src/vds_jira_orchestrator/adapter.py +1320 -0
- package/tools/vds-scripts/jira_orchestrator/src/vds_jira_orchestrator/cli.py +2271 -0
- package/tools/vds-scripts/jira_orchestrator/src/vds_jira_orchestrator/config.py +138 -0
- package/tools/vds-scripts/jira_orchestrator/src/vds_jira_orchestrator/errors.py +67 -0
- package/tools/vds-scripts/jira_orchestrator/src/vds_jira_orchestrator/reporting.py +65 -0
- package/tools/vds-scripts/jira_orchestrator/tests/__init__.py +1 -0
- package/tools/vds-scripts/jira_orchestrator/tests/conftest.py +86 -0
- package/tools/vds-scripts/jira_orchestrator/tests/test_adapter_agile_list_payloads.py +54 -0
- package/tools/vds-scripts/jira_orchestrator/tests/test_adapter_bulk_operations.py +69 -0
- package/tools/vds-scripts/jira_orchestrator/tests/test_adapter_components.py +57 -0
- package/tools/vds-scripts/jira_orchestrator/tests/test_adapter_createmeta.py +45 -0
- package/tools/vds-scripts/jira_orchestrator/tests/test_adapter_dashboard.py +117 -0
- package/tools/vds-scripts/jira_orchestrator/tests/test_adapter_issue_properties.py +54 -0
- package/tools/vds-scripts/jira_orchestrator/tests/test_adapter_permissions_compat.py +42 -0
- package/tools/vds-scripts/jira_orchestrator/tests/test_adapter_reindex.py +42 -0
- package/tools/vds-scripts/jira_orchestrator/tests/test_adapter_remote_links.py +76 -0
- package/tools/vds-scripts/jira_orchestrator/tests/test_adapter_transitions.py +91 -0
- package/tools/vds-scripts/jira_orchestrator/tests/test_adapter_user_management.py +110 -0
- package/tools/vds-scripts/jira_orchestrator/tests/test_adapter_version_management.py +133 -0
- package/tools/vds-scripts/jira_orchestrator/tests/test_adapter_watchers.py +41 -0
- package/tools/vds-scripts/jira_orchestrator/tests/test_advanced_search.py +164 -0
- package/tools/vds-scripts/jira_orchestrator/tests/test_agile.py +256 -0
- package/tools/vds-scripts/jira_orchestrator/tests/test_application_properties.py +193 -0
- package/tools/vds-scripts/jira_orchestrator/tests/test_backlog.py +91 -0
- package/tools/vds-scripts/jira_orchestrator/tests/test_bulk_operations.py +277 -0
- package/tools/vds-scripts/jira_orchestrator/tests/test_cli.py +106 -0
- package/tools/vds-scripts/jira_orchestrator/tests/test_components.py +106 -0
- package/tools/vds-scripts/jira_orchestrator/tests/test_config.py +164 -0
- package/tools/vds-scripts/jira_orchestrator/tests/test_dashboard.py +122 -0
- package/tools/vds-scripts/jira_orchestrator/tests/test_discover_fields.py +207 -0
- package/tools/vds-scripts/jira_orchestrator/tests/test_filter_management.py +333 -0
- package/tools/vds-scripts/jira_orchestrator/tests/test_issue_archiving.py +164 -0
- package/tools/vds-scripts/jira_orchestrator/tests/test_issue_links.py +257 -0
- package/tools/vds-scripts/jira_orchestrator/tests/test_issue_properties.py +171 -0
- package/tools/vds-scripts/jira_orchestrator/tests/test_link_types.py +314 -0
- package/tools/vds-scripts/jira_orchestrator/tests/test_parse_set.py +37 -0
- package/tools/vds-scripts/jira_orchestrator/tests/test_permissions.py +273 -0
- package/tools/vds-scripts/jira_orchestrator/tests/test_reindex.py +81 -0
- package/tools/vds-scripts/jira_orchestrator/tests/test_remote_links.py +254 -0
- package/tools/vds-scripts/jira_orchestrator/tests/test_security_schemes.py +170 -0
- package/tools/vds-scripts/jira_orchestrator/tests/test_transitions_changelog.py +114 -0
- package/tools/vds-scripts/jira_orchestrator/tests/test_user_management.py +226 -0
- package/tools/vds-scripts/jira_orchestrator/tests/test_version_management.py +339 -0
- package/tools/vds-scripts/jira_orchestrator/tests/test_watchers.py +101 -0
- package/tools/vds-scripts/jira_orchestrator/tests/test_worklog.py +223 -0
- package/tools/vds-scripts/jira_orchestrator/uv.lock +738 -0
- package/tools/vds-scripts/mcp_server/Dockerfile +34 -0
- package/tools/vds-scripts/mcp_server/README.md +140 -0
- package/tools/vds-scripts/mcp_server/pyproject.toml +42 -0
- package/tools/vds-scripts/mcp_server/src/vds_mcp_server/__init__.py +4 -0
- package/tools/vds-scripts/mcp_server/src/vds_mcp_server/config.py +36 -0
- package/tools/vds-scripts/mcp_server/src/vds_mcp_server/server.py +66 -0
- package/tools/vds-scripts/mcp_server/src/vds_mcp_server/tools/__init__.py +14 -0
- package/tools/vds-scripts/mcp_server/src/vds_mcp_server/tools/bitbucket_tools.py +47 -0
- package/tools/vds-scripts/mcp_server/src/vds_mcp_server/tools/confluence_tools.py +59 -0
- package/tools/vds-scripts/mcp_server/src/vds_mcp_server/tools/git_tools.py +71 -0
- package/tools/vds-scripts/mcp_server/src/vds_mcp_server/tools/jira_tools.py +63 -0
- package/tools/vds-scripts/mcp_server/tests/__init__.py +2 -0
- package/tools/vds-scripts/mcp_server/tests/conftest.py +29 -0
- package/tools/vds-scripts/mcp_server/tests/unit/__init__.py +2 -0
- package/tools/vds-scripts/mcp_server/tests/unit/test_bitbucket_tools.py +25 -0
- package/tools/vds-scripts/mcp_server/tests/unit/test_confluence_tools.py +25 -0
- package/tools/vds-scripts/mcp_server/tests/unit/test_git_tools.py +32 -0
- package/tools/vds-scripts/mcp_server/tests/unit/test_jira_tools.py +32 -0
- package/tools/vds-scripts/mcp_server/tests/verification/__init__.py +2 -0
- package/tools/vds-scripts/mcp_server/tests/verification/test_mcp_confluence_tools.py +40 -0
- package/tools/vds-scripts/mcp_server/tests/verification/test_mcp_jira_tools.py +37 -0
- package/tools/vds-scripts/mcp_server/tests/verification/test_mcp_tool_registration.py +47 -0
- package/tools/vds-scripts/mcp_server/uv.lock +1032 -0
- package/tools/vds-scripts/mypy.ini +5 -0
- package/tools/vds-scripts/pyproject.toml +29 -0
- package/tools/vds-scripts/repo-manifest.yaml +273 -0
- package/tools/vds-scripts/repo-manifest.yaml.example +25 -0
- package/tools/vds-scripts/scripts/BRD-Validation-API.postman_collection.json +706 -0
- package/tools/vds-scripts/scripts/BRD-Validation-README.md +308 -0
- package/tools/vds-scripts/scripts/README.md +162 -0
- package/tools/vds-scripts/scripts/bootstrap_uv.sh +30 -0
- package/tools/vds-scripts/scripts/brd-validation-environment.json +51 -0
- package/tools/vds-scripts/scripts/brd-validation-test-results.json +13023 -0
- package/tools/vds-scripts/scripts/brd_coverage_report.json +276 -0
- package/tools/vds-scripts/scripts/create_memory_session.py +35 -0
- package/tools/vds-scripts/scripts/deployment/load_docker_images_offline.sh +90 -0
- package/tools/vds-scripts/scripts/final_completion_report.md +139 -0
- package/tools/vds-scripts/scripts/folder_structure_report.json +321 -0
- package/tools/vds-scripts/scripts/generate_completion_report.py +125 -0
- package/tools/vds-scripts/scripts/generate_intellij_modules.py +150 -0
- package/tools/vds-scripts/scripts/link_integrity_report.json +807 -0
- package/tools/vds-scripts/scripts/move_audit_artifact_pages.py +255 -0
- package/tools/vds-scripts/scripts/move_audit_artifact_pages_rest.py +165 -0
- package/tools/vds-scripts/scripts/move_wrong_dept_pages.py +216 -0
- package/tools/vds-scripts/scripts/save_intellij_memories.py +120 -0
- package/tools/vds-scripts/scripts/save_memories_to_vds_ai.py +83 -0
- package/tools/vds-scripts/scripts/save_memories_vds_style.py +129 -0
- package/tools/vds-scripts/scripts/search_intellij_memories.py +50 -0
- package/tools/vds-scripts/scripts/setup_intellij_workspace.py +65 -0
- package/tools/vds-scripts/scripts/target-state-automation/README.md +89 -0
- package/tools/vds-scripts/scripts/target-state-automation/confluence_sync_coordinator.sh +27 -0
- package/tools/vds-scripts/scripts/target-state-automation/coordination.sh +114 -0
- package/tools/vds-scripts/scripts/target-state-automation/diagram_coordinator.sh +25 -0
- package/tools/vds-scripts/scripts/target-state-automation/docs_root.sh +22 -0
- package/tools/vds-scripts/scripts/target-state-automation/generate_diagrams.sh +22 -0
- package/tools/vds-scripts/scripts/target-state-automation/markdown_coordinator.sh +25 -0
- package/tools/vds-scripts/scripts/target-state-automation/progress_dashboard.sh +17 -0
- package/tools/vds-scripts/scripts/target-state-automation/schema_coordinator.sh +25 -0
- package/tools/vds-scripts/scripts/target-state-automation/sync_confluence.sh +30 -0
- package/tools/vds-scripts/scripts/target-state-automation/update_dependencies.sh +19 -0
- package/tools/vds-scripts/scripts/target-state-automation/validate_links.sh +86 -0
- package/tools/vds-scripts/scripts/target-state-automation/validate_markdown.sh +52 -0
- package/tools/vds-scripts/scripts/target-state-automation/validate_schemas.sh +26 -0
- package/tools/vds-scripts/scripts/target-state-automation/validate_structure.sh +98 -0
- package/tools/vds-scripts/scripts/update_modules_xml.py +190 -0
- package/tools/vds-scripts/scripts/uv-workspace-alignment-verification-2026-03-25.md +128 -0
- package/tools/vds-scripts/scripts/validate_brd_coverage.py +179 -0
- package/tools/vds-scripts/scripts/validate_folder_structure.py +240 -0
- package/tools/vds-scripts/scripts/validate_link_integrity.py +272 -0
- package/tools/vds-scripts/scripts/vds_sh_helpers.sh +180 -0
- package/tools/vds-scripts/scripts/verification/phase2_portable_paths_ubuntu_docker.sh +26 -0
- package/tools/vds-scripts/scripts/worktree_uv.sh +48 -0
- package/tools/vds-scripts/uv.lock +8 -0
- package/tools/vds-scripts/vds_cli/README.md +126 -0
- package/tools/vds-scripts/vds_cli/VERIFICATION_REPORT.md +41 -0
- package/tools/vds-scripts/vds_cli/pyproject.toml +38 -0
- package/tools/vds-scripts/vds_cli/src/vds_cli/__init__.py +3 -0
- package/tools/vds-scripts/vds_cli/src/vds_cli/cli.py +173 -0
- package/tools/vds-scripts/vds_cli/src/vds_cli/docs_sync.py +1203 -0
- package/tools/vds-scripts/vds_cli/src/vds_cli/env.py +41 -0
- package/tools/vds-scripts/vds_cli/src/vds_cli/google_sheets_orchestrator/__init__.py +3 -0
- package/tools/vds-scripts/vds_cli/src/vds_cli/google_sheets_orchestrator/google_sheets_orchestrator.py +198 -0
- package/tools/vds-scripts/vds_cli/src/vds_cli/router.py +93 -0
- package/tools/vds-scripts/vds_cli/src/vds_cli/sync_api.py +647 -0
- package/tools/vds-scripts/vds_cli/src/vds_cli/sync_service.py +266 -0
- package/tools/vds-scripts/vds_cli/tests/__init__.py +2 -0
- package/tools/vds-scripts/vds_cli/tests/conftest.py +49 -0
- package/tools/vds-scripts/vds_cli/tests/unit/__init__.py +2 -0
- package/tools/vds-scripts/vds_cli/tests/unit/test_cli.py +143 -0
- package/tools/vds-scripts/vds_cli/tests/unit/test_docs_sync.py +422 -0
- package/tools/vds-scripts/vds_cli/tests/unit/test_env.py +51 -0
- package/tools/vds-scripts/vds_cli/tests/unit/test_router.py +72 -0
- package/tools/vds-scripts/vds_cli/tests/unit/test_sync_api.py +357 -0
- package/tools/vds-scripts/vds_cli/tests/unit/test_sync_service.py +160 -0
- package/tools/vds-scripts/vds_cli/tests/verification/__init__.py +2 -0
- package/tools/vds-scripts/vds_cli/tests/verification/test_bitbucket_real.py +33 -0
- package/tools/vds-scripts/vds_cli/tests/verification/test_confluence_real.py +35 -0
- package/tools/vds-scripts/vds_cli/tests/verification/test_jira_real.py +41 -0
- package/tools/vds-scripts/vds_cli/uv.lock +524 -0
- package/tools/vds-scripts/vds_cli_common/README.md +190 -0
- package/tools/vds-scripts/vds_cli_common/pyproject.toml +92 -0
- package/tools/vds-scripts/vds_cli_common/src/vds_cli_common/__init__.py +34 -0
- package/tools/vds-scripts/vds_cli_common/src/vds_cli_common/completers.py +139 -0
- package/tools/vds-scripts/vds_cli_common/src/vds_cli_common/context.py +201 -0
- package/tools/vds-scripts/vds_cli_common/src/vds_cli_common/env.py +119 -0
- package/tools/vds-scripts/vds_cli_common/src/vds_cli_common/errors.py +318 -0
- package/tools/vds-scripts/vds_cli_common/src/vds_cli_common/output.py +284 -0
- package/tools/vds-scripts/vds_cli_common/src/vds_cli_common/paths.py +78 -0
- package/tools/vds-scripts/vds_cli_common/src/vds_cli_common/testing.py +213 -0
- package/tools/vds-scripts/vds_cli_common/src/vds_cli_common/version.py +85 -0
- package/tools/vds-scripts/vds_cli_common/tests/__init__.py +1 -0
- package/tools/vds-scripts/vds_cli_common/tests/test_completers.py +148 -0
- package/tools/vds-scripts/vds_cli_common/tests/test_context.py +192 -0
- package/tools/vds-scripts/vds_cli_common/tests/test_env.py +102 -0
- package/tools/vds-scripts/vds_cli_common/tests/test_errors.py +186 -0
- package/tools/vds-scripts/vds_cli_common/tests/test_output.py +229 -0
- package/tools/vds-scripts/vds_cli_common/tests/test_paths.py +61 -0
- package/tools/vds-scripts/vds_cli_common/tests/test_testing.py +138 -0
- package/tools/vds-scripts/vds_cli_common/tests/test_version.py +64 -0
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
# VDS CLI Common
|
|
2
|
+
|
|
3
|
+
Shared CLI infrastructure for VDS orchestrator CLIs.
|
|
4
|
+
|
|
5
|
+
## Overview
|
|
6
|
+
|
|
7
|
+
`vds-cli-common` provides a unified set of building blocks for creating consistent CLI applications across the VDS ecosystem. It standardizes output formatting, error handling, shell completions, and testing patterns.
|
|
8
|
+
|
|
9
|
+
## Features
|
|
10
|
+
|
|
11
|
+
- **CLIContext**: Dataclass for passing CLI state (verbosity, output format, color settings)
|
|
12
|
+
- **OutputManager**: Rich-based output formatting with JSON/table/text modes
|
|
13
|
+
- **ErrorHandler**: Consistent error handling with exit codes
|
|
14
|
+
- **Version Callback**: Factory for `--version` flags
|
|
15
|
+
- **Completers**: Shell completion helpers for common patterns
|
|
16
|
+
- **Testing Fixtures**: pytest fixtures for CLI testing
|
|
17
|
+
|
|
18
|
+
## Installation
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
# Add as dependency in pyproject.toml
|
|
22
|
+
dependencies = [
|
|
23
|
+
"vds-cli-common @ file:///${PROJECT_ROOT}/../vds_cli_common",
|
|
24
|
+
]
|
|
25
|
+
|
|
26
|
+
# Or install directly
|
|
27
|
+
uv add ../vds_cli_common
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## Quick Start
|
|
31
|
+
|
|
32
|
+
```python
|
|
33
|
+
from vds_cli_common import CLIContext, OutputManager, ExitCodes, create_version_callback
|
|
34
|
+
|
|
35
|
+
# Create context with CLI options
|
|
36
|
+
ctx = CLIContext(verbose=True, output_format="json", no_color=False)
|
|
37
|
+
|
|
38
|
+
# Use OutputManager for consistent output
|
|
39
|
+
output = OutputManager(ctx)
|
|
40
|
+
output.success("Operation completed")
|
|
41
|
+
output.print_json({"key": "value"})
|
|
42
|
+
|
|
43
|
+
# Handle errors consistently
|
|
44
|
+
from vds_cli_common import ErrorHandler
|
|
45
|
+
handler = ErrorHandler(ctx)
|
|
46
|
+
handler.handle_error(some_exception)
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
## Modules
|
|
50
|
+
|
|
51
|
+
### `context`
|
|
52
|
+
|
|
53
|
+
```python
|
|
54
|
+
from vds_cli_common import CLIContext
|
|
55
|
+
|
|
56
|
+
ctx = CLIContext(
|
|
57
|
+
verbose=False, # Enable verbose output
|
|
58
|
+
debug=False, # Enable debug output
|
|
59
|
+
quiet=False, # Suppress non-essential output
|
|
60
|
+
output_format="text", # text, json, table
|
|
61
|
+
no_color=False, # Disable colored output
|
|
62
|
+
)
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
### `output`
|
|
66
|
+
|
|
67
|
+
```python
|
|
68
|
+
from vds_cli_common import OutputManager
|
|
69
|
+
|
|
70
|
+
output = OutputManager(ctx)
|
|
71
|
+
output.info("Information message")
|
|
72
|
+
output.success("Success message")
|
|
73
|
+
output.warning("Warning message")
|
|
74
|
+
output.error("Error message")
|
|
75
|
+
output.debug("Debug message") # Only shown if ctx.debug=True
|
|
76
|
+
output.verbose("Verbose message") # Only shown if ctx.verbose=True
|
|
77
|
+
|
|
78
|
+
# Structured output
|
|
79
|
+
output.print_json(data)
|
|
80
|
+
output.print_table(rows, columns=["Name", "Value"])
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
### `errors`
|
|
84
|
+
|
|
85
|
+
```python
|
|
86
|
+
from vds_cli_common import ErrorHandler, ExitCodes, CLIError
|
|
87
|
+
|
|
88
|
+
# Standard exit codes
|
|
89
|
+
ExitCodes.SUCCESS # 0
|
|
90
|
+
ExitCodes.GENERAL_ERROR # 1
|
|
91
|
+
ExitCodes.CONFIG_ERROR # 2
|
|
92
|
+
ExitCodes.AUTH_ERROR # 3
|
|
93
|
+
ExitCodes.NETWORK_ERROR # 4
|
|
94
|
+
ExitCodes.NOT_FOUND # 5
|
|
95
|
+
ExitCodes.VALIDATION_ERROR # 6
|
|
96
|
+
|
|
97
|
+
# Custom CLI errors
|
|
98
|
+
raise CLIError("Something went wrong", exit_code=ExitCodes.VALIDATION_ERROR)
|
|
99
|
+
|
|
100
|
+
# Error handler
|
|
101
|
+
handler = ErrorHandler(ctx)
|
|
102
|
+
exit_code = handler.handle_error(exception)
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
### `version`
|
|
106
|
+
|
|
107
|
+
```python
|
|
108
|
+
from vds_cli_common import create_version_callback
|
|
109
|
+
import typer
|
|
110
|
+
|
|
111
|
+
app = typer.Typer()
|
|
112
|
+
|
|
113
|
+
@app.callback()
|
|
114
|
+
def main(
|
|
115
|
+
version: bool = typer.Option(
|
|
116
|
+
False, "--version", "-V",
|
|
117
|
+
callback=create_version_callback("my-cli", "1.0.0"),
|
|
118
|
+
is_eager=True,
|
|
119
|
+
),
|
|
120
|
+
):
|
|
121
|
+
pass
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
### `completers`
|
|
125
|
+
|
|
126
|
+
```python
|
|
127
|
+
from vds_cli_common import complete_from_list, complete_path, complete_choice
|
|
128
|
+
|
|
129
|
+
# Static list completion
|
|
130
|
+
@app.command()
|
|
131
|
+
def cmd(
|
|
132
|
+
project: str = typer.Option(
|
|
133
|
+
...,
|
|
134
|
+
autocompletion=complete_from_list(["lep", "insurance", "saving"]),
|
|
135
|
+
),
|
|
136
|
+
):
|
|
137
|
+
pass
|
|
138
|
+
|
|
139
|
+
# Path completion
|
|
140
|
+
@app.command()
|
|
141
|
+
def cmd(
|
|
142
|
+
file: str = typer.Option(..., autocompletion=complete_path()),
|
|
143
|
+
):
|
|
144
|
+
pass
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
### `testing`
|
|
148
|
+
|
|
149
|
+
```python
|
|
150
|
+
import pytest
|
|
151
|
+
from vds_cli_common.testing import cli_runner, captured_output, mock_context
|
|
152
|
+
|
|
153
|
+
def test_my_command(cli_runner):
|
|
154
|
+
result = cli_runner.invoke(app, ["my-command"])
|
|
155
|
+
assert result.exit_code == 0
|
|
156
|
+
|
|
157
|
+
def test_output(captured_output):
|
|
158
|
+
output = OutputManager(mock_context())
|
|
159
|
+
output.success("Done")
|
|
160
|
+
assert "Done" in captured_output.getvalue()
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
## Development
|
|
164
|
+
|
|
165
|
+
```bash
|
|
166
|
+
cd WHO-project/vds-scripts/vds_cli_common
|
|
167
|
+
|
|
168
|
+
# Install with dev dependencies
|
|
169
|
+
uv sync --group dev
|
|
170
|
+
|
|
171
|
+
# Run tests
|
|
172
|
+
uv run pytest
|
|
173
|
+
|
|
174
|
+
# Run tests with coverage
|
|
175
|
+
uv run pytest --cov=vds_cli_common --cov-report=term-missing
|
|
176
|
+
|
|
177
|
+
# Lint
|
|
178
|
+
uv run ruff check src tests
|
|
179
|
+
uv run ruff format src tests
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
## Requirements
|
|
183
|
+
|
|
184
|
+
- Python >= 3.11
|
|
185
|
+
- typer>=0.24.1
|
|
186
|
+
- rich>=14.3.3
|
|
187
|
+
|
|
188
|
+
## License
|
|
189
|
+
|
|
190
|
+
MIT
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "vds-cli-common"
|
|
3
|
+
version = "0.1.0"
|
|
4
|
+
description = "Shared CLI infrastructure for VDS orchestrator CLIs"
|
|
5
|
+
readme = "README.md"
|
|
6
|
+
requires-python = ">=3.11"
|
|
7
|
+
license = { text = "MIT" }
|
|
8
|
+
authors = [{ name = "VDS Team" }]
|
|
9
|
+
keywords = ["cli", "typer", "rich", "vds"]
|
|
10
|
+
classifiers = [
|
|
11
|
+
"Development Status :: 4 - Beta",
|
|
12
|
+
"Environment :: Console",
|
|
13
|
+
"Intended Audience :: Developers",
|
|
14
|
+
"License :: OSI Approved :: MIT License",
|
|
15
|
+
"Programming Language :: Python :: 3.11",
|
|
16
|
+
"Programming Language :: Python :: 3.12",
|
|
17
|
+
"Topic :: Software Development :: Libraries :: Python Modules",
|
|
18
|
+
"Typing :: Typed",
|
|
19
|
+
]
|
|
20
|
+
dependencies = [
|
|
21
|
+
"typer>=0.24.1",
|
|
22
|
+
"rich>=14.3.3",
|
|
23
|
+
"platformdirs>=4.5.0",
|
|
24
|
+
]
|
|
25
|
+
|
|
26
|
+
[dependency-groups]
|
|
27
|
+
dev = [
|
|
28
|
+
"pytest>=7.0.0",
|
|
29
|
+
"pytest-cov>=4.0.0",
|
|
30
|
+
"ruff>=0.1.0",
|
|
31
|
+
]
|
|
32
|
+
|
|
33
|
+
[build-system]
|
|
34
|
+
requires = ["hatchling"]
|
|
35
|
+
build-backend = "hatchling.build"
|
|
36
|
+
|
|
37
|
+
[tool.hatch.build.targets.wheel]
|
|
38
|
+
packages = ["src/vds_cli_common"]
|
|
39
|
+
|
|
40
|
+
[tool.ruff]
|
|
41
|
+
target-version = "py311"
|
|
42
|
+
line-length = 120
|
|
43
|
+
src = ["src", "tests"]
|
|
44
|
+
|
|
45
|
+
[tool.ruff.lint]
|
|
46
|
+
select = [
|
|
47
|
+
"E", # pycodestyle errors
|
|
48
|
+
"W", # pycodestyle warnings
|
|
49
|
+
"F", # Pyflakes
|
|
50
|
+
"I", # isort
|
|
51
|
+
"B", # flake8-bugbear
|
|
52
|
+
"C4", # flake8-comprehensions
|
|
53
|
+
"UP", # pyupgrade
|
|
54
|
+
"ARG", # flake8-unused-arguments
|
|
55
|
+
"SIM", # flake8-simplify
|
|
56
|
+
"TCH", # flake8-type-checking
|
|
57
|
+
"PTH", # flake8-use-pathlib
|
|
58
|
+
"ERA", # eradicate (commented code)
|
|
59
|
+
"PL", # Pylint
|
|
60
|
+
"RUF", # Ruff-specific
|
|
61
|
+
]
|
|
62
|
+
ignore = [
|
|
63
|
+
"PLR0913", # Too many arguments
|
|
64
|
+
"PLR2004", # Magic value comparison
|
|
65
|
+
"PLC0415", # Allow lazy imports for performance (Rich imports are heavy)
|
|
66
|
+
"ARG002", # Allow unused arguments in interface/stub methods
|
|
67
|
+
"TC003", # Allow runtime imports of typing constructs
|
|
68
|
+
"RUF001", # Allow Unicode symbols (ℹ for info icon)
|
|
69
|
+
"SIM117", # Allow nested with statements for clarity
|
|
70
|
+
"F841", # Allow unused variables in test setup
|
|
71
|
+
]
|
|
72
|
+
|
|
73
|
+
[tool.ruff.lint.isort]
|
|
74
|
+
known-first-party = ["vds_cli_common"]
|
|
75
|
+
|
|
76
|
+
[tool.pytest.ini_options]
|
|
77
|
+
testpaths = ["tests"]
|
|
78
|
+
pythonpath = ["src"]
|
|
79
|
+
addopts = "-v --tb=short"
|
|
80
|
+
|
|
81
|
+
[tool.coverage.run]
|
|
82
|
+
source = ["src/vds_cli_common"]
|
|
83
|
+
branch = true
|
|
84
|
+
|
|
85
|
+
[tool.coverage.report]
|
|
86
|
+
exclude_lines = [
|
|
87
|
+
"pragma: no cover",
|
|
88
|
+
"if TYPE_CHECKING:",
|
|
89
|
+
"if __name__ == .__main__.:",
|
|
90
|
+
"@abstractmethod",
|
|
91
|
+
]
|
|
92
|
+
fail_under = 90
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"""Shared infrastructure for VDS CLI packages.
|
|
2
|
+
|
|
3
|
+
This package provides reusable components for building consistent CLIs:
|
|
4
|
+
- CLIContext: TTY detection, color control, output mode management
|
|
5
|
+
- OutputManager: Unified output with spinners, progress bars, tables
|
|
6
|
+
- ErrorHandler: Consistent error formatting with suggestions
|
|
7
|
+
- ExitCodes: Standard exit codes for all CLIs
|
|
8
|
+
- create_version_callback: Factory for --version flag handlers
|
|
9
|
+
"""
|
|
10
|
+
|
|
11
|
+
from vds_cli_common.context import CLIContext
|
|
12
|
+
from vds_cli_common.env import DEFAULT_ENV_PATHS, load_shared_env
|
|
13
|
+
from vds_cli_common.errors import ErrorHandler, ExitCodes
|
|
14
|
+
from vds_cli_common.output import NullProgress, OutputManager
|
|
15
|
+
from vds_cli_common.paths import get_shared_env_path, get_vds_cache_root, get_vds_config_root, get_vds_log_root
|
|
16
|
+
from vds_cli_common.version import create_version_callback
|
|
17
|
+
|
|
18
|
+
__version__ = "0.1.0"
|
|
19
|
+
|
|
20
|
+
__all__ = [
|
|
21
|
+
"CLIContext",
|
|
22
|
+
"DEFAULT_ENV_PATHS",
|
|
23
|
+
"ErrorHandler",
|
|
24
|
+
"ExitCodes",
|
|
25
|
+
"NullProgress",
|
|
26
|
+
"OutputManager",
|
|
27
|
+
"__version__",
|
|
28
|
+
"create_version_callback",
|
|
29
|
+
"get_shared_env_path",
|
|
30
|
+
"get_vds_cache_root",
|
|
31
|
+
"get_vds_config_root",
|
|
32
|
+
"get_vds_log_root",
|
|
33
|
+
"load_shared_env",
|
|
34
|
+
]
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
"""Common completers for VDS CLIs.
|
|
2
|
+
|
|
3
|
+
This module provides shell completion functions for common arguments
|
|
4
|
+
used across VDS orchestrator CLIs.
|
|
5
|
+
|
|
6
|
+
Usage:
|
|
7
|
+
from vds_cli_common.completers import complete_index, complete_project
|
|
8
|
+
|
|
9
|
+
@app.command()
|
|
10
|
+
def search(
|
|
11
|
+
index: str = typer.Option(
|
|
12
|
+
"*",
|
|
13
|
+
"--index", "-i",
|
|
14
|
+
help="Index pattern",
|
|
15
|
+
autocompletion=complete_index,
|
|
16
|
+
),
|
|
17
|
+
):
|
|
18
|
+
pass
|
|
19
|
+
"""
|
|
20
|
+
|
|
21
|
+
from __future__ import annotations
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
def complete_index(incomplete: str) -> list[str]:
|
|
25
|
+
"""Provide common Elasticsearch index pattern suggestions.
|
|
26
|
+
|
|
27
|
+
Returns common index patterns that match the incomplete input.
|
|
28
|
+
This is static completion - doesn't query Elasticsearch for performance.
|
|
29
|
+
|
|
30
|
+
Args:
|
|
31
|
+
incomplete: The partial input to complete
|
|
32
|
+
|
|
33
|
+
Returns:
|
|
34
|
+
List of matching index patterns
|
|
35
|
+
"""
|
|
36
|
+
common_patterns = [
|
|
37
|
+
"logs-*",
|
|
38
|
+
"metrics-*",
|
|
39
|
+
"traces-*",
|
|
40
|
+
"filebeat-*",
|
|
41
|
+
"metricbeat-*",
|
|
42
|
+
"apm-*",
|
|
43
|
+
".kibana*",
|
|
44
|
+
"otel-logs-*",
|
|
45
|
+
"*",
|
|
46
|
+
]
|
|
47
|
+
return [p for p in common_patterns if p.startswith(incomplete)]
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
def complete_time_field(incomplete: str) -> list[str]:
|
|
51
|
+
"""Provide common time field suggestions.
|
|
52
|
+
|
|
53
|
+
Args:
|
|
54
|
+
incomplete: The partial input to complete
|
|
55
|
+
|
|
56
|
+
Returns:
|
|
57
|
+
List of matching time field names
|
|
58
|
+
"""
|
|
59
|
+
common_fields = [
|
|
60
|
+
"@timestamp",
|
|
61
|
+
"timestamp",
|
|
62
|
+
"time",
|
|
63
|
+
"created_at",
|
|
64
|
+
"updated_at",
|
|
65
|
+
"event.created",
|
|
66
|
+
"event_time",
|
|
67
|
+
]
|
|
68
|
+
return [f for f in common_fields if f.startswith(incomplete)]
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
def complete_project(incomplete: str) -> list[str]:
|
|
72
|
+
"""Provide VDS project name suggestions.
|
|
73
|
+
|
|
74
|
+
Args:
|
|
75
|
+
incomplete: The partial input to complete
|
|
76
|
+
|
|
77
|
+
Returns:
|
|
78
|
+
List of matching project names
|
|
79
|
+
"""
|
|
80
|
+
projects = [
|
|
81
|
+
"lep",
|
|
82
|
+
"insurance",
|
|
83
|
+
"saving",
|
|
84
|
+
"ekyc",
|
|
85
|
+
]
|
|
86
|
+
return [p for p in projects if p.startswith(incomplete.lower())]
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
def complete_server(incomplete: str) -> list[str]:
|
|
90
|
+
"""Provide Confluence server suggestions.
|
|
91
|
+
|
|
92
|
+
Args:
|
|
93
|
+
incomplete: The partial input to complete
|
|
94
|
+
|
|
95
|
+
Returns:
|
|
96
|
+
List of matching server names
|
|
97
|
+
"""
|
|
98
|
+
servers = [
|
|
99
|
+
"internal",
|
|
100
|
+
"external",
|
|
101
|
+
]
|
|
102
|
+
return [s for s in servers if s.startswith(incomplete.lower())]
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
def complete_output_format(incomplete: str) -> list[str]:
|
|
106
|
+
"""Provide output format suggestions.
|
|
107
|
+
|
|
108
|
+
Args:
|
|
109
|
+
incomplete: The partial input to complete
|
|
110
|
+
|
|
111
|
+
Returns:
|
|
112
|
+
List of matching output formats
|
|
113
|
+
"""
|
|
114
|
+
formats = [
|
|
115
|
+
"json",
|
|
116
|
+
"table",
|
|
117
|
+
"csv",
|
|
118
|
+
"yaml",
|
|
119
|
+
]
|
|
120
|
+
return [f for f in formats if f.startswith(incomplete.lower())]
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
def complete_log_level(incomplete: str) -> list[str]:
|
|
124
|
+
"""Provide log level suggestions.
|
|
125
|
+
|
|
126
|
+
Args:
|
|
127
|
+
incomplete: The partial input to complete
|
|
128
|
+
|
|
129
|
+
Returns:
|
|
130
|
+
List of matching log levels
|
|
131
|
+
"""
|
|
132
|
+
levels = [
|
|
133
|
+
"DEBUG",
|
|
134
|
+
"INFO",
|
|
135
|
+
"WARNING",
|
|
136
|
+
"ERROR",
|
|
137
|
+
"CRITICAL",
|
|
138
|
+
]
|
|
139
|
+
return [lvl for lvl in levels if lvl.startswith(incomplete.upper())]
|
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
"""CLI Context for unified state management across VDS CLIs.
|
|
2
|
+
|
|
3
|
+
This module provides CLIContext, a dataclass that handles:
|
|
4
|
+
- TTY detection for adaptive output
|
|
5
|
+
- Color control (flags, env vars, TTY detection)
|
|
6
|
+
- Quiet mode for suppressing non-essential output
|
|
7
|
+
- JSON-only mode for machine-readable output
|
|
8
|
+
|
|
9
|
+
Usage:
|
|
10
|
+
@app.callback()
|
|
11
|
+
def callback(
|
|
12
|
+
ctx: typer.Context,
|
|
13
|
+
json_only: bool = typer.Option(False, "--json-only", "-j"),
|
|
14
|
+
quiet: bool = typer.Option(False, "--quiet", "-q"),
|
|
15
|
+
no_color: bool = typer.Option(False, "--no-color"),
|
|
16
|
+
color: bool = typer.Option(False, "--color"),
|
|
17
|
+
):
|
|
18
|
+
cli_ctx = CLIContext.from_options(
|
|
19
|
+
json_only=json_only,
|
|
20
|
+
quiet=quiet,
|
|
21
|
+
no_color=no_color,
|
|
22
|
+
force_color=color,
|
|
23
|
+
)
|
|
24
|
+
ctx.obj = {"cli_ctx": cli_ctx}
|
|
25
|
+
"""
|
|
26
|
+
|
|
27
|
+
from __future__ import annotations
|
|
28
|
+
|
|
29
|
+
import os
|
|
30
|
+
import sys
|
|
31
|
+
from dataclasses import dataclass, field
|
|
32
|
+
from typing import TYPE_CHECKING
|
|
33
|
+
|
|
34
|
+
if TYPE_CHECKING:
|
|
35
|
+
import typer
|
|
36
|
+
from rich.console import Console
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
@dataclass
|
|
40
|
+
class CLIContext:
|
|
41
|
+
"""Unified CLI context for all VDS orchestrator CLIs.
|
|
42
|
+
|
|
43
|
+
Handles TTY detection, color preferences, output mode, and quiet mode
|
|
44
|
+
consistently across all CLIs.
|
|
45
|
+
|
|
46
|
+
Attributes:
|
|
47
|
+
json_only: Output clean JSON only (existing behavior)
|
|
48
|
+
structured_logs: Emit JSON logs to stderr
|
|
49
|
+
is_tty: Whether stdout is an interactive terminal
|
|
50
|
+
no_color: Disable colors explicitly
|
|
51
|
+
force_color: Force colors even in non-TTY
|
|
52
|
+
quiet: Suppress progress and non-essential output
|
|
53
|
+
no_input: Disable interactive prompts
|
|
54
|
+
"""
|
|
55
|
+
|
|
56
|
+
# Core flags
|
|
57
|
+
json_only: bool = False
|
|
58
|
+
quiet: bool = False
|
|
59
|
+
structured_logs: bool = False
|
|
60
|
+
no_input: bool = False
|
|
61
|
+
|
|
62
|
+
# Color control
|
|
63
|
+
no_color: bool = False
|
|
64
|
+
force_color: bool = False
|
|
65
|
+
|
|
66
|
+
# Computed properties (set during initialization)
|
|
67
|
+
_is_tty: bool = field(default=False, init=False)
|
|
68
|
+
_console: Console | None = field(default=None, init=False, repr=False)
|
|
69
|
+
_err_console: Console | None = field(default=None, init=False, repr=False)
|
|
70
|
+
|
|
71
|
+
def __post_init__(self) -> None:
|
|
72
|
+
"""Detect TTY after initialization."""
|
|
73
|
+
self._is_tty = sys.stdout.isatty()
|
|
74
|
+
|
|
75
|
+
@classmethod
|
|
76
|
+
def from_options(
|
|
77
|
+
cls,
|
|
78
|
+
*,
|
|
79
|
+
json_only: bool = False,
|
|
80
|
+
quiet: bool = False,
|
|
81
|
+
structured_logs: bool = False,
|
|
82
|
+
no_input: bool = False,
|
|
83
|
+
no_color: bool = False,
|
|
84
|
+
force_color: bool = False,
|
|
85
|
+
) -> CLIContext:
|
|
86
|
+
"""Factory method to create CLIContext from CLI options."""
|
|
87
|
+
return cls(
|
|
88
|
+
json_only=json_only,
|
|
89
|
+
quiet=quiet,
|
|
90
|
+
structured_logs=structured_logs,
|
|
91
|
+
no_input=no_input,
|
|
92
|
+
no_color=no_color,
|
|
93
|
+
force_color=force_color,
|
|
94
|
+
)
|
|
95
|
+
|
|
96
|
+
@classmethod
|
|
97
|
+
def from_typer_context(cls, ctx: typer.Context) -> CLIContext: # type: ignore[name-defined]
|
|
98
|
+
"""Get CLIContext from Typer context, or create default.
|
|
99
|
+
|
|
100
|
+
Args:
|
|
101
|
+
ctx: Typer context object
|
|
102
|
+
|
|
103
|
+
Returns:
|
|
104
|
+
CLIContext from ctx.obj if available, else default CLIContext
|
|
105
|
+
"""
|
|
106
|
+
if ctx.obj is not None:
|
|
107
|
+
if isinstance(ctx.obj, CLIContext):
|
|
108
|
+
return ctx.obj
|
|
109
|
+
if isinstance(ctx.obj, dict) and "cli_ctx" in ctx.obj:
|
|
110
|
+
cli_ctx = ctx.obj["cli_ctx"]
|
|
111
|
+
if isinstance(cli_ctx, CLIContext):
|
|
112
|
+
return cli_ctx
|
|
113
|
+
return cls()
|
|
114
|
+
|
|
115
|
+
@property
|
|
116
|
+
def is_tty(self) -> bool:
|
|
117
|
+
"""Whether stdout is an interactive terminal."""
|
|
118
|
+
return self._is_tty
|
|
119
|
+
|
|
120
|
+
@property
|
|
121
|
+
def use_color(self) -> bool:
|
|
122
|
+
"""Determine if colors should be used.
|
|
123
|
+
|
|
124
|
+
Precedence (highest to lowest):
|
|
125
|
+
1. --no-color flag (disables)
|
|
126
|
+
2. --color flag (enables)
|
|
127
|
+
3. FORCE_COLOR env var (enables)
|
|
128
|
+
4. NO_COLOR env var (disables)
|
|
129
|
+
5. TTY detection (enables if TTY)
|
|
130
|
+
6. json_only mode (disables)
|
|
131
|
+
"""
|
|
132
|
+
# json_only always disables color
|
|
133
|
+
if self.json_only:
|
|
134
|
+
return False
|
|
135
|
+
|
|
136
|
+
# CLI flags have highest precedence
|
|
137
|
+
if self.no_color:
|
|
138
|
+
return False
|
|
139
|
+
if self.force_color:
|
|
140
|
+
return True
|
|
141
|
+
|
|
142
|
+
# Environment variables
|
|
143
|
+
if os.environ.get("FORCE_COLOR"):
|
|
144
|
+
return True
|
|
145
|
+
if os.environ.get("NO_COLOR"):
|
|
146
|
+
return False
|
|
147
|
+
|
|
148
|
+
# Default to TTY detection
|
|
149
|
+
return self._is_tty
|
|
150
|
+
|
|
151
|
+
@property
|
|
152
|
+
def use_rich_output(self) -> bool:
|
|
153
|
+
"""Whether to use Rich formatting (tables, panels, etc).
|
|
154
|
+
|
|
155
|
+
Disabled when:
|
|
156
|
+
- json_only mode is active
|
|
157
|
+
- stdout is not a TTY (piped output)
|
|
158
|
+
"""
|
|
159
|
+
if self.json_only:
|
|
160
|
+
return False
|
|
161
|
+
return self._is_tty
|
|
162
|
+
|
|
163
|
+
@property
|
|
164
|
+
def use_spinner(self) -> bool:
|
|
165
|
+
"""Whether to show spinners for long operations."""
|
|
166
|
+
return self.use_rich_output and not self.quiet
|
|
167
|
+
|
|
168
|
+
@property
|
|
169
|
+
def use_progress(self) -> bool:
|
|
170
|
+
"""Whether to show progress bars for batch operations."""
|
|
171
|
+
return self.use_rich_output and not self.quiet
|
|
172
|
+
|
|
173
|
+
@property
|
|
174
|
+
def show_hints(self) -> bool:
|
|
175
|
+
"""Whether to show hints and suggestions."""
|
|
176
|
+
return not self.json_only and not self.quiet
|
|
177
|
+
|
|
178
|
+
@property
|
|
179
|
+
def console(self) -> Console:
|
|
180
|
+
"""Get the stdout console with appropriate settings."""
|
|
181
|
+
if self._console is None:
|
|
182
|
+
from rich.console import Console
|
|
183
|
+
|
|
184
|
+
self._console = Console(
|
|
185
|
+
force_terminal=self.force_color if self.force_color else None,
|
|
186
|
+
no_color=not self.use_color,
|
|
187
|
+
)
|
|
188
|
+
return self._console
|
|
189
|
+
|
|
190
|
+
@property
|
|
191
|
+
def err_console(self) -> Console:
|
|
192
|
+
"""Get the stderr console with appropriate settings."""
|
|
193
|
+
if self._err_console is None:
|
|
194
|
+
from rich.console import Console
|
|
195
|
+
|
|
196
|
+
self._err_console = Console(
|
|
197
|
+
stderr=True,
|
|
198
|
+
force_terminal=self.force_color if self.force_color else None,
|
|
199
|
+
no_color=not self.use_color,
|
|
200
|
+
)
|
|
201
|
+
return self._err_console
|