Skip to content

feature: /idd-close should chain to plugin-update / mcp-update / cli-update for distribution-aware close #45

@kiki830621

Description

@kiki830621

Problem

/idd-close 是 IDD lifecycle 的終點:寫 closing summary + close issue + auto-update phase=closed。但對於 distributed-via-plugin / MCP / CLI binary 的 issue,closing 後仍有最後一哩 — 把 fix 同步到 user-facing distribution channel(plugin marketplace / MCP wrapper / CLI release)。

目前流程:

/idd-close #N        ← end of lifecycle from IDD's POV
   ↓ (gap — user 容易忘)
/plugin-update X     ← 才讓使用者實際拿到新版

如果忘了第二步,fix 已合進 main 但 marketplace 仍指向舊版 → 使用者跑 /plugin update 拉不到新東西,看似「修了卻沒修」。歷史上已經多次踩過這坑(Global rule common-release-flow.md 就是為了這個 mandate marketplace-sync,但 trigger 是「release 後」,不是「issue close 後」 — 兩者不總一致)。

Type

feature

Expected

/idd-close #N 在 close 成功後(Step 6 auto-update 之後、Step 7 final report 之前),做 distribution-aware chain detection:

  1. Detect issue + repo 是不是 distributed via:

    • Claude Code plugin marketplace (.claude-plugin/marketplace.json 含此 repo)
    • MCP binary (repo 有 bin/*-wrapper.sh 引用 GitHub Release)
    • CLI binary (相似 wrapper / ~/bin reference)
  2. AskUserQuestion 3-option(per IC_R011 canonical pattern):

    • chain to plugin-update / mcp-update / cli-update now — 直接 invoke 對應 skill
    • skip — I'll sync manually later — 不 chain,但寫進 closing comment audit trail(### Distribution Sync Pending)讓三個月後考古能找到 dropped step
    • not applicable — this issue doesn't ship — confirm + 不再問(內部 refactor、docs、test 等)
  3. Audit trail(任一選擇都寫):

    • PATCH closing comment append ### Distribution Sync section
    • "chained" → record skill + outcome
    • "skip" → record reason + provide command for later use
    • "n/a" → record + close

Actual

目前 /idd-close 結束就是結束。Distribution sync 完全靠使用者記得,沒有任何 mechanical checkpoint。

歷史踩坑(從 che-claude-config/rules/common-release-flow.md 摘):

跳過這步驟讓 marketplace.json 過時。使用者跑 /plugin update 看到舊版本,拿不到新 binary — 即使 GitHub release 存在。Release 只有半成 unless marketplace sync lands.

common-release-flow.md 是 release-side trigger,假設 release 跟 issue close 順序一致。實務上很多 issue 是 fix-via-PR,merge 後 close issue 但還沒 cut release;或者 cut release 後忘了 close issue。idd-close 是更早 + 更可靠的 chain anchor(因為 close 是 lifecycle 必經點)。

Impact

影響的工作流

  • 任何 idd-close 收尾的 issue,若 repo 是 plugin / MCP / CLI distribution
  • 對純內部 refactor / docs / spec 改動 → 不影響(Step 1 detection 過濾掉)

影響的檔案(實作面)

  • Sources/.../skills/idd-close/SKILL.md — 加 Step 6.5 (Distribution Sync chain)
  • 可能新增 references/distribution-detection.md — detect 邏輯抽出來給其他 skill reuse(idd-implement 在 implement 完成時也該有類似 prompt?)

跨 skill 影響

  • plugin-tools/skills/plugin-update — 改成可以接收 --source-issue #N flag,把 issue ref 寫進 commit message
  • mcp-tools/skills/mcp-deploy — 同上
  • cli-tools/skills/cli-deploy — 同上(若存在)

推測 detection 邏輯

# Heuristic: this repo is distributed if any of:
is_plugin_marketplace_member() {
  # Walk-up parent dirs for .claude-plugin/marketplace.json that lists this repo
  # Or check if cwd is direct subdir of a known marketplace repo
  ...
}

has_binary_wrapper() {
  # Look for bin/*.sh that curls from GitHub Release
  ls "$REPO_ROOT/bin" 2>/dev/null | xargs grep -l "gh release download\|curl.*github.com.*releases" 2>/dev/null
}

DISTRIBUTION_TYPE=""
if is_plugin_marketplace_member "$REPO"; then DISTRIBUTION_TYPE="plugin"; fi
if has_binary_wrapper "$REPO_ROOT"; then DISTRIBUTION_TYPE="${DISTRIBUTION_TYPE:+$DISTRIBUTION_TYPE+}mcp_or_cli"; fi

False-positive case:repo 在 marketplace 但本次 issue 沒影響 user-facing surface(內部 test infra fix)— 由 not applicable option cover。

推測 Step 6.5 placement

Step 4: gh issue close ✓
Step 5: report
Step 6: auto-update body phase=closed ✓
Step 6.5: ★ NEW — Distribution Sync detection + AskUserQuestion + chain
Step 7: batch close special rules

放在 phase=closed 之後是因為:closing summary 是 audit trail,distribution sync 是 follow-up action。Phase 應該在 audit 完成那刻就 lock,不該 hold 著等 sync 才 close。

Acceptance criteria

  • /idd-close #N 對 plugin/MCP/CLI repo 觸發 detection + AskUserQuestion
  • 三選項都有對應 audit trail entry 寫進 closing comment
  • 對純內部 refactor / docs issue → silent skip(detection returns "n/a")
  • Backward compat:既有 idd-close 用法不受影響(detection 找不到 distribution type 就 silent)
  • 寫入 references/distribution-detection.md(若抽 helper)+ test fixture

Out-of-scope (本 issue 不處理)

  • idd-implement 在 implement 完成時也提示(可能是 follow-up:在 fix 還沒 ship 前先 surface 一次)
  • ✗ Auto-detect issue 影響 user-facing surface vs 純內部(留 user 用 not applicable 表態)
  • ✗ Release tag 自動 cut(那是 release flow 的職責,不是 close 的職責)

Relation to existing rules

  • che-claude-config/rules/common-release-flow.md — release-tier trigger;本 proposal 是 close-tier trigger,互補不衝突(一個 release 對多個 close,一個 close 對 0-1 個 release)
  • IC_R011 canonical pattern — Distribution Sync prompt 沿用 3-option AskUserQuestion + audit trail 結構

Trigger context

提此 proposal 的當下 session 剛 close che-apple-mail-mcp#72(get_email base64 bug fix),PR #75 merged 為 commit 5fda74d。但 marketplace.json 還沒 bump,使用者 /plugin update che-apple-mail-mcp 拉到的是舊 v2.16.0 binary,不會包含 fix。User 觀察到此 gap,提出建議。


Current Status

Phase: closed
Last updated: 2026-05-10 by idd-close (#67 merged 566741c)

Key Decisions

  • Complexity = Plan (Layer P 命中: ordered Strategy 6 steps, decision-heavy detection heuristics, risk-sensitive — close-tier surface)
  • Layer V untriggered (V1=2, V4=3) — both axes ≤ 3
  • Step 6.5 placement: between current Step 6 (auto-update phase=closed) and Step 7 (batch close special rules) — explicit per issue body
  • Cross-repo callers (plugin-update / mcp-deploy / cli-deploy) --source-issue flag deferred to sister issue in psychquant-claude-plugins
  • Per Step 4.7 scope clarification: this change limited to idd-close SKILL.md + references/distribution-detection.md in this repo

Scope Changes

  • 2026-05-10: scope narrowed by user pre-emptively (Step 4.7 comment) — single repo only

Blocking

  • 等 user 確認 diagnosis 後跑 /idd-plan #45 進 EnterPlanMode approval gate

Sister Concerns

  • (none surfaced; Strategy 已 explicit 把 cross-repo work 列為 Step 6 sister issue,不另外 file)

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions