Skip to content

docs: add auto-generated code documentation#149

Open
enesgules wants to merge 2 commits into
cleder:developfrom
enesgules:codedocs/auto-generated
Open

docs: add auto-generated code documentation#149
enesgules wants to merge 2 commits into
cleder:developfrom
enesgules:codedocs/auto-generated

Conversation

@enesgules

@enesgules enesgules commented May 1, 2026

Copy link
Copy Markdown

Auto-generated Code Documentation

AI-analyzed source code to produce structured documentation including:

  • Architecture overview with diagrams
  • Core concepts and internals
  • API reference with parameter tables
  • Practical usage guides

Browse the documentation →


Generated by Context7 · View docs

Summary by Sourcery

Add comprehensive auto-generated documentation for crepr’s architecture, concepts, and public API, including CLI usage and repr-generation workflows.

Documentation:

  • Introduce a getting-started guide explaining the problem crepr solves, installation options, and a quick-start example.
  • Document the internal architecture and core concepts such as discovery/loading, class selection, repr generation, and edit modes.
  • Add API reference pages for source inspection helpers, generation/mutation utilities, package-level exports, and CLI commands.
  • Provide step-by-step guides for generating/previewing reprs, reviewing diffs and applying changes, working with existing reprs/kwargs, and removing generated reprs.

Summary by CodeRabbit

  • Documentation
    • Added comprehensive documentation suite including getting started guide, system architecture overview, complete API references for CLI commands and public functions, and multiple user guides covering preview workflows, diff inspection, inline file application, and handling existing __repr__ implementations.

@semanticdiff-com

Copy link
Copy Markdown

Review changes with  SemanticDiff

@sourcery-ai

sourcery-ai Bot commented May 1, 2026

Copy link
Copy Markdown
Contributor

Reviewer's Guide

Adds a new auto-generated documentation section under docs/codedocs describing crepr’s architecture, concepts, CLI, and public APIs, without changing any library or test code.

Sequence diagram for crepr add command with diff and inline modes

sequenceDiagram
  actor User
  participant App as app
  participant Add as add
  participant GM as get_modules
  participant GMod as get_module
  participant Sel as get_all_init_args
  participant Gen as create_repr
  participant Apply as apply_changes
  participant Ins as insert_changes
  participant Diff as print_diff

  User->>App: invoke crepr add files [flags]
  App->>Add: dispatch add(files, kwarg_splat, diff, ignore_existing)

  Add->>GM: get_modules(files)
  loop each file
    GM->>GMod: get_module(file_path)
    alt import ok
      GMod-->>GM: ModuleType
    else CreprError
      GMod-->>GM: raise CreprError
      GM-->>Add: skip file after error output
    end
  end

  loop each loaded module
    Add->>Sel: get_all_init_args(module)
    Sel-->>Add: iterator of (cls, init_args, line, source)

    Add->>Gen: create_repr(module, kwarg_splat, ignore_existing_flag)
    Gen-->>Add: changes: dict[int, Change]

    alt diff is None
      Add->>Add: print_changes(changes, action="generated")
    else diff is True
      Add->>Apply: apply_changes(module, changes, file_path, diff=True, change_func=insert_changes)
      Apply->>Ins: insert_changes(module, changes)
      Ins-->>Apply: new_source_lines
      Apply->>Diff: print_diff(before, after)
      Diff-->>User: unified diff
    else diff is False
      Add->>Apply: apply_changes(module, changes, file_path, diff=False, change_func=insert_changes)
      Apply->>Ins: insert_changes(module, changes)
      Ins-->>Apply: new_source_lines
      Apply-->>User: file rewritten on disk
    end
  end
Loading

Class diagram for core public types and their relationships

classDiagram
  class CreprError {
    - message: str
    - exit_code: int
    + __init__(self: Self, message: str, exit_code: int)
  }

  class Change {
    class_name: str
    lines: list[str]
  }

  class ModuleType
  class TyperApp

  class Functions {
    + get_module(file_path: pathlib_Path) ModuleType
    + get_modules(files: Iterable_pathlib_Path) Iterator_ModuleType_pathlib_Path
    + get_all_init_args(module: ModuleType) Iterator_type_MappingProxyType_int_list_str
    + create_repr(module: ModuleType, kwarg_splat: str, ignore_existing: bool) dict_int_Change
    + remove_repr(module: ModuleType) dict_int_Change
    + insert_changes(module: ModuleType, changes: dict_int_Change) list_str
    + remove_changes(module: ModuleType, changes: dict_int_Change) list_str
    + apply_changes(module: ModuleType, changes: dict_int_Change, file_path: pathlib_Path, diff: bool, change_func: Callable_ModuleType_dict_int_Change_list_str_) None
  }

  class CLICommands {
    + add(files: list_pathlib_Path, kwarg_splat: str, diff: Optional_bool, ignore_existing: bool) None
    + remove(files: list_pathlib_Path, diff: Optional_bool) None
  }

  TyperApp <|-- CLICommands : registered_as
  Functions --> Change : uses
  Functions --> ModuleType : inspects
  CLICommands --> TyperApp : entry_point
  CLICommands --> Functions : orchestration
  CreprError <.. Functions : raises get_module_error
Loading

File-Level Changes

Change Details Files
Introduce an API reference for source inspection helpers that load modules and select eligible classes.
  • Document helper functions for recovering method and constructor source (get_method_source, get_init_source, get_repr_source, get_init_args).
  • Explain class filtering rules via has_only_kwargs, is_class_in_module, repr_exists, and get_all_init_args with examples.
  • Describe module loading utilities get_module and get_modules, including error behavior and usage patterns.
docs/codedocs/api-reference/source-inspection.md
Document the generation and mutation API that builds repr changes and applies them to source files.
  • Describe create_repr_lines, create_repr, and remove_repr, including their signatures and return shapes.
  • Detail mutation helpers insert_changes, remove_changes, print_changes, print_diff, and apply_changes, and how they are composed.
  • Provide example flows for programmatic add/remove operations using these helpers.
docs/codedocs/api-reference/generation-and-mutation.md
Document package-level exports, public types, and CLI option objects.
  • Explain __version__, the Typer app entry point, and how it is wired via pyproject.
  • Describe CreprError and Change and how they are meant to be used programmatically.
  • Document shared Typer argument/option objects (file_arg, splat_option, diff_inline_option, ignore_existing_option) for readers of CLI signatures.
docs/codedocs/api-reference/package-exports.md
Add a CLI commands reference for the add and remove Typer commands.
  • Document signatures, parameters, defaults, and behaviors of add and remove.
  • Clarify interactions of --diff, --inline, --kwarg-splat, and --ignore-existing.
  • Provide common usage patterns and explain how the commands rely on internal helpers like get_modules, create_repr, and apply_changes.
docs/codedocs/api-reference/cli-commands.md
Introduce a high-level getting started page describing crepr’s purpose and basic workflow.
  • Explain the motivating problem and crepr’s solution at a conceptual level.
  • Provide installation instructions for multiple Python tooling ecosystems (pip, uv, pipx, poetry).
  • Show a quick-start example running crepr add and highlight key features with navigation to deeper docs.
docs/codedocs/index.md
Add concept documentation pages explaining core internal ideas: repr generation, class selection, discovery/loading, architecture, and edit modes.
  • Describe how constructor parameters are transformed into __repr__ source (repr-generation.md).
  • Explain class eligibility rules and filtering (class-selection.md).
  • Detail how files are imported and inspected via importlib and inspect (discovery-and-loading.md).
  • Provide an architectural overview tying together loaders, scanners, generators, and writers (architecture.md).
  • Explain the different edit modes (preview, diff, inline) and how they map to internal helpers (edit-modes.md).
docs/codedocs/repr-generation.md
docs/codedocs/class-selection.md
docs/codedocs/discovery-and-loading.md
docs/codedocs/architecture.md
docs/codedocs/edit-modes.md
Add end-user guides for common workflows around generation, review, kwargs handling, and removal.
  • Guide for generating and previewing reprs without modifying files (generate-preview.md).
  • Guide for reviewing diffs and then applying changes inline (review-diff-and-apply.md).
  • Guide for working with existing __repr__ methods and tuning the **kwargs placeholder (work-with-existing-reprs.md).
  • Guide for removing previously generated reprs, including preview and diff workflows (remove-generated-reprs.md).
docs/codedocs/guides/generate-preview.md
docs/codedocs/guides/review-diff-and-apply.md
docs/codedocs/guides/work-with-existing-reprs.md
docs/codedocs/guides/remove-generated-reprs.md

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@coderabbitai

coderabbitai Bot commented May 1, 2026

Copy link
Copy Markdown
📝 Walkthrough

Walkthrough

Adds comprehensive documentation to the crepr project comprising getting started guide, architecture overview, core concept pages (class selection, discovery and loading, representation generation, edit modes), API reference docs for CLI commands and functions, and four user guides covering preview, removal, diff-and-apply, and existing __repr__ workflows.

Changes

Cohort / File(s) Summary
Getting Started & Architecture
docs/codedocs/index.md, docs/codedocs/architecture.md
Introduction to crepr tool and high-level architecture explaining CLI entry point, module loading pipeline, class discovery, change generation, and edit-mode execution.
Core Concept Documentation
docs/codedocs/class-selection.md, docs/codedocs/discovery-and-loading.md, docs/codedocs/repr-generation.md, docs/codedocs/edit-modes.md
Detailed explanations of class eligibility rules, module discovery and loading mechanisms, __repr__ generation from constructor parameters, and the three edit modes (preview, diff, inline).
API Reference
docs/codedocs/api-reference/cli-commands.md, docs/codedocs/api-reference/generation-and-mutation.md, docs/codedocs/api-reference/package-exports.md, docs/codedocs/api-reference/source-inspection.md
Complete API documentation of public CLI commands (add, remove), generation/mutation functions, package-level exports, exception types, and source inspection helper functions.
User Guides
docs/codedocs/guides/generate-preview.md, docs/codedocs/guides/remove-generated-reprs.md, docs/codedocs/guides/review-diff-and-apply.md, docs/codedocs/guides/work-with-existing-reprs.md
Step-by-step guides covering preview workflow, removal operations, diff review and inline application, and handling existing __repr__ implementations with --ignore-existing and --kwarg-splat options.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Suggested labels

documentation, Review effort [1-5]: 2

Suggested reviewers

  • cleder

Poem

🐰 A curious rabbit hops through your docs with glee,
Fourteen pages of wisdom, from "A" to "Z" (or API)!
Guides, guides, and more guides—oh what a delight,
Your __repr__ now shines with knowledge so bright!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: adding auto-generated code documentation across architecture, guides, and API reference.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
Review rate limit: 0/1 reviews remaining, refill in 60 minutes.

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

Warning

⚠️ This pull request might be slop. It has been flagged by CodeRabbit slop detection and should be reviewed carefully.

@qodo-code-review

Copy link
Copy Markdown

Review Summary by Qodo

Add comprehensive auto-generated code documentation for crepr

📝 Documentation

Grey Divider

Walkthroughs

Description
• Adds comprehensive auto-generated code documentation covering architecture, core concepts, API
  reference, and practical guides
• Documents module loading, class selection, repr generation, and edit modes with detailed
  walkthroughs and examples
• Provides CLI command reference for add and remove with parameter tables and usage patterns
• Includes source inspection, generation/mutation functions, and package exports with import paths
  and signatures
Diagram
flowchart LR
  A["Documentation Structure"] --> B["Architecture & Concepts"]
  A --> C["API Reference"]
  A --> D["Practical Guides"]
  B --> E["Module relationships<br/>Data lifecycle<br/>Design decisions"]
  C --> F["CLI commands<br/>Generation functions<br/>Package exports<br/>Source inspection"]
  D --> G["Preview workflows<br/>Diff & apply<br/>Removal operations<br/>Kwargs handling"]
Loading

Grey Divider

File Changes

1. docs/codedocs/architecture.md 📝 Documentation +88/-0

Architecture overview with module relationships and design decisions

docs/codedocs/architecture.md


2. docs/codedocs/discovery-and-loading.md 📝 Documentation +81/-0

Module loading and source inspection concepts and walkthrough

docs/codedocs/discovery-and-loading.md


3. docs/codedocs/class-selection.md 📝 Documentation +95/-0

Class filtering and eligibility criteria with examples

docs/codedocs/class-selection.md


View more (11)
4. docs/codedocs/repr-generation.md 📝 Documentation +117/-0

Repr generation logic and parameter handling documentation

docs/codedocs/repr-generation.md


5. docs/codedocs/edit-modes.md 📝 Documentation +80/-0

Preview, diff, and inline edit mode documentation

docs/codedocs/edit-modes.md


6. docs/codedocs/index.md 📝 Documentation +117/-0

Getting started guide with installation and quick start

docs/codedocs/index.md


