Skip to content

feat: 支持上传到需求、缺陷和任务的标准附件 #14

Description

@wesleywu

背景

当前 tapd attachment upload 命令强制要求 --custom-field,只能上传到 TAPD 的自定义字段附件。

从当前实现看:

  • internal/cmd/attachment.go--custom-field 标记为必填;
  • runAttachmentUpload 通过 SDK 的 UploadAttachmentRequest 发送 workspace_idtypecustom_fieldentry_id
  • SDK 的上传请求模型也将 custom_field 定义为必填,并将 type 示例限定为 story_custom_field

问题

TAPD Web 的需求/缺陷/任务详情页存在不依赖自定义字段的标准“附件”区域,但 CLI 没有办法上传到该区域。

例如:

tapd attachment upload \
  --workspace-id=<workspace_id> \
  --entry-id=<bug_id> \
  --type=bug \
  --custom-field=custom_field_one \
  --file=/path/to/video.mp4

该命令可以返回附件 ID,但附件会关联到自定义字段,而不是标准 Bug 附件列表。随后执行:

tapd attachment list --workspace-id=<workspace_id> --entry-id=<bug_id> --type=bug

无法看到该附件;在 TAPD Web 的标准“附件”区域也不可见。

期望行为

希望支持标准工作项附件上传,例如:

tapd attachment upload \
  --workspace-id=<workspace_id> \
  --entry-id=<bug_id> \
  --type=bug \
  --file=/path/to/video.mp4

或者提供明确区分两种目标的参数,例如:

  • 标准附件:--target=attachment
  • 自定义字段附件:--custom-field=<field>

同时保留现有自定义字段附件上传能力。

需要确认

如果 TAPD Open API 本身不支持需求/缺陷/任务的标准附件上传,也请在命令帮助和 README 中明确说明当前限制,并说明 CLI 推荐的替代方式。

影响

AI Agent 通过 CLI 创建带录屏、日志或复现材料的 Bug 时,容易误以为上传成功,但附件实际不会出现在用户查看的标准“附件”区域。

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions