@dxtmisha/scripts 0.11.2 → 0.11.4
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 +22 -0
- package/bin/design-types-save.ts +1 -0
- package/package.json +1 -1
- package/src/classes/Design/DesignTypes.ts +3 -1
- package/src/classes/Design/DesignTypesPrompts.ts +72 -29
- package/src/config.ts +2 -0
- package/src/media/templates/packages/library/_.gitignore.txt +2 -0
- package/src/media/templates/packages/library/package.json +1 -0
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,28 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
|
|
5
|
+
## [0.11.4] - 2026-08-19
|
|
6
|
+
|
|
7
|
+
### Changed
|
|
8
|
+
- **AI Types Save Workflow (`dxt-types-save`)**:
|
|
9
|
+
- Added MCP resources generation (`await this.mcp.make()`) into `DesignTypes.makeSave()` to automatically generate and synchronize MCP resource manifests (`ai-mcp.json`) when running fast type saving.
|
|
10
|
+
|
|
11
|
+
## [0.11.3] - 2026-08-19
|
|
12
|
+
|
|
13
|
+
### Added
|
|
14
|
+
- **Constants**: Added `UI_DIR_RESOURCES` (`'resources'`) directory constant in `src/config.ts`.
|
|
15
|
+
- **Scaffolding Template**: Added `"screenshot": "dxt-screenshot"` script entry to the library package template (`src/media/templates/packages/library/package.json`).
|
|
16
|
+
|
|
17
|
+
### Changed
|
|
18
|
+
- **AI Prompt Metadata Separation & Granular Cache**:
|
|
19
|
+
- Split prompt metadata caching from monolithic `prompts.json` files into individual JSON files saved in `ai-types-list/resources/`.
|
|
20
|
+
- Updated `DesignTypesPrompts` to read, aggregate, and persist prompt cache items as separate `.json` files in the resources directory.
|
|
21
|
+
- Added `getCacheDir()`, `getCachePath()`, and `saveCacheItem()` methods in `DesignTypesPrompts` to manage individual prompt metadata files.
|
|
22
|
+
- Refactored `make()` and `toAiPromptItem()` to write prompt cache files immediately on change.
|
|
23
|
+
- **AI Types Save Workflow (`dxt-types-save`)**:
|
|
24
|
+
- Made `DesignTypes.makeSave()` asynchronous (`Promise<this>`) and added automatic package description generation via `await this.description.make()`.
|
|
25
|
+
- Updated `bin/design-types-save.ts` to await `makeSave()`.
|
|
26
|
+
|
|
5
27
|
## [0.11.2] - 2026-08-14
|
|
6
28
|
|
|
7
29
|
### Changed
|
package/bin/design-types-save.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dxtmisha/scripts",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "0.11.
|
|
4
|
+
"version": "0.11.4",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"description": "CLI tools, AI integration scripts, and automation utilities for DXT UI — automated component scaffolding, Figma layout generation, library packaging, documentation building, screenshot captures, and AI prompt processing.",
|
|
7
7
|
"keywords": [
|
|
@@ -76,10 +76,12 @@ export class DesignTypes {
|
|
|
76
76
|
* Генерирует определения типов путем объединения обработанных файлов из директории ai-types-list без запуска ИИ.
|
|
77
77
|
* @returns current instance / текущий экземпляр
|
|
78
78
|
*/
|
|
79
|
-
makeSave(): this {
|
|
79
|
+
async makeSave(): Promise<this> {
|
|
80
80
|
console.log('DesignTypes: saving AI types from list...')
|
|
81
81
|
|
|
82
82
|
this.makeTypes.makeSave()
|
|
83
|
+
await this.description.make()
|
|
84
|
+
await this.mcp.make()
|
|
83
85
|
|
|
84
86
|
console.log('DesignTypes: AI types saved.')
|
|
85
87
|
|
|
@@ -12,12 +12,12 @@ import type {
|
|
|
12
12
|
DesignTypesPromptResult
|
|
13
13
|
} from '../../types/designTypes'
|
|
14
14
|
|
|
15
|
-
import { UI_MODULES } from '../../config'
|
|
15
|
+
import { UI_DIR_AI_TYPES_LIST, UI_DIR_RESOURCES, UI_MODULES } from '../../config'
|
|
16
16
|
|
|
17
17
|
/**
|
|
18
|
-
* Class for reading prompt files and generating AI project rules and prompt triggers description.
|
|
18
|
+
* Class for reading prompt files, managing individual prompt metadata files, and generating AI project rules and prompt triggers description.
|
|
19
19
|
*
|
|
20
|
-
* Класс для чтения файлов промптов и генерации описания правил проекта ИИ и триггеров промптов.
|
|
20
|
+
* Класс для чтения файлов промптов, управления отдельными файлами метаданных промптов и генерации описания правил проекта ИИ и триггеров промптов.
|
|
21
21
|
*/
|
|
22
22
|
export class DesignTypesPrompts {
|
|
23
23
|
/** Cached list of prompt files / Кэшированный список файлов с промптами */
|
|
@@ -39,17 +39,33 @@ export class DesignTypesPrompts {
|
|
|
39
39
|
) { }
|
|
40
40
|
|
|
41
41
|
/**
|
|
42
|
-
* Reads and returns the prompt cache list from
|
|
42
|
+
* Reads and returns the prompt cache list from individual JSON files in the resources directory.
|
|
43
43
|
*
|
|
44
|
-
* Читает и возвращает список кэша промптов из JSON
|
|
44
|
+
* Читает и возвращает список кэша промптов из отдельных JSON файлов в директории ресурсов.
|
|
45
45
|
* @returns prompt cache list / список кэша промптов
|
|
46
46
|
*/
|
|
47
47
|
getCacheList(): DesignTypesPromptCacheList {
|
|
48
48
|
if (this.cacheList === undefined) {
|
|
49
|
-
const
|
|
50
|
-
const
|
|
49
|
+
const cacheDir = this.getCacheDir()
|
|
50
|
+
const files = PropertiesFile.readDirRecursive(cacheDir)
|
|
51
|
+
const list: DesignTypesPromptCacheList = []
|
|
52
|
+
|
|
53
|
+
for (const file of files) {
|
|
54
|
+
if (file.endsWith('.json')) {
|
|
55
|
+
const item = PropertiesFile.readFile<DesignTypesPromptCacheItem>([cacheDir, file])
|
|
56
|
+
|
|
57
|
+
if (
|
|
58
|
+
item
|
|
59
|
+
&& isFilled(item.path)
|
|
60
|
+
&& isFilled(item.name)
|
|
61
|
+
&& isFilled(item.description)
|
|
62
|
+
) {
|
|
63
|
+
list.push(item)
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
51
67
|
|
|
52
|
-
this.cacheList =
|
|
68
|
+
this.cacheList = list
|
|
53
69
|
}
|
|
54
70
|
|
|
55
71
|
return this.cacheList
|
|
@@ -114,25 +130,16 @@ export class DesignTypesPrompts {
|
|
|
114
130
|
}
|
|
115
131
|
|
|
116
132
|
/**
|
|
117
|
-
* Processes prompt files using AI and updates
|
|
133
|
+
* Processes prompt files using AI and updates individual JSON cache files if changes are detected.
|
|
118
134
|
*
|
|
119
|
-
* Обрабатывает файлы промптов с помощью ИИ и обновляет JSON
|
|
135
|
+
* Обрабатывает файлы промптов с помощью ИИ и обновляет отдельные JSON файлы кэша при обнаружении изменений.
|
|
120
136
|
* @returns current instance / текущий экземпляр
|
|
121
137
|
*/
|
|
122
138
|
async make(): Promise<this> {
|
|
123
139
|
const list = this.getListPrompts()
|
|
124
|
-
let isCacheChanged = false
|
|
125
140
|
|
|
126
141
|
for (const item of list) {
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
if (result.isChanged) {
|
|
130
|
-
isCacheChanged = true
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
if (isCacheChanged) {
|
|
135
|
-
this.saveCacheList(this.getCacheList())
|
|
142
|
+
await this.toAiPromptItem(item)
|
|
136
143
|
}
|
|
137
144
|
|
|
138
145
|
return this
|
|
@@ -157,13 +164,31 @@ export class DesignTypesPrompts {
|
|
|
157
164
|
}
|
|
158
165
|
|
|
159
166
|
/**
|
|
160
|
-
* Gets the cache
|
|
167
|
+
* Gets the cache directory path for individual prompt JSON files.
|
|
161
168
|
*
|
|
162
|
-
* Получает путь к
|
|
169
|
+
* Получает путь к директории кэша для отдельных JSON файлов промптов.
|
|
170
|
+
* @returns cache directory path / путь к директории кэша
|
|
171
|
+
*/
|
|
172
|
+
protected getCacheDir(): string {
|
|
173
|
+
return PropertiesFile.joinPath([UI_DIR_AI_TYPES_LIST, UI_DIR_RESOURCES])
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
/**
|
|
177
|
+
* Gets the cache JSON file path for a specific prompt file path.
|
|
178
|
+
*
|
|
179
|
+
* Получает путь к JSON файлу кэша для конкретного пути к файлу промпта.
|
|
180
|
+
* @param path relative file path of the prompt / относительный путь к файлу промпта
|
|
163
181
|
* @returns cache JSON file path / путь к JSON файлу кэша
|
|
164
182
|
*/
|
|
165
|
-
protected getCachePath(): string {
|
|
166
|
-
|
|
183
|
+
protected getCachePath(path: string): string {
|
|
184
|
+
const relativePath = path
|
|
185
|
+
.replace(new RegExp(`^${this.promptsDir}/`), '')
|
|
186
|
+
.replace(/\.[^/.]+$/, '.json')
|
|
187
|
+
|
|
188
|
+
return PropertiesFile.joinPath([
|
|
189
|
+
this.getCacheDir(),
|
|
190
|
+
relativePath
|
|
191
|
+
])
|
|
167
192
|
}
|
|
168
193
|
|
|
169
194
|
/**
|
|
@@ -193,14 +218,30 @@ export class DesignTypesPrompts {
|
|
|
193
218
|
}
|
|
194
219
|
|
|
195
220
|
/**
|
|
196
|
-
* Saves
|
|
221
|
+
* Saves an individual prompt cache item to its JSON cache file.
|
|
222
|
+
*
|
|
223
|
+
* Сохраняет отдельный элемент кэша промпта в его JSON файл кэша.
|
|
224
|
+
* @param item prompt cache item to save / элемент кэша промпта для сохранения
|
|
225
|
+
*/
|
|
226
|
+
protected saveCacheItem(item: DesignTypesPromptCacheItem): void {
|
|
227
|
+
PropertiesFile.writeByPath(
|
|
228
|
+
this.getCachePath(item.path),
|
|
229
|
+
item
|
|
230
|
+
)
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
/**
|
|
234
|
+
* Saves the prompt cache list to individual JSON cache files.
|
|
197
235
|
*
|
|
198
|
-
* Сохраняет список кэша промптов в JSON
|
|
236
|
+
* Сохраняет список кэша промптов в отдельные JSON файлы кэша.
|
|
199
237
|
* @param cache cache list to save / список кэша для сохранения
|
|
200
238
|
*/
|
|
201
239
|
protected saveCacheList(cache: DesignTypesPromptCacheList): void {
|
|
202
240
|
this.cacheList = cache
|
|
203
|
-
|
|
241
|
+
|
|
242
|
+
for (const item of cache) {
|
|
243
|
+
this.saveCacheItem(item)
|
|
244
|
+
}
|
|
204
245
|
}
|
|
205
246
|
|
|
206
247
|
/**
|
|
@@ -230,9 +271,9 @@ export class DesignTypesPrompts {
|
|
|
230
271
|
}
|
|
231
272
|
|
|
232
273
|
/**
|
|
233
|
-
* Processes a single prompt file item using cache or AI into a formatted rule entry string and updates cache
|
|
274
|
+
* Processes a single prompt file item using cache or AI into a formatted rule entry string and updates individual cache file if changed.
|
|
234
275
|
*
|
|
235
|
-
* Обрабатывает один элемент файла промпта с использованием кэша или ИИ в отформатированную строку правила и обновляет
|
|
276
|
+
* Обрабатывает один элемент файла промпта с использованием кэша или ИИ в отформатированную строку правила и обновляет отдельный файл кэша при изменениях.
|
|
236
277
|
* @param item prompt file item / элемент файла промпта
|
|
237
278
|
* @returns object with formatted rule string and changed flag / объект с отформатированной строкой правила и флагом изменений
|
|
238
279
|
*/
|
|
@@ -278,6 +319,8 @@ export class DesignTypesPrompts {
|
|
|
278
319
|
cache.push(newItem)
|
|
279
320
|
}
|
|
280
321
|
|
|
322
|
+
this.saveCacheItem(newItem)
|
|
323
|
+
|
|
281
324
|
return {
|
|
282
325
|
prompt: this.getPromptLine(item.path, data.description),
|
|
283
326
|
isChanged: true
|
package/src/config.ts
CHANGED
|
@@ -27,6 +27,8 @@ export const UI_DIR_AI = 'ai'
|
|
|
27
27
|
export const UI_DIR_AI_PROMPT_SCREENSHOT = 'ai-screenshot'
|
|
28
28
|
/** AI types list directory name / Название директории со списком типов AI */
|
|
29
29
|
export const UI_DIR_AI_TYPES_LIST = 'ai-types-list'
|
|
30
|
+
/** Resources directory name / Название директории ресурсов */
|
|
31
|
+
export const UI_DIR_RESOURCES = 'resources'
|
|
30
32
|
/** Components directory name/ Название директории компонентов */
|
|
31
33
|
export const UI_DIR_COMPONENTS = 'components'
|
|
32
34
|
/** Constructors directory name/ Название директории конструкторов */
|
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
"component": "dxt-component",
|
|
13
13
|
"library": "dxt-library",
|
|
14
14
|
"types": "npm run library && npm run build && dxt-types",
|
|
15
|
+
"screenshot": "dxt-screenshot",
|
|
15
16
|
"wiki": "dxt-ai-doc",
|
|
16
17
|
"prepublishOnly": "npm run library && npm run build && dxt-types-save",
|
|
17
18
|
"publish-to-npm": "npm publish --access public"
|