--- name: openalgo-chart-setup description: Scaffold a working openalgo-charts chart in an existing project - detects the host (React, Next.js, Vue, vanilla bundler, or plain script tag), installs the right tiers, and writes a chart that renders real data. Use when the user asks to add a chart, set up openalgo-charts, or get a first chart running. argument-hint: "[chart-type] [host]" allowed-tools: Read, Write, Edit, Bash, Glob, Grep --- Scaffold a first working chart. Do not write a demo page unless the user asked for one; wire it into the project they already have. ## Arguments - `$0` = chart type. Default: `candlestick`. - `$1` = host. Default: detect it. ## Step 1 - detect the host before writing anything ```sh cat package.json rg -n "\"(react|next|vue|svelte|vite|webpack)\"" package.json node -p "require('./node_modules/openalgo-charts/package.json').version" 2>/dev/null || echo "not installed" ``` Pick the shape from what you find: | Finding | Shape | |---|---| | `next` | client-only component, `'use client'`, create in `useEffect` | | `react` without `next` | component with `useRef` + `useEffect` | | `vue` | a composable: chart in a `shallowRef`, `onMounted` / `onBeforeUnmount` | | a bundler, no framework | plain module | | no bundler, HTML only | `