7. docs/codedocs/api-reference/cli-commands.md 📝 Documentation +120/-0

CLI command reference for add and remove commands

docs/codedocs/api-reference/cli-commands.md


8. docs/codedocs/api-reference/source-inspection.md 📝 Documentation +209/-0

Source inspection functions and module loading API reference

docs/codedocs/api-reference/source-inspection.md


9. docs/codedocs/api-reference/generation-and-mutation.md 📝 Documentation +200/-0

Generation and mutation functions with signatures and examples

docs/codedocs/api-reference/generation-and-mutation.md


10. docs/codedocs/api-reference/package-exports.md 📝 Documentation +169/-0

Package-level exports, types, and CLI option objects reference

docs/codedocs/api-reference/package-exports.md


11. docs/codedocs/guides/generate-preview.md 📝 Documentation +89/-0

Guide for previewing generated repr methods safely

docs/codedocs/guides/generate-preview.md


12. docs/codedocs/guides/review-diff-and-apply.md 📝 Documentation +87/-0

Guide for reviewing diffs before applying changes inline

docs/codedocs/guides/review-diff-and-apply.md


13. docs/codedocs/guides/remove-generated-reprs.md 📝 Documentation +83/-0

Guide for removing generated repr methods with workflows

docs/codedocs/guides/remove-generated-reprs.md


14. docs/codedocs/guides/work-with-existing-reprs.md 📝 Documentation +88/-0

Guide for handling existing reprs and kwargs customization

docs/codedocs/guides/work-with-existing-reprs.md


Grey Divider

Qodo Logo

@qodo-code-review

qodo-code-review Bot commented May 1, 2026

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (3) 📘 Rule violations (0)

Grey Divider


Action required

1. Broken Tabs block 🐞 Bug ☼ Reliability
Description
docs/codedocs/index.md contains an invalid Tabs section: a stray " "poetry"]}> line and a
</Tabs> close without any opening <Tabs ...> tag. This will fail MDX parsing/rendering and can
break the documentation build.
Code

docs/codedocs/index.md[R34-65]

+<Callout type="info">`crepr` is published as a Python package, so installation uses Python package managers rather than npm.</Callout>
+
+" "poetry"]}>
+<Tab value="pip">
+
+```bash
+pip install crepr
+```
+
+</Tab>
+<Tab value="uv">
+
+```bash
+uv tool install crepr
+```
+
+</Tab>
+<Tab value="pipx">
+
+```bash
+pipx install crepr
+```
+
+</Tab>
+<Tab value="poetry">
+
+```bash
+poetry add --group dev crepr
+```
+
+</Tab>
+</Tabs>
Evidence
The file contains a </Tabs> closing tag but no valid opening <Tabs> tag; instead there is a
malformed fragment line, which will not parse as a component.

docs/codedocs/index.md[32-66]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
`docs/codedocs/index.md` has a malformed Tabs block: there is an invalid fragment (`" "poetry"]}>`) and a closing `</Tabs>` without a corresponding opening `<Tabs ...>` tag, which can break MDX compilation.

## Issue Context
The installation section is intended to render a tabbed UI for pip/uv/pipx/poetry.

## Fix Focus Areas
- docs/codedocs/index.md[32-66]

## Suggested change
Replace the broken fragment line with a correct opening `<Tabs ...>` tag compatible with this docs stack (likely something like `<Tabs items={["pip","uv","pipx","poetry"]}>`), ensuring the opening/closing tags match and that all `<Tab>` children are properly nested.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


2. Invalid inline code span 🐞 Bug ☼ Reliability
Description
docs/codedocs/edit-modes.md breaks an inline code span across a newline inside a <Callout> (``
"\n".join(src) ` becomes  " <newline> ".join(src) `). This is invalid Markdown/MDX and can
fail rendering or compilation.
Code

docs/codedocs/edit-modes.md[R68-69]

+<Callout type="warn">Inline mode rewrites the file content directly with `"
+".join(src)`. There is no backup file, formatting pass, or conflict detection. Use `--diff` first if you want a review step or if the file may have been edited concurrently.</Callout>
Evidence
The callout contains a backtick-opened inline code span that is split by a literal newline, which is
not valid inline-code syntax. The intended expression is also evident from the implementation
writing "\n".join(src).

docs/codedocs/edit-modes.md[64-70]
crepr/crepr.py[380-395]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
`docs/codedocs/edit-modes.md` contains an inline code span that is split across two lines inside backticks, which is invalid Markdown/MDX and may break docs rendering.

## Issue Context
The callout is trying to document the exact string used when writing the file content in inline mode.

## Fix Focus Areas
- docs/codedocs/edit-modes.md[64-70]
- crepr/crepr.py[380-395]

## Suggested change
Rewrite the callout sentence so the code span is on a single line and matches the implementation, e.g.:

`Inline mode rewrites the file content directly with `"\n".join(src)`...`

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools



Remediation recommended

3. Broken apply_changes examples 🐞 Bug ≡ Correctness
Description
docs/codedocs/api-reference/generation-and-mutation.md includes invalid Python examples (`path
diff=True / path diff=False` missing commas), so users copying these snippets will get syntax
errors. This contradicts the documented apply_changes signature and harms usability.
Code

docs/codedocs/api-reference/generation-and-mutation.md[R176-198]

+```python
+from pathlib import Path
+from crepr.crepr import apply_changes, create_repr, get_module, insert_changes
+
+path = Path("models.py")
+module = get_module(path)
+changes = create_repr(module, kwarg_splat="kwargs=...", ignore_existing=True)
+
+apply_changes(module, changes, path diff=True, change_func=insert_changes)
+```
+
+Programmatic remove flow:
+
+```python
+from pathlib import Path
+from crepr.crepr import apply_changes, get_module, remove_changes, remove_repr
+
+path = Path("models.py")
+module = get_module(path)
+changes = remove_repr(module)
+
+apply_changes(module, changes, path diff=False, change_func=remove_changes)
+```
Evidence
The docs examples omit the comma between path and the diff= keyword. The actual function
signature requires file_path as a separate positional argument followed by diff=....

docs/codedocs/api-reference/generation-and-mutation.md[172-198]
crepr/crepr.py[380-386]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The `apply_changes(...)` examples in `docs/codedocs/api-reference/generation-and-mutation.md` are syntactically invalid (`path diff=True` / `path diff=False`). Users copying these examples will hit immediate `SyntaxError`.

## Issue Context
`apply_changes` takes `file_path` as a positional argument and `diff` as a separate argument/keyword.

