ComfyUI-Manager/docs/internal/cli_migration
Dr.Lt.Data 43647249cf refactor: remove package-level caching to support dynamic installation
Remove package-level caching in cnr_utils and node_package modules to enable
proper dynamic custom node installation and version switching without ComfyUI
server restarts.

Key Changes:
- Remove @lru_cache decorators from version-sensitive functions
- Remove cached_property from NodePackage for dynamic state updates
- Add comprehensive test suite with parallel execution support
- Implement version switching tests (CNR ↔ Nightly)
- Add case sensitivity integration tests
- Improve error handling and logging

API Priority Rules (manager_core.py:1801):
- Enabled-Priority: Show only enabled version when both exist
- CNR-Priority: Show only CNR when both CNR and Nightly are disabled
- Prevents duplicate package entries in /v2/customnode/installed API
- Cross-match using cnr_id and aux_id for CNR ↔ Nightly detection

Test Infrastructure:
- 8 test files with 59 comprehensive test cases
- Parallel test execution across 5 isolated environments
- Automated test scripts with environment setup
- Configurable timeout (60 minutes default)
- Support for both master and dr-support-pip-cm branches

Bug Fixes:
- Fix COMFYUI_CUSTOM_NODES_PATH environment variable export
- Resolve test fixture regression with module-level variables
- Fix import timing issues in test configuration
- Register pytest integration marker to eliminate warnings
- Fix POSIX compliance in shell scripts (((var++)) → $((var + 1)))

Documentation:
- CNR_VERSION_MANAGEMENT_DESIGN.md v1.0 → v1.1 with API priority rules
- Add test guides and execution documentation (TESTING_PROMPT.md)
- Add security-enhanced installation guide
- Create CLI migration guides and references
- Document package version management

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-08 09:07:09 +09:00
..
CLI_API_REFERENCE.md refactor: remove package-level caching to support dynamic installation 2025-11-08 09:07:09 +09:00
CLI_IMPLEMENTATION_CHECKLIST.md refactor: remove package-level caching to support dynamic installation 2025-11-08 09:07:09 +09:00
CLI_MIGRATION_GUIDE.md refactor: remove package-level caching to support dynamic installation 2025-11-08 09:07:09 +09:00
CLI_TESTING_GUIDE.md refactor: remove package-level caching to support dynamic installation 2025-11-08 09:07:09 +09:00
README.md refactor: remove package-level caching to support dynamic installation 2025-11-08 09:07:09 +09:00

CLI Migration Documentation

Status: Completed (Historical Reference) Last Updated: 2025-11-04 Purpose: Documentation for CLI migration from legacy to glob module (completed August 2025)


📁 Directory Overview

This directory contains consolidated documentation for the ComfyUI Manager CLI migration project. The migration successfully moved the CLI from the legacy module to the glob module without modifying glob module code.


📚 Documentation Files

🎯 Comprehensive Guide

  • CLI_MIGRATION_GUIDE.md (~800 lines)
    • Complete migration guide with all technical details
    • Legacy vs Glob comparison
    • Implementation strategies
    • Code examples and patterns
    • Read this first for complete understanding

📖 Implementation Resources

  • CLI_IMPLEMENTATION_CHECKLIST.md (~350 lines)

    • Step-by-step implementation tasks
    • Daily breakdown (3.5 days)
    • Testing checkpoints
    • Completion criteria
  • CLI_API_REFERENCE.md (~300 lines)

    • Quick API lookup guide
    • UnifiedManager methods
    • InstalledNodePackage structure
    • Usage examples
  • CLI_TESTING_GUIDE.md (~400 lines)

    • Comprehensive testing strategy
    • Test scenarios and cases
    • Validation procedures
    • Rollback planning

🚀 Quick Start (For Reference)

Understanding the Migration

  1. Start Here: CLI_MIGRATION_GUIDE.md

    • Read sections: Overview → Legacy vs Glob → Migration Strategy
  2. API Reference: CLI_API_REFERENCE.md

    • Use for quick API lookups during implementation
  3. Implementation: CLI_IMPLEMENTATION_CHECKLIST.md

    • Follow step-by-step if re-implementing
  4. Testing: CLI_TESTING_GUIDE.md

    • Reference for validation procedures

🎯 Migration Summary

Objective Achieved

Migrated CLI from ..legacy to ..glob imports using only existing glob APIs

Key Accomplishments

  • Single file modified: comfyui_manager/cm_cli/__main__.py
  • No glob modifications: Used existing APIs only
  • All commands functional: install, update, enable, disable, uninstall
  • show_list() rewritten: Adapted to InstalledNodePackage architecture
  • Completed in: 3.5 days as planned

Major Changes

  1. Import path updates (2 lines)
  2. install_node() → use repo_install() for Git URLs
  3. show_list() → rewritten for InstalledNodePackage
  4. Data structure migration: dictionaries → objects
  5. Removed unsupported features (deps-in-workflow)

📋 File Organization

docs/internal/cli_migration/
├── README.md                           (This file - Quick navigation)
├── CLI_MIGRATION_GUIDE.md             (Complete guide - 800 lines)
├── CLI_IMPLEMENTATION_CHECKLIST.md    (Task breakdown - 350 lines)
├── CLI_API_REFERENCE.md               (API docs - 300 lines)
└── CLI_TESTING_GUIDE.md               (Testing guide - 400 lines)

Total: 5 files, ~1,850 lines (consolidated from 9 files, ~2,400 lines)

Documentation Improvements

Before Consolidation (9 files)

  • Duplicate content across multiple files
  • Mixed languages (Korean/English)
  • Unclear hierarchy
  • Fragmented information

After Consolidation (5 files)

  • Single comprehensive guide
  • All English
  • Clear purpose per file
  • Easy navigation
  • No duplication

🔍 Key Constraints (Historical Reference)

Hard Constraints

  • NO modifications to glob module
  • NO legacy dependencies post-migration
  • CLI interface must remain unchanged

Implementation Approach

  • Adapt CLI code to glob architecture
  • Use existing glob APIs only
  • Minimal changes, maximum compatibility

📊 Migration Statistics

Metric Value
Duration 3.5 days
Files Modified 1 (__main__.py)
Lines Changed ~200 lines
glob Modifications 0 (constraint met)
Tests Passing 100%
Features Removed 1 (deps-in-workflow)

🎓 Lessons Learned

What Worked Well

  1. Consolidation First: Understanding all legacy usage before coding
  2. API-First Design: glob's clean API made migration straightforward
  3. Object-Oriented: InstalledNodePackage simplified many operations
  4. No Glob Changes: Constraint forced better CLI design

Challenges Overcome

  1. show_list() Complexity: Rewrote from scratch using new patterns
  2. Dictionary to Object: Required rethinking data access patterns
  3. Async Handling: Wrapped async methods appropriately
  4. Testing Without Mocks: Relied on integration testing

Project Documentation

Package Documentation


🔗 Cross-References

If you need to:


Status: Migration Complete - Documentation Archived for Reference Next Review: When similar migration projects are planned