Skip to content

Commit eedf5b5

Browse files
authored
Merge pull request #45 from comfygit-ai/dev
Release v0.3.20
2 parents b8209fc + f8a375a commit eedf5b5

41 files changed

Lines changed: 2737 additions & 415 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.beads/last-touched

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
cg-2n3
1+
cg-pbu

AGENTS.md

Lines changed: 185 additions & 85 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,16 @@
1+
<!-- NOTE: This file must stay in sync with CLAUDE.md. If you update one, update the other. -->
2+
13
## Project Overview
24

3-
ComfyGit is a monorepo workspace using uv for Python package management. It provides unified environment management for ComfyUI through multiple coordinated packages.
5+
ComfyGit is a monorepo workspace using uv for Python package management. It provides unified environment management for ComfyUI through multiple coordinated packages. Licensed under GPL-3.0.
6+
7+
### Packages
8+
9+
| Package | PyPI Name | CLI Commands | Description |
10+
|---------|-----------|--------------|-------------|
11+
| `packages/core/` | comfygit-core || Core library for environment management |
12+
| `packages/cli/` | comfygit | `comfygit`, `cg` | Main CLI |
13+
| `packages/deploy/` | comfygit-deploy | `cg-deploy` | Remote deployment |
414

515
### Codebase Navigation
616

@@ -27,136 +37,226 @@ pyast deps "Environment.sync" packages/core/src/comfygit_core/core/environment.p
2737
- `packages/core/src/comfygit_core/utils/` - git, filesystem, retry, parsing helpers
2838
- `packages/core/src/comfygit_core/services/` - downloads, lookups, registry
2939

30-
## Version Management
40+
## CLI Reference
3141

32-
All packages use **lockstep versioning** - same version number, always.
42+
### Global Commands
43+
```bash
44+
cg init # Initialize workspace
45+
cg list # List all environments
46+
cg update # Upgrade ComfyGit CLI to latest version
47+
cg update --check # Check for updates without upgrading
48+
cg import <source> # Import environment from tarball or git URL
49+
cg export # Export environment
50+
cg config # Manage configuration settings
51+
cg completion # Manage shell tab completion
52+
```
3353

54+
### Environment Lifecycle
3455
```bash
35-
make show-versions # Check current versions
36-
make bump-version VERSION=0.4.0 # Bump all packages
37-
make check-versions # CI validation
56+
cg create <name> # Create new environment
57+
cg use <name> # Set active environment
58+
cg delete <name> # Delete environment
59+
cg -e <name> run # Run ComfyUI
60+
cg -e <name> run --no-sync # Run without syncing first
61+
cg -e <name> run -- --port 8189 # Pass args to ComfyUI via --
62+
cg -e <name> status # Show sync + git status
63+
cg -e <name> manifest # Show pyproject.toml contents
64+
cg -e <name> sync # Sync packages and dependencies
65+
cg -e <name> repair # Repair environment to match pyproject
66+
cg -e <name> doctor # Diagnose and repair uv tooling
67+
cg -e <name> doctor --check-only # Check only, don't repair
3868
```
3969

40-
Publishing is automated via `.github/workflows/publish.yml` - push version bump to main and the workflow handles PyPI publishing and GitHub releases.
70+
### Node Management
71+
```bash
72+
cg -e <name> node add <id> # Add node (registry ID, GitHub URL, or local dir)
73+
cg -e <name> node add <id> --dev # Track existing local development node
74+
cg -e <name> node add <id> --strict # Fail on dependency conflicts
75+
cg -e <name> node remove <id> # Remove node
76+
cg -e <name> node update <id> # Update node to latest
77+
cg -e <name> node list # List installed nodes
78+
```
4179

42-
## Development Commands
80+
### Python Dependencies
81+
```bash
82+
cg -e <name> py add <packages> # Add Python dependencies
83+
cg -e <name> py add <pkg> --no-build-isolation # For CUDA packages needing PyTorch at build time
84+
cg -e <name> py add <pkg> --optional <extra> # Add to optional dependency group
85+
cg -e <name> py add <pkg> --group <group> # Add to dependency group
86+
cg -e <name> py add <pkg> --dev # Add to dev dependencies
87+
cg -e <name> py add <pkg> --editable # Install as editable
88+
cg -e <name> py add -r requirements.txt # Add from requirements file
89+
cg -e <name> py remove <packages> # Remove dependencies
90+
cg -e <name> py remove-group <group> # Remove entire dependency group
91+
cg -e <name> py list # List dependencies
92+
cg -e <name> py uv <args> # Direct UV passthrough (advanced)
93+
```
4394

95+
### Git Operations
4496
```bash
45-
make install # Install all packages in dev mode
46-
make dev # Start dev environment
47-
make test # Run all tests
48-
make lint # Run linting
97+
cg -e <name> commit -m "message" # Commit environment changes
98+
cg -e <name> log # Show commit history
99+
cg -e <name> branch # List/create/delete branches
100+
cg -e <name> switch <branch> # Switch branches
101+
cg -e <name> checkout <ref> # Checkout commits/branches/files
102+
cg -e <name> pull # Pull and repair environment
103+
cg -e <name> push # Push to remote
104+
cg -e <name> remote # Manage git remotes
105+
cg -e <name> merge <branch> # Merge branch
106+
cg -e <name> reset # Reset HEAD
107+
cg -e <name> revert # Revert a commit
49108
```
50109

51-
**Python commands:** Use `uv run` for running Python scripts and tools (e.g., `uv run docs/comfygit-docs/scripts/generate_cli_reference.py`). Avoid calling `python` directly.
110+
### Environment Configuration
111+
```bash
112+
# PyTorch backend (machine-specific, gitignored)
113+
cg -e <name> env-config torch-backend show # Show current backend
114+
cg -e <name> env-config torch-backend set <be> # Set backend (cu128, cpu, etc.)
115+
cg -e <name> env-config torch-backend detect # Auto-detect recommended backend
116+
117+
# Local UV source overrides (machine-specific, gitignored)
118+
cg -e <name> env-config local-sources show # Show local overrides
119+
cg -e <name> env-config local-sources add <pkg> --path /path --editable # Add local source
120+
cg -e <name> env-config local-sources remove <pkg> # Remove local source
121+
122+
# Default sync extras
123+
cg -e <name> env-config extras show # Show default extras
124+
cg -e <name> env-config extras add <extra> # Add default extra for sync
125+
cg -e <name> env-config extras remove <extra> # Remove default extra
126+
```
52127

53-
Cross-platform testing: `uv run dev/scripts/cross-platform-test.py` (see `dev/cross-platform-test.toml` for config).
128+
### Optional Extras (one-time flags)
129+
```bash
130+
cg -e <name> sync --extra <extra> # Sync with optional extra
131+
cg -e <name> sync --all-extras # Sync with all extras
132+
cg -e <name> run --extra <extra> # Run with optional extra
133+
cg -e <name> run --all-extras # Run with all extras
134+
cg -e <name> node add <id> --extra <e> # Install node with optional extra
135+
```
54136

55-
## Running Tests
137+
### PyTorch Backend Override (one-time)
138+
```bash
139+
cg -e <name> sync --torch-backend cu128 # Override for this sync only
140+
cg -e <name> run --torch-backend cpu # Override for this run only
141+
# Valid backends: cpu, cu124, cu126, cu128, rocm6.3, xpu
142+
```
56143

57-
**IMPORTANT:** Always use `uv run pytest`, never bare `pytest`. The project uses uv for dependency management and pytest is only available through the virtual environment.
144+
### Manager (comfygit-manager custom node)
145+
```bash
146+
cg -e <name> manager status # Show manager version and update availability
147+
cg -e <name> manager update # Update or migrate comfygit-manager
148+
```
58149

150+
### Other
59151
```bash
60-
# From repo root - run all tests
61-
uv run pytest packages/core/tests/ -v
152+
cg -e <name> workflow list # List tracked workflows
153+
cg -e <name> constraint # Manage UV constraint dependencies
154+
cg -e <name> model # Manage model index
155+
cg -e <name> metadata # Manage environment metadata
156+
cg registry # Manage node registry cache
157+
cg orch # Monitor/control orchestrator
158+
cg debug # Show debug logs
159+
```
160+
161+
## Machine-Specific Dependency Injection
62162

