Commit Graph

90 Commits

Author SHA1 Message Date
wauxing 8ca5a63a7b Merge branch 'master' into baoerjun_branch: resolve conflicts in batch_update.go, batch.go, issue.go - keep HEAD CSV-driven batch-update + add batch-delete from master 2026-06-01 17:30:01 +08:00
wauxing 9af1e9d607 fix: 修复 milestone API 路径和字段名,batch milestone 现在实际生效
- Milestone 列表 API 路径从 /v1/:owner/:repo/versions 改为 /v1/:owner/:repo/milestones
- Milestone 数据解析从 env.Data 改为从 env.Data["milestones"] 提取
- Issue PATCH 中 milestone 字段从 fixed_version_id 改为 milestone_id
- 新增 getNestedMapInt() 从嵌套对象提取 milestone.id
- CSV 列名匹配添加 milestone_id 别名
- 端到端验证:名称解析/数字ID/batch-update/batch-create 全部通过
2026-06-01 16:40:37 +08:00
wauxing d183bc2c5d fix: 修复 label API 路径和字段名,batch-label 现在实际生效
- Label 列表 API 路径从 /v1/:owner/:repo/labels 改为 /:owner/:repo/labels(v0 前缀)
- Label 数据解析从 env.Data 改为从 env.Data["issue_tags"] 提取
- Issue PATCH 中 label 字段从 label_ids 改为 issue_tag_ids(GitLink 正确字段名)
- 新增 getTagIDs() 函数处理 GET issue 返回的 tags 对象数组
- 端到端验证:add/remove/set/dry-run/幂等/多标签/数字ID 全部通过
2026-06-01 16:40:37 +08:00
wauxing a4507ca9e9 refactor: batch 操作重构 + 修复 assign API 字段 + 补充单元测试
重构:
- 引入 BatchOptions 结构体,RunBatch 签名从 7 参数简化为结构体
- 提取 batchStateFlags/runBatchStateChange 消除 batch-close/batch-open 重复
- 提取 patchIssue 统一 fetch→patch 模式
- 延迟 API 调用到回调内,修复 --dry-run 仍触发网络请求的问题
- 消除 resolveAssigneeID,统一用 ResolveUserID

修复:
- assigned_to_id → assigner_ids(GitLink API 设置经办人的正确字段)
- searchIssues 移除 id fallback,避免用全局 ID 调 PATCH 导致 404
- priority 非法值从静默忽略改为显式报错
- --action 做 case-insensitive 处理

清理:
- 删除 closeIssue 死代码、existingIssue 类型别名、DoneRatio 字段
- 注释统一为中文

测试:
- 新增 batch_operation_test.go,覆盖 RunBatch 核心行为、patchIssue、
  label 合并/移除、status 解析、parseBatchOptions
