Repository navigation
Slim agent guidance, add core lint, run rust-llm-tidy in verify #31
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,109 @@ | ||
| # Migration to v1.4.2 | ||
|
|
||
| From `v1.4.1` to `v1.4.2`. | ||
|
|
||
| Slims the LLM guidance and moves `core`-over-`std` to a Clippy lint: | ||
|
|
||
| - Deletes the `.llm/{general,performance,documentation}.md` guidance files. | ||
| - Inlines the performance reminders into `src/AGENTS.md`. | ||
| - Runs [rust-llm-tidy] at the end of `.llm/verify.{sh,ps1}` when installed. | ||
| - Adds the `std_instead_of_core` Clippy lint to the workspace. | ||
|
|
||
| ## 1. Delete the guidance files | ||
|
|
||
| ```text | ||
| src/.llm/documentation.md | ||
| src/.llm/general.md | ||
| src/.llm/performance.md | ||
| ``` | ||
|
|
||
| ## 2. Replace `src/AGENTS.md` | ||
|
|
||
| ```markdown | ||
| After changes, find and run `.llm/verify.{sh,ps1}` to test + lint. | ||
| Print all output. | ||
|
|
||
| Performance: | ||
|
|
||
| - Prefer borrows: `&str` / `&[T]` returns, `&'static str` constants, | ||
| `Cow<'_, str>` for conditional ownership. | ||
| - `Box<str>` for immutable strings. | ||
| - Reuse buffers via `.clear()`. | ||
| - Const generics for compile-time branching such as | ||
| `<const LINE_NUMBERS: bool>`. | ||
| - Prefer performance-oriented crates such as `parking_lot` and `memchr`. | ||
| - Keep dependency footprint minimal. | ||
| ``` | ||
|
|
||
| ## 3. Add the tidy step to the verify scripts | ||
|
|
||
| In `.llm/verify.sh`, after the publish dry-run: | ||
|
|
||
| ```diff | ||
| echo "Publish dry-run..." | ||
| run_cmd cargo publish --dry-run --allow-dirty --quiet --workspace | ||
| + | ||
| +echo "Tidy..." | ||
| +if command -v rust-llm-tidy >/dev/null 2>&1; then | ||
| + run_cmd rust-llm-tidy | ||
| +else | ||
| + echo "Skipping; rust-llm-tidy not installed. Install: cargo install rust-llm-tidy-cli" | ||
| +fi | ||
|
|
||
| if [ "$EXIT_CODE" -eq 0 ]; then | ||
| ``` | ||
|
|
||
| In `.llm/verify.ps1`, after the publish dry-run: | ||
|
|
||
| ```diff | ||
| Write-Host "Publish dry-run..." | ||
| Invoke-LoggedCommand "cargo" @("publish", "--dry-run", "--allow-dirty", "--quiet", "--workspace") | ||
| + | ||
| + Write-Host "Tidy..." | ||
| + if (Get-Command rust-llm-tidy -ErrorAction SilentlyContinue) { | ||
| + Invoke-LoggedCommand "rust-llm-tidy" @() | ||
| + } else { | ||
| + Write-Host "Skipping; rust-llm-tidy not installed. Install: cargo install rust-llm-tidy-cli" | ||
| + } | ||
| } finally { | ||
| ``` | ||
|
|
||
| ## 4. Add the Clippy lint | ||
|
|
||
| Root `Cargo.toml`: | ||
|
|
||
| ```diff | ||
| [workspace] | ||
| resolver = "2" | ||
| members = ["src/my-project"] | ||
| + | ||
| +# Inherited by members via `[lints] workspace = true`. | ||
| +[workspace.lints.clippy] | ||
| +# Prefer `core` over `std` where both work. | ||
| +std_instead_of_core = "warn" | ||
| ``` | ||
|
|
||
| Every member crate (`src/my-project/Cargo.toml`, `src/cli/Cargo.toml` if present): | ||
|
|
||
| ```diff | ||
| # categories = ["command-line-utilities"] | ||
| + | ||
| +[lints] | ||
| +workspace = true | ||
| ``` | ||
|
|
||
| Then fix any hits, for example the benchmark: | ||
|
|
||
| ```diff | ||
| -use std::hint::black_box; | ||
| +use core::hint::black_box; | ||
| ``` | ||
|
|
||
| ## 5. Update the template version marker | ||
|
|
||
| ```diff | ||
| -reloaded-templates-rust:1.4.1 | ||
| +reloaded-templates-rust:1.4.2 | ||
| ``` | ||
|
|
||
| [rust-llm-tidy]: https://github.com/Sewer56/rust-llm-tidy |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1 @@ | ||
| reloaded-templates-rust:1.4.1 | ||
| reloaded-templates-rust:1.4.2 |
This file was deleted.
This file was deleted.
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -51,6 +51,13 @@ run_cmd cargo fmt --all --quiet | |
| echo "Publish dry-run..." | ||
| run_cmd cargo publish --dry-run --allow-dirty --quiet --workspace | ||
|
|
||
| echo "Tidy..." | ||
| if command -v rust-llm-tidy >/dev/null 2>&1; then | ||
| run_cmd rust-llm-tidy | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win 🔎 Supported by static analysis🤖 get_repo_knowledge executed:
Length of output: 396 🏁 Script executed: #!/bin/bash
set -eu
printf '%s\n' '--- target files ---'
sed -n '45,65p' templates/general/src/.llm/verify.sh
sed -n '75,95p' templates/general/src/.llm/verify.ps1
sed -n '35,72p' docs/migration/v1.4.2.md
printf '%s\n' '--- tidy definitions and references ---'
rg -n --glob '!target' --glob '!node_modules' 'rust-llm-tidy|llm-tidy|dry-run|check' .Repository: Reloaded-Project/reloaded-templates-rust Length of output: 18213 🏁 Script executed: #!/bin/bash
set -eu
printf '%s\n' '--- rust-llm-tidy documentation in repository ---'
sed -n '1,110p' docs/migration/v1.4.0.md
printf '%s\n' '--- documentation conventions ---'
sed -n '1,90p' docs/AGENTS-DOCS.md
printf '%s\n' '--- repository status and relevant config ---'
sed -n '1,130p' templates/general/cargo-generate.toml
fd -i 'rust-llm-tidy*' . -t f -x sh -c 'echo "--- $1"; sed -n "1,140p" "$1"' sh {}Repository: Reloaded-Project/reloaded-templates-rust Length of output: 8926 🌐 Web query:
💡 Result: The rust-llm-tidy tool is an opinionated, work-in-progress Rust linter designed for LLM-assisted workflows, available via the Sewer56/rust-llm-tidy repository [1]. It provides a unified command-line interface to perform several code-tidying operations, including reordering source items, visibility narrowing, documentation linting, and markdown/doc-comment fixing [1]. Regarding your specific request for --validate and apply mode: --validate: This flag is used to verify the configuration without actually processing any files [1]. This is particularly useful for CI environments to ensure the.rust-llm-tidy.yml configuration is valid before running operations [1]. Apply Mode: When the tool is run (often via the rust-llm-tidy-action in CI/CD pipelines), it can operate in an apply mode [2][3]. In this mode, the tool automatically applies fixes to the target files in place [2]. For example, when used in a CI workflow on a pull request, apply mode is typically configured to commit and push these automated fixes back to the PR branch [2][3]. Configuration: The tool optionally uses a.rust-llm-tidy.yml configuration file, discovered by walking up from the current directory [1]. This file allows you to specify include/exclude rules or skip entire files [1]. If no configuration file is present, the tool uses default settings [1][3]. Citations:
🌐 Web query:
💡 Result: The rust-llm-tidy tool is a CLI utility written in Rust designed to lint and tidy codebases (specifically.rs and.md files) to improve compatibility or structure for LLM processing [1]. It provides specific flags for handling modifications and configuration validation [1]. Dry-Run Execution: To preview changes without applying them to your files, use the --dry-run flag [1]. For example: rust-llm-tidy --dry-run src/main.rs Configuration Validation: To verify the integrity of your configuration file (.rust-llm-tidy.yml) without processing any files, use the --validate flag [1]. This is particularly useful in CI environments to ensure the configuration is correctly formatted before running linting tasks [1]. rust-llm-tidy --validate Additional CLI usage details: - Default behavior: Running rust-llm-tidy without arguments processes files changed in the current git diff [1]. - Path specification: You can specify files or directories (e.g., rust-llm-tidy src) to process them recursively [1]. - Rule Selection: You can use --include and --exclude flags to run specific operations (e.g., fix, reorder, vis, lints) or skip them for a single invocation [1]. - Configuration Discovery: The tool automatically searches for a.rust-llm-tidy.yml file by walking up the directory tree to the repository root [1]. This can be overridden using the --config or --no-config flags [1]. Citations: Use non-mutating tidy verification. Bare 📍 Affects 3 files
🤖 Prompt for AI Agents |
||
| else | ||
| echo "Skipping; rust-llm-tidy not installed. Install: cargo install rust-llm-tidy-cli" | ||
| fi | ||
|
|
||
| if [ "$EXIT_CODE" -eq 0 ]; then | ||
| echo "All checks passed!" | ||
| else | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,2 +1,13 @@ | ||
| After changes, find and run `.llm/verify.{sh,ps1}` to test + lint. | ||
| If relevant to your review task, read `.llm/{general,performance,documentation}.md`. | ||
| Print all output. | ||
|
|
||
| Performance: | ||
|
|
||
| - Prefer borrows: `&str` / `&[T]` returns, `&'static str` constants, | ||
| `Cow<'_, str>` for conditional ownership. | ||
| - `Box<str>` for immutable strings. | ||
| - Reuse buffers via `.clear()`. | ||
| - Const generics for compile-time branching such as | ||
| `<const LINE_NUMBERS: bool>`. | ||
| - Prefer performance-oriented crates such as `parking_lot` and `memchr`. | ||
| - Keep dependency footprint minimal. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
Check each deleted guidance path independently.
The current condition matches only the literal
.llm/{general,performance,documentation}.md. It does not detect individual references such as.llm/general.md. A generatedsrc/AGENTS.mdcan therefore contain a broken reference and still pass validation. Check each deleted path separately, while retaining the existing combined-form check.Proposed fix
📝 Committable suggestion
🤖 Prompt for AI Agents