You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

SKILL.md 32 KiB

2 viikkoa sitten
2 viikkoa sitten
2 viikkoa sitten
2 viikkoa sitten
1 viikko sitten
2 viikkoa sitten
2 viikkoa sitten
2 viikkoa sitten
2 viikkoa sitten
2 viikkoa sitten
2 viikkoa sitten
2 viikkoa sitten
2 viikkoa sitten
1 viikko sitten
2 viikkoa sitten
2 viikkoa sitten
1 viikko sitten
1 viikko sitten
2 viikkoa sitten
2 viikkoa sitten
2 viikkoa sitten
2 viikkoa sitten
2 viikkoa sitten
2 viikkoa sitten
2 viikkoa sitten
2 viikkoa sitten
2 viikkoa sitten
2 viikkoa sitten
2 viikkoa sitten
2 viikkoa sitten
2 viikkoa sitten
2 viikkoa sitten
2 viikkoa sitten
2 viikkoa sitten
2 viikkoa sitten
2 viikkoa sitten
2 viikkoa sitten
2 viikkoa sitten
2 viikkoa sitten
2 viikkoa sitten
2 viikkoa sitten
2 viikkoa sitten
2 viikkoa sitten
2 viikkoa sitten
2 viikkoa sitten
2 viikkoa sitten
2 viikkoa sitten
2 viikkoa sitten
2 viikkoa sitten
2 viikkoa sitten
2 viikkoa sitten
2 viikkoa sitten
1 viikko sitten
2 viikkoa sitten
2 viikkoa sitten
2 viikkoa sitten
2 viikkoa sitten
2 viikkoa sitten
2 viikkoa sitten
2 viikkoa sitten
2 viikkoa sitten
2 viikkoa sitten
1 viikko sitten
1 viikko sitten
2 viikkoa sitten
2 viikkoa sitten
2 viikkoa sitten
2 viikkoa sitten
2 viikkoa sitten
2 viikkoa sitten
2 viikkoa sitten
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785
  1. ---
  2. name: fp-mtms-version-checklist
  3. description: >-
  4. Updates the FP-MTMS Version Programs and Functions Checklist Excel on each
  5. developer's synced SharePoint folder. Overflow beyond Latest+3 previous
  6. versions is appended to the Archive long-table Excel. Use only when the user
  7. explicitly invokes this skill or asks to update the FP-MTMS version control
  8. checklist, page/program version sheet, function version sheet, or archive.
  9. disable-model-invocation: true
  10. ---
  11. # FP-MTMS Version Checklist Excel
  12. ## Purpose
  13. Maintain the team **FP-MTMS System Version Control Checklist**: page/program
  14. level and function-level version history in a shared SharePoint Excel file.
  15. ## Language
  16. Keep Excel **column headers** exactly as in the file (English).
  17. ### 中英對照 (required for cell content)
  18. All written cell values must be **Traditional Chinese + English**
  19. (中英對照), using i18n labels where they exist.
  20. **Exception — do NOT bilingualize:**
  21. - `Functions in Page&Program` column **G — Name of Function within
  22. Program** (English symbol + source path only; see Column G rule)
  23. - Version & Date fields (e.g. `v1.0.0 2026-07-14`)
  24. - Developed By (person name as-is)
  25. - Ref. No. (number)
  26. ### Format
  27. **Short labels** (subsystem / page names):
  28. ```text
  29. 批號追溯 / Item Tracing
  30. 倉庫管理 / Store Management
  31. ```
  32. **Longer prose** (purpose, highlights, major changes): Chinese first,
  33. then English on the **next line**. For usage/呼叫來源, keep it on its
  34. own line(s) as well:
  35. ```text
  36. 工單提料執行頁面(/jodetail)。
  37. Job Order Pick Execution page (/jodetail).
  38. 使用/呼叫來源:批號追溯(單據深連結開啟已完成提料紀錄)。
  39. Used / called from: Item Tracing (doc deep-link to open completed pick record).
  40. ```
  41. **Major Changes** (Page col F / history I,L,O and Functions col J / history
  42. M,P,S) must also list **file + line range + short per-line explanation** —
  43. see **Major Changes: file, lines, explanation** below.
  44. Prefer EN/ZH pairs from `src/i18n/en/*` and `src/i18n/zh/*` for menu and
  45. feature terms.
  46. ## Excel formatting (required on every write)
  47. When writing with `openpyxl`, apply formatting so cells stay readable:
  48. 1. **Wrap text** — enable wrap on every multi-line cell you write (Purpose,
  49. Major Changes, Function name with multiple paths, Highlights). Prefer
  50. `Alignment(wrap_text=True, vertical="top")`.
  51. 2. **Line breaks** — use real Excel newlines (`\n`) between ZH/EN pairs and
  52. between file / line bullets; do not stuff everything onto one long line.
  53. 3. **Row height** — after writing multi-line cells, set a reasonable row
  54. height (or leave Excel auto-fit) so wrapped text is visible; do not leave
  55. multi-line content in a single-line-tall row if the sheet already uses
  56. taller history rows.
  57. 4. **Do not break headers** — never rename, reorder, or delete existing header
  58. labels; only fill data cells (and Archive append columns as defined).
  59. 5. **Match existing style** — when updating a row, keep the same wrap/alignment
  60. pattern as neighbouring filled cells on that sheet.
  61. 6. **Archive** — same wrap rules as main; no extra “Source” or helper columns.
  62. ## Excel path (per developer)
  63. Path varies by Windows user / OneDrive sync root. Resolve in this order:
  64. 1. If the user provides a full path, use it.
  65. 2. Else try under the user profile home:
  66. `{USERPROFILE}/2Fi Business Solutions Limited/2Fi Business Solutions Limited - FP-MTMS VERSION CONTROL/FP-MTMS Version Programs and Functions Checklist v0.1.xlsx`
  67. 3. If missing, search under `{USERPROFILE}` for
  68. `FP-MTMS Version Programs and Functions Checklist v0.1.xlsx` (real `.xlsx` only).
  69. 4. **Always confirm the resolved path with the user before writing.**
  70. ### Archive Excel path
  71. Same folder as the main checklist. Default:
  72. `{USERPROFILE}/2Fi Business Solutions Limited/2Fi Business Solutions Limited - FP-MTMS VERSION CONTROL/FP-MTMS Version Programs and Functions Checklist v0.1 - Archive.xlsx`
  73. If the user provides an archive path, use it. Confirm both main and archive
  74. paths before writing. Do not edit `.url` shortcuts or Downloads copies unless
  75. the user explicitly asks.
  76. Use `openpyxl` to read/write. If either file is locked (PermissionError), ask
  77. the user to close Excel / Excel Online sync lock, then retry.
  78. ## Hard rule: preview first — do not interview column by column
  79. **Never** ask the user one question per cell / column.
  80. Instead:
  81. 1. Infer all planned adds/updates from conversation context, git diff, PR,
  82. feature description, and existing Excel rows.
  83. 2. Before any write, show a **full preview** of every row that will be added or
  84. changed (including history shifts and any Archive long-table appends).
  85. 3. Ask **one** confirmation: whether this preview is correct (yes / no / what
  86. to fix). Prefer the Ask Questions tool when available; otherwise ask once
  87. in chat.
  88. 4. Only after explicit approval, write with `openpyxl` and save.
  89. If the preview is wrong, adjust and show a **revised preview**; do not write
  90. until approved.
  91. If critical facts are truly unknown (e.g. version number or developer name
  92. cannot be inferred), ask at most a short batch of missing items — never walk
  93. the sheet column by column.
  94. ## Pre-check: matching program / feature must exist
  95. Before drafting or writing any row:
  96. 1. Open the workbook and search both sheets for the target
  97. **System Page / Program Name** (and for Functions sheet, also
  98. **Name of Function within Program**).
  99. 2. Match on existing rows when the program/page already exists.
  100. 3. If updating a function: the parent page/program should already exist on
  101. `Page&Program Name` (or be included in the same preview as a new page row).
  102. Set **Page Ref. No. (B)** to that page row’s Ref. No.
  103. 4. If nothing matches and the user intends a **new** program or function, say so
  104. clearly in the preview as `NEW ROW`.
  105. 5. Do **not** invent duplicate rows for the same page + same function.
  106. 6. Different **功能** (distinct functions) → **different Ref. No. rows**, even
  107. under the same System Page / Program Name.
  108. ## History shift (required on every update)
  109. Each page or function keeps **Latest** plus up to **3 previous** history slots
  110. (1st, 2nd, 3rd). On every new change to an existing row, **push history
  111. rightward** before writing the new Latest:
  112. | Before write | After shift |
  113. |--------------|-------------|
  114. | Latest | → 1st previous |
  115. | 1st previous | → 2nd previous |
  116. | 2nd previous | → 3rd previous |
  117. | 3rd previous | → **Archive Excel** (append long-table row; then clear 3rd on main) |
  118. Then write the new change into **Latest** (version/date, highlights, Developed By).
  119. If the old 3rd previous slot is **empty**, skip archive append for that shift.
  120. ### Page&Program Name — fields that shift together
  121. Treat each “slot” as a triple:
  122. - **Latest**: D (Version & Date), F (Major Changes), G (Developed By)
  123. - **1st**: H, I, J
  124. - **2nd**: K, L, M
  125. - **3rd**: N, O, P
  126. Shift: `(D,F,G) → (H,I,J) → (K,L,M) → (N,O,P)` then **archive** old 3rd
  127. (N/O/P) to the Archive Excel long table if filled; clear N/O/P on main; write
  128. new into D/F/G.
  129. Leave identity columns A–C and purpose E unchanged unless the user asked to
  130. change them (purpose may be refreshed if the preview says so).
  131. ### Functions in Page&Program — fields that shift together
  132. - **Latest**: I (Function Version & Date), J (Major Changes), K (Developed By)
  133. - **1st**: L, M, N
  134. - **2nd**: O, P, Q
  135. - **3rd**: R, S, T
  136. Shift: `(I,J,K) → (L,M,N) → (O,P,Q) → (R,S,T)` then **archive** old 3rd
  137. (R/S/T) to the Archive Excel long table if filled; clear R/S/T on main; write
  138. new into I/J/K.
  139. Leave A–H (Ref, **Page Ref. No.**, subsystem, page, page version/purpose,
  140. function name/highlight) unchanged unless the preview explicitly updates them.
  141. Always show the shift **and any archive appends** in the preview (old Latest →
  142. new 1st, old 3rd → Archive, etc.).
  143. #### Column B — Page Ref. No. (required)
  144. **Page Ref. No. (B)** on every Functions row must equal the parent row’s
  145. **Ref. No. (A)** on sheet `Page&Program Name`.
  146. Rules:
  147. 1. Resolve the parent by matching **System Page / Program Name** (and
  148. subsystem when needed) on the Page sheet; use that page row’s A.
  149. 2. Never leave B blank on a Functions data row.
  150. 3. Do **not** invent a Page Ref that has no matching Page sheet row (unless
  151. that page row is included in the same approved preview as NEW).
  152. 4. Multiple function rows under the same page share the **same** Page Ref. No.
  153. 5. Function **Ref. No. (A)** stays independent (one per 功能 row).
  154. 6. Preview must show `Page Ref. No. = <n> → Page sheet Ref <n> (<page name>)`.
  155. Page sheet columns A–P are unchanged by this field (Page sheet has no
  156. Page Ref column).
  157. ## Archive Excel — long table (required on 3rd overflow)
  158. When a filled **3rd previous** is pushed off the main checklist, **append one
  159. row** to the Archive workbook (never overwrite existing archive rows).
  160. Data starts at **row 5** (rows 1–3 title/notes, row 4 headers).
  161. ### Sheet: `Page&Program Name` (archive)
  162. | Col | Header |
  163. |-----|--------|
  164. | A | Ref. No. |
  165. | B | Name of Subsystem / Module / Menu Selection |
  166. | C | System Page / Program Name |
  167. | D | Version & Date |
  168. | E | Major Changes Highlights |
  169. | F | Developed By |
  170. | G | Archived At |
  171. Map from main page row 3rd slot: A←A, B←B, C←C, D←N, E←O, F←P.
  172. `Archived At` = today's date (`YYYY-MM-DD`).
  173. Do **not** add a Source column.
  174. ### Sheet: `Functions in Page&Program` (archive)
  175. | Col | Header |
  176. |-----|--------|
  177. | A | Ref. No. |
  178. | B | Page Ref. No. |
  179. | C | Name of Subsystem / Module / Menu Selection |
  180. | D | System Page / Program Name |
  181. | E | Name of Function within Program |
  182. | F | Version & Date |
  183. | G | Major Changes Highlights |
  184. | H | Developed By |
  185. | I | Archived At |
  186. Map from main functions row 3rd slot:
  187. A←A, B←B (Page Ref. No.), C←C, D←D, E←G, F←R, G←S, H←T;
  188. `Archived At` (I) = today.
  189. Always copy **Page Ref. No.** so archive rows stay linked to the parent page.
  190. Do **not** add a Source column.
  191. ### Archive write rules
  192. 1. **Append only** — find the next empty data row (after last non-empty row ≥ 5).
  193. 2. Keep **中英對照** and Major Changes content exactly as they were on main 3rd.
  194. 3. Do **not** invent archive rows for empty 3rd slots.
  195. 4. Do **not** edit older archive rows.
  196. 5. Write archive **before or in the same approved batch as** the main shift; if
  197. archive save fails (lock), do not leave main half-shifted — abort and ask the
  198. user to close the file, then retry the whole approved batch.
  199. 6. Never commit either Excel file to git.
  200. ### Function history only when that function changed (required)
  201. **Do not** push or invent a Functions-sheet history slot for a commit / release
  202. that did **not** change the symbols listed in column G for that row.
  203. - **Page&Program Name** may still advance Latest / history for a page-level
  204. release (e.g. backend-only fix under the same page).
  205. - **Functions in Page&Program**: shift I→L→O→R **only** when this row’s
  206. function(s) actually changed (diff touches the verified G symbol(s) / paths).
  207. - If a commit updates the **page** but not this function:
  208. - You may refresh column **E** (Latest Page Version) to match the page row.
  209. - Leave **I/J/K** and previous function history **unchanged**.
  210. - Do **not** write filler Latest/history text such as「頁面版本對齊;本功能無程式變更」
  211. / “Page version align; no UI change this release”.
  212. - When mapping several commits into history for a **new** function row: include
  213. only commits that changed that function; leave unused 1st/2nd/3rd slots empty.
  214. Different function rows under the same page may have **different** Latest
  215. versions and history depths.
  216. Example: page Latest = v1.0.3 (backend TRF fix). Frontend transfer UI row last
  217. changed at v1.0.2 → keep function I = v1.0.2; optional E = v1.0.3; no fake
  218. v1.0.3 function history slot.
  219. ### Major Changes: file, lines, explanation (required)
  220. For every **Major Changes Highlights** cell written into Excel (Page sheet
  221. Latest F and history I/L/O; Functions sheet Latest J and history M/P/S),
  222. include concrete code locations from the commit / diff — not only a summary
  223. sentence.
  224. **Required content (中英對照 for prose; paths/lines stay as-is):**
  225. 1. **Summary** — short ZH then EN (what the release did).
  226. 2. **Per changed file** — repo-relative path.
  227. 3. **Line range(s)** — current file line numbers after the change (prefer
  228. `start–end`; single line OK). Re-resolve with `git show` / Read / Grep;
  229. do not guess.
  230. 4. **Short explanation by line/range** — what that hunk does (ZH then EN, or
  231. one ZH+EN pair per bullet).
  232. **Cell layout example:**
  233. ```text
  234. 轉倉出庫批次 ledger 餘額鏈結修正。
  235. TRF stock-out batch ledger balance chaining fix.
  236. StockOutLineService.kt
  237. L1518: ledger 查詢改為 findFirstByItemIdAndDeletedFalseOrderByDateDescIdDesc。
  238. L1518: ledger lookup → findFirstByItemIdAndDeletedFalseOrderByDateDescIdDesc.
  239. L2318–2347 (createStockOutBatch): 同 batch 多行依 runningLedgerBalance 扣帳,不再每次用 onHandQty。
  240. L2318–2347 (createStockOutBatch): chain per-item running ledger balance within a batch instead of onHandQty each line.
  241. StockInLineService.kt
  242. L269 / L312: assignLotNo / assignLotNoForJo 改為 open fun(無邏輯變更)。
  243. L269 / L312: assignLotNo / assignLotNoForJo marked open (no logic change).
  244. ```
  245. **Rules:**
  246. - Fact-check path + line numbers against the repo at write time (lines drift;
  247. re-check before save).
  248. - Group by file; under each file, one bullet per meaningful hunk / line range.
  249. - Prefer the member / symbol name in the explanation when helpful
  250. (e.g. `createStockOutBatch`, `assignLotNo`).
  251. - If many files: keep bullets short; still list each touched path that belongs
  252. to this row (Functions row → only files/symbols in column G, plus closely
  253. related hunks in those files for this change).
  254. - Page-sheet Major Changes may summarize all files for that page release;
  255. Functions-sheet Major Changes stay scoped to that function row’s G symbols
  256. and their files.
  257. - Show the same file/line bullets in the **preview** before write.
  258. - Pure i18n-only or one-liner UI copy changes: still cite file + line(s)
  259. (e.g. `InventoryLotLineTable.tsx L508–518: success message by API code`).
  260. ## Batch updates
  261. Many rows may change in one invocation (multiple pages and/or functions).
  262. - Build **one combined preview** covering all affected rows.
  263. - One approval covers the whole batch.
  264. - Still one Ref. No. row per distinct 功能 / function.
  265. ## Sheets and columns
  266. Data starts at **row 5** (rows 1–4 are title/headers).
  267. ### Sheet: `Page&Program Name`
  268. | Col | Header |
  269. |-----|--------|
  270. | A | Ref. No. |
  271. | B | Name of Subsystem / Module / Menu Selection |
  272. | C | System Page / Program Name |
  273. | D | Latest Page Version & Date |
  274. | E | Page Purpose Highlights |
  275. | F | Major Changes Highlights |
  276. | G | Developed By |
  277. | H | 1st Previous Page Version & Date |
  278. | I | 1st Major Changes Highlights |
  279. | J | Developed By |
  280. | K | 2nd Previous Page Version & Date |
  281. | L | 2nd Major Changes Highlights |
  282. | M | Developed By |
  283. | N | 3rd Previous Page Version & Date |
  284. | O | 3rd Major Changes Highlights |
  285. | P | Developed By |
  286. ### Sheet: `Functions in Page&Program`
  287. | Col | Header |
  288. |-----|--------|
  289. | A | Ref. No. |
  290. | B | Page Ref. No. |
  291. | C | Name of Subsystem / Module / Menu Selection |
  292. | D | System Page / Program Name |
  293. | E | Latest Page Version & Date |
  294. | F | Page Purpose Highlights |
  295. | G | Name of Function within Program |
  296. | H | Functions Highlight |
  297. | I | Latest Function Version & Date |
  298. | J | Major Changes Highlights |
  299. | K | Developed By |
  300. | L | 1st Previous Page Version & Date |
  301. | M | 1st Major Changes Highlights |
  302. | N | Developed By |
  303. | O | 2nd Previous Page Version & Date |
  304. | P | 2nd Major Changes Highlights |
  305. | Q | Developed By |
  306. | R | 3rd Previous Page Version & Date |
  307. | S | 3rd Major Changes Highlights |
  308. | T | Developed By |
  309. (Main workbook may also show helper note columns such as U `Archive`; do
  310. **not** require filling them unless the user asks. Page Ref. No. is the
  311. required parent link.)
  312. #### Column B — Page Ref. No. (see also history section)
  313. Must point at the parent `Page&Program Name` row’s **Ref. No. (A)**. Required
  314. on every Functions data row (main and archive).
  315. #### Column G — English symbol + source file (required)
  316. **Name of Function within Program (G)** must use the real English
  317. identifier from code (component / class / function / endpoint name),
  318. **and** state which file(s) it comes from. Do **not** put only a
  319. localized UI label in G.
  320. Format:
  321. ```text
  322. <EnglishSymbol> — <repo-relative path>
  323. ```
  324. Examples:
  325. - `ItemTracingScanBar — src/components/ItemTracing/ItemTracingScanBar.tsx`
  326. - `GoodPickExecutionWorkbenchRecord — src/components/DoWorkbench/GoodPickExecutionWorkbenchRecord.tsx`
  327. If one checklist function spans multiple primary files, put **each**
  328. symbol + path on its **own new line** (do not join with `; ` on one line):
  329. ```text
  330. ItemTracingSummary — src/components/ItemTracing/ItemTracingSummary.tsx
  331. ItemTracingLocations — src/components/ItemTracing/ItemTracingLocations.tsx
  332. ```
  333. ##### Service / controller / class files — also list member functions
  334. When the primary symbol is a **service, controller, or other class**
  335. (not a React page component), G must also name the **member function(s)**
  336. that were added or changed — not only the class name.
  337. Put **each class + its methods + its path on its own line** (Excel `\n`,
  338. wrap text). Do not squeeze multiple files onto one line with `; `.
  339. Format (one file per line):
  340. ```text
  341. <ClassName>.<fun1> / .<fun2> — <path-to-that-file>
  342. ```
  343. Multi-file example:
  344. ```text
  345. ItemLotTraceService.trace / .traceLocation — src/main/java/com/ffii/fpsms/modules/stock/service/ItemLotTraceService.kt
  346. InventoryLotLineController.traceLot / .traceLocation — src/main/java/com/ffii/fpsms/modules/stock/web/InventoryLotLineController.kt
  347. ```
  348. ```text
  349. PickOrderLifecycleController.getLifecycle / .getLifecycleByCode — src/main/java/.../PickOrderLifecycleController.kt
  350. PickOrderLifecycleService.getLifecycle / .getLifecycleByCode — src/main/java/.../PickOrderLifecycleService.kt
  351. ```
  352. For multi-file **component** rows, also one path per line:
  353. ```text
  354. ItemTracingSummary — src/components/ItemTracing/ItemTracingSummary.tsx
  355. ItemTracingLocations — src/components/ItemTracing/ItemTracingLocations.tsx
  356. ```
  357. Fact-check each listed member function exists in that file (same casing).
  358. If only one method changed, list that one method. Do not cite a class
  359. without its relevant `fun` / method names when the change is in a
  360. `*Service` / `*Controller` (or similar) file.
  361. **Functions Highlight (H)** and **Major Changes (J)** must be 中英對照
  362. (Chinese then English on the next line). Prefer i18n terms. Page /
  363. subsystem names (C/D) use `中文 / English`.
  364. #### Column F — Page Purpose + where the function is used (required)
  365. On **Functions in Page&Program**, **Page Purpose Highlights (F)** must
  366. include:
  367. 1. The owning page purpose (what page C is for), **and**
  368. 2. **Where this function is used / called from** — especially when the
  369. caller is a **different** page than column C.
  370. Owning page (C) = where the code/feature primarily lives.
  371. Usage location = which page(s) invoke, deep-link into, or depend on it.
  372. Examples:
  373. - Function lives on `工單提料` but is opened from Item Tracing doc links:
  374. ```text
  375. 工單提料執行頁面(/jodetail)。
  376. Job Order Pick Execution page (/jodetail).
  377. 使用/呼叫來源:批號追溯(單據深連結開啟已完成提料紀錄)。
  378. Used / called from: Item Tracing (doc deep-link to open completed pick record).
  379. ```
  380. - Function lives on `提料單` (lifecycle API) but is consumed for tracing:
  381. ```text
  382. 提料單管理。
  383. Pick Order management.
  384. 使用/呼叫來源:批號追溯(追溯流程/單據生命週期查詢)。
  385. Used / called from: Item Tracing (trace flow / document lifecycle query).
  386. ```
  387. - Function lives on `成品出倉` but is deep-linked from tracing:
  388. ```text
  389. 成品出倉(DO Workbench)揀貨與紀錄作業。
  390. DO Workbench pick execution and records.
  391. 使用/呼叫來源:批號追溯(單據深連結開啟成品出倉紀錄)。
  392. Used / called from: Item Tracing (doc deep-link to open DO Workbench record).
  393. ```
  394. - Function lives on and is only used by the same page (e.g. 批號追溯):
  395. ```text
  396. …頁面目的(中文)…
  397. …page purpose (English)…
  398. 使用/呼叫來源:本頁(批號追溯 / Item Tracing)。
  399. Used / called from: this page (批號追溯 / Item Tracing).
  400. ```
  401. Put **使用/呼叫來源** (and its English line) on **new lines** after the
  402. page-purpose ZH/EN pair. Do not run usage on the same line as purpose.
  403. When inferring usage, fact-check callers (imports, links, API consumers)
  404. from the change/diff. Do not invent a caller. If usage is only the owning
  405. page, say `本頁(<page>)`. If multiple callers, list them (i18n names).
  406. Do **not** leave F as only the generic page blurb when the function was
  407. added/changed for another page’s flow (e.g. refs that support 批號追溯
  408. but sit under 工單提料/提料單/成品出倉).
  409. #### Fact-check column G before preview (required)
  410. Never invent a symbol or path. For **every** Functions-sheet row in the
  411. preview (new or updated), verify against the real repos:
  412. 1. **Path exists** — each repo-relative path resolves under the correct
  413. workspace (`FPSMS-frontend` or `FPSMS-backend`). Prefer `Glob` / `Read`
  414. / `Grep`; do not guess.
  415. 2. **Symbol is in that file** — the English symbol must actually be defined
  416. or exported in the cited file (e.g. `const ItemTracingScanBar`,
  417. `export default ItemTracingScanBar`, `open class ItemLotTraceService`,
  418. `fun traceLot`, `class PickOrderLifecycleController`). Match casing
  419. exactly as in code (`CompleteJobOrderRecord`, not `completeJobOrderRecord`).
  420. For service/controller rows, also verify each listed **member function**
  421. (e.g. `trace`, `traceLocation`, `getLifecycle`) exists in that file.
  422. 3. **Multi-path rows** — each symbol + path must be on its **own line**:
  423. - Every line’s symbol must be defined in that line’s file.
  424. - Example OK:
  425. ```text
  426. ItemTracingSummary — …/ItemTracingSummary.tsx
  427. ItemTracingLocations — …/ItemTracingLocations.tsx
  428. ```
  429. - Do not join multiple files with `; ` on one line.
  430. 4. **Wrong location** — if the symbol lives elsewhere, correct the path to
  431. the real file; do not keep a convenient-but-false path.
  432. 5. **Not found** — if the file or symbol cannot be verified, do **not** put
  433. it in G. Omit the row or ask the user; never write an unverified G.
  434. In the preview, mark verified rows (optional short note), e.g.
  435. `G verified: symbol+path OK`. If any G failed fact-check, fix before asking
  436. for confirmation.
  437. ## Preview format (required before save)
  438. Show a clear preview, for example:
  439. ```text
  440. Excel: <resolved main path>
  441. Archive: <resolved archive path>
  442. Sheet: Functions in Page&Program
  443. Row 12 (UPDATE existing | Ref 7 | Page Ref 3 → 批號追溯 / Item Tracing | Function: ItemTracingFlowGraphSearch — src/components/ItemTracing/ItemTracingFlowGraphSearch.tsx)
  444. History shift:
  445. old Latest (I/J/K) → 1st
  446. old 1st → 2nd
  447. old 2nd → 3rd
  448. old 3rd → ARCHIVE (append)
  449. Archive append (Functions in Page&Program):
  450. A: 7
  451. B: 3
  452. C: 倉庫管理 / Store Management
  453. D: 批號追溯 / Item Tracing
  454. E: ItemTracingFlowGraphSearch — src/components/ItemTracing/ItemTracingFlowGraphSearch.tsx
  455. F: <old 3rd version & date>
  456. G: <old 3rd major changes>
  457. H: <old 3rd developed by>
  458. I: 2026-07-16
  459. New Latest:
  460. I: v1.2.0 2026-07-14
  461. J: 新增流程圖節點搜尋。
  462. Add flow-graph node search.
  463. ItemTracingFlowGraphSearch.tsx
  464. L42–88: 搜尋框與節點高亮。
  465. L42–88: search box and node highlight.
  466. K: <developer>
  467. Row NEW (append | next Ref 15 | Page Ref 3 → 批號追溯 / Item Tracing | Function: ItemTracingScanBar — src/components/ItemTracing/ItemTracingScanBar.tsx)
  468. A: 15
  469. B: 3
  470. C: 倉庫管理 / Store Management
  471. D: 批號追溯 / Item Tracing
  472. F: …頁面目的(中文)…
  473. …page purpose (English)…
  474. 使用/呼叫來源:本頁(批號追溯 / Item Tracing)。
  475. Used / called from: this page (批號追溯 / Item Tracing).
  476. G: ItemTracingScanBar — src/components/ItemTracing/ItemTracingScanBar.tsx
  477. H: 相機掃碼/手動查詢
  478. Camera scan / manual search
  479. ...
  480. I/J/K: <new latest>
  481. history slots: empty
  482. Row NEW (… | Page Ref <n> → 工單提料 / Job Order Pick Execution | Function: CompleteJobOrderRecord — …)
  483. B: <page Ref. No.>
  484. D: 工單提料 / Job Order Pick Execution
  485. F: 工單提料執行頁面(/jodetail)。
  486. Job Order Pick Execution page (/jodetail).
  487. 使用/呼叫來源:批號追溯(單據深連結)。
  488. Used / called from: Item Tracing (doc deep-link).
  489. G: CompleteJobOrderRecord — src/components/Jodetail/completeJobOrderRecord.tsx
  490. JodetailSearch — src/components/Jodetail/JodetailSearch.tsx
  491. Confirm: Is this preview correct? [Yes / No — tell me what to change]
  492. ```
  493. For page-sheet rows, use the same style with D/F/G and H–P history.
  494. ## Workflow
  495. 1. Confirm **main and archive** Excel paths exist (and are writable when saving).
  496. 2. Infer target sheets and rows from the user’s change description / diff.
  497. 3. **Pre-check** existing program/page/function rows in Excel.
  498. 4. For each Functions row: **fact-check** English symbol + every source path
  499. against the codebase (see Fact-check column G). Correct or drop failures.
  500. Also set / verify **Page Ref. No. (B)** against the parent Page sheet Ref.
  501. 5. For each Functions row: set **F** with page purpose **and** usage/呼叫來源
  502. (owning page vs caller page; see Column F rule).
  503. 6. For each existing match: plan history shift + new Latest values
  504. (**only** shift function history when that function’s G symbols changed).
  505. If old 3rd is filled, plan an **Archive long-table append**.
  506. 7. For each Major Changes cell (page + functions, Latest and any filled history
  507. slots): resolve **file path + line range(s) + short per-hunk explanation**
  508. from git diff / current sources (see Major Changes: file, lines, explanation).
  509. 8. For each new function/page: plan a new Ref. No. row (next integer after max used).
  510. 9. Present the **full preview** (verified G + Page Ref + file/line Major Changes +
  511. archive appends) → ask once if correct.
  512. 10. On approval: with `openpyxl`, **append archive rows first** (if any), then
  513. apply main shifts + writes; apply **Excel formatting** (wrap text /
  514. newlines); save both workbooks; report sheet names, row numbers,
  515. Ref. Nos., Page Ref. Nos., archive rows appended, and key Latest fields.
  516. 11. **Code comments** — for every Functions-sheet symbol that was added or
  517. updated, add or refresh the FP-MTMS checklist comment on that
  518. component / class member (see Code comments rule). Include this in the
  519. preview (list of files/symbols that will get comments).
  520. 12. Note that OneDrive may take a few seconds to sync; refresh Excel Online if open.
  521. ## Code comments on every updated function (required)
  522. After the user approves the checklist preview (or as part of the same
  523. approved batch), **add or update a source comment** on every function /
  524. component listed in column G for each affected Functions-sheet row.
  525. ### Comment contents (required fields)
  526. Must include:
  527. 1. **Ref. No.** — Functions sheet Ref. No. for that row
  528. 2. **Version** — Latest Function Version (column I), e.g. `v1.0.0`
  529. 3. **Update date** — the date from column I, e.g. `2026-07-14`
  530. ### Canonical format
  531. Parse column I `vX.Y.Z YYYY-MM-DD` into version + date.
  532. **TypeScript / TSX** (JSDoc immediately above the component / export /
  533. function):
  534. ```ts
  535. /** FP-MTMS Version Checklist | Functions Ref. No. 1 | v1.0.0 | 2026-07-14 */
  536. const ItemTracingScanBar: React.FC<ScanBarProps> = (...) => {
  537. ```
  538. **Kotlin** (KDoc immediately above the `fun` / class member):
  539. ```kotlin
  540. /** FP-MTMS Version Checklist | Functions Ref. No. 7 | v1.0.0 | 2026-07-14 */
  541. open fun trace(...): ItemLotTraceResponse = ...
  542. ```
  543. If a KDoc/JSDoc already exists, **prepend or merge** this checklist line
  544. into it (do not delete useful existing documentation). Prefer keeping the
  545. checklist line as the first line of the block:
  546. ```kotlin
  547. /**
  548. * FP-MTMS Version Checklist | Functions Ref. No. 7 | v1.0.0 | 2026-07-14
  549. * Lazy-load: returns the full location-scoped trace block...
  550. */
  551. ```
  552. ### Placement rules
  553. - **React component**: above the primary `const ComponentName` / `export
  554. default` that matches column G.
  555. - **Service / controller**: above **each** listed member function
  556. (e.g. both `trace` and `traceLocation`).
  557. - Multi-line G (one symbol per line): comment **each** symbol in its file.
  558. - On later checklist updates to the same row: **replace** the old Ref/version/date
  559. in the comment with the new Latest values (do not stack duplicate checklist lines).
  560. ### Preview
  561. The Excel preview must also list planned comment updates, e.g.:
  562. ```text
  563. Code comments to add/update:
  564. Ref 7 → ItemLotTraceService.trace / .traceLocation (v1.0.0 | 2026-07-14)
  565. Ref 1 → ItemTracingScanBar (v1.0.0 | 2026-07-14)
  566. ```
  567. Only edit comments after preview approval (same gate as Excel write), unless
  568. the user explicitly asks to sync comments only.
  569. ## Inference hints (for filling the preview)
  570. - **Version & Date**: next patch/semver from conversation/git if known; else
  571. `vX.Y.Z YYYY-MM-DD` with today’s date.
  572. - **Developed By**: `git config user.name` or chat context.
  573. - **Purpose / Changes / Function highlight**: 中英對照; short bullets from
  574. recent PR/diff; prefer i18n terms.
  575. - **Major Changes (Page F / Functions J and history slots)**: summary ZH/EN
  576. **plus** each changed file, line range(s), and short per-hunk explanation
  577. (see Major Changes: file, lines, explanation). Resolve lines from git diff
  578. + current file; do not omit locations.
  579. - **Subsystem / Page names**: `中文 / English` from i18n EN+ZH.
  580. - **Function name (col G)**: English code symbol + source file path only
  581. (no 中英對照). **Fact-check** symbol+path before preview.
  582. - **Page Purpose (F)**: 中英對照 + usage/呼叫來源 lines (ZH then EN).
  583. - **Page Ref. No. (B)**: parent Page sheet Ref. No. for column D’s page.
  584. - **Ref. No.**: for new rows, next integer after the last used Ref. No. on that sheet.
  585. - Prefer updating an existing row over creating a duplicate when page +
  586. English function symbol (and file) match.
  587. ## Do not
  588. - Ask the user to fill cells one column at a time
  589. - Save without an approved preview
  590. - Skip history shift when updating an existing Latest
  591. - Drop a filled **3rd previous** without appending it to the Archive long table
  592. - Add or fill an Archive **Source** column (removed; do not reintroduce)
  593. - Overwrite or edit existing Archive rows (append only)
  594. - Skip Excel formatting (wrap text / newlines) on multi-line cells you write
  595. - Push or invent **function** history (I–T) for a commit that did not change
  596. that row’s column G symbols — no “page align / no code change” filler slots
  597. - Write Major Changes as summary-only without **file path + line range(s) +
  598. short per-hunk explanation** (Page F / Functions J and matching history cols)
  599. - Write Chinese-only or English-only prose in bilingual-required columns
  600. (everything except Function name G, versions, Developed By, Ref. No., Page Ref. No., and
  601. the path/line tokens inside Major Changes)
  602. - Put only a Chinese UI label in **Name of Function within Program** without
  603. the English symbol and source file
  604. - Bilingualize column G (keep symbol + path English-only)
  605. - Omit usage/呼叫來源 from **Page Purpose Highlights (F)** when the function
  606. is invoked from another page (e.g. 批號追溯 deep-link into 工單提料)
  607. - Cite a `*Service` / `*Controller` class in G without its relevant member
  608. function names (e.g. write `ItemLotTraceService.trace / .traceLocation`,
  609. not only `ItemLotTraceService`)
  610. - Write a G value whose symbol or path was not verified in the codebase
  611. - Leave **Page Ref. No. (B)** blank or pointing at a non-existent Page row
  612. - Guess file paths or rename symbols to “look right” without opening the file
  613. - Put two different 功能 on the same Ref. No. row
  614. - Create a function row when the parent program/page was neither found nor
  615. included in the same approved preview as a new page row
  616. - Clear history columns without showing that shift/archive in the preview
  617. - Skip adding/updating FP-MTMS checklist comments on code for Functions rows
  618. that were just written (must include Ref. No., version, and update date)
  619. - Commit the Excel file to git
  620. - Edit cloud URLs / `.url` files as if they were workbooks