Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: Tests

on:
push:
branches: [master, main]
pull_request:

jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
- run: npm test
42 changes: 42 additions & 0 deletions .github/workflows/pages.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Deploy converter demo to GitHub Pages

on:
push:
branches: [master, main]
workflow_dispatch:

permissions:
contents: read
pages: write
id-token: write

concurrency:
group: pages
cancel-in-progress: true

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Assemble site
run: |
mkdir -p _site/src _site/examples
cp web/index.html _site/index.html
cp src/*.js _site/src/
cp examples/*.pine _site/examples/
# manifest the page fetches to populate the examples dropdown
( cd examples && ls *.pine | sort | sed 's/.*/"&"/' | paste -sd, - | sed 's/^/[/;s/$/]/' ) > _site/examples/manifest.json
- uses: actions/upload-pages-artifact@v3
with:
path: _site

deploy:
needs: build
runs-on: ubuntu-latest
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- id: deployment
uses: actions/deploy-pages@v4
40 changes: 9 additions & 31 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,14 @@ A production-grade transpiler that converts TradingView PineScript (v5/v6) into

This is not a toy converter. It handles real-world PineScript with 240+ function mappings, full series semantics, state persistence across bars, multi-timeframe support, and a post-conversion reviewer that catches problems before they hit you at runtime.

## Try It Online

Paste your PineScript and convert it right in your browser — nothing is uploaded, the transpiler runs client-side:

**https://meridianalgo.github.io/Pine-A-Script/**

(Published automatically from `web/index.html` by the GitHub Pages workflow. Enable it once under repo Settings → Pages → Source: GitHub Actions.)

## What It Does

- Converts PineScript v5/v6 into standard JavaScript (ESM modules)
Expand All @@ -12,7 +20,6 @@ This is not a toy converter. It handles real-world PineScript with 240+ function
- Persists `var` / `varip` state across bar executions, just like TradingView does
- Supports multi-timeframe data via `request.security()` with timeframe resampling
- Runs a multi-stage post-conversion reviewer that catches syntax errors, missing functions, and conversion artifacts
- Optional local AI review using a lightweight code model (no server or API key needed)

## Project Layout

Expand All @@ -26,7 +33,7 @@ src/
cli.js Command-line interface for converting files
reviewer.js Post-conversion quality checks and validation

ai_reviewer/ Optional local AI review (Python, runs on your machine)
web/ Browser-based converter demo (deployed to GitHub Pages)
test/ Test suite including bar-by-bar runtime smoke tests
tools/ Batch conversion utilities and status tracking
examples/ Sample PineScript files for testing
Expand Down Expand Up @@ -100,31 +107,6 @@ Environment variables for fine-grained control:
|----------|--------|
| `PINE_REVIEW=0` | Disables the reviewer completely |
| `PINE_REVIEW_IMPORT=0` | Skips the import smoke test |
| `PINE_REVIEW_AI=1` | Enables the optional AI review |
| `PINE_REVIEWER_MODEL` | Sets the HuggingFace model for AI review |
| `PINE_REVIEWER_PYTHON` | Path to your Python interpreter |
| `PINE_REVIEWER_USE_CUDA=1` | Enables GPU acceleration for AI review |

### Optional AI review

The repo includes a fully local AI reviewer that runs a small code model on your machine. No server, no API key, no data leaves your laptop.

Default model: `Qwen/Qwen2.5-Coder-0.5B-Instruct` (fast, low RAM)
Larger model: `Qwen/Qwen2.5-Coder-1.5B-Instruct` (better results, slower)

Setup:

```bash
pip install -r ai_reviewer/requirements.txt
```

Run with AI review enabled:

```bash
PINE_REVIEW_AI=1 node src/cli.js script.pine output.js --review-ai
```

Note: Small models can produce repetitive or low-quality output. The reviewer sanitizes bad responses and will suggest switching models if needed.

## Supported PineScript Features

Expand Down Expand Up @@ -355,7 +337,6 @@ Options:
--tokens Output the token stream instead of JavaScript
--no-review Skip post-conversion review
--no-review-import Skip the runtime import test only
--review-ai Enable local AI review (needs Python deps)
```

### Example workflow
Expand All @@ -369,9 +350,6 @@ node src/cli.js my_indicator.pine --ast

# Convert without any review (fastest)
node src/cli.js my_indicator.pine my_indicator.js --no-review

# Convert with AI review for deeper analysis
PINE_REVIEW_AI=1 node src/cli.js my_indicator.pine my_indicator.js --review-ai
```

## Running Tests
Expand Down
5 changes: 0 additions & 5 deletions ai_reviewer/requirements.txt

This file was deleted.

135 changes: 0 additions & 135 deletions ai_reviewer/review.py

This file was deleted.

Loading
Loading