py-wlcli 0.8.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.
- py_wlcli-0.8.0.dist-info/METADATA +139 -0
- py_wlcli-0.8.0.dist-info/RECORD +320 -0
- py_wlcli-0.8.0.dist-info/WHEEL +4 -0
- py_wlcli-0.8.0.dist-info/entry_points.txt +2 -0
- py_wlcli-0.8.0.dist-info/licenses/LICENSE +21 -0
- wl_cli/__init__.py +27 -0
- wl_cli/__main__.py +130 -0
- wl_cli/capabilities.py +79 -0
- wl_cli/cc/__init__.py +5 -0
- wl_cli/cc/checks.py +1019 -0
- wl_cli/cc/cli.py +370 -0
- wl_cli/cc/mutate.py +1350 -0
- wl_cli/cli_click.py +156 -0
- wl_cli/commands/__init__.py +84 -0
- wl_cli/commands/base.py +80 -0
- wl_cli/commands/buildcommands/__init__.py +1 -0
- wl_cli/commands/buildcommands/build.py +71 -0
- wl_cli/commands/buildcommands/build_utils.py +47 -0
- wl_cli/commands/buildcommands/builders/__init__.py +18 -0
- wl_cli/commands/buildcommands/builders/cleanup.py +35 -0
- wl_cli/commands/buildcommands/builders/coordinator.py +122 -0
- wl_cli/commands/buildcommands/builders/environment.py +81 -0
- wl_cli/commands/buildcommands/builders/rust_builder.py +39 -0
- wl_cli/commands/buildcommands/builders/stubs.py +58 -0
- wl_cli/commands/buildcommands/dist.py +326 -0
- wl_cli/commands/buildcommands/test.py +89 -0
- wl_cli/commands/clean/__init__.py +1 -0
- wl_cli/commands/clean/build.py +151 -0
- wl_cli/commands/clean/clean.py +294 -0
- wl_cli/commands/clean/clean_utils.py +77 -0
- wl_cli/commands/clean/core.py +236 -0
- wl_cli/commands/clean/dead_code/__init__.py +0 -0
- wl_cli/commands/clean/dead_code/dead_code_command.py +70 -0
- wl_cli/commands/clean/dead_code/detector.py +161 -0
- wl_cli/commands/clean/dead_code/fixer.py +176 -0
- wl_cli/commands/clean/dead_code/reporter.py +295 -0
- wl_cli/commands/clean/dead_code/utils.py +0 -0
- wl_cli/commands/clean/lfs.py +215 -0
- wl_cli/commands/clean/python.py +81 -0
- wl_cli/commands/clean/rust.py +91 -0
- wl_cli/commands/clean/utils/__init__.py +34 -0
- wl_cli/commands/clean/venv.py +91 -0
- wl_cli/commands/cleanup.py +73 -0
- wl_cli/commands/click_base.py +79 -0
- wl_cli/commands/config/__init__.py +1 -0
- wl_cli/commands/config/config.py +291 -0
- wl_cli/commands/debug/__init__.py +6 -0
- wl_cli/commands/debug/debug.py +309 -0
- wl_cli/commands/debug/debug_cache.py +86 -0
- wl_cli/commands/debug/debug_subagent.py +156 -0
- wl_cli/commands/debug/output_formatter.py +165 -0
- wl_cli/commands/debug/source_hasher.py +92 -0
- wl_cli/commands/format/__init__.py +13 -0
- wl_cli/commands/format/format_cache_adapter.py +125 -0
- wl_cli/commands/format/format_command.py +197 -0
- wl_cli/commands/format/format_coordinator.py +191 -0
- wl_cli/commands/format/format_executor.py +470 -0
- wl_cli/commands/format/format_outcome.py +44 -0
- wl_cli/commands/format/format_path_handler.py +1016 -0
- wl_cli/commands/format/format_progress.py +62 -0
- wl_cli/commands/format/format_reporter.py +31 -0
- wl_cli/commands/format/python_formatter.py +506 -0
- wl_cli/commands/format/rust_formatter.py +106 -0
- wl_cli/commands/gate/__init__.py +1 -0
- wl_cli/commands/gate/gate_command.py +862 -0
- wl_cli/commands/gate/preflight.py +445 -0
- wl_cli/commands/git/__init__.py +1 -0
- wl_cli/commands/git/config.py +169 -0
- wl_cli/commands/git/git_facts.py +60 -0
- wl_cli/commands/git/git_flow.py +86 -0
- wl_cli/commands/git/hook.py +112 -0
- wl_cli/commands/git/policy.py +216 -0
- wl_cli/commands/git/push_update.py +82 -0
- wl_cli/commands/initenv/__init__.py +1 -0
- wl_cli/commands/initenv/common/__init__.py +23 -0
- wl_cli/commands/initenv/common/check_git_bash.py +78 -0
- wl_cli/commands/initenv/common/error_handler.py +68 -0
- wl_cli/commands/initenv/common/exceptions.py +52 -0
- wl_cli/commands/initenv/components/__init__.py +4 -0
- wl_cli/commands/initenv/components/cargo_sync.py +240 -0
- wl_cli/commands/initenv/components/config_manager.py +106 -0
- wl_cli/commands/initenv/components/directory_utils.py +71 -0
- wl_cli/commands/initenv/components/git/__init__.py +9 -0
- wl_cli/commands/initenv/components/git/branch_creator.py +143 -0
- wl_cli/commands/initenv/components/git/git_flow_interface.py +24 -0
- wl_cli/commands/initenv/components/git/git_flow_manager.py +159 -0
- wl_cli/commands/initenv/components/git/git_lfs_manager.py +272 -0
- wl_cli/commands/initenv/components/git/git_utility.py +254 -0
- wl_cli/commands/initenv/components/git/gitignore_manager.py +53 -0
- wl_cli/commands/initenv/components/git_initializer.py +212 -0
- wl_cli/commands/initenv/components/i18n_manager.py +104 -0
- wl_cli/commands/initenv/components/log_manager.py +241 -0
- wl_cli/commands/initenv/components/project_structure/__init__.py +23 -0
- wl_cli/commands/initenv/components/project_structure/config_generator.py +360 -0
- wl_cli/commands/initenv/components/project_structure/directory_creator.py +184 -0
- wl_cli/commands/initenv/components/project_structure/hook_source.py +110 -0
- wl_cli/commands/initenv/components/project_structure/hooks_manager.py +995 -0
- wl_cli/commands/initenv/components/project_structure/readme_handler.py +56 -0
- wl_cli/commands/initenv/components/project_structure/rust_files_handler.py +30 -0
- wl_cli/commands/initenv/components/project_structure/setup_handler.py +103 -0
- wl_cli/commands/initenv/components/project_structure/sop_generator.py +73 -0
- wl_cli/commands/initenv/components/project_structure/template_copier.py +104 -0
- wl_cli/commands/initenv/components/project_structure/template_manager.py +195 -0
- wl_cli/commands/initenv/components/pyproject_generator.py +194 -0
- wl_cli/commands/initenv/components/rust_initializer.py +145 -0
- wl_cli/commands/initenv/components/symlink_cleaner.py +99 -0
- wl_cli/commands/initenv/components/symlink_manager.py +52 -0
- wl_cli/commands/initenv/components/venv_manager.py +118 -0
- wl_cli/commands/initenv/initenv.py +169 -0
- wl_cli/commands/initenv/services/__init__.py +11 -0
- wl_cli/commands/initenv/services/environment_initializer.py +288 -0
- wl_cli/commands/initenv/services/git_lfs_initializer.py +26 -0
- wl_cli/commands/initenv/services/project_structure_initializer.py +52 -0
- wl_cli/commands/lfs/README.md +221 -0
- wl_cli/commands/lfs/__init__.py +5 -0
- wl_cli/commands/lfs/cli.py +106 -0
- wl_cli/commands/lfs/config.py +164 -0
- wl_cli/commands/lfs/hook.py +61 -0
- wl_cli/commands/lfs/initializer.py +531 -0
- wl_cli/commands/lfs/manager.py +95 -0
- wl_cli/commands/lfs/policy.py +165 -0
- wl_cli/commands/lfs/watcher.py +294 -0
- wl_cli/commands/lint/__init__.py +1 -0
- wl_cli/commands/lint/lint_command.py +297 -0
- wl_cli/commands/lint/lint_executor.py +409 -0
- wl_cli/commands/lint/lint_reporter.py +579 -0
- wl_cli/commands/lint/lint_run.py +258 -0
- wl_cli/commands/lint/mypy_config.py +90 -0
- wl_cli/commands/registry.py +103 -0
- wl_cli/commands/self/__init__.py +7 -0
- wl_cli/commands/self/common/__init__.py +8 -0
- wl_cli/commands/self/common/capabilities.py +30 -0
- wl_cli/commands/self/common/config.py +27 -0
- wl_cli/commands/self/common/version_cache.py +85 -0
- wl_cli/commands/self/handlers/__init__.py +19 -0
- wl_cli/commands/self/handlers/base_handler.py +28 -0
- wl_cli/commands/self/handlers/install_handler.py +85 -0
- wl_cli/commands/self/handlers/status_handler.py +66 -0
- wl_cli/commands/self/handlers/uninstall_handler.py +58 -0
- wl_cli/commands/self/handlers/update_handler.py +102 -0
- wl_cli/commands/self/handlers/version_handler.py +16 -0
- wl_cli/commands/self/self_command.py +237 -0
- wl_cli/commands/self/services/__init__.py +15 -0
- wl_cli/commands/self/services/installation_manager.py +187 -0
- wl_cli/commands/self/services/local_installer.py +165 -0
- wl_cli/commands/self/services/pypi_updater.py +278 -0
- wl_cli/commands/self/services/windows_update.py +174 -0
- wl_cli/commands/testcommands/__init__.py +8 -0
- wl_cli/commands/testcommands/base_dependency_analyzer.py +198 -0
- wl_cli/commands/testcommands/batch_processor.py +278 -0
- wl_cli/commands/testcommands/cache_manager.py +1156 -0
- wl_cli/commands/testcommands/coverage_analyzer.py +955 -0
- wl_cli/commands/testcommands/coverage_cache_manager.py +183 -0
- wl_cli/commands/testcommands/progress_manager.py +79 -0
- wl_cli/commands/testcommands/python_env_detector.py +207 -0
- wl_cli/commands/testcommands/report_generator.py +101 -0
- wl_cli/commands/testcommands/single_test_executor.py +250 -0
- wl_cli/commands/testcommands/speed_checker.py +118 -0
- wl_cli/commands/testcommands/test_command_builder.py +165 -0
- wl_cli/commands/testcommands/test_commands.py +786 -0
- wl_cli/commands/testcommands/test_reporter.py +181 -0
- wl_cli/commands/testcommands/test_result_handler.py +96 -0
- wl_cli/commands/testcommands/test_runner.py +1343 -0
- wl_cli/commands/testcommands/test_utils.py +197 -0
- wl_cli/commands/testcommands/utils/__init__.py +17 -0
- wl_cli/commands/testcommands/utils/coverage_parser.py +98 -0
- wl_cli/commands/testcommands/utils/env_info.py +36 -0
- wl_cli/commands/testcommands/utils/junit_parser.py +75 -0
- wl_cli/commands/testcommands/utils/markdown_utils.py +20 -0
- wl_cli/commands/testcommands/utils/project_root.py +61 -0
- wl_cli/commands/update/__init__.py +9 -0
- wl_cli/commands/update/services/__init__.py +21 -0
- wl_cli/commands/update/services/backup_manager.py +207 -0
- wl_cli/commands/update/services/component_manager.py +83 -0
- wl_cli/commands/update/services/conflict_resolver.py +189 -0
- wl_cli/commands/update/services/vendors_updater.py +85 -0
- wl_cli/commands/update/services/version_tracker.py +127 -0
- wl_cli/commands/update/update_command.py +270 -0
- wl_cli/commands/update/utils/__init__.py +3 -0
- wl_cli/commands/version/__init__.py +9 -0
- wl_cli/commands/version/version_command.py +155 -0
- wl_cli/commands/workflow.py +477 -0
- wl_cli/env/__init__.py +5 -0
- wl_cli/env/cli.py +167 -0
- wl_cli/env_status.py +157 -0
- wl_cli/envelope.py +91 -0
- wl_cli/exceptions.py +85 -0
- wl_cli/lib/__init__.py +3 -0
- wl_cli/lib/rust_utils.py +35 -0
- wl_cli/mcp/__init__.py +6 -0
- wl_cli/mcp/capabilities.py +19 -0
- wl_cli/mcp/cli.py +22 -0
- wl_cli/mcp/gitlab.py +553 -0
- wl_cli/mcp/k8s.py +344 -0
- wl_cli/mcp/protocol.py +159 -0
- wl_cli/platform.py +139 -0
- wl_cli/quality/__init__.py +18 -0
- wl_cli/utils/__init__.py +7 -0
- wl_cli/utils/cache.py +491 -0
- wl_cli/utils/cache_ledger.py +355 -0
- wl_cli/utils/cache_store.py +546 -0
- wl_cli/utils/config/__init__.py +27 -0
- wl_cli/utils/config/config_loader.py +163 -0
- wl_cli/utils/config/core.py +862 -0
- wl_cli/utils/config/defaults.py +142 -0
- wl_cli/utils/config/env_exporter.py +86 -0
- wl_cli/utils/config/env_parser.py +108 -0
- wl_cli/utils/config/validation.py +280 -0
- wl_cli/utils/error_handler.py +165 -0
- wl_cli/utils/file_copier.py +56 -0
- wl_cli/utils/file_operations.py +506 -0
- wl_cli/utils/language_utils.py +122 -0
- wl_cli/utils/lazy_import.py +240 -0
- wl_cli/utils/log_levels.py +35 -0
- wl_cli/utils/log_rotators.py +74 -0
- wl_cli/utils/logging.py +458 -0
- wl_cli/utils/output_context.py +142 -0
- wl_cli/utils/performance/__init__.py +1 -0
- wl_cli/utils/performance/decorators.py +111 -0
- wl_cli/utils/performance/exporter.py +38 -0
- wl_cli/utils/performance/models.py +16 -0
- wl_cli/utils/performance/monitor.py +161 -0
- wl_cli/utils/performance_monitor.py +32 -0
- wl_cli/utils/platform_adapter.py +131 -0
- wl_cli/utils/pre_commit.py +266 -0
- wl_cli/utils/pre_commit_config.py +72 -0
- wl_cli/utils/root.py +521 -0
- wl_cli/utils/root_fallback.py +256 -0
- wl_cli/utils/run_evidence.py +236 -0
- wl_cli/utils/structured_logger.py +18 -0
- wl_cli/utils/structured_logging/__init__.py +19 -0
- wl_cli/utils/structured_logging/config.py +337 -0
- wl_cli/utils/structured_logging/core.py +177 -0
- wl_cli/utils/structured_logging/env.py +56 -0
- wl_cli/utils/structured_logging/filtering.py +75 -0
- wl_cli/utils/structured_logging/filters.py +55 -0
- wl_cli/utils/structured_logging/formatters.py +251 -0
- wl_cli/utils/structured_logging/handlers.py +308 -0
- wl_cli/utils/structured_logging/logger.py +354 -0
- wl_cli/utils/subprocess.py +71 -0
- wl_cli/utils/subprocess_utils.py +260 -0
- wl_cli/utils/test_utils/__init__.py +5 -0
- wl_cli/utils/test_utils/test_filter.py +36 -0
- wl_cli/utils/uv_run.py +79 -0
- wl_cli/utils/uv_tool.py +117 -0
- wl_cli/utils/uv_tree.py +71 -0
- wl_cli/utils/uv_workspace.py +174 -0
- wl_cli/utils/version/__init__.py +15 -0
- wl_cli/utils/version/pypi_version_checker.py +95 -0
- wl_cli/utils/version/version_comparator.py +133 -0
- wl_cli/utils/version/version_detectors.py +312 -0
- wl_cli/utils/version/version_service.py +131 -0
- wl_cli/utils/version/version_updater.py +198 -0
- wl_cli/utils/wl_dir_updater.py +1440 -0
- wl_cli/utils/workspace_detector/__init__.py +28 -0
- wl_cli/utils/workspace_detector/core.py +161 -0
- wl_cli/utils/workspace_detector/detection_strategies.py +107 -0
- wl_cli/utils/workspace_detector/exceptions.py +5 -0
- wl_cli/utils/workspace_detector/types.py +17 -0
- wl_cli/utils/workspace_detector/venv_resolver.py +84 -0
- wl_cli/vendors/config/.codespellrc +2 -0
- wl_cli/vendors/config/dependencies.toml +10 -0
- wl_cli/vendors/config/mypy.ini +62 -0
- wl_cli/vendors/config/pyproject_defaults.toml +28 -0
- wl_cli/vendors/config/template_config.toml +24 -0
- wl_cli/vendors/config/tool_configs.toml +76 -0
- wl_cli/vendors/git/.gitignore +122 -0
- wl_cli/vendors/git/.pre-commit-config.yaml +37 -0
- wl_cli/vendors/hooks/applypatch-msg.sample +15 -0
- wl_cli/vendors/hooks/commit-msg.sample +24 -0
- wl_cli/vendors/hooks/fsmonitor-watchman.sample +174 -0
- wl_cli/vendors/hooks/post-update.sample +8 -0
- wl_cli/vendors/hooks/pre-applypatch.sample +14 -0
- wl_cli/vendors/hooks/pre-commit +45 -0
- wl_cli/vendors/hooks/pre-commit.legacy +31 -0
- wl_cli/vendors/hooks/pre-commit.sample +49 -0
- wl_cli/vendors/hooks/pre-merge-commit.sample +13 -0
- wl_cli/vendors/hooks/pre-push.sample +60 -0
- wl_cli/vendors/hooks/pre-rebase.sample +169 -0
- wl_cli/vendors/hooks/pre-receive.sample +24 -0
- wl_cli/vendors/hooks/prepare-commit-msg.sample +42 -0
- wl_cli/vendors/hooks/push-to-checkout.sample +78 -0
- wl_cli/vendors/hooks/sendemail-validate.sample +77 -0
- wl_cli/vendors/hooks/unix/applypatch-msg.sample +15 -0
- wl_cli/vendors/hooks/unix/check_lockfile.py +58 -0
- wl_cli/vendors/hooks/unix/check_lockfile.sh +36 -0
- wl_cli/vendors/hooks/unix/commit-msg.sample +24 -0
- wl_cli/vendors/hooks/unix/fsmonitor-watchman.sample +174 -0
- wl_cli/vendors/hooks/unix/post-update.sample +8 -0
- wl_cli/vendors/hooks/unix/pre-applypatch.sample +14 -0
- wl_cli/vendors/hooks/unix/pre-commit +190 -0
- wl_cli/vendors/hooks/unix/pre-commit.legacy +31 -0
- wl_cli/vendors/hooks/unix/pre-commit.py +81 -0
- wl_cli/vendors/hooks/unix/pre-commit.sample +49 -0
- wl_cli/vendors/hooks/unix/pre-merge-commit.sample +13 -0
- wl_cli/vendors/hooks/unix/pre-push +417 -0
- wl_cli/vendors/hooks/unix/pre-push.sample +53 -0
- wl_cli/vendors/hooks/unix/pre-rebase.sample +169 -0
- wl_cli/vendors/hooks/unix/pre-receive.sample +24 -0
- wl_cli/vendors/hooks/unix/prepare-commit-msg.sample +42 -0
- wl_cli/vendors/hooks/update.sample +128 -0
- wl_cli/vendors/hooks/win/work.bat +63 -0
- wl_cli/vendors/project/.gitignore +90 -0
- wl_cli/vendors/project/.python-version +1 -0
- wl_cli/vendors/project/LICENSE +21 -0
- wl_cli/vendors/project/README.md +0 -0
- wl_cli/vendors/project/pyproject.toml +27 -0
- wl_cli/vendors/project/pyproject_no_workspace.toml +16 -0
- wl_cli/vendors/project/pyproject_workspace.toml +14 -0
- wl_cli/vendors/readme/README.md +120 -0
- wl_cli/vendors/rust/Cargo.toml +14 -0
- wl_cli/vendors/rust/lib/__init__.py +3 -0
- wl_cli/vendors/rust/lib/rust_utils.py +31 -0
- wl_cli/vendors/rust/src/lib.rs +13 -0
- wl_cli/vendors/rust/src/main.rs +3 -0
- wl_cli/vendors/rust/tests/test_rust_fallback.py +40 -0
- wl_cli/vendors/sop_doc/git-dev-sop.md +220 -0
- wl_cli/vendors/sop_doc/industrial-standard-sop.md +145 -0
- wl_cli/vendors/sop_doc/python-sop.md +342 -0
- wl_cli/vendors/sop_doc/rust-readme.md +219 -0
wl_cli/__main__.py
ADDED
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
|
|
3
|
+
"""
|
|
4
|
+
Main entry point for WL Commands.
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
import io
|
|
8
|
+
import os
|
|
9
|
+
import sys
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
def _setup_stdio_encoding() -> None:
|
|
13
|
+
"""Ensure stdout/stderr use UTF-8 encoding on Windows.
|
|
14
|
+
|
|
15
|
+
On Windows with Chinese locale (GBK), emoji and other non-ASCII
|
|
16
|
+
characters crash print(). This wraps stdout/stderr with explicit
|
|
17
|
+
UTF-8 encoding so all output works regardless of terminal locale.
|
|
18
|
+
"""
|
|
19
|
+
# Imported here (with a script-execution fallback, matching the cli_click
|
|
20
|
+
# import below) so this module stays runnable as a plain script.
|
|
21
|
+
try:
|
|
22
|
+
from .utils import platform_adapter
|
|
23
|
+
except ImportError: # pragma: no cover - direct script execution
|
|
24
|
+
from wl_cli.utils import platform_adapter # type: ignore[no-redef]
|
|
25
|
+
|
|
26
|
+
if not platform_adapter.PlatformAdapter.is_windows():
|
|
27
|
+
return
|
|
28
|
+
# PYTHONIOENCODING also helps subprocess pipe encoding
|
|
29
|
+
os.environ.setdefault("PYTHONIOENCODING", "utf-8")
|
|
30
|
+
for stream_name in ("stdout", "stderr"):
|
|
31
|
+
stream = getattr(sys, stream_name, None)
|
|
32
|
+
if stream is None:
|
|
33
|
+
continue
|
|
34
|
+
encoding = getattr(stream, "encoding", None)
|
|
35
|
+
if encoding and encoding.upper() not in ("UTF-8", "UTF8"):
|
|
36
|
+
buffer = getattr(stream, "buffer", None)
|
|
37
|
+
if buffer is not None:
|
|
38
|
+
setattr(
|
|
39
|
+
sys,
|
|
40
|
+
stream_name,
|
|
41
|
+
io.TextIOWrapper(
|
|
42
|
+
buffer, encoding="utf-8", errors="replace", line_buffering=True
|
|
43
|
+
),
|
|
44
|
+
)
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
# Fix stdio encoding on Windows before any output
|
|
48
|
+
_setup_stdio_encoding()
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
def check_installation() -> bool:
|
|
52
|
+
"""Check if wl_cli is properly installed.
|
|
53
|
+
|
|
54
|
+
Returns:
|
|
55
|
+
True if installed correctly, False otherwise.
|
|
56
|
+
"""
|
|
57
|
+
try:
|
|
58
|
+
import wl_cli # noqa: F401 # availability probe: import must succeed
|
|
59
|
+
|
|
60
|
+
return True
|
|
61
|
+
except ImportError:
|
|
62
|
+
return False
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
def print_installation_guide() -> None:
|
|
66
|
+
"""Print installation guide when module is not installed."""
|
|
67
|
+
red = "\033[0;31m"
|
|
68
|
+
yellow = "\033[1;33m"
|
|
69
|
+
blue = "\033[0;34m"
|
|
70
|
+
nc = "\033[0m" # No Color
|
|
71
|
+
|
|
72
|
+
print(f"{red}ERROR:{nc} wl_cli is not installed or not properly configured.")
|
|
73
|
+
print()
|
|
74
|
+
print(f"{blue}Installation Guide:{nc}")
|
|
75
|
+
print("-" * 50)
|
|
76
|
+
print()
|
|
77
|
+
print("To automatically install wl_cli, run:")
|
|
78
|
+
print()
|
|
79
|
+
print(f" {yellow}./install-wl-cli.sh{nc}")
|
|
80
|
+
print()
|
|
81
|
+
print("To install a specific version:")
|
|
82
|
+
print()
|
|
83
|
+
print(f" {yellow}./install-wl-cli.sh 0.1.0{nc}")
|
|
84
|
+
print()
|
|
85
|
+
print("If you are in the git repository, this script will:")
|
|
86
|
+
print(" 1. Auto-detect your Python environment")
|
|
87
|
+
print(" 2. Check if wl_cli is already installed")
|
|
88
|
+
print(" 3. Install from local source (development mode)")
|
|
89
|
+
print(" 4. Fallback to PyPI if local installation fails")
|
|
90
|
+
print(" 5. Verify installation after completion")
|
|
91
|
+
print()
|
|
92
|
+
print("After installation completes, you can use 'wl' commands normally.")
|
|
93
|
+
print()
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
# 使用新的Click CLI
|
|
97
|
+
try:
|
|
98
|
+
# Local import to avoid import issues
|
|
99
|
+
from .cli_click import main as cli_main
|
|
100
|
+
except ImportError:
|
|
101
|
+
try:
|
|
102
|
+
# Fallback for cases where relative imports don't work
|
|
103
|
+
from wl_cli.cli_click import main as cli_main # type: ignore[no-redef]
|
|
104
|
+
except ImportError:
|
|
105
|
+
# Module not properly installed
|
|
106
|
+
if not check_installation():
|
|
107
|
+
print_installation_guide()
|
|
108
|
+
sys.exit(1)
|
|
109
|
+
else:
|
|
110
|
+
# Re-raise if installation check passed but import still fails
|
|
111
|
+
raise
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
def main() -> None:
|
|
115
|
+
"""Main entry point for WL Commands.
|
|
116
|
+
|
|
117
|
+
``cli_click.main`` returns the process exit code (0 on success, 1 when a
|
|
118
|
+
command raises), so the entry point must hand that value to the
|
|
119
|
+
interpreter instead of discarding it. Without the ``SystemExit`` every
|
|
120
|
+
``return 1`` path inside ``cli_click.main`` exited 0 (#186).
|
|
121
|
+
"""
|
|
122
|
+
raise SystemExit(cli_main())
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
# Alias for compatibility with tests
|
|
126
|
+
main_entry = main
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
if __name__ == "__main__":
|
|
130
|
+
main()
|
wl_cli/capabilities.py
ADDED
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
"""The shared capability registry for the ``wl`` CLI (issues #270, #221).
|
|
2
|
+
|
|
3
|
+
Capabilities are the stable, dotted names a consumer (wlcc) probes instead of
|
|
4
|
+
grepping ``--help`` for an implementation flag (wlcc ADR-0010, decision 6):
|
|
5
|
+
``test.clean_cache`` says *what wl can do*; ``--clean-cache`` is only how it is
|
|
6
|
+
spelled today. The dotted names are the interface -- treat them as stable.
|
|
7
|
+
|
|
8
|
+
The registry lives in the shared layer rather than under ``wl_cli.env`` or
|
|
9
|
+
``wl_cli.commands`` because two commands in different domains must serve the
|
|
10
|
+
same names: ``wl env check`` (``wl_cli.env``) and the deprecated
|
|
11
|
+
``wl self capabilities`` alias (``wl_cli.commands``). The quality domain may
|
|
12
|
+
not import the env domain (#220), so one shared data owner is the only
|
|
13
|
+
arrangement that does not fork the answer.
|
|
14
|
+
|
|
15
|
+
Adding a capability is a data change here plus an entry in the surface table
|
|
16
|
+
of ``tests/test_self_capabilities_270.py`` proving some CLI surface still
|
|
17
|
+
backs it, so a name cannot outlive its implementation.
|
|
18
|
+
|
|
19
|
+
A domain may keep a domain-local view of its own entries
|
|
20
|
+
(``wl_cli.mcp.capabilities.CAPABILITIES``, #224) derived from this mapping;
|
|
21
|
+
the data itself lives here only, and ``tests/test_capability_registry.py``
|
|
22
|
+
pins that the view cannot drift.
|
|
23
|
+
"""
|
|
24
|
+
|
|
25
|
+
from __future__ import annotations
|
|
26
|
+
|
|
27
|
+
#: Bump only when the payload *shape* changes -- never when a capability is
|
|
28
|
+
#: added. Consumers key off this; adding a capability is backwards compatible.
|
|
29
|
+
SCHEMA_VERSION = 1
|
|
30
|
+
|
|
31
|
+
#: Capability name -> first release that ships its implementation. Adding an
|
|
32
|
+
#: entry is a data change; ``since`` must never be newer than the release this
|
|
33
|
+
#: data ships in (the release bump happens outside this change).
|
|
34
|
+
CAPABILITY_SINCE: dict[str, str] = {
|
|
35
|
+
"cc.check": "0.8.0",
|
|
36
|
+
"cc.hooks": "0.8.0",
|
|
37
|
+
"cc.init": "0.8.0",
|
|
38
|
+
"cc.mcp": "0.8.0",
|
|
39
|
+
"cc.plugins": "0.8.0",
|
|
40
|
+
"cc.repair": "0.8.0",
|
|
41
|
+
"cc.settings": "0.8.0",
|
|
42
|
+
"cc.stamps": "0.8.0",
|
|
43
|
+
"cc.statusline": "0.8.0",
|
|
44
|
+
"cc.upgrade": "0.8.0",
|
|
45
|
+
"env.check": "0.8.0",
|
|
46
|
+
"env.repair": "0.8.0",
|
|
47
|
+
"mcp.gitlab": "0.8.0",
|
|
48
|
+
"mcp.k8s": "0.8.0",
|
|
49
|
+
"test.clean_cache": "0.7.0",
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
#: The advertised names, sorted for stable output. Derived from the mapping so
|
|
53
|
+
#: there is exactly one source of truth.
|
|
54
|
+
CAPABILITIES: tuple[str, ...] = tuple(sorted(CAPABILITY_SINCE))
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
def capability_names() -> list[str]:
|
|
58
|
+
"""Return the advertised capability names, sorted for stable output."""
|
|
59
|
+
return list(CAPABILITIES)
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
def capability_details() -> list[dict[str, str]]:
|
|
63
|
+
"""Return ``[{"name": ..., "since": ...}, ...]`` in sorted-name order."""
|
|
64
|
+
return [{"name": name, "since": CAPABILITY_SINCE[name]} for name in CAPABILITIES]
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
def capability_since() -> dict[str, str]:
|
|
68
|
+
"""Return ``{name: since}`` in sorted-name order."""
|
|
69
|
+
return {name: CAPABILITY_SINCE[name] for name in CAPABILITIES}
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
def capabilities_payload() -> dict[str, object]:
|
|
73
|
+
"""Return the legacy ``wl self capabilities --json`` payload (#270).
|
|
74
|
+
|
|
75
|
+
``wl self capabilities`` is a deprecated alias since #221 and emits the
|
|
76
|
+
``wl env check`` envelope instead, but the old shape stays importable so a
|
|
77
|
+
library consumer does not break in the same release that deprecates it.
|
|
78
|
+
"""
|
|
79
|
+
return {"schema": SCHEMA_VERSION, "capabilities": capability_names()}
|