chore: bootstrap Claude setup
Add root CLAUDE.md, docs/, LESSONS.md, .env.example, .claude/settings.json hooks (syntax-check on edit and on stop), and CI workflows (lint via node --check, and a VERSION-based semver bump) for this plain-JS, no-build Chrome extension. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
733097a002
commit
7285c82fb7
9 files changed
+199
No files matched your search
@@ -0,0 +1 @@
|
|||||||
|
2
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
{
|
||||||
|
"hooks": {
|
||||||
|
"PostToolUse": [
|
||||||
|
{
|
||||||
|
"matcher": "Edit|Write",
|
||||||
|
"hooks": [
|
||||||
|
{
|
||||||
|
"type": "command",
|
||||||
|
"command": "file=$(cat | python3 -c 'import json,sys; print(json.load(sys.stdin).get(\"tool_input\",{}).get(\"file_path\",\"\"))'); case \"$file\" in *.js) node --check \"$file\" ;; esac"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"Stop": [
|
||||||
|
{
|
||||||
|
"hooks": [
|
||||||
|
{
|
||||||
|
"type": "command",
|
||||||
|
"command": "cd \"$CLAUDE_PROJECT_DIR\" && find . -name '*.js' -not -path './.git/*' -print0 | xargs -0 -n1 node --check"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
# This project is a client-side browser extension with no backend and no
|
||||||
|
# build step, so it reads no environment variables at runtime or build time.
|
||||||
|
# This file is kept for consistency with the repo standard; add variables here
|
||||||
|
# (names only, no values) if the project ever needs any.
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
name: CI
|
||||||
|
|
||||||
|
on:
|
||||||
|
pull_request:
|
||||||
|
branches: [development]
|
||||||
|
push:
|
||||||
|
branches: [development, main]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
lint:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
- uses: actions/setup-node@v4
|
||||||
|
with:
|
||||||
|
node-version: "20"
|
||||||
|
# No linter or test suite is configured for this plain-JS browser extension
|
||||||
|
# (no package.json/bundler). This runs a syntax check on every JS file.
|
||||||
|
- name: Syntax check (node --check)
|
||||||
|
run: |
|
||||||
|
find . -name "*.js" -not -path "./.git/*" -print0 | xargs -0 -n1 node --check
|
||||||
@@ -0,0 +1,67 @@
|
|||||||
|
name: Version bump
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: [development, main]
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: write
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
bump:
|
||||||
|
if: github.actor != 'github-actions[bot]' && !contains(github.event.head_commit.message, '[skip ci]')
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
|
- name: Configure git
|
||||||
|
run: |
|
||||||
|
git config user.name "github-actions[bot]"
|
||||||
|
git config user.email "github-actions[bot]@users.noreply.github.com"
|
||||||
|
|
||||||
|
- name: Bump version
|
||||||
|
id: bump
|
||||||
|
run: |
|
||||||
|
set -euo pipefail
|
||||||
|
current=$(cat VERSION)
|
||||||
|
IFS='.' read -r major minor patch <<< "$current"
|
||||||
|
|
||||||
|
if [ "${{ github.ref_name }}" = "development" ]; then
|
||||||
|
patch=$((patch + 1))
|
||||||
|
else
|
||||||
|
# push to main: MINOR bump only when this commit is already part of
|
||||||
|
# development's history (i.e. an approved development -> main merge
|
||||||
|
# PR); otherwise treat it as a direct hotfix push (PATCH bump).
|
||||||
|
if git fetch origin development >/dev/null 2>&1 && \
|
||||||
|
git merge-base --is-ancestor "$(git rev-parse HEAD)" origin/development; then
|
||||||
|
minor=$((minor + 1))
|
||||||
|
patch=0
|
||||||
|
else
|
||||||
|
patch=$((patch + 1))
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
new_version="$major.$minor.$patch"
|
||||||
|
echo "$new_version" > VERSION
|
||||||
|
echo "new_version=$new_version" >> "$GITHUB_OUTPUT"
|
||||||
|
|
||||||
|
- name: Commit version bump
|
||||||
|
run: |
|
||||||
|
git add VERSION
|
||||||
|
git commit -m "chore(release): v${{ steps.bump.outputs.new_version }} [skip ci]"
|
||||||
|
git push origin HEAD:${{ github.ref_name }}
|
||||||
|
|
||||||
|
- name: Merge main back into development
|
||||||
|
if: github.ref_name == 'main'
|
||||||
|
run: |
|
||||||
|
if git ls-remote --exit-code --heads origin development >/dev/null 2>&1; then
|
||||||
|
git fetch origin development
|
||||||
|
git checkout -B development origin/development
|
||||||
|
git merge --no-edit origin/main
|
||||||
|
git push origin development
|
||||||
|
else
|
||||||
|
echo "No development branch yet; skipping merge-back."
|
||||||
|
fi
|
||||||
@@ -0,0 +1,44 @@
|
|||||||
|
# CLAUDE.md
|
||||||
|
|
||||||
|
## Overview
|
||||||
|
Bypass Paywalls Clean (BPC) — a Manifest V3 Chrome/Chromium extension that bypasses
|
||||||
|
paywalls on supported news sites. This is a tracked fork/mirror of the upstream
|
||||||
|
GitFlic project (`magnolia1234/bypass-paywalls-chrome-clean`); changes here are
|
||||||
|
mostly periodic syncs from upstream plus local tweaks.
|
||||||
|
|
||||||
|
## Commands
|
||||||
|
Plain vanilla JS extension: no package.json, no bundler, no build step.
|
||||||
|
- Syntax check: `find . -name "*.js" -not -path "./.git/*" -print0 | xargs -0 -n1 node --check`
|
||||||
|
- No test suite and no linter are configured in this repo.
|
||||||
|
- Load locally: `chrome://extensions` → Developer Mode → *Load unpacked* → select this folder.
|
||||||
|
|
||||||
|
## Architecture
|
||||||
|
- `manifest.json` — MV3 manifest (permissions, content scripts, service worker).
|
||||||
|
- `background.js` — service worker: request/header rewriting, site-rule dispatch.
|
||||||
|
- `contentScript.js`, `contentScript_once.js`, `contentScript_once_var.js` — injected page scripts.
|
||||||
|
- `sites.js` / `sites_updated.json` — per-site bypass rules (the bulk of upstream updates).
|
||||||
|
- `options/` — popup and options UI (HTML/CSS/JS).
|
||||||
|
- `custom/` — user-defined custom site manifest/rules.
|
||||||
|
- `lib/` — vendored third-party JS (e.g. `purify.min.js`).
|
||||||
|
- See `docs/` for anything not obvious from the code.
|
||||||
|
|
||||||
|
## Conventions
|
||||||
|
- Keep edits minimal and localized; `sites.js`/`README.md` mirror upstream content —
|
||||||
|
avoid reformatting them so future upstream merges stay low-conflict.
|
||||||
|
- No build step: files run as-is in the browser, so keep syntax ES-compatible with
|
||||||
|
`minimum_chrome_version` in `manifest.json`.
|
||||||
|
|
||||||
|
## Workflow quirks
|
||||||
|
- `manifest.json`'s `version` field tracks the upstream extension release (4-part,
|
||||||
|
e.g. `4.2.8.2`) and is NOT the repo's own semver — do not bump it by hand or via CI.
|
||||||
|
This repo's own release tracking uses the root `VERSION` file instead.
|
||||||
|
- `README.md` / `README.html` are upstream-authored docs (site list, install steps);
|
||||||
|
prefer syncing them from upstream over hand-editing.
|
||||||
|
|
||||||
|
## Deployment
|
||||||
|
Not a deployed service — distributed as an unpacked folder or a `.crx` file. No
|
||||||
|
`web-deploy` setup applies.
|
||||||
|
|
||||||
|
## Gotchas
|
||||||
|
- No `.env` / secrets: this is a client-side browser extension with no backend.
|
||||||
|
- `node --check` only validates syntax, not behavior — there is no real test coverage.
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
# Lessons
|
||||||
|
|
||||||
|
Recurring mistakes in this repo and how to avoid them. Read before starting work;
|
||||||
|
add an entry whenever a mistake repeats.
|
||||||
|
|
||||||
|
(No recurring mistakes recorded yet.)
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
# Development notes
|
||||||
|
|
||||||
|
This repo tracks the upstream [Bypass Paywalls Clean](https://gitflic.ru/project/magnolia1234/bypass-paywalls-chrome-clean)
|
||||||
|
project. Most changes are periodic syncs of `sites.js`, `background.js`,
|
||||||
|
`contentScript*.js` and `README.md`/`README.html` from upstream releases.
|
||||||
|
|
||||||
|
## Local testing
|
||||||
|
|
||||||
|
1. Open `chrome://extensions` in a Chromium-based browser.
|
||||||
|
2. Enable Developer Mode.
|
||||||
|
3. Click *Load unpacked* and select the repo root (it contains `manifest.json`).
|
||||||
|
4. Reload the extension after any file change.
|
||||||
|
|
||||||
|
## Syntax checking
|
||||||
|
|
||||||
|
There is no bundler or test suite. The quickest available check is a Node.js
|
||||||
|
syntax check on every JS file:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
find . -name "*.js" -not -path "./.git/*" -print0 | xargs -0 -n1 node --check
|
||||||
|
```
|
||||||
|
|
||||||
|
This only catches syntax errors, not logic bugs — there is no real lint or test
|
||||||
|
coverage configured.
|
||||||
|
|
||||||
|
## Versioning
|
||||||
|
|
||||||
|
`manifest.json`'s `version` field mirrors the upstream extension release and is
|
||||||
|
not touched by this repo's own CI. This repo's own release counter lives in the
|
||||||
|
root `VERSION` file, bumped automatically by `.github/workflows/version.yml`.
|
||||||
Reference in new issue
Block a user