mirror of
https://github.com/luongnv89/claude-howto.git
synced 2026-12-03 02:03:31 +01:00
fix/hook-template-security
7
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
c2f92c8fa7 |
feat(i18n): wire Persian (fa) into tooling and sync to v2.1.316 (#241)
Type: chore ## Summary Follow-up to #208 (Persian translation). It wires `fa/` into the repo tooling the same way #228 did for Korean, and syncs the translation from v2.1.310 to v2.1.316. ## Changes **Tooling** (`feat(i18n)`) - `build_epub.py`: `--lang fa` builds `claude-howto-guide-fa.epub`. - `build_website.py`: `--lang fa`; `fa` is in `EXCLUDE_DIRS`, so Persian pages stay out of the English site. - CI: the EPUB matrix in `test.yml` now includes `fa`. The markdown-rendering docstring and test now list `fa`. - Pre-commit: new `persian-markdown-lint`, `persian-cross-references`, `persian-mermaid` and `persian-link-check` hooks. `persian-mermaid` is added to the offline `SKIP=` lists in `.pre-commit-config.yaml`, `CONTRIBUTING.md` and `CLAUDE.md`. - `scripts/README.md`: usage text updated. - Language switchers: `فارسی` added to `vi/`, `zh/`, `uk/`, `ja/` and `ko/` READMEs and to the landing-page footer. **Translation** (`docs(fa)`) - Applies the English changes from #230 (v2.1.316) to the 15 affected `fa/` files: 192 lines added, 104 removed. - Moves the misplaced `دسترسپذیری (v2.1.310)` Monitor callout in `fa/09-advanced-features/README.md` to the position it has in English. ## Verification | Check | Result | |---|---| | `fa/` line counts, URLs and code-fence positions vs English `main` | identical in all files | | `pre-commit run --all-files`, including the new Persian hooks | pass | | `pytest scripts/tests/` | 198 passed | | ruff, mypy, bandit | clean | | `build_epub.py --lang fa` + `check_epub_diagrams.py` | 61 diagrams, 0 placeholders | | `build_website.py --lang fa` | builds; English site has no `fa/` pages | ## Known limitations (not in this PR) - The EPUB and website templates hard-code `lang="en"` and have no `dir="rtl"`, so Persian pages render left-to-right. Fixing that means passing the language into the HTML templates for every locale. - `fa/.github/` has no `TESTING.md`, `SECURITY_REPORTING.md` or `pull_request_template.md`; the other locales have all three. |
||
|
|
efbe356d08 |
docs(ko): Korean translation synced to v2.1.310 (supersedes #150) (#228)
## Summary Adds a complete Korean translation under `ko/`, synced to **Claude Code v2.1.310** (upstream `b968f42`), and wires Korean into the repo tooling the same way Japanese is. This builds on #150 by @minhee-seo (her original commit is kept, with co-author credit) and addresses every point from your review there: - [x] Version badges/footers now match English (v2.1.310), not v2.1.160 - [x] Permission mode rename `default` → `manual` (v2.1.200) — config values copied exactly where English still shows `default` - [x] `/agents` wizard section removed per v2.1.198 (ask Claude / edit `.claude/agents/` directly) - [x] New content since v2.1.160: `/dataviz`, `${CLAUDE_PROJECT_DIR}`, Sonnet 5 / Opus 5.5 / Fable, 33 hook events, Mods, MCP WebSocket/Tasks, and everything else through v2.1.310 ## What's in it **Translation (`ko/`)** - 90 Markdown files mirroring the English tree, including files #150 was missing or had left in English (`06-hooks/README.md`, `claude_concepts_guide.md`, `CLAUDE.md`, `resources/*`, plugin READMEs) - Every file has `i18n-source` / `i18n-source-sha` / `i18n-date` headers (placed after frontmatter so example SKILL.md/agent files stay valid) for future re-syncs - `ko/TRANSLATION_NOTES.md`: glossary + style guide (합니다체, code/Mermaid kept verbatim, comments translated) - Stale non-Markdown copies from #150 (old scripts/JSON/workflows under `ko/`) removed; docs link to the English originals, as `zh/` does **Tooling** (mirrors the Japanese setup) - `.pre-commit-config.yaml`: `korean-markdown-lint`, `korean-cross-references`, `korean-mermaid`, `korean-link-check` - `build_epub.py` / `build_website.py`: `--lang ko`; `ko` added to the English site's excluded dirs (otherwise Korean pages would leak into the English site) - CI EPUB matrix + markdown-rendering scope include `ko`; `CONTRIBUTING.md` / `CLAUDE.md` SKIP lists updated - `한국어` added to the English and Japanese language switchers ## Verification | Check | Result | |---|---| | Structure vs English (headings, code blocks, Mermaid, table rows, per file) | 90/90 identical | | Non-comment code lines identical to English | 90/90 | | `markdownlint` (whole repo) | 0 issues | | `check_cross_references.py` + cross-file anchor check | pass (3 anchors in `LEARNING-ROADMAP.md` → `README.md` are broken in English too) | | `check_mermaid.py --strict` | 351 blocks rendered | | `check_links.py` | 237 external URLs reachable | | `build_epub.py --lang ko` + `check_epub_diagrams.py` | 54 diagrams, 0 placeholders | | `build_website.py --lang ko` | builds; English site contains no `ko/` pages | | pytest / ruff / mypy / bandit | pass (188 tests) | An independent review pass (separate from the translation pass) checked meaning, omissions, code fidelity and links on the largest modules; its findings are fixed in the last commit. Translation and sync were AI-assisted (Claude Code), following `ko/TRANSLATION_NOTES.md`. Feedback from Korean readers is very welcome. Supersedes #150. --------- Co-authored-by: seominhee <minheee07@gmail.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: Luong NGUYEN <luongnv89@gmail.com> |
||
|
|
0e0115935d |
refactor(scripts): replace Mermaid.js with Pele for diagrams (#197)
* refactor(website): render diagrams with pinned pele bundle (#195) * refactor(ci): validate diagrams with pele and fail when missing (#195) * refactor(epub): render diagrams as flattened pele svg (#195) * docs: document pele diagram rendering and node 20 setup (#195) * test(epub): assert numbered labels reach pele unescaped (#195) * fix(scripts): address review feedback (#195) * fix(website): keep pele zoom controls off diagram labels (#195) Pele (zoom: 'auto') draws an opaque zoom box over the top-right corner of every diagram it shrinks to fit, which hid labels. When that box is shown, div.mermaid now gets top padding so the diagram starts below it. Top room rather than side room: Pele lays diagrams out to the content width, so side padding would shrink them further and re-lay them out. Zoom also makes each shrunk diagram a tab stop, but the SVG had no accessible name. Name every SVG Pele draws after the nearest heading plus its diagram kind ("Architecture - flowchart"). Pele draws a new <svg> on resize and font load, so the name is set in onRender. SVGs named by accTitle keep their own name. * fix(scripts): load the cached pele bundle as ESM on node 20 (#195) pele_render.mjs imports Pele's ES module build, dist/pele.js, which was cached as a bare pele.js with no package.json "type": "module" beside it. Node.js 20.0-20.18 and 22.0-22.6 have no ESM syntax detection, so they load that file as CommonJS and crash on `export`, failing check_mermaid.py and build_epub.py on a supported Node. Cache dist/pele.js as pele.mjs (the same sha256-pinned file) and hand that path to the helper, so every Node.js >= 20 loads it as an ES module. A cache holding only pele.js downloads and verifies pele.mjs once. A test turns off syntax detection to reproduce the old Node behaviour on newer Node. |
||
|
|
4f3fa85d7e |
docs: follow-ups from the v2.1.220 accuracy review (#161)
* fix(ci): move the EPUB build out of pre-commit into CI The build-epub hooks called scripts/build_epub.py, which raises when the mmdc binary is missing, while check_mermaid.py skips with a warning in the same situation. On arm64 — where @mermaid-js/mermaid-cli has no working build — that made 'pre-commit run --all-files' impossible to satisfy for a docs-only change without --no-verify. Remove the build-epub, vietnamese-build-epub and japanese-build-epub hooks and widen the CI build-epub job to a language matrix so PR-time coverage is not reduced: it previously built en only, and now builds en, vi, zh and ja. zh was covered by neither the hooks nor this job, so a broken zh diagram could only surface at release time. Closes #156 * docs: replace the stale Kroki narrative with local mmdc rendering Commit |
||
|
|
3557d791f5 |
feat(scripts): add static website generator from markdown sources (#85) (#121)
* feat(scripts): add static website generator from markdown sources (#85) Generate an elegant, mobile-friendly static site from the existing tutorial markdown files. The markdown remains the single source of truth — `scripts/build_website.py` reads from the same `.md` files the EPUB builder uses, rewrites cross-references to site URLs, and rewrites references to non-markdown repo files (`.json`, `.sh`, `.py`) to GitHub blob URLs so users can jump to the source on github.com. Highlights: - Reuses the chapter ordering convention from `build_epub.py` - Anchor algorithm mirrors `check_cross_references.heading_to_anchor` for parity with the validator - Mermaid renders client-side via `mermaid.js` (no pre-render step) - Tailwind CSS via CDN; light/dark theme toggle; sidebar nav; in-page TOC; prev/next page navigation; mobile responsive - 27 unit + smoke tests covering anchors, link rewriting (including `<source srcset>` inside `<picture>`), Mermaid handling, and a full end-to-end build - GitHub Pages deploy workflow at `.github/workflows/pages.yml` Closes #85 * fix(website): use relative URLs in sidebar nav and avoid INDEX.html collision Two bugs found by local browser dogfooding: 1. **Sidebar nav broke from deep pages.** `build_navigation` emitted raw `output_url` values (site-root-relative) which made every sidebar link 404 from any page below the root. Moved the call inside the per-page render loop so each page gets nav links computed relative to its own URL — `01-slash-commands/index.html` from the root, `../01-slash-commands/...` from a depth-1 page, `../../01-slash-commands/...` from depth-2. 2. **`INDEX.md` overwrote `index.html`.** On case-insensitive filesystems (macOS/Windows), `INDEX.html` and `index.html` are the same file, so `INDEX.md` clobbered the rendered `README.md`. Added `_disambiguate_url` that detects case-insensitive collisions and suffixes the colliding page with its source stem (`INDEX-index.html`). Added 2 tests; full suite stays at 83 passed. * fix(scripts): skip URLs with port in localhost/127.0.0.1 skip list `check_links.is_skipped()` did an exact-match comparison against the host, so `http://localhost:8080` (used in scripts/README.md as a preview example) was not skipped and CI's link check tried to fetch it, which fails on the GitHub runner. Strip the port before comparing. * chore(scripts): drop vestigial mypy ignore_errors for build_website The override silenced all mypy errors for build_website, making the "mypy: clean" claim technically vacuous. Removing it shows mypy is actually clean — 0 issues on build_website after type annotations were added during PR review. * feat(website): self-host Tailwind, Mermaid, and Inter fonts Drop all third-party CDN dependencies from rendered pages. The site previously loaded Tailwind from cdn.tailwindcss.com (Play CDN — JIT compile in browser, marked not-for-production), Mermaid from cdn.jsdelivr.net, and Inter/JetBrains Mono from fonts.googleapis.com. Replace with a vendored toolchain: - scripts/vendor_assets.py downloads the Tailwind standalone CLI (Go binary, no Node toolchain), Mermaid's UMD bundle, and Google Fonts CSS + WOFF2 files. Cached under scripts/.vendor-cache/ (gitignored), refetched only when missing. - Tailwind compiles a per-build site/assets/tailwind.css with only the utility classes actually used by the rendered HTML. - Mermaid and font files land in site/assets/vendor/ and load via relative URLs. - Tailwind config + entry CSS live in scripts/website_templates/ alongside the Jinja template. - build_website grows a skip_vendor flag so the smoke test runs offline. - pre-commit mypy hook gets types-Markdown so it can resolve the same imports as the project venv. Verification: 86/86 pytest pass, ruff/mypy/bandit clean, full build produces a working site with zero external requests (verified in a headless browser — no console errors, no failed network calls, Mermaid diagrams render). * fix(website): use tree URLs for repo directory links (#85) * fix(website): include additional top-level docs (#85) |
||
|
|
58e586f09b |
refactor: Add new V2.0 logo with dark/light mode support to all markdown files
- Update all main markdown files (INDEX.md, LEARNING-ROADMAP.md, QUICK_REFERENCE.md, CONTRIBUTING.md, claude_concepts_guide.md, resources.md) with new responsive picture element - Add logo to all subdirectory README files in feature folders (01-10) and plugins - Replace old markdown image syntax with HTML picture element for dark/light mode adaptation - Logo automatically displays dark mode version when system prefers dark mode - Maintain correct relative paths for all nesting levels (../, ../../, etc.) - Update README.md with new logo syntax All markdown files now use the new V2.0 starburst logo design with professional dark/light mode support. |
||
|
|
540508f392 |
ci: Add DevOps quality assurance with pre-commit hooks and GitHub Actions
- Add pre-commit hooks: Ruff lint/format, Bandit security scan, YAML/TOML validation - Add GitHub Actions CI workflow: lint, security, test, and build jobs - Configure Ruff and Bandit in pyproject.toml - Add pytest test suite for build_epub.py (25 tests) - Fix code issues: exception chaining, httpx timeout, formatting - Add requirements.txt and requirements-dev.txt |