Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@narnaud
Copy link
Contributor

@narnaud narnaud commented Sep 13, 2025

The path installed via clink installscripts was different for each
version of clink-flex-prompt, creating issues as the same script was
loaded multiple times (with different version).

This change makes the path consistent across versions, making sure only
the latest one is loaded.

Closes #7170

  • Use conventional PR title: <manifest-name[@version]|chore>: <general summary of the pull request>
  • I have read the Contributing Guide

Summary by CodeRabbit

  • Bug Fixes
    • Improved reliability of Clink script installation and uninstallation by using a corrected path, preventing scripts from targeting the wrong directory.
    • Ensures consistent behavior in both default and Cmder environments, reducing setup issues and path-related errors.
    • No changes to error handling or overall workflow; only the path resolution for script operations was corrected.

The path installed via clink installscripts was different for each
version of clink-flex-prompt, creating issues as the same script was
loaded multiple times (with different version).

This change makes the path consistent across versions, making sure only
the latest one is loaded.

Closes ScoopInstaller#7170
@coderabbitai
Copy link

coderabbitai bot commented Sep 13, 2025

Walkthrough

Introduces a new PowerShell variable $luapath pointing to the canonical "current" directory and replaces uses of $dir with $luapath in clink installscripts/uninstallscripts calls within both installer and uninstaller blocks of bucket/clink-flex-prompt.json.

Changes

Cohort / File(s) Summary
Canonicalize clink script path usage
bucket/clink-flex-prompt.json
Define $luapath = Join-Path (Split-Path -Path "$dir" -Parent) "current". Replace clink installscripts "$dir" and clink uninstallscripts "$dir" (including Cmder branch) with $luapath. No other logic changes.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  actor User
  participant Scoop as Scoop Installer
  participant PS as PowerShell Script
  participant Clink as clink.exe

  rect rgba(220,235,245,0.5)
  note over PS: Install
  User->>Scoop: scoop install clink-flex-prompt
  Scoop->>PS: Run install block
  PS->>PS: $luapath = Join-Path (Split-Path $dir -Parent) "current"
  PS->>Clink: clink installscripts "$luapath"
  Clink-->>PS: Register scripts (canonical path)
  end

  rect rgba(235,220,245,0.5)
  note over PS: Uninstall
  User->>Scoop: scoop uninstall clink-flex-prompt
  Scoop->>PS: Run uninstall block
  PS->>PS: $luapath = Join-Path (Split-Path $dir -Parent) "current"
  PS->>Clink: clink uninstallscripts "$luapath"
  Clink-->>PS: Deregister scripts
  end
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

I hop along the PATH so bright,
From “dir” to “current,” set just right.
No duplicate burrows in the night—
One warren found by Clink’s clear sight.
Scripts align, the prompts delight.
Thump-thump! My ears applaud the byte. 🐇✨

Pre-merge checks and finishing touches

✅ Passed checks (5 passed)
Check name Status Explanation
Title Check ✅ Passed The title "[email protected]: fix clink script path" is concise, follows the repository's "manifest@version: " convention, and accurately highlights the primary change (fixing the clink script installation path) so a reviewer can quickly understand the PR's purpose.
Linked Issues Check ✅ Passed The linked issue (#7170) requested registering a canonical, non-versioned path to avoid duplicate clink script registrations; the changes add a $luapath that points to a "current" canonical location and replace versioned $dir usages for clink installscripts/uninstallscripts in both installer and uninstaller (including Cmder branches), which implements the requested solution and should prevent multiple versions from being loaded.
Out of Scope Changes Check ✅ Passed According to the provided summary, the PR only modifies the path variable and the clink install/uninstall invocations and does not touch unrelated files or logic, so no out-of-scope changes are detected.
Description Check ✅ Passed The PR description explains the problem (multiple versions being loaded), describes the implemented fix to make the installed path consistent, includes "Closes #7170", and marks the required checklist items from the repository template, so it satisfies the template and provides sufficient context for reviewers.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.
✨ Finishing touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Tip

👮 Agentic pre-merge checks are now available in preview!

Pro plan users can now enable pre-merge checks in their settings to enforce checklists before merging PRs.

  • Built-in checks – Quickly apply ready-made checks to enforce title conventions, require pull request descriptions that follow templates, validate linked issues for compliance, and more.
  • Custom agentic checks – Define your own rules using CodeRabbit’s advanced agentic capabilities to enforce organization-specific policies and workflows. For example, you can instruct CodeRabbit’s agent to verify that API documentation is updated whenever API schema files are modified in a PR. Note: Upto 5 custom checks are currently allowed during the preview period. Pricing for this feature will be announced in a few weeks.

Please see the documentation for more information.

Example:

reviews:
  pre_merge_checks:
    custom_checks:
      - name: "Undocumented Breaking Changes"
        mode: "warning"
        instructions: |
          Pass/fail criteria: All breaking changes to public APIs, CLI flags, environment variables, configuration keys, database schemas, or HTTP/GraphQL endpoints must be documented in the "Breaking Change" section of the PR description and in CHANGELOG.md. Exclude purely internal or private changes (e.g., code not exported from package entry points or explicitly marked as internal).

Please share your feedback with us on this Discord post.


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

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

@github-actions
Copy link
Contributor

All changes look good.

Wait for review from human collaborators.

clink-flex-prompt

  • Description
  • License
  • Hashes
  • Checkver
  • Autoupdate

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between b33b26e and 97e4aa4.

📒 Files selected for processing (1)
  • bucket/clink-flex-prompt.json (1 hunks)

@narnaud
Copy link
Contributor Author

narnaud commented Sep 13, 2025

For information, it's the same fix that was applied to clink-completions some month ago.

@Lutra-Fs
Copy link
Member

Lutra-Fs commented Oct 3, 2025

For information, it's the same fix that was applied to clink-completions some month ago.

Hi I plan to review this PR. if possible could you add the link to that PR/issue/commit for reference? That would be easier for me.
Regards.

@narnaud
Copy link
Contributor Author

narnaud commented Oct 4, 2025

@Lutra-Fs Thanks for the review, here is the other PR: #6577

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: clink-flex-prompt have multiple version loaded by clink

2 participants