## Fix Focus Areas
- docs/codedocs/api-reference/generation-and-mutation.md[172-198]
- crepr/crepr.py[380-386]

## Suggested change
Update the examples to include the missing comma and (optionally) use keyword args for clarity, e.g.:

- `apply_changes(module, changes, path, diff=True, change_func=insert_changes)`
- `apply_changes(module, changes, path, diff=False, change_func=remove_changes)`

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Grey Divider

Qodo Logo

@sourcery-ai sourcery-ai Bot left a comment

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.

Hey - I've found 1 issue, and left some high level feedback:

  • In docs/codedocs/generation-and-mutation.md, the final apply_changes example is missing a comma between path and diff (apply_changes(module, changes, path diff=True, ...)), which will confuse readers copying the snippet.
  • In docs/codedocs/index.md under Installation, the line starting with " "poetry"]}> appears to be a broken or leftover Tabs/Callout marker and should be cleaned up or replaced with the correct Tabs wrapper.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- In `docs/codedocs/generation-and-mutation.md`, the final `apply_changes` example is missing a comma between `path` and `diff` (`apply_changes(module, changes, path diff=True, ...)`), which will confuse readers copying the snippet.
- In `docs/codedocs/index.md` under Installation, the line starting with `" "poetry"]}>` appears to be a broken or leftover Tabs/Callout marker and should be cleaned up or replaced with the correct Tabs wrapper.

## Individual Comments

### Comment 1
<location path="docs/codedocs/index.md" line_range="36" />
<code_context>
+
+<Callout type="info">`crepr` is published as a Python package, so installation uses Python package managers rather than npm.</Callout>
+
+" "poetry"]}>
+<Tab value="pip">
+
</code_context>
<issue_to_address>
**issue (bug_risk):** Stray text in the Installation section likely from a malformed Tabs declaration.

This looks like a leftover fragment (likely from a `<Tabs>` declaration) and is invalid Markdown/JSX/MDX. Please remove or fix it so the installation tabs render correctly.
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Comment thread docs/codedocs/index.md

<Callout type="info">`crepr` is published as a Python package, so installation uses Python package managers rather than npm.</Callout>

" "poetry"]}>

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.

issue (bug_risk): Stray text in the Installation section likely from a malformed Tabs declaration.

This looks like a leftover fragment (likely from a <Tabs> declaration) and is invalid Markdown/JSX/MDX. Please remove or fix it so the installation tabs render correctly.

@llamapreview llamapreview Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Auto Pull Request Review from LlamaPReview

Review Status: Automated Review Skipped

Dear contributor,

Thank you for your Pull Request. LlamaPReview has analyzed your changes and determined that this PR does not require an automated code review.

Analysis Result:

PR only contains documentation changes (14 files)

Technical Context:

Documentation changes typically include:

  • Markdown/RST file updates
  • API documentation
  • Code comments
  • README updates
  • Documentation in /docs directory
  • License and contribution files

We're continuously improving our PR analysis capabilities. Have thoughts on when and how LlamaPReview should perform automated reviews? Share your insights in our GitHub Discussions.

Best regards,
LlamaPReview Team

@gemini-code-assist gemini-code-assist Bot left a comment

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.

Code Review

This pull request introduces comprehensive documentation for the crepr tool, covering its architecture, core concepts, API reference, and practical usage guides. The documentation details how the tool uses runtime inspection to generate or remove repr methods across various execution modes. Review feedback identified several syntax errors in code examples, including missing commas in function calls and a mangled UI component in the getting started guide.

module = get_module(path)
changes = create_repr(module, kwarg_splat="kwargs=...", ignore_existing=True)

apply_changes(module, changes, path diff=True, change_func=insert_changes)

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.

medium

There is a missing comma between the path and diff arguments in this code example.

Suggested change
apply_changes(module, changes, path diff=True, change_func=insert_changes)
apply_changes(module, changes, path, diff=True, change_func=insert_changes)

module = get_module(path)
changes = remove_repr(module)

apply_changes(module, changes, path diff=False, change_func=remove_changes)

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.

medium

There is a missing comma between the path and diff arguments in this code example.

Suggested change
apply_changes(module, changes, path diff=False, change_func=remove_changes)
apply_changes(module, changes, path, diff=False, change_func=remove_changes)

Comment thread docs/codedocs/index.md

<Callout type="info">`crepr` is published as a Python package, so installation uses Python package managers rather than npm.</Callout>

" "poetry"]}>

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.

medium

This line appears to be a mangled snippet of a component (likely <Tabs>). It should be corrected to properly wrap the installation options.

Suggested change
" "poetry"]}>
<Tabs items={["pip", "uv", "pipx", "poetry"]}>

Comment on lines +68 to +69
<Callout type="warn">Inline mode rewrites the file content directly with `"
".join(src)`. There is no backup file, formatting pass, or conflict detection. Use `--diff` first if you want a review step or if the file may have been edited concurrently.</Callout>

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.

medium

The string literal for the newline join is split across two lines, which will likely render incorrectly and is technically inaccurate as a Python snippet. It should be on a single line.

Suggested change
<Callout type="warn">Inline mode rewrites the file content directly with `"
".join(src)`. There is no backup file, formatting pass, or conflict detection. Use `--diff` first if you want a review step or if the file may have been edited concurrently.</Callout>
<Callout type="warn">Inline mode rewrites the file content directly with "\n".join(src). There is no backup file, formatting pass, or conflict detection. Use --diff first if you want a review step or if the file may have been edited concurrently.</Callout>

