Skip to content

cudatext: Improve persistence#17092

Merged
z-Fng merged 3 commits intoScoopInstaller:masterfrom
SorYoshino:cudatext
Apr 19, 2026
Merged

cudatext: Improve persistence#17092
z-Fng merged 3 commits intoScoopInstaller:masterfrom
SorYoshino:cudatext

Conversation

@SorYoshino
Copy link
Copy Markdown
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.

Edit:

  • 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.

change: Windows: shell extension files (.cmd and cudatext_shell.dll) removed from distributive, to avoid potential problems on Windows 11

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.
  • Improvements

    • Expanded product description text for clearer detail.
    • Updated license field to a structured representation with a reference link.
    • Broadened persistence configuration to include additional data types.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Jan 26, 2026

Walkthrough

Manifest for CudaText updated: description expanded, license converted to an object with URL, persist extended to include py and data, and a post_install script added to restore any *.original subdirectories into target folders and remove them.

Changes

Cohort / File(s) Summary
CudaText Manifest
bucket/cudatext.json
Expanded description; converted license from string to object with identifier and url; changed persist from "settings" to ["py","data","settings"]; added post_install script to copy contents from *.original subfolders into target dirs and remove originals.

Sequence Diagram(s)

sequenceDiagram
    autonumber
    participant User
    participant Scoop
    participant Manifest as "cudatext.json"
    participant FS as Filesystem
    User->>Scoop: install/update cudatext
    Scoop->>Manifest: read manifest (persist, post_install)
    Scoop->>FS: extract package files (includes `py`, `data`, `settings`, `*.original`)
    Scoop->>Scoop: run post_install script
    Scoop->>FS: for dir in [py,data]: if dir/original exists -> copy contents to dir
    Scoop->>FS: remove dir/original after copy
    Scoop->>User: finish install/update
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Suggested reviewers

  • z-Fng

Poem

🐰
I hopped through bytes and folders deep,
Restored the plugins from their sleep,
Copied originals, tucked them tight,
Now CudaText keeps them through the night. 🎉

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: expanding the manifest's persistence configuration to include py and data folders.
Linked Issues check ✅ Passed The PR fully addresses issue #12452 by persisting the py folder and implementing logic to handle preinstalled plugin updates via .original directories while preserving user-installed plugins.
Out of Scope Changes check ✅ Passed All changes are directly related to issue #12452: expanding description, structuring license, adding post_install and uninstaller scripts, and expanding persist field are all within scope of improving persistence and managing core updates.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Description check ✅ Passed The PR description comprehensively covers all required elements: summary, related issues, detailed changes, notes, testing results, and confirms both checklist items.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

Tip

You can enable review details to help with troubleshooting, context usage and more.

Enable the reviews.review_details setting to include review details such as the model used, the time taken for each step and more in the review comments.

@github-actions
Copy link
Copy Markdown
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
Copy Markdown

@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
 }

Comment thread bucket/cudatext.json
@SorYoshino SorYoshino changed the title cudatext: Improve persistence and add uninstaller logic cudatext: Improve persistence Mar 22, 2026
@SorYoshino
Copy link
Copy Markdown
Contributor Author

/verify

@github-actions
Copy link
Copy Markdown
Contributor

All changes look good.

Wait for review from human collaborators.

cudatext

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

Check the full log for details.

@z-Fng
Copy link
Copy Markdown
Member

z-Fng commented Apr 19, 2026

/verify

@github-actions
Copy link
Copy Markdown
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
Copy Markdown
Member

@z-Fng z-Fng left a comment

Choose a reason for hiding this comment

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

Thanks for your contribution!

@z-Fng z-Fng merged commit f2c5315 into ScoopInstaller:master Apr 19, 2026
2 checks passed
@SorYoshino SorYoshino deleted the cudatext branch April 19, 2026 09:16
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

2 participants