Skip to content

Add sync-latest-to-next script and update docs#289

Merged
evanorti merged 1 commit intomainfrom
upgrade-guides-refresh
Apr 10, 2026
Merged

Add sync-latest-to-next script and update docs#289
evanorti merged 1 commit intomainfrom
upgrade-guides-refresh

Conversation

@evanorti
Copy link
Copy Markdown
Contributor

Add a new executable script scripts/sync-latest-to-next.js to copy files from a product's latest/ tree to the matching next/ tree, rewriting internal latest→next links and preserving destination front matter. Update CLAUDE.md to require logging and to instruct running the sync script after editing latest/. Revise SDK guides (sdk/latest and sdk/next) for upgrades: add warnings, clarify upgrade handler type and InitGenesis override behavior, and expand notes on syncing full nodes; clean up Go example formatting in migration code. Also trim stray blank lines in ADR/RFC templates and make small copy edits in example tutorial pages and the v0.54 upgrade guide (clarify changelog references and fix anchors).

Add a new executable script scripts/sync-latest-to-next.js to copy files from a product's latest/ tree to the matching next/ tree, rewriting internal latest→next links and preserving destination front matter. Update CLAUDE.md to require logging and to instruct running the sync script after editing latest/. Revise SDK guides (sdk/latest and sdk/next) for upgrades: add warnings, clarify upgrade handler type and InitGenesis override behavior, and expand notes on syncing full nodes; clean up Go example formatting in migration code. Also trim stray blank lines in ADR/RFC templates and make small copy edits in example tutorial pages and the v0.54 upgrade guide (clarify changelog references and fix anchors).
@mintlify
Copy link
Copy Markdown

mintlify Bot commented Apr 10, 2026

Preview deployment for your docs. Learn more about Mintlify Previews.

Project Status Preview Updated (UTC)
cosmos-docs 🟢 Ready View Preview Apr 10, 2026, 8:57 PM

💡 Tip: Enable Workflows to automatically generate PRs for you.

@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented Apr 10, 2026

Greptile Summary

This PR introduces scripts/sync-latest-to-next.js, a Node.js utility that copies .mdx files from a product's latest/ tree to next/, rewriting internal links and preserving destination front matter. It also updates CLAUDE.md to mandate running the script after latest/ edits, revises the SDK upgrade and migration guides with warnings and clarifications, fixes a broken ToC anchor (x/nft), trims blank lines from ADR/RFC templates, and makes minor copy edits across tutorial pages.

Confidence Score: 5/5

Safe to merge; all remaining findings are P2 style suggestions with no correctness or data-integrity impact.

The sync script logic is correct — front matter preservation, link rewriting, and directory walking all behave as intended. Documentation edits are accurate. The only issues found are: a duplicated instruction in CLAUDE.md, repeated paragraphs in the upgrade guide, a trailing space in one tutorial file, and an inaccurate comment in the script — none of which affect runtime behaviour or user-facing correctness.

sdk/next/upgrade/upgrade.mdx (duplicate not-exhaustive paragraph) and CLAUDE.md (duplicate sync instruction).

Important Files Changed

Filename Overview
scripts/sync-latest-to-next.js New script that copies .mdx files from latest/ to next/, preserving destination front matter and rewriting internal product links; logic is sound with one minor comment inaccuracy about http vs https.
CLAUDE.md Adds sync-script instructions and work-log numbering; sync instruction is duplicated (appears in both the numbered list and again as a standalone paragraph under Products).
sdk/next/upgrade/upgrade.mdx Fixes x/nft ToC anchor, adds Changelog references and Store v2 note, but the not-exhaustive sentence and Changelog link now appear three times across the document.
sdk/latest/guides/upgrades/upgrade.mdx Adds Warning callout, clarifies upgrade handler type signature, expands InitGenesis override guidance, and improves full-node syncing section; changes are accurate and well-structured.
sdk/next/guides/upgrades/upgrade.mdx Next-branch mirror of the latest upgrade guide with noindex front matter preserved; changes are consistent with the latest version.
sdk/next/tutorials/example/03-build-a-module.mdx Minor copy edit; introduces a trailing space on line 10 after the period.
sdk/next/tutorials/example/01-prerequisites.mdx Small copy edits: removes 'on your machine', updates 'throughout this tutorial' to 'throughout the tutorial', and converts trailing space to colon; all clean improvements.
sdk/next/reference/architecture/adr-template.mdx Removes stray blank lines; no content changes.
sdk/next/reference/rfc/rfc-template.mdx Removes stray blank lines; no content changes.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A["User edits latest/ file(s)"] --> B["node scripts/sync-latest-to-next.js path"]
    B --> C{collectFiles}
    C -->|"file"| D["syncFile(relPath)"]
    C -->|"directory"| E["walk .mdx files"] --> D
    D --> F{dest exists?}
    F -->|"yes"| G["Read dest front matter\nKeep as-is"]
    F -->|"no"| H["Use src front matter\nrewriteLinks on full content"]
    G --> I["extractBody(src)\nrewriteLinks(body, product)"]
    H --> J["Write to next/ path"]
    I --> K["destFrontMatter + rewrittenBody"]
    K --> J
    J --> L["Log ✓ updated / created"]
