Skip to content

DEMO PR: add styleguide + checks#4

Merged
probablyangg merged 17 commits into
mainfrom
ag/add-styleguide-ci
Jun 17, 2026
Merged

DEMO PR: add styleguide + checks#4
probablyangg merged 17 commits into
mainfrom
ag/add-styleguide-ci

Conversation

@probablyangg

Copy link
Copy Markdown
Member

Summary

Docs i18n checklist

  • Edited docs/pages/en/ only (did not hand-edit cn/ko content)
  • Updated docs/sidebar.json (/en/) if pages were added, moved, or renamed
  • Reviewed the auto-generated cn/ko translations committed to this PR
  • If a page was deleted/renamed: applied the same change to cn and ko
  • npm run i18n:check reports 0 missing (stale warnings OK)

…ode blocks to specify text format, and enhance clarity across various how-to and reference pages. Added style check script to package.json.
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Jun 16, 2026

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
docs 3dc103f Commit Preview URL

Branch Preview URL
Jun 16 2026, 10:47 PM

@probablyangg probablyangg changed the title add styleguide + checks Demo PR: add styleguide + checks Jun 16, 2026
@probablyangg probablyangg changed the title Demo PR: add styleguide + checks DEMO PR: add styleguide + checks Jun 16, 2026
probablyangg and others added 2 commits June 16, 2026 15:30
Resolves the blocking style:check failure (em dashes in prose).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
verify-style.mjs writes a Markdown report to $STYLE_REPORT when set
(no-op locally). docs-style.yml runs the check, posts/updates a single
sticky comment with the findings, and still fails the job on blocking
issues so enforcement is unchanged.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@github-actions

github-actions Bot commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

Styleguide check

✓ 126 en pages — 0 blocking, 11 warnings

docs/pages/en/explanation/autobahn.mdx

  • ⚠ warning: marketing word "robust" (L20)
  • ⚠ warning: marketing word "seamless" (L34)

docs/pages/en/explanation/consensus.mdx

  • ⚠ warning: marketing word "robust" (L32)

docs/pages/en/explanation/ethereum-compatibility.mdx

  • ⚠ warning: marketing word "seamless" (L10)

docs/pages/en/how-to/monitor-node.mdx

  • ⚠ warning: marketing word "comprehensive" (L7)

docs/pages/en/how-to/troubleshoot-node.mdx

  • ⚠ warning: marketing word "comprehensive" (L7)

docs/pages/en/reference/indexers.mdx

  • ⚠ warning: marketing word "seamlessly" (L9)

docs/pages/en/reference/ramps.mdx

  • ⚠ warning: marketing word "seamless" (L28)

docs/pages/en/reference/system-transactions-api.mdx

  • ⚠ warning: marketing word "comprehensive" (L358)

docs/pages/en/reference/wallets.mdx

  • ⚠ warning: marketing word "powerful" (L83)
  • ⚠ warning: marketing word "seamless" (L30)

Enforced by npm run style:check — see STYLEGUIDE.md.

probablyangg and others added 14 commits June 16, 2026 15:51
The report now renders each path as a clickable GitHub blob URL pinned to
the PR head SHA, with #L line anchors for line-locatable findings (em
dashes, marketing words, untagged code fences). Falls back to plain paths
when STYLE_REPO_URL is unset (local runs). Line numbers account for the
stripped frontmatter offset.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
verify-style.mjs emits a STYLE_SUGGESTIONS JSON of safe mechanical fixes
(em dash -> colon, per line). The workflow maps PR diff hunks to added
line numbers and posts each in-diff fix as a GitHub suggested-change
review comment (with a marker so reruns replace prior suggestions rather
than stacking). Findings on unchanged lines stay in the summary comment.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Adds an "Automated checks" section to STYLEGUIDE.md covering what
style:check enforces (blocking vs warnings) and how the docs style
workflow surfaces results: a sticky summary comment with line-anchored
links, plus applyable inline suggestions for em-dash fixes.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
discover() returned explicit paths verbatim, bypassing the source_sha
freshness gate. Since CI passes every en page changed in the PR (git
diff base...HEAD), each push re-translated the entire PR changeset
through Opus — even pages whose cn/ko already matched — exhausting the
rate limit / credit balance.

Explicit paths now flow through the same missing-or-drifted check used by
full discovery, so an in-sync page is a no-op. Added --force to
re-translate regardless (intentional local re-runs).

