@angular/cli 21.0.0-next.0 → 21.0.0-next.10

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 (226) hide show
  1. package/lib/cli/index.js +1 -0
  2. package/lib/cli/index.js.map +1 -0
  3. package/lib/code-examples.db +0 -0
  4. package/lib/config/schema.json +276 -51
  5. package/lib/config/workspace-schema.d.ts +57 -2
  6. package/lib/config/workspace-schema.js +23 -2
  7. package/lib/config/workspace-schema.js.map +1 -0
  8. package/lib/init.js +1 -0
  9. package/lib/init.js.map +1 -0
  10. package/package.json +24 -23
  11. package/src/analytics/analytics-collector.js +1 -0
  12. package/src/analytics/analytics-collector.js.map +1 -0
  13. package/src/analytics/analytics-parameters.js +1 -0
  14. package/src/analytics/analytics-parameters.js.map +1 -0
  15. package/src/analytics/analytics.js +1 -0
  16. package/src/analytics/analytics.js.map +1 -0
  17. package/src/command-builder/architect-base-command-module.js +1 -0
  18. package/src/command-builder/architect-base-command-module.js.map +1 -0
  19. package/src/command-builder/architect-command-module.js +21 -7
  20. package/src/command-builder/architect-command-module.js.map +1 -0
  21. package/src/command-builder/command-module.js +1 -0
  22. package/src/command-builder/command-module.js.map +1 -0
  23. package/src/command-builder/command-runner.js +2 -2
  24. package/src/command-builder/command-runner.js.map +1 -0
  25. package/src/command-builder/schematics-command-module.js +8 -2
  26. package/src/command-builder/schematics-command-module.js.map +1 -0
  27. package/src/command-builder/utilities/command.js +1 -0
  28. package/src/command-builder/utilities/command.js.map +1 -0
  29. package/src/command-builder/utilities/json-help.js +1 -0
  30. package/src/command-builder/utilities/json-help.js.map +1 -0
  31. package/src/command-builder/utilities/json-schema.d.ts +13 -1
  32. package/src/command-builder/utilities/json-schema.js +180 -96
  33. package/src/command-builder/utilities/json-schema.js.map +1 -0
  34. package/src/command-builder/utilities/normalize-options-middleware.js +1 -0
  35. package/src/command-builder/utilities/normalize-options-middleware.js.map +1 -0
  36. package/src/command-builder/utilities/schematic-engine-host.js +5 -6
  37. package/src/command-builder/utilities/schematic-engine-host.js.map +1 -0
  38. package/src/command-builder/utilities/schematic-workflow.js +1 -0
  39. package/src/command-builder/utilities/schematic-workflow.js.map +1 -0
  40. package/src/commands/add/cli.d.ts +2 -1
  41. package/src/commands/add/cli.js +179 -94
  42. package/src/commands/add/cli.js.map +1 -0
  43. package/src/commands/analytics/cli.js +1 -0
  44. package/src/commands/analytics/cli.js.map +1 -0
  45. package/src/commands/analytics/info/cli.js +1 -0
  46. package/src/commands/analytics/info/cli.js.map +1 -0
  47. package/src/commands/analytics/settings/cli.js +1 -0
  48. package/src/commands/analytics/settings/cli.js.map +1 -0
  49. package/src/commands/build/cli.js +1 -0
  50. package/src/commands/build/cli.js.map +1 -0
  51. package/src/commands/cache/clean/cli.js +1 -0
  52. package/src/commands/cache/clean/cli.js.map +1 -0
  53. package/src/commands/cache/cli.js +1 -0
  54. package/src/commands/cache/cli.js.map +1 -0
  55. package/src/commands/cache/info/cli.js +36 -11
  56. package/src/commands/cache/info/cli.js.map +1 -0
  57. package/src/commands/cache/settings/cli.js +1 -0
  58. package/src/commands/cache/settings/cli.js.map +1 -0
  59. package/src/commands/cache/utilities.js +1 -0
  60. package/src/commands/cache/utilities.js.map +1 -0
  61. package/src/commands/command-config.js +1 -0
  62. package/src/commands/command-config.js.map +1 -0
  63. package/src/commands/completion/cli.js +1 -0
  64. package/src/commands/completion/cli.js.map +1 -0
  65. package/src/commands/config/cli.js +1 -0
  66. package/src/commands/config/cli.js.map +1 -0
  67. package/src/commands/deploy/cli.js +1 -0
  68. package/src/commands/deploy/cli.js.map +1 -0
  69. package/src/commands/e2e/cli.js +1 -0
  70. package/src/commands/e2e/cli.js.map +1 -0
  71. package/src/commands/extract-i18n/cli.js +1 -0
  72. package/src/commands/extract-i18n/cli.js.map +1 -0
  73. package/src/commands/generate/cli.js +1 -0
  74. package/src/commands/generate/cli.js.map +1 -0
  75. package/src/commands/lint/cli.js +1 -0
  76. package/src/commands/lint/cli.js.map +1 -0
  77. package/src/commands/make-this-awesome/cli.js +1 -0
  78. package/src/commands/make-this-awesome/cli.js.map +1 -0
  79. package/src/commands/mcp/cli.js +1 -0
  80. package/src/commands/mcp/cli.js.map +1 -0
  81. package/src/commands/mcp/constants.d.ts +1 -1
  82. package/src/commands/mcp/constants.js +2 -1
  83. package/src/commands/mcp/constants.js.map +1 -0
  84. package/src/commands/mcp/mcp-server.d.ts +3 -3
  85. package/src/commands/mcp/mcp-server.js +40 -4
  86. package/src/commands/mcp/mcp-server.js.map +1 -0
  87. package/src/commands/mcp/resources/ai-tutor.md +627 -0
  88. package/src/commands/mcp/resources/instructions.js +1 -0
  89. package/src/commands/mcp/resources/instructions.js.map +1 -0
  90. package/src/commands/mcp/tools/ai-tutor.d.ts +8 -0
  91. package/src/commands/mcp/tools/ai-tutor.js +62 -0
  92. package/src/commands/mcp/tools/ai-tutor.js.map +1 -0
  93. package/src/commands/mcp/tools/best-practices.d.ts +4 -1
  94. package/src/commands/mcp/tools/best-practices.js +167 -22
  95. package/src/commands/mcp/tools/best-practices.js.map +1 -0
  96. package/src/commands/mcp/tools/doc-search.d.ts +20 -1
  97. package/src/commands/mcp/tools/doc-search.js +186 -67
  98. package/src/commands/mcp/tools/doc-search.js.map +1 -0
  99. package/src/commands/mcp/tools/examples.d.ts +35 -1
  100. package/src/commands/mcp/tools/examples.js +414 -56
  101. package/src/commands/mcp/tools/examples.js.map +1 -0
  102. package/src/commands/mcp/tools/modernize.js +29 -27
  103. package/src/commands/mcp/tools/modernize.js.map +1 -0
  104. package/src/commands/mcp/tools/onpush-zoneless-migration/analyze_for_unsupported_zone_uses.d.ts +17 -0
  105. package/src/commands/mcp/tools/onpush-zoneless-migration/analyze_for_unsupported_zone_uses.js +62 -0
  106. package/src/commands/mcp/tools/onpush-zoneless-migration/analyze_for_unsupported_zone_uses.js.map +1 -0
  107. package/src/commands/mcp/tools/onpush-zoneless-migration/migrate_single_file.d.ts +12 -0
  108. package/src/commands/mcp/tools/onpush-zoneless-migration/migrate_single_file.js +73 -0
  109. package/src/commands/mcp/tools/onpush-zoneless-migration/migrate_single_file.js.map +1 -0
  110. package/src/commands/mcp/tools/onpush-zoneless-migration/migrate_test_file.d.ts +11 -0
  111. package/src/commands/mcp/tools/onpush-zoneless-migration/migrate_test_file.js +106 -0
  112. package/src/commands/mcp/tools/onpush-zoneless-migration/migrate_test_file.js.map +1 -0
  113. package/src/commands/mcp/tools/onpush-zoneless-migration/prompts.d.ts +15 -0
  114. package/src/commands/mcp/tools/onpush-zoneless-migration/prompts.js +238 -0
  115. package/src/commands/mcp/tools/onpush-zoneless-migration/prompts.js.map +1 -0
  116. package/src/commands/mcp/tools/onpush-zoneless-migration/send_debug_message.d.ts +10 -0
  117. package/src/commands/mcp/tools/onpush-zoneless-migration/send_debug_message.js +20 -0
  118. package/src/commands/mcp/tools/onpush-zoneless-migration/send_debug_message.js.map +1 -0
  119. package/src/commands/mcp/tools/onpush-zoneless-migration/ts_utils.d.ts +36 -0
  120. package/src/commands/mcp/tools/onpush-zoneless-migration/ts_utils.js +136 -0
  121. package/src/commands/mcp/tools/onpush-zoneless-migration/ts_utils.js.map +1 -0
  122. package/src/commands/mcp/tools/onpush-zoneless-migration/types.d.ts +13 -0
  123. package/src/commands/mcp/tools/onpush-zoneless-migration/types.js +10 -0
  124. package/src/commands/mcp/tools/onpush-zoneless-migration/types.js.map +1 -0
  125. package/src/commands/mcp/tools/onpush-zoneless-migration/zoneless-migration.d.ts +14 -0
  126. package/src/commands/mcp/tools/onpush-zoneless-migration/zoneless-migration.js +228 -0
  127. package/src/commands/mcp/tools/onpush-zoneless-migration/zoneless-migration.js.map +1 -0
  128. package/src/commands/mcp/tools/projects.d.ts +75 -16
  129. package/src/commands/mcp/tools/projects.js +427 -30
  130. package/src/commands/mcp/tools/projects.js.map +1 -0
  131. package/src/commands/mcp/tools/tool-registry.d.ts +2 -1
  132. package/src/commands/mcp/tools/tool-registry.js +4 -2
  133. package/src/commands/mcp/tools/tool-registry.js.map +1 -0
  134. package/src/commands/new/cli.js +2 -0
  135. package/src/commands/new/cli.js.map +1 -0
  136. package/src/commands/run/cli.js +1 -0
  137. package/src/commands/run/cli.js.map +1 -0
  138. package/src/commands/serve/cli.js +1 -0
  139. package/src/commands/serve/cli.js.map +1 -0
  140. package/src/commands/test/cli.js +1 -0
  141. package/src/commands/test/cli.js.map +1 -0
  142. package/src/commands/update/cli.js +1 -0
  143. package/src/commands/update/cli.js.map +1 -0
  144. package/src/commands/update/schematic/index.js +1 -0
  145. package/src/commands/update/schematic/index.js.map +1 -0
  146. package/src/commands/update/schematic/schema.d.ts +0 -1
  147. package/src/commands/update/schematic/schema.js +1 -1
  148. package/src/commands/update/schematic/schema.js.map +1 -0
  149. package/src/commands/update/schematic/schema.json +1 -1
  150. package/src/commands/version/cli.d.ts +3 -7
  151. package/src/commands/version/cli.js +50 -49
  152. package/src/commands/version/cli.js.map +1 -0
  153. package/src/commands/version/version-info.d.ts +28 -10
  154. package/src/commands/version/version-info.js +34 -50
  155. package/src/commands/version/version-info.js.map +1 -0
  156. package/src/package-managers/discovery.d.ts +23 -0
  157. package/src/package-managers/discovery.js +110 -0
  158. package/src/package-managers/discovery.js.map +1 -0
  159. package/src/package-managers/error.d.ts +31 -0
  160. package/src/package-managers/error.js +41 -0
  161. package/src/package-managers/error.js.map +1 -0
  162. package/src/package-managers/factory.d.ts +25 -0
  163. package/src/package-managers/factory.js +123 -0
  164. package/src/package-managers/factory.js.map +1 -0
  165. package/src/package-managers/host.d.ts +64 -0
  166. package/src/package-managers/host.js +69 -0
  167. package/src/package-managers/host.js.map +1 -0
  168. package/src/package-managers/index.d.ts +12 -0
  169. package/src/package-managers/index.js +15 -0
  170. package/src/package-managers/index.js.map +1 -0
  171. package/src/package-managers/logger.d.ts +27 -0
  172. package/src/package-managers/logger.js +10 -0
  173. package/src/package-managers/logger.js.map +1 -0
  174. package/src/package-managers/package-manager-descriptor.d.ts +204 -0
  175. package/src/package-managers/package-manager-descriptor.js +147 -0
  176. package/src/package-managers/package-manager-descriptor.js.map +1 -0
  177. package/src/package-managers/package-manager.d.ts +144 -0
  178. package/src/package-managers/package-manager.js +304 -0
  179. package/src/package-managers/package-manager.js.map +1 -0
  180. package/src/package-managers/package-metadata.d.ts +87 -0
  181. package/src/package-managers/package-metadata.js +10 -0
  182. package/src/package-managers/package-metadata.js.map +1 -0
  183. package/src/package-managers/package-tree.d.ts +23 -0
  184. package/src/package-managers/package-tree.js +10 -0
  185. package/src/package-managers/package-tree.js.map +1 -0
  186. package/src/package-managers/parsers.d.ts +92 -0
  187. package/src/package-managers/parsers.js +234 -0
  188. package/src/package-managers/parsers.js.map +1 -0
  189. package/src/package-managers/testing/mock-host.d.ts +26 -0
  190. package/src/package-managers/testing/mock-host.js +53 -0
  191. package/src/package-managers/testing/mock-host.js.map +1 -0
  192. package/src/utilities/color.js +1 -0
  193. package/src/utilities/color.js.map +1 -0
  194. package/src/utilities/completion.js +1 -0
  195. package/src/utilities/completion.js.map +1 -0
  196. package/src/utilities/config.js +1 -0
  197. package/src/utilities/config.js.map +1 -0
  198. package/src/utilities/environment-options.js +1 -0
  199. package/src/utilities/environment-options.js.map +1 -0
  200. package/src/utilities/eol.js +1 -0
  201. package/src/utilities/eol.js.map +1 -0
  202. package/src/utilities/error.js +1 -0
  203. package/src/utilities/error.js.map +1 -0
  204. package/src/utilities/find-up.js +1 -0
  205. package/src/utilities/find-up.js.map +1 -0
  206. package/src/utilities/json-file.js +1 -0
  207. package/src/utilities/json-file.js.map +1 -0
  208. package/src/utilities/log-file.js +1 -0
  209. package/src/utilities/log-file.js.map +1 -0
  210. package/src/utilities/memoize.js +1 -0
  211. package/src/utilities/memoize.js.map +1 -0
  212. package/src/utilities/package-manager.d.ts +12 -0
  213. package/src/utilities/package-manager.js +52 -35
  214. package/src/utilities/package-manager.js.map +1 -0
  215. package/src/utilities/package-metadata.js +1 -0
  216. package/src/utilities/package-metadata.js.map +1 -0
  217. package/src/utilities/package-tree.js +1 -0
  218. package/src/utilities/package-tree.js.map +1 -0
  219. package/src/utilities/project.js +1 -0
  220. package/src/utilities/project.js.map +1 -0
  221. package/src/utilities/prompt.js +1 -0
  222. package/src/utilities/prompt.js.map +1 -0
  223. package/src/utilities/tty.js +1 -0
  224. package/src/utilities/tty.js.map +1 -0
  225. package/src/utilities/version.js +2 -1
  226. package/src/utilities/version.js.map +1 -0
@@ -46,45 +46,143 @@ Object.defineProperty(exports, "__esModule", { value: true });
46
46
  exports.FIND_EXAMPLE_TOOL = void 0;
47
47
  exports.escapeSearchQuery = escapeSearchQuery;
48
48
  const promises_1 = require("node:fs/promises");
49
+ const node_module_1 = require("node:module");
49
50
  const node_path_1 = __importDefault(require("node:path"));
50
51
  const zod_1 = require("zod");
51
52
  const tool_registry_1 = require("./tool-registry");
52
53
  const findExampleInputSchema = zod_1.z.object({
53
- query: zod_1.z.string().describe(`Performs a full-text search using FTS5 syntax. The query should target relevant Angular concepts.
54
-
55
- Key Syntax Features (see https://www.sqlite.org/fts5.html for full documentation):
56
- - AND (default): Space-separated terms are combined with AND.
57
- - Example: 'standalone component' (finds results with both "standalone" and "component")
58
- - OR: Use the OR operator to find results with either term.
59
- - Example: 'validation OR validator'
60
- - NOT: Use the NOT operator to exclude terms.
61
- - Example: 'forms NOT reactive'
62
- - Grouping: Use parentheses () to group expressions.
63
- - Example: '(validation OR validator) AND forms'
64
- - Phrase Search: Use double quotes "" for exact phrases.
65
- - Example: '"template-driven forms"'
66
- - Prefix Search: Use an asterisk * for prefix matching.
67
- - Example: 'rout*' (matches "route", "router", "routing")
68
-
69
- Examples of queries:
70
- - Find standalone components: 'standalone component'
71
- - Find ngFor with trackBy: 'ngFor trackBy'
72
- - Find signal inputs: 'signal input'
73
- - Find lazy loading a route: 'lazy load route'
74
- - Find forms with validation: 'form AND (validation OR validator)'`),
54
+ workspacePath: zod_1.z
55
+ .string()
56
+ .optional()
57
+ .describe('The absolute path to the `angular.json` file for the workspace. This is used to find the ' +
58
+ 'version-specific code examples that correspond to the installed version of the ' +
59
+ 'Angular framework. You **MUST** get this path from the `list_projects` tool. If omitted, ' +
60
+ 'the tool will search the generic code examples bundled with the CLI.'),
61
+ query: zod_1.z
62
+ .string()
63
+ .describe(`The primary, conceptual search query. This should capture the user's main goal or question ` +
64
+ `(e.g., 'lazy loading a route' or 'how to use signal inputs'). The query will be processed ` +
65
+ 'by a powerful full-text search engine.\n\n' +
66
+ 'Key Syntax Features (see https://www.sqlite.org/fts5.html for full documentation):\n' +
67
+ ' - AND (default): Space-separated terms are combined with AND.\n' +
68
+ ' - Example: \'standalone component\' (finds results with both "standalone" and "component")\n' +
69
+ ' - OR: Use the OR operator to find results with either term.\n' +
70
+ " - Example: 'validation OR validator'\n" +
71
+ ' - NOT: Use the NOT operator to exclude terms.\n' +
72
+ " - Example: 'forms NOT reactive'\n" +
73
+ ' - Grouping: Use parentheses () to group expressions.\n' +
74
+ " - Example: '(validation OR validator) AND forms'\n" +
75
+ ' - Phrase Search: Use double quotes "" for exact phrases.\n' +
76
+ ' - Example: \'"template-driven forms"\'\n' +
77
+ ' - Prefix Search: Use an asterisk * for prefix matching.\n' +
78
+ ' - Example: \'rout*\' (matches "route", "router", "routing")'),
79
+ keywords: zod_1.z
80
+ .array(zod_1.z.string())
81
+ .optional()
82
+ .describe('A list of specific, exact keywords to narrow the search. Use this for precise terms like ' +
83
+ 'API names, function names, or decorators (e.g., `ngFor`, `trackBy`, `inject`).'),
84
+ required_packages: zod_1.z
85
+ .array(zod_1.z.string())
86
+ .optional()
87
+ .describe("A list of NPM packages that an example must use. Use this when the user's request is " +
88
+ 'specific to a feature within a certain package (e.g., if the user asks about `ngModel`, ' +
89
+ 'you should filter by `@angular/forms`).'),
90
+ related_concepts: zod_1.z
91
+ .array(zod_1.z.string())
92
+ .optional()
93
+ .describe('A list of high-level concepts to filter by. Use this to find examples related to broader ' +
94
+ 'architectural ideas or patterns (e.g., `signals`, `dependency injection`, `routing`).'),
95
+ includeExperimental: zod_1.z
96
+ .boolean()
97
+ .optional()
98
+ .default(false)
99
+ .describe('By default, this tool returns only production-safe examples. Set this to `true` **only if** ' +
100
+ 'the user explicitly asks for a bleeding-edge feature or if a stable solution to their ' +
101
+ 'problem cannot be found. If you set this to `true`, you **MUST** preface your answer by ' +
102
+ 'warning the user that the example uses experimental APIs that are not suitable for production.'),
103
+ });
104
+ const findExampleOutputSchema = zod_1.z.object({
105
+ examples: zod_1.z.array(zod_1.z.object({
106
+ title: zod_1.z
107
+ .string()
108
+ .describe('The title of the example. Use this as a heading when presenting the example to the user.'),
109
+ summary: zod_1.z
110
+ .string()
111
+ .describe("A one-sentence summary of the example's purpose. Use this to help the user decide " +
112
+ 'if the example is relevant to them.'),
113
+ keywords: zod_1.z
114
+ .array(zod_1.z.string())
115
+ .optional()
116
+ .describe('A list of keywords for the example. You can use these to explain why this example ' +
117
+ "was a good match for the user's query."),
118
+ required_packages: zod_1.z
119
+ .array(zod_1.z.string())
120
+ .optional()
121
+ .describe('A list of NPM packages required for the example to work. Before presenting the code, ' +
122
+ 'you should inform the user if any of these packages need to be installed.'),
123
+ related_concepts: zod_1.z
124
+ .array(zod_1.z.string())
125
+ .optional()
126
+ .describe('A list of related concepts. You can suggest these to the user as topics for ' +
127
+ 'follow-up questions.'),
128
+ related_tools: zod_1.z
129
+ .array(zod_1.z.string())
130
+ .optional()
131
+ .describe('A list of related MCP tools. You can suggest these as potential next steps for the user.'),
132
+ content: zod_1.z
133
+ .string()
134
+ .describe('A complete, self-contained Angular code example in Markdown format. This should be ' +
135
+ 'presented to the user inside a markdown code block.'),
136
+ snippet: zod_1.z
137
+ .string()
138
+ .optional()
139
+ .describe('A contextual snippet from the content showing the matched search term. This field is ' +
140
+ 'critical for efficiently evaluating a result`s relevance. It enables two primary ' +
141
+ 'workflows:\n\n' +
142
+ '1. For direct questions: You can internally review snippets to select the single best ' +
143
+ 'result before generating a comprehensive answer from its full `content`.\n' +
144
+ '2. For ambiguous or exploratory questions: You can present a summary of titles and ' +
145
+ 'snippets to the user, allowing them to guide the next step.'),
146
+ })),
75
147
  });
76
148
  exports.FIND_EXAMPLE_TOOL = (0, tool_registry_1.declareTool)({
77
149
  name: 'find_examples',
78
150
  title: 'Find Angular Code Examples',
79
- description: 'Before writing or modifying any Angular code including templates, ' +
80
- '**ALWAYS** use this tool to find current best-practice examples. ' +
81
- 'This is critical for ensuring code quality and adherence to modern Angular standards. ' +
82
- 'This tool searches a curated database of approved Angular code examples and returns the most relevant results for your query. ' +
83
- 'Example Use Cases: ' +
84
- "1) Creating new components, directives, or services (e.g., query: 'standalone component' or 'signal input'). " +
85
- "2) Implementing core features (e.g., query: 'lazy load route', 'httpinterceptor', or 'route guard'). " +
86
- "3) Refactoring existing code to use modern patterns (e.g., query: 'ngfor trackby' or 'form validation').",
151
+ description: `
152
+ <Purpose>
153
+ Augments your knowledge base with a curated database of official, best-practice code examples,
154
+ focusing on **modern, new, and recently updated** Angular features. This tool acts as a RAG
155
+ (Retrieval-Augmented Generation) source, providing ground-truth information on the latest Angular
156
+ APIs and patterns. You **MUST** use it to understand and apply current standards when working with
157
+ new or evolving features.
158
+ </Purpose>
159
+ <Use Cases>
160
+ * **Knowledge Augmentation:** Learning about new or updated Angular features (e.g., query: 'signal input' or 'deferrable views').
161
+ * **Modern Implementation:** Finding the correct modern syntax for features
162
+ (e.g., query: 'functional route guard' or 'http client with fetch').
163
+ * **Refactoring to Modern Patterns:** Upgrading older code by finding examples of new syntax
164
+ (e.g., query: 'built-in control flow' to replace "*ngIf").
165
+ * **Advanced Filtering:** Combining a full-text search with filters to narrow results.
166
+ (e.g., query: 'forms', required_packages: ['@angular/forms'], keywords: ['validation'])
167
+ </Use Cases>
168
+ <Operational Notes>
169
+ * **Project-Specific Use (Recommended):** For tasks inside a user's project, you **MUST** provide the
170
+ \`workspacePath\` argument to get examples that match the project's Angular version. Get this
171
+ path from \`list_projects\`.
172
+ * **General Use:** If no project context is available (e.g., for general questions or learning),
173
+ you can call the tool without the \`workspacePath\` argument. It will return the latest
174
+ generic examples.
175
+ * **Tool Selection:** This database primarily contains examples for new and recently updated Angular
176
+ features. For established, core features, the main documentation (via the
177
+ \`search_documentation\` tool) may be a better source of information.
178
+ * The examples in this database are the single source of truth for modern Angular coding patterns.
179
+ * The search query uses a powerful full-text search syntax (FTS5). Refer to the 'query'
180
+ parameter description for detailed syntax rules and examples.
181
+ * You can combine the main 'query' with optional filters like 'keywords', 'required_packages',
182
+ and 'related_concepts' to create highly specific searches.
183
+ </Operational Notes>`,
87
184
  inputSchema: findExampleInputSchema.shape,
185
+ outputSchema: findExampleOutputSchema.shape,
88
186
  isReadOnly: true,
89
187
  isLocalOnly: true,
90
188
  shouldRegister: ({ logger }) => {
@@ -99,34 +197,174 @@ exports.FIND_EXAMPLE_TOOL = (0, tool_registry_1.declareTool)({
99
197
  },
100
198
  factory: createFindExampleHandler,
101
199
  });
102
- async function createFindExampleHandler({ exampleDatabasePath }) {
103
- let db;
104
- let queryStatement;
105
- if (process.env['NG_MCP_EXAMPLES_DIR']) {
106
- db = await setupRuntimeExamples(process.env['NG_MCP_EXAMPLES_DIR']);
200
+ /**
201
+ * Attempts to find a version-specific example database from the user's installed
202
+ * version of `@angular/core`. It looks for a custom `angular` metadata property in the
203
+ * framework's `package.json` to locate the database.
204
+ *
205
+ * @example A sample `package.json` `angular` field:
206
+ * ```json
207
+ * {
208
+ * "angular": {
209
+ * "examples": {
210
+ * "format": "sqlite",
211
+ * "path": "./resources/code-examples.db"
212
+ * }
213
+ * }
214
+ * }
215
+ * ```
216
+ *
217
+ * @param workspacePath The absolute path to the user's `angular.json` file.
218
+ * @param logger The MCP tool context logger for reporting warnings.
219
+ * @returns A promise that resolves to an object containing the database path and source,
220
+ * or `undefined` if the database could not be resolved.
221
+ */
222
+ async function getVersionSpecificExampleDatabase(workspacePath, logger) {
223
+ // 1. Resolve the path to package.json
224
+ let pkgJsonPath;
225
+ try {
226
+ const workspaceRequire = (0, node_module_1.createRequire)(workspacePath);
227
+ pkgJsonPath = workspaceRequire.resolve('@angular/core/package.json');
228
+ }
229
+ catch (e) {
230
+ logger.warn(`Could not resolve '@angular/core/package.json' from '${workspacePath}'. ` +
231
+ 'Is Angular installed in this project? Falling back to the bundled examples.');
232
+ return undefined;
233
+ }
234
+ // 2. Read and parse package.json, then find the database.
235
+ try {
236
+ const pkgJsonContent = await (0, promises_1.readFile)(pkgJsonPath, 'utf-8');
237
+ const pkgJson = JSON.parse(pkgJsonContent);
238
+ const examplesInfo = pkgJson['angular']?.examples;
239
+ if (examplesInfo && examplesInfo.format === 'sqlite' && typeof examplesInfo.path === 'string') {
240
+ const packageDirectory = node_path_1.default.dirname(pkgJsonPath);
241
+ const dbPath = node_path_1.default.resolve(packageDirectory, examplesInfo.path);
242
+ // Ensure the resolved database path is within the package boundary.
243
+ const relativePath = node_path_1.default.relative(packageDirectory, dbPath);
244
+ if (relativePath.startsWith('..') || node_path_1.default.isAbsolute(relativePath)) {
245
+ logger.warn(`Detected a potential path traversal attempt in '${pkgJsonPath}'. ` +
246
+ `The path '${examplesInfo.path}' escapes the package boundary. ` +
247
+ 'Falling back to the bundled examples.');
248
+ return undefined;
249
+ }
250
+ // Check the file size to prevent reading a very large file.
251
+ const stats = await (0, promises_1.stat)(dbPath);
252
+ if (stats.size > 10 * 1024 * 1024) {
253
+ // 10MB
254
+ logger.warn(`The example database at '${dbPath}' is larger than 10MB (${stats.size} bytes). ` +
255
+ 'This is unexpected and the file will not be used. Falling back to the bundled examples.');
256
+ return undefined;
257
+ }
258
+ const source = `framework version ${pkgJson.version}`;
259
+ return { dbPath, source };
260
+ }
261
+ else {
262
+ logger.warn(`Did not find valid 'angular.examples' metadata in '${pkgJsonPath}'. ` +
263
+ 'Falling back to the bundled examples.');
264
+ }
265
+ }
266
+ catch (e) {
267
+ logger.warn(`Failed to read or parse version-specific examples metadata referenced in '${pkgJsonPath}': ${e instanceof Error ? e.message : e}. Falling back to the bundled examples.`);
107
268
  }
269
+ return undefined;
270
+ }
271
+ async function createFindExampleHandler({ logger, exampleDatabasePath }) {
272
+ const runtimeDb = process.env['NG_MCP_EXAMPLES_DIR']
273
+ ? await setupRuntimeExamples(process.env['NG_MCP_EXAMPLES_DIR'])
274
+ : undefined;
108
275
  suppressSqliteWarning();
109
- return async ({ query }) => {
110
- if (!db) {
111
- if (!exampleDatabasePath) {
112
- // This should be prevented by the registration logic in mcp-server.ts
113
- throw new Error('Example database path is not available.');
276
+ return async (input) => {
277
+ // If the dev-time override is present, use it and bypass all other logic.
278
+ if (runtimeDb) {
279
+ return queryDatabase(runtimeDb, input);
280
+ }
281
+ let dbPath;
282
+ // First, try to get the version-specific guide.
283
+ if (input.workspacePath) {
284
+ const versionSpecific = await getVersionSpecificExampleDatabase(input.workspacePath, logger);
285
+ if (versionSpecific) {
286
+ dbPath = versionSpecific.dbPath;
114
287
  }
115
- const { DatabaseSync } = await Promise.resolve().then(() => __importStar(require('node:sqlite')));
116
- db = new DatabaseSync(exampleDatabasePath, { readOnly: true });
117
288
  }
118
- if (!queryStatement) {
119
- queryStatement = db.prepare('SELECT * from examples WHERE examples MATCH ? ORDER BY rank;');
289
+ // If the version-specific guide was not found for any reason, fall back to the bundled version.
290
+ if (!dbPath) {
291
+ dbPath = exampleDatabasePath;
292
+ }
293
+ if (!dbPath) {
294
+ // This should be prevented by the registration logic in mcp-server.ts
295
+ throw new Error('Example database path is not available.');
120
296
  }
121
- const sanitizedQuery = escapeSearchQuery(query);
122
- // Query database and return results as text content
123
- const content = [];
124
- for (const exampleRecord of queryStatement.all(sanitizedQuery)) {
125
- content.push({ type: 'text', text: exampleRecord['content'] });
297
+ const { DatabaseSync } = await Promise.resolve().then(() => __importStar(require('node:sqlite')));
298
+ const db = new DatabaseSync(dbPath, { readOnly: true });
299
+ return queryDatabase(db, input);
300
+ };
301
+ }
302
+ function queryDatabase(db, input) {
303
+ const { query, keywords, required_packages, related_concepts, includeExperimental } = input;
304
+ // Build the query dynamically
305
+ const params = [];
306
+ let sql = `SELECT e.title, e.summary, e.keywords, e.required_packages, e.related_concepts, e.related_tools, e.content, ` +
307
+ // The `snippet` function generates a contextual snippet of the matched text.
308
+ // Column 6 is the `content` column. We highlight matches with asterisks and limit the snippet size.
309
+ "snippet(examples_fts, 6, '**', '**', '...', 15) AS snippet " +
310
+ 'FROM examples e JOIN examples_fts ON e.id = examples_fts.rowid';
311
+ const whereClauses = [];
312
+ // FTS query
313
+ if (query) {
314
+ whereClauses.push('examples_fts MATCH ?');
315
+ params.push(escapeSearchQuery(query));
316
+ }
317
+ // JSON array filters
318
+ const addJsonFilter = (column, values) => {
319
+ if (values?.length) {
320
+ for (const value of values) {
321
+ whereClauses.push(`e.${column} LIKE ?`);
322
+ params.push(`%"${value}"%`);
323
+ }
126
324
  }
127
- return {
128
- content,
325
+ };
326
+ addJsonFilter('keywords', keywords);
327
+ addJsonFilter('required_packages', required_packages);
328
+ addJsonFilter('related_concepts', related_concepts);
329
+ if (!includeExperimental) {
330
+ whereClauses.push('e.experimental = 0');
331
+ }
332
+ if (whereClauses.length > 0) {
333
+ sql += ` WHERE ${whereClauses.join(' AND ')}`;
334
+ }
335
+ // Order the results by relevance using the BM25 algorithm.
336
+ // The weights assigned to each column boost the ranking of documents where the
337
+ // search term appears in a more important field.
338
+ // Column order: title, summary, keywords, required_packages, related_concepts, related_tools, content
339
+ sql += ' ORDER BY bm25(examples_fts, 10.0, 5.0, 5.0, 1.0, 2.0, 1.0, 1.0);';
340
+ const queryStatement = db.prepare(sql);
341
+ // Query database and return results
342
+ const examples = [];
343
+ const textContent = [];
344
+ for (const exampleRecord of queryStatement.all(...params)) {
345
+ const record = exampleRecord;
346
+ const example = {
347
+ title: record['title'],
348
+ summary: record['summary'],
349
+ keywords: JSON.parse(record['keywords'] || '[]'),
350
+ required_packages: JSON.parse(record['required_packages'] || '[]'),
351
+ related_concepts: JSON.parse(record['related_concepts'] || '[]'),
352
+ related_tools: JSON.parse(record['related_tools'] || '[]'),
353
+ content: record['content'],
354
+ snippet: record['snippet'],
129
355
  };
356
+ examples.push(example);
357
+ // Also create a more structured text output
358
+ let text = `## Example: ${example.title}\n**Summary:** ${example.summary}`;
359
+ if (example.snippet) {
360
+ text += `\n**Snippet:** ${example.snippet}`;
361
+ }
362
+ text += `\n\n---\n\n${example.content}`;
363
+ textContent.push({ type: 'text', text });
364
+ }
365
+ return {
366
+ content: textContent,
367
+ structuredContent: { examples },
130
368
  };
131
369
  }
132
370
  /**
@@ -206,19 +444,139 @@ function suppressSqliteWarning() {
206
444
  return originalProcessEmit.apply(process, arguments);
207
445
  };
208
446
  }
447
+ /**
448
+ * A simple YAML front matter parser.
449
+ *
450
+ * This function extracts the YAML block enclosed by `---` at the beginning of a string
451
+ * and parses it into a JavaScript object. It is not a full YAML parser and only
452
+ * supports simple key-value pairs and string arrays.
453
+ *
454
+ * @param content The string content to parse.
455
+ * @returns A record containing the parsed front matter data.
456
+ */
457
+ function parseFrontmatter(content) {
458
+ const match = content.match(/^---\r?\n(.*?)\r?\n---/s);
459
+ if (!match) {
460
+ return {};
461
+ }
462
+ const frontmatter = match[1];
463
+ const data = {};
464
+ const lines = frontmatter.split(/\r?\n/);
465
+ let currentKey = '';
466
+ let isArray = false;
467
+ const arrayValues = [];
468
+ for (const line of lines) {
469
+ const keyValueMatch = line.match(/^([^:]+):\s*(.*)/);
470
+ if (keyValueMatch) {
471
+ if (currentKey && isArray) {
472
+ data[currentKey] = arrayValues.slice();
473
+ arrayValues.length = 0;
474
+ }
475
+ const [, key, value] = keyValueMatch;
476
+ currentKey = key.trim();
477
+ isArray = value.trim() === '';
478
+ if (!isArray) {
479
+ const trimmedValue = value.trim();
480
+ if (trimmedValue === 'true') {
481
+ data[currentKey] = true;
482
+ }
483
+ else if (trimmedValue === 'false') {
484
+ data[currentKey] = false;
485
+ }
486
+ else {
487
+ data[currentKey] = trimmedValue;
488
+ }
489
+ }
490
+ }
491
+ else {
492
+ const arrayItemMatch = line.match(/^\s*-\s*(.*)/);
493
+ if (arrayItemMatch && currentKey && isArray) {
494
+ let value = arrayItemMatch[1].trim();
495
+ // Unquote if the value is quoted.
496
+ if ((value.startsWith("'") && value.endsWith("'")) ||
497
+ (value.startsWith('"') && value.endsWith('"'))) {
498
+ value = value.slice(1, -1);
499
+ }
500
+ arrayValues.push(value);
501
+ }
502
+ }
503
+ }
504
+ if (currentKey && isArray) {
505
+ data[currentKey] = arrayValues;
506
+ }
507
+ return data;
508
+ }
209
509
  async function setupRuntimeExamples(examplesPath) {
210
510
  const { DatabaseSync } = await Promise.resolve().then(() => __importStar(require('node:sqlite')));
211
511
  const db = new DatabaseSync(':memory:');
212
- db.exec(`CREATE VIRTUAL TABLE examples USING fts5(content, tokenize = 'porter ascii');`);
213
- const insertStatement = db.prepare('INSERT INTO examples(content) VALUES(?);');
512
+ // Create a relational table to store the structured example data.
513
+ db.exec(`
514
+ CREATE TABLE examples (
515
+ id INTEGER PRIMARY KEY,
516
+ title TEXT NOT NULL,
517
+ summary TEXT NOT NULL,
518
+ keywords TEXT,
519
+ required_packages TEXT,
520
+ related_concepts TEXT,
521
+ related_tools TEXT,
522
+ experimental INTEGER NOT NULL DEFAULT 0,
523
+ content TEXT NOT NULL
524
+ );
525
+ `);
526
+ // Create an FTS5 virtual table to provide full-text search capabilities.
527
+ db.exec(`
528
+ CREATE VIRTUAL TABLE examples_fts USING fts5(
529
+ title,
530
+ summary,
531
+ keywords,
532
+ required_packages,
533
+ related_concepts,
534
+ related_tools,
535
+ content,
536
+ content='examples',
537
+ content_rowid='id',
538
+ tokenize = 'porter ascii'
539
+ );
540
+ `);
541
+ // Create triggers to keep the FTS table synchronized with the examples table.
542
+ db.exec(`
543
+ CREATE TRIGGER examples_after_insert AFTER INSERT ON examples BEGIN
544
+ INSERT INTO examples_fts(rowid, title, summary, keywords, required_packages, related_concepts, related_tools, content)
545
+ VALUES (
546
+ new.id, new.title, new.summary, new.keywords, new.required_packages, new.related_concepts,
547
+ new.related_tools, new.content
548
+ );
549
+ END;
550
+ `);
551
+ const insertStatement = db.prepare('INSERT INTO examples(' +
552
+ 'title, summary, keywords, required_packages, related_concepts, related_tools, experimental, content' +
553
+ ') VALUES(?, ?, ?, ?, ?, ?, ?, ?);');
554
+ const frontmatterSchema = zod_1.z.object({
555
+ title: zod_1.z.string(),
556
+ summary: zod_1.z.string(),
557
+ keywords: zod_1.z.array(zod_1.z.string()).optional(),
558
+ required_packages: zod_1.z.array(zod_1.z.string()).optional(),
559
+ related_concepts: zod_1.z.array(zod_1.z.string()).optional(),
560
+ related_tools: zod_1.z.array(zod_1.z.string()).optional(),
561
+ experimental: zod_1.z.boolean().optional(),
562
+ });
214
563
  db.exec('BEGIN TRANSACTION');
215
- for await (const entry of (0, promises_1.glob)('*.md', { cwd: examplesPath, withFileTypes: true })) {
564
+ for await (const entry of (0, promises_1.glob)('**/*.md', { cwd: examplesPath, withFileTypes: true })) {
216
565
  if (!entry.isFile()) {
217
566
  continue;
218
567
  }
219
- const example = await (0, promises_1.readFile)(node_path_1.default.join(entry.parentPath, entry.name), 'utf-8');
220
- insertStatement.run(example);
568
+ const content = await (0, promises_1.readFile)(node_path_1.default.join(entry.parentPath, entry.name), 'utf-8');
569
+ const frontmatter = parseFrontmatter(content);
570
+ const validation = frontmatterSchema.safeParse(frontmatter);
571
+ if (!validation.success) {
572
+ // eslint-disable-next-line no-console
573
+ console.warn(`Skipping invalid example file ${entry.name}:`, validation.error.issues);
574
+ continue;
575
+ }
576
+ const { title, summary, keywords, required_packages, related_concepts, related_tools, experimental, } = validation.data;
577
+ insertStatement.run(title, summary, JSON.stringify(keywords ?? []), JSON.stringify(required_packages ?? []), JSON.stringify(related_concepts ?? []), JSON.stringify(related_tools ?? []), experimental ? 1 : 0, content);
221
578
  }
222
579
  db.exec('END TRANSACTION');
223
580
  return db;
224
581
  }
582
+ //# sourceMappingURL=examples.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"examples.js","sourceRoot":"","sources":["examples.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;;;;;;;;;;;;;;;;;;;;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D,IAAI,CAAC,UAAU,CAAC,OAAO,EAAE,CAAC;YACxB,sCAAsC;YACtC,OAAO,CAAC,IAAI,CAAC,iCAAiC,KAAK,CAAC,IAAI,GAAG,EAAE,UAAU,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;YACtF,SAAS;QACX,CAAC;QAED,MAAM,EACJ,KAAK,EACL,OAAO,EACP,QAAQ,EACR,iBAAiB,EACjB,gBAAgB,EAChB,aAAa,EACb,YAAY,GACb,GAAG,UAAU,CAAC,IAAI,CAAC;QAEpB,eAAe,CAAC,GAAG,CACjB,KAAK,EACL,OAAO,EACP,IAAI,CAAC,SAAS,CAAC,QAAQ,IAAI,EAAE,CAAC,EAC9B,IAAI,CAAC,SAAS,CAAC,iBAAiB,IAAI,EAAE,CAAC,EACvC,IAAI,CAAC,SAAS,CAAC,gBAAgB,IAAI,EAAE,CAAC,EACtC,IAAI,CAAC,SAAS,CAAC,aAAa,IAAI,EAAE,CAAC,EACnC,YAAY,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EACpB,OAAO,CACR,CAAC;IACJ,CAAC;IACD,EAAE,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC;IAE3B,OAAO,EAAE,CAAC;AACZ,CAAC"}
@@ -22,11 +22,6 @@ const TRANSFORMATIONS = [
22
22
  description: 'Converts tags for elements with no content to be self-closing (e.g., `<app-foo></app-foo>` becomes `<app-foo />`).',
23
23
  documentationUrl: 'https://angular.dev/reference/migrations/self-closing-tags',
24
24
  },
25
- {
26
- name: 'test-bed-get',
27
- description: 'Updates `TestBed.get` to the preferred and type-safe `TestBed.inject` in TypeScript test files.',
28
- documentationUrl: 'https://angular.dev/guide/testing/dependency-injection',
29
- },
30
25
  {
31
26
  name: 'inject',
32
27
  description: 'Converts usages of constructor-based injection to the inject() function.',
@@ -59,17 +54,14 @@ const TRANSFORMATIONS = [
59
54
  '3. Run `ng g @angular/core:standalone` and select "Bootstrap the project using standalone APIs"',
60
55
  documentationUrl: 'https://angular.dev/reference/migrations/standalone',
61
56
  },
62
- {
63
- name: 'zoneless',
64
- description: 'Migrates the application to be zoneless.',
65
- documentationUrl: 'https://angular.dev/guide/zoneless',
66
- },
67
57
  ];
68
58
  const modernizeInputSchema = zod_1.z.object({
69
59
  // Casting to [string, ...string[]] since the enum definition requires a nonempty array.
70
60
  transformations: zod_1.z
71
61
  .array(zod_1.z.enum(TRANSFORMATIONS.map((t) => t.name)))
72
- .optional(),
62
+ .optional()
63
+ .describe('A list of specific transformations to get instructions for. ' +
64
+ 'If omitted, general guidance is provided.'),
73
65
  });
74
66
  function generateInstructions(transformationNames) {
75
67
  if (transformationNames.length === 0) {
@@ -107,29 +99,39 @@ async function runModernization(input) {
107
99
  exports.MODERNIZE_TOOL = (0, tool_registry_1.declareTool)({
108
100
  name: 'modernize',
109
101
  title: 'Modernize Angular Code',
110
- description: '<Purpose>\n' +
111
- 'This tool modernizes Angular code by applying the latest best practices and syntax improvements, ' +
112
- 'ensuring it is idiomatic, readable, and maintainable.\n\n' +
113
- '</Purpose>\n' +
114
- '<Use Cases>\n' +
115
- '* After generating new code: Run this tool immediately after creating new Angular components, directives, ' +
116
- 'or services to ensure they adhere to modern standards.\n' +
117
- '* On existing code: Apply to existing TypeScript files (.ts) and Angular templates (.html) to update ' +
118
- 'them with the latest features, such as the new built-in control flow syntax.\n\n' +
119
- '* When the user asks for a specific transformation: When the transformation list is populated, ' +
120
- 'these specific ones will be ran on the inputs.\n' +
121
- '</Use Cases>\n' +
122
- '<Transformations>\n' +
123
- TRANSFORMATIONS.map((t) => `* ${t.name}: ${t.description}`).join('\n') +
124
- '\n</Transformations>\n',
102
+ description: `
103
+ <Purpose>
104
+ Provides instructions and commands for modernizing Angular code to align with the latest best
105
+ practices and syntax. This tool helps ensure code is idiomatic, readable, and maintainable by
106
+ generating the exact steps needed to perform specific migrations.
107
+ </Purpose>
108
+ <Use Cases>
109
+ * **Applying Specific Migrations:** Get the precise commands to update code to modern patterns
110
+ (e.g., selecting 'control-flow-migration' to replace *ngIf with @if).
111
+ * **Upgrading Existing Code:** Modernize an entire project by running the 'standalone' migration,
112
+ which provides a multi-step command sequence.
113
+ * **Discovering Available Migrations:** Call the tool with no transformations to get a link to the
114
+ general best practices guide.
115
+ </Use Cases>
116
+ <Operational Notes>
117
+ * **Execution:** This tool **provides instructions**, which you **MUST** then execute as shell commands.
118
+ It does not modify code directly.
119
+ * **Standalone Migration:** The 'standalone' transformation is a special, multi-step process.
120
+ You **MUST** execute the commands in the exact order provided and validate your application
121
+ between each step.
122
+ * **Transformation List:** The following transformations are available:
123
+ ${TRANSFORMATIONS.map((t) => ` * ${t.name}: ${t.description}`).join('\n')}
124
+ </Operational Notes>`,
125
125
  inputSchema: modernizeInputSchema.shape,
126
126
  outputSchema: {
127
127
  instructions: zod_1.z
128
128
  .array(zod_1.z.string())
129
129
  .optional()
130
- .describe('A list of instructions on how to run the migrations.'),
130
+ .describe('A list of instructions and shell commands to run the requested modernizations. ' +
131
+ 'Each string in the array is a separate step or command.'),
131
132
  },
132
133
  isLocalOnly: true,
133
134
  isReadOnly: true,
134
135
  factory: () => (input) => runModernization(input),
135
136
  });
137
+ //# sourceMappingURL=modernize.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"modernize.js","sourceRoot":"","sources":["modernize.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;AAwGH,4CAOC;AA7GD,6BAAwB;AACxB,mDAA8C;AAS9C,MAAM,eAAe,GAA0B;IAC7C;QACE,IAAI,EAAE,wBAAwB;QAC9B,WAAW,EACT,qHAAqH;QACvH,gBAAgB,EAAE,uDAAuD;KAC1E;IACD;QACE,IAAI,EAAE,6BAA6B;QACnC,WAAW,EACT,oHAAoH;QACtH,gBAAgB,EAAE,4DAA4D;KAC/E;IACD;QACE,IAAI,EAAE,QAAQ;QACd,WAAW,EAAE,0EAA0E;QACvF,gBAAgB,EAAE,0DAA0D;KAC7E;IACD;QACE,IAAI,EAAE,kBAAkB;QACxB,W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