refactor(workflow): convert all plugins to class/struct + factory pattern

- Python: class extending NodeExecutor + factory.py (80+ plugins)
- TypeScript: class implements NodeExecutor + factory.ts (7 groups, 116 classes)
- Go: struct with methods + factory.go (36 plugins)
- Rust: struct impl NodeExecutor trait + factory.rs (54 plugins)
- Mojo: struct + factory.mojo (11 plugins)

All package.json files now include:
- files array listing source files
- metadata.class/struct field
- metadata.entrypoint field

This enables a unified plugin loading system across all languages
with no import side effects (Spring-style DI pattern).

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-01-22 14:53:04 +00:00
parent 2562c2f55b
commit 7ce8b4ae8a
653 changed files with 13243 additions and 3034 deletions

View File

@@ -0,0 +1,7 @@
"""Factory for StringConcat plugin."""
from .string_concat import StringConcat
def create():
return StringConcat()

View File

@@ -1,13 +1,16 @@
{
"name": "@metabuilder/string_concat",
"version": "1.0.0",
"description": "string_concat plugin",
"description": "Concatenate multiple strings",
"author": "MetaBuilder",
"license": "MIT",
"keywords": ["string", "workflow", "plugin"],
"main": "string_concat.py",
"files": ["string_concat.py", "factory.py"],
"metadata": {
"plugin_type": "string.concat",
"category": "string"
"category": "string",
"class": "StringConcat",
"entrypoint": "execute"
}
}

View File

@@ -1,10 +1,16 @@
"""Workflow plugin: concatenate strings."""
from ...base import NodeExecutor
def run(_runtime, inputs):
class StringConcat(NodeExecutor):
"""Concatenate multiple strings."""
strings = inputs.get("strings", [])
separator = inputs.get("separator", "")
str_list = [str(s) for s in strings]
return {"result": separator.join(str_list)}
node_type = "string.concat"
category = "string"
description = "Concatenate multiple strings"
def execute(self, inputs, runtime=None):
separator = inputs.get("separator", "")
strings = inputs.get("strings", inputs.get("values", []))
return {"result": separator.join(str(s) for s in strings)}

View File

@@ -0,0 +1,7 @@
"""Factory for StringFormat plugin."""
from .string_format import StringFormat
def create():
return StringFormat()

View File

@@ -1,13 +1,16 @@
{
"name": "@metabuilder/string_format",
"version": "1.0.0",
"description": "string_format plugin",
"description": "Format string with variables",
"author": "MetaBuilder",
"license": "MIT",
"keywords": ["string", "workflow", "plugin"],
"main": "string_format.py",
"files": ["string_format.py", "factory.py"],
"metadata": {
"plugin_type": "string.format",
"category": "string"
"category": "string",
"class": "StringFormat",
"entrypoint": "execute"
}
}

View File

@@ -1,13 +1,19 @@
"""Workflow plugin: format string with variables."""
from ...base import NodeExecutor
def run(_runtime, inputs):
class StringFormat(NodeExecutor):
"""Format string with variables."""
template = inputs.get("template", "")
variables = inputs.get("variables", {})
try:
result = template.format(**variables)
return {"result": result}
except (KeyError, ValueError) as e:
return {"result": template, "error": str(e)}
node_type = "string.format"
category = "string"
description = "Format string with variables"
def execute(self, inputs, runtime=None):
template = inputs.get("template", "")
variables = inputs.get("variables", {})
try:
return {"result": template.format(**variables)}
except (KeyError, ValueError) as e:
return {"result": template, "error": str(e)}

View File

@@ -0,0 +1,7 @@
"""Factory for StringLength plugin."""
from .string_length import StringLength
def create():
return StringLength()

View File

