feat: support post-task script hooks#1265
Conversation
Co-authored-by: monkeyWie <13160176+monkeyWie@users.noreply.github.com>
Co-authored-by: monkeyWie <13160176+monkeyWie@users.noreply.github.com>
Co-authored-by: monkeyWie <13160176+monkeyWie@users.noreply.github.com>
Co-authored-by: monkeyWie <13160176+monkeyWie@users.noreply.github.com>
|
@copilot support windows shells such like cmd or powshells |
Co-authored-by: monkeyWie <13160176+monkeyWie@users.noreply.github.com>
Done in a2508e9. Added support for:
Also added 3 Windows example scripts (move_file.bat, move_file.ps1, notify.ps1) and updated documentation with Windows-specific guidance. |
|
Co-authored-by: monkeyWie <13160176+monkeyWie@users.noreply.github.com>
Done in 833e289:
|
|
@copilot 脚本执行不需要限制超时时间 |
Co-authored-by: monkeyWie <13160176+monkeyWie@users.noreply.github.com>
|
Co-authored-by: monkeyWie <13160176+monkeyWie@users.noreply.github.com>
Done in 3ee6593:
|
|
@copilot 单测跑不通了,看看什么情况,验证并修复,并且确保跑通单测: RUN TestDownloaderStoreConfig_Init/Init_Archive |
Co-authored-by: monkeyWie <13160176+monkeyWie@users.noreply.github.com>
Fixed in 0e43759. The test was failing because the new |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1265 +/- ##
==========================================
- Coverage 73.81% 73.70% -0.11%
==========================================
Files 47 48 +1
Lines 6110 6192 +82
==========================================
+ Hits 4510 4564 +54
- Misses 1184 1208 +24
- Partials 416 420 +4 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
@copilot 去掉往脚本里面写入json data的逻辑,另外不要_examples/scripts 里面的文件了,如果不是用于测试的话 |
Co-authored-by: monkeyWie <13160176+monkeyWie@users.noreply.github.com>
Done in a7a5cbe:
|
|
@copilot flutter UI那边也要加上对应的配置项 |
Co-authored-by: monkeyWie <13160176+monkeyWie@users.noreply.github.com>
Done in 651093c. Added Flutter UI configuration for script execution:
|
✅ Implementation Complete
This PR adds support for executing custom scripts automatically when downloads complete successfully, addressing the issue request for file movement and script execution capabilities. Includes full backend implementation and Flutter UI configuration.
📋 Completed Tasks
📊 Changes Summary
🎯 Key Features
GOPEED_TASK_PATHwith same logic as task deletion🖥️ Flutter UI Features
🔧 Environment Variables
Scripts receive the following environment variables:
GOPEED_EVENT: Event type (alwaysDOWNLOAD_DONE)GOPEED_TASK_ID: Unique task identifierGOPEED_TASK_NAME: Display name of the taskGOPEED_TASK_STATUS: Task statusGOPEED_TASK_PATH: Full path to the downloaded file or folder📚 Test Scripts
Test scripts located in
pkg/download/testdata/script/:test_basic.sh: Basic test scripttest_env.sh: Environment variable test script🔧 Technical Changes
Backend:
GOPEED_TASK_PATHenvironment variableFolderPath()for multi-file tasks andSingleFilepath()for single files (same as task deletion)pkg/download/testdata/script/directorycmd.Run()execution without JSON stdin complexityFlutter UI:
ScriptConfigclass with JSON serialization indownloader_config.darten_us.dart) and Chinese (zh_cn.dart)✅ Quality Checks
Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.