From d26d1aaa4e7f1a4223b042da4cf21d84e36a4198 Mon Sep 17 00:00:00 2001 From: ilia Date: Sun, 26 Jul 2026 15:47:37 -0400 Subject: [PATCH] Unify product version at 1.4.0, add ruff gate, drop stale GitHub workflow - One version (1.4.0) across extension/manifest.json, automation/pyproject.toml, automation-js/package.json (+lockfile); README documents the bump-together policy - Delete .github/workflows/ci.yml (behind the Gitea copy; CI runs on Gitea Actions) - CURSOR_PROMPT.md: replace personal paths with - Add ruff (E4,E7,E9,F,I, line-length 120) to automation/ dev extras, Makefile lint, and the Gitea CI Lint + tests job as a hard gate --- .gitea/workflows/ci.yml | 3 ++ .github/workflows/ci.yml | 75 --------------------------------- CURSOR_PROMPT.md | 10 ++--- Makefile | 5 ++- README.md | 10 ++++- automation-js/package-lock.json | 4 +- automation-js/package.json | 2 +- automation/pyproject.toml | 4 +- automation/ruff.toml | 4 ++ extension/manifest.json | 2 +- 10 files changed, 30 insertions(+), 89 deletions(-) delete mode 100644 .github/workflows/ci.yml create mode 100644 automation/ruff.toml diff --git a/.gitea/workflows/ci.yml b/.gitea/workflows/ci.yml index f634665..75a6266 100644 --- a/.gitea/workflows/ci.yml +++ b/.gitea/workflows/ci.yml @@ -66,6 +66,9 @@ jobs: python -m pip install --upgrade pip pip install -e ".[dev]" + - name: Ruff lint + run: ruff check . + - name: Install Playwright Chromium run: playwright install --with-deps chromium diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml deleted file mode 100644 index dc16817..0000000 --- a/.github/workflows/ci.yml +++ /dev/null @@ -1,75 +0,0 @@ -name: CI - -on: - push: - branches: [master, main] - pull_request: - branches: [master, main] - -jobs: - quality: - name: Lint + tests - runs-on: ubuntu-latest - defaults: - run: - working-directory: automation - - steps: - - name: Checkout - uses: actions/checkout@v4 - - - name: Set up Python - uses: actions/setup-python@v5 - with: - python-version: "3.12" - cache: pip - cache-dependency-path: automation/pyproject.toml - - - name: Set up Node (JS syntax check only) - uses: actions/setup-node@v4 - with: - node-version: "20" - - - name: Syntax-check extension JS - working-directory: ${{ github.workspace }} - run: | - set -euo pipefail - for f in \ - extension/core/dom.js \ - extension/core/prompt.js \ - extension/page-patcher.js \ - extension/content.js \ - extension/background.js \ - extension/popup.js - do - node --check "$f" - echo "OK $f" - done - python3 -m json.tool extension/manifest.json >/dev/null - echo "OK extension/manifest.json" - - - name: Verify shared-core symlinks - working-directory: ${{ github.workspace }} - run: | - set -euo pipefail - test -L automation/context_extractor/js/dom.js - test -L automation/context_extractor/js/prompt.js - diff -q automation/context_extractor/js/dom.js extension/core/dom.js - diff -q automation/context_extractor/js/prompt.js extension/core/prompt.js - - - name: Install package + dev deps - run: | - python -m pip install --upgrade pip - pip install -e ".[dev]" - - - name: Install Playwright Chromium - run: playwright install --with-deps chromium - - - name: Pytest - run: pytest -q - - - name: Package extension zip (smoke) - working-directory: ${{ github.workspace }} - run: | - python3 scripts/package_extension.py - test -f dist/context-extractor-extension.zip diff --git a/CURSOR_PROMPT.md b/CURSOR_PROMPT.md index 551be06..987d8e6 100644 --- a/CURSOR_PROMPT.md +++ b/CURSOR_PROMPT.md @@ -1,15 +1,15 @@ # Cursor consumer prompt -Paste this into another Cursor chat when that project should use Context Extractor -(path below — adjust if you moved the repo). +Paste this into another Cursor chat when that project should use Context Extractor. +Replace `` with wherever you cloned this repo. --- ```text -Use Context Extractor from ~/Documents/code/context-extractor for browser capture / scrape debugging. +Use Context Extractor from for browser capture / scrape debugging. Setup (once): - cd ~/Documents/code/context-extractor/automation && python3 -m venv .venv && source .venv/bin/activate + cd /automation && python3 -m venv .venv && source .venv/bin/activate pip install -e ".[dev]" playwright install chromium # optional anti-detect: pip install -e ".[camoufox]" @@ -29,7 +29,7 @@ Python scrape / CI loop: CLI: context-extractor URL --selector CSS --engine chromium|camoufox --out prompt.md Manual / interactive (Brave or Chrome): - Load unpacked: ~/Documents/code/context-extractor/extension + Load unpacked: /extension Then use "Copy" on the broken page. When debugging scrapers or flaky pages in THIS project: diff --git a/Makefile b/Makefile index 2f6bf2e..e7a36bf 100644 --- a/Makefile +++ b/Makefile @@ -17,7 +17,7 @@ test: ## Run pytest test-js: ## Run automation-js vitest suite (real headless Chromium) cd automation-js && npm test -lint: ## Syntax-check extension JS + validate manifest JSON +lint: ## Syntax-check extension JS + validate manifest JSON + ruff on automation/ @node --check extension/core/dom.js @node --check extension/core/prompt.js @node --check extension/page-patcher.js @@ -25,9 +25,10 @@ lint: ## Syntax-check extension JS + validate manifest JSON @node --check extension/background.js @node --check extension/popup.js @python3 -m json.tool extension/manifest.json >/dev/null + @cd automation && .venv/bin/ruff check . @echo "lint OK" package: ## Zip extension/ into dist/ python3 scripts/package_extension.py -ci: lint test test-js package ## Local stand-in for GitHub Actions +ci: lint test test-js package ## Local stand-in for Gitea Actions diff --git a/README.md b/README.md index a84d510..1540250 100644 --- a/README.md +++ b/README.md @@ -46,6 +46,14 @@ place to fix a markdown-formatting bug, and the Python/JS test suites both run against the same fixture page (`automation/tests/fixtures/sample.html`) so a regression can't silently diverge between the two. +## Versioning + +The extension (`extension/manifest.json`), the Python package +(`automation/pyproject.toml`), and the Node package +(`automation-js/package.json`) share **one product version** and are bumped +together — they ship the same `core/*.js`, so a version like `1.4.0` means +the same extraction behavior in all three. + ## Use from another Cursor project Copy the block in [`CURSOR_PROMPT.md`](CURSOR_PROMPT.md) into that project's chat @@ -55,7 +63,7 @@ Copy the block in [`CURSOR_PROMPT.md`](CURSOR_PROMPT.md) into that project's cha ```bash make install # once -make ci # lint + pytest + package smoke (same checks as GitHub Actions) +make ci # lint + pytest + vitest + package smoke (same checks as Gitea Actions) ``` Or manually: diff --git a/automation-js/package-lock.json b/automation-js/package-lock.json index be22cbf..d2318cf 100644 --- a/automation-js/package-lock.json +++ b/automation-js/package-lock.json @@ -1,12 +1,12 @@ { "name": "context-extractor", - "version": "1.0.0", + "version": "1.4.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "context-extractor", - "version": "1.0.0", + "version": "1.4.0", "license": "MIT", "devDependencies": { "@types/node": "^22.15.0", diff --git a/automation-js/package.json b/automation-js/package.json index 56d7e61..4ce70d3 100644 --- a/automation-js/package.json +++ b/automation-js/package.json @@ -1,6 +1,6 @@ { "name": "context-extractor", - "version": "1.0.0", + "version": "1.4.0", "description": "Capture console/network/errors and extract AI-ready markdown from a Playwright (Node) page — JS/TS twin of the automation/ Python package, sharing the same extension/core/*.js.", "license": "MIT", "type": "module", diff --git a/automation/pyproject.toml b/automation/pyproject.toml index 99b05ba..8c93a75 100644 --- a/automation/pyproject.toml +++ b/automation/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "context-extractor" -version = "1.3.0" +version = "1.4.0" description = "Capture console/network/errors and extract AI-ready markdown from a Playwright or Camoufox page." readme = "README.md" requires-python = ">=3.9" @@ -13,7 +13,7 @@ dependencies = [ [project.optional-dependencies] camoufox = ["camoufox[geoip]>=0.4"] -dev = ["pytest>=8.0", "pytest-asyncio>=0.23"] +dev = ["pytest>=8.0", "pytest-asyncio>=0.23", "ruff>=0.8"] [project.scripts] context-extractor = "context_extractor.cli:main" diff --git a/automation/ruff.toml b/automation/ruff.toml new file mode 100644 index 0000000..dcd9132 --- /dev/null +++ b/automation/ruff.toml @@ -0,0 +1,4 @@ +line-length = 120 + +[lint] +select = ["E4", "E7", "E9", "F", "I"] diff --git a/extension/manifest.json b/extension/manifest.json index 023dcf2..e91dd83 100644 --- a/extension/manifest.json +++ b/extension/manifest.json @@ -1,7 +1,7 @@ { "manifest_version": 3, "name": "Context Extractor", - "version": "1.3.2", + "version": "1.4.0", "description": "Extract clean, AI-ready context from any webpage — page content, console logs, network requests, and JS errors. Works unpacked in Chrome and Brave.", "permissions": ["activeTab", "scripting", "storage"], "host_permissions": [""],