Unify product version at 1.4.0, add ruff gate, drop stale GitHub workflow #2
@@ -66,6 +66,9 @@ jobs:
|
|||||||
python -m pip install --upgrade pip
|
python -m pip install --upgrade pip
|
||||||
pip install -e ".[dev]"
|
pip install -e ".[dev]"
|
||||||
|
|
||||||
|
- name: Ruff lint
|
||||||
|
run: ruff check .
|
||||||
|
|
||||||
- name: Install Playwright Chromium
|
- name: Install Playwright Chromium
|
||||||
run: playwright install --with-deps chromium
|
run: playwright install --with-deps chromium
|
||||||
|
|
||||||
|
|||||||
@@ -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
|
|
||||||
+5
-5
@@ -1,15 +1,15 @@
|
|||||||
# Cursor consumer prompt
|
# Cursor consumer prompt
|
||||||
|
|
||||||
Paste this into another Cursor chat when that project should use Context Extractor
|
Paste this into another Cursor chat when that project should use Context Extractor.
|
||||||
(path below — adjust if you moved the repo).
|
Replace `<path-to-context-extractor>` with wherever you cloned this repo.
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
```text
|
```text
|
||||||
Use Context Extractor from ~/Documents/code/context-extractor for browser capture / scrape debugging.
|
Use Context Extractor from <path-to-context-extractor> for browser capture / scrape debugging.
|
||||||
|
|
||||||
Setup (once):
|
Setup (once):
|
||||||
cd ~/Documents/code/context-extractor/automation && python3 -m venv .venv && source .venv/bin/activate
|
cd <path-to-context-extractor>/automation && python3 -m venv .venv && source .venv/bin/activate
|
||||||
pip install -e ".[dev]"
|
pip install -e ".[dev]"
|
||||||
playwright install chromium
|
playwright install chromium
|
||||||
# optional anti-detect: pip install -e ".[camoufox]"
|
# 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
|
CLI: context-extractor URL --selector CSS --engine chromium|camoufox --out prompt.md
|
||||||
|
|
||||||
Manual / interactive (Brave or Chrome):
|
Manual / interactive (Brave or Chrome):
|
||||||
Load unpacked: ~/Documents/code/context-extractor/extension
|
Load unpacked: <path-to-context-extractor>/extension
|
||||||
Then use "Copy" on the broken page.
|
Then use "Copy" on the broken page.
|
||||||
|
|
||||||
When debugging scrapers or flaky pages in THIS project:
|
When debugging scrapers or flaky pages in THIS project:
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ test: ## Run pytest
|
|||||||
test-js: ## Run automation-js vitest suite (real headless Chromium)
|
test-js: ## Run automation-js vitest suite (real headless Chromium)
|
||||||
cd automation-js && npm test
|
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/dom.js
|
||||||
@node --check extension/core/prompt.js
|
@node --check extension/core/prompt.js
|
||||||
@node --check extension/page-patcher.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/background.js
|
||||||
@node --check extension/popup.js
|
@node --check extension/popup.js
|
||||||
@python3 -m json.tool extension/manifest.json >/dev/null
|
@python3 -m json.tool extension/manifest.json >/dev/null
|
||||||
|
@cd automation && .venv/bin/ruff check .
|
||||||
@echo "lint OK"
|
@echo "lint OK"
|
||||||
|
|
||||||
package: ## Zip extension/ into dist/
|
package: ## Zip extension/ into dist/
|
||||||
python3 scripts/package_extension.py
|
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
|
||||||
|
|||||||
@@ -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`)
|
run against the same fixture page (`automation/tests/fixtures/sample.html`)
|
||||||
so a regression can't silently diverge between the two.
|
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
|
## Use from another Cursor project
|
||||||
|
|
||||||
Copy the block in [`CURSOR_PROMPT.md`](CURSOR_PROMPT.md) into that project's chat
|
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
|
```bash
|
||||||
make install # once
|
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:
|
Or manually:
|
||||||
|
|||||||
Generated
+2
-2
@@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "context-extractor",
|
"name": "context-extractor",
|
||||||
"version": "1.0.0",
|
"version": "1.4.0",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "context-extractor",
|
"name": "context-extractor",
|
||||||
"version": "1.0.0",
|
"version": "1.4.0",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/node": "^22.15.0",
|
"@types/node": "^22.15.0",
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "context-extractor",
|
"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.",
|
"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",
|
"license": "MIT",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
[project]
|
[project]
|
||||||
name = "context-extractor"
|
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."
|
description = "Capture console/network/errors and extract AI-ready markdown from a Playwright or Camoufox page."
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
requires-python = ">=3.9"
|
requires-python = ">=3.9"
|
||||||
@@ -13,7 +13,7 @@ dependencies = [
|
|||||||
|
|
||||||
[project.optional-dependencies]
|
[project.optional-dependencies]
|
||||||
camoufox = ["camoufox[geoip]>=0.4"]
|
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]
|
[project.scripts]
|
||||||
context-extractor = "context_extractor.cli:main"
|
context-extractor = "context_extractor.cli:main"
|
||||||
|
|||||||
@@ -0,0 +1,4 @@
|
|||||||
|
line-length = 120
|
||||||
|
|
||||||
|
[lint]
|
||||||
|
select = ["E4", "E7", "E9", "F", "I"]
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"manifest_version": 3,
|
"manifest_version": 3,
|
||||||
"name": "Context Extractor",
|
"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.",
|
"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"],
|
"permissions": ["activeTab", "scripting", "storage"],
|
||||||
"host_permissions": ["<all_urls>"],
|
"host_permissions": ["<all_urls>"],
|
||||||
|
|||||||
Reference in New Issue
Block a user