Skip to content

feat: 记录并展示本地整合包实例的版本号 - #1886

Merged
UNIkeEN merged 1 commit into
UNIkeEN:mainfrom
CiiLu:modpack
Aug 6, 2026
Merged

feat: 记录并展示本地整合包实例的版本号#1886
UNIkeEN merged 1 commit into
UNIkeEN:mainfrom
CiiLu:modpack

Conversation

@CiiLu

@CiiLu CiiLu commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Checklist

  • Changes have been tested locally and work as expected.
  • All tests in workflows pass successfully.
  • Documentation has been updated if necessary.
  • Code formatting and commit messages align with the project's conventions.
  • Comments have been added for any complex logic or functionality if possible.

This PR is a ..

  • 🆕 New feature
  • 🐞 Bug fix
  • 🛠 Refactoring
  • ⚡️ Performance improvement
  • 🌐 Internationalization
  • 📄 Documentation improvement
  • 🎨 Code style optimization
  • ❓ Other (Please specify below)

Related Issues

resolves #1785

Description

image

Additional Context

Summary by Sourcery

Record and surface modpack version information for local instances, from creation/import through to display in the instances list.

New Features:

  • Persist an optional modpack version on instances across backend models, commands, and MCP tooling.
  • Display the associated modpack version in the instances list header when available, normalizing it with a leading v.

Enhancements:

  • Propagate modpack version metadata from the modpack import modal into instance creation so it can be stored and reused.

@sourcery-ai

sourcery-ai Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Reviewer's Guide

Adds support for recording a modpack version when creating an instance and displaying that version in the instances list, by wiring a new optional modpackVersion/modpack_version field through the frontend, Tauri commands, and backend models.

Sequence diagram for propagating modpackVersion from import to instances list

sequenceDiagram
  participant ImportModpackModal
  participant InstanceService
  participant TauriInvoke as invoke_create_instance
  participant CreateInstance as create_instance
  participant InstanceSummary
  participant InstancesView

  ImportModpackModal->>InstanceService: createInstance(directory, name, description, runtimeConfig, modLoaderResourceInfo, modpackPath, isInstallFabricApi, isInstallQfApi, modpack.version)
  InstanceService->>TauriInvoke: invoke create_instance{ modpackVersion }
  TauriInvoke->>CreateInstance: create_instance(directory, name, runtime_config, modpack_path, is_install_fabric_api, is_install_qf_api, modpack_version)
  CreateInstance->>CreateInstance: set instance.modpack_version = modpack_version
  CreateInstance->>InstanceSummary: InstanceSummary::from(instance)
  InstanceSummary-->>InstancesView: modpack_version
  InstancesView->>InstancesView: render titleExtra with modpackVersion
Loading

File-Level Changes

Change Details Files
Display modpack version badge in the instances list item header when available.
  • Extend titleExtra condition to render when a modpackVersion exists, in addition to starred/tag states.
  • Render a small gray text badge showing the modpack version, prefixing with 'v' when missing.
  • Keep existing star and tag indicators alongside the new version badge.
src/components/instances-view.tsx
Propagate modpack version from imported modpack metadata into instance creation requests.
  • Update ImportModpackModal to pass modpack.version as an additional argument to the instance creation service call.
  • Adjust InstanceService.createInstance signature to accept an optional modpackVersion and include it in the Tauri invoke payload.
  • Extend MCP launcher tool route schema to accept an optional modpack_version parameter and forward it into instance creation.
src/components/modals/import-modpack-modal.tsx
src/services/instance.ts
src-tauri/src/intelligence/mcp_server/launcher/tools/instance.rs
Add modpack_version field to instance models and wire it through instance creation and summaries.
  • Add modpack_version: Option to Rust instance model/misc struct and InstanceSummary, and populate it from the underlying instance record.
  • Update create_instance Tauri command to accept an optional modpack_version argument and store it on the new instance.
  • Add modpackVersion?: string to the TS InstanceSummary interface to align with the backend field.
src-tauri/src/instance/models/misc.rs
src-tauri/src/instance/commands.rs
src/models/instance/misc.ts

Assessment against linked issues

Issue Objective Addressed Explanation
#1785 Record/store the modpack version number for a local modpack-based instance when it is created/imported.
#1785 Display the stored modpack version number as a label in the instance list UI (HMCL-like label on the instance).

Possibly linked issues


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

@github-actions github-actions Bot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Aug 5, 2026

@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 left some high level feedback:

  • The createInstance call in import-modpack-modal.tsx now has a long tail of positional optional arguments ending in modpack.version; consider refactoring this API to use an options object or named parameters to make the call site clearer and less error‑prone when adding more options.
  • In InstancesView, the modpackVersion formatting logic (prefixing with v) is embedded in the UI; you might consider normalizing this value at the service/model layer so all consumers get a consistently formatted version string and the view stays simpler.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- The `createInstance` call in `import-modpack-modal.tsx` now has a long tail of positional optional arguments ending in `modpack.version`; consider refactoring this API to use an options object or named parameters to make the call site clearer and less error‑prone when adding more options.
- In `InstancesView`, the `modpackVersion` formatting logic (prefixing with `v`) is embedded in the UI; you might consider normalizing this value at the service/model layer so all consumers get a consistently formatted version string and the view stays simpler.

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.

@UNIkeEN
UNIkeEN merged commit 32df79f into UNIkeEN:main Aug 6, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/M Denotes a PR that changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature] 展示整合包实例的版本号

2 participants