2026-06-01 16:40:37 +08:00
wauxing 1e23b9691c chore: remove unused --verbose flags, move parseIntArg to batch_common, return error on batch_create truncation 2026-06-01 16:40:37 +08:00
wauxing 00d80ed6ff fix: address review findings - case-insensitive CSV, searchIssues ID priority, dedup numbers, truncation marker, and consistency 2026-06-01 16:40:37 +08:00
wauxing 161be6888a feat: add batch-assign CSV-driven mode 2026-06-01 16:40:37 +08:00
wauxing a2ac3c5659 feat: register batch-assign, batch-label, batch-update shortcuts 2026-06-01 16:40:37 +08:00
wauxing 4a9319e160 feat: add batch-create command 2026-06-01 16:40:37 +08:00
wauxing 56f7e428a3 feat: add batch-update CSV mode 2026-06-01 16:40:37 +08:00
wauxing 843bf0b505 feat: add batch-label command 2026-06-01 16:40:37 +08:00
wauxing c25b01b468 feat: add batch-assign uniform mode 2026-06-01 16:40:37 +08:00
wauxing 28804076e0 feat: add batch-open command 2026-06-01 16:40:37 +08:00
wauxing 2e26d586a5 refactor: migrate batch-close to shared engine 2026-06-01 16:40:37 +08:00
wauxing 58cea89a07 fix: scope label/milestone cache by repo, deduplicate parseDataArray 2026-06-01 16:40:37 +08:00
wauxing 5a3b809969 feat: add ResolveUserID, ResolveLabelID, ResolveMilestoneID with caching 2026-06-01 16:40:37 +08:00
wauxing 6bd588eaf1 fix: use ReadCSV/FindColumn in ResolveIssueNumbers CSV path 2026-06-01 16:40:37 +08:00
wauxing aa0a392d3e feat: add ResolveIssueNumbers and RunBatch 2026-06-01 16:40:37 +08:00
wauxing 9b9c081017 feat: add IssueData, BatchResult, BatchSummary types and CSV utilities 2026-06-01 16:40:37 +08:00
wauxing 2093434ebe chore: add .gitignore and ignore docs/ directory 2026-06-01 16:40:37 +08:00
wauxing 980dda890e docs: batch issue operations design spec (Chinese) 2026-06-01 16:40:37 +08:00
wauxing dd98d7ddc5 docs: add batch issue operations design spec 2026-06-01 16:40:37 +08:00
Surponess ddb9a9625f Merge pull request '文件描述符泄漏等修改' (#8) from surponess_br into master 2026-06-01 12:02:29 +08:00
Surponess 89225e6851 11.1 🔴 文件描述符泄漏 循环内 defer 改为手动 Close() release.go
11.2	🔴 RequireArg 错误忽略	10 处 _, _ 改为检查返回 error	release.go + snippet.go
11.3	🟡 download 消息中英混杂	"No assets" → "没有可下载的资源"	release.go
11.4	🟡 缺少分页参数	追加 --page/--limit + CallAPIWithQuery	webhook.go + label.go
11.5	🟢 输出方法不统一	output.SuccessEnvelope() → ctx.OutputData()	release.go
11.6	🟢 错误包装丢失链	%v → %w(语序调整为让 %w 在末尾)	file.go
详细的修复前后代码对比和实现说明已写入 成员B工作执行方案.md 的「完成记录(任务 11)」章节。
2026-06-01 12:02:02 +08:00
whale 9c5e5b0072 fix: update wiki tests for gateway URL and JSON body
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-01 11:55:27 +08:00
whale e3c1952826 Merge cuijiaxiang23: Wiki + PM + Webhook + Issue batch
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-01 11:51:54 +08:00
whale 2b0ee1be6f feat: add Wiki, PM kanban, Webhook shortcuts + Issue batch operations
Wiki (5 commands):
- wiki +list/+view/+create/+update/+delete
- Uses gateway.gitlink.org.cn API gateway
- JSON body with owner/repo params, auto base64 encoding

PM/Kanban (6 commands):
- pm +boards/+sprints/+weekly/+tags/+pipelines/+actions
- Shared listPM helper to reduce duplication

Webhook (4 new commands + bugfix):
- webhook +view/+update/+history/+test
- Fixed create missing http_method field

Issue batch (3 commands):
- issue +batch-update/+batch-delete/+batch-close
- Dry-run safety + CSV file support

Infrastructure:
- Added DoForm/CallAPIRawForm for form-encoded bodies
- Added DecodeForm test utility
- All 39 tests passing

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-01 11:38:55 +08:00
Surponess 51780058a2 Merge pull request '代码片段管理功能' (#7) from surponess_br into master 2026-06-01 10:49:10 +08:00
Surponess 3b75aca287 代码片段管理功能
7 个命令
命令	用途	关键参数
create	创建片段	--title(必填)、--language、--tags、--content(支持 stdin)
list	列出片段	--tag、--language、--keyword(可选过滤)
view	查看详情	--id(必填)
search	全文搜索	--query(必填)
update	更新片段	--id(必填)+ 至少一个字段
delete	删除片段	--id(必填)
export	导出到文件	--id(必填)、--output
2026-06-01 10:48:50 +08:00
Surponess 87b2d46816 Merge pull request 'release download 命令 新增 download 快捷命令、错误消息统一化' (#6) from surponess_br into master 2026-05-30 21:24:00 +08:00
Surponess 6db62f79a8 release download 命令
新增 download 快捷命令,支持 --id 和 --output 参数,先获取 release 详情提取 assets 列表,再用 HTTP 客户端逐个下载二进制文件到磁盘
错误消息统一化:
将所有用户可见的错误消息从英文统一为中文,内部解析错误保持英文。
2026-05-30 21:23:44 +08:00
Surponess 7fd12583fe Merge pull request 'release download 功能(新增) 在 release.go 的 Shortcuts() 中新增第 5 个快捷命令 download: 参数:--id(必填,Release ID)、--output(默认当前目录) 流程:CallAPI 获取 release 详情 → 提取 assets 列表 → 用 HTTP 客户端下载二进制文件 → 写入磁盘 支持相对/绝对 URL,空 ass' (#5) from surponess_br into master 2026-05-29 11:46:33 +08:00
Surponess 0f5cfc4a30 release download 功能(新增)
在 release.go 的 Shortcuts() 中新增第 5 个快捷命令 download:

参数:--id(必填,Release ID)、--output(默认当前目录)
流程:CallAPI 获取 release 详情 → 提取 assets 列表 → 用 HTTP 客户端下载二进制文件 → 写入磁盘
支持相对/绝对 URL,空 assets 时返回友好提示
2026-05-29 11:46:30 +08:00
Surponess 492eff4026 Merge pull request 'label 领域原来只有 3 个命令(list/create/delete),现在新增了 update 命令。' (#4) from surponess_br into master 2026-05-29 10:56:56 +08:00
Surponess 8a234b00cc feat: add label +update command and fix shared test helpers
- Add update command to label domain using PATCH method
- Add TestLabelUpdate and TestLabelUpdateRequiresAtLeastOneField tests
- Fix RunShortcut parameter type to accept []*Shortcut
2026-05-29 10:50:45 +08:00
Surponess fde9a5d7e5 Merge pull request '创建 webhook 领域 + 实现 `+update`' (#3) from surponess_br into master 2026-05-28 16:27:22 +08:00
Surponess 34bece43ff Merge branch 'master' of https://gitlink.org.cn/whale_hihihi/gitlink-cli into surponess_br
# Conflicts:
#	shortcuts/common/testutil.go
#	shortcuts/webhook/webhook.go
#	shortcuts/webhook/webhook_test.go
2026-05-28 16:25:43 +08:00
Surponess 2ef1f92f50 创建 webhook 领域 + 实现 `+update` 2026-05-28 16:20:24 +08:00
whale 3952b4ce20 Merge branch 'cuijiaxiang23' 2026-05-26 15:18:29 +08:00
whale e7ce32a8b1 fix: remove unused fmt import in member shortcut
Go compiler rejects unused imports, causing Docker build to fail.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-26 15:17:50 +08:00
whale bc4daa66ca Merge branch 'cuijiaxiang23' 2026-05-26 15:04:52 +08:00
whale a13f9e40fc fix: resolve git detached HEAD and Go proxy timeout in pipeline
- Use git fetch + checkout master + reset --hard instead of git pull
  to handle detached HEAD state on server
- Add GOPROXY=https://goproxy.cn,direct to Dockerfile so go mod
  download uses Chinese mirror instead of unreachable proxy.golang.org

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-26 15:04:33 +08:00
whale c18b7fbf2b Merge branch 'cuijiaxiang23' 2026-05-26 14:59:37 +08:00
whale 50f271b41d fix: use single-line ssh_cmd to avoid JianMu JS parse error
JianMu treats ssh_cmd as a JavaScript expression and cannot handle
newlines. Rewrite the entire command as a single-line string with
semicolon chaining, matching the original project's format.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-26 14:59:14 +08:00
whale 0bdc036329 Merge branch 'cuijiaxiang23' 2026-05-26 14:53:41 +08:00
whale c6debeafe8 refactor: use git pull incremental sync + Docker build in pipeline
Replace git_clone + scp_resource with single ssh_cmd that does
git pull for incremental updates. Keep Docker build and deploy
approach. First run clones the repo, subsequent runs only
download changed files before rebuilding the Docker image.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-26 14:53:15 +08:00
whale e9261eebd4 Merge branch 'master' of https://gitlink.org.cn/whale_hihihi/gitlink-cli 2026-05-26 14:47:40 +08:00
whale 66b91718b4 refactor: restructure DevOps pipeline to use incremental git pull
Replace scp_resource full-copy approach with single ssh_cmd that does
git pull for incremental sync. First run clones the repo, subsequent
runs only download changed files. Remove redundant publish pipeline.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-26 14:45:52 +08:00
Surponess 7262f312e8 Merge pull request '本次实现:search +issues — 搜索 Issue 功能' (#2) from surponess_br into master 2026-05-25 22:07:44 +08:00
Surponess 355fa7fdfb 本次实现:search +issues — 搜索 Issue 功能
新增功能参数
gitlink-cli search +issues --keyword "登录失败"    # 必填:搜索关键词
                           --category opened       # 可选:all/opened/closed
                           --assignee 42           # 可选:按负责人 ID
                           --author 10             # 可选:按创建人 ID
                           --milestone 5           # 可选:按里程碑 ID
                           --tag 1,2               # 可选:按标签 ID
                           --sort-by created_on    # 可选:排序字段
                           --sort-dir asc          # 可选:排序方向
API 调用
GET /api/v1/{owner}/{repo}/issues?keyword=xxx&category=opened&assigner_id=42&sort_by=issues.updated_on
2026-05-25 22:07:35 +08:00