Skip to content

feat: 支持从此处运行、单独运行与单次运行任务#229

Open
overflow65537 wants to merge 1 commit into
MistEO:mainfrom
overflow65537:feat/task-run-modes
Open

feat: 支持从此处运行、单独运行与单次运行任务#229
overflow65537 wants to merge 1 commit into
MistEO:mainfrom
overflow65537:feat/task-run-modes

Conversation

@overflow65537
Copy link
Copy Markdown
Contributor

@overflow65537 overflow65537 commented May 31, 2026

新增任务右键菜单与三态复选框,允许从指定任务启动、仅运行单个任务,以及通过右键设置单次运行标记;左键复选框仅在启用与禁用间切换。

Summary by Sourcery

添加三态任务选择(tri-state)与“仅运行一次”语义以及新的运行模式,以改进任务执行控制。

新特性:

  • 允许通过任务上下文菜单从特定任务开始执行,或仅运行单个任务。
  • 为任务引入“仅运行一次”标记,使任务只参与下一次运行,完成后自动清除。
  • 添加任务的三态复选框界面,用于区分启用、禁用和仅运行一次三种状态。

增强:

  • 优化任务选择和过滤逻辑,使运行时能够考虑已启用和“仅运行一次”的任务,并通过任务启动服务支持外部启动请求。
  • 调整紧凑显示模式和任务名称样式,更准确地反映“仅运行一次”参与状态和未运行任务。
  • 为新的任务运行选项和“仅运行一次”提示扩展 i18n 字符串,覆盖所有受支持的语言环境。
Original summary in English

Summary by Sourcery

Add tri-state task selection with run-once semantics and new run modes to improve task execution control.

New Features:

  • Allow starting execution from a specific task or running a single task via the task context menu.
  • Introduce a run-once flag for tasks that includes them only in the next run and clears automatically after completion.
  • Add a tri-state checkbox UI for tasks to distinguish enabled, disabled, and run-once states.

Enhancements:

  • Refine task selection and filtering logic so runs consider enabled and run-once tasks and support external start requests via a task start service.
  • Adjust compact display and task name styling to reflect run-once participation and non-running tasks more accurately.
  • Extend i18n strings for new task run options and run-once hints across supported locales.

新增任务右键菜单与三态复选框,允许从指定任务启动、仅运行单个任务,以及通过右键设置单次运行标记;左键复选框仅在启用与禁用间切换。

Co-authored-by: Cursor <cursoragent@cursor.com>
Copy link
Copy Markdown
Contributor

@sourcery-ai sourcery-ai Bot left a comment

Choose a reason for hiding this comment

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

Hey - 我在这里给了一些高层面的反馈:

  • toggleTaskEnabled 中,当某个任务 runOnce=true 时,你目前会把它重置为 enabled:false/runOnce:false。这意味着对一个“只运行一次”的任务左键单击时,并不会真正把它切换到启用状态;可以考虑在清除 runOnce 时将 enabled 设置为 true,这样复选框就会像描述中的那样,充当一个简单的启用/禁用切换。
  • 条件 isInstanceRunning || isIncompatible 在多个处理函数中被重复使用(复选框点击/上下文菜单、run-from-here/run-single、上下文菜单项);可以考虑抽取一个小的辅助函数或布尔变量来集中这段逻辑,从而降低未来出现不一致行为的风险。
  • TaskList 使用 t.enabled || t.runOnce 来计算 hasEnabledTasks,而 Toolbar 使用 isTaskSelectedForRun;为了避免之后出现行为偏差,你可以在 TaskList 中也复用 isTaskSelectedForRun,这样运行选择的语义就可以集中在一个地方。
给 AI 代理的提示
Please address the comments from this code review:

## Overall Comments
- In toggleTaskEnabled, when a task has runOnce=true you currently reset it to enabled:false/runOnce:false, which means a left-click on a ‘run once’ task does not actually toggle it to enabled; consider setting enabled to true when clearing runOnce so the checkbox behaves as a simple enabled/disabled toggle as described.
- The condition `isInstanceRunning || isIncompatible` is duplicated in several handlers (checkbox click/context menu, run-from-here/run-single, context menu items); consider extracting a small helper or boolean to centralize this logic and reduce the risk of future inconsistencies.
- TaskList uses `t.enabled || t.runOnce` to compute `hasEnabledTasks` while Toolbar uses `isTaskSelectedForRun`; to avoid divergence over time you could reuse `isTaskSelectedForRun` in TaskList as well, keeping the run-selection semantics in one place.

Sourcery 对开源项目免费——如果你喜欢我们的代码审查,请考虑帮我们分享 ✨
帮我变得更有用!请在每条评论上点击 👍 或 👎,我会利用这些反馈来改进你的代码审查体验。
Original comment in English

Hey - I've left some high level feedback:

  • In toggleTaskEnabled, when a task has runOnce=true you currently reset it to enabled:false/runOnce:false, which means a left-click on a ‘run once’ task does not actually toggle it to enabled; consider setting enabled to true when clearing runOnce so the checkbox behaves as a simple enabled/disabled toggle as described.
  • The condition isInstanceRunning || isIncompatible is duplicated in several handlers (checkbox click/context menu, run-from-here/run-single, context menu items); consider extracting a small helper or boolean to centralize this logic and reduce the risk of future inconsistencies.
  • TaskList uses t.enabled || t.runOnce to compute hasEnabledTasks while Toolbar uses isTaskSelectedForRun; to avoid divergence over time you could reuse isTaskSelectedForRun in TaskList as well, keeping the run-selection semantics in one place.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- In toggleTaskEnabled, when a task has runOnce=true you currently reset it to enabled:false/runOnce:false, which means a left-click on a ‘run once’ task does not actually toggle it to enabled; consider setting enabled to true when clearing runOnce so the checkbox behaves as a simple enabled/disabled toggle as described.
- The condition `isInstanceRunning || isIncompatible` is duplicated in several handlers (checkbox click/context menu, run-from-here/run-single, context menu items); consider extracting a small helper or boolean to centralize this logic and reduce the risk of future inconsistencies.
- TaskList uses `t.enabled || t.runOnce` to compute `hasEnabledTasks` while Toolbar uses `isTaskSelectedForRun`; to avoid divergence over time you could reuse `isTaskSelectedForRun` in TaskList as well, keeping the run-selection semantics in one place.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

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