@@ -1,13 +1,16 @@
{
"name": "@metabuilder/string_length",
"version": "1.0.0",
"description": "string_length plugin",
"description": "Get string length",
"author": "MetaBuilder",
"license": "MIT",
"keywords": ["string", "workflow", "plugin"],
"main": "string_length.py",
"files": ["string_length.py", "factory.py"],
"metadata": {
"plugin_type": "string.length",
"category": "string"
"category": "string",
"class": "StringLength",
"entrypoint": "execute"
}
}

View File

@@ -1,7 +1,15 @@
"""Workflow plugin: get string length."""
from ...base import NodeExecutor
def run(_runtime, inputs):
"""Get length of a string."""
text = inputs.get("text", "")
return {"result": len(text)}
class StringLength(NodeExecutor):
"""Get string length."""
node_type = "string.length"
category = "string"
description = "Get string length"
def execute(self, inputs, runtime=None):
value = str(inputs.get("value", inputs.get("text", "")))
return {"result": len(value)}

View File

@@ -0,0 +1,7 @@
"""Factory for StringLower plugin."""
from .string_lower import StringLower
def create():
return StringLower()

View File

@@ -1,13 +1,16 @@
{
"name": "@metabuilder/string_lower",
"version": "1.0.0",
"description": "string_lower plugin",
"description": "Convert string to lowercase",
"author": "MetaBuilder",
"license": "MIT",
"keywords": ["string", "workflow", "plugin"],
"main": "string_lower.py",
"files": ["string_lower.py", "factory.py"],
"metadata": {
"plugin_type": "string.lower",
"category": "string"
"category": "string",
"class": "StringLower",
"entrypoint": "execute"
}
}

View File

@@ -1,7 +1,15 @@
"""Workflow plugin: convert string to lowercase."""
from ...base import NodeExecutor
def run(_runtime, inputs):
class StringLower(NodeExecutor):
"""Convert string to lowercase."""
text = inputs.get("text", "")
return {"result": text.lower()}
node_type = "string.lower"
category = "string"
description = "Convert string to lowercase"
def execute(self, inputs, runtime=None):
value = str(inputs.get("value", inputs.get("text", "")))
return {"result": value.lower()}

View File

@@ -0,0 +1,7 @@
"""Factory for StringReplace plugin."""
from .string_replace import StringReplace
def create():
return StringReplace()

View File

@@ -1,13 +1,16 @@
{
"name": "@metabuilder/string_replace",
"version": "1.0.0",
"description": "string_replace plugin",
"description": "Replace occurrences in string",
"author": "MetaBuilder",
"license": "MIT",
"keywords": ["string", "workflow", "plugin"],
"main": "string_replace.py",
"files": ["string_replace.py", "factory.py"],
"metadata": {
"plugin_type": "string.replace",
"category": "string"
"category": "string",
"class": "StringReplace",
"entrypoint": "execute"
}
}

View File

@@ -1,12 +1,18 @@
"""Workflow plugin: replace in string."""
from ...base import NodeExecutor
def run(_runtime, inputs):
class StringReplace(NodeExecutor):
"""Replace occurrences in string."""
text = inputs.get("text", "")
old = inputs.get("old", "")
new = inputs.get("new", "")
count = inputs.get("count", -1)
result = text.replace(old, new, count)
return {"result": result}
node_type = "string.replace"
category = "string"
description = "Replace occurrences in string"
def execute(self, inputs, runtime=None):
value = str(inputs.get("value", inputs.get("text", "")))
old = inputs.get("old", inputs.get("search", ""))
new = inputs.get("new", inputs.get("replacement", ""))
count = inputs.get("count", -1)
return {"result": value.replace(old, new, count)}

View File

@@ -0,0 +1,7 @@
"""Factory for StringSplit plugin."""
from .string_split import StringSplit
def create():
return StringSplit()

View File

