Skip to content

Conversation

kumaryash90
Copy link
Member

@kumaryash90 kumaryash90 commented Oct 10, 2025


PR-Codex overview

This PR introduces updates to the CLI for stylus, adding new project templates for zero-knowledge (ZK) ERC721 and ERC20 projects.

Detailed summary

  • Added new project templates for ZK ERC721 and ZK ERC20 in the CLI command createStylusProject.
  • Implemented logic to clone specific GitHub repositories for the new templates when selected.

✨ Ask PR-Codex anything about this PR by commenting with /codex {your question}

Summary by CodeRabbit

  • New Features

    • Added two new Stylus project templates: ZK ERC721 and ZK ERC20. These appear as selectable options during project setup.
  • UX Improvements

    • Project creation flow updated to support the new templates, with clearer progress and status messages shown during setup.

@kumaryash90 kumaryash90 requested review from a team as code owners October 10, 2025 22:00
Copy link

changeset-bot bot commented Oct 10, 2025

🦋 Changeset detected

Latest commit: c779bcf

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 4 packages
Name Type
thirdweb Patch
@thirdweb-dev/nebula Patch
@thirdweb-dev/wagmi-adapter Patch
wagmi-inapp Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link

vercel bot commented Oct 10, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
docs-v2 Ready Ready Preview Comment Oct 13, 2025 5:17pm
nebula Ready Ready Preview Comment Oct 13, 2025 5:17pm
thirdweb_playground Error Error Oct 13, 2025 5:17pm
thirdweb-www Ready Ready Preview Comment Oct 13, 2025 5:17pm
wallet-ui Ready Ready Preview Comment Oct 13, 2025 5:17pm

Copy link
Contributor

graphite-app bot commented Oct 10, 2025

How to use the Graphite Merge Queue

Add either label to this PR to merge it via the merge queue:

  • merge-queue - adds this PR to the back of the merge queue
  • hotfix - for urgent hot fixes, skip the queue and merge this PR next

You must have a Graphite account in order to use the merge queue. Sign up using this link.

An organization admin has enabled the Graphite Merge Queue in this repository.

Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.

@github-actions github-actions bot added packages SDK Involves changes to the thirdweb SDK labels Oct 10, 2025
@kumaryash90 kumaryash90 requested a review from jakeloo October 10, 2025 22:00
Copy link
Contributor

coderabbitai bot commented Oct 10, 2025

Walkthrough

Adds two new Stylus CLI project templates: zk-erc721 and zk-erc20. The create command now presents these options and clones the corresponding template repositories when selected; other project types and existing control flow remain unchanged.

Changes

Cohort / File(s) Summary
CLI — Stylus create templates
packages/thirdweb/src/cli/commands/stylus/create.ts
Added zk-erc721 and zk-erc20 to template selection and control flow. Implemented git clone targets and spinner messages for the two new project types; preserved existing handling for other types.
Changeset
.changeset/solid-hotels-play.md
Added a changeset noting a patch release and CLI updates for Stylus new templates.

Sequence Diagram(s)

sequenceDiagram
    autonumber
    participant U as User
    participant C as Stylus CLI (create)
    participant G as Git (remote template repos)

    U->>C: Choose projectType
    alt projectType in (erc20, erc721, other-existing)
        C->>G: git clone existing template repo
        G-->>C: repo cloned
        C-->>U: Success message
    else projectType == zk-erc20
        Note over C: New template branch
        C->>G: git clone zk-erc20 template
        G-->>C: repo cloned
        C-->>U: Success message
    else projectType == zk-erc721
        Note over C: New template branch
        C->>G: git clone zk-erc721 template
        G-->>C: repo cloned
        C-->>U: Success message
    end
    opt error
        C-->>U: Error message
    end
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Pre-merge checks and finishing touches

