universal-dev-standards 6.9.0 → 6.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. package/bundled/core/agent-communication-protocol.md +8 -0
  2. package/bundled/core/branch-completion.md +8 -0
  3. package/bundled/core/change-batching-standards.md +8 -0
  4. package/bundled/core/execution-history.md +8 -0
  5. package/bundled/core/pipeline-integration-standards.md +8 -0
  6. package/bundled/core/workflow-enforcement.md +8 -0
  7. package/bundled/core/workflow-state-protocol.md +8 -0
  8. package/bundled/locales/zh-CN/CHANGELOG.md +29 -3
  9. package/bundled/locales/zh-CN/README.md +1 -1
  10. package/bundled/locales/zh-CN/SECURITY.md +1 -1
  11. package/bundled/locales/zh-CN/core/agent-communication-protocol.md +7 -0
  12. package/bundled/locales/zh-CN/core/branch-completion.md +7 -0
  13. package/bundled/locales/zh-CN/core/change-batching-standards.md +7 -0
  14. package/bundled/locales/zh-CN/core/execution-history.md +7 -0
  15. package/bundled/locales/zh-CN/core/pipeline-integration-standards.md +7 -0
  16. package/bundled/locales/zh-CN/core/workflow-enforcement.md +7 -0
  17. package/bundled/locales/zh-CN/core/workflow-state-protocol.md +7 -0
  18. package/bundled/locales/zh-CN/docs/MIGRATION-v6.md +8 -4
  19. package/bundled/locales/zh-TW/CHANGELOG.md +30 -3
  20. package/bundled/locales/zh-TW/README.md +1 -1
  21. package/bundled/locales/zh-TW/SECURITY.md +1 -1
  22. package/bundled/locales/zh-TW/core/agent-communication-protocol.md +7 -0
  23. package/bundled/locales/zh-TW/core/branch-completion.md +7 -0
  24. package/bundled/locales/zh-TW/core/change-batching-standards.md +7 -0
  25. package/bundled/locales/zh-TW/core/execution-history.md +7 -0
  26. package/bundled/locales/zh-TW/core/pipeline-integration-standards.md +7 -0
  27. package/bundled/locales/zh-TW/core/workflow-enforcement.md +7 -0
  28. package/bundled/locales/zh-TW/core/workflow-state-protocol.md +7 -0
  29. package/bundled/locales/zh-TW/docs/MIGRATION-v6.md +8 -4
  30. package/package.json +7 -6
  31. package/src/commands/check.js +161 -24
  32. package/src/commands/config.js +19 -19
  33. package/src/commands/init.js +13 -4
  34. package/src/commands/spec.js +2 -2
  35. package/src/commands/update.js +251 -29
  36. package/src/i18n/messages.js +36 -0
  37. package/src/installers/integration-installer.js +4 -4
  38. package/src/installers/skills-installer.js +4 -4
  39. package/src/installers/standards-installer.js +3 -3
  40. package/src/prompts/init.js +33 -4
  41. package/src/reconciler/diff-engine.js +57 -2
  42. package/src/reconciler/plan-executor.js +31 -11
  43. package/src/utils/integration-generator.js +209 -81
  44. package/src/utils/reference-sync.js +103 -7
  45. package/src/utils/registry.js +57 -0
  46. package/src/utils/spinner.js +31 -0
  47. package/standards-registry.json +8 -8
@@ -3,7 +3,7 @@ import { dirname, join, basename } from 'path';
3
3
  import { getLanguageRules } from '../prompts/integrations.js';
4
4
  import { computeIntegrationBlockHash } from './hasher.js';
5
5
  import { UDS_MARKERS, SUPPORTED_AI_TOOLS, LEGACY_TOOL_MAPPINGS } from '../core/constants.js';
6
- import { resolveSelectedOptionSources, resolveStandardFilename } from './registry.js';
6
+ import { resolveSelectedOptionSources, resolveStandardFilename, getAllStandards } from './registry.js';
7
7
  import { getAgentConfig, getAgentTier } from '../config/ai-agent-paths.js';
8
8
 
9
9
  /**
@@ -2003,6 +2003,16 @@ src/
2003
2003
  /**
2004
2004
  * Tool-specific file headers
2005
2005
  */
