comfygit 0.2.0__tar.gz

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.
Files changed (64) hide show
  1. comfygit-0.2.0/.github/workflows/publish_pypi.yml +56 -0
  2. comfygit-0.2.0/.gitignore +26 -0
  3. comfygit-0.2.0/.python-version +1 -0
  4. comfygit-0.2.0/CLAUDE.md +181 -0
  5. comfygit-0.2.0/LICENSE.txt +661 -0
  6. comfygit-0.2.0/PKG-INFO +654 -0
  7. comfygit-0.2.0/README.md +644 -0
  8. comfygit-0.2.0/comfygit_cli/__init__.py +12 -0
  9. comfygit-0.2.0/comfygit_cli/__main__.py +6 -0
  10. comfygit-0.2.0/comfygit_cli/cli.py +642 -0
  11. comfygit-0.2.0/comfygit_cli/cli_utils.py +32 -0
  12. comfygit-0.2.0/comfygit_cli/completers.py +239 -0
  13. comfygit-0.2.0/comfygit_cli/completion_commands.py +246 -0
  14. comfygit-0.2.0/comfygit_cli/env_commands.py +2360 -0
  15. comfygit-0.2.0/comfygit_cli/formatters/__init__.py +5 -0
  16. comfygit-0.2.0/comfygit_cli/formatters/error_formatter.py +141 -0
  17. comfygit-0.2.0/comfygit_cli/global_commands.py +1462 -0
  18. comfygit-0.2.0/comfygit_cli/interactive/__init__.py +1 -0
  19. comfygit-0.2.0/comfygit_cli/logging/compressed_handler.py +150 -0
  20. comfygit-0.2.0/comfygit_cli/logging/environment_logger.py +554 -0
  21. comfygit-0.2.0/comfygit_cli/logging/log_compressor.py +101 -0
  22. comfygit-0.2.0/comfygit_cli/logging/logging_config.py +97 -0
  23. comfygit-0.2.0/comfygit_cli/resolution_strategies.py +89 -0
  24. comfygit-0.2.0/comfygit_cli/strategies/__init__.py +1 -0
  25. comfygit-0.2.0/comfygit_cli/strategies/interactive.py +843 -0
  26. comfygit-0.2.0/comfygit_cli/strategies/rollback.py +40 -0
  27. comfygit-0.2.0/comfygit_cli/utils/__init__.py +12 -0
  28. comfygit-0.2.0/comfygit_cli/utils/civitai_errors.py +9 -0
  29. comfygit-0.2.0/comfygit_cli/utils/pagination.py +82 -0
  30. comfygit-0.2.0/comfygit_cli/utils/progress.py +128 -0
  31. comfygit-0.2.0/docs/codebase-map.md +131 -0
  32. comfygit-0.2.0/pyproject.toml +24 -0
  33. comfygit-0.2.0/scripts/README_REGISTRY.md +130 -0
  34. comfygit-0.2.0/scripts/augment_mappings.py +382 -0
  35. comfygit-0.2.0/scripts/build_global_mappings.py +276 -0
  36. comfygit-0.2.0/scripts/build_registry_cache.py +660 -0
  37. comfygit-0.2.0/scripts/extract_builtin_nodes.py +548 -0
  38. comfygit-0.2.0/scripts/extract_node_modules.py +78 -0
  39. comfygit-0.2.0/scripts/get_hash.py +86 -0
  40. comfygit-0.2.0/scripts/global-node-mappings.md +299 -0
  41. comfygit-0.2.0/scripts/registry.py +547 -0
  42. comfygit-0.2.0/scripts/registry_client.py +186 -0
  43. comfygit-0.2.0/scripts/test_concurrent_api.py +318 -0
  44. comfygit-0.2.0/tests/conftest.py +37 -0
  45. comfygit-0.2.0/tests/test_batch_node_add.py +166 -0
  46. comfygit-0.2.0/tests/test_batch_node_remove.py +160 -0
  47. comfygit-0.2.0/tests/test_branch_commands.py +461 -0
  48. comfygit-0.2.0/tests/test_completers.py +438 -0
  49. comfygit-0.2.0/tests/test_completion_commands.py +237 -0
  50. comfygit-0.2.0/tests/test_detached_head_display.py +168 -0
  51. comfygit-0.2.0/tests/test_error_formatter.py +174 -0
  52. comfygit-0.2.0/tests/test_log_command.py +180 -0
  53. comfygit-0.2.0/tests/test_logging_structure.py +199 -0
  54. comfygit-0.2.0/tests/test_manifest_command.py +136 -0
  55. comfygit-0.2.0/tests/test_pagination.py +72 -0
  56. comfygit-0.2.0/tests/test_py_commands.py +803 -0
  57. comfygit-0.2.0/tests/test_py_remove_group_commands.py +141 -0
  58. comfygit-0.2.0/tests/test_status_displays_uninstalled_nodes.py +180 -0
  59. comfygit-0.2.0/tests/test_status_path_sync_display.py +84 -0
  60. comfygit-0.2.0/tests/test_status_real_bug_scenario.py +134 -0
  61. comfygit-0.2.0/tests/test_status_suggestions.py +157 -0
  62. comfygit-0.2.0/tests/test_status_uninstalled_reporting.py +151 -0
  63. comfygit-0.2.0/tests/test_update_workflow_model_paths.py +190 -0
  64. comfygit-0.2.0/tests/test_workflow_model_importance.py +210 -0