63-
# Run specific test file
64-
uv run pytest packages/core/tests/unit/managers/test_pyproject_manager.py -v
163+
ComfyGit keeps environments portable by separating machine-specific config from the tracked `pyproject.toml`. Two gitignored files handle this:
65164

66-
# Run specific test class or function
67-
uv run pytest packages/core/tests/unit/managers/test_pyproject_manager.py::TestStripLocalPathSources -v
165+
### `.pytorch-backend`
166+
Auto-detected per machine. Stores the PyTorch CUDA backend (e.g., `cu128`, `cpu`) and exact wheel versions. On import/create, ComfyGit probes the local GPU and writes this file. During sync, the PyTorch config is temporarily injected into pyproject.toml, resolved by UV, then removed.
68167

69-
# Run tests matching a pattern
70-
uv run pytest packages/core/tests/ -k "injection" -v
168+
### `.local-uv-config`
169+
Machine-specific TOML file for overriding package sources, adding custom indexes, or pinning constraint dependencies. Managed via `cg env-config local-sources`. Contents are injected at sync time but never committed.
71170

72-
# Quick run (no verbose)
73-
uv run pytest packages/core/tests/unit/managers/test_local_uv_config_manager.py -q
171+
```toml
172+
# Example: Use local editable build of sageattention
173+
[sources]
174+
sageattention = { path = "/home/user/SageAttention", editable = true }
175+
176+
# Example: Custom package index
177+
[[index]]
178+
name = "corp"
179+
url = "https://pypi.corp/simple/"
74180
```
75181

76-
**Test locations:**
77-
- `packages/core/tests/unit/` - Unit tests for core library
78-
- `packages/core/tests/integration/` - Integration tests
79-
- `packages/cli/tests/` - CLI tests
80-
- `packages/deploy/tests/` - Deploy tests
182+
### Update Notice System
183+
Background PyPI check runs on every CLI invocation. If a newer version exists, a one-line notice is printed to stderr. Cached in `~/.config/comfygit/update_state.json` with 24h recheck window. Disable with `COMFYGIT_NO_UPDATE_CHECK=1`.
81184

82-
## Validation
185+
### Environment Name Validation
186+
Names must be 1-64 chars, alphanumeric + hyphens/underscores, no leading/trailing hyphens. Applied at create and import time.
187+
188+
## Version Management
83189

84-
Use `/validate` after features or fixes that change observable behavior. The skill covers quick checks against the shared workspace and full validation with disposable workspaces via `dev/scripts/validation-workspace.sh`.
190+
All packages use **lockstep versioning** - same version number, always.
85191

86-
## Important Notes
192+
```bash
193+
make show-versions # Check current versions
194+
make bump-version VERSION=0.4.0 # Bump all packages
195+
make check-versions # CI validation
196+
```
87197

88-
- Both packages must always have the same version (lockstep)
89-
- Never manually edit version numbers - use `make bump-version`
90-
- Code should work across Linux, Windows, and Mac
198+
Publishing is automated via `.github/workflows/publish.yml` - push version bump to main and the workflow handles PyPI publishing and GitHub releases.
91199

92-
## Issue Tracking (Beads)
200+
## Development Commands
201+
202+
```bash
203+
make install / make dev / make test / make lint
204+
```
93205

94-
This project uses beads (`bd`) for issue tracking with the **`cg-`** prefix.
206+
Cross-platform testing: `python dev/scripts/cross-platform-test.py` (config: `dev/cross-platform-test.toml`).
95207

96-
### When to Use Beads
97-
- **Use beads** for multi-session work, work with dependencies, or discovered tasks
98-
- **Skip beads** for simple single-session fixes where tracking adds no value
99-
- When in doubt, prefer beads - persistence you don't need beats lost context
208+
## Running Tests
209+
210+
**Always use `uv run pytest`** (never bare `pytest`).
100211

101-
### Session Workflow
102212
```bash
103-
# 1. Find available work
104-
bd ready # Show unblocked issues
213+
uv run pytest packages/core/tests/ -v # All core tests
214+
uv run pytest packages/core/tests/unit/managers/test_pyproject_manager.py -v # Specific file
215+
uv run pytest packages/core/tests/ -k "injection" -v # Pattern match
216+
```
105217

