Generate Your Own Nyno Workflow Extensions

Generate Your Own Nyno Workflow Extensions (Markdown Version)


Nyno Extension Rules (Simple)

1. Basic Rules

2. Dynamic Output Key

3. Return Values

4. Context Usage

5. Syntax

6. Language Choice Guideline

7. Examples

Example Python extension

# extensions/hello-py/command.py
def hello_py(args, context):
    name = args[0] if args else "World"
    set_name = context.get("set_context", "prev")
    context[set_name] = f"Hello, {name} from Python!"
    return 0

Example PHP extension

<?php
// extensions/hello-php/command.php
function hello_php($args, &$context) { // & required to modify context
    $name = $args[0] ?? "World";
    $setName = $context["set_context"] ?? "prev";
    $context[$setName] = "Hello, $name from PHP!";
    return 0;
}

Example Ruby extension

# extensions/hello-rb/command.rb
def hello_rb(args, context)
  name = args[0] || "World"
  set_name = context["set_context"] || "prev"
  context[set_name] = "Hello, #{name} from Ruby!"
  return 0
end

JS Example using context to pass data between steps

export function some_extension(args, context) {
  const result = args[0] || "default value";

  const setName = context?.set_context ?? "prev";

  // Save output in context for the next step
  context[setName] = result;

  return 0; // default path
}