@@ -0,0 +1,56 @@
1
+ name: Publish Python Package
2
+
3
+ on:
4
+ workflow_dispatch: # Manual trigger
5
+ push:
6
+ branches: [ main ] # Auto-trigger on push to main
7
+
8
+ jobs:
9
+ publish:
10
+ runs-on: ubuntu-latest
11
+ permissions:
12
+ contents: write # For creating tags
13
+ id-token: write # Required for trusted publishing
14
+
15
+ steps:
16
+ - name: Checkout code
17
+ uses: actions/checkout@v4
18
+
19
+ - name: Install uv
20
+ uses: astral-sh/setup-uv@v5
21
+
22
+ - name: Install dependencies
23
+ run: uv sync
24
+
25
+ - name: Extract package version
26
+ id: version
27
+ run: |
28
+ VERSION=$(grep 'version =' pyproject.toml | sed -n 's/.*version = "\(.*\)"/\1/p')
29
+ echo "Extracted version: $VERSION"
30
+ echo "version=$VERSION" >> $GITHUB_OUTPUT
31
+
32
+ - name: Create and push version tag
33
+ run: |
34
+ git config --global user.name "GitHub Actions"
35
+ git config --global user.email "actions@github.com"
36
+ git tag v${{ steps.version.outputs.version }}
37
+ git push origin v${{ steps.version.outputs.version }}
38
+
39
+ - name: Create GitHub Release
40
+ env:
41
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
42
+ uses: softprops/action-gh-release@v1
43
+ with:
44
+ tag_name: v${{ steps.version.outputs.version }}
45
+ name: Release v${{ steps.version.outputs.version }}
46
+ draft: false
47
+ prerelease: false
48
+ generate_release_notes: true
49
+
50
+ - name: Build package
51
+ run: uv build --no-sources # Build without tool.uv.sources
52
+
53
+ - name: Publish to PyPI
54
+ run: uv publish
55
+ env:
56
+ UV_PUBLISH_TOKEN: ${{ secrets.PYPI_TOKEN }}
@@ -0,0 +1,26 @@
1
+ .venv/
2
+
3
+ *.pyc
4
+
5
+ *.egg-info/
6
+ # Local development environment
7
+ .env*
8
+
9
+ build/*
10
+ dist/
11
+
12
+ *.json.lock
13
+
14
+ Release/*
15
+ # Local development environment
16
+ .env.local
17
+
18
+ config.json
19
+ environments.json
20
+ user.settings.json
21
+ comfydock.log
22
+
23
+ # Docs
24
+ docs/archive
25
+ docs/context
26
+ docs/contexts
@@ -0,0 +1 @@
1
+ 3.10
@@ -0,0 +1,181 @@
1
+ # ComfyDock CLI Package
2
+
3
+ ## Overview
4
+ CLI interface for ComfyDock, providing command-line tools for workspace and environment management.
5
+
6
+ ## Key Documents
7
+ - @docs/codebase-map.md - Architecture and structure
8
+ - @../../CLAUDE.md - Root workspace instructions
9
+ - @../core/CLAUDE.md - Core package guidelines
10
+
11
+ ## Development
12
+
13
+ ### Type Checking
14
+
15
+ **IMPORTANT**: Always run both type checkers before completing implementations to catch IDE issues:
16
+
17
+ ```bash
18
+ # Run mypy (stricter, CI/CD-style checking)
19
+ uv run mypy packages/cli/comfydock_cli/
20
+
21
+ # Run pyright (Pylance/IDE-style checking - catches "possibly unbound" etc.)
22
+ uv run pyright packages/cli/comfydock_cli/
23
+
24
+ # Run both together
25
+ uv run mypy packages/cli/comfydock_cli/ && uv run pyright packages/cli/comfydock_cli/
26
+ ```
27
+
28
+ **Why both?**
29
+ - **mypy**: Catches type correctness issues, used in CI/CD
30
+ - **pyright**: Catches IDE-visible issues (unbound variables, flow analysis), matches VS Code Pylance
31
+
32
+ ### Type Annotation Guidelines
33
+
34
+ 1. **All command handlers**: `def command(self, args: argparse.Namespace) -> None:`
35
+ 2. **Callbacks with logger**: `def command(self, args: argparse.Namespace, logger=None) -> None:`
36
+ 3. **Helper functions**: Add full type annotations including return types
37
+ 4. **Local variables**: Add type hints when pyright complains about inference
38
+ 5. **Dictionary returns**: Use `dict[str, Any]` for heterogeneous dicts
39
+
40
+ ### Common Type Issues
41
+
42
+ **Possibly Unbound Variables**:
43
+ ```python
44
+ # BAD - variable only assigned in conditional
45
+ if not args.yes:
46
+ preview = status.get_sync_preview()
47
+ # ... later use of preview fails
48
+
49
+ # GOOD - assign before conditional
50
+ preview: dict[str, Any] = status.get_sync_preview()
51
+ if not args.yes:
52
+ # use preview
53
+ ```
54
+
55
+ **Return vs Exit**:
56
+ ```python
57
+ # BAD - function declared -> None but returns int
58
+ def command(self, args: argparse.Namespace) -> None:
59
+ return 1 # Error!
60
+
61
+ # GOOD - use sys.exit() or just return
62
+ def command(self, args: argparse.Namespace) -> None:
63
+ sys.exit(1) # or just return (no value)
64
+ ```
65
+
66
+ **Argcomplete Completers**:
67
+ ```python
68
+ # Add type ignore for completer attribute (not in argparse stubs)
69
+ parser.add_argument("name").completer = env_completer # type: ignore[attr-defined]
70
+ ```
71
+
72
+ ## Testing
73
+
74
+ ```bash
75
+ # Run CLI tests
76
+ uv run pytest packages/cli/tests/ -v
77
+
78
+ # Run specific test
79
+ uv run pytest packages/cli/tests/test_status_displays_uninstalled_nodes.py -v
80
+
81
+ # Test with coverage
82
+ uv run pytest packages/cli/tests/ --cov=comfydock_cli
83
+ ```
84
+
85
+ ## Code Style
86
+
87
+ ### Command Handler Pattern
88
+ ```python
89
+ @with_env_logging("command name")
90
+ def command(self, args: argparse.Namespace, logger=None) -> None:
91
+ """Command description."""
92
+ env = self._get_env(args)
93
+
94
+ # Implementation
95
+
96
+ # Use sys.exit() for early returns with error codes
97
+ if error_condition:
98
+ print("✗ Error message")
99
+ sys.exit(1)
100
+
101
+ # Normal completion - just return
102
+ print("✓ Success")
103
+ ```
104
+
105
+ ### Error Handling
106
+ ```python
107
+ try:
108
+ # Operation
109
+ except CDEnvironmentError as e:
110
+ print(f"✗ {e}", file=sys.stderr)
111
+ sys.exit(1)
112
+ except Exception as e:
113
+ if logger:
114
+ logger.error(f"Command failed: {e}", exc_info=True)
115
+ print(f"✗ Error: {e}", file=sys.stderr)
116
+ sys.exit(1)
117
+ ```
118
+
119
+ ## Important Notes
120
+
121
+ - **No print() in core imports**: CLI layer handles all user output
122
+ - **Use sys.exit() not return**: For early exits with error codes
123
+ - **Logging via decorators**: Use `@with_env_logging` for environment commands
124
+ - **Type safety first**: Run pyright before marking work complete
125
+ - **Simple code**: This is pre-customer MVP - avoid over-engineering
126
+
127
+ ## Pre-Commit Checklist
128
+
129
+ Before committing CLI changes:
130
+
131
+ 1. ✅ Run `uv run mypy packages/cli/comfydock_cli/`
132
+ 2. ✅ Run `uv run pyright packages/cli/comfydock_cli/`
133
+ 3. ✅ Run `uv run pytest packages/cli/tests/`
134
+ 4. ✅ Test manually with `uv run cfd <command>`
135
+ 5. ✅ Check no red squiggles in IDE
136
+
137
+ ## Common Commands
138
+
139
+ ```bash
140
+ # Run CLI locally
141
+ uv run cfd --help
142
+
143
+ # Test specific command
144
+ uv run cfd -e test-env status
145
+
146
+ # Install in dev mode
147
+ uv pip install -e packages/cli/
148
+
149
+ # Format code
150
+ uv run ruff format packages/cli/
151
+
152
+ # Lint and fix
153
+ uv run ruff check --fix packages/cli/
154
+ ```
155
+
156
+ ## Dependencies
157
+
158
+ - **comfydock-core**: Core library (DO NOT couple with CLI specifics)
159
+ - **argparse**: Command-line parsing
160
+ - **argcomplete**: Shell tab completion
161
+ - **aiohttp**: Async HTTP for registry operations
162
+
163
+ ## Architecture
164
+
165
+ ```
166
+ comfydock_cli/
167
+ ├── cli.py # Main entry point, argument parsing
168
+ ├── env_commands.py # Environment-scoped commands
169
+ ├── global_commands.py # Workspace-scoped commands
170
+ ├── completers.py # Shell completion logic
171
+ ├── strategies/
172
+ │ └── interactive.py # Interactive resolution strategies
173
+ ├── formatters/
174
+ │ └── error_formatter.py # Error message formatting
175
+ ├── logging/
176
+ │ ├── logging_config.py # Base logging setup
177
+ │ └── environment_logger.py # Environment-specific logging
178
+ └── utils/
179
+ ├── progress.py # Download progress display
180
+ └── pagination.py # Terminal pagination
181
+ ```