Conversation
Greptile SummaryThis PR adds a complete six-part "Build a Chain" tutorial series ( Key issues found:
Confidence Score: 3/5
Important Files Changed
Last reviewed commit: "Revert "Update 04-co..." |
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
…s/docs into feat/example-tutorial-sync
| git push origin "$BRANCH" | ||
|
|
||
| gh pr comment "$PR_NUMBER" \ | ||
| --repo cosmos/example \ |
There was a problem hiding this comment.
git stash silently skips untracked files — stash pop will fail
git stash only stashes changes to already-tracked files. When the transform writes .md files into cosmos-example/docs/ and that directory does not yet exist on cosmos/example's default branch (e.g. on the very first sync run, or whenever a new tutorial page is added), those output files are untracked. git stash prints "No local changes to stash" and exits 0 — it saves nothing. The subsequent git stash pop then fails with error: No stash entries found., aborting the entire "update existing PR" code path.
The fix is to include untracked files in the stash:
| git push origin "$BRANCH" | |
| gh pr comment "$PR_NUMBER" \ | |
| --repo cosmos/example \ | |
| git stash --include-untracked | |
| git fetch origin "$BRANCH" | |
| git checkout "$BRANCH" | |
| git stash pop |
Using --include-untracked (or the short form -u) ensures newly-created files are stashed alongside modified tracked files and correctly restored on top of the sync branch.
|
|
||
| def to_example(content: str) -> str: | ||
| # Extract frontmatter | ||
| fields, content = strip_frontmatter(content) | ||
| title = fields.get("title", "") | ||
|
|
||
| # Rewrite tutorial-local Mintlify links back to relative .md links | ||
| # e.g. /sdk/next/tutorials/example/quickstart → ./quickstart.md | ||
| content = re.sub( | ||
| rf'\(/{re.escape(TUTORIAL_BASE_PATH)}/([^)]+)\)', | ||
| r'(./\1.md)', | ||
| content, | ||
| ) | ||
|
|
||
| # Rewrite other /sdk/... Mintlify paths (non-tutorial) to full URLs | ||
| # e.g. (/sdk/next/learn/foo) → (https://docs.cosmos.network/sdk/next/learn/foo) | ||
| content = re.sub( | ||
| rf'\(/(?!{re.escape(TUTORIAL_BASE_PATH)})([^\s)"\']+)\)', | ||
| lambda m: f'({DOCS_BASE_URL}/{m.group(1)})', | ||
| content, |
There was a problem hiding this comment.
Mintlify MDX components not stripped in
to_example output
The to_example function rewrites links and frontmatter, but it does not handle Mintlify-specific MDX components such as <Note>, <Warning>, and <Tip>. Multiple tutorial files already use these components:
sdk/next/tutorials/example/01-prerequisites.mdxline 7:<Warning>This tutorial is intended for macOS and Linux systems…</Warning>sdk/next/tutorials/example/02-quickstart.mdxline 9:<Note>Before continuing, make sure you have completed…</Note>sdk/next/tutorials/example/03-build-a-module.mdx:<Note>Before continuing, you must follow the Prerequisites guide…</Note>
After transformation these tags are written verbatim into the example repo's .md files. <Note> and <Warning> are not standard HTML elements, so they will either be rendered as unstyled text content or stripped entirely by GitHub's Markdown renderer. The callout intent is completely lost for readers browsing the example repo on GitHub.
Consider adding a simple stripping or text-block conversion pass inside to_example, for example:
# Convert <Note>...</Note> / <Warning>...</Warning> / <Tip>...</Tip> to blockquotes
content = re.sub(
r'<(Note|Warning|Tip)>\s*([\s\S]*?)\s*</\1>',
lambda m: '> **' + m.group(1) + ':** ' + m.group(2).replace('\n', '\n> '),
content,
)This produces readable callouts in plain Markdown without requiring MDX support.
Add the build a chain and module tutorial.
Also create a docs sync between docs files and the example repo to keep docs in sync in both locations.