ado-writeback-tracking
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
Chineseado-writeback-tracking
ado-writeback-tracking
Closes the loop: once items exist in ADO, stamp their IDs and URLs back onto the
spreadsheet the findings came from, so every row shows which ticket it became.
This makes the source self-tracking — anyone reopening the sheet sees status
without cross-referencing ADO. The link between a row and its ticket is the
field (see ),
carried from [[extract-findings]] () through .
key${CLAUDE_PLUGIN_ROOT}/references/data-contracts.mdkeyColumnbacklog_result.json完成闭环:一旦项在ADO中创建,就将其ID和URL标记回发现项来源的电子表格,这样每一行都能显示它对应的工单。这使得源文件具备自我追踪能力——任何人重新打开表格时,无需交叉引用ADO即可查看状态。行与其工单之间的链接是****字段(参见),从[[extract-findings]]()传递到。
key${CLAUDE_PLUGIN_ROOT}/references/data-contracts.mdkeyColumnbacklog_result.jsonWhen this applies
适用场景
- Spreadsheet sources only (/
.xlsx/.csv). There must be one row per finding to write back to..tsv - Doc / pasted-text sources have no rows — skip the script entirely and just
report the created ticket links (parent + per-item URLs) from
in chat. Don't fabricate a spreadsheet to write to.
backlog_result.json - You need from [[ado-create-work-items]] (which runs
backlog_result.json). Eachcreate-backlog.csis the created work item; rows whose key has no matching createditems[].idare simply skipped.id
- 仅适用于电子表格源(/
.xlsx/.csv)。必须每行对应一个可写回的发现项。.tsv - 文档/粘贴文本源无行结构——完全跳过脚本,只需在聊天中报告中的创建工单链接(父链接+每个项的URL)。不要虚构电子表格进行写入。
backlog_result.json - 你需要来自[[ado-create-work-items]](运行)的
create-backlog.cs。每个backlog_result.json是已创建的工作项;键与已创建items[].id不匹配的行将被跳过。id
Before you write
写入前准备
Back up the user's source file first — edits it in place and
overwrites it. A quick copy keeps you safe if a key mismatch or wrong
sends links to the wrong rows:
tracking.py--keypowershell
Copy-Item "<file>.xlsx" "<file>.bak.xlsx"首先备份用户的源文件——会原地编辑并覆盖它。快速复制一份可以避免因键不匹配或错误的参数导致链接写入错误行的情况:
tracking.py--keypowershell
Copy-Item "<file>.xlsx" "<file>.bak.xlsx"Step 1 — add tracking columns (idempotent)
步骤1 — 添加追踪列(幂等操作)
Appends , , , after the last used
column. Safe to run repeatedly — columns that already exist are not duplicated.
Run this once before the first writeback so the target columns exist:
Ticket IDTicket URLWI StateCreatedpowershell
python "${CLAUDE_PLUGIN_ROOT}/scripts/tracking.py" add-columns --source "<file>" --key "#"It prints which columns map to which letters (xlsx) or confirms they're ensured
(csv). defaults to if omitted, but pass it explicitly to match.
--key#在最后一列后追加、、、列。重复运行是安全的——已存在的列不会被重复添加。在首次写回前运行一次,确保目标列存在:
Ticket IDTicket URLWI StateCreatedpowershell
python "${CLAUDE_PLUGIN_ROOT}/scripts/tracking.py" add-columns --source "<file>" --key "#"它会打印哪些列对应哪个字母(xlsx格式),或确认列已确保存在(csv格式)。如果省略,默认值为,但建议显式传递以匹配设置。
--key#Step 2 — write the ticket links back (idempotent)
步骤2 — 写回工单链接(幂等操作)
Matches each item's to the value in the source's key
column and fills the four tracking columns. Rows that already hold a Ticket
ID are left as-is, so re-running after a partial create only fills the new
rows:
backlog_result.jsonkeypowershell
python "${CLAUDE_PLUGIN_ROOT}/scripts/tracking.py" writeback --source "<file>" --result "<path>/backlog_result.json" --key "#"Per row it writes:
- ←
Ticket IDitems[].id - ←
Ticket URL(built from thehttps://dev.azure.com/{org}/{project}/_workitems/edit/{id}/orginproject)backlog_result.json - ←
WI State(the state freshly created items land in)New - ← a
CreatedtimestampYYYY-MM-DD HH:MM
It logs each , prints the parent link if one exists, and ends with
.
key -> #idwrote N ticket links back to source将每个项的与源文件键列中的值匹配,并填充四个追踪列。已包含Ticket ID的行将保持不变,因此在部分创建后重新运行只会填充新行:
backlog_result.jsonkeypowershell
python "${CLAUDE_PLUGIN_ROOT}/scripts/tracking.py" writeback --source "<file>" --result "<path>/backlog_result.json" --key "#"每行写入的内容:
- ←
Ticket IDitems[].id - ←
Ticket URL(由https://dev.azure.com/{org}/{project}/_workitems/edit/{id}中的backlog_result.json/org构建)project - ←
WI State(新创建项的初始状态)New - ←
Created格式的时间戳YYYY-MM-DD HH:MM
它会记录每个,如果存在父链接则打印,并以结尾。
key -> #idwrote N ticket links back to sourceThe --key
must line up across all three files
--key--key
必须在三个文件中保持一致
--keyThis is the single most common failure. The you pass here must be the
same column name as:
--key- chosen in [[extract-findings]] (e.g.
keyColumn,#,ID), andRow - the value carried in
keyandbacklog_input.json.backlog_result.json
Values are compared as strings. If the script prints
, the in the result doesn't match any
value in that column — re-check (right column?) and that the source
hasn't been re-sorted or had rows removed since extraction. If it raises
, you skipped Step 1 (or pointed
at a column that isn't in the sheet).
warn: key <x> not found in sourcekey--keymissing column '<name>' — run add-columns first--key这是最常见的失败原因。你在此处传递的必须与以下内容的列名称相同:
--key- [[extract-findings]]中选择的(例如
keyColumn、#、ID),以及Row - 和
backlog_input.json中携带的backlog_result.json值。key
值将作为字符串进行比较。如果脚本打印,说明结果中的与该列中的任何值都不匹配——重新检查(是否为正确的列?)以及自提取以来源文件是否被重新排序或删除了行。如果提示,说明你跳过了步骤1(或指向的列不在表格中)。
warn: key <x> not found in sourcekey--keymissing column '<name>' — run add-columns first--keyTiny example
小示例
backlog_result.jsonjson
{ "org": "Cartagena365", "project": "GlassHull",
"items": [ { "key": "1", "id": 6073, "type": "Bug", "title": "..." } ] }After writeback, the source row whose column is gains:
, ,
, .
#1Ticket ID=6073Ticket URL=https://dev.azure.com/Cartagena365/GlassHull/_workitems/edit/6073WI State=NewCreated=2026-06-02 14:05backlog_result.jsonjson
{ "org": "Cartagena365", "project": "GlassHull",
"items": [ { "key": "1", "id": 6073, "type": "Bug", "title": "..." } ] }写回后,列值为的源行将添加:、、、。
#1Ticket ID=6073Ticket URL=https://dev.azure.com/Cartagena365/GlassHull/_workitems/edit/6073WI State=NewCreated=2026-06-02 14:05Notes
注意事项
- No ADO auth or network call happens here — this step only reads the JSON result and edits the local file. (Auth lives in [[ado-auth]] / the create step.)
- The bundled Python forces UTF-8, so accented/Thai text survives even on a cp1252 PowerShell console.
- This is the final stage of the [[findings-to-ado-backlog]] pipeline: [[extract-findings]] → [[triage-findings]] → [[classify-work-items]] → [[ado-create-work-items]] → ado-writeback-tracking.
- 此步骤不涉及ADO认证或网络调用——仅读取JSON结果并编辑本地文件。(认证在[[ado-auth]] / 创建步骤中处理。)
- 捆绑的Python强制使用UTF-8编码,因此即使在cp1252编码的PowerShell控制台中,带重音的字符/泰文文本也能保留。
- 这是[[findings-to-ado-backlog]]流程的最后阶段:[[extract-findings]] → [[triage-findings]] → [[classify-work-items]] → [[ado-create-work-items]] → ado-writeback-tracking。