comfygit 0.3.1__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.
- comfygit-0.3.1.dist-info/METADATA +654 -0
- comfygit-0.3.1.dist-info/RECORD +30 -0
- comfygit-0.3.1.dist-info/WHEEL +4 -0
- comfygit-0.3.1.dist-info/entry_points.txt +3 -0
- comfygit-0.3.1.dist-info/licenses/LICENSE.txt +661 -0
- comfygit_cli/__init__.py +12 -0
- comfygit_cli/__main__.py +6 -0
- comfygit_cli/cli.py +704 -0
- comfygit_cli/cli_utils.py +32 -0
- comfygit_cli/completers.py +239 -0
- comfygit_cli/completion_commands.py +246 -0
- comfygit_cli/env_commands.py +2701 -0
- comfygit_cli/formatters/__init__.py +5 -0
- comfygit_cli/formatters/error_formatter.py +141 -0
- comfygit_cli/global_commands.py +1806 -0
- comfygit_cli/interactive/__init__.py +1 -0
- comfygit_cli/logging/compressed_handler.py +150 -0
- comfygit_cli/logging/environment_logger.py +554 -0
- comfygit_cli/logging/log_compressor.py +101 -0
- comfygit_cli/logging/logging_config.py +97 -0
- comfygit_cli/resolution_strategies.py +89 -0
- comfygit_cli/strategies/__init__.py +1 -0
- comfygit_cli/strategies/conflict_resolver.py +113 -0
- comfygit_cli/strategies/interactive.py +843 -0
- comfygit_cli/strategies/rollback.py +40 -0
- comfygit_cli/utils/__init__.py +12 -0
- comfygit_cli/utils/civitai_errors.py +9 -0
- comfygit_cli/utils/orchestrator.py +252 -0
- comfygit_cli/utils/pagination.py +82 -0
- comfygit_cli/utils/progress.py +128 -0
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
# formatters/error_formatter.py
|
|
2
|
+
|
|
3
|
+
from comfygit_core.models.exceptions import (
|
|
4
|
+
CDDependencyConflictError,
|
|
5
|
+
CDNodeConflictError,
|
|
6
|
+
CDRegistryDataError,
|
|
7
|
+
NodeAction,
|
|
8
|
+
)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class NodeErrorFormatter:
|
|
12
|
+
"""Formats core library errors for CLI display."""
|
|
13
|
+
|
|
14
|
+
@staticmethod
|
|
15
|
+
def format_registry_error(error: CDRegistryDataError) -> str:
|
|
16
|
+
"""Format registry data error with recovery commands."""
|
|
17
|
+
lines = [str(error)]
|
|
18
|
+
|
|
19
|
+
if error.cache_path:
|
|
20
|
+
lines.append(f" Cache location: {error.cache_path}")
|
|
21
|
+
|
|
22
|
+
if error.can_retry:
|
|
23
|
+
lines.append("\nTo fix this issue:")
|
|
24
|
+
lines.append(" 1. Download registry data:")
|
|
25
|
+
lines.append(" → cg registry update")
|
|
26
|
+
lines.append("")
|
|
27
|
+
lines.append(" 2. Check download status:")
|
|
28
|
+
lines.append(" → cg registry status")
|
|
29
|
+
|
|
30
|
+
return "\n".join(lines)
|
|
31
|
+
|
|
32
|
+
@staticmethod
|
|
33
|
+
def format_node_action(action: NodeAction) -> str:
|
|
34
|
+
"""Convert NodeAction to CLI command string."""
|
|
35
|
+
if action.action_type == 'remove_node':
|
|
36
|
+
return f"cg node remove {action.node_identifier}"
|
|
37
|
+
|
|
38
|
+
elif action.action_type == 'add_node_dev':
|
|
39
|
+
return f"cg node add {action.node_name} --dev"
|
|
40
|
+
|
|
41
|
+
elif action.action_type == 'add_node_force':
|
|
42
|
+
return f"cg node add {action.node_identifier} --force"
|
|
43
|
+
|
|
44
|
+
elif action.action_type == 'add_node_version':
|
|
45
|
+
return f"cg node add {action.node_identifier}"
|
|
46
|
+
|
|
47
|
+
elif action.action_type == 'rename_directory':
|
|
48
|
+
return f"mv custom_nodes/{action.directory_name} custom_nodes/{action.new_name}"
|
|
49
|
+
|
|
50
|
+
elif action.action_type == 'update_node':
|
|
51
|
+
return f"cg node update {action.node_identifier}"
|
|
52
|
+
|
|
53
|
+
elif action.action_type == 'add_constraint':
|
|
54
|
+
return f"cg constraint add \"<package>==<version>\""
|
|
55
|
+
|
|
56
|
+
elif action.action_type == 'skip_node':
|
|
57
|
+
return "# Don't install this node"
|
|
58
|
+
|
|
59
|
+
return f"# Unknown action: {action.action_type}"
|
|
60
|
+
|
|
61
|
+
@staticmethod
|
|
62
|
+
def format_conflict_error(error: CDNodeConflictError) -> str:
|
|
63
|
+
"""Format a conflict error with suggested actions."""
|
|
64
|
+
if not error.context:
|
|
65
|
+
return str(error)
|
|
66
|
+
|
|
67
|
+
lines = [str(error)]
|
|
68
|
+
|
|
69
|
+
# Add context details
|
|
70
|
+
ctx = error.context
|
|
71
|
+
if ctx.local_remote_url:
|
|
72
|
+
lines.append(f" Filesystem: {ctx.local_remote_url}")
|
|
73
|
+
if ctx.expected_remote_url:
|
|
74
|
+
lines.append(f" Registry: {ctx.expected_remote_url}")
|
|
75
|
+
|
|
76
|
+
# Add suggested actions
|
|
77
|
+
if ctx.suggested_actions:
|
|
78
|
+
lines.append("\nSuggested actions:")
|
|
79
|
+
for i, action in enumerate(ctx.suggested_actions, 1):
|
|
80
|
+
cmd = NodeErrorFormatter.format_node_action(action)
|
|
81
|
+
desc = action.description
|
|
82
|
+
lines.append(f" {i}. {desc}")
|
|
83
|
+
lines.append(f" → {cmd}")
|
|
84
|
+
|
|
85
|
+
return "\n".join(lines)
|
|
86
|
+
|
|
87
|
+
@staticmethod
|
|
88
|
+
def format_dependency_conflict_error(error: CDDependencyConflictError, verbose: bool = False) -> str:
|
|
89
|
+
"""Format a dependency conflict error with actionable suggestions.
|
|
90
|
+
|
|
91
|
+
Args:
|
|
92
|
+
error: The dependency conflict error
|
|
93
|
+
verbose: If True, include full UV stderr output
|
|
94
|
+
|
|
95
|
+
Returns:
|
|
96
|
+
Formatted error message
|
|
97
|
+
"""
|
|
98
|
+
if not error.context:
|
|
99
|
+
return str(error)
|
|
100
|
+
|
|
101
|
+
lines = [f"✗ {str(error)}"]
|
|
102
|
+
|
|
103
|
+
ctx = error.context
|
|
104
|
+
|
|
105
|
+
# Show simplified conflict descriptions
|
|
106
|
+
if ctx.conflict_descriptions:
|
|
107
|
+
lines.append("")
|
|
108
|
+
for conflict in ctx.conflict_descriptions[:3]: # Limit to top 3
|
|
109
|
+
lines.append(f" • {conflict}")
|
|
110
|
+
|
|
111
|
+
# Show package pairs if available
|
|
112
|
+
if ctx.conflicting_packages:
|
|
113
|
+
lines.append("")
|
|
114
|
+
lines.append("Conflicting packages:")
|
|
115
|
+
for pkg1, pkg2 in ctx.conflicting_packages[:3]:
|
|
116
|
+
lines.append(f" - {pkg1} ↔ {pkg2}")
|
|
117
|
+
|
|
118
|
+
# Add suggested actions
|
|
119
|
+
if ctx.suggested_actions:
|
|
120
|
+
lines.append("")
|
|
121
|
+
lines.append("Options:")
|
|
122
|
+
for i, action in enumerate(ctx.suggested_actions, 1):
|
|
123
|
+
desc = action.description
|
|
124
|
+
cmd = NodeErrorFormatter.format_node_action(action)
|
|
125
|
+
lines.append(f" {i}. {desc}")
|
|
126
|
+
if action.action_type != 'skip_node': # Skip "don't install" has no command
|
|
127
|
+
lines.append(f" → {cmd}")
|
|
128
|
+
|
|
129
|
+
# Add hints
|
|
130
|
+
lines.append("")
|
|
131
|
+
lines.append("To see full UV error output: Add --verbose flag")
|
|
132
|
+
lines.append("To force installation anyway: Add --no-test flag (not recommended)")
|
|
133
|
+
|
|
134
|
+
# Show full stderr if verbose
|
|
135
|
+
if verbose and ctx.raw_stderr:
|
|
136
|
+
lines.append("")
|
|
137
|
+
lines.append("=== Full UV Error Output ===")
|
|
138
|
+
lines.append(ctx.raw_stderr)
|
|
139
|
+
lines.append("=== End UV Output ===")
|
|
140
|
+
|
|
141
|
+
return "\n".join(lines)
|