universal-dev-standards 6.7.5 → 6.9.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 (213) hide show
  1. package/bin/uds.js +19 -2
  2. package/bundled/ai/standards/acceptance-criteria-traceability.ai.yaml +14 -2
  3. package/bundled/ai/standards/adr-standards.ai.yaml +14 -2
  4. package/bundled/ai/standards/ai-instruction-standards.ai.yaml +6 -6
  5. package/bundled/ai/standards/code-review.ai.yaml +13 -3
  6. package/bundled/ai/standards/commit-message.ai.yaml +8 -4
  7. package/bundled/ai/standards/deferred-item-exit.ai.yaml +225 -0
  8. package/bundled/ai/standards/feature-discovery-standards.ai.yaml +14 -2
  9. package/bundled/ai/standards/governance-layer.ai.yaml +128 -2
  10. package/bundled/ai/standards/logging.ai.yaml +2 -2
  11. package/bundled/ai/standards/retrospective-standards.ai.yaml +14 -2
  12. package/bundled/ai/standards/reverse-engineering-standards.ai.yaml +73 -2
  13. package/bundled/ai/standards/security-standards.ai.yaml +2 -2
  14. package/bundled/ai/standards/spec-driven-development.ai.yaml +14 -2
  15. package/bundled/ai/standards/tech-debt-standards.ai.yaml +87 -3
  16. package/bundled/ai/standards/turn-completion-integrity.ai.yaml +131 -0
  17. package/bundled/core/acceptance-criteria-traceability.md +5 -2
  18. package/bundled/core/adr-standards.md +26 -2
  19. package/bundled/core/ai-instruction-standards.md +9 -7
  20. package/bundled/core/code-review-checklist.md +5 -2
  21. package/bundled/core/context-aware-loading.md +1 -1
  22. package/bundled/core/deferred-item-exit.md +254 -0
  23. package/bundled/core/feature-discovery-standards.md +5 -1
  24. package/bundled/core/governance-layer.md +114 -2
  25. package/bundled/core/retrospective-standards.md +4 -2
  26. package/bundled/core/reverse-engineering-standards.md +81 -2
  27. package/bundled/core/spec-driven-development.md +8 -2
  28. package/bundled/core/tech-debt-standards.md +67 -8
  29. package/bundled/core/turn-completion-integrity.md +196 -0
  30. package/bundled/hooks/check-dangerous-cmd.mjs +60 -0
  31. package/bundled/hooks/check-logging-standard.mjs +59 -0
  32. package/bundled/hooks/check-turn-completion.mjs +233 -0
  33. package/bundled/hooks/inject-standards.mjs +183 -0
  34. package/bundled/hooks/telemetry-wrapper.mjs +77 -0
  35. package/bundled/hooks/turn-completion/detect.mjs +99 -0
  36. package/bundled/hooks/turn-completion/locales/en.mjs +159 -0
  37. package/bundled/hooks/turn-completion/locales/zh-TW.mjs +166 -0
  38. package/bundled/hooks/validate-commit-msg.mjs +104 -0
  39. package/bundled/locales/zh-CN/CHANGELOG.md +65 -3
  40. package/bundled/locales/zh-CN/CLAUDE.md +1 -1
  41. package/bundled/locales/zh-CN/README.md +7 -7
  42. package/bundled/locales/zh-CN/SECURITY.md +1 -1
  43. package/bundled/locales/zh-CN/core/adr-standards.md +1 -1
  44. package/bundled/locales/zh-CN/core/ai-instruction-standards.md +10 -8
  45. package/bundled/locales/zh-CN/core/governance-layer.md +118 -6
  46. package/bundled/locales/zh-CN/core/retrospective-standards.md +1 -1
  47. package/bundled/locales/zh-CN/core/tech-debt-standards.md +71 -4
  48. package/bundled/locales/zh-CN/core/turn-completion-integrity.md +190 -0
  49. package/bundled/locales/zh-CN/docs/CHEATSHEET.md +27 -6
  50. package/bundled/locales/zh-CN/docs/CLI-INIT-OPTIONS.md +29 -68
  51. package/bundled/locales/zh-CN/docs/FEATURE-REFERENCE.md +172 -24
  52. package/bundled/locales/zh-CN/docs/USAGE-MODES-COMPARISON.md +1 -2
  53. package/bundled/locales/zh-CN/integrations/google-antigravity/{INSTRUCTIONS.md → AGENTS.md} +1 -1
  54. package/bundled/locales/zh-CN/integrations/google-antigravity/README.md +3 -3
  55. package/bundled/locales/zh-CN/skills/agents/README.md +1 -1
  56. package/bundled/locales/zh-CN/skills/atdd-assistant/SKILL.md +2 -0
  57. package/bundled/locales/zh-CN/skills/bdd-assistant/SKILL.md +2 -0
  58. package/bundled/locales/zh-CN/skills/brainstorm-assistant/SKILL.md +22 -12
  59. package/bundled/locales/zh-CN/skills/brainstorm-assistant/guide.md +12 -9
  60. package/bundled/locales/zh-CN/skills/code-review-assistant/SKILL.md +1 -0
  61. package/bundled/locales/zh-CN/skills/commands/brainstorm.md +17 -13
  62. package/bundled/locales/zh-CN/skills/commands/config.md +0 -1
  63. package/bundled/locales/zh-CN/skills/commands/init.md +1 -2
  64. package/bundled/locales/zh-CN/skills/commit-standards/SKILL.md +2 -0
  65. package/bundled/locales/zh-CN/skills/contract-test-assistant/SKILL.md +1 -0
  66. package/bundled/locales/zh-CN/skills/dev-methodology/SKILL.md +2 -0
  67. package/bundled/locales/zh-CN/skills/observability-assistant/SKILL.md +1 -0
  68. package/bundled/locales/zh-CN/skills/project-structure-guide/SKILL.md +1 -0
  69. package/bundled/locales/zh-CN/skills/release-standards/SKILL.md +3 -0
  70. package/bundled/locales/zh-CN/skills/requirement-assistant/SKILL.md +2 -0
  71. package/bundled/locales/zh-CN/skills/reverse-engineer/SKILL.md +3 -0
  72. package/bundled/locales/zh-CN/skills/reverse-engineer/tdd-analysis.md +13 -23
  73. package/bundled/locales/zh-CN/skills/runbook-assistant/SKILL.md +1 -0
  74. package/bundled/locales/zh-CN/skills/slo-assistant/SKILL.md +1 -0
  75. package/bundled/locales/zh-CN/skills/tdd-assistant/SKILL.md +2 -0
  76. package/bundled/locales/zh-CN/skills/workflows/README.md +2 -11
  77. package/bundled/locales/zh-TW/CHANGELOG.md +65 -3
  78. package/bundled/locales/zh-TW/CLAUDE.md +1 -1
  79. package/bundled/locales/zh-TW/README.md +7 -7
  80. package/bundled/locales/zh-TW/SECURITY.md +1 -1
  81. package/bundled/locales/zh-TW/core/acceptance-criteria-traceability.md +2 -0
  82. package/bundled/locales/zh-TW/core/adr-standards.md +26 -5
  83. package/bundled/locales/zh-TW/core/ai-instruction-standards.md +10 -8
  84. package/bundled/locales/zh-TW/core/code-review-checklist.md +2 -0
  85. package/bundled/locales/zh-TW/core/container-image-standards.md +2 -2
  86. package/bundled/locales/zh-TW/core/contract-testing-standards.md +2 -2
  87. package/bundled/locales/zh-TW/core/cross-flow-regression.md +8 -7
  88. package/bundled/locales/zh-TW/core/data-contract.md +2 -2
  89. package/bundled/locales/zh-TW/core/data-migration-testing.md +2 -2
  90. package/bundled/locales/zh-TW/core/data-pipeline.md +2 -2
  91. package/bundled/locales/zh-TW/core/deferred-item-exit.md +251 -0
  92. package/bundled/locales/zh-TW/core/documentation-writing-standards.md +228 -3
  93. package/bundled/locales/zh-TW/core/full-coverage-testing.md +15 -2
  94. package/bundled/locales/zh-TW/core/governance-layer.md +118 -5
  95. package/bundled/locales/zh-TW/core/iac-design-principles.md +2 -2
  96. package/bundled/locales/zh-TW/core/incident-response.md +2 -2
  97. package/bundled/locales/zh-TW/core/model-provenance.md +4 -2
  98. package/bundled/locales/zh-TW/core/pii-classification.md +42 -6
  99. package/bundled/locales/zh-TW/core/prd-standards.md +4 -2
  100. package/bundled/locales/zh-TW/core/product-metrics-standards.md +4 -2
  101. package/bundled/locales/zh-TW/core/release-readiness-gate.md +2 -2
  102. package/bundled/locales/zh-TW/core/resource-cost-boundary.md +2 -2
  103. package/bundled/locales/zh-TW/core/retrospective-standards.md +5 -3
  104. package/bundled/locales/zh-TW/core/reverse-engineering-standards.md +83 -5
  105. package/bundled/locales/zh-TW/core/runbook.md +2 -2
  106. package/bundled/locales/zh-TW/core/schema-evolution.md +2 -2
  107. package/bundled/locales/zh-TW/core/secret-management-standards.md +2 -2
  108. package/bundled/locales/zh-TW/core/slo-sli.md +2 -2
  109. package/bundled/locales/zh-TW/core/spec-driven-development.md +2 -0
  110. package/bundled/locales/zh-TW/core/tech-debt-standards.md +71 -4
  111. package/bundled/locales/zh-TW/core/turn-completion-integrity.md +190 -0
  112. package/bundled/locales/zh-TW/core/user-journey-testing.md +2 -2
  113. package/bundled/locales/zh-TW/core/user-story-mapping.md +2 -2
  114. package/bundled/locales/zh-TW/core/verification-oracle.md +2 -2
  115. package/bundled/locales/zh-TW/docs/CHEATSHEET.md +27 -6
  116. package/bundled/locales/zh-TW/docs/CLI-INIT-OPTIONS.md +29 -68
  117. package/bundled/locales/zh-TW/docs/FEATURE-REFERENCE.md +172 -24
  118. package/bundled/locales/zh-TW/docs/USAGE-MODES-COMPARISON.md +1 -2
  119. package/bundled/locales/zh-TW/integrations/google-antigravity/{INSTRUCTIONS.md → AGENTS.md} +1 -1
  120. package/bundled/locales/zh-TW/integrations/google-antigravity/README.md +3 -3
  121. package/bundled/locales/zh-TW/skills/adr-assistant/SKILL.md +1 -1
  122. package/bundled/locales/zh-TW/skills/agents/README.md +1 -1
  123. package/bundled/locales/zh-TW/skills/atdd-assistant/SKILL.md +2 -0
  124. package/bundled/locales/zh-TW/skills/bdd-assistant/SKILL.md +2 -0
  125. package/bundled/locales/zh-TW/skills/brainstorm-assistant/SKILL.md +22 -12
  126. package/bundled/locales/zh-TW/skills/brainstorm-assistant/guide.md +12 -9
  127. package/bundled/locales/zh-TW/skills/code-review-assistant/SKILL.md +1 -0
  128. package/bundled/locales/zh-TW/skills/commands/brainstorm.md +17 -13
  129. package/bundled/locales/zh-TW/skills/commands/config.md +0 -1
  130. package/bundled/locales/zh-TW/skills/commands/init.md +1 -2
  131. package/bundled/locales/zh-TW/skills/commit-standards/SKILL.md +2 -0
  132. package/bundled/locales/zh-TW/skills/contract-test-assistant/SKILL.md +2 -1
  133. package/bundled/locales/zh-TW/skills/dev-methodology/SKILL.md +2 -0
  134. package/bundled/locales/zh-TW/skills/dev-workflow-guide/SKILL.md +1 -1
  135. package/bundled/locales/zh-TW/skills/knowledge-graph/guide.md +2 -2
  136. package/bundled/locales/zh-TW/skills/migration-assistant/SKILL.md +1 -1
  137. package/bundled/locales/zh-TW/skills/observability-assistant/SKILL.md +1 -0
  138. package/bundled/locales/zh-TW/skills/project-discovery/SKILL.md +1 -0
  139. package/bundled/locales/zh-TW/skills/project-structure-guide/SKILL.md +1 -0
  140. package/bundled/locales/zh-TW/skills/release-standards/SKILL.md +3 -0
  141. package/bundled/locales/zh-TW/skills/requirement-assistant/SKILL.md +2 -0
  142. package/bundled/locales/zh-TW/skills/reverse-engineer/SKILL.md +3 -0
  143. package/bundled/locales/zh-TW/skills/reverse-engineer/tdd-analysis.md +13 -23
  144. package/bundled/locales/zh-TW/skills/runbook-assistant/SKILL.md +1 -0
  145. package/bundled/locales/zh-TW/skills/slo-assistant/SKILL.md +1 -0
  146. package/bundled/locales/zh-TW/skills/tdd-assistant/SKILL.md +2 -0
  147. package/bundled/locales/zh-TW/skills/workflows/README.md +2 -11
  148. package/bundled/skills/agents/README.md +1 -1
  149. package/bundled/skills/atdd-assistant/SKILL.md +2 -0
  150. package/bundled/skills/bdd-assistant/SKILL.md +2 -0
  151. package/bundled/skills/brainstorm-assistant/SKILL.md +31 -13
  152. package/bundled/skills/brainstorm-assistant/guide.md +9 -6
  153. package/bundled/skills/code-review-assistant/SKILL.md +1 -0
  154. package/bundled/skills/commands/brainstorm.md +12 -9
  155. package/bundled/skills/commands/config.md +0 -1
  156. package/bundled/skills/commands/init.md +2 -3
  157. package/bundled/skills/commit-standards/SKILL.md +2 -0
  158. package/bundled/skills/contract-test-assistant/SKILL.md +1 -0
  159. package/bundled/skills/dev-methodology/SKILL.md +4 -0
  160. package/bundled/skills/observability-assistant/SKILL.md +1 -0
  161. package/bundled/skills/project-discovery/SKILL.md +1 -0
  162. package/bundled/skills/project-structure-guide/SKILL.md +1 -0
  163. package/bundled/skills/release-standards/SKILL.md +3 -0
  164. package/bundled/skills/requirement-assistant/SKILL.md +2 -0
  165. package/bundled/skills/reverse-engineer/SKILL.md +3 -0
  166. package/bundled/skills/reverse-engineer/tdd-analysis.md +16 -23
  167. package/bundled/skills/runbook-assistant/SKILL.md +1 -0
  168. package/bundled/skills/slo-assistant/SKILL.md +1 -0
  169. package/bundled/skills/tdd-assistant/SKILL.md +2 -0
  170. package/bundled/skills/workflows/README.md +2 -11
  171. package/bundled/templates/.ai-context.yaml.template +194 -0
  172. package/bundled/templates/CLAUDE.md.template +145 -0
  173. package/bundled/templates/DESIGN.md +237 -0
  174. package/bundled/templates/SKILL-BRIEF-TEMPLATE.md +57 -0
  175. package/bundled/templates/SKILL-CANDIDATES.md +39 -0
  176. package/bundled/templates/gates/check-error-exit.mjs +309 -0
  177. package/bundled/templates/mcp-config.json +10 -0
  178. package/bundled/templates/methodology-template.yaml +209 -0
  179. package/bundled/templates/migration-template.md +408 -0
  180. package/bundled/templates/requirement-checklist.md +410 -0
  181. package/bundled/templates/requirement-document-template.md +591 -0
  182. package/bundled/templates/requirement-template.md +881 -0
  183. package/bundled/templates/reverse-spec-template.md +409 -0
  184. package/bundled/templates/test-case-template.md +74 -0
  185. package/bundled/templates/test-plan-template.md +74 -0
  186. package/package.json +9 -5
  187. package/src/commands/audit.js +82 -0
  188. package/src/commands/check.js +66 -10
  189. package/src/commands/init.js +161 -16
  190. package/src/commands/lint.js +96 -0
  191. package/src/commands/quickstart.js +16 -13
  192. package/src/commands/update.js +286 -14
  193. package/src/compilers/claude-code-compiler.js +4 -1
  194. package/src/config/ai-agent-paths.js +62 -17
  195. package/src/core/constants.js +42 -11
  196. package/src/core/manifest.js +201 -3
  197. package/src/core/paths.js +2 -2
  198. package/src/i18n/messages.js +9 -32
  199. package/src/installers/hooks-installer.js +167 -75
  200. package/src/installers/integration-installer.js +9 -5
  201. package/src/prompts/init.js +14 -14
  202. package/src/reconciler/actual-state-scanner.js +14 -3
  203. package/src/utils/detector.js +21 -1
  204. package/src/utils/effect-boundary.js +1093 -0
  205. package/src/utils/hasher.js +229 -9
  206. package/src/utils/hook-stats.js +1 -1
  207. package/src/utils/integration-generator.js +100 -4
  208. package/src/utils/reference-sync.js +4 -1
  209. package/src/utils/skills-installer.js +17 -3
  210. package/src/utils/spec-linter.js +35 -76
  211. package/src/utils/yaml-generator.js +51 -9
  212. package/standards-registry.json +31 -8
  213. package/src/commands/sync.js +0 -133
@@ -4,8 +4,44 @@
4
4
  * Generates AI-optimized YAML from parsed Markdown structure.
5
5
  */
6
6
 
7
+ import { execFileSync } from 'node:child_process';
8
+ import { fileURLToPath } from 'node:url';
9
+ import { dirname, resolve } from 'node:path';
10
+
7
11
  import { SECTION_MAPPINGS, STANDARD_ID_MAPPING } from './conversion-rules.js';
8
12
 
13
+ const __filename = fileURLToPath(import.meta.url);
14
+ const __dirname = dirname(__filename);
15
+ // cli/src/utils/yaml-generator.js -> cli/src/utils -> cli/src -> cli -> repo root
16
+ const REPO_ROOT = resolve(__dirname, '../../..');
17
+
18
+ /**
19
+ * XSPEC-392 R2: `meta.updated` must reflect when the source file's content
20
+ * actually last changed, not a hand-typed `**Last Updated**` line (which can
21
+ * go stale relative to the file it lives in), and — this is the part that is
22
+ * not negotiable — never a `new Date()` value standing in for "the day this
23
+ * script happened to run".
24
+ *
25
+ * Returns an ISO date (YYYY-MM-DD) from git history for `relativeSourcePath`,
26
+ * or `null` when git has no record for it (untracked/new file, git missing,
27
+ * or any other failure). A missing `updated` field is honest; a fabricated
28
+ * one is not — so callers must omit the field entirely rather than fall back
29
+ * to any other date source.
30
+ */
31
+ function getGitLastModifiedDate(relativeSourcePath) {
32
+ if (!relativeSourcePath) return null;
33
+ try {
34
+ const out = execFileSync(
35
+ 'git',
36
+ ['log', '-1', '--format=%ad', '--date=short', '--', relativeSourcePath],
37
+ { cwd: REPO_ROOT, encoding: 'utf-8', stdio: ['ignore', 'pipe', 'ignore'] }
38
+ ).trim();
39
+ return out || null;
40
+ } catch {
41
+ return null;
42
+ }
43
+ }
44
+
9
45
  /**
10
46
  * Generate AI-YAML structure from parsed Markdown
11
47
  * @param {Object} parsed - Parsed Markdown structure from md-parser
@@ -18,16 +54,22 @@ export function generateAiYaml(parsed, options = {}) {
18
54
  // Generate ID
19
55
  const id = generateStandardId(filename, parsed.metadata.title);
20
56
 
21
- // Build YAML structure
22
- const yaml = {
23
- id,
24
- meta: {
25
- version: parsed.metadata.version || '1.0.0',
26
- updated: parsed.metadata.updated || new Date().toISOString().split('T')[0],
27
- source: inferSourcePath(filename, locale),
28
- description: parsed.purpose || parsed.metadata.title || ''
29
- }
57
+ const sourcePath = inferSourcePath(filename, locale);
58
+
59
+ // Build YAML structure. `updated` is set from git history below, and is
60
+ // deliberately absent (not null) when git has no record for the file —
61
+ // see getGitLastModifiedDate.
62
+ const meta = {
63
+ version: parsed.metadata.version || '1.0.0'
30
64
  };
65
+ const gitUpdated = getGitLastModifiedDate(sourcePath);
66
+ if (gitUpdated) {
67
+ meta.updated = gitUpdated;
68
+ }
69
+ meta.source = sourcePath;
70
+ meta.description = parsed.purpose || parsed.metadata.title || '';
71
+
72
+ const yaml = { id, meta };
31
73
 
32
74
  // Add language if locale specified
33
75
  if (locale) {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "$schema": "https://json-schema.org/draft/2020-12/schema",
3
- "version": "6.7.5",
3
+ "version": "6.9.0",
4
4
  "lastUpdated": "2026-05-13",
5
5
  "description": "Standards registry for universal-dev-standards with integrated skills and AI-optimized formats",
6
6
  "formats": {
@@ -58,14 +58,14 @@
58
58
  "standards": {
59
59
  "name": "universal-dev-standards",
60
60
  "url": "https://github.com/AsiaOstrich/universal-dev-standards",
61
- "version": "6.7.5"
61
+ "version": "6.9.0"
62
62
  },
63
63
  "skills": {
64
64
  "name": "universal-dev-standards",
65
65
  "url": "https://github.com/AsiaOstrich/universal-dev-standards",
66
66
  "localPath": "skills",
67
67
  "rawUrl": "https://raw.githubusercontent.com/AsiaOstrich/universal-dev-standards/main/skills",
68
- "version": "6.7.5",
68
+ "version": "6.9.0",
69
69
  "note": "Skills are now included in the main repository under skills/"
70
70
  }
71
71
  },
@@ -736,6 +736,17 @@
736
736
  "category": "core",
737
737
  "description": "Four behavioral disciplines for AI agents: Ask (surface assumptions), Simple (minimum code), Precision (scope only what's needed), Test (loop until verified)"
738
738
  },
739
+ {
740
+ "id": "turn-completion-integrity",
741
+ "name": "Turn Completion Integrity",
742
+ "nameZh": "回合收尾完整性標準",
743
+ "source": {
744
+ "human": "core/turn-completion-integrity.md",
745
+ "ai": "ai/standards/turn-completion-integrity.ai.yaml"
746
+ },
747
+ "category": "core",
748
+ "description": "An agent must not end a turn having stated a next action it did not take; enforced at turn end by a Stop hook, with a per-language corpus that runs in CI"
749
+ },
739
750
  {
740
751
  "id": "ai-friendly-architecture",
741
752
  "name": "AI-Friendly Architecture",
@@ -1569,7 +1580,7 @@
1569
1580
  "id": "antigravity-integration",
1570
1581
  "name": "Google Antigravity Instructions",
1571
1582
  "nameZh": "Google Antigravity 指令",
1572
- "source": "integrations/google-antigravity/INSTRUCTIONS.md",
1583
+ "source": "integrations/google-antigravity/AGENTS.md",
1573
1584
  "category": "integration",
1574
1585
  "skillName": null,
1575
1586
  "description": "System prompt snippets for Google Antigravity agent",
@@ -1766,6 +1777,18 @@
1766
1777
  "skillName": null,
1767
1778
  "description": "Aim a fix at the set, not the member. Walk the set from the source the system reads, never from a typed list; print the denominator and what was excluded; prove the check non-vacuous per sub-set"
1768
1779
  },
1780
+ {
1781
+ "id": "deferred-item-exit",
1782
+ "name": "Deferred Item Exit Standard",
1783
+ "nameZh": "延後項目出口標準",
1784
+ "source": {
1785
+ "human": "core/deferred-item-exit.md",
1786
+ "ai": "ai/standards/deferred-item-exit.ai.yaml"
1787
+ },
1788
+ "category": "reference",
1789
+ "skillName": null,
1790
+ "description": "A deferred item must leave the document: a traceable exit outside it, identified beside the item. The carrier is deliberately unspecified. A present link is not a working link — verified and unverified links are two states, never one green. Anchor on document structure, not wording"
1791
+ },
1769
1792
  {
1770
1793
  "id": "verification-evidence",
1771
1794
  "name": "Verification Evidence Standard",
@@ -2260,7 +2283,7 @@
2260
2283
  "id": "license-compliance",
2261
2284
  "name": "License Compliance Standards",
2262
2285
  "nameZh": "授權合規標準",
2263
- "version": "6.7.5",
2286
+ "version": "6.9.0",
2264
2287
  "source": {
2265
2288
  "human": "core/license-compliance.md",
2266
2289
  "ai": "ai/standards/license-compliance.ai.yaml"
@@ -2272,7 +2295,7 @@
2272
2295
  "id": "verification-oracle",
2273
2296
  "name": "Verification Oracle Standards",
2274
2297
  "nameZh": "驗證 Oracle 標準",
2275
- "version": "6.7.5",
2298
+ "version": "6.9.0",
2276
2299
  "source": {
2277
2300
  "human": "core/verification-oracle.md",
2278
2301
  "ai": "ai/standards/verification-oracle.ai.yaml"
@@ -2284,7 +2307,7 @@
2284
2307
  "id": "model-provenance",
2285
2308
  "name": "Model Provenance Policy Standards",
2286
2309
  "nameZh": "模型來源政策標準",
2287
- "version": "6.7.5",
2310
+ "version": "6.9.0",
2288
2311
  "source": {
2289
2312
  "human": "core/model-provenance.md",
2290
2313
  "ai": "ai/standards/model-provenance.ai.yaml"
@@ -2296,7 +2319,7 @@
2296
2319
  "id": "resource-cost-boundary",
2297
2320
  "name": "Resource / Cost Boundary Declaration Standards",
2298
2321
  "nameZh": "資源/成本邊界宣告標準",
2299
- "version": "6.7.5",
2322
+ "version": "6.9.0",
2300
2323
  "source": {
2301
2324
  "human": "core/resource-cost-boundary.md",
2302
2325
  "ai": "ai/standards/resource-cost-boundary.ai.yaml"
@@ -1,133 +0,0 @@
1
- /**
2
- * Sync Command — Export current work context for session resume
3
- * Zero AI tokens — pure shell/JS execution
4
- *
5
- * @module commands/sync
6
- * @see specs/superspec-borrowing-phase1-2-spec.md (AC-16, AC-17)
7
- */
8
-
9
- import { execSync } from 'child_process';
10
- import { readFileSync, writeFileSync, existsSync, readdirSync, mkdirSync } from 'fs';
11
- import { join } from 'path';
12
-
13
- const MAX_LINES = 500;
14
-
15
- /**
16
- * Generate context.md from git info and optional workflow state
17
- * @param {string} projectPath - Project root directory
18
- * @returns {string} Path to generated context.md
19
- */
20
- export function generateContext(projectPath) {
21
- const lines = [];
22
-
23
- lines.push('# Development Context');
24
- lines.push(`> Auto-generated by \`uds sync\` at ${new Date().toISOString()}`);
25
- lines.push('> This file helps restore context in a new AI session.');
26
- lines.push('');
27
-
28
- // ─── Git Status ───
29
- lines.push('## Git Status');
30
- lines.push('');
31
-
32
- const branch = gitCmd('git rev-parse --abbrev-ref HEAD', projectPath);
33
- lines.push(`- **Branch**: ${branch}`);
34
-
35
- const baseBranch = detectBaseBranch(projectPath);
36
- if (baseBranch && baseBranch !== branch) {
37
- const commitCount = gitCmd(`git rev-list --count ${baseBranch}..HEAD`, projectPath) || '0';
38
- lines.push(`- **Base**: ${baseBranch} (+${commitCount} commits)`);
39
- }
40
-
41
- lines.push('');
42
- lines.push('### Recent Commits');
43
- lines.push('');
44
-
45
- const logOutput = gitCmd('git log --oneline -20', projectPath);
46
- if (logOutput) {
47
- lines.push(...logOutput.split('\n').map(l => `- ${l}`));
48
- } else {
49
- lines.push('(no commits)');
50
- }
51
- lines.push('');
52
-
53
- lines.push('### Changed Files');
54
- lines.push('');
55
-
56
- if (baseBranch && baseBranch !== branch) {
57
- const diffStat = gitCmd(`git diff --stat ${baseBranch}..HEAD`, projectPath);
58
- if (diffStat) {
59
- lines.push('```');
60
- lines.push(...diffStat.split('\n'));
61
- lines.push('```');
62
- }
63
- } else {
64
- lines.push('(on base branch, no diff)');
65
- }
66
- lines.push('');
67
-
68
- // ─── Workflow State ───
69
- const workflowState = readWorkflowState(projectPath);
70
- if (workflowState) {
71
- lines.push('## Workflow State');
72
- lines.push('');
73
- lines.push(...workflowState);
74
- lines.push('');
75
- }
76
-
77
- // Truncate to MAX_LINES
78
- const truncated = lines.slice(0, MAX_LINES);
79
-
80
- // Write to .workflow-state/context.md
81
- const outputDir = join(projectPath, '.workflow-state');
82
- mkdirSync(outputDir, { recursive: true });
83
- const outputPath = join(outputDir, 'context.md');
84
- writeFileSync(outputPath, truncated.join('\n'), 'utf-8');
85
-
86
- return outputPath;
87
- }
88
-
89
- // ─── Helpers ───
90
-
91
- function gitCmd(cmd, cwd) {
92
- try {
93
- return execSync(cmd, { cwd, encoding: 'utf-8', stdio: ['pipe', 'pipe', 'ignore'] }).trim();
94
- } catch {
95
- return '';
96
- }
97
- }
98
-
99
- function detectBaseBranch(projectPath) {
100
- // Check for common base branches
101
- for (const name of ['main', 'master']) {
102
- const exists = gitCmd(`git rev-parse --verify ${name}`, projectPath);
103
- if (exists) return name;
104
- }
105
- return null;
106
- }
107
-
108
- function readWorkflowState(projectPath) {
109
- const stateDir = join(projectPath, '.workflow-state');
110
- if (!existsSync(stateDir)) return null;
111
-
112
- const yamlFiles = readdirSync(stateDir)
113
- .filter(f => f.endsWith('.yaml') && !f.endsWith('.log.yaml'))
114
- .sort();
115
-
116
- if (yamlFiles.length === 0) return null;
117
-
118
- // Read the most recent state file
119
- const latestFile = yamlFiles[yamlFiles.length - 1];
120
- const content = readFileSync(join(stateDir, latestFile), 'utf-8');
121
-
122
- const lines = [];
123
- // Extract key fields
124
- const specMatch = content.match(/spec_id:\s*(.+)/);
125
- const phaseMatch = content.match(/current_phase:\s*(.+)/);
126
- const statusMatch = content.match(/status:\s*(.+)/);
127
-
128
- if (specMatch) lines.push(`- **Spec**: ${specMatch[1].trim()}`);
129
- if (phaseMatch) lines.push(`- **Phase**: ${phaseMatch[1].trim()}`);
130
- if (statusMatch) lines.push(`- **Status**: ${statusMatch[1].trim()}`);
131
-
132
- return lines.length > 0 ? lines : null;
133
- }