@dxtmisha/scripts 0.9.1 → 0.10.3
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 +48 -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/Design/DesignTypes.ts +7 -6
- package/src/classes/Design/DesignWikiStorm.ts +7 -7
- package/src/classes/Design/DesignWikiStormItem.ts +64 -34
- package/src/classes/Library/LibraryAiPrompt.ts +2 -2
- package/src/classes/Library/LibraryAiPromptItem.ts +37 -3
- package/src/composables/useAi.ts +15 -0
- package/src/config.ts +9 -7
- 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/{prompt.txt → prompt.md} +4 -4
- package/src/media/templates/componentDoc/wiki/prompt.md +21 -0
- package/src/media/templates/componentDoc/wiki/run.ts +1 -1
- package/src/media/templates/packages/library/package.json +7 -5
- package/src/media/templates/prompts/aiCodeGlobalPrompt.en.md +77 -0
- package/src/media/templates/prompts/aiCodeGlobalPrompt.ru.md +78 -0
- package/src/types/configTypes.ts +9 -2
- package/src/types/webTypes.ts +33 -4
- 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/wiki/prompt.txt +0 -16
- package/src/media/templates/prompts/aiCodeGlobalPrompt.en.txt +0 -40
- package/src/media/templates/prompts/aiCodeGlobalPrompt.ru.txt +0 -40
- /package/src/media/templates/prompts/{aiCodeVuePrompt.en.txt → aiCodeVuePrompt.en.md} +0 -0
- /package/src/media/templates/prompts/{aiCodeVuePrompt.ru.txt → aiCodeVuePrompt.ru.md} +0 -0
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { PropertiesFile } from '../Properties/PropertiesFile'
|
|
2
|
+
|
|
3
|
+
const TEMPORARY_DIR = './ai-tmp'
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* ApiTmp
|
|
7
|
+
*/
|
|
8
|
+
export class ApiTmp {
|
|
9
|
+
protected idFile = 1
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Generates a unique file path for the temporary prompt.
|
|
13
|
+
*
|
|
14
|
+
* Генерирует уникальный путь к файлу для временного промпта.
|
|
15
|
+
*/
|
|
16
|
+
protected getFileName(): string {
|
|
17
|
+
return `${TEMPORARY_DIR}/Prompt-${this.idFile++}.txt`
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Creates a temporary file with the prompt content and returns the path formatted for the CLI.
|
|
22
|
+
*
|
|
23
|
+
* Создает временный файл с содержимым промпта и возвращает путь, отформатированный для CLI.
|
|
24
|
+
* @param content Prompt content / Содержимое промпта
|
|
25
|
+
* @returns Formatted file path (e.g., @./ai-tmp/Prompt-1.txt) / Отформатированный путь к файлу
|
|
26
|
+
*/
|
|
27
|
+
createFile(content: string): string {
|
|
28
|
+
const name = this.getFileName()
|
|
29
|
+
|
|
30
|
+
PropertiesFile.writeByPath(name, content.trim())
|
|
31
|
+
|
|
32
|
+
return `Please read the following file as it contains the prompt instructions: @${name}`
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Cleans up temporary files and directories.
|
|
37
|
+
*
|
|
38
|
+
* Очищает временные файлы и директории.
|
|
39
|
+
*/
|
|
40
|
+
removeFile(): void {
|
|
41
|
+
PropertiesFile.removeDir(TEMPORARY_DIR)
|
|
42
|
+
}
|
|
43
|
+
}
|
|
@@ -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
|
|
@@ -256,13 +256,14 @@ export class DesignTypes {
|
|
|
256
256
|
protected async toAiDescription(content: string): Promise<string> {
|
|
257
257
|
const generate = await this.toAi(
|
|
258
258
|
content,
|
|
259
|
-
'Analyze the provided code and generate a highly technical, concise project overview for another AI coding assistant. '
|
|
260
|
-
+ '
|
|
261
|
-
+ 'The description must be objective, factual, and free of marketing fluff. '
|
|
259
|
+
'Analyze the provided code and generate a highly technical, structured, and concise project overview specifically designed for another AI coding assistant. '
|
|
260
|
+
+ 'The description must enable the reading AI to immediately evaluate whether this library contains code, components, classes, or utilities useful for its current task, and when it is mandatory to read and analyze "ai-types.md". '
|
|
261
|
+
+ 'The description must be objective, factual, precise, and free of marketing fluff. '
|
|
262
262
|
+ 'Include: '
|
|
263
|
-
+ '1. Core Purpose: What is the primary function of this library?
|
|
264
|
-
+ '2.
|
|
265
|
-
+ '3.
|
|
263
|
+
+ '1. Core Purpose: What is the primary technical function of this library? '
|
|
264
|
+
+ '2. Key Expositions: What are the main classes, hooks, utilities, or components exposed by this project, and what specific tasks do they perform? '
|
|
265
|
+
+ '3. Triggers for Studying ai-types.md: Under what specific conditions, keywords, or coding requirements is this library indispensable, making it mandatory for the AI to study its "ai-types.md" file? '
|
|
266
|
+
+ '4. Integration Context: How does it connect with other technologies in the system stack? '
|
|
266
267
|
+ 'Ensure the structure is clean and enables immediate context retrieval. '
|
|
267
268
|
+ 'Return ONLY the resulting description text. No markdown, no labels like "Description:", no explanations. NOTHING but the pure content.'
|
|
268
269
|
)
|
|
@@ -6,7 +6,7 @@ import { PropertiesFile } from '../Properties/PropertiesFile'
|
|
|
6
6
|
import { LibraryItems } from '../Library/LibraryItems'
|
|
7
7
|
import { DesignWikiStormItem } from './DesignWikiStormItem'
|
|
8
8
|
|
|
9
|
-
import type {
|
|
9
|
+
import type { WebTypesVueComponentItem, WebTypesVueJson } from '../../types/webTypes'
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
12
|
* Engine for generating `web-types.json` to provide rich metadata and IDE support (IntelliSense) for the design system components in JetBrains editors (IntelliJ IDEA, WebStorm).
|
|
@@ -43,15 +43,15 @@ export class DesignWikiStorm {
|
|
|
43
43
|
|
|
44
44
|
if (packageFile) {
|
|
45
45
|
const data: WebTypesVueJson = {
|
|
46
|
-
$schema: 'https://
|
|
46
|
+
$schema: 'https://raw.githubusercontent.com/JetBrains/web-types/master/schema/web-types.json',
|
|
47
47
|
framework: 'vue',
|
|
48
48
|
name: toCamelCaseFirst(PropertiesConfig.getDesignName()),
|
|
49
49
|
version: packageFile.version,
|
|
50
|
+
'js-types-syntax': 'typescript',
|
|
50
51
|
contributions: {
|
|
51
52
|
html: {
|
|
52
|
-
'types-syntax': 'typescript',
|
|
53
53
|
'description-markup': 'markdown',
|
|
54
|
-
'
|
|
54
|
+
'vue-components': await this.getComponents()
|
|
55
55
|
}
|
|
56
56
|
}
|
|
57
57
|
}
|
|
@@ -68,9 +68,9 @@ export class DesignWikiStorm {
|
|
|
68
68
|
*
|
|
69
69
|
* Создает или обновляет список компонентов.
|
|
70
70
|
*/
|
|
71
|
-
protected async getComponents(): Promise<
|
|
71
|
+
protected async getComponents(): Promise<WebTypesVueComponentItem[]> {
|
|
72
72
|
const packageFile = getPackageJson()
|
|
73
|
-
const tags:
|
|
73
|
+
const tags: WebTypesVueComponentItem[] = []
|
|
74
74
|
|
|
75
75
|
if (packageFile) {
|
|
76
76
|
for (const component of this.components.getComponentList()) {
|
|
@@ -85,7 +85,7 @@ export class DesignWikiStorm {
|
|
|
85
85
|
const tag = await item.get()
|
|
86
86
|
|
|
87
87
|
if (tag) {
|
|
88
|
-
tags.push(tag)
|
|
88
|
+
tags.push(tag as any)
|
|
89
89
|
}
|
|
90
90
|
}
|
|
91
91
|
}
|
|
@@ -6,7 +6,7 @@ import { PropertiesConfig } from '../Properties/PropertiesConfig'
|
|
|
6
6
|
import { PropertiesFile } from '../Properties/PropertiesFile'
|
|
7
7
|
|
|
8
8
|
import type { LibraryData } from '../../types/libraryTypes'
|
|
9
|
-
import type {
|
|
9
|
+
import type { WebTypesVueComponentItem, WebTypesPropItem, WebTypesSlots, WebTypesEventItem, WebTypesProperty } from '../../types/webTypes'
|
|
10
10
|
import { forEach } from '@dxtmisha/functional-basic'
|
|
11
11
|
|
|
12
12
|
/**
|
|
@@ -46,73 +46,73 @@ export class DesignWikiStormItem {
|
|
|
46
46
|
*
|
|
47
47
|
* Возвращает определение тега для web-types.
|
|
48
48
|
*/
|
|
49
|
-
async get(): Promise<
|
|
49
|
+
async get(): Promise<WebTypesVueComponentItem | undefined> {
|
|
50
50
|
if (this.wiki) {
|
|
51
51
|
const name = `${toCamelCaseFirst(PropertiesConfig.getDesignName())}${this.wiki.getName()}`
|
|
52
52
|
|
|
53
|
-
const
|
|
53
|
+
const component: WebTypesVueComponentItem = {
|
|
54
54
|
name,
|
|
55
55
|
description: this.wiki.getDescription(),
|
|
56
56
|
source: {
|
|
57
57
|
module: `${this.project}/${name}`,
|
|
58
58
|
symbol: name
|
|
59
59
|
},
|
|
60
|
-
|
|
60
|
+
props: this.getProps()
|
|
61
61
|
}
|
|
62
62
|
|
|
63
63
|
const slots = await this.getSlots()
|
|
64
64
|
|
|
65
65
|
if (slots) {
|
|
66
|
-
|
|
66
|
+
component.slots = slots
|
|
67
67
|
}
|
|
68
68
|
|
|
69
69
|
const events = await this.getEvents()
|
|
70
70
|
|
|
71
|
-
if (events) {
|
|
72
|
-
|
|
71
|
+
if (events && events.length > 0) {
|
|
72
|
+
component.js = {
|
|
73
|
+
events
|
|
74
|
+
}
|
|
73
75
|
}
|
|
74
76
|
|
|
75
|
-
return
|
|
77
|
+
return component
|
|
76
78
|
}
|
|
77
79
|
|
|
78
80
|
return undefined
|
|
79
81
|
}
|
|
80
82
|
|
|
81
83
|
/**
|
|
82
|
-
* Returns the
|
|
84
|
+
* Returns the prop definition.
|
|
83
85
|
*
|
|
84
|
-
* Возвращает определение
|
|
86
|
+
* Возвращает определение свойства.
|
|
85
87
|
* @param item prop item / элемент свойства
|
|
86
88
|
*/
|
|
87
|
-
|
|
89
|
+
getProp(item: WikiStorybookProp): WebTypesPropItem {
|
|
88
90
|
const type = this.prepareType(item.getType())
|
|
91
|
+
const cleaned = type ? this.cleanType(type) : undefined
|
|
89
92
|
return {
|
|
90
93
|
name: item.getName(),
|
|
91
94
|
description: item.getDescription(),
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
kind: 'expression',
|
|
95
|
-
type
|
|
96
|
-
}
|
|
95
|
+
default: item.getDefaultValue() ?? undefined,
|
|
96
|
+
type: cleaned
|
|
97
97
|
}
|
|
98
98
|
}
|
|
99
99
|
|
|
100
100
|
/**
|
|
101
|
-
* Returns a list of
|
|
101
|
+
* Returns a list of props.
|
|
102
102
|
*
|
|
103
|
-
* Возвращает список
|
|
103
|
+
* Возвращает список свойств.
|
|
104
104
|
*/
|
|
105
|
-
|
|
106
|
-
const
|
|
105
|
+
getProps(): WebTypesPropItem[] {
|
|
106
|
+
const props: WebTypesPropItem[] = []
|
|
107
107
|
|
|
108
108
|
if (this.wiki) {
|
|
109
109
|
this.wiki.getWikiObject()
|
|
110
110
|
.forEach(
|
|
111
|
-
|
|
111
|
+
item => props.push(this.getProp(item))
|
|
112
112
|
)
|
|
113
113
|
}
|
|
114
114
|
|
|
115
|
-
return
|
|
115
|
+
return props
|
|
116
116
|
}
|
|
117
117
|
|
|
118
118
|
/**
|
|
@@ -127,11 +127,19 @@ export class DesignWikiStormItem {
|
|
|
127
127
|
const slots: WebTypesSlots = []
|
|
128
128
|
|
|
129
129
|
data.slots.forEach(
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
130
|
+
slot => {
|
|
131
|
+
const vueProperties: WebTypesProperty[] = (slot.properties ?? []).map(p => ({
|
|
132
|
+
name: p.name,
|
|
133
|
+
type: p.type ? this.cleanType(p.type) : undefined,
|
|
134
|
+
description: p.description
|
|
135
|
+
}))
|
|
136
|
+
|
|
137
|
+
slots.push({
|
|
138
|
+
'name': slot.name,
|
|
139
|
+
'description': slot.description,
|
|
140
|
+
'vue-properties': vueProperties
|
|
141
|
+
})
|
|
142
|
+
}
|
|
135
143
|
)
|
|
136
144
|
|
|
137
145
|
return slots
|
|
@@ -145,18 +153,28 @@ export class DesignWikiStormItem {
|
|
|
145
153
|
*
|
|
146
154
|
* Возвращает список событий.
|
|
147
155
|
*/
|
|
148
|
-
async getEvents(): Promise<
|
|
156
|
+
async getEvents(): Promise<WebTypesEventItem[] | undefined> {
|
|
149
157
|
const data = await this.getData()
|
|
150
158
|
|
|
151
159
|
if (data && data.events) {
|
|
152
|
-
const events:
|
|
160
|
+
const events: WebTypesEventItem[] = []
|
|
153
161
|
|
|
154
162
|
data.events.forEach(
|
|
155
|
-
event =>
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
163
|
+
event => {
|
|
164
|
+
let typeString = '() => void'
|
|
165
|
+
if (event.properties && event.properties.length > 0) {
|
|
166
|
+
const args = event.properties
|
|
167
|
+
.map(p => `${p.name}: ${p.type ? this.cleanType(p.type) : 'any'}`)
|
|
168
|
+
.join(', ')
|
|
169
|
+
typeString = `(${args}) => void`
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
events.push({
|
|
173
|
+
name: event.name,
|
|
174
|
+
description: event.description,
|
|
175
|
+
type: typeString
|
|
176
|
+
})
|
|
177
|
+
}
|
|
160
178
|
)
|
|
161
179
|
|
|
162
180
|
return events
|
|
@@ -262,6 +280,18 @@ export class DesignWikiStormItem {
|
|
|
262
280
|
return type
|
|
263
281
|
}
|
|
264
282
|
|
|
283
|
+
/**
|
|
284
|
+
* Cleans a type string by removing redundant parentheses, e.g., (CellClassesSub) | undefined -> CellClassesSub | undefined
|
|
285
|
+
*
|
|
286
|
+
* Очищает строку типа, удаляя лишние скобки, например: (CellClassesSub) | undefined -> CellClassesSub | undefined
|
|
287
|
+
*/
|
|
288
|
+
protected cleanType(type: string): string {
|
|
289
|
+
return type
|
|
290
|
+
.replace(/^\(([^()]+)\)$/, '$1')
|
|
291
|
+
.replace(/^\(([^()]+)\)\s*\|\s*undefined$/, '$1 | undefined')
|
|
292
|
+
.trim()
|
|
293
|
+
}
|
|
294
|
+
|
|
265
295
|
/**
|
|
266
296
|
* Initializes the wiki object.
|
|
267
297
|
*
|
|
@@ -7,8 +7,8 @@ import {
|
|
|
7
7
|
import { PropertiesFile } from '../Properties/PropertiesFile'
|
|
8
8
|
import { LibraryAiPromptItem } from './LibraryAiPromptItem'
|
|
9
9
|
|
|
10
|
-
import vuePromptText from '../../media/templates/prompts/aiCodeVuePrompt.en.
|
|
11
|
-
import globalPromptText from '../../media/templates/prompts/aiCodeGlobalPrompt.en.
|
|
10
|
+
import vuePromptText from '../../media/templates/prompts/aiCodeVuePrompt.en.md?raw'
|
|
11
|
+
import globalPromptText from '../../media/templates/prompts/aiCodeGlobalPrompt.en.md?raw'
|
|
12
12
|
|
|
13
13
|
const LIBRARY_AI_PROMPT_LIST_DIRS = [
|
|
14
14
|
UI_MODULES
|
|
@@ -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
|
+
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:
|
|
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
|
*
|
|
@@ -235,7 +269,7 @@ ${this.readFile(UI_FILE_AI_PROMPT_INFO)}
|
|
|
235
269
|
|
|
236
270
|
return `
|
|
237
271
|
## Project types: Essential for analysis
|
|
238
|
-
This file contains the complete type definitions for the project.
|
|
272
|
+
This file contains the complete type definitions 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 and study this type definition file as your absolute first action to understand its API and structure:
|
|
239
273
|
'${this.getPathString()}/${UI_FILE_AI_PROMPT_TYPES}'
|
|
240
274
|
`.trim()
|
|
241
275
|
}
|
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
|
@@ -81,15 +81,17 @@ export const UI_FILE_PACKAGE = 'package.json'
|
|
|
81
81
|
export const UI_FILE_PROPERTY = 'properties.json'
|
|
82
82
|
|
|
83
83
|
/** AI prompt description file name / Название файла с описанием промпта AI */
|
|
84
|
-
export const UI_FILE_AI_PROMPT_DESCRIPTION = 'ai-description.
|
|
84
|
+
export const UI_FILE_AI_PROMPT_DESCRIPTION = 'ai-description.md'
|
|
85
85
|
/** AI prompt info file name / Название файла с информацией промпта AI */
|
|
86
|
-
export const UI_FILE_AI_PROMPT_INFO = 'ai-doc.
|
|
86
|
+
export const UI_FILE_AI_PROMPT_INFO = 'ai-doc.md'
|
|
87
87
|
/** AI prompt instruction file name / Название файла с инструкцией промпта AI */
|
|
88
|
-
export const UI_FILE_AI_PROMPT_INSTRUCTION = 'ai-instruction.
|
|
88
|
+
export const UI_FILE_AI_PROMPT_INSTRUCTION = 'ai-instruction.md'
|
|
89
89
|
/** AI prompt result file name / Название файла с результатом промпта AI */
|
|
90
|
-
export const UI_FILE_AI_PROMPT_PROMPT = 'ai-prompt.
|
|
90
|
+
export const UI_FILE_AI_PROMPT_PROMPT = 'ai-prompt.md'
|
|
91
91
|
/** AI prompt types file name / Название файла с типами промпта AI */
|
|
92
|
-
export const UI_FILE_AI_PROMPT_TYPES = 'ai-types.
|
|
92
|
+
export const UI_FILE_AI_PROMPT_TYPES = 'ai-types.md'
|
|
93
|
+
/** AI prompt developer file name / Название файла для разработчика AI */
|
|
94
|
+
export const UI_FILE_AI_PROMPT_DEVELOPER = 'ai-developer.md'
|
|
93
95
|
|
|
94
96
|
/** File name for storing the list of flags/ Название файла для хранения списка флагов */
|
|
95
97
|
export const UI_FILE_NAME_FLAGS = 'flags'
|
|
@@ -115,9 +117,9 @@ export const UI_FILE_NAME_VITE_WORKERS = 'vite-workers.config.ts'
|
|
|
115
117
|
export const UI_FILE_INDEX = 'index.ts'
|
|
116
118
|
|
|
117
119
|
/** AI types file name / Название файла с типами AI */
|
|
118
|
-
export const UI_FILE_AI_TYPES = 'ai-types.
|
|
120
|
+
export const UI_FILE_AI_TYPES = 'ai-types.md'
|
|
119
121
|
/** AI description file name / Название файла с описанием AI */
|
|
120
|
-
export const UI_FILE_AI_DESCRIPTION = 'ai-description.
|
|
122
|
+
export const UI_FILE_AI_DESCRIPTION = 'ai-description.md'
|
|
121
123
|
/** Style SCSS file name / Название файла стилей SCSS */
|
|
122
124
|
export const UI_FILE_STYLE_SCSS = 'style.scss'
|
|
123
125
|
/** UI properties SCSS file name / Название файла свойств UI в SCSS */
|
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'
|