### SQL Migration File Example Source: https://github.com/windmill-labs/windmill-cli-docs/blob/main/skills/raw-app/SKILL.md An example SQL file for creating a 'users' table, demonstrating idempotent syntax and best practices for migrations. ```sql CREATE TABLE IF NOT EXISTS users ( id SERIAL PRIMARY KEY, email TEXT NOT NULL UNIQUE, name TEXT, created_at TIMESTAMP DEFAULT NOW() ); ``` -------------------------------- ### Start App Development Server Source: https://context7.com/windmill-labs/windmill-cli-docs/llms.txt Navigate to the raw app directory and start the development server with live reload using `wmill app dev`. ```bash # Start the dev server with live reload cd f/dashboards/customers__raw_app wmill app dev --port 4000 --no-open ``` -------------------------------- ### Install and Check Windmill CLI Version Source: https://github.com/windmill-labs/windmill-cli-docs/blob/main/README.md Install the Windmill CLI globally using npm and verify the installation by checking the version. Upgrade later with `wmill upgrade`. ```sh npm install -g windmill-cli wmill --version ``` -------------------------------- ### Bun TypeScript Workflow Example Source: https://github.com/windmill-labs/windmill-cli-docs/blob/main/skills/write-workflow-as-code/SKILL.md Example of a Windmill Workflow-as-Code script written in Bun TypeScript. It demonstrates importing necessary functions from 'windmill-client' and defining a workflow with a task. ```typescript import { task, taskScript, taskFlow, step, sleep, waitForApproval, getResumeUrls, parallel, workflow, } from "windmill-client"; const process = task(async (x: string): Promise => { return `processed: ${x}`; }); export const main = workflow(async (x: string) => { const result = await process(x); return { result }; }); ``` -------------------------------- ### Start Windmill App Dev Server Source: https://github.com/windmill-labs/windmill-cli-docs/blob/main/skills/preview/SKILL.md Use this command to start the Windmill dev server for an application. It prints the local app server URL to stdout. Ensure you are in the app's raw directory. ```bash cd __raw_app && wmill app dev --no-open --port 4000 ``` -------------------------------- ### Start Windmill Dev Server for Flows/Scripts (Direct Mode) Source: https://github.com/windmill-labs/windmill-cli-docs/blob/main/skills/preview/SKILL.md Use this command to start the Windmill dev server in direct mode for flows or scripts. It prints the remote dev-page URL to stdout. Use when the embedder accepts any URL. ```bash wmill dev --path --no-open ``` -------------------------------- ### Python Workflow Example Source: https://github.com/windmill-labs/windmill-cli-docs/blob/main/skills/write-workflow-as-code/SKILL.md Example of a Windmill Workflow-as-Code script written in Python. It shows importing WAC components from 'wmill' and defining a workflow with a task using decorators. ```python from wmill import task, task_script, task_flow, step, sleep, wait_for_approval, get_resume_urls, parallel, workflow @task() async def process(x: str) -> str: return f"processed: {x}" @workflow async def main(x: str): result = await process(x) return {"result": result} ``` -------------------------------- ### Start Windmill Dev Server for Flows/Scripts (Proxy Mode) Source: https://github.com/windmill-labs/windmill-cli-docs/blob/main/skills/preview/SKILL.md Use this command to start the Windmill dev server in proxy mode for flows or scripts. It prints a localhost URL that redirects to the remote dev page. Use when the embedder only accepts localhost URLs. ```bash wmill dev --proxy-port 4000 --path --no-open ``` -------------------------------- ### Development Server Command Source: https://github.com/windmill-labs/windmill-cli-docs/blob/main/skills/raw-app/SKILL.md Command to start the Windmill development server, which watches the 'sql_to_apply/' folder for migrations. ```bash wmill app dev ``` -------------------------------- ### Basic Bun Script Structure Source: https://github.com/windmill-labs/windmill-cli-docs/blob/main/skills/write-script-bun/SKILL.md Export an async function named `main` as the entry point for your script. This function accepts parameters and returns a result. Libraries are installed automatically. ```typescript export async function main(param1: string, param2: number) { // Your code here return { result: param1, count: param2 }; } ``` -------------------------------- ### MySQL Resource Configuration Source: https://github.com/windmill-labs/windmill-cli-docs/blob/main/skills/resources/SKILL.md Example configuration for a MySQL resource, specifying connection parameters and a variable for the database password. ```json { "resource_type": "mysql", "value": { "host": "localhost", "port": 3306, "user": "root", "password": "$var:g/all/mysql_password", "database": "myapp" } } ``` -------------------------------- ### Data Table Configuration in `raw_app.yaml` Source: https://github.com/windmill-labs/windmill-cli-docs/blob/main/skills/raw-app/SKILL.md Example of the 'data' block in `raw_app.yaml` to configure accessible data tables, including default and specific schema tables. ```yaml data: datatable: main # Default datatable schema: app_schema # Default schema (optional) tables: - main/users # Table in public schema - main/app_schema:items # Table in specific schema ``` -------------------------------- ### PostgreSQL Resource Configuration Source: https://github.com/windmill-labs/windmill-cli-docs/blob/main/skills/resources/SKILL.md Example configuration for a PostgreSQL resource, including connection details and variable references for sensitive information. ```json { "resource_type": "postgresql", "value": { "host": "localhost", "port": 5432, "user": "postgres", "password": "$var:g/all/pg_password", "dbname": "windmill", "sslmode": "prefer" } } ``` -------------------------------- ### denoS3LightClientSettings Source: https://github.com/windmill-labs/windmill-cli-docs/blob/main/skills/write-script-deno/SKILL.md Gets S3 client settings, either from a specific resource or workspace defaults. ```APIDOC ## denoS3LightClientSettings ### Description Retrieves S3 client configuration settings. These settings can be obtained from a specified S3 resource path or by using the workspace's default S3 configuration if the path is undefined. ### Method `async denoS3LightClientSettings(s3_resource_path: string | undefined): Promise` ### Parameters * **s3_resource_path** (string | undefined) - The path to the S3 resource. If undefined, the workspace's default S3 resource will be used. ``` -------------------------------- ### denoS3LightClientSettings Source: https://github.com/windmill-labs/windmill-cli-docs/blob/main/skills/write-script-nativets/SKILL.md Gets S3 client settings, either from a specified resource path or workspace defaults. ```APIDOC ## denoS3LightClientSettings ### Description Retrieves S3 client configuration settings. It can use a specific S3 resource path or fall back to the workspace's default S3 resource. ### Method `async denoS3LightClientSettings(s3_resource_path: string | undefined): Promise` ### Parameters * **s3_resource_path** (string | undefined) - Optional. The path to the S3 resource. If undefined, the workspace default is used. ``` -------------------------------- ### Deno S3 Light Client Settings Source: https://github.com/windmill-labs/windmill-cli-docs/blob/main/skills/write-script-bun/SKILL.md Gets S3 client settings, either from a specified resource path or workspace default. ```APIDOC ## denoS3LightClientSettings ### Description Gets S3 client settings, either from a specified resource path or workspace default. ### Signature `async denoS3LightClientSettings(s3_resource_path: string | undefined): Promise` ### Parameters * **s3_resource_path** (string | undefined) - Path to S3 resource (uses workspace default if undefined). ``` -------------------------------- ### denoS3LightClientSettings Source: https://github.com/windmill-labs/windmill-cli-docs/blob/main/skills/write-script-bunnative/SKILL.md Gets S3 client settings, either from a specified resource path or workspace defaults. ```APIDOC ## denoS3LightClientSettings ### Description Gets S3 client settings, either from a specified resource path or workspace defaults. ### Method `async denoS3LightClientSettings(s3_resource_path: string | undefined): Promise` ### Parameters - **s3_resource_path** (string | undefined) - Path to the S3 resource. Uses workspace default if undefined. ``` -------------------------------- ### Optional YAML Configuration for Backend Runnables Source: https://github.com/windmill-labs/windmill-cli-docs/blob/main/skills/raw-app/SKILL.md Example of an optional YAML configuration file for a backend runnable, specifying static field values. ```yaml type: inline fields: user_id: type: static value: "default_user" ``` -------------------------------- ### Static Input Transform Example Source: https://github.com/windmill-labs/windmill-cli-docs/blob/main/skills/write-flow/SKILL.md Map a parameter to a fixed value using the `static` type. ```json {"param_name": {"type": "static", "value": "fixed_string"}} ``` -------------------------------- ### Preprocessor Script Example Source: https://github.com/windmill-labs/windmill-cli-docs/blob/main/skills/write-script-python3/SKILL.md Defines a preprocessor function that transforms an incoming event into flow input parameters. ```APIDOC ## Preprocessor Script For preprocessor scripts, the function should be named `preprocessor` and receives an `event` parameter. ```python from typing import TypedDict, Literal, Any class Event(TypedDict): kind: Literal["webhook", "http", "websocket", "kafka", "email", "nats", "postgres", "sqs", "mqtt", "gcp"] body: Any headers: dict[str, str] query: dict[str, str] def preprocessor(event: Event): # Transform the event into flow input parameters return { "param1": event["body"]["field1"], "param2": event["query"]["id"] } ``` ``` -------------------------------- ### Get Deno S3 Light Client Settings Source: https://github.com/windmill-labs/windmill-cli-docs/blob/main/skills/write-script-nativets/SKILL.md Obtains S3 client settings, defaulting to workspace settings if no S3 resource path is provided. ```typescript async denoS3LightClientSettings(s3_resource_path: string | undefined): Promise ``` -------------------------------- ### Flow YAML Structure Example Source: https://context7.com/windmill-labs/windmill-cli-docs/llms.txt Defines a daily ETL pipeline with modules for fetching data, transforming it, and loading it into a database. Includes input transformations and failure handling. ```yaml summary: Daily ETL Pipeline description: Extract, transform, load from API to database value: modules: - id: fetch_data value: type: rawscript language: bun content: !inline fetch_data.ts input_transforms: api_url: type: static value: "https://api.example.com/export" - id: transform value: type: rawscript language: python3 content: !inline transform.py input_transforms: raw_data: type: javascript expr: results.fetch_data - id: load_db stop_after_if: expr: result.rows_inserted === 0 skip_if_stopped: true value: type: script path: f/shared/db_insert input_transforms: records: type: javascript expr: results.transform.records table: type: static value: "events" failure_module: id: failure value: type: rawscript language: bun content: | export async function main(error: {message: string; step_id: string}) { console.error(`Flow failed at ${error.step_id}: ${error.message}`); } input_transforms: {} schema: type: object properties: date: type: string description: Target date in YYYY-MM-DD format required: [date] ``` -------------------------------- ### JavaScript Input Transform Example Source: https://github.com/windmill-labs/windmill-cli-docs/blob/main/skills/write-flow/SKILL.md Map a parameter to a dynamic value using a JavaScript expression. ```json {"param_name": {"type": "javascript", "expr": "results.previous_step.data"}} ``` -------------------------------- ### Get DataTable Client Source: https://github.com/windmill-labs/windmill-cli-docs/blob/main/skills/write-script-python3/SKILL.md Obtain a client instance for executing SQL queries against a DataTable. Defaults to the 'main' database. ```python def datatable(name: str = 'main') ``` -------------------------------- ### Get DuckLake Client Source: https://github.com/windmill-labs/windmill-cli-docs/blob/main/skills/write-script-python3/SKILL.md Obtain a client instance for executing DuckDB queries. Defaults to the 'main' database. ```python def ducklake(name: str = 'main') ``` -------------------------------- ### Basic PHP Script Structure Source: https://github.com/windmill-labs/windmill-cli-docs/blob/main/skills/write-script-php/SKILL.md PHP scripts must start with $param1, "count" => $param2]; } ``` -------------------------------- ### AWS S3 Resource Configuration Source: https://github.com/windmill-labs/windmill-cli-docs/blob/main/skills/resources/SKILL.md Example configuration for an AWS S3 resource, including bucket, region, and credentials referenced as variables. ```json { "resource_type": "s3", "value": { "bucket": "my-bucket", "region": "us-east-1", "accessKeyId": "$var:g/all/aws_access_key", "secretAccessKey": "$var:g/all/aws_secret_key" } } ``` -------------------------------- ### Python Imports Source: https://github.com/windmill-labs/windmill-cli-docs/blob/main/skills/write-script-python3/SKILL.md Standard Python libraries can be imported directly. Libraries are installed automatically, so no explicit installation instructions are needed. ```python import requests import pandas as pd from datetime import datetime ``` -------------------------------- ### Get Resume Endpoints (Deprecated) Source: https://github.com/windmill-labs/windmill-cli-docs/blob/main/skills/write-script-bunnative/SKILL.md Deprecated method to get resume and cancel endpoints for a flow. Use getResumeUrls instead. ```typescript getResumeEndpoints(approver?: string): Promise<{ approvalPage: string; resume: string; cancel: string }> ``` -------------------------------- ### Create a New Raw App with Required Flags Source: https://github.com/windmill-labs/windmill-cli-docs/blob/main/skills/raw-app/SKILL.md Use this command to create a new raw app, providing essential details like summary, path, and framework. Passing these flags ensures non-interactive mode, skipping wizards and prompts. ```bash wmill app new \ --summary "Customer dashboard" \ --path f/sales/dashboard \ --framework react19 ``` -------------------------------- ### Get Resume Endpoints (Deprecated) Source: https://github.com/windmill-labs/windmill-cli-docs/blob/main/skills/write-script-bun/SKILL.md Deprecated method to get resume and cancel endpoints for a flow. Use `getResumeUrls` instead. ```typescript getResumeEndpoints(approver?: string): Promise<{ approvalPage: string; resume: string; cancel: string; }> ``` -------------------------------- ### Initialize Windmill Project Source: https://context7.com/windmill-labs/windmill-cli-docs/llms.txt Creates a `wmill.yaml` file to tie the local directory to a Windmill workspace. Use interactively or non-interactively with backend settings or defaults. ```bash # Interactive: detects the active workspace profile and prompts for settings wmill init ``` ```bash # Non-interactive: pull git-sync settings from the backend automatically wmill init --use-backend --repository u/admin/my_repo --bind-profile ``` ```bash # Use defaults without contacting the backend wmill init --use-default ``` -------------------------------- ### Configure App Preview in launch.json Source: https://github.com/windmill-labs/windmill-cli-docs/blob/main/skills/preview/SKILL.md Add this entry to `.claude/launch.json` to configure the preview for an application. Note the different command and path structure for apps. ```json { "name": "windmill: f/test/my_app", "runtimeExecutable": "bash", "runtimeArgs": ["-c", "cd f/test/my_app__raw_app && wmill app dev --no-open --port ${PORT:-4001}"], "port": 4001, "autoPort": true } ``` -------------------------------- ### Java with Maven Dependencies Source: https://github.com/windmill-labs/windmill-cli-docs/blob/main/skills/write-script-java/SKILL.md Specify Maven dependencies using `//requirements:` comments at the top of the script. The example shows how to include the Gson library for JSON parsing. ```java //requirements: //com.google.code.gson:gson:2.10.1 //org.apache.httpcomponents:httpclient:4.5.14 import com.google.gson.Gson; public class Main { public static Object main(String input) { Gson gson = new Gson(); return gson.fromJson(input, Object.class); } } ``` -------------------------------- ### Configure Flow/Script Preview in launch.json Source: https://github.com/windmill-labs/windmill-cli-docs/blob/main/skills/preview/SKILL.md Add this entry to `.claude/launch.json` to configure the preview for a flow or script. Ensure the port is unique if running multiple previews. ```json { "name": "windmill: f/test/my_flow", "runtimeExecutable": "bash", "runtimeArgs": ["-c", "wmill dev --proxy-port ${PORT:-4000} --path f/test/my_flow --no-open"], "port": 4000, "autoPort": true } ``` -------------------------------- ### Handle Approvals with Checkpointing (Python) Source: https://github.com/windmill-labs/windmill-cli-docs/blob/main/skills/write-workflow-as-code/SKILL.md Generate resume URLs within `step()` before sending them for approval. Use `wait_for_approval()` to pause execution until approval is granted. ```python urls = await step("get_urls", lambda: get_resume_urls()) await step("notify", lambda: send_approval_email(urls["approvalPage"])) approval = await wait_for_approval(timeout=3600) ``` -------------------------------- ### Customer Onboarding Workflow (TypeScript) Source: https://context7.com/windmill-labs/windmill-cli-docs/llms.txt This TypeScript workflow defines a customer onboarding process using Windmill's Workflow-as-Code. It includes email validation, account provisioning, and conditional approval gates. ```typescript // f/workflows/onboard_customer.ts import { workflow, task, taskScript, taskFlow, step, sleep, waitForApproval, getResumeUrls, parallel } from "windmill-client"; // Inline task — runs as its own child job const validateEmail = task(async (email: string): Promise => { const re = /^[^\s@]+@[^\s@]+\.[^\s@]+$/; return re.test(email); }); // Reference an existing deployed script const sendWelcomeEmail = taskScript("f/email/send_welcome"); // Reference an existing flow const provisionAccount = taskFlow("f/provisioning/create_account"); export const main = workflow(async ( email: string, plan: "starter" | "pro" | "enterprise" ) => { // Non-deterministic values must be checkpointed with step() const startedAt = await step("started_at", () => new Date().toISOString()); const valid = await validateEmail(email); if (!valid) return { success: false, error: "Invalid email" }; // Fan-out: run two tasks in parallel const [account, _email] = await Promise.all([ provisionAccount({ email, plan }), sendWelcomeEmail({ to: email, plan }), ]); // Approval gate for enterprise plans if (plan === "enterprise") { const urls = await step("approval_urls", () => getResumeUrls("sales-team")); await step("notify_sales", () => fetch("https://hooks.slack.com/...", { method: "POST", body: JSON.stringify({ text: `Approve enterprise for ${email}: ${urls.approvalPage}` }), }) ); const { approved } = await waitForApproval({ timeout: 86400 }); if (!approved) return { success: false, error: "Rejected by sales" }; } // Server-side sleep — does NOT hold a worker thread await sleep(5); // Process a list in parallel with concurrency cap const features = ["billing", "analytics", "integrations"]; const results = await parallel(features, taskScript("f/provisioning/enable_feature"), { concurrency: 3 }); return { success: true, account_id: account.id, features: results, started_at: startedAt }; }); ``` -------------------------------- ### Interactive Raw App Creation Source: https://github.com/windmill-labs/windmill-cli-docs/blob/main/skills/raw-app/SKILL.md This command initiates an interactive wizard for creating a raw app. It is intended for use by a human directly in a terminal and should not be invoked by an agent. ```bash wmill app new ``` -------------------------------- ### Initialize a Local Windmill Project Source: https://github.com/windmill-labs/windmill-cli-docs/blob/main/README.md Initialize a new Windmill project directory. This creates a `wmill.yaml` for sync configuration and agent prompt files. It can also bind a workspace profile and import git-sync settings. ```sh wmill init ``` -------------------------------- ### Get Variable Source: https://github.com/windmill-labs/windmill-cli-docs/blob/main/skills/write-script-nativets/SKILL.md Retrieves a variable's value by its path. ```typescript async getVariable(path: string): Promise ``` -------------------------------- ### Get Variable Source: https://github.com/windmill-labs/windmill-cli-docs/blob/main/skills/write-script-bun/SKILL.md Retrieves a variable's value by its path. ```APIDOC ## getVariable ### Description Retrieves a variable's value by its path. ### Signature `async getVariable(path: string): Promise` ### Parameters * **path** (string) - The path of the variable. ``` -------------------------------- ### Get Windmill Version Source: https://github.com/windmill-labs/windmill-cli-docs/blob/main/skills/write-script-python3/SKILL.md Retrieves the current version of the Windmill platform. ```python def get_version() -> str ``` -------------------------------- ### get_shared_state Source: https://github.com/windmill-labs/windmill-cli-docs/blob/main/skills/write-script-python3/SKILL.md Gets the state from the shared folder using JSON deserialization. ```APIDOC ## get_shared_state ### Description Get the state from the shared folder using JSON. ### Args - path: The path to the JSON file (defaults to 'state.json') ### Returns - The deserialized state value ### Signature def get_shared_state(path: str = 'state.json') -> None ``` -------------------------------- ### get_shared_state_pickle Source: https://github.com/windmill-labs/windmill-cli-docs/blob/main/skills/write-script-python3/SKILL.md Gets the state from the shared folder using pickle deserialization. ```APIDOC ## get_shared_state_pickle ### Description Get the state from the shared folder using pickle. ### Args - path: The path to the pickle file (defaults to 'state.pickle') ### Returns - The deserialized state value ### Signature def get_shared_state_pickle(path: str = 'state.pickle') -> Any ``` -------------------------------- ### Client Initialization Source: https://github.com/windmill-labs/windmill-cli-docs/blob/main/skills/write-script-bun/SKILL.md Initialize the Windmill client with an authentication token and base URL. If not provided, it defaults to environment variables. ```APIDOC ## setClient ### Description Initialize the Windmill client with authentication token and base URL. ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Method `setClient(token?: string, baseUrl?: string): void` ### Parameters * **token** (string) - Optional - Authentication token (defaults to WM_TOKEN env variable) * **baseUrl** (string) - Optional - API base URL (defaults to BASE_INTERNAL_URL or BASE_URL env variable) ``` -------------------------------- ### State Management Source: https://github.com/windmill-labs/windmill-cli-docs/blob/main/skills/write-script-python3/SKILL.md Functions for setting and getting workflow and user state. ```APIDOC ## set_state ### Description Sets the workflow state. ### Parameters - **value** (Any) - Required - State value to set. - **path** (str | None) - Optional - State resource path override. ``` ```APIDOC ## get_state ### Description Gets the workflow state. ### Parameters - **path** (str | None) - Optional - State resource path override. ### Returns - **Any** - State value or None if not set. ``` ```APIDOC ## set_flow_user_state ### Description Sets the user state of a flow at a given key. ### Parameters - **key** (str) - Required - The key for the user state. - **value** (Any) - Required - The value to set for the user state. ``` ```APIDOC ## get_flow_user_state ### Description Gets the user state of a flow at a given key. ### Parameters - **key** (str) - Required - The key for the user state. ### Returns - **Any** - The user state value. ``` -------------------------------- ### Client Initialization Source: https://github.com/windmill-labs/windmill-cli-docs/blob/main/skills/write-script-nativets/SKILL.md Initialize the Windmill client with an authentication token and base URL. If not provided, it defaults to environment variables. ```APIDOC ## setClient ### Description Initialize the Windmill client with authentication token and base URL. ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Method `setClient(token?: string, baseUrl?: string): void` ### Parameters - **token** (string) - Optional - Authentication token (defaults to WM_TOKEN env variable) - **baseUrl** (string) - Optional - API base URL (defaults to BASE_INTERNAL_URL or BASE_URL env variable) ``` -------------------------------- ### Get Flow User State Source: https://github.com/windmill-labs/windmill-cli-docs/blob/main/skills/write-script-bun/SKILL.md Retrieves a user-defined state from a flow. ```APIDOC ## getFlowUserState ### Description Retrieves a user-defined state from a flow. ### Signature `async getFlowUserState(key: string, errorIfNotPossible?: boolean): Promise` ### Parameters * **key** (string) - The key of the state to retrieve. * **errorIfNotPossible** (boolean, optional) - If true, an error will be thrown if the state cannot be retrieved. ``` -------------------------------- ### Get Progress Source: https://github.com/windmill-labs/windmill-cli-docs/blob/main/skills/write-script-bun/SKILL.md Retrieves the progress of a job, clamped between 0 and 100. ```APIDOC ## getProgress ### Description Retrieves the progress of a job, clamped between 0 and 100. ### Signature `async getProgress(jobId?: any): Promise` ### Parameters * **jobId** (any, optional) - The job to get progress from. ### Returns * **Promise** - Optional clamped between 0 and 100 progress value. ``` -------------------------------- ### Get State Path Source: https://github.com/windmill-labs/windmill-cli-docs/blob/main/skills/write-script-python3/SKILL.md Retrieves the configured path for state storage from the environment. ```python def get_state_path() -> str ``` -------------------------------- ### init_global_client Source: https://github.com/windmill-labs/windmill-cli-docs/blob/main/skills/write-script-python3/SKILL.md Initializes a global client with a provided function. ```APIDOC ## init_global_client ### Description Initializes a global client instance using a provided function `f`. This is typically used for setting up shared resources or configurations at the start of a script. ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Method None (Python function) ### Endpoint None (Python function) ### Parameters * **f** (function) - Required - The function to use for initializing the global client. ### Request Example ```python def my_client_initializer(): # Logic to initialize and return a client return "initialized_client" client = client.init_global_client(my_client_initializer) ``` ### Response #### Success Response (Any) Returns the initialized global client. #### Response Example ```json "initialized_client" ``` ``` -------------------------------- ### Get Workspace ID Source: https://github.com/windmill-labs/windmill-cli-docs/blob/main/skills/write-script-python3/SKILL.md Retrieves the unique identifier for the current Windmill workspace. ```python def get_workspace() -> str ``` -------------------------------- ### Get Current User Information Source: https://github.com/windmill-labs/windmill-cli-docs/blob/main/skills/write-script-python3/SKILL.md Retrieves details about the currently authenticated user. ```python client.whoami() ``` ```python client.user() ``` -------------------------------- ### Get State Path Source: https://github.com/windmill-labs/windmill-cli-docs/blob/main/skills/write-script-nativets/SKILL.md Retrieves the state file path from environment variables. ```typescript getStatePath(): string ``` -------------------------------- ### Windmill CLI: List Resource Types with Schemas Source: https://github.com/windmill-labs/windmill-cli-docs/blob/main/skills/resources/SKILL.md Command to list all available resource types along with their JSON schemas. ```bash wmill resource-type list --schema ``` -------------------------------- ### Get State Path Source: https://github.com/windmill-labs/windmill-cli-docs/blob/main/skills/write-script-bun/SKILL.md Retrieves the path to the state file from environment variables. ```APIDOC ## getStatePath ### Description Retrieves the path to the state file from environment variables. ### Signature `getStatePath(): string` ``` -------------------------------- ### TypeScript (Bun) Script with Windmill SDK Source: https://context7.com/windmill-labs/windmill-cli-docs/llms.txt Example of a TypeScript script using the `windmill-client` SDK to interact with the Windmill platform. Demonstrates reading variables, running other scripts, loading files, managing state, and reporting progress. ```typescript // f/notify/send_slack_alert.ts import * as wmill from "windmill-client"; export async function main( slack: RT.Slack, // resource injected from workspace channel: string, message: string, job_id?: string ) { // Read a workspace variable const env = await wmill.getVariable("f/config/environment"); // Run another script and wait for the result const enriched = await wmill.runScriptByPath( "f/shared/enrich_message", { message, env } ); // Load a file from S3 const template: Uint8Array = await wmill.loadS3File({ s3: "templates/slack.txt" }); const body = new TextDecoder().decode(template).replace("{{MSG}}", enriched.text); // Store state across executions const prev = await wmill.getState() ?? { count: 0 }; await wmill.setState({ count: prev.count + 1 }); // Report progress await wmill.setProgress(50); // Post to Slack using the injected resource const resp = await fetch(`https://slack.com/api/chat.postMessage`, { method: "POST", headers: { Authorization: `Bearer ${slack.token}`, "Content-Type": "application/json" }, body: JSON.stringify({ channel, text: body }), }); await wmill.setProgress(100); return { ok: resp.ok, count: prev.count + 1 }; } ``` -------------------------------- ### getIdToken Source: https://github.com/windmill-labs/windmill-cli-docs/blob/main/skills/write-script-bunnative/SKILL.md Gets an OIDC JWT token for authentication to external services. (Enterprise Edition Only) ```APIDOC ## getIdToken ### Description Gets an OIDC JWT token for authentication to external services (e.g: Vault, AWS). (Enterprise Edition Only) ### Method ```typescript async getIdToken(audience: string, expiresIn?: number): Promise ``` ### Parameters * **audience** (string) - The audience of the token. * **expiresIn** (number, optional) - The number of seconds until the token expires. ### Returns * **Promise** - A promise that resolves to the JWT token. ``` -------------------------------- ### Importing npm and Deno Modules Source: https://github.com/windmill-labs/windmill-cli-docs/blob/main/skills/write-script-deno/SKILL.md Import npm packages using the `npm:` prefix and Deno standard library modules using their URLs. ```typescript // npm packages use npm: prefix import Stripe from "npm:stripe"; import { someFunction } from "npm:some-package"; // Deno standard library import { serve } from "https://deno.land/std/http/server.ts"; ``` -------------------------------- ### Get State Path Source: https://github.com/windmill-labs/windmill-cli-docs/blob/main/skills/write-script-python3/SKILL.md Retrieves the environment variable representing the state resource path. ```python client.state_path() ``` -------------------------------- ### Add Applied Migration Table to `raw_app.yaml` Source: https://github.com/windmill-labs/windmill-cli-docs/blob/main/skills/raw-app/SKILL.md Shows how to whitelist a newly created table in `raw_app.yaml` after applying a SQL migration. ```yaml data: tables: - main/users ``` -------------------------------- ### Job Status and Results Source: https://github.com/windmill-labs/windmill-cli-docs/blob/main/skills/write-script-deno/SKILL.md Wait for jobs to complete, get their results, or check their status. ```APIDOC ## waitJob ### Description Wait for a job to complete and return its result. ### Method `async waitJob(jobId: string, verbose: boolean = false): Promise` ### Parameters * **jobId** (string) - Required - ID of the job to wait for * **verbose** (boolean) - Optional - Enable verbose logging ### Returns * **Promise** - Job result when completed ``` ```APIDOC ## getResult ### Description Get the result of a completed job. ### Method `async getResult(jobId: string): Promise` ### Parameters * **jobId** (string) - Required - ID of the completed job ### Returns * **Promise** - Job result ``` ```APIDOC ## getResultMaybe ### Description Get the result of a job if completed, or its current status. ### Method `async getResultMaybe(jobId: string): Promise` ### Parameters * **jobId** (string) - Required - ID of the job ### Returns * **Promise** - Object with started, completed, success, and result properties ``` -------------------------------- ### Initialize Global Client Source: https://github.com/windmill-labs/windmill-cli-docs/blob/main/skills/write-script-python3/SKILL.md Initializes a global client, likely for use across multiple operations. ```python def init_global_client(f) ``` -------------------------------- ### getIdToken Source: https://github.com/windmill-labs/windmill-cli-docs/blob/main/skills/write-script-nativets/SKILL.md Gets an OIDC JWT token for authentication to external services. This is an Enterprise Edition feature. ```APIDOC ## getIdToken ### Description Gets an OIDC JWT token for authentication to external services (e.g: Vault, AWS). This is an Enterprise Edition feature. ### Signature ```typescript async getIdToken(audience: string, expiresIn?: number): Promise ``` ### Parameters * **audience** (string) - The audience of the token. * **expiresIn** (number, optional) - The number of seconds until the token expires. ### Returns * **Promise** - A promise that resolves with the JWT token. ``` -------------------------------- ### Handle Approvals with Checkpointing (TypeScript) Source: https://github.com/windmill-labs/windmill-cli-docs/blob/main/skills/write-workflow-as-code/SKILL.md Generate resume URLs within `step()` before sending them for approval. Use `waitForApproval()` to pause execution until approval is granted. ```typescript const urls = await step("get_urls", () => getResumeUrls()); await step("notify", () => sendApprovalEmail(urls.approvalPage)); const approval = await waitForApproval({ timeout: 3600 }); ``` -------------------------------- ### getIdToken Source: https://github.com/windmill-labs/windmill-cli-docs/blob/main/skills/write-script-bun/SKILL.md Gets an OIDC JWT token for authentication to external services. This is an Enterprise Edition feature. ```APIDOC ## getIdToken ### Description Gets an OIDC JWT token for authentication to external services (e.g., Vault, AWS). This is an Enterprise Edition feature. ### Method Signature `async getIdToken(audience: string, expiresIn?: number): Promise` ### Parameters #### Path Parameters - **audience** (string) - The audience of the token. - **expiresIn** (number, optional) - The number of seconds until the token expires. ### Returns - **Promise** - A promise that resolves to the JWT token. ``` -------------------------------- ### Using PostgreSQL Resource in Python Source: https://github.com/windmill-labs/windmill-cli-docs/blob/main/skills/resources/SKILL.md Shows how to use a PostgreSQL resource in Python by defining a TypedDict for type hinting and accessing the resource's configuration. ```python class postgresql(TypedDict): host: str port: int user: str password: str dbname: str def main(db: postgresql): # db contains the resource values pass ``` -------------------------------- ### Get Workflow State Source: https://github.com/windmill-labs/windmill-cli-docs/blob/main/skills/write-script-python3/SKILL.md Retrieves the current state of the workflow. Returns None if the state is not set. ```python client.state() ``` -------------------------------- ### Variable References in Resource Values Source: https://github.com/windmill-labs/windmill-cli-docs/blob/main/skills/resources/SKILL.md Demonstrates how to reference global or user-specific variables within resource configurations using the $var syntax. ```json { "value": { "api_key": "$var:g/all/api_key", "secret": "$var:u/admin/secret" } } ``` -------------------------------- ### Get Internal State (Deprecated) Source: https://github.com/windmill-labs/windmill-cli-docs/blob/main/skills/write-script-nativets/SKILL.md Deprecated. Use `getState` instead. Retrieves the internal state. ```typescript async getInternalState(): Promise ``` -------------------------------- ### Resource Management Source: https://github.com/windmill-labs/windmill-cli-docs/blob/main/skills/write-script-bun/SKILL.md Get a resource value by its path. Optionally, return undefined if the resource is empty. ```APIDOC ## getResource ### Description Get a resource value by path. ### Method `async getResource(path?: string, undefinedIfEmpty?: boolean): Promise` ### Parameters * **path** (string) - Optional - Path of the resource, defaults to internal state path. * **undefinedIfEmpty** (boolean) - Optional - If the resource does not exist, return undefined instead of throwing an error. ### Returns * **Promise** - Resource value ``` -------------------------------- ### Windmill CLI: List Resources Source: https://github.com/windmill-labs/windmill-cli-docs/blob/main/skills/resources/SKILL.md Command to list all available resources managed by Windmill. ```bash wmill resource list ``` -------------------------------- ### Resource Management Source: https://github.com/windmill-labs/windmill-cli-docs/blob/main/skills/write-script-deno/SKILL.md Get a resource value by its path, with an option to return undefined if the resource is empty. ```APIDOC ## getResource ### Description Get a resource value by path. ### Method `async getResource(path?: string, undefinedIfEmpty?: boolean): Promise` ### Parameters * **path** (string) - Optional - Path of the resource, defaults to internal state path * **undefinedIfEmpty** (boolean) - Optional - If the resource does not exist, return undefined instead of throwing an error ### Returns * **Promise** - Resource value ``` -------------------------------- ### Scaffold a New React App Source: https://context7.com/windmill-labs/windmill-cli-docs/llms.txt Use `wmill app new` to scaffold a new React application non-interactively, specifying the summary, path, framework, datatable, and schema. ```bash # Scaffold a new React 19 app non-interactively wmill app new \ --summary "Customer Dashboard" \ --path f/dashboards/customers \ --framework react19 \ --datatable main \ --schema customer_schema ``` -------------------------------- ### Create a new Windmill flow Source: https://github.com/windmill-labs/windmill-cli-docs/blob/main/skills/write-flow/SKILL.md Use this command to scaffold a new flow. It creates the necessary folder structure and a basic `flow.yaml` file. Add `--description` to include a longer explanation. ```bash wmill flow new f/folder/my_flow --summary "Short description" ``` -------------------------------- ### Resource References Source: https://github.com/windmill-labs/windmill-cli-docs/blob/main/skills/resources/SKILL.md Shows how one resource can reference another resource, enabling dependency management between different service configurations. ```json { "value": { "database": "$res:f/databases/postgres" } } ``` -------------------------------- ### Get Progress Source: https://github.com/windmill-labs/windmill-cli-docs/blob/main/skills/write-script-nativets/SKILL.md Retrieves the progress for a specific job. Returns a value clamped between 0 and 100, or null. ```typescript async getProgress(jobId?: any): Promise ``` -------------------------------- ### Get Internal State (Deprecated) Source: https://github.com/windmill-labs/windmill-cli-docs/blob/main/skills/write-script-bun/SKILL.md Retrieves the internal state. This method is deprecated and `getState` should be used instead. ```APIDOC ## getInternalState ### Description Retrieves the internal state. This method is deprecated and `getState` should be used instead. ### Signature `async getInternalState(): Promise` ```