Skip to content

cudatext: Improve persistence and add uninstaller logic#17092

Open
SorYoshino wants to merge 1 commit intoScoopInstaller:masterfrom
SorYoshino:cudatext
Open

cudatext: Improve persistence and add uninstaller logic#17092
SorYoshino wants to merge 1 commit intoScoopInstaller:masterfrom
SorYoshino:cudatext

Conversation

@SorYoshino
Copy link
Contributor

@SorYoshino SorYoshino commented Jan 26, 2026

Summary

Restructures the cudatext manifest to support full persistence of add-ons and data, handles core component updates via .original directories, and automates shell extension removal.

Related issues or pull requests

Changes

  • Expand description to provide a more comprehensive overview of the editor's features.
  • Structure the license field with a full SPDX identifier and a direct URL to the license file.
  • Implement post_install logic to move files from .original directories to active directories (py and data), ensuring core updates are applied while respecting the persistence layer.
  • Expand the persist field to include py and data folders, preserving Python-based add-ons and application data across updates.
  • Add an uninstaller script to automate the removal of the Explorer context menu handler using the application's own uninstallation batch files.
  • Include a registry check to ensure the uninstaller only runs if the context menu handler is present.
  • Add an explorer restart command in the uninstaller to ensure shell extensions are refreshed immediately after removal.

Notes

settings folder must not be modified by installer at all. installer must not create it nor add files there.

data / py foldes - only several subfolders must be updated. which? look at the Gihub page of editor - those which present in Github, must be updated by installer.

Testing

The test results are as follows:
┏[ ~]
└─> Test-Administrator
False

┏[ ~]
└─> scoop install Unofficial/cudatext
Installing 'cudatext' (1.231.8.0) [64bit] from 'Unofficial' bucket
Loading cudatext-windows-amd64-1.231.8.0.zip from cache.
Checking hash of cudatext-windows-amd64-1.231.8.0.zip... OK.
Extracting cudatext-windows-amd64-1.231.8.0.zip... Done.
Linking D:\Software\Scoop\Local\apps\cudatext\current => D:\Software\Scoop\Local\apps\cudatext\1.231.8.0
Creating shim for 'cudatext'.
Making D:\Software\Scoop\Local\shims\cudatext.exe a GUI binary.
Creating shortcut for CudaText (cudatext.exe)
Persisting py
Persisting data
Persisting settings
Running post_install script... Done.
'cudatext' (1.231.8.0) was installed successfully!


# Context menu not registered

┏[ ~]
└─> Test-Path -LiteralPath 'HKLM:\Software\Classes\*\shellex\ContextMenuHandlers\CudaTextContextMenuHandler'
False

┏[ ~]
└─> scoop update cudatext -f
cudatext: 1.231.8.0 -> 1.231.8.0
Updating one outdated app:
Updating 'cudatext' (1.231.8.0 -> 1.231.8.0)
Downloading new version
Loading cudatext-windows-amd64-1.231.8.0.zip from cache.
Checking hash of cudatext-windows-amd64-1.231.8.0.zip... OK.
Uninstalling 'cudatext' (1.231.8.0)
Running uninstaller script... Done.
Removing shim 'cudatext.shim'.
Removing shim 'cudatext.exe'.
Unlinking D:\Software\Scoop\Local\apps\cudatext\current
Installing 'cudatext' (1.231.8.0) [64bit] from 'Unofficial' bucket
Loading cudatext-windows-amd64-1.231.8.0.zip from cache.
Extracting cudatext-windows-amd64-1.231.8.0.zip... Done.
Linking D:\Software\Scoop\Local\apps\cudatext\current => D:\Software\Scoop\Local\apps\cudatext\1.231.8.0
Creating shim for 'cudatext'.
Making D:\Software\Scoop\Local\shims\cudatext.exe a GUI binary.
Creating shortcut for CudaText (cudatext.exe)
Persisting py
Persisting data
Persisting settings
Running post_install script... Done.
'cudatext' (1.231.8.0) was installed successfully!

┏[ ~]
└─> scoop uninstall cudatext -p
Uninstalling 'cudatext' (1.231.8.0).
Running uninstaller script... Done.
Removing shim 'cudatext.shim'.
Removing shim 'cudatext.exe'.
Removing shortcut ~\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Scoop Apps\CudaText.lnk
Unlinking D:\Software\Scoop\Local\apps\cudatext\current
Removing older version (_1.231.8.0.old).
Removing persisted data.
'cudatext' was uninstalled.


# Context menu registered

┏[ ~]
└─> Test-Path -LiteralPath 'HKLM:\Software\Classes\*\shellex\ContextMenuHandlers\CudaTextContextMenuHandler'
True

