diff --git a/.agents/AGENTS.md b/.agents/AGENTS.md new file mode 100644 index 00000000..6d1ea1f9 --- /dev/null +++ b/.agents/AGENTS.md @@ -0,0 +1,10 @@ +# Workspace Agent Rules + +## Skill & MCP Usage Guidelines +For **every prompt**: +1. Scan available Skills (`frontend-design`, `ui-ux-pro-max`, `awwwards-animations`, `high-end-visual-design`, `clean-code-refactor`, `graphify` vb.) and MCP Servers (`21st-dev`, `shadcn`, `playwright`, `fetch`, `filesystem`, `memory`, `graphify`). +2. **Independent Tool Selection**: Skills and MCP Servers operate independently. You do NOT need to call an MCP server to use a Skill, and you do NOT need a Skill to use an MCP server. Use whichever applies to the task. +3. **MUST BE THE FIRST LINE** of the response, expressed in present/future starting tense ("işleme başlıyorum"): + - **If matching Skill(s) and/or MCP(s) are used:** `🔍 **Tespit Edilen Araçlar:** Bu görev için **[Kullanılan Skill/MCP Adı]** araçlarını tespit ettim, bunları kullanarak işleme başlıyorum.` + - **If none apply:** `🔍 **Tespit Edilen Araçlar:** Bu görev için özel bir Skill veya MCP bulunamadı / gerekmiyor. Standart araçlarla devam ediyorum.` +4. **Design & Code Excellence**: Enforce top-tier UI/UX design standards, smooth micro-interactions, responsive ergonomics, clean code principles, and zero false claims. diff --git a/.codex/hooks.json b/.codex/hooks.json new file mode 100644 index 00000000..23843ebb --- /dev/null +++ b/.codex/hooks.json @@ -0,0 +1,15 @@ +{ + "hooks": { + "PreToolUse": [ + { + "matcher": "Bash", + "hooks": [ + { + "type": "command", + "command": "/home/chatgpt/.local/bin/graphify hook-check" + } + ] + } + ] + } +} \ No newline at end of file diff --git a/.codex/skills/graphify/.graphify_version b/.codex/skills/graphify/.graphify_version new file mode 100644 index 00000000..3431d022 --- /dev/null +++ b/.codex/skills/graphify/.graphify_version @@ -0,0 +1 @@ +0.9.51 \ No newline at end of file diff --git a/.codex/skills/graphify/SKILL.md b/.codex/skills/graphify/SKILL.md new file mode 100644 index 00000000..af3f723c --- /dev/null +++ b/.codex/skills/graphify/SKILL.md @@ -0,0 +1,710 @@ +--- +name: graphify +description: "Use for any question about a codebase, its architecture, file relationships, or project content — especially when graphify-out/ exists, where the question should be treated as a graphify query first. Turns any input (code, docs, papers, images, videos) into a persistent knowledge graph with god nodes, community detection, and query/path/explain tools." +--- + +# /graphify + +Turn any folder of files into a navigable knowledge graph with community detection, an honest audit trail, and three outputs: interactive HTML, GraphRAG-ready JSON, and a plain-language GRAPH_REPORT.md. + +## Usage + +``` +/graphify # full pipeline on current directory (HTML viz; add --obsidian for a vault) +/graphify # full pipeline on specific path +/graphify https://github.com// # clone repo then run full pipeline on it +/graphify https://github.com// --branch # clone a specific branch +/graphify ... # clone multiple repos, build each, merge into one cross-repo graph +/graphify --mode deep # thorough extraction, richer INFERRED edges +/graphify --update # incremental - re-extract only new/changed files +/graphify --directed # build directed graph (preserves edge direction: source→target) +/graphify --whisper-model medium # use a larger Whisper model for better transcription accuracy +/graphify --cluster-only # rerun clustering on existing graph +/graphify --no-viz # skip visualization, just report + JSON +/graphify --html # (HTML is generated by default - this flag is a no-op) +/graphify --svg # also export graph.svg (embeds in Notion, GitHub) +/graphify --graphml # export graph.graphml (Gephi, yEd) +/graphify --neo4j # generate graphify-out/cypher.txt for Neo4j +/graphify --neo4j-push bolt://localhost:7687 # push directly to Neo4j +/graphify --falkordb # generate graphify-out/cypher.txt for FalkorDB +/graphify --falkordb-push falkordb://localhost:6379 # push directly to FalkorDB +/graphify --mcp # start MCP stdio server for agent access +/graphify --watch # watch folder, auto-rebuild on code changes (no LLM needed) +/graphify --wiki # build agent-crawlable wiki (index.md + one article per community) +/graphify --obsidian --obsidian-dir ~/vaults/my-project # write vault to custom path (e.g. existing vault) +/graphify add # fetch URL, save to ./raw, update graph +/graphify add --author "Name" # tag who wrote it +/graphify add --contributor "Name" # tag who added it to the corpus +/graphify query "" # BFS traversal - broad context +/graphify query "" --dfs # DFS - trace a specific path +/graphify query "" --budget 1500 # cap answer at N tokens +/graphify path "AuthModule" "Database" # shortest path between two concepts +/graphify explain "SwinTransformer" # plain-language explanation of a node +``` + +## What graphify is for + +Drop any folder of code, docs, papers, images, or video into graphify and get a queryable knowledge graph. Persistent across sessions, honest audit trail (EXTRACTED/INFERRED/AMBIGUOUS), community detection surfaces cross-document connections you wouldn't think to ask about. + +## What You Must Do When Invoked + +If the user invoked `/graphify --help` or `/graphify -h` (with no other arguments), print the contents of the `## Usage` section above verbatim and stop. Do not run any commands, do not detect files, do not default the path to `.`. Just print the Usage block and return. + +**Fast path — existing graph:** Before doing anything else, check whether `graphify-out/graph.json` exists. The expected location is `graphify-out/graph.json` relative to the **current working directory** (i.e. the project root where you are running commands). If it exists AND the user's request is a natural-language question about the codebase (e.g. "How does X work?", "What calls Y?", "Trace the data flow through Z") and NOT an explicit rebuild command (`--update`, `--cluster-only`, or a bare path/URL that implies fresh extraction): **skip Steps 1–5 entirely and jump straight to `## For /graphify query`.** Run `graphify query ""` immediately. Do not run detect. Do not check corpus size. Do not ask the user to narrow. The graph is already built — use it. + +If no path was given, use `.` (current directory). Do not ask the user for a path. + +If the path argument starts with `https://github.com/` or `http://github.com/`, treat it as a GitHub URL - run Step 0 before anything else, then continue with the resolved local path. + +Follow these steps in order. Do not skip steps. + +### Step 0 - GitHub repos and multi-path merge (only if a URL or several paths) + +Only when the path is one or more `https://github.com/...` URLs, or several local subfolders to merge. See `references/github-and-merge.md` for the clone, cross-repo merge, and monorepo flow, then continue with the resolved local path. A plain local path skips this step. + +### Step 1 - Ensure graphify is installed + +```bash +# Detect the correct Python interpreter (handles uv tool, pipx, venv, system installs) +PYTHON="" +GRAPHIFY_BIN=$(which graphify 2>/dev/null) +# 1. uv tool installs — most reliable on modern Mac/Linux +if [ -z "$PYTHON" ] && command -v uv >/dev/null 2>&1; then + _UV_PY=$(uv tool run --from graphifyy python -c "import sys; print(sys.executable)" 2>/dev/null) + if [ -n "$_UV_PY" ]; then PYTHON="$_UV_PY"; fi +fi +# 2. Read shebang from graphify binary (pipx and direct pip installs) +if [ -z "$PYTHON" ] && [ -n "$GRAPHIFY_BIN" ]; then + _SHEBANG=$(head -1 "$GRAPHIFY_BIN" | tr -d '#!') + case "$_SHEBANG" in + *[!a-zA-Z0-9/_.@-]*) ;; + *) "$_SHEBANG" -c "import graphify" 2>/dev/null && PYTHON="$_SHEBANG" ;; + esac +fi +# 3. Fall back to python3 +if [ -z "$PYTHON" ]; then PYTHON="python3"; fi +if ! "$PYTHON" -c "import graphify" 2>/dev/null; then + if command -v uv >/dev/null 2>&1; then + uv tool install --upgrade graphifyy -q 2>&1 | tail -3 + _UV_PY=$(uv tool run --from graphifyy python -c "import sys; print(sys.executable)" 2>/dev/null) + if [ -n "$_UV_PY" ]; then PYTHON="$_UV_PY"; fi + else + "$PYTHON" -m pip install graphifyy -q 2>/dev/null \ + || "$PYTHON" -m pip install graphifyy -q --break-system-packages 2>&1 | tail -3 + fi +fi +# Write interpreter path for all subsequent steps (persists across invocations) +mkdir -p graphify-out +"$PYTHON" -c "import sys; open('graphify-out/.graphify_python', 'w', encoding='utf-8').write(sys.executable)" +# Save scan root so `graphify update` (no args) knows where to look next time +echo "$(cd INPUT_PATH && pwd)" > graphify-out/.graphify_root +``` + +If the import succeeds, print nothing and move straight to Step 2. + +**In every subsequent bash block, replace `python3` with `$(cat graphify-out/.graphify_python)` to use the correct interpreter.** + +### Step 2 - Detect files + +```bash +$(cat graphify-out/.graphify_python) -c " +import json +from graphify.detect import detect +from pathlib import Path +result = detect(Path('INPUT_PATH')) +# Write the sidecar from Python, not a shell redirect, so the same block renders +# on PowerShell hosts without console-encoding drift (#2528). +Path('graphify-out/.graphify_detect.json').write_text(json.dumps(result, ensure_ascii=False), encoding=\"utf-8\") +print(f'Detected {result[\"total_files\"]} files') +" +``` + +Replace INPUT_PATH with the actual path the user provided. Do NOT cat or print the JSON - read it silently and present a clean summary instead: + +``` +Corpus: X files · ~Y words + code: N files (.py .ts .go ...) + docs: N files (.md .txt ...) + papers: N files (.pdf ...) + images: N files + video: N files (.mp4 .mp3 ...) +``` + +Omit any category with 0 files from the summary. + +Then act on it: +- If `total_files` is 0: stop with "No supported files found in [path]." +- If `skipped_sensitive` is non-empty: report the count and list the skipped file names, so a wrongly-flagged source or doc is visible and can be renamed or moved (#2106). +- If `total_words` > 2,000,000 OR `total_files` > 500: show the warning. Then compute the top 5 first-level subdirectories by file count: + - Read `scan_root` from the detect JSON (always an absolute path to the resolved INPUT_PATH). + - Concatenate all file lists across all types (`code`, `document`, `paper`, `image`, `video`). + - Filter out any path that starts with `scan_root + "/graphify-out/"` to exclude converted sidecars. + - For each file, strip the `scan_root` prefix and take the first path component. Files directly in `scan_root` with no subdirectory count as `(root)`. + - If all files are in `(root)` with no subdirectories, do not ask to narrow — no subfolders exist. Instead suggest `--no-cluster` to skip the expensive clustering step and proceed. + - Otherwise rank by count, show the top 5 with file counts, then ask which subfolder to run on. Wait for the user's answer before proceeding. +- Otherwise: proceed directly to Step 2.5 if video files were detected, or Step 3 if not. + +### Step 2.5 - Video and audio (only if video files detected) + +Skip this step entirely if `detect` returned zero `video` files. When the corpus has video or audio, see `references/transcribe.md` to transcribe them to text first, then treat the transcripts as doc files in Step 3. + +### Step 3 - Extract entities and relationships + +**Before starting:** note whether `--mode deep` was given. You must pass `DEEP_MODE=true` to every subagent in Step B2 if it was. Track this from the original invocation - do not lose it. + +This step has two parts: **structural extraction** (deterministic, free) and **semantic extraction** (LLM, costs tokens). + +> **graphify needs no API key. Never ask the user for one, and never block on one.** Code is extracted structurally (AST) with no LLM and no key at all — a code-only corpus (the common `/graphify .` on a repo) skips semantic extraction entirely, so it needs nothing here: go straight to Part A and skip Part B. Semantic extraction (only for docs, papers, and images) uses Gemini **only if** `GEMINI_API_KEY`/`GOOGLE_API_KEY` is already set; otherwise the host agent itself is the LLM. graphify does **not** read `ANTHROPIC_API_KEY`, `OPENAI_API_KEY`, or any other provider key. If you catch yourself about to prompt for, wait on, or stop because of a missing API key, that is a misread of this skill — proceed without one. + +**Before semantic extraction:** check whether `GEMINI_API_KEY` or `GOOGLE_API_KEY` is set. If neither is set, print this one-liner to the user: +> Tip: set `GEMINI_API_KEY` or `GOOGLE_API_KEY` to use Gemini for semantic extraction (`pip install 'graphifyy[gemini]'`). + +Print it once, then continue — do not wait for the user to supply a key. If `GEMINI_API_KEY` or `GOOGLE_API_KEY` IS set, use `graphify.llm.extract_corpus_parallel(files, backend="gemini")` for semantic extraction instead of dispatching subagents. The default Gemini model is `gemini-3-flash-preview`; set `GRAPHIFY_GEMINI_MODEL` or pass `--model` in headless CLI flows to override it. + +> **No other API keys are read.** When `GEMINI_API_KEY`/`GOOGLE_API_KEY` are unset, semantic extraction falls to the host agent itself — the running session is the LLM. On a host that dispatches subagents (e.g. Claude Code), dispatch them as written in Part B. On a host that runs the CLI directly in a terminal and cannot dispatch subagents, do not stall: a code-only corpus has no semantic work, so write the empty semantic file (Part B "Fast path") and continue to Part C; for a corpus with docs/papers/images, either set a Gemini key or extract those inline yourself, but in no case prompt for `ANTHROPIC_API_KEY` — that prompt is a misread of this skill. + +**Run Part A (AST) and Part B (semantic) in parallel. Dispatch all semantic subagents AND start AST extraction in the same message. Both can run simultaneously since they operate on different file types. Merge results in Part C as before.** + +Note: Parallelizing AST + semantic saves 5-15s on large corpora. AST is deterministic and fast; start it while subagents are processing docs/papers. + +#### Part A - Structural extraction for code files + +For any code files detected, run AST extraction in parallel with Part B subagents: + +```bash +$(cat graphify-out/.graphify_python) -c " +import sys, json +from graphify.extract import collect_files, extract +from pathlib import Path +import json + +code_files = [] +detect = json.loads(Path('graphify-out/.graphify_detect.json').read_text(encoding=\"utf-8\")) +for f in detect.get('files', {}).get('code', []): + code_files.extend(collect_files(Path(f)) if Path(f).is_dir() else [Path(f)]) + +if code_files: + result = extract(code_files, cache_root=Path('INPUT_PATH')) + Path('graphify-out/.graphify_ast.json').write_text(json.dumps(result, indent=2, ensure_ascii=False), encoding=\"utf-8\") + print(f'AST: {len(result[\"nodes\"])} nodes, {len(result[\"edges\"])} edges') +else: + Path('graphify-out/.graphify_ast.json').write_text(json.dumps({'nodes':[],'edges':[],'input_tokens':0,'output_tokens':0}, ensure_ascii=False), encoding=\"utf-8\") + print('No code files - skipping AST extraction') +" +``` + +#### Part B - Semantic extraction (parallel subagents) + +**Fast path:** If detection found zero docs, papers, and images (code-only corpus), skip Part B entirely and go straight to Part C. AST handles code - there is nothing for semantic subagents to do. **First write an empty semantic file** so Part C's merge has its input (it reads `.graphify_semantic.json` unconditionally; without this a code-only run hits `FileNotFoundError`): + +```bash +$(cat graphify-out/.graphify_python) -c " +import json +from pathlib import Path +Path('graphify-out/.graphify_semantic.json').write_text(json.dumps({'nodes':[],'edges':[],'hyperedges':[],'input_tokens':0,'output_tokens':0}), encoding='utf-8') +" +``` + +**MANDATORY: You MUST use the Agent tool here. Reading files yourself one-by-one is forbidden - it is 5-10x slower. If you do not use the Agent tool you are doing this wrong.** + +Before dispatching subagents, print a timing estimate: +- Load `total_words` and file counts from `graphify-out/.graphify_detect.json` +- Estimate agents needed: `ceil(uncached_non_code_files / 22)` (chunk size is 20-25) +- Estimate time: ~45s per agent batch (they run in parallel, so total ≈ 45s × ceil(agents/parallel_limit)) +- Print: "Semantic extraction: ~N files → X agents, estimated ~Ys" + +**Step B0 - Check extraction cache first** + +Before dispatching any subagents, check which files already have cached extraction results: + +SPEC_PATH below is the **absolute** path of the `references/extraction-spec.md` that ships beside this SKILL.md — the same file Step B2 loads and hands to every subagent. It is the extraction prompt, so cache entries are attributed to it: when a graphify upgrade changes the prompt, entries produced by the old one are re-extracted instead of replayed, and unchanged prompts keep their entries (#1939). Substitute the real path in both Step B0 and Step B3 — pass the same one to each, and do not drop the argument. + +```bash +$(cat graphify-out/.graphify_python) -c " +import json +from graphify.cache import check_semantic_cache +from pathlib import Path + +detect = json.loads(Path('graphify-out/.graphify_detect.json').read_text(encoding=\"utf-8\")) +# Only content files go to semantic extraction. Code is already covered structurally +# by the AST pass (Part A); flattening every category here makes subagents re-read +# every source file (#1392). Video is transcribed to a document in Step 2.5 first. +all_files = [f for cat in ('document', 'paper', 'image') for f in detect['files'].get(cat, [])] + +cached_nodes, cached_edges, cached_hyperedges, uncached = check_semantic_cache(all_files, root='INPUT_PATH', prompt_file='SPEC_PATH') + +# Always (re)write the cache file: write hits, else DELETE any leftover from a prior +# run so Part C never merges a stale .graphify_cached.json (#1392). +if cached_nodes or cached_edges or cached_hyperedges: + Path('graphify-out/.graphify_cached.json').write_text(json.dumps({'nodes': cached_nodes, 'edges': cached_edges, 'hyperedges': cached_hyperedges}, ensure_ascii=False), encoding=\"utf-8\") +else: + Path('graphify-out/.graphify_cached.json').unlink(missing_ok=True) +Path('graphify-out/.graphify_uncached.txt').write_text('\n'.join(uncached), encoding=\"utf-8\") +print(f'Cache: {len(all_files)-len(uncached)} files hit, {len(uncached)} files need extraction') +" +``` + +Only dispatch subagents for files listed in `graphify-out/.graphify_uncached.txt`. If all files are cached, skip to Part C directly. + +**Step B1 - Split into chunks** + +Load files from `graphify-out/.graphify_uncached.txt`. Split into chunks of 20-25 files each. Each image gets its own chunk (vision needs separate context). When splitting, group files from the same directory together so related artifacts land in the same chunk and cross-file relationships are more likely to be extracted. + +**Step B2 - Dispatch ALL subagents in a single message (Codex)** + +> **Codex platform:** Uses `spawn_agent` + `wait_agent` + `close_agent` instead of the Agent tool. +> Requires `multi_agent = true` under `[features]` in `~/.codex/config.toml`. +> If `spawn_agent` is unavailable, tell the user to add that config and restart Codex. + +Call `spawn_agent` once per chunk — ALL in the same response so they run in parallel. Build the message by wrapping the extraction prompt in task-delegation framing: + +``` +spawn_agent(agent_type="worker", message="Your task is to perform the following. Follow the instructions below exactly.\n\n\n[extraction prompt, with FILE_LIST, CHUNK_NUM, TOTAL_CHUNKS, DEEP_MODE substituted]\n\n\nExecute this now. Output ONLY the structured JSON response.") +``` + +After all agents are dispatched, collect results sequentially in memory: +``` +result = wait_agent(handle); close_agent(handle) # repeat per handle +``` + +Parse each result as JSON. Accumulate nodes/edges/hyperedges across all results and write to `graphify-out/.graphify_semantic_new.json`. Codex collects in memory, so there are no per-chunk files on disk; the disk-based success checks in Step B3 do not apply — a chunk that returns invalid JSON is the failure signal instead. + +Subagent prompt template: + +See `references/extraction-spec.md` for the compact subagent prompt (rules, node-ID format, confidence rubric, hyperedge and vision rules, JSON schema). Load it only here, only when at least one chunk holds a doc, paper, or image; a pure-code corpus has skipped Part B and never reads it. Pass each agent that prompt verbatim with FILE_LIST, CHUNK_NUM, TOTAL_CHUNKS, and DEEP_MODE substituted, and have it return the JSON inline. + +**Step B3 - Collect, cache, and merge** + +Wait for all subagents. For each result: +- Check that `graphify-out/.graphify_chunk_NN.json` exists on disk — this is the success signal +- If the file exists and contains valid JSON with `nodes` and `edges`, include it and save to cache +- If the file is missing, the subagent was likely dispatched as read-only (Explore type) — print a warning: "chunk N missing from disk — subagent may have been read-only. Re-run with general-purpose agent." Do not silently skip. +- If a subagent failed or returned invalid JSON, print a warning and skip that chunk - do not abort + +If more than half the chunks failed or are missing, stop and tell the user to re-run and ensure `subagent_type="general-purpose"` is used. + +Merge all chunk files into `.graphify_semantic_new.json`. **After each Agent call completes, read the real token counts from the Agent tool result's `usage` field and write them back into the chunk JSON before merging** — the chunk JSON itself always has placeholder zeros. Then run: +```bash +$(cat graphify-out/.graphify_python) -c " +import json, glob +from pathlib import Path + +chunks = sorted(glob.glob('graphify-out/.graphify_chunk_*.json')) +all_nodes, all_edges, all_hyperedges = [], [], [] +total_in, total_out = 0, 0 +for c in chunks: + d = json.loads(Path(c).read_text(encoding=\"utf-8\")) + all_nodes += d.get('nodes', []) + all_edges += d.get('edges', []) + all_hyperedges += d.get('hyperedges', []) + total_in += d.get('input_tokens', 0) + total_out += d.get('output_tokens', 0) +Path('graphify-out/.graphify_semantic_new.json').write_text(json.dumps({ + 'nodes': all_nodes, 'edges': all_edges, 'hyperedges': all_hyperedges, + 'input_tokens': total_in, 'output_tokens': total_out, +}, indent=2, ensure_ascii=False), encoding=\"utf-8\") +print(f'Merged {len(chunks)} chunks: {total_in:,} in / {total_out:,} out tokens') +" +``` + +Save new results to cache. Pass the same SPEC_PATH as Step B0 — it stamps each entry with the prompt that produced it, and a write under a different prompt than the read lands where the next run won't look (#1939): +```bash +$(cat graphify-out/.graphify_python) -c " +import json +from graphify.cache import save_semantic_cache +from pathlib import Path + +new = json.loads(Path('graphify-out/.graphify_semantic_new.json').read_text(encoding=\"utf-8\")) if Path('graphify-out/.graphify_semantic_new.json').exists() else {'nodes':[],'edges':[],'hyperedges':[]} +uncached = [line for line in Path('graphify-out/.graphify_uncached.txt').read_text(encoding=\"utf-8\").splitlines() if line] +saved = save_semantic_cache(new.get('nodes', []), new.get('edges', []), new.get('hyperedges', []), root='INPUT_PATH', allowed_source_files=uncached, prompt_file='SPEC_PATH') +print(f'Cached {saved} files') +" +``` + +Merge cached + new results into `graphify-out/.graphify_semantic.json`: +```bash +$(cat graphify-out/.graphify_python) -c " +import json +from pathlib import Path + +cached = json.loads(Path('graphify-out/.graphify_cached.json').read_text(encoding=\"utf-8\")) if Path('graphify-out/.graphify_cached.json').exists() else {'nodes':[],'edges':[],'hyperedges':[]} +new = json.loads(Path('graphify-out/.graphify_semantic_new.json').read_text(encoding=\"utf-8\")) if Path('graphify-out/.graphify_semantic_new.json').exists() else {'nodes':[],'edges':[],'hyperedges':[]} + +all_nodes = cached['nodes'] + new.get('nodes', []) +all_edges = cached['edges'] + new.get('edges', []) +all_hyperedges = cached.get('hyperedges', []) + new.get('hyperedges', []) +seen = set() +deduped = [] +for n in all_nodes: + if n['id'] not in seen: + seen.add(n['id']) + deduped.append(n) + +merged = { + 'nodes': deduped, + 'edges': all_edges, + 'hyperedges': all_hyperedges, + 'input_tokens': new.get('input_tokens', 0), + 'output_tokens': new.get('output_tokens', 0), +} +Path('graphify-out/.graphify_semantic.json').write_text(json.dumps(merged, indent=2, ensure_ascii=False), encoding=\"utf-8\") +print(f'Extraction complete - {len(deduped)} nodes, {len(all_edges)} edges ({len(cached[\"nodes\"])} from cache, {len(new.get(\"nodes\",[]))} new)') +" +``` +Clean up temp files: `rm -f graphify-out/.graphify_cached.json graphify-out/.graphify_uncached.txt graphify-out/.graphify_semantic_new.json` + +#### Part C - Merge AST + semantic into final extraction + +```bash +$(cat graphify-out/.graphify_python) -c " +import sys, json +from pathlib import Path + +ast = json.loads(Path('graphify-out/.graphify_ast.json').read_text(encoding=\"utf-8\")) +sem = json.loads(Path('graphify-out/.graphify_semantic.json').read_text(encoding=\"utf-8\")) + +# Merge: AST nodes first, semantic nodes deduplicated by id +seen = {n['id'] for n in ast['nodes']} +merged_nodes = list(ast['nodes']) +for n in sem['nodes']: + if n['id'] not in seen: + merged_nodes.append(n) + seen.add(n['id']) + +merged_edges = ast['edges'] + sem['edges'] +merged_hyperedges = sem.get('hyperedges', []) +merged = { + 'nodes': merged_nodes, + 'edges': merged_edges, + 'hyperedges': merged_hyperedges, + 'input_tokens': sem.get('input_tokens', 0), + 'output_tokens': sem.get('output_tokens', 0), +} +Path('graphify-out/.graphify_extract.json').write_text(json.dumps(merged, indent=2, ensure_ascii=False), encoding=\"utf-8\") +total = len(merged_nodes) +edges = len(merged_edges) +print(f'Merged: {total} nodes, {edges} edges ({len(ast[\"nodes\"])} AST + {len(sem[\"nodes\"])} semantic)') +" +``` + +### Step 4 - Build graph, cluster, analyze, generate outputs + +**Before starting:** the code blocks below pass `directed=IS_DIRECTED` to `build_from_json()`. Replace `IS_DIRECTED` with `True` if `--directed` was given (builds a `DiGraph` preserving edge direction source→target), otherwise `False` (the default undirected `Graph`). Substitute it the same way you substitute `INPUT_PATH` — do not leave the literal `IS_DIRECTED` in the code. + +```bash +mkdir -p graphify-out +$(cat graphify-out/.graphify_python) -c " +import sys, json +from graphify.build import build_from_json +from graphify.cluster import cluster, score_all +from graphify.analyze import god_nodes, surprising_connections, suggest_questions +from graphify.report import generate +from graphify.export import to_json +from pathlib import Path + +extraction = json.loads(Path('graphify-out/.graphify_extract.json').read_text(encoding=\"utf-8\")) +detection = json.loads(Path('graphify-out/.graphify_detect.json').read_text(encoding=\"utf-8\")) + +# root= mirrors the --update runbook (#1361): relativize source_file to the same +# base so the full build and incremental --update never drift apart on re-extract. +G = build_from_json(extraction, root='INPUT_PATH', directed=IS_DIRECTED) +# Guard BEFORE any write: an empty extraction must not clobber a good graph.json / +# GRAPH_REPORT.md / analysis sidecar. Check immediately after build (#1392). +if G.number_of_nodes() == 0: + print('ERROR: Graph is empty - extraction produced no nodes.') + print('Possible causes: all files were skipped, binary-only corpus, or extraction failed.') + raise SystemExit(1) +communities = cluster(G) +cohesion = score_all(G, communities) +tokens = {'input': extraction.get('input_tokens', 0), 'output': extraction.get('output_tokens', 0)} +gods = god_nodes(G) +surprises = surprising_connections(G, communities) +labels = {cid: 'Community ' + str(cid) for cid in communities} +# Placeholder questions - regenerated with real labels in Step 5 +questions = suggest_questions(G, communities, labels) + +# Export FIRST and honor the #479 shrink-guard: to_json returns False (writing +# nothing) when the new graph is smaller than the existing graph.json. Only write +# GRAPH_REPORT.md + the analysis sidecar when the graph was actually written, so +# they never describe a graph that graph.json doesn't contain (#1392). +wrote = to_json(G, communities, 'graphify-out/graph.json') +if not wrote: + print('ERROR: refused to shrink graphify-out/graph.json (existing graph has more nodes; #479).') + print('If this shrink is intentional (you deleted files), re-run a full build with --force.') + raise SystemExit(1) +report = generate(G, communities, cohesion, labels, gods, surprises, detection, tokens, 'INPUT_PATH', suggested_questions=questions) +Path('graphify-out/GRAPH_REPORT.md').write_text(report, encoding=\"utf-8\") +analysis = { + 'communities': {str(k): v for k, v in communities.items()}, + 'cohesion': {str(k): v for k, v in cohesion.items()}, + 'gods': gods, + 'surprises': surprises, + 'questions': questions, +} +Path('graphify-out/.graphify_analysis.json').write_text(json.dumps(analysis, indent=2, ensure_ascii=False), encoding=\"utf-8\") +print(f'Graph: {G.number_of_nodes()} nodes, {G.number_of_edges()} edges, {len(communities)} communities') +" +``` + +If this step prints `ERROR: Graph is empty`, stop and tell the user what happened - do not proceed to labeling or visualization. + +Replace INPUT_PATH with the actual path. + +### Step 4.5 - Graph health check (read-only integrity gate) + +A non-destructive diagnostic on the extraction, before labeling. It surfaces edge collapse, dangling/missing endpoints, and self-loops — the silent-corruption modes of incremental updates and AST/LLM id mismatches. Read-only; never aborts. + +```bash +$(cat graphify-out/.graphify_python) -c " +import json +from pathlib import Path +from graphify.diagnostics import diagnose_extraction, format_diagnostic_report + +extraction = json.loads(Path('graphify-out/.graphify_extract.json').read_text(encoding=\"utf-8\")) +summary = diagnose_extraction(extraction, directed=IS_DIRECTED, root='INPUT_PATH') +print(format_diagnostic_report(summary)) +flags = [f'{summary[k]} {label}' for k, label in ( + ('dangling_endpoint_edges', 'dangling-endpoint edges'), + ('missing_endpoint_edges', 'missing-endpoint edges'), + ('self_loop_edges', 'self-loop edges'), + ('directed_same_endpoint_collapsed_edges', 'collapsed (directed) edges'), + ('undirected_same_endpoint_collapsed_edges', 'collapsed (undirected) edges'), +) if summary.get(k, 0)] +print('GRAPH HEALTH WARNING: ' + '; '.join(flags) + ' - graph may be incomplete/corrupt.' if flags else 'Graph health: OK (no dangling/missing/collapsed edges).') +" +``` + +Substitute `IS_DIRECTED` and `INPUT_PATH` as in Step 4. If a `GRAPH HEALTH WARNING` prints, surface it in the final summary (do not abort — the graph is still usable, but the integrity issue must be visible, per the Honesty Rules). + +### Step 5 - Label communities + +Read `graphify-out/.graphify_analysis.json`. For each community key, look at its node labels and write a 2-5 word plain-language name (e.g. "Attention Mechanism", "Training Pipeline", "Data Loading"). + +Then regenerate the report and save the labels for the visualizer: + +```bash +$(cat graphify-out/.graphify_python) -c " +import sys, json +from graphify.build import build_from_json +from graphify.cluster import score_all +from graphify.analyze import god_nodes, surprising_connections, suggest_questions +from graphify.report import generate +from graphify.export import to_json +from pathlib import Path + +extraction = json.loads(Path('graphify-out/.graphify_extract.json').read_text(encoding=\"utf-8\")) +detection = json.loads(Path('graphify-out/.graphify_detect.json').read_text(encoding=\"utf-8\")) +analysis = json.loads(Path('graphify-out/.graphify_analysis.json').read_text(encoding=\"utf-8\")) + +# root= as in Step 4 / the --update runbook (#1361) — same base for node-key parity. +G = build_from_json(extraction, root='INPUT_PATH', directed=IS_DIRECTED) +communities = {int(k): v for k, v in analysis['communities'].items()} +cohesion = {int(k): v for k, v in analysis['cohesion'].items()} +tokens = {'input': extraction.get('input_tokens', 0), 'output': extraction.get('output_tokens', 0)} + +# LABELS - replace these with the names you chose above +labels = LABELS_DICT + +# Regenerate questions with real community labels (labels affect question phrasing) +questions = suggest_questions(G, communities, labels) + +report = generate(G, communities, cohesion, labels, analysis['gods'], analysis['surprises'], detection, tokens, 'INPUT_PATH', suggested_questions=questions) +Path('graphify-out/GRAPH_REPORT.md').write_text(report, encoding=\"utf-8\") +Path('graphify-out/.graphify_labels.json').write_text(json.dumps({str(k): v for k, v in labels.items()}, ensure_ascii=False), encoding=\"utf-8\") +# Re-export so graph.json nodes carry the curated community_name (#2490). +# Same extraction as Step 4, so the #479 shrink-guard passes on node count; +# if it still refuses, surface the guard message - do not force past it. +wrote = to_json(G, communities, 'graphify-out/graph.json', community_labels=labels) +if not wrote: + print('ERROR: refused to shrink graphify-out/graph.json (existing graph has more nodes; #479).') + print('If this shrink is intentional (you deleted files), re-run a full build with --force.') +print('Report updated with community labels') +" +``` + +Replace `LABELS_DICT` with the actual dict you constructed (e.g. `{0: "Attention Mechanism", 1: "Training Pipeline"}`). +Replace INPUT_PATH with the actual path. + +### Step 6 - Generate Obsidian vault (opt-in) + HTML + +**Generate HTML always** (unless `--no-viz`). **Obsidian vault only if `--obsidian` was explicitly given** — skip it otherwise, it generates one file per node. + +If `--obsidian` was given: + +- If `--obsidian-dir ` was also given, pass it via `--dir`. Otherwise defaults to `graphify-out/obsidian`. + +```bash +graphify export obsidian +# or with custom dir: graphify export obsidian --dir ~/vaults/my-project +``` + +Generate the HTML graph (always, unless `--no-viz`): + +```bash +graphify export html # auto-aggregates to community view if graph > 5000 nodes +# or: graphify export html --no-viz +``` + +### Steps 6b-8 - Wiki, Neo4j, FalkorDB, SVG, GraphML, MCP, benchmark (only on their flags) + +These run only when their flag is present (`--wiki`, `--neo4j`/`--neo4j-push`, `--falkordb`/`--falkordb-push`, `--svg`, `--graphml`, `--mcp`) or, for the token-reduction benchmark, when `total_words` exceeds 5,000. A default run with no export flags skips all of them. See `references/exports.md` for each one. Run any `--wiki` export before Step 9 cleanup so `.graphify_labels.json` is still available. + +--- + +### Step 9 - Save manifest, update cost tracker, clean up, and report + +```bash +$(cat graphify-out/.graphify_python) -c " +import json +from pathlib import Path +from datetime import datetime, timezone +from graphify.detect import save_manifest + +# Save manifest for --update +detect = json.loads(Path('graphify-out/.graphify_detect.json').read_text(encoding=\"utf-8\")) +extract = json.loads(Path('graphify-out/.graphify_extract.json').read_text(encoding=\"utf-8\")) +# In --update mode, 'all_files' carries the full corpus; 'files' is the changed +# subset. Full-rebuild mode populates only 'files', so the fallback handles that. +# root= relativizes the manifest keys to the scan root (same base as the build), +# so the on-disk manifest is portable across clones/machines and a later --update +# matches cached files instead of missing every one (#1417). +# +# Only stamp semantic files (docs/papers/images) that ACTUALLY produced output: +# a detected file whose chunk failed or was omitted must stay unstamped so the +# next --update re-queues it, otherwise it is marked done and its content is lost +# forever (#2015). This mirrors the library extract path exactly +# (cli._stamped_manifest_files + clear_semantic + scan_corpus); do not stamp the +# raw corpus. Code files are always stamped (AST is deterministic); only semantic +# types are gated on output. +from graphify.cli import _stamped_manifest_files +_corpus = detect.get('all_files') or detect['files'] +_manifest_files = _stamped_manifest_files(_corpus, extract, Path('INPUT_PATH')) +# Files dispatched this run (the changed subset) but NOT stamped above still carry +# a stale semantic_hash from a prior run; clear it so detect_incremental re-queues +# them instead of reading them as unchanged (#1948). +_sem_types = ('document', 'paper', 'image') +_dispatched = {f for t, fl in detect['files'].items() if t in _sem_types for f in fl} +_stamped = {f for fl in _manifest_files.values() for f in fl} +_cleared = _dispatched - _stamped +# scan_corpus = the RAW full corpus (not the stamp-filtered subset) so in-root +# files newly excluded since last run are dropped rather than masquerading as +# deletions; untouched files' prior rows are still preserved (#1908). +_scan = {f for fl in _corpus.values() for f in fl} +save_manifest(_manifest_files, root='INPUT_PATH', scan_corpus=_scan, clear_semantic=_cleared or None) + +# Update cumulative cost tracker +input_tok = extract.get('input_tokens', 0) +output_tok = extract.get('output_tokens', 0) + +cost_path = Path('graphify-out/cost.json') +if cost_path.exists(): + cost = json.loads(cost_path.read_text(encoding=\"utf-8\")) +else: + cost = {'runs': [], 'total_input_tokens': 0, 'total_output_tokens': 0} + +cost['runs'].append({ + 'date': datetime.now(timezone.utc).isoformat(), + 'input_tokens': input_tok, + 'output_tokens': output_tok, + 'files': detect.get('total_files', 0), +}) +cost['total_input_tokens'] += input_tok +cost['total_output_tokens'] += output_tok +cost_path.write_text(json.dumps(cost, indent=2, ensure_ascii=False), encoding=\"utf-8\") + +print(f'This run: {input_tok:,} input tokens, {output_tok:,} output tokens') +print(f'All time: {cost[\"total_input_tokens\"]:,} input, {cost[\"total_output_tokens\"]:,} output ({len(cost[\"runs\"])} runs)') +" +rm -f graphify-out/.graphify_detect.json graphify-out/.graphify_extract.json graphify-out/.graphify_ast.json graphify-out/.graphify_semantic.json graphify-out/.graphify_analysis.json +find graphify-out -maxdepth 1 -name '.graphify_chunk_*.json' -delete 2>/dev/null +rm -f graphify-out/.needs_update 2>/dev/null || true +``` + +Replace INPUT_PATH with the actual path (same value used in Steps 4-5) so the manifest is relativized to the scan root. + +Tell the user (omit the obsidian line unless --obsidian was given): +``` +Graph complete. Outputs in PATH_TO_DIR/graphify-out/ + + graph.html - interactive graph, open in browser + GRAPH_REPORT.md - audit report + graph.json - raw graph data + obsidian/ - Obsidian vault (only if --obsidian was given) +``` + +If graphify saved you time, consider supporting it: https://github.com/sponsors/safishamsi + +Replace PATH_TO_DIR with the actual absolute path of the directory that was processed. + +Then paste these sections from GRAPH_REPORT.md directly into the chat: +- God Nodes +- Surprising Connections +- Suggested Questions + +Do NOT paste the full report - just those three sections. Keep it concise. + +Then immediately offer to explore. Pick the single most interesting suggested question from the report - the one that crosses the most community boundaries or has the most surprising bridge node - and ask: + +> "The most interesting question this graph can answer: **[question]**. Want me to trace it?" + +If the user says yes, run `/graphify query "[question]"` on the graph and walk them through the answer using the graph structure - which nodes connect, which community boundaries get crossed, what the path reveals. Keep going as long as they want to explore. Each answer should end with a natural follow-up ("this connects to X - want to go deeper?") so the session feels like navigation, not a one-shot report. + +The graph is the map. Your job after the pipeline is to be the guide. + +--- + +## Interpreter guard for subcommands + +Before running any subcommand below (`--update`, `--cluster-only`, `query`, `path`, `explain`, `add`), check that `.graphify_python` exists. If it's missing (e.g. user deleted `graphify-out/`), re-resolve the interpreter first: + +```bash +if [ ! -f graphify-out/.graphify_python ]; then + GRAPHIFY_BIN=$(which graphify 2>/dev/null) + if [ -n "$GRAPHIFY_BIN" ]; then + PYTHON=$(head -1 "$GRAPHIFY_BIN" | tr -d '#!') + case "$PYTHON" in *[!a-zA-Z0-9/_.@-]*) PYTHON="python3" ;; esac + else + PYTHON="python3" + fi + mkdir -p graphify-out + "$PYTHON" -c "import sys; open('graphify-out/.graphify_python', 'w', encoding='utf-8').write(sys.executable)" +fi +``` + +## For --update and --cluster-only + +Both are non-default subcommands. `--update` re-extracts only new or changed files; `--cluster-only` reruns clustering on the existing graph. See `references/update.md` for both flows. + +--- + +## For /graphify query + +When `graphify-out/graph.json` already exists and the user asks a question about the corpus, answer from the graph rather than rebuilding it: + +```bash +graphify query "" +``` + +Before traversal, expand the question against the graph's own vocabulary so a wording mismatch does not collapse the answer to noise. If the `graphify query` CLI is unavailable, fall back to an inline NetworkX traversal of `graphify-out/graph.json`. Answer using only what the graph output contains, and quote `source_location` when citing a specific fact. For that vocab-expansion step, the BFS/DFS traversal modes, the `--budget` cap, the NetworkX fallback, `save-result` feedback, and the `/graphify path` and `/graphify explain` flows, see `references/query.md`. + +--- + +## For /graphify add and --watch + +Neither is part of the default build. When the user runs `/graphify add ` to fetch a URL into the corpus, or passes `--watch` to auto-rebuild on file changes, see `references/add-watch.md`. + +--- + +## For the commit hook and native CLAUDE.md integration + +When the user asks to install the post-commit auto-rebuild hook or wire graphify into a project's CLAUDE.md, see `references/hooks.md`. + +--- + +## Honesty Rules + +- Never invent an edge. If unsure, use AMBIGUOUS. +- Never skip the corpus check warning. +- Always show token cost in the report. +- Never hide cohesion scores behind symbols - show the raw number. +- Never run HTML viz on a graph with more than 5,000 nodes without warning the user. diff --git a/.codex/skills/graphify/references/add-watch.md b/.codex/skills/graphify/references/add-watch.md new file mode 100644 index 00000000..77844343 --- /dev/null +++ b/.codex/skills/graphify/references/add-watch.md @@ -0,0 +1,56 @@ +# graphify reference: add a URL and watch a folder + +Load this when the user ran `/graphify add ` or passed `--watch`. Neither is part of the default build. + +## For /graphify add + +Fetch a URL and add it to the corpus, then update the graph. + +```bash +$(cat graphify-out/.graphify_python) -c " +import sys +from graphify.ingest import ingest +from pathlib import Path + +try: + out = ingest('URL', Path('./raw'), author='AUTHOR', contributor='CONTRIBUTOR') + print(f'Saved to {out}') +except ValueError as e: + print(f'error: {e}', file=sys.stderr) + sys.exit(1) +except RuntimeError as e: + print(f'error: {e}', file=sys.stderr) + sys.exit(1) +" +``` + +Replace `URL` with the actual URL, `AUTHOR` with the user's name if provided, `CONTRIBUTOR` likewise. If the command exits with an error, tell the user what went wrong - do not silently continue. After a successful save, automatically run the `--update` pipeline on `./raw` to merge the new file into the existing graph. + +Supported URL types (auto-detected): +- YouTube / any video URL → audio downloaded via yt-dlp, transcribed to `.txt` on next run (requires `pip install 'graphifyy[video]'`) +- Twitter/X → fetched via oEmbed, saved as `.md` with tweet text and author +- arXiv → abstract + metadata saved as `.md` +- PDF → downloaded as `.pdf` +- Images (.png/.jpg/.webp) → downloaded, Claude vision extracts on next run +- Any webpage → converted to markdown via html2text + +--- + +## For --watch + +Start a background watcher that monitors a folder and auto-updates the graph when files change. + +```bash +$(cat graphify-out/.graphify_python) -m graphify.watch INPUT_PATH --debounce 3 +``` + +Replace INPUT_PATH with the folder to watch. Behavior depends on what changed: + +- **Code files only (.py, .ts, .go, etc.):** re-runs AST extraction + rebuild + cluster immediately, no LLM needed. `graph.json` and `GRAPH_REPORT.md` are updated automatically. +- **Docs, papers, or images:** writes a `graphify-out/needs_update` flag and prints a notification to run `/graphify --update` (LLM semantic re-extraction required). + +Debounce (default 3s): waits until file activity stops before triggering, so a wave of parallel agent writes doesn't trigger a rebuild per file. + +Press Ctrl+C to stop. + +For agentic workflows: run `--watch` in a background terminal. Code changes from agent waves are picked up automatically between waves. If agents are also writing docs or notes, you'll need a manual `/graphify --update` after those waves. diff --git a/.codex/skills/graphify/references/exports.md b/.codex/skills/graphify/references/exports.md new file mode 100644 index 00000000..242ff868 --- /dev/null +++ b/.codex/skills/graphify/references/exports.md @@ -0,0 +1,87 @@ +# graphify reference: extra exports and benchmark + +Load this when the user passed one of the export flags (`--wiki`, `--neo4j`, `--neo4j-push`, `--falkordb`, `--falkordb-push`, `--svg`, `--graphml`, `--mcp`), or when the corpus is large enough for the token-reduction benchmark. Each step runs only for its own flag. + +### Step 6b - Wiki (only if --wiki flag) + +**Only run this step if `--wiki` was explicitly given in the original command.** + +Run this before Step 9 (cleanup) so `.graphify_labels.json` is still available. + +```bash +graphify export wiki +``` + +### Step 7 - Neo4j export (only if --neo4j or --neo4j-push flag) + +**If `--neo4j`** - generate a Cypher file for manual import: + +```bash +graphify export neo4j +``` + +**If `--neo4j-push `** - push directly to a running Neo4j instance. Ask the user for credentials if not provided: + +```bash +graphify export neo4j --push bolt://localhost:7687 --user neo4j --password PASSWORD +``` + +Default URI is `bolt://localhost:7687`, default user is `neo4j`. Uses MERGE - safe to re-run without creating duplicates. + +### Step 7a - FalkorDB export (only if --falkordb or --falkordb-push flag) + +**If `--falkordb`** - generate a Cypher file. The statements are OpenCypher, but FalkorDB's `GRAPH.QUERY` runs one statement at a time (no bulk script import like Neo4j's `cypher-shell`), so prefer `--falkordb-push` to load a graph. Use this only when you want the portable `cypher.txt` artifact: + +```bash +graphify export falkordb +``` + +**If `--falkordb-push `** - push directly to a running FalkorDB instance. Credentials are optional; ask the user only if the instance requires auth: + +```bash +graphify export falkordb --push falkordb://localhost:6379 +``` + +Default URI is `falkordb://localhost:6379` (the scheme is informational - `redis://` or a bare `host:port` work too), auth is optional, and the target graph defaults to `graphify`. Uses MERGE - safe to re-run without creating duplicates. + +### Step 7b - SVG export (only if --svg flag) + +```bash +graphify export svg +``` + +### Step 7c - GraphML export (only if --graphml flag) + +```bash +graphify export graphml +``` + +### Step 7d - MCP server (only if --mcp flag) + +```bash +$(cat graphify-out/.graphify_python) -m graphify.serve graphify-out/graph.json +``` + +This starts a stdio MCP server that exposes tools: `query_graph`, `get_node`, `get_neighbors`, `get_community`, `god_nodes`, `graph_stats`, `shortest_path`. Add to Claude Desktop or any MCP-compatible agent orchestrator so other agents can query the graph live. + +To configure in Claude Desktop, add to `claude_desktop_config.json`. Claude Desktop can't run `$(...)`, and under `uv tool install` the system `python3` can't import graphify — so set `command` to the **absolute interpreter path** printed by `cat graphify-out/.graphify_python`: +```json +{ + "mcpServers": { + "graphify": { + "command": "", + "args": ["-m", "graphify.serve", "/absolute/path/to/graphify-out/graph.json"] + } + } +} +``` + +### Step 8 - Token reduction benchmark (only if total_words > 5000) + +If `total_words` from `graphify-out/.graphify_detect.json` is greater than 5,000, run: + +```bash +graphify benchmark +``` + +Print the output directly in chat. If `total_words <= 5000`, skip silently - the graph value is structural clarity, not token compression, for small corpora. diff --git a/.codex/skills/graphify/references/extraction-spec.md b/.codex/skills/graphify/references/extraction-spec.md new file mode 100644 index 00000000..4b278b28 --- /dev/null +++ b/.codex/skills/graphify/references/extraction-spec.md @@ -0,0 +1,31 @@ +# graphify reference: extraction subagent prompt (compact) + +Load this in Step 3 Part B when the corpus has at least one doc, paper, or image chunk. A pure-code corpus skips Part B and never reads this file. Each semantic subagent receives the prompt below verbatim (substitute FILE_LIST, CHUNK_NUM, TOTAL_CHUNKS, and DEEP_MODE). + +``` +You are a graphify extraction subagent. Read the files listed and extract a knowledge graph fragment. +Output ONLY valid JSON matching the schema below - no explanation, no markdown fences, no preamble. + +Files (chunk CHUNK_NUM of TOTAL_CHUNKS): +FILE_LIST + +Rules: +- EXTRACTED: relationship explicit in source (import, call, citation) +- INFERRED: reasonable inference (shared structure, implied dependency) +- AMBIGUOUS: uncertain — flag it, do not omit +- Code files: semantic edges AST cannot find. Do not re-extract imports. When adding `calls` edges: source is the caller, target is the callee, never reversed; keep `calls` within one language. +- Doc/paper files: named concepts, entities, citations. Store rationale (WHY decisions were made) as a `rationale` attribute on the relevant node, not as a separate node. Use `file_type:"rationale"` for concept-like nodes (ideas, principles, mechanisms) and `file_type:"concept"` for named concepts. `file_type` MUST be one of exactly these six values: `code`, `document`, `paper`, `image`, `rationale`, `concept`. Any other value is invalid and will be rejected. +- Image files: use vision — understand what the image IS, not just OCR +- DEEP_MODE (if --mode deep): be aggressive with INFERRED edges — indirect deps, shared assumptions, latent couplings. Mark uncertain ones AMBIGUOUS instead of omitting. +- Semantic similarity: if two concepts solve the same problem or represent the same idea without a structural link (no import, call, or citation), add a `semantically_similar_to` edge marked INFERRED with confidence_score 0.6-0.95. Non-obvious cross-file links only. +- Hyperedges: if 3+ nodes share a concept, flow, or pattern not captured by pairwise edges, add a hyperedge to a top-level `hyperedges` array. Use sparingly. Max 3 per chunk. +- If a file has YAML frontmatter (--- ... ---), copy source_url, captured_at, author, contributor onto every node from that file. +- confidence_score is REQUIRED on every edge — never omit it, never use 0.5 as a default. EXTRACTED = 1.0 always. INFERRED: pick exactly ONE of 0.95 (direct structural evidence), 0.85 (strong inference), 0.75 (reasonable inference), 0.65 (weak inference), 0.55 (speculative but plausible) — never 0.5; if none fit, mark the edge AMBIGUOUS. AMBIGUOUS = 0.1-0.3. + +Node ID format: lowercase, only `[a-z0-9_]`, no dots or slashes. Format `{stem}_{entity}` where stem is the full repo-relative path with the extension dropped, every segment joined with `_` (each lowercased with non-alphanumeric chars replaced by `_`) and entity is the symbol name similarly normalized. Use every directory level, not just the immediate parent. `src/auth/session.py` + `ValidateToken` → `src_auth_session_validatetoken`. Top-level files use just the filename stem. This must match the AST extractor's ID. Never append chunk or sequence suffixes — IDs must be deterministic from the label alone. + +Output exactly this JSON (no other text): +{"nodes":[{"id":"auth_session_validatetoken","label":"Human Readable Name","file_type":"code|document|paper|image|rationale|concept","source_file":"","source_location":null,"source_url":null,"captured_at":null,"author":null,"contributor":null}],"edges":[{"source":"node_id","target":"node_id","relation":"calls|implements|references|cites|conceptually_related_to|shares_data_with|semantically_similar_to|rationale_for","confidence":"EXTRACTED|INFERRED|AMBIGUOUS","confidence_score":1.0,"source_file":"","source_location":null,"weight":1.0}],"hyperedges":[{"id":"snake_case_id","label":"Human Readable Label","nodes":["node_id1","node_id2","node_id3"],"relation":"participate_in|implement|form","confidence":"EXTRACTED|INFERRED","confidence_score":0.75,"source_file":""}],"input_tokens":0,"output_tokens":0} + +source_file RULE: set source_file to the FILE_LIST path for that file VERBATIM (absolute, no shortening to basename, no re-relativizing, no separator change). Keeps full build and --update on one base so build_merge's replace matches instead of duplicating. +``` diff --git a/.codex/skills/graphify/references/github-and-merge.md b/.codex/skills/graphify/references/github-and-merge.md new file mode 100644 index 00000000..a41ea06e --- /dev/null +++ b/.codex/skills/graphify/references/github-and-merge.md @@ -0,0 +1,46 @@ +# graphify reference: GitHub clone and cross-repo merge + +Load this when the user passed one or more `https://github.com/...` URLs, or named several local subfolders to merge into one graph. + +### Step 0 - Clone GitHub repo(s) (only if a GitHub URL was given) + +**Single repo:** +```bash +LOCAL_PATH=$(graphify clone [--branch ]) +# Use LOCAL_PATH as the target for all subsequent steps +``` + +**Multiple repos (cross-repo graph):** +```bash +# Clone each repo, run the full pipeline on each, then merge +graphify clone # → ~/.graphify/repos// +graphify clone # → ~/.graphify/repos// +# Run /graphify on each local path to produce their graph.json files +# Then merge: +graphify merge-graphs \ + ~/.graphify/repos///graphify-out/graph.json \ + ~/.graphify/repos///graphify-out/graph.json \ + --out graphify-out/cross-repo-graph.json +``` + +Graphify clones into `~/.graphify/repos//` and reuses existing clones on repeat runs. Each node in the merged graph carries a `repo` attribute so you can filter by origin. + +**Multiple local subfolders (monorepo or multi-service layout):** + +The skill pipeline writes all intermediate and final outputs to `graphify-out/` in the current working directory. Running the skill on each subfolder separately will clobber the same output dir. Instead, use the CLI directly for each subfolder — it places `graphify-out/` *inside* the scanned path: + +```bash +graphify extract ./core/ # → ./core/graphify-out/graph.json +graphify extract ./service/ # → ./service/graphify-out/graph.json +graphify extract ./platform/ # → ./platform/graphify-out/graph.json +# Add --backend gemini|kimi|openai|deepseek|claude-cli depending on which API key you have set + +# Then merge at the project root: +graphify merge-graphs \ + ./core/graphify-out/graph.json \ + ./service/graphify-out/graph.json \ + ./platform/graphify-out/graph.json \ + --out graphify-out/graph.json +``` + +Once `graphify-out/graph.json` exists, the fast path above takes over: any codebase question runs `graphify query` directly on the merged graph — no re-extraction, no size gate. diff --git a/.codex/skills/graphify/references/hooks.md b/.codex/skills/graphify/references/hooks.md new file mode 100644 index 00000000..438b8b16 --- /dev/null +++ b/.codex/skills/graphify/references/hooks.md @@ -0,0 +1,33 @@ +# graphify reference: commit hook and native CLAUDE.md integration + +Load this when the user asked to install the post-commit hook or wire graphify into a project's CLAUDE.md. + +## For git commit hook + +Install a post-commit hook that auto-rebuilds the graph after every commit. No background process needed - triggers once per commit, works with any editor. + +```bash +graphify hook install # install +graphify hook uninstall # remove +graphify hook status # check +``` + +After every `git commit`, the hook detects which code files changed (via `git diff HEAD~1`), re-runs AST extraction on those files, and rebuilds `graph.json` and `GRAPH_REPORT.md`. Doc/image changes are ignored by the hook - run `/graphify --update` manually for those. + +If a post-commit hook already exists, graphify appends to it rather than replacing it. + +--- + +## For native CLAUDE.md integration + +Run once per project to make graphify always-on in Claude Code sessions: + +```bash +graphify claude install +``` + +This writes a `## graphify` section to the local `CLAUDE.md` that instructs Claude to check the graph before answering codebase questions and rebuild it after code changes. No manual `/graphify` needed in future sessions. + +```bash +graphify claude uninstall # remove the section +``` diff --git a/.codex/skills/graphify/references/query.md b/.codex/skills/graphify/references/query.md new file mode 100644 index 00000000..56565eb7 --- /dev/null +++ b/.codex/skills/graphify/references/query.md @@ -0,0 +1,311 @@ +# graphify reference: query, path, explain + +Load this when the user asks a question against an existing graph, or runs `/graphify path` or `/graphify explain`. The core's query stub points here for the full traversal flow. These flows use the `graphify query` CLI when it is available and fall back to an inline NetworkX traversal otherwise. + +Two traversal modes - choose based on the question: + +| Mode | Flag | Best for | +|------|------|----------| +| BFS (default) | _(none)_ | "What is X connected to?" - broad context, nearest neighbors first | +| DFS | `--dfs` | "How does X reach Y?" - trace a specific chain or dependency path | + +First check the graph exists: +```bash +$(cat graphify-out/.graphify_python) -c " +from pathlib import Path +if not Path('graphify-out/graph.json').exists(): + print('ERROR: No graph found. Run /graphify first to build the graph.') + raise SystemExit(1) +" +``` +If it fails, stop and tell the user to run `/graphify ` first. + +### Step 0 — Constrained query expansion (REQUIRED before traversal) + +graphify's `query` CLI matches nodes via case-folded substring + IDF — there is **no stemming, no synonyms, no cross-language match** inside the binary, and the inline fallback below matches the same way. If the user's question uses different language or different domain vocabulary than the graph's labels (user says "обработчик" / graph says "handler"; user says "authentication" / graph says "Guardian"), the literal matcher returns 0 hits and the answer collapses to noise. + +Fix this **without inventing tokens** by expanding the query against the actual graph vocabulary first: + +1. Extract the token vocabulary from node labels: +```bash +$(cat graphify-out/.graphify_python) -c " +import json, re +from pathlib import Path +data = json.loads(Path('graphify-out/graph.json').read_text(encoding='utf-8')) +vocab = set() +for n in data['nodes']: + for c in re.findall(r'[^\W\d_]+', n.get('label','') or '', re.UNICODE): + parts = re.findall(r'[A-Z]+(?=[A-Z][a-z])|[A-Z]?[a-z]+|[A-Z]+', c) or [c] + for p in parts: + t = p.lower() + if 3 <= len(t) <= 30: + vocab.add(t) +Path('graphify-out/.vocab.txt').write_text('\n'.join(sorted(vocab)), encoding='utf-8') +print(f'vocab: {len(vocab)} tokens') +" +``` + +2. Read `graphify-out/.vocab.txt`. Then for the user's question, select **up to 12 tokens from this exact list** that semantically match the query intent. Hard constraints: + - You MUST pick only tokens present in the vocabulary file. Do NOT invent tokens. + - If a query concept has no plausible token in the vocab, skip it — do not substitute a near-synonym from training memory. + - If **no** vocab tokens match the query at all, output an empty list and tell the user the corpus has no relevant vocabulary for this question. Do not fabricate a search. + - Translate cross-language: Russian "аутентификация" → look for `auth`, `credential`, `token`, `security` IFF present in vocab. + - Morphology: "handlers" maps to `handler` IFF present; "todos" maps to `todo` IFF present. + +3. Print the selection explicitly to the user before running the query, so the expansion is auditable: +``` +Query expanded to (from graph vocab, N tokens): [token1, token2, ...] +``` +If the list is empty, say so plainly and stop — do not proceed to traversal. + +### Step 1 — Traversal + +Build the **expanded query string** by joining the selected tokens with spaces. Use this string as `QUESTION` below — NOT the original user question. (The original question is preserved only for `save-result` at the end.) + +Prefer the CLI when it is installed: +```bash +graphify query "QUESTION" +# or: graphify query "QUESTION" --dfs --budget 3000 +``` + +If the CLI is unavailable, load `graphify-out/graph.json` and run the traversal inline: + +1. Find the 1-3 nodes whose label best matches the expanded tokens. +2. Run the appropriate traversal from each starting node. +3. Read the subgraph - node labels, edge relations, confidence tags, source locations. +4. Answer using **only** what the graph contains. Quote `source_location` when citing a specific fact. +5. If the graph lacks enough information, say so - do not hallucinate edges. + +```bash +$(cat graphify-out/.graphify_python) -c " +import sys, json +from networkx.readwrite import json_graph +import networkx as nx +from pathlib import Path + +data = json.loads(Path('graphify-out/graph.json').read_text(encoding='utf-8')) +G = json_graph.node_link_graph(data, edges='links') + +question = 'QUESTION' +mode = 'MODE' # 'bfs' or 'dfs' +terms = [t.lower() for t in question.split() if len(t) >= 3] # match the vocab threshold; keeps api/jwt/ios (#1392) + +# Find best-matching start nodes +scored = [] +for nid, ndata in G.nodes(data=True): + label = ndata.get('label', '').lower() + score = sum(1 for t in terms if t in label) + if score > 0: + scored.append((score, nid)) +scored.sort(reverse=True) +start_nodes = [nid for _, nid in scored[:3]] + +if not start_nodes: + print('No matching nodes found for query terms:', terms) + sys.exit(0) + +subgraph_nodes = set() +subgraph_edges = [] + +if mode == 'dfs': + # DFS: follow one path as deep as possible before backtracking. + # Depth-limited to 6 to avoid traversing the whole graph. + visited = set() + stack = [(n, 0) for n in reversed(start_nodes)] + while stack: + node, depth = stack.pop() + if node in visited or depth > 6: + continue + visited.add(node) + subgraph_nodes.add(node) + for neighbor in G.neighbors(node): + if neighbor not in visited: + stack.append((neighbor, depth + 1)) + subgraph_edges.append((node, neighbor)) +else: + # BFS: explore all neighbors layer by layer up to depth 3. + frontier = set(start_nodes) + subgraph_nodes = set(start_nodes) + for _ in range(3): + next_frontier = set() + for n in frontier: + for neighbor in G.neighbors(n): + if neighbor not in subgraph_nodes: + next_frontier.add(neighbor) + subgraph_edges.append((n, neighbor)) + subgraph_nodes.update(next_frontier) + frontier = next_frontier + +# Token-budget aware output: rank by relevance, cut at budget (~4 chars/token) +token_budget = BUDGET # default 2000 +char_budget = token_budget * 4 + +# Score each node by term overlap for ranked output +def relevance(nid): + label = G.nodes[nid].get('label', '').lower() + return sum(1 for t in terms if t in label) + +ranked_nodes = sorted(subgraph_nodes, key=relevance, reverse=True) + +lines = [f'Traversal: {mode.upper()} | Start: {[G.nodes[n].get(\"label\",n) for n in start_nodes]} | {len(subgraph_nodes)} nodes'] +for nid in ranked_nodes: + d = G.nodes[nid] + lines.append(f' NODE {d.get(\"label\", nid)} [src={d.get(\"source_file\",\"\")} loc={d.get(\"source_location\",\"\")}]') +for u, v in subgraph_edges: + if u in subgraph_nodes and v in subgraph_nodes: + _raw = G[u][v]; d = next(iter(_raw.values()), {}) if isinstance(G, nx.MultiGraph) else _raw + lines.append(f' EDGE {G.nodes[u].get(\"label\",u)} --{d.get(\"relation\",\"\")} [{d.get(\"confidence\",\"\")}]--> {G.nodes[v].get(\"label\",v)}') + +output = '\n'.join(lines) +if len(output) > char_budget: + output = output[:char_budget] + f'\n... (truncated at ~{token_budget} token budget - use --budget N for more)' +print(output) +" +``` + +Replace `QUESTION` with the **expanded** query string, `MODE` with `bfs` or `dfs`, and `BUDGET` with the token budget (default `2000`, or whatever `--budget N` specifies). Then answer based on the subgraph output above, using only what the graph contains. + +After writing the answer, save it back into the graph so it improves future queries. Include the expanded tokens inside the `--answer` text (e.g. `"Expanded from original query via vocab: [tokens]. Then traversed..."`) so the next `--update` extracts the expansion history as a graph node: + +```bash +$(cat graphify-out/.graphify_python) -m graphify save-result --question "ORIGINAL_QUESTION" --answer "ANSWER" --type query --nodes NODE1 NODE2 +``` + +Replace `ORIGINAL_QUESTION` with the user's verbatim question, `ANSWER` with your full answer text (containing the expanded-token trace), `NODE1 NODE2` with the list of node labels you cited. This closes the feedback loop: the next `--update` will extract this Q&A as a node in the graph. + +**Work memory (self-improving loop).** Add an `--outcome` so future sessions learn from this one — append `--outcome useful|dead_end|corrected` to the `save-result` command (and `--correction "the right answer"` when correcting): + +- `useful` — the cited nodes answered the question well (they become *preferred sources*). +- `dead_end` — the question/path led nowhere; don't re-derive it next time. +- `corrected` — the saved answer was wrong; `--correction` records what was right. + +At the **start** of graph work, refresh and read the lessons: run `graphify reflect --if-stale` (cheap, deterministic, no LLM; `--if-stale` makes it a no-op when `LESSONS.md` is already newer than every input, e.g. when the git hook just refreshed it), then read `graphify-out/reflections/LESSONS.md`. It lists **preferred sources** (start there), **known dead ends** (skip them), and prior **corrections**. Running `reflect` yourself keeps the lessons current even without the git hook installed; if the post-commit hook *is* installed, `--if-stale` means your session-start run costs almost nothing. + +--- + +## For /graphify path + +Find the shortest path between two named concepts in the graph. Prefer the CLI when installed: + +```bash +graphify path "NODE_A" "NODE_B" +``` + +If the CLI is unavailable, run it inline: + +```bash +$(cat graphify-out/.graphify_python) -c " +import json, sys +import networkx as nx +from networkx.readwrite import json_graph +from pathlib import Path + +data = json.loads(Path('graphify-out/graph.json').read_text(encoding='utf-8')) +G = json_graph.node_link_graph(data, edges='links') + +a_term = 'NODE_A' +b_term = 'NODE_B' + +def find_node(term): + term = term.lower() + scored = sorted( + [(sum(1 for w in term.split() if w in G.nodes[n].get('label','').lower()), n) + for n in G.nodes()], + reverse=True + ) + return scored[0][1] if scored and scored[0][0] > 0 else None + +src = find_node(a_term) +tgt = find_node(b_term) + +if not src or not tgt: + print(f'Could not find nodes matching: {a_term!r} or {b_term!r}') + sys.exit(0) + +try: + path = nx.shortest_path(G, src, tgt) + print(f'Shortest path ({len(path)-1} hops):') + for i, nid in enumerate(path): + label = G.nodes[nid].get('label', nid) + if i < len(path) - 1: + _raw = G[nid][path[i+1]]; edge = next(iter(_raw.values()), {}) if isinstance(G, nx.MultiGraph) else _raw + rel = edge.get('relation', '') + conf = edge.get('confidence', '') + print(f' {label} --{rel}--> [{conf}]') + else: + print(f' {label}') +except nx.NetworkXNoPath: + print(f'No path found between {a_term!r} and {b_term!r}') +except nx.NodeNotFound as e: + print(f'Node not found: {e}') +" +``` + +Replace `NODE_A` and `NODE_B` with the actual concept names from the user. Then explain the path in plain language - what each hop means, why it's significant. + +After writing the explanation, save it back: + +```bash +$(cat graphify-out/.graphify_python) -m graphify save-result --question "Path from NODE_A to NODE_B" --answer "ANSWER" --type path_query --nodes NODE_A NODE_B +``` + +--- + +## For /graphify explain + +Give a plain-language explanation of a single node - everything connected to it. Prefer the CLI when installed: + +```bash +graphify explain "NODE_NAME" +``` + +If the CLI is unavailable, run it inline: + +```bash +$(cat graphify-out/.graphify_python) -c " +import json, sys +import networkx as nx +from networkx.readwrite import json_graph +from pathlib import Path + +data = json.loads(Path('graphify-out/graph.json').read_text(encoding='utf-8')) +G = json_graph.node_link_graph(data, edges='links') + +term = 'NODE_NAME' +term_lower = term.lower() + +# Find best matching node +scored = sorted( + [(sum(1 for w in term_lower.split() if w in G.nodes[n].get('label','').lower()), n) + for n in G.nodes()], + reverse=True +) +if not scored or scored[0][0] == 0: + print(f'No node matching {term!r}') + sys.exit(0) + +nid = scored[0][1] +data_n = G.nodes[nid] +print(f'NODE: {data_n.get(\"label\", nid)}') +print(f' source: {data_n.get(\"source_file\",\"unknown\")}') +print(f' type: {data_n.get(\"file_type\",\"unknown\")}') +print(f' degree: {G.degree(nid)}') +print() +print('CONNECTIONS:') +for neighbor in G.neighbors(nid): + _raw = G[nid][neighbor]; edge = next(iter(_raw.values()), {}) if isinstance(G, nx.MultiGraph) else _raw + nlabel = G.nodes[neighbor].get('label', neighbor) + rel = edge.get('relation', '') + conf = edge.get('confidence', '') + src_file = G.nodes[neighbor].get('source_file', '') + print(f' --{rel}--> {nlabel} [{conf}] ({src_file})') +" +``` + +Replace `NODE_NAME` with the concept the user asked about. Then write a 3-5 sentence explanation of what this node is, what it connects to, and why those connections are significant. Use the source locations as citations. + +After writing the explanation, save it back: + +```bash +$(cat graphify-out/.graphify_python) -m graphify save-result --question "Explain NODE_NAME" --answer "ANSWER" --type explain --nodes NODE_NAME +``` diff --git a/.codex/skills/graphify/references/transcribe.md b/.codex/skills/graphify/references/transcribe.md new file mode 100644 index 00000000..b967f837 --- /dev/null +++ b/.codex/skills/graphify/references/transcribe.md @@ -0,0 +1,52 @@ +# graphify reference: transcribe video and audio + +Load this only when `detect` reported one or more `video` files. A corpus with no video never reads this. + +### Step 2.5 - Transcribe video / audio files (only if video files detected) + +Skip this step entirely if `detect` returned zero `video` files. + +Video and audio files cannot be read directly. Transcribe them to text first, then treat the transcripts as doc files in Step 3. + +**Strategy:** Read the god nodes from `graphify-out/.graphify_detect.json` (or the analysis file if it exists from a previous run). You are already a language model — write a one-sentence domain hint yourself from those labels. Then pass it to Whisper as the initial prompt. No separate API call needed. + +**However**, if the corpus has *only* video files and no other docs/code, use the generic fallback prompt: `"Use proper punctuation and paragraph breaks."` + +**Step 1 - Write the Whisper prompt yourself.** + +Read the top god node labels from detect output or analysis, then compose a short domain hint sentence, for example: + +- Labels: `transformer, attention, encoder, decoder` → `"Machine learning research on transformer architectures and attention mechanisms. Use proper punctuation and paragraph breaks."` +- Labels: `kubernetes, deployment, pod, helm` → `"DevOps discussion about Kubernetes deployments and Helm charts. Use proper punctuation and paragraph breaks."` + +**Export** it as `GRAPHIFY_WHISPER_PROMPT` (the exact name the transcriber reads — and it must be `export`ed so the child Python process sees it) for the next command. + +**Step 2 - Transcribe:** + +```bash +export GRAPHIFY_WHISPER_MODEL=base # or whatever --whisper-model the user passed (must be exported) +export GRAPHIFY_WHISPER_PROMPT="" +$(cat graphify-out/.graphify_python) -c " +import json, os, sys +from pathlib import Path +from graphify.transcribe import transcribe_all + +detect = json.loads(Path('graphify-out/.graphify_detect.json').read_text(encoding=\"utf-8\")) +video_files = detect.get('files', {}).get('video', []) +prompt = os.environ.get('GRAPHIFY_WHISPER_PROMPT', 'Use proper punctuation and paragraph breaks.') + +transcript_paths = transcribe_all(video_files, initial_prompt=prompt) +# Write the JSON from Python (NOT a shell '>' redirect): transcribe_all/Whisper +# print progress to stdout, which would otherwise corrupt the JSON file (#1392). +Path('graphify-out/.graphify_transcripts.json').write_text(json.dumps(transcript_paths, ensure_ascii=False), encoding=\"utf-8\") +print(f'Transcribed {len(transcript_paths)} file(s)', file=sys.stderr) +" +``` + +After transcription: +- Read the transcript paths from `graphify-out/.graphify_transcripts.json` +- Add them to the docs list before dispatching semantic subagents in Step 3B +- Print how many transcripts were created: `Transcribed N video file(s) -> treating as docs` +- If transcription fails for a file, print a warning and continue with the rest + +**Whisper model:** Default is `base`. If the user passed `--whisper-model `, `export GRAPHIFY_WHISPER_MODEL=` (it must be exported, not just assigned) before running the command above. diff --git a/.codex/skills/graphify/references/update.md b/.codex/skills/graphify/references/update.md new file mode 100644 index 00000000..3632fd41 --- /dev/null +++ b/.codex/skills/graphify/references/update.md @@ -0,0 +1,210 @@ +# graphify reference: incremental update and cluster-only + +Load this only when the user passed `--update` or `--cluster-only`. A first-time full build never reads this file. + +## For --update (incremental re-extraction) + +Use when you've added or modified files since the last run. Only re-extracts changed files - saves tokens and time. + +```bash +$(cat graphify-out/.graphify_python) -c " +import sys, json +from graphify.detect import detect_incremental, save_manifest +from pathlib import Path + +result = detect_incremental(Path('INPUT_PATH')) +new_total = result.get('new_total', 0) +print(json.dumps(result, indent=2, ensure_ascii=False)) +Path('graphify-out/.graphify_incremental.json').write_text(json.dumps(result, ensure_ascii=False), encoding=\"utf-8\") +deleted = list(result.get('deleted_files', [])) +if new_total == 0 and not deleted: + print('No files changed since last run. Nothing to update.') + raise SystemExit(0) +if deleted: + print(f'{len(deleted)} deleted file(s) to prune.') +if new_total > 0: + print(f'{new_total} new/changed file(s) to re-extract.') +" +``` + +Then populate `.graphify_detect.json` so Steps 3A–6 (which read it unconditionally) see the right state for an incremental run. `files` carries the changed subset (drives Step 3A AST + Step 3B0 cache check on only what changed); `all_files` carries the full corpus for any step that needs corpus-wide context: + +```bash +$(cat graphify-out/.graphify_python) -c " +import json +from pathlib import Path +r = json.loads(Path('graphify-out/.graphify_incremental.json').read_text(encoding=\"utf-8\")) +Path('graphify-out/.graphify_detect.json').write_text(json.dumps({ + 'files': r.get('new_files', {}), + 'all_files': r.get('files', {}), + 'total_files': r.get('new_total', 0), + 'total_words': r.get('total_words', 0), + 'skipped_sensitive': r.get('skipped_sensitive', []), + 'needs_graph': True, +}, ensure_ascii=False), encoding=\"utf-8\") +" +``` + +If new files exist, first check whether all changed files are code files: + +```bash +$(cat graphify-out/.graphify_python) -c " +import json +from pathlib import Path + +result = json.loads(open('graphify-out/.graphify_incremental.json', encoding='utf-8').read()) if Path('graphify-out/.graphify_incremental.json').exists() else {} +code_exts = {'.py','.ts','.js','.go','.rs','.java','.cpp','.c','.rb','.swift','.kt','.cs','.scala','.php','.cc','.cxx','.hpp','.h','.kts','.lua','.toc','.f','.F','.f90','.F90','.f95','.F95','.f03','.F03','.f08','.F08'} +new_files = result.get('new_files', {}) +all_changed = [f for files in new_files.values() for f in files] +code_only = all(Path(f).suffix.lower() in code_exts for f in all_changed) +print('code_only:', code_only) +" +``` + +If `code_only` is True: print `[graphify update] Code-only changes detected - skipping semantic extraction (no LLM needed)`, run only Step 3A (AST) on the changed files, skip Step 3B entirely (no subagents), then go straight to merge and Steps 4–8. + +If `code_only` is False (any changed file is a doc/paper/image/video): **first, if any changed file is in `new_files['video']`, run `references/transcribe.md` (Step 2.5) on those files, then rewrite `.graphify_detect.json` to move the resulting transcript paths into `files['document']` and drop `files['video']`** — otherwise raw `.mp4/.mp3` paths are fed to semantic subagents as unreadable media (#1392). Then run the full Steps 3A–3C pipeline as normal. + + +If no new files exist (only deletions), create an empty extraction so the merge step can prune: + +```bash +if [ ! -f graphify-out/.graphify_extract.json ]; then + echo '[graphify update] Only deletions -- creating empty extraction for merge.' + $(cat graphify-out/.graphify_python) -c " +import json +from pathlib import Path +Path('graphify-out/.graphify_extract.json').write_text(json.dumps({'nodes':[],'edges':[],'hyperedges':[],'input_tokens':0,'output_tokens':0}), encoding='utf-8') +" +fi +``` + + +Then: + +```bash +$(cat graphify-out/.graphify_python) -c " +import json +from pathlib import Path +from graphify.build import build_merge +from graphify.detect import save_manifest + +# Load new extraction and incremental state +new_extraction = json.loads(Path('graphify-out/.graphify_extract.json').read_text(encoding=\"utf-8\")) +incremental = json.loads(Path('graphify-out/.graphify_incremental.json').read_text(encoding=\"utf-8\")) +deleted = list(incremental.get('deleted_files', [])) +# prune_sources is ONLY for genuinely DELETED files. Changed/re-extracted files are +# handled by build_merge's replace-on-re-extract (#1344): every source_file in +# new_chunks is dropped from the base before merge, so old/stale nodes don't survive. +# Do NOT add `changed` here: with root= passed, prune_set relativizes to the same base +# as the freshly merged nodes and would DELETE the re-extracted content (#1178 is moot +# now that replace — not the dedup pass — reconciles changed files). +prune = list(deleted) or None + +# Use build_merge() — reads graph.json directly without NetworkX round-trip +# so edge direction (calls, implements, imports) is always preserved (#801). +# Pass root= so prune_sources (absolute paths from detect_incremental) are +# relativized to match the graph's relative source_file values; without it +# nothing is pruned and stale nodes accumulate on every update (#1361). +# directed=IS_DIRECTED: replace IS_DIRECTED with True if --directed was given, else +# False. Without it a --directed --update silently rebuilds undirected and collapses +# reciprocal A<->B edges (#1392). +G = build_merge( + [new_extraction], + graph_path='graphify-out/graph.json', + prune_sources=prune, + root='INPUT_PATH', + directed=IS_DIRECTED, +) +print(f'[graphify update] Merged: {G.number_of_nodes()} nodes, {G.number_of_edges()} edges') + +# Write merged result back to .graphify_extract.json so Step 4 sees the full graph +merged_out = { + 'nodes': [{'id': n, **d} for n, d in G.nodes(data=True)], + 'edges': [ + # Explicit source/target last so they win over any stale attrs in d. + {**{k: val for k, val in d.items() if k not in ('_src', '_tgt', 'source', 'target')}, + 'source': d.get('_src', u), 'target': d.get('_tgt', v)} + for u, v, d in G.edges(data=True) + ], + # G.graph["hyperedges"] holds hyperedges from both existing graph.json + # and new_extraction (build_merge combines them). Falling back to + # new_extraction only would silently drop prior-run hyperedges (#801). + 'hyperedges': list(G.graph.get('hyperedges', [])), + 'input_tokens': new_extraction.get('input_tokens', 0), + 'output_tokens': new_extraction.get('output_tokens', 0), +} +Path('graphify-out/.graphify_extract.json').write_text(json.dumps(merged_out, ensure_ascii=False), encoding=\"utf-8\") +print(f'[graphify update] Merged extraction written ({len(merged_out[\"nodes\"])} nodes, {len(merged_out[\"edges\"])} edges)') + +# Save manifest so next --update diffs against today's state, not the +# prior run's baseline (prevents ghost-node reports on subsequent updates). +# root= matches the build_merge call above so the manifest keys stay relative to +# the scan root — portable across clones/machines, so --update keeps matching +# cached files instead of missing every one after a move (#1417). +# +# Only stamp semantic files (docs/papers/images) that ACTUALLY produced output +# THIS run (new_extraction is this run's fresh extraction, read above before the +# merge overwrote the file): a changed doc whose chunk failed must stay unstamped +# so the next --update re-queues it, otherwise it is marked done and its content +# is lost forever (#2015). Mirrors the library extract path +# (cli._stamped_manifest_files + clear_semantic + scan_corpus). +from graphify.cli import _stamped_manifest_files +_manifest_files = _stamped_manifest_files(incremental['files'], new_extraction, Path('INPUT_PATH')) +# Changed semantic files dispatched this run but NOT stamped had their chunk fail +# or be omitted; clear any stale semantic_hash so they are re-queued (#1948). +_sem_types = ('document', 'paper', 'image') +_dispatched = {f for t, fl in incremental.get('new_files', {}).items() if t in _sem_types for f in fl} +_stamped = {f for fl in _manifest_files.values() for f in fl} +_cleared = _dispatched - _stamped +# scan_corpus = the RAW full corpus so in-root files newly excluded since last run +# are dropped rather than masquerading as deletions; untouched rows preserved (#1908). +_scan = {f for fl in incremental['files'].values() for f in fl} +save_manifest(_manifest_files, root='INPUT_PATH', scan_corpus=_scan, clear_semantic=_cleared or None) +print('[graphify update] Manifest saved.') +" +``` + +Then run Steps 4–8 on the merged graph as normal. + +After Step 4, show the graph diff: + +```bash +$(cat graphify-out/.graphify_python) -c " +import json +from graphify.analyze import graph_diff +from graphify.build import build_from_json +from networkx.readwrite import json_graph +import networkx as nx +from pathlib import Path + +# Load old graph (before update) from backup written before merge +old_data = json.loads(Path('graphify-out/.graphify_old.json').read_text(encoding=\"utf-8\")) if Path('graphify-out/.graphify_old.json').exists() else None +new_extract = json.loads(Path('graphify-out/.graphify_extract.json').read_text(encoding=\"utf-8\")) +G_new = build_from_json(new_extract, directed=IS_DIRECTED) + +if old_data: + G_old = json_graph.node_link_graph(old_data, edges='links') + diff = graph_diff(G_old, G_new) + print(diff['summary']) + if diff['new_nodes']: + print('New nodes:', ', '.join(n['label'] for n in diff['new_nodes'][:5])) + if diff['new_edges']: + print('New edges:', len(diff['new_edges'])) +" +``` + +Before the merge step, save the old graph: `cp graphify-out/graph.json graphify-out/.graphify_old.json` +Clean up after: `rm -f graphify-out/.graphify_old.json` + +--- + +## For --cluster-only + +Skip Steps 1–3. Re-run clustering on the existing graph: + +```bash +graphify cluster-only . +``` + +`graphify cluster-only .` is **self-contained**: it re-clusters, names communities, and regenerates `GRAPH_REPORT.md`, `graph.json`, and `graph.html` from the existing graph. **Do not re-run Steps 5–9** — they read intermediate files (`.graphify_extract.json`, `.graphify_detect.json`, `.graphify_analysis.json`) that a prior build's cleanup (Step 9) already deleted, so they raise `FileNotFoundError` (#1392). When it finishes, present the refreshed `GRAPH_REPORT.md` summary as usual. diff --git a/.codex/skills/postify-ui-review/SKILL.md b/.codex/skills/postify-ui-review/SKILL.md new file mode 100644 index 00000000..c42b3284 --- /dev/null +++ b/.codex/skills/postify-ui-review/SKILL.md @@ -0,0 +1,61 @@ +--- +name: postify-ui-review +description: "Use for every Postify UI/UX change. Enforces an editorial + developer-tool visual system, real browser review, responsive quality, accessibility, and anti-template checks before considering UI work complete." +--- + +# Postify UI Review + +Use this skill for any task that changes Postify's visible interface, interaction model, information hierarchy, or responsive behavior. + +## Product direction + +Postify's identity is "show your work": a test-report / engineering-notebook language where evidence is the loudest thing on the page. Report paper, graphite ink, a single cobalt evidence colour, amber for recheck. The site should feel authored and memorable, not like a template, and every bold moment must be made of real product data. + +## Hard rules + +- Spend boldness in one place per page (hero proof receipt, Goal scroll scene); keep everything around it quiet. +- Decoration must encode information: graph-paper grid = notebook page, stamps = verification state, evidence rail = trust level, cover figure = content type. No unexplained gradients, glow, glass, marquees or ambient animation. +- No all-caps monospace micro-labels, no middle-dot meta strings, no fake ordinals, no single-word italic accents in headlines. +- Do not use fake social proof, fake activity, fake verification, invented counts, or unsupported trust labels. Stamps and receipts render published artifacts only. +- Motion explains state change, is interruptible, lazy-loaded per route, and fully disabled under `prefers-reduced-motion`. +- Mobile is designed, not scaled: check touch targets, sticky docks, overflow and 400% text separately. +- Accessibility is a release gate: keyboard navigation, visible focus, semantic headings, labels, contrast. +- A passing build is not proof of a good UI. + +## Required workflow + +1. Query Graphify first when `graphify-out/graph.json` exists. Identify the page, its shared components, and likely impact radius before editing. +2. Inspect the current page and relevant shared styles/components. Prefer deleting visual noise over layering more CSS on top. +3. State the user-facing problem being solved in one sentence before implementation. +4. Implement the smallest coherent redesign slice that creates a clearly visible improvement. +5. Run focused tests plus lint/build as appropriate. +6. Open the real page in a browser/Playwright and inspect it at minimum at 1440px and 390px widths. +7. Check these failure modes explicitly: + - generic template / portfolio aesthetic + - weak content hierarchy + - excessive empty space + - too many cards/borders + - inconsistent type scale or spacing + - decorative effects competing with content + - navigation clutter + - hidden or ambiguous primary action + - mobile overflow or cramped controls + - trust/evidence labels that overclaim +8. Capture/compare screenshots for major surfaces. For V3 baseline coverage prioritize Home, Article, Editor, and mobile Home/Article. +9. Re-query/update Graphify after code changes when useful: `graphify update src` or rebuild the focused graph. +10. Do not call the UI task complete until visual browser inspection is clean. + +## V3 priority order + +1. Global visual system and header/navigation +2. Home page hierarchy and content discovery +3. Post card system +4. Article reading/trust surface +5. Create/Edit editor and evidence inspector +6. Profile, bookmarks, knowledge dashboard +7. Empty/loading/error states +8. Motion/polish only after layout and hierarchy are stable + +## Acceptance bar + +A successful change should make an unprompted user notice that Postify looks more coherent and mature without needing an explanation of what changed. If the improvement is mainly visible in code, tests, or architecture rather than on the page, it is not sufficient for a UI V3 milestone. diff --git a/.env.example b/.env.example index 2b34634d..df7afe77 100644 --- a/.env.example +++ b/.env.example @@ -5,4 +5,4 @@ VITE_SUPABASE_ANON_KEY=your-anon-key # App Configuration VITE_APP_URL=http://localhost:5173 -VITE_APP_NAME=Postify Blog +VITE_APP_NAME=Postify diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS new file mode 100644 index 00000000..cd1b278a --- /dev/null +++ b/.github/CODEOWNERS @@ -0,0 +1,11 @@ +# Default repository ownership +* @zexy2 + +# Security- and release-sensitive surfaces +/.github/ @zexy2 +/supabase/ @zexy2 +/scripts/ @zexy2 +/package.json @zexy2 +/package-lock.json @zexy2 +/Dockerfile @zexy2 +/.env.example @zexy2 diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml new file mode 100644 index 00000000..1a4aa0c0 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.yml @@ -0,0 +1,76 @@ +name: Bug report +description: Report a reproducible problem in Postify +title: "[Bug]: " +body: + - type: markdown + attributes: + value: | + Thanks for reporting a bug. Please provide enough detail for someone else to reproduce it. + Do not include secrets, private user data, or security vulnerability details here; use the Security tab for those. + + - type: checkboxes + id: preflight + attributes: + label: Preflight + options: + - label: I searched existing issues and did not find a duplicate. + required: true + - label: This is not a security vulnerability or private-data disclosure. + required: true + + - type: textarea + id: summary + attributes: + label: What happened? + description: Describe the problem and what you expected instead. + placeholder: A clear, concise description of the bug. + validations: + required: true + + - type: textarea + id: reproduce + attributes: + label: Steps to reproduce + description: Give the smallest reliable sequence that reproduces the issue. + placeholder: | + 1. Go to ... + 2. Click ... + 3. Observe ... + validations: + required: true + + - type: input + id: url + attributes: + label: Affected URL or route + placeholder: https://postify.zekiakgul.dev/... + + - type: dropdown + id: environment + attributes: + label: Where did you see it? + options: + - Production + - Local development + - Pull request / preview environment + - Other + validations: + required: true + + - type: input + id: browser + attributes: + label: Browser / runtime + placeholder: Chrome 151, Safari 19, Node 24, etc. + + - type: textarea + id: evidence + attributes: + label: Screenshots, logs, or other evidence + description: Add useful evidence after removing secrets and private information. + + - type: textarea + id: notes + attributes: + label: Additional context + description: Include regressions, accessibility impact, frequency, or anything else that may help. diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml new file mode 100644 index 00000000..c930952f --- /dev/null +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -0,0 +1,11 @@ +blank_issues_enabled: false +contact_links: + - name: Security vulnerability + url: https://github.com/zexy2/postify/security/advisories/new + about: Report security vulnerabilities privately. Do not disclose exploit details in a public issue. + - name: Questions and open-ended ideas + url: https://github.com/zexy2/postify/discussions + about: Use Discussions for Q&A, early ideas, and community conversations that are not yet scoped work. + - name: Live Postify + url: https://postify.zekiakgul.dev/ + about: Open the current production application before reporting a production-specific issue. diff --git a/.github/ISSUE_TEMPLATE/feature_request.yml b/.github/ISSUE_TEMPLATE/feature_request.yml new file mode 100644 index 00000000..a746abcd --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature_request.yml @@ -0,0 +1,69 @@ +name: Feature request +description: Propose a focused product or developer-experience improvement +title: "[Feature]: " +body: + - type: markdown + attributes: + value: | + Describe the user problem first, then the proposed solution. Postify prioritizes changes that strengthen useful, trustworthy, and reproducible knowledge. + + - type: checkboxes + id: preflight + attributes: + label: Preflight + options: + - label: I searched existing issues and did not find the same request. + required: true + + - type: textarea + id: problem + attributes: + label: Problem + description: What user or contributor problem should this solve? + placeholder: Today, users cannot ... which causes ... + validations: + required: true + + - type: textarea + id: proposal + attributes: + label: Proposed solution + description: Describe the smallest useful solution. + validations: + required: true + + - type: textarea + id: alternatives + attributes: + label: Alternatives considered + description: What other approaches or workarounds did you consider? + + - type: dropdown + id: area + attributes: + label: Primary area + options: + - Verified Knowledge / trust model + - Reading / discovery experience + - Writing / editor experience + - Accounts / profiles + - Accessibility + - Performance / PWA + - Supabase / data model + - Developer experience / tooling + - Documentation + - Other + validations: + required: true + + - type: textarea + id: success + attributes: + label: Success criteria + description: How would we know this feature solves the problem? + + - type: textarea + id: context + attributes: + label: Additional context + description: Mockups, examples, links, constraints, or implementation notes. diff --git a/.github/assets/postify-home.png b/.github/assets/postify-home.png new file mode 100644 index 00000000..6c47c700 Binary files /dev/null and b/.github/assets/postify-home.png differ diff --git a/.github/assets/postify-social-preview.png b/.github/assets/postify-social-preview.png new file mode 100644 index 00000000..b598bc23 Binary files /dev/null and b/.github/assets/postify-social-preview.png differ diff --git a/.github/assets/postify-verification.png b/.github/assets/postify-verification.png new file mode 100644 index 00000000..b53e6d31 Binary files /dev/null and b/.github/assets/postify-verification.png differ diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 00000000..33fa88df --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,148 @@ +version: 2 +updates: + - package-ecosystem: "npm" + directory: "/" + schedule: + interval: "weekly" + day: "monday" + time: "04:00" + timezone: "Europe/Istanbul" + open-pull-requests-limit: 8 + cooldown: + semver-minor-days: 7 + semver-patch-days: 3 + labels: + - "dependencies" + allow: + - dependency-name: "*" + update-types: + - "version-update:semver-minor" + - "version-update:semver-patch" + groups: + tiptap: + applies-to: "version-updates" + patterns: + - "@tiptap/*" + update-types: + - "minor" + - "patch" + react-platform: + applies-to: "version-updates" + patterns: + - "react" + - "react-dom" + - "react-is" + - "react-redux" + - "@reduxjs/toolkit" + - "redux-persist" + update-types: + - "minor" + - "patch" + data-platform: + applies-to: "version-updates" + patterns: + - "@supabase/*" + - "@tanstack/react-query" + - "axios" + update-types: + - "minor" + - "patch" + content-and-i18n: + applies-to: "version-updates" + patterns: + - "i18next" + - "react-i18next" + - "react-markdown" + - "react-helmet-async" + - "rehype-highlight" + - "remark-gfm" + update-types: + - "minor" + - "patch" + ui-runtime: + applies-to: "version-updates" + patterns: + - "@radix-ui/*" + - "framer-motion" + - "react-icons" + - "react-hot-toast" + - "class-variance-authority" + - "clsx" + - "tailwind-merge" + - "gradflow" + update-types: + - "minor" + - "patch" + linting: + applies-to: "version-updates" + dependency-type: "development" + patterns: + - "eslint" + - "eslint-*" + - "@eslint/*" + - "globals" + update-types: + - "minor" + - "patch" + test-tooling: + applies-to: "version-updates" + dependency-type: "development" + patterns: + - "@testing-library/*" + - "vitest" + - "jsdom" + exclude-patterns: + - "@playwright/test" + update-types: + - "minor" + - "patch" + build-tooling: + applies-to: "version-updates" + dependency-type: "development" + patterns: + - "vite" + - "@vitejs/*" + - "vite-plugin-pwa" + - "workbox-window" + - "gh-pages" + - "@types/react" + - "@types/react-dom" + update-types: + - "minor" + - "patch" + + - package-ecosystem: "github-actions" + directory: "/" + schedule: + interval: "weekly" + day: "monday" + time: "04:30" + timezone: "Europe/Istanbul" + open-pull-requests-limit: 3 + labels: + - "dependencies" + - "github_actions" + allow: + - dependency-name: "*" + update-types: + - "version-update:semver-minor" + - "version-update:semver-patch" + groups: + github-actions-version-updates: + applies-to: "version-updates" + patterns: + - "*" + update-types: + - "minor" + - "patch" + + - package-ecosystem: "docker" + directory: "/" + schedule: + interval: "weekly" + day: "monday" + time: "04:45" + timezone: "Europe/Istanbul" + open-pull-requests-limit: 2 + labels: + - "dependencies" diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md new file mode 100644 index 00000000..ec627b91 --- /dev/null +++ b/.github/pull_request_template.md @@ -0,0 +1,55 @@ +## Summary + + + +## Change type + +- [ ] Feature +- [ ] Bug fix +- [ ] Documentation +- [ ] Refactor / maintenance +- [ ] Test / tooling +- [ ] Database / migration +- [ ] Security hardening + +## Validation + + + +- [ ] `npm run verify` +- [ ] `npm run verify:security` +- [ ] `npm run test:e2e:ui` +- [ ] `npm run test:e2e:visual` +- [ ] Database migration/RLS verification is relevant and covered +- [ ] Manual browser verification is relevant and completed + +### Test notes + + + +## Screenshots / visual evidence + + + +Not applicable / add screenshots here. + +## Trust, security, and data review + +- [ ] This change does not make `Postify verified` author-writable. +- [ ] This change does not fabricate verification/evidence/freshness data. +- [ ] This change does not expose service-role or other server secrets to the client. +- [ ] I reviewed RLS/privacy implications if this touches persisted user data. +- [ ] I did not include credentials, private user data, or sensitive logs in this PR. + +## Accessibility and UX + +- [ ] Keyboard/focus behavior was considered for interactive UI changes. +- [ ] Contrast/readability was considered. +- [ ] Reduced-motion behavior was considered when animation changed. +- [ ] Not applicable. + +## Follow-up / known limitations + + + +None. diff --git a/.github/release.yml b/.github/release.yml new file mode 100644 index 00000000..c5b0365c --- /dev/null +++ b/.github/release.yml @@ -0,0 +1,23 @@ +changelog: + exclude: + labels: + - duplicate + - invalid + - wontfix + categories: + - title: "🚀 Features" + labels: + - enhancement + - title: "🐛 Fixes" + labels: + - bug + - title: "📚 Documentation" + labels: + - documentation + - title: "📦 Dependencies" + labels: + - dependencies + - github_actions + - title: "🧰 Other changes" + labels: + - "*" diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 00000000..a8f49bde --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,319 @@ +name: CI/CD Pipeline + +on: + push: + branches: [main] + pull_request: + branches: [main] + schedule: + - cron: '17 5 * * *' + workflow_dispatch: + +env: + NODE_VERSION: "24.20.0" + +permissions: + contents: read + +jobs: + verify: + name: Test, Lint, Build & Smoke + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6 + + - name: Setup Node.js + uses: actions/setup-node@249970729cb0ef3589644e2896645e5dc5ba9c38 # v6 + with: + node-version: ${{ env.NODE_VERSION }} + cache: "npm" + + - name: Install dependencies + run: npm ci + + - name: Verify dependency security and browser runner parity + run: npm run verify:security + + - name: Run release verification + run: npm run verify + + docker-smoke: + name: Docker Image Smoke + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6 + with: + persist-credentials: false + + - name: Build production image + run: docker build --tag postify:ci . + + - name: Start production image + run: docker run --detach --name postify-ci --publish 18080:80 postify:ci + + - name: Verify container health and root response + run: | + set -euo pipefail + for attempt in {1..30}; do + if [ "$(curl --fail --silent http://127.0.0.1:18080/health || true)" = "healthy" ]; then + curl --fail --silent --output /dev/null http://127.0.0.1:18080/ + exit 0 + fi + sleep 1 + done + docker logs postify-ci + exit 1 + + - name: Stop production image + if: always() + run: docker rm --force postify-ci || true + + ui-e2e: + name: Chromium Product E2E + runs-on: ubuntu-latest + container: mcr.microsoft.com/playwright:v1.57.0-noble@sha256:3bed4b1a12f2338642f3d8cba28e291deef3c66bd4a964bbeb3e57bbff511dbd + steps: + - name: Checkout code + uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6 + + - name: Install dependencies + run: npm ci + + # The UI suite checks hashed production assets, lazy chunk loading and + # static public route shells. Test the same compiled output Pages ships. + - name: Build production site for browser verification + run: npm run build + + - name: Start compiled product preview + run: | + npm run preview -- --host 0.0.0.0 --port 4174 --strictPort > /tmp/postify-vite.log 2>&1 & + echo $! > /tmp/postify-vite.pid + + - name: Wait for product server + run: | + node --input-type=module <<'NODE' + const deadline=Date.now()+30_000; + while(Date.now()setTimeout(resolve,500)); + } + process.exit(1); + NODE + + - name: Run Chromium product suite + run: npm run test:e2e:ui + env: + PLAYWRIGHT_BASE_URL: http://127.0.0.1:4174 + + - name: Run deterministic visual regression + run: npm run test:e2e:visual + env: + PLAYWRIGHT_VISUAL_PORT: 4175 + + - name: Show server log on failure + if: failure() + run: cat /tmp/postify-vite.log || true + + schema-verify: + name: Verified Knowledge Schema & RLS + runs-on: ubuntu-latest + services: + postgres: + image: postgres:16-alpine@sha256:cf78e76683b9ca8c5733cbbdce6c9262b45b6767934dd0a95e671f9a0fc20685 + env: + POSTGRES_PASSWORD: postify + POSTGRES_DB: postify + ports: + - 5432:5432 + options: >- + --health-cmd "pg_isready -U postgres -d postify" + --health-interval 5s + --health-timeout 5s + --health-retries 10 + env: + PGPASSWORD: postify + steps: + - uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6 + - name: Install PostgreSQL client + run: sudo apt-get update -qq && sudo apt-get install -y postgresql-client + - name: Bootstrap Supabase auth roles for dry-run + run: | + psql -v ON_ERROR_STOP=1 -h 127.0.0.1 -U postgres -d postify <<'SQL' + create schema auth; + create table auth.users(id uuid primary key,email text,raw_user_meta_data jsonb default '{}'::jsonb); + create or replace function auth.uid() returns uuid language sql stable as $$ select null::uuid $$; + create schema storage; + create table storage.buckets( + id text primary key, + name text not null, + public boolean not null default false, + file_size_limit bigint, + allowed_mime_types text[] + ); + create table storage.objects( + id uuid primary key default gen_random_uuid(), + bucket_id text, + name text not null, + owner_id text + ); + alter table storage.objects enable row level security; + create or replace function storage.foldername(name text) + returns text[] language sql immutable + as $$ select string_to_array(name, '/') $$; + create role anon nologin; + create role authenticated nologin; + SQL + - name: Apply all migrations in order + run: | + set -euo pipefail + for migration in supabase/migrations/*.sql; do + echo "Applying $migration" + psql -v ON_ERROR_STOP=1 -h 127.0.0.1 -U postgres -d postify -f "$migration" + done + - name: Verify RLS and abuse boundaries + run: psql -v ON_ERROR_STOP=1 -h 127.0.0.1 -U postgres -d postify -f supabase/verify-verified-knowledge.sql + + deploy: + name: Build & Deploy to GitHub Pages + runs-on: ubuntu-latest + needs: [verify, docker-smoke, ui-e2e, schema-verify] + if: github.ref == 'refs/heads/main' && github.event_name != 'pull_request' + permissions: + contents: write + outputs: + deployed: ${{ steps.prereq.outputs.ready }} + concurrency: + group: pages-deploy + cancel-in-progress: true + steps: + - name: Checkout code + uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6 + + - name: Setup Node.js + uses: actions/setup-node@249970729cb0ef3589644e2896645e5dc5ba9c38 # v6 + with: + node-version: ${{ env.NODE_VERSION }} + cache: "npm" + + - name: Install dependencies + run: npm ci + + - name: Check deploy prerequisites + id: prereq + env: + SUPABASE_URL: ${{ secrets.VITE_SUPABASE_URL }} + SUPABASE_ANON_KEY: ${{ secrets.VITE_SUPABASE_ANON_KEY }} + run: | + if [ -n "$SUPABASE_URL" ] && [ -n "$SUPABASE_ANON_KEY" ]; then + echo "ready=true" >> "$GITHUB_OUTPUT" + else + echo "ready=false" >> "$GITHUB_OUTPUT" + echo "::warning title=Deploy skipped::Set VITE_SUPABASE_URL and VITE_SUPABASE_ANON_KEY in Settings > Secrets and variables > Actions > Secrets to enable automatic deployment." + fi + + - name: Build + if: steps.prereq.outputs.ready == 'true' + run: npm run build + env: + VITE_SUPABASE_URL: ${{ secrets.VITE_SUPABASE_URL }} + VITE_SUPABASE_ANON_KEY: ${{ secrets.VITE_SUPABASE_ANON_KEY }} + VITE_APP_URL: https://postify.zekiakgul.dev + VITE_APP_NAME: Postify + + - name: Export production machine-readable knowledge + if: steps.prereq.outputs.ready == 'true' + run: npm run export:knowledge + env: + VITE_SUPABASE_URL: ${{ secrets.VITE_SUPABASE_URL }} + VITE_SUPABASE_ANON_KEY: ${{ secrets.VITE_SUPABASE_ANON_KEY }} + + - name: Stamp release identity + if: steps.prereq.outputs.ready == 'true' + run: | + node --input-type=module <<'NODE' + import { writeFile } from 'node:fs/promises'; + const release={sourceSha:process.env.GITHUB_SHA,builtAt:new Date().toISOString(),knowledgeBackend:'runtime-capability-artifact'}; + await writeFile('docs/release.json',JSON.stringify(release,null,2)+'\n'); + NODE + + - name: Deploy to GitHub Pages + if: steps.prereq.outputs.ready == 'true' + uses: peaceiris/actions-gh-pages@84c30a85c19949d7eee79c4ff27748b70285e453 # v4.1.0 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + publish_dir: ./docs + + + production-browser-smoke: + name: Production Chromium & Release Smoke + runs-on: ubuntu-latest + needs: deploy + if: github.ref == 'refs/heads/main' && github.event_name != 'pull_request' && needs.deploy.result == 'success' && needs.deploy.outputs.deployed == 'true' + container: mcr.microsoft.com/playwright:v1.57.0-noble@sha256:3bed4b1a12f2338642f3d8cba28e291deef3c66bd4a964bbeb3e57bbff511dbd + steps: + - name: Checkout source + uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6 + + - name: Install dependencies + run: npm ci + + - name: Wait for the exact source SHA on production + env: + EXPECTED_SHA: ${{ github.sha }} + run: | + node --input-type=module <<'NODE' + const expected=process.env.EXPECTED_SHA; + const deadline=Date.now()+360_000; + let last='unavailable'; + while(Date.now()setTimeout(resolve,5000)); + } + console.error(`Production did not reach ${expected}; last observed ${last}`); + process.exit(1); + NODE + + - name: Probe production capability and machine-readable artifacts + run: | + node --input-type=module <<'NODE' + // Hosted static shells must return successful HTML, not a 404 SPA redirect. + for (const [route, title] of [['about', 'Hakkımızda — Postify'], ['contact', 'İletişim — Postify']]) { + const response=await fetch('https://postify.zekiakgul.dev/'+route+'?direct=1&t='+Date.now(),{cache:'no-store'}); + if(response.status!==200) throw new Error('Direct /'+route+' returned HTTP '+response.status); + if(!response.headers.get('content-type')?.includes('text/html')) throw new Error('Direct /'+route+' is not HTML'); + const html=await response.text(); + if(!html.includes(''+title+'') || !html.includes('rel="canonical" href="https://postify.zekiakgul.dev/'+route+'"')) { + throw new Error('Direct /'+route+' served the wrong static route shell'); + } + console.log('Direct /'+route+' HTTP 200'); + } + for(const path of ['/','/llms.txt','/verification-runs.json','/runtime-release-status.json','/knowledge-backend-status.json','/knowledge/node-json-dogrulama.tr.json']){ + const response=await fetch(`https://postify.zekiakgul.dev${path}?smoke=${Date.now()}`,{cache:'no-store'}); + if(!response.ok) throw new Error(`${path} returned ${response.status}`); + console.log(`${path} ${response.status}`); + } + const capability=await fetch(`https://postify.zekiakgul.dev/knowledge-backend-status.json?t=${Date.now()}`,{cache:'no-store'}).then((r)=>r.json()); + const verification=await fetch(`https://postify.zekiakgul.dev/verification-runs.json?t=${Date.now()}`,{cache:'no-store'}).then((r)=>r.json()); + const runtimeStatus=await fetch(`https://postify.zekiakgul.dev/runtime-release-status.json?t=${Date.now()}`,{cache:'no-store'}).then((r)=>r.json()); + const run=verification.runs?.['node-json-parse-v1']; + const signal=runtimeStatus.checks?.['node-json-parse-v1']; + if(!run || !signal || signal.verifiedRuntimeVersion!==run.runtimeVersion || signal.requiredRuntimeMajor!==run.requiredRuntimeMajor){ + throw new Error('Production runtime freshness artifact is not bound to the executed verification run'); + } + if(!['current','recheck-required','unknown'].includes(signal.status)) throw new Error(`Unexpected runtime freshness status: ${signal.status}`); + console.log(`Verified Knowledge backend ready=${capability.ready} mode=${capability.mode} runtimeFreshness=${signal.status}`); + NODE + + - name: Run production Chromium product suite + env: + PLAYWRIGHT_BASE_URL: https://postify.zekiakgul.dev + run: npm run test:e2e:ui diff --git a/.github/workflows/dependency-review.yml b/.github/workflows/dependency-review.yml new file mode 100644 index 00000000..59812537 --- /dev/null +++ b/.github/workflows/dependency-review.yml @@ -0,0 +1,24 @@ +name: Dependency Review + +on: + pull_request: + branches: + - main + +permissions: + contents: read + +jobs: + dependency-review: + name: Dependency Review + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6 + with: + persist-credentials: false + + - name: Review dependency changes + uses: actions/dependency-review-action@a1d282b36b6f3519aa1f3fc636f609c47dddb294 # v5.0.0 + with: + fail-on-severity: high diff --git a/.github/workflows/scorecard.yml b/.github/workflows/scorecard.yml new file mode 100644 index 00000000..1577c3c8 --- /dev/null +++ b/.github/workflows/scorecard.yml @@ -0,0 +1,44 @@ +name: OpenSSF Scorecard + +on: + push: + branches: + - main + schedule: + - cron: "30 2 * * 6" + workflow_dispatch: + +permissions: read-all + +jobs: + analysis: + name: Scorecard analysis + runs-on: ubuntu-latest + permissions: + security-events: write + id-token: write + + steps: + - name: Checkout code + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + persist-credentials: false + + - name: Run OpenSSF Scorecard + uses: ossf/scorecard-action@fa7117db83c52d787ae5a89f350999701505d78e # v2.5.0 + with: + results_file: results.sarif + results_format: sarif + publish_results: true + + - name: Upload SARIF artifact + uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2 + with: + name: scorecard-results + path: results.sarif + retention-days: 5 + + - name: Upload to code scanning + uses: github/codeql-action/upload-sarif@9b3254085494b55a0f7c4c2b3d2d52cc712ce370 # v4.39.1 + with: + sarif_file: results.sarif diff --git a/.github/workflows/supabase-production-migrate.yml b/.github/workflows/supabase-production-migrate.yml new file mode 100644 index 00000000..ab3ad294 --- /dev/null +++ b/.github/workflows/supabase-production-migrate.yml @@ -0,0 +1,161 @@ +name: Supabase Production Migration + +on: + workflow_dispatch: + inputs: + mode: + description: "Inspect/dry-run or apply pending production migrations" + required: true + default: dry-run + type: choice + options: + - dry-run + - apply + confirmation: + description: "For apply only: type APPLY_fuiwcrqmxndguxymwoin" + required: false + type: string + +permissions: + contents: read + +concurrency: + group: postify-production-supabase-migration + cancel-in-progress: false + +env: + SUPABASE_CLI_VERSION: "2.116.0" + SUPABASE_PROJECT_REF: "fuiwcrqmxndguxymwoin" + +jobs: + migrate: + name: Inspect / Apply Production Schema + runs-on: ubuntu-latest + environment: production + steps: + - name: Checkout main source + uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6 + + - name: Setup Node.js + uses: actions/setup-node@249970729cb0ef3589644e2896645e5dc5ba9c38 # v6 + with: + node-version: "24.20.0" + cache: npm + + - name: Validate owner credentials and apply confirmation + env: + SUPABASE_ACCESS_TOKEN: ${{ secrets.SUPABASE_ACCESS_TOKEN }} + SUPABASE_DB_PASSWORD: ${{ secrets.SUPABASE_DB_PASSWORD }} + MODE: ${{ inputs.mode }} + CONFIRMATION: ${{ inputs.confirmation }} + run: | + set -euo pipefail + test -n "$SUPABASE_ACCESS_TOKEN" || { echo "::error::SUPABASE_ACCESS_TOKEN is missing"; exit 1; } + test -n "$SUPABASE_DB_PASSWORD" || { echo "::error::SUPABASE_DB_PASSWORD is missing"; exit 1; } + if [ "$MODE" = "apply" ] && [ "$CONFIRMATION" != "APPLY_${SUPABASE_PROJECT_REF}" ]; then + echo "::error::Apply confirmation does not match the production project ref" + exit 1 + fi + + - name: Pin Supabase CLI + run: npx --yes "supabase@${SUPABASE_CLI_VERSION}" --version + + - name: Link exact production project + env: + SUPABASE_ACCESS_TOKEN: ${{ secrets.SUPABASE_ACCESS_TOKEN }} + SUPABASE_DB_PASSWORD: ${{ secrets.SUPABASE_DB_PASSWORD }} + run: | + set -euo pipefail + npx --yes "supabase@${SUPABASE_CLI_VERSION}" link \ + --project-ref "$SUPABASE_PROJECT_REF" \ + --password "$SUPABASE_DB_PASSWORD" \ + --yes + + - name: Inspect remote migration history + env: + SUPABASE_ACCESS_TOKEN: ${{ secrets.SUPABASE_ACCESS_TOKEN }} + SUPABASE_DB_PASSWORD: ${{ secrets.SUPABASE_DB_PASSWORD }} + run: | + set -euo pipefail + npx --yes "supabase@${SUPABASE_CLI_VERSION}" migration list \ + --linked \ + --password "$SUPABASE_DB_PASSWORD" + + - name: Dry-run pending migrations + env: + SUPABASE_ACCESS_TOKEN: ${{ secrets.SUPABASE_ACCESS_TOKEN }} + SUPABASE_DB_PASSWORD: ${{ secrets.SUPABASE_DB_PASSWORD }} + run: | + set -euo pipefail + # Deliberately do not use --include-all or migration repair. + # If remote history is inconsistent, fail and inspect rather than guessing. + npx --yes "supabase@${SUPABASE_CLI_VERSION}" db push \ + --linked \ + --password "$SUPABASE_DB_PASSWORD" \ + --dry-run + + - name: Apply pending migrations + if: inputs.mode == 'apply' + env: + SUPABASE_ACCESS_TOKEN: ${{ secrets.SUPABASE_ACCESS_TOKEN }} + SUPABASE_DB_PASSWORD: ${{ secrets.SUPABASE_DB_PASSWORD }} + run: | + set -euo pipefail + npx --yes "supabase@${SUPABASE_CLI_VERSION}" db push \ + --linked \ + --password "$SUPABASE_DB_PASSWORD" \ + --yes + + - name: Re-read migration history after apply + if: inputs.mode == 'apply' + env: + SUPABASE_ACCESS_TOKEN: ${{ secrets.SUPABASE_ACCESS_TOKEN }} + SUPABASE_DB_PASSWORD: ${{ secrets.SUPABASE_DB_PASSWORD }} + run: | + set -euo pipefail + npx --yes "supabase@${SUPABASE_CLI_VERSION}" migration list \ + --linked \ + --password "$SUPABASE_DB_PASSWORD" + + - name: Probe new public schema contracts + if: inputs.mode == 'apply' + env: + SUPABASE_URL: ${{ secrets.VITE_SUPABASE_URL }} + SUPABASE_ANON_KEY: ${{ secrets.VITE_SUPABASE_ANON_KEY }} + run: | + set -euo pipefail + test -n "$SUPABASE_URL" || { echo "::error::VITE_SUPABASE_URL is missing"; exit 1; } + test -n "$SUPABASE_ANON_KEY" || { echo "::error::VITE_SUPABASE_ANON_KEY is missing"; exit 1; } + node --input-type=module <<'NODE' + const base=process.env.SUPABASE_URL.replace(/\/$/,''); + const headers={apikey:process.env.SUPABASE_ANON_KEY,Authorization:`Bearer ${process.env.SUPABASE_ANON_KEY}`}; + for(const resource of ['post_evidence_summary','post_failure_reports','post_revision_history','knowledge_backend_capabilities']){ + const response=await fetch(`${base}/rest/v1/${resource}?select=*&limit=1`,{headers}); + if(!response.ok) throw new Error(`${resource} probe returned ${response.status}: ${(await response.text()).slice(0,300)}`); + console.log(`${resource} ${response.status}`); + } + const canonicalResponse=await fetch(`${base}/rest/v1/posts?select=id,canonical_source_url&limit=1`,{headers}); + if(!canonicalResponse.ok) throw new Error(`canonical_source_url probe returned ${canonicalResponse.status}: ${(await canonicalResponse.text()).slice(0,300)}`); + console.log(`canonical_source_url ${canonicalResponse.status}`); + const capabilityResponse=await fetch(`${base}/rest/v1/knowledge_backend_capabilities?select=schema_version,evidence_ready,corrections_ready`,{headers}); + if(!capabilityResponse.ok) throw new Error(`capability probe returned ${capabilityResponse.status}`); + const [capability]=await capabilityResponse.json(); + if(Number(capability?.schema_version)<2 || capability?.evidence_ready!==true || capability?.corrections_ready!==true){ + throw new Error(`incomplete backend capability: ${JSON.stringify(capability)}`); + } + console.log(`capability schema=${capability.schema_version} evidence=${capability.evidence_ready} corrections=${capability.corrections_ready}`); + NODE + + + release-verification: + name: Trigger Main Release Verification + if: inputs.mode == 'apply' + needs: migrate + runs-on: ubuntu-latest + permissions: + actions: write + steps: + - name: Trigger full main release verification after migration + env: + GH_TOKEN: ${{ github.token }} + run: gh workflow run ci.yml --ref main diff --git a/.gitignore b/.gitignore index a547bf36..8bc71c69 100644 --- a/.gitignore +++ b/.gitignore @@ -10,7 +10,10 @@ lerna-debug.log* node_modules dist dist-ssr +docs/ +graphify-out/ *.local +.env # Editor directories and files .vscode/* @@ -22,3 +25,8 @@ dist-ssr *.njsproj *.sln *.sw? +/public/verification-runs.json +/public/runtime-release-status.json +/public/knowledge/ + +/public/verification/ diff --git a/AGENTS.md b/AGENTS.md new file mode 100644 index 00000000..fe3e150d --- /dev/null +++ b/AGENTS.md @@ -0,0 +1,51 @@ +# Postify Agent Working Agreement + +## Start every task +1. Read `project/project-context.md`, `project/progress.md`, `project/known-issues.md`, and the relevant file under `specs/`. +2. Inspect the current code before changing it. Do not assume a route, service, schema, or script exists. +3. Preserve existing authentication/Supabase behavior unless the task explicitly changes it. +4. Separate verified facts from assumptions. Do not claim tests, browser checks, sources, or deployments that were not actually run. + +## Product direction +Postify is not a generic Medium clone. The product is being repositioned around practical, structured, freshness-aware knowledge for builders: guides, decision notes, explainers, and field notes. + +Every product change should improve at least one of these outcomes: +- a reader finds the right answer faster; +- a reader understands whether the content is current and applicable; +- an author can publish reusable knowledge instead of an unstructured blog post; +- useful content remains portable and discoverable outside Postify. + +## Implementation loop +1. Pick the smallest incomplete acceptance criterion. +2. Reproduce/inspect the current behavior. +3. Make the smallest coherent change. +4. Run lint and production build; run narrower tests when available. +5. Review the diff for regressions and accidental scope creep. +6. Update `project/progress.md`, `project/decisions.md`, and `project/known-issues.md` when relevant. + +## Quality rules +- Design language is "show your work": cool report paper, graphite ink, one cobalt colour reserved for evidence, amber for recheck. Tokens live in `src/index.css`; do not reintroduce cream/terracotta or extra accent hues. +- Type: Bricolage Grotesque (display/UI), Source Serif 4 (reading), IBM Plex Mono for code only. No all-caps monospace labels, no fake ordinals (01/02/03) unless the content is a real sequence. +- Motion is allowed when it explains evidence: the hero proof receipt, record-to-article view transitions, the Goal scroll scene. One orchestrated moment per page; everything respects `prefers-reduced-motion`. Heavy motion libraries (GSAP) load lazily per route and never enter the entry chunk. +- Covers are `EvidenceCover` figures generated from each post's record (type → shape, evidence → terminal mark, minutes → ruler). Do not add stock imagery. +- No fake social proof, fake live data, fake verification badges, or invented source counts. Anything shown in the proof receipt or a stamp must come from published run artifacts. +- New trust/freshness labels must be backed by explicit data or use neutral wording such as “last edited”. +- Keyboard access, visible focus, 44px touch targets and 400% text reflow remain release gates. +- Supabase schema changes are deferred until the product model is validated in the frontend. + +## graphify + +This project has a knowledge graph at graphify-out/ with god nodes, community structure, and cross-file relationships. + +When the user types `/graphify`, use the installed graphify skill or instructions before doing anything else. + +Rules: +- For codebase questions, first run `graphify query ""` when graphify-out/graph.json exists. Use `graphify path "" ""` for relationships and `graphify explain ""` for focused concepts. These return a scoped subgraph, usually much smaller than GRAPH_REPORT.md or raw grep output. +- Dirty graphify-out/ files are expected after hooks or incremental updates; dirty graph files are not a reason to skip graphify. Only skip graphify if the task is about stale or incorrect graph output, or the user explicitly says not to use it. +- If graphify-out/wiki/index.md exists, use it for broad navigation instead of raw source browsing. +- Read graphify-out/GRAPH_REPORT.md only for broad architecture review or when query/path/explain do not surface enough context. +- After modifying code, run `graphify update .` to keep the graph current (AST-only, no API cost). + +## Postify UI Review + +For any visible Postify UI/UX change, follow `.codex/skills/postify-ui-review/SKILL.md`. A passing build is not enough: use Graphify for impact analysis, inspect the actual browser result on desktop and mobile, and reject generic template aesthetics or decorative effects that compete with content. diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 00000000..68cc42e9 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,34 @@ +# Changelog + +All notable public changes to Postify are documented here. + +This project follows [Semantic Versioning](https://semver.org/) for published GitHub releases and uses GitHub-generated release notes for pull-request-level detail. + +## [Unreleased] + +### Changed + +- Future user-visible changes will be collected here before the next release. + +## [0.1.0] - 2026-08-31 + +### Added + +- First public product baseline for Postify as a Verified Knowledge network. +- Reproducible knowledge verification with explicit Unverified, Author tested, and Postify verified trust states. +- Supabase/PostgreSQL persistence with Row Level Security verification. +- Community Worked / Didn’t work evidence with privacy-safe public aggregates. +- React 19 application, TipTap editor, PWA support, multilingual product surfaces, and machine-readable knowledge artifacts. +- CI/CD gates covering unit tests, lint, production build, Chromium product tests, visual regression, database migration/RLS verification, deployment, and exact-SHA production smoke tests. +- Professional repository documentation, contribution guidance, security policy, issue forms, and pull request template. + +### Security + +- Secret scanning and push protection enabled. +- Private vulnerability reporting enabled. +- Dependabot alerts and security updates enabled. +- CodeQL default code scanning enabled for JavaScript/TypeScript and GitHub Actions. +- Main branch protected by required CI checks, pull-request flow, linear history, and force-push/deletion prevention. + +[Unreleased]: https://github.com/zexy2/postify/compare/v0.1.0...HEAD +[0.1.0]: https://github.com/zexy2/postify/releases/tag/v0.1.0 diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md new file mode 100644 index 00000000..3c658173 --- /dev/null +++ b/CODE_OF_CONDUCT.md @@ -0,0 +1,130 @@ +# Contributor Covenant Code of Conduct + +## Our Pledge + +We as members, contributors, and leaders pledge to make participation in our +community a harassment-free experience for everyone, regardless of age, body +size, visible or invisible disability, ethnicity, sex characteristics, gender +identity and expression, level of experience, education, socio-economic status, +nationality, personal appearance, race, religion, or sexual identity +and orientation. + +We pledge to act and interact in ways that contribute to an open, welcoming, +diverse, inclusive, and healthy community. + +## Our Standards + +Examples of behavior that contributes to a positive environment for our +community include: + +- Demonstrating empathy and kindness toward other people +- Being respectful of differing opinions, viewpoints, and experiences +- Giving and gracefully accepting constructive feedback +- Accepting responsibility and apologizing to those affected by our mistakes, + and learning from the experience +- Focusing on what is best not just for us as individuals, but for the + overall community + +Examples of unacceptable behavior include: + +- The use of sexualized language or imagery, and sexual attention or + advances of any kind +- Trolling, insulting or derogatory comments, and personal or political attacks +- Public or private harassment +- Publishing others' private information, such as a physical or email + address, without their explicit permission +- Other conduct which could reasonably be considered inappropriate in a + professional setting + +## Enforcement Responsibilities + +Community leaders are responsible for clarifying and enforcing our standards of +acceptable behavior and will take appropriate and fair corrective action in +response to any behavior that they deem inappropriate, threatening, offensive, +or harmful. + +Community leaders have the right and responsibility to remove, edit, or reject +comments, commits, code, wiki edits, issues, and other contributions that are +not aligned to this Code of Conduct, and will communicate reasons for moderation +decisions when appropriate. + +## Scope + +This Code of Conduct applies within all community spaces, and also applies when +an individual is officially representing the community in public spaces. +Examples of representing our community include using an official email address, +posting via an official social media account, or acting as an appointed +representative at an online or offline event. + +## Enforcement + +Instances of abusive, harassing, or otherwise unacceptable behavior can be +reported by opening an issue titled `Private conduct contact requested` **without +including incident details or personal information**. A maintainer will establish +a private reporting channel. Security or privacy vulnerabilities should instead +use the private process in [SECURITY.md](SECURITY.md). + +All complaints will be reviewed and investigated promptly and fairly. Community +leaders are obligated to respect the privacy and security of the reporter of any +incident. + +## Enforcement Guidelines + +Community leaders will follow these Community Impact Guidelines in determining +the consequences for any action they deem in violation of this Code of Conduct: + +### 1. Correction + +**Community Impact**: Use of inappropriate language or other behavior deemed +unprofessional or unwelcome in the community. + +**Consequence**: A private, written warning from community leaders, providing +clarity around the nature of the violation and an explanation of why the +behavior was inappropriate. A public apology may be requested. + +### 2. Warning + +**Community Impact**: A violation through a single incident or series of +actions. + +**Consequence**: A warning with consequences for continued behavior. No +interaction with the people involved, including unsolicited interaction with +those enforcing the Code of Conduct, for a specified period of time. This +includes avoiding interactions in community spaces as well as external channels +like social media. Violating these terms may lead to a temporary or permanent +ban. + +### 3. Temporary Ban + +**Community Impact**: A serious violation of community standards, including +sustained inappropriate behavior. + +**Consequence**: A temporary ban from any sort of interaction or public +communication with the community for a specified period of time. No public or +private interaction with the people involved, including unsolicited interaction +with those enforcing the Code of Conduct, is allowed during this period. +Violating these terms may lead to a permanent ban. + +### 4. Permanent Ban + +**Community Impact**: Demonstrating a pattern of violation of community +standards, including sustained inappropriate behavior, harassment of an +individual, or aggression toward or disparagement of classes of individuals. + +**Consequence**: A permanent ban from any sort of public interaction within the +community. + +## Attribution + +This Code of Conduct is adapted from the [Contributor Covenant][homepage], +version 2.0, available at +https://www.contributor-covenant.org/version/2/0/code_of_conduct.html. + +Community Impact Guidelines were inspired by [Mozilla's code of conduct +enforcement ladder](https://github.com/mozilla/diversity). + +[homepage]: https://www.contributor-covenant.org + +For answers to common questions about this code of conduct, see the FAQ at +https://www.contributor-covenant.org/faq. Translations are available at +https://www.contributor-covenant.org/translations. diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 00000000..5012e0c3 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,136 @@ +# Contributing to Postify + +Thanks for helping improve Postify. This project values contributions that are focused, reproducible, and easy to review. + +## Before you start + +- Search existing issues, discussions, and pull requests before opening a duplicate. +- Use GitHub Discussions for open-ended questions and early product ideas. +- Use the repository issue forms for reproducible bugs and scoped feature requests. +- For security-sensitive reports, follow [SECURITY.md](SECURITY.md) and do **not** publish exploit details in a public issue. +- Keep changes scoped. A small PR with one clear purpose is easier to verify and safer to ship. + +## Development setup + +### Requirements + +- Node.js 24 LTS recommended +- npm +- A Supabase project for backend-backed/authenticated flows + +### Install + +```bash +git clone https://github.com/zexy2/postify.git +cd postify +npm ci +cp .env.example .env.local +npm run dev +``` + +Never put a Supabase `service_role` key or another server secret in a Vite-exposed environment variable. + +## Branches + +Create a branch from the latest `main`: + +```bash +git switch main +git pull --ff-only +git switch -c feat/short-description +``` + +Suggested prefixes: + +- `feat/` — product capability +- `fix/` — bug fix +- `docs/` — documentation only +- `test/` — tests or test infrastructure +- `refactor/` — behavior-preserving code change +- `chore/` — maintenance/tooling + +## Quality gates + +Run the checks relevant to your change before opening a PR. + +```bash +npm run verify +npm run verify:security +npm run test:e2e:ui +npm run test:e2e:visual +``` + +`npm run verify` covers deterministic knowledge verification, unit tests, lint, build, and build smoke. Database changes are additionally validated in CI by replaying migrations on fresh PostgreSQL 16 and running `supabase/verify-verified-knowledge.sql`. + +If a check cannot be run locally, say so explicitly in the PR and explain why. + +## Product and UI changes + +For visible changes: + +1. Test the affected flow at realistic desktop and mobile sizes. +2. Check keyboard navigation and focus behavior. +3. Preserve readable contrast and reduced-motion behavior. +4. Add or update Playwright coverage when the behavior is important to the product contract. +5. Include before/after screenshots in the PR when they materially help reviewers. + +Do not update visual baselines merely to make a failing visual test green. First confirm that the visual change is intended. + +## Verified Knowledge changes + +Trust signals are product behavior, not decorative labels. + +- Never make `Postify verified` author-writable. +- Do not fabricate verification runs, evidence counts, runtime freshness, or authenticated-user results. +- Deterministic verifiers must remain checked in and reviewable. +- A displayed verification artifact must remain bound to the code/runtime it claims to represent. +- If freshness cannot be established safely, fail closed rather than presenting a stronger trust state. + +## Database and Supabase changes + +- Add new migrations; do not rewrite production migration history. +- Preserve Row Level Security boundaries. +- Avoid exposing private user data in public aggregates or machine-readable surfaces. +- Prefer additive, reversible schema evolution where practical. +- Never commit production secrets or local credentials. + +## Commit messages + +Use short, imperative Conventional Commit-style messages when practical: + +```text +feat(knowledge): add evidence freshness signal +fix(ui): restore focus after closing dialog +docs: expand local setup guide +``` + +## Pull requests + +A good PR should explain: + +- what changed; +- why it changed; +- how it was tested; +- whether there are security/data implications; +- screenshots for meaningful UI changes; +- any known limitations or follow-up work. + +The repository PR template will prompt for these details. + +## Review expectations + +Reviewers may ask for changes when a contribution: + +- weakens verification or RLS boundaries; +- introduces an untested product-critical behavior; +- mixes unrelated refactors with the requested change; +- makes claims that are not supported by persisted or deterministic evidence; +- hides known failures instead of addressing or documenting them. + +## Code of conduct + +Participation in this project is governed by [CODE_OF_CONDUCT.md](CODE_OF_CONDUCT.md). + +## License + +By contributing, you agree that your contribution may be distributed under the repository’s [MIT License](LICENSE). diff --git a/Dockerfile b/Dockerfile index 350c8923..a7218959 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,35 +1,24 @@ -# Build stage -FROM node:20-alpine AS builder +# Build stage — exact runtime and digest keep builds reproducible across architectures. +FROM node:24.20.0-bookworm-slim@sha256:ba849c60be29959425b8734d57b8b4b7d56f98edd9504c9af091d5281095a71e AS builder WORKDIR /app -# Copy package files COPY package*.json ./ - -# Install dependencies RUN npm ci -# Copy source files COPY . . - -# Build the application RUN npm run build -# Production stage -FROM nginx:alpine AS production +# Production stage — pin the official stable NGINX image by immutable manifest digest. +FROM nginx:1.31.0-alpine@sha256:2f07d83bf561b506400dc183b1b2003803e39efbd22451f848adaba14d28c7c7 AS production -# Copy custom nginx config COPY nginx.conf /etc/nginx/conf.d/default.conf -# Copy built assets from builder -COPY --from=builder /app/dist /usr/share/nginx/html +# Vite's canonical production outDir is docs/. +COPY --from=builder /app/docs /usr/share/nginx/html -# Add healthcheck HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \ CMD wget --no-verbose --tries=1 --spider http://localhost:80/ || exit 1 -# Expose port EXPOSE 80 - -# Start nginx CMD ["nginx", "-g", "daemon off;"] diff --git a/README.md b/README.md index 430070ac..ef9b0f3b 100644 --- a/README.md +++ b/README.md @@ -1,93 +1,216 @@ -# Postify Blog +
+ Postify logo -A full-stack blog platform built with React 19, Redux Toolkit, and Supabase. +# Postify -**Demo:** https://zexy2.github.io/Blog-app-with-React-and-Redux +### Knowledge you can verify, not just read. -## Features +A verified knowledge network for developers and builders — combining reproducible guides, evidence, freshness signals, and community validation. -- Content management with rich text editor (TipTap) -- JWT authentication with refresh token mechanism -- Role-based access control (Admin, Moderator, User) -- Admin dashboard for user and content management -- Multi-language support (English, Turkish) -- Dark/Light theme with system preference detection -- PWA with offline support -- Analytics dashboard with charts +[**Open Postify**](https://postify.zekiakgul.dev/) · [**How verification works**](#how-verification-works) · [**Contribute**](CONTRIBUTING.md) · [**Support**](SUPPORT.md) · [**Türkçe README**](README.tr.md) -## Tech Stack +[![CI/CD](https://github.com/zexy2/postify/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/zexy2/postify/actions/workflows/ci.yml) +[![Production](https://img.shields.io/website?url=https%3A%2F%2Fpostify.zekiakgul.dev&label=production)](https://postify.zekiakgul.dev/) +[![Node 24 LTS](https://img.shields.io/badge/Node.js-24%20LTS-339933?logo=nodedotjs&logoColor=white)](https://nodejs.org/) +[![MIT License](https://img.shields.io/github/license/zexy2/postify)](LICENSE) -**Frontend:** React 19, Redux Toolkit, TanStack Query, React Router 7, TipTap, Recharts +
-**Backend:** Supabase (PostgreSQL), JWT Authentication +![Postify production home screen](.github/assets/postify-home.png) -**Build:** Vite 7, Docker +## Why Postify? -**Testing:** Vitest, Playwright +Most technical content tells you what somebody wrote. Postify is designed to also show **what was tested, when it was tested, under which environment, and whether that evidence is still current**. -## Getting Started +| | Postify signal | What it answers | +|---|---|---| +| 🧪 | **Reproducible verification** | Can this claim be executed and checked? | +| 🧾 | **Evidence & provenance** | What supports the claim? | +| 🕒 | **Freshness** | Is the verification still current for the tracked runtime? | +| 👥 | **Community validation** | Did it work for other authenticated users? | -```bash -git clone https://github.com/zexy2/Blog-app-with-React-and-Redux.git -cd Blog-app-with-React-and-Redux -npm install -cp .env.example .env -npm run dev +Postify is not trying to be another generic blog clone. Its core product idea is **Verified Knowledge**: practical technical knowledge with explicit trust states instead of an undifferentiated “published = trustworthy” model. + +## Knowledge formats + +Postify treats different kinds of technical writing differently: + +- **Guide** — completes a concrete task. +- **Decision note** — makes options, constraints, and trade-offs visible. +- **Explainer** — builds a fast, accurate mental model. +- **Field note** — records the result and lesson from a real experience. + +## How verification works + +Postify deliberately separates author claims from platform-derived verification. + +```mermaid +flowchart LR + A[Unverified] -->|Author adds test date, environment and steps| B[Author tested] + B -->|Checked-in deterministic verifier runs during release| C[Postify verified] + C -->|Tracked runtime becomes stale or uncertain| D[Recheck required] + D -->|Verifier runs successfully on a current tracked runtime| C ``` -## Project Structure +### Trust states + +- **Unverified** — the author does not claim a test was performed. +- **Author tested** — the post includes meaningful environment/version information, a valid test date, and verification steps. This remains an author assertion. +- **Postify verified** — cannot be selected by an author. It is derived only when checked-in deterministic verification code actually runs, the displayed code matches the verified artifact, and the tracked runtime freshness remains current. + +Authenticated users can submit **Worked / Didn’t work** evidence to Supabase. Public surfaces expose privacy-safe aggregates rather than raw user identities or private notes. Signed-out feedback remains local to the device. + +![Postify verification experience in production](.github/assets/postify-verification.png) + +## Production +**Live app:** https://postify.zekiakgul.dev/ + +Machine-readable trust surfaces are published alongside the UI: + +- `/verification-runs.json` +- `/runtime-release-status.json` +- `/knowledge-backend-status.json` +- `/knowledge/..json` +- `/llms.txt` + +The production pipeline stamps every deployment with its source commit and waits for the **exact source SHA** to become observable before the final Chromium smoke suite runs. + +## Architecture + +```mermaid +flowchart TB + UI[React 19 + Vite 7] --> DATA[Supabase client] + DATA --> DB[(PostgreSQL + RLS)] + UI --> KNOWLEDGE[Verified Knowledge artifacts] + VERIFY[Deterministic Node verifiers] --> KNOWLEDGE + CI[GitHub Actions release gates] --> VERIFY + CI --> TESTS[Vitest + Playwright + visual regression] + CI --> SCHEMA[Fresh PostgreSQL 16 migration + RLS verification] + TESTS --> DEPLOY[GitHub Pages deployment] + SCHEMA --> DEPLOY + DEPLOY --> PROD[postify.zekiakgul.dev] + PROD --> SMOKE[Exact-SHA production Chromium smoke] ``` -src/ -├── components/ # UI components -├── pages/ # Route pages -├── services/ # API and business logic -│ ├── apiService.js # REST API layer -│ ├── authService.js # Auth logic -│ ├── jwtService.js # Token management -│ └── adminService.js # Admin operations -├── store/ # Redux store and slices -├── hooks/ # Custom hooks -└── lib/ # External configs (Supabase, i18n) + +### Stack + +- **Frontend:** React 19, Vite 7, React Router 7 +- **State & data:** Redux Toolkit, TanStack Query, Supabase +- **Editor:** TipTap +- **Database:** PostgreSQL + Row Level Security +- **Testing:** Vitest, Testing Library, Playwright +- **PWA:** Workbox / Vite PWA +- **Delivery:** GitHub Actions + GitHub Pages +- **Hosted verification runtime:** Node 24 LTS (`24.20.0` in the current workflow) + +## Quick start + +### Prerequisites + +- Node.js 24 LTS recommended +- npm +- A Supabase project if you want authenticated/backend-backed features locally + +### 1. Clone + +```bash +git clone https://github.com/zexy2/postify.git +cd postify +``` + +### 2. Install dependencies + +```bash +npm ci ``` -## API +### 3. Configure environment + +```bash +cp .env.example .env.local +``` -```javascript -api.posts.getAll({ page, limit }) -api.posts.getById(id) -api.posts.create(data) -api.posts.update(id, data) -api.posts.delete(id) +Then provide your local values: -api.users.getById(id) -api.users.update(id, data) +```env +VITE_SUPABASE_URL=https://your-project.supabase.co +VITE_SUPABASE_ANON_KEY=your-anon-key +VITE_APP_URL=http://localhost:5173 +VITE_APP_NAME=Postify ``` -## Scripts +Never place a Supabase `service_role` secret or any other server secret in the browser bundle. + +### 4. Run locally ```bash -npm run dev # Start dev server -npm run build # Production build -npm run test # Run tests -npm run lint # Lint code +npm run dev ``` -## Environment Variables +## Quality gates + +The repository uses fail-closed release checks rather than treating a successful build as sufficient proof of quality. +```bash +# Knowledge verification + unit tests + lint + build + build smoke +npm run verify + +# Dependency/security and browser-runner parity checks +npm run verify:security + +# Chromium product tests +npm run test:e2e:ui + +# Deterministic visual regression +npm run test:e2e:visual ``` -VITE_SUPABASE_URL=your_supabase_url -VITE_SUPABASE_ANON_KEY=your_anon_key + +Database migration changes are also replayed from scratch on PostgreSQL 16 and verified with `supabase/verify-verified-knowledge.sql` before deployment is allowed. + +## Repository map + +```text +. +├── src/ # React application, features and content +├── e2e/ # Chromium product tests +├── scripts/ # Verification, release and artifact tooling +├── supabase/ # Migrations and database verification +├── public/ # Static public assets and machine-readable surfaces +├── project/ # Maintainer-oriented project records +├── .github/workflows/ # CI/CD, security and production workflows +├── ROADMAP.md # Public product direction +├── CONTRIBUTING.md # Contribution workflow +├── SECURITY.md # Vulnerability reporting policy +├── SUPPORT.md # Help and reporting routes +└── CODE_OF_CONDUCT.md # Community standards ``` -## Performance +## Security model & important boundaries + +- The automatic verifier is **not** a sandbox for arbitrary or untrusted code. It is restricted to checked-in deterministic verification snippets. +- `Postify verified` is never author-writable database metadata. +- Evidence counts and authenticated browser coverage must come from real persisted data; they are not synthesized for presentation. +- Supabase Row Level Security is verified as part of the CI schema gate. +- Browser-exposed environment values must never contain service-role or other server secrets. +- GitHub Pages deep-link first-request behavior is treated as a hosting constraint and tested separately from the browser fallback path. + +See [SECURITY.md](SECURITY.md) before reporting a vulnerability. -| Metric | Score | -|--------|-------| -| Best Practices | 100 | -| Accessibility | 95 | -| SEO | 90 | +## Contributing + +Contributions are welcome. Start with [CONTRIBUTING.md](CONTRIBUTING.md) and keep pull requests focused and testable. + +Use [GitHub Discussions](https://github.com/zexy2/postify/discussions) for questions and open-ended ideas, and the repository issue forms for reproducible bugs or scoped feature work. Public product direction lives in [ROADMAP.md](ROADMAP.md). + +For community behavior expectations, see [CODE_OF_CONDUCT.md](CODE_OF_CONDUCT.md). ## License -MIT +Postify is released under the [MIT License](LICENSE). + +--- + +
+ Read less blindly. Verify more deliberately. +
diff --git a/README.tr.md b/README.tr.md new file mode 100644 index 00000000..9cec2452 --- /dev/null +++ b/README.tr.md @@ -0,0 +1,216 @@ +
+ Postify logosu + +# Postify + +### Sadece okuduğun değil, doğrulayabildiğin bilgi. + +Geliştiriciler ve ürün üretenler için; yeniden üretilebilir rehberleri, kanıtı, güncellik sinyallerini ve topluluk doğrulamasını bir araya getiren Verified Knowledge ağı. + +[**Postify’ı Aç**](https://postify.zekiakgul.dev/) · [**Doğrulama nasıl çalışıyor?**](#doğrulama-nasıl-çalışıyor) · [**Katkıda bulun**](CONTRIBUTING.md) · [**Destek**](SUPPORT.md) · [**English README**](README.md) + +[![CI/CD](https://github.com/zexy2/postify/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/zexy2/postify/actions/workflows/ci.yml) +[![Production](https://img.shields.io/website?url=https%3A%2F%2Fpostify.zekiakgul.dev&label=production)](https://postify.zekiakgul.dev/) +[![Node 24 LTS](https://img.shields.io/badge/Node.js-24%20LTS-339933?logo=nodedotjs&logoColor=white)](https://nodejs.org/) +[![MIT License](https://img.shields.io/github/license/zexy2/postify)](LICENSE) + +
+ +![Postify production ana ekranı](.github/assets/postify-home.png) + +## Neden Postify? + +Çoğu teknik içerik sana yalnızca **birinin ne yazdığını** söyler. Postify ise ayrıca **neyin test edildiğini, ne zaman test edildiğini, hangi ortamda doğrulandığını ve bu kanıtın hâlâ güncel olup olmadığını** görünür kılmak için tasarlanmıştır. + +| | Postify sinyali | Cevapladığı soru | +|---|---|---| +| 🧪 | **Yeniden üretilebilir doğrulama** | Bu iddia çalıştırılıp kontrol edilebilir mi? | +| 🧾 | **Kanıt ve kaynak** | İddiayı ne destekliyor? | +| 🕒 | **Güncellik** | Doğrulama takip edilen runtime için hâlâ güncel mi? | +| 👥 | **Topluluk doğrulaması** | Diğer authenticated kullanıcılar için çalıştı mı? | + +Postify bir başka genel amaçlı blog klonu olmaya çalışmaz. Ürünün merkezinde **Verified Knowledge** vardır: “yayınlandı = güvenilir” varsayımı yerine açık güven durumlarıyla sunulan uygulanabilir teknik bilgi. + +## Bilgi biçimleri + +Postify farklı teknik içerik türlerini aynı kefeye koymaz: + +- **Rehber** — somut bir işi tamamlatır. +- **Karar notu** — seçenekleri, kısıtları ve ödünleşimleri görünür kılar. +- **Açıklayıcı** — hızlı ve doğru bir zihinsel model kurar. +- **Saha notu** — gerçek bir deneyimin sonucunu ve dersini kaydeder. + +## Doğrulama nasıl çalışıyor? + +Postify, yazar beyanı ile platform tarafından türetilen doğrulamayı bilinçli biçimde ayırır. + +```mermaid +flowchart LR + A[Doğrulanmamış] -->|Yazar test tarihi, ortam ve adımlar ekler| B[Yazar test etti] + B -->|Checked-in deterministik verifier release sırasında çalışır| C[Postify verified] + C -->|Takip edilen runtime eskir veya belirsizleşir| D[Yeniden kontrol gerekli] + D -->|Verifier güncel runtime üzerinde başarıyla çalışır| C +``` + +### Güven durumları + +- **Doğrulanmamış / Unverified** — yazar test yaptığı iddiasında bulunmaz. +- **Yazar test etti / Author tested** — anlamlı ortam/sürüm bilgisi, geçerli test tarihi ve doğrulama adımları vardır. Bu hâlâ bir yazar beyanıdır. +- **Postify verified** — yazar tarafından seçilemez. Yalnız checked-in deterministik doğrulama kodu gerçekten çalıştığında, gösterilen kod doğrulanan artifact ile eşleştiğinde ve takip edilen runtime güncelliği `current` olduğunda türetilir. + +Authenticated kullanıcılar **Çalıştı / Çalışmadı** kanıtı gönderebilir. Public yüzeyler ham kullanıcı kimliği veya özel notlar yerine privacy-safe aggregate gösterir. Giriş yapılmadan gönderilen geri bildirim cihazda kalır. + +![Postify production doğrulama deneyimi](.github/assets/postify-verification.png) + +## Production + +**Canlı uygulama:** https://postify.zekiakgul.dev/ + +UI ile birlikte machine-readable güven yüzeyleri de yayınlanır: + +- `/verification-runs.json` +- `/runtime-release-status.json` +- `/knowledge-backend-status.json` +- `/knowledge/..json` +- `/llms.txt` + +Production pipeline her deploy’u kaynak commit’i ile damgalar ve son Chromium smoke suite’ini çalıştırmadan önce **tam olarak beklenen source SHA’nın** production’da görünmesini bekler. + +## Mimari + +```mermaid +flowchart TB + UI[React 19 + Vite 7] --> DATA[Supabase client] + DATA --> DB[(PostgreSQL + RLS)] + UI --> KNOWLEDGE[Verified Knowledge artifactları] + VERIFY[Deterministik Node verifier'ları] --> KNOWLEDGE + CI[GitHub Actions release gate'leri] --> VERIFY + CI --> TESTS[Vitest + Playwright + visual regression] + CI --> SCHEMA[Fresh PostgreSQL 16 migration + RLS verification] + TESTS --> DEPLOY[GitHub Pages deployment] + SCHEMA --> DEPLOY + DEPLOY --> PROD[postify.zekiakgul.dev] + PROD --> SMOKE[Exact-SHA production Chromium smoke] +``` + +### Teknoloji yığını + +- **Frontend:** React 19, Vite 7, React Router 7 +- **State & data:** Redux Toolkit, TanStack Query, Supabase +- **Editör:** TipTap +- **Veritabanı:** PostgreSQL + Row Level Security +- **Test:** Vitest, Testing Library, Playwright +- **PWA:** Workbox / Vite PWA +- **Dağıtım:** GitHub Actions + GitHub Pages +- **Hosted verification runtime:** Node 24 LTS (mevcut workflow’da `24.20.0`) + +## Hızlı başlangıç + +### Gereksinimler + +- Önerilen: Node.js 24 LTS +- npm +- Authenticated/backend özelliklerini yerelde kullanmak istiyorsanız bir Supabase projesi + +### 1. Repoyu klonlayın + +```bash +git clone https://github.com/zexy2/postify.git +cd postify +``` + +### 2. Bağımlılıkları kurun + +```bash +npm ci +``` + +### 3. Ortam değişkenlerini hazırlayın + +```bash +cp .env.example .env.local +``` + +Ardından kendi değerlerinizi girin: + +```env +VITE_SUPABASE_URL=https://your-project.supabase.co +VITE_SUPABASE_ANON_KEY=your-anon-key +VITE_APP_URL=http://localhost:5173 +VITE_APP_NAME=Postify +``` + +Supabase `service_role` secret veya başka bir server secret değerini browser bundle’a **asla** koymayın. + +### 4. Yerelde çalıştırın + +```bash +npm run dev +``` + +## Kalite kapıları + +Repo, başarılı build’i tek başına yeterli kalite kanıtı kabul etmez; release kontrolleri fail-closed çalışır. + +```bash +# Knowledge verification + unit test + lint + build + build smoke +npm run verify + +# Dependency/security ve browser-runner parity +npm run verify:security + +# Chromium ürün testleri +npm run test:e2e:ui + +# Deterministik visual regression +npm run test:e2e:visual +``` + +Veritabanı migration değişiklikleri de deploy öncesinde PostgreSQL 16 üzerinde sıfırdan uygulanır ve `supabase/verify-verified-knowledge.sql` ile doğrulanır. + +## Repo yapısı + +```text +. +├── src/ # React uygulaması, özellikler ve içerik +├── e2e/ # Chromium ürün testleri +├── scripts/ # Verification, release ve artifact araçları +├── supabase/ # Migration ve DB doğrulaması +├── public/ # Static asset ve machine-readable yüzeyler +├── project/ # Maintainer odaklı proje kayıtları +├── .github/workflows/ # CI/CD, güvenlik ve production workflow'ları +├── ROADMAP.md # Public ürün yönü +├── CONTRIBUTING.md # Katkı akışı +├── SECURITY.md # Güvenlik açığı bildirim politikası +├── SUPPORT.md # Destek ve bildirim kanalları +└── CODE_OF_CONDUCT.md # Topluluk standartları +``` + +## Güvenlik modeli ve önemli sınırlar + +- Otomatik verifier, arbitrary/untrusted kod için bir sandbox değildir; checked-in deterministik doğrulama snippet’leriyle sınırlıdır. +- `Postify verified` hiçbir zaman yazar tarafından yazılabilir DB metadata’sı değildir. +- Kanıt sayaçları ve authenticated browser coverage gerçek persisted veriden gelmelidir; sunum için uydurulmaz. +- Supabase Row Level Security, CI schema gate’in bir parçası olarak doğrulanır. +- Browser’a açılan environment değerleri service-role veya başka server secret’ları içermemelidir. +- GitHub Pages deep-link ilk-request davranışı ayrı bir hosting kısıtı olarak ele alınır ve browser fallback akışından ayrı test edilir. + +Bir güvenlik açığı bildirmeden önce [SECURITY.md](SECURITY.md) dosyasını okuyun. + +## Katkıda bulunma + +Katkılar memnuniyetle karşılanır. [CONTRIBUTING.md](CONTRIBUTING.md) ile başlayın ve pull request’leri dar kapsamlı ve test edilebilir tutun. + +Sorular ve açık uçlu fikirler için [GitHub Discussions](https://github.com/zexy2/postify/discussions), yeniden üretilebilir hatalar veya kapsamı belirli özellik çalışmaları için repo issue formlarını kullanın. Public ürün yönünü [ROADMAP.md](ROADMAP.md) içinde görebilirsiniz. + +Topluluk davranış beklentileri için [CODE_OF_CONDUCT.md](CODE_OF_CONDUCT.md) dosyasına bakın. + +## Lisans + +Postify [MIT License](LICENSE) altında yayınlanır. + +--- + +
+ Daha az körü körüne oku. Daha bilinçli doğrula. +
diff --git a/ROADMAP.md b/ROADMAP.md new file mode 100644 index 00000000..235e0bd5 --- /dev/null +++ b/ROADMAP.md @@ -0,0 +1,37 @@ +# Postify Roadmap + +Postify is evolving as a **Verified Knowledge** network: practical technical knowledge with explicit evidence, reproducibility, freshness, and community validation. + +This roadmap communicates product direction, not guaranteed delivery dates. Concrete implementation work should be tracked in GitHub Issues; open-ended ideas and questions belong in GitHub Discussions. + +## Now + +- Strengthen the verification and freshness contract without overstating trust. +- Keep discovery, reading, and authoring flows accessible, fast, and understandable on desktop and mobile. +- Harden authentication, abuse resistance, data boundaries, and release security. +- Keep CI/CD, database/RLS verification, browser coverage, and production exact-SHA checks release-blocking. +- Make contributor and maintainer workflows easier to understand and reproduce. + +## Next + +- Expand verification beyond the current deterministic Node.js foundation while preserving strict safety boundaries. +- Improve evidence invalidation when tracked runtimes, packages, or source assumptions change. +- Make provenance, revision history, and canonical-source relationships more useful to readers. +- Improve community evidence so “worked / didn’t work” signals are informative without becoming popularity metrics. +- Make knowledge gaps and saved intent more useful across authenticated sessions. + +## Later + +- Explore isolated verification runtimes for additional rule-safe verification types. +- Expand machine-readable Verified Knowledge integrations where the trust model can remain explicit. +- Improve contributor-facing tooling around verification recipes, evidence quality, and maintenance ownership. +- Explore broader community and organization workflows only when the core Verified Knowledge experience proves the need. + +## How to participate + +- **Reproducible bug:** use the repository Bug Report issue form. +- **Scoped feature work:** use the Feature Request issue form. +- **Open-ended idea or product question:** start a [GitHub Discussion](https://github.com/zexy2/postify/discussions). +- **Security vulnerability:** use [private vulnerability reporting](https://github.com/zexy2/postify/security/advisories/new). + +See [CONTRIBUTING.md](CONTRIBUTING.md) for the contribution workflow and [SUPPORT.md](SUPPORT.md) for the right support channel. diff --git a/SECURITY.md b/SECURITY.md new file mode 100644 index 00000000..e145e467 --- /dev/null +++ b/SECURITY.md @@ -0,0 +1,75 @@ +# Security Policy + +Security reports are taken seriously. Please help us protect Postify users by reporting vulnerabilities privately and giving maintainers a reasonable opportunity to investigate before public disclosure. + +## Supported version + +Postify is deployed continuously from `main`. Security fixes target the current production release and the current `main` branch. + +| Version | Supported | +|---|---| +| Current `main` / production | ✅ | +| Historical commits or old forks | ❌ | + +## Reporting a vulnerability + +**Do not open a public issue containing vulnerability details, proof-of-concept code, secrets, or user data.** + +Use GitHub’s private vulnerability reporting flow: + +1. Open the repository’s **Security** tab. +2. Choose **Report a vulnerability**. +3. Describe the issue, affected surface, reproduction steps, impact, and any suggested mitigation. +4. Attach only the minimum data necessary to reproduce the issue. Redact credentials and personal data. + +Repository security page: https://github.com/zexy2/postify/security + +If GitHub’s private reporting control is temporarily unavailable, open a public issue containing **only** the title `Private security contact requested` and no vulnerability details. A maintainer can then establish a private channel. + +## What to include + +A useful report normally contains: + +- affected URL, component, route, API, migration, or workflow; +- vulnerability class and expected impact; +- exact reproduction steps; +- browser/runtime/environment information when relevant; +- whether authentication is required; +- whether real user data could be exposed or modified; +- minimal proof of concept, when necessary; +- a mitigation idea, if you have one. + +## Scope priorities + +High-priority areas include: + +- authentication and account takeover; +- Supabase Row Level Security bypasses; +- unauthorized reads or writes of user data; +- exposure of secrets or privileged credentials; +- stored or reflected script injection; +- authorization bypasses; +- verification/trust-state forgery, including ways to obtain `Postify verified` without the required deterministic release evidence; +- CI/CD or supply-chain paths that could publish unverified or attacker-controlled artifacts; +- privacy leaks through evidence, notes, aggregates, or machine-readable knowledge surfaces. + +## Security boundaries + +Postify intentionally treats several boundaries as fail-closed contracts: + +- `Postify verified` is not author-writable metadata. +- Browser-exposed Vite variables must not contain Supabase `service_role` or other server secrets. +- Row Level Security is part of the database security model and is verified in CI on fresh PostgreSQL. +- The deterministic knowledge verifier is not an arbitrary/untrusted-code sandbox. +- Public evidence surfaces must not reveal private user identity or private notes. +- Production release verification is tied to the deployed source SHA. + +## Disclosure and response + +Please avoid public disclosure until maintainers have had a reasonable opportunity to validate and remediate the issue. We will aim to acknowledge a valid private report, keep the reporter informed when practical, and credit the reporter if they want attribution and disclosure is safe. + +Do not test in a way that intentionally degrades service availability, destroys data, accesses data belonging to unrelated users, or meaningfully disrupts production. + +## Secrets accidentally committed + +If you discover a committed credential, assume the credential is compromised even if the commit is later removed. Report it privately so the credential can be revoked/rotated and repository history can be assessed. diff --git a/SUPPORT.md b/SUPPORT.md new file mode 100644 index 00000000..facbab8f --- /dev/null +++ b/SUPPORT.md @@ -0,0 +1,35 @@ +# Support + +Use the channel that matches your request so it reaches the right workflow. + +## Bugs + +Open a **Bug report** from the repository’s Issues page and include reproducible steps, environment information, and screenshots/logs when useful. + +https://github.com/zexy2/postify/issues/new/choose + +## Feature requests + +Use the **Feature request** issue form. Describe the user problem first, then the smallest useful solution and how success should be measured. + +https://github.com/zexy2/postify/issues/new/choose + +## Security vulnerabilities + +Do **not** open a public issue with vulnerability details. Use GitHub private vulnerability reporting from the repository Security tab and follow [SECURITY.md](SECURITY.md). + +https://github.com/zexy2/postify/security + +## Questions and open-ended ideas + +For implementation questions, contribution help, or ideas that are not yet scoped work, use [GitHub Discussions](https://github.com/zexy2/postify/discussions). Start with [CONTRIBUTING.md](CONTRIBUTING.md) for the local workflow. + +Use Issues when the conversation has become a reproducible bug or a concrete, actionable feature request. + +## Production + +Current production application: + +https://postify.zekiakgul.dev/ + +Postify is an open-source project and does not currently promise a commercial support SLA. Reports that include clear reproduction evidence are much easier to investigate. diff --git a/design/ABOUT-CONTACT-PHASED-PUBLIC-RELEASE-2026-10-19.md b/design/ABOUT-CONTACT-PHASED-PUBLIC-RELEASE-2026-10-19.md new file mode 100644 index 00000000..dbddb864 --- /dev/null +++ b/design/ABOUT-CONTACT-PHASED-PUBLIC-RELEASE-2026-10-19.md @@ -0,0 +1,41 @@ +# Postify — staged public release, About + Contact only (2026-10-19) + +## Owner permission and scope + +Owner approved the actual PL-01 About and Contact v3 screens and requested a gradual production launch on 2026-10-19. This owner approval supersedes the earlier prohibition on preparing a deployment **for these two public read-only pages only**. It is not permission to silently change the rest of the 85-commit redesign worktree, apply production database migrations, enable unreleased authenticated Knowledge write flows, or publish an unverified branch. + +Main production source at kickoff: `cba2c8652ca61d1dc559368e17a506061e0d4e95`; the user's original UI development branch latest approved `0a36a5e` contains 85 unmerged commits, and **must not be merged directly**. This package uses independent worktree `postify-rollout-pl01-20261019` with branch `rollout/about-contact-pl01-20261019` created from unchanged main. Published live `release.json` initially matched `cba2c86`. No public deploy is implied by a local test, branch push or PR. + +## Slice design isolation + +- Only `src/pages/AboutPage.{jsx,module.css}` and `src/pages/ContactPage.{jsx,module.css}` are transplanted from actual approved `0a36a5e`, plus their scoped Playwright UI contract and local Fraunces route-use font files with redistributable OFL notice. Current global `src/index.css` remains unchanged; page-root scoped PL-01 variables preserve approved `#F4EFE6` paper, `#151B19` dark, `#A13826` oxide and `#F2AC91` coral without recoloring other product routes. +- Source is real bilingual React with genuine direct `mailto:` and GitHub links. No fake form, made-up submission, auth bypass, added user tracking or database writes. +- Security prerequisite on current main npm lock discovered **eight high-severity vulnerabilities**: brace-expansion, fast-uri, source-map-js and transitive `gh-pages/globby/fast-glob/micromatch/braces`. Pin CLI-only `gh-pages` dev dependency to available safe `6.1.1` and apply compatible transitive lock updates. Exact rebuilt `npm run verify:security` must report zero. CI website deployment uses `peaceiris/actions-gh-pages`, not this CLI; no behavior change to deployed runtime intended. Both package.json and lock file are part of this scoped release security adjustment. + +## Required real checks before main publication + +- Full Node24 verify (knowledge, real current-main Vitest, ESLint, build, 11-artifact smoke), security npm audit; real Chromium product test on exact built source; About/Contact light/dark 320,390,768,1440 viewport semantics; keyboard focus/anchors, contact link 44px and localized Turkish; no horizontal overflow/console errors. +- Full visual snapshot suite **must pass** without unrelated drift; only update individual About/Contact light/dark 390/1440 baseline shots following explicit design approval and inspection. Do NOT automatically accept unrelated screenshot changes, even if baseline snapshots are old. +- Check exact SHA branch CI via GitHub PR, including required Test/Lint/Smoke, Chromium, schema/PostgreSQL RLS, CodeQL, Dependency Review and Docker. A PR push is not a production deployment. Do not manually run `npm run deploy`, migration workflow or GH Pages deploy action. +- Keep `knowledge-backend-status.json` `ready:false` with `supabase-schema-pending` unless real *separate* staging credentials and authenticated users prove actual backend readiness. **No database schema application or staging OAuth/RLS certification** from a local PostgreSQL test. +- Public production first slice must not claim full-site WCAG2.2 AA manual native AT or mobile field CWV green: both remain release program open items. If these gates block main cutover, stop after CI PR until evidence gathered or new explicit scoped risk decision, not override with a fake green. + +## Deploy and rollback boundaries + +- GitHub `main` is protected; branch squash merge after required checks triggers GitHub Pages deploy automatically. Verify `release.json` reflects the merged SHA; production Chromium CI probes exact deployed SHA and machine-readable articles. Read-only smoke `/`, `/about`, `/contact`, static assets, theme, mailto/GitHub and capability JSON; never test protected writes on production. +- On new regression, halt merge if not yet merged; after a verified deployment, revert the **one scoped release commit** in a new reviewable PR and let same protected CI/Pages pipeline republish, then compare `release.json` to reverted SHA. This is a **frontend-only rollback**, not database rollback. No force-push or direct write to protected main. + +## Verified isolated release evidence, 2026-10-19 + +- Main-based scoped branch first source commit c944897, no changes to unrelated 85-commit redesign branch. Node24 exact-source npm ci, npm run verify (161/161 Vitest, lint, build, 11-artifact smoke), npm run verify:security (0 vulnerabilities), PL-01 modern route browser contracts 18/18 and compiled-app Chromium 52/52 passed. Evidence job job-fc449802618c exit 0. +- Full deterministic screenshot run showed **47/128 pass, 81/128 fail**. Exactly 8 are About/Contact owner-approved v3 layout differences; **73 are other page snapshots** not directly changed in this narrow patch. Underlying Playwright report /tmp/postify-slice-fullvisual-before.json is RED, irrespective of diagnostic wrapper exit 0 (job job-42c8d2159d72). No root cause assumption and no unrelated golden refresh permitted. +- Visual comparison of real About/Contact desktop/mobile output confirmed the scoped approved design is recognizable, with different global navbar/footer remaining on old main design. Exactly eight scoped About/Contact snapshots were refreshed from actual Chromium screenshots. Targeted browser rerun **8/8 PASS**, no skipped or flaky (job job-1d2829e56926 exit 0). All 73 unrelated full-suite issues remain pending, not waived. +- GitHub Draft PR #101: https://github.com/zexy2/postify/pull/101. Required CI and visual investigation still underway. This is not a production publication; protected main and live site unchanged. Do not merge or deploy while visual suite or other release gates remain red. + +## CI-pinned visual reconciliation (critical later evidence) + +- Investigated earlier local-host visual suite which failed 81/128 with 73 unrelated baseline mismatches; on **unmodified main** five comparable samples also failed (file /tmp/postify-main-control-three.json: expected0, unexpected5), proving at least those five were independent of the new pages. Neither host run is valid proof that full official CI must fail. +- Exact GitHub Actions PR #101 run on initial b45d16b ran inside pinned image mcr.microsoft.com/playwright:v1.57.0-noble@sha256:3bed4b1a12f2338642f3d8cba28e291deef3c66bd4a964bbeb3e57bbff511dbd and reported **120/128 passed; exactly 8 About/Contact snapshots failed**. See Actions run 39241616097, Chromium job 118023534650. All 73 unrelated host mismatches **did not reproduce** in official CI. +- Pulled and verified exact immutable Playwright CI Docker image digest locally (901MB), ran eight About/Contact screenshot tests with --update-snapshots inside that same isolated pinned image using no network access: **8/8 PASS** job job-575552b2a5dd, report /tmp/postify-pl01-ci-pinned-evidence/eight-pinned-update.json. Only eight design-approved About/Contact light/dark desktop/mobile screenshot golden assets modified. +- Re-ran the COMPLETE 128 visual tests in the exact pinned Docker image with network isolation and *without updating snapshots*: **128/128 PASS**, zero unexpected/skipped/flaky. Oracle job job-f6e8b2f98e06 exit0, report /tmp/postify-pl01-ci-pinned-evidence/full-pinned-128.json. This is a credible **local CI-parity visual gate**, but the remote GitHub latest-commit run is still authoritative and not yet green until rerun. No other screenshot references updated. +- PR #101 remains DRAFT until its latest remote checks pass and public-slice accessibility/staging and owner release requirements are explicitly evaluated. No production publication yet. diff --git a/design/AWWWARDS-QUALITY-GATES-2026-10-20.md b/design/AWWWARDS-QUALITY-GATES-2026-10-20.md new file mode 100644 index 00000000..6c733ad4 --- /dev/null +++ b/design/AWWWARDS-QUALITY-GATES-2026-10-20.md @@ -0,0 +1,407 @@ +# Postify — Awwwards-level quality gates / 2026-10-20 + +Status: **local internal quality target, not an Awwwards award or jury rating.** Owner requested continuous screenshot → audit → critique → targeted fix → rescreenshot iteration. Production changes remain approval-gated. No paid services. + +## Measurable rubric + +Awwwards-inspired weighting: Design 40%, Usability 30%, Creativity 20%, Content 10% (published Awwwards scores). Internal threshold: **weighted >= 8.5/10**; Design >= 8.5; Usability >= 9.0; Creativity >= 8.0; Content >= 8.0. Scores must be explicitly justified with screenshots and practical evidence: not actual Awwwards jury scores. 0 = unusable/missing; 5 = generic but functional; 7 = deliberate, consistent and polished; 8 = distinct and cohesive across all tested views; 9 = unusually strong and memorable without usability loss; 10 = exemplary original craft under realistic constraints. Do not claim success based on scores alone. + +For each route and light/dark × desktop/mobile, review each 0–10 component: +- Design: (type legibility and hierarchy; grid/whitespace; imagery and art direction; consistency across routes; quality of hover/focus/error/empty states). Mean of five, then cross-route mean. +- Usability: (findability/task success; keyboard focus/order; mobile/touch; legibility/accessibility; stability/performance). Mean, then cross-route mean. +- Creativity: (single explainable idea rooted in 'useful, verified knowledge'; signature moment; restrained choreography with off-switch; originality without interaction ambiguity). Mean of four. +- Content: (real, non-placeholder content; clear prose and CTA; context/evidence surfaced without noise; image/alt relevance). Mean of four. +- Weighted score = .40*D + .30*U + .20*C + .10*Content, no rounding for pass/fail. + +## Non-negotiable functional quality gates + +- UI route matrix: `/`, `/posts/ai-muhendisligi`, `/users/postify`, `/about`, `/contact`, `/auth/login`; light/dark at 390 and 1440 minimum, plus 320/768/1024 responsive sweep. Screenshots **fullPage**, not only viewport. Every visible defect logged, categorized critical/major/minor with before/after evidence. +- Must pass core flows: site navigation, search, topic/content-type filters, article access, bookmarking with expected auth/anonymous behavior, theme switch, dialogs, forms; no uncaught JS errors. Header/keyboard skip links and Escape behavior. No layout overlap, clipped interactive controls or horizontal overflow. +- Aim WCAG 2.2 AA with text contrast >=4.5:1 and large text >=3:1; visible focus, touch target ~44px practical target, keyboard/screen-reader manual testing required before claiming full conformance, respects prefers-reduced-motion. +- Target lab Lighthouse mobile >=90 performance, >=95 accessibility, >=95 SEO, >=90 best practices. Core Web Vitals LCP <=2.5s, CLS <=0.1, INP <=200ms at real-user 75th percentile; **field data unverified until a real dataset exists**. Lab checks are evidence but cannot replace field Core Web Vitals. +- Existing repository test suite and build smoke pass, JS entry budget <=320000 bytes. CSS/motion must not create perf regression. Review loading and empty/error states. +- Award-grade readiness requires no critical or major visual/UX defects across reviewed routes; each category threshold and weighted threshold passed; real owner/human visual review and independent reviewer warranted. Do not claim award or Awwwards rating. + +## Iteration log + +| Iteration | Full-page audit | Observed defects | Change | Verification | Weighted self-score | Status | +|---|---|---|---|---|---|---| +| 0 | 24 full-page images: 6 pages × 1440/390 × light/dark (`round0/`) | mobile 320px overflow; About and Contact visually duplicate; hidden lazy imagery misclassified as broken; originality insufficient | baseline only | initial route scans 24/24 HTTP 200 | **6.36 provisional** (D6.4 / U7.0 / C5.0 / Content7.0) | failed threshold | +| 1 | mobile full-page comparison (`round1/`) | Footer three tiny columns overflowed in Turkish at 320px; banner strong text not wrapping; decorative dither exceeded viewport | wrap status text, constrain dither, mobile footer single-column evidence rows | TR/EN 320/360/390/430/768 screenshot exact viewport width; no horizontal overflow | not separately scored | correction verified | +| 2 | 24 refreshed full-page images (`round2/`) | About / Contact repeated dark covers in light mode; lost theme distinction | About sage paper evidence poster; Contact warm oxide invitation and dark amber variant | 24/24 HTTP 200, 0 visible broken images, no overflow/pageerrors; 8/8 page-theme check; 16/16 basic interaction smoke; full `npm run verify` exit 0 | **6.77 provisional** (D6.9 / U7.5 / C5.3 / Content7.0) | **below 8.5 — continue** | + +| 3 | 24 refreshed full-page images (`round3/`) + actual Chromium hover GIF | Motion absent or generic; article already had a functional reading progress bar so a second CSS bar would be incorrect; floating mobile toolbar obscured reading content | One deliberate masthead arrival, hover-triggered editorial photo inspection sweep, interactive proof-trail card underline; reused/repositioned existing reading-progress bar below header; shortened mobile reading dock with intact 44px controls | `npm run verify` PASS: 163/163 unit tests, lint, build, 13 critical assets and 2 route shells, JS 319999/320000 bytes. Playwright motion/reduced-motion matrix 16/16 after correcting test selector; final home/article UX matrix 24/24. Full-page matrix 24/24 HTTP200/no overflow/no broken visible images/no pageerrors. Hover animation recorded as `postify-photo-inspection.gif`. | **7.00 provisional** (D7.1 / U7.6 / C5.9 / Content7.0) | **below 8.5 — continue** | + +| 4 | 24 full-page views (`round4/`), original artwork PNG/WEBP and 8-case TR/EN theme checks, browser QA gallery | Hero/gallery tech stock photography made verified knowledge feel generic; SEO missing robots.txt and vague CTA; mobile performance missed release gate | Replaced 4 core article covers with Postify-original artwork (AI verification lens, semantic web structure, frontend timing signal, developer pipeline). Kept editable SVG master files in `design/artwork/postify/`, generated 1200/800/480px optimized WebP and preserved image paths/srcsets. Added valid `robots.txt`, changed generic CTA translations. | `npm run verify` EXIT0: 163 unit tests, lint/build, 13 artifact smoke, 2 public route shells, main entry **320000/320000 bytes**. Browser 24/24 full-page routes (390/1440 × light/dark), 8/8 interactive TR/EN asset/link smoke, zero overflow/JS errors/broken visible images. **Mobile Lighthouse local compiled build: performance 71→74, accessibility 100→100, best-practices 100→100, SEO 85→100; LCP still 4.1s**, CLS 0. See `lighthouse-round4*.json`. | **7.40 provisional** (D7.5 / U7.6 / C7.0 / Content7.2) | **below 8.5; performance still fails** | + +| 5 | 24 full-page screenshots (`round5/`), article dock visual comparison, mobile Lighthouse repeat runs | LCP cover not discoverable in initial document; oversized list-card assets; mobile reading dock covered article text; 200%-zoomed long card link escaped viewport | Homepage-only static preload, excluded on About/Contact shells; existing responsive WebP srcsets added to KnowledgeCard without exceeding 320000 JS bytes; scroll-position linked mobile dock becomes hidden and non-tabbable in article reading; long titles wrap inside narrow cards at 200% zoom | `npm run verify` PASS 163 unit + lint/build/assets, entry JS **320000/320000** bytes; 24/24 full-page images no overflow or browser errors, mobile dock 6/6 at 320/390/768 × normal/reduced motion, exact 200%-zoom E2E PASS 1/1, article toast/touch E2E PASS 2/2. **Broader E2E initial run 41/52 PASS, 11 FAIL** (test assumptions from old UI + one real 200% bug; fix proven only by targeted retest, remainder not re-run). Lighthouse mobile preload: P73/67, LCP4.12/4.33s; after responsive cards: P71/70, LCP3.78/3.80s (environment variability, not a controlled causal proof). | **7.50 provisional** (D7.5 / U7.9 / C7.0 / Content7.3) | **below 8.5; release gates still fail** | + +| 6 | 24 full-page captures (`round6/`), explicit before/after of the unaltered image assets, navigation and mobile view | Previous editorial list was essentially a horizontal filter bar plus large picture cards; numbered top nav inaccurately implied a sequence; split feature at 834px feed width caused 6+ line heading, and sticky filter did not actually stick because root `overflow-x:hidden` formed a scroll container | **CSS-only structural redesign**, no image/JS/data changes. Navigation taxonomy without false indices; Home discovery becomes large editorial heading followed by a two-column reading desk: left sticky topic/format/evidence controls and right article stream. Lead story typography takes full reading width, with media stage below. Corrected root overflow to `clip` **scoped to Home**, enabling sticky rail. Tablet/mobile remain responsive single-column. | Full `npm run verify` EXIT0 (163 unit tests, lint, build, asset smoke 13, route shell tests 2, strict 320000-byte JS cap); real Chromium 24/24 TR/EN × light/dark ×320/390/768/1024/1120/1440 image/link/geometry, 56/56 filter/dialog/keyboard/scroll/200%-zoom checks, 4/4 sticky validation, 24/24 six-route full-page screenshots with no overflow, visible broken images or pageerrors. Previous full E2E suite's 11 failures remain open; mobile lab Lighthouse **not repeated** this round. | **7.66 provisional** (D7.8 / U7.9 / C7.2 / Content7.3) | **below 8.5; release gates still fail** | + +| 7 | 24 full-page screenshots (`round7/`), 4 direct article before/after screenshots at mobile/desktop x theme | Article page still resembled stacked rounded SaaS surfaces after Home redesign: huge decorative masthead, overlapping image, extra outcome card; information and reading rhythm were disconnected | **CSS-only structural article redesign**. Newsprint reading surface, serif headline, sober editorial meta and author line, image placed naturally after title (without overlap), outcome as two-column research note separated by rules, cleaned desktop reading-tool rail. Keep full article content, images, existing link/interaction/data untouched. | Full `npm run verify` passed 163 unit + lint/build/13 smoke/2 shell; manual Chromium browser article/dock matrix **28/28** TR/EN x light/dark at 320/390/768/1120/1440, no overlap/JS errors; full-page screenshots **24/24** six routes no overflow, broken visible images or errors. Wider E2E/open performance gates still not certified. | **7.84 provisional** (D8.2 / U8.0 / C7.3 / Content7.5) | **below 8.5; performance and native a11y gates open** | + +| 8 | 24 complete six-route captures (`round8/`); author and login before/after desktop/mobile × light/dark (8 images) | Author portfolio had oversized ornamental P-avatar circle and 3 floating KPI cards dominating useful content. Mobile login presented a long marketing-style preface before the actual form. | **No image/data/JS changes.** Rebuilt author profile with journal-type serif name, editorial colophon glyph, identity and biography first; 3 stats as one integrated ruled strip instead of separate cards; portfolio title in matching editorial typography. Mobile login now uses smaller statement/description and form earlier, removes misleading step numbers on benefits list. | Full `npm run verify` PASS: 163 unit tests, lint, build, 13 assets, 2 route shells. Chromium responsive/locale/theme matrix for author+login **40/40**, plus **4 form/zoom** checks = **44/44** total, correct focus/password toggle. Full-page 24/24 six-route screenshots HTTP200, 0 overflow, JS errors, visible broken images. Focused E2E **4/4 PASS** on a compiled preview: author, EN category/URL and fallback profile, login form, validation/touch; updated two obsolete test selectors for native select and actual visible article result without weakening behavior assertions. | **7.95 provisional** (D8.25 / U8.1 / C7.3 / Content7.6) | **below 8.5; field perf/manual accessibility + broad E2E open** | + +| 9 | 52/52 whole Chromium UI E2E, 24 full-page captures (`round9/`), evidence badge before/after and 10 real touch/click cases | Test runner initially targeted stale generated docs build, misleadingly returning 6/52; fresh compilation restored reliable baseline **41/52**. Nine scenarios asserted old format-button/rail DOM; featured evidence badge was genuinely hidden by generic caption CSS; two long filters timed out because fixed filter sheet was painted underneath adjacent story and header at some scroll positions | Tightened badge CSS so live `Postify verified` remains visible while its *caption* stays hidden; raised actual sticky discovery rail above feed in its own stacking context; migrated nine stale assertions to native combobox values, URL, focus and visible semantic evidence; removed scrollIntoView of an already fixed filter option that changed page behind the overlay | Real compiled-preview Chromium **52/52 PASS** after improvements, targeted nine tests **9/9**, two long tests **2/2**, clickability **10/10** (320/390/960/1304/1440 × latest/verified), visible badge **4/4** (390/1440 × light/dark), full `npm run verify` PASS (163 unit, lint, build 13 critical smoke + two shell tests), 24/24 full-page screenshot baseline no overflow, broken images or page errors. Initial uncompiled 6/52 must not be construed as code regression. | **8.02 provisional** (D8.2 / U8.4 / C7.35 / Content7.6) | **below 8.5; lab perf/manual native a11y still open** | + +| 10 | Four real mobile/desktop light/dark side-by-side article screenshots (`round9` vs `round10`) and 24-page regression capture | At first mobile viewport the bottom-fixed pill of reading controls **covered** the heading of the "before reading" summary despite earlier scroll-linked hiding; real screenshot confirmed visible occlusion, contradicting premium reading intent | Moved the same 4 existing mobile actions **into the article header below the author** and styled them as an integrated 44px keyboard/touch-accessible horizontal editorial toolbar rather than a screen-fixed pill. No artwork, data, auth logic, packages or icon swaps | Fresh compiled Chromium full UI E2E **52/52 PASS**; full `npm run verify` PASS: 163 unit, lint, build, 13 artifact smoke and 2 public shells; **24/24** route snapshots zero JS errors/overflow/broken image; **6/6** inline placement and no heading overlap at 320/390/768 × light/dark; **8/8** bookmark toast non-occlusion at 320/390/568/768 × light/dark. Existing mobile bookmark E2E updated to assert no overlap and inline positioning rather than obsolete fixed-bar directional relation | **8.12 provisional** (D8.2 / U8.65 / C7.35 / Content7.7) | **below 8.5; mobile lab performance and native WCAG tests open** | + +| 11 | 8 actual offline-status before/after crops (Home + article × desktop/mobile × light/dark), 24 full-page route captures, standalone mobile Lighthouse trials and full deterministic E2E | First fold JS/style CPU remained costly; premature menu deferral broke a <250ms first-open quality gate and strict 320000-byte entry (by 13 bytes), while font preload improved FCP in some trials but not LCP or overall mobile score. Real visual mismatch: both Home and fallback article prominently displayed a warning block rather than a quiet editorial service status; menu close hit target was browser-measured 43.99997px vs 44px accessibility minimum | **Reverted both non-beneficial performance experiments** (no lazy sheet and no font preload committed). CSS-only: replaced Home offline notice with two-column hairline editorial service strip, and gave article offline notice its missing styling (text/role="status" preserved); enlarged mobile sheet close target from 44px to 45px. No new images, packages, business logic or backend changes | Final sequential `npm run verify` PASS (163 unit, lint/build, 13 smoke, 2 public shells, 320000B entry), **52/52 full Chromium E2E PASS with one worker**, **24/24** full-page screenshots, **8/8** Home/article offline notice×device×theme visible and nonoverflow. Earlier concurrent broad run 50/52 had borderline 250.8ms menu vs 250ms and 43.99997px vs 44px; latter CSS fix measured safely, no test limits loosened. Standalone baseline mobile Lighthouse P70, LCP3.79s, TBT558ms; subsequent experimental variants P55–70 and LCP3.6–4.3s do **not** demonstrate sustained gain and were reverted. | **8.12 provisional, unchanged** | **below 8.5; mobile Lighthouse, field CWV and native manual WCAG still open** | + +| 12 | Two proper current-production Lighthouse baseline runs; two offscreen containment A/B; two solid-header A/B; 4 real scroll-state navbar before/after crops, route screenshot suite `round12/` | A previous static `docs/` build served obsolete DOM: P83 was **invalid** for current site; current rebuild confirmed Hero `.supportingGrid` and 320000B entry. Current baseline P70/71 and LCP 3.79s. Offscreen `content-visibility` card optimization scored P71–73 and LCP3.53–3.59s but made lower cards blank in full-page capture; not acceptable for visual review and content consistency | **Discarded** offscreen card containment; no image/text/backend/JS edits. On mobile (<=960px) made sticky Header opaque and removed costly live backdrop blur; more legible, deterministic scroll composition. Same semantics, actions, theme colors and navigation retained | Baseline current P70/71 A100 LCP3.792/3.789s TBT555/541ms. Solid header P71/71 A100 LCP3.780/3.783s TBT535/540ms, too small to claim material performance gain; current mobile header geometry passes browser. Final sequential `npm run verify` PASS (163 unit, lint/build, 13 asset checks, 2 route shells, exact 320000B entry), **52/52** Playwright Chromium E2E PASS with one worker, **24/24** full-page screen captures PASS with no overflow/image/page errors; below-feed screenshot edge density preserved after reverting card containment, four 390/768×light/dark navbar before/after captures | **8.12 provisional, unchanged** | **P90/LCP<=2.5s and native WCAG remain open** | + +| 13 | Redesign first home fold as a single magazine opening: source round12 vs new round13, 4 real 390/1440 × light/dark before/after screenshots and 24-route captures | Desktop subtitle was stuck to the top while search+CTAs were bottom-aligned with excessive dead space, visually disconnected from feature. Cover had no clear issue marker, search looked like a rounded UI box. First serial attempt visually collided with the arrow, and adding it in JSX broke strict JS bundle gate by 95 bytes | Pure CSS editorial composition: desktop intro, search and CTAs grouped around cover centre; subtitle scaled for stronger reading hierarchy; squared editorial index-style search field and actions; nested subtle feature frame + outlined `01` issue mark in CSS `::before` (no new JSX, assets or dependency). Move issue mark below action arrow, retain reduced-motion safety and light/dark palettes | Final `npm run verify` PASS 163 unit+lint+build+13 critical asset smoke+2 public shell and JS entry exactly 320000B. Real full Chromium E2E **52/52 PASS**. Fresh full-page all 6 public routes × 2 widths × two themes **24/24 PASS** with no overflow/broken images/JS errors; visual before/after four image panels reviewed | **8.24 internal provisional** (design composition up; not external assessment) | **below 8.5; mobile Lighthouse/LCP and native WCAG still open** | + +| 14 | Editorial feed visual refresh: four genuine round13 vs round14 side-by-sides; 24 full-page six-route screenshots and responsive 10-condition real browser grid matrix | Home showed an impressive lead feature but the next three supporting posts looked like repetitive horizontally sliced spreadsheet rows. Same small square thumbnails and metadata scattered across three tall list rows, especially awkward in desktop reading rail | **No content/image/JS change:** Home `data-showcase=true` supporting stories 02–04 become a three-column publication index for desktop >=1180px, using existing story thumbnails above editorial headlines, intact outcome and factual badges and CTA; first featured and later compact archive span full width. Below 1180px original mobile/tablet cards remain. Designed aligned photo heights, continuous paper card rhythm, type and neutral rules; reduced-motion honoured | Final `npm run verify` PASS 163 unit, lint/build, 13 artifact checks and 2 public shell tests; JS entry exactly 320000B; full Chromium E2E **52/52 PASS** with one worker; **24/24** whole-page screenshot routes across desktop/mobile light/dark PASS zero overflow, broken images and pageerrors; targeted real viewport/theme grid **10/10** (390/768/1060 list; 1180/1440 three tiles) | **8.31 provisional** (subjective internal critique, owner approval pending) | **below 8.5; native WCAG & field/mobile performance open** | + +| 15 | Mobile archive editorial index 05–08; old round14 vs final round15 before/after (TR light/dark), six-page 24 screenshot suite, 52 Chromium UI journeys | After the impressive first featured + three supporting stories, mobile compact archive continued as small repetitive rows: <18px type at 390, a bookmark-only action because "Oku" was hidden, repeated KANIT/GÜNCELLİK labels breaking the fact rail | **Home-only <=620px** compact article list redesigned as left large oxide issue numeral and full-width serif heading; visible 44px real "Oku ↗" navigation and existing 44px bookmark; evidence badge visibly remains with "Yazar test etti · Güncel" and duplicate separate freshness label suppressed (no information loss), reading minutes and context remain; CSS-only decorative arrow removes JS icon and keeps bundle budget. No images/data/backend changes | `npm run verify` PASS: 163 unit + lint/build/13 critical smoke/2 shells; production entry **319998/320000B**, initial version exceeded cap by 45B and was fixed without loosening threshold. Full Chromium **52/52 E2E PASS** single worker; real screenshot suite **24/24 PASS** after restoring a stopped local preview (first failed run discarded). Existing badge and reading link browser verified at widths 320, 390, 620 light/dark; later 768/1440 unaffected | **8.38 provisional** subjective, owner review pending | **below 8.5; mobile Lighthouse/field CWV/native manual WCAG open** | + +| 16 | Editorial closing endpaper, four genuine round15-vs-round16 Home full-page crops (desktop/mobile, light/dark) plus 24 route screenshots | The original closing CTA was a sparse text strip with an undersized lone button beside the long heading. It sat disconnected above the brand, footer directory and existing dot-field wordmark; on mobile it felt like extra copy rather than a closing action. | CSS-only global Footer statement inversion: full-width ink/paper endpaper that reverses naturally with light/dark tokens, larger readable serif typography, paired existing links with proper hit targets, subtle non-interactive circular evidence motif and oxide line. Preserved labels, semantics and destinations, zero new images/JS/backend dependencies. | Final sequential `npm run verify` exit 0: **163/163** Vitest, lint, Vite build, 13 critical smoke assets, 2 public route-shell tests, **319998B <=320000B** entry. Full compiled Chromium **52/52 E2E PASS**. Full **24/24** public route/theme/device screenshot audit PASS, no overflow/visible broken imgs/pageerrors. Separate 320/390/768/1024/1440 × light/dark **10/10** target & computed text-contrast checks: title >=15.77:1, body >=14.45:1, CTA >=5.46:1, 44px minimum hit areas. | **8.38 provisional retained pending owner acceptance** | **<8.5; independent visual review, native WCAG/field CWV/mobile lab still open** | + +Stop only after acceptance criteria met with evidence, or explicitly report remaining failures and resume in next authorized work window. Existing public production must remain unchanged until explicit approval. + +## First two review rounds — evidence and open issues + +Evidence browser (on Oracle host): `http://127.0.0.1:4436/index.html` (local-only quality viewer; choose page, viewport, theme and before/after). Full screenshot PNGs and JSON reports live under `/tmp/postify-awwwards-audit-20261020/{round0,round1,round2}`; copy to protected Oracle evidence directory below. Screenshots are from the local design branch, not current production. + +**Caution about scoring:** D/U/C/Content numbers above are assistant's calibrated editorial impressions, **not** an Awwwards jury decision or quantitative Lighthouse measurements. Usability ratings are low-confidence pending formal WCAG, real device and performance data. No target is certified even if these impressions improve. + +Observed remaining items, ranked: +- **Major:** no single original, utility-driven Postify interaction/art direction distinguishes the product from generic high-quality editorial templates. Creativity below >=8 target; generic tech-photo direction still repeats. +- **Major:** mobile article's persistent reading actions need focused occlusion and keyboard testing; existing responsive screenshot scan alone cannot prove comfort or non-obstruction. +- **Major:** field 75th percentile LCP/CLS/INP unavailable and mobile Lighthouse not yet run. Cannot certify Core Web Vitals or WCAG 2.2 AA from automated screenshots. +- **Moderate:** remaining author/about/contact/login section rhythms, error and empty states, dark theme, and original imagery need another full route-by-route design pass. + +The 24-route matrix is a capture/audit, **not** automatically an Awwwards-level pass. Continue the deliberate loop, hold production release until owner approval. + +References: Awwwards examples [SOTD criteria](https://www.awwwards.com/sites/okkapi-agency); Google [Core Web Vitals](https://web.dev/articles/vitals); W3C [WCAG 2.2](https://www.w3.org/TR/WCAG22/). + +## Round 3: measured motion without JavaScript payload growth + +- **New content:** Homepage masthead composited intro (`transform`/`opacity`), one-shot scan across featured image on mouse or keyboard intent, and compact proof-trail accent on Home discovery card hover/focus. Motion is disabled when `prefers-reduced-motion: reduce`. +- **Existing functionality preserved:** The article already had a `ReadingProgress` component with scroll listener and accessible ARIA `progressbar`; the duplicate scroll-timeline CSS was discovered and removed before delivery. The retained component is repositioned immediately below sticky site header. Its real numeric progress increases on reading scroll. +- **Readability:** Mobile article dock moved closer to safe bottom edge, reducing occluded vertical strip from ~69px to ~49px at 390px, while keeping 44px tap targets and original bookmark/share/back/comments behavior. **Some overlap remains while reading; merits another interaction study** rather than claiming it solved all occlusion. +- **Evidence:** `round3/` 24 full-page PNG screenshots and `postify-photo-inspection.gif` served from local QA viewer `http://127.0.0.1:4436/index.html`. No false promise of a direct sandbox download path. +- **Next primary gaps:** bespoke Postify-specific visual storytelling and original image system, repeated card/section density across routes, full manual WCAG keyboard/screen-reader validation, actual Lighthouse mobile lab report and real-user 75th percentile CWV, production direct-route HTTP 404 on some static deep links. The current 7.00 score remains a *self-evaluation* and release is not authorized. + +## Round 4 — original evidence artwork and first mobile Lighthouse evidence + +- Four original artworks replaced generic photographs on the corresponding editorial posts without modifying post ids/links or product content, with editable SVG masters in `design/artwork/postify/` and optimized WebP versions at the existing image paths in `public/images/posts/` and `responsive/`. Some other post images still need the art direction treatment; do not claim a unified complete visual system. +- Before/after can be seen in the Oracle-hosted local quality gallery `http://127.0.0.1:4436/index.html` (round3 → round4). The gallery includes four source-derived visual examples and full-page screenshots. +- Real Lighthouse mobile lab against **compiled local preview** port 4437, not the dev server: baseline P71/A100/BP100/SEO85 LCP 4.1s, after static robots and descriptive CTA P74/A100/BP100/SEO100 LCP 4.1s. Variation in performance score should not be attributed causally without repeat runs; field p75 INP/LCP/CLS remains unavailable. +- Release-blocking findings: mobile performance 74 < target 90 and LCP 4.1s >2.5s. Audit points to LCP image not discoverable in initial HTML, main-thread JS work, initial CSS/font requests, and oversized images in ordinary cards (the homepage hero uses responsive srcset; standard cards still use full-size webp). Next loop: improve initial asset discovery and responsive card imagery **without harming other routes**, compare several Lighthouse runs, and only then consider further visual enhancements. +- Usability: existing mobile article dock still can cover text during scroll; do not call fully solved. Manual WCAG 2.2 AA, screen-reader and real-device checks not done; Lighthouse 100 accessibility is only automated lab evidence. + +**Rubric scoring disclaimer:** 7.40 is an internal expert-opinion estimate, not an official Awwwards rating or proof of passing the technical gates. Awwwards target not achieved. No push, no deployment or production data writes. + +## Round 5 — mobile performance and distraction-free reading + +- Used static home-only `rel=preload as=image` for the default featured fallback responsive AI cover in `index.html` so Lighthouse's LCP discovery check changes from false to true; exporter removes the image preload from `/about` and `/contact` shells. Caveat: the featured image can vary with remote content and static preloading could become wasteful if the homepage content becomes dynamic. Re-evaluate before deploying the design. +- KnowledgeCard now opts into the existing getResponsiveCoverSrcSet helper; standard mobile thumbnail picks 480px WebP rather than full 1200px, and existing product actions/links retained. Optimized minification inside the card to keep **exact** 320KB JS entry cap. +- Mobile article toolbar no longer overlaps the text during middle/later scrolling in Chromium: CSS scroll animation uses `visibility:hidden` (not just `opacity:0`) to remove invisible toolbar buttons from keyboard traversal, preserving normal initial actions and footer-hidden behavior. Old behavior is retained as a progressive enhancement fallback when CSS scroll timelines unsupported. Under `prefers-reduced-motion:reduce`, visibility changes discretely rather than animating smoothly. Visual comparison is a same-page **simulation of old fixed dock**, not an archived screenshot from the previous commit, versus actual new DOM/CSS. +- Zoom/accessibility: a genuine prior E2E issue where a Node.js card link exceeded 320px at 200% font sizing was fixed with narrow-screen wrapping. Exact prior failing browser test passes on its own. Existing mobile article touch/toast E2E tests also pass. Full suite was NOT green: initial run 41/52, 11 failed, including outdated discovery layout expectations. Record and triage individually in future iteration rather than rewriting tests to rubberstamp new design. +- Lighthouse: synthetic mobile P70–73 remains **below 90** and repeated LCP ~3.8s **above 2.5s**; original 4.1s measurement cannot be treated as a controlled before/after because TBT and environment varied. LCP discoverability now passes, but TBT ~534–570ms suggests main-thread JavaScript cost remains a major concern. Do not claim actual Core Web Vitals improved without field data. +- Evidence gallery `http://127.0.0.1:4436/index.html` defaults to mobile article round4/round5 compare; `round5-mobile-dock-before-after.jpg` and 24 full-page screenshots saved under Oracle local evidence. + +**Next priorities:** performance JS execution strategy/route splitting without breaking entry budget; update obsolete UI tests based on owner-approved new layout while retaining accessibility assertions; test and address remaining broken E2E flows; finish native screen reader and field performance signoff. Never ship production without owner acceptance. + +## Round 6 — structural editorial redesign, not an image swap + +- Owner directly challenged asset-only polish: commit this round changes **exactly three CSS modules** (Header, HomePage, KnowledgeCard) plus this quality note; no new image, font, icon, JS dependency or user data changes. The deliberate structural choice is a sticky editorial research/reading desk with a long-form hero article, rather than SaaS cards or another visual decoration layer. +- Feedback-driven correction inside the round: first CSS pass squeezed featured title to six lines in a narrow half-card; second pass rebuilt it as a full-width typographic introduction over a horizontal image stage. Sticky rail initially failed in Chromium because the existing root `overflow-x: hidden` made BODY/HTML independent scroll containers; Home-scoped `overflow-x: clip; overflow-y: visible` fixed actual sticky behavior without touching other routes. Do not simply assert CSS `position:sticky` works without scroll testing. +- Screenshot comparison in QA gallery: `http://127.0.0.1:4436/index.html` (round5 before vs round6 after, defaults Home desktop light). Explicit inspection captures: `round6-structure-desktop-before-after.jpg` and `round6-structure-mobile-before-after.jpg` with same images/wording. 24 whole-page captures in `round6/`. Test notes: responsive & theme matrix 24/24, user flows 56/56, full verify successful. +- These improvements are substantial in layout, but the independently useful Postify signature interaction is still not mature. Full E2E package last measured 41/52 (11 failures) and manual WCAG 2.2 AA plus mobile Lighthouse 90 and LCP <=2.5s remain gates; do not claim Awwwards jury equivalence. The 7.66 rating is subjective self-assessment, not award evidence. + +**Next loop:** address the remaining broad E2E failures individually, prioritize high-impact first-fold page composition (without simply growing title or changing artwork), improve motion as intentional feedback rather than decoration, performance and native accessibility checks, continue before/after audits. Preserve local-only change scope until owner accepts production deployment. + +## Round 7 — article content-first typographic hierarchy + +- User asked to continue premium UI improvements without simply replacing pictures. Revised PostDetailPage.module.css only: removes round-corner/gradient giant application banner in favor of journal/magazine typography, light/dark tokens, readable metadata and author, uncluttered cover, and a genuine side-label/outcome reading note. **No image asset change, no new JS or font.** +- Browser screen comparisons are in `http://127.0.0.1:4436/index.html` (defaults article, round6→round7); four focused before/after images `round7-article-{1440,390}-{light,dark}-before-after.jpg`. Full-page matrix round7/ captured for six public routes. +- 28/28 custom Chromium article/dock structural checks and full `npm run verify` green. All accessibility/performance and broad end-to-end release gates remain open until separately demonstrated. The internal 7.84 evaluation is subjective, NOT an Awwwards panel rating or certification. +- Subsequent focus: check remaining full E2E failures (last known 41/52), first-fold weight and mobile Lighthouse LCP; address profile/auth route compositions with same seriousness. Production deployment/push not approved. + +## Round 8 — public author folio and task-first sign-in + +- Owner wants substantial structural design, not image swapping. Revised `UserPage.module.css` and `LoginPage.module.css` only: author masthead uses editorial hierarchy, author monogram is a quiet secondary colophon (hidden at narrow mobile), contiguous ruled data metrics instead of KPI cards; profile content appears sooner and content stays unchanged. On login mobile, the service introduction is compact and email/password/submit are visible earlier. The three benefits no longer imply an ordered procedure with 01/02/03. All form authentication logic/fields, labels, validation and link routes remain untouched. +- Before/after: `http://127.0.0.1:4436/index.html`, default author desktop light, previous `round7` vs new `round8`, eight direct `round8-{author,login}-{desktop,mobile}-{light,dark}-before-after.jpg` and 24 full-page route screenshots. +- Focused Playwright suite: initial 3/4 with one test expecting removed chip buttons, then 3/4 because `getByText(...).first()` matched a hidden native `
` disclosure and semantic chapter anchors, with no fixed overlay. +- Added a new compiled Chromium E2E test for native anchor/aria-current, desktop sticky layout and nonoverlapping text, 980px touch targets and mobile disclosure. Captured actual before/after long `node-json-dogrulama` article views at 1440 and 390, preserved under `/home/ubuntu/.oracle-dev/evidence/postify-awwwards/2026-10-21-round20/{before,after}-{desktop,mobile}-atlas.png`. The **before** reference is the previous running local design Vite preview (port4435), not an exact independent compiled Round19 benchmark; no misleading precision claim. A visual review showed the desktop article reading body uses a dedicated column and the new right-hand chapter nav is visibly separate; mobile topography remained unchanged. +- **Final** Node24 `npm run verify` exit0: 163/163 unit, lint, compiled build, 13 critical artifacts, 2 public-shell checks; main JS entry **308451/320000 bytes** (unchanged against Round19). **Final** compiled Chromium E2E **53/53 PASS** including the new test, job `job-35dcbb89bf5d` exit0. Re-captured six routes × mobile390/desktop1440 × light/dark, **24/24** HTTP200, zero visible broken images/JS page errors/overflow/motion contract deviations. Extra **20/20** article geometry checks at 320/390/620/768/780/781/980/1199/1200/1440 × light/dark verified zero overflow, mobile native disclosure, >=44px section links everywhere and desktop >=1200 sticky positioning. +- **Quality still pending:** owner design assessment, manual native screenreader WCAG2.2AA, mobile Lighthouse P>=90/LCP<=2.5s, real field p75 CWV, staging OAuth/negative RLS/storage actor integration. Round19 score variance and internal ~8.38/10 subjective estimate have not been re-scored or certified by any award jury. No global installs, image swaps, package changes, production push or deployment. Continue another actual screenshot-driven functional/typographic critique round after owner preview; preserve worktree and staging gate limitations. + +## Round 21 — discoverable editorial subject index on the Home reading desk + +- Started from clean Round20 `051dec4` in independent worktree `/home/ubuntu/.oracle-dev/worktrees/postify-round21-topic-index-20261021`, without touching the existing Chrome tabs, release branch, or other working copies. Inspected Home UI actual compiled Round20 on port 4488, its HomePage filter mechanics and saved visual evidence; identified a functional hierarchy problem: the large sticky discovery rail at desktop widths devoted its most prominent area to a **closed** native topic select, hiding the useful category taxonomy. +- Replaced only the desktop (>=1060px) *presentation* of that control with an accessible, directly selectable editorial **topic index** (full category names, live archive counts from the same loaded post set as Home, visible active state with `aria-pressed`, existing `onChange`/URL semantics, and no invented statistics). Counts represent whole loaded archive, not filtered intersections; the index's total must equal the sum of subject counts when posts have categories. A bounded 264px internal list preserves access to all subjects while returning screen space to format and advanced-evidence controls. At <1060px the native ` without a
');let i=e.getAttribute("formaction")||s.getAttribute("action");if(n=i?ie(i,t):null,r=e.getAttribute("formmethod")||s.getAttribute("method")||We,a=Je(e.getAttribute("formenctype"))||Je(s.getAttribute("enctype"))||Ke,o=new FormData(s,e),!function(){if(null===Ye)try{new FormData(document.createElement("form"),0),Ye=!1}catch(Ra){Ye=!0}return Ye}()){let{name:t,type:r,value:n}=e;if("image"===r){let e=t?`${t}.`:"";o.append(`${e}x`,"0"),o.append(`${e}y`,"0")}else t&&o.append(t,n)}}else{if(Ve(e))throw new Error('Cannot submit element that is not , - - - -