2006
+ // 🔴 These headers used to open by telling the agent to "PRIORITIZE reading the
2007
+ // concise rules in `core/`". `uds init` installs standards into `.standards/`
2008
+ // and has never created a `core/` directory in an adopter's project — `core/`
2009
+ // is where the standards live in the UDS repo, not in the repos that adopt it.
2010
+ // So the first instruction in every generated file, for every tool, in every
2011
+ // language, pointed at nothing. An adopter reported the symptom on 2026-09-16
2012
+ // and read it as residue from an old install; it was not residue, a clean
2013
+ // `uds init` wrote it. 36 copies of the same two sentences, all wrong the same
2014
+ // way. `tests/unit/utils/tool-headers-no-core.test.js` walks the generated
2015
+ // output so a tenth tool cannot reintroduce it.
2006
2016
  const TOOL_HEADERS = {
2007
2017
  cursor: {
2008
2018
  en: `# Cursor Rules
@@ -2015,8 +2025,8 @@ You are an expert software engineer assistant. Follow these project standards.
2015
2025
  All responses should be in **English**.
2016
2026
 
2017
2027
  ## Core Standards Usage Rule
2018
- > When verifying standards, checking code, or performing tasks, **PRIORITIZE** reading the concise rules in \`core/\` (e.g., \`core/testing-standards.md\`).
2019
- > **ONLY** read \`core/guides/\` or \`methodologies/guides/\` when explicitly asked for educational content, detailed explanations, or tutorials.
2028
+ > When verifying standards, checking code, or performing tasks, read the rules in \`.standards/\` — that is where this project's standards are installed.
2029
+ > Each file states its own requirements; read the one the task is about rather than all of them.
2020
2030
  > This ensures token efficiency and focused context.`,
2021
2031
  'zh-tw': `# Cursor 規則
2022
2032
  # 由 Universal Dev Standards CLI 生成
@@ -2028,8 +2038,8 @@ All responses should be in **English**.
2028
2038
  所有回覆必須使用**繁體中文 (Traditional Chinese)**。
2029
2039
 
2030
2040
  ## 核心標準使用規則 / Core Standards Usage Rule
2031
- > 當驗證標準、檢查程式碼或執行任務時,**優先**讀取 \`core/\` 中的精簡規則(例如 \`core/testing-standards.md\`)。
2032
- > 只有在被明確要求提供教育內容、詳細解釋或教學時,才讀取 \`core/guides/\` 或 \`methodologies/guides/\`。
2041
+ > 當驗證標準、檢查程式碼或執行任務時,讀取 \`.standards/\` 裡的規則——那是本專案標準實際安裝的位置。
2042
+ > 每個檔案各自寫明它要求什麼;讀與當下任務相關的那一份,不必全部讀完。
2033
2043
  > 這確保了 Token 效率和上下文聚焦。`,
2034
2044
  bilingual: `# Cursor Rules | Cursor 規則
2035
2045
  # Generated by Universal Dev Standards CLI
@@ -2044,10 +2054,10 @@ All responses should be in **Traditional Chinese (繁體中文)**, with technica
2044
2054
  所有回覆必須使用**繁體中文**,技術術語可保留英文。
2045
2055
 
2046
2056
  ## Core Standards Usage Rule / 核心標準使用規則
2047
- > When verifying standards, checking code, or performing tasks, **PRIORITIZE** reading the concise rules in \`core/\` (e.g., \`core/testing-standards.md\`).
2048
- > 當驗證標準、檢查程式碼或執行任務時,**優先**讀取 \`core/\` 中的精簡規則(例如 \`core/testing-standards.md\`)。
2049
- > **ONLY** read \`core/guides/\` or \`methodologies/guides/\` when explicitly asked for educational content, detailed explanations, or tutorials.
2050
- > 只有在被明確要求提供教育內容、詳細解釋或教學時,才讀取 \`core/guides/\` 或 \`methodologies/guides/\`。
2057
+ > When verifying standards, checking code, or performing tasks, read the rules in \`.standards/\` — that is where this project's standards are installed.
2058
+ > 當驗證標準、檢查程式碼或執行任務時,讀取 \`.standards/\` 裡的規則——那是本專案標準實際安裝的位置。
2059
+ > Each file states its own requirements; read the one the task is about rather than all of them.
2060
+ > 每個檔案各自寫明它要求什麼;讀與當下任務相關的那一份,不必全部讀完。
2051
2061
  > This ensures token efficiency and focused context.
2052
2062
  > 這確保了 Token 效率和上下文聚焦。`
2053
2063
  },
@@ -2062,8 +2072,8 @@ You are an expert software engineer assistant. Follow these project standards.
2062
2072
  All responses should be in **English**.
2063
2073
 
2064
2074
  ## Core Standards Usage Rule
2065
- > When verifying standards, checking code, or performing tasks, **PRIORITIZE** reading the concise rules in \`core/\` (e.g., \`core/testing-standards.md\`).
2066
- > **ONLY** read \`core/guides/\` or \`methodologies/guides/\` when explicitly asked for educational content, detailed explanations, or tutorials.
2075
+ > When verifying standards, checking code, or performing tasks, read the rules in \`.standards/\` — that is where this project's standards are installed.
2076
+ > Each file states its own requirements; read the one the task is about rather than all of them.
2067
2077
  > This ensures token efficiency and focused context.`,
2068
2078
  'zh-tw': `# Windsurf 規則
2069
2079
  # 由 Universal Dev Standards CLI 生成
@@ -2075,8 +2085,8 @@ All responses should be in **English**.
2075
2085
  所有回覆必須使用**繁體中文 (Traditional Chinese)**。
2076
2086
 
2077
2087
  ## 核心標準使用規則 / Core Standards Usage Rule
2078
- > 當驗證標準、檢查程式碼或執行任務時,**優先**讀取 \`core/\` 中的精簡規則(例如 \`core/testing-standards.md\`)。
2079
- > 只有在被明確要求提供教育內容、詳細解釋或教學時,才讀取 \`core/guides/\` 或 \`methodologies/guides/\`。
2088
+ > 當驗證標準、檢查程式碼或執行任務時,讀取 \`.standards/\` 裡的規則——那是本專案標準實際安裝的位置。
2089
+ > 每個檔案各自寫明它要求什麼;讀與當下任務相關的那一份,不必全部讀完。
2080
2090
  > 這確保了 Token 效率和上下文聚焦。`,
2081
2091
  bilingual: `# Windsurf Rules | Windsurf 規則
2082
2092
  # Generated by Universal Dev Standards CLI
@@ -2091,10 +2101,10 @@ All responses should be in **Traditional Chinese (繁體中文)**, with technica
2091
2101
  所有回覆必須使用**繁體中文**,技術術語可保留英文。
2092
2102
 
2093
2103
  ## Core Standards Usage Rule / 核心標準使用規則
2094
- > When verifying standards, checking code, or performing tasks, **PRIORITIZE** reading the concise rules in \`core/\` (e.g., \`core/testing-standards.md\`).
2095
- > 當驗證標準、檢查程式碼或執行任務時,**優先**讀取 \`core/\` 中的精簡規則(例如 \`core/testing-standards.md\`)。
2096
- > **ONLY** read \`core/guides/\` or \`methodologies/guides/\` when explicitly asked for educational content, detailed explanations, or tutorials.
2097
- > 只有在被明確要求提供教育內容、詳細解釋或教學時,才讀取 \`core/guides/\` 或 \`methodologies/guides/\`。
2104
+ > When verifying standards, checking code, or performing tasks, read the rules in \`.standards/\` — that is where this project's standards are installed.
2105
+ > 當驗證標準、檢查程式碼或執行任務時,讀取 \`.standards/\` 裡的規則——那是本專案標準實際安裝的位置。
2106
+ > Each file states its own requirements; read the one the task is about rather than all of them.
2107
+ > 每個檔案各自寫明它要求什麼;讀與當下任務相關的那一份,不必全部讀完。
2098
2108
  > This ensures token efficiency and focused context.
2099
2109
  > 這確保了 Token 效率和上下文聚焦。`
2100
2110
  },
