zrb 1.9.5__py3-none-any.whl → 1.9.6__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,250 @@
1
+ Metadata-Version: 2.1
2
+ Name: zrb
3
+ Version: 1.9.6
4
+ Summary: Your Automation Powerhouse
5
+ Home-page: https://github.com/state-alchemists/zrb
6
+ License: AGPL-3.0-or-later
7
+ Keywords: Automation,Task Runner,Code Generator,Monorepo,Low Code
8
+ Author: Go Frendi Gunawan
9
+ Author-email: gofrendiasgard@gmail.com
10
+ Requires-Python: >=3.10.0,<4.0.0
11
+ Classifier: License :: OSI Approved :: GNU Affero General Public License v3 or later (AGPLv3+)
12
+ Classifier: Programming Language :: Python :: 3
13
+ Classifier: Programming Language :: Python :: 3.10
14
+ Classifier: Programming Language :: Python :: 3.11
15
+ Classifier: Programming Language :: Python :: 3.12
16
+ Provides-Extra: all
17
+ Provides-Extra: playwright
18
+ Provides-Extra: rag
19
+ Requires-Dist: beautifulsoup4 (>=4.13.3,<5.0.0)
20
+ Requires-Dist: black (>=25.1.0,<25.2.0)
21
+ Requires-Dist: chromadb (>=0.6.3,<0.7.0) ; extra == "rag" or extra == "all"
22
+ Requires-Dist: fastapi[standard] (>=0.115.14,<0.116.0)
23
+ Requires-Dist: isort (>=6.0.1,<6.1.0)
24
+ Requires-Dist: libcst (>=1.7.0,<2.0.0)
25
+ Requires-Dist: openai (>=1.86.0,<2.0.0) ; extra == "rag" or extra == "all"
26
+ Requires-Dist: pdfplumber (>=0.11.6,<0.12.0) ; extra == "rag" or extra == "all"
27
+ Requires-Dist: playwright (>=1.53.0,<2.0.0) ; extra == "playwright" or extra == "all"
28
+ Requires-Dist: prompt-toolkit (>=3.0.51,<4.0.0)
29
+ Requires-Dist: psutil (>=7.0.0,<8.0.0)
30
+ Requires-Dist: pydantic-ai (>=0.3.4,<0.4.0)
31
+ Requires-Dist: pyjwt (>=2.10.1,<3.0.0)
32
+ Requires-Dist: python-dotenv (>=1.1.1,<2.0.0)
33
+ Requires-Dist: python-jose[cryptography] (>=3.4.0,<4.0.0)
34
+ Requires-Dist: requests (>=2.32.4,<3.0.0)
35
+ Requires-Dist: rich (>=14.0.0,<15.0.0)
36
+ Requires-Dist: tiktoken (>=0.8.0,<0.9.0)
37
+ Requires-Dist: ulid-py (>=1.1.0,<2.0.0)
38
+ Project-URL: Documentation, https://github.com/state-alchemists/zrb
39
+ Project-URL: Repository, https://github.com/state-alchemists/zrb
40
+ Description-Content-Type: text/markdown
41
+
42
+ ![](https://raw.githubusercontent.com/state-alchemists/zrb/main/_images/zrb/android-chrome-192x192.png)
43
+
44
+ # 🤖 Zrb: Your Automation Powerhouse
45
+
46
+ **Zrb (Zaruba) is a Python-based tool that makes it easy to create, organize, and run automation tasks.** Think of it as a command-line sidekick, ready to handle everything from simple scripts to complex, AI-powered workflows.
47
+
48
+ Whether you're running tasks from the terminal or a sleek web UI, Zrb streamlines your process with task dependencies, environment management, and even inter-task communication.
49
+
50
+ [Documentation](https://github.com/state-alchemists/zrb/blob/main/docs/README.md) | [Contribution Guidelines](https://github.com/state-alchemists/zrb/pulls) | [Report an Issue](https://github.com/state-alchemists/zrb/issues)
51
+
52
+ ---
53
+
54
+ ## 🔥 Why Choose Zrb?
55
+
56
+ Zrb is designed to be powerful yet intuitive, offering a unique blend of features:
57
+
58
+ - 🤖 **Built-in LLM Integration:** Go beyond simple automation. Leverage Large Language Models to generate code, create diagrams, produce documentation, and more.
59
+ - 🐍 **Pure Python:** Write your tasks in Python. No complex DSLs or YAML configurations to learn.
60
+ - 🔗 **Smart Task Chaining:** Define dependencies between tasks to build sophisticated, ordered workflows.
61
+ - 💻 **Dual-Mode Execution:** Run tasks from the command line for speed or use the built-in web UI for a more visual experience.
62
+ - ⚙️ **Flexible Configuration:** Manage inputs with defaults, prompts, or command-line arguments. Handle secrets and settings with environment variables from the system or `.env` files.
63
+ - 🗣️ **Cross-Communication (XCom):** Allow tasks to safely exchange small pieces of data.
64
+ - 🌍 **Open & Extensible:** Zrb is open-source. Feel free to contribute, customize, or extend it to meet your needs.
65
+
66
+ ---
67
+
68
+ ## 🚀 Quick Start: Your First AI-Powered Workflow in 5 Minutes
69
+
70
+ Let's create a two-step workflow that uses an LLM to analyze your code and generate a Mermaid diagram, then converts that diagram into a PNG image.
71
+
72
+ ### 1. Prerequisites: Get Your Tools Ready
73
+
74
+ Before you start, make sure you have the following:
75
+
76
+ - **An LLM API Key:** Zrb needs an API key to talk to an AI model.
77
+ ```bash
78
+ export OPENAI_API_KEY="your-key-here"
79
+ ```
80
+ > Zrb defaults to OpenAI, but you can easily configure it for other providers like **Deepseek, Ollama, etc.** See the [LLM Integration Guide](https://github.com/state-alchemists/zrb/blob/main/docs/installation-and-configuration/configuration/llm-integration.md) for details.
81
+
82
+ - **Mermaid CLI:** This tool converts Mermaid diagram scripts into images.
83
+ ```bash
84
+ npm install -g @mermaid-js/mermaid-cli
85
+ ```
86
+
87
+ ### 2. Install Zrb
88
+
89
+ The easiest way to get Zrb is with `pip`.
90
+
91
+ ```bash
92
+ pip install zrb
93
+ # Or for the latest pre-release version:
94
+ # pip install --pre zrb
95
+ ```
96
+
97
+ Alternatively, you can use an installation script that handles all prerequisites:
98
+ ```bash
99
+ bash -c "$(curl -fsSL https://raw.githubusercontent.com/state-alchemists/zrb/main/install.sh)"
100
+ ```
101
+
102
+ > For other installation methods, including **Docker 🐋** and **Android 📱**, check out the full [Installation Guide](https://github.com/state-alchemists/zrb/blob/main/docs/installation-and-configuration/README.md).
103
+
104
+ ### 3. Define Your Tasks
105
+
106
+ Create a file named `zrb_init.py` in your project directory. Zrb automatically discovers this file.
107
+
108
+ > **💡 Pro Tip:** You can place `zrb_init.py` in your home directory (`~/zrb_init.py`), and the tasks you define will be available globally across all your projects!
109
+
110
+ Add the following Python code to your `zrb_init.py`:
111
+
112
+ ```python
113
+ from zrb import cli, LLMTask, CmdTask, StrInput, Group
114
+ from zrb.builtin.llm.tool.code import analyze_repo
115
+ from zrb.builtin.llm.tool.file import write_to_file
116
+
117
+
118
+ # Create a group for Mermaid-related tasks
119
+ mermaid_group = cli.add_group(Group(
120
+ name="mermaid",
121
+ description="🧜 Mermaid diagram related tasks"
122
+ ))
123
+
124
+ # Task 1: Generate a Mermaid script from your source code
125
+ make_mermaid_script = mermaid_group.add_task(
126
+ LLMTask(
127
+ name="make-script",
128
+ description="Create a mermaid diagram from source code in the current directory",
129
+ input=[
130
+ StrInput(name="dir", default="./"),
131
+ StrInput(name="diagram", default="state-diagram"),
132
+ ],
133
+ message=(
134
+ "Read all necessary files in {ctx.input.dir}, "
135
+ "make a {ctx.input.diagram} in mermaid format. "
136
+ "Write the script into `{ctx.input.dir}/{ctx.input.diagram}.mmd`"
137
+ ),
138
+ tools=[
139
+ analyze_repo, write_to_file
140
+ ],
141
+ )
142
+ )
143
+
144
+ # Task 2: Convert the Mermaid script into a PNG image
145
+ make_mermaid_image = mermaid_group.add_task(
146
+ CmdTask(
147
+ name="make-image",
148
+ description="Create a PNG from a mermaid script",
149
+ input=[
150
+ StrInput(name="dir", default="./"),
151
+ StrInput(name="diagram", default="state-diagram"),
152
+ ],
153
+ cmd="mmdc -i '{ctx.input.diagram}.mmd' -o '{ctx.input.diagram}.png'",
154
+ cwd="{ctx.input.dir}",
155
+ )
156
+ )
157
+
158
+ # Set up the dependency: the image task runs after the script is created
159
+ make_mermaid_script >> make_mermaid_image
160
+ ```
161
+
162
+ ### 4. Run Your Workflow!
163
+
164
+ Now, navigate to any project with source code. For example:
165
+
166
+ ```bash
167
+ git clone git@github.com:jjinux/gotetris.git
168
+ cd gotetris
169
+ ```
170
+
171
+ Run your new task to generate the diagram:
172
+
173
+ ```bash
174
+ zrb mermaid make-image --diagram "state-diagram" --dir ./
175
+ ```
176
+
177
+ You can also run it interactively and let Zrb prompt you for inputs:
178
+ ```bash
179
+ zrb mermaid make-image
180
+ ```
181
+ Zrb will ask for the directory and diagram name—just press **Enter** to accept the defaults.
182
+
183
+ In moments, you'll have a beautiful state diagram of your code!
184
+
185
+ ![State Diagram](https://raw.githubusercontent.com/state-alchemists/zrb/main/_images/state-diagram.png)
186
+
187
+ ---
188
+
189
+ ## 🖥️ Try the Web UI
190
+
191
+ Prefer a graphical interface? Zrb has you covered. Start the web server:
192
+
193
+ ```bash
194
+ zrb server start
195
+ ```
196
+
197
+ Then open your browser to `http://localhost:21213` to see your tasks in a clean, user-friendly interface.
198
+
199
+ ![Zrb Web UI](https://raw.githubusercontent.com/state-alchemists/zrb/main/_images/zrb-web-ui.png)
200
+
201
+ ---
202
+
203
+ ## 💬 Interact with an LLM Directly
204
+
205
+ Zrb brings AI capabilities right to your command line.
206
+
207
+ ### Interactive Chat
208
+
209
+ Start a chat session with an LLM to ask questions, brainstorm ideas, or get coding help.
210
+
211
+ ```bash
212
+ zrb llm chat
213
+ ```
214
+
215
+ ### Quick Questions
216
+
217
+ For a single question, use the `ask` command for a fast response.
218
+
219
+ ```bash
220
+ zrb llm ask "What is the capital of Indonesia?"
221
+ ```
222
+
223
+ ---
224
+
225
+ ## 🎥 Demo & Documentation
226
+
227
+ - **Dive Deeper:** [**Explore the Full Zrb Documentation**](https://github.com/state-alchemists/zrb/blob/main/docs/README.md)
228
+ - **Watch the Video Demo:**
229
+
230
+ [![Video Title](https://img.youtube.com/vi/W7dgk96l__o/0.jpg)](https://www.youtube.com/watch?v=W7dgk96l__o)
231
+
232
+ ---
233
+
234
+ ## 🤝 Join the Community & Support the Project
235
+
236
+ - **Bugs & Feature Requests:** Found a bug or have a great idea? [Open an issue](https://github.com/state-alchemists/zrb/issues). Please include your Zrb version (`zrb version`) and steps to reproduce the issue.
237
+ - **Contributions:** We love pull requests! See our [contribution guidelines](https://github.com/state-alchemists/zrb/pulls) to get started.
238
+ - **Support Zrb:** If you find Zrb valuable, please consider showing your support.
239
+
240
+ [![](https://raw.githubusercontent.com/state-alchemists/zrb/main/_images/donator.png)](https://stalchmst.com)
241
+
242
+ ---
243
+
244
+ ## 🎉 Fun Fact
245
+
246
+ **Did you know?** Zrb is named after `Zaruba`, a powerful, sentient Madou Ring that acts as a guide and support tool in the *Garo* universe.
247
+
248
+ > *Madou Ring Zaruba (魔導輪ザルバ, Madōrin Zaruba) is a Madougu which supports bearers of the Garo Armor.* [(Garo Wiki | Fandom)](https://garo.fandom.com/wiki/Zaruba)
249
+
250
+ ![Madou Ring Zaruba on Kouga's Hand](https://raw.githubusercontent.com/state-alchemists/zrb/main/_images/madou-ring-zaruba.jpg)
@@ -12,16 +12,16 @@ zrb/builtin/jwt.py,sha256=3M5uaQhJZbKQLjTUft1OwPz_JxtmK-xtkjxWjciOQho,2859
12
12
  zrb/builtin/llm/chat_session.py,sha256=1DMy6j24jfTVkQfsZAHvazniXrWfUW8E0ZwTAxi7WAU,7593
13
13
  zrb/builtin/llm/history.py,sha256=jCMeRCHUsDFnQWyDoH9SOBptzceOs_wACvVpYkDOoTk,3086
14
14
  zrb/builtin/llm/input.py,sha256=Nw-26uTWp2QhUgKJcP_IMHmtk-b542CCSQ_vCOjhvhM,877
15
- zrb/builtin/llm/llm_ask.py,sha256=PCd8pXb3dkVBPqAyiEylMetT76Wr6nuNFtK0zo0oCn0,4539
15
+ zrb/builtin/llm/llm_ask.py,sha256=oozfQwa1i2PnXV4qWbn60Pmd3fS0kgmhYCbfKlhr25o,4549
16
16
  zrb/builtin/llm/previous-session.js,sha256=xMKZvJoAbrwiyHS0OoPrWuaKxWYLoyR5sguePIoCjTY,816
17
17
  zrb/builtin/llm/tool/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
18
- zrb/builtin/llm/tool/api.py,sha256=yR9I0ZsI96OeQl9pgwORMASVuXsAL0a89D_iPS4C8Dc,1699
19
- zrb/builtin/llm/tool/cli.py,sha256=_CNEmEc6K2Z0i9ppYeM7jGpqaEdT3uxaWQatmxP3jKE,858
20
- zrb/builtin/llm/tool/code.py,sha256=VCmfgS-UjWd5917yVMWvkmp4K07zEcKBY5LXneI_VME,8097
21
- zrb/builtin/llm/tool/file.py,sha256=R8js6rqPpMo9iavt3u4v5Zyr6AV820yztSUJVOkMGkY,22764
22
- zrb/builtin/llm/tool/rag.py,sha256=I7xooTVwCN_Jd4KBqMfhAGMtdc4r7kde8_iHc94xFyA,7890
23
- zrb/builtin/llm/tool/sub_agent.py,sha256=Xz_nwNA8hW52gCeNdNBT7TXDUU3x7Ube-t17FYxx0-E,4671
24
- zrb/builtin/llm/tool/web.py,sha256=SeTT59yRaBJQILi4TETaLDMna2ooeYStYMkAnn0uTZc,5465
18
+ zrb/builtin/llm/tool/api.py,sha256=OhmfLc2TwWKQYIMweGelqb5s4JF4nB-YynbSO4yb_Jk,2342
19
+ zrb/builtin/llm/tool/cli.py,sha256=QqIil29dVOjbTxwb9Gib4KhlaJcOcto-OxEX5hHmA1s,1377
20
+ zrb/builtin/llm/tool/code.py,sha256=EROMSmeVtVSqLVF6DZLAo97oj6rVOpGfnG7VNagWzfE,8799
21
+ zrb/builtin/llm/tool/file.py,sha256=2_S5KCgB-9mhwc_w2YKsQkH_zAW42GTrM6qvYoV_2_o,22737
22
+ zrb/builtin/llm/tool/rag.py,sha256=wB74JV7bxs0ec77b_09Z2lPjoR1WzPUvZbuXOdb9Q9g,9675
23
+ zrb/builtin/llm/tool/sub_agent.py,sha256=7Awa9dpXqtJAZhxyXaKeZv5oIE2N_OqXhAbNmsOG49Y,4951
24
+ zrb/builtin/llm/tool/web.py,sha256=gQlUsmYCJOFJtNjwpjK-xk13LMvrMSpSaFHXUTnIayQ,7090
25
25
  zrb/builtin/md5.py,sha256=690RV2LbW7wQeTFxY-lmmqTSVEEZv3XZbjEUW1Q3XpE,1480
26
26
  zrb/builtin/project/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
27
27
  zrb/builtin/project/add/fastapp/fastapp_input.py,sha256=MKlWR_LxWhM_DcULCtLfL_IjTxpDnDBkn9KIqNmajFs,310
@@ -218,7 +218,7 @@ zrb/cmd/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
218
218
  zrb/cmd/cmd_result.py,sha256=L8bQJzWCpcYexIxHBNsXj2pT3BtLmWex0iJSMkvimOA,597
219
219
  zrb/cmd/cmd_val.py,sha256=7Doowyg6BK3ISSGBLt-PmlhzaEkBjWWm51cED6fAUOQ,1014
220
220
  zrb/config/config.py,sha256=PbtmVWIdCTCFdeAIF5Y-J7wa99ZhLWIe_GMYqpZzhXk,10576
221
- zrb/config/llm_config.py,sha256=HnQKDgZSk9MXngH2cqqxk8OFqGQaH8JeMeLSp-UQDlE,18909
221
+ zrb/config/llm_config.py,sha256=c9ySC40hToXP91FZ2wylXVnvRDLkwhBr1Skqw8RmvHU,19006
222
222
  zrb/config/llm_rate_limitter.py,sha256=0U0qm4qgCWqBjohPdwANNUzLR3joJCFYr6oW6Xpccfo,4436
223
223
  zrb/config/web_auth_config.py,sha256=_PXatQTYh2mX9H3HSYSQKp13zm1RlLyVIoeIr6KYMQ8,6279
224
224
  zrb/content_transformer/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -391,7 +391,7 @@ zrb/util/todo.py,sha256=r9_KYF2-hLKMNjsp6AFK9zivykMrywd-kJ4bCwfdafI,19323
391
391
  zrb/util/todo_model.py,sha256=0SJ8aLYfJAscDOk5JsH7pXP3h1rAG91VMCS20-c2Y6A,1576
392
392
  zrb/xcom/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
393
393
  zrb/xcom/xcom.py,sha256=o79rxR9wphnShrcIushA0Qt71d_p3ZTxjNf7x9hJB78,1571
394
- zrb-1.9.5.dist-info/METADATA,sha256=mFfF74UklDKcc54tTD5nWKRozhJgKYHgGMEZrIhOwVs,9597
395
- zrb-1.9.5.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
396
- zrb-1.9.5.dist-info/entry_points.txt,sha256=-Pg3ElWPfnaSM-XvXqCxEAa-wfVI6BEgcs386s8C8v8,46
397
- zrb-1.9.5.dist-info/RECORD,,
394
+ zrb-1.9.6.dist-info/METADATA,sha256=djvxyCdtBRZInrSwxMWqIxtpfmFpD1mo0Q5HFwdaTZA,9777
395
+ zrb-1.9.6.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
396
+ zrb-1.9.6.dist-info/entry_points.txt,sha256=-Pg3ElWPfnaSM-XvXqCxEAa-wfVI6BEgcs386s8C8v8,46
397
+ zrb-1.9.6.dist-info/RECORD,,
@@ -1,245 +0,0 @@
1
- Metadata-Version: 2.1
2
- Name: zrb
3
- Version: 1.9.5
4
- Summary: Your Automation Powerhouse
5
- Home-page: https://github.com/state-alchemists/zrb
6
- License: AGPL-3.0-or-later
7
- Keywords: Automation,Task Runner,Code Generator,Monorepo,Low Code
8
- Author: Go Frendi Gunawan
9
- Author-email: gofrendiasgard@gmail.com
10
- Requires-Python: >=3.10.0,<4.0.0
11
- Classifier: License :: OSI Approved :: GNU Affero General Public License v3 or later (AGPLv3+)
12
- Classifier: Programming Language :: Python :: 3
13
- Classifier: Programming Language :: Python :: 3.10
14
- Classifier: Programming Language :: Python :: 3.11
15
- Classifier: Programming Language :: Python :: 3.12
16
- Provides-Extra: all
17
- Provides-Extra: playwright
18
- Provides-Extra: rag
19
- Requires-Dist: beautifulsoup4 (>=4.13.3,<5.0.0)
20
- Requires-Dist: black (>=25.1.0,<25.2.0)
21
- Requires-Dist: chromadb (>=0.6.3,<0.7.0) ; extra == "rag" or extra == "all"
22
- Requires-Dist: fastapi[standard] (>=0.115.14,<0.116.0)
23
- Requires-Dist: isort (>=6.0.1,<6.1.0)
24
- Requires-Dist: libcst (>=1.7.0,<2.0.0)
25
- Requires-Dist: openai (>=1.86.0,<2.0.0) ; extra == "rag" or extra == "all"
26
- Requires-Dist: pdfplumber (>=0.11.6,<0.12.0) ; extra == "rag" or extra == "all"
27
- Requires-Dist: playwright (>=1.53.0,<2.0.0) ; extra == "playwright" or extra == "all"
28
- Requires-Dist: prompt-toolkit (>=3.0.51,<4.0.0)
29
- Requires-Dist: psutil (>=7.0.0,<8.0.0)
30
- Requires-Dist: pydantic-ai (>=0.3.4,<0.4.0)
31
- Requires-Dist: pyjwt (>=2.10.1,<3.0.0)
32
- Requires-Dist: python-dotenv (>=1.1.1,<2.0.0)
33
- Requires-Dist: python-jose[cryptography] (>=3.4.0,<4.0.0)
34
- Requires-Dist: requests (>=2.32.4,<3.0.0)
35
- Requires-Dist: rich (>=14.0.0,<15.0.0)
36
- Requires-Dist: tiktoken (>=0.8.0,<0.9.0)
37
- Requires-Dist: ulid-py (>=1.1.0,<2.0.0)
38
- Project-URL: Documentation, https://github.com/state-alchemists/zrb
39
- Project-URL: Repository, https://github.com/state-alchemists/zrb
40
- Description-Content-Type: text/markdown
41
-
42
- ![](https://raw.githubusercontent.com/state-alchemists/zrb/main/_images/zrb/android-chrome-192x192.png)
43
-
44
- [Documentation](https://github.com/state-alchemists/zrb/blob/main/docs/README.md)
45
-
46
- # 🤖 Zrb: Your Automation Powerhouse
47
-
48
- Zrb simplifies the creation and execution of automation tasks. It allows you to define tasks using Python classes or functions, organize them into groups, and run them via a command-line interface or a web UI. Zrb handles task dependencies, inputs, environment variables, and inter-task communication, allowing you to focus on the logic of your automation.
49
-
50
- ## 🚀 Why Zrb?
51
-
52
- Zrb stands out by offering:
53
- * **Python-Native Automation:** Write tasks in a familiar and powerful language.
54
- * **LLM Integration:** Easily incorporate AI capabilities into your workflows.
55
- * **Structured Workflows:** Define dependencies and organize tasks logically.
56
- * **Flexible Execution:** Run tasks from the CLI or a web browser.
57
- * **Extensibility:** Customize and build upon the Zrb framework.
58
-
59
- ## 🔥 Key Features
60
-
61
- - **LLM Integration:** Leverage state-of-the-art language models to generate code, diagrams, and documentation.
62
- - **Task Chaining:** Easily define dependencies between tasks to create complex workflows.
63
- - **CLI & Server Mode:** Run tasks directly from the command line or through a user-friendly web UI.
64
- - **Flexible Input Handling:** Defaults, prompts, and command-line parameters to suit any workflow.
65
- * **Environment Variables:** Manage configuration using environment variables, loaded from the system, `.env` files, or task definitions.
66
- * **Cross-Communication (XCom):** Safely exchange small amounts of data between tasks.
67
- - **Extensible & Open Source:** Contribute, customize, or extend Zrb to fit your unique needs.
68
-
69
-
70
- # 🛠️ Installation
71
-
72
- The easiest way to install Zrb is using pip:
73
-
74
- ```bash
75
- pip install zrb
76
- # pip install --pre zrb
77
- ```
78
-
79
- Alternatively, you can use Zrb installation script which handles prerequisites:
80
-
81
- ```bash
82
- bash -c "$(curl -fsSL https://raw.githubusercontent.com/state-alchemists/zrb/main/install.sh)"
83
- ```
84
-
85
- For more installation option like running Zrb on your **Android Device 📱** or **as a Container 🐋**, you can check the [installation and configuration guide](https://github.com/state-alchemists/zrb/blob/main/docs/installation-and-configuration/README.md).
86
-
87
- # 🍲 Quick Start: Build Your First Automation Workflow
88
-
89
- This guide shows you how to define two simple tasks:
90
-
91
- - One to generate a Mermaid Diagram Script from your source code.
92
- - And another one to convert that script into a PNG image.
93
-
94
- > **Note:** This assume you have an `OPENAI_API_KEY` and a Mermaid CLI installed (i.e., `npm install -g @mermaid-js/mermaid-cli`)
95
- > If you want to use other LLM Provider (e.g., Deepseek, Ollama, etc.), you can refer to [Zrb LLM Integration guide](https://github.com/state-alchemists/zrb/blob/main/docs/installation-and-configuration/configuration/llm-integration.md)
96
-
97
- ## 1. Create Your Task Definition File
98
-
99
- Place a file named `zrb_init.py` in a directory that's accessible from your projects.
100
-
101
- Zrb will automatically search for this file by starting in your current directory and then moving upward (i.e., checking parent directories) until it finds one.
102
-
103
- This means if you place your `zrb_init.py` in your home directory (e.g., `/home/<your-user-name>/zrb_init.py`), the tasks defined there will be available for any project inside your home directory.
104
-
105
- Add the following content to your zrb_init.py:
106
-
107
- ```python
108
- from zrb import cli, LLMTask, CmdTask, StrInput, Group
109
- from zrb.builtin.llm.tool.code import analyze_repo
110
- from zrb.builtin.llm.tool.file import write_to_file
111
-
112
-
113
- # Create a group for Mermaid-related tasks
114
- mermaid_group = cli.add_group(Group(name="mermaid", description="🧜 Mermaid diagram related tasks"))
115
-
116
- # Task 1: Generate a Mermaid script from your source code
117
- make_mermaid_script = mermaid_group.add_task(
118
- LLMTask(
119
- name="make-script",
120
- description="Creating mermaid diagram based on source code in current directory",
121
- input=[
122
- StrInput(name="dir", default="./"),
123
- StrInput(name="diagram", default="state-diagram"),
124
- ],
125
- message=(
126
- "Read all necessary files in {ctx.input.dir}, "
127
- "make a {ctx.input.diagram} in mermaid format. "
128
- "Write the script into `{ctx.input.dir}/{ctx.input.diagram}.mmd`"
129
- ),
130
- tools=[
131
- analyze_repo, write_to_file
132
- ],
133
- )
134
- )
135
-
136
- # Task 2: Convert the Mermaid script into a PNG image
137
- make_mermaid_image = mermaid_group.add_task(
138
- CmdTask(
139
- name="make-image",
140
- description="Creating png based on source code in current directory",
141
- input=[
142
- StrInput(name="dir", default="./"),
143
- StrInput(name="diagram", default="state-diagram"),
144
- ],
145
- cmd="mmdc -i '{ctx.input.diagram}.mmd' -o '{ctx.input.diagram}.png'",
146
- cwd="{ctx.input.dir}",
147
- )
148
- )
149
-
150
- # Set up the dependency: the image task runs after the script is created
151
- make_mermaid_script >> make_mermaid_image
152
- ```
153
-
154
- **What This Does**
155
-
156
- - **Task 1 – make-script**:
157
-
158
- Uses an LLM to read all files in your current directory and generate a [Mermaid Diagram Script](https://mermaid.js.org/) (e.g., `state diagram.mmd`).
159
-
160
- - **Task 2 – make-image**:
161
-
162
- Executes a command that converts the Mermaid Diagram Script into a PNG image (e.g., `state diagram.png`). This task will run only after the script has been generated.
163
-
164
-
165
- ## 2. Run Your Tasks
166
-
167
- After setting up your tasks, you can execute them from any project. For example:
168
-
169
- - Clone/Create a Project:
170
-
171
- ```bash
172
- git clone git@github.com:jjinux/gotetris.git
173
- cd gotetris
174
- ```
175
-
176
- - Create a state diagram:
177
-
178
- ```bash
179
- zrb mermaid make-image --diagram "state diagram" --dir ./
180
- ```
181
-
182
- - Or use the interactive mode:
183
-
184
- ```bash
185
- zrb mermaid make-image
186
- ```
187
-
188
- Zrb will prompt:
189
-
190
- ```
191
- dir [./]:
192
- diagram [state diagram]:
193
- ```
194
-
195
- Press **Enter** to use the default value
196
-
197
- - And you have your State Diagram ready :)
198
-
199
- ![State Diagram](https://raw.githubusercontent.com/state-alchemists/zrb/main/_images/state-diagram.png)
200
-
201
-
202
- ## 3. Try Out the Web UI
203
-
204
- You can also serve your tasks through a user-friendly web interface:
205
-
206
- ```bash
207
- zrb server start
208
- ```
209
-
210
- Then open your browser and visit `http://localhost:21213`
211
-
212
- ![Zrb Web UI](https://raw.githubusercontent.com/state-alchemists/zrb/main/_images/zrb-web-ui.png)
213
-
214
- # 🎥 Demo & Documentation
215
-
216
- - **Go Further By Visiting Our Documentation:** [Zrb Documentation](https://github.com/state-alchemists/zrb/blob/main/docs/README.md)
217
- - **Video Demo:**
218
-
219
- [![Video Title](https://img.youtube.com/vi/W7dgk96l__o/0.jpg)](https://www.youtube.com/watch?v=W7dgk96l__o)
220
-
221
-
222
- # 🤝 Join the Community
223
-
224
- - **Bug Reports & Feature Requests:** Create an [issue](https://github.com/state-alchemists/zrb/issues) on Zrb's GitHub Repositories and include:
225
- - Your Zrb version (i.e., `zrb version`).
226
- - Steps you’ve taken and what you expected versus what happened
227
- - **Contributions:** We welcome pull requests! Check out our [contribution guidelines](https://github.com/state-alchemists/zrb/pulls).
228
-
229
-
230
- # ☕ Support The Project
231
-
232
- If you find Zrb valuable, please consider donating:
233
-
234
- [![](https://raw.githubusercontent.com/state-alchemists/zrb/main/_images/donator.png)](https://stalchmst.com)
235
-
236
- # 🎉 Fun Fact
237
-
238
- Did you know?
239
-
240
- Zrb is named after `Zaruba`, a powerful support tool from the Garo universe!
241
-
242
- > Madou Ring Zaruba (魔導輪ザルバ, Madōrin Zaruba) is a Madougu which supports bearers of the Garo Armor. [(Garo Wiki | Fandom)](https://garo.fandom.com/wiki/Zaruba)
243
-
244
- ![Madou Ring Zaruba on Kouga's Hand](https://raw.githubusercontent.com/state-alchemists/zrb/main/_images/madou-ring-zaruba.jpg)
245
-
File without changes