mirror of
https://github.com/johndoe6345789/metabuilder.git
synced 2026-04-25 06:14:59 +00:00
feat: Add Python plugins from AutoMetabuilder + restructure workflow folder
Restructure workflow/ for multi-language plugin support:
- Rename src/ to core/ (engine code: DAG executor, registry, types)
- Create executor/{cpp,python,ts}/ for language-specific runtimes
- Consolidate plugins to plugins/{ts,python}/ by language then category
Add 80+ Python plugins from AutoMetabuilder in 14 categories:
- control: bot control, switch logic, state management
- convert: type conversions (json, boolean, dict, list, number, string)
- core: AI requests, context management, tool calls
- dict: dictionary operations (get, set, keys, values, merge)
- list: list operations (concat, find, sort, slice, filter)
- logic: boolean logic (and, or, xor, equals, comparisons)
- math: arithmetic operations (add, subtract, multiply, power, etc.)
- string: string manipulation (concat, split, replace, format)
- notifications: Slack, Discord integrations
- test: assertion helpers and test suite runner
- tools: file operations, git, docker, testing utilities
- utils: filtering, mapping, reducing, condition branching
- var: variable store operations (get, set, delete, exists)
- web: Flask server, environment variables, JSON handling
Add language executor runtimes:
- TypeScript: direct import execution (default, fast startup)
- Python: child process with JSON stdin/stdout communication
- C++: placeholder for native FFI bindings (Phase 3)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
1
workflow/plugins/python/string/__init__.py
Normal file
1
workflow/plugins/python/string/__init__.py
Normal file
@@ -0,0 +1 @@
|
||||
"""String manipulation plugins."""
|
||||
10
workflow/plugins/python/string/string_concat.py
Normal file
10
workflow/plugins/python/string/string_concat.py
Normal file
@@ -0,0 +1,10 @@
|
||||
"""Workflow plugin: concatenate strings."""
|
||||
|
||||
|
||||
def run(_runtime, inputs):
|
||||
"""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)}
|
||||
13
workflow/plugins/python/string/string_format.py
Normal file
13
workflow/plugins/python/string/string_format.py
Normal file
@@ -0,0 +1,13 @@
|
||||
"""Workflow plugin: format string with variables."""
|
||||
|
||||
|
||||
def run(_runtime, inputs):
|
||||
"""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)}
|
||||
7
workflow/plugins/python/string/string_length.py
Normal file
7
workflow/plugins/python/string/string_length.py
Normal file
@@ -0,0 +1,7 @@
|
||||
"""Workflow plugin: get string length."""
|
||||
|
||||
|
||||
def run(_runtime, inputs):
|
||||
"""Get length of a string."""
|
||||
text = inputs.get("text", "")
|
||||
return {"result": len(text)}
|
||||
7
workflow/plugins/python/string/string_lower.py
Normal file
7
workflow/plugins/python/string/string_lower.py
Normal file
@@ -0,0 +1,7 @@
|
||||
"""Workflow plugin: convert string to lowercase."""
|
||||
|
||||
|
||||
def run(_runtime, inputs):
|
||||
"""Convert string to lowercase."""
|
||||
text = inputs.get("text", "")
|
||||
return {"result": text.lower()}
|
||||
12
workflow/plugins/python/string/string_replace.py
Normal file
12
workflow/plugins/python/string/string_replace.py
Normal file
@@ -0,0 +1,12 @@
|
||||
"""Workflow plugin: replace in string."""
|
||||
|
||||
|
||||
def run(_runtime, inputs):
|
||||
"""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}
|
||||
15
workflow/plugins/python/string/string_split.py
Normal file
15
workflow/plugins/python/string/string_split.py
Normal file
@@ -0,0 +1,15 @@
|
||||
"""Workflow plugin: split string."""
|
||||
|
||||
|
||||
def run(_runtime, inputs):
|
||||
"""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)
|
||||
|
||||
return {"result": result}
|
||||
16
workflow/plugins/python/string/string_trim.py
Normal file
16
workflow/plugins/python/string/string_trim.py
Normal file
@@ -0,0 +1,16 @@
|
||||
"""Workflow plugin: trim whitespace from string."""
|
||||
|
||||
|
||||
def run(_runtime, inputs):
|
||||
"""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()
|
||||
|
||||
return {"result": result}
|
||||
7
workflow/plugins/python/string/string_upper.py
Normal file
7
workflow/plugins/python/string/string_upper.py
Normal file
@@ -0,0 +1,7 @@
|
||||
"""Workflow plugin: convert string to uppercase."""
|
||||
|
||||
|
||||
def run(_runtime, inputs):
|
||||
"""Convert string to uppercase."""
|
||||
text = inputs.get("text", "")
|
||||
return {"result": text.upper()}
|
||||
Reference in New Issue
Block a user