```

After the second command, `account.py` contains the new `__repr__`.

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.

medium

There is a missing comma between the mode and encoding arguments in the file_path.open call description.

Suggested change
Diff mode and inline mode share the same selection and generation pipeline. There is no “preview implementation” and “apply implementation” that could diverge. The only difference is whether apply_changes calls print_diff or writes the resulting source back through file_path.open(mode="w", encoding="UTF-8").

@greptile-apps

greptile-apps Bot commented May 1, 2026

Copy link
Copy Markdown

Greptile Summary

This PR adds 14 AI-generated documentation files under docs/codedocs/ covering architecture, core concepts, API reference, and usage guides for crepr. The overall structure and content is accurate against the source, but there are a few concrete errors that need fixing before the docs are usable.

  • Two code examples in generation-and-mutation.md are missing a comma (path diff=True / path diff=False) — both would produce a SyntaxError if copied verbatim.
  • The index.md Installation section contains a broken MDX component tag (\" \"poetry\"]}>) that will cause a parse error in any MDX renderer.
  • The create_repr ignore_existing parameter is documented with semantics that are technically correct for the internal function but contradict the same-named CLI flag (since add calls create_repr(..., not ignore_existing)); a clarifying note would prevent misuse by programmatic callers.

Confidence Score: 3/5

Not safe to merge as-is — broken MDX syntax will break the rendered docs page and copy-pasteable code examples contain syntax errors.

Three P1 findings: two copy-paste-ready code examples with SyntaxErrors and one broken MDX component that will break rendering. These are straightforward to fix but should be resolved before the docs go live.

docs/codedocs/api-reference/generation-and-mutation.md (syntax errors in examples) and docs/codedocs/index.md (broken MDX component tag).

Important Files Changed

Filename Overview
docs/codedocs/api-reference/generation-and-mutation.md Contains two syntax errors (missing commas in apply_changes examples) and a misleading ignore_existing parameter description that inverts semantics relative to the CLI flag.
docs/codedocs/index.md Broken MDX component tag (" "poetry"]}>) in the Installation section will cause parse errors in any MDX renderer.
docs/codedocs/architecture.md Architecture overview with accurate mermaid diagrams and sequence diagrams; no issues found.
docs/codedocs/api-reference/cli-commands.md CLI command reference with accurate signatures and examples; parameter table for add is correct.
docs/codedocs/api-reference/source-inspection.md Accurate documentation of all inspection helpers; function signatures and return types match the source.
docs/codedocs/api-reference/package-exports.md Accurate documentation of package-level exports; __version__ value is a snapshot and will become stale over time.
docs/codedocs/repr-generation.md Accurate walkthrough of repr generation internals including flowchart diagram; examples match actual tool output.
docs/codedocs/class-selection.md Accurate description of the three-pass class filtering logic; examples correctly demonstrate which classes are skipped.
docs/codedocs/discovery-and-loading.md Accurate description of the module-loading pipeline with correct warnings about execution side-effects.
docs/codedocs/edit-modes.md Accurate explanation of preview/diff/inline modes with correct state machine diagram.
docs/codedocs/guides/generate-preview.md Accurate step-by-step guide for preview mode; examples are correct and runnable.
docs/codedocs/guides/remove-generated-reprs.md Accurate removal workflow guide; correctly notes that removal depends on the same class-selection rules as generation.
docs/codedocs/guides/review-diff-and-apply.md Accurate two-step diff-then-inline workflow guide; file writing path correctly documented.
docs/codedocs/guides/work-with-existing-reprs.md Accurately explains the not ignore_existing inversion at the add call site; correctly warns about the overwrite risk.

Sequence Diagram

sequenceDiagram
  participant User
  participant CLI as Typer CLI (add/remove)
  participant Loader as get_modules / get_module
  participant Scanner as get_all_init_args
  participant Generator as create_repr / remove_repr
  participant Output as print_changes / apply_changes

  User->>CLI: crepr add file.py [--diff|--inline]
  CLI->>Loader: load each file path
  Loader-->>CLI: ModuleType (or print error and skip)
  CLI->>Scanner: inspect module classes
  Scanner-->>CLI: eligible (cls, init_args, lineno, source) tuples
  CLI->>Generator: build dict[int, Change] keyed by line number
  Generator-->>CLI: change map
  alt diff is None (preview)
    CLI->>Output: print_changes → stdout
  else diff=True
    CLI->>Output: apply_changes → print_diff → stdout
  else diff=False (inline)
    CLI->>Output: apply_changes → write file
  end
  Output-->>User: generated text / unified diff / rewritten file
Loading

Reviews (1): Last reviewed commit: "[pre-commit.ci] auto fixes from pre-comm..." | Re-trigger Greptile

Comment on lines +164 to +171
module,
changes,
Path("models.py"),
diff=True,
change_func=insert_changes,
)
```

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Missing comma in apply_changes call examples

Both programmatic usage examples omit the required comma between the path positional argument and the diff keyword argument. Copying these examples as-is would produce a SyntaxError.

Suggested change
module,
changes,
Path("models.py"),
diff=True,
change_func=insert_changes,
)
```
apply_changes(module, changes, path, diff=True, change_func=insert_changes)

Comment on lines +178 to +185
from crepr.crepr import apply_changes, create_repr, get_module, insert_changes

path = Path("models.py")
module = get_module(path)
changes = create_repr(module, kwarg_splat="kwargs=...", ignore_existing=True)

apply_changes(module, changes, path diff=True, change_func=insert_changes)
```

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Missing comma in apply_changes remove-flow example

Same issue as the add-flow example: path diff=False is missing a comma and would fail as a SyntaxError if copied verbatim.

Suggested change
from crepr.crepr import apply_changes, create_repr, get_module, insert_changes
path = Path("models.py")
module = get_module(path)
changes = create_repr(module, kwarg_splat="kwargs=...", ignore_existing=True)
apply_changes(module, changes, path diff=True, change_func=insert_changes)
```
apply_changes(module, changes, path, diff=False, change_func=remove_changes)

Comment thread docs/codedocs/index.md
<Tab value="uv">

```bash
uv tool install crepr

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Broken MDX component syntax

The line " "poetry"]}> is clearly truncated/corrupted MDX. It appears the opening <Tabs ...> component tag was partially removed, leaving only the tail of a values={["pip", "uv", "pipx", "poetry"]}> attribute. As-is, this will cause a parse error in any MDX renderer and break the entire Installation section.

| `kwarg_splat` | `str` | — | Placeholder fragment for `**kwargs`. |
| `ignore_existing` | `bool` | — | When `True`, skip classes that already define `__repr__`. |

Return type: `dict[int, Change]`

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 ignore_existing semantics are inverted relative to the CLI flag

The table documents create_repr's ignore_existing parameter as "When True, skip classes that already define __repr__". This is technically accurate for the internal function (if repr_exists(obj) and ignore_existing: continue), but the add command calls create_repr(module, kwarg_splat, not ignore_existing) — inverting the flag. A direct caller following this documented example with ignore_existing=True would see the opposite behavior from the same-named --ignore-existing CLI flag. The docs should add a note about this inversion.

Comment thread docs/codedocs/index.md
Comment on lines +34 to +65
<Callout type="info">`crepr` is published as a Python package, so installation uses Python package managers rather than npm.</Callout>

" "poetry"]}>
<Tab value="pip">

```bash
pip install crepr
```

</Tab>
<Tab value="uv">

```bash
uv tool install crepr
```

</Tab>
<Tab value="pipx">

```bash
pipx install crepr
```

</Tab>
<Tab value="poetry">

```bash
poetry add --group dev crepr
```

</Tab>
</Tabs>

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Action required

1. Broken tabs block 🐞 Bug ☼ Reliability

docs/codedocs/index.md contains an invalid Tabs section: a stray " "poetry"]}> line and a
</Tabs> close without any opening <Tabs ...> tag. This will fail MDX parsing/rendering and can
break the documentation build.
Agent Prompt
## Issue description
`docs/codedocs/index.md` has a malformed Tabs block: there is an invalid fragment (`" "poetry"]}>`) and a closing `</Tabs>` without a corresponding opening `<Tabs ...>` tag, which can break MDX compilation.

## Issue Context
The installation section is intended to render a tabbed UI for pip/uv/pipx/poetry.

## Fix Focus Areas
- docs/codedocs/index.md[32-66]

## Suggested change
Replace the broken fragment line with a correct opening `<Tabs ...>` tag compatible with this docs stack (likely something like `<Tabs items={["pip","uv","pipx","poetry"]}>`), ensuring the opening/closing tags match and that all `<Tab>` children are properly nested.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

Comment on lines +68 to +69
<Callout type="warn">Inline mode rewrites the file content directly with `"
".join(src)`. There is no backup file, formatting pass, or conflict detection. Use `--diff` first if you want a review step or if the file may have been edited concurrently.</Callout>

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Action required

2. Invalid inline code span 🐞 Bug ☼ Reliability

docs/codedocs/edit-modes.md breaks an inline code span across a newline inside a <Callout> (``
"\n".join(src) ` becomes  " <newline> ".join(src) `). This is invalid Markdown/MDX and can
fail rendering or compilation.
Agent Prompt
## Issue description
`docs/codedocs/edit-modes.md` contains an inline code span that is split across two lines inside backticks, which is invalid Markdown/MDX and may break docs rendering.

## Issue Context
The callout is trying to document the exact string used when writing the file content in inline mode.

## Fix Focus Areas
- docs/codedocs/edit-modes.md[64-70]
- crepr/crepr.py[380-395]

## Suggested change
Rewrite the callout sentence so the code span is on a single line and matches the implementation, e.g.:

`Inline mode rewrites the file content directly with `"\n".join(src)`...`

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 7

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@docs/codedocs/api-reference/generation-and-mutation.md`:
- Line 184: The example calls to apply_changes are syntactically invalid because
the positional argument list is missing commas after the path parameter; update
the example calls to pass arguments correctly by adding the missing comma
between path and the keyword args (e.g., after path) so that
apply_changes(module, changes, path, diff=True, change_func=insert_changes) and
the other call use proper comma separation; look for usages of apply_changes and
the parameter names module, changes, path, diff, change_func to fix all
instances.

In `@docs/codedocs/api-reference/package-exports.md`:
- Around line 18-22: Update the doc snippet to show that __version__ is
re-exported rather than defined in the package root: replace the literal
assignment example with an import-from form (e.g., from crepr.about import
__version__) and revise the explanatory sentence to state that the package root
re-exports __version__ from crepr.about; reference crepr.__init__/crepr.about
and the symbol __version__ so readers know the true source-of-truth.

In `@docs/codedocs/api-reference/source-inspection.md`:
- Around line 91-97: The docs incorrectly list POSITIONAL_OR_KEYWORD as
supported by has_only_kwargs; update the API reference text in
source-inspection.md so it matches the actual has_only_kwargs implementation by
stating it only returns True when parameters are KEYWORD_ONLY or VAR_KEYWORD and
returns False for POSITIONAL_OR_KEYWORD and VAR_POSITIONAL (e.g., remove
POSITIONAL_OR_KEYWORD from the supported list and clarify the behavior for
*args/VAR_POSITIONAL).

In `@docs/codedocs/architecture.md`:
- Around line 78-79: The doc claim about constructor-shape support is
inaccurate: `get_all_init_args` relies on `has_only_kwargs`, which currently
only accepts `KEYWORD_ONLY` and `VAR_KEYWORD` and thus does not actually support
`POSITIONAL_OR_KEYWORD` or `*args`; update the architecture text to reflect the
real behavior (that only keyword-only and **kwargs constructors are supported
and dataclasses are skipped because they don't define `__init__` in the class
body) or alternatively change the implementation by modifying `has_only_kwargs`
to also accept `POSITIONAL_OR_KEYWORD` parameters—reference `get_all_init_args`
and `has_only_kwargs` when making the fix so the doc and code remain consistent.

In `@docs/codedocs/edit-modes.md`:
- Around line 68-69: The callout currently breaks the inline join expression
across two lines (shows a quote on one line and .join(src) on the next); update
the callout text in edit-modes.md so the inline snippet is a single, continuous
literal showing an empty-string join of src (replace the broken split `" "
.join(src)` with a single inline snippet for the empty-string join), ensuring
the sentence reads smoothly and uses one inline code span for the join
expression.

In `@docs/codedocs/index.md`:
- Line 36: The MDX Tabs opening tag is malformed at the fragment `"
"poetry"]}>`; restore the full opening tag for the Tabs component (the <Tabs
...> element) so the MDX parser can render; locate the broken token near the
existing Tabs usage in docs/codedocs/index.md (search for `" "poetry"]}>` or the
surrounding closing tag) and replace it with the correct opening tag including
its expected attributes (e.g., the full <Tabs value={...} onChange={...}> or
whatever attributes the other Tabs usage in this file expects) so the Tabs block
is syntactically valid.