❌ Failed checks (1 warning, 1 inconclusive)
Check name Status Explanation Resolution
Description Check ⚠️ Warning The pull request description includes the repository’s commented template but does not replace any of the placeholders with actual content, leaving out the required formatted title, reviewer notes, and testing instructions, and instead only provides the PR-Codex overview without adhering to the specified template. Please replace the commented template with filled-in sections matching the repository requirements: include a title in the form “[SDK/Dashboard/Portal] Feature/Fix: Concise title for the changes,” add meaningful notes for the reviewer describing any important details, and provide concrete “How to test” instructions such as specific unit tests or manual verification steps.
Title Check ❓ Inconclusive The title “Stylus CLI updates” is a generic descriptor that does not convey the primary change of adding ZK ERC721 and ZK ERC20 templates, making it too vague for someone scanning history to understand the main update at a glance. Please revise the title to clearly highlight the key feature, for example “Stylus CLI: add ZK ERC721 and ZK ERC20 templates,” so that the main change is immediately obvious.
✅ Passed checks (1 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch yash/stylus-cli-zk

Warning

Review ran into problems

🔥 Problems

Errors were encountered while retrieving linked issues.

Errors (1)
  • TEAM-0000: Entity not found: Issue - Could not find referenced Issue.

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (1)
packages/thirdweb/src/cli/commands/stylus/create.ts (1)

124-136: Logic is correct; consider refactoring for maintainability.

The new conditional branches correctly handle the ZK template types and follow the established pattern. The implementation is sound.

For future maintainability, consider refactoring the if-else chain to use a map-based approach to reduce duplication:

+const templateConfigs = {
+  erc20: { repo: "stylus-erc20-template", label: "ERC20" },
+  erc721: { repo: "stylus-erc721-template", label: "ERC721" },
+  erc1155: { repo: "stylus-erc1155-template", label: "ERC1155" },
+  airdrop20: { repo: "stylus-airdrop-erc20-template", label: "Airdrop ERC20" },
+  airdrop721: { repo: "stylus-airdrop-erc721-template", label: "Airdrop ERC721" },
+  airdrop1155: { repo: "stylus-airdrop-erc1155-template", label: "Airdrop ERC1155" },
+  "zk-erc721": { repo: "stylus-zk-erc721", label: "ZK ERC721" },
+  "zk-erc20": { repo: "stylus-zk-erc20", label: "ZK ERC20" },
+};
+
 if (projectType === "default") {
   spinner.start(`Creating new Stylus project: ${projectName}...`);
   newProject = spawnSync("cargo", ["stylus", "new", projectName], {
     stdio: "inherit",
   });
-} else if (projectType === "erc20") {
-  const repoUrl = "git@github.com:thirdweb-example/stylus-erc20-template.git";
-  spinner.start(`Creating new ERC20 Stylus project: ${projectName}...`);
-  newProject = spawnSync("git", ["clone", repoUrl, projectName], {
-    stdio: "inherit",
-  });
-} // ... similar branches for other types
+} else {
+  const config = templateConfigs[projectType];
+  if (!config) {
+    spinner.fail(`Unknown project type: ${projectType}`);
+    process.exit(1);
+  }
+  const repoUrl = `git@github.com:thirdweb-example/${config.repo}.git`;
+  spinner.start(`Creating new ${config.label} Stylus project: ${projectName}...`);
+  newProject = spawnSync("git", ["clone", repoUrl, projectName], {
+    stdio: "inherit",
+  });
 }

This also adds a safeguard for unexpected projectType values.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between edf3aad and 81f03d1.

📒 Files selected for processing (1)
  • packages/thirdweb/src/cli/commands/stylus/create.ts (2 hunks)
🧰 Additional context used
📓 Path-based instructions (3)
**/*.{ts,tsx}

📄 CodeRabbit inference engine (CLAUDE.md)

**/*.{ts,tsx}: Write idiomatic TypeScript with explicit function declarations and return types
Limit each file to one stateless, single-responsibility function for clarity
Re-use shared types from @/types or local types.ts barrels
Prefer type aliases over interface except for nominal shapes
Avoid any and unknown unless unavoidable; narrow generics when possible
Choose composition over inheritance; leverage utility types (Partial, Pick, etc.)
Comment only ambiguous logic; avoid restating TypeScript in prose

**/*.{ts,tsx}: Use explicit function declarations and explicit return types in TypeScript
Limit each file to one stateless, single‑responsibility function
Re‑use shared types from @/types where applicable
Prefer type aliases over interface except for nominal shapes
Avoid any and unknown unless unavoidable; narrow generics when possible
Prefer composition over inheritance; use utility types (Partial, Pick, etc.)
Lazy‑import optional features and avoid top‑level side‑effects to reduce bundle size

Files:

  • packages/thirdweb/src/cli/commands/stylus/create.ts
**/*.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (CLAUDE.md)

Load heavy dependencies inside async paths to keep initial bundle lean (lazy loading)

Files:

  • packages/thirdweb/src/cli/commands/stylus/create.ts
packages/thirdweb/**/*.{ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

packages/thirdweb/**/*.{ts,tsx}: Every public symbol must have comprehensive TSDoc with at least one compiling @example and a custom tag (@beta, @internal, @experimental, etc.)
Comment only ambiguous logic; avoid restating TypeScript in prose
Lazy‑load heavy dependencies inside async paths (e.g., const { jsPDF } = await import("jspdf"))

Files:

  • packages/thirdweb/src/cli/commands/stylus/create.ts
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (8)
  • GitHub Check: E2E Tests (pnpm, esbuild)
  • GitHub Check: Size
  • GitHub Check: E2E Tests (pnpm, vite)
  • GitHub Check: Unit Tests
  • GitHub Check: E2E Tests (pnpm, webpack)
  • GitHub Check: Lint Packages
  • GitHub Check: Build Packages
  • GitHub Check: Analyze (javascript)

Copy link
Contributor

github-actions bot commented Oct 10, 2025

size-limit report 📦

Path Size Loading time (3g) Running time (snapdragon) Total time
thirdweb (esm) 64.51 KB (0%) 1.3 s (0%) 170 ms (+209.63% 🔺) 1.5 s
thirdweb (cjs) 366.04 KB (0%) 7.4 s (0%) 577 ms (+15.05% 🔺) 7.9 s
thirdweb (minimal + tree-shaking) 5.73 KB (0%) 115 ms (0%) 94 ms (+3766.4% 🔺) 209 ms
thirdweb/chains (tree-shaking) 526 B (0%) 11 ms (0%) 81 ms (+4123.86% 🔺) 91 ms
thirdweb/react (minimal + tree-shaking) 19.13 KB (0%) 383 ms (0%) 77 ms (+2902.62% 🔺) 460 ms

@0xFirekeeper 0xFirekeeper merged commit 464af6a into main Oct 13, 2025
17 of 20 checks passed
@0xFirekeeper 0xFirekeeper deleted the yash/stylus-cli-zk branch October 13, 2025 17:11
@joaquim-verges joaquim-verges mentioned this pull request Oct 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

packages SDK Involves changes to the thirdweb SDK

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants