@h2nguyen/arc42-node-mcp-server 1.0.3 → 2.0.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 (190) hide show
  1. package/CHANGELOG.md +41 -0
  2. package/README.md +222 -11
  3. package/dist/server.d.ts.map +1 -1
  4. package/dist/server.js +28 -72
  5. package/dist/server.js.map +1 -1
  6. package/dist/templates/index.d.ts +46 -1
  7. package/dist/templates/index.d.ts.map +1 -1
  8. package/dist/templates/index.js +63 -896
  9. package/dist/templates/index.js.map +1 -1
  10. package/dist/templates/locales/cz/index.d.ts +9 -0
  11. package/dist/templates/locales/cz/index.d.ts.map +1 -0
  12. package/dist/templates/locales/cz/index.js +29 -0
  13. package/dist/templates/locales/cz/index.js.map +1 -0
  14. package/dist/templates/locales/cz/sections.d.ts +10 -0
  15. package/dist/templates/locales/cz/sections.d.ts.map +1 -0
  16. package/dist/templates/locales/cz/sections.js +39 -0
  17. package/dist/templates/locales/cz/sections.js.map +1 -0
  18. package/dist/templates/locales/cz/templates.d.ts +9 -0
  19. package/dist/templates/locales/cz/templates.d.ts.map +1 -0
  20. package/dist/templates/locales/cz/templates.js +274 -0
  21. package/dist/templates/locales/cz/templates.js.map +1 -0
  22. package/dist/templates/locales/de/index.d.ts +26 -0
  23. package/dist/templates/locales/de/index.d.ts.map +1 -0
  24. package/dist/templates/locales/de/index.js +53 -0
  25. package/dist/templates/locales/de/index.js.map +1 -0
  26. package/dist/templates/locales/de/sections.d.ts +28 -0
  27. package/dist/templates/locales/de/sections.d.ts.map +1 -0
  28. package/dist/templates/locales/de/sections.js +57 -0
  29. package/dist/templates/locales/de/sections.js.map +1 -0
  30. package/dist/templates/locales/de/templates.d.ts +22 -0
  31. package/dist/templates/locales/de/templates.d.ts.map +1 -0
  32. package/dist/templates/locales/de/templates.js +1060 -0
  33. package/dist/templates/locales/de/templates.js.map +1 -0
  34. package/dist/templates/locales/en/index.d.ts +26 -0
  35. package/dist/templates/locales/en/index.d.ts.map +1 -0
  36. package/dist/templates/locales/en/index.js +53 -0
  37. package/dist/templates/locales/en/index.js.map +1 -0
  38. package/dist/templates/locales/en/sections.d.ts +25 -0
  39. package/dist/templates/locales/en/sections.d.ts.map +1 -0
  40. package/dist/templates/locales/en/sections.js +54 -0
  41. package/dist/templates/locales/en/sections.js.map +1 -0
  42. package/dist/templates/locales/en/templates.d.ts +22 -0
  43. package/dist/templates/locales/en/templates.d.ts.map +1 -0
  44. package/dist/templates/locales/en/templates.js +1060 -0
  45. package/dist/templates/locales/en/templates.js.map +1 -0
  46. package/dist/templates/locales/es/index.d.ts +26 -0
  47. package/dist/templates/locales/es/index.d.ts.map +1 -0
  48. package/dist/templates/locales/es/index.js +53 -0
  49. package/dist/templates/locales/es/index.js.map +1 -0
  50. package/dist/templates/locales/es/sections.d.ts +28 -0
  51. package/dist/templates/locales/es/sections.d.ts.map +1 -0
  52. package/dist/templates/locales/es/sections.js +57 -0
  53. package/dist/templates/locales/es/sections.js.map +1 -0
  54. package/dist/templates/locales/es/templates.d.ts +22 -0
  55. package/dist/templates/locales/es/templates.d.ts.map +1 -0
  56. package/dist/templates/locales/es/templates.js +1060 -0
  57. package/dist/templates/locales/es/templates.js.map +1 -0
  58. package/dist/templates/locales/fr/index.d.ts +26 -0
  59. package/dist/templates/locales/fr/index.d.ts.map +1 -0
  60. package/dist/templates/locales/fr/index.js +53 -0
  61. package/dist/templates/locales/fr/index.js.map +1 -0
  62. package/dist/templates/locales/fr/sections.d.ts +28 -0
  63. package/dist/templates/locales/fr/sections.d.ts.map +1 -0
  64. package/dist/templates/locales/fr/sections.js +57 -0
  65. package/dist/templates/locales/fr/sections.js.map +1 -0
  66. package/dist/templates/locales/fr/templates.d.ts +22 -0
  67. package/dist/templates/locales/fr/templates.d.ts.map +1 -0
  68. package/dist/templates/locales/fr/templates.js +1060 -0
  69. package/dist/templates/locales/fr/templates.js.map +1 -0
  70. package/dist/templates/locales/index.d.ts +67 -0
  71. package/dist/templates/locales/index.d.ts.map +1 -0
  72. package/dist/templates/locales/index.js +100 -0
  73. package/dist/templates/locales/index.js.map +1 -0
  74. package/dist/templates/locales/it/index.d.ts +26 -0
  75. package/dist/templates/locales/it/index.d.ts.map +1 -0
  76. package/dist/templates/locales/it/index.js +53 -0
  77. package/dist/templates/locales/it/index.js.map +1 -0
  78. package/dist/templates/locales/it/sections.d.ts +28 -0
  79. package/dist/templates/locales/it/sections.d.ts.map +1 -0
  80. package/dist/templates/locales/it/sections.js +57 -0
  81. package/dist/templates/locales/it/sections.js.map +1 -0
  82. package/dist/templates/locales/it/templates.d.ts +22 -0
  83. package/dist/templates/locales/it/templates.d.ts.map +1 -0
  84. package/dist/templates/locales/it/templates.js +1060 -0
  85. package/dist/templates/locales/it/templates.js.map +1 -0
  86. package/dist/templates/locales/language-factory.d.ts +97 -0
  87. package/dist/templates/locales/language-factory.d.ts.map +1 -0
  88. package/dist/templates/locales/language-factory.js +126 -0
  89. package/dist/templates/locales/language-factory.js.map +1 -0
  90. package/dist/templates/locales/language-registry.d.ts +114 -0
  91. package/dist/templates/locales/language-registry.d.ts.map +1 -0
  92. package/dist/templates/locales/language-registry.js +146 -0
  93. package/dist/templates/locales/language-registry.js.map +1 -0
  94. package/dist/templates/locales/language-strategy.d.ts +126 -0
  95. package/dist/templates/locales/language-strategy.d.ts.map +1 -0
  96. package/dist/templates/locales/language-strategy.js +46 -0
  97. package/dist/templates/locales/language-strategy.js.map +1 -0
  98. package/dist/templates/locales/nl/index.d.ts +26 -0
  99. package/dist/templates/locales/nl/index.d.ts.map +1 -0
  100. package/dist/templates/locales/nl/index.js +53 -0
  101. package/dist/templates/locales/nl/index.js.map +1 -0
  102. package/dist/templates/locales/nl/sections.d.ts +28 -0
  103. package/dist/templates/locales/nl/sections.d.ts.map +1 -0
  104. package/dist/templates/locales/nl/sections.js +57 -0
  105. package/dist/templates/locales/nl/sections.js.map +1 -0
  106. package/dist/templates/locales/nl/templates.d.ts +22 -0
  107. package/dist/templates/locales/nl/templates.d.ts.map +1 -0
  108. package/dist/templates/locales/nl/templates.js +1060 -0
  109. package/dist/templates/locales/nl/templates.js.map +1 -0
  110. package/dist/templates/locales/pt/index.d.ts +26 -0
  111. package/dist/templates/locales/pt/index.d.ts.map +1 -0
  112. package/dist/templates/locales/pt/index.js +53 -0
  113. package/dist/templates/locales/pt/index.js.map +1 -0
  114. package/dist/templates/locales/pt/sections.d.ts +28 -0
  115. package/dist/templates/locales/pt/sections.d.ts.map +1 -0
  116. package/dist/templates/locales/pt/sections.js +57 -0
  117. package/dist/templates/locales/pt/sections.js.map +1 -0
  118. package/dist/templates/locales/pt/templates.d.ts +22 -0
  119. package/dist/templates/locales/pt/templates.d.ts.map +1 -0
  120. package/dist/templates/locales/pt/templates.js +1060 -0
  121. package/dist/templates/locales/pt/templates.js.map +1 -0
  122. package/dist/templates/locales/ru/index.d.ts +15 -0
  123. package/dist/templates/locales/ru/index.d.ts.map +1 -0
  124. package/dist/templates/locales/ru/index.js +41 -0
  125. package/dist/templates/locales/ru/index.js.map +1 -0
  126. package/dist/templates/locales/ru/sections.d.ts +28 -0
  127. package/dist/templates/locales/ru/sections.d.ts.map +1 -0
  128. package/dist/templates/locales/ru/sections.js +57 -0
  129. package/dist/templates/locales/ru/sections.js.map +1 -0
  130. package/dist/templates/locales/ru/templates.d.ts +22 -0
  131. package/dist/templates/locales/ru/templates.d.ts.map +1 -0
  132. package/dist/templates/locales/ru/templates.js +664 -0
  133. package/dist/templates/locales/ru/templates.js.map +1 -0
  134. package/dist/templates/locales/template-provider.d.ts +122 -0
  135. package/dist/templates/locales/template-provider.d.ts.map +1 -0
  136. package/dist/templates/locales/template-provider.js +173 -0
  137. package/dist/templates/locales/template-provider.js.map +1 -0
  138. package/dist/templates/locales/ukr/index.d.ts +9 -0
  139. package/dist/templates/locales/ukr/index.d.ts.map +1 -0
  140. package/dist/templates/locales/ukr/index.js +29 -0
  141. package/dist/templates/locales/ukr/index.js.map +1 -0
  142. package/dist/templates/locales/ukr/sections.d.ts +10 -0
  143. package/dist/templates/locales/ukr/sections.d.ts.map +1 -0
  144. package/dist/templates/locales/ukr/sections.js +39 -0
  145. package/dist/templates/locales/ukr/sections.js.map +1 -0
  146. package/dist/templates/locales/ukr/templates.d.ts +9 -0
  147. package/dist/templates/locales/ukr/templates.d.ts.map +1 -0
  148. package/dist/templates/locales/ukr/templates.js +242 -0
  149. package/dist/templates/locales/ukr/templates.js.map +1 -0
  150. package/dist/templates/locales/zh/index.d.ts +9 -0
  151. package/dist/templates/locales/zh/index.d.ts.map +1 -0
  152. package/dist/templates/locales/zh/index.js +29 -0
  153. package/dist/templates/locales/zh/index.js.map +1 -0
  154. package/dist/templates/locales/zh/sections.d.ts +10 -0
  155. package/dist/templates/locales/zh/sections.d.ts.map +1 -0
  156. package/dist/templates/locales/zh/sections.js +39 -0
  157. package/dist/templates/locales/zh/sections.js.map +1 -0
  158. package/dist/templates/locales/zh/templates.d.ts +9 -0
  159. package/dist/templates/locales/zh/templates.d.ts.map +1 -0
  160. package/dist/templates/locales/zh/templates.js +260 -0
  161. package/dist/templates/locales/zh/templates.js.map +1 -0
  162. package/dist/tools/arc42-init.d.ts +8 -2
  163. package/dist/tools/arc42-init.d.ts.map +1 -1
  164. package/dist/tools/arc42-init.js +67 -97
  165. package/dist/tools/arc42-init.js.map +1 -1
  166. package/dist/tools/arc42-status.d.ts +5 -2
  167. package/dist/tools/arc42-status.d.ts.map +1 -1
  168. package/dist/tools/arc42-status.js +47 -18
  169. package/dist/tools/arc42-status.js.map +1 -1
  170. package/dist/tools/arc42-workflow-guide.d.ts +6 -3
  171. package/dist/tools/arc42-workflow-guide.d.ts.map +1 -1
  172. package/dist/tools/arc42-workflow-guide.js +42 -276
  173. package/dist/tools/arc42-workflow-guide.js.map +1 -1
  174. package/dist/tools/generate-template.d.ts +7 -3
  175. package/dist/tools/generate-template.d.ts.map +1 -1
  176. package/dist/tools/generate-template.js +44 -35
  177. package/dist/tools/generate-template.js.map +1 -1
  178. package/dist/tools/get-section.d.ts +7 -3
  179. package/dist/tools/get-section.d.ts.map +1 -1
  180. package/dist/tools/get-section.js +38 -38
  181. package/dist/tools/get-section.js.map +1 -1
  182. package/dist/tools/index.d.ts +6 -5
  183. package/dist/tools/index.d.ts.map +1 -1
  184. package/dist/tools/index.js +14 -20
  185. package/dist/tools/index.js.map +1 -1
  186. package/dist/tools/update-section.d.ts +9 -3
  187. package/dist/tools/update-section.d.ts.map +1 -1
  188. package/dist/tools/update-section.js +12 -44
  189. package/dist/tools/update-section.js.map +1 -1
  190. package/package.json +1 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"templates.js","sourceRoot":"","sources":["../../../../src/templates/locales/it/templates.ts"],"names":[],"mappings":"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"}
