### Run Development Server Source: https://github.com/ideamans/chartjs2img/blob/main/docs/en/developer/index.md Installs dependencies and starts the HTTP server for local development. ```bash bun install bun run dev ``` -------------------------------- ### GET /examples Source: https://github.com/ideamans/chartjs2img/blob/main/docs/en/guide/http/index.md Provides a gallery of examples for chart rendering. ```APIDOC ## GET /examples ### Description Provides a gallery of examples for chart rendering. ### Method GET ### Endpoint /examples ### Response #### Success Response (200) - (HTML content displaying examples) ``` -------------------------------- ### Render all built-in examples Source: https://github.com/ideamans/chartjs2img/blob/main/docs/en/guide/cli/index.md Use the 'examples' subcommand to render all bundled Chart.js examples into a specified output directory. ```bash chartjs2img examples -o ./out ``` ```bash chartjs2img examples -o ./out -f jpeg -q 80 ``` -------------------------------- ### Render example via curl Source: https://github.com/ideamans/chartjs2img/blob/main/docs/en/developer/adding-plugin.md After starting the development server with `bun run dev`, use `curl` to POST a JSON request to the `/render` endpoint, specifying the chart configuration for the new plugin. ```bash curl -X POST http://localhost:3000/render \ -H 'Content-Type: application/json' \ -d '{"chart":{"type":"mynew","data":{...}}}' \ -o /tmp/mynew.png open /tmp/mynew.png ``` -------------------------------- ### GET /examples Source: https://github.com/ideamans/chartjs2img/blob/main/README.md Displays a gallery of built-in chart examples, rendered in real-time. Useful for visual verification and as a reference. ```APIDOC ## GET /examples ### Description Built-in gallery page showing chart examples rendered in real time. Useful for visual verification and as a reference for building chart configurations. ### Method GET ### Endpoint /examples ``` -------------------------------- ### Run Example Renders Source: https://github.com/ideamans/chartjs2img/blob/main/docs/en/gallery/index.md Use this command to render all examples into the docs/public/examples directory. This is useful for generating static assets for documentation. ```bash bun run docs:examples ``` -------------------------------- ### Start Development Server Source: https://github.com/ideamans/chartjs2img/blob/main/docs/en/gallery/index.md Starts the development server, making the live gallery accessible at http://localhost:3000/examples. This is useful for previewing changes and testing. ```bash bun run dev ``` -------------------------------- ### Generate All Example Charts Source: https://context7.com/ideamans/chartjs2img/llms.txt Generate all built-in example charts to a specified directory. Options include output format and quality. ```bash chartjs2img examples -o ./gallery ``` ```bash chartjs2img examples -o ./gallery -f jpeg -q 80 ``` -------------------------------- ### Batch Render Examples to PNG Source: https://github.com/ideamans/chartjs2img/blob/main/README.md Renders all bundled chart examples into PNG files in the specified output directory. ```bash chartjs2img examples -o ./gallery ``` -------------------------------- ### Install chartjs2img on Windows (PowerShell) Source: https://github.com/ideamans/chartjs2img/blob/main/docs/en/guide/index.md Installs the chartjs2img binary using PowerShell. This command downloads and executes the installation script. ```powershell irm https://bin.ideamans.com/install/chartjs2img.ps1 | iex ``` -------------------------------- ### Batch Render Examples to JPEG Source: https://github.com/ideamans/chartjs2img/blob/main/README.md Renders all bundled chart examples into JPEG files with a specified quality setting. ```bash chartjs2img examples -o ./gallery -f jpeg -q 80 ``` -------------------------------- ### List Installed Skills Source: https://github.com/ideamans/chartjs2img/blob/main/docs/en/ai/gh-skill.md Displays all skills currently installed in your agent host. Use this to verify installations and check available skills. ```bash gh skill list ``` -------------------------------- ### Sudo Fallback Installation Source: https://github.com/ideamans/chartjs2img/blob/main/plugins/chartjs2img/skills/chartjs2img-install/SKILL.md Provides a fallback installation method using sudo if the primary installation path is not writable. This copies the binary to /tmp and instructs the user on how to move it to a system-wide location. ```bash FALLBACK="/tmp/chartjs2img" cp "$BIN" "$FALLBACK" chmod +x "$FALLBACK" echo "chartjs2img is ready at $FALLBACK." echo "Install it system-wide with:" echo " sudo mv $FALLBACK /usr/local/bin/chartjs2img" ``` -------------------------------- ### Start Chart.js to Image Server Source: https://context7.com/ideamans/chartjs2img/llms.txt Starts the chartjs2img HTTP server. Configure the port, host, and API key using command-line flags or environment variables. ```bash chartjs2img serve ``` ```bash chartjs2img serve --port 8080 --api-key s3cr3t ``` ```bash PORT=8080 HOST=127.0.0.1 API_KEY=s3cr3t chartjs2img serve ``` -------------------------------- ### Install chartjs2img Source: https://github.com/ideamans/chartjs2img/blob/main/docs/en/developer/library-api.md Install the chartjs2img package using npm or bun. For development from source, clone the repository, install dependencies, and build the library. ```bash # from npm (once published) bun add chartjs2img # or npm install chartjs2img # from source (dev) git clone https://github.com/ideamans/chartjs2img cd chartjs2img bun install bun run build:lib # produces ./dist/*.js + *.d.ts ``` -------------------------------- ### Run Documentation Site Locally Source: https://github.com/ideamans/chartjs2img/blob/main/docs/en/developer/index.md Starts the VitePress development server for the documentation site. ```bash bun run docs:dev ``` -------------------------------- ### Install Project Dependencies Source: https://github.com/ideamans/chartjs2img/blob/main/README.md Installs Node.js packages for the chartjs2img project using Bun. This command should be run after cloning the repository. ```bash cd chartjs2img bun install ``` -------------------------------- ### Install Bun Source: https://github.com/ideamans/chartjs2img/blob/main/README.md Installs Bun, a JavaScript runtime, on macOS and Linux. Restart your terminal or source your shell profile after installation. ```bash # macOS / Linux curl -fsSL https://bun.sh/install | bash # Then restart your terminal, or run: source ~/.bashrc # or ~/.zshrc ``` -------------------------------- ### HTTP API GET /cache/:hash Example Source: https://github.com/ideamans/chartjs2img/blob/main/README.md Retrieve a previously rendered image using its cache hash. First, render the chart using POST /render to obtain the hash, then use it with GET /cache/:hash. ```bash # Render and get the cache hash HASH=$(curl -s -D- -X POST http://localhost:3000/render \ -H 'Content-Type: application/json' \ -d '{"chart":{"type":"bar","data":{"labels":["A","B"],"datasets":[{"data":[1,2]}]}}}' \ -o /dev/null | grep -i x-cache-hash | awk '{print $2}' | tr -d '\r') # Access the cached image later curl -o chart.png "http://localhost:3000/cache/$HASH" ``` -------------------------------- ### Install chartjs2img with custom install directory Source: https://github.com/ideamans/chartjs2img/blob/main/docs/en/guide/install.md Install chartjs2img to a custom directory on Linux/macOS by specifying the --install-dir flag. ```shell curl -fsSL https://bin.ideamans.com/install/chartjs2img.sh | bash -s -- --install-dir "$HOME/bin" ``` -------------------------------- ### Verify Bun Installation Source: https://github.com/ideamans/chartjs2img/blob/main/README.md Checks if Bun is installed and accessible in your system's PATH. ```bash bun --version ``` -------------------------------- ### Install the chartjs2img plugin Source: https://github.com/ideamans/chartjs2img/blob/main/docs/en/ai/claude-plugin.md Install the chartjs2img plugin from the added marketplace. This registers the necessary slash commands for chart manipulation. ```shell /plugin install chartjs2img@ideamans-plugins ``` -------------------------------- ### Verify Installation Source: https://github.com/ideamans/chartjs2img/blob/main/plugins/chartjs2img/skills/chartjs2img-install/SKILL.md Checks if the chartjs2img executable is correctly installed by running the --version command. ```bash "$TARGET_DIR/chartjs2img" --version ``` -------------------------------- ### Install chartjs2img Skills for Claude Code Agent Source: https://github.com/ideamans/chartjs2img/blob/main/docs/en/ai/gh-skill.md Installs the three core chartjs2img skills (`render`, `author`, `install`) into the `claude-code` agent. Run these commands independently to install each skill. ```bash gh skill install ideamans/chartjs2img plugins/chartjs2img/skills/chartjs2img-render --agent claude-code gh skill install ideamans/chartjs2img plugins/chartjs2img/skills/chartjs2img-author --agent claude-code gh skill install ideamans/chartjs2img plugins/chartjs2img/skills/chartjs2img-install --agent claude-code ``` -------------------------------- ### Find Writable Install Directory Source: https://github.com/ideamans/chartjs2img/blob/main/plugins/chartjs2img/skills/chartjs2img-install/SKILL.md Iterate through a list of candidate directories to find one that is on the system's PATH and is writable. This is used for fresh installations to place the binary in a user-accessible location. ```bash for d in "$HOME/.local/bin" "$HOME/bin" "/usr/local/bin" "/opt/homebrew/bin"; do case ":$PATH:" in ":$d:"*) :;; *) continue;; esac if [ -d "$d" ] && [ -w "$d" ]; then echo "ok: $d" elif [ ! -d "$d" ] && mkdir -p "$d" 2>/dev/null; then echo "ok: $d (created)" fi done ``` -------------------------------- ### Examples Gallery Source: https://github.com/ideamans/chartjs2img/blob/main/docs/en/guide/http/index.md The /examples endpoint serves a built-in gallery that renders every example chart live. It displays each chart alongside its source JSON, serving as a convenient way to verify service operation and explore available chart types. ```APIDOC ## GET /examples ### Description Provides a live gallery of all example charts with their source JSON. ### Method GET ### Endpoint `/examples` ### Notes If `API_KEY` is configured, this endpoint also requires the API key for access. ``` -------------------------------- ### Install chartjs2img on macOS / Linux Source: https://github.com/ideamans/chartjs2img/blob/main/docs/en/guide/index.md Installs the chartjs2img binary using curl and bash. Ensure you have curl installed. ```sh curl -fsSL https://bin.ideamans.com/install/chartjs2img.sh | bash ``` -------------------------------- ### Verify plugin integration with CLI commands Source: https://github.com/ideamans/chartjs2img/blob/main/docs/en/developer/adding-plugin.md Use `bun run typecheck` for type checking. Render the new example using `bun run cli -- render` or `bun run cli -- examples` to verify its output. Check LLM output with `bun run cli -- llm`. ```bash # 1. Type check bun run typecheck # 2. Render the new example alone bun run cli -- render < <(jq '.[-1].config' <(cat src/examples.ts | ...)) -o /tmp/new.png # Or simpler: run the examples CLI and look at the last file bun run cli -- examples -o /tmp/out ls /tmp/out | tail # 3. Make sure chartjs2img llm shows your new section bun run cli -- llm | grep -A 5 "My New Plugin" # 4. Run the HTTP server and render via curl bun run dev & ``` -------------------------------- ### Minimal Chart.js Bar Chart Render Example Source: https://github.com/ideamans/chartjs2img/blob/main/plugins/chartjs2img/skills/chartjs2img-render/SKILL.md A minimal example demonstrating how to pipe a JSON Chart.js configuration to the chartjs2img CLI for rendering a bar chart. It also shows how to check for errors. ```bash echo '{"type":"bar","data":{"labels":["A","B","C"],"datasets":[{"data":[1,2,3]}]}}' \ | chartjs2img render -o /tmp/demo.png 2> /tmp/demo.err ``` ```bash ls -l /tmp/demo.png ``` ```bash cat /tmp/demo.err # should be empty on a clean render ``` -------------------------------- ### Verify chartjs2img CLI installation Source: https://github.com/ideamans/chartjs2img/blob/main/docs/en/ai/claude-plugin.md After installation, run this command to confirm the chartjs2img CLI is accessible and to check its version. ```shell chartjs2img --version ``` -------------------------------- ### Install Skill Pinned to a Specific Version Source: https://github.com/ideamans/chartjs2img/blob/main/docs/en/ai/gh-skill.md Installs a skill, pinning it to a specific Git tag (e.g., `v0.2.2`) instead of the latest commit on the main branch. This ensures reproducible installations. ```bash gh skill install ideamans/chartjs2img plugins/chartjs2img/skills/chartjs2img-render \ --ref v0.2.2 \ --agent claude-code ``` -------------------------------- ### Add new example to examples.ts Source: https://github.com/ideamans/chartjs2img/blob/main/docs/en/developer/adding-plugin.md Append a new entry to the `EXAMPLES` array in `src/examples.ts` to showcase the new chart type or plugin. This entry should include a title, configuration, width, and height. ```typescript { title: 'My New Chart', config: { type: 'mynew', data: { // ...realistic sample data... }, options: { plugins: { title: { display: true, text: 'My New Chart example' } } } }, width: 800, height: 600, } ``` -------------------------------- ### Install Plugin via Claude Code Marketplace Source: https://github.com/ideamans/chartjs2img/blob/main/plugins/chartjs2img/README.md Commands to add the plugin marketplace and then install the chartjs2img plugin within Claude Code. ```bash /plugin marketplace add ideamans/claude-public-plugins /plugin install chartjs2img@ideamans-plugins ``` -------------------------------- ### Install the chartjs2img CLI binary Source: https://github.com/ideamans/chartjs2img/blob/main/docs/en/ai/claude-plugin.md Execute this command to install or update the chartjs2img CLI binary. It automatically detects your OS, downloads the correct asset, verifies checksums, and places the binary in a PATH directory. ```shell /chartjs2img-install ``` -------------------------------- ### Start chartjs2img HTTP server Source: https://github.com/ideamans/chartjs2img/blob/main/docs/en/guide/http/index.md Run the chartjs2img server on a specified port. The server will print its listening address and available endpoints on startup. ```bash chartjs2img serve --port 3000 ``` -------------------------------- ### CLI Examples Arguments Interface Source: https://github.com/ideamans/chartjs2img/blob/main/docs/en/developer/types.md Defines the structure for arguments when generating chart examples via the CLI. Requires an output directory and supports image format and quality. ```typescript interface CliExamplesArgs { outdir: string // required format?: 'png' | 'jpeg' quality?: number } ``` -------------------------------- ### Build chartjs2img from source Source: https://github.com/ideamans/chartjs2img/blob/main/docs/en/guide/install.md Build the chartjs2img executable from source using Bun. This involves cloning the repository, installing dependencies, and running the build command. ```shell git clone https://github.com/ideamans/chartjs2img cd chartjs2img bun install bun run build # produces ./chartjs2img in the repo root ``` -------------------------------- ### Display version information Source: https://github.com/ideamans/chartjs2img/blob/main/docs/en/guide/cli/index.md Print the installed version of chartjs2img. ```bash chartjs2img version ``` ```bash --version ``` -------------------------------- ### Bar Chart Example Source: https://github.com/ideamans/chartjs2img/blob/main/docs/en/gallery/basic.md A basic bar chart implementation. Use this for comparing discrete categories. ```javascript { type: "bar", data: { labels: ["January", "February", "March", "April", "May", "June", "July"], datasets: [ { label: "My First dataset", backgroundColor: "rgba(200,200,200,0.2)", data: [65, 59, 80, 81, 56, 55, 40] }, { label: "My Second dataset", backgroundColor: "rgba(151,187,205,0.2)", data: [28, 48, 40, 19, 86, 27, 90] } ] }, options: { responsive: true } } ``` -------------------------------- ### Pie Chart Example Source: https://github.com/ideamans/chartjs2img/blob/main/docs/en/gallery/basic.md A standard pie chart. Use for showing proportions of a whole. ```javascript { type: "pie", data: { labels: ["Red", "Green", "Yellow", "Grey", "Dark Grey"], datasets: [ { data: [300, 50, 100, 40, 120], backgroundColor: [ "#F7464A", "#46BFBD", "#FDB45C", "#949FB1", "#4D5360" ], hoverBackgroundColor: [ "#FF5A5E", "#5AD3D1", "#FFC870", "#A8B3C1", "#616774" ] } ] }, options: { responsive: true } } ``` -------------------------------- ### Run Docker Container with Configuration Source: https://github.com/ideamans/chartjs2img/blob/main/docs/en/guide/http/docker.md Run the chartjs2img Docker container with environment variables for configuration. This example sets API_KEY, CONCURRENCY, CACHE_MAX_ENTRIES, and CACHE_TTL_SECONDS. ```bash docker run -p 3000:3000 \ -e API_KEY=s3cret \ -e CONCURRENCY=4 \ -e CACHE_MAX_ENTRIES=2000 \ -e CACHE_TTL_SECONDS=7200 \ chartjs2img ``` -------------------------------- ### GET /render endpoint usage Source: https://github.com/ideamans/chartjs2img/blob/main/docs/en/guide/http/index.md Example of using the `GET /render` endpoint with chart configuration and dimensions passed as URL query parameters. The chart JSON must be URL-encoded. ```http GET /render?chart={"type":"bar","data":{...}}&width=400&height=300 ``` -------------------------------- ### Agent System Prompt with Full Documentation Source: https://github.com/ideamans/chartjs2img/blob/main/docs/en/ai/llms-txt.md This example shows a system prompt for an agent, instructing it to use the complete contents of `llms-full.txt` as its reference for authoring Chart.js configurations. It outlines a validation and retry process. ```text SYSTEM: You are going to author Chart.js configuration JSON for chartjs2img. The complete reference follows. It covers the input format, every supported chart type, every bundled plugin's options, error feedback, and canonical examples. --- --- When you produce a Chart.js configuration: 1. Validate it via a subsequent `chartjs2img render` call. 2. If X-Chart-Messages (HTTP) or stderr (CLI) is non-empty, fix the config and retry. 3. Report the final JSON plus the rendered image path. ``` -------------------------------- ### Run CLI Help Source: https://github.com/ideamans/chartjs2img/blob/main/docs/en/developer/index.md Displays help information for the command-line interface. ```bash bun run cli -- help ``` -------------------------------- ### Display help information Source: https://github.com/ideamans/chartjs2img/blob/main/docs/en/guide/cli/index.md Print the full usage banner, including all subcommands, flags, and environment variables. ```bash chartjs2img help ``` ```bash --help ``` -------------------------------- ### Install Plugin Directly from Local Repo (Claude Code) Source: https://github.com/ideamans/chartjs2img/blob/main/plugins/chartjs2img/README.md Use this command to add a local plugin marketplace for testing purposes in Claude Code. This requires the repository to be registered or used with a specific scope. ```bash /plugin marketplace add ./plugins/chartjs2img ``` -------------------------------- ### Troubleshooting: Install CJK Fonts Source: https://github.com/ideamans/chartjs2img/blob/main/docs/en/guide/http/docker.md If Japanese/CJK text shows up as boxes in a customized Dockerfile, install the Noto Sans CJK and Noto Color Emoji fonts. This Dockerfile snippet updates apt, installs the fonts, and cleans up. ```dockerfile RUN apt-get update && apt-get install -y \ fonts-noto-cjk fonts-noto-color-emoji \ && rm -rf /var/lib/apt/lists/* ``` -------------------------------- ### Enable API Key via CLI Flag Source: https://github.com/ideamans/chartjs2img/blob/main/docs/en/guide/http/auth.md Use the `--api-key` flag with the `serve` command to enable API key authentication. ```bash chartjs2img serve --api-key s3cret ``` -------------------------------- ### Install Chromium on Debian/Ubuntu Source: https://github.com/ideamans/chartjs2img/blob/main/README.md Installs Chromium browser on Debian-based Linux distributions. This is a prerequisite for chartjs2img on systems where it cannot auto-download Chrome for Testing. ```bash # Debian/Ubuntu sudo apt install chromium-browser # or sudo apt install chromium ``` -------------------------------- ### Render Chart with Options Source: https://github.com/ideamans/chartjs2img/blob/main/README.md Renders a chart with specified dimensions, format, and quality settings. ```bash bun run src/index.ts render -i chart.json -o chart.png -w 1200 -h 400 -f jpeg -q 85 ``` -------------------------------- ### Verify chartjs2img installation Source: https://github.com/ideamans/chartjs2img/blob/main/docs/en/guide/index.md Checks if the chartjs2img command is accessible and displays its help message. If not found, open a new shell or check the installation. ```sh chartjs2img --help ``` -------------------------------- ### Check if chartjs2img is Installed Source: https://github.com/ideamans/chartjs2img/blob/main/plugins/chartjs2img/skills/chartjs2img-install/SKILL.md Verify if the `chartjs2img` command is available in the system's PATH and retrieve its installed version. This is crucial for determining if an update is needed. ```bash if command -v chartjs2img >/dev/null 2>&1; then INSTALLED_PATH="$(command -v chartjs2img)" INSTALLED_VERSION="$(chartjs2img --version 2>&1 | grep -oE 'v[0-9.]+' || echo 'unknown')" else INSTALLED_PATH="" fi ``` -------------------------------- ### Fetch llms.txt Index Source: https://github.com/ideamans/chartjs2img/blob/main/docs/en/ai/llms-txt.md Use this command to fetch the first 20 lines of the `llms.txt` index file. This is useful for agents to quickly see the structure of the documentation. ```bash curl -s https://chartjs2img.ideamans.com/llms.txt | head -20 ``` -------------------------------- ### Get Server Health Status Source: https://context7.com/ideamans/chartjs2img/llms.txt The GET /health endpoint provides server status, including browser connection, concurrency, and cache statistics. It does not require authentication. ```bash curl http://localhost:3000/health ``` ```json { "status": "ok", "version": "0.3.0", "renderer": { "browserConnected": true, "concurrency": { "max": 8, "active": 2, "pending": 0 }, "activePages": 2, "maxRenderTimeSeconds": 30, "pageSafetyNetSeconds": 70, "pageTimeoutSeconds": 70 }, "cache": { "size": 42, "maxEntries": 1000, "ttlSeconds": 3600 } } ``` -------------------------------- ### Detect Platform (Architecture) Source: https://github.com/ideamans/chartjs2img/blob/main/plugins/chartjs2img/skills/chartjs2img-install/SKILL.md Use `uname -m` to determine the system architecture. Normalize the output to 'amd64' or 'arm64' for release asset naming. ```bash uname -m ``` -------------------------------- ### Render Chart via HTTP GET Source: https://context7.com/ideamans/chartjs2img/llms.txt Use the GET /render endpoint with URL-encoded JSON for chart configuration. This is suitable for embedding in HTML `` tags. ```bash curl -G http://localhost:3000/render \ --data-urlencode 'chart={"type":"pie","data":{"labels":["A","B","C"],"datasets":[{"data":[30,50,20],"backgroundColor":["#ff6384","#36a2eb","#ffce56"]}]}}' \ --data-urlencode 'width=400' \ --data-urlencode 'height=400' \ -o pie.png ``` ```html ``` -------------------------------- ### Render from file to file Source: https://github.com/ideamans/chartjs2img/blob/main/docs/en/guide/cli/index.md Specify an input JSON file and an output image file for rendering. ```bash chartjs2img render -i chart.json -o chart.png ``` -------------------------------- ### HTTP GET /render Query Parameters Schema Source: https://github.com/ideamans/chartjs2img/blob/main/docs/en/developer/types.md The query parameters used for the `/render` endpoint when using the GET method. Chart configuration is URL-encoded JSON. ```http GET /render?chart= &width=800 &height=600 &devicePixelRatio=2 &backgroundColor=white &format=png &quality=90 ``` -------------------------------- ### Render Chart from Stdin to File Source: https://context7.com/ideamans/chartjs2img/llms.txt Pipe a Chart.js JSON configuration to the 'render' command to create an image file. Use '-o' to specify the output file. ```bash echo '{"type":"bar","data":{"labels":["A","B","C"],"datasets":[{"label":"Data","data":[10,20,30]}]}}' \ | chartjs2img render -o chart.png ``` -------------------------------- ### Install Skills via GitHub CLI Source: https://github.com/ideamans/chartjs2img/blob/main/plugins/chartjs2img/README.md Commands to install the individual chartjs2img skills using the GitHub CLI. The `--agent claude-code` flag is used for the render skill. ```bash gh skill install ideamans/chartjs2img plugins/chartjs2img/skills/chartjs2img-render --agent claude-code gh skill install ideamans/chartjs2img plugins/chartjs2img/skills/chartjs2img-author gh skill install ideamans/chartjs2img plugins/chartjs2img/skills/chartjs2img-install ``` -------------------------------- ### Detect Platform (OS) Source: https://github.com/ideamans/chartjs2img/blob/main/plugins/chartjs2img/skills/chartjs2img-install/SKILL.md Use `uname -s` to determine the operating system. Normalize the output to 'linux', 'darwin', or 'windows' for release asset naming. ```bash uname -s ``` -------------------------------- ### Run Development Server with Custom Port Source: https://github.com/ideamans/chartjs2img/blob/main/README.md Starts the chartjs2img development server on a specified port and with an API key. This demonstrates passing command-line arguments to the server script. ```bash bun run src/index.ts serve --port 8080 --api-key mysecret ``` -------------------------------- ### API Key Authentication Examples Source: https://github.com/ideamans/chartjs2img/blob/main/README.md Authenticate API requests using an API key. The key can be provided via the 'Authorization' header, 'X-API-Key' header, or as a query parameter. ```bash # Authorization header curl -H 'Authorization: Bearer YOUR_KEY' ... ``` ```bash # X-API-Key header curl -H 'X-API-Key: YOUR_KEY' ... ``` ```bash # Query parameter curl 'http://localhost:3000/render?api_key=YOUR_KEY&chart=...' ``` -------------------------------- ### HTTP API GET /health Response Source: https://github.com/ideamans/chartjs2img/blob/main/README.md The GET /health endpoint returns server status, renderer statistics, and cache information. This JSON response indicates the operational state of the service. ```json { "status": "ok", "renderer": { "browserConnected": true, "concurrency": { "max": 8, "active": 2, "pending": 0 }, "activePages": 2, "pageTimeoutSeconds": 60 }, "cache": { "size": 42, "maxEntries": 1000, "ttlSeconds": 3600 } } ``` -------------------------------- ### Download and install chartjs2img from GitHub Releases (Windows) Source: https://github.com/ideamans/chartjs2img/blob/main/docs/en/guide/install.md Manually download and extract the chartjs2img binary for Windows from GitHub Releases using PowerShell. Remember to move the executable to a directory on your PATH. ```powershell $Version = "0.2.2" $Url = "https://github.com/ideamans/chartjs2img/releases/download/v$Version/chartjs2img_${Version}_windows_amd64.zip" Invoke-WebRequest $Url -OutFile chartjs2img.zip Expand-Archive chartjs2img.zip -DestinationPath . # move chartjs2img.exe somewhere on your PATH, e.g. %USERPROFILE%\bin ``` -------------------------------- ### Author a chart from a description Source: https://github.com/ideamans/chartjs2img/blob/main/docs/en/ai/claude-plugin.md Use this command to have Claude Code author a chart configuration based on a textual description. The skill generates a realistic skeleton, validates it, and iterates until a clean render is achieved. ```shell /chartjs2img-author monthly sales bar chart for Jan-Jun, data 12 19 3 5 2 15 ``` -------------------------------- ### GET /health Source: https://github.com/ideamans/chartjs2img/blob/main/docs/en/guide/http/index.md Health check endpoint that also returns server statistics. ```APIDOC ## GET /health ### Description Health check endpoint that also returns server statistics. ### Method GET ### Endpoint /health ### Response #### Success Response (200) - (JSON object containing health status and statistics) ``` -------------------------------- ### Enable API Key via Environment Variable Source: https://github.com/ideamans/chartjs2img/blob/main/docs/en/guide/http/auth.md Set the `API_KEY` environment variable before running the `serve` command to enable API key authentication. ```bash API_KEY=s3cret chartjs2img serve ```