@@ -2109,8 +2119,8 @@ You are an expert software engineer assistant. Follow these project standards.
2109
2119
  All responses should be in **English**.
2110
2120
 
2111
2121
  ## Core Standards Usage Rule
2112
- > When verifying standards, checking code, or performing tasks, **PRIORITIZE** reading the concise rules in \`core/\` (e.g., \`core/testing-standards.md\`).
2113
- > **ONLY** read \`core/guides/\` or \`methodologies/guides/\` when explicitly asked for educational content, detailed explanations, or tutorials.
2122
+ > When verifying standards, checking code, or performing tasks, read the rules in \`.standards/\` — that is where this project's standards are installed.
2123
+ > Each file states its own requirements; read the one the task is about rather than all of them.
2114
2124
  > This ensures token efficiency and focused context.`,
2115
2125
  'zh-tw': `# Cline 規則
2116
2126
  # 由 Universal Dev Standards CLI 生成
@@ -2122,8 +2132,8 @@ All responses should be in **English**.
2122
2132
  所有回覆必須使用**繁體中文 (Traditional Chinese)**。
2123
2133
 
2124
2134
  ## 核心標準使用規則 / Core Standards Usage Rule
2125
- > 當驗證標準、檢查程式碼或執行任務時,**優先**讀取 \`core/\` 中的精簡規則(例如 \`core/testing-standards.md\`)。
2126
- > 只有在被明確要求提供教育內容、詳細解釋或教學時,才讀取 \`core/guides/\` 或 \`methodologies/guides/\`。
2135
+ > 當驗證標準、檢查程式碼或執行任務時,讀取 \`.standards/\` 裡的規則——那是本專案標準實際安裝的位置。
2136
+ > 每個檔案各自寫明它要求什麼;讀與當下任務相關的那一份,不必全部讀完。
2127
2137
  > 這確保了 Token 效率和上下文聚焦。`,
2128
2138
  bilingual: `# Cline Rules | Cline 規則
2129
2139
  # Generated by Universal Dev Standards CLI
@@ -2138,10 +2148,10 @@ All responses should be in **Traditional Chinese (繁體中文)**, with technica
2138
2148
  所有回覆必須使用**繁體中文**,技術術語可保留英文。
2139
2149
 
2140
2150
  ## Core Standards Usage Rule / 核心標準使用規則
2141
- > When verifying standards, checking code, or performing tasks, **PRIORITIZE** reading the concise rules in \`core/\` (e.g., \`core/testing-standards.md\`).
2142
- > 當驗證標準、檢查程式碼或執行任務時,**優先**讀取 \`core/\` 中的精簡規則(例如 \`core/testing-standards.md\`)。
2143
- > **ONLY** read \`core/guides/\` or \`methodologies/guides/\` when explicitly asked for educational content, detailed explanations, or tutorials.
2144
- > 只有在被明確要求提供教育內容、詳細解釋或教學時,才讀取 \`core/guides/\` 或 \`methodologies/guides/\`。
2151
+ > When verifying standards, checking code, or performing tasks, read the rules in \`.standards/\` — that is where this project's standards are installed.
2152
+ > 當驗證標準、檢查程式碼或執行任務時,讀取 \`.standards/\` 裡的規則——那是本專案標準實際安裝的位置。
2153
+ > Each file states its own requirements; read the one the task is about rather than all of them.
2154
+ > 每個檔案各自寫明它要求什麼;讀與當下任務相關的那一份,不必全部讀完。
2145
2155
  > This ensures token efficiency and focused context.
2146
2156
  > 這確保了 Token 效率和上下文聚焦。`
2147
2157
  },
@@ -2156,8 +2166,8 @@ You are an expert software engineer assistant. Follow these project standards.
2156
2166
  All responses should be in **English**.
2157
2167
 
2158
2168
  ## Core Standards Usage Rule
2159
- > When verifying standards, checking code, or performing tasks, **PRIORITIZE** reading the concise rules in \`core/\` (e.g., \`core/testing-standards.md\`).
2160
- > **ONLY** read \`core/guides/\` or \`methodologies/guides/\` when explicitly asked for educational content, detailed explanations, or tutorials.
2169
+ > When verifying standards, checking code, or performing tasks, read the rules in \`.standards/\` — that is where this project's standards are installed.
2170
+ > Each file states its own requirements; read the one the task is about rather than all of them.
2161
2171
  > This ensures token efficiency and focused context.`,
2162
2172
  'zh-tw': `# GitHub Copilot 說明
2163
2173
  # 由 Universal Dev Standards CLI 生成
@@ -2169,8 +2179,8 @@ All responses should be in **English**.
2169
2179
  所有回覆必須使用**繁體中文 (Traditional Chinese)**。
2170
2180
 
2171
2181
  ## 核心標準使用規則 / Core Standards Usage Rule
2172
- > 當驗證標準、檢查程式碼或執行任務時,**優先**讀取 \`core/\` 中的精簡規則(例如 \`core/testing-standards.md\`)。
2173
- > 只有在被明確要求提供教育內容、詳細解釋或教學時,才讀取 \`core/guides/\` 或 \`methodologies/guides/\`。
2182
+ > 當驗證標準、檢查程式碼或執行任務時,讀取 \`.standards/\` 裡的規則——那是本專案標準實際安裝的位置。
2183
+ > 每個檔案各自寫明它要求什麼;讀與當下任務相關的那一份,不必全部讀完。
2174
2184
  > 這確保了 Token 效率和上下文聚焦。`,
2175
2185
  bilingual: `# GitHub Copilot Instructions | GitHub Copilot 說明
2176
2186
  # Generated by Universal Dev Standards CLI
@@ -2185,10 +2195,10 @@ All responses should be in **Traditional Chinese (繁體中文)**, with technica
2185
2195
  所有回覆必須使用**繁體中文**,技術術語可保留英文。
2186
2196
 
2187
2197
  ## Core Standards Usage Rule / 核心標準使用規則
2188
- > When verifying standards, checking code, or performing tasks, **PRIORITIZE** reading the concise rules in \`core/\` (e.g., \`core/testing-standards.md\`).
2189
- > 當驗證標準、檢查程式碼或執行任務時,**優先**讀取 \`core/\` 中的精簡規則(例如 \`core/testing-standards.md\`)。
2190
- > **ONLY** read \`core/guides/\` or \`methodologies/guides/\` when explicitly asked for educational content, detailed explanations, or tutorials.
2191
- > 只有在被明確要求提供教育內容、詳細解釋或教學時,才讀取 \`core/guides/\` 或 \`methodologies/guides/\`。
2198
+ > When verifying standards, checking code, or performing tasks, read the rules in \`.standards/\` — that is where this project's standards are installed.
2199
+ > 當驗證標準、檢查程式碼或執行任務時,讀取 \`.standards/\` 裡的規則——那是本專案標準實際安裝的位置。
2200
+ > Each file states its own requirements; read the one the task is about rather than all of them.
2201
+ > 每個檔案各自寫明它要求什麼;讀與當下任務相關的那一份,不必全部讀完。
2192
2202
  > This ensures token efficiency and focused context.
2193
2203
  > 這確保了 Token 效率和上下文聚焦。`
2194
2204
  },
@@ -2204,8 +2214,8 @@ Follow these project standards.
2204
2214
  All responses should be in **English**.
2205
2215
 
2206
2216
  ## Core Standards Usage Rule
2207
- > When verifying standards, checking code, or performing tasks, **PRIORITIZE** reading the concise rules in \`core/\` (e.g., \`core/testing-standards.md\`).
2208
- > **ONLY** read \`core/guides/\` or \`methodologies/guides/\` when explicitly asked for educational content, detailed explanations, or tutorials.
2217
+ > When verifying standards, checking code, or performing tasks, read the rules in \`.standards/\` — that is where this project's standards are installed.
2218
+ > Each file states its own requirements; read the one the task is about rather than all of them.
2209
2219
  > This ensures token efficiency and focused context.`,
2210
2220
  'zh-tw': `# Antigravity 系統指令
2211
2221
  # 由 Universal Dev Standards CLI 生成
@@ -2218,8 +2228,8 @@ Google Antigravity (Gemini Advanced Agent) 的推薦系統指令。
2218
2228
  所有回覆必須使用**繁體中文 (Traditional Chinese)**。
2219
2229
 
2220
2230
  ## 核心標準使用規則 / Core Standards Usage Rule
2221
- > 當驗證標準、檢查程式碼或執行任務時,**優先**讀取 \`core/\` 中的精簡規則(例如 \`core/testing-standards.md\`)。
2222
- > 只有在被明確要求提供教育內容、詳細解釋或教學時,才讀取 \`core/guides/\` 或 \`methodologies/guides/\`。
2231
+ > 當驗證標準、檢查程式碼或執行任務時,讀取 \`.standards/\` 裡的規則——那是本專案標準實際安裝的位置。
2232
+ > 每個檔案各自寫明它要求什麼;讀與當下任務相關的那一份,不必全部讀完。
2223
2233
  > 這確保了 Token 效率和上下文聚焦。`,
2224
2234
  bilingual: `# Antigravity System Instructions | Antigravity 系統指令
2225
2235
  # Generated by Universal Dev Standards CLI
@@ -2234,10 +2244,10 @@ All responses should be in **Traditional Chinese (繁體中文)**, with technica
2234
2244
  所有回覆必須使用**繁體中文**,技術術語可保留英文。
2235
2245
 
2236
2246
  ## Core Standards Usage Rule / 核心標準使用規則
2237
- > When verifying standards, checking code, or performing tasks, **PRIORITIZE** reading the concise rules in \`core/\` (e.g., \`core/testing-standards.md\`).
2238
- > 當驗證標準、檢查程式碼或執行任務時,**優先**讀取 \`core/\` 中的精簡規則(例如 \`core/testing-standards.md\`)。
2239
- > **ONLY** read \`core/guides/\` or \`methodologies/guides/\` when explicitly asked for educational content, detailed explanations, or tutorials.
2240
- > 只有在被明確要求提供教育內容、詳細解釋或教學時,才讀取 \`core/guides/\` 或 \`methodologies/guides/\`。
2247
+ > When verifying standards, checking code, or performing tasks, read the rules in \`.standards/\` — that is where this project's standards are installed.
2248
+ > 當驗證標準、檢查程式碼或執行任務時,讀取 \`.standards/\` 裡的規則——那是本專案標準實際安裝的位置。
2249
+ > Each file states its own requirements; read the one the task is about rather than all of them.
2250
+ > 每個檔案各自寫明它要求什麼;讀與當下任務相關的那一份,不必全部讀完。
2241
2251
  > This ensures token efficiency and focused context.
2242
2252
  > 這確保了 Token 效率和上下文聚焦。`
2243
2253
  },
@@ -2250,8 +2260,8 @@ All responses should be in **Traditional Chinese (繁體中文)**, with technica
2250
2260
  All responses should be in **English**.
2251
2261
 
2252
2262
  ## Core Standards Usage Rule
2253
- > When verifying standards, checking code, or performing tasks, **PRIORITIZE** reading the concise rules in \`core/\` (e.g., \`core/testing-standards.md\`).
2254
- > **ONLY** read \`core/guides/\` or \`methodologies/guides/\` when explicitly asked for educational content, detailed explanations, or tutorials.
2263
+ > When verifying standards, checking code, or performing tasks, read the rules in \`.standards/\` — that is where this project's standards are installed.
2264
+ > Each file states its own requirements; read the one the task is about rather than all of them.
2255
2265
  > This ensures token efficiency and focused context.`,
2256
2266
  'zh-tw': `# Claude Code 專案指南
2257
2267
  # 由 Universal Dev Standards CLI 生成
@@ -2262,8 +2272,8 @@ All responses should be in **English**.
2262
2272
  AI 助手應以繁體中文回覆使用者的問題與請求。
2263
2273
 
2264
2274
  ## 核心標準使用規則 / Core Standards Usage Rule
2265
- > 當驗證標準、檢查程式碼或執行任務時,**優先**讀取 \`core/\` 中的精簡規則(例如 \`core/testing-standards.md\`)。
2266
- > 只有在被明確要求提供教育內容、詳細解釋或教學時,才讀取 \`core/guides/\` 或 \`methodologies/guides/\`。
2275
+ > 當驗證標準、檢查程式碼或執行任務時,讀取 \`.standards/\` 裡的規則——那是本專案標準實際安裝的位置。
2276
+ > 每個檔案各自寫明它要求什麼;讀與當下任務相關的那一份,不必全部讀完。
2267
2277
  > 這確保了 Token 效率和上下文聚焦。`,
2268
2278
  bilingual: `# Project Guidelines for Claude Code | Claude Code 專案指南
2269
2279
  # Generated by Universal Dev Standards CLI
@@ -2276,10 +2286,10 @@ All responses should be in **Traditional Chinese (繁體中文)**, with technica
2276
2286
  AI 助手應以繁體中文回覆使用者的問題與請求。
2277
2287
 
2278
2288
  ## Core Standards Usage Rule / 核心標準使用規則
2279
- > When verifying standards, checking code, or performing tasks, **PRIORITIZE** reading the concise rules in \`core/\` (e.g., \`core/testing-standards.md\`).
2280
- > 當驗證標準、檢查程式碼或執行任務時,**優先**讀取 \`core/\` 中的精簡規則(例如 \`core/testing-standards.md\`)。
2281
- > **ONLY** read \`core/guides/\` or \`methodologies/guides/\` when explicitly asked for educational content, detailed explanations, or tutorials.
2282
- > 只有在被明確要求提供教育內容、詳細解釋或教學時,才讀取 \`core/guides/\` 或 \`methodologies/guides/\`。
2289
+ > When verifying standards, checking code, or performing tasks, read the rules in \`.standards/\` — that is where this project's standards are installed.
2290
+ > 當驗證標準、檢查程式碼或執行任務時,讀取 \`.standards/\` 裡的規則——那是本專案標準實際安裝的位置。
2291
+ > Each file states its own requirements; read the one the task is about rather than all of them.
2292
+ > 每個檔案各自寫明它要求什麼;讀與當下任務相關的那一份,不必全部讀完。
2283
2293
  > This ensures token efficiency and focused context.
2284
2294
  > 這確保了 Token 效率和上下文聚焦。`
2285
2295
  },
@@ -2294,8 +2304,8 @@ You are an expert software engineer assistant. Follow these project standards.
2294
2304
  All responses should be in **English**.
2295
2305
 
2296
2306
  ## Core Standards Usage Rule
2297
- > When verifying standards, checking code, or performing tasks, **PRIORITIZE** reading the concise rules in \`core/\` (e.g., \`core/testing-standards.md\`).
2298
- > **ONLY** read \`core/guides/\` or \`methodologies/guides/\` when explicitly asked for educational content, detailed explanations, or tutorials.
2307
+ > When verifying standards, checking code, or performing tasks, read the rules in \`.standards/\` — that is where this project's standards are installed.
2308
+ > Each file states its own requirements; read the one the task is about rather than all of them.
2299
2309
  > This ensures token efficiency and focused context.`,
2300
2310
  'zh-tw': `# AGENTS.md - OpenAI Codex CLI 規則
2301
2311
  # 由 Universal Dev Standards CLI 生成
@@ -2307,8 +2317,8 @@ All responses should be in **English**.
2307
2317
  所有回覆必須使用**繁體中文 (Traditional Chinese)**。
2308
2318
 
2309
2319
  ## 核心標準使用規則 / Core Standards Usage Rule
2310
- > 當驗證標準、檢查程式碼或執行任務時,**優先**讀取 \`core/\` 中的精簡規則(例如 \`core/testing-standards.md\`)。
2311
- > 只有在被明確要求提供教育內容、詳細解釋或教學時,才讀取 \`core/guides/\` 或 \`methodologies/guides/\`。
2320
+ > 當驗證標準、檢查程式碼或執行任務時,讀取 \`.standards/\` 裡的規則——那是本專案標準實際安裝的位置。
2321
+ > 每個檔案各自寫明它要求什麼;讀與當下任務相關的那一份,不必全部讀完。
2312
2322
  > 這確保了 Token 效率和上下文聚焦。`,
2313
2323
  bilingual: `# AGENTS.md - OpenAI Codex CLI Rules | OpenAI Codex CLI 規則
2314
2324
  # Generated by Universal Dev Standards CLI
@@ -2323,10 +2333,10 @@ All responses should be in **Traditional Chinese (繁體中文)**, with technica
2323
2333
  所有回覆必須使用**繁體中文**,技術術語可保留英文。
2324
2334
 
2325
2335
  ## Core Standards Usage Rule / 核心標準使用規則
2326
- > When verifying standards, checking code, or performing tasks, **PRIORITIZE** reading the concise rules in \`core/\` (e.g., \`core/testing-standards.md\`).
2327
- > 當驗證標準、檢查程式碼或執行任務時,**優先**讀取 \`core/\` 中的精簡規則(例如 \`core/testing-standards.md\`)。
2328
- > **ONLY** read \`core/guides/\` or \`methodologies/guides/\` when explicitly asked for educational content, detailed explanations, or tutorials.
2329
- > 只有在被明確要求提供教育內容、詳細解釋或教學時,才讀取 \`core/guides/\` 或 \`methodologies/guides/\`。
2336
+ > When verifying standards, checking code, or performing tasks, read the rules in \`.standards/\` — that is where this project's standards are installed.
2337
+ > 當驗證標準、檢查程式碼或執行任務時,讀取 \`.standards/\` 裡的規則——那是本專案標準實際安裝的位置。
2338
+ > Each file states its own requirements; read the one the task is about rather than all of them.
2339
+ > 每個檔案各自寫明它要求什麼;讀與當下任務相關的那一份,不必全部讀完。
2330
2340
  > This ensures token efficiency and focused context.
2331
2341
  > 這確保了 Token 效率和上下文聚焦。`
2332
2342
  },
@@ -2341,8 +2351,8 @@ You are an expert software engineer assistant powered by Gemini. Follow these pr
2341
2351
  All responses should be in **English**.
2342
2352
 
2343
2353
  ## Core Standards Usage Rule
2344
- > When verifying standards, checking code, or performing tasks, **PRIORITIZE** reading the concise rules in \`core/\` (e.g., \`core/testing-standards.md\`).
2345
- > **ONLY** read \`core/guides/\` or \`methodologies/guides/\` when explicitly asked for educational content, detailed explanations, or tutorials.
2354
+ > When verifying standards, checking code, or performing tasks, read the rules in \`.standards/\` — that is where this project's standards are installed.
2355
+ > Each file states its own requirements; read the one the task is about rather than all of them.
2346
2356
  > This ensures token efficiency and focused context.`,
2347
2357
  'zh-tw': `# GEMINI.md - Gemini CLI 規則
2348
2358
  # 由 Universal Dev Standards CLI 生成
@@ -2354,8 +2364,8 @@ All responses should be in **English**.
2354
2364
  所有回覆必須使用**繁體中文 (Traditional Chinese)**。
2355
2365
 
2356
2366
  ## 核心標準使用規則 / Core Standards Usage Rule
2357
- > 當驗證標準、檢查程式碼或執行任務時,**優先**讀取 \`core/\` 中的精簡規則(例如 \`core/testing-standards.md\`)。
2358
- > 只有在被明確要求提供教育內容、詳細解釋或教學時,才讀取 \`core/guides/\` 或 \`methodologies/guides/\`。
2367
+ > 當驗證標準、檢查程式碼或執行任務時,讀取 \`.standards/\` 裡的規則——那是本專案標準實際安裝的位置。
2368
+ > 每個檔案各自寫明它要求什麼;讀與當下任務相關的那一份,不必全部讀完。
2359
2369
  > 這確保了 Token 效率和上下文聚焦。`,
2360
2370
  bilingual: `# GEMINI.md - Gemini CLI Rules | Gemini CLI 規則
2361
2371
  # Generated by Universal Dev Standards CLI
@@ -2370,10 +2380,10 @@ All responses should be in **Traditional Chinese (繁體中文)**, with technica
2370
2380
  所有回覆必須使用**繁體中文**,技術術語可保留英文。
2371
2381
 
2372
2382
  ## Core Standards Usage Rule / 核心標準使用規則
2373
- > When verifying standards, checking code, or performing tasks, **PRIORITIZE** reading the concise rules in \`core/\` (e.g., \`core/testing-standards.md\`).
2374
- > 當驗證標準、檢查程式碼或執行任務時,**優先**讀取 \`core/\` 中的精簡規則(例如 \`core/testing-standards.md\`)。
2375
- > **ONLY** read \`core/guides/\` or \`methodologies/guides/\` when explicitly asked for educational content, detailed explanations, or tutorials.
2376
- > 只有在被明確要求提供教育內容、詳細解釋或教學時,才讀取 \`core/guides/\` 或 \`methodologies/guides/\`。
2383
+ > When verifying standards, checking code, or performing tasks, read the rules in \`.standards/\` — that is where this project's standards are installed.
2384
+ > 當驗證標準、檢查程式碼或執行任務時,讀取 \`.standards/\` 裡的規則——那是本專案標準實際安裝的位置。
2385
+ > Each file states its own requirements; read the one the task is about rather than all of them.
2386
+ > 每個檔案各自寫明它要求什麼;讀與當下任務相關的那一份,不必全部讀完。
2377
2387
  > This ensures token efficiency and focused context.
2378
2388
  > 這確保了 Token 效率和上下文聚焦。`
2379
2389
  },
@@ -2388,8 +2398,8 @@ You are an expert software engineer assistant. Follow these project standards.
2388
2398
  All responses should be in **English**.
2389
2399
 
2390
2400
  ## Core Standards Usage Rule
2391
- > When verifying standards, checking code, or performing tasks, **PRIORITIZE** reading the concise rules in \`core/\` (e.g., \`core/testing-standards.md\`).
2392
- > **ONLY** read \`core/guides/\` or \`methodologies/guides/\` when explicitly asked for educational content, detailed explanations, or tutorials.
2401
+ > When verifying standards, checking code, or performing tasks, read the rules in \`.standards/\` — that is where this project's standards are installed.
2402
+ > Each file states its own requirements; read the one the task is about rather than all of them.
2393
2403
  > This ensures token efficiency and focused context.`,
2394
2404
  'zh-tw': `# AGENTS.md - OpenCode 規則
2395
2405
  # 由 Universal Dev Standards CLI 生成
@@ -2401,8 +2411,8 @@ All responses should be in **English**.
2401
2411
  所有回覆必須使用**繁體中文 (Traditional Chinese)**。
2402
2412
 
2403
2413
  ## 核心標準使用規則 / Core Standards Usage Rule
2404
- > 當驗證標準、檢查程式碼或執行任務時,**優先**讀取 \`core/\` 中的精簡規則(例如 \`core/testing-standards.md\`)。
2405
- > 只有在被明確要求提供教育內容、詳細解釋或教學時,才讀取 \`core/guides/\` 或 \`methodologies/guides/\`。
2414
+ > 當驗證標準、檢查程式碼或執行任務時,讀取 \`.standards/\` 裡的規則——那是本專案標準實際安裝的位置。
2415
+ > 每個檔案各自寫明它要求什麼;讀與當下任務相關的那一份,不必全部讀完。
2406
2416
  > 這確保了 Token 效率和上下文聚焦。`,