106-
# 2. Read the issue details
107-
bd show cg-xxx # Full context, acceptance criteria, files to modify
218+
Test locations: `packages/core/tests/{unit,integration}/`, `packages/cli/tests/`, `packages/deploy/tests/`
108219

109-
# 3. Claim the work
110-
bd update cg-xxx --status=in_progress
220+
## Validation
111221

112-
# 4. Implement the task...
222+
Use `/validate` after features or fixes that change observable behavior (uses `dev/scripts/validation-workspace.sh`).
113223

114-
# 5. Close when done
115-
bd close cg-xxx --reason="Implemented in commit abc123"
224+
## Important Notes
116225

117-
# 6. Sync at session end
118-
bd sync
119-
```
226+
- All packages must have the same version (lockstep) — use `make bump-version`
227+
- Code should work across Linux, Windows, and Mac
228+
229+
## Issue Tracking (Beads)
230+
231+
Uses beads (`bd`) with prefix **`cg-`**. Use for multi-session or dependent work; skip for simple single-session fixes.
120232

121-
### Common Commands
122233
```bash
234+
# Workflow: bd ready → bd show cg-xxx → bd update cg-xxx --status=in_progress → implement → bd close cg-xxx --reason="..." → bd sync
123235
bd ready # Show unblocked work
236+
bd show cg-xxx # Full context + acceptance criteria
124237
bd list --status=open # All open issues
125-
bd show cg-xxx # View issue details
126-
bd blocked # Show blocked issues and why
238+
bd create --title="..." --type=bug --priority=2 # Types: task/bug/feature/epic, Priority: 0-4
239+
bd dep add cg-yyy cg-xxx # cg-yyy depends on cg-xxx
240+
bd close cg-xxx cg-yyy # Close one or more
241+
```
127242

128-
# Creating issues
129-
bd create --title="Fix the bug" --type=bug --priority=2
130-
bd create --title="New feature" --type=feature --priority=2
243+
Always run `bd show <id>` before starting work — beads contain implementation context, file lists, and acceptance criteria.
131244

132-
# Priority: 0=critical, 1=high, 2=medium (default), 3=low, 4=backlog
133-
# Types: task, bug, feature, epic
245+
### Commit Convention — Bead References
134246

135-
# Dependencies
136-
bd dep add cg-yyy cg-xxx # cg-yyy depends on cg-xxx (xxx blocks yyy)
247+
**When a commit implements, fixes, or closes a bead, include the bead ID(s) in the commit message.** This creates traceability between git history and issue tracking.
137248

138-
# Closing
139-
bd close cg-xxx # Close single issue
140-
bd close cg-xxx cg-yyy cg-zzz # Close multiple at once
141-
bd close cg-xxx --reason="Done in commit abc" # Close with reason
142-
```
249+
Format: `<description> [<bead-id>]` or `<description> [<bead-id>, <bead-id>]`
143250

144-
### For Epics with Child Tasks
145-
```bash
146-
bd create --title="Big feature" --type=epic
147-
bd create --title="Phase 1" --type=task --parent=cg-xxx
148-
bd create --title="Phase 2" --type=task --parent=cg-xxx
149-
bd dep add cg-xxx.2 cg-xxx.1 # Phase 2 depends on Phase 1
251+
```
252+
Fix cnr_id mapping upgrade flow and add resolver tests [cg-e7u]
253+
Add version-indexed builtins pipeline [crd-5pa, cg-2ih]
254+
Fix builtin extraction for cls constant node IDs [cg-2ih]
150255
```
151256

152-
### Reading Bead Notes
153-
Beads contain detailed implementation context in their notes:
154-
- **Context & Goal** - Why this matters
155-
- **Current vs Target State** - Code before/after with file paths
156-
- **Files Inventory** - What to read/modify/create
157-
- **Acceptance Criteria** - How to verify completion
158-
159-
Always run `bd show <id>` before starting work to get full context.
257+
- Place bead ID(s) at the end of the first line in square brackets
258+
- Use this for commits that directly address bead work — skip for unrelated housekeeping commits
259+
- If a commit fully resolves a bead, also close it with `bd close`
160260

161261
## General
162262

0 commit comments

Comments
 (0)