In `@docs/codedocs/repr-generation.md`:
- Around line 31-32: The doc contains a malformed fragment for VAR_KEYWORD
output (the broken literal starting with f"**{},) — replace that with a valid
fragment that mirrors the named-parameter pattern by inserting the VAR_KEYWORD
parameter name (and proper quoting/representation when appropriate) plus the
trailing comma and space so the example matches actual generated output and
reflects the --kwarg-splat option behavior.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 2b1763ac-1ff8-435b-851e-d273a0917144

📥 Commits

Reviewing files that changed from the base of the PR and between d47939a and 02a4e4f.

📒 Files selected for processing (14)
  • docs/codedocs/api-reference/cli-commands.md
  • docs/codedocs/api-reference/generation-and-mutation.md
  • docs/codedocs/api-reference/package-exports.md
  • docs/codedocs/api-reference/source-inspection.md
  • docs/codedocs/architecture.md
  • docs/codedocs/class-selection.md
  • docs/codedocs/discovery-and-loading.md
  • docs/codedocs/edit-modes.md
  • docs/codedocs/guides/generate-preview.md
  • docs/codedocs/guides/remove-generated-reprs.md
  • docs/codedocs/guides/review-diff-and-apply.md
  • docs/codedocs/guides/work-with-existing-reprs.md
  • docs/codedocs/index.md
  • docs/codedocs/repr-generation.md

module = get_module(path)
changes = create_repr(module, kwarg_splat="kwargs=...", ignore_existing=True)

apply_changes(module, changes, path diff=True, change_func=insert_changes)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Fix invalid Python example calls (apply_changes) in docs.

Line 184 and Line 197 are syntactically invalid due to missing commas after path.

Proposed fix
-apply_changes(module, changes, path diff=True, change_func=insert_changes)
+apply_changes(module, changes, path, diff=True, change_func=insert_changes)
-apply_changes(module, changes, path diff=False, change_func=remove_changes)
+apply_changes(module, changes, path, diff=False, change_func=remove_changes)

Also applies to: 197-197

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@docs/codedocs/api-reference/generation-and-mutation.md` at line 184, The
example calls to apply_changes are syntactically invalid because the positional
argument list is missing commas after the path parameter; update the example
calls to pass arguments correctly by adding the missing comma between path and
the keyword args (e.g., after path) so that apply_changes(module, changes, path,
diff=True, change_func=insert_changes) and the other call use proper comma
separation; look for usages of apply_changes and the parameter names module,
changes, path, diff, change_func to fix all instances.

Comment on lines +18 to +22
```python
__version__ = "0.6.0dev0"
```

The package root only re-exports `__version__` from `crepr/about.py`. If you need the installed library version in tooling or diagnostics, this is the stable import path.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

__version__ definition is documented as a literal instead of a re-export.

Line 18–22 currently implies a direct package-root assignment, but crepr/__init__.py re-exports from crepr.about. This can mislead readers about source-of-truth location.

Suggested doc correction
-Definition:
+Re-export in `crepr/__init__.py`:

 ```python
-__version__ = "0.6.0dev0"
+from crepr.about import __version__

-The package root only re-exports __version__ from crepr/about.py. If you need the installed library version in tooling or diagnostics, this is the stable import path.
+The package root re-exports __version__ from crepr/about.py. If you need the installed library version in tooling or diagnostics, this is the stable import path.

</details>

<details>
<summary>🤖 Prompt for AI Agents</summary>

Verify each finding against the current code and only fix it if needed.

In @docs/codedocs/api-reference/package-exports.md around lines 18 - 22, Update
the doc snippet to show that version is re-exported rather than defined in
the package root: replace the literal assignment example with an import-from
form (e.g., from crepr.about import version) and revise the explanatory
sentence to state that the package root re-exports version from crepr.about;
reference crepr.init/crepr.about and the symbol version so readers know
the true source-of-truth.


</details>

<!-- fingerprinting:phantom:triton:hawk:8efb80dd-fd62-4f8b-a4e9-b35b94c4dcc4 -->

<!-- This is an auto-generated comment by CodeRabbit -->

Comment on lines +91 to +97
Returns `True` when every parameter is one of:

- `POSITIONAL_OR_KEYWORD`
- `KEYWORD_ONLY`
- `VAR_KEYWORD`

It returns `False` for constructors with `VAR_POSITIONAL` (`*args`).

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

has_only_kwargs behavior is documented incorrectly.

Line 93 lists POSITIONAL_OR_KEYWORD as supported, but implementation only accepts KEYWORD_ONLY and VAR_KEYWORD. This is an API-reference mismatch.

Suggested doc correction
 Returns `True` when every parameter is one of:

-- `POSITIONAL_OR_KEYWORD`
 - `KEYWORD_ONLY`
 - `VAR_KEYWORD`

-It returns `False` for constructors with `VAR_POSITIONAL` (`*args`).
+It returns `False` for constructors with `POSITIONAL_OR_KEYWORD` and `VAR_POSITIONAL` (`*args`).
📝 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.

Suggested change
Returns `True` when every parameter is one of:
- `POSITIONAL_OR_KEYWORD`
- `KEYWORD_ONLY`
- `VAR_KEYWORD`
It returns `False` for constructors with `VAR_POSITIONAL` (`*args`).
Returns `True` when every parameter is one of:
- `KEYWORD_ONLY`
- `VAR_KEYWORD`
It returns `False` for constructors with `POSITIONAL_OR_KEYWORD` and `VAR_POSITIONAL` (`*args`).
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@docs/codedocs/api-reference/source-inspection.md` around lines 91 - 97, The
docs incorrectly list POSITIONAL_OR_KEYWORD as supported by has_only_kwargs;
update the API reference text in source-inspection.md so it matches the actual
has_only_kwargs implementation by stating it only returns True when parameters
are KEYWORD_ONLY or VAR_KEYWORD and returns False for POSITIONAL_OR_KEYWORD and
VAR_POSITIONAL (e.g., remove POSITIONAL_OR_KEYWORD from the supported list and
clarify the behavior for *args/VAR_POSITIONAL).

Comment on lines +78 to +79
`get_all_init_args` only yields classes with an explicit `__init__` in `cls.__dict__` and only when `has_only_kwargs` returns `True`. In practice, that means classes with `POSITIONAL_OR_KEYWORD`, `KEYWORD_ONLY`, and `VAR_KEYWORD` parameters are supported, while `*args` is not. Dataclasses are also skipped because they do not define `__init__` directly in the class body.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Constructor-shape support is overstated.

Line 78 says get_all_init_args supports POSITIONAL_OR_KEYWORD, but current has_only_kwargs logic only accepts KEYWORD_ONLY and VAR_KEYWORD. This architectural statement should match implementation.

Suggested doc correction
-`get_all_init_args` only yields classes with an explicit `__init__` in `cls.__dict__` and only when `has_only_kwargs` returns `True`. In practice, that means classes with `POSITIONAL_OR_KEYWORD`, `KEYWORD_ONLY`, and `VAR_KEYWORD` parameters are supported, while `*args` is not. Dataclasses are also skipped because they do not define `__init__` directly in the class body.
+`get_all_init_args` only yields classes with an explicit `__init__` in `cls.__dict__` and only when `has_only_kwargs` returns `True`. In practice, that means classes with `KEYWORD_ONLY` and `VAR_KEYWORD` parameters are supported, while `POSITIONAL_OR_KEYWORD` and `*args` are not. Dataclasses are also skipped because they do not define `__init__` directly in the class body.
📝 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.

Suggested change
`get_all_init_args` only yields classes with an explicit `__init__` in `cls.__dict__` and only when `has_only_kwargs` returns `True`. In practice, that means classes with `POSITIONAL_OR_KEYWORD`, `KEYWORD_ONLY`, and `VAR_KEYWORD` parameters are supported, while `*args` is not. Dataclasses are also skipped because they do not define `__init__` directly in the class body.
`get_all_init_args` only yields classes with an explicit `__init__` in `cls.__dict__` and only when `has_only_kwargs` returns `True`. In practice, that means classes with `KEYWORD_ONLY` and `VAR_KEYWORD` parameters are supported, while `POSITIONAL_OR_KEYWORD` and `*args` are not. Dataclasses are also skipped because they do not define `__init__` directly in the class body.
🧰 Tools
🪛 LanguageTool

[style] ~78-~78: This adverb was used twice in the sentence. Consider removing one of them or replacing them with a synonym.
Context: ...init__incls.dictand only whenhas_only_kwargsreturnsTrue`. In practice, th...

(ADVERB_REPETITION_PREMIUM)

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@docs/codedocs/architecture.md` around lines 78 - 79, The doc claim about
constructor-shape support is inaccurate: `get_all_init_args` relies on
`has_only_kwargs`, which currently only accepts `KEYWORD_ONLY` and `VAR_KEYWORD`
and thus does not actually support `POSITIONAL_OR_KEYWORD` or `*args`; update
the architecture text to reflect the real behavior (that only keyword-only and
**kwargs constructors are supported and dataclasses are skipped because they
don't define `__init__` in the class body) or alternatively change the
implementation by modifying `has_only_kwargs` to also accept
`POSITIONAL_OR_KEYWORD` parameters—reference `get_all_init_args` and
`has_only_kwargs` when making the fix so the doc and code remain consistent.

Comment on lines +68 to +69
<Callout type="warn">Inline mode rewrites the file content directly with `"
".join(src)`. There is no backup file, formatting pass, or conflict detection. Use `--diff` first if you want a review step or if the file may have been edited concurrently.</Callout>

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Callout contains a broken code literal for inline write behavior.

Line 68–69 splits the join expression and renders awkwardly. Use a single inline snippet.

Suggested doc correction
-<Callout type="warn">Inline mode rewrites the file content directly with `"
-".join(src)`. There is no backup file, formatting pass, or conflict detection. Use `--diff` first if you want a review step or if the file may have been edited concurrently.</Callout>
+<Callout type="warn">Inline mode rewrites the file content directly with `"\n".join(src)`. There is no backup file, formatting pass, or conflict detection. Use `--diff` first if you want a review step or if the file may have been edited concurrently.</Callout>
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@docs/codedocs/edit-modes.md` around lines 68 - 69, The callout currently
breaks the inline join expression across two lines (shows a quote on one line
and .join(src) on the next); update the callout text in edit-modes.md so the
inline snippet is a single, continuous literal showing an empty-string join of
src (replace the broken split `" " .join(src)` with a single inline snippet for
the empty-string join), ensuring the sentence reads smoothly and uses one inline
code span for the join expression.

Comment thread docs/codedocs/index.md

<Callout type="info">`crepr` is published as a Python package, so installation uses Python package managers rather than npm.</Callout>

" "poetry"]}>

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical | ⚡ Quick win

Fix broken MDX Tabs opening tag (parse/render blocker).

Line 36 is malformed (" "poetry"]}>) and will likely break page rendering/build for this doc. Please restore the full <Tabs ...> opening tag.

Proposed fix
-" "poetry"]}>
+<Tabs items={["pip", "uv", "pipx", "poetry"]}>
📝 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.

Suggested change
" "poetry"]}>
<Tabs items={["pip", "uv", "pipx", "poetry"]}>
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@docs/codedocs/index.md` at line 36, The MDX Tabs opening tag is malformed at
the fragment `" "poetry"]}>`; restore the full opening tag for the Tabs
component (the <Tabs ...> element) so the MDX parser can render; locate the
broken token near the existing Tabs usage in docs/codedocs/index.md (search for
`" "poetry"]}>` or the surrounding closing tag) and replace it with the correct
opening tag including its expected attributes (e.g., the full <Tabs value={...}
onChange={...}> or whatever attributes the other Tabs usage in this file
expects) so the Tabs block is syntactically valid.

Comment on lines +31 to +32
It then iterates through the inspected constructor parameters, skipping `self`. Named parameters become fragments like `f"name={self.name!r}, "`. A `VAR_KEYWORD` parameter becomes a placeholder fragment like `f"**{},` by default, or another token if `--kwarg-splat` changes the placeholder.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Malformed placeholder example for VAR_KEYWORD output.

Line 31 has a broken literal (f"**{},) which is hard to parse. Use a valid fragment shape matching the actual generated line.

Suggested doc correction
-It then iterates through the inspected constructor parameters, skipping `self`. Named parameters become fragments like `f"name={self.name!r}, "`. A `VAR_KEYWORD` parameter becomes a placeholder fragment like `f"**{},` by default, or another token if `--kwarg-splat` changes the placeholder.
+It then iterates through the inspected constructor parameters, skipping `self`. Named parameters become fragments like `f"name={self.name!r}, "`. A `VAR_KEYWORD` parameter becomes a placeholder fragment like `f"**{},'"` by default (rendered as `f'**{},'` in generated code), or another token if `--kwarg-splat` changes the placeholder.
📝 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.

Suggested change
It then iterates through the inspected constructor parameters, skipping `self`. Named parameters become fragments like `f"name={self.name!r}, "`. A `VAR_KEYWORD` parameter becomes a placeholder fragment like `f"**{},` by default, or another token if `--kwarg-splat` changes the placeholder.
It then iterates through the inspected constructor parameters, skipping `self`. Named parameters become fragments like `f"name={self.name!r}, "`. A `VAR_KEYWORD` parameter becomes a placeholder fragment like `f"**{},'"` by default (rendered as `f'**{},'` in generated code), or another token if `--kwarg-splat` changes the placeholder.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@docs/codedocs/repr-generation.md` around lines 31 - 32, The doc contains a
malformed fragment for VAR_KEYWORD output (the broken literal starting with
f"**{},) — replace that with a valid fragment that mirrors the named-parameter
pattern by inserting the VAR_KEYWORD parameter name (and proper
quoting/representation when appropriate) plus the trailing comma and space so
the example matches actual generated output and reflects the --kwarg-splat
option behavior.

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