@@ -0,0 +1,97 @@
1
+ /**
2
+ * Language Factory
3
+ *
4
+ * Factory for creating language strategy instances.
5
+ * Handles code normalization and fallback to English for unknown codes.
6
+ *
7
+ * @module templates/locales/language-factory
8
+ *
9
+ * S.O.L.I.D Principles:
10
+ * - SRP (Single Responsibility Principle): Only creates instances, not registration
11
+ * - DIP (Dependency Inversion Principle): Depends on LanguageRegistry abstraction
12
+ *
13
+ * Design Patterns:
14
+ * - Factory Pattern: Centralized object creation
15
+ */
16
+ import type { LanguageStrategy, LanguageCode } from './language-strategy.js';
17
+ import type { LanguageRegistry } from './language-registry.js';
18
+ /**
19
+ * Language Factory Class
20
+ *
21
+ * Creates language strategy instances from the registry with code normalization
22
+ * and optional fallback to English for unknown language codes.
23
+ *
24
+ * @example
25
+ * ```typescript
26
+ * const factory = new LanguageFactory(registry);
27
+ *
28
+ * // Strict mode - throws for unknown codes
29
+ * const german = factory.create('de'); // Case-insensitive
30
+ *
31
+ * // Lenient mode - falls back to English
32
+ * const fallback = factory.createWithFallback('unknown');
33
+ * ```
34
+ */
35
+ export declare class LanguageFactory {
36
+ /**
37
+ * The registry to retrieve strategies from
38
+ */
39
+ private readonly registry;
40
+ /**
41
+ * Create a new LanguageFactory
42
+ *
43
+ * @param registry - The language registry to use for lookups
44
+ */
45
+ constructor(registry: LanguageRegistry);
46
+ /**
47
+ * Normalize a language code
48
+ *
49
+ * Converts to uppercase and trims whitespace for consistent handling.
50
+ *
51
+ * @param code - The language code to normalize
52
+ * @returns The normalized code (uppercase, trimmed)
53
+ */
54
+ normalizeCode(code: string): string;
55
+ /**
56
+ * Create a language strategy for the given code
57
+ *
58
+ * Performs case-insensitive lookup and throws if the language is not registered.
59
+ *
60
+ * @param code - The language code
61
+ * @returns The language strategy
62
+ * @throws Error if the language code is not registered
63
+ */
64
+ create(code: string): LanguageStrategy;
65
+ /**
66
+ * Create a language strategy with fallback to English
67
+ *
68
+ * Attempts to create a strategy for the given code. If the code is not registered,
69
+ * logs a warning and returns the English strategy as fallback.
70
+ *
71
+ * @param code - The language code
72
+ * @returns The language strategy (or English if code not found)
73
+ * @throws Error if neither the requested code nor English is registered
74
+ */
75
+ createWithFallback(code: string): LanguageStrategy;
76
+ /**
77
+ * Check if a language code is supported
78
+ *
79
+ * @param code - The language code to check
80
+ * @returns True if the language is registered
81
+ */
82
+ isSupported(code: string): boolean;
83
+ /**
84
+ * Get all available language codes
85
+ *
86
+ * @returns Array of registered language codes
87
+ */
88
+ getAvailableCodes(): LanguageCode[];
89
+ /**
90
+ * Get the default language strategy (English)
91
+ *
92
+ * @returns The English language strategy
93
+ * @throws Error if English is not registered
94
+ */
95
+ getDefault(): LanguageStrategy;
96
+ }
97
+ //# sourceMappingURL=language-factory.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"language-factory.d.ts","sourceRoot":"","sources":["../../../src/templates/locales/language-factory.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAC7E,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAE/D;;;;;;;;;;;;;;;;GAgBG;AACH,qBAAa,eAAe;IAC1B;;OAEG;IACH,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAmB;IAE5C;;;;OAIG;gBACS,QAAQ,EAAE,gBAAgB;IAItC;;;;;;;OAOG;IACH,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM;IAInC;;;;;;;;OAQG;IACH,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,gBAAgB;IAItC;;;;;;;;;OASG;IACH,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,gBAAgB;IAwBlD;;;;;OAKG;IACH,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO;IAIlC;;;;OAIG;IACH,iBAAiB,IAAI,YAAY,EAAE;IAInC;;;;;OAKG;IACH,UAAU,IAAI,gBAAgB;CAU/B"}
@@ -0,0 +1,126 @@
1
+ /**
2
+ * Language Factory
3
+ *
4
+ * Factory for creating language strategy instances.
5
+ * Handles code normalization and fallback to English for unknown codes.
6
+ *
7
+ * @module templates/locales/language-factory
8
+ *
9
+ * S.O.L.I.D Principles:
10
+ * - SRP (Single Responsibility Principle): Only creates instances, not registration
11
+ * - DIP (Dependency Inversion Principle): Depends on LanguageRegistry abstraction
12
+ *
13
+ * Design Patterns:
14
+ * - Factory Pattern: Centralized object creation
15
+ */
16
+ /**
17
+ * Language Factory Class
18
+ *
19
+ * Creates language strategy instances from the registry with code normalization
20
+ * and optional fallback to English for unknown language codes.
21
+ *
22
+ * @example
23
+ * ```typescript
24
+ * const factory = new LanguageFactory(registry);
25
+ *
26
+ * // Strict mode - throws for unknown codes
27
+ * const german = factory.create('de'); // Case-insensitive
28
+ *
29
+ * // Lenient mode - falls back to English
30
+ * const fallback = factory.createWithFallback('unknown');
31
+ * ```
32
+ */
33
+ export class LanguageFactory {
34
+ /**
35
+ * The registry to retrieve strategies from
36
+ */
37
+ registry;
38
+ /**
39
+ * Create a new LanguageFactory
40
+ *
41
+ * @param registry - The language registry to use for lookups
42
+ */
43
+ constructor(registry) {
44
+ this.registry = registry;
45
+ }
46
+ /**
47
+ * Normalize a language code
48
+ *
49
+ * Converts to uppercase and trims whitespace for consistent handling.
50
+ *
51
+ * @param code - The language code to normalize
52
+ * @returns The normalized code (uppercase, trimmed)
53
+ */
54
+ normalizeCode(code) {
55
+ return code.trim().toUpperCase();
56
+ }
57
+ /**
58
+ * Create a language strategy for the given code
59
+ *
60
+ * Performs case-insensitive lookup and throws if the language is not registered.
61
+ *
62
+ * @param code - The language code
63
+ * @returns The language strategy
64
+ * @throws Error if the language code is not registered
65
+ */
66
+ create(code) {
67
+ return this.registry.getOrThrow(code);
68
+ }
69
+ /**
70
+ * Create a language strategy with fallback to English
71
+ *
72
+ * Attempts to create a strategy for the given code. If the code is not registered,
73
+ * logs a warning and returns the English strategy as fallback.
74
+ *
75
+ * @param code - The language code
76
+ * @returns The language strategy (or English if code not found)
77
+ * @throws Error if neither the requested code nor English is registered
78
+ */
79
+ createWithFallback(code) {
80
+ const normalizedCode = this.normalizeCode(code);
81
+ const strategy = this.registry.get(normalizedCode);
82
+ if (strategy) {
83
+ return strategy;
84
+ }
85
+ // Log warning and fall back to English
86
+ console.warn(`Language code "${normalizedCode}" is not registered. Falling back to English.`);
87
+ const englishStrategy = this.registry.get('EN');
88
+ if (!englishStrategy) {
89
+ throw new Error(`Cannot fall back to English: English language is not registered. ` +
90
+ `Available languages: ${this.registry.getAvailableCodes().join(', ') || 'none'}`);
91
+ }
92
+ return englishStrategy;
93
+ }
94
+ /**
95
+ * Check if a language code is supported
96
+ *
97
+ * @param code - The language code to check
98
+ * @returns True if the language is registered
99
+ */
100
+ isSupported(code) {
101
+ return this.registry.isSupported(code);
102
+ }
103
+ /**
104
+ * Get all available language codes
105
+ *
106
+ * @returns Array of registered language codes
107
+ */
108
+ getAvailableCodes() {
109
+ return this.registry.getAvailableCodes();
110
+ }
111
+ /**
112
+ * Get the default language strategy (English)
113
+ *
114
+ * @returns The English language strategy
115
+ * @throws Error if English is not registered
116
+ */
117
+ getDefault() {
118
+ const defaultStrategy = this.registry.getDefault();
119
+ if (!defaultStrategy) {
120
+ throw new Error('Default language (English) is not registered. ' +
121
+ `Available languages: ${this.registry.getAvailableCodes().join(', ') || 'none'}`);
122
+ }
123
+ return defaultStrategy;
124
+ }
125
+ }
126
+ //# sourceMappingURL=language-factory.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"language-factory.js","sourceRoot":"","sources":["../../../src/templates/locales/language-factory.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAKH;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,OAAO,eAAe;IAC1B;;OAEG;IACc,QAAQ,CAAmB;IAE5C;;;;OAIG;IACH,YAAY,QAA0B;QACpC,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;IAC3B,CAAC;IAED;;;;;;;OAOG;IACH,aAAa,CAAC,IAAY;QACxB,OAAO,IAAI,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;IACnC,CAAC;IAED;;;;;;;;OAQG;IACH,MAAM,CAAC,IAAY;QACjB,OAAO,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;IACxC,CAAC;IAED;;;;;;;;;OASG;IACH,kBAAkB,CAAC,IAAY;QAC7B,MAAM,cAAc,GAAG,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC;QAChD,MAAM,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;QAEnD,IAAI,QAAQ,EAAE,CAAC;YACb,OAAO,QAAQ,CAAC;QAClB,CAAC;QAED,uCAAuC;QACvC,OAAO,CAAC,IAAI,CACV,kBAAkB,cAAc,+CAA+C,CAChF,CAAC;QAEF,MAAM,eAAe,GAAG,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QAChD,IAAI,CAAC,eAAe,EAAE,CAAC;YACrB,MAAM,IAAI,KAAK,CACb,mEAAmE;gBACnE,wBAAwB,IAAI,CAAC,QAAQ,CAAC,iBAAiB,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,MAAM,EAAE,CACjF,CAAC;QACJ,CAAC;QAED,OAAO,eAAe,CAAC;IACzB,CAAC;IAED;;;;;OAKG;IACH,WAAW,CAAC,IAAY;QACtB,OAAO,IAAI,CAAC,QAAQ,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;IACzC,CAAC;IAED;;;;OAIG;IACH,iBAAiB;QACf,OAAO,IAAI,CAAC,QAAQ,CAAC,iBAAiB,EAAE,CAAC;IAC3C,CAAC;IAED;;;;;OAKG;IACH,UAAU;QACR,MAAM,eAAe,GAAG,IAAI,CAAC,QAAQ,CAAC,UAAU,EAAE,CAAC;QACnD,IAAI,CAAC,eAAe,EAAE,CAAC;YACrB,MAAM,IAAI,KAAK,CACb,gDAAgD;gBAChD,wBAAwB,IAAI,CAAC,QAAQ,CAAC,iBAAiB,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,MAAM,EAAE,CACjF,CAAC;QACJ,CAAC;QACD,OAAO,eAAe,CAAC;IACzB,CAAC;CACF"}
@@ -0,0 +1,114 @@
1
+ /**
2
+ * Language Registry
3
+ *
4
+ * Registry for storing and retrieving language strategies.
5
+ * Uses Map for O(1) lookup by normalized language code.
6
+ *
7
+ * @module templates/locales/language-registry
8
+ *
9
+ * S.O.L.I.D Principles:
10
+ * - SRP (Single Responsibility Principle): Only manages registration and lookup,
11
+ * not creation or template retrieval
12
+ *
13
+ * Design Patterns:
14
+ * - Registry Pattern: Single source of truth for language strategies
15
+ */
16
+ import type { LanguageStrategy, LanguageCode } from './language-strategy.js';
17
+ /**
18
+ * Language Registry Class
19
+ *
20
+ * Manages the collection of language strategies, providing registration,
21
+ * lookup, and enumeration capabilities with case-insensitive code handling.
22
+ *
23
+ * @example
24
+ * ```typescript
25
+ * const registry = new LanguageRegistry();
26
+ * registry.register(englishStrategy);
27
+ * registry.register(germanStrategy);
28
+ *
29
+ * const strategy = registry.get('de'); // Case-insensitive
30
+ * const allCodes = registry.getAvailableCodes(); // ['EN', 'DE']
31
+ * ```
32
+ */
33
+ export declare class LanguageRegistry {
34
+ /**
35
+ * Internal map storing strategies by normalized (uppercase) language code
36
+ */
37
+ private readonly strategies;
38
+ constructor();
39
+ /**
40
+ * Normalize a language code for consistent storage and lookup
41
+ *
42
+ * @param code - The language code to normalize
43
+ * @returns Uppercase, trimmed language code
44
+ */
45
+ private normalizeCode;
46
+ /**
47
+ * Register a language strategy
48
+ *
49
+ * Stores the strategy using its code (normalized to uppercase).
50
+ * If a strategy with the same code already exists, it will be overwritten.
51
+ *
52
+ * @param strategy - The language strategy to register
53
+ * @returns This registry instance for method chaining
54
+ */
55
+ register(strategy: LanguageStrategy): this;
56
+ /**
57
+ * Get a language strategy by code
58
+ *
59
+ * Performs case-insensitive lookup.
60
+ *
61
+ * @param code - The language code to look up
62
+ * @returns The language strategy, or undefined if not found
63
+ */
64
+ get(code: string): LanguageStrategy | undefined;
65
+ /**
66
+ * Get a language strategy by code, throwing if not found
67
+ *
68
+ * Performs case-insensitive lookup and throws a descriptive error
69
+ * if the requested language is not registered.
70
+ *
71
+ * @param code - The language code to look up
72
+ * @returns The language strategy
73
+ * @throws Error if the language code is not registered
74
+ */
75
+ getOrThrow(code: string): LanguageStrategy;
76
+ /**
77
+ * Get all registered language strategies
78
+ *
79
+ * @returns Array of all registered strategies (copy, not the internal collection)
80
+ */
81
+ getAll(): LanguageStrategy[];
82
+ /**
83
+ * Check if a language code is supported
84
+ *
85
+ * Performs case-insensitive check.
86
+ *
87
+ * @param code - The language code to check
88
+ * @returns True if the language is registered
89
+ */
90
+ isSupported(code: string): boolean;
91
+ /**
92
+ * Get all available language codes
93
+ *
94
+ * @returns Array of all registered language codes (uppercase)
95
+ */
96
+ getAvailableCodes(): LanguageCode[];
97
+ /**
98
+ * Get the default language strategy (English)
99
+ *
100
+ * @returns The English language strategy, or undefined if not registered
101
+ */
102
+ getDefault(): LanguageStrategy | undefined;
103
+ /**
104
+ * Get the number of registered strategies
105
+ */
106
+ get size(): number;
107
+ /**
108
+ * Remove all registered strategies
109
+ *
110
+ * @returns This registry instance for method chaining
111
+ */
112
+ clear(): this;
113
+ }
114
+ //# sourceMappingURL=language-registry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"language-registry.d.ts","sourceRoot":"","sources":["../../../src/templates/locales/language-registry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAE7E;;;;;;;;;;;;;;;GAeG;AACH,qBAAa,gBAAgB;IAC3B;;OAEG;IACH,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAgC;;IAM3D;;;;;OAKG;IACH,OAAO,CAAC,aAAa;IAIrB;;;;;;;;OAQG;IACH,QAAQ,CAAC,QAAQ,EAAE,gBAAgB,GAAG,IAAI;IAM1C;;;;;;;OAOG;IACH,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,gBAAgB,GAAG,SAAS;IAK/C;;;;;;;;;OASG;IACH,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,gBAAgB;IAY1C;;;;OAIG;IACH,MAAM,IAAI,gBAAgB,EAAE;IAI5B;;;;;;;OAOG;IACH,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO;IAKlC;;;;OAIG;IACH,iBAAiB,IAAI,YAAY,EAAE;IAInC;;;;OAIG;IACH,UAAU,IAAI,gBAAgB,GAAG,SAAS;IAI1C;;OAEG;IACH,IAAI,IAAI,IAAI,MAAM,CAEjB;IAED;;;;OAIG;IACH,KAAK,IAAI,IAAI;CAId"}
@@ -0,0 +1,146 @@
1
+ /**
2
+ * Language Registry
3
+ *
4
+ * Registry for storing and retrieving language strategies.
5
+ * Uses Map for O(1) lookup by normalized language code.
6
+ *
7
+ * @module templates/locales/language-registry
8
+ *
9
+ * S.O.L.I.D Principles:
10
+ * - SRP (Single Responsibility Principle): Only manages registration and lookup,
11
+ * not creation or template retrieval
12
+ *
13
+ * Design Patterns:
14
+ * - Registry Pattern: Single source of truth for language strategies
15
+ */
16
+ /**
17
+ * Language Registry Class
18
+ *
19
+ * Manages the collection of language strategies, providing registration,
20
+ * lookup, and enumeration capabilities with case-insensitive code handling.
21
+ *
22
+ * @example
23
+ * ```typescript
24
+ * const registry = new LanguageRegistry();
25
+ * registry.register(englishStrategy);
26
+ * registry.register(germanStrategy);
27
+ *
28
+ * const strategy = registry.get('de'); // Case-insensitive
29
+ * const allCodes = registry.getAvailableCodes(); // ['EN', 'DE']
30
+ * ```
31
+ */
32
+ export class LanguageRegistry {
33
+ /**
34
+ * Internal map storing strategies by normalized (uppercase) language code
35
+ */
36
+ strategies;
37
+ constructor() {
38
+ this.strategies = new Map();
39
+ }
40
+ /**
41
+ * Normalize a language code for consistent storage and lookup
42
+ *
43
+ * @param code - The language code to normalize
44
+ * @returns Uppercase, trimmed language code
45
+ */
46
+ normalizeCode(code) {
47
+ return code.trim().toUpperCase();
48
+ }
49
+ /**
50
+ * Register a language strategy
51
+ *
52
+ * Stores the strategy using its code (normalized to uppercase).
53
+ * If a strategy with the same code already exists, it will be overwritten.
54
+ *
55
+ * @param strategy - The language strategy to register
56
+ * @returns This registry instance for method chaining
57
+ */
58
+ register(strategy) {
59
+ const normalizedCode = this.normalizeCode(strategy.code);
60
+ this.strategies.set(normalizedCode, strategy);
61
+ return this;
62
+ }
63
+ /**
64
+ * Get a language strategy by code
65
+ *
66
+ * Performs case-insensitive lookup.
67
+ *
68
+ * @param code - The language code to look up
69
+ * @returns The language strategy, or undefined if not found
70
+ */
71
+ get(code) {
72
+ const normalizedCode = this.normalizeCode(code);
73
+ return this.strategies.get(normalizedCode);
74
+ }
75
+ /**
76
+ * Get a language strategy by code, throwing if not found
77
+ *
78
+ * Performs case-insensitive lookup and throws a descriptive error
79
+ * if the requested language is not registered.
80
+ *
81
+ * @param code - The language code to look up
82
+ * @returns The language strategy
83
+ * @throws Error if the language code is not registered
84
+ */
85
+ getOrThrow(code) {
86
+ const strategy = this.get(code);
87
+ if (!strategy) {
88
+ const availableCodes = this.getAvailableCodes().join(', ');
89
+ throw new Error(`Language code "${code.trim().toUpperCase()}" is not registered. ` +
90
+ `Available languages: ${availableCodes || 'none'}`);
91
+ }
92
+ return strategy;
93
+ }
94
+ /**
95
+ * Get all registered language strategies
96
+ *
97
+ * @returns Array of all registered strategies (copy, not the internal collection)
98
+ */
99
+ getAll() {
100
+ return Array.from(this.strategies.values());
101
+ }
102
+ /**
103
+ * Check if a language code is supported
104
+ *
105
+ * Performs case-insensitive check.
106
+ *
107
+ * @param code - The language code to check
108
+ * @returns True if the language is registered
109
+ */
110
+ isSupported(code) {
111
+ const normalizedCode = this.normalizeCode(code);
112
+ return this.strategies.has(normalizedCode);
113
+ }
114
+ /**
115
+ * Get all available language codes
116
+ *
117
+ * @returns Array of all registered language codes (uppercase)
118
+ */
119
+ getAvailableCodes() {
120
+ return Array.from(this.strategies.keys());
121
+ }
122
+ /**
123
+ * Get the default language strategy (English)
124
+ *
125
+ * @returns The English language strategy, or undefined if not registered
126
+ */
127
+ getDefault() {
128
+ return this.get('EN');
129
+ }
130
+ /**
131
+ * Get the number of registered strategies
132
+ */
133
+ get size() {
134
+ return this.strategies.size;
135
+ }
136
+ /**
137
+ * Remove all registered strategies
138
+ *
139
+ * @returns This registry instance for method chaining
140
+ */
141
+ clear() {
142
+ this.strategies.clear();
143
+ return this;
144
+ }
145
+ }
146
+ //# sourceMappingURL=language-registry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"language-registry.js","sourceRoot":"","sources":["../../../src/templates/locales/language-registry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAIH;;;;;;;;;;;;;;;GAeG;AACH,MAAM,OAAO,gBAAgB;IAC3B;;OAEG;IACc,UAAU,CAAgC;IAE3D;QACE,IAAI,CAAC,UAAU,GAAG,IAAI,GAAG,EAAE,CAAC;IAC9B,CAAC;IAED;;;;;OAKG;IACK,aAAa,CAAC,IAAY;QAChC,OAAO,IAAI,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;IACnC,CAAC;IAED;;;;;;;;OAQG;IACH,QAAQ,CAAC,QAA0B;QACjC,MAAM,cAAc,GAAG,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;QACzD,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,cAAc,EAAE,QAAQ,CAAC,CAAC;QAC9C,OAAO,IAAI,CAAC;IACd,CAAC;IAED;;;;;;;OAOG;IACH,GAAG,CAAC,IAAY;QACd,MAAM,cAAc,GAAG,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC;QAChD,OAAO,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;IAC7C,CAAC;IAED;;;;;;;;;OASG;IACH,UAAU,CAAC,IAAY;QACrB,MAAM,QAAQ,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QAChC,IAAI,CAAC,QAAQ,EAAE,CAAC;YACd,MAAM,cAAc,GAAG,IAAI,CAAC,iBAAiB,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YAC3D,MAAM,IAAI,KAAK,CACb,kBAAkB,IAAI,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,uBAAuB;gBAClE,wBAAwB,cAAc,IAAI,MAAM,EAAE,CACnD,CAAC;QACJ,CAAC;QACD,OAAO,QAAQ,CAAC;IAClB,CAAC;IAED;;;;OAIG;IACH,MAAM;QACJ,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,MAAM,EAAE,CAAC,CAAC;IAC9C,CAAC;IAED;;;;;;;OAOG;IACH,WAAW,CAAC,IAAY;QACtB,MAAM,cAAc,GAAG,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC;QAChD,OAAO,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;IAC7C,CAAC;IAED;;;;OAIG;IACH,iBAAiB;QACf,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,IAAI,EAAE,CAAmB,CAAC;IAC9D,CAAC;IAED;;;;OAIG;IACH,UAAU;QACR,OAAO,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IACxB,CAAC;IAED;;OAEG;IACH,IAAI,IAAI;QACN,OAAO,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC;IAC9B,CAAC;IAED;;;;OAIG;IACH,KAAK;QACH,IAAI,CAAC,UAAU,CAAC,KAAK,EAAE,CAAC;QACxB,OAAO,IAAI,CAAC;IACd,CAAC;CACF"}
@@ -0,0 +1,126 @@
1
+ /**
2
+ * Language Strategy Interface
3
+ *
4
+ * Defines the contract for all language implementations in the multi-language template system.
5
+ * This interface follows the Strategy Pattern, allowing different language implementations
6
+ * to be used interchangeably.
7
+ *
8
+ * @module templates/locales/language-strategy
9
+ *
10
+ * S.O.L.I.D Principles:
11
+ * - ISP (Interface Segregation Principle): Interface is focused only on language content,
12
+ * not registration or creation logic
13
+ * - OCP (Open/Closed Principle): New languages can be added by implementing this interface
14
+ * without modifying existing code
15
+ */
16
+ import type { Arc42Section } from '../../types.js';
17
+ /**
18
+ * Supported language codes
19
+ * Based on the arc42 template repository structure
20
+ */
21
+ export type LanguageCode = 'EN' | 'DE' | 'CZ' | 'ES' | 'FR' | 'IT' | 'NL' | 'PT' | 'RU' | 'UKR' | 'ZH';
22
+ /**
23
+ * Array of all supported language codes
24
+ */
25
+ export declare const SUPPORTED_LANGUAGE_CODES: readonly LanguageCode[];
26
+ /**
27
+ * Section title with associated section identifier
28
+ */
29
+ export interface SectionTitle {
30
+ /** The localized title of the section */
31
+ title: string;
32
+ /** The section identifier */
33
+ section: Arc42Section;
34
+ }
35
+ /**
36
+ * Section description with associated section identifier
37
+ */
38
+ export interface SectionDescription {
39
+ /** The localized description of the section */
40
+ description: string;
41
+ /** The section identifier */
42
+ section: Arc42Section;
43
+ }
44
+ /**
45
+ * Language metadata for display purposes
46
+ */
47
+ export interface LanguageInfo {
48
+ /** ISO language code (uppercase) */
49
+ code: LanguageCode;
50
+ /** English name of the language */
51
+ name: string;
52
+ /** Name of the language in its native form */
53
+ nativeName: string;
54
+ }
55
+ /**
56
+ * Language Strategy Interface
57
+ *
58
+ * Defines the contract that all language implementations must follow.
59
+ * Each language strategy provides localized content for arc42 documentation.
60
+ *
61
+ * @example
62
+ * ```typescript
63
+ * const englishStrategy: LanguageStrategy = {
64
+ * code: 'EN',
65
+ * name: 'English',
66
+ * nativeName: 'English',
67
+ * getSectionTitle: (section) => ({ title: 'Introduction and Goals', section }),
68
+ * getSectionDescription: (section) => ({ description: 'Overview of requirements...', section }),
69
+ * getTemplate: (section) => '# Introduction and Goals\n\n...',
70
+ * getWorkflowGuide: () => '# arc42 Workflow Guide\n\n...',
71
+ * getReadmeContent: () => '# Project Documentation\n\n...'
72
+ * };
73
+ * ```
74
+ */
75
+ export interface LanguageStrategy extends LanguageInfo {
76
+ /**
77
+ * Get the localized title for a specific section
78
+ *
79
+ * @param section - The arc42 section identifier
80
+ * @returns The section title with metadata
81
+ */
82
+ getSectionTitle(section: Arc42Section): SectionTitle;
83
+ /**
84
+ * Get the localized description for a specific section
85
+ *
86
+ * @param section - The arc42 section identifier
87
+ * @returns The section description with metadata
88
+ */
89
+ getSectionDescription(section: Arc42Section): SectionDescription;
90
+ /**
91
+ * Get the localized template content for a specific section
92
+ *
93
+ * @param section - The arc42 section identifier
94
+ * @returns The full markdown template for the section
95
+ */
96
+ getTemplate(section: Arc42Section): string;
97
+ /**
98
+ * Get the localized workflow guide
99
+ *
100
+ * @returns The complete workflow guide in markdown format
101
+ */
102
+ getWorkflowGuide(): string;
103
+ /**
104
+ * Get the localized README content
105
+ *
106
+ * @param projectName - Optional project name for README header
107
+ * @returns The README content in markdown format
108
+ */
109
+ getReadmeContent(projectName?: string): string;
110
+ }
111
+ /**
112
+ * Type guard to check if a value is a valid LanguageCode
113
+ *
114
+ * @param value - The value to check
115
+ * @returns True if the value is a valid LanguageCode
116
+ */
117
+ export declare function isLanguageCode(value: unknown): value is LanguageCode;
118
+ /**
119
+ * Normalize a language code to uppercase
120
+ *
121
+ * @param code - The language code to normalize
122
+ * @returns The normalized uppercase language code
123
+ * @throws Error if the code is not a valid language code
124
+ */
125
+ export declare function normalizeLanguageCode(code: string): LanguageCode;
126
+ //# sourceMappingURL=language-strategy.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"language-strategy.d.ts","sourceRoot":"","sources":["../../../src/templates/locales/language-strategy.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAEnD;;;GAGG;AACH,MAAM,MAAM,YAAY,GACpB,IAAI,GACJ,IAAI,GACJ,IAAI,GACJ,IAAI,GACJ,IAAI,GACJ,IAAI,GACJ,IAAI,GACJ,IAAI,GACJ,IAAI,GACJ,KAAK,GACL,IAAI,CAAC;AAET;;GAEG;AACH,eAAO,MAAM,wBAAwB,EAAE,SAAS,YAAY,EAElD,CAAC;AAEX;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B,yCAAyC;IACzC,KAAK,EAAE,MAAM,CAAC;IACd,6BAA6B;IAC7B,OAAO,EAAE,YAAY,CAAC;CACvB;AAED;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,+CAA+C;IAC/C,WAAW,EAAE,MAAM,CAAC;IACpB,6BAA6B;IAC7B,OAAO,EAAE,YAAY,CAAC;CACvB;AAED;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B,oCAAoC;IACpC,IAAI,EAAE,YAAY,CAAC;IACnB,mCAAmC;IACnC,IAAI,EAAE,MAAM,CAAC;IACb,8CAA8C;IAC9C,UAAU,EAAE,MAAM,CAAC;CACpB;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,WAAW,gBAAiB,SAAQ,YAAY;IACpD;;;;;OAKG;IACH,eAAe,CAAC,OAAO,EAAE,YAAY,GAAG,YAAY,CAAC;IAErD;;;;;OAKG;IACH,qBAAqB,CAAC,OAAO,EAAE,YAAY,GAAG,kBAAkB,CAAC;IAEjE;;;;;OAKG;IACH,WAAW,CAAC,OAAO,EAAE,YAAY,GAAG,MAAM,CAAC;IAE3C;;;;OAIG;IACH,gBAAgB,IAAI,MAAM,CAAC;IAE3B;;;;;OAKG;IACH,gBAAgB,CAAC,WAAW,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;CAChD;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,YAAY,CAKpE;AAED;;;;;;GAMG;AACH,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,MAAM,GAAG,YAAY,CAQhE"}
@@ -0,0 +1,46 @@
1
+ /**
2
+ * Language Strategy Interface
3
+ *
4
+ * Defines the contract for all language implementations in the multi-language template system.
5
+ * This interface follows the Strategy Pattern, allowing different language implementations
6
+ * to be used interchangeably.
7
+ *
8
+ * @module templates/locales/language-strategy
9
+ *
10
+ * S.O.L.I.D Principles:
11
+ * - ISP (Interface Segregation Principle): Interface is focused only on language content,
12
+ * not registration or creation logic
13
+ * - OCP (Open/Closed Principle): New languages can be added by implementing this interface
14
+ * without modifying existing code
15
+ */
16
+ /**
17
+ * Array of all supported language codes
18
+ */
19
+ export const SUPPORTED_LANGUAGE_CODES = [
20
+ 'EN', 'DE', 'CZ', 'ES', 'FR', 'IT', 'NL', 'PT', 'RU', 'UKR', 'ZH'
21
+ ];
22
+ /**
23
+ * Type guard to check if a value is a valid LanguageCode
24
+ *
25
+ * @param value - The value to check
26
+ * @returns True if the value is a valid LanguageCode
27
+ */
28
+ export function isLanguageCode(value) {
29
+ return (typeof value === 'string' &&
30
+ SUPPORTED_LANGUAGE_CODES.includes(value.toUpperCase()));
31
+ }
32
+ /**
33
+ * Normalize a language code to uppercase
34
+ *
35
+ * @param code - The language code to normalize
36
+ * @returns The normalized uppercase language code
37
+ * @throws Error if the code is not a valid language code
38
+ */
39
+ export function normalizeLanguageCode(code) {
40
+ const normalized = code.trim().toUpperCase();
41
+ if (!isLanguageCode(normalized)) {
42
+ throw new Error(`Invalid language code: "${code}". Supported codes: ${SUPPORTED_LANGUAGE_CODES.join(', ')}`);
43
+ }
44
+ return normalized;
45
+ }
46
+ //# sourceMappingURL=language-strategy.js.map