Component Creator¶
Component Creator — mvp.component_creator
Cluster: Core Infrastructure | Type: component | MCP Tools: 34
Overview¶
Code-generation engine that scaffolds fully-formed G6 components from a declarative spec. Given a name and a list of operations it produces the complete file tree — __init__.py, schema.py, Tier 1 block, MCP sub-package with 25 operations, SQLite store, skill directory, and test suite — returning each file as an in-memory FileEntry without touching disk. An inspector sub-module analyses existing components for convention gaps and import hygiene.
When to use:
- Bootstrapping a new component so all conventions and boilerplate are correct from day one
- Auditing an existing component for missing files, bad exports, or non-standard skill structure
- Programmatically generating component variants from a pipeline or agent workflow
Launch caveat: Component Creator is a scaffolding and internal acceleration tool, not a standalone business-logic generator for non-technical end users. It creates consistent, importable component skeletons and MCP packaging, but the generated component still needs human review, domain implementation, tests, and release approval before it should be treated as production functionality. For the current launch plan, use it behind guided workflows or founder/engineering tooling rather than marketing it as a direct vibe-coder feature.
Reliability contract: MCP outputs include the G6 creator envelope (completion_state, warning_card, evidence, request_id, task_id, run_id) while preserving legacy degraded and degradation_reason. Scaffold outputs are explicitly scaffold_only=True, semantic_completeness="scaffold_only", and completion_state="qualified-draft"; they are not domain-complete components. Mutating filesystem operations use path containment, dry-run reporting, and production write gates, with blocked gates surfaced as blocked-escalated and stable G6_E_* codes.
Example:
from mvp.component_creator import ComponentCreatorBlock, CreatorInput, ComponentSpec
block = ComponentCreatorBlock(name="component_creator")
result = block.infer(CreatorInput(
operation="scaffold_component",
spec=ComponentSpec(name="adapt_opencv", description="OpenCV vision adapter", prefix="adapt_"),
))
# result.ok → True; result.value.files → list[FileEntry] ready to write
Works well with: meta_programming, align_specs, workspace_manager
Public API¶
ComponentCreatorBlock(AIBlock[CreatorInput, CreatorOutput, None])¶
Scaffolds G6 components — returns files without writing to disk.
| Field | Type | Default |
|---|---|---|
name | str | 'component_creator' |
Methods:
infer(data: CreatorInput) -> Result[CreatorOutput]¶
FileEntry(BaseModel)¶
A generated file with its relative path and content.
| Field | Type | Default |
|---|---|---|
path | str | required |
content | str | required |
ComponentSpec(BaseModel)¶
Specification for a new G6 component.
| Field | Type | Default |
|---|---|---|
name | str | required |
description | str | '' |
prefix | str | '' |
operations | list[str] | Field(default_factory=list) |
mcp_operations | list[str] | Field(default_factory=list) |
input_fields | list[dict[str, str]] | Field(default_factory=list) |
output_fields | list[dict[str, str]] | Field(default_factory=list) |
workspace_root | str | '' |
skill_name | str | '' |
author | str | 'G6 Hyperdistillation Team' |
version | str | '1.0.0' |
CreatorInput(BaseModel)¶
Tier 1 input for ComponentCreatorBlock.
| Field | Type | Default |
|---|---|---|
operation | Literal['scaffold_component', 'scaffold_mcp', 'scaffold_skill', 'scaffold_tests', 'scaffold_extension', 'preview', 'validate_skill'] | 'scaffold_component' |
spec | ComponentSpec \| None | None |
skill_md | str | '' |
CreatorOutput(BaseModel)¶
Tier 1 output from ComponentCreatorBlock.
| Field | Type | Default |
|---|---|---|
operation | str | required |
files | list[FileEntry] | Field(default_factory=list) |
message | str | '' |
errors | list[str] | Field(default_factory=list) |
degraded | bool | False |
degradation_reason | str | '' |
Functions¶
inspect_structure(component_path: str) -> dict¶
Analyse a component directory and report what files are present.
check_conventions(component_path: str) -> dict¶
Validate G6 coding conventions in a component.
detect_gaps(component_path: str) -> list[str]¶
Find missing expected files and exports in a component.
analyze_imports(component_path: str) -> dict¶
Parse import dependencies of all Python files in a component.
check_skill_conventions(skill_path: str) -> dict¶
Validate Anthropic skill requirements for a skill/ directory.
render_init(spec: 'ComponentSpec') -> str¶
Generate init.py with exports.
render_schema(spec: 'ComponentSpec') -> str¶
Generate Tier 1 schema.py with Input/Output Pydantic models.
render_block(spec: 'ComponentSpec') -> str¶
Generate Tier 1 AIBlock subclass with operation dispatch.
render_mcp_init(spec: 'ComponentSpec') -> str¶
Generate MCP sub-package init.py.
render_mcp_schema(spec: 'ComponentSpec') -> str¶
Generate MCP schema.py with 25-operation Literal.
render_mcp_store(spec: 'ComponentSpec') -> str¶
Generate SQLite store with 4 tables.
render_mcp_block(spec: 'ComponentSpec') -> str¶
Generate Tier 2 MCP AIBlock with dispatch to all 25 ops.
render_mcp_server(spec: 'ComponentSpec') -> str¶
Generate FastMCP server with lazy singleton pattern.
render_mcp_main(spec: 'ComponentSpec') -> str¶
Generate main.py for
python -m mvp.<name>.<name>_mcp.
render_test_tier1(spec: 'ComponentSpec') -> str¶
Generate pytest tests for Tier 1 block.
render_test_tier2(spec: 'ComponentSpec') -> str¶
Generate pytest tests for MCP block.
render_frontmatter(spec: 'ComponentSpec') -> str¶
Generate YAML frontmatter string for SKILL.md.
render_skill_md(spec: 'ComponentSpec') -> str¶
Generate a SKILL.md skeleton following the NORTH_STAR §7.1 12-section standard.
render_plugin_json(spec: 'ComponentSpec') -> str¶
Generate plugin.json.
render_mcp_json(spec: 'ComponentSpec') -> str¶
Generate .mcp.json for MCP host configuration.
render_hooks_json(spec: 'ComponentSpec') -> str¶
Generate hooks.json.
MCP Tools¶
| Operation | Source |
|---|---|
scaffold_component | component_creator_mcp |
scaffold_mcp | component_creator_mcp |
scaffold_skill | component_creator_mcp |
scaffold_tests | component_creator_mcp |
scaffold_full | component_creator_mcp |
design_schema | component_creator_mcp |
design_operations | component_creator_mcp |
design_block | component_creator_mcp |
design_skill_docs | component_creator_mcp |
preview_scaffold | component_creator_mcp |
list_templates | component_creator_mcp |
get_template | component_creator_mcp |
render_template | component_creator_mcp |
register_template | component_creator_mcp |
list_archetypes | component_creator_mcp |
inspect_component | component_creator_mcp |
check_conventions | component_creator_mcp |
detect_gaps | component_creator_mcp |
analyze_dependencies | component_creator_mcp |
compare_patterns | component_creator_mcp |
list_components | component_creator_mcp |
get_component_info | component_creator_mcp |
get_component | component_creator_mcp |
get_creator_info | component_creator_mcp |
list_generations | component_creator_mcp |
list_validations | component_creator_mcp |
update_exports | component_creator_mcp |
wire_integration | component_creator_mcp |
info | component_creator_mcp |
list_patterns | component_creator_mcp |
describe_capabilities | component_creator_mcp |
scaffold_only | component_creator_mcp |
validated_source | component_creator_mcp |
domain_complete | component_creator_mcp |