@dxtmisha/scripts 0.7.12 → 0.8.2
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 +12 -0
- package/bin/design-prompt.ts +5 -0
- package/package.json +2 -1
- package/src/classes/BrowserItem.ts +33 -0
- package/src/classes/Design/DesignComponent.ts +1 -1
- package/src/classes/Design/DesignConstructor.ts +1 -1
- package/src/classes/Design/DesignReplace.ts +1 -1
- package/src/classes/Design/DesignScreenshot.ts +11 -1
- package/src/classes/Design/DesignTypes.ts +1 -1
- package/src/classes/Design/DesignUi.ts +4 -4
- package/src/classes/Design/DesignWikiStormItem.ts +6 -4
- package/src/classes/Library/LibraryAiPrompt.ts +223 -0
- package/src/classes/Library/LibraryAiPromptItem.ts +284 -0
- package/src/config.ts +28 -0
- package/src/library.ts +54 -54
- package/src/media/templates/packages/library/package.json +2 -1
- package/src/media/templates/packages/nitro/src/App.vue +2 -2
- package/src/media/templates/packages/nitro/src/entry-client.ts +1 -0
- package/src/media/templates/packages/nitro/tsconfig.app.json +1 -2
- package/src/media/templates/prompts/aiCodeGlobalPrompt.en.txt +40 -0
- package/src/media/templates/prompts/aiCodeGlobalPrompt.ru.txt +40 -0
- package/src/media/templates/prompts/aiCodeVuePrompt.en.txt +17 -0
- package/src/media/templates/prompts/aiCodeVuePrompt.ru.txt +17 -0
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,18 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
|
|
5
|
+
## [0.8.0] - 2026-05-10
|
|
6
|
+
|
|
7
|
+
### Added
|
|
8
|
+
- **AI Prompt System**: Introduced `LibraryAiPrompt` and `LibraryAiPromptItem` classes for automated, recursive AI prompt generation across the monorepo.
|
|
9
|
+
- **Nitro Scaffolding**: Added a full Nitro + Vue 3 SSR boilerplate template for rapid project initialization.
|
|
10
|
+
- **Design Prompt CLI**: Added `design-prompt` CLI tool for aggregating documentation, types, and screenshots into AI-ready context files.
|
|
11
|
+
- **Config Standardization**: Standardized project constants in `config.ts` to support automated discovery and design workflows.
|
|
12
|
+
|
|
13
|
+
### Changed / Improved
|
|
14
|
+
- **Build System**: Updated script library exports and synchronized workspace dependencies.
|
|
15
|
+
- **Library Exports**: Synchronized package-lock and updated internal script exports for better consistency.
|
|
16
|
+
|
|
5
17
|
## [0.7.11] - 2026-05-05
|
|
6
18
|
|
|
7
19
|
### Added
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dxtmisha/scripts",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.8.2",
|
|
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": [
|
|
@@ -51,6 +51,7 @@
|
|
|
51
51
|
"dxt-flags": "bin/design-flags.ts",
|
|
52
52
|
"dxt-library": "bin/design-library.ts",
|
|
53
53
|
"dxt-package": "bin/design-package.ts",
|
|
54
|
+
"dxt-prompt": "bin/design-prompt.ts",
|
|
54
55
|
"dxt-screenshot": "bin/design-screenshot.ts",
|
|
55
56
|
"dxt-types": "bin/design-types.ts",
|
|
56
57
|
"dxt-ui": "bin/design-ui.ts",
|
|
@@ -187,6 +187,39 @@ export class BrowserItem {
|
|
|
187
187
|
return await (await this.getPage()).content()
|
|
188
188
|
}
|
|
189
189
|
|
|
190
|
+
/**
|
|
191
|
+
* Retrieves the HTML content of the body.
|
|
192
|
+
*
|
|
193
|
+
* Извлекает HTML-содержимое тела (body) страницы.
|
|
194
|
+
* @returns body html content string / HTML-содержимое body
|
|
195
|
+
*/
|
|
196
|
+
async getBody(): Promise<string> {
|
|
197
|
+
return await this.evaluate(() => document.body.innerHTML) ?? ''
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
/**
|
|
201
|
+
* Retrieves all CSS styles from the page.
|
|
202
|
+
*
|
|
203
|
+
* Извлекает все CSS-стили со страницы.
|
|
204
|
+
* @returns CSS content string / CSS-содержимое
|
|
205
|
+
*/
|
|
206
|
+
async getStyles(): Promise<string> {
|
|
207
|
+
return await this.evaluate(() => {
|
|
208
|
+
return Array.from(document.styleSheets)
|
|
209
|
+
.map((sheet) => {
|
|
210
|
+
try {
|
|
211
|
+
return Array.from(sheet.cssRules)
|
|
212
|
+
.map(rule => rule.cssText)
|
|
213
|
+
.join('\n')
|
|
214
|
+
} catch (e) {
|
|
215
|
+
console.error('Error getting CSS rules:', e)
|
|
216
|
+
return ''
|
|
217
|
+
}
|
|
218
|
+
})
|
|
219
|
+
.join('\n')
|
|
220
|
+
}) ?? ''
|
|
221
|
+
}
|
|
222
|
+
|
|
190
223
|
/**
|
|
191
224
|
* Extracts scrollable dimensions of the page.
|
|
192
225
|
*
|
|
@@ -793,7 +793,7 @@ export class DesignComponent extends DesignCommand {
|
|
|
793
793
|
this.updatePackage(
|
|
794
794
|
`exports|${name}`,
|
|
795
795
|
{
|
|
796
|
-
types: `./dist/library/${this.getFullName()}.d.ts`,
|
|
796
|
+
types: `./dist/src/library/${this.getFullName()}.d.ts`,
|
|
797
797
|
default: `./dist/${this.getFullName()}.js`
|
|
798
798
|
}
|
|
799
799
|
)
|
|
@@ -195,7 +195,7 @@ export class DesignConstructor extends DesignCommand {
|
|
|
195
195
|
this.updatePackage(
|
|
196
196
|
`exports|${name}`,
|
|
197
197
|
{
|
|
198
|
-
types: `./dist/constructors/${command}/index.d.ts`,
|
|
198
|
+
types: `./dist/src/constructors/${command}/index.d.ts`,
|
|
199
199
|
default: `./dist/${this.getNameMin()}.js`
|
|
200
200
|
}
|
|
201
201
|
)
|
|
@@ -215,7 +215,7 @@ export class DesignReplace {
|
|
|
215
215
|
&& !this.isNoMark(mark, name)
|
|
216
216
|
) {
|
|
217
217
|
const typesString = !constructor && !types.match(/string|boolean/) && types.match(/'/)
|
|
218
|
-
? `string |
|
|
218
|
+
? `${types}` // string |
|
|
219
219
|
: types
|
|
220
220
|
|
|
221
221
|
templates.push(`${name}?: ${typesString}`)
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { spawn } from 'node:child_process'
|
|
2
2
|
import { ServerStorage } from '@dxtmisha/functional-basic'
|
|
3
|
+
|
|
4
|
+
import { PropertiesFile } from '../Properties/PropertiesFile'
|
|
3
5
|
import { BrowserItem } from '../BrowserItem'
|
|
4
|
-
import { PropertiesFile } from '../Properties/PropertiesFile.ts'
|
|
5
6
|
|
|
6
7
|
/**
|
|
7
8
|
* Class for automatic capturing of screenshots by running dev server.
|
|
@@ -55,6 +56,15 @@ export class DesignScreenshot {
|
|
|
55
56
|
const browser = new BrowserItem(this.url, { height: 1024 * 12 })
|
|
56
57
|
await browser.screenshot(this.file)
|
|
57
58
|
|
|
59
|
+
PropertiesFile.writeByPath(
|
|
60
|
+
`${this.file}-code.html`,
|
|
61
|
+
await browser.getBody()
|
|
62
|
+
)
|
|
63
|
+
PropertiesFile.writeByPath(
|
|
64
|
+
`${this.file}-styles.css`,
|
|
65
|
+
await browser.getStyles()
|
|
66
|
+
)
|
|
67
|
+
|
|
58
68
|
return true
|
|
59
69
|
}
|
|
60
70
|
|
|
@@ -229,7 +229,7 @@ export class DesignTypes {
|
|
|
229
229
|
const generate = await this.toAi(
|
|
230
230
|
content,
|
|
231
231
|
'Remove all Russian comments from this code. '
|
|
232
|
-
+ '
|
|
232
|
+
+ 'Shorten English comments for AI; keep context but be brief. Do not delete obvious comments. '
|
|
233
233
|
+ 'Always keep All JSDoc "@example", "@remarks", "@note", and any other notes or warnings. '
|
|
234
234
|
+ 'Remove all imports. '
|
|
235
235
|
+ '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. '
|
|
@@ -106,15 +106,15 @@ export class DesignUi {
|
|
|
106
106
|
|
|
107
107
|
if (packageJson?.exports) {
|
|
108
108
|
packageJson.exports['.'] = {
|
|
109
|
-
types: './dist/library/types.d.ts',
|
|
109
|
+
types: './dist/src/library/types.d.ts',
|
|
110
110
|
default: './dist/types.js'
|
|
111
111
|
}
|
|
112
112
|
packageJson.exports['./plugin'] = {
|
|
113
|
-
types: './dist/library/plugin.d.ts',
|
|
113
|
+
types: './dist/src/library/plugin.d.ts',
|
|
114
114
|
default: './dist/plugin.js'
|
|
115
115
|
}
|
|
116
116
|
packageJson.exports['./media'] = {
|
|
117
|
-
types: './dist/library/media.d.ts',
|
|
117
|
+
types: './dist/src/library/media.d.ts',
|
|
118
118
|
default: './dist/media.js'
|
|
119
119
|
}
|
|
120
120
|
packageJson.exports['./style.css'] = './dist/style.css'
|
|
@@ -123,7 +123,7 @@ export class DesignUi {
|
|
|
123
123
|
sass: './ui-properties.scss',
|
|
124
124
|
default: './ui-properties.scss'
|
|
125
125
|
}
|
|
126
|
-
packageJson.exports['./types.d.ts'] = './dist/library/types.d.ts'
|
|
126
|
+
packageJson.exports['./types.d.ts'] = './dist/src/library/types.d.ts'
|
|
127
127
|
packageJson['web-types'] = './dist/web-types.json'
|
|
128
128
|
|
|
129
129
|
PropertiesFile.writeByPath(UI_FILE_PACKAGE, packageJson)
|
|
@@ -186,10 +186,12 @@ export class DesignWikiStormItem {
|
|
|
186
186
|
const filePath = this.getPaths(['wikiData.ts'])
|
|
187
187
|
|
|
188
188
|
if (PropertiesFile.is(filePath)) {
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
189
|
+
try {
|
|
190
|
+
const wiki: Record<string, any> = await import(filePath.join('/'))
|
|
191
|
+
this.dataComponent = Object.values(wiki).find(item => 'component' in item)
|
|
192
|
+
} catch (error) {
|
|
193
|
+
console.error(filePath, error)
|
|
194
|
+
}
|
|
193
195
|
}
|
|
194
196
|
}
|
|
195
197
|
|
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
import {
|
|
2
|
+
UI_FILE_AI_PROMPT_INSTRUCTION,
|
|
3
|
+
UI_FILE_AI_PROMPT_PROMPT,
|
|
4
|
+
UI_MODULES
|
|
5
|
+
} from '../../config'
|
|
6
|
+
|
|
7
|
+
import { PropertiesFile } from '../Properties/PropertiesFile'
|
|
8
|
+
import { LibraryAiPromptItem } from './LibraryAiPromptItem'
|
|
9
|
+
|
|
10
|
+
import vuePromptText from '../../media/templates/prompts/aiCodeVuePrompt.en.txt?raw'
|
|
11
|
+
import globalPromptText from '../../media/templates/prompts/aiCodeGlobalPrompt.en.txt?raw'
|
|
12
|
+
|
|
13
|
+
const LIBRARY_AI_PROMPT_LIST_DIRS = [
|
|
14
|
+
UI_MODULES
|
|
15
|
+
]
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Class for generating a consolidated AI prompt for the library.
|
|
19
|
+
* It scans directories for prompt items and instructions to create a final prompt file.
|
|
20
|
+
*
|
|
21
|
+
* Класс для генерации консолидированного промпта ИИ для библиотеки.
|
|
22
|
+
* Сканирует директории на наличие элементов промпта и инструкций для создания итогового файла промпта.
|
|
23
|
+
*/
|
|
24
|
+
export class LibraryAiPrompt {
|
|
25
|
+
/** List of directories to scan. / Список директорий для сканирования. */
|
|
26
|
+
protected readonly dirs: string[]
|
|
27
|
+
|
|
28
|
+
/** Regular expression to identify files in directories. / Регулярное выражение для идентификации файлов в директориях. */
|
|
29
|
+
protected readonly exFileOnDirs = /^.+\.[^.]{2,4}$/
|
|
30
|
+
/** Regular expression to exclude hidden files/directories. / Регулярное выражение для исключения скрытых файлов/директорий. */
|
|
31
|
+
protected readonly exNotRead = /^\./
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Constructor for LibraryAiPrompt.
|
|
35
|
+
*
|
|
36
|
+
* Конструктор для LibraryAiPrompt.
|
|
37
|
+
* @param dirs Additional directories to scan / Дополнительные директории для сканирования
|
|
38
|
+
*/
|
|
39
|
+
constructor(
|
|
40
|
+
dirs: string[] = []
|
|
41
|
+
) {
|
|
42
|
+
this.dirs = [
|
|
43
|
+
...LIBRARY_AI_PROMPT_LIST_DIRS,
|
|
44
|
+
...dirs
|
|
45
|
+
]
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Main method to generate the AI prompt file.
|
|
50
|
+
*
|
|
51
|
+
* Основной метод для генерации файла промпта ИИ.
|
|
52
|
+
*/
|
|
53
|
+
make(): void {
|
|
54
|
+
console.log('Generating AI prompt...')
|
|
55
|
+
|
|
56
|
+
const list = this.getList()
|
|
57
|
+
const prompts = [
|
|
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.
|
|
68
|
+
`.trim(),
|
|
69
|
+
this.getGlobalPrompt(),
|
|
70
|
+
this.getVuePrompt()
|
|
71
|
+
]
|
|
72
|
+
|
|
73
|
+
if (list.length > 0) {
|
|
74
|
+
list.forEach((item) => {
|
|
75
|
+
const prompt = item.make()
|
|
76
|
+
|
|
77
|
+
if (prompt) {
|
|
78
|
+
prompts.push(prompt)
|
|
79
|
+
}
|
|
80
|
+
})
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
const instruction = this.getInstruction()
|
|
84
|
+
|
|
85
|
+
if (instruction) {
|
|
86
|
+
prompts.push(instruction)
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
this.write(prompts)
|
|
90
|
+
|
|
91
|
+
console.log('end')
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* Checks if there are any files in the provided list.
|
|
96
|
+
*
|
|
97
|
+
* Проверяет, есть ли файлы в предоставленном списке.
|
|
98
|
+
* @param dirs list of file/directory names / список имен файлов/директорий
|
|
99
|
+
* @returns true if any file is found / true, если найден хотя бы один файл
|
|
100
|
+
* @protected
|
|
101
|
+
*/
|
|
102
|
+
protected isFileOnDirs(dirs: string[]): boolean {
|
|
103
|
+
return dirs.some(path => this.exFileOnDirs.test(path))
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* Retrieves high-priority instructions from a specific file.
|
|
108
|
+
*
|
|
109
|
+
* Получает высокоприоритетные инструкции из специального файла.
|
|
110
|
+
* @returns formatted instructions or undefined / отформатированные инструкции или undefined
|
|
111
|
+
* @protected
|
|
112
|
+
*/
|
|
113
|
+
protected getInstruction(): string | undefined {
|
|
114
|
+
if (PropertiesFile.is(UI_FILE_AI_PROMPT_INSTRUCTION)) {
|
|
115
|
+
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.
|
|
118
|
+
${PropertiesFile.readFileOnly(UI_FILE_AI_PROMPT_INSTRUCTION)}
|
|
119
|
+
`.trim()
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* Retrieves the Vue component implementation prompt.
|
|
125
|
+
*
|
|
126
|
+
* Получает промпт по реализации Vue-компонентов.
|
|
127
|
+
* @returns formatted Vue prompt or undefined / отформатированный промпт Vue или undefined
|
|
128
|
+
* @protected
|
|
129
|
+
*/
|
|
130
|
+
protected getVuePrompt(): string {
|
|
131
|
+
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.
|
|
134
|
+
${vuePromptText}
|
|
135
|
+
`.trim()
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
/**
|
|
139
|
+
* Retrieves the global code implementation prompt.
|
|
140
|
+
*
|
|
141
|
+
* Получает глобальный промпт по реализации кода.
|
|
142
|
+
* @returns formatted global prompt or undefined / отформатированный глобальный промпт или undefined
|
|
143
|
+
* @protected
|
|
144
|
+
*/
|
|
145
|
+
protected getGlobalPrompt(): string {
|
|
146
|
+
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.
|
|
149
|
+
${globalPromptText}
|
|
150
|
+
`.trim()
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
/**
|
|
154
|
+
* Recursively scans directories to collect LibraryAiPromptItem instances.
|
|
155
|
+
*
|
|
156
|
+
* Рекурсивно сканирует директории для сбора экземпляров LibraryAiPromptItem.
|
|
157
|
+
* @param dirs directories to scan / директории для сканирования
|
|
158
|
+
* @param path current path segments / текущие сегменты пути
|
|
159
|
+
* @param limit recursion depth limit / лимит глубины рекурсии
|
|
160
|
+
* @returns list of prompt items / список элементов промпта
|
|
161
|
+
* @protected
|
|
162
|
+
*/
|
|
163
|
+
protected getList(
|
|
164
|
+
dirs: string[] = this.dirs,
|
|
165
|
+
path: string[] = [],
|
|
166
|
+
limit = 4
|
|
167
|
+
): LibraryAiPromptItem[] {
|
|
168
|
+
if (limit <= 0) {
|
|
169
|
+
return []
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
const items: LibraryAiPromptItem[] = []
|
|
173
|
+
|
|
174
|
+
for (const dir of dirs) {
|
|
175
|
+
if (this.exNotRead.test(dir)) {
|
|
176
|
+
continue
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
const pathDir = [...path, dir]
|
|
180
|
+
const list = PropertiesFile.readDir(pathDir)
|
|
181
|
+
|
|
182
|
+
if (
|
|
183
|
+
!this.isFileOnDirs(list)
|
|
184
|
+
|| dir === UI_MODULES
|
|
185
|
+
) {
|
|
186
|
+
items.push(...this.getList(
|
|
187
|
+
list,
|
|
188
|
+
pathDir,
|
|
189
|
+
limit - 1
|
|
190
|
+
))
|
|
191
|
+
} else {
|
|
192
|
+
const promptItem = new LibraryAiPromptItem(pathDir)
|
|
193
|
+
|
|
194
|
+
if (promptItem.isPrompt()) {
|
|
195
|
+
items.push(promptItem)
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
return items
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
/**
|
|
204
|
+
* Writes the collected prompts to a file.
|
|
205
|
+
*
|
|
206
|
+
* Записывает собранные промпты в файл.
|
|
207
|
+
* @param prompts list of prompt strings / список строк промптов
|
|
208
|
+
* @returns this instance / этот экземпляр
|
|
209
|
+
* @protected
|
|
210
|
+
*/
|
|
211
|
+
protected write(prompts: string[]): this {
|
|
212
|
+
PropertiesFile.writeByPath(
|
|
213
|
+
UI_FILE_AI_PROMPT_PROMPT,
|
|
214
|
+
prompts.join(`
|
|
215
|
+
|
|
216
|
+
---
|
|
217
|
+
|
|
218
|
+
`)
|
|
219
|
+
)
|
|
220
|
+
|
|
221
|
+
return this
|
|
222
|
+
}
|
|
223
|
+
}
|
|
@@ -0,0 +1,284 @@
|
|
|
1
|
+
import { PropertiesFile } from '../Properties/PropertiesFile'
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
UI_DIR_AI_PROMPT_SCREENSHOT,
|
|
5
|
+
UI_FILE_AI_PROMPT_DESCRIPTION,
|
|
6
|
+
UI_FILE_AI_PROMPT_INFO,
|
|
7
|
+
UI_FILE_AI_PROMPT_TYPES,
|
|
8
|
+
UI_FILE_PACKAGE
|
|
9
|
+
} from '../../config'
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Class representing an item in the AI prompt generation process.
|
|
13
|
+
* Handles reading and aggregating various project-related files (descriptions, info, types, screenshots)
|
|
14
|
+
* to build a context-rich prompt for AI.
|
|
15
|
+
*
|
|
16
|
+
* Класс, представляющий элемент в процессе создания промпта для ИИ.
|
|
17
|
+
* Управляет чтением и агрегацией различных файлов проекта (описания, информация, типы, скриншоты)
|
|
18
|
+
* для создания насыщенного контекстом промпта для ИИ.
|
|
19
|
+
*/
|
|
20
|
+
export class LibraryAiPromptItem {
|
|
21
|
+
/** Cached partition of package.json. / Кэш содержимого файла package.json. */
|
|
22
|
+
protected packageJson?: Record<string, any>
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Constructor for LibraryAiPromptItem.
|
|
26
|
+
*
|
|
27
|
+
* Конструктор для LibraryAiPromptItem.
|
|
28
|
+
* @param dir Path segments to the directory / Сегменты пути к директории
|
|
29
|
+
*/
|
|
30
|
+
constructor(
|
|
31
|
+
protected readonly dir: string[] = []
|
|
32
|
+
) {
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Returns the project name from package.json.
|
|
37
|
+
*
|
|
38
|
+
* Возвращает название проекта из package.json.
|
|
39
|
+
* @returns project name or 'none' / название проекта или 'none'
|
|
40
|
+
*/
|
|
41
|
+
getProjectName(): string {
|
|
42
|
+
return this.getPackageJson().name ?? 'none'
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Checks if any prompt-related files or directories exist.
|
|
47
|
+
*
|
|
48
|
+
* Проверяет, существуют ли какие-либо файлы или директории, связанные с промптами.
|
|
49
|
+
* @returns true if any prompt content is found / true, если найден какой-либо контент для промпта
|
|
50
|
+
*/
|
|
51
|
+
isPrompt(): boolean {
|
|
52
|
+
return this.isDescription()
|
|
53
|
+
|| this.isInfo()
|
|
54
|
+
|| this.isTypes()
|
|
55
|
+
|| this.isScreenshot()
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Checks if the description file exists.
|
|
60
|
+
*
|
|
61
|
+
* Проверяет, существует ли файл описания.
|
|
62
|
+
* @returns true if description file exists / true, если файл описания существует
|
|
63
|
+
*/
|
|
64
|
+
isDescription(): boolean {
|
|
65
|
+
return PropertiesFile.is(this.getPath(UI_FILE_AI_PROMPT_DESCRIPTION))
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Checks if the information file exists.
|
|
70
|
+
*
|
|
71
|
+
* Проверяет, существует ли файл с информацией.
|
|
72
|
+
* @returns true if info file exists / true, если файл информации существует
|
|
73
|
+
*/
|
|
74
|
+
isInfo(): boolean {
|
|
75
|
+
return PropertiesFile.is(this.getPath(UI_FILE_AI_PROMPT_INFO))
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* Checks if the types file exists.
|
|
80
|
+
*
|
|
81
|
+
* Проверяет, существует ли файл с типами.
|
|
82
|
+
* @returns true if types file exists / true, если файл типов существует
|
|
83
|
+
*/
|
|
84
|
+
isTypes(): boolean {
|
|
85
|
+
return PropertiesFile.is(this.getPath(UI_FILE_AI_PROMPT_TYPES))
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* Checks if the screenshot directory exists.
|
|
90
|
+
*
|
|
91
|
+
* Проверяет, существует ли директория со скриншотами.
|
|
92
|
+
* @returns true if screenshot directory exists / true, если директория скриншотов существует
|
|
93
|
+
*/
|
|
94
|
+
isScreenshot(): boolean {
|
|
95
|
+
return PropertiesFile.is(this.getPath(UI_DIR_AI_PROMPT_SCREENSHOT))
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* Gathers all available prompt content and formats it as a single string.
|
|
100
|
+
*
|
|
101
|
+
* Собирает весь доступный контент промпта и форматирует его в виде одной строки.
|
|
102
|
+
* @returns formatted prompt content or undefined / отформатированный контент промпта или undefined
|
|
103
|
+
*/
|
|
104
|
+
make(): string | undefined {
|
|
105
|
+
console.log(this.getProjectName())
|
|
106
|
+
|
|
107
|
+
const data = [
|
|
108
|
+
this.getDescription(),
|
|
109
|
+
this.getInfo(),
|
|
110
|
+
this.getTypes(),
|
|
111
|
+
this.getScreenshot()
|
|
112
|
+
].filter(item => item !== undefined) as string[]
|
|
113
|
+
|
|
114
|
+
if (data.length > 0) {
|
|
115
|
+
return `
|
|
116
|
+
# ${this.getProjectName()}
|
|
117
|
+
## Project location: Root directory
|
|
118
|
+
The project is located at: '${this.getPathString()}'.
|
|
119
|
+
|
|
120
|
+
${data.join('\n\n')}
|
|
121
|
+
`.trim()
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
return undefined
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
/**
|
|
128
|
+
* Constructs a full path for a file within the item's directory.
|
|
129
|
+
*
|
|
130
|
+
* Создает полный путь к файлу внутри директории элемента.
|
|
131
|
+
* @param dirFile File name / Имя файла
|
|
132
|
+
* @returns path segments / сегменты пути
|
|
133
|
+
* @protected
|
|
134
|
+
*/
|
|
135
|
+
protected getPath(dirFile: string): string[] {
|
|
136
|
+
return [...this.dir, dirFile]
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
/**
|
|
140
|
+
* Returns the directory path as a string joined by a slash.
|
|
141
|
+
*
|
|
142
|
+
* Возвращает путь к директории в виде строки, объединенной слешем.
|
|
143
|
+
* @returns path string / строка пути
|
|
144
|
+
* @protected
|
|
145
|
+
*/
|
|
146
|
+
protected getPathString(): string {
|
|
147
|
+
return this.dir.join('/')
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
/**
|
|
151
|
+
* Retrieves and caches package.json content.
|
|
152
|
+
*
|
|
153
|
+
* Получает и кэширует содержимое файла package.json.
|
|
154
|
+
* @returns package.json object / объект package.json
|
|
155
|
+
* @protected
|
|
156
|
+
*/
|
|
157
|
+
protected getPackageJson(): Record<string, any> {
|
|
158
|
+
if (!this.packageJson) {
|
|
159
|
+
const path = this.getPath(UI_FILE_PACKAGE)
|
|
160
|
+
this.packageJson = PropertiesFile.readFile(path) ?? {}
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
return this.packageJson
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
/**
|
|
167
|
+
* Reads content of a file by its name relative to the item's directory.
|
|
168
|
+
*
|
|
169
|
+
* Читает содержимое файла по его имени относительно директории элемента.
|
|
170
|
+
* @param dirFile File name / Имя файла
|
|
171
|
+
* @returns file content / содержимое файла
|
|
172
|
+
* @protected
|
|
173
|
+
*/
|
|
174
|
+
protected readFile(dirFile: string): string {
|
|
175
|
+
const file = PropertiesFile.readFileOnly(this.getPath(dirFile))
|
|
176
|
+
|
|
177
|
+
if (file) {
|
|
178
|
+
return file.replace(/([ '"`]|^)\.\//g, `$1${this.getPathString()}/`)
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
return ''
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
/**
|
|
185
|
+
* Formats and returns the description section for the prompt.
|
|
186
|
+
*
|
|
187
|
+
* Форматирует и возвращает секцию описания для промпта.
|
|
188
|
+
* @returns formatted description or undefined / отформатированное описание или undefined
|
|
189
|
+
* @protected
|
|
190
|
+
*/
|
|
191
|
+
protected getDescription(): string | undefined {
|
|
192
|
+
if (this.isDescription()) {
|
|
193
|
+
console.log('-- Description')
|
|
194
|
+
|
|
195
|
+
return `
|
|
196
|
+
## Project context: Investigation required
|
|
197
|
+
${this.readFile(UI_FILE_AI_PROMPT_DESCRIPTION)}
|
|
198
|
+
`.trim()
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
return undefined
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
/**
|
|
205
|
+
* Formats and returns the info section for the prompt.
|
|
206
|
+
*
|
|
207
|
+
* Форматирует и возвращает секцию информации для промпта.
|
|
208
|
+
* @returns formatted info or undefined / отформатированная информация или undefined
|
|
209
|
+
* @protected
|
|
210
|
+
*/
|
|
211
|
+
protected getInfo(): string | undefined {
|
|
212
|
+
if (this.isInfo()) {
|
|
213
|
+
console.log('-- Info')
|
|
214
|
+
|
|
215
|
+
return `
|
|
216
|
+
## Project information: Core overview
|
|
217
|
+
This section contains essential information and the core overview of the project. Review this to understand the fundamental architecture and key features.
|
|
218
|
+
${this.readFile(UI_FILE_AI_PROMPT_INFO)}
|
|
219
|
+
`.trim()
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
return undefined
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
/**
|
|
226
|
+
* Formats and returns the types section for the prompt.
|
|
227
|
+
*
|
|
228
|
+
* Форматирует и возвращает секцию типов для промпта.
|
|
229
|
+
* @returns formatted types reference or undefined / отформатированная ссылка на типы или undefined
|
|
230
|
+
* @protected
|
|
231
|
+
*/
|
|
232
|
+
protected getTypes(): string | undefined {
|
|
233
|
+
if (this.isTypes()) {
|
|
234
|
+
console.log('-- Types')
|
|
235
|
+
|
|
236
|
+
return `
|
|
237
|
+
## Project types: Essential for analysis
|
|
238
|
+
This file contains the complete type definitions for the project. It is mandatory to study this file to perform an accurate analysis of the project structure and logic:
|
|
239
|
+
'${this.getPathString()}/${UI_FILE_AI_PROMPT_TYPES}'
|
|
240
|
+
`.trim()
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
return undefined
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
/**
|
|
247
|
+
* Formats and returns the screenshot section for the prompt.
|
|
248
|
+
*
|
|
249
|
+
* Форматирует и возвращает секцию скриншотов для промпта.
|
|
250
|
+
* @returns formatted screenshot list or undefined / отформатированный список скриншотов или undefined
|
|
251
|
+
* @protected
|
|
252
|
+
*/
|
|
253
|
+
protected getScreenshot(): string | undefined {
|
|
254
|
+
const list = this.getScreenshotList()
|
|
255
|
+
|
|
256
|
+
if (list) {
|
|
257
|
+
console.log('-- Screenshot')
|
|
258
|
+
|
|
259
|
+
const screenshot: string = list.map(item => `- '${this.getPathString()}/${UI_DIR_AI_PROMPT_SCREENSHOT}/${item}'`).join('\n')
|
|
260
|
+
|
|
261
|
+
return `## Project screenshots: Visual reference
|
|
262
|
+
The project includes the following screenshots that provide a visual reference for the project's design and functionality:
|
|
263
|
+
${screenshot}
|
|
264
|
+
`.trim()
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
return undefined
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
/**
|
|
271
|
+
* Retrieves the list of files in the screenshot directory.
|
|
272
|
+
*
|
|
273
|
+
* Получает список файлов в директории скриншотов.
|
|
274
|
+
* @returns list of screenshot file names or undefined / список имен файлов скриншотов или undefined
|
|
275
|
+
* @protected
|
|
276
|
+
*/
|
|
277
|
+
protected getScreenshotList(): string[] | undefined {
|
|
278
|
+
if (this.isScreenshot()) {
|
|
279
|
+
return PropertiesFile.readDir(this.getPath(UI_DIR_AI_PROMPT_SCREENSHOT))
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
return undefined
|
|
283
|
+
}
|
|
284
|
+
}
|
package/src/config.ts
CHANGED
|
@@ -21,20 +21,30 @@ export const UI_FLAG_NOT_EXPORT = /\/\/ *export:none/
|
|
|
21
21
|
|
|
22
22
|
/** Folder where all the code is stored/ Папка, где хранится весь код */
|
|
23
23
|
export const UI_DIR_IN = 'src'
|
|
24
|
+
/** AI folder name / Название папки AI */
|
|
24
25
|
export const UI_DIR_AI = 'ai'
|
|
26
|
+
/** Screenshot folder name for AI / Название папки со снимками экрана для AI */
|
|
27
|
+
export const UI_DIR_AI_PROMPT_SCREENSHOT = 'ai-screenshot'
|
|
25
28
|
/** Components directory name/ Название директории компонентов */
|
|
26
29
|
export const UI_DIR_COMPONENTS = 'components'
|
|
27
30
|
/** Constructors directory name/ Название директории конструкторов */
|
|
28
31
|
export const UI_DIR_CONSTRUCTOR = 'constructors'
|
|
29
32
|
/** Structure directory name/ Название директории структуры */
|
|
30
33
|
export const UI_DIR_STRUCTURE = 'structure'
|
|
34
|
+
/** Wiki directory name / Название директории wiki */
|
|
31
35
|
export const UI_DIR_WIKI = 'wiki'
|
|
36
|
+
/** Temporary directory name / Название временной директории */
|
|
32
37
|
export const UI_DIR_TEMPORARY = 'temporary'
|
|
38
|
+
/** Distribution directory name / Название директории сборки */
|
|
33
39
|
export const UI_DIR_DIST = 'dist'
|
|
40
|
+
/** Temporary distribution directory name / Название временной директории сборки */
|
|
34
41
|
export const UI_DIR_DIST_TEMPORARY = 'dist-temporary'
|
|
42
|
+
/** Prompt directory name / Название директории промптов */
|
|
35
43
|
export const UI_DIR_PROMPT = 'prompt'
|
|
44
|
+
/** Packages directory name / Название директории пакетов */
|
|
36
45
|
export const UI_DIR_PACKAGES = 'packages'
|
|
37
46
|
|
|
47
|
+
/** List of directories for AI wiki / Список директорий для AI wiki */
|
|
38
48
|
export const UI_DIRS_AI_WIKI = [UI_DIR_IN, UI_DIR_WIKI, UI_DIR_AI]
|
|
39
49
|
/** Name of the path to tokens/ Название пути к токенам */
|
|
40
50
|
export const UI_DIRS_TOKENS = [UI_DIR_IN, 'media']
|
|
@@ -70,6 +80,17 @@ export const UI_FILE_PACKAGE = 'package.json'
|
|
|
70
80
|
/** Name of the main file with tokens/ Название главного файла с токенами */
|
|
71
81
|
export const UI_FILE_PROPERTY = 'properties.json'
|
|
72
82
|
|
|
83
|
+
/** AI prompt description file name / Название файла с описанием промпта AI */
|
|
84
|
+
export const UI_FILE_AI_PROMPT_DESCRIPTION = 'ai-description.txt'
|
|
85
|
+
/** AI prompt info file name / Название файла с информацией промпта AI */
|
|
86
|
+
export const UI_FILE_AI_PROMPT_INFO = 'ai-doc.txt'
|
|
87
|
+
/** AI prompt instruction file name / Название файла с инструкцией промпта AI */
|
|
88
|
+
export const UI_FILE_AI_PROMPT_INSTRUCTION = 'ai-instruction.txt'
|
|
89
|
+
/** AI prompt result file name / Название файла с результатом промпта AI */
|
|
90
|
+
export const UI_FILE_AI_PROMPT_PROMPT = 'ai-prompt.txt'
|
|
91
|
+
/** AI prompt types file name / Название файла с типами промпта AI */
|
|
92
|
+
export const UI_FILE_AI_PROMPT_TYPES = 'ai-types.txt'
|
|
93
|
+
|
|
73
94
|
/** File name for storing the list of flags/ Название файла для хранения списка флагов */
|
|
74
95
|
export const UI_FILE_NAME_FLAGS = 'flags'
|
|
75
96
|
|
|
@@ -84,15 +105,22 @@ export const UI_FILE_NAME_STYLE = 'style'
|
|
|
84
105
|
/** File name for the list of component descriptions for the wiki/ Название файла для список описаний компонентов для wiki */
|
|
85
106
|
export const UI_FILE_NAME_WIKI = 'wiki'
|
|
86
107
|
|
|
108
|
+
/** Vite configuration file name / Название файла конфигурации Vite */
|
|
87
109
|
export const UI_FILE_NAME_VITE = 'vite.config.ts'
|
|
88
110
|
|
|
111
|
+
/** Vite workers configuration file name / Название файла конфигурации Vite workers */
|
|
89
112
|
export const UI_FILE_NAME_VITE_WORKERS = 'vite-workers.config.ts'
|
|
90
113
|
|
|
114
|
+
/** Index file name / Название файла index */
|
|
91
115
|
export const UI_FILE_INDEX = 'index.ts'
|
|
92
116
|
|
|
117
|
+
/** AI types file name / Название файла с типами AI */
|
|
93
118
|
export const UI_FILE_AI_TYPES = 'ai-types.txt'
|
|
119
|
+
/** AI description file name / Название файла с описанием AI */
|
|
94
120
|
export const UI_FILE_AI_DESCRIPTION = 'ai-description.txt'
|
|
121
|
+
/** Style SCSS file name / Название файла стилей SCSS */
|
|
95
122
|
export const UI_FILE_STYLE_SCSS = 'style.scss'
|
|
123
|
+
/** UI properties SCSS file name / Название файла свойств UI в SCSS */
|
|
96
124
|
export const UI_FILE_STYLE_PROPERTIES = 'ui-properties.scss'
|
|
97
125
|
|
|
98
126
|
/** SCSS file extension/ Расширение файлов SCSS */
|
package/src/library.ts
CHANGED
|
@@ -1,54 +1,54 @@
|
|
|
1
|
-
// Classes
|
|
2
|
-
export * from './classes/Ai/AiAbstract'
|
|
3
|
-
export * from './classes/Ai/AiClaude'
|
|
4
|
-
export * from './classes/Ai/AiClaudeCli'
|
|
5
|
-
export * from './classes/Ai/AiClaudeCliLite'
|
|
6
|
-
export * from './classes/Ai/AiClaudeLite'
|
|
7
|
-
export * from './classes/Ai/AiDoc'
|
|
8
|
-
export * from './classes/Ai/AiDocItem'
|
|
9
|
-
export * from './classes/Ai/AiDocItemAbstract'
|
|
10
|
-
export * from './classes/Ai/AiDocItemClasses'
|
|
11
|
-
export * from './classes/Ai/AiDocItemComposables'
|
|
12
|
-
export * from './classes/Ai/AiDocType'
|
|
13
|
-
export * from './classes/Ai/AiGoogle'
|
|
14
|
-
export * from './classes/Ai/AiGoogleCli'
|
|
15
|
-
export * from './classes/Ai/AiGoogleCliLite'
|
|
16
|
-
export * from './classes/Ai/AiGoogleLite'
|
|
17
|
-
export * from './classes/BrowserItem'
|
|
18
|
-
export * from './classes/Build/buildFunctional'
|
|
19
|
-
export * from './classes/BuildItem'
|
|
20
|
-
export * from './classes/Design/DesignFigma'
|
|
21
|
-
export * from './classes/Design/DesignScreenshot'
|
|
22
|
-
export * from './classes/Design/DesignTypes'
|
|
23
|
-
export * from './classes/Design/DesignTypescript'
|
|
24
|
-
export * from './classes/Design/DesignWikiStorm'
|
|
25
|
-
export * from './classes/Design/DesignWikiStormItem'
|
|
26
|
-
export * from './classes/FigmaApi'
|
|
27
|
-
export * from './classes/Git/GitRead'
|
|
28
|
-
export * from './classes/Library/LibraryAiWiki'
|
|
29
|
-
export * from './classes/Library/LibraryAiWikiItem'
|
|
30
|
-
export * from './classes/Library/LibraryExport'
|
|
31
|
-
export * from './classes/Library/LibraryList'
|
|
32
|
-
export * from './classes/Library/LibraryPlugin'
|
|
33
|
-
export * from './classes/Library/LibraryTypes'
|
|
34
|
-
export * from './classes/Properties/PropertiesFile'
|
|
35
|
-
|
|
36
|
-
// Composables
|
|
37
|
-
export * from './composables/useAi'
|
|
38
|
-
|
|
39
|
-
// Functions
|
|
40
|
-
export * from './functions/getConfigAi'
|
|
41
|
-
export * from './functions/getDirname'
|
|
42
|
-
export * from './functions/getPackageJson'
|
|
43
|
-
export * from './functions/hasNativeDirname'
|
|
44
|
-
|
|
45
|
-
// Types
|
|
46
|
-
export * from './types/aiTypes'
|
|
47
|
-
export * from './types/configTypes'
|
|
48
|
-
export * from './types/designTypes'
|
|
49
|
-
export * from './types/figmaApiTypes'
|
|
50
|
-
export * from './types/gitTypes'
|
|
51
|
-
export * from './types/libraryTypes'
|
|
52
|
-
export * from './types/propertyTypes'
|
|
53
|
-
export * from './types/screenshotTypes'
|
|
54
|
-
export * from './types/webTypes'
|
|
1
|
+
// Classes
|
|
2
|
+
export * from './classes/Ai/AiAbstract'
|
|
3
|
+
export * from './classes/Ai/AiClaude'
|
|
4
|
+
export * from './classes/Ai/AiClaudeCli'
|
|
5
|
+
export * from './classes/Ai/AiClaudeCliLite'
|
|
6
|
+
export * from './classes/Ai/AiClaudeLite'
|
|
7
|
+
export * from './classes/Ai/AiDoc'
|
|
8
|
+
export * from './classes/Ai/AiDocItem'
|
|
9
|
+
export * from './classes/Ai/AiDocItemAbstract'
|
|
10
|
+
export * from './classes/Ai/AiDocItemClasses'
|
|
11
|
+
export * from './classes/Ai/AiDocItemComposables'
|
|
12
|
+
export * from './classes/Ai/AiDocType'
|
|
13
|
+
export * from './classes/Ai/AiGoogle'
|
|
14
|
+
export * from './classes/Ai/AiGoogleCli'
|
|
15
|
+
export * from './classes/Ai/AiGoogleCliLite'
|
|
16
|
+
export * from './classes/Ai/AiGoogleLite'
|
|
17
|
+
export * from './classes/BrowserItem'
|
|
18
|
+
export * from './classes/Build/buildFunctional'
|
|
19
|
+
export * from './classes/BuildItem'
|
|
20
|
+
export * from './classes/Design/DesignFigma'
|
|
21
|
+
export * from './classes/Design/DesignScreenshot'
|
|
22
|
+
export * from './classes/Design/DesignTypes'
|
|
23
|
+
export * from './classes/Design/DesignTypescript'
|
|
24
|
+
export * from './classes/Design/DesignWikiStorm'
|
|
25
|
+
export * from './classes/Design/DesignWikiStormItem'
|
|
26
|
+
export * from './classes/FigmaApi'
|
|
27
|
+
export * from './classes/Git/GitRead'
|
|
28
|
+
export * from './classes/Library/LibraryAiWiki'
|
|
29
|
+
export * from './classes/Library/LibraryAiWikiItem'
|
|
30
|
+
export * from './classes/Library/LibraryExport'
|
|
31
|
+
export * from './classes/Library/LibraryList'
|
|
32
|
+
export * from './classes/Library/LibraryPlugin'
|
|
33
|
+
export * from './classes/Library/LibraryTypes'
|
|
34
|
+
export * from './classes/Properties/PropertiesFile'
|
|
35
|
+
|
|
36
|
+
// Composables
|
|
37
|
+
export * from './composables/useAi'
|
|
38
|
+
|
|
39
|
+
// Functions
|
|
40
|
+
export * from './functions/getConfigAi'
|
|
41
|
+
export * from './functions/getDirname'
|
|
42
|
+
export * from './functions/getPackageJson'
|
|
43
|
+
export * from './functions/hasNativeDirname'
|
|
44
|
+
|
|
45
|
+
// Types
|
|
46
|
+
export * from './types/aiTypes'
|
|
47
|
+
export * from './types/configTypes'
|
|
48
|
+
export * from './types/designTypes'
|
|
49
|
+
export * from './types/figmaApiTypes'
|
|
50
|
+
export * from './types/gitTypes'
|
|
51
|
+
export * from './types/libraryTypes'
|
|
52
|
+
export * from './types/propertyTypes'
|
|
53
|
+
export * from './types/screenshotTypes'
|
|
54
|
+
export * from './types/webTypes'
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
### Global Development Principles (AI Code Promise)
|
|
2
|
+
|
|
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
|
+
|
|
5
|
+
1. **"Copy-Paste Ready" Principle**:
|
|
6
|
+
- Generate code that can be copied and run without a single manual edit.
|
|
7
|
+
- All imports must be absolute or correct relative paths.
|
|
8
|
+
- No `// ... rest of the code`, no `// imports here`. Only the complete, working file.
|
|
9
|
+
|
|
10
|
+
2. **Zero Tolerance for Hallucinations**:
|
|
11
|
+
- Use only the libraries and versions specified in the project's `package.json`.
|
|
12
|
+
- Do not invent API methods that do not exist in the current versions of dependencies.
|
|
13
|
+
- If information is insufficient, it is better to ask or point out the limitation than to hallucinate.
|
|
14
|
+
|
|
15
|
+
3. **Clean Code Standards**:
|
|
16
|
+
- **DRY & KISS**: Avoid duplication, write as simply and clearly as possible.
|
|
17
|
+
- **SOLID**: Every module, class, or function must have one clear responsibility.
|
|
18
|
+
- **Declarative Approach**: Prefer a declarative programming style (array functional methods, composition).
|
|
19
|
+
|
|
20
|
+
4. **Uncompromising TypeScript**:
|
|
21
|
+
- No `any`. Use `unknown` if the type is truly unknown, or create generic types.
|
|
22
|
+
- Always define interfaces for input and output data.
|
|
23
|
+
- Use `as const`, `readonly`, and enums/union types to increase reliability.
|
|
24
|
+
|
|
25
|
+
5. **Professional Documentation (TSDoc)**:
|
|
26
|
+
- Accompany all exported entities with TSDoc comments in the [wikiLanguage] language.
|
|
27
|
+
- Describe the purpose, parameters, return values, and potential exceptions.
|
|
28
|
+
- Usage examples in comments are encouraged for complex functions.
|
|
29
|
+
|
|
30
|
+
6. **Architectural Consistency**:
|
|
31
|
+
- Respect the project structure. If it is standard in the project to move logic into `composables` or `utils`, follow that pattern.
|
|
32
|
+
- Do not modify global styles or styles of base UI components unless explicitly requested.
|
|
33
|
+
|
|
34
|
+
7. **Security and Performance**:
|
|
35
|
+
- Write error-proof code (guard clauses, optional chaining `?.`, nullish coalescing `??`).
|
|
36
|
+
- Avoid redundant calculations in loops and heavy operations in reactive dependencies.
|
|
37
|
+
|
|
38
|
+
8. **Aesthetics and Conciseness**:
|
|
39
|
+
- The code must be beautiful. Use logical indentation and group code by meaning.
|
|
40
|
+
- Save tokens by avoiding redundant comments where the code speaks for itself.
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
### Глобальные принципы разработки (AI Code Promise)
|
|
2
|
+
|
|
3
|
+
Твоя главная цель — генерировать безупречный, промышленный код, который соответствует стандартам dxt-ui. Ты обещаешь следовать этим правилам неукоснительно:
|
|
4
|
+
|
|
5
|
+
1. **Принцип «Copy-Paste Ready» (Готовность к использованию)**:
|
|
6
|
+
- Генерируй код, который можно скопировать и запустить без единой правки.
|
|
7
|
+
- Все импорты должны быть абсолютными или корректными относительными.
|
|
8
|
+
- Никаких `// ... остальной код`, никаких `// импорты здесь`. Только полный, рабочий файл.
|
|
9
|
+
|
|
10
|
+
2. **Нулевая толерантность к галлюцинациям**:
|
|
11
|
+
- Используй только те библиотеки и версии, которые указаны в `package.json` проекта.
|
|
12
|
+
- Не выдумывай методы API, которых не существует в текущих версиях зависимостей.
|
|
13
|
+
- Если информации недостаточно — лучше спроси или укажи на ограничение, чем галлюцинируй.
|
|
14
|
+
|
|
15
|
+
3. **Стандарты чистого кода (Clean Code)**:
|
|
16
|
+
- **DRY & KISS**: Избегай дублирования, пиши максимально просто и понятно.
|
|
17
|
+
- **SOLID**: Каждый модуль, класс или функция должны иметь одну четкую ответственность.
|
|
18
|
+
- **Декларативность**: Отдавай предпочтение декларативному стилю программирования (функциональные методы массивов, композиция).
|
|
19
|
+
|
|
20
|
+
4. **Бескомпромиссный TypeScript**:
|
|
21
|
+
- Никаких `any`. Используй `unknown`, если тип действительно неизвестен, или создавай generic-типы.
|
|
22
|
+
- Всегда определяй интерфейсы для входных и выходных данных.
|
|
23
|
+
- Используй `as const`, `readonly` и перечисления (enums/union types) для повышения надежности.
|
|
24
|
+
|
|
25
|
+
5. **Профессиональное документирование (TSDoc)**:
|
|
26
|
+
- Сопровождай все экспортируемые сущности комментариями TSDoc на [wikiLanguage] языке.
|
|
27
|
+
- Описывай назначение, параметры, возвращаемые значения и возможные исключения.
|
|
28
|
+
- Примеры использования в комментариях приветствуются для сложных функций.
|
|
29
|
+
|
|
30
|
+
6. **Архитектурная консистентность**:
|
|
31
|
+
- Соблюдай структуру проекта. Если в проекте принято выносить логику в `composables` или `utils` — следуй этому паттерну.
|
|
32
|
+
- Не изменяй глобальные стили или стили базовых UI-компонентов, если это не было явно запрошено.
|
|
33
|
+
|
|
34
|
+
7. **Безопасность и Производительность**:
|
|
35
|
+
- Пиши код, защищенный от ошибок (guard clauses, опциональная цепочка `?.`, nullish coalescing `??`).
|
|
36
|
+
- Избегай лишних вычислений в циклах и тяжелых операций в реактивных зависимостях.
|
|
37
|
+
|
|
38
|
+
8. **Эстетика и Лаконичность**:
|
|
39
|
+
- Код должен быть красивым. Используй логические отступы и группировку кода по смыслу.
|
|
40
|
+
- Экономь токены, избегая избыточных комментариев там, где код говорит сам за себя.
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
### Vue Component Implementation Rules (Vue.js Style Guide)
|
|
2
|
+
|
|
3
|
+
- **Script Setup**: Use strictly `<script setup lang="ts">`.
|
|
4
|
+
- **Naming**: Component names must be multi-word, match their project path, and use PascalCase.
|
|
5
|
+
- **CSS**: The root CSS class name of the component must match its name (in kebab-case).
|
|
6
|
+
- **Typing**: Mandatory interfaces for Props (`defineProps<{...}>()`) and Emits (`defineEmits<{...}>()`).
|
|
7
|
+
- **Lists (v-for)**: Always use a unique `:key`. Avoid using the array index as a key.
|
|
8
|
+
- **Directives**: Never use `v-if` on the same element as `v-for`.
|
|
9
|
+
- **Reactivity**: Use `ref` for data. Calculate complex logic via `computed`.
|
|
10
|
+
- **Logic**: ALL logic must be moved to Composables. The component should only contain the composable call and the template.
|
|
11
|
+
- **Templates**: Cleanest possible HTML. No function calls, calculations, or inline styles. If complex logic is needed, split into sub-components.
|
|
12
|
+
- **Props**: One-way data flow. Never mutate incoming props.
|
|
13
|
+
- **Events**: Event names must be strictly in kebab-case.
|
|
14
|
+
- **A11y**: Use semantic HTML and ARIA attributes.
|
|
15
|
+
- **Atomicity**: Components should be minimal and perform only one function. Avoid universal "Swiss army knife" components.
|
|
16
|
+
- **UI Styles**: Modifying the styles of ready-made UI components in the library is strictly forbidden. This is a taboo.
|
|
17
|
+
- **Purity**: Write declaratively, avoid "fluff," and save tokens.
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
### Правила реализации Vue-компонентов (Style Guide Vue.js)
|
|
2
|
+
|
|
3
|
+
- **Script Setup**: Используй строго `<script setup lang="ts">`.
|
|
4
|
+
- **Именование**: Названия компонентов должны состоять из нескольких слов, соответствовать их пути в проекте и быть в PascalCase.
|
|
5
|
+
- **CSS**: Название корневого CSS-класса компонента должно совпадать с его названием (в формате kebab-case).
|
|
6
|
+
- **Типизация**: Обязательные интерфейсы для Props (`defineProps<{...}>()`) и Emits (`defineEmits<{...}>()`).
|
|
7
|
+
- **Списки (v-for)**: Всегда используй уникальный `:key`. Избегай использования индекса массива в качестве ключа.
|
|
8
|
+
- **Директивы**: Никогда не используй `v-if` на том же элементе, что и `v-for`.
|
|
9
|
+
- **Реактивность**: Используй `ref` для данных. Сложную логику вычисляй через `computed`.
|
|
10
|
+
- **Логика**: ВСЯ логика должна быть вынесена в Composables. Компонент должен содержать только вызов composable и шаблон.
|
|
11
|
+
- **Шаблоны**: Максимально чистый HTML. Никаких вызовов функций, вычислений или инлайн-стилей. Если нужна сложная логика — разделяй на подкомпоненты.
|
|
12
|
+
- **Props**: Односторонний поток данных. Никогда не мутируй входящие пропсы.
|
|
13
|
+
- **События**: Названия событий — строго в kebab-case.
|
|
14
|
+
- **A11y**: Используй семантический HTML и ARIA-атрибуты.
|
|
15
|
+
- **Атомарность**: Компоненты должны быть минимальными и выполнять только одну функцию. Избегай универсальных компонентов («швейцарских ножей»).
|
|
16
|
+
- **Стили UI**: Изменение стилей готовых UI-компонентов библиотеки строго запрещено. Это табу.
|
|
17
|
+
- **Чистота**: Пиши декларативно, избегай "воды", экономь токены.
|