Loading

Reviews (1): Last reviewed commit: "Add sync-latest-to-next script and updat..." | Re-trigger Greptile

Comment thread CLAUDE.md
Comment on lines 29 to 31
- `next/` — active development. Default working directory for new content.
- `v0.53/`, `v10.1.x/`, etc. — archived versions. Do not edit these.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Duplicate sync instruction

The instruction to run sync-latest-to-next.js after editing latest/ appears twice: once in the "Notes and sync" numbered list (item 2, lines 10-11) and again as a standalone paragraph here. Having it in two places risks the two versions drifting and makes CLAUDE.md longer without adding clarity.

Comment on lines 79 to +81

This guide provides an overview of the major changes in v0.54.0. However, this guide is not exhaustive for all breaking changes. For a comprehensive list of all breaking changes in v0.54.0, see the [Changelog](https://github.com/cosmos/cosmos-sdk/blob/release/v0.54.x/CHANGELOG.md).

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Duplicate "not exhaustive" paragraph

The same "this guide is not exhaustive" message (with an identical Changelog link) already appears in the document's opening paragraph at lines 10-11. Having it a second time at the top of "Required Changes" adds noise without new information.

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

Comment on lines 193 to +195
### Store v2

Store v2 introduces breaking changes. For a comprehensive list of all breaking changes, see the [Changelog](https://github.com/cosmos/cosmos-sdk/blob/release/v0.54.x/CHANGELOG.md).
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Duplicate Changelog link under Store v2

The sentence "Store v2 introduces breaking changes. For a comprehensive list of all breaking changes, see the [Changelog]..." repeats the same Changelog reference already given at the top of the document (lines 10-11) and again at line 80. One canonical mention is enough.

In [quickstart](/sdk/next/tutorials/example/02-quickstart), you started a chain and submitted a transaction to increase the counter. In this tutorial, you'll build a simple counter module from scratch. It follows the same overall structure as the full `x/counter`, but uses a stripped-down version so you can focus on the core steps of building and wiring a module yourself.

By the end, you'll have built a working module and wired it into a running chain. For a deeper dive into how modules work in the Cosmos SDK, see [Intro to Modules](/sdk/next/learn/concepts/modules).
By the end, you'll have built a working module and wired it into a running chain. For a deeper dive into how modules work in the Cosmos SDK, see [Intro to Modules](/sdk/next/learn/concepts/modules).
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Trailing whitespace introduced

A trailing space was added after the period at the end of this sentence, which can produce unexpected rendering or lint failures.

Comment on lines +47 to +56
function rewriteLinks(content, product) {
// Only rewrite /<product>/latest/ → /<product>/next/ for the product being synced.
// Cross-product links (e.g. /cometbft/latest/) are left unchanged — next/ files
// intentionally reference other products' latest/ versions.
const escapedProduct = product.replace(/-/g, '\\-');
const re = new RegExp(`(https?:\\/\\/\\S+)|\\/${escapedProduct}\\/latest\\/`, 'g');
return content.replace(re, (match, externalUrl) => {
if (externalUrl) return externalUrl;
return `/${product}/next/`;
});
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Comment says "https://" but regex also matches "http://"

The comment says the function preserves "external https:// URLs", but the regex https?:\/\/ matches both http:// and https://. The code behaviour is correct (preserving both is the right thing), but the comment is misleading.

@evanorti evanorti merged commit 9daf092 into main Apr 10, 2026
4 checks passed
@evanorti evanorti deleted the upgrade-guides-refresh branch April 10, 2026 20:58
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