Skip to content

Add plugin 快速处理数据 v1.0.0#279

Open
onezylee wants to merge 2 commits into
ZToolsCenter:mainfrom
onezylee:plugin/fast-data
Open

Add plugin 快速处理数据 v1.0.0#279
onezylee wants to merge 2 commits into
ZToolsCenter:mainfrom
onezylee:plugin/fast-data

Conversation

@onezylee

@onezylee onezylee commented Jun 29, 2026

Copy link
Copy Markdown

插件信息

  • 名称: 快速处理数据
  • 插件ID: fast-data
  • 版本: 1.0.0
  • 描述: 快速批量处理数据
  • 作者: onezylee
  • 类型: 新增

本次变更

  • init
  • 更新命令为“fast-data”

截图 / 演示

1782728587042_d

自检清单

  • plugin.json 的 name / title / version / description / author 字段均已检查
  • 已移除调试日志、未使用文件、敏感信息(.env、token、密钥等)
  • 本次 PR 的 diff 仅涉及 plugins/fast-data/ 目录
  • 已在本地 ZTools 客户端实际加载并测试过此插件,主要功能正常
  • 同意以仓库声明的开源协议发布此插件

此 PR 由 ztools-plugin-cli 自动管理:每次 ztools publish 在分支上追加一个 commit,PR 链接保持不变。

onezylee added 2 commits June 29, 2026 17:45
- init
- 更新命令为“fast-data”

@gemini-code-assist gemini-code-assist 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.

Code Review

This pull request implements the 'fast-data' (快速处理数据) ZTools plugin, adding configuration files, a main Vue application, and text transformation utilities. However, several issues were identified in the review: the getProcessedLines function in index.vue automatically trims all lines, making the trimEdges option redundant and stripping original indentation; the initial route state in App.vue is incorrectly set to 'fast' instead of 'fast-data', which breaks local browser development; and index.vue duplicates text processing logic rather than importing and reusing the pure functions defined in transformers.ts.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment on lines +137 to +139
let lines = splitLines(text)
.map((line) => line.trim())
.filter((line) => line.length > 0)

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.

high

getProcessedLines 中,默认对所有行进行了 .map((line) => line.trim()) 操作。这导致无论用户是否启用了“两边空”(trimEdges)选项,输出的数据都会被强制去除首尾空格(例如代码缩进或格式化空格)。这使得 trimEdges 选项变得冗余,且无法保留原始文本的缩进。\n\n建议修改为仅过滤掉纯空白行,保留原始行的空格,只有在启用 trimEdges 时才进行修剪。

  let lines = splitLines(text)\n    .filter((line) => line.trim().length > 0)

import { onMounted, ref } from 'vue'
import Fast from './Fast/index.vue'

const route = ref('fast')

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.

medium

App.vue 中,route 的初始值被设置为 'fast',但在 plugin.json 中,插件的 feature code 已被更新为 'fast-data',且模板中使用的判断条件是 route === 'fast-data'。\n\n这会导致两个问题:\n1. 初始状态不一致:在 ZTools 客户端加载插件时,初始渲染会因为路由不匹配而跳过,直到 onPluginEnter 事件触发后才重新渲染。\n2. 本地浏览器开发失效:在本地浏览器中进行开发调试时(此时没有 window.ztools 环境,不会触发 onPluginEnter),页面将完全空白,无法进行任何 UI 预览和调试。\n\n建议将 route 的初始值修改为 'fast-data'

const route = ref('fast-data')

Comment on lines +1 to +2
<script setup lang="ts">
import { ref, watch } from 'vue'

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.

medium

index.vue 中,所有的数据处理逻辑(如 splitLines、去重、去除注释、大小写转换等)都是直接在组件内实现的,而没有导入并使用 src/Fast/transformers.ts 中定义的纯文本处理函数。这导致 transformers.ts 变成了完全未使用的死代码,且存在严重的逻辑重复。\n\n建议重构 index.vue,导入并复用 transformers.ts 中的函数,以提高代码的可维护性和可测试性。

@onezylee onezylee marked this pull request as ready for review June 29, 2026 10:25
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.

1 participant