|
| 1 | +# TaskBeacon Task Gallery (Website) |
| 2 | + |
| 3 | +Public, statically deployed website that lists and showcases TaskBeacon task template repositories (PsyFlow/TAPS tasks) as a searchable, filterable gallery. |
| 4 | + |
| 5 | +- Gallery: task cards, tags, last updated, links to repo/Run/download |
| 6 | +- Task detail pages: README rendering + quick start + metadata panel |
| 7 | +- Robust indexing: GitHub API repo list + README + optional `task.yaml`/`task.json` |
| 8 | +- Deployment: GitHub Pages static export via GitHub Actions |
| 9 | + |
| 10 | +## Tech |
| 11 | + |
| 12 | +- Next.js (App Router) with static export (`output: "export"`) |
| 13 | +- Tailwind CSS |
| 14 | +- Markdown rendering via `react-markdown` (+ GFM + code highlighting) |
| 15 | + |
| 16 | +## Local Dev |
| 17 | + |
| 18 | +Prereqs: Node 20+ (Node 22 works). |
| 19 | + |
| 20 | +```bash |
| 21 | +cd taskbeacon.github.io |
| 22 | +npm install |
| 23 | + |
| 24 | +# Build/refresh the index (optional; works without token but rate-limited) |
| 25 | +npm run index |
| 26 | + |
| 27 | +# Build the static site into ./out |
| 28 | +npm run build |
| 29 | +``` |
| 30 | + |
| 31 | +Optional: set `GITHUB_TOKEN` locally to increase GitHub API rate limits. |
| 32 | + |
| 33 | +```bash |
| 34 | +# macOS/Linux |
| 35 | +export GITHUB_TOKEN=... |
| 36 | + |
| 37 | +# Windows PowerShell |
| 38 | +$env:GITHUB_TOKEN = "..." |
| 39 | +``` |
| 40 | + |
| 41 | +## How Indexing Works |
| 42 | + |
| 43 | +Indexing is a build-time step that generates: |
| 44 | + |
| 45 | +- `src/data/tasks_index.json` (task metadata used by the UI) |
| 46 | +- `src/data/readmes/*.md` (README snapshots for static rendering) |
| 47 | + |
| 48 | +The indexer lives at: |
| 49 | + |
| 50 | +- `scripts/build-index.mjs` |
| 51 | + |
| 52 | +It: |
| 53 | + |
| 54 | +1. Lists public repos in the `TaskBeacon` org (GitHub API, paginated `per_page=100`). |
| 55 | +2. Excludes non-task repos via a denylist (see `DENYLIST` in the script). |
| 56 | +3. For each repo, fetches: |
| 57 | + - README (raw) |
| 58 | + - repo root contents (to detect `config/`, `assets/`, `src/` and metadata files) |
| 59 | + - optional metadata `task.yaml` / `task.yml` / `task.json` (repo root) |
| 60 | +4. Produces conservative inferred tags when metadata is missing (primarily from repo name). |
| 61 | + |
| 62 | +Rate limits: |
| 63 | + |
| 64 | +- Without token, GitHub API is rate-limited and the script may fail. |
| 65 | +- If the script fails but an older `src/data/tasks_index.json` exists, it will fall back to the existing index so `npm run build` still works. |
| 66 | + |
| 67 | +## Metadata Schema (`task.yaml`) |
| 68 | + |
| 69 | +If a task repo includes `task.yaml` (or `task.yml`) at repo root, the indexer reads it. |
| 70 | +Supported fields: |
| 71 | + |
| 72 | +```yaml |
| 73 | +name: "T000014-stroop" |
| 74 | +short_description: "Classic Stroop color-word interference task template." |
| 75 | + |
| 76 | +tags: |
| 77 | + paradigm: ["Stroop"] |
| 78 | + response: ["2-choice"] |
| 79 | + modality: ["behavior"] |
| 80 | + language: ["en"] |
| 81 | + |
| 82 | +keywords: |
| 83 | + - stroop |
| 84 | + - interference |
| 85 | + |
| 86 | +psyflow_version: "^0.2.0" # optional |
| 87 | +has_voiceover: false # optional |
| 88 | +``` |
| 89 | +
|
| 90 | +Notes: |
| 91 | +
|
| 92 | +- `tags.*` values must be arrays of strings. |
| 93 | +- Keep tags stable and human-readable (e.g., `"N-back"`, not `"nback"`). |
| 94 | + |
| 95 | +## Deployment (GitHub Pages) |
| 96 | + |
| 97 | +- GitHub Action workflow: `.github/workflows/pages.yml` |
| 98 | +- Triggered on push to `main`, manual dispatch, and weekly schedule. |
| 99 | + |
| 100 | +What CI does: |
| 101 | + |
| 102 | +1. `npm ci` |
| 103 | +2. `npm run index` (uses `secrets.GITHUB_TOKEN` automatically) |
| 104 | +3. `npm run build` (static export to `out/`) |
| 105 | +4. Upload `out/` as Pages artifact + deploy |
| 106 | + |
| 107 | +Repository settings required: |
| 108 | + |
| 109 | +- Settings -> Pages |
| 110 | +- Source: GitHub Actions |
| 111 | + |
| 112 | +## Excluding Non-Task Repos |
| 113 | + |
| 114 | +Update the denylist in `scripts/build-index.mjs`: |
| 115 | + |
| 116 | +- `DENYLIST` contains known non-task repos (e.g., `task-registry`, `.github`, `psyflow`, `taskbeacon.github.io`). |
| 117 | + |
| 118 | +## PR Notes |
| 119 | + |
| 120 | +This repo historically contained a Sphinx build under `docs/`. |
| 121 | +The Next.js site builds to `out/` for GitHub Pages, and does not modify `docs/`. |
| 122 | + |
0 commit comments