Skip to main content

Scripting Plugin - Workflow Automation

ยท 2 min read
Mark Dierolf
Creator of TokenRing AI

The Scripting plugin brings powerful workflow automation with variables, functions, and LLM integration.

Key Featuresโ€‹

๐Ÿ“ Variablesโ€‹

Store and manipulate data:

/var $name = "Alice"
/var $topic = "AI safety"
/var $summary = llm("Summarize $topic")

๐Ÿ”ง Functionsโ€‹

Define reusable functions:

# Static functions
/func static greet($name) => "Hello, $name!"

# LLM functions
/func llm search($query, $site) => "Search for $query on $site"

# JavaScript functions
/func js calculate($x, $y) { return $x + $y; }

๐Ÿ“‹ Lists and Iterationโ€‹

Work with collections:

/list @files = ["file1.txt", "file2.txt", "file3.txt"]
/for $file in @files { /echo Processing $file }

๐Ÿ”€ Control Flowโ€‹

Conditionals and loops:

/prompt $username "Enter your name:"
/confirm $proceed "Continue?"
/if $proceed { /echo Continuing... } else { /echo Stopped }
/while $condition { /echo Running... }

๐ŸŽฏ Predefined Scriptsโ€‹

Run command sequences by name:

export async function setupProject(projectName) {
return [
`/agent switch writer`,
`/template run projectSetup ${projectName}`,
`/tools enable filesystem`,
`/agent switch publisher`
];
}

Global Functionsโ€‹

Packages can register global functions:

scriptingService.registerFunction({
name: "readFile",
item: {
type: 'js',
params: ['path'],
body: `return fs.readFileSync(path, 'utf-8');`
}
});

Usageโ€‹

# Variables with LLM
/var $analysis = llm("Analyze this code: $code")

# Function calls
/call search("quantum computing", "Google Scholar")

# Iteration
/for $f in @ts-files { /echo $basename at $path }

# Scripts
/script run setupProject myapp

Inspirationโ€‹

Scripting operators inspired by mlld - a modular LLM scripting language.

Automate repetitive tasks, create reusable workflows, and build powerful AI-driven automation.


Mark Dierolf
Creator of TokenRing AI