feat: add header comment to generated lockfiles#8481
Conversation
Adds a comment block at the top of mise.lock files instructing coding agents and users not to edit them by hand, with a link to the docs and the CLI command for managing lockfiles. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request introduces a clear, informative header comment to all Highlights
Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request adds a header comment to generated lockfiles to discourage manual editing. The implementation in src/lockfile.rs correctly prepends the header. I've made one suggestion to improve the formatting of the header string to avoid unintended whitespace in the output file. The test files have been updated accordingly, which is great.
| let content = format!( | ||
| "# This file is auto-generated by mise.\n\ | ||
| # It is not intended to be edited manually.\n\ | ||
| # mise docs: https://mise.jdx.dev/dev-tools/mise-lock.html\n\ | ||
| # mise CLI: `mise lock`\n\ | ||
| \n\ | ||
| {content}" | ||
| ); |
There was a problem hiding this comment.
The current formatting of the header string will include leading whitespace from the source code indentation in the output file. This can be avoided by using a const for the header, which also improves readability and makes it easier to keep it in sync with the test files.
| let content = format!( | |
| "# This file is auto-generated by mise.\n\ | |
| # It is not intended to be edited manually.\n\ | |
| # mise docs: https://mise.jdx.dev/dev-tools/mise-lock.html\n\ | |
| # mise CLI: `mise lock`\n\ | |
| \n\ | |
| {content}" | |
| ); | |
| const LOCKFILE_HEADER: &str = "# This file is auto-generated by mise.\n# It is not intended to be edited manually.\n# mise docs: https://mise.jdx.dev/dev-tools/mise-lock.html\n# mise CLI: `mise lock`"; | |
| let content = format!("{LOCKFILE_HEADER}\n\n{content}"); |
There was a problem hiding this comment.
Bad robot! I verified locally.
───────┬──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
│ File: mise.lock
───────┼──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
1 + │ # This file is auto-generated by mise.
2 + │ # It is not intended to be edited manually.
3 + │ # mise docs: https://mise.jdx.dev/dev-tools/mise-lock.html
4 + │ # mise CLI: `mise lock`
Greptile SummaryThis PR prepends a 4-line comment block to every generated Key changes:
Confidence Score: 5/5
Sequence DiagramsequenceDiagram
participant User as User / Agent
participant CLI as mise CLI
participant Lockfile as Lockfile::save()
participant FS as mise.lock (file)
User->>CLI: mise use / mise lock
CLI->>Lockfile: save(path)
Lockfile->>Lockfile: Build TOML table (tools, conda-packages)
Lockfile->>Lockfile: toml::to_string_pretty()
Lockfile->>Lockfile: format() — sort keys, inline platform tables
Lockfile->>Lockfile: Prepend header comment block
Note over Lockfile: "# This file is auto-generated by mise.\n# It is not intended to be edited manually.\n..."
Lockfile->>FS: Atomic write (temp file → rename)
User->>CLI: mise install / mise ls
CLI->>Lockfile: Lockfile::read(path)
Lockfile->>FS: Read file contents
FS-->>Lockfile: content (with header comments)
Lockfile->>Lockfile: toml::from_str() — TOML ignores # comments natively
Lockfile-->>CLI: Parsed Lockfile struct
Last reviewed commit: d2cf116 |
|
Okay, I didn't shellcheck. You caught me. (One sec.) |
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
Suggestion: simplify the header to a single line with This comment was generated by Claude Code. |
Replaces the four-line verbose header with a concise `@generated` style comment, consistent with standard tooling conventions.
|
Oh, interesting! There might be some other cool GitHub stuff we can do with linguist to improve how these lockfiles are rendered in the repo web UI: https://github.com/github-linguist/linguist/blob/d403bc76daf1d83d97f7ee40cd64957cadc33706/lib/linguist/generated.rb#L53-L59 |
### 🚀 Features - **(github)** keep exe extensions on Windows by @iki in [#8424](#8424) - **(task)** add `interactive` field for exclusive terminal access by @jdx in [#8491](#8491) - add header comment to generated lockfiles by @ivy in [#8481](#8481) - runtime musl/glibc detection for correct libc variant selection by @jdx in [#8490](#8490) ### 🐛 Bug Fixes - **(github)** use registry platform options during install by @jdx in [#8492](#8492) - **(http)** store tool opts as native TOML to fix platform switching by @jdx in [#8448](#8448) - **(installer)** error if MISE_INSTALL_PATH is a directory by @jdx in [#8468](#8468) - **(prepare)** resolve sources/outputs relative to `dir` when set by @jdx in [#8472](#8472) - **(ruby)** fetch precompiled binary by release tag instead of listing all releases by @jdx in [#8488](#8488) - **(schema)** support structured objects in task depends by @risu729 in [#8463](#8463) - **(task)** replace println!/eprintln! with calm_io in task output macros by @vmaleze in [#8485](#8485) - handle scoped npm package names without backend prefix by @jdx in [#8477](#8477) ### 📦️ Dependency Updates - update ghcr.io/jdx/mise:copr docker digest to c485c4c by @renovate[bot] in [#8484](#8484) - update ghcr.io/jdx/mise:alpine docker digest to 8118bc7 by @renovate[bot] in [#8483](#8483) ### 📦 Registry - disable sd version test by @jdx in [#8489](#8489) ### New Contributors - @ivy made their first contribution in [#8481](#8481) - @iki made their first contribution in [#8424](#8424) ## 📦 Aqua Registry Updates #### New Packages (5) - [`datadog-labs/pup`](https://github.com/datadog-labs/pup) - [`k1LoW/mo`](https://github.com/k1LoW/mo) - [`rtk-ai/rtk`](https://github.com/rtk-ai/rtk) - [`suzuki-shunsuke/docfresh`](https://github.com/suzuki-shunsuke/docfresh) - [`yashikota/exiftool-go`](https://github.com/yashikota/exiftool-go) #### Updated Packages (6) - [`cloudflare/cloudflared`](https://github.com/cloudflare/cloudflared) - [`mozilla/sccache`](https://github.com/mozilla/sccache) - [`owenlamont/ryl`](https://github.com/owenlamont/ryl) - [`spinel-coop/rv`](https://github.com/spinel-coop/rv) - [`technicalpickles/envsense`](https://github.com/technicalpickles/envsense) - [`weaviate/weaviate`](https://github.com/weaviate/weaviate)
Hey friend! 👋
My agents keep trying to update the mise lockfile by hand. It's ridiculous. I could settle for a line in
AGENTS.md/CLAUDE.mdbut I figured, it'd help to put a headder in the lockfile that explains the obvious until the training data catches up.It might also help with the confused humans too.
(Note: I didn't not wordsmith this.)
Example: