Remove codex skill-mirror sync (codex kaldırıldı)
Browse files at this commit113a85866872ab079fbb7f4154cd8666367dcce0Parent: 0f9d8a5- chore
- remove codex skill-mirror sync (codex kaldırıldı)
11 changed files +2 -315
- .codex/config.toml +0 -2
- .codex/skills/api-layer/SKILL.md +0 -24
- .codex/skills/commit-workflow/SKILL.md +0 -39
- .codex/skills/dashboard-design/SKILL.md +0 -46
- .codex/skills/solidjs-pitfalls/SKILL.md +0 -60
- .codex/skills/ui-conventions/SKILL.md +0 -63
- .githooks/pre-commit +0 -8
- AGENTS.md +0 -2
- CLAUDE.md +1 -3
- package.json +1 -4
- scripts/sync-skills.ts +0 -64
.codex/config.tomldeleted+0 -2
| @@ -1,2 +0,0 @@ | |||
| 1 | -[plugins."browser@openai-bundled"] | ||
| 2 | -enabled = true | ||
.codex/skills/api-layer/SKILL.mddeleted+0 -24
| @@ -1,24 +0,0 @@ | |||
| 1 | ---- | ||
| 2 | -name: api-layer | ||
| 3 | -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. | ||
| 4 | ---- | ||
| 5 | - | ||
| 6 | -# API layer | ||
| 7 | - | ||
| 8 | -## Structure | ||
| 9 | - | ||
| 10 | -- Domain-based folders under `src/api/` (e.g. `src/api/notes/`, `src/api/exams/`). | ||
| 11 | -- 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`. | ||
| 12 | -- Each file exports exactly one function matching its filename. | ||
| 13 | -- Each domain must have an `index.ts` re-exporting its endpoints. | ||
| 14 | -- Only `src/api/client/client.ts` calls `fetch` directly. Pages/components never call `fetch` — they call `src/api/<domain>` functions inside `createResource`. | ||
| 15 | - | ||
| 16 | -## Tests — mandatory | ||
| 17 | - | ||
| 18 | -Every new or modified API endpoint file must have a corresponding test file at `src/api/__tests__/<domain>/<domain>.test.ts` (one test file per domain, not per endpoint). | ||
| 19 | - | ||
| 20 | -- Use **vitest** (globals enabled) and shared helpers from `src/api/__tests__/helpers/mock-fetch.ts`: `mockFetchSuccess`, `mockFetch204`, `mockFetchError`, `lastFetchCall`. | ||
| 21 | -- Each test asserts correct URL, HTTP method, and request body (when applicable). | ||
| 22 | -- `afterEach` must call `vi.restoreAllMocks()`. | ||
| 23 | -- Run `bun run test` before committing. | ||
| 24 | -- Do not skip or defer API tests — they are part of the definition of done for every API change. | ||
.codex/skills/commit-workflow/SKILL.mddeleted+0 -39
| @@ -1,39 +0,0 @@ | |||
| 1 | ---- | ||
| 2 | -name: commit-workflow | ||
| 3 | -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. | ||
| 4 | ---- | ||
| 5 | - | ||
| 6 | -# Commit workflow | ||
| 7 | - | ||
| 8 | -## Message format | ||
| 9 | - | ||
| 10 | -Conventional Commits + a short emoji + bullet detail: | ||
| 11 | - | ||
| 12 | -``` | ||
| 13 | -<type>: <emoji> <short summary> | ||
| 14 | -- <concrete sub-change 1> | ||
| 15 | -- <concrete sub-change 2> | ||
| 16 | -``` | ||
| 17 | - | ||
| 18 | -Example: | ||
| 19 | - | ||
| 20 | -``` | ||
| 21 | -feat: ✨ live exams, Turkish i18n, and mobile tab bar | ||
| 22 | -- mirror the backend exam contract: schedule fields, attempts, | ||
| 23 | - questions/answers, live monitor, /time clock sync, ws proxy | ||
| 24 | -- exam scheduling UI in plain words with client-side window validation | ||
| 25 | -- student exam room: server-judged countdown, WebSocket autosave with | ||
| 26 | - REST fallback, two-step turn-in, review after submit or expiry | ||
| 27 | -- full English/Turkish dictionaries, persisted toggle, localized dates | ||
| 28 | -- bottom tab bar within thumb reach on small screens | ||
| 29 | -``` | ||
| 30 | - | ||
| 31 | -## Rules | ||
| 32 | - | ||
| 33 | -- **Title:** `type: emoji short summary` — `type` ∈ `feat|fix|refactor|chore|docs|style|test|perf`. Short, plain, no marketing tone. | ||
| 34 | -- **Body:** one concrete sub-change per line, technical but plain language. Continuation lines indented two spaces. | ||
| 35 | -- **Language:** every commit message is in English, always — regardless of the conversation language. | ||
| 36 | -- **When to commit:** one commit per significant/complete feature. Not for tiny one-line fixes alone; never commit half-finished or non-building code. | ||
| 37 | -- **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. | ||
| 38 | -- **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. | ||
| 39 | -- **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. | ||
.codex/skills/dashboard-design/SKILL.mddeleted+0 -46
| @@ -1,46 +0,0 @@ | |||
| 1 | ---- | ||
| 2 | -name: dashboard-design | ||
| 3 | -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. | ||
| 4 | ---- | ||
| 5 | - | ||
| 6 | -# Dashboard / homepage design | ||
| 7 | - | ||
| 8 | -Reference: `src/pages/dashboard-page.tsx`. The homepage is a **read-only status board**, not a marketing landing or action hub. | ||
| 9 | - | ||
| 10 | -- **No mutations:** no create/edit/delete buttons, no primary CTAs that open forms. Links only navigate to existing list/detail routes. | ||
| 11 | -- **Charts are allowed, on real data only.** Charts use `ChartBar`, | ||
| 12 | - `ChartProgressRing` and `ChartHeatmap` from `src/components/ui/` (accent = | ||
| 13 | - `hsl(var(--primary))`, semantic tints for status). | ||
| 14 | - **Every chart/stat must be backed by a live API field** — no fabricated trends, | ||
| 15 | - streak counters, sparklines, or `+%` delta badges the backend can't produce. | ||
| 16 | - Categorical series use bars, with a plain empty state when no records exist. | ||
| 17 | -- **Layout order (top → bottom):** | ||
| 18 | - 1. Compact header — greeting, role chip (neutral), date. | ||
| 19 | - 2. **Highlights** — role-scoped stat cards (icon + label + mono value). | ||
| 20 | - 3. Chart row on `lg+` (hidden for `parent`, who has no marks access). | ||
| 21 | - 4. **Upcoming deadlines** `DataTable` (exams / events / homework / appointments), | ||
| 22 | - full width for every role — one standalone section, no side panel and no | ||
| 23 | - shortcut link in its header. | ||
| 24 | - 5. **Activity heatmap** — full-width `ChartHeatmap`, 26 weeks. | ||
| 25 | -- **Grid:** stat row `1 → 2 sm → 4 lg`; charts `lg:grid-cols-3`. | ||
| 26 | -- **Role scoping:** stat/chart set matches nav/role matrix. Show only panels whose | ||
| 27 | - data exists for the role, and never call an endpoint the role would 403 on. | ||
| 28 | -- **Deadlines table:** active / today / soon items only, semantic status badge, rows | ||
| 29 | - navigate by pointer, Enter, or Space. Empty state is plain text, not a create CTA. | ||
| 30 | -- **Chart semantics per role:** | ||
| 31 | - - student — course averages + **success trend** (own marks ordered by their exam's | ||
| 32 | - date) + attendance split ring. | ||
| 33 | - - teacher+ — **success trend** (`getExamStatistics().average` per exam, spans 2) | ||
| 34 | - + the same averages grouped by course. Statistics are grader-only, so the | ||
| 35 | - resource must stay gated on `hasMinRole(role, "teacher")`. | ||
| 36 | - - Exam statistics have no bulk endpoint: cap the trend at the most recent handful | ||
| 37 | - of past, non-draft exams (`TREND_EXAM_CAP`), and swallow a per-exam failure | ||
| 38 | - rather than blanking the panel. | ||
| 39 | - - Never chart `Course.capacity` as if it were performance, and never derive a | ||
| 40 | - class (şube) average — no endpoint aggregates one, and per-student fetches do | ||
| 41 | - not belong on the homepage. | ||
| 42 | -- **Heatmap source per role:** student = own `/pomodoro/me` focus minutes; | ||
| 43 | - parent = own appointments; teacher+ = dated exams/events/homework already read by | ||
| 44 | - the page. Never read another user's pomodoro log here. | ||
| 45 | -- **Role privacy:** no teacher-only navigation shortcuts on the board. No inferred | ||
| 46 | - priority or manual refresh. | ||
.codex/skills/solidjs-pitfalls/SKILL.mddeleted+0 -60
| @@ -1,60 +0,0 @@ | |||
| 1 | ---- | ||
| 2 | -name: solidjs-pitfalls | ||
| 3 | -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 <Suspense>, polling, or inline PATCH toggles. | ||
| 4 | ---- | ||
| 5 | - | ||
| 6 | -# SolidJS rules & resource pitfalls | ||
| 7 | - | ||
| 8 | -## Baseline rules — SolidJS is not React | ||
| 9 | - | ||
| 10 | -Solid components run **once**; there is no re-render. | ||
| 11 | - | ||
| 12 | -1. Never destructure props — use `props.title` or `splitProps`. | ||
| 13 | -2. Signals are functions: read `count()`, write `setCount(v)`. | ||
| 14 | -3. Use `createSignal`/`createMemo`/`createEffect`/`createResource` — never | ||
| 15 | - `useState`/`useEffect`/`useMemo`, no dependency arrays. | ||
| 16 | -4. Conditional/list rendering: `<Show>`, `<For>`, `<Switch>/<Match>`; server data: | ||
| 17 | - `<Suspense>` + `createResource`. | ||
| 18 | -5. Use `class`, not `className`. Route components are `lazy()`-loaded into the | ||
| 19 | - TanStack Router tree. | ||
| 20 | - | ||
| 21 | -## Performance | ||
| 22 | - | ||
| 23 | -- Every route component is `lazy()` (code-split per page). | ||
| 24 | -- Server data goes through `createResource` → `<Suspense>` (lightweight fallback), | ||
| 25 | - `refetch()` after mutations. | ||
| 26 | -- One `<Suspense>` boundary per page, no spinner-cascades, fixed-height list rows. | ||
| 27 | - | ||
| 28 | -## Two expensive resource pitfalls | ||
| 29 | - | ||
| 30 | -## 1. `resource.latest` for reads outside `<Suspense>` | ||
| 31 | - | ||
| 32 | -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 `<Suspense>` (e.g. an always-rendered badge/count in a shell component mounted beside `<Outlet>`), 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. | ||
| 33 | - | ||
| 34 | -Rule: | ||
| 35 | -- Reads under a page's `<Suspense>` → use `resource()`. | ||
| 36 | -- Always-rendered / shell / badge reads of a periodically-refetched resource → use `resource.latest` (last value, no suspend). | ||
| 37 | -- Poll-driven revalidation belongs behind `.latest`. | ||
| 38 | - | ||
| 39 | -## 2. Live save-on-click toggles use a local signal, not `mutate`/`refetch` | ||
| 40 | - | ||
| 41 | -For an inline switch that PATCHes one field (e.g. the exam-review toggle in `exam-detail-page.tsx`): | ||
| 42 | - | ||
| 43 | -- Do NOT `refetch()` the shared resource → re-suspends → page spinner. | ||
| 44 | -- 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. | ||
| 45 | - | ||
| 46 | -Instead keep a local signal, sync from the resource in a `createEffect`, flip optimistically, revert on failure: | ||
| 47 | - | ||
| 48 | -```ts | ||
| 49 | -const [on, setOn] = createSignal(false); | ||
| 50 | -createEffect(() => { const e = res(); if (e) setOn(e.field); }); | ||
| 51 | -const toggle = async (next: boolean) => { | ||
| 52 | - if (saving()) return; | ||
| 53 | - setOn(next); setSaving(true); | ||
| 54 | - try { await patchX(id(), { field: next }); } | ||
| 55 | - catch (err) { setOn(!next); setError(fmt(err)); } | ||
| 56 | - finally { setSaving(false); } | ||
| 57 | -}; | ||
| 58 | -``` | ||
| 59 | - | ||
| 60 | -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. | ||
.codex/skills/ui-conventions/SKILL.mddeleted+0 -63
| @@ -1,63 +0,0 @@ | |||
| 1 | ---- | ||
| 2 | -name: ui-conventions | ||
| 3 | -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. | ||
| 4 | ---- | ||
| 5 | - | ||
| 6 | -# UI conventions | ||
| 7 | - | ||
| 8 | -## Naming & file structure | ||
| 9 | - | ||
| 10 | -- **One component per file.** Never two sibling components in one file. Exception: | ||
| 11 | - shadcn-solid wrapper files under `src/components/ui/` may export the documented | ||
| 12 | - compound API from one file (`Dialog`, `DialogContent`, `DialogHeader`, …). | ||
| 13 | -- File name = component name in kebab-case; exported component is PascalCase | ||
| 14 | - (`note-card.tsx` → `NoteCard`). Colocated files keep the base name | ||
| 15 | - (`note-card.types.ts`, `note-card.test.tsx`). | ||
| 16 | -- Same-domain components share a folder: `components/notes/`, `events/`, `exams/`, | ||
| 17 | - `users/`, `attendance/`, `courses/`, `marks/`, `sessions/`, `messages/`, | ||
| 18 | - `homework/`, `appointments/`, `layout/`, `ui/`. | ||
| 19 | -- Cross-cutting app state lives in `src/stores/` (`auth-context.tsx`, | ||
| 20 | - `preferences-context.tsx`) — context providers only, never domain components. | ||
| 21 | - School-policy lists (exam kinds, attendance statuses, grade bands) come from | ||
| 22 | - `getSettings()` in a `createResource`, never hardcoded. | ||
| 23 | -- **API layer** lives under `src/api/` — domain folders, one verb-first file per | ||
| 24 | - endpoint, `fetch` only in `client.ts`, mandatory per-domain tests. Full rules and | ||
| 25 | - the test contract: **api-layer** reference. | ||
| 26 | - | ||
| 27 | -Active project reference docs (read the relevant one before changing that area): | ||
| 28 | -- `docs/ui/navigation-patterns.md` — interaction rules, role scope, side-panel/full-page decisions, dashboard structure. | ||
| 29 | -- `docs/ui/ui-redesign-tokens.md` — visual density, radius, table, side-panel, status UI, dashboard card conventions. | ||
| 30 | -- `docs/auth/role-scope-matrix.md` — role access matrix for pages/nav/dashboard cards. | ||
| 31 | -- `docs/frontend/frontend-next-steps.md` — completed audit summary plus active follow-up notes. | ||
| 32 | -- `docs/backend/backend-ui-alignment-plan.md` — completed archive; not active work unless backend scope changes. | ||
| 33 | - | ||
| 34 | -## Layout & panels | ||
| 35 | - | ||
| 36 | -- Durable resources use full detail pages. Short create/edit/filter work uses `SidePanel`. Destructive actions use confirm dialogs. | ||
| 37 | -- Disclosure sections may defer mounting (request savings) or stay mounted (state preservation) — choose deliberately; avoid hidden heavy requests unless needed. | ||
| 38 | - | ||
| 39 | -## Buttons | ||
| 40 | - | ||
| 41 | -- Header create actions: compact icon+label, consistent size and current radius. | ||
| 42 | -- Page header primary create/add: `size="sm" class="min-w-[7.5rem] rounded-lg"`. Secondary/import: `variant="outline"` with the same size/class. | ||
| 43 | -- Section/sub-panel header actions: `variant="outline" size="sm" class="rounded-lg"` unless matching a page header button. | ||
| 44 | -- 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. | ||
| 45 | - | ||
| 46 | -## Tables | ||
| 47 | - | ||
| 48 | -- Application tables must use `src/components/ui/data-table.tsx` `DataTable`. | ||
| 49 | -- 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. | ||
| 50 | -- Table-page headers fold into the `DataTable` title/description/actions area; do not render a separate `PageHeader` above table-primary pages. | ||
| 51 | -- 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`. | ||
| 52 | -- Pages/domain components must not import or render `Table` primitives directly; only the `DataTable` wrapper and table primitive files may. | ||
| 53 | - | ||
| 54 | -## Date/time & attendance | ||
| 55 | - | ||
| 56 | -- 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. | ||
| 57 | -- 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. | ||
| 58 | -- Attendance status UI uses shared localized metadata: label, short detail text, semantic colors. | ||
| 59 | - | ||
| 60 | -## Features | ||
| 61 | - | ||
| 62 | -- **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. | ||
| 63 | -- **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. | ||
.githooks/pre-commitdeleted+0 -8
| @@ -1,8 +0,0 @@ | |||
| 1 | -#!/bin/sh | ||
| 2 | -# Fail the commit if .codex/skills has drifted from .claude/skills. | ||
| 3 | -# Enable once per clone: git config core.hooksPath .githooks | ||
| 4 | -bun run scripts/sync-skills.ts --check || { | ||
| 5 | - echo "" | ||
| 6 | - echo " Skill mirror drift blocked the commit. Fix with: bun run sync-skills" | ||
| 7 | - exit 1 | ||
| 8 | -} | ||
AGENTS.mdmodified+0 -2
| @@ -27,7 +27,5 @@ Bilingual codebase: Turkish UI labels, English code + commits. | |||
| 27 | 27 | ||
| 28 | Load on demand by area — `solidjs-pitfalls` | `ui-conventions` | `api-layer` | | 28 | Load on demand by area — `solidjs-pitfalls` | `ui-conventions` | `api-layer` | |
| 29 | `commit-workflow` | `dashboard-design`. Source of truth: `.claude/skills/<name>/SKILL.md`. | 29 | `commit-workflow` | `dashboard-design`. Source of truth: `.claude/skills/<name>/SKILL.md`. |
| 30 | -`.codex/skills/` is a generated mirror — edit `.claude`, then `bun run sync-skills` | ||
| 31 | -(a pre-commit hook blocks drift). | ||
| 32 | 30 | ||
| 33 | Deeper docs by area: `docs/ui/` · `docs/auth/` · `docs/frontend/` · `docs/backend/`. | 31 | Deeper docs by area: `docs/ui/` · `docs/auth/` · `docs/frontend/` · `docs/backend/`. |
CLAUDE.mdmodified+1 -3
| @@ -4,7 +4,7 @@ SolidJS + TypeScript + TanStack Router + shadcn-solid, Vite/Bun. | |||
| 4 | Read-only status-board dashboard; Turkish/English i18n. | 4 | Read-only status-board dashboard; Turkish/English i18n. |
| 5 | Bilingual codebase: Turkish UI labels, English code + commits. | 5 | Bilingual codebase: Turkish UI labels, English code + commits. |
| 6 | 6 | ||
| 7 | -**AGENTS.md mirrors this for Codex/OpenCode.** Update CLAUDE.md first, then copy. | 7 | +**AGENTS.md mirrors this for OpenCode.** Update CLAUDE.md first, then copy. |
| 8 | 8 | ||
| 9 | ## Gotchas | 9 | ## Gotchas |
| 10 | 10 | ||
| @@ -26,7 +26,5 @@ Bilingual codebase: Turkish UI labels, English code + commits. | |||
| 26 | 26 | ||
| 27 | Load on demand by area — `solidjs-pitfalls` | `ui-conventions` | `api-layer` | | 27 | Load on demand by area — `solidjs-pitfalls` | `ui-conventions` | `api-layer` | |
| 28 | `commit-workflow` | `dashboard-design`. Source of truth: `.claude/skills/<name>/SKILL.md`. | 28 | `commit-workflow` | `dashboard-design`. Source of truth: `.claude/skills/<name>/SKILL.md`. |
| 29 | -`.codex/skills/` is a generated mirror — edit `.claude`, then `bun run sync-skills` | ||
| 30 | -(a pre-commit hook blocks drift). | ||
| 31 | 29 | ||
| 32 | Deeper docs by area: `docs/ui/` · `docs/auth/` · `docs/frontend/` · `docs/backend/`. | 30 | Deeper docs by area: `docs/ui/` · `docs/auth/` · `docs/frontend/` · `docs/backend/`. |
package.jsonmodified+1 -4
| @@ -11,10 +11,7 @@ | |||
| 11 | "test": "vitest run", | 11 | "test": "vitest run", |
| 12 | "test:e2e": "playwright test", | 12 | "test:e2e": "playwright test", |
| 13 | "test:watch": "vitest", | 13 | "test:watch": "vitest", |
| 14 | - "test:contract": "vitest run --config vitest.contract.config.ts", | 14 | + "test:contract": "vitest run --config vitest.contract.config.ts" |
| 15 | - "sync-skills": "bun run scripts/sync-skills.ts", | ||
| 16 | - "check-skills": "bun run scripts/sync-skills.ts --check", | ||
| 17 | - "prepare": "git config core.hooksPath .githooks 2>/dev/null || true" | ||
| 18 | }, | 15 | }, |
| 19 | "dependencies": { | 16 | "dependencies": { |
| 20 | "@kobalte/core": "^0.13.12", | 17 | "@kobalte/core": "^0.13.12", |
scripts/sync-skills.tsdeleted+0 -64
| @@ -1,64 +0,0 @@ | |||
| 1 | -#!/usr/bin/env bun | ||
| 2 | -/** | ||
| 3 | - * Mirror `.claude/skills/` → `.codex/skills/`. | ||
| 4 | - * | ||
| 5 | - * `.claude/skills/` is the single source of truth (Claude Code auto-loads it). | ||
| 6 | - * Codex reads the identical copy under `.codex/skills/`. Skills are hand-edited | ||
| 7 | - * in `.claude/` and this script keeps `.codex/` byte-identical so the two never | ||
| 8 | - * drift. | ||
| 9 | - * | ||
| 10 | - * bun run sync-skills # copy .claude/skills → .codex/skills | ||
| 11 | - * bun run sync-skills --check # exit 1 if they differ (no writes) — for CI/hooks | ||
| 12 | - */ | ||
| 13 | -import { readdirSync, readFileSync, mkdirSync, writeFileSync, rmSync, statSync, existsSync } from "node:fs"; | ||
| 14 | -import { join, relative } from "node:path"; | ||
| 15 | - | ||
| 16 | -const SRC = ".claude/skills"; | ||
| 17 | -const DST = ".codex/skills"; | ||
| 18 | -const check = process.argv.includes("--check"); | ||
| 19 | - | ||
| 20 | -function walk(dir: string): string[] { | ||
| 21 | - if (!existsSync(dir)) return []; | ||
| 22 | - return readdirSync(dir).flatMap((name) => { | ||
| 23 | - const p = join(dir, name); | ||
| 24 | - return statSync(p).isDirectory() ? walk(p) : [p]; | ||
| 25 | - }); | ||
| 26 | -} | ||
| 27 | - | ||
| 28 | -const srcFiles = walk(SRC).map((p) => relative(SRC, p)); | ||
| 29 | -const dstFiles = walk(DST).map((p) => relative(DST, p)); | ||
| 30 | - | ||
| 31 | -if (!existsSync(SRC)) { | ||
| 32 | - console.error(`✗ source ${SRC}/ does not exist`); | ||
| 33 | - process.exit(1); | ||
| 34 | -} | ||
| 35 | - | ||
| 36 | -if (check) { | ||
| 37 | - const drift: string[] = []; | ||
| 38 | - for (const rel of new Set([...srcFiles, ...dstFiles])) { | ||
| 39 | - const s = existsSync(join(SRC, rel)) ? readFileSync(join(SRC, rel), "utf8") : null; | ||
| 40 | - const d = existsSync(join(DST, rel)) ? readFileSync(join(DST, rel), "utf8") : null; | ||
| 41 | - if (s !== d) drift.push(rel); | ||
| 42 | - } | ||
| 43 | - if (drift.length) { | ||
| 44 | - console.error("✗ .codex/skills is out of sync with .claude/skills:"); | ||
| 45 | - for (const f of drift) console.error(` ${f}`); | ||
| 46 | - console.error(" run: bun run sync-skills"); | ||
| 47 | - process.exit(1); | ||
| 48 | - } | ||
| 49 | - console.log("✓ .claude/skills and .codex/skills are in sync"); | ||
| 50 | - process.exit(0); | ||
| 51 | -} | ||
| 52 | - | ||
| 53 | -// sync mode: make DST a byte-identical mirror of SRC | ||
| 54 | -for (const rel of srcFiles) { | ||
| 55 | - const from = join(SRC, rel); | ||
| 56 | - const to = join(DST, rel); | ||
| 57 | - mkdirSync(join(to, ".."), { recursive: true }); | ||
| 58 | - writeFileSync(to, readFileSync(from)); | ||
| 59 | -} | ||
| 60 | -// remove DST files that no longer exist in SRC | ||
| 61 | -for (const rel of dstFiles) { | ||
| 62 | - if (!srcFiles.includes(rel)) rmSync(join(DST, rel)); | ||
| 63 | -} | ||
| 64 | -console.log(`✓ synced ${srcFiles.length} skill file(s) → ${DST}`); | ||