mirror of
https://github.com/luongnv89/claude-howto.git
synced 2026-12-03 02:03:31 +01:00
docs/sync-claude-code-2.1.323
22
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
2fa192d02a |
ci(release): publish a draft naming missing languages when a build fails (#257)
When a language build fails, the release job now publishes a **draft** whose body starts with a note naming the missing languages. Before this change it published a normal **Latest** release that said nothing about the missing languages.
## Behaviour by case
| Case | Result |
|------|--------|
| All 6 builds succeed | Normal, non-draft release, as before: `generate_release_notes: true`, `fail_on_unmatched_files: true`, `draft: false`, empty `body` |
| A build fails (`needs.build.result != 'success'`) and at least one EPUB is missing | `draft: true`. The body starts with a `[!WARNING]` note naming the missing languages and linking the workflow run, followed by the generated release notes |
| A build job fails but all 6 EPUBs are present | `draft: true`. The note says a build job failed although all expected EPUBs are present |
| No EPUB at all | The `Check for missing languages` step fails with `::error::no EPUBs built, nothing to release (build result: <result>)`. Nothing is published |
| A draft for this tag already exists | The `Remove stale drafts for this tag` step deletes it before `Create Release`, so the new release, draft or not, gets a fresh body. This applies to **any** draft for the tag, including one written or edited by hand. Published releases and the tag are never touched |
The missing languages come from comparing `LANGUAGES` with the files in `dist/`. `claude-howto-guide.epub` is `en`, and `claude-howto-guide-<lang>.epub` covers every other language. The steps only read values passed through `env:`, with no `${{ }}` inside the scripts, so the tests below run the same scripts as the workflow.
## Re-running after a partial draft
The natural recovery after a partial draft is **Re-run failed jobs**. Without cleanup, `softprops/action-gh-release@v2` (`3bb1273`) would publish the old draft with its stale "Partial release" note:
- `findTagFromReleases` uses `getReleaseByTag` (`src/github.ts:739`), which only returns published releases, so it gets a 404 and goes down the create path.
- `createRelease` creates a new draft, and then `canonicalizeCreatedRelease` picks the lowest-id draft for the tag (`pickCanonicalRelease`) and deletes the new, asset-less duplicate. The old draft is kept with its old body. The create path never rewrites the body.
- Passing a different `body` doesn't help. It only reaches the new draft, which gets deleted. Even on the update path, an empty body keeps the old one (`src/github.ts:566`: `body = workflowBody || existingReleaseBody`).
So the release job now deletes the drafts for `$GITHUB_REF_NAME` first:
```bash
# shell: bash, i.e. bash --noprofile --norc -eo pipefail
ids=$(gh api --paginate "repos/$GH_REPO/releases?per_page=100" |
jq -r --arg tag "$GITHUB_REF_NAME" '.[] | select(.draft and .tag_name == $tag) | .id')
for id in $ids; do
gh api -X DELETE "repos/$GH_REPO/releases/$id"
done
```
- Releases are deleted **by id**, and only when `draft == true`. `gh release delete <tag>` was not used because it looks the tag up again through `FetchRelease`, which races a published-release lookup against a draft lookup and returns whichever succeeds first (`pkg/cmd/release/shared/fetch.go:183-223` in gh v2.102.0). If a published release and a draft shared the tag, a `view` followed by a `delete` by tag could hit different releases.
- Only the release is deleted. The tag stays.
- The REST list includes drafts only for users with push access ([docs](https://docs.github.com/en/rest/releases/releases#list-releases)). The job has `contents: write` and uses `GH_TOKEN: ${{ github.token }}`. It also sets `GH_REPO`, because the release job doesn't check out the repo.
- The step runs after `check`, so if no EPUB was built, the old draft isn't deleted. It runs on the draft path too, so a re-run that is still partial gets a note with the current missing list.
- If listing the releases fails, the step fails before any delete and nothing is published. This holds because the step sets `shell: bash`. A `run:` step without `shell:` runs as `bash -e {0}`, with no pipefail, so a `gh` failure with nothing on stdout would let `jq` exit 0. The [workflow syntax docs](https://docs.github.com/en/actions/reference/workflows-and-actions/workflow-syntax#jobsjob_idstepsshell) say: "By default, fail-fast behavior is enforced using `set -e` for both `sh` and `bash`. When `shell: bash` is specified, `-o pipefail` is also applied to enforce early exit from pipelines that generate a non-zero exit status." `Check for missing languages` sets `shell: bash` too.
- Every run that gets past the missing-languages check (a full success or a partial build, re-runs included) deletes **any** draft release for the tag, including one a maintainer wrote or edited by hand before pushing the tag or re-running. Save hand-written notes somewhere else first.
- The cleanup only removes drafts. If someone publishes a partial draft by hand, it keeps its "Partial release … saved as a draft" warning until someone edits the body. A later re-run takes the action's update path, which keeps an existing body when `body` is empty (`src/github.ts:566`). To recover, re-run while the release is still a draft, or remove the note when publishing by hand.
- If a tag whose release is already **published** is re-run and a build fails, the release stays published, but its body is replaced by the "saved as a draft" warning. This is rare and harmless; edit the body after a successful re-run.
## Language lists
`LANGUAGES: en vi zh ja ko fa` (top-level `env`) is what the check compares against. The build matrix is the plain `lang: [en, vi, zh, ja, ko, fa]`, because `strategy.matrix` can't read `env`. A comment next to each says to keep it in sync with the other, with `test.yml` build-epub and with `scripts/build_epub.py` `lang_map`. To add a language, edit all four.
Drift between the two lists can't publish a silent Latest:
- A language in the matrix but not in `LANGUAGES` that fails still makes `needs.build.result` `failure`, so the release is a draft. The note is just less specific.
- A language in `LANGUAGES` but not in the matrix is always reported missing, so every tag becomes a draft.
## Action inputs (softprops/action-gh-release v2)
Source: the inputs table in [README.md at `v2`](https://github.com/softprops/action-gh-release/blob/v2/README.md#inputs) and `action.yml` at `v2`, checked on 2026-11-12.
- `draft`: "Keep the release as a draft. Defaults to false."
- `generate_release_notes`: "If body is specified, the body will be pre-pended to the automatically generated notes." This keeps the note above the generated notes, so `append_body` isn't needed. That input only appends to the body of an existing release.
- The `src/util.ts` and `src/github.ts` source at `v2` shows that `draft: false` and an empty `body` act the same as leaving them unset. The action creates a draft, uploads the files, and publishes it unless `input_draft === true`. So a full build behaves as it did before.
## Verification
`release.yml` only runs on tags, so nothing was triggered and no release was touched. The `run:` scripts were taken from the parsed YAML. Each one ran under the command its `shell:` maps to: `bash --noprofile --norc -eo pipefail` for `shell: bash`, and `bash -e` for the old unset `shell:`.
`Check for missing languages` against fake `dist/` dirs:
```text
===== all6 (BUILD_RESULT=success; present: en vi zh ja ko fa) =====
dist/claude-howto-guide-fa.epub
dist/claude-howto-guide-ja.epub
dist/claude-howto-guide-ko.epub
dist/claude-howto-guide-vi.epub
dist/claude-howto-guide-zh.epub
dist/claude-howto-guide.epub
exit=0
--- GITHUB_OUTPUT:
draft=false
note=
===== missing-ja-fa (BUILD_RESULT=failure; present: en vi zh ko) =====
dist/claude-howto-guide-ko.epub
dist/claude-howto-guide-vi.epub
dist/claude-howto-guide-zh.epub
dist/claude-howto-guide.epub
::warning::partial build, publishing a draft (missing: ja fa)
exit=0
--- GITHUB_OUTPUT:
draft=true
note<<EOF_NOTE
> [!WARNING]
> **Partial release.** Missing languages: ja, fa.
> See the [workflow run](https://github.com/OWNER/REPO/actions/runs/1). This release was saved as a draft;
> review it before publishing.
EOF_NOTE
===== only-en (BUILD_RESULT=failure; present: en) =====
dist/claude-howto-guide.epub
::warning::partial build, publishing a draft (missing: vi zh ja ko fa)
exit=0
--- GITHUB_OUTPUT:
draft=true
note<<EOF_NOTE
> [!WARNING]
> **Partial release.** Missing languages: vi, zh, ja, ko, fa.
> See the [workflow run](https://github.com/OWNER/REPO/actions/runs/1). This release was saved as a draft;
> review it before publishing.
EOF_NOTE
===== none (BUILD_RESULT=failure; present: none) =====
::error::no EPUBs built, nothing to release (build result: failure)
exit=1
--- GITHUB_OUTPUT:
===== no-dir (BUILD_RESULT=failure; present: NODIR) =====
::error::no EPUBs built, nothing to release (build result: failure)
exit=1
--- GITHUB_OUTPUT:
===== build-skipped (BUILD_RESULT=skipped; present: NODIR) =====
::error::no EPUBs built, nothing to release (build result: skipped)
exit=1
--- GITHUB_OUTPUT:
===== failure-but-all-present (BUILD_RESULT=failure; present: en vi zh ja ko fa) =====
dist/claude-howto-guide-fa.epub
dist/claude-howto-guide-ja.epub
dist/claude-howto-guide-ko.epub
dist/claude-howto-guide-vi.epub
dist/claude-howto-guide-zh.epub
dist/claude-howto-guide.epub
::warning::build result is failure although all EPUBs are present, publishing a draft
exit=0
--- GITHUB_OUTPUT:
draft=true
note<<EOF_NOTE
> [!WARNING]
> **Draft release.** A build job failed although all expected EPUBs are present.
> See the [workflow run](https://github.com/OWNER/REPO/actions/runs/1). This release was saved as a draft;
> review it before publishing.
EOF_NOTE
===== success-but-ko-missing (BUILD_RESULT=success; present: en vi zh ja fa) =====
dist/claude-howto-guide-fa.epub
dist/claude-howto-guide-ja.epub
dist/claude-howto-guide-vi.epub
dist/claude-howto-guide-zh.epub
dist/claude-howto-guide.epub
::warning::partial build, publishing a draft (missing: ko)
exit=0
--- GITHUB_OUTPUT:
draft=true
note<<EOF_NOTE
> [!WARNING]
> **Partial release.** Missing languages: ko.
> See the [workflow run](https://github.com/OWNER/REPO/actions/runs/1). This release was saved as a draft;
> review it before publishing.
EOF_NOTE
```
`Remove stale drafts for this tag` with a fake `gh` on `PATH`. It serves fixture release pages, one JSON array per page (or one merged array in `merged` mode), and logs every call. It refuses (exit 99) to delete a release that isn't a draft in the fixtures. The fixtures are:
- `other-tag-drafts-*`: page 1 has a `v9.9.8` draft and a `v9.9.9` draft. Page 2 has a `v9.9.9` draft, a `v9.9.9-rc` draft and a published `v9.9.9`.
- `*-json-body`: gh prints a JSON error object on stdout and exits 1, which is what real gh does on an HTTP error.
- `*-empty`: nothing on stdout and exit 1, a transport error.
- `page2-*`: page 1 succeeds and then page 2 fails.
```text
===== no-release [bash -eo pipefail, gh mode: ok] =====
exit=0 deleted ids: []
gh calls:
gh api --paginate repos/OWNER/REPO/releases?per_page=100
===== draft-exists [bash -eo pipefail, gh mode: ok] =====
| Deleting stale draft release 101 for v9.9.9
exit=0 deleted ids: [101]
gh calls:
gh api --paginate repos/OWNER/REPO/releases?per_page=100
gh api -X DELETE repos/OWNER/REPO/releases/101
===== published-exists [bash -eo pipefail, gh mode: ok] =====
exit=0 deleted ids: []
gh calls:
gh api --paginate repos/OWNER/REPO/releases?per_page=100
===== published-and-draft [bash -eo pipefail, gh mode: ok] =====
| Deleting stale draft release 101 for v9.9.9
exit=0 deleted ids: [101]
gh calls:
gh api --paginate repos/OWNER/REPO/releases?per_page=100
gh api -X DELETE repos/OWNER/REPO/releases/101
===== other-tag-drafts-2pages [bash -eo pipefail, gh mode: ok] =====
| Deleting stale draft release 101 for v9.9.9
| Deleting stale draft release 102 for v9.9.9
exit=0 deleted ids: [101,102]
gh calls:
gh api --paginate repos/OWNER/REPO/releases?per_page=100
gh api -X DELETE repos/OWNER/REPO/releases/101
gh api -X DELETE repos/OWNER/REPO/releases/102
===== other-tag-drafts-merged [bash -eo pipefail, gh mode: merged] =====
| Deleting stale draft release 101 for v9.9.9
| Deleting stale draft release 102 for v9.9.9
exit=0 deleted ids: [101,102]
gh calls:
gh api --paginate repos/OWNER/REPO/releases?per_page=100
gh api -X DELETE repos/OWNER/REPO/releases/101
gh api -X DELETE repos/OWNER/REPO/releases/102
===== list-fails-json-body [bash -eo pipefail, gh mode: errjson] =====
| gh: Server Error (HTTP 500)
| jq: error (at <stdin>:1): Cannot index string with string "draft"
exit=5 deleted ids: []
gh calls:
gh api --paginate repos/OWNER/REPO/releases?per_page=100
===== list-fails-empty-stdout [bash -eo pipefail, gh mode: empty] =====
| gh: connection reset by peer
exit=1 deleted ids: []
gh calls:
gh api --paginate repos/OWNER/REPO/releases?per_page=100
===== page2-fails-json-body [bash -eo pipefail, gh mode: p2err] =====
| gh: HTTP 500
| jq: error (at <stdin>:2): Cannot index string with string "draft"
exit=5 deleted ids: []
gh calls:
gh api --paginate repos/OWNER/REPO/releases?per_page=100
===== page2-fails-empty [bash -eo pipefail, gh mode: p2empty] =====
| gh: connection reset by peer
exit=1 deleted ids: []
gh calls:
gh api --paginate repos/OWNER/REPO/releases?per_page=100
```
For contrast, the intermediate version of this step at `41ab1e3` (never on `main`), with no `shell:` so it ran as `bash -e`, on the two cases where the result differs. The step passed after the list call failed, and on a page-2 failure it deleted the page-1 draft. The other 8 cases give the same result under both shells.
```text
===== list-fails-empty-stdout [bash -e, gh mode: empty] =====
| gh: connection reset by peer
exit=0 deleted ids: []
gh calls:
gh api --paginate repos/OWNER/REPO/releases
===== page2-fails-empty [bash -e, gh mode: p2empty] =====
| gh: connection reset by peer
| Deleting stale draft release 101 for v9.9.9
exit=0 deleted ids: [101]
gh calls:
gh api --paginate repos/OWNER/REPO/releases
gh api -X DELETE repos/OWNER/REPO/releases/101
```
Other checks:
- The YAML parses. Both release-job `run:` steps have `shell: bash`, and there is no `defaults:` block. `actionlint` 1.7.12 (release binary, checksum verified) with `shellcheck` 0.11.0 reports nothing on `release.yml` (exit 0). A probe workflow confirmed that actionlint does call shellcheck. `shellcheck -s bash` on both extracted scripts exits 0.
- `pre-commit run --files .github/workflows/release.yml` passes. The mermaid hooks were skipped (`SKIP=mermaid,…`) because they don't check `.yml` files.
- The EPUB build was not run.
Closes #254
|
||
|
|
dec30c0897 |
ci(release): publish EPUBs for all six languages (#253)
Extend the `build` matrix in `.github/workflows/release.yml` from `[en, vi, zh]` to `[en, vi, zh, ja, ko, fa]`, the same order as `test.yml`'s `build-epub` job. Nothing else in the workflow changes: the `UV_PYTHON: '3.11'` pin, the `uv python install 3.11` step, `fail-fast: false`, the diagram check and the release job all stay as they are.
File names are unique per language. `scripts/build_epub.py`'s `lang_map` writes `claude-howto-guide.epub` (en) and `claude-howto-guide-{vi,zh,ja,ko,fa}.epub`. Each matrix leg uploads its own `epub-<lang>` artifact, so `download-artifact` with `merge-multiple: true` puts six distinct files in `dist/`, and nothing gets overwritten.
Docs: none updated. No doc in English or any locale says which languages a GitHub Release ships. I searched `git grep -i epub` over `*.md` (CHANGELOGs excluded) for release, download and language-list wording. The only language lists are `build_epub.py --lang` usage blocks, which describe the build CLI, not release contents.
`test.yml` already builds and verifies these six languages on every scripts change. Most recently, #250's push run on main was green, with `Build EPUB Artifact` passing for en, vi, zh, ja, ko and fa: https://github.com/luongnv89/claude-howto/actions/runs/43216242906
Closes #252
|
||
|
|
3cd08e372e |
fix(ci): pin Python 3.11 in release workflow (#250)
The v2.1.322 release run failed: https://github.com/luongnv89/claude-howto/actions/runs/43214385899 ## Cause `ubuntu-latest` moved to Ubuntu 26.04, whose system Python is 3.14. `.github/workflows/release.yml` ran `uv venv` without pinning a version and with no uv-managed Python installed, so uv took the first Python it found on the runner's `PATH`: `/usr/bin/python` (CPython 3.14.4). `pillow==11.1.0` (`scripts/requirements.txt`) has no 3.14 wheel. uv tried to build it from source, and the build failed because the libjpeg headers were missing. All three EPUB jobs failed at "Install Python dependencies". The "Publish GitHub Release" job then failed at "List built artifacts" (`ls: cannot access 'dist/'`), before it reached the publish step. ## Fix - **`release.yml`, `build` job:** add a `Set up Python` step (`uv python install 3.11`) before "Install Python dependencies". This is the step the `build-epub` job in `test.yml` already uses. - **Both `release.yml` `build` and `test.yml` `build-epub`:** set a job-level `UV_PYTHON: '3.11'`. This pins every uv command in those jobs to 3.11: `uv venv`, and also the PEP 723 environment that `uv run scripts/build_epub.py` creates. Without it, the install step works only because 3.11 is the sole managed interpreter and uv's default preference is `managed`. A runner image that ships a newer uv-managed Python, or a change to that default, would silently switch versions. The `uv python install 3.11` steps stay as the explicit download. The two jobs now pin Python the same way, so release builds run on the interpreter CI already tests. Editing `test.yml` also makes it run on this PR, so its `build-epub` job exercises the same pin. Nothing else changes, and the release language matrix (en/vi/zh) stays as it is. The other workflows don't need this. `docs-check.yml` pins 3.11 through `actions/setup-python`. `pages.yml` runs `uv run scripts/build_website.py`, whose inline dependencies are pure Python (markdown, beautifulsoup4, jinja2). It doesn't install Pillow or `scripts/requirements*.txt`. ## Publishing v2.1.322 Re-running the failed run won't fix it: a tag-triggered run uses the workflow file at the tagged commit (`b5548c6`), which doesn't have this fix. After merge, v2.1.322 is released only if the tag is moved to a commit that contains this fix, or a new tag is cut. That's the maintainer's decision. ## Verification - Both workflow files parse. The `build` step order is checkout → uv → Node.js → **Set up Python** → install deps → build. - `pre-commit run --files .github/workflows/release.yml .github/workflows/test.yml` passes: check-yaml, end-of-file, trailing-whitespace, large-files and merge-conflict. The mermaid hooks were skipped (`SKIP=…`) because their Node.js environment couldn't install locally, and they have nothing to check on these files anyway. - `release.yml` has no `workflow_dispatch`, so only the next tag push proves it end to end. ## Follow-up (not in this PR) `uv run scripts/build_epub.py` builds in its own PEP 723 environment and doesn't use `.venv` or `scripts/requirements-dev.txt`. The `uv venv` + `uv pip install -r scripts/requirements-dev.txt` step in both EPUB jobs installs tools the build never uses. It also means the EPUB is built with the latest Pillow, not the `pillow==11.1.0` pin. Dropping that step, or pinning the script's inline dependencies, is a separate change. Closes #249 |
||
|
|
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 |
||
|
|
ce10c70054 |
fix(pages): remove uv cache glob that broke on missing uv.lock
astral-sh/setup-uv enable-cache defaults to keying off uv.lock, which this repo intentionally gitignores, so every push to main since 2026-06-17 failed at the cache step before the build ever ran. |
||
|
|
8143e37d1b |
perf(scripts): single-parse website build + CI caching (#144)
Optimize the lesson -> GitHub Pages conversion in build_website.py: - BS4 single parse: thread one BeautifulSoup tree through heading-id normalisation, TOC extraction, and link rewriting instead of reparsing the rendered HTML 3x per page. Build drops 2.97s -> 1.77s (~40% faster) on the ~222-page site; html.parser reparsing was the dominant cost. - Nav O(n^2) -> O(n): build the sidebar section grouping once (build_nav_skeleton) and resolve per-page relative URLs in localize_nav, removing ~49k redundant relative_link/grouping calls. - Read each .md once: cache source text on PageInfo.content and reuse it across collect_pages, render_pages, and copy_assets (was 2-3 reads/page). - CI: enable uv cache and cache scripts/.vendor-cache so deploys skip cold dep resolution and vendor (Tailwind/Mermaid/fonts) downloads. Public string APIs (derive_page_title, render_markdown, extract_toc, rewrite_links, normalise_heading_ids) preserved as thin wrappers over the new soup-based cores. Full suite green (92 tests), ruff/mypy clean. Output is semantically identical to the prior build; the only diff is raw hand-written <img/> badges serializing as <img></img> (valid HTML5, renders identically; nothing validates generated site HTML). |
||
|
|
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) |
||
|
|
90e9c30e93 |
feat(release): build and publish EPUB artifacts per language (#54)
Extend the release workflow to build separate EPUB artifacts for en, vi, and zh in parallel via a matrix job, then publish all built files under a single GitHub Release. Using fail-fast: false so a failure in one language does not block releasing the others. Also refactor build_epub.py to drive language-specific paths, filenames, and titles from a mapping, and add zh support (title/subtitle + choice). |
||
|
|
699fb39a46 |
ci: shift-left quality gates — add mypy to pre-commit, fix CI failures (#53)
* ci: shift-left quality gates — add mypy to pre-commit, fix CI failures - Add mypy pre-commit hook (mirrors-mypy v1.13.0) so type checks run locally - Add [tool.mypy] config to scripts/pyproject.toml with overrides for untyped libs (ebooklib, sync_translations) - Add mypy>=1.8.0 to requirements-dev.txt - Fix CI test.yml: remove continue-on-error: true from lint/security/type-check jobs (was silently swallowing failures) - Fix CI bandit -c path: pyproject.toml → scripts/pyproject.toml - Fix CI mypy command: use --config-file scripts/pyproject.toml - Fix CI build-epub: add type-check to needs, fix if: success() → !failure() && !cancelled() - Fix ruff errors in sync_translations.py (RUF013 implicit Optional, SIM102 nested if) - Fix mypy errors: add list[str] annotations to errors vars in check_cross_references.py and check_links.py * fix(ci): install mmdc in build-epub job and correct return type annotation - Add npm install step for @mermaid-js/mermaid-cli before Build EPUB to fix CI failure (mmdc not found error) - Fix check_translation_status() return type from list[dict] to tuple[list[dict], list[dict]] to match the actual return value * fix(ci): pass --no-sandbox to Puppeteer in build-epub CI job mmdc (Mermaid CLI) uses Puppeteer/Chromium which requires --no-sandbox in the GitHub Actions sandboxed environment. Add --puppeteer-config flag to build_epub.py that passes a Puppeteer JSON config file to mmdc via -p, and use it in the CI workflow to inject the no-sandbox args. |
||
|
|
e76bbe40f2 |
refactor(epub): replace Kroki HTTP dependency with local mmdc rendering (#10) (#52)
* refactor(epub): replace Kroki HTTP dependency with local mmdc rendering (#10) Remove httpx/tenacity dependencies and Kroki.io API calls from the EPUB build pipeline. MermaidRenderer now invokes mmdc (mermaid-cli) as a local subprocess, eliminating intermittent CI failures caused by network unavailability. CI workflow installs @mermaid-js/mermaid-cli before build. * fix(epub): add subprocess timeout and fix deduplication log count - Add 60s timeout to mmdc subprocess.run to prevent hanging builds when Chromium/Puppeteer stalls in headless CI environments - Fix misleading log that printed unique/total as equal counts; now logs "N unique diagrams (M total blocks)" explicitly - Add test_render_all_timeout and strengthen deduplication assertion |
||
|
|
6d1e0ae4af |
refactor(ci): shift quality checks to pre-commit, CI as 2nd pass (#34)
* refactor(ci): shift quality checks to pre-commit, CI as 2nd pass
- Remove ci.yml (lint, security, pytest were only for EPUB scripts)
- Move EPUB build to pre-commit local hook (runs on .md changes)
- Add check_cross_references.py, check_mermaid.py, check_links.py scripts
- Add markdown-lint, cross-references, mermaid-syntax, link-check as
pre-commit hooks — mirrors all 4 CI doc-check jobs locally
- Remove spell check job from docs-check.yml (breaks on translations)
- Refactor docs-check.yml to reuse scripts/ instead of inline Python
- Add .markdownlint.json config shared by pre-commit and CI
- Update CONTRIBUTING.md with required dependencies and hook table
* fix(ci): resolve all CI check failures in docs-check workflow
- fix(check_cross_references): skip code blocks and inline code spans
to avoid false positives from documentation examples; fix emoji
heading anchor generation (rstrip not strip); add blog-posts,
openspec, prompts, .agents to IGNORE_DIRS; ignore README.backup.md
- fix(check_links): strip trailing Markdown punctuation from captured
URLs; add wikipedia, api.github.com to SKIP_DOMAINS; add placeholder
URL patterns to SKIP_URL_PATTERNS; add .agents/.claude to IGNORE_DIRS
- fix(check_mermaid): add --no-sandbox puppeteer config support via
MERMAID_PUPPETEER_NO_SANDBOX env var for GitHub Actions Linux runners
- fix(docs-check.yml): pass MERMAID_PUPPETEER_NO_SANDBOX=true to mermaid job
- fix(content): repair broken anchors in README.md, 09-advanced-features;
fix #plugins -> #claude-code-plugins in claude_concepts_guide.md;
remove non-existent ./docs/performance.md placeholder links; fix
dependabot alerts URL in SECURITY_REPORTING.md; update auto-mode URL
in resources.md; use placeholder pattern for 07-plugins example URL
- remove README.backup.md (stale file)
* fix(check-scripts): fix strip_code_blocks regex and URL fragment handling
- fix regex in strip_code_blocks to avoid conflicting MULTILINE+DOTALL
flags that could fail to strip indented code fences; use DOTALL only
- strip URL fragments (#section) before dispatching link checks to avoid
false-positive 404s on valid URLs with anchor fragments
* fix(check-scripts): fix anchor stripping, cross-ref enforcement, and mermaid temp file cleanup
- heading_to_anchor: use .strip("-") instead of .rstrip("-") to also strip leading hyphens
produced by emoji-prefixed headings, preventing false-positive anchor errors
- check_cross_references: always exit with main()'s return code — filesystem checks
should block pre-commit unconditionally, not silently pass on errors
- check_mermaid: wrap file-processing loop in try/finally so the puppeteer config
temp file is cleaned up even if an unexpected exception (e.g. UnicodeDecodeError) occurs
- docs-check.yml: remove now-unused CROSS_REF_STRICT env var
* fix(scripts): fix anchor stripping and mermaid output path
- Replace .strip('-') with .rstrip('-') in heading_to_anchor() so leading
hyphens from emoji-prefixed headings are preserved, matching GitHub's
anchor generation behaviour.
- Use Path.with_suffix('.svg') in check_mermaid.py instead of
str.replace('.mmd', '.svg') to avoid replacing all occurrences of .mmd
in the full temp path.
|
||
|
|
e8cdd26db0 |
ci: Trigger docs-check on config file changes
Add .cspell.json and markdown-link-check-config.json to the docs-check workflow trigger paths so spelling and link check config changes are properly validated. |
||
|
|
5c54d753a1 | fix: Add 'srcset' to spell check dictionary and fix Bandit config path in CI workflow | ||
|
|
c2130fc769 | refactor: Move Python configuration and requirements files to scripts/ directory for better organization | ||
|
|
728bd50804 | ci: Add comprehensive automated testing workflows and documentation | ||
|
|
62e8dd9042 | ci: Add GitHub Actions workflow for documentation checks | ||
|
|
3a1f45e5e9 |
fix(ci): Use virtual environments instead of --system flag
The --system flag fails on GitHub Actions runners because Python is externally managed. Using uv venv + uv pip install instead. |
||
|
|
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 |
||
|
|
57ff23f9e0 |
feat: Add EPUB generation tool and workflow
- Introduced a new script to build an EPUB from markdown files, enhancing documentation accessibility. - Added a GitHub Actions workflow for automated EPUB builds on version tag pushes. - Created the initial EPUB file 'claude-howto-guide.epub' for distribution. This update streamlines the process of creating and releasing the Claude How-To guide in EPUB format. |