2407
2417
  bilingual: `# AGENTS.md - OpenCode Rules | OpenCode 規則
2408
2418
  # Generated by Universal Dev Standards CLI
@@ -2417,10 +2427,10 @@ All responses should be in **Traditional Chinese (繁體中文)**, with technica
2417
2427
  所有回覆必須使用**繁體中文**,技術術語可保留英文。
2418
2428
 
2419
2429
  ## Core Standards Usage Rule / 核心標準使用規則
2420
- > When verifying standards, checking code, or performing tasks, **PRIORITIZE** reading the concise rules in \`core/\` (e.g., \`core/testing-standards.md\`).
2421
- > 當驗證標準、檢查程式碼或執行任務時,**優先**讀取 \`core/\` 中的精簡規則(例如 \`core/testing-standards.md\`)。
2422
- > **ONLY** read \`core/guides/\` or \`methodologies/guides/\` when explicitly asked for educational content, detailed explanations, or tutorials.
2423
- > 只有在被明確要求提供教育內容、詳細解釋或教學時,才讀取 \`core/guides/\` 或 \`methodologies/guides/\`。
2430
+ > When verifying standards, checking code, or performing tasks, read the rules in \`.standards/\` — that is where this project's standards are installed.
2431
+ > 當驗證標準、檢查程式碼或執行任務時,讀取 \`.standards/\` 裡的規則——那是本專案標準實際安裝的位置。
2432
+ > Each file states its own requirements; read the one the task is about rather than all of them.
2433
+ > 每個檔案各自寫明它要求什麼;讀與當下任務相關的那一份,不必全部讀完。
2424
2434
  > This ensures token efficiency and focused context.
2425
2435
  > 這確保了 Token 效率和上下文聚焦。`
2426
2436
  }
@@ -2736,6 +2746,86 @@ function generateWorkflowGateContent(language) {
2736
2746
  * @param {Object} config - Integration configuration
2737
2747
  * @returns {string} Generated content
2738
2748
  */
2749
+ /**
2750
+ * Point every `.standards/<file>` reference at the file this project actually has.
2751
+ *
2752
+ * `RULE_TEMPLATES` spells its references as `.standards/<name>.md` because that
2753
+ * is what UDS shipped when they were written. A project installed with
2754
+ * `--format ai` holds `<name>.ai.yaml`, so those lines named files that are not
2755
+ * there — reproduced on 6.9.0 (2026-09-16): a clean `--format ai` project got
2756
+ * `.standards/anti-hallucination.md` and `.standards/checkin-standards.md`, and
2757
+ * `uds check` called the file in sync because it compared names with the
2758
+ * extension stripped and never asked whether the file existed.
2759
+ *
2760
+ * Rewrites by stem against the installed set; a reference whose standard this
2761
+ * project did not install is dropped rather than left dangling, and if that
2762
+ * empties the line, the line goes too.
2763
+ *
2764
+ * @param {string} content - Generated integration content
2765
+ * @param {string[]} installedStandards - Manifest standards (IDs or paths)
2766
+ * @param {string} standardsFormat - 'ai' | 'human'
2767
+ * @returns {string}
2768
+ */
2769
+ function resolveStandardReferences(content, installedStandards = [], standardsFormat = 'ai', projectPath = null) {
2770
+ if (!content) return content;
2771
+
2772
+ const stemOf = (value) => basename(String(value)).replace(/\.(ai\.yaml|yaml|md)$/i, '');
2773
+ // Every stem UDS itself ships — the only references this function may delete.
2774
+ //
2775
+ // Read defensively: this runs inside pure content generation, and callers
2776
+ // (including this repo's own tests) may have the registry or `fs` mocked. A
2777
+ // registry that cannot be read means "delete nothing", which degrades to
2778
+ // rewriting matched paths only — never to removing a line.
2779
+ const udsOwnedStems = new Set();
2780
+ try {
2781
+ for (const std of getAllStandards()) {
2782
+ if (std?.id) udsOwnedStems.add(stemOf(std.id));
2783
+ const sources = typeof std?.source === 'string'
2784
+ ? [std.source]
2785
+ : [std?.source?.ai, std?.source?.human].filter(Boolean);
2786
+ for (const src of sources) udsOwnedStems.add(stemOf(src));
2787
+ }
2788
+ } catch {
2789
+ // Registry unavailable — keep every reference that does not match.
2790
+ }
2791
+
2792
+ const installedByStem = new Map();
2793
+ for (const entry of installedStandards) {
2794
+ const filename = resolveStandardFilename(entry, standardsFormat) || basename(String(entry));
2795
+ installedByStem.set(stemOf(entry), filename);
2796
+ installedByStem.set(stemOf(filename), filename);
2797
+ }
2798
+
2799
+ const referenceLine = /^([^\n]*(?:Reference|參考|参考)[::])([^\n]*)$/gim;
2800
+ return content.replace(referenceLine, (line, label, rest) => {
2801
+ let dropped = 0;
2802
+ let kept = 0;
2803
+ const rewritten = rest.replace(/(\.standards\/)([^\s,`)\]]+)/g, (match, prefix, path) => {
2804
+ // Option files live in `.standards/options/…` and are named by path, not ID.
2805
+ if (path.startsWith('options/')) { kept++; return match; }
2806
+ const actual = installedByStem.get(stemOf(path));
2807
+ if (actual) { kept++; return `${prefix}${actual}`; }
2808
+
2809
+ // 🔴 Only UDS's own standards may be dropped. The first version of this
2810
+ // rewrite removed every unmatched reference, which deleted a project's own
2811
+ // `.standards/our-house-rule.md` line — a file it had put there on purpose.
2812
+ // Removing a user's line is worse than the dead link this exists to fix.
2813
+ let onDisk = false;
2814
+ try {
2815
+ onDisk = Boolean(projectPath) && existsSync(join(projectPath, '.standards', path));
2816
+ } catch {
2817
+ onDisk = false;
2818
+ }
2819
+ if (onDisk || !udsOwnedStems.has(stemOf(path))) { kept++; return match; }
2820
+ dropped++;
2821
+ return '';
2822
+ });
2823
+ if (kept === 0 && dropped > 0) return '';
2824
+ // Tidy the separators left behind by a dropped path.
2825
+ return `${label}${rewritten.replace(/,\s*,/g, ',').replace(/[::]?\s*,\s*$/, '').replace(/\s+,/g, ',')}`;
2826
+ }).replace(/\n{3,}/g, '\n\n');
2827
+ }
2828
+
2739
2829
  export function generateIntegrationContent(config) {
2740
2830
  const {
2741
2831
  tool,
@@ -2890,7 +2980,8 @@ export function generateIntegrationContent(config) {
2890
2980
  sections.push('\n');
2891
2981
  }
2892
2982
 
2893
- return sections.join('\n').trim() + '\n';
2983
+ const assembled = sections.join('\n').trim() + '\n';
2984
+ return resolveStandardReferences(assembled, installedStandards, standardsFormat, config.projectPath || null);
2894
2985
  }
2895
2986
 
2896
2987
  /**
@@ -2973,6 +3064,19 @@ export function writeIntegrationFile(tool, config, projectPath) {
2973
3064
  }
2974
3065
  }
2975
3066
 
3067
+ // 🔴 The rule sections live OUTSIDE the markers, so a marker-based update
3068
+ // never refreshes them: a file first written by an older CLI kept
3069
+ // `.standards/commit-message-guide.md` for ever, and a regenerate on the
3070
+ // fixed generator still left it (measured 2026-09-16). Repoint stale
3071
+ // `.standards/` paths across the whole file — it touches nothing but the
3072
+ // paths, and a path to a file that is not there helps no reader.
3073
+ content = resolveStandardReferences(
3074
+ content,
3075
+ config.installedStandards || [],
3076
+ config.standardsFormat || 'ai',
3077
+ projectPath
3078
+ );
3079
+
2976
3080
  writeFileSync(filePath, content);
2977
3081
 
2978
3082
  // Compute block hash for tracking UDS content separately from user content
@@ -3201,9 +3305,19 @@ function withSelectedOptions(manifest) {
3201
3305
 
3202
3306
  export function buildToolIntegrationConfig(manifest, tool) {
3203
3307
  const selected = manifest.options?.output_language || manifest.options?.commit_language || 'english';
3204
- const language = selected === 'bilingual'
3308
+
3309
+ // Content language comes from `display_language` — the setting whose entire
3310
+ // job is "what language do you want to read" — and only falls back to
3311
+ // `output_language`, which is the commit-message language, when the project
3312
+ // has no display setting to go on. They are different questions: `uds init`
3313
+ // has always used the first, every regeneration path used the second, and a
3314
+ // project installed with `--locale zh-tw` therefore got Chinese instructions
3315
+ // from `init` and English ones from the next `uds update`, silently.
3316
+ const display = manifest.options?.display_language;
3317
+ const fromOutput = selected === 'bilingual'
3205
3318
  ? 'bilingual'
3206
3319
  : selected === 'traditional-chinese' ? 'zh-tw' : 'en';
3320
+ const language = ['en', 'zh-tw', 'bilingual'].includes(display) ? display : fromOutput;
3207
3321
  const resolved = resolveContentModeForTool(tool, manifest.contentMode || 'auto');
3208
3322
 
3209
3323
  return {
@@ -3431,6 +3545,7 @@ export function generateAgentsMdSummary(config = {}) {
3431
3545
  language = 'en',
3432
3546
  outputLanguage = 'english',
3433
3547
  standardOptions = {},
3548
+ standardsFormat = 'ai',
3434
3549
  projectPath
3435
3550
  } = config;
3436
3551
 
@@ -3523,12 +3638,25 @@ export function generateAgentsMdSummary(config = {}) {
3523
3638
  // only the option files. On one adopter that meant seven lines standing in
3524
3639
  // for seventy, under a heading reading "Installed Standards", with nothing
3525
3640
  // anywhere reporting the sixty-three that had been dropped.
3526
- const resolved = installedStandards
3527
- .map((s) => resolveStandardFilename(s, 'ai'))
3528
- .filter((name) => name?.endsWith('.ai.yaml'));
3529
-
3530
- for (const filename of resolved) {
3531
- lines.push(`- \`.standards/${filename}\` — ${filename.replace('.ai.yaml', '')}`);
3641
+ // Two things this used to get wrong, both of which produced a list of paths
3642
+ // that are not there — under a heading telling the agent to read them.
3643
+ //
3644
+ // Options install one directory deeper (`.standards/options/…`), and this
3645
+ // wrote every entry at the top level. The sibling renderer in this file has
3646
+ // always handled that; the docblock above it says a previous fix reached
3647
+ // "one of the two producers", and this is the other one.
3648
+ //
3649
+ // And the format was pinned to `ai`, so a `--format human` project was
3650
+ // handed `.ai.yaml` names for files it holds as `.md`.
3651
+ const format = standardsFormat === 'human' ? 'human' : 'ai';
3652
+ const suffix = format === 'human' ? '.md' : '.ai.yaml';
3653
+
3654
+ for (const entry of installedStandards) {
3655
+ const filename = resolveStandardFilename(entry, format);
3656
+ if (!filename?.endsWith(suffix)) continue;
3657
+ const isOption = entry.includes('/options/') || entry.includes('\\options\\');
3658
+ const dir = isOption ? '.standards/options' : '.standards';
3659
+ lines.push(`- \`${dir}/${filename}\` — ${filename.replace(suffix, '')}`);
3532
3660
  }
3533
3661
  } else {
3534
3662
  lines.push('No standards installed yet. Run `npx uds init` to install.');