{
  "slug": "markdown-runbook-extractor",
  "name": "gizza-ai/markdown-runbook-extractor",
  "version": "0.1.0",
  "title": "Markdown Runbook Extractor — Code Blocks to a Runnable Script — gizza.ai",
  "description": "Extract the named code blocks of a Markdown runbook into one runnable script plus an ordered task list. Strips $ prompts. Runs in your browser.",
  "tags": [
    "markdown runbook",
    "extract code blocks from markdown",
    "markdown to shell script",
    "runbook to script",
    "executable markdown",
    "markdown tangle",
    "literate markdown",
    "markdown code block extractor",
    "runbook checklist"
  ],
  "category": "documents",
  "urls": {
    "page": "https://gizza.ai/tools/markdown-runbook-extractor/",
    "markdown": "https://gizza.ai/tools/markdown-runbook-extractor/index.md",
    "descriptor": "https://gizza.ai/tools/markdown-runbook-extractor/tool.json",
    "deep_link_example": "https://gizza.ai/tools/markdown-runbook-extractor/?markdown=%23%20Deploy%20the%20API%0A%0A%23%23%20Install%20dependencies%0A%0A%60%60%60console%0A%24%20npm%20ci%0Aadded%2042%20packages%0A%60%60%60%0A%0A%23%23%20Run%20migrations%0A%0A%60%60%60bash%20name%3Dmigrate%0A.%2Fmanage.py%20migrate%0A%60%60%60&language=auto&output=script&tags=deploy%2C-slow&strip_prompts=true&echo_steps=true&fail_fast=true&skip_marked=true"
  },
  "cli": "gizza tool markdown-runbook-extractor '# Deploy the API\n\n## Install dependencies\n\n```console\n$ npm ci\nadded 42 packages\n```\n\n## Run migrations\n\n```bash name=migrate\n./manage.py migrate\n```'",
  "tool": {
    "description": "Extract the named, executable code blocks of a Markdown runbook into a single runnable script plus an ordered task list. Each fenced block becomes a numbered step; its name comes from the fence info string (```bash \"Install deps\", name=/title=/id=, or a {.bash #id} attribute), else a bold label or the nearest heading above it, else step-N. language selects the family (auto/shell/python/powershell/javascript/any). output='script' (default) returns a runnable script whose header lists the tasks; 'tasks' returns a Markdown checklist; 'json' returns structured steps with source line numbers. strip_prompts turns pasted terminal sessions into commands (drops '$ ' prompts and output lines); tags filters blocks by info-string tag ('deploy,-slow'); skip_marked comments out blocks tagged skip/no-run/example; echo_steps adds progress lines; fail_fast adds 'set -euo pipefail'. Returns the chosen text. Runs locally.",
    "parameters": {
      "additionalProperties": false,
      "properties": {
        "echo_steps": {
          "default": true,
          "description": "Emit a progress line before each step in script output (echo / print / Write-Host of '==> [i/n] name'), so a long run says where it is. Default true.",
          "type": "boolean"
        },
        "fail_fast": {
          "default": true,
          "description": "Add an abort-on-error header to script output: 'set -euo pipefail' for shell, \"$ErrorActionPreference = 'Stop'\" for PowerShell. No-op for Python/JavaScript, which already abort on an unhandled error. Default true.",
          "type": "boolean"
        },
        "language": {
          "default": "auto",
          "description": "Which fenced blocks are steps, and which script to emit: 'auto' (default) picks the family with the most blocks; 'shell' matches bash/sh/zsh/console/shell-session; 'python' matches python/py/pycon; 'powershell' matches powershell/pwsh/ps1; 'javascript' matches js/node; 'any' takes every fence that has a language tag (untagged fences are never steps).",
          "enum": [
            "auto",
            "shell",
            "python",
            "powershell",
            "javascript",
            "any"
          ],
          "type": "string"
        },
        "markdown": {
          "description": "The Markdown runbook to extract from — paste the whole document. Steps are its fenced code blocks (```bash …```).",
          "type": "string"
        },
        "output": {
          "default": "script",
          "description": "What to return: 'script' (default) — one runnable script whose header comment lists the ordered tasks; 'tasks' — a Markdown checklist of the steps with language, line count and source line; 'json' — {language, count, runnable, steps:[{index,name,language,line,tags,skipped,skip_reason,lines,code}]}.",
          "enum": [
            "script",
            "tasks",
            "json"
          ],
          "type": "string"
        },
        "skip_marked": {
          "default": true,
          "description": "Treat blocks tagged skip, no-run, norun, noexec, dont-run, ignore, example or output as documentation: they stay in the task list and appear commented out in the script instead of running. Set false to make them runnable. Default true.",
          "type": "boolean"
        },
        "strip_prompts": {
          "default": true,
          "description": "Turn a pasted terminal session into runnable commands: strip leading prompts ('$ ', '% ', 'PS C:\\>', '>>> ') and drop the un-prompted lines, which are command output. Blocks with no prompt at all are kept verbatim. Default true.",
          "type": "boolean"
        },
        "tags": {
          "default": "",
          "description": "Optional comma-separated tag filter over the fence info string (```bash#deploy, ```bash deploy slow, ```{.bash .deploy}). A block is kept if it carries ANY listed tag; prefix a tag with '-' to exclude it (e.g. 'deploy,-slow'). Empty (default) keeps every block.",
          "type": "string"
        }
      },
      "required": [
        "markdown"
      ],
      "type": "object"
    }
  }
}