Skip and rename for Shank types and account fields#73
Conversation
Summary by CodeRabbit
Summary by CodeRabbit
WalkthroughThis update introduces support for two new field attributes, Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant RustMacro
participant StructField
participant IDLGenerator
User->>RustMacro: Annotate struct fields with #[idl_name] or #[skip]
RustMacro->>StructField: Parse attributes
StructField->>IDLGenerator: Provide name_override and is_skipped info
IDLGenerator->>IDLGenerator: Use override for field name if present
IDLGenerator->>IDLGenerator: Exclude fields marked as skipped
IDLGenerator->>User: Output customized IDL JSON
Possibly related PRs
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 Clippy (1.86.0)warning: failed to write cache, path: /usr/local/registry/index/index.crates.io-1949cf8c6b5b557f/.cache/pr/oc/proc-macro2, error: Permission denied (os error 13) Caused by: 📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (5)
🧰 Additional context used🧬 Code Graph Analysis (1)shank-macro-impl/src/parsed_struct/struct_field_attr.rs (3)
⏰ 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). (1)
🔇 Additional comments (13)
✨ Finishing Touches
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Actionable comments posted: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (9)
CLAUDE.md(1 hunks)shank-idl/src/idl_field.rs(2 hunks)shank-idl/src/idl_type_definition.rs(1 hunks)shank-idl/tests/accounts.rs(1 hunks)shank-idl/tests/fixtures/accounts/single_file/field_attributes.json(1 hunks)shank-idl/tests/fixtures/accounts/single_file/field_attributes.rs(1 hunks)shank-macro-impl/src/parsed_struct/parsed_struct.rs(1 hunks)shank-macro-impl/src/parsed_struct/struct_field_attr.rs(2 hunks)shank-macro/src/lib.rs(3 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (1)
shank-idl/src/idl_type_definition.rs (1)
shank-idl/src/idl_field.rs (1)
field(35-39)
🪛 LanguageTool
CLAUDE.md
[grammar] ~1-~1: Use correct spacing
Context: # CLAUDE.md This file provides guidance to Claude C...
(QB_NEW_EN_OTHER_ERROR_IDS_5)
[grammar] ~3-~3: Use correct spacing
Context: ...ai/code) when working with code in this repository. ## Project Overview Shank is a collection...
(QB_NEW_EN_OTHER_ERROR_IDS_5)
[grammar] ~5-~5: Use correct spacing
Context: ...th code in this repository. ## Project Overview Shank is a collection of Rust crates th...
(QB_NEW_EN_OTHER_ERROR_IDS_5)
[grammar] ~7-~7: There might be a problem here.
Context: ... to generate TypeScript SDKs for Solana programs. ## Architecture This is a Rust workspace containing 6 m...
(QB_NEW_EN_MERGED_MATCH)
[grammar] ~11-~11: Use correct spacing
Context: ...s is a Rust workspace containing 6 main crates: - shank - Top-level crate that exports ...
(QB_NEW_EN_OTHER_ERROR_IDS_5)
[grammar] ~18-~18: Use correct spacing
Context: ...Command-line tool that orchestrates IDL extraction The workflow: Users annotate their Sola...
(QB_NEW_EN_OTHER_ERROR_IDS_5)
[grammar] ~20-~20: Use correct spacing
Context: ... → produces JSON IDL → consumed by code generators. ## Common Commands ### Building and Testi...
(QB_NEW_EN_OTHER_ERROR_IDS_5)
[grammar] ~22-~22: Use correct spacing
Context: ...consumed by code generators. ## Common Commands ### Building and Testing ```bash cargo test...
(QB_NEW_EN_OTHER_ERROR_IDS_5)
[grammar] ~24-~24: Use correct spacing
Context: .... ## Common Commands ### Building and Testing bash cargo test # Run all tests across workspace cargo build # Build all crates cargo build --release # Release build ### CLI Usage ```bash cargo install shank-c...
(QB_NEW_EN_OTHER_ERROR_IDS_5)
[grammar] ~31-~31: Use correct spacing
Context: ...se # Release build ### CLI Usagebash cargo install shank-cli # Install CLI globally shank idl # Extract IDL to ./idl/ directory shank idl -o
### Release Processbash cargo test && c...
(QB_NEW_EN_OTHER_ERROR_IDS_5)
[grammar] ~39-~39: Use correct spacing
Context: ...ify program crate root ### Release Processbash cargo test && cargo release <major|minor|patch> # Dry run cargo release <major|minor|patch> --execute # Execute release ``` ## Key Macro Annotations - `#[derive(Shan...
(QB_NEW_EN_OTHER_ERROR_IDS_5)
[grammar] ~45-~45: There might be a problem here.
Context: ... # Execute release ``` ## Key Macro Annotations - #[derive(ShankAccount)] - Marks account structs with optional `#[...
(QB_NEW_EN_MERGED_MATCH)
[grammar] ~47-~47:
Context: ...tructs with optional #[seeds] for PDA generation - #[derive(ShankInstruction)] - Marks instruction enums with `#[account...
(QB_NEW_EN_OTHER_ERROR_IDS_)
[grammar] ~48-~48:
Context: ...rks instruction enums with #[account] attributes - #[derive(ShankType)] - Marks custom types for IDL inclusion - ...
(QB_NEW_EN_OTHER_ERROR_IDS_)
[grammar] ~49-~49:
Context: ...ankType)]- Marks custom types for IDL inclusion -#[derive(ShankBuilder)]- Generates instruction builders -#[de...
(QB_NEW_EN_OTHER_ERROR_IDS_)
[grammar] ~50-~50:
Context: ...ShankBuilder)]- Generates instruction builders -#[derive(ShankContext)]` - Generates account context structs ### ...
(QB_NEW_EN_OTHER_ERROR_IDS_)
[grammar] ~51-~51: Use correct spacing
Context: ...kContext)]- Generates account context structs ### Field Attributes -#[padding]` - Mark...
(QB_NEW_EN_OTHER_ERROR_IDS_5)
[grammar] ~53-~53: There might be a problem here.
Context: ...ates account context structs ### Field Attributes - #[padding] - Marks field as padding in IDL - `#[idl_...
(QB_NEW_EN_MERGED_MATCH)
[grammar] ~55-~55:
Context: ...#[padding]- Marks field as padding in IDL -#[idl_type("TypeName")]- Overrides field type in IDL -#[idl_na...
(QB_NEW_EN_OTHER_ERROR_IDS_)
[grammar] ~56-~56:
Context: ..."TypeName")]- Overrides field type in IDL -#[idl_name("name")]` - Renames field in IDL while keeping Rust...
(QB_NEW_EN_OTHER_ERROR_IDS_)
[grammar] ~57-~57:
Context: ...s field in IDL while keeping Rust field name - #[skip] - Excludes field from IDL entirely ## Te...
(QB_NEW_EN_OTHER_ERROR_IDS_)
[grammar] ~58-~58: There might be a problem here.
Context: ...e - #[skip] - Excludes field from IDL entirely ## Testing Test files are organized in each crate'...
(QB_NEW_EN_MERGED_MATCH)
[grammar] ~62-~62: Use correct spacing
Context: ...both macro expansion and IDL generation accuracy. ## Development Notes - Uses Rust 2018 edi...
(QB_NEW_EN_OTHER_ERROR_IDS_5)
[grammar] ~64-~64: Use correct spacing
Context: ...DL generation accuracy. ## Development Notes - Uses Rust 2018 edition - Release config...
(QB_NEW_EN_OTHER_ERROR_IDS_5)
[grammar] ~66-~66: There might be a mistake here.
Context: ... ## Development Notes - Uses Rust 2018 edition - Release configuration in `release.tom...
(QB_NEW_EN_OTHER)
[grammar] ~68-~68: Use articles correctly
Context: ...tion in release.toml - Only releases from master branch - Uses rustfmt.toml f...
(QB_NEW_EN_OTHER_ERROR_IDS_11)
[grammar] ~68-~68: There might be a mistake here.
Context: ...se.toml - Only releases frommasterbranch - Usesrustfmt.toml` for consistent fo...
(QB_NEW_EN_OTHER)
[grammar] ~69-~69: There might be a mistake here.
Context: ...ch - Uses rustfmt.toml for consistent formatting - Heavy use of syn and quote for ma...
(QB_NEW_EN_OTHER)
[grammar] ~70-~70: Use a period to end declarative sentences
Context: ...eavy use of syn and quote for macro implementation
(QB_NEW_EN_OTHER_ERROR_IDS_25)
🪛 markdownlint-cli2 (0.17.2)
CLAUDE.md
24-24: Headings should be surrounded by blank lines
Expected: 1; Actual: 0; Below
(MD022, blanks-around-headings)
25-25: Fenced code blocks should be surrounded by blank lines
(MD031, blanks-around-fences)
31-31: Headings should be surrounded by blank lines
Expected: 1; Actual: 0; Below
(MD022, blanks-around-headings)
32-32: Fenced code blocks should be surrounded by blank lines
(MD031, blanks-around-fences)
39-39: Headings should be surrounded by blank lines
Expected: 1; Actual: 0; Below
(MD022, blanks-around-headings)
40-40: Fenced code blocks should be surrounded by blank lines
(MD031, blanks-around-fences)
50-50: Trailing spaces
Expected: 0 or 2; Actual: 1
(MD009, no-trailing-spaces)
67-67: Trailing spaces
Expected: 0 or 2; Actual: 1
(MD009, no-trailing-spaces)
70-70: Files should end with a single newline character
(MD047, single-trailing-newline)
🔇 Additional comments (12)
shank-idl/src/idl_type_definition.rs (1)
30-30: LGTM! Clean implementation of skip attribute filtering.The filter correctly excludes fields marked with the
skipattribute before converting them to IDL fields. This is the right place in the conversion pipeline to implement this functionality.shank-idl/tests/accounts.rs (1)
79-87: LGTM! Test follows established patterns and provides good coverage.The new test function correctly follows the existing test pattern in the file and provides essential coverage for the field attributes functionality.
shank-idl/src/idl_field.rs (1)
22-27: LGTM! Clear implementation of idl_name attribute support.The name override logic is well-implemented with a clear fallback strategy. The comment explains the behavior and the code maintains backward compatibility.
shank-idl/tests/fixtures/accounts/single_file/field_attributes.json (1)
1-50: LGTM! Comprehensive test fixture covering all field attribute combinations.The JSON fixture effectively demonstrates the various field attribute combinations:
- Normal field without attributes
idl-nameattribute for field renaming- Combined
idl-name+paddingattributes- Combined
idl-type+idl-nameattributesThis provides thorough test coverage for the new functionality.
shank-macro-impl/src/parsed_struct/parsed_struct.rs (1)
48-62: LGTM! Well-implemented accessor methods for field attributes.Both methods are correctly implemented:
name_override()efficiently extracts the custom name from theIdlNameattributeis_skipped()uses idiomatic Rust pattern matching to check for theSkipattributeThese methods provide clean APIs for the IDL conversion logic to use.
shank-macro/src/lib.rs (3)
55-79: Excellent documentation for the new field attributes.The documentation clearly explains both new attributes with practical examples. The
#[idl_name("name")]attribute documentation shows how to rename fields in IDL while preserving Rust field names, and the#attribute documentation demonstrates excluding fields from IDL output.
138-141: Correctly updated ShankAccount derive macro attributes.The macro properly declares support for the new
idl_nameandskipattributes alongside existing ones.
385-385: Appropriately updated ShankType derive macro attributes.The ShankType macro now correctly supports all three field attributes:
idl_name,idl_type, andskip.shank-macro-impl/src/parsed_struct/struct_field_attr.rs (3)
14-15: Well-designed enum variants for the new attributes.The
IdlName(String)andSkipvariants properly capture the semantic meaning of each attribute type.
23-24: Appropriate string representations for new attributes.The string identifiers "idl-name" and "skip" follow the established pattern and provide clear identification.
40-73: Robust parsing implementation with excellent error handling.The parsing logic correctly handles both new attributes:
skipattribute is simple and requires no argumentsidl_nameattribute validates exactly one string literal argument with comprehensive error messagesThe error messages are descriptive and provide helpful guidance to users about the expected format.
shank-idl/tests/fixtures/accounts/single_file/field_attributes.rs (1)
1-22: Comprehensive test fixture covering all new attribute scenarios.This fixture excellently demonstrates:
- Basic
#[idl_name("customName")]usage for field renaming- Simple
#usage for field exclusion- Combining
#[idl_name("renamedAndPadded")]with#[padding]- Combining
#[idl_type("u32")]with#[idl_name("customTypedField")]The examples show practical use cases and validate that the new attributes work both independently and in combination with existing ones.
| # CLAUDE.md | ||
|
|
||
| This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository. | ||
|
|
||
| ## Project Overview | ||
|
|
||
| Shank is a collection of Rust crates that extract Interface Definition Language (IDL) files from Solana programs using macro annotations. The generated IDL is consumed by tools like [solita](https://github.com/metaplex-foundation/solita) to generate TypeScript SDKs for Solana programs. | ||
|
|
||
| ## Architecture | ||
|
|
||
| This is a Rust workspace containing 6 main crates: | ||
|
|
||
| - **shank** - Top-level crate that exports all macros, entry point for users | ||
| - **shank-macro** - Provides derive macros (`ShankAccount`, `ShankInstruction`, `ShankType`, etc.) | ||
| - **shank-macro-impl** - Core implementation of the derive macros and parsing logic | ||
| - **shank-idl** - Processes Rust source files to extract IDL from shank annotations | ||
| - **shank-render** - Generates Rust code (like PDA functions) from annotations | ||
| - **shank-cli** - Command-line tool that orchestrates IDL extraction | ||
|
|
||
| The workflow: Users annotate their Solana program structs/enums with shank macros → shank-cli analyzes the source code → produces JSON IDL → consumed by code generators. | ||
|
|
||
| ## Common Commands | ||
|
|
||
| ### Building and Testing | ||
| ```bash | ||
| cargo test # Run all tests across workspace | ||
| cargo build # Build all crates | ||
| cargo build --release # Release build | ||
| ``` | ||
|
|
||
| ### CLI Usage | ||
| ```bash | ||
| cargo install shank-cli # Install CLI globally | ||
| shank idl # Extract IDL to ./idl/ directory | ||
| shank idl -o <dir> # Extract IDL to custom directory | ||
| shank idl -r <crate-root> # Specify program crate root | ||
| ``` | ||
|
|
||
| ### Release Process | ||
| ```bash | ||
| cargo test && cargo release <major|minor|patch> # Dry run | ||
| cargo release <major|minor|patch> --execute # Execute release | ||
| ``` | ||
|
|
||
| ## Key Macro Annotations | ||
|
|
||
| - `#[derive(ShankAccount)]` - Marks account structs with optional `#[seeds]` for PDA generation | ||
| - `#[derive(ShankInstruction)]` - Marks instruction enums with `#[account]` attributes | ||
| - `#[derive(ShankType)]` - Marks custom types for IDL inclusion | ||
| - `#[derive(ShankBuilder)]` - Generates instruction builders | ||
| - `#[derive(ShankContext)]` - Generates account context structs | ||
|
|
||
| ### Field Attributes | ||
|
|
||
| - `#[padding]` - Marks field as padding in IDL | ||
| - `#[idl_type("TypeName")]` - Overrides field type in IDL | ||
| - `#[idl_name("name")]` - Renames field in IDL while keeping Rust field name | ||
| - `#[skip]` - Excludes field from IDL entirely | ||
|
|
||
| ## Testing | ||
|
|
||
| Test files are organized in each crate's `tests/` directory with fixture files demonstrating expected behavior. Tests verify both macro expansion and IDL generation accuracy. | ||
|
|
||
| ## Development Notes | ||
|
|
||
| - Uses Rust 2018 edition | ||
| - Release configuration in `release.toml` | ||
| - Only releases from `master` branch | ||
| - Uses `rustfmt.toml` for consistent formatting | ||
| - Heavy use of `syn` and `quote` for macro implementation No newline at end of file |
There was a problem hiding this comment.
🧹 Nitpick (assertive)
Valuable documentation addition with minor formatting issues to address.
This documentation file provides excellent guidance for AI assistance with the Shank codebase. The content accurately describes the architecture, workflow, and key concepts.
Please address the formatting issues identified by static analysis:
-Shank is a collection of Rust crates that extract Interface Definition Language (IDL) files from Solana programs using macro annotations. The generated IDL is consumed by tools like [solita](https://github.com/metaplex-foundation/solita) to generate TypeScript SDKs for Solana programs.
+Shank is a collection of Rust crates that extract Interface Definition Language (IDL) files from Solana programs using macro annotations. The generated IDL is consumed by tools like [solita](https://github.com/metaplex-foundation/solita) to generate TypeScript SDKs for Solana programs.
### Building and Testing
+
```bash
cargo test # Run all tests across workspace
cargo build # Build all crates
cargo build --release # Release buildCLI Usage
cargo install shank-cli # Install CLI globally
shank idl # Extract IDL to ./idl/ directory
shank idl -o <dir> # Extract IDL to custom directory
shank idl -r <crate-root> # Specify program crate rootRelease Process
cargo test && cargo release <major|minor|patch> # Dry run
cargo release <major|minor|patch> --execute # Execute release-- #[derive(ShankBuilder)] - Generates instruction builders
-- #[derive(ShankContext)] - Generates account context structs
+- #[derive(ShankBuilder)] - Generates instruction builders
+- #[derive(ShankContext)] - Generates account context structs
-- Only releases from master branch
-- Uses rustfmt.toml for consistent formatting
-- Heavy use of syn and quote for macro implementation
+- Only releases from the master branch
+- Uses rustfmt.toml for consistent formatting
+- Heavy use of syn and quote for macro implementation
<details>
<summary>🧰 Tools</summary>
<details>
<summary>🪛 LanguageTool</summary>
[grammar] ~1-~1: Use correct spacing
Context: # CLAUDE.md This file provides guidance to Claude C...
(QB_NEW_EN_OTHER_ERROR_IDS_5)
---
[grammar] ~3-~3: Use correct spacing
Context: ...ai/code) when working with code in this repository. ## Project Overview Shank is a collection...
(QB_NEW_EN_OTHER_ERROR_IDS_5)
---
[grammar] ~5-~5: Use correct spacing
Context: ...th code in this repository. ## Project Overview Shank is a collection of Rust crates th...
(QB_NEW_EN_OTHER_ERROR_IDS_5)
---
[grammar] ~7-~7: There might be a problem here.
Context: ... to generate TypeScript SDKs for Solana programs. ## Architecture This is a Rust workspace containing 6 m...
(QB_NEW_EN_MERGED_MATCH)
---
[grammar] ~11-~11: Use correct spacing
Context: ...s is a Rust workspace containing 6 main crates: - **shank** - Top-level crate that exports ...
(QB_NEW_EN_OTHER_ERROR_IDS_5)
---
[grammar] ~18-~18: Use correct spacing
Context: ...Command-line tool that orchestrates IDL extraction The workflow: Users annotate their Sola...
(QB_NEW_EN_OTHER_ERROR_IDS_5)
---
[grammar] ~20-~20: Use correct spacing
Context: ... → produces JSON IDL → consumed by code generators. ## Common Commands ### Building and Testi...
(QB_NEW_EN_OTHER_ERROR_IDS_5)
---
[grammar] ~22-~22: Use correct spacing
Context: ...consumed by code generators. ## Common Commands ### Building and Testing ```bash cargo test...
(QB_NEW_EN_OTHER_ERROR_IDS_5)
---
[grammar] ~24-~24: Use correct spacing
Context: .... ## Common Commands ### Building and Testing ```bash cargo test # Run all tests across workspace cargo build # Build all crates cargo build --release # Release build ``` ### CLI Usage ```bash cargo install shank-c...
(QB_NEW_EN_OTHER_ERROR_IDS_5)
---
[grammar] ~31-~31: Use correct spacing
Context: ...se # Release build ``` ### CLI Usage ```bash cargo install shank-cli # Install CLI globally shank idl # Extract IDL to ./idl/ directory shank idl -o <dir> # Extract IDL to custom directory shank idl -r <crate-root> # Specify program crate root ``` ### Release Process ```bash cargo test && c...
(QB_NEW_EN_OTHER_ERROR_IDS_5)
---
[grammar] ~39-~39: Use correct spacing
Context: ...ify program crate root ``` ### Release Process ```bash cargo test && cargo release <major|minor|patch> # Dry run cargo release <major|minor|patch> --execute # Execute release ``` ## Key Macro Annotations - `#[derive(Shan...
(QB_NEW_EN_OTHER_ERROR_IDS_5)
---
[grammar] ~45-~45: There might be a problem here.
Context: ... # Execute release ``` ## Key Macro Annotations - `#[derive(ShankAccount)]` - Marks account structs with optional `#[...
(QB_NEW_EN_MERGED_MATCH)
---
[grammar] ~47-~47:
Context: ...tructs with optional `#[seeds]` for PDA generation - `#[derive(ShankInstruction)]` - Marks instruction enums with `#[account...
(QB_NEW_EN_OTHER_ERROR_IDS_)
---
[grammar] ~48-~48:
Context: ...rks instruction enums with `#[account]` attributes - `#[derive(ShankType)]` - Marks custom types for IDL inclusion - ...
(QB_NEW_EN_OTHER_ERROR_IDS_)
---
[grammar] ~49-~49:
Context: ...ankType)]` - Marks custom types for IDL inclusion - `#[derive(ShankBuilder)]` - Generates instruction builders - `#[de...
(QB_NEW_EN_OTHER_ERROR_IDS_)
---
[grammar] ~50-~50:
Context: ...ShankBuilder)]` - Generates instruction builders - `#[derive(ShankContext)]` - Generates account context structs ### ...
(QB_NEW_EN_OTHER_ERROR_IDS_)
---
[grammar] ~51-~51: Use correct spacing
Context: ...kContext)]` - Generates account context structs ### Field Attributes - `#[padding]` - Mark...
(QB_NEW_EN_OTHER_ERROR_IDS_5)
---
[grammar] ~53-~53: There might be a problem here.
Context: ...ates account context structs ### Field Attributes - `#[padding]` - Marks field as padding in IDL - `#[idl_...
(QB_NEW_EN_MERGED_MATCH)
---
[grammar] ~55-~55:
Context: ...#[padding]` - Marks field as padding in IDL - `#[idl_type("TypeName")]` - Overrides field type in IDL - `#[idl_na...
(QB_NEW_EN_OTHER_ERROR_IDS_)
---
[grammar] ~56-~56:
Context: ..."TypeName")]` - Overrides field type in IDL - `#[idl_name("name")]` - Renames field in IDL while keeping Rust...
(QB_NEW_EN_OTHER_ERROR_IDS_)
---
[grammar] ~57-~57:
Context: ...s field in IDL while keeping Rust field name - `#[skip]` - Excludes field from IDL entirely ## Te...
(QB_NEW_EN_OTHER_ERROR_IDS_)
---
[grammar] ~58-~58: There might be a problem here.
Context: ...e - `#[skip]` - Excludes field from IDL entirely ## Testing Test files are organized in each crate'...
(QB_NEW_EN_MERGED_MATCH)
---
[grammar] ~62-~62: Use correct spacing
Context: ...both macro expansion and IDL generation accuracy. ## Development Notes - Uses Rust 2018 edi...
(QB_NEW_EN_OTHER_ERROR_IDS_5)
---
[grammar] ~64-~64: Use correct spacing
Context: ...DL generation accuracy. ## Development Notes - Uses Rust 2018 edition - Release config...
(QB_NEW_EN_OTHER_ERROR_IDS_5)
---
[grammar] ~66-~66: There might be a mistake here.
Context: ... ## Development Notes - Uses Rust 2018 edition - Release configuration in `release.tom...
(QB_NEW_EN_OTHER)
---
[grammar] ~68-~68: Use articles correctly
Context: ...tion in `release.toml` - Only releases from `master` branch - Uses `rustfmt.toml` f...
(QB_NEW_EN_OTHER_ERROR_IDS_11)
---
[grammar] ~68-~68: There might be a mistake here.
Context: ...se.toml` - Only releases from `master` branch - Uses `rustfmt.toml` for consistent fo...
(QB_NEW_EN_OTHER)
---
[grammar] ~69-~69: There might be a mistake here.
Context: ...ch - Uses `rustfmt.toml` for consistent formatting - Heavy use of `syn` and `quote` for ma...
(QB_NEW_EN_OTHER)
---
[grammar] ~70-~70: Use a period to end declarative sentences
Context: ...eavy use of `syn` and `quote` for macro implementation
(QB_NEW_EN_OTHER_ERROR_IDS_25)
</details>
<details>
<summary>🪛 markdownlint-cli2 (0.17.2)</summary>
24-24: Headings should be surrounded by blank lines
Expected: 1; Actual: 0; Below
(MD022, blanks-around-headings)
---
25-25: Fenced code blocks should be surrounded by blank lines
(MD031, blanks-around-fences)
---
31-31: Headings should be surrounded by blank lines
Expected: 1; Actual: 0; Below
(MD022, blanks-around-headings)
---
32-32: Fenced code blocks should be surrounded by blank lines
(MD031, blanks-around-fences)
---
39-39: Headings should be surrounded by blank lines
Expected: 1; Actual: 0; Below
(MD022, blanks-around-headings)
---
40-40: Fenced code blocks should be surrounded by blank lines
(MD031, blanks-around-fences)
---
50-50: Trailing spaces
Expected: 0 or 2; Actual: 1
(MD009, no-trailing-spaces)
---
67-67: Trailing spaces
Expected: 0 or 2; Actual: 1
(MD009, no-trailing-spaces)
---
70-70: Files should end with a single newline character
(MD047, single-trailing-newline)
</details>
</details>
<details>
<summary>🤖 Prompt for AI Agents</summary>
In CLAUDE.md from lines 1 to 70, fix the markdown formatting issues by ensuring
consistent spacing and proper code block delimiters around bash commands, remove
extra blank lines before and after code blocks, and adjust list item indentation
and spacing for bullet points to align with markdown standards. Also, correct
minor wording in the last bullet point by adding "the" before "master branch"
for clarity.
</details>
<!-- fingerprinting:phantom:poseidon:panther -->
<!-- This is an auto-generated comment by CodeRabbit -->
There was a problem hiding this comment.
Actionable comments posted: 2
📜 Review details
Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (1)
shank-macro/README.md(1 hunks)
🧰 Additional context used
🪛 LanguageTool
shank-macro/README.md
[grammar] ~75-~75: There might be a problem here.
Context: ...etween your Rust code and the generated IDL. rs use shank::ShankAccount; use borsh::{BorshDeserialize, BorshSerialize}; #[derive(Clone, BorshSerialize, BorshDeserialize, ShankAccount)] pub struct MyAccount { // This field will appear as "displayName" in the IDL #[idl_name("displayName")] pub internal_name: String, // This field will appear as "userCount" in the IDL #[idl_name("userCount")] pub total_users: u32, } #### #[skip] attribute Excludes the field from the IDL entire...
(QB_NEW_EN_MERGED_MATCH)
[grammar] ~95-~95: Use correct spacing
Context: ...t shouldn't be exposed in the interface definition. rs use shank::ShankAccount; use borsh::{BorshDeserialize, BorshSerialize}; #[derive(Clone, BorshSerialize, BorshDeserialize, ShankAccount)] pub struct MyAccount { // This field will appear in the IDL pub public_field: u64, // This field will be excluded from the IDL #[skip] pub internal_only_field: String, // This field will also be excluded from the IDL #[skip] pub debug_info: Vec<u8>, } #### Combining Attributes You can combine m...
(QB_NEW_EN_OTHER_ERROR_IDS_5)
[grammar] ~116-~116: Use correct spacing
Context: ...ug_info: Vec, } ``` #### Combining Attributes You can combine multiple field attribut...
(QB_NEW_EN_OTHER_ERROR_IDS_5)
[grammar] ~118-~118: Use correct spacing
Context: ...e multiple field attributes on the same field: rs use shank::ShankAccount; use borsh::{BorshDeserialize, BorshSerialize}; #[derive(Clone, BorshSerialize, BorshDeserialize, ShankAccount)] pub struct MyAccount { // Rename the field and override its type #[idl_name("customField")] #[idl_type("CustomType")] pub internal_field: SomeWrapper<CustomType>, // Mark as padding and rename #[padding] #[idl_name("alignmentPadding")] pub _padding: [u8; 8], } ### Note The fields of a _ShankAccount_ struct can reference other types as long as they are annotated with `BorshSerialize`, `BorshDeserialize`, or `ShankType`. ## ShankInstruction Annotates the program _Instruction_ `Enum` in order to include `#[account]` attributes. The `#[account]` attributes indicate for each instruction _variant_ which accounts it expects and how they should be configured. ### `#[account]` attribute This attribute allows you to configure each account that is provided to the particular instruction. These annotations need to follow the order in which the accounts are provided. They take the following general form: rs #[account(index?, (writable|signer)?, name="<account_name>", desc?="optional description")] ``` - index: optionally provides the account index...
(QB_NEW_EN_OTHER_ERROR_IDS_5)
| #### `#[skip]` attribute | ||
|
|
||
| Excludes the field from the IDL entirely. The field will not appear in the generated IDL. This is useful for internal-only fields that shouldn't be exposed in the interface definition. | ||
|
|
||
| ```rs |
There was a problem hiding this comment.
🧹 Nitpick (assertive)
Tweak wording to avoid repetition
The sentence repeats “IDL”; the second occurrence can be dropped:
-Excludes the field from the IDL entirely. The field will not appear in the generated IDL.
+Excludes the field entirely so it does not appear in the generated IDL.📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| #### `#[skip]` attribute | |
| Excludes the field from the IDL entirely. The field will not appear in the generated IDL. This is useful for internal-only fields that shouldn't be exposed in the interface definition. | |
| ```rs | |
| #### `#[skip]` attribute | |
| Excludes the field entirely so it does not appear in the generated IDL. This is useful for internal-only fields that shouldn't be exposed in the interface definition. | |
🧰 Tools
🪛 LanguageTool
[grammar] ~95-~95: Use correct spacing
Context: ...t shouldn't be exposed in the interface definition. rs use shank::ShankAccount; use borsh::{BorshDeserialize, BorshSerialize}; #[derive(Clone, BorshSerialize, BorshDeserialize, ShankAccount)] pub struct MyAccount { // This field will appear in the IDL pub public_field: u64, // This field will be excluded from the IDL #[skip] pub internal_only_field: String, // This field will also be excluded from the IDL #[skip] pub debug_info: Vec<u8>, } #### Combining Attributes You can combine m...
(QB_NEW_EN_OTHER_ERROR_IDS_5)
🤖 Prompt for AI Agents
In shank-macro/README.md around lines 93 to 97, the description of the #[skip]
attribute repeats the term "IDL" unnecessarily. Edit the sentence to remove the
second occurrence of "IDL" to improve readability and avoid redundancy, keeping
the meaning clear and concise.
| #### `#[idl_name("name")]` attribute | ||
|
|
||
| Allows you to override the field name that appears in the IDL while keeping the original Rust field name. This is useful when you need different naming conventions between your Rust code and the generated IDL. | ||
|
|
||
| ```rs |
There was a problem hiding this comment.
🧹 Nitpick (assertive)
Minor grammar-style polish for the new section
Consider inserting a comma to improve the flow and changing “while” → “but” for clarity:
-Allows you to override the field name that appears in the IDL while keeping the original Rust field name.
+Allows you to override the field name that appears in the IDL, but keeps the original Rust field name.📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| #### `#[idl_name("name")]` attribute | |
| Allows you to override the field name that appears in the IDL while keeping the original Rust field name. This is useful when you need different naming conventions between your Rust code and the generated IDL. | |
| ```rs | |
| #### `#[idl_name("name")]` attribute | |
| Allows you to override the field name that appears in the IDL, but keeps the original Rust field name. This is useful when you need different naming conventions between your Rust code and the generated IDL. | |
🧰 Tools
🪛 LanguageTool
[grammar] ~75-~75: There might be a problem here.
Context: ...etween your Rust code and the generated IDL. rs use shank::ShankAccount; use borsh::{BorshDeserialize, BorshSerialize}; #[derive(Clone, BorshSerialize, BorshDeserialize, ShankAccount)] pub struct MyAccount { // This field will appear as "displayName" in the IDL #[idl_name("displayName")] pub internal_name: String, // This field will appear as "userCount" in the IDL #[idl_name("userCount")] pub total_users: u32, } #### #[skip] attribute Excludes the field from the IDL entire...
(QB_NEW_EN_MERGED_MATCH)
🤖 Prompt for AI Agents
In shank-macro/README.md around lines 73 to 77, improve the grammar and clarity
of the sentence describing the #[idl_name("name")] attribute by inserting a
comma after "IDL" and replacing "while" with "but" to better convey the contrast
between Rust field names and generated IDL names.
This PR adds
#[skip]and#[idl_name("name")]field attributes forShankAccountandShankTypestructs for more IDL output customization.e.g.