┏[ ~]
└─> scoop update cudatext -f
cudatext: 1.231.8.0 -> 1.231.8.0
Updating one outdated app:
Updating 'cudatext' (1.231.8.0 -> 1.231.8.0)
Downloading new version
Loading cudatext-windows-amd64-1.231.8.0.zip from cache.
Checking hash of cudatext-windows-amd64-1.231.8.0.zip... OK.
Uninstalling 'cudatext' (1.231.8.0)
Running uninstaller script... Done.
Removing shim 'cudatext.shim'.
Removing shim 'cudatext.exe'.
Unlinking D:\Software\Scoop\Local\apps\cudatext\current
Installing 'cudatext' (1.231.8.0) [64bit] from 'Unofficial' bucket
Loading cudatext-windows-amd64-1.231.8.0.zip from cache.
Extracting cudatext-windows-amd64-1.231.8.0.zip... Done.
Linking D:\Software\Scoop\Local\apps\cudatext\current => D:\Software\Scoop\Local\apps\cudatext\1.231.8.0
Creating shim for 'cudatext'.
Making D:\Software\Scoop\Local\shims\cudatext.exe a GUI binary.
Creating shortcut for CudaText (cudatext.exe)
Persisting py
Persisting data
Persisting settings
Running post_install script... Done.
'cudatext' (1.231.8.0) was installed successfully!

┏[ ~]
└─> scoop uninstall cudatext -p
Uninstalling 'cudatext' (1.231.8.0).
Running uninstaller script...
[ERROR]  cudatext requires admin rights to uninstall.

┏[ ~]
└─[ Error, check your command]> sudo scoop uninstall cudatext -p
Uninstalling 'cudatext' (1.231.8.0).
Running uninstaller script... Done.
Removing shim 'cudatext.shim'.
Removing shim 'cudatext.exe'.
Removing shortcut ~\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Scoop Apps\CudaText.lnk
Unlinking D:\Software\Scoop\Local\apps\cudatext\current
Removing older version (_1.231.8.0.old).
Removing persisted data.
'cudatext' was uninstalled.
  • Use conventional PR title: <manifest-name[@version]|chore>: <general summary of the pull request>
  • I have read the Contributing Guide

Summary by CodeRabbit

  • New Features

    • Added post-installation operations for automated setup tasks.
    • Added enhanced uninstall process with cleanup operations.
  • Improvements

    • Extended product descriptions with detailed information.
    • Updated license representation for better clarity and accessibility.
    • Improved file persistence handling with expanded configuration options.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link

coderabbitai bot commented Jan 26, 2026

Walkthrough

The CudaText package manifest is updated to resolve plugin loss during updates by expanding the persist field to include the "py" folder, restructuring the license field, adding post-install and uninstall script blocks, and enhancing the description.

Changes

Cohort / File(s) Summary
CudaText Manifest Configuration
bucket/cudatext.json
License field converted from string to structured object; persist field expanded from single value to array containing py, data, and settings directories; post_install script block added for post-install operations; uninstaller block added with cleanup and admin-check scripts; description enhanced with detailed multi-sentence content

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~5 minutes

Possibly related PRs

Suggested labels

review-needed

Suggested reviewers

  • z-Fng

Poem

🐰 A plugin's home was lost to time,
When updates came, persistence resigned,
But now the "py" folder stays so true,
With persist arrays and scripts brand new! 🎉

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main changes: improving persistence for add-ons/data and adding uninstaller logic to the cudatext manifest.
Description check ✅ Passed The PR description provides a comprehensive summary with related issue, detailed changes, implementation notes, and comprehensive test results demonstrating the functionality.
Linked Issues check ✅ Passed The PR directly addresses issue #12452 by persisting the py folder to prevent plugin loss during updates, implementing post_install logic to handle core updates via .original directories, and automating context menu handler removal.
Out of Scope Changes check ✅ Passed All changes are directly related to the linked issue objectives: persist py and data folders, implement post_install and uninstaller logic, and improve documentation. No out-of-scope modifications detected.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

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


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.

cudatext

  • Lint
  • Description
  • License
  • Hashes
  • Checkver
  • Autoupdate

Check the full log for details.

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: 1

🤖 Fix all issues with AI agents
In `@bucket/cudatext.json`:
- Around line 20-27: In the post_install PowerShell block that iterates "'py',
'data' | ForEach-Object { … }", guard the Copy-Item call against empty
"$dir\$_.original" directories by checking for child items before copying: use
Test-Path/$null check or Get-ChildItem on "$dir\$_.original" and only invoke
Copy-Item when children exist; keep the existing Remove-Item behavior for
cleanup. This prevents non-terminating Copy-Item errors when an upstream release
provides an empty .original folder while leaving the rest of the post_install
logic unchanged.
🧹 Nitpick comments (1)
bucket/cudatext.json (1)

42-48: Handle missing uninstaller batch file; verify registry scope.

If no un*.cmd exists, $batch_file is $null and Start-Process will throw, leaving the handler in place. Also, please confirm whether CudaText ever registers the handler under HKCU; if so, the early HKLM-only check would skip cleanup for per-user installs.

🛠️ Suggested guard for missing batch file
     if (-not (is_admin)) { abort "`n[ERROR]  $app requires admin rights to $cmd." }
     $batch_file = Get-ChildItem -Path $dir -Filter 'un*.cmd' -File | Select-Object -First 1
+    if (-not $batch_file) { abort "`n[ERROR]  Missing uninstaller script (un*.cmd) in $dir." }
     Start-Process -FilePath $batch_file.FullName -NoNewWindow -Wait
 }

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]: The CudaText plugins was not persisted after update

1 participant