{title}

- - -
- User {userId} -
- - - ); -} diff --git a/src/components/BentoGrid/PostCardFeatured.jsx b/src/components/BentoGrid/PostCardFeatured.jsx deleted file mode 100644 index 9f471e78..00000000 --- a/src/components/BentoGrid/PostCardFeatured.jsx +++ /dev/null @@ -1,74 +0,0 @@ -/** - * PostCardFeatured - * Large hero-style post card for Bento Grid featured position - */ - -import { Link } from 'react-router-dom'; -import { FiBookmark, FiClock, FiUser } from 'react-icons/fi'; -import styles from './PostCards.module.css'; - -export default function PostCardFeatured({ post, isBookmarked, onBookmarkToggle }) { - const { id, title, body, userId } = post; - - // Linear style: subtle dark gradients only - const gradientIndex = id % 5; - const gradients = [ - 'linear-gradient(135deg, #1a1a1f 0%, #0d0d0f 100%)', - 'linear-gradient(135deg, #18181c 0%, #0f0f12 100%)', - 'linear-gradient(135deg, #1c1c22 0%, #101014 100%)', - 'linear-gradient(135deg, #191920 0%, #0e0e11 100%)', - 'linear-gradient(135deg, #1b1b21 0%, #0c0c0e 100%)', - ]; - - return ( -
- {/* Background gradient */} -
- - {/* Overlay for text readability */} -
- - {/* Content */} -
-
- - - User {userId} - - - - 5 min read - -
- - -

{title}

- - -

- {body.length > 200 ? `${body.substring(0, 200)}...` : body} -

- -
- - Read Article - - - - - - -
-
-
- ); -} diff --git a/src/components/BentoGrid/PostCardMedium.jsx b/src/components/BentoGrid/PostCardMedium.jsx deleted file mode 100644 index 8f8b4c72..00000000 --- a/src/components/BentoGrid/PostCardMedium.jsx +++ /dev/null @@ -1,49 +0,0 @@ -/** - * PostCardMedium - * Standard-sized post card for Bento Grid - */ - -import { Link } from 'react-router-dom'; -import { FiBookmark, FiClock } from 'react-icons/fi'; -import styles from './PostCards.module.css'; - -export default function PostCardMedium({ post, isBookmarked, onBookmarkToggle }) { - const { id, title, body, userId } = post; - - return ( -
- {/* Accent line */} -
- -
-
- User {userId} - • - 3 min -
- - -

{title}

- - -

- {body.length > 100 ? `${body.substring(0, 100)}...` : body} -

- -
- - Read more → - - - -
-
-
- ); -} diff --git a/src/components/BentoGrid/PostCards.module.css b/src/components/BentoGrid/PostCards.module.css deleted file mode 100644 index b7ecb547..00000000 --- a/src/components/BentoGrid/PostCards.module.css +++ /dev/null @@ -1,369 +0,0 @@ -/** - * PostCards Shared Styles - * Styles for Featured, Medium, and Compact card variants - */ - -/* Base Card - Linear Style */ -.card { - position: relative; - height: 100%; - display: flex; - flex-direction: column; - background: var(--bg-secondary); - border-radius: var(--radius-xl); - overflow: visible; -} - -.titleLink { - text-decoration: none; - color: inherit; -} - -.titleLink:hover h2, -.titleLink:hover h3, -.titleLink:hover h4 { - color: var(--text-primary); - opacity: 0.8; -} - -/* ============================================ - FEATURED CARD STYLES - ============================================ */ - -.featured { - position: relative; -} - -.featuredBackground { - position: absolute; - inset: 0; - z-index: 0; -} - -.featuredOverlay { - position: absolute; - inset: 0; - background: linear-gradient( - 180deg, - rgba(0, 0, 0, 0) 0%, - rgba(0, 0, 0, 0.3) 50%, - rgba(0, 0, 0, 0.85) 100% - ); - z-index: 1; -} - -.featuredContent { - position: relative; - z-index: 2; - display: flex; - flex-direction: column; - justify-content: flex-end; - height: 100%; - padding: var(--space-2xl); - color: #ffffff; -} - -.meta { - display: flex; - gap: var(--space-md); - margin-bottom: var(--space-md); -} - -.metaItem { - display: flex; - align-items: center; - gap: var(--space-xs); - font-size: var(--text-sm); - opacity: 0.8; -} - -.featuredTitle { - font-family: var(--font-display); - font-size: var(--text-3xl); - font-weight: 700; - line-height: 1.2; - margin-bottom: var(--space-md); - text-transform: capitalize; - transition: color var(--transition-fast); -} - -.featuredExcerpt { - font-size: var(--text-base); - line-height: 1.6; - opacity: 0.85; - margin-bottom: var(--space-xl); - max-width: 500px; -} - -.actions { - display: flex; - align-items: center; - justify-content: space-between; -} - -.readMore { - display: inline-flex; - align-items: center; - gap: var(--space-sm); - padding: var(--space-sm) var(--space-lg); - background: rgba(255, 255, 255, 0.15); - backdrop-filter: blur(10px); - border-radius: var(--radius-full); - color: #ffffff; - font-weight: 500; - text-decoration: none; - transition: all var(--transition-fast); -} - -.readMore:hover { - background: rgba(255, 255, 255, 0.25); - transform: translateX(4px); -} - -.readMore svg { - transition: transform var(--transition-fast); -} - -.readMore:hover svg { - transform: translateX(4px); -} - -/* ============================================ - MEDIUM CARD STYLES - ============================================ */ - -.medium { - background: var(--bg-secondary); -} - -.accentLine { - position: absolute; - top: 0; - left: 0; - right: 0; - height: 1px; - background: rgba(255, 255, 255, 0.2); - opacity: 0; - transition: opacity var(--transition-fast); -} - -.medium:hover .accentLine { - opacity: 1; -} - -.mediumContent { - display: flex; - flex-direction: column; - height: 100%; - padding: var(--space-xl); -} - -.metaSmall { - display: flex; - align-items: center; - gap: var(--space-xs); - font-size: var(--text-xs); - color: var(--text-muted); - margin-bottom: var(--space-md); -} - -.dot { - opacity: 0.5; -} - -.mediumTitle { - font-family: var(--font-display); - font-size: var(--text-xl); - font-weight: 600; - line-height: 1.3; - color: var(--text-primary); - text-transform: capitalize; - margin-bottom: var(--space-md); - transition: color var(--transition-fast); - flex-grow: 0; -} - -.mediumExcerpt { - font-size: var(--text-sm); - color: var(--text-secondary); - line-height: 1.6; - flex-grow: 1; -} - -.footer { - display: flex; - align-items: center; - justify-content: space-between; - margin-top: var(--space-lg); - padding-top: var(--space-md); - border-top: 1px solid var(--border-color); -} - -.readLink { - font-size: var(--text-sm); - font-weight: 500; - color: var(--text-secondary); - text-decoration: none; - transition: color var(--transition-fast); -} - -.readLink:hover { - color: var(--text-primary); -} - -/* ============================================ - COMPACT CARD STYLES - ============================================ */ - -.compact { - background: var(--bg-secondary); -} - -.compactContent { - display: flex; - flex-direction: column; - height: 100%; - padding: var(--space-lg); -} - -.compactHeader { - display: flex; - align-items: center; - justify-content: space-between; - margin-bottom: var(--space-md); -} - -.tag { - font-family: var(--font-mono); - font-size: var(--text-xs); - text-transform: uppercase; - letter-spacing: 0.05em; - padding: var(--space-xs) var(--space-sm); - background: rgba(255, 255, 255, 0.06); - color: var(--text-secondary); - border-radius: var(--radius-sm); - font-weight: 500; - border: 1px solid rgba(255, 255, 255, 0.08); -} - -[data-theme='dark'] .tag { - background: rgba(255, 255, 255, 0.04); - color: var(--text-secondary); -} - -.compactTitle { - font-family: var(--font-display); - font-size: var(--text-lg); - font-weight: 600; - line-height: 1.4; - color: var(--text-primary); - text-transform: capitalize; - transition: color var(--transition-fast); - flex-grow: 1; - display: -webkit-box; - -webkit-line-clamp: 3; - line-clamp: 3; - -webkit-box-orient: vertical; - overflow: hidden; -} - -.compactFooter { - margin-top: auto; - padding-top: var(--space-md); -} - -.author { - font-size: var(--text-xs); - color: var(--text-muted); -} - -/* ============================================ - BOOKMARK BUTTON STYLES - ============================================ */ - -.bookmarkBtn { - display: flex; - align-items: center; - justify-content: center; - width: 40px; - height: 40px; - background: rgba(255, 255, 255, 0.1); - backdrop-filter: blur(10px); - border: 1px solid rgba(255, 255, 255, 0.1); - border-radius: var(--radius-full); - color: rgba(255, 255, 255, 0.8); - cursor: pointer; - transition: all var(--transition-fast); -} - -.bookmarkBtn.small { - width: 32px; - height: 32px; - background: var(--bg-tertiary); - border-color: var(--border-color); - color: var(--text-muted); -} - -.bookmarkBtn.tiny { - width: 28px; - height: 28px; - background: transparent; - border: none; - color: var(--text-muted); -} - -.bookmarkBtn:hover { - background: rgba(255, 255, 255, 0.2); - color: #ffffff; - transform: scale(1.05); -} - -.bookmarkBtn.small:hover, -.bookmarkBtn.tiny:hover { - background: var(--primary-light); - color: var(--primary); -} - -.bookmarkBtn.bookmarked { - background: var(--primary); - color: #ffffff; - border-color: var(--primary); -} - -.bookmarkBtn.bookmarked svg { - fill: currentColor; -} - -/* ============================================ - RESPONSIVE STYLES - ============================================ */ - -@media (max-width: 768px) { - .featuredContent { - padding: var(--space-xl); - } - - .featuredTitle { - font-size: var(--text-2xl); - } - - .featuredExcerpt { - font-size: var(--text-sm); - } - - .mediumTitle { - font-size: var(--text-lg); - } -} - -/* Reduced motion */ -@media (prefers-reduced-motion: reduce) { - .accentLine, - .readMore, - .bookmarkBtn, - .titleLink h2, - .titleLink h3, - .titleLink h4 { - transition: none; - } -} diff --git a/src/components/BentoGrid/index.js b/src/components/BentoGrid/index.js deleted file mode 100644 index d1ba7a3a..00000000 --- a/src/components/BentoGrid/index.js +++ /dev/null @@ -1,4 +0,0 @@ -export { default } from "./BentoGrid"; -export { default as PostCardFeatured } from "./PostCardFeatured"; -export { default as PostCardMedium } from "./PostCardMedium"; -export { default as PostCardCompact } from "./PostCardCompact"; diff --git a/src/components/BookmarkButton/BookmarkButton.jsx b/src/components/BookmarkButton/BookmarkButton.jsx deleted file mode 100644 index ff135f81..00000000 --- a/src/components/BookmarkButton/BookmarkButton.jsx +++ /dev/null @@ -1,42 +0,0 @@ -/** - * BookmarkButton Component - * Reusable bookmark toggle button - */ - -import React from 'react'; -import { useTranslation } from 'react-i18next'; -import { FiBookmark } from 'react-icons/fi'; -import { useBookmarks } from '../../hooks/useBookmarks'; -import styles from './BookmarkButton.module.css'; - -const BookmarkButton = ({ post, size = 'medium', showText = false }) => { - const { t } = useTranslation(); - const { isBookmarked, toggle } = useBookmarks(); - const isActive = isBookmarked(post.id); - - const handleClick = (e) => { - e.preventDefault(); - e.stopPropagation(); - toggle(post.id, post); - }; - - const sizeClass = styles[size] || styles.medium; - - return ( - - ); -}; - -export default BookmarkButton; diff --git a/src/components/BookmarkButton/BookmarkButton.module.css b/src/components/BookmarkButton/BookmarkButton.module.css deleted file mode 100644 index 006cc0f4..00000000 --- a/src/components/BookmarkButton/BookmarkButton.module.css +++ /dev/null @@ -1,214 +0,0 @@ -/** - * BookmarkButton - Modern Bookmark UI (2025) - * Animated toggle with micro-interactions - */ - -.button { - display: inline-flex; - align-items: center; - justify-content: center; - gap: var(--space-sm); - background: var(--bg-secondary); - border: 2px solid var(--border-color); - border-radius: var(--radius-lg); - color: var(--text-secondary); - cursor: pointer; - transition: all var(--transition-fast); - font-weight: 600; - position: relative; - overflow: hidden; -} - -.button::before { - content: ''; - position: absolute; - inset: 0; - background: var(--gradient-secondary); - opacity: 0; - transition: opacity var(--transition-fast); -} - -.button:hover { - border-color: var(--secondary); - color: var(--secondary); - transform: translateY(-2px); - box-shadow: var(--shadow-md); -} - -.button:active { - transform: translateY(0); -} - -/* Active State */ -.button.active { - background: var(--gradient-secondary); - border-color: transparent; - color: white; - box-shadow: 0 4px 16px rgba(139, 92, 246, 0.4); -} - -.button.active:hover { - box-shadow: 0 6px 20px rgba(139, 92, 246, 0.5); -} - -.button.active .icon { - animation: pop 0.3s ease; -} - -@keyframes pop { - 0% { transform: scale(1); } - 50% { transform: scale(1.3); } - 100% { transform: scale(1); } -} - -/* Icon */ -.icon { - display: flex; - align-items: center; - justify-content: center; - transition: transform var(--transition-fast); - position: relative; - z-index: 1; -} - -.button:hover .icon { - transform: scale(1.1); -} - -.button.active .icon svg { - fill: currentColor; -} - -/* Sizes */ -.small { - padding: var(--space-xs) var(--space-sm); - font-size: var(--text-sm); - border-radius: var(--radius-md); -} - -.small .icon svg { - width: 14px; - height: 14px; -} - -.medium { - padding: var(--space-sm) var(--space-md); - font-size: var(--text-sm); -} - -.medium .icon svg { - width: 18px; - height: 18px; -} - -.large { - padding: var(--space-md) var(--space-lg); - font-size: var(--text-base); -} - -.large .icon svg { - width: 22px; - height: 22px; -} - -/* Icon Only Variant */ -.iconOnly { - padding: var(--space-sm); - border-radius: var(--radius-full); -} - -.iconOnly.small { - padding: var(--space-xs); - width: 32px; - height: 32px; -} - -.iconOnly.medium { - width: 40px; - height: 40px; -} - -.iconOnly.large { - width: 48px; - height: 48px; -} - -/* Text Label */ -.text { - position: relative; - z-index: 1; -} - -/* Count Badge */ -.count { - display: inline-flex; - align-items: center; - justify-content: center; - min-width: 20px; - height: 20px; - padding: 0 6px; - background: var(--bg-tertiary); - border-radius: var(--radius-full); - font-size: var(--text-xs); - font-weight: 700; - margin-left: var(--space-xs); - position: relative; - z-index: 1; -} - -.button.active .count { - background: rgba(255, 255, 255, 0.2); -} - -/* Loading State */ -.loading { - opacity: 0.7; - cursor: not-allowed; -} - -.loading .icon svg { - animation: spin 1s linear infinite; -} - -@keyframes spin { - to { transform: rotate(360deg); } -} - -/* Tooltip */ -.tooltip { - position: absolute; - bottom: 100%; - left: 50%; - transform: translateX(-50%) translateY(-8px); - padding: var(--space-xs) var(--space-sm); - background: var(--bg-tertiary); - color: var(--text-primary); - font-size: var(--text-xs); - font-weight: 600; - white-space: nowrap; - border-radius: var(--radius-md); - opacity: 0; - visibility: hidden; - transition: all var(--transition-fast); - box-shadow: var(--shadow-md); - pointer-events: none; -} - -.button:hover .tooltip { - opacity: 1; - visibility: visible; - transform: translateX(-50%) translateY(-4px); -} - -/* Responsive */ -@media (max-width: 640px) { - .large { - padding: var(--space-sm) var(--space-md); - font-size: var(--text-sm); - } - - .large .icon svg { - width: 18px; - height: 18px; - } -} diff --git a/src/components/BookmarkButton/index.js b/src/components/BookmarkButton/index.js deleted file mode 100644 index df801fdf..00000000 --- a/src/components/BookmarkButton/index.js +++ /dev/null @@ -1 +0,0 @@ -export { default } from './BookmarkButton'; diff --git a/src/components/BrandMark/BrandMark.jsx b/src/components/BrandMark/BrandMark.jsx new file mode 100644 index 00000000..a1606cf9 --- /dev/null +++ b/src/components/BrandMark/BrandMark.jsx @@ -0,0 +1,19 @@ +import styles from './BrandMark.module.css'; + +// Proof seal: a stamped disc whose "P" closes with a check stroke. +const BrandMark = ({ size = 'md', className = '' }) => ( + +); + +export default BrandMark; diff --git a/src/components/BrandMark/BrandMark.module.css b/src/components/BrandMark/BrandMark.module.css new file mode 100644 index 00000000..6809f996 --- /dev/null +++ b/src/components/BrandMark/BrandMark.module.css @@ -0,0 +1,33 @@ +.mark { + display: block; + flex: 0 0 auto; + overflow: visible; +} + +.sm { width: 1.375rem; height: 1.375rem; } +.md { width: 1.875rem; height: 1.875rem; } +.lg { width: 3rem; height: 3rem; } + +.seal { fill: var(--text-primary); } +.letter { fill: var(--bg-primary); } + +.tick { + fill: none; + stroke: var(--primary); + stroke-width: 2.6; + stroke-linecap: round; + stroke-linejoin: round; + stroke-dasharray: 12; + stroke-dashoffset: 0; +} + +@media (hover: hover) and (prefers-reduced-motion: no-preference) { + a:hover > .mark .tick { + animation: restamp 520ms var(--ease-out); + } +} + +@keyframes restamp { + from { stroke-dashoffset: 12; } + to { stroke-dashoffset: 0; } +} diff --git a/src/components/BrandMark/index.js b/src/components/BrandMark/index.js new file mode 100644 index 00000000..5a17d536 --- /dev/null +++ b/src/components/BrandMark/index.js @@ -0,0 +1 @@ +export { default } from './BrandMark'; diff --git a/src/components/Button/Button.jsx b/src/components/Button/Button.jsx deleted file mode 100644 index 47e2e8bc..00000000 --- a/src/components/Button/Button.jsx +++ /dev/null @@ -1,20 +0,0 @@ -import styles from "./Button.module.css"; -import { Link } from "react-router-dom"; - -const Button = ({ children, to, onClick, ...props }) => { - if (to) { - return ( - - {children} - - ); - } - - return ( - - ); -}; - -export default Button; diff --git a/src/components/Button/Button.module.css b/src/components/Button/Button.module.css deleted file mode 100644 index 8c17f6da..00000000 --- a/src/components/Button/Button.module.css +++ /dev/null @@ -1,185 +0,0 @@ -/** - * Button Styles - Modern Design with Micro-interactions - */ - -.button { - display: inline-flex; - align-items: center; - justify-content: center; - gap: var(--space-sm); - font-family: var(--font-sans); - font-weight: 600; - line-height: 1.5; - text-decoration: none; - border: none; - border-radius: var(--radius-md); - cursor: pointer; - transition: all var(--transition-fast); - white-space: nowrap; - user-select: none; - position: relative; - overflow: hidden; -} - -/* Ripple Effect */ -.button::after { - content: ''; - position: absolute; - inset: 0; - background: radial-gradient(circle, rgba(255,255,255,0.3) 0%, transparent 70%); - opacity: 0; - transform: scale(0); - transition: all var(--transition-base); -} - -.button:active::after { - opacity: 1; - transform: scale(2); - transition: all 0s; -} - -/* Disabled State */ -.button:disabled { - opacity: 0.5; - cursor: not-allowed; - transform: none !important; -} - -/* Sizes */ -.small { - padding: var(--space-sm) var(--space-md); - font-size: var(--text-sm); - border-radius: var(--radius-sm); -} - -.medium { - padding: var(--space-sm) var(--space-lg); - font-size: var(--text-sm); -} - -.large { - padding: var(--space-md) var(--space-xl); - font-size: var(--text-base); - border-radius: var(--radius-lg); -} - -/* Variants - Linear Style */ -.primary { - background: #ffffff; - color: #000000; - box-shadow: none; -} - -.primary:hover:not(:disabled) { - background: #f4f5f8; - transform: translateY(-1px); - box-shadow: none; -} - -.primary:active:not(:disabled) { - transform: translateY(0); -} - -.secondary { - background: transparent; - color: var(--text-primary); - border: 1px solid rgba(255, 255, 255, 0.2); -} - -.secondary:hover:not(:disabled) { - background: rgba(255, 255, 255, 0.05); - border-color: rgba(255, 255, 255, 0.3); - transform: translateY(-1px); -} - -.outline { - background: transparent; - color: var(--text-primary); - border: 1px solid rgba(255, 255, 255, 0.2); -} - -.outline:hover:not(:disabled) { - background: rgba(255, 255, 255, 0.05); - border-color: rgba(255, 255, 255, 0.3); - transform: translateY(-1px); -} - -.ghost { - background: transparent; - color: var(--text-secondary); -} - -.ghost:hover:not(:disabled) { - background: var(--bg-tertiary); - color: var(--text-primary); -} - -.danger { - background: var(--error); - color: white; - box-shadow: none; -} - -.danger:hover:not(:disabled) { - background: #dc2626; - transform: translateY(-1px); -} - -.success { - background: var(--success); - color: white; - box-shadow: none; -} - -.success:hover:not(:disabled) { - background: #059669; - transform: translateY(-1px); -} - -/* Full Width */ -.fullWidth { - width: 100%; -} - -/* Loading State */ -.loading { - position: relative; - color: transparent !important; -} - -.loading::before { - content: ''; - position: absolute; - width: 18px; - height: 18px; - border: 2px solid currentColor; - border-top-color: transparent; - border-radius: 50%; - animation: spin 0.6s linear infinite; -} - -@keyframes spin { - to { - transform: rotate(360deg); - } -} - -/* Icon Only */ -.iconOnly { - padding: var(--space-sm); -} - -.iconOnly.small { - width: 32px; - height: 32px; -} - -.iconOnly.medium { - width: 40px; - height: 40px; -} - -.iconOnly.large { - width: 48px; - height: 48px; -} diff --git a/src/components/CategoryNav/CategoryNav.jsx b/src/components/CategoryNav/CategoryNav.jsx new file mode 100644 index 00000000..c1636fc4 --- /dev/null +++ b/src/components/CategoryNav/CategoryNav.jsx @@ -0,0 +1,53 @@ +import { useTranslation } from 'react-i18next'; +import styles from './CategoryNav.module.css'; +import { getCategoryLabel } from '../../lib/categoryLabels'; + +const CategoryNav = ({ categories, activeCategory, onChange, counts = {} }) => { + const { t, i18n } = useTranslation(); + const isEnglish = i18n.language?.startsWith('en'); + const topics = [{ value: 'all', label: isEnglish ? 'All topics' : 'Tüm konular' }, ...categories.map((category) => ({ + value: category, + label: getCategoryLabel(category, i18n.language), + }))]; + + return ( + + ); +}; + +export default CategoryNav; diff --git a/src/components/CategoryNav/CategoryNav.module.css b/src/components/CategoryNav/CategoryNav.module.css new file mode 100644 index 00000000..0b6b4c7c --- /dev/null +++ b/src/components/CategoryNav/CategoryNav.module.css @@ -0,0 +1,195 @@ +.nav { + display: flex; + align-items: center; + gap: 0.6rem; + min-width: 0; +} + +.label { + color: var(--text-muted); + font-size: 0.875rem; +} + +.selectWrap { + position: relative; + min-width: 0; +} + +.select { + appearance: none; + width: 100%; + min-height: 44px; + padding: 0 2.4rem 0 1rem; + color: var(--text-primary); + font: inherit; + font-size: 0.9375rem; + font-weight: 550; + background: var(--bg-elevated); + border: 1px solid var(--border-strong); + border-radius: var(--radius-full); + cursor: pointer; + transition: border-color var(--transition-fast); +} + +.select:hover { border-color: var(--text-primary); } + +.chevron { + position: absolute; + top: 50%; + right: 1rem; + color: var(--text-muted); + line-height: 0; + transform: translateY(-60%); + pointer-events: none; +} + +.topicIndex { display: none; } + +.indexHeading { + color: var(--text-muted); + font-size: 0.875rem; +} + +.indexList { + display: flex; + flex-wrap: wrap; + gap: 0.4rem; +} + +.indexItem { + display: inline-flex; + align-items: center; + gap: 0.5rem; + min-height: 40px; + padding: 0 0.6rem 0 0.95rem; + color: var(--text-secondary); + font-size: 0.9375rem; + font-weight: 540; + border: 1px solid var(--border-color); + border-radius: var(--radius-full); + transition: color var(--transition-fast), border-color var(--transition-fast), background-color var(--transition-fast); +} + +.indexItem:hover { + color: var(--text-primary); + border-color: var(--border-strong); +} + +.indexCount { + min-width: 1.6rem; + padding: 0.05rem 0.4rem; + color: var(--text-muted); + font-size: 0.75rem; + font-variant-numeric: tabular-nums; + text-align: center; + background: var(--bg-secondary); + border-radius: var(--radius-full); +} + +.active { + color: var(--bg-primary); + background: var(--text-primary); + border-color: var(--text-primary); +} + +.active:hover { color: var(--bg-primary); border-color: var(--text-primary); } + +.active .indexCount { + color: var(--text-primary); + background: var(--bg-primary); +} + +@media (min-width: 1060px) { + .nav > .label, + .nav > .selectWrap { display: none; } + .topicIndex { display: grid; gap: 0.6rem; min-width: 0; } +} + +@media (max-width: 700px) { + .label { display: none; } + .selectWrap { width: 100%; } +} + +.indexItem, +.indexName { min-width: 0; max-width: 100%; overflow-wrap: anywhere; white-space: normal; } + +@media (prefers-reduced-motion: reduce) { + .select, + .indexItem { transition: none; } +} + +/* ── Topic index v2: a typographic line, counts as superscripts ───────── */ +.indexHeading { + font-family: var(--font-mono); + font-size: 0.6875rem; + letter-spacing: 0.14em; + text-transform: uppercase; +} + +.indexList { gap: 0.1rem 1.6rem; } + +.indexItem, +.active, +.active:hover { + position: relative; + align-items: flex-start; + gap: 0.2rem; + min-height: 44px; + padding: 0.35rem 0; + color: var(--text-primary); + font-family: var(--font-display); + font-size: clamp(1.125rem, 1.5vw, 1.5rem); + font-weight: 600; + letter-spacing: -0.02em; + background: none; + border: 0; + border-radius: 0; + transition: color 280ms ease; +} + +/* Underline draws in under the selected topic */ +.indexItem::after { + content: ''; + position: absolute; + left: 0; + right: 0; + bottom: 0.2rem; + height: 2px; + background: var(--primary); + scale: 0 1; + transform-origin: left; + transition: scale 480ms cubic-bezier(0.7, 0, 0.2, 1); +} +.active::after { scale: 1 1; } +.indexItem:hover::after { scale: 1 1; background: var(--text-primary); } +.active:hover::after { background: var(--primary); } + +.indexCount, +.active .indexCount { + min-width: 0; + padding: 0; + color: var(--text-muted); + font-family: var(--font-mono); + font-size: 0.6875rem; + font-weight: 500; + letter-spacing: 0; + line-height: 1.4; + background: none; + border: 0; + border-radius: 0; +} +.active .indexCount { color: var(--primary); } + +/* Others step back while one is pointed at */ +@media (hover: hover) and (pointer: fine) { + .indexList:has(.indexItem:hover) .indexItem:not(:hover) { color: var(--text-muted); } +} + +.indexItem:focus-visible { outline: 2px solid var(--border-focus); outline-offset: 4px; } + +/* Phones keep the native select, in the strip's square language */ +.select { border-radius: 2px; background: transparent; min-height: 48px; font-weight: 600; } + +@media (prefers-reduced-motion: reduce) { + .indexItem::after { transition: none; } +} diff --git a/src/components/CategoryNav/index.js b/src/components/CategoryNav/index.js new file mode 100644 index 00000000..72a554cd --- /dev/null +++ b/src/components/CategoryNav/index.js @@ -0,0 +1 @@ +export { default } from './CategoryNav'; diff --git a/src/components/CodeProof/CodeProof.jsx b/src/components/CodeProof/CodeProof.jsx new file mode 100644 index 00000000..f1d7b872 --- /dev/null +++ b/src/components/CodeProof/CodeProof.jsx @@ -0,0 +1,41 @@ +import { useTranslation } from 'react-i18next'; +import { useAutoVerification } from '../../hooks/useAutoVerification'; +import { getVerificationCheck } from '../../content/verificationManifest'; +import styles from './CodeProof.module.css'; + +const normalize = (value) => String(value || '').replace(/\r\n/g, '\n').trimEnd(); + +/** + * Attaches the published execution record to the exact code block it ran. + * Renders nothing unless the displayed code is byte-identical to the artifact. + */ +export default function CodeProof({ verificationId, code }) { + const { i18n } = useTranslation(); + const en = i18n.language?.startsWith('en'); + const { run, state } = useAutoVerification(verificationId); + const check = verificationId ? getVerificationCheck(verificationId) : null; + if (!run || run.status !== 'passed' || !check || normalize(check.code) !== normalize(code)) return null; + + const current = state.status === 'verified'; + const hashesMatch = Boolean(run.codeSha256) && run.codeSha256 === run.artifactSha256; + + return ( + + ); +} diff --git a/src/components/CodeProof/CodeProof.module.css b/src/components/CodeProof/CodeProof.module.css new file mode 100644 index 00000000..f76549e1 --- /dev/null +++ b/src/components/CodeProof/CodeProof.module.css @@ -0,0 +1,82 @@ +.proof { + --state: var(--state-recheck); + display: flex; + flex-wrap: wrap; + align-items: center; + gap: 8px 14px; + margin: -1.15rem 0 1.75rem; + padding: 12px min(1.25rem, 18px); + color: #e8ebee; + font-family: var(--font-sans); + font-size: 0.875rem; + background: #1d2128; + border: 1px solid rgba(255, 255, 255, 0.06); + border-top: 1px dashed rgba(255, 255, 255, 0.16); + border-radius: 0 0 var(--radius-lg) var(--radius-lg); +} + +.proof[data-current] { --state: var(--state-verified); } + +.command { padding: 0; color: inherit; font-size: 0.8125rem; background: none; } +.command span { opacity: 0.55; } + +.result { + padding: 2px 10px; + color: #fff; + font-family: var(--font-mono); + font-size: 0.8125rem; + background: #2f3be0; + border-radius: var(--radius-full); +} + +.meta { color: #949ca6; } + +.state { + display: inline-flex; + align-items: center; + gap: 6px; + margin-left: auto; + color: #f3f4f1; + font-weight: 600; +} + +.state::before { + content: ''; + width: 8px; + height: 8px; + background: var(--state); + border-radius: 50%; + box-shadow: 0 0 0 3px color-mix(in srgb, var(--state) 30%, transparent); +} + +.proof > * { min-width: 0; max-width: 100%; overflow-wrap: anywhere; } + +@media (max-width: 640px) { .state { margin-left: 0; } } + +/* Seal pressed once as the record scrolls in; colour follows the run state */ +.seal { + flex: none; + width: 1.75rem; + height: 1.75rem; + overflow: visible; + color: var(--state); +} +.seal circle { fill: currentColor; } +.seal path { fill: none; stroke: #fff; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; } +.proof:not([data-current]) .seal circle { fill: none; stroke: currentColor; stroke-width: 2.4; stroke-dasharray: 3.4 3.2; } +.proof:not([data-current]) .seal path { stroke: currentColor; } + +.proof { border-radius: 0 0 4px 4px; } +.result { border-radius: 2px; } + +@media (prefers-reduced-motion: no-preference) { + @supports (animation-timeline: view()) { + .seal { animation: proofPress linear both; animation-timeline: view(); animation-range: entry 60% cover 30%; } + } +} + +@keyframes proofPress { + 0%, 35% { opacity: 0; scale: 2; rotate: -30deg; } + 80% { opacity: 1; scale: 0.88; rotate: 4deg; } + 100% { opacity: 1; scale: 1; rotate: 0deg; } +} diff --git a/src/components/CommandPalette/CommandPalette.jsx b/src/components/CommandPalette/CommandPalette.jsx new file mode 100644 index 00000000..73174adf --- /dev/null +++ b/src/components/CommandPalette/CommandPalette.jsx @@ -0,0 +1,174 @@ +import { useCallback, useEffect, useMemo, useRef, useState } from 'react'; +import { createPortal } from 'react-dom'; +import { useNavigate } from 'react-router-dom'; +import { useTranslation } from 'react-i18next'; +import { FiArrowUpRight, FiCommand, FiSearch, FiX } from 'react-icons/fi'; +import { usePosts } from '../../hooks/usePosts'; +import ContentImage from '../ContentImage/ContentImage'; +import { getCategoryLabel } from '../../lib/categoryLabels'; +import styles from './CommandPalette.module.css'; + +const CommandPalette = ({ open, onClose }) => { + const { t, i18n } = useTranslation(); + const navigate = useNavigate(); + const { posts } = usePosts({ enabled: open }); + const [query, setQuery] = useState(''); + const [activeIndex, setActiveIndex] = useState(0); + const inputRef = useRef(null); + const dialogRef = useRef(null); + const previousFocusRef = useRef(null); + + useEffect(() => { + if (!open) return undefined; + previousFocusRef.current = document.activeElement; + setQuery(''); + setActiveIndex(0); + + const html = document.documentElement; + const body = document.body; + const scrollbarWidth = Math.max(0, window.innerWidth - html.clientWidth); + const previousStyles = { + htmlOverflow: html.style.overflow, + bodyOverflow: body.style.overflow, + bodyPaddingRight: body.style.paddingRight, + }; + + // Keep the document at its current scroll position without shifting . + // A fixed body with a negative top offset also offsets fixed descendants, + // which can push this palette above the viewport when opened after scrolling. + html.style.overflow = 'hidden'; + body.style.overflow = 'hidden'; + if (scrollbarWidth > 0) body.style.paddingRight = `${scrollbarWidth}px`; + + const focusTimer = window.setTimeout(() => inputRef.current?.focus({ preventScroll: true }), 0); + return () => { + window.clearTimeout(focusTimer); + html.style.overflow = previousStyles.htmlOverflow; + body.style.overflow = previousStyles.bodyOverflow; + body.style.paddingRight = previousStyles.bodyPaddingRight; + if (previousFocusRef.current instanceof HTMLElement) previousFocusRef.current.focus({ preventScroll: true }); + }; + }, [open]); + + const results = useMemo(() => { + const normalizedQuery = query.trim().toLocaleLowerCase(i18n.language); + if (!normalizedQuery) return posts.slice(0, 6); + + return posts + .filter((post) => [post.title, post.excerpt, post.category, getCategoryLabel(post.category, i18n.language), post.author?.name] + .filter(Boolean) + .some((field) => field.toLocaleLowerCase(i18n.language).includes(normalizedQuery))) + .slice(0, 6); + }, [i18n.language, posts, query]); + + useEffect(() => setActiveIndex(0), [query]); + + useEffect(() => { + if (!open || !results[activeIndex]) return; + const activeOption = document.getElementById(`command-result-${results[activeIndex].id}`); + activeOption?.scrollIntoView({ block: 'nearest', inline: 'nearest' }); + }, [activeIndex, open, results]); + + const openPost = useCallback((post) => { + navigate(`/posts/${post.slug || post.id}`); + onClose(); + }, [navigate, onClose]); + + useEffect(() => { + if (!open) return undefined; + const handleKeyDown = (event) => { + if (event.key === 'Escape') { + onClose(); + } else if (event.key === 'Tab' && dialogRef.current) { + const focusable = [...dialogRef.current.querySelectorAll('button:not([disabled]):not([tabindex="-1"]), input:not([disabled]):not([tabindex="-1"]), a[href]:not([tabindex="-1"]), [tabindex]:not([tabindex="-1"])')]; + if (focusable.length) { + const first = focusable[0]; + const last = focusable[focusable.length - 1]; + if (event.shiftKey && document.activeElement === first) { event.preventDefault(); last.focus(); } + else if (!event.shiftKey && document.activeElement === last) { event.preventDefault(); first.focus(); } + } + } else if (event.key === 'ArrowDown' && results.length) { + event.preventDefault(); + setActiveIndex((index) => Math.min(index + 1, results.length - 1)); + } else if (event.key === 'ArrowUp' && results.length) { + event.preventDefault(); + setActiveIndex((index) => Math.max(index - 1, 0)); + } else if (event.key === 'Enter' && results[activeIndex]) { + event.preventDefault(); + openPost(results[activeIndex]); + } + }; + document.addEventListener('keydown', handleKeyDown); + return () => document.removeEventListener('keydown', handleKeyDown); + }, [activeIndex, onClose, open, openPost, results]); + + if (!open) return null; + + return createPortal( +
+ +
+ + + +
+ {results.length ? results.map((post, index) => ( + + )) : ( +

{t('common.noResults')}

+ )} +
+
{t('search.navigate')}↵ {t('search.open')}
+ + , + document.body, + ); +}; + +export default CommandPalette; diff --git a/src/components/CommandPalette/CommandPalette.module.css b/src/components/CommandPalette/CommandPalette.module.css new file mode 100644 index 00000000..eed71622 --- /dev/null +++ b/src/components/CommandPalette/CommandPalette.module.css @@ -0,0 +1,57 @@ +.layer { position: fixed; inset: 0; z-index: var(--z-modal); display: grid; place-items: start center; padding: clamp(4.5rem, 12vh, 8rem) 1rem 2rem; } +.backdrop { position: absolute; inset: 0; background: rgba(27, 25, 23, .46); backdrop-filter: blur(4px); } +.dialog { position: relative; width: min(720px, 100%); overflow: hidden; background: var(--bg-elevated); border-top: 2px solid var(--text-primary); border-bottom: 1px solid var(--border-strong); box-shadow: 0 18px 56px rgba(27, 25, 23, .16); animation: commandIn 180ms ease-out both; } +.header, .footer { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 1rem 1.25rem; } +.header { border-bottom: 1px solid var(--border-color); } +.titleGroup { display: flex; align-items: center; gap: .85rem; } +.icon { display: grid; width: 2rem; height: 2rem; place-items: center; color: var(--primary); border-right: 1px solid var(--border-color); } +.title, .hint { margin: 0; } +.title { color: var(--text-primary); font-family: var(--font-display); font-size: var(--text-base); font-weight: 600; letter-spacing: -.015em; } +.hint, .footer { color: var(--text-muted); font-size: var(--text-xs); } +.close { display: grid; width: 40px; height: 40px; place-items: center; color: var(--text-muted); border-bottom: 1px solid var(--border-color); } +.close:hover { color: var(--text-primary); border-color: var(--text-primary); } +.inputWrap { display: flex; align-items: center; gap: .75rem; margin: 1.1rem 1.25rem .8rem; padding: .9rem 0 .8rem; color: var(--primary); border-bottom: 1px solid var(--border-strong); } +.inputWrap:focus-within { border-color: var(--primary); box-shadow: inset 0 -1px 0 var(--primary); } +.inputWrap input { min-width: 0; flex: 1; color: var(--text-primary); background: transparent; border: 0; outline: 0; font: inherit; } +.inputWrap input::placeholder { color: var(--text-muted); } +kbd { padding: .18rem .35rem; color: var(--text-muted); background: var(--bg-elevated); border: 1px solid var(--border-color); border-radius: 4px; font-size: 0.8125rem; } +.results { max-height: min(48vh, 430px); overflow-y: auto; padding: .2rem 1.25rem .7rem; } +.result { display: flex; width: 100%; align-items: center; gap: .9rem; padding: .7rem 0; color: var(--text-primary); border-bottom: 1px solid var(--border-color); text-align: left; } +.result:hover, .result:focus-visible, .resultActive { background: linear-gradient(90deg, var(--primary-subtle), transparent 72%); outline: 0; } +.resultImage { flex: 0 0 3.4rem; width: 3.4rem; height: 2.75rem; overflow: hidden; background: var(--bg-tertiary); border: 1px solid var(--border-color); } +.resultImage img { display: block; width: 100%; height: 100%; object-fit: cover; } +.resultCopy { display: flex; min-width: 0; flex: 1; flex-direction: column; gap: .25rem; } +.resultCopy strong { overflow: hidden; font-family: var(--font-display); font-size: var(--text-sm); font-weight: 600; letter-spacing: -.01em; text-overflow: ellipsis; white-space: nowrap; } +.resultCopy small { color: var(--text-muted); font-size: var(--text-xs); } +.resultArrow { color: var(--text-muted); } +.empty { margin: 0; padding: 2rem 1rem; color: var(--text-muted); text-align: center; } +.footer { border-top: 1px solid var(--border-color); } +.footer span:last-child { display: inline-flex; align-items: center; gap: .35rem; } +@keyframes commandIn { from { opacity: 0; transform: translateY(-8px) scale(.985); } to { opacity: 1; transform: translateY(0) scale(1); } } +@media (prefers-reduced-motion: reduce) { .dialog { animation: none; } } + +@media (max-width: 960px) { + .close { width: 46px; height: 46px; } +} + +@media (max-width: 560px) { + .layer { padding: 4.5rem .75rem 1rem; } + .close { width: 46px; height: 46px; } + .header { padding: .8rem .95rem; } + .inputWrap { margin: .8rem .95rem .65rem; } + .results { padding-inline: .95rem; } + .footer { display: none; } + .results { max-height: min(54vh, 430px); } + .result { min-height: 44px; } + .inputWrap input { min-height: 44px; } +} + +@media (max-width: 560px) and (min-resolution: 1.5dppx) { + .layer { padding-top: 2.5rem; } +} + +@media (max-height: 520px) { + .layer { padding: .75rem 1rem; } + .results { max-height: min(36vh, 160px); } + .footer { display: none; } +} diff --git a/src/components/CommandPalette/index.js b/src/components/CommandPalette/index.js new file mode 100644 index 00000000..67500a99 --- /dev/null +++ b/src/components/CommandPalette/index.js @@ -0,0 +1 @@ +export { default } from './CommandPalette'; diff --git a/src/components/CommentSection/CommentSection.jsx b/src/components/CommentSection/CommentSection.jsx deleted file mode 100644 index b7fe7885..00000000 --- a/src/components/CommentSection/CommentSection.jsx +++ /dev/null @@ -1,248 +0,0 @@ -/** - * Comment Section Component - * - * Displays comments with nested replies - */ - -import { useState } from 'react'; -import { useTranslation } from 'react-i18next'; -import { FaReply, FaEdit, FaTrash, FaHeart, FaRegHeart } from 'react-icons/fa'; -import { useAuth } from '../../hooks/useAuth'; -import { useComments } from '../../hooks/useComments'; -import styles from './CommentSection.module.css'; - -const CommentSection = ({ postId }) => { - const { t } = useTranslation(); - const { user, isAuthenticated } = useAuth(); - const { - comments, - count, - isLoading, - addComment, - updateComment, - deleteComment, - likeComment, - isAdding, - } = useComments(postId); - - const [newComment, setNewComment] = useState(''); - const [replyTo, setReplyTo] = useState(null); - const [editingId, setEditingId] = useState(null); - const [editContent, setEditContent] = useState(''); - - const handleSubmit = async (e) => { - e.preventDefault(); - if (!newComment.trim()) return; - - await addComment(newComment, replyTo); - setNewComment(''); - setReplyTo(null); - }; - - const handleEdit = async (commentId) => { - if (!editContent.trim()) return; - await updateComment(commentId, editContent); - setEditingId(null); - setEditContent(''); - }; - - const handleDelete = async (commentId) => { - if (window.confirm(t('comments.confirmDelete'))) { - await deleteComment(commentId); - } - }; - - const startEdit = (comment) => { - setEditingId(comment.id); - setEditContent(comment.content); - }; - - const cancelEdit = () => { - setEditingId(null); - setEditContent(''); - }; - - const formatDate = (dateString) => { - const date = new Date(dateString); - const now = new Date(); - const diffMs = now - date; - const diffMins = Math.floor(diffMs / 60000); - const diffHours = Math.floor(diffMs / 3600000); - const diffDays = Math.floor(diffMs / 86400000); - - if (diffMins < 1) return t('time.justNow'); - if (diffMins < 60) return t('time.minutesAgo', { count: diffMins }); - if (diffHours < 24) return t('time.hoursAgo', { count: diffHours }); - if (diffDays < 7) return t('time.daysAgo', { count: diffDays }); - return date.toLocaleDateString(); - }; - - const renderComment = (comment, isReply = false) => ( -
- {comment.author?.full_name} - -
-
- {comment.author?.full_name} - @{comment.author?.username} - · - {formatDate(comment.created_at)} - {comment.is_edited && ( - ({t('comments.edited')}) - )} -
- - {editingId === comment.id ? ( -
-