* feat: add R language support Add R as a new supported scripting language in Windmill, following the same pattern used for Ruby. Includes: - Backend: ScriptLang::Rlang enum variant, DB migration, tree-sitter-r parser crate with tests, WASM parser binding, R executor with NSJail sandboxing, job dispatch and signature parsing - Frontend: language picker, R icon, syntax highlighting, editor bar insertions (Sys.getenv, get_variable, get_resource), schema inference, init code template, BETA badge - CLI: .r extension mapping, sync support, bootstrap template R scripts use `main <- function(...)` syntax, jsonlite for JSON serialization, and system curl for the Windmill client helper. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * feat: add R package resolution and installation Parse library()/require() calls from R scripts to extract dependencies. Resolve versions from CRAN, cache lockfiles in pip_resolution_cache, and install packages to a shared R library cache. The run step sets R_LIBS_USER so installed packages are available to the script. - Parser: parse_r_requirements() extracts package names from AST - Executor: resolve() generates lockfile, install() installs from CRAN - Worker lockfiles: wire up R resolve for dependency jobs Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * feat: add nsjail sandboxing for R resolve and install phases Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: fix R get_variable/get_resource and add sandbox annotation + e2e tests Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: fix R arg inference with JS fallback parser and get_variable/get_resource Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix flake * nsjail * nits * fix: R install improvements - suppress verbose output, flat lockfile logging, Dockerfile R support, rlimits - Suppress renv verbose output during resolve and install (controlled by #verbose annotation) - Filter renv from install list (already loaded, causes noisy restart message) - Log compact "resolved N packages" instead of full renv.lock JSON - Add R (r-base, r-cran-renv) to DockerfileFull and DockerfileFullEe - Use disable_rl for nsjail install config (R compiles from source) - Reduce default concurrency from 20 to 5 - Add rlang to openflow.openapi.yaml - Fix MainArgSignature (no_main_func -> auto_kind) after main merge Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * final * fix: remove accidental R install from multiplayer Dockerfile Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * fix: remove R from Windows build and DockerfileExtra Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * fix: rename R migration to avoid timestamp collision with trigger_filter_logic Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * all * fix: R install improvements - suppress verbose output, flat lockfile logging, Dockerfile R support, rlimits Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * fix: add clear error when Rscript binary is missing Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * fix: fix type errors in R fallback parser, use format! in wrap(), add R system prompts Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com> Co-authored-by: pyranota <pyra@duck.com>
145 lines
2.4 KiB
TypeScript
145 lines
2.4 KiB
TypeScript
import { SchemaProperty } from "./common.ts";
|
|
|
|
export interface ScriptMetadata {
|
|
summary: string;
|
|
description: string;
|
|
lock: string | string[];
|
|
is_template?: boolean;
|
|
kind: string;
|
|
schema: {
|
|
$schema: string;
|
|
type: string;
|
|
properties: { [name: string]: SchemaProperty };
|
|
required: string[];
|
|
};
|
|
}
|
|
|
|
export function defaultScriptMetadata(): ScriptMetadata {
|
|
return {
|
|
summary: "",
|
|
description: "",
|
|
lock: "",
|
|
kind: "script",
|
|
schema: {
|
|
$schema: "https://json-schema.org/draft/2020-12/schema",
|
|
type: "object",
|
|
properties: {},
|
|
required: [],
|
|
},
|
|
};
|
|
}
|
|
|
|
export const scriptBootstrapCode = {
|
|
python3: `def main():
|
|
return "Hello world"
|
|
`,
|
|
|
|
nativets: `export async function main() {
|
|
return "Hello world";
|
|
}
|
|
`,
|
|
|
|
bun: `// there are multiple modes to add as header: //nobundling //native //npm //nodejs
|
|
// https://www.windmill.dev/docs/getting_started/scripts_quickstart/typescript#modes
|
|
|
|
export async function main() {
|
|
return "Hello world";
|
|
}
|
|
`,
|
|
|
|
deno: `export async function main() {
|
|
return "Hello world";
|
|
}
|
|
`,
|
|
|
|
go: `package inner
|
|
func main() (interface{}, error) {
|
|
return "Hello world", nil
|
|
}
|
|
`,
|
|
|
|
mysql: `SELECT 'Hello world' AS message
|
|
`,
|
|
|
|
bigquery: `SELECT 'Hello world' AS message
|
|
`,
|
|
|
|
snowflake: `SELECT 'Hello world' AS message
|
|
`,
|
|
|
|
mssql: `SELECT 'Hello world' AS message
|
|
`,
|
|
|
|
graphql: `query() {
|
|
demo() {}
|
|
}`,
|
|
|
|
postgresql: `SELECT 'Hello world' AS message
|
|
`,
|
|
|
|
bash: `echo "Hello world"
|
|
`,
|
|
duckdb: `SELECT 'Hello world' AS message`,
|
|
|
|
oracledb: `SELECT 'Hello world' AS message`,
|
|
powershell: `Write-Output "Hello world"`,
|
|
|
|
php: `<?php
|
|
function main() {
|
|
return "Hello world";
|
|
}
|
|
`,
|
|
|
|
csharp: `class Script
|
|
{
|
|
public static void Main()
|
|
{
|
|
Console.WriteLine("Hello World");
|
|
}
|
|
}
|
|
`,
|
|
nu: `
|
|
def main [] {
|
|
print "Hello World"
|
|
}
|
|
`,
|
|
|
|
rust: `fn main() -> Result<(), String> {
|
|
println!("Hello World");
|
|
Ok(())
|
|
}
|
|
`,
|
|
|
|
ansible: `---
|
|
inventory:
|
|
- resource_type: ansible_inventory
|
|
---
|
|
- name: Echo
|
|
hosts: 127.0.0.1
|
|
connection: local
|
|
|
|
tasks:
|
|
- name: Print debug message
|
|
debug:
|
|
msg: "Hello, world!"
|
|
`,
|
|
java: `
|
|
public class Main {
|
|
public static void main() {
|
|
System.out.println("Hello World");
|
|
}
|
|
}
|
|
`,
|
|
ruby: `
|
|
def main a, b, c
|
|
puts a, b, c
|
|
end
|
|
`,
|
|
rlang: `
|
|
main <- function(x, name = "default") {
|
|
return(list(result = x, name = name))
|
|
}
|
|
`,
|
|
// for related places search: ADD_NEW_LANG
|
|
};
|