Skip to content

Conversation

@jeff-hykin
Copy link
Member

No description provided.

@greptile-apps
Copy link

greptile-apps bot commented Jan 28, 2026

Greptile Overview

Greptile Summary

Refactored the blueprint creation API to use a more object-oriented .create() pattern. The standalone functions create_module_blueprint and _make_module_blueprint have been replaced with classmethod constructors on ModuleBlueprintSet.create and ModuleBlueprint.create respectively.

Key Changes:

  • Moved _make_module_blueprint function logic into ModuleBlueprint.create classmethod
  • Moved create_module_blueprint function logic into ModuleBlueprintSet.create classmethod
  • Updated Module.blueprint property to use the new ModuleBlueprintSet.create API
  • Updated all tests to use the new API
  • Updated documentation to reflect the new usage pattern

This is a clean refactoring that improves API consistency and encapsulation without changing functionality. All usages across the codebase have been properly updated.

Confidence Score: 5/5

  • This PR is safe to merge - it's a clean refactoring with comprehensive test and documentation updates
  • All functionality remains identical, just reorganized into a more object-oriented API. The refactoring is complete across all files (code, tests, and docs), and no usages of the old functions remain in the codebase.
  • No files require special attention

Important Files Changed

Filename Overview
dimos/core/blueprints.py Refactored _make_module_blueprint function into ModuleBlueprint.create classmethod and create_module_blueprint into ModuleBlueprintSet.create - clean API improvement
dimos/core/module.py Updated import and usage from create_module_blueprint to ModuleBlueprintSet.create in the blueprint property
dimos/core/test_blueprints.py Updated tests to use ModuleBlueprint.create instead of _make_module_blueprint, removed import of private function
docs/concepts/blueprints.md Updated documentation examples to use ModuleBlueprintSet.create instead of deprecated create_module_blueprint function

Sequence Diagram

sequenceDiagram
    participant User
    participant Module
    participant ModuleBlueprintSet
    participant ModuleBlueprint
    participant TypeSystem

    User->>Module: Access Module.blueprint property
    Module->>ModuleBlueprintSet: Call ModuleBlueprintSet.create(Module, *args, **kwargs)
    ModuleBlueprintSet->>ModuleBlueprint: Call ModuleBlueprint.create(Module, args, kwargs)
    ModuleBlueprint->>TypeSystem: get_type_hints(module)
    TypeSystem-->>ModuleBlueprint: Return type annotations
    alt Type hints success
        ModuleBlueprint->>ModuleBlueprint: Extract In/Out connections from annotations
    else Type hints failed
        ModuleBlueprint->>Module: Iterate module.__mro__ for __annotations__
        Module-->>ModuleBlueprint: Return raw annotations
        ModuleBlueprint->>ModuleBlueprint: Extract In/Out connections from raw annotations
    end
    ModuleBlueprint->>ModuleBlueprint: Build list of ModuleConnection objects
    ModuleBlueprint-->>ModuleBlueprintSet: Return ModuleBlueprint instance
    ModuleBlueprintSet-->>Module: Return ModuleBlueprintSet with single blueprint
    Module-->>User: Return partial(ModuleBlueprintSet.create, Module)
Loading

Copy link

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No files reviewed, no comments

Edit Code Review Agent Settings | Greptile

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants