diff --git a/.claude/bootstrap-version b/.claude/bootstrap-version new file mode 100644 index 0000000..0cfbf08 --- /dev/null +++ b/.claude/bootstrap-version @@ -0,0 +1 @@ +2 diff --git a/.claude/settings.json b/.claude/settings.json new file mode 100644 index 0000000..bb44ead --- /dev/null +++ b/.claude/settings.json @@ -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 *.py) python3 -m py_compile \"$file\" ;; *.ts|*.vue|*.js) if [ -d \"$(dirname \"$file\")/../node_modules\" ] || [ -d frontend/node_modules ]; then (cd frontend && npx --no-install eslint --fix \"${file#frontend/}\" 2>&1 || true); fi ;; esac" + } + ] + } + ], + "Stop": [ + { + "hooks": [ + { + "type": "command", + "command": "set -e; python3 -m compileall backend -q; if [ -d frontend/node_modules ]; then (cd frontend && npm run build); else echo 'frontend/node_modules missing, skipping frontend build check'; fi" + } + ] + } + ] + } +} diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..c96b3e6 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,38 @@ +name: CI + +on: + pull_request: + branches: [development] + push: + branches: [development, main] + +jobs: + backend: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 + with: + python-version: "3.12" + cache: "pip" + - run: pip install -r requirements.txt + # No linter or test suite is configured for the backend yet. + # This is a lightweight sanity check (syntax/import compile), not a test run. + - run: python -m compileall backend -q + + frontend: + runs-on: ubuntu-latest + defaults: + run: + working-directory: frontend + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version: "20" + cache: "npm" + cache-dependency-path: frontend/package-lock.json + - run: npm ci + # `npm run lint` has no ESLint config checked in yet, so it is not run here. + # `build` runs `vue-tsc` first, which is the available type-check. + - run: npm run build diff --git a/.github/workflows/version.yml b/.github/workflows/version.yml new file mode 100644 index 0000000..a4a1960 --- /dev/null +++ b/.github/workflows/version.yml @@ -0,0 +1,69 @@ +name: Version + +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 identity + run: | + git config user.name "github-actions[bot]" + git config user.email "github-actions[bot]@users.noreply.github.com" + + - name: Determine bump type + id: bump + run: | + if [ "${{ github.ref_name }}" = "development" ]; then + echo "type=patch" >> "$GITHUB_OUTPUT" + else + # On main: a minor bump if this push is a merge whose commits all + # came from development (an approved development -> main PR), + # otherwise a direct hotfix push gets a patch bump. + if git log -1 --pretty=%P | grep -q ' ' && \ + git log -1 --pretty=%s | grep -qiE "development"; then + echo "type=minor" >> "$GITHUB_OUTPUT" + else + echo "type=patch" >> "$GITHUB_OUTPUT" + fi + fi + + - name: Bump VERSION + id: version + run: | + current=$(cat VERSION) + IFS='.' read -r major minor patch <<< "$current" + if [ "${{ steps.bump.outputs.type }}" = "minor" ]; then + minor=$((minor + 1)) + patch=0 + else + patch=$((patch + 1)) + fi + new="$major.$minor.$patch" + echo "$new" > VERSION + echo "new=$new" >> "$GITHUB_OUTPUT" + + - name: Commit and push version bump + run: | + git add VERSION + git commit -m "chore(release): v${{ steps.version.outputs.new }} [skip ci]" + git push origin HEAD:${{ github.ref_name }} + + - name: Merge main back into development + if: github.ref_name == 'main' + run: | + git fetch origin development + git checkout development + git merge --no-edit origin/main + git push origin development diff --git a/CLAUDE.md b/CLAUDE.md new file mode 100644 index 0000000..5bc3b92 --- /dev/null +++ b/CLAUDE.md @@ -0,0 +1,31 @@ +# CLAUDE.md + +## Overview +Transcriptarr: AI-powered subtitle transcription service. FastAPI backend (Whisper/faster-whisper/stable-ts transcription, worker pool, SQLite/PostgreSQL/MariaDB) with a Vue 3 + TypeScript web UI. + +## Commands +- Backend install: `pip install -r requirements.txt` +- Backend run (dev): `python backend/cli.py server --reload` +- Backend run (prod): `python backend/cli.py server --host 0.0.0.0 --port 8000 --workers 4` +- Backend quick check (no test suite exists yet): `python -m compileall backend -q` +- Frontend install: `cd frontend && npm install` +- Frontend dev: `cd frontend && npm run dev` +- Frontend build (also type-checks via vue-tsc): `cd frontend && npm run build` +- Frontend lint: `cd frontend && npm run lint` — script exists but no ESLint config file is checked in, so it currently errors; see LESSONS.md. + +## Architecture +FastAPI backend under `backend/` (API routers in `backend/api`, core services in `backend/core`, scanning in `backend/scanning`, transcription in `backend/transcription`), Vue 3 SPA under `frontend/`. See `docs/ARCHITECTURE.md`, `docs/API.md`, `docs/CONFIGURATION.md`, `docs/FRONTEND.md`. + +## Conventions +- Only `DATABASE_URL` is read from the environment (`backend/config.py`); all other settings live in the database and are managed via the Settings API/UI. +- Keep `.env.example` limited to variable names actually read from the environment. + +## Workflow quirks +- No backend linter/formatter (ruff/black/flake8) and no automated test suite (pytest/vitest) are configured yet. Do not assume `npm run lint` passes — it has no config. +- Single `frontend/package.json` version field; there is no root `package.json`/`pyproject.toml`, so the release workflow tracks the version in the root `VERSION` file. + +## Deployment +Not yet documented here; no deployment workflow exists in this repo. + +## Gotchas +- `models/`, `transcriptarr.db`, and `.env` are gitignored — expected to be created at runtime, not committed. diff --git a/LESSONS.md b/LESSONS.md new file mode 100644 index 0000000..843b6f7 --- /dev/null +++ b/LESSONS.md @@ -0,0 +1,9 @@ +# LESSONS.md + +Recurring mistakes and how to avoid them. Read before starting work; add an entry when a mistake repeats. + +## Frontend lint has no config +`frontend/package.json` declares `npm run lint` (ESLint), but no `.eslintrc*`/`eslint.config.*` is checked into the repo, so the command errors immediately. Don't rely on it as a working gate until a config is added; use `npm run build` (runs `vue-tsc`) as the available type-check instead. + +## Backend has no test suite or linter +There is no `pytest`/`ruff`/`black`/`flake8` configuration in this repo. Don't assume a `test`/`lint` command exists for the backend — the closest available quick check is `python -m compileall backend -q`. diff --git a/VERSION b/VERSION new file mode 100644 index 0000000..6e8bf73 --- /dev/null +++ b/VERSION @@ -0,0 +1 @@ +0.1.0