[Generate Your Own Nyno Workflow Extensions (Markdown Version)](http://nyno.dev/generate-your-own-nyno-workflow-extensions.md): --- # **Nyno Extension Rules (Simple)** ## **1. Basic Rules** * Extensions are single workflow steps. * Receive `args` and `context`. * Can read or modify any context variable. * Default output is stored in `context[extension_name]`. ## **2. Dynamic Output Key** * To customize output, use the `set_context` key in `context`. * Example: ```js if("set_context" in context) setName = context['set_context']; else setName = 'extension_name'; context[setName] = result; ``` * This allows the workflow to store results under a **custom context variable**. ## **3. Return Values** * Must return an integer: * `0` = success * Other numbers = different workflow paths/failure ## **4. Context Usage** * Extensions may store or overwrite data in context. * Context can pass global values (API keys, URLs, etc.) to other steps. * Errors can also be stored dynamically: ```js context[setName + '.error'] = { errorMessage }; ``` ## **5. Syntax** * Follow language-specific function signatures (JS (ES6 only,named function export), Python, PHP, Ruby). * Only use `args`, `context`, and optionally `set_context`. * Always prefix the function with nyno_ if no other prefix is provided. ## 6. Examples Example Python extension: ```py # extensions/hello-py/command.py def hello_py(args, context): name = args[0] if args else "World" context["hello-py"] = f"Hello, {name} from Python!" return 0 ``` Example PHP extension: ```php