@@ -1,13 +1,16 @@
{
"name": "@metabuilder/string_split",
"version": "1.0.0",
"description": "string_split plugin",
"description": "Split string by separator",
"author": "MetaBuilder",
"license": "MIT",
"keywords": ["string", "workflow", "plugin"],
"main": "string_split.py",
"files": ["string_split.py", "factory.py"],
"metadata": {
"plugin_type": "string.split",
"category": "string"
"category": "string",
"class": "StringSplit",
"entrypoint": "execute"
}
}

View File

@@ -1,15 +1,19 @@
"""Workflow plugin: split string."""
from ...base import NodeExecutor
def run(_runtime, inputs):
class StringSplit(NodeExecutor):
"""Split string by separator."""
text = inputs.get("text", "")
separator = inputs.get("separator", " ")
max_splits = inputs.get("max_splits")
if max_splits is not None:
result = text.split(separator, max_splits)
else:
result = text.split(separator)
node_type = "string.split"
category = "string"
description = "Split string by separator"
return {"result": result}
def execute(self, inputs, runtime=None):
text = str(inputs.get("text", inputs.get("value", "")))
separator = inputs.get("separator", " ")
max_splits = inputs.get("max_splits", inputs.get("limit"))
if max_splits is not None:
return {"result": text.split(separator, max_splits)}
return {"result": text.split(separator)}

View File

@@ -0,0 +1,7 @@
"""Factory for StringTrim plugin."""
from .string_trim import StringTrim
def create():
return StringTrim()

View File

@@ -1,13 +1,16 @@
{
"name": "@metabuilder/string_trim",
"version": "1.0.0",
"description": "string_trim plugin",
"description": "Trim whitespace from string",
"author": "MetaBuilder",
"license": "MIT",
"keywords": ["string", "workflow", "plugin"],
"main": "string_trim.py",
"files": ["string_trim.py", "factory.py"],
"metadata": {
"plugin_type": "string.trim",
"category": "string"
"category": "string",
"class": "StringTrim",
"entrypoint": "execute"
}
}

View File

@@ -1,16 +1,20 @@
"""Workflow plugin: trim whitespace from string."""
from ...base import NodeExecutor
def run(_runtime, inputs):
class StringTrim(NodeExecutor):
"""Trim whitespace from string."""
text = inputs.get("text", "")
mode = inputs.get("mode", "both")
if mode == "start":
result = text.lstrip()
elif mode == "end":
result = text.rstrip()
else:
result = text.strip()
node_type = "string.trim"
category = "string"
description = "Trim whitespace from string"
return {"result": result}
def execute(self, inputs, runtime=None):
value = str(inputs.get("value", inputs.get("text", "")))
mode = inputs.get("mode", "both")
if mode == "start":
return {"result": value.lstrip()}
elif mode == "end":
return {"result": value.rstrip()}
return {"result": value.strip()}

View File

@@ -0,0 +1,7 @@
"""Factory for StringUpper plugin."""
from .string_upper import StringUpper
def create():
return StringUpper()

View File

@@ -1,13 +1,16 @@
{
"name": "@metabuilder/string_upper",
"version": "1.0.0",
"description": "string_upper plugin",
"description": "Convert string to uppercase",
"author": "MetaBuilder",
"license": "MIT",
"keywords": ["string", "workflow", "plugin"],
"main": "string_upper.py",
"files": ["string_upper.py", "factory.py"],
"metadata": {
"plugin_type": "string.upper",
"category": "string"
"category": "string",
"class": "StringUpper",
"entrypoint": "execute"
}
}

View File

@@ -1,7 +1,15 @@
"""Workflow plugin: convert string to uppercase."""
from ...base import NodeExecutor
def run(_runtime, inputs):
class StringUpper(NodeExecutor):
"""Convert string to uppercase."""
text = inputs.get("text", "")
return {"result": text.upper()}
node_type = "string.upper"
category = "string"
description = "Convert string to uppercase"
def execute(self, inputs, runtime=None):
value = str(inputs.get("value", inputs.get("text", "")))
return {"result": value.upper()}