@dxtmisha/scripts 0.9.0 → 0.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +30 -0
- package/package.json +2 -1
- package/src/classes/Ai/AiClaudeAgent.ts +16 -0
- package/src/classes/Ai/AiClaudeAgentLite.ts +86 -0
- package/src/classes/Ai/AiClaudeCliLite.ts +29 -65
- package/src/classes/Ai/AiClaudeLite.ts +19 -7
- package/src/classes/Ai/AiGoogleCliLite.ts +27 -64
- package/src/classes/Ai/AiOpenAi.ts +26 -0
- package/src/classes/Ai/AiOpenAiLite.ts +107 -0
- package/src/classes/Ai/AiZAi.ts +17 -0
- package/src/classes/Ai/AiZAiLite.ts +26 -0
- package/src/classes/Ai/ApiTmp.ts +43 -0
- package/src/classes/Build/BuildPackages.ts +33 -7
- package/src/classes/Design/DesignComponent.ts +1 -1
- package/src/classes/Library/LibraryAiPromptItem.ts +36 -2
- package/src/composables/useAi.ts +15 -0
- package/src/config.ts +2 -0
- package/src/demo/ai.ts +10 -0
- package/src/library-ai.ts +4 -4
- package/src/library.ts +67 -54
- package/src/media/templates/componentDoc/materials/README.md +8 -0
- package/src/media/templates/componentDoc/materials/prompt.txt +28 -0
- package/src/media/templates/componentDoc/wiki/prompt.txt +21 -0
- package/src/media/templates/componentDoc/wiki/run.ts +2 -1
- package/src/media/templates/prompts/aiCodeGlobalPrompt.en.txt +19 -0
- package/src/media/templates/prompts/aiCodeGlobalPrompt.ru.txt +21 -0
- package/src/media/templates/prompts/componentPrompt.en.txt +71 -16
- package/src/media/templates/prompts/componentPrompt.ru.txt +71 -16
- package/src/types/configTypes.ts +9 -2
- package/src/classes/Component/__tests__/ComponentCreator.test.ts +0 -71
- package/src/classes/Component/__tests__/ComponentItem.test.ts +0 -71
- package/src/classes/Git/__tests__/GitRead.test.ts +0 -70
- package/src/composables/__tests__/useAi.test.ts +0 -75
- package/src/functions/__tests__/getComponentPaths.test.ts +0 -19
- package/src/functions/__tests__/getConfigAi.test.ts +0 -26
- package/src/functions/__tests__/getConstructorProperties.test.ts +0 -51
- package/src/functions/__tests__/getDirname.test.ts +0 -31
- package/src/functions/__tests__/getNameDirByPaths.test.ts +0 -40
- package/src/functions/__tests__/getPackageJson.test.ts +0 -34
- package/src/functions/__tests__/hasNativeDirname.test.ts +0 -18
- package/src/functions/__tests__/toPathStandardSep.test.ts +0 -31
- package/src/media/templates/componentDoc/figma/run-figma.ts +0 -26
|
@@ -31,18 +31,14 @@ export class BuildPackages {
|
|
|
31
31
|
* Сканирует директорию пакетов и собирает каждый пакет, содержащий package.json.
|
|
32
32
|
*/
|
|
33
33
|
async make(): Promise<void> {
|
|
34
|
-
const list =
|
|
34
|
+
const list = this.getList()
|
|
35
35
|
let changed = 0
|
|
36
36
|
|
|
37
37
|
console.info(`Build packages(${list.length})...`)
|
|
38
38
|
|
|
39
|
-
for (const
|
|
40
|
-
const packageFile = new PackageFile([this.path, folder])
|
|
41
|
-
|
|
39
|
+
for (const packageFile of list) {
|
|
42
40
|
if (
|
|
43
|
-
|
|
44
|
-
&& !packageFile.isTest()
|
|
45
|
-
&& this.isUpdate(packageFile)
|
|
41
|
+
this.isUpdate(packageFile)
|
|
46
42
|
&& await this.build(packageFile)
|
|
47
43
|
) {
|
|
48
44
|
this.updateLog(packageFile)
|
|
@@ -80,6 +76,36 @@ export class BuildPackages {
|
|
|
80
76
|
)
|
|
81
77
|
}
|
|
82
78
|
|
|
79
|
+
/**
|
|
80
|
+
* Scans the packages directory and returns a list of packages sorted by the ui-priority property in package.json.
|
|
81
|
+
* If a package does not have a priority, it defaults to 500.
|
|
82
|
+
*
|
|
83
|
+
* Сканирует директорию пакетов и возвращает список пакетов, отсортированный по свойству ui-priority в package.json.
|
|
84
|
+
* Если у пакета нет приоритета, по умолчанию устанавливается значение 500.
|
|
85
|
+
* @returns sorted list of package files / отсортированный список файлов пакетов
|
|
86
|
+
*/
|
|
87
|
+
private getList(): PackageFile[] {
|
|
88
|
+
const list = PropertiesFile.readDir(this.path)
|
|
89
|
+
const packages: PackageFile[] = []
|
|
90
|
+
|
|
91
|
+
for (const folder of list) {
|
|
92
|
+
const packageFile = new PackageFile([this.path, folder])
|
|
93
|
+
|
|
94
|
+
if (
|
|
95
|
+
packageFile.is()
|
|
96
|
+
&& !packageFile.isTest()
|
|
97
|
+
) {
|
|
98
|
+
packages.push(packageFile)
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
return packages.sort((a, b) => {
|
|
103
|
+
const priorityA = a.get()?.['ui-priority'] ?? 500
|
|
104
|
+
const priorityB = b.get()?.['ui-priority'] ?? 500
|
|
105
|
+
return priorityA - priorityB
|
|
106
|
+
})
|
|
107
|
+
}
|
|
108
|
+
|
|
83
109
|
/**
|
|
84
110
|
* Returns the cached version of the package from the build log.
|
|
85
111
|
*
|
|
@@ -270,7 +270,7 @@ export class DesignComponent extends DesignCommand {
|
|
|
270
270
|
const option = prop.option
|
|
271
271
|
let item: string = ''
|
|
272
272
|
|
|
273
|
-
item += `{ name: '${prop.name}', type: '${prop.type}'`
|
|
273
|
+
item += `{ name: '${prop.name}', type: '${prop.type.replace('| undefined', '').trim()}'`
|
|
274
274
|
|
|
275
275
|
if (
|
|
276
276
|
option
|
|
@@ -5,7 +5,8 @@ import {
|
|
|
5
5
|
UI_FILE_AI_PROMPT_DESCRIPTION,
|
|
6
6
|
UI_FILE_AI_PROMPT_INFO,
|
|
7
7
|
UI_FILE_AI_PROMPT_TYPES,
|
|
8
|
-
UI_FILE_PACKAGE
|
|
8
|
+
UI_FILE_PACKAGE,
|
|
9
|
+
UI_FILE_AI_PROMPT_DEVELOPER
|
|
9
10
|
} from '../../config'
|
|
10
11
|
|
|
11
12
|
/**
|
|
@@ -53,6 +54,7 @@ export class LibraryAiPromptItem {
|
|
|
53
54
|
|| this.isInfo()
|
|
54
55
|
|| this.isTypes()
|
|
55
56
|
|| this.isScreenshot()
|
|
57
|
+
|| this.isDeveloper()
|
|
56
58
|
}
|
|
57
59
|
|
|
58
60
|
/**
|
|
@@ -65,6 +67,16 @@ export class LibraryAiPromptItem {
|
|
|
65
67
|
return PropertiesFile.is(this.getPath(UI_FILE_AI_PROMPT_DESCRIPTION))
|
|
66
68
|
}
|
|
67
69
|
|
|
70
|
+
/**
|
|
71
|
+
* Checks if the developer prompt file exists.
|
|
72
|
+
*
|
|
73
|
+
* Проверяет, существует ли файл промпта разработчика.
|
|
74
|
+
* @returns true if developer prompt file exists / true, если файл промпта разработчика существует
|
|
75
|
+
*/
|
|
76
|
+
isDeveloper(): boolean {
|
|
77
|
+
return PropertiesFile.is(this.getPath(UI_FILE_AI_PROMPT_DEVELOPER))
|
|
78
|
+
}
|
|
79
|
+
|
|
68
80
|
/**
|
|
69
81
|
* Checks if the information file exists.
|
|
70
82
|
*
|
|
@@ -108,7 +120,8 @@ export class LibraryAiPromptItem {
|
|
|
108
120
|
this.getDescription(),
|
|
109
121
|
this.getInfo(),
|
|
110
122
|
this.getTypes(),
|
|
111
|
-
this.getScreenshot()
|
|
123
|
+
this.getScreenshot(),
|
|
124
|
+
this.getDeveloper()
|
|
112
125
|
].filter(item => item !== undefined) as string[]
|
|
113
126
|
|
|
114
127
|
if (data.length > 0) {
|
|
@@ -201,6 +214,27 @@ ${this.readFile(UI_FILE_AI_PROMPT_DESCRIPTION)}
|
|
|
201
214
|
return undefined
|
|
202
215
|
}
|
|
203
216
|
|
|
217
|
+
/**
|
|
218
|
+
* Formats and returns the developer prompt section.
|
|
219
|
+
*
|
|
220
|
+
* Форматирует и возвращает секцию промпта для разработчика.
|
|
221
|
+
* @returns formatted developer prompt or undefined / отформатированный промпт разработчика или undefined
|
|
222
|
+
* @protected
|
|
223
|
+
*/
|
|
224
|
+
protected getDeveloper(): string | undefined {
|
|
225
|
+
if (this.isDeveloper()) {
|
|
226
|
+
console.log('-- Developer')
|
|
227
|
+
|
|
228
|
+
return `
|
|
229
|
+
## Mandatory Study Before Development
|
|
230
|
+
Before developing, modifying, or implementing any code for /${this.getPathString()}, you MUST first study the architectural rules and instructions located in the following file:
|
|
231
|
+
'${this.getPathString()}/${UI_FILE_AI_PROMPT_DEVELOPER}'
|
|
232
|
+
`.trim()
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
return undefined
|
|
236
|
+
}
|
|
237
|
+
|
|
204
238
|
/**
|
|
205
239
|
* Formats and returns the info section for the prompt.
|
|
206
240
|
*
|
package/src/composables/useAi.ts
CHANGED
|
@@ -1,8 +1,13 @@
|
|
|
1
1
|
import { PropertiesConfig } from '../classes/Properties/PropertiesConfig'
|
|
2
2
|
|
|
3
3
|
import { AiAbstract } from '../classes/Ai/AiAbstract'
|
|
4
|
+
import { AiClaude } from '../classes/Ai/AiClaude'
|
|
5
|
+
import { AiClaudeAgent } from '../classes/Ai/AiClaudeAgent'
|
|
6
|
+
import { AiClaudeCli } from '../classes/Ai/AiClaudeCli'
|
|
4
7
|
import { AiGoogle } from '../classes/Ai/AiGoogle'
|
|
5
8
|
import { AiGoogleCli } from '../classes/Ai/AiGoogleCli'
|
|
9
|
+
import { AiOpenAi } from '../classes/Ai/AiOpenAi'
|
|
10
|
+
import { AiZAi } from '../classes/Ai/AiZAi'
|
|
6
11
|
|
|
7
12
|
/**
|
|
8
13
|
* Composable to obtain an AI instance based on configuration.
|
|
@@ -13,10 +18,20 @@ export function useAi(): AiAbstract | undefined {
|
|
|
13
18
|
const type = PropertiesConfig.getAiType()
|
|
14
19
|
|
|
15
20
|
switch (type) {
|
|
21
|
+
case 'claude':
|
|
22
|
+
return new AiClaude()
|
|
23
|
+
case 'claude-agent':
|
|
24
|
+
return new AiClaudeAgent()
|
|
25
|
+
case 'claude-cli':
|
|
26
|
+
return new AiClaudeCli()
|
|
16
27
|
case 'gemini':
|
|
17
28
|
return new AiGoogle()
|
|
18
29
|
case 'gemini-cli':
|
|
19
30
|
return new AiGoogleCli()
|
|
31
|
+
case 'openai':
|
|
32
|
+
return new AiOpenAi()
|
|
33
|
+
case 'zai':
|
|
34
|
+
return new AiZAi()
|
|
20
35
|
}
|
|
21
36
|
|
|
22
37
|
return undefined
|
package/src/config.ts
CHANGED
|
@@ -90,6 +90,8 @@ export const UI_FILE_AI_PROMPT_INSTRUCTION = 'ai-instruction.txt'
|
|
|
90
90
|
export const UI_FILE_AI_PROMPT_PROMPT = 'ai-prompt.txt'
|
|
91
91
|
/** AI prompt types file name / Название файла с типами промпта AI */
|
|
92
92
|
export const UI_FILE_AI_PROMPT_TYPES = 'ai-types.txt'
|
|
93
|
+
/** AI prompt developer file name / Название файла для разработчика AI */
|
|
94
|
+
export const UI_FILE_AI_PROMPT_DEVELOPER = 'ai-developer.txt'
|
|
93
95
|
|
|
94
96
|
/** File name for storing the list of flags/ Название файла для хранения списка флагов */
|
|
95
97
|
export const UI_FILE_NAME_FLAGS = 'flags'
|
package/src/demo/ai.ts
ADDED
package/src/library-ai.ts
CHANGED
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
export * from './classes/Ai/AiAbstract'
|
|
3
3
|
export * from './classes/Ai/AiGoogleLite'
|
|
4
4
|
export * from './classes/Ai/AiGoogle'
|
|
5
|
-
export * from './classes/Ai/AiGoogleCliLite'
|
|
6
|
-
export * from './classes/Ai/AiGoogleCli'
|
|
7
5
|
export * from './classes/Ai/AiClaudeLite'
|
|
8
6
|
export * from './classes/Ai/AiClaude'
|
|
9
|
-
export * from './classes/Ai/
|
|
10
|
-
export * from './classes/Ai/
|
|
7
|
+
export * from './classes/Ai/AiOpenAiLite'
|
|
8
|
+
export * from './classes/Ai/AiOpenAi'
|
|
9
|
+
export * from './classes/Ai/AiZAiLite'
|
|
10
|
+
export * from './classes/Ai/AiZAi'
|
package/src/library.ts
CHANGED
|
@@ -1,54 +1,67 @@
|
|
|
1
|
-
// Classes
|
|
2
|
-
export * from './classes/Ai/AiAbstract'
|
|
3
|
-
export * from './classes/Ai/AiClaude'
|
|
4
|
-
export * from './classes/Ai/
|
|
5
|
-
export * from './classes/Ai/
|
|
6
|
-
export * from './classes/Ai/
|
|
7
|
-
export * from './classes/Ai/
|
|
8
|
-
export * from './classes/Ai/
|
|
9
|
-
export * from './classes/Ai/
|
|
10
|
-
export * from './classes/Ai/
|
|
11
|
-
export * from './classes/Ai/
|
|
12
|
-
export * from './classes/Ai/
|
|
13
|
-
export * from './classes/Ai/
|
|
14
|
-
export * from './classes/Ai/
|
|
15
|
-
export * from './classes/Ai/
|
|
16
|
-
export * from './classes/Ai/
|
|
17
|
-
export * from './classes/
|
|
18
|
-
export * from './classes/
|
|
19
|
-
export * from './classes/
|
|
20
|
-
export * from './classes/
|
|
21
|
-
export * from './classes/
|
|
22
|
-
export * from './classes/
|
|
23
|
-
export * from './classes/
|
|
24
|
-
export * from './classes/
|
|
25
|
-
export * from './classes/
|
|
26
|
-
export * from './classes/
|
|
27
|
-
export * from './classes/
|
|
28
|
-
export * from './classes/
|
|
29
|
-
export * from './classes/
|
|
30
|
-
export * from './classes/
|
|
31
|
-
export * from './classes/
|
|
32
|
-
export * from './classes/
|
|
33
|
-
export * from './classes/
|
|
34
|
-
export * from './classes/
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
export * from './
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
export * from './
|
|
41
|
-
export * from './
|
|
42
|
-
export * from './
|
|
43
|
-
export * from './
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
export * from './
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
export * from './
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
export * from './
|
|
53
|
-
export * from './
|
|
54
|
-
export * from './
|
|
1
|
+
// Classes
|
|
2
|
+
export * from './classes/Ai/AiAbstract'
|
|
3
|
+
export * from './classes/Ai/AiClaude'
|
|
4
|
+
export * from './classes/Ai/AiClaudeAgent'
|
|
5
|
+
export * from './classes/Ai/AiClaudeAgentLite'
|
|
6
|
+
export * from './classes/Ai/AiClaudeCli'
|
|
7
|
+
export * from './classes/Ai/AiClaudeCliLite'
|
|
8
|
+
export * from './classes/Ai/AiClaudeLite'
|
|
9
|
+
export * from './classes/Ai/AiDoc'
|
|
10
|
+
export * from './classes/Ai/AiDocItem'
|
|
11
|
+
export * from './classes/Ai/AiDocItemAbstract'
|
|
12
|
+
export * from './classes/Ai/AiDocItemClasses'
|
|
13
|
+
export * from './classes/Ai/AiDocItemComposables'
|
|
14
|
+
export * from './classes/Ai/AiDocType'
|
|
15
|
+
export * from './classes/Ai/AiGoogle'
|
|
16
|
+
export * from './classes/Ai/AiGoogleCli'
|
|
17
|
+
export * from './classes/Ai/AiGoogleCliLite'
|
|
18
|
+
export * from './classes/Ai/AiGoogleLite'
|
|
19
|
+
export * from './classes/Ai/AiOpenAi'
|
|
20
|
+
export * from './classes/Ai/AiOpenAiLite'
|
|
21
|
+
export * from './classes/Ai/AiZAi'
|
|
22
|
+
export * from './classes/Ai/AiZAiLite'
|
|
23
|
+
export * from './classes/Ai/ApiTmp'
|
|
24
|
+
export * from './classes/BrowserItem'
|
|
25
|
+
export * from './classes/Build/BuildFunctional'
|
|
26
|
+
export * from './classes/Build/BuildPackages'
|
|
27
|
+
export * from './classes/Build/BuildPublishPackages'
|
|
28
|
+
export * from './classes/BuildItem'
|
|
29
|
+
export * from './classes/Design/DesignFigma'
|
|
30
|
+
export * from './classes/Design/DesignScreenshot'
|
|
31
|
+
export * from './classes/Design/DesignTypes'
|
|
32
|
+
export * from './classes/Design/DesignTypescript'
|
|
33
|
+
export * from './classes/Design/DesignWikiStorm'
|
|
34
|
+
export * from './classes/Design/DesignWikiStormItem'
|
|
35
|
+
export * from './classes/FigmaApi'
|
|
36
|
+
export * from './classes/Git/GitRead'
|
|
37
|
+
export * from './classes/Library/LibraryAiPrompt'
|
|
38
|
+
export * from './classes/Library/LibraryAiPromptItem'
|
|
39
|
+
export * from './classes/Library/LibraryAiWiki'
|
|
40
|
+
export * from './classes/Library/LibraryAiWikiItem'
|
|
41
|
+
export * from './classes/Library/LibraryExport'
|
|
42
|
+
export * from './classes/Library/LibraryList'
|
|
43
|
+
export * from './classes/Library/LibraryPlugin'
|
|
44
|
+
export * from './classes/Library/LibraryTypes'
|
|
45
|
+
export * from './classes/Package/PackageFile'
|
|
46
|
+
export * from './classes/Properties/PropertiesFile'
|
|
47
|
+
|
|
48
|
+
// Composables
|
|
49
|
+
export * from './composables/useAi'
|
|
50
|
+
|
|
51
|
+
// Functions
|
|
52
|
+
export * from './functions/getConfigAi'
|
|
53
|
+
export * from './functions/getDirname'
|
|
54
|
+
export * from './functions/getPackageJson'
|
|
55
|
+
export * from './functions/hasNativeDirname'
|
|
56
|
+
export * from './functions/run'
|
|
57
|
+
|
|
58
|
+
// Types
|
|
59
|
+
export * from './types/aiTypes'
|
|
60
|
+
export * from './types/configTypes'
|
|
61
|
+
export * from './types/designTypes'
|
|
62
|
+
export * from './types/figmaApiTypes'
|
|
63
|
+
export * from './types/gitTypes'
|
|
64
|
+
export * from './types/libraryTypes'
|
|
65
|
+
export * from './types/propertyTypes'
|
|
66
|
+
export * from './types/screenshotTypes'
|
|
67
|
+
export * from './types/webTypes'
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
# Work Materials
|
|
2
|
+
|
|
3
|
+
This folder is designed to store all supporting design documents, component specifications, assets, research notes, and raw inputs utilized for generating high-quality component documentation and design integrations.
|
|
4
|
+
|
|
5
|
+
### Contents and Usage:
|
|
6
|
+
- Place design screenshots, layout diagrams, or visual references here.
|
|
7
|
+
- Place text drafts, API research files, or functional notes here.
|
|
8
|
+
- Keeping materials here helps maintain a centralized workspace context for AI agents and developers.
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
Task Goal:
|
|
2
|
+
Based on the design assets, specifications, and other work materials located in this "materials" folder, you must implement a fully working, production-ready, and robust component.
|
|
3
|
+
|
|
4
|
+
Component Location & Resolution:
|
|
5
|
+
The component source files (including the main Vue component, styles, typings, and auxiliary code) are located one level up from this "materials" directory (in the parent folder containing this directory). You must locate, edit, or create them directly in that parent directory.
|
|
6
|
+
|
|
7
|
+
Template Structure & Explanations:
|
|
8
|
+
The target parent directory (one level up from this "materials" directory) represents a standardized Vue 3 component package/directory. You must study and strictly adhere to its file layout:
|
|
9
|
+
- `[ComponentName].vue`: The main Vue single-file component (SFC) implementing the layout template, script setup, and BEM-compliant SCSS rules (referencing `ComponentDoc.vue`).
|
|
10
|
+
- `types.ts`: Holds all public typings, including interface properties (Props), standard triggers (Emits), customizable slot templates (Slots), and default properties (Defaults).
|
|
11
|
+
- `index.ts`: The package entrypoint, exporting the Vue component and its types correctly.
|
|
12
|
+
- `subcomponents/`: A subdirectory reserved for storing smaller, reusable child components.
|
|
13
|
+
- `wiki/`: Storybook playground configuration and documentation files:
|
|
14
|
+
- `[ComponentName].mdx`: MDX documentation tab/documentation configuration for Storybook.
|
|
15
|
+
- `[ComponentName].stories.ts`: Storybook stories/scenarios configuration.
|
|
16
|
+
- `prompt.txt`: The system prompt directing how to generate MDX/Storybook documentation.
|
|
17
|
+
- `run.ts`: A script running `npx dxt-component-wiki` to write the MDX files automatically using `wiki/prompt.txt`.
|
|
18
|
+
|
|
19
|
+
Strict Implementation & Architectural Constraints:
|
|
20
|
+
1. Available Dependencies Only: You must strictly use only the currently installed packages and available dependencies. Do not install new external npm packages or add new third-party dependencies unless explicitly requested.
|
|
21
|
+
2. Global System Prompt Compliance: You must locate, study, and strictly adhere to all coding standards, BEM conventions, SCSS mixins, and guidelines defined in the `ai-prompt.txt` file located up the folder tree in the root of the repository. Ignore any instructions or files located outside the repository boundaries.
|
|
22
|
+
3. Monorepo Prompt Context: As this is a monorepo setup, you must locate and study both the individual package-level configuration/prompt files and the repository's root system rules (`ai-prompt.txt`) to ensure perfect compatibility with the local package architecture.
|
|
23
|
+
4. Zero Tolerance for Hallucinations: You must strictly follow all implementation rules and specifications without any deviation. Hallucinating, inventing properties, methods, slots, or external libraries is strictly forbidden.
|
|
24
|
+
|
|
25
|
+
---
|
|
26
|
+
CRITICAL PRIORITY OVERRIDE:
|
|
27
|
+
Everything below this line (if any further instructions or materials are appended) holds the absolute highest priority. Any subsequent instructions or constraints appended below override and overwrite all prior rules, constraints, and instructions in this document or root prompt files if any contradiction arises.
|
|
28
|
+
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
Task Goal:
|
|
2
|
+
The primary goal is to write comprehensive, high-quality documentation for the Vue 3 component.
|
|
3
|
+
|
|
4
|
+
Component Resolution & Analysis:
|
|
5
|
+
If the component source files are not directly attached, they are located in the parent directory (one folder above this "wiki" folder). Locate and study the main Vue file, types/props, styles, and dependencies until you fully understand how the component works. Once you have a complete understanding of its behavior and interface, further deep-dive study of outer dependencies is not required.
|
|
6
|
+
|
|
7
|
+
Mandatory Instruction:
|
|
8
|
+
You must read and deeply study the detailed descriptions, rules, coding standards, and templates specified in:
|
|
9
|
+
node_modules/@dxtmisha/scripts/src/media/templates/prompts/componentPrompt.en.txt
|
|
10
|
+
|
|
11
|
+
You must strictly follow those instructions. However, make sure you save your outputs in the correct target locations:
|
|
12
|
+
- Documentation & playground changes (including MDX files and `stories.ts` playground configurations) must be saved inside this current directory (the "wiki" folder).
|
|
13
|
+
- Component source changes (including Vue SFC and typings/properties files) must be saved inside the parent directory (one level up from this current directory).
|
|
14
|
+
- Note: You must completely ignore any instructions or constraints in `componentPrompt.en.txt` regarding how the final result/output should be returned or structured (specifically ignore rules 5-8, the requirement to split the response into 5 parts separated by "#########", and the prohibition on writing or modifying files). Instead, strictly follow the local file modification and file saving rules defined here by directly modifying the workspace files (MDX and `stories.ts` in the current folder, and Vue SFC and `types.ts` in the parent folder).
|
|
15
|
+
|
|
16
|
+
All constraints, formatting standards, and styling helper classes described in that file must be adhered to without exception.
|
|
17
|
+
(Warning: If this file is not accessible, missing, or cannot be read, you do not need to study or follow the instructions from it; instead, proceed with standard high-quality documentation practices.)
|
|
18
|
+
|
|
19
|
+
---
|
|
20
|
+
CRITICAL PRIORITY RULE:
|
|
21
|
+
Everything below this line has a higher priority than the text above it.
|
|
@@ -2,11 +2,12 @@
|
|
|
2
2
|
/// <reference types="node" />
|
|
3
3
|
|
|
4
4
|
import { spawn } from 'node:child_process'
|
|
5
|
+
import { readFileSync } from 'node:fs'
|
|
5
6
|
|
|
6
7
|
;(async () => {
|
|
7
8
|
try {
|
|
8
9
|
// You can add prompt generation logic here
|
|
9
|
-
const prompt = ''
|
|
10
|
+
const prompt = readFileSync(new URL('./prompt.txt', import.meta.url), 'utf-8')
|
|
10
11
|
|
|
11
12
|
const child = spawn(
|
|
12
13
|
'npx',
|
|
@@ -2,6 +2,17 @@
|
|
|
2
2
|
|
|
3
3
|
Your primary goal is to generate flawless, industrial-grade code that adheres to dxt-ui standards. You promise to follow these rules strictly:
|
|
4
4
|
|
|
5
|
+
0. **Mandatory Deep Study**:
|
|
6
|
+
- Before developing anything for any project or package, you MUST study it completely to fully understand its architecture and stylistic guidelines.
|
|
7
|
+
- Before modifying or fixing any file, you MUST fully study its internal structure and logic first.
|
|
8
|
+
- If any instructions, paths, or files are specified as located inside `node_modules/` or any other external/linked directory, you MUST first check if this package exists locally in the workspace (for example, under `packages/`). If it does exist locally, you MUST resolve the paths to the local workspace package directory and study/modify the local source files instead.
|
|
9
|
+
- **CRITICAL FIRST STEP:** If any project, module, or instruction contains links or references to specific files (e.g. types, developer guides, descriptions), you MUST study all these referenced files as your absolute first action. As soon as you start working with a project, or notice that it is imported/used in the code you are working with, you must immediately read and study all these referenced files before doing any planning, proposing code changes, or writing code. This is mandatory and applies even if the files are located in `node_modules/` (always resolve them to the local workspace directory first if they exist locally).
|
|
10
|
+
- **STRICT BLOCKING GUARD (CHRONOLOGICAL ORDER RULES):**
|
|
11
|
+
1. Identify all package paths involved in the user request (e.g. `/packages/constructor/...` maps to `@dxtmisha/constructor`).
|
|
12
|
+
2. Scan the prompt for sections corresponding to those packages.
|
|
13
|
+
3. Identify all paths to auxiliary documentation/types mentioned in those sections (e.g., `ai-types.txt`, `ai-developer.txt`).
|
|
14
|
+
4. You MUST use the `view_file` tool to read and study ALL of these referenced files BEFORE calling `list_dir` on component sub-folders, writing any plans/checklists, or proposing/making code changes. Bypassing this order is a critical protocol violation.
|
|
15
|
+
|
|
5
16
|
1. **"Copy-Paste Ready" Principle**:
|
|
6
17
|
- Generate code that can be copied and run without a single manual edit.
|
|
7
18
|
- All imports must be absolute or correct relative paths.
|
|
@@ -16,6 +27,9 @@ Your primary goal is to generate flawless, industrial-grade code that adheres to
|
|
|
16
27
|
- **DRY & KISS**: Avoid duplication, write as simply and clearly as possible.
|
|
17
28
|
- **SOLID**: Every module, class, or function must have one clear responsibility.
|
|
18
29
|
- **Declarative Approach**: Prefer a declarative programming style (array functional methods, composition).
|
|
30
|
+
- **No Abbreviations**: Do not use shortened or abbreviated names for variables, properties, arguments, methods, classes, etc. (e.g., do not use `el`, `rect1`/`r1`, `dx`/`dy`, `val`, `temp`). All identifiers must be descriptive, complete, and self-explanatory.
|
|
31
|
+
- **Optimization and Clarity**: Write code that is highly optimized, performant, and clean, ensuring it is easy to read and understand.
|
|
32
|
+
- **Single Responsibility (KISS/SOLID)**: Avoid creating large "mega-functions" or monolithic blocks. Each function must be concise and perform exactly one focused task (1 function = 1 functionality).
|
|
19
33
|
|
|
20
34
|
4. **Uncompromising TypeScript**:
|
|
21
35
|
- No `any`. Use `unknown` if the type is truly unknown, or create generic types.
|
|
@@ -38,3 +52,8 @@ Your primary goal is to generate flawless, industrial-grade code that adheres to
|
|
|
38
52
|
8. **Aesthetics and Conciseness**:
|
|
39
53
|
- The code must be beautiful. Use logical indentation and group code by meaning.
|
|
40
54
|
- Save tokens by avoiding redundant comments where the code speaks for itself.
|
|
55
|
+
|
|
56
|
+
9. **Strict Adherence to Instructions**:
|
|
57
|
+
- Perform all operations strictly in accordance with the provided commands and instructions.
|
|
58
|
+
- Avoid guessing, improvisation, or performing any unrequested or extra actions.
|
|
59
|
+
- Strictly adhere to the plan, checklists, and execution steps.
|
|
@@ -2,6 +2,19 @@
|
|
|
2
2
|
|
|
3
3
|
Твоя главная цель — генерировать безупречный, промышленный код, который соответствует стандартам dxt-ui. Ты обещаешь следовать этим правилам неукоснительно:
|
|
4
4
|
|
|
5
|
+
0. **Обязательное глубокое изучение**:
|
|
6
|
+
- Прежде чем разрабатывать что-либо для любого проекта или пакета, ты ОБЯЗАН полностью изучить его, чтобы детально понять его архитектуру и стилистику.
|
|
7
|
+
- Прежде чем изменять или исправлять любой файл, ты ОБЯЗАН полностью изучить его внутреннюю структуру и логику.
|
|
8
|
+
- Если в инструкциях, путях или файлах указано расположение внутри `node_modules/` или любой другой внешней/привязанной директории, ты ОБЯЗАН сначала проверить, существует ли этот пакет локально в рабочей области (например, в каталоге `packages/`). Если пакет существует локально, ты ОБЯЗАН переопределить пути на локальный каталог пакета рабочей области и изучать/изменять локальные исходные файлы вместо указанных.
|
|
9
|
+
- **КРИТИЧЕСКИЙ ПЕРВЫЙ ШАГ:** Если какой-либо проект, модуль или инструкция содержит ссылки или пути к конкретным файлам (например, типы, руководства для разработчиков, описания), ты ОБЯЗАН подробно изучить все эти файлы по ссылкам в первую очередь. Как только ты начинаешь работу с проектом или видишь, что он импортируется/используется в коде, над которым ты работаешь, ты должен незамедлительно прочитать и изучить все эти файлы по ссылкам, прежде чем приступать к планированию, предложению изменений или написанию кода. Это требование обязательно и распространяется в том числе на файлы, находящиеся в `node_modules/` (всегда сначала переопределяй пути на локальный каталог рабочей области, если они существуют локально).
|
|
10
|
+
- **БЛОКИРУЮЩИЙ КОНТРОЛЬ ПОСЛЕДОВАТЕЛЬНОСТИ (ПРАВИЛО ХРОНОЛОГИИ):**
|
|
11
|
+
1. Определи все пути пакетов, связанных с запросом (например, `/packages/constructor/...` относится к `@dxtmisha/constructor`).
|
|
12
|
+
2. Найди в промпте секции, соответствующие этим пакетам.
|
|
13
|
+
3. Выпиши все пути к вспомогательным файлам типов и руководств, упомянутые в этих секциях (например, `ai-types.txt`, `ai-developer.txt`).
|
|
14
|
+
4. Ты ОБЯЗАН использовать инструмент `view_file` для чтения и изучения ВСЕХ этих файлов ДО ТОГО, как вызывать `list_dir` для папок компонентов, писать какие-либо планы/чек-листы или вносить/предлагать изменения в код. Нарушение этой последовательности является критическим нарушением протокола.
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
5
18
|
1. **Принцип «Copy-Paste Ready» (Готовность к использованию)**:
|
|
6
19
|
- Генерируй код, который можно скопировать и запустить без единой правки.
|
|
7
20
|
- Все импорты должны быть абсолютными или корректными относительными.
|
|
@@ -16,6 +29,9 @@
|
|
|
16
29
|
- **DRY & KISS**: Избегай дублирования, пиши максимально просто и понятно.
|
|
17
30
|
- **SOLID**: Каждый модуль, класс или функция должны иметь одну четкую ответственность.
|
|
18
31
|
- **Декларативность**: Отдавай предпочтение декларативному стилю программирования (функциональные методы массивов, композиция).
|
|
32
|
+
- **Никаких сокращений**: Запрещено использовать сокращенные имена для переменных, свойств, аргументов, методов, классов и т. д. (например, нельзя использовать `el`, `rect1`/`r1`, `dx`/`dy`, `val`, `temp`). Все идентификаторы должны быть информативными, полными и самодокументируемыми.
|
|
33
|
+
- **Оптимизация и понятность**: Код должен быть максимально оптимизированным, производительным и понятным, обеспечивающим легкое чтение и поддержку.
|
|
34
|
+
- **Принцип единой ответственности**: Избегай создания больших «мега-функций» или монолитных блоков. Каждая функция должна быть лаконичной и решать ровно одну задачу (1 функция — 1 функционал).
|
|
19
35
|
|
|
20
36
|
4. **Бескомпромиссный TypeScript**:
|
|
21
37
|
- Никаких `any`. Используй `unknown`, если тип действительно неизвестен, или создавай generic-типы.
|
|
@@ -38,3 +54,8 @@
|
|
|
38
54
|
8. **Эстетика и Лаконичность**:
|
|
39
55
|
- Код должен быть красивым. Используй логические отступы и группировку кода по смыслу.
|
|
40
56
|
- Экономь токены, избегая избыточных комментариев там, где код говорит сам за себя.
|
|
57
|
+
|
|
58
|
+
9. **Строгое следование инструкциям**:
|
|
59
|
+
- Выполняй все действия строго в соответствии с предоставленными командами и инструкциями.
|
|
60
|
+
- Никакой самодеятельности, додумывания или выполнения лишних/незапрошенных действий.
|
|
61
|
+
- Строго придерживайся планов, чек-листов и шагов выполнения.
|
|
@@ -52,27 +52,79 @@ Use the following template and style.
|
|
|
52
52
|
7. **Events**:
|
|
53
53
|
- Heading `## Events`
|
|
54
54
|
- For each event:
|
|
55
|
-
- `### eventName
|
|
56
|
-
-
|
|
55
|
+
- Header `### `eventName`` (the name must be wrapped in backticks).
|
|
56
|
+
- A brief paragraph describing when the event triggers.
|
|
57
57
|
- **Parameters:**
|
|
58
|
-
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
58
|
+
- Header: `**Parameters:**`
|
|
59
|
+
- List: `- `paramName: paramType` — parameter description.`
|
|
60
|
+
- **Structure of Custom Types (if applicable):**
|
|
61
|
+
- Header: `**TypeName structure:**` (or `**TypeName structure:** same as for `otherEventName` event` if identical).
|
|
62
|
+
- List: `- `fieldName: fieldType` — field description.`
|
|
63
|
+
- **Code Example (if the event is complex):**
|
|
64
|
+
- Code examples MUST be wrapped using the Storybook `<Source />` component instead of standard markdown backticks. Remember to add `import { Source } from '@storybook/addon-docs/blocks';` at the top of the MDX file if not already present:
|
|
65
|
+
```md
|
|
66
|
+
<Source
|
|
67
|
+
code={`
|
|
68
|
+
<script setup>
|
|
69
|
+
// code example here
|
|
70
|
+
</script>
|
|
71
|
+
`}
|
|
72
|
+
language="html"
|
|
73
|
+
/>
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
8. **Expose (Component Methods & Properties)**:
|
|
62
77
|
- Heading `## Expose`
|
|
63
|
-
-
|
|
64
|
-
-
|
|
65
|
-
-
|
|
66
|
-
-
|
|
78
|
+
- Under the heading, present the list of public methods, reactive references (Refs), and computed variables exposed by the component, in the clean, signature-based bullet format:
|
|
79
|
+
- For methods: `- `methodName(paramName: paramType): returnType` — Description.`
|
|
80
|
+
- For reactive states (Refs/Computed): `- `propertyName: PropertyType` — Description.`
|
|
81
|
+
- Standard types include `boolean`, `void`, `Ref<any>`, `ComputedRef<any>`, etc.
|
|
67
82
|
|
|
68
83
|
9. **Slots**:
|
|
69
84
|
- Heading `## Slots`
|
|
70
|
-
-
|
|
71
|
-
-
|
|
72
|
-
-
|
|
73
|
-
-
|
|
74
|
-
|
|
75
|
-
|
|
85
|
+
- Under the heading, present the list of slots in the clean, signature-based bullet format:
|
|
86
|
+
- For slots without parameters: `- `slotName: Type` — Description.`
|
|
87
|
+
- For slots with parameters: `- `slotName(paramName: paramType): Type` — Description.`
|
|
88
|
+
- Standard return type is usually `VNode` or `any`.
|
|
89
|
+
|
|
90
|
+
### Storybook Layout Helpers (storybookStyle.scss):
|
|
91
|
+
When writing Storybook stories (`*.stories.ts`) and examples in the MDX documentation, you MUST use the predefined showcase helper classes. These styles are imported globally and start with the `.wiki-storybook-` prefix. Do not write custom inline styles or new CSS classes for showcase layout, positioning, placeholders, or containers; use the following helper classes:
|
|
92
|
+
|
|
93
|
+
- **Containers & Layouts**:
|
|
94
|
+
- `.wiki-storybook-container` — enables container queries (`container-type: inline-size`).
|
|
95
|
+
- `.wiki-storybook-group` — a 12-column CSS Grid layout (`grid-template-columns: repeat(12, 1fr)`) with an `8px` gap, perfect for presenting multiple items or variations.
|
|
96
|
+
- `.wiki-storybook-flex` — basic flexbox wrapper (`display: flex; flex-wrap: wrap`) with an `8px` gap.
|
|
97
|
+
- `.wiki-storybook-flex-align-center` — same as flex wrapper, but aligns items vertically (`align-items: center`).
|
|
98
|
+
- `.wiki-storybook-flex-center` — centers items horizontally and vertically with an `8px` gap.
|
|
99
|
+
- `.wiki-storybook-flex-column` — vertical flexbox layout (`display: flex; flex-direction: column`) with a `16px` gap.
|
|
100
|
+
- `.wiki-storybook-decreased` — constrains maximum width of the showcase block to `72%`.
|
|
101
|
+
- `.wiki-storybook-decreasedX2` — constrains showcase block width responsively (`64%` at `md` screens, `48%` at `lg` screens).
|
|
102
|
+
|
|
103
|
+
- **Showcase Items (`.wiki-storybook-item`)**:
|
|
104
|
+
Used to display components inside a unified visual frame (aspect-ratio `1/1` by default, border, rounded corners, hidden overflow):
|
|
105
|
+
- `.wiki-storybook-item__label` — a small floaty label at the top-left corner (`font-size: 12px`, semi-transparent blurred background) for labeling specific variations. Use `.wiki-storybook-item__label--static` to make it flow statically inside the block without absolute positioning.
|
|
106
|
+
- `&--padding` — adds standard `16px` padding inside the item box.
|
|
107
|
+
- `&--rectangle` — sets a `16:9` aspect ratio and spans all 12 columns in a grid.
|
|
108
|
+
- `&--widescreen` — sets a `32:9` aspect ratio and spans all 12 columns in a grid.
|
|
109
|
+
- `&--compact` — sets a `64:9` aspect ratio and spans all 12 columns in a grid.
|
|
110
|
+
- `&--auto` — sets aspect ratio to `auto` and spans all 12 columns in a grid.
|
|
111
|
+
- `&--squared--xs`, `&--squared--sm`, `&--squared--md`, `&--squared--lg`, `&--squared--max` — responsive grid item spans. For instance, `--squared--sm` spans 6 columns on mobile, 4 columns on tablet (640px+), and 2 columns on desktop (1024px+).
|
|
112
|
+
- `&--center` — flex-centers internal elements.
|
|
113
|
+
- `&--widthAuto` — sets width to `auto`.
|
|
114
|
+
- `&--overflowVisible` — overrides `overflow: hidden` to `overflow: visible` (useful for dropdowns or modals).
|
|
115
|
+
- `&--rtl` — sets Right-to-Left (RTL) text and flex layout direction.
|
|
116
|
+
|
|
117
|
+
- **Mock Components & Placeholders**:
|
|
118
|
+
- `.wiki-storybook-card` — a mock card (`320px` width, rounded borders) to simulate real-world layout placement:
|
|
119
|
+
- `.wiki-storybook-card__image` — 128px high cover image.
|
|
120
|
+
- `.wiki-storybook-card__content` — vertical flex layout with `16px` padding and `16px` gap.
|
|
121
|
+
- `.wiki-storybook-card__label` — title with `20px` font size.
|
|
122
|
+
- `.wiki-storybook-card__information` — muted descriptions (`14px` size, gray).
|
|
123
|
+
- `.wiki-storybook-card__actions` — horizontal actions flex wrapper (`8px` gap).
|
|
124
|
+
- `.wiki-storybook-button` — standard story action trigger button. Modifiers for status colors: `&--success` (green), `&--error` (red), `&--warning` (yellow), `&--info` (blue).
|
|
125
|
+
- `.wiki-storybook-dummy` — visual placeholder box (`32px` high, dark translucent grey).
|
|
126
|
+
- Colors: `&--color--blue`, `&--color--red`, `&--color--green`.
|
|
127
|
+
- Sizes: `&--size--sm` (height `64px`), `&--size--md` (height `128px`), `&--size--lg` (height `256px`).
|
|
76
128
|
|
|
77
129
|
### Instructions:
|
|
78
130
|
1. Study the provided component code (including props, emits, slots, expose).
|
|
@@ -82,6 +134,9 @@ Use the following template and style.
|
|
|
82
134
|
3.2. Try to keep original descriptions unchanged.
|
|
83
135
|
4. Use the correct terminology (Props, Events, Slots, Expose).
|
|
84
136
|
4.1. All headings must be in [wikiLanguage].
|
|
137
|
+
4.2. In Storybook stories and MDX code examples, you MUST use the predefined layout helper classes from `storybookStyle.scss` (described above) instead of inline styles or custom CSS blocks.
|
|
138
|
+
4.3. Do not modify the original component code under any circumstances unless explicitly requested.
|
|
139
|
+
4.4. Strictly follow all rules in this prompt. There is zero tolerance for hallucinations: do not invent, assume, or add any non-existent properties, methods, events, slots, or external package dependencies.
|
|
85
140
|
5. Do not add unnecessary introductions or conclusions, only MDX.
|
|
86
141
|
6. Return only the full MDX code of the documentation without any additional text, comments, or markdown formatting (```).
|
|
87
142
|
7. The result must be exclusively text (response), do not attach any files.
|