UNPKG

meld

Version:

Meld: A template language for LLM prompts

147 lines (141 loc) 6.1 kB
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Meld CLI Usage - meld</title> <link rel="preconnect" href="https://fonts.googleapis.com"> <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin> <link href="https://fonts.googleapis.com/css2?family=Tektur:wght@800&family=Cousine:wght@400;700&display=swap" rel="stylesheet"> <link rel="stylesheet" href="/css/style.css"> <script src="/js/theme.js" defer></script> <script src="/js/terminal.js" defer></script> </head> <body> <header> <div class="container"> <a href="/" class="logo">meld</a> <nav> <ul> <li><a href="/" aria-current=&quot;page&quot;>Home</a></li> <li><a href="/docs/introduction/" >Docs</a></li> <li><a href="https://github.com/meldorg/meld">GitHub</a></li> </ul> </nav> </div> </header> <main> <div class="container"> <div class="docs-layout"> <aside class="docs-sidebar"> <nav> <h3>Documentation</h3> <ul class="nav-list"> <li><a href="/docs/introduction/" >Introduction</a></li> <li><a href="/docs/cli-usage/" aria-current=&quot;page&quot;>CLI Usage</a></li> <li><a href="/docs/sdk-usage/" >SDK Usage</a></li> <li><a href="/docs/variables/" >Variables</a></li> <li><a href="/docs/error-handling/" >Error Handling</a></li> <li><a href="/docs/grammar-reference/" >Grammar Reference</a></li> </ul> <h3>Directives</h3> <ul class="nav-list"> <li><a href="/docs/directives/" >Overview</a></li> <li><a href="/docs/directives/data/" >@data</a></li> <li><a href="/docs/directives/define/" >@define</a></li> <li><a href="/docs/directives/embed/" >@embed</a></li> <li><a href="/docs/directives/import/" >@import</a></li> <li><a href="/docs/directives/path/" >@path</a></li> <li><a href="/docs/directives/run/" >@run</a></li> <li><a href="/docs/directives/text/" >@text</a></li> </ul> </nav> </aside> <div class="docs-content"> <h1 id="meld-cli-usage" tabindex="-1">Meld CLI Usage</h1> <p>The Meld CLI provides a simple way to process Meld files from the command line.</p> <h2 id="installation" tabindex="-1">Installation</h2> <p>Install Meld globally to use the CLI:</p> <pre><code class="language-bash">npm install -g meld </code></pre> <p>Or use it from a local installation:</p> <pre><code class="language-bash">npm install meld npx meld &lt;options&gt; </code></pre> <h2 id="basic-usage" tabindex="-1">Basic Usage</h2> <p>Process a Meld file with default options:</p> <pre><code class="language-bash">meld input.meld </code></pre> <p>By default, this will:</p> <ul> <li>Parse and interpret the Meld file</li> <li>Generate output in XML format</li> <li>Save to a file with the same name but extension changed to <code>.llm</code></li> </ul> <h2 id="command-line-options" tabindex="-1">Command Line Options</h2> <h3 id="output-format" tabindex="-1">Output Format</h3> <p>Specify the output format with the <code>--format</code> or <code>-f</code> option:</p> <pre><code class="language-bash">meld input.meld --format md </code></pre> <p>Supported formats:</p> <ul> <li><code>xml</code> (default) - Outputs in XML format</li> <li><code>md</code> - Outputs in Markdown format</li> </ul> <h3 id="output-file" tabindex="-1">Output File</h3> <p>Specify the output file with the <code>--output</code> or <code>-o</code> option:</p> <pre><code class="language-bash">meld input.meld --output output.llm </code></pre> <p>By default, the output file uses the input filename with a new extension.</p> <h3 id="output-to-console" tabindex="-1">Output to Console</h3> <p>Print to stdout instead of writing to a file with the <code>--stdout</code> option:</p> <pre><code class="language-bash">meld input.meld --stdout </code></pre> <h3 id="combined-options" tabindex="-1">Combined Options</h3> <p>You can combine multiple options:</p> <pre><code class="language-bash">meld input.meld --format md --output custom.md --stdout </code></pre> <h2 id="file-extensions" tabindex="-1">File Extensions</h2> <p>Meld supports several file extensions:</p> <ul> <li><code>.meld</code> - Standard Meld files</li> <li><code>.meld.md</code> - Meld files with Markdown content</li> <li><code>.mll</code> - Alternative extension for Meld files</li> <li><code>.mll.md</code> - Alternative extension for Meld Markdown files</li> </ul> <h2 id="examples" tabindex="-1">Examples</h2> <p>Process a Meld file with default options:</p> <pre><code class="language-bash">meld document.meld </code></pre> <p>Process a Meld file and output as Markdown:</p> <pre><code class="language-bash">meld document.meld --format md </code></pre> <p>Process a Meld file and save with custom name:</p> <pre><code class="language-bash">meld document.meld --output result.llm </code></pre> <p>Process a Meld file and print to console:</p> <pre><code class="language-bash">meld document.meld --stdout </code></pre> <p>Process a Meld file with multiple options:</p> <pre><code class="language-bash">meld document.meld --format md --output result.md --stdout </code></pre> <h2 id="environment-variables" tabindex="-1">Environment Variables</h2> <p>Meld scripts can access environment variables using the <code>{{ENV_NAME}}</code> syntax:</p> <pre><code class="language-meld">@text token = &quot;{{ENV_TOKEN}}&quot; </code></pre> <p>You can set these when running the CLI:</p> <pre><code class="language-bash">ENV_TOKEN=12345 meld script.meld </code></pre> <h2 id="project-path" tabindex="-1">Project Path</h2> <p>The special <code>$PROJECTPATH</code> or <code>$.</code> variable refers to the directory where the Meld CLI is executed. All relative paths in Meld scripts are resolved relative to this directory.</p> </div> </div> </div> </main> <footer> <div class="container"> <p>&copy; 2025 meld - <a href="https://github.com/meldorg/meld">GitHub</a></p> </div> </footer> </body> </html>