Skip to content

Commit 7f49d3d

Browse files
committed
feat: add TaskBeacon task gallery website
1 parent 14ef3e6 commit 7f49d3d

51 files changed

Lines changed: 12913 additions & 0 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/index-only.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: Rebuild Task Index (Manual)
2+
3+
on:
4+
workflow_dispatch:
5+
6+
permissions:
7+
contents: read
8+
9+
jobs:
10+
index:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Checkout
14+
uses: actions/checkout@v4
15+
16+
- name: Setup Node
17+
uses: actions/setup-node@v4
18+
with:
19+
node-version: 22
20+
cache: npm
21+
22+
- name: Install dependencies
23+
run: npm ci
24+
25+
- name: Rebuild task index
26+
env:
27+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
28+
run: npm run index
29+
30+
- name: Upload index artifact
31+
uses: actions/upload-artifact@v4
32+
with:
33+
name: tasks-index
34+
path: |
35+
src/data/tasks_index.json
36+
src/data/readmes

.github/workflows/pages.yml

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
name: Build and Deploy (GitHub Pages)
2+
3+
on:
4+
push:
5+
branches: [main]
6+
workflow_dispatch:
7+
schedule:
8+
- cron: '17 3 * * 1' # Mondays 03:17 UTC (weekly)
9+
10+
permissions:
11+
contents: read
12+
pages: write
13+
id-token: write
14+
15+
concurrency:
16+
group: pages
17+
cancel-in-progress: false
18+
19+
jobs:
20+
build:
21+
runs-on: ubuntu-latest
22+
steps:
23+
- name: Checkout
24+
uses: actions/checkout@v4
25+
26+
- name: Setup Node
27+
uses: actions/setup-node@v4
28+
with:
29+
node-version: 22
30+
cache: npm
31+
32+
- name: Install dependencies
33+
run: npm ci
34+
35+
- name: Rebuild task index
36+
env:
37+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
38+
run: npm run index
39+
40+
- name: Configure Pages
41+
uses: actions/configure-pages@v4
42+
43+
- name: Build static site
44+
run: npm run build
45+
46+
- name: Upload artifact
47+
uses: actions/upload-pages-artifact@v3
48+
with:
49+
path: out
50+
51+
deploy:
52+
needs: build
53+
runs-on: ubuntu-latest
54+
environment:
55+
name: github-pages
56+
url: ${{ steps.deployment.outputs.page_url }}
57+
steps:
58+
- name: Deploy
59+
id: deployment
60+
uses: actions/deploy-pages@v4

.gitignore

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,3 +30,17 @@ temp/
3030
.DS_Store
3131
Thumbs.db
3232
.idea/
33+
34+
# Node / Next.js
35+
node_modules/
36+
.next/
37+
out/
38+
npm-debug.log*
39+
yarn-debug.log*
40+
yarn-error.log*
41+
pnpm-debug.log*
42+
43+
# Local env
44+
.env
45+
.env.local
46+
.env.*.local

README.md

Lines changed: 122 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,122 @@
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+

eslint.config.mjs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import nextCoreWebVitals from "eslint-config-next/core-web-vitals";
2+
3+
const config = [
4+
{
5+
ignores: ["node_modules/**", ".next/**", "out/**", "docs/**"]
6+
},
7+
...nextCoreWebVitals,
8+
{
9+
files: ["src/components/markdown.tsx"],
10+
rules: {
11+
"@next/next/no-img-element": "off"
12+
}
13+
}
14+
];
15+
16+
export default config;

next-env.d.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
/// <reference types="next" />
2+
/// <reference types="next/image-types/global" />
3+
import "./.next/types/routes.d.ts";
4+
5+
// NOTE: This file should not be edited
6+
// see https://nextjs.org/docs/app/api-reference/config/typescript for more information.

next.config.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
/** @type {import('next').NextConfig} */
2+
const nextConfig = {
3+
// GitHub Pages deployment: static HTML export
4+
output: "export",
5+
trailingSlash: true,
6+
images: {
7+
// next/image optimization is not supported in static export on Pages.
8+
unoptimized: true
9+
}
10+
};
11+
12+
module.exports = nextConfig;
13+

0 commit comments

Comments
 (0)