From 113a85866872ab079fbb7f4154cd8666367dcce0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Burak=20Boduro=C4=9Flu?= <80620802+burakboduroglu@users.noreply.github.com> Date: Sun, 13 Sep 2026 17:03:44 +0300 Subject: [PATCH] =?UTF-8?q?chore:=20remove=20codex=20skill-mirror=20sync?= =?UTF-8?q?=20(codex=20kald=C4=B1r=C4=B1ld=C4=B1)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .codex/config.toml | 2 - .codex/skills/api-layer/SKILL.md | 24 ---------- .codex/skills/commit-workflow/SKILL.md | 39 --------------- .codex/skills/dashboard-design/SKILL.md | 46 ------------------ .codex/skills/solidjs-pitfalls/SKILL.md | 60 ----------------------- .codex/skills/ui-conventions/SKILL.md | 63 ------------------------ .githooks/pre-commit | 8 ---- AGENTS.md | 2 - CLAUDE.md | 4 +- package.json | 5 +- scripts/sync-skills.ts | 64 ------------------------- 11 files changed, 2 insertions(+), 315 deletions(-) delete mode 100644 .codex/config.toml delete mode 100644 .codex/skills/api-layer/SKILL.md delete mode 100644 .codex/skills/commit-workflow/SKILL.md delete mode 100644 .codex/skills/dashboard-design/SKILL.md delete mode 100644 .codex/skills/solidjs-pitfalls/SKILL.md delete mode 100644 .codex/skills/ui-conventions/SKILL.md delete mode 100755 .githooks/pre-commit delete mode 100644 scripts/sync-skills.ts diff --git a/.codex/config.toml b/.codex/config.toml deleted file mode 100644 index ef386f8..0000000 --- a/.codex/config.toml +++ /dev/null @@ -1,2 +0,0 @@ -[plugins."browser@openai-bundled"] -enabled = true diff --git a/.codex/skills/api-layer/SKILL.md b/.codex/skills/api-layer/SKILL.md deleted file mode 100644 index 5de3546..0000000 --- a/.codex/skills/api-layer/SKILL.md +++ /dev/null @@ -1,24 +0,0 @@ ---- -name: api-layer -description: Structure and mandatory-test rules for the src/api/ layer in hezarfen_frontend — domain folders, one verb-first file per endpoint, index re-exports, fetch only in client.ts, and required vitest tests per domain. Load before adding or changing any API endpoint file. ---- - -# API layer - -## Structure - -- Domain-based folders under `src/api/` (e.g. `src/api/notes/`, `src/api/exams/`). -- One file per request under its domain folder, camelCase and verb-first, mirroring the endpoint exactly: `src/api/notes/getNoteById.ts`, `src/api/exams/deleteExamResultByUserId.ts`. -- Each file exports exactly one function matching its filename. -- Each domain must have an `index.ts` re-exporting its endpoints. -- Only `src/api/client/client.ts` calls `fetch` directly. Pages/components never call `fetch` — they call `src/api/` functions inside `createResource`. - -## Tests — mandatory - -Every new or modified API endpoint file must have a corresponding test file at `src/api/__tests__//.test.ts` (one test file per domain, not per endpoint). - -- Use **vitest** (globals enabled) and shared helpers from `src/api/__tests__/helpers/mock-fetch.ts`: `mockFetchSuccess`, `mockFetch204`, `mockFetchError`, `lastFetchCall`. -- Each test asserts correct URL, HTTP method, and request body (when applicable). -- `afterEach` must call `vi.restoreAllMocks()`. -- Run `bun run test` before committing. -- Do not skip or defer API tests — they are part of the definition of done for every API change. diff --git a/.codex/skills/commit-workflow/SKILL.md b/.codex/skills/commit-workflow/SKILL.md deleted file mode 100644 index 618bf6d..0000000 --- a/.codex/skills/commit-workflow/SKILL.md +++ /dev/null @@ -1,39 +0,0 @@ ---- -name: commit-workflow -description: This repo's git commit rules — Conventional-Commit + emoji format, commits pre-approved (no per-commit ask), mandatory approval only for risky git ops (force-push, branch/history rewrite), and the mandatory `bun run build` pre-commit check. Load before proposing or running any commit in hezarfen_frontend. ---- - -# Commit workflow - -## Message format - -Conventional Commits + a short emoji + bullet detail: - -``` -: -- -- -``` - -Example: - -``` -feat: ✨ live exams, Turkish i18n, and mobile tab bar -- mirror the backend exam contract: schedule fields, attempts, - questions/answers, live monitor, /time clock sync, ws proxy -- exam scheduling UI in plain words with client-side window validation -- student exam room: server-judged countdown, WebSocket autosave with - REST fallback, two-step turn-in, review after submit or expiry -- full English/Turkish dictionaries, persisted toggle, localized dates -- bottom tab bar within thumb reach on small screens -``` - -## Rules - -- **Title:** `type: emoji short summary` — `type` ∈ `feat|fix|refactor|chore|docs|style|test|perf`. Short, plain, no marketing tone. -- **Body:** one concrete sub-change per line, technical but plain language. Continuation lines indented two spaces. -- **Language:** every commit message is in English, always — regardless of the conversation language. -- **When to commit:** one commit per significant/complete feature. Not for tiny one-line fixes alone; never commit half-finished or non-building code. -- **Commits are pre-approved — no per-commit ask.** Run `git commit` directly once the message follows the format above and the pre-commit build is green. Still tell the user what you committed (short summary), just don't block on a yes/no first. -- **Ask first only for genuinely risky git operations:** force-push, `push --force`, rewriting published history (`rebase`, `filter-branch`, amending a commit already shared), deleting a branch, `reset --hard`/`clean -f` that would discard uncommitted work, or anything else in the Executing Actions section of the global instructions. These still require explicit approval every time — the pre-approval above covers ordinary commits only. -- **Mandatory pre-commit check:** right before committing, run `bun run build` (`tsc --noEmit && vite build`) unless a build already passed since the last code change. On failure, remove unused imports/vars and re-run until green. Only commit once green. diff --git a/.codex/skills/dashboard-design/SKILL.md b/.codex/skills/dashboard-design/SKILL.md deleted file mode 100644 index a4303c1..0000000 --- a/.codex/skills/dashboard-design/SKILL.md +++ /dev/null @@ -1,46 +0,0 @@ ---- -name: dashboard-design -description: Rules for the hezarfen_frontend dashboard/homepage — a read-only board (no mutations), Knowvio-style stat cards + real-data charts + deadlines table, and role scoping. Load before editing src/pages/dashboard-page.tsx or the homepage. ---- - -# Dashboard / homepage design - -Reference: `src/pages/dashboard-page.tsx`. The homepage is a **read-only status board**, not a marketing landing or action hub. - -- **No mutations:** no create/edit/delete buttons, no primary CTAs that open forms. Links only navigate to existing list/detail routes. -- **Charts are allowed, on real data only.** Charts use `ChartBar`, - `ChartProgressRing` and `ChartHeatmap` from `src/components/ui/` (accent = - `hsl(var(--primary))`, semantic tints for status). - **Every chart/stat must be backed by a live API field** — no fabricated trends, - streak counters, sparklines, or `+%` delta badges the backend can't produce. - Categorical series use bars, with a plain empty state when no records exist. -- **Layout order (top → bottom):** - 1. Compact header — greeting, role chip (neutral), date. - 2. **Highlights** — role-scoped stat cards (icon + label + mono value). - 3. Chart row on `lg+` (hidden for `parent`, who has no marks access). - 4. **Upcoming deadlines** `DataTable` (exams / events / homework / appointments), - full width for every role — one standalone section, no side panel and no - shortcut link in its header. - 5. **Activity heatmap** — full-width `ChartHeatmap`, 26 weeks. -- **Grid:** stat row `1 → 2 sm → 4 lg`; charts `lg:grid-cols-3`. -- **Role scoping:** stat/chart set matches nav/role matrix. Show only panels whose - data exists for the role, and never call an endpoint the role would 403 on. -- **Deadlines table:** active / today / soon items only, semantic status badge, rows - navigate by pointer, Enter, or Space. Empty state is plain text, not a create CTA. -- **Chart semantics per role:** - - student — course averages + **success trend** (own marks ordered by their exam's - date) + attendance split ring. - - teacher+ — **success trend** (`getExamStatistics().average` per exam, spans 2) - + the same averages grouped by course. Statistics are grader-only, so the - resource must stay gated on `hasMinRole(role, "teacher")`. - - Exam statistics have no bulk endpoint: cap the trend at the most recent handful - of past, non-draft exams (`TREND_EXAM_CAP`), and swallow a per-exam failure - rather than blanking the panel. - - Never chart `Course.capacity` as if it were performance, and never derive a - class (şube) average — no endpoint aggregates one, and per-student fetches do - not belong on the homepage. -- **Heatmap source per role:** student = own `/pomodoro/me` focus minutes; - parent = own appointments; teacher+ = dated exams/events/homework already read by - the page. Never read another user's pomodoro log here. -- **Role privacy:** no teacher-only navigation shortcuts on the board. No inferred - priority or manual refresh. diff --git a/.codex/skills/solidjs-pitfalls/SKILL.md b/.codex/skills/solidjs-pitfalls/SKILL.md deleted file mode 100644 index e83faf4..0000000 --- a/.codex/skills/solidjs-pitfalls/SKILL.md +++ /dev/null @@ -1,60 +0,0 @@ ---- -name: solidjs-pitfalls -description: SolidJS rules and resource pitfalls for hezarfen_frontend — run-once model, no destructure, signals, control-flow components, resource.latest, local signal for toggles. Load when touching any Solid component, createResource reads outside , polling, or inline PATCH toggles. ---- - -# SolidJS rules & resource pitfalls - -## Baseline rules — SolidJS is not React - -Solid components run **once**; there is no re-render. - -1. Never destructure props — use `props.title` or `splitProps`. -2. Signals are functions: read `count()`, write `setCount(v)`. -3. Use `createSignal`/`createMemo`/`createEffect`/`createResource` — never - `useState`/`useEffect`/`useMemo`, no dependency arrays. -4. Conditional/list rendering: ``, ``, `/`; server data: - `` + `createResource`. -5. Use `class`, not `className`. Route components are `lazy()`-loaded into the - TanStack Router tree. - -## Performance - -- Every route component is `lazy()` (code-split per page). -- Server data goes through `createResource` → `` (lightweight fallback), - `refetch()` after mutations. -- One `` boundary per page, no spinner-cascades, fixed-height list rows. - -## Two expensive resource pitfalls - -## 1. `resource.latest` for reads outside `` - -A bare `resource()` re-suspends on **every** `refetch()` — not just the first load, and `initialValue` does NOT stop it. If that read sits outside a `` (e.g. an always-rendered badge/count in a shell component mounted beside ``), the suspension bubbles up and **blanks the whole page** for the entire fetch duration, once per poll/refetch. Invisible on a fast local backend; a multi-second blank on a real one. - -Rule: -- Reads under a page's `` → use `resource()`. -- Always-rendered / shell / badge reads of a periodically-refetched resource → use `resource.latest` (last value, no suspend). -- Poll-driven revalidation belongs behind `.latest`. - -## 2. Live save-on-click toggles use a local signal, not `mutate`/`refetch` - -For an inline switch that PATCHes one field (e.g. the exam-review toggle in `exam-detail-page.tsx`): - -- Do NOT `refetch()` the shared resource → re-suspends → page spinner. -- Do NOT `mutate({...res, field})` either → mutating a shared resource changes its object identity, so every *other* `createResource` whose source reads it (directly or via a memo like `hasCourseManagementRights()`) re-runs and refetches, cascading the same spinner. - -Instead keep a local signal, sync from the resource in a `createEffect`, flip optimistically, revert on failure: - -```ts -const [on, setOn] = createSignal(false); -createEffect(() => { const e = res(); if (e) setOn(e.field); }); -const toggle = async (next: boolean) => { - if (saving()) return; - setOn(next); setSaving(true); - try { await patchX(id(), { field: next }); } - catch (err) { setOn(!next); setError(fmt(err)); } - finally { setSaving(false); } -}; -``` - -A correct toggle fires exactly one PATCH and zero GETs. No success toast — the switch position is the feedback. Pitfall #1's `resource.latest` is the read-side companion (survive a refetch without blanking); this is the write-side (don't trigger the refetch at all). `mutate()` (`settings-page.tsx`) is fine for a form that owns its whole resource, but still cascades for a shared one — the local signal is the safe default. diff --git a/.codex/skills/ui-conventions/SKILL.md b/.codex/skills/ui-conventions/SKILL.md deleted file mode 100644 index ab21ffa..0000000 --- a/.codex/skills/ui-conventions/SKILL.md +++ /dev/null @@ -1,63 +0,0 @@ ---- -name: ui-conventions -description: hezarfen_frontend UI conventions — SidePanel vs full-page, header button sizing/radius, DataTable-only tables, date/time forms, attendance/roll-call rules, Note Import Assistant, and DrawCanvas. Load before building or restyling pages, tables, headers, dialogs, forms, or the notes/draw features. ---- - -# UI conventions - -## Naming & file structure - -- **One component per file.** Never two sibling components in one file. Exception: - shadcn-solid wrapper files under `src/components/ui/` may export the documented - compound API from one file (`Dialog`, `DialogContent`, `DialogHeader`, …). -- File name = component name in kebab-case; exported component is PascalCase - (`note-card.tsx` → `NoteCard`). Colocated files keep the base name - (`note-card.types.ts`, `note-card.test.tsx`). -- Same-domain components share a folder: `components/notes/`, `events/`, `exams/`, - `users/`, `attendance/`, `courses/`, `marks/`, `sessions/`, `messages/`, - `homework/`, `appointments/`, `layout/`, `ui/`. -- Cross-cutting app state lives in `src/stores/` (`auth-context.tsx`, - `preferences-context.tsx`) — context providers only, never domain components. - School-policy lists (exam kinds, attendance statuses, grade bands) come from - `getSettings()` in a `createResource`, never hardcoded. -- **API layer** lives under `src/api/` — domain folders, one verb-first file per - endpoint, `fetch` only in `client.ts`, mandatory per-domain tests. Full rules and - the test contract: **api-layer** reference. - -Active project reference docs (read the relevant one before changing that area): -- `docs/ui/navigation-patterns.md` — interaction rules, role scope, side-panel/full-page decisions, dashboard structure. -- `docs/ui/ui-redesign-tokens.md` — visual density, radius, table, side-panel, status UI, dashboard card conventions. -- `docs/auth/role-scope-matrix.md` — role access matrix for pages/nav/dashboard cards. -- `docs/frontend/frontend-next-steps.md` — completed audit summary plus active follow-up notes. -- `docs/backend/backend-ui-alignment-plan.md` — completed archive; not active work unless backend scope changes. - -## Layout & panels - -- Durable resources use full detail pages. Short create/edit/filter work uses `SidePanel`. Destructive actions use confirm dialogs. -- Disclosure sections may defer mounting (request savings) or stay mounted (state preservation) — choose deliberately; avoid hidden heavy requests unless needed. - -## Buttons - -- Header create actions: compact icon+label, consistent size and current radius. -- Page header primary create/add: `size="sm" class="min-w-[7.5rem] rounded-lg"`. Secondary/import: `variant="outline"` with the same size/class. -- Section/sub-panel header actions: `variant="outline" size="sm" class="rounded-lg"` unless matching a page header button. -- Actions inside sub-panels must not duplicate section headers — primary create/add/assign actions go in the header `actions` prop of the parent disclosure or page header. - -## Tables - -- Application tables must use `src/components/ui/data-table.tsx` `DataTable`. -- Actions columns stay fixed at `w-[110px] min-w-[110px] max-w-[110px] h-[45px] text-center whitespace-nowrap` to prevent localized headers like `"İŞLEMLER"` from changing their size. -- Table-page headers fold into the `DataTable` title/description/actions area; do not render a separate `PageHeader` above table-primary pages. -- Search inputs, dropdown filters, filter buttons, and column controls share the same compact height/radius (`h-8 rounded-lg`, `text-[13px]`) unless the shared component changes the standard globally. Page-header primary actions may stay `h-9`. -- Pages/domain components must not import or render `Table` primitives directly; only the `DataTable` wrapper and table primitive files may. - -## Date/time & attendance - -- Date/time product forms use shared `DatePicker` plus a separate `HH:mm` input. Backend schedule fields are UTC unix-millisecond values; backend rejects newly set past event/exam/session schedules with `400`. Use `GET /time` for server-clock-aware checks when accuracy matters. -- Lesson session roll call is teacher/manager workflow only. Students never self-mark lesson sessions; the session teacher or course manager marks enrolled students, and the session teacher's own presence row is manager-only per backend rules. -- Attendance status UI uses shared localized metadata: label, short detail text, semantic colors. - -## Features - -- **Note Import Assistant:** Raw PDF/TXT/MD converted to structured Markdown via `src/lib/note-importer.ts`. Noise (page numbers, headers/footers, watermarks) removed, PDF mid-sentence line wraps re-joined, headings (`##`) and bullet lists formatted, OCR-unreadable artifacts flagged with `⚠️ Some content may be unreadable due to OCR/extraction issues`. Never invent content or add fluff preamble. Lives in a dedicated `SidePanel` triggered from the Notes page header, right of the "Yeni Not" button. -- **Drawing Canvas (`DrawCanvas`):** Freehand drawings saved as `.hzdraw.png` with embedded scene JSON metadata. Live drawing effects must guard `initialScene` against re-initializing during active strokes. diff --git a/.githooks/pre-commit b/.githooks/pre-commit deleted file mode 100755 index cf827f2..0000000 --- a/.githooks/pre-commit +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/sh -# Fail the commit if .codex/skills has drifted from .claude/skills. -# Enable once per clone: git config core.hooksPath .githooks -bun run scripts/sync-skills.ts --check || { - echo "" - echo " Skill mirror drift blocked the commit. Fix with: bun run sync-skills" - exit 1 -} diff --git a/AGENTS.md b/AGENTS.md index 56cb74d..d877967 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -27,7 +27,5 @@ Bilingual codebase: Turkish UI labels, English code + commits. Load on demand by area — `solidjs-pitfalls` | `ui-conventions` | `api-layer` | `commit-workflow` | `dashboard-design`. Source of truth: `.claude/skills//SKILL.md`. -`.codex/skills/` is a generated mirror — edit `.claude`, then `bun run sync-skills` -(a pre-commit hook blocks drift). Deeper docs by area: `docs/ui/` · `docs/auth/` · `docs/frontend/` · `docs/backend/`. diff --git a/CLAUDE.md b/CLAUDE.md index b4cc87e..36c7321 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -4,7 +4,7 @@ SolidJS + TypeScript + TanStack Router + shadcn-solid, Vite/Bun. Read-only status-board dashboard; Turkish/English i18n. Bilingual codebase: Turkish UI labels, English code + commits. -**AGENTS.md mirrors this for Codex/OpenCode.** Update CLAUDE.md first, then copy. +**AGENTS.md mirrors this for OpenCode.** Update CLAUDE.md first, then copy. ## Gotchas @@ -26,7 +26,5 @@ Bilingual codebase: Turkish UI labels, English code + commits. Load on demand by area — `solidjs-pitfalls` | `ui-conventions` | `api-layer` | `commit-workflow` | `dashboard-design`. Source of truth: `.claude/skills//SKILL.md`. -`.codex/skills/` is a generated mirror — edit `.claude`, then `bun run sync-skills` -(a pre-commit hook blocks drift). Deeper docs by area: `docs/ui/` · `docs/auth/` · `docs/frontend/` · `docs/backend/`. diff --git a/package.json b/package.json index 75b6e35..fe3c338 100644 --- a/package.json +++ b/package.json @@ -11,10 +11,7 @@ "test": "vitest run", "test:e2e": "playwright test", "test:watch": "vitest", - "test:contract": "vitest run --config vitest.contract.config.ts", - "sync-skills": "bun run scripts/sync-skills.ts", - "check-skills": "bun run scripts/sync-skills.ts --check", - "prepare": "git config core.hooksPath .githooks 2>/dev/null || true" + "test:contract": "vitest run --config vitest.contract.config.ts" }, "dependencies": { "@kobalte/core": "^0.13.12", diff --git a/scripts/sync-skills.ts b/scripts/sync-skills.ts deleted file mode 100644 index c00a3a1..0000000 --- a/scripts/sync-skills.ts +++ /dev/null @@ -1,64 +0,0 @@ -#!/usr/bin/env bun -/** - * Mirror `.claude/skills/` → `.codex/skills/`. - * - * `.claude/skills/` is the single source of truth (Claude Code auto-loads it). - * Codex reads the identical copy under `.codex/skills/`. Skills are hand-edited - * in `.claude/` and this script keeps `.codex/` byte-identical so the two never - * drift. - * - * bun run sync-skills # copy .claude/skills → .codex/skills - * bun run sync-skills --check # exit 1 if they differ (no writes) — for CI/hooks - */ -import { readdirSync, readFileSync, mkdirSync, writeFileSync, rmSync, statSync, existsSync } from "node:fs"; -import { join, relative } from "node:path"; - -const SRC = ".claude/skills"; -const DST = ".codex/skills"; -const check = process.argv.includes("--check"); - -function walk(dir: string): string[] { - if (!existsSync(dir)) return []; - return readdirSync(dir).flatMap((name) => { - const p = join(dir, name); - return statSync(p).isDirectory() ? walk(p) : [p]; - }); -} - -const srcFiles = walk(SRC).map((p) => relative(SRC, p)); -const dstFiles = walk(DST).map((p) => relative(DST, p)); - -if (!existsSync(SRC)) { - console.error(`✗ source ${SRC}/ does not exist`); - process.exit(1); -} - -if (check) { - const drift: string[] = []; - for (const rel of new Set([...srcFiles, ...dstFiles])) { - const s = existsSync(join(SRC, rel)) ? readFileSync(join(SRC, rel), "utf8") : null; - const d = existsSync(join(DST, rel)) ? readFileSync(join(DST, rel), "utf8") : null; - if (s !== d) drift.push(rel); - } - if (drift.length) { - console.error("✗ .codex/skills is out of sync with .claude/skills:"); - for (const f of drift) console.error(` ${f}`); - console.error(" run: bun run sync-skills"); - process.exit(1); - } - console.log("✓ .claude/skills and .codex/skills are in sync"); - process.exit(0); -} - -// sync mode: make DST a byte-identical mirror of SRC -for (const rel of srcFiles) { - const from = join(SRC, rel); - const to = join(DST, rel); - mkdirSync(join(to, ".."), { recursive: true }); - writeFileSync(to, readFileSync(from)); -} -// remove DST files that no longer exist in SRC -for (const rel of dstFiles) { - if (!srcFiles.includes(rel)) rmSync(join(DST, rel)); -} -console.log(`✓ synced ${srcFiles.length} skill file(s) → ${DST}`);