@dxtmisha/scripts 0.10.8 → 0.10.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.
package/CHANGELOG.md CHANGED
@@ -2,6 +2,14 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file.
4
4
 
5
+ ## [0.10.9] - 2026-08-03
6
+
7
+ ### Changed
8
+ - **DesignTypes**: Updated AI prompt instructions in `DesignTypes.toAiEdit` and `DesignTypes.toAiDescription`:
9
+ - Enforced strict prompt boundaries forbidding AI agents from analyzing unprovided external files, links, paths, or environment data.
10
+ - Enhanced JSDoc generation rules to generate English JSDocs for non-obvious entities directly from JS implementation code.
11
+ - Expanded project description structure in `toAiDescription` to detail all exposed capabilities and triggers for `ai-types.md` analysis, and added optional `code` parameter support.
12
+
5
13
  ## [0.10.8] - 2026-07-28
6
14
 
7
15
  ### Added / Updated
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@dxtmisha/scripts",
3
3
  "private": false,
4
- "version": "0.10.8",
4
+ "version": "0.10.10",
5
5
  "type": "module",
6
6
  "description": "Development scripts and CLI tools for DXT UI projects - automated component generation, library building and project management tools",
7
7
  "keywords": [
@@ -1,12 +1,12 @@
1
- import { forEach, ServerStorage } from '@dxtmisha/functional-basic'
1
+ import { forEach, isFilled, ServerStorage } from '@dxtmisha/functional-basic'
2
2
  import { getPackageJson } from '../../functions/getPackageJson'
3
3
  import { useAi } from '../../composables/useAi'
4
4
 
5
5
  import { PropertiesFile } from '../Properties/PropertiesFile'
6
6
 
7
- import type { DesignTypesList } from '../../types/designTypes'
7
+ import type { DesignMcpResourceItem, DesignMcpResources, DesignTypesList } from '../../types/designTypes'
8
8
 
9
- import { UI_DIR_CONSTRUCTOR, UI_FILE_AI_DESCRIPTION, UI_FILE_AI_TYPES } from '../../config'
9
+ import { UI_DIR_CONSTRUCTOR, UI_FILE_AI_DESCRIPTION, UI_FILE_AI_MCP, UI_FILE_AI_TYPES, UI_MODULES } from '../../config'
10
10
 
11
11
  /**
12
12
  * Engine for generating compressed and AI-optimized TypeScript type definitions.
@@ -28,9 +28,11 @@ export class DesignTypes {
28
28
  *
29
29
  * Конструктор для DesignTypes.
30
30
  * @param dir input directory path containing declaration files / входной путь к директории, содержащей файлы деклараций
31
+ * @param promptsDir input directory path containing prompt files / входной путь к директории, содержащей файлы промптов
31
32
  */
32
33
  constructor(
33
- protected readonly dir: string = 'dist'
34
+ protected readonly dir: string = 'dist',
35
+ protected readonly promptsDir: string = 'ai-prompts'
34
36
  ) {
35
37
  ServerStorage.setErrorStatus(true)
36
38
  this.dirArray = this.dir.split('/')
@@ -53,8 +55,18 @@ export class DesignTypes {
53
55
  const aiContent = await this.toAiEdit(fullContent, fullJsContent)
54
56
  this.save(aiContent)
55
57
 
56
- const aiDescription = await this.toAiDescription(fullContent)
57
- this.saveDescription(aiDescription)
58
+ const aiDescription = await this.toAiDescription(fullContent, fullJsContent)
59
+
60
+ const promptList = this.getListPrompts()
61
+ const prompts = await this.toAiPrompts(promptList)
62
+
63
+ this.saveDescription(`${aiDescription}\n${prompts}`)
64
+
65
+ const mcpPrompts = await this.toAiMcpPrompts(promptList)
66
+
67
+ if (mcpPrompts) {
68
+ this.saveMcp(mcpPrompts)
69
+ }
58
70
 
59
71
  console.log('DesignTypes: AI types saved.')
60
72
  }
@@ -111,6 +123,16 @@ export class DesignTypes {
111
123
  return [...this.dirArray, file]
112
124
  }
113
125
 
126
+ /**
127
+ * Returns the project name from package.json.
128
+ *
129
+ * Возвращает название проекта из package.json.
130
+ * @returns project name or 'none' / название проекта или 'none'
131
+ */
132
+ protected getProjectName(): string {
133
+ return getPackageJson()?.name ?? 'none'
134
+ }
135
+
114
136
  /**
115
137
  * Reads the directory recursively.
116
138
  *
@@ -164,6 +186,30 @@ export class DesignTypes {
164
186
  return this.getListBy(file => this.isFileJs(file))
165
187
  }
166
188
 
189
+ /**
190
+ * Gets a list of prompt files.
191
+ *
192
+ * Получает список файлов с промптами.
193
+ */
194
+ protected getListPrompts(): DesignTypesList {
195
+ const files = PropertiesFile.readDirRecursive(this.promptsDir)
196
+
197
+ return forEach(
198
+ files,
199
+ (file) => {
200
+ const path = `${this.promptsDir}/${file}`
201
+ const content = PropertiesFile.readFileOnly(path)
202
+
203
+ if (content) {
204
+ return {
205
+ path,
206
+ content
207
+ }
208
+ }
209
+ }
210
+ ) as DesignTypesList
211
+ }
212
+
167
213
  /**
168
214
  * Reads the content of a file.
169
215
  *
@@ -213,6 +259,19 @@ export class DesignTypes {
213
259
  )
214
260
  }
215
261
 
262
+ /**
263
+ * Saves the AI-generated MCP server resources to a file.
264
+ *
265
+ * Сохраняет сгенерированные ИИ ресурсы MCP-сервера в файл.
266
+ * @param data data to save / данные для сохранения
267
+ */
268
+ protected saveMcp(data: object) {
269
+ PropertiesFile.writeByPath(
270
+ UI_FILE_AI_MCP,
271
+ JSON.stringify(data, null, 2)
272
+ )
273
+ }
274
+
216
275
  /**
217
276
  * Combines a list of files into a single string.
218
277
  *
@@ -270,25 +329,31 @@ export class DesignTypes {
270
329
  protected async toAiEdit(content: string, code: string): Promise<string> {
271
330
  const generate = await this.toAi(
272
331
  content,
273
- 'TRANSLATE all non-English comments (including JSDocs and inline comments) to English. '
274
- + 'Optimize the provided type definitions, improve and supplement them if necessary. '
275
- + 'Carefully study the provided JS code to understand its logic and what the code does. '
276
- + 'Remove redundant or self-explanatory JSDoc comments for any entity (types, properties, variables, functions, methods, etc.) if their meaning is obvious from their name or signature and does not require documentation. '
277
- + 'Keep or add clear English JSDoc comments for entities that are complex, non-obvious, or require explanation. '
278
- + 'CRITICAL: Always keep all JSDoc "@example", "@remarks", "@note", and any other notes or warnings. Their contents must NOT be modified, altered, or rewritten—keep them exactly as written, only translating them to English if they are not in English. '
279
- + 'CRITICAL: Remove all imports. Remove all local internal re-exports (e.g., `export * from "./..."`), but strictly KEEP any exports from external libraries or packages. '
280
- + 'Remove all non-public content: delete all private and protected class methods and properties, and any non-exported elements. The final output must contain only the members and entities that are accessible from outside. '
281
- + 'Remove any code segments or data that do not provide useful information for an AI assistant. '
282
- + 'You may remove abstract classes or other structures that provide no practical value for code generation, but do so with extreme caution. Maintain a strict balance: if there is even a 5% chance the item might be relevant for understanding the API or generating code, keep it. Think carefully before every deletion. '
283
- + 'Remove any large Enums that add excessive length without providing critical context. '
284
- + 'Your goal is to create a compact, context-rich file that enables any AI coding assistant to generate high-quality code for a developer. '
285
- + 'Ensure that no public API surface, essential data types, or required logic is lost. '
286
- + 'Do not delete any "type" definitions; they are strictly required. '
287
- + 'Remove all regular comments and inline comments (lines starting with "//" or "/* ... */"). '
288
- + 'Do not include empty lines; keep the output compact and tight without blank lines. '
289
- + 'CRITICAL: Do NOT return the provided JS code in your response. '
290
- + 'All instructions are mandatory and must be executed perfectly. '
291
- + 'Return ONLY the resulting optimized type definitions code. No markdown code blocks, no tags, no explanations, and no additional comments from the AI. NOTHING but the pure code.',
332
+ 'Goal: Optimize and generate clean, highly informative TypeScript type definitions based ONLY on the provided code and types.\n\n'
333
+ + 'CRITICAL CONTEXT & SCOPE RESTRICTIONS:\n'
334
+ + '- IMPORTANT: The AI coding agent that will write code for developers using this library will NEVER see or have access to the underlying JS implementation code or external files. It will rely EXCLUSIVELY on the output document generated by you in this session. You MUST ensure that your output provides complete, flawless context, clear JSDoc explanations, and precise type contracts so that the reading AI agent can write accurate code without making assumptions.\n'
335
+ + '- Analyze ONLY the code, type definitions, and text explicitly provided in this prompt. Do NOT attempt to read, search, infer, or assume any external files, imports, project structure, or unprovided environment data.\n'
336
+ + '- Do NOT include any references, links, file paths, or pointers to external files or local directories in the final output, as AI agents will have no environment file access.\n'
337
+ + '- Do NOT return the provided JS code in your response.\n\n'
338
+ + 'JSDOC & COMMENT RULES:\n'
339
+ + '- STUDY THE PROVIDED JS CODE: You are explicitly provided with the JS implementation code (`File JS Code`). You MUST study the JS code for every function/method/property to understand its exact logic, behavior, and purpose.\n'
340
+ + '- GENERATE MISSING JSDOCS FROM JS CODE: If an entity lacks a JSDoc comment in the input declarations, but its provided JS code implementation reveals its behavior or purpose, you MUST generate and add a clear, fluff-free English JSDoc description directly above its declaration.\n'
341
+ + '- DEFINITION OF OBVIOUS (NO JSDOC): An entity is "obvious" ONLY IF its name uses clear, standard English naming conventions (e.g., `isString`, `capitalize`, `copyObject`) AND its functionality is 100% self-evident from its signature alone. Obvious entities MUST NOT have a JSDoc.\n'
342
+ + '- MANDATORY JSDOC FOR NON-OBVIOUS ENTITIES: Any entity with an obscure, non-standard, custom, abbreviated, or ambiguous name (e.g., `abutaSudatoho`, `transformation`), or complex logic, MUST have a clear English JSDoc description generated by inspecting its JS implementation code.\n'
343
+ + '- Write JSDoc comments WITHOUT fluff or filler text, focusing strictly on operational logic and behavior.\n'
344
+ + '- Place all JSDoc comments STRICTLY directly above the target declaration.\n'
345
+ + '- Translate all non-English comments and JSDocs to English.\n'
346
+ + '- Remove regular inline comments (`//` or `/* ... */`).\n'
347
+ + '- STRICTLY PRESERVE all JSDoc tags like `@example`, `@remarks`, `@note`, and warnings—keep them intact, translating only to English if needed.\n\n'
348
+ + 'CLEANING & OPTIMIZATION:\n'
349
+ + '- Remove all `import` statements and local internal re-exports (e.g., `export * from "./..."`). Strictly KEEP exports from external packages.\n'
350
+ + '- Delete all non-public content (private/protected class members, unexported elements). Keep all public API surfaces.\n'
351
+ + '- Do NOT delete any `type` definitions; they are strictly required.\n'
352
+ + '- Remove large Enums or structures that add length without critical context.\n'
353
+ + '- Exercise extreme caution when removing abstract classes: if there is even a 5% chance it helps understand the API or generate code, keep it.\n'
354
+ + '- Format output tightly with no blank lines.\n\n'
355
+ + 'OUTPUT REQUIREMENTS:\n'
356
+ + 'Return ONLY the resulting optimized TypeScript type definitions code. No markdown formatting, no code blocks (```), no explanations, and no additional AI text. NOTHING but pure code.',
292
357
  code
293
358
  )
294
359
 
@@ -300,22 +365,160 @@ export class DesignTypes {
300
365
  *
301
366
  * Генерирует описание проекта и рекомендации по использованию с помощью ИИ.
302
367
  * @param content cleaned type definitions / очищенные определения типов
368
+ * @param code JS code for analysis / JS код для анализа
369
+ */
370
+ protected async toAiDescription(content: string, code?: string): Promise<string> {
371
+ const generate = await this.toAi(
372
+ content,
373
+ 'Goal: Generate a CONCISE, high-density project overview for an AI coding assistant to evaluate this library\'s core purpose, key module groupings, and triggers for studying type definitions.\n\n'
374
+ + 'CRITICAL RESTRICTIONS:\n'
375
+ + '- Keep the output dense, focused, and fluff-free. Avoid bloated descriptions, exhaustive lists of individual methods, classes, or components by name, or repetitive explanations.\n'
376
+ + '- Always group components, classes, or methods by functional category (e.g. "form components", "navigation controls", "storage utilities") instead of enumerating every individual name.\n'
377
+ + '- Analyze ONLY the code, type definitions, and text explicitly provided in this prompt. Do NOT assume external unprovided data.\n'
378
+ + '- Do NOT include file paths, relative links, URLs, or markdown formatting.\n\n'
379
+ + 'STRUCTURE REQUIREMENTS (Provide a single cohesive text block):\n'
380
+ + '1. Core Purpose: 1-2 sentences summarizing the library\'s primary technical function and responsibility.\n'
381
+ + '2. Key Capabilities & Groupings: Group main classes, composables, or components into high-level functional modules (e.g. API/Network, Storage, Localization, Form Components, Layout Controls, Utilities) and summarize their capabilities in tight sentences. Avoid listing individual component or method names—group them by function instead.\n'
382
+ + '3. Triggers for Studying ai-types.md: Under what specific coding requirements, keywords, tasks, or architectural needs is it mandatory for the AI to study "ai-types.md"?\n'
383
+ + '4. Integration Context: 1 sentence explaining how this library connects with other stack frameworks or packages.\n\n'
384
+ + 'OUTPUT REQUIREMENTS:\n'
385
+ + 'Return ONLY the resulting concise description text. No markdown code blocks (```), no section headers, no labels (like "Description:"), and no conversational fluff.',
386
+ code
387
+ )
388
+
389
+ return generate ?? ''
390
+ }
391
+
392
+ /**
393
+ * Generates project rules and prompt triggers description.
394
+ *
395
+ * Генерирует описание правил проекта и триггеров промптов.
396
+ * @param list list of prompt files / список файлов промптов
397
+ */
398
+ protected async toAiPrompts(list: DesignTypesList): Promise<string> {
399
+ const projectName = this.getProjectName()
400
+ const promptList = await Promise.all(
401
+ forEach(list, async (item) => {
402
+ const content = await this.toAiPromptName(item.content)
403
+
404
+ if (isFilled(content)) {
405
+ return `- '${UI_MODULES}/${projectName}/${item.path}': ${content}`
406
+ }
407
+
408
+ return ''
409
+ })
410
+ )
411
+
412
+ const prompts = promptList.filter(Boolean).join('\n')
413
+
414
+ if (prompts) {
415
+ return '## Mandatory Rules\n'
416
+ + 'Read the corresponding file if your task relates to:\n'
417
+ + `${prompts}`
418
+ }
419
+
420
+ return ''
421
+ }
422
+
423
+ /**
424
+ * Generates a trigger description for studying a prompt file using AI.
425
+ *
426
+ * Генерирует описание-триггер для изучения файла промпта с помощью ИИ.
427
+ * @param content prompt file content / содержимое файла промпта
303
428
  */
304
- protected async toAiDescription(content: string): Promise<string> {
429
+ protected async toAiPromptName(content: string): Promise<string> {
305
430
  const generate = await this.toAi(
306
431
  content,
307
- 'Analyze the provided code and generate a highly technical, structured, and concise project overview specifically designed for another AI coding assistant. '
308
- + 'The description must enable the reading AI to immediately evaluate whether this library contains code, components, classes, or utilities useful for its current task, and when it is mandatory to read and analyze "ai-types.md". '
309
- + 'The description must be objective, factual, precise, and free of marketing fluff. '
310
- + 'Include: '
311
- + '1. Core Purpose: What is the primary technical function of this library? '
312
- + '2. Key Expositions: What are the main classes, hooks, utilities, or components exposed by this project, and what specific tasks do they perform? '
313
- + '3. Triggers for Studying ai-types.md: Under what specific conditions, keywords, or coding requirements is this library indispensable, making it mandatory for the AI to study its "ai-types.md" file? '
314
- + '4. Integration Context: How does it connect with other technologies in the system stack? '
315
- + 'Ensure the structure is clean and enables immediate context retrieval. '
316
- + 'Return ONLY the resulting description text. No markdown, no labels like "Description:", no explanations. NOTHING but the pure content.'
432
+ 'Goal: Generate an EXTREMELY SHORT, high-density topic summary for an AI coding assistant describing what rules/topics are covered in this prompt document.\n\n'
433
+ + 'CRITICAL RESTRICTIONS:\n'
434
+ + '- The output MUST be EXTREMELY CONCISE: 1 short sentence or clause (maximum 10-15 words).\n'
435
+ + '- Do NOT include repetitive filler like "When working with...", "you MUST study this document", or "in order to follow...".\n'
436
+ + '- Analyze ONLY the text explicitly provided in this prompt.\n'
437
+ + '- Do NOT include file paths, URLs, quotes, or markdown syntax.\n\n'
438
+ + 'EXAMPLES OF GOOD OUTPUT:\n'
439
+ + '- "Class structure, typing standards, SSR safety, and primitive helpers"\n'
440
+ + '- "HTTP client, storage management, localization, and DOM event helpers"\n'
441
+ + '- "MDX documentation generation rules for TypeScript classes"\n\n'
442
+ + 'OUTPUT REQUIREMENTS:\n'
443
+ + 'Return ONLY the resulting short topic summary. No markdown code blocks (```), no labels, no quotes, and no conversational text.'
317
444
  )
318
445
 
319
446
  return generate ?? ''
320
447
  }
448
+
449
+ /**
450
+ * Generates MCP server resources structure for prompt files using AI.
451
+ *
452
+ * Генерирует структуру ресурсов MCP-сервера для файлов промптов с помощью ИИ.
453
+ * @param list list of prompt files / список файлов промптов
454
+ * @returns object with resources array or undefined / объект со массивом ресурсов или undefined
455
+ */
456
+ protected async toAiMcpPrompts(list: DesignTypesList): Promise<DesignMcpResources | undefined> {
457
+ const projectName = this.getProjectName()
458
+ const resources: DesignMcpResourceItem[] = []
459
+
460
+ for (const item of list) {
461
+ const data = await this.toAiMcpResources(item.content, item.path)
462
+
463
+ if (
464
+ data?.name
465
+ && data?.description
466
+ ) {
467
+ resources.push({
468
+ uri: `${projectName}/${item.path}`,
469
+ name: data.name,
470
+ mimeType: data.mimeType ?? 'text/markdown',
471
+ description: data.description
472
+ })
473
+ }
474
+ }
475
+
476
+ if (resources.length > 0) {
477
+ return resources
478
+ }
479
+
480
+ return undefined
481
+ }
482
+
483
+ /**
484
+ * Generates MCP server resource metadata for a prompt document using AI.
485
+ *
486
+ * Генерирует метаданные ресурса MCP-сервера для документа промпта с помощью ИИ.
487
+ * @param content prompt file content / содержимое файла промпта
488
+ * @param file prompt file path or name / путь или имя файла промпта
489
+ * @returns resource metadata object or undefined / объект метаданных ресурса или undefined
490
+ */
491
+ protected async toAiMcpResources(content: string, file?: string): Promise<Partial<DesignMcpResourceItem> | undefined> {
492
+ const generate = await this.toAi(
493
+ content,
494
+ (file ? `File Name: ${file}\n\n` : '')
495
+ + 'Goal: Generate an MCP (Model Context Protocol) server resource metadata object in valid JSON format for this prompt document.\n\n'
496
+ + 'CRITICAL RESTRICTIONS:\n'
497
+ + '- The output MUST be a valid JSON object with keys: "name", "mimeType", and "description".\n'
498
+ + '- All text values MUST be strictly in English. Non-English languages are strictly forbidden.\n'
499
+ + '- "name": A concise, clear English title (2-4 words, e.g. "Coding Standards", "API Reference").\n'
500
+ + '- "mimeType": Must be strictly "text/markdown".\n'
501
+ + '- "description": A high-density, professional description strictly in English (1-2 sentences) summarizing what rules, APIs, or architectural conventions are covered in this document.\n'
502
+ + '- Do NOT include markdown code block wrappers (```json). Return ONLY the raw JSON string.\n\n'
503
+ + 'EXAMPLES OF GOOD OUTPUT:\n'
504
+ + '{\n'
505
+ + ' "name": "Coding Standards",\n'
506
+ + ' "mimeType": "text/markdown",\n'
507
+ + ' "description": "Strict architectural conventions and code implementation standards for the product."\n'
508
+ + '}\n\n'
509
+ + 'OUTPUT REQUIREMENTS:\n'
510
+ + 'Return ONLY the JSON object. No explanations, no markdown formatting, no conversational text.'
511
+ )
512
+
513
+ if (generate) {
514
+ try {
515
+ const cleaned = generate.replace(/```json|```/g, '').trim()
516
+ return JSON.parse(cleaned)
517
+ } catch {
518
+ return undefined
519
+ }
520
+ }
521
+
522
+ return undefined
523
+ }
321
524
  }
@@ -56,15 +56,14 @@ export class LibraryAiPrompt {
56
56
  const list = this.getList()
57
57
  const prompts = [
58
58
  `
59
- # System role: AI assistant for project analysis
60
- This file contains the consolidated documentation and essential prompts for the current project.
61
-
62
- ## Mandatory instructions
63
- It is critically important to strictly follow all the prompts and instructions listed below. You must adhere to these guidelines without exception to ensure accurate analysis and project development.
64
- - Do not hallucinate or invent any information.
65
- - Study the provided materials in detail.
66
- - If you do not know something or lack information, state it explicitly rather than making assumptions.
67
- - Be sure to study package.json to know which packages are available and rely exclusively on them when writing code.
59
+ # System Role: AI Coding Assistant & Project Analyzer
60
+ Consolidated documentation, architectural guidelines, and mandatory rules for the project.
61
+
62
+ ## Core Rules & Directives
63
+ - **Zero Hallucinations**: Rely strictly on existing APIs and dependencies declared in package.json.
64
+ - **Deep Context Study**: Analyze provided prompt documents and type definitions before writing code.
65
+ - **Explicit Unknowns**: If information is missing or unclear, state it explicitly instead of guessing.
66
+ - **Strict Compliance**: Follow all architectural conventions, design system rules, and coding standards.
68
67
  `.trim(),
69
68
  this.getGlobalPrompt(),
70
69
  this.getVuePrompt()
@@ -113,8 +112,7 @@ It is critically important to strictly follow all the prompts and instructions l
113
112
  protected getInstruction(): string | undefined {
114
113
  if (PropertiesFile.is(UI_FILE_AI_PROMPT_INSTRUCTION)) {
115
114
  return `
116
- ## High-priority instructions
117
- The rules and instructions provided below have the highest priority. These directives supersede any previous instructions or general rules in case of conflict or contradiction.
115
+ ## High-Priority Directives (Overrides Base Rules)
118
116
  ${PropertiesFile.readFileOnly(UI_FILE_AI_PROMPT_INSTRUCTION)}
119
117
  `.trim()
120
118
  }
@@ -129,8 +127,7 @@ ${PropertiesFile.readFileOnly(UI_FILE_AI_PROMPT_INSTRUCTION)}
129
127
  */
130
128
  protected getVuePrompt(): string {
131
129
  return `
132
- ## Vue component implementation rules
133
- The rules for the implementation of Vue components are listed below. These instructions are mandatory for creating high-quality, standard-compliant components within this project.
130
+ ## Vue Component Implementation Rules
134
131
  ${vuePromptText}
135
132
  `.trim()
136
133
  }
@@ -144,8 +141,7 @@ ${vuePromptText}
144
141
  */
145
142
  protected getGlobalPrompt(): string {
146
143
  return `
147
- ## Global code implementation rules
148
- The global rules for code implementation are listed below. These instructions are mandatory for ensuring high-quality, professional-grade development across the entire project.
144
+ ## Global Code Implementation Rules
149
145
  ${globalPromptText}
150
146
  `.trim()
151
147
  }
@@ -206,8 +206,7 @@ ${data.join('\n\n')}
206
206
  console.log('-- Description')
207
207
 
208
208
  return `
209
- ## Project context: Investigation required
210
- You MUST read and carefully analyze the description of this project below. If there is even a 1% chance that the functionality, components, styles, or helpers from this project could be useful for your task, you MUST immediately start analyzing this project, studying its types, and checking its structure in full to prevent custom code duplication:
209
+ ## Package Description & Module Overview
211
210
  ${this.readFile(UI_FILE_AI_PROMPT_DESCRIPTION)}
212
211
  `.trim()
213
212
  }
@@ -227,8 +226,7 @@ ${this.readFile(UI_FILE_AI_PROMPT_DESCRIPTION)}
227
226
  console.log('-- Developer')
228
227
 
229
228
  return `
230
- ## Mandatory Study Before Development
231
- As soon as you start working with this project (using any of its components/functionality, importing from it, or editing its code), you MUST read and study the architectural rules and instructions in this file as your absolute first action:
229
+ ## Developer Rules (Must Read Before Modifying Code)
232
230
  '${this.getPathString()}/${UI_FILE_AI_PROMPT_DEVELOPER}'
233
231
  `.trim()
234
232
  }
@@ -248,8 +246,7 @@ As soon as you start working with this project (using any of its components/func
248
246
  console.log('-- Info')
249
247
 
250
248
  return `
251
- ## Project information: Core overview
252
- This section contains essential information and the core overview of the project. Review this to understand the fundamental architecture and key features.
249
+ ## Package Core Information
253
250
  ${this.readFile(UI_FILE_AI_PROMPT_INFO)}
254
251
  `.trim()
255
252
  }
@@ -269,8 +266,7 @@ ${this.readFile(UI_FILE_AI_PROMPT_INFO)}
269
266
  console.log('-- Types')
270
267
 
271
268
  return `
272
- ## Project types: Essential for analysis
273
- This file contains the complete type definitions, available utilities, and component structures for the project. As soon as you start working with this project (using any of its components/functionality, importing from it, or editing its code), you MUST read, analyze, and study this type definition file COMPLETELY and IN FULL (NOT partially), as your absolute first action using the view_file tool. This is mandatory to fully understand its API, locate all existing utilities/helpers (полезности), and prevent writing duplicate code:
269
+ ## Package Type Definitions (Must Read in Full When Working with Package)
274
270
  '${this.getPathString()}/${UI_FILE_AI_PROMPT_TYPES}'
275
271
  `.trim()
276
272
  }
@@ -293,8 +289,7 @@ This file contains the complete type definitions, available utilities, and compo
293
289
 
294
290
  const screenshot: string = list.map(item => `- '${this.getPathString()}/${UI_DIR_AI_PROMPT_SCREENSHOT}/${item}'`).join('\n')
295
291
 
296
- return `## Project screenshots: Visual reference
297
- The project includes the following screenshots that provide a visual reference for the project's design and functionality:
292
+ return `## Component Visual References (Screenshots)
298
293
  ${screenshot}
299
294
  `.trim()
300
295
  }
package/src/config.ts CHANGED
@@ -120,6 +120,8 @@ export const UI_FILE_INDEX = 'index.ts'
120
120
  export const UI_FILE_AI_TYPES = 'ai-types.md'
121
121
  /** AI description file name / Название файла с описанием AI */
122
122
  export const UI_FILE_AI_DESCRIPTION = 'ai-description.md'
123
+ /** AI MCP resources file name / Название файла с ресурсами MCP AI */
124
+ export const UI_FILE_AI_MCP = 'ai-mcp.json'
123
125
  /** Style SCSS file name / Название файла стилей SCSS */
124
126
  export const UI_FILE_STYLE_SCSS = 'style.scss'
125
127
  /** UI properties SCSS file name / Название файла свойств UI в SCSS */
@@ -17,9 +17,12 @@
17
17
  "publish-to-npm": "npm publish --access public"
18
18
  },
19
19
  "files": [
20
+ "ai-prompts/",
21
+ "ai-screenshot/",
20
22
  "dist",
21
23
  "ai-description.md",
22
24
  "ai-doc.md",
25
+ "ai-mcp.json",
23
26
  "ai-types.md",
24
27
  "CHANGELOG.md",
25
28
  "LICENSE",
@@ -5,8 +5,8 @@ Strictly follow these rules for flawless dxt-ui code:
5
5
  0. **Mandatory Deep Study (CHRONOLOGICAL GUARD)**:
6
6
  - **Step 1**: Read/create local `ai-memory.md` strictly in the current package root (e.g., `packages/constructor/`). Using repository root `ai-memory.md` for package files is FORBIDDEN.
7
7
  - **Step 2**: Read root `ai-prompt.md` and study descriptions of all mentioned libraries.
8
- - **Step 3**: Read all linked `ai-types.md` and `ai-developer.md` BEFORE proposing plans, calling `list_dir`, or writing code. If a package is in `node_modules/` but exists locally (e.g., `packages/`), resolve and study the local source instead.
9
- - Fully read files via `view_file` before modifying. Superficial scans (grep only) are strictly forbidden. Always check existing infrastructure before writing custom logic.
8
+ - **Step 3**: Read all linked `ai-types.md` and `ai-developer.md` BEFORE proposing plans, inspecting directory structures, or writing code. If a package is in `node_modules/` but exists locally (e.g., `packages/`), resolve and study the local source instead.
9
+ - Fully read file contents before modifying them. Superficial scans (text search only) are strictly forbidden. Always check existing infrastructure before writing custom logic.
10
10
 
11
11
  1. **"Copy-Paste Ready"**: Generate complete, runnable files with correct imports. No placeholders (e.g., `// rest of code`).
12
12
  2. **Zero Hallucinations**: Strictly use `package.json` dependencies. No invented APIs. Ask if unsure.
@@ -17,5 +17,5 @@ Strictly follow these rules for flawless dxt-ui code:
17
17
  7. **Security & Performance**: Error-proof code (`?.`, `??`, guard clauses). Use explicit `try-catch` for async. Never swallow errors. Avoid heavy ops in loops/reactivity.
18
18
  8. **Aesthetics & Conciseness**: Group logically. Save tokens by avoiding redundant comments if code is self-explanatory.
19
19
  9. **Strict Adherence & Optimization**: Follow instructions precisely without guessing. Propose relevant technical optimizations while strictly adhering to plans.
20
- 10. **AI Workspace Memory (`ai-memory.md`)**: Actively APPLY its rules (highest priority). Update it on developer feedback. Do NOT store change logs or absolute paths (use relative). Keep it focused strictly on architectural constraints.
20
+ 10. **AI Workspace Memory (`ai-memory.md`)**: Actively APPLY its rules (highest priority). Update it on developer feedback. **CRITICAL**: Any remark from the developer that has value for the future (e.g., code style, dos and don'ts) MUST be saved here. If the developer explicitly asks to save or remember something, you MUST save it. Do NOT store change logs or absolute paths (use relative). Keep it focused strictly on architectural constraints and developer preferences.
21
21
  11. **Mandatory Full-File Self-Audit**: When creating new entities, you MUST audit the ENTIRE file (not just modified parts) to ensure no logic duplication (DRY) and full compliance with project rules. *Exception: minor bug fixes to existing code do not require a full audit.*
@@ -5,8 +5,8 @@
5
5
  0. **Обязательное глубокое изучение (БЛОКИРУЮЩИЙ КОНТРОЛЬ)**:
6
6
  - **Шаг 1**: Читай/создавай локальный `ai-memory.md` СТРОГО в корне текущего пакета (напр., `packages/constructor/`). Использовать корневой `ai-memory.md` репозитория для файлов пакета ЗАПРЕЩЕНО.
7
7
  - **Шаг 2**: Прочитай корневой `ai-prompt.md` и изучи описания всех упомянутых библиотек.
8
- - **Шаг 3**: Прочитай все связанные `ai-types.md` и `ai-developer.md` ДО вызова `list_dir`, планирования или написания кода. Если пакет в `node_modules/` существует локально (в `packages/`), изучай/изменяй локальные исходники.
9
- - Полностью читай файлы через `view_file` перед изменением. Поверхностное изучение (только grep) запрещено. Всегда проверяй существующую инфраструктуру перед написанием кастомной логики.
8
+ - **Шаг 3**: Прочитай все связанные `ai-types.md` и `ai-developer.md` ДО планирования, исследования структуры директорий или написания кода. Если пакет в `node_modules/` существует локально (в `packages/`), изучай/изменяй локальные исходники.
9
+ - Полностью читай содержимое файлов перед изменением. Поверхностное изучение (только через поиск текста) запрещено. Всегда проверяй существующую инфраструктуру перед написанием кастомной логики.
10
10
 
11
11
  1. **Готовность к использованию (Copy-Paste Ready)**: Генерируй полные, рабочие файлы с правильными импортами. Никаких заглушек (напр., `// остальной код`).
12
12
  2. **Нулевая толерантность к галлюцинациям**: Используй только зависимости из `package.json`. Не выдумывай API. Не знаешь — спроси.
@@ -17,5 +17,5 @@
17
17
  7. **Безопасность и Производительность**: Защищенный код (`?.`, `??`, guard clauses). Явный `try-catch` для асинхронности. Не скрывай ошибки. Избегай тяжелых операций в циклах/реактивности.
18
18
  8. **Эстетика и Лаконичность**: Логическая группировка. Экономь токены, избегая избыточных комментариев, если код очевиден.
19
19
  9. **Строгое следование инструкциям**: Выполняй команды без додумывания, но предлагай уместные технические оптимизации, придерживаясь плана.
20
- 10. **Память ИИ (`ai-memory.md`)**: Активно ПРИМЕНЯЙ ее правила (высший приоритет). Обновляй при правках от разработчика. ЗАПРЕЩЕНО хранить историю изменений (changelogs) и абсолютные пути (только относительные). Только актуальные стандарты.
20
+ 10. **Память ИИ (`ai-memory.md`)**: Активно ПРИМЕНЯЙ ее правила (высший приоритет). Обновляй при правках от разработчика. **ВАЖНО**: Любое замечание от разработчика, которое имеет ценность для будущего (например, стиль кода, что надо делать, а что нет), ДОЛЖНО быть сохранено здесь. Также, если разработчик просит сохранить или запомнить какую-либо информацию, ты ОБЯЗАН это сделать. ЗАПРЕЩЕНО хранить историю изменений (changelogs) и абсолютные пути (только относительные). Только актуальные стандарты и предпочтения разработчика.
21
21
  11. **Обязательный полный самоаудит**: При создании новых сущностей ОБЯЗАТЕЛЬНО проверяй ВЕСЬ файл целиком. Строго контролируй отсутствие дублирования (DRY) и соблюдение всех правил проекта. *Исключение: мелкие правки существующего кода не требуют полного аудита.*
@@ -113,3 +113,18 @@ export type DesignTypesItem = {
113
113
  }
114
114
 
115
115
  export type DesignTypesList = DesignTypesItem[]
116
+
117
+ /** Design MCP resource item / Элемент ресурса MCP дизайна */
118
+ export type DesignMcpResourceItem = {
119
+ /** Resource URI / URI ресурса */
120
+ uri: string
121
+ /** Resource name / Название ресурса */
122
+ name: string
123
+ /** Resource MIME type / MIME-тип ресурса */
124
+ mimeType: string
125
+ /** Resource description / Описание ресурса */
126
+ description: string
127
+ }
128
+
129
+ /** Design MCP resources container / Контейнер ресурсов MCP дизайна */
130
+ export type DesignMcpResources = DesignMcpResourceItem[]