Skip to content

feat(ui-plugins): add Batch File Renamer (batch-file-renamer) - #256

Open
ppppp2005-p wants to merge 11 commits into
zai-org:mainfrom
ppppp2005-p:feat/batch-file-renamer
Open

ppppp2005-p wants to merge 11 commits into
zai-org:mainfrom
ppppp2005-p:feat/batch-file-renamer

Conversation

@ppppp2005-p

Copy link
Copy Markdown

Plugin type (required) / 插件类型(必填)

  • UI Plugin / 是 UI 插件 — provides MCP Apps interactive pages / 提供 MCP Apps 交互页面
  • Standard plugin / 普通插件(非 UI)
  • Not applicable / 不适用

Affected plugin name(s) / 涉及的插件名称:batch-file-renamer (UI Plugin, new)

What / 改动内容

New community UI plugin Batch File Renamer / 批量重命名: Rename a whole folder of files by rules — find/replace or regex, name templates with numbering, dates and folder names, case and space clean-up, lower-case extensions and per-file manual names. See old → new for every file and every clash before anything changes, rename safely (swaps and case-only changes work), keep a log, and undo the last rename. Runs locally; no API keys.

  • Tools: rename_open, rename_edit, rename_status, rename_export (all share one side panel: file picker, settings, issue list, editable table, preview, export).
  • Rules: find/replace (plain or regex with $1), a name template with {name} {n} {date} {parent} {ext}, numbering start and digits, numbering by name or modified time.
  • Clean-up: lower/UPPER/Title case, spaces to - or _ or removed, runs of spaces collapsed, extensions lower-cased, illegal characters (\ / : * ? " < > |) replaced.
  • Manual names: type a new name for any file in the table; the extension is kept if you leave it out.
  • Safety: duplicate targets, names that already belong to other files and broken regexes are errors and block the rename; renaming is two-step so swaps and case-only changes work, and it rolls back if something fails.
  • Undo: the last rename is logged and can be reverted with the “Undo” button (it is never part of “Export all”).
  • Scope (v0.1):
    • Renames files only, not folders, inside the workspace; hidden files are skipped.
    • Up to 5 folders and 5,000 files per project; subfolders are optional.
    • Reading EXIF dates for photo names is a separate plugin (Photo Date Organizer).
  • Local only; writes only batch-file-renamer/ in the workspace. Workspace paths are checked so symlinks cannot lead reads or writes outside the workspace (regression test included).
  • Tests: vitest unit + MCP tool tests on real sample files, and a browser e2e with the official AppBridge host (panel → open → edit → export).

A ZCode Desktop demo recording is attached in the comments. / ZCode 桌面版演示录屏见评论。

Self-check / 自查清单

  • Plugin name is unique kebab-case; new external plugin directory is external_plugins/<name>/
  • Usage category is set (productivity)
  • Plugin type and affected names are declared above
  • version 0.1.0 in both plugin.json and marketplace.json
  • README.md (EN) and README_CN.md (中文) both provided and equivalent
  • description_i18n has both en and zh-CN
  • No secrets, machine-specific paths, or private dependencies
  • Model/API/network dependencies documented
  • python3 scripts/validate.py and python3 scripts/build_dist.py pass locally
  • Exercised in ZCode Desktop (ZCode 4.0.0, macOS arm64: installed from a local marketplace, opened the folder p100/batch-file-renamer/photos and exported the rename (3 files renamed, plan + undo log); demo video in the comments)

@ppppp2005-p

Copy link
Copy Markdown
Author

ZCode desktop demo (ZCode 4.0.0, macOS arm64)

batch-file-renamer-demo.mp4

Flow shown:

  1. Installed batch-file-renamer from a local marketplace built from this PR's branch.
  2. Asked ZCode to open the folder p100/batch-file-renamer/photos (8 mixed files: camera JPGs with .JPG, a screenshot, a WeChat image, a text file with double spaces, two 报价单 (n).pdf) and export (rename_open, rename_edit only if something blocks, rename_export).
  3. rename_open found no blocking problems with the default rules (template {name}, lowercase extensions, collapse repeated spaces), so rename_edit was not needed. The side panel (批量重命名) shows the find/replace, template, numbering, case, space and extension settings and the file table.
  4. rename_export renamed 3 of the 8 files on disk (IMG_…JPG → .jpg, notes draft FINAL.txt → notes draft FINAL.txt) and wrote batch-file-renamer/photos/rename-plan.csv and rename-log-….csv (the log is what the undo action uses). After the export the panel shows 8 files, 0 left to rename. The last card is the final state.

演示流程:本地 marketplace 安装 → rename_open(8 个文件,默认规则无问题)→ rename_export 实际改名 3 个文件(扩展名统一小写、合并连续空格),写出改名计划和可撤销日志;面板显示规则设置和文件表。

@panda920

Copy link
Copy Markdown
Collaborator

✅ Internal validation passed. A ZCode maintainer will review the change next; after acceptance, release checks run separately and this PR is closed automatically.

This branch has not been deployed

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants