@dxtmisha/scripts 0.10.9 → 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/package.json +1 -1
- package/src/classes/Design/DesignTypes.ts +208 -15
- package/src/classes/Library/LibraryAiPrompt.ts +11 -15
- package/src/classes/Library/LibraryAiPromptItem.ts +5 -10
- package/src/config.ts +2 -0
- package/src/media/templates/packages/library/package.json +3 -0
- package/src/media/templates/prompts/aiCodeGlobalPrompt.en.md +3 -3
- package/src/media/templates/prompts/aiCodeGlobalPrompt.ru.md +3 -3
- package/src/types/designTypes.ts +15 -0
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dxtmisha/scripts",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "0.10.
|
|
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('/')
|
|
@@ -54,7 +56,17 @@ export class DesignTypes {
|
|
|
54
56
|
this.save(aiContent)
|
|
55
57
|
|
|
56
58
|
const aiDescription = await this.toAiDescription(fullContent, fullJsContent)
|
|
57
|
-
|
|
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
|
*
|
|
@@ -311,21 +370,155 @@ export class DesignTypes {
|
|
|
311
370
|
protected async toAiDescription(content: string, code?: string): Promise<string> {
|
|
312
371
|
const generate = await this.toAi(
|
|
313
372
|
content,
|
|
314
|
-
'Goal: Generate a
|
|
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'
|
|
315
374
|
+ 'CRITICAL RESTRICTIONS:\n'
|
|
316
|
-
+ '-
|
|
317
|
-
+ '-
|
|
318
|
-
+ '
|
|
319
|
-
+ '
|
|
320
|
-
+ '
|
|
321
|
-
+ '
|
|
322
|
-
+ '
|
|
323
|
-
+ '
|
|
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'
|
|
324
384
|
+ 'OUTPUT REQUIREMENTS:\n'
|
|
325
|
-
+ 'Return ONLY the resulting description text. No markdown
|
|
385
|
+
+ 'Return ONLY the resulting concise description text. No markdown code blocks (```), no section headers, no labels (like "Description:"), and no conversational fluff.',
|
|
326
386
|
code
|
|
327
387
|
)
|
|
328
388
|
|
|
329
389
|
return generate ?? ''
|
|
330
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 / содержимое файла промпта
|
|
428
|
+
*/
|
|
429
|
+
protected async toAiPromptName(content: string): Promise<string> {
|
|
430
|
+
const generate = await this.toAi(
|
|
431
|
+
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.'
|
|
444
|
+
)
|
|
445
|
+
|
|
446
|
+
return generate ?? ''
|
|
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
|
+
}
|
|
331
524
|
}
|
|
@@ -56,15 +56,14 @@ export class LibraryAiPrompt {
|
|
|
56
56
|
const list = this.getList()
|
|
57
57
|
const prompts = [
|
|
58
58
|
`
|
|
59
|
-
# System
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
##
|
|
63
|
-
|
|
64
|
-
-
|
|
65
|
-
-
|
|
66
|
-
-
|
|
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-
|
|
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
|
|
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
|
|
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
|
-
##
|
|
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
|
-
##
|
|
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
|
-
##
|
|
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
|
-
##
|
|
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 `##
|
|
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 */
|
|
@@ -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,
|
|
9
|
-
- Fully read
|
|
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` ДО
|
|
9
|
-
- Полностью читай
|
|
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) и соблюдение всех правил проекта. *Исключение: мелкие правки существующего кода не требуют полного аудита.*
|
package/src/types/designTypes.ts
CHANGED
|
@@ -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[]
|