Verified: an in-sync page passed explicitly now reports "translating 0
page(s)" and makes no API call; drifted/missing pages are still selected.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Replaces the Claude Opus 4.8 + adaptive-thinking translation calls (overkill
and expensive for a translation task) with a single ~30-line fetch-based
helper, docs/lib/llm.mjs, exporting complete(). Both i18n scripts call only
that — provider, base URL, key, and model are env-driven, so swapping
provider/model is config, never a code edit.

- docs/lib/llm.mjs: OpenAI-compatible /chat/completions over native fetch
  (no SDK), small retry on 429/5xx. LLM_BASE_URL defaults to OpenRouter;
  TRANSLATE_MODEL defaults to a cheap model; optional REVIEW_MODEL enables a
  second QA pass.
- i18n-translate.mjs: translate (+ optional review) through complete(), plus a
  deterministic structural check (frontmatter present, code-fence count matches,
  no stray fence wrapper) that fails a bad generation instead of writing it.
  Mismatch-only discovery and --force are unchanged.
- i18n-sidebar.mjs: same swap; keeps the JSON entry-count guard.
- Drop the @anthropic-ai/sdk dependency (no remaining importers).
- Workflow uses LLM_API_KEY from secrets.OPENROUTER_API_KEY + model env vars.
- CLAUDE.md: env-var examples + note that provider/model are swappable.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…output

The placeholder google/gemini-2.0-flash-001 returned 404 "No endpoints found"
on OpenRouter. Switch the default TRANSLATE_MODEL and the workflow to
google/gemini-2.5-flash and raise MAX_OUTPUT_TOKENS to 32000 to use its larger
output window so long pages don't truncate.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
gemini-2.5-flash localized internal link paths itself — emitting language
tags (/zh-CN/, /ko-KR/) and a duplicated section instead of leaving /en/ for
localizeLinks to convert — which broke 65 internal links and failed the vocs
build (deadlinks).

localizeLinks now rewrites ANY locale/lang prefix (en|cn|ko|zh|zh-cn|ko-kr) in
a markdown href to the file's locale and collapses a duplicated section segment,
touching only the locale prefix (asset paths like /images/ are left alone). The
system prompt also tells the model to keep /en/ hrefs verbatim.

Repaired the already-committed translations via the no-API --relink pass
(cn: 12 files, ko: 3). docs:build now passes with 0 deadlinks.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…ommit

git add -A in the previous commit swept in vocs-build output (9 .woff2 fonts
generated from the tracked .ttf sources, plus a rebuilt styles.css). Untrack
the woff2, restore styles.css, and gitignore docs/public/fonts/*.woff2 so the
build artifacts don't get committed again.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
# Conflicts:
#	docs/pages/cn/explanation/core-concepts.mdx
#	docs/pages/cn/explanation/usdt0-behavior.mdx
#	docs/pages/cn/reference/connect.mdx
#	docs/pages/ko/explanation/core-concepts.mdx
#	docs/pages/ko/explanation/usdt0-behavior.mdx
#	docs/pages/ko/reference/connect.mdx
…EGUIDE

Mechanical rule specifics lived in two places — constants in verify-style.mjs
and prose in STYLEGUIDE.md — so changing one risked drifting from the other.

- verify-style.mjs: consolidate the tunable specifics (diataxis values, exempt
  folders, description cap, marketing words) into one labeled RULES block marked
  as the single source of truth; add `--rules` to print the enforced rules.
- STYLEGUIDE.md: stop restating the values (length cap, marketing-word list,
  diataxis enum). It now links to RULES / `--rules`, and gains an "Updating the
  styleguide" section: mechanical rule → edit RULES; judgment rule → edit prose.

Changing an enforced value is now a one-place edit.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
… enforcement)

- DR004: swappable OpenAI-compatible llm.mjs seam, OpenRouter + cheap model
  default, optional review pass, structural + link-normalization guards, and the
  mismatch-only discovery fix. Supersedes DR002 §5-6 engine internals.
- DR005: mechanical-vs-judgment split, single RULES source + --rules,
  verify-style.mjs, and the docs-style PR comment + inline-suggestion design.
- DR002: superseded-by-DR004 pointers at §5/§6 and the verification commands;
  the sync contract / CI gates / mapping are unchanged.
- DR003: cross-ref the *-index lint follow-up to its new home (DR005).
- README: list DR004 and DR005.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@probablyangg probablyangg merged commit 41930de into main Jun 17, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant