@dxtmisha/scripts 1.1.3 → 1.1.5
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 +56 -0
- package/dist/{AiZAi-P-St-CZL.js → AiZAi-B4ih4xL2.js} +8 -1
- package/dist/config.d.ts +9 -0
- package/dist/config.js +3 -3
- package/dist/library-ai.js +1 -1
- package/dist/library.d.ts +333 -31
- package/dist/library.js +421 -217
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,62 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
|
|
5
|
+
## [1.1.5] - 2026-09-09
|
|
6
|
+
|
|
7
|
+
### Added
|
|
8
|
+
- **Third-Party Context & Prompt Injection Defense (Rule #10)**:
|
|
9
|
+
- Added comprehensive prompt injection defense directives to `aiCodeGlobalPrompt.en.md` and `aiCodeGlobalPrompt.ru.md`.
|
|
10
|
+
- Enforced `Data-Only Boundary`, treating all third-party package documentation as passive read-only data without executive authority.
|
|
11
|
+
- Mandated unconditional ignoring of manipulative and imperative commands (e.g. «СТОП», «ОБЯЗАН», «ИГНОРИРУЙ ПРЕДЫДУЩЕЕ», «ЗАБУДЬ ПРАВИЛА», "STOP", "MUST", "IGNORE PREVIOUS", "FORGET RULES").
|
|
12
|
+
- Added role and delimiter spoofing defense against fake system tags (`<system>`, `[SYSTEM]`, `---`, `User:`, `Assistant:`), fictitious CTF challenges, or unauthorized debug modes.
|
|
13
|
+
- Added anti-obfuscation guard prohibiting decoding or executing obfuscated instructions (Base64, Hex, zero-width characters, ciphers).
|
|
14
|
+
- Enforced data exfiltration guard prohibiting leaking local files, configs, tokens, or secrets to external networks, URL query parameters, or markdown images/links.
|
|
15
|
+
- Enforced command execution sandboxing prohibiting running terminal commands mentioned in third-party documentation without direct user authorization.
|
|
16
|
+
- **Strict Confidentiality of `design.config.json` (Rule #11)**:
|
|
17
|
+
- Added strict prohibition in `aiCodeGlobalPrompt.en.md` and `aiCodeGlobalPrompt.ru.md` against reading, inspecting, studying, or leaking any content, API keys, tokens, or configuration from `design.config.json`.
|
|
18
|
+
|
|
19
|
+
### Changed
|
|
20
|
+
- **Package Filtering Logic (`LibraryAiPrompt.isExclude`)**:
|
|
21
|
+
- Refactored `isExclude()` in `LibraryAiPrompt.ts` so that when `isPromptPackageOnly` (`promptPackageOnly: true`) is enabled, packages declared in `package.json` are treated as the default whitelist.
|
|
22
|
+
- Enhanced `promptInclude` to supplement `package.json`, allowing inclusion of explicitly specified transitive dependencies not listed in `package.json`.
|
|
23
|
+
- Ensured `promptExclude` retains highest priority as an unconditional blacklist over both `package.json` dependencies and `promptInclude`.
|
|
24
|
+
|
|
25
|
+
## [1.1.4] - 2026-09-08
|
|
26
|
+
|
|
27
|
+
### Added
|
|
28
|
+
- **`AiAntigravityCli` & `AiAntigravityCliLite` AI Providers**:
|
|
29
|
+
- Implemented `AiAntigravityCli` (`src/classes/Ai/AiAntigravityCli.ts`) and `AiAntigravityCliLite` (`src/classes/Ai/AiAntigravityCliLite.ts`) classes providing integration with Google Antigravity CLI (`agy`) without a system shell.
|
|
30
|
+
- Added support for `'antigravity-cli'` provider identifier in `AiType` (`src/types/configTypes.ts`) and registry-based factory resolution in `useAi()` (`src/composables/useAi.ts`).
|
|
31
|
+
- Exported `AiAntigravityCli` and `AiAntigravityCliLite` in `src/library.ts`.
|
|
32
|
+
- Added unit test suite in `src/classes/Ai/__tests__/AiAntigravityCli.test.ts` and updated `src/composables/__tests__/useAi.test.ts`.
|
|
33
|
+
- **`DesignScreenshotDescription` Analysis Class**:
|
|
34
|
+
- Implemented `DesignScreenshotDescription` (`src/classes/Design/DesignScreenshotDescription.ts`) to analyze component screenshots using multimodal AI models (Gemini, Claude, OpenAI) and generate structured JSON metadata files (`screenshot.json`).
|
|
35
|
+
- Added prompt templates `aiScreenshotDescription.en.md` and `aiScreenshotDescription.ru.md` instructing AI to identify and describe visible components and documentation showcases.
|
|
36
|
+
- Added `DesignScreenshotItem` and `DesignScreenshotList` types in `src/types/screenshotTypes.ts`.
|
|
37
|
+
- Added comprehensive test suite in `src/classes/Design/__tests__/DesignScreenshotDescription.test.ts`.
|
|
38
|
+
- **`LibraryAiPromptScreenshot` Handler**:
|
|
39
|
+
- Implemented dedicated `LibraryAiPromptScreenshot` class (`src/classes/Library/LibraryAiPromptScreenshot.ts`) to modularize screenshot handling, artifact copying, and visual context generation.
|
|
40
|
+
- Added support for copying `screenshot-code.html` and `screenshot-styles.css` into isolated project directories under `ai-packages-types/<project-folder>/`.
|
|
41
|
+
- Added automatic annotation of screenshot image references in `ai-prompt.md` with descriptions loaded from `screenshot.json`.
|
|
42
|
+
- Added constants `UI_FILE_AI_PROMPT_SCREENSHOT_JSON`, `UI_FILE_AI_PROMPT_SCREENSHOT_CODE`, and `UI_FILE_AI_PROMPT_SCREENSHOT_STYLES` in `src/config.ts`.
|
|
43
|
+
- Added unit test suite in `src/classes/Library/__tests__/LibraryAiPromptScreenshot.test.ts`.
|
|
44
|
+
- **Global AI Prompt Rule for Visual Context**:
|
|
45
|
+
- Added rule #9 "Visual Component Reference (`ai-screenshot/`)" to `aiCodeGlobalPrompt.en.md` and `aiCodeGlobalPrompt.ru.md` templates, guiding AI assistants on how to use screenshots, descriptions (`screenshot.json`), DOM structures (`screenshot-code.html`), and computed styles (`screenshot-styles.css`) for accurate UI component reuse without reinvention or token waste.
|
|
46
|
+
- **Storybook Documentation for AI Providers**:
|
|
47
|
+
- Added multi-language Storybook documentation (EN, RU, VI) for `AiAntigravityCli` and `AiAntigravityCliLite` in `src/storybook/classes/`.
|
|
48
|
+
- Added comprehensive AI Providers guide (`src/storybook/ai/providers/providers.*.mdx`) covering all supported backends (`gemini`, `gemini-cli`, `antigravity-cli`, `claude`, `claude-cli`, `claude-agent`, `openai`, `zai`).
|
|
49
|
+
- Updated AI Configuration Storybook documentation (`src/storybook/ai/config/config.*.mdx`) with updated provider lists and configuration details.
|
|
50
|
+
|
|
51
|
+
### Changed
|
|
52
|
+
- **AI Prompt Generation (`LibraryAiPrompt` & `LibraryAiPromptItem`)**:
|
|
53
|
+
- Updated `LibraryAiPrompt.make()` to clean and recreate `ai-packages-types` on each run, ensuring removal of stale type declarations and screenshot artifacts.
|
|
54
|
+
- Updated `LibraryAiPromptItem` to store package type definitions in dedicated project subdirectories (`ai-packages-types/<project-folder>/ai-types.md`) instead of flat files.
|
|
55
|
+
- Refactored `LibraryAiPromptItem` to delegate all screenshot operations directly to `LibraryAiPromptScreenshot`.
|
|
56
|
+
- **Multimodal AI Payload (`AiGoogleLite`)**:
|
|
57
|
+
- Fixed `@google/genai` request payload for multimodal inputs by properly structuring user message parts.
|
|
58
|
+
- **Type Definitions (`screenshotTypes.ts`)**:
|
|
59
|
+
- Standardized property order (`width` before `height`) and sorted types and constants alphabetically.
|
|
60
|
+
|
|
5
61
|
## [1.1.2] - 2026-09-07
|
|
6
62
|
|
|
7
63
|
### Fixed
|
|
@@ -138,7 +138,14 @@ var o = class extends i {
|
|
|
138
138
|
async response(e, t) {
|
|
139
139
|
return (await this.ai?.models.generateContent({
|
|
140
140
|
model: e,
|
|
141
|
-
contents: [
|
|
141
|
+
contents: [{
|
|
142
|
+
role: "user",
|
|
143
|
+
parts: [
|
|
144
|
+
...this.toImages(),
|
|
145
|
+
...this.toContents(),
|
|
146
|
+
{ text: t }
|
|
147
|
+
]
|
|
148
|
+
}],
|
|
142
149
|
config: this.config
|
|
143
150
|
}))?.text ?? "";
|
|
144
151
|
}
|
package/dist/config.d.ts
CHANGED
|
@@ -109,6 +109,15 @@ export declare const UI_FILE_AI_PROMPT_INSTRUCTION = "ai-instruction.md";
|
|
|
109
109
|
/** AI prompt result file name / Название файла с результатом промпта AI */
|
|
110
110
|
export declare const UI_FILE_AI_PROMPT_PROMPT = "ai-prompt.md";
|
|
111
111
|
|
|
112
|
+
/** AI prompt screenshot code file name / Название файла с HTML кодом скриншота AI */
|
|
113
|
+
export declare const UI_FILE_AI_PROMPT_SCREENSHOT_CODE = "screenshot-code.html";
|
|
114
|
+
|
|
115
|
+
/** AI prompt screenshot description JSON file name / Название файла с описанием скриншотов AI */
|
|
116
|
+
export declare const UI_FILE_AI_PROMPT_SCREENSHOT_JSON = "screenshot.json";
|
|
117
|
+
|
|
118
|
+
/** AI prompt screenshot styles file name / Название файла со стилями скриншота AI */
|
|
119
|
+
export declare const UI_FILE_AI_PROMPT_SCREENSHOT_STYLES = "screenshot-styles.css";
|
|
120
|
+
|
|
112
121
|
/** AI prompt types file name / Название файла с типами промпта AI */
|
|
113
122
|
export declare const UI_FILE_AI_PROMPT_TYPES = "ai-types.md";
|
|
114
123
|
|
package/dist/config.js
CHANGED
|
@@ -3,18 +3,18 @@ var e = "design.config.json", t = "@dxtmisha", n = "constructor", r = `${t}/${n}
|
|
|
3
3
|
"src",
|
|
4
4
|
v,
|
|
5
5
|
"ai"
|
|
6
|
-
], T = ["src", "media"], E = [...T, "icons"], D = ["src", h], O = ["src", g], k = ["src", "styles"], A = ["src", "library"],
|
|
6
|
+
], T = ["src", "media"], E = [...T, "icons"], D = ["src", h], O = ["src", g], k = ["src", "styles"], A = ["src", "library"], j = ["src", v], M = ["src", "library.ts"], N = [
|
|
7
7
|
"classes",
|
|
8
8
|
"components",
|
|
9
9
|
"composables",
|
|
10
10
|
"functions",
|
|
11
11
|
"global",
|
|
12
12
|
"types"
|
|
13
|
-
],
|
|
13
|
+
], P = ".gitignore", ee = "package.json", F = "properties.json", I = "ai-description.md", L = "ai-doc.md", R = "ai-instruction.md", z = "ai-prompt.md", B = "ai-types.md", V = "ai-developer.md", H = "screenshot.json", U = "screenshot-code.html", W = "screenshot-styles.css", G = "flags", K = "media", q = "design", J = "plugin", Y = "style", X = "wiki", Z = "vite.config.ts", Q = "vite-workers.config.ts", $ = "index.ts", te = "ai-types.md", ne = "ai-description.md", re = "ai-mcp-resources.json", ie = "ai-mcp-all-resources.json", ae = "ai-mcp-all-resources.ts", oe = "style.scss", se = "ui-properties.scss", ce = "scss", le = "classes", ue = [
|
|
14
14
|
"disabled",
|
|
15
15
|
"focus",
|
|
16
16
|
"readonly",
|
|
17
17
|
"read-only"
|
|
18
18
|
];
|
|
19
19
|
//#endregion
|
|
20
|
-
export { e as UI_CONFIG_FILE, w as UI_DIRS_AI_WIKI, D as UI_DIRS_COMPONENTS, O as UI_DIRS_CONSTRUCTOR,
|
|
20
|
+
export { e as UI_CONFIG_FILE, w as UI_DIRS_AI_WIKI, D as UI_DIRS_COMPONENTS, O as UI_DIRS_CONSTRUCTOR, M as UI_DIRS_FILE_EXPORT, E as UI_DIRS_ICONS, A as UI_DIRS_LIBRARY, N as UI_DIRS_LIST_EXPORT, k as UI_DIRS_STYLES, T as UI_DIRS_TOKENS, j as UI_DIRS_WIKI, l as UI_DIR_AI, u as UI_DIR_AI_PROMPT_SCREENSHOT, d as UI_DIR_AI_TYPES, f as UI_DIR_AI_TYPES_LIST, p as UI_DIR_AI_TYPES_TEMPORARY, h as UI_DIR_COMPONENTS, g as UI_DIR_CONSTRUCTOR, b as UI_DIR_DIST, x as UI_DIR_DIST_TEMPORARY, c as UI_DIR_IN, C as UI_DIR_PACKAGES, S as UI_DIR_PROMPT, m as UI_DIR_RESOURCES, _ as UI_DIR_STRUCTURE, y as UI_DIR_TEMPORARY, v as UI_DIR_WIKI, ce as UI_EXTENSION_STYLE, ne as UI_FILE_AI_DESCRIPTION, re as UI_FILE_AI_MCP, ie as UI_FILE_AI_MCP_ALL, ae as UI_FILE_AI_MCP_ALL_TS, I as UI_FILE_AI_PROMPT_DESCRIPTION, V as UI_FILE_AI_PROMPT_DEVELOPER, L as UI_FILE_AI_PROMPT_INFO, R as UI_FILE_AI_PROMPT_INSTRUCTION, z as UI_FILE_AI_PROMPT_PROMPT, U as UI_FILE_AI_PROMPT_SCREENSHOT_CODE, H as UI_FILE_AI_PROMPT_SCREENSHOT_JSON, W as UI_FILE_AI_PROMPT_SCREENSHOT_STYLES, B as UI_FILE_AI_PROMPT_TYPES, te as UI_FILE_AI_TYPES, P as UI_FILE_GITIGNORE, $ as UI_FILE_INDEX, q as UI_FILE_NAME_DESIGN, G as UI_FILE_NAME_FLAGS, K as UI_FILE_NAME_MEDIA, J as UI_FILE_NAME_PLUGIN, Y as UI_FILE_NAME_STYLE, Z as UI_FILE_NAME_VITE, Q as UI_FILE_NAME_VITE_WORKERS, X as UI_FILE_NAME_WIKI, ee as UI_FILE_PACKAGE, F as UI_FILE_PROPERTY, se as UI_FILE_STYLE_PROPERTIES, oe as UI_FILE_STYLE_SCSS, s as UI_FLAG_NOT_EXPORT, a as UI_KEY_CONSTRUCTOR, o as UI_KEY_CUSTOM, i as UI_MODULES, r as UI_PROJECT_CONSTRUCTOR_FULL_NAME, n as UI_PROJECT_CONSTRUCTOR_NAME, t as UI_PROJECT_NAME, ue as UI_PROPERTY_FOR_PROPS, le as UI_STRUCTURE_CLASSES };
|
package/dist/library-ai.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as e, c as t, i as n, n as r, o as i, r as a, s as o, t as s, u as c } from "./AiZAi-
|
|
1
|
+
import { a as e, c as t, i as n, n as r, o as i, r as a, s as o, t as s, u as c } from "./AiZAi-B4ih4xL2.js";
|
|
2
2
|
export { c as AiAbstract, o as AiClaude, t as AiClaudeLite, e as AiGoogle, i as AiGoogleLite, a as AiOpenAi, n as AiOpenAiLite, s as AiZAi, r as AiZAiLite };
|
package/dist/library.d.ts
CHANGED
|
@@ -182,6 +182,81 @@ export declare abstract class AiAbstract<AI = any> {
|
|
|
182
182
|
protected abstract response(model: string, contents: string): Promise<string>;
|
|
183
183
|
}
|
|
184
184
|
|
|
185
|
+
/**
|
|
186
|
+
* Google Antigravity AI implementation via CLI (`agy`).
|
|
187
|
+
* Extends AiAntigravityCliLite and provides configuration from the project environment.
|
|
188
|
+
*
|
|
189
|
+
* Реализация Google Antigravity AI через CLI (`agy`).
|
|
190
|
+
* Расширяет AiAntigravityCliLite и предоставляет конфигурацию из окружения проекта.
|
|
191
|
+
*
|
|
192
|
+
* Responsibilities / Ответственности:
|
|
193
|
+
* - Provide API key and model from config / Предоставить API ключ и модель из конфигурации
|
|
194
|
+
* - Initialize CLI wrapper / Инициализировать обертку CLI
|
|
195
|
+
*
|
|
196
|
+
* Notes / Примечания:
|
|
197
|
+
* - Uses getConfigAi() to retrieve credentials / Использует getConfigAi() для получения учетных данных
|
|
198
|
+
*/
|
|
199
|
+
export declare class AiAntigravityCli extends AiAntigravityCliLite {
|
|
200
|
+
/**
|
|
201
|
+
* Constructor initializes Antigravity CLI AI with project configuration.
|
|
202
|
+
*
|
|
203
|
+
* Конструктор инициализирует Antigravity CLI AI с конфигурацией проекта.
|
|
204
|
+
*/
|
|
205
|
+
constructor();
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
/**
|
|
209
|
+
* Google Antigravity AI implementation via CLI (`agy`).
|
|
210
|
+
* Executes Antigravity CLI commands directly without a system shell.
|
|
211
|
+
*
|
|
212
|
+
* Реализация Google Antigravity AI через CLI (`agy`).
|
|
213
|
+
* Выполняет команды Antigravity CLI напрямую, без системной оболочки.
|
|
214
|
+
*
|
|
215
|
+
* Responsibilities / Ответственности:
|
|
216
|
+
* - Construct Antigravity CLI command / Сформировать команду Antigravity CLI
|
|
217
|
+
* - Execute command without shell / Выполнить команду без оболочки
|
|
218
|
+
* - Return stdout as result / Вернуть stdout как результат
|
|
219
|
+
*
|
|
220
|
+
* Notes / Примечания:
|
|
221
|
+
* - Requires 'agy' CLI tool installed / Требует установленной утилиты 'agy'
|
|
222
|
+
* - API key is passed via environment variable or config / API ключ передается через переменную окружения или конфиг
|
|
223
|
+
*/
|
|
224
|
+
export declare class AiAntigravityCliLite extends AiAbstract<{}> {
|
|
225
|
+
/** Temporary prompt file manager / Менеджер временных файлов промпта */
|
|
226
|
+
protected readonly tmp: ApiTmp;
|
|
227
|
+
/**
|
|
228
|
+
* Initializes the client instance.
|
|
229
|
+
*
|
|
230
|
+
* Инициализирует экземпляр клиента.
|
|
231
|
+
*/
|
|
232
|
+
protected init(): Promise<void>;
|
|
233
|
+
/**
|
|
234
|
+
* Implementation hook: convert accumulated images to model-specific format.
|
|
235
|
+
* CLI implementation currently ignores images.
|
|
236
|
+
*
|
|
237
|
+
* Хук реализации: преобразовать накопленные изображения в формат, специфичный для модели.
|
|
238
|
+
* Реализация CLI в настоящее время игнорирует изображения.
|
|
239
|
+
* @returns array of converted images / массив преобразованных изображений
|
|
240
|
+
*/
|
|
241
|
+
protected toImages(): any;
|
|
242
|
+
/**
|
|
243
|
+
* Implementation hook: convert accumulated contents to model-specific format.
|
|
244
|
+
*
|
|
245
|
+
* Хук реализации: преобразовать накопленное содержимое в формат, специфичный для модели.
|
|
246
|
+
* @returns array of formatted prompt strings / массив отформатированных строк промпта
|
|
247
|
+
*/
|
|
248
|
+
protected toContents(): any;
|
|
249
|
+
/**
|
|
250
|
+
* Performs content generation request via Antigravity CLI and returns textual result.
|
|
251
|
+
*
|
|
252
|
+
* Выполняет запрос генерации контента через Antigravity CLI и возвращает текстовый результат.
|
|
253
|
+
* @param model model identifier / идентификатор модели
|
|
254
|
+
* @param contents composed contents for generation / собранный контент для генерации
|
|
255
|
+
* @returns generated text response / сгенерированный текстовый ответ
|
|
256
|
+
*/
|
|
257
|
+
protected response(model: string, contents: string): Promise<string>;
|
|
258
|
+
}
|
|
259
|
+
|
|
185
260
|
/**
|
|
186
261
|
* Claude AI implementation of AiAbstract.
|
|
187
262
|
* Initializes Anthropic client and performs text generation requests.
|
|
@@ -645,7 +720,7 @@ export declare class AiOpenAiLite extends AiAbstract<OpenAI> {
|
|
|
645
720
|
*
|
|
646
721
|
* Тип ИИ-провайдера для генерации кода и контента.
|
|
647
722
|
*/
|
|
648
|
-
export declare type AiType = 'claude' | 'claude-
|
|
723
|
+
export declare type AiType = 'antigravity-cli' | 'claude' | 'claude-agent' | 'claude-cli' | 'gemini' | 'gemini-cli' | 'openai' | 'zai';
|
|
649
724
|
|
|
650
725
|
/**
|
|
651
726
|
* Z.ai (Zhipu AI) implementation extending AiZAiLite.
|
|
@@ -1084,10 +1159,10 @@ export declare type DesignMcpResources = DesignMcpResourceItem[];
|
|
|
1084
1159
|
|
|
1085
1160
|
/**
|
|
1086
1161
|
* Automates the capturing of full-page component screenshots and extraction of DOM/CSS styles.
|
|
1087
|
-
* Spawns a local development server, navigates headless browser, captures screenshots,
|
|
1162
|
+
* Spawns a local development server, navigates headless browser, captures screenshots, dumps HTML and CSS artifacts, and generates AI visual metadata.
|
|
1088
1163
|
*
|
|
1089
1164
|
* Автоматизирует создание полностраничных скриншотов компонентов и извлечение DOM/CSS стилей.
|
|
1090
|
-
* Запускает локальный сервер разработки, открывает headless-браузер, делает
|
|
1165
|
+
* Запускает локальный сервер разработки, открывает headless-браузер, делает скриншоты, сохраняет HTML и CSS артефакты и генерирует визуальные метаданные с помощью ИИ.
|
|
1091
1166
|
*/
|
|
1092
1167
|
export declare class DesignScreenshot {
|
|
1093
1168
|
protected readonly file: string;
|
|
@@ -1102,6 +1177,13 @@ export declare class DesignScreenshot {
|
|
|
1102
1177
|
* @param file output path / путь к файлу
|
|
1103
1178
|
*/
|
|
1104
1179
|
constructor(file?: string);
|
|
1180
|
+
/**
|
|
1181
|
+
* Returns an instance of DesignScreenshotDescription for AI metadata analysis.
|
|
1182
|
+
*
|
|
1183
|
+
* Возвращает экземпляр DesignScreenshotDescription для ИИ анализа метаданных.
|
|
1184
|
+
* @returns instance of DesignScreenshotDescription / экземпляр DesignScreenshotDescription
|
|
1185
|
+
*/
|
|
1186
|
+
getDescription(): DesignScreenshotDescription;
|
|
1105
1187
|
/**
|
|
1106
1188
|
* Starts the screenshot process.
|
|
1107
1189
|
*
|
|
@@ -1133,6 +1215,124 @@ export declare class DesignScreenshot {
|
|
|
1133
1215
|
makeUrl(data: string): this;
|
|
1134
1216
|
}
|
|
1135
1217
|
|
|
1218
|
+
/**
|
|
1219
|
+
* Class for analyzing individual component screenshots using AI and generating structured JSON metadata descriptions.
|
|
1220
|
+
* Reads captured screenshot image files, analyzes visible components per screenshot with multimodal AI, and saves the list of screenshot descriptors to a JSON file.
|
|
1221
|
+
*
|
|
1222
|
+
* Класс для анализа отдельных скриншотов компонентов с помощью ИИ и генерации структурированных JSON описаний метаданных.
|
|
1223
|
+
* Читает сохраненные файлы изображений скриншотов, анализирует видимые компоненты для каждого скриншота с помощью мультимодального ИИ и сохраняет список дескрипторов скриншотов в JSON файл.
|
|
1224
|
+
*/
|
|
1225
|
+
export declare class DesignScreenshotDescription {
|
|
1226
|
+
protected readonly file: string;
|
|
1227
|
+
/** Cached list of analyzed screenshot items / Кэшированный список проанализированных элементов скриншота */
|
|
1228
|
+
protected items?: DesignScreenshotList;
|
|
1229
|
+
/**
|
|
1230
|
+
* Constructor initializes target screenshot file path.
|
|
1231
|
+
*
|
|
1232
|
+
* Конструктор инициализирует целевой путь к файлу скриншота.
|
|
1233
|
+
* @param file target screenshot file base path / базовый путь к целевому файлу скриншота
|
|
1234
|
+
*/
|
|
1235
|
+
constructor(file?: string);
|
|
1236
|
+
/**
|
|
1237
|
+
* Checks if the screenshot description JSON file exists.
|
|
1238
|
+
*
|
|
1239
|
+
* Проверяет, существует ли JSON файл описания скриншота.
|
|
1240
|
+
* @returns true if description file exists / true, если файл описания существует
|
|
1241
|
+
*/
|
|
1242
|
+
is(): boolean;
|
|
1243
|
+
/**
|
|
1244
|
+
* Returns the directory containing the screenshot files.
|
|
1245
|
+
*
|
|
1246
|
+
* Возвращает директорию, содержащую файлы скриншотов.
|
|
1247
|
+
* @returns directory path / путь к директории
|
|
1248
|
+
*/
|
|
1249
|
+
getDir(): string;
|
|
1250
|
+
/**
|
|
1251
|
+
* Returns the JSON description file path.
|
|
1252
|
+
*
|
|
1253
|
+
* Возвращает путь к JSON файлу описания.
|
|
1254
|
+
* @returns JSON file path / путь к JSON файлу
|
|
1255
|
+
*/
|
|
1256
|
+
getJsonPath(): string;
|
|
1257
|
+
/**
|
|
1258
|
+
* Returns the list of screenshot description items from cache or file.
|
|
1259
|
+
*
|
|
1260
|
+
* Возвращает список элементов описания скриншота из кэша или файла.
|
|
1261
|
+
* @returns list of screenshot description items / список элементов описания скриншота
|
|
1262
|
+
*/
|
|
1263
|
+
getItems(): DesignScreenshotList;
|
|
1264
|
+
/**
|
|
1265
|
+
* Executes AI screenshot analysis for each screenshot image file and writes results to the JSON file.
|
|
1266
|
+
*
|
|
1267
|
+
* Выполняет анализ скриншотов с помощью ИИ для каждого файла изображения скриншота и записывает результаты в JSON файл.
|
|
1268
|
+
* @returns this instance / этот экземпляр
|
|
1269
|
+
*/
|
|
1270
|
+
make(): Promise<this>;
|
|
1271
|
+
/**
|
|
1272
|
+
* Loads an individual image file by name and returns an AI image item with base64 data.
|
|
1273
|
+
*
|
|
1274
|
+
* Загружает отдельный файл изображения по имени и возвращает элемент изображения ИИ с данными base64.
|
|
1275
|
+
* @param fileName image file name / имя файла изображения
|
|
1276
|
+
* @returns AI image item or undefined / элемент изображения ИИ или undefined
|
|
1277
|
+
* @protected
|
|
1278
|
+
*/
|
|
1279
|
+
protected getImage(fileName: string): AiImageItem | undefined;
|
|
1280
|
+
/**
|
|
1281
|
+
* Scans screenshot directory and returns a sorted list of image file names.
|
|
1282
|
+
*
|
|
1283
|
+
* Сканирует директорию скриншотов и возвращает отсортированный список имен файлов изображений.
|
|
1284
|
+
* @returns sorted array of image file names / отсортированный массив имен файлов изображений
|
|
1285
|
+
* @protected
|
|
1286
|
+
*/
|
|
1287
|
+
protected getImageFiles(): string[];
|
|
1288
|
+
/**
|
|
1289
|
+
* Determines MIME type based on image file extension.
|
|
1290
|
+
*
|
|
1291
|
+
* Определяет MIME-тип на основе расширения файла изображения.
|
|
1292
|
+
* @param file filename or path / имя файла или путь
|
|
1293
|
+
* @returns image MIME type string / строка MIME-типа изображения
|
|
1294
|
+
* @protected
|
|
1295
|
+
*/
|
|
1296
|
+
protected getMimeType(file: string): string;
|
|
1297
|
+
/**
|
|
1298
|
+
* Saves the generated screenshot description list to a JSON file.
|
|
1299
|
+
*
|
|
1300
|
+
* Сохраняет сгенерированный список описаний скриншота в JSON файл.
|
|
1301
|
+
* @param items description items list / список элементов описания
|
|
1302
|
+
* @protected
|
|
1303
|
+
*/
|
|
1304
|
+
protected saveJson(items: DesignScreenshotList): void;
|
|
1305
|
+
/**
|
|
1306
|
+
* Sends a single screenshot image and prompt to AI and parses the JSON response into a screenshot descriptor item.
|
|
1307
|
+
*
|
|
1308
|
+
* Отправляет отдельное изображение скриншота и промпт ИИ и парсит полученный JSON-ответ в элемент дескриптора скриншота.
|
|
1309
|
+
* @param fileName image file name / имя файла изображения
|
|
1310
|
+
* @param image image item with base64 data / элемент изображения с данными base64
|
|
1311
|
+
* @returns parsed screenshot item or undefined / распарсенный элемент скриншота или undefined
|
|
1312
|
+
* @protected
|
|
1313
|
+
*/
|
|
1314
|
+
protected toAiItem(fileName: string, image: AiImageItem): Promise<DesignScreenshotItem | undefined>;
|
|
1315
|
+
}
|
|
1316
|
+
|
|
1317
|
+
/**
|
|
1318
|
+
* Screenshot visual analysis item containing component name and description.
|
|
1319
|
+
*
|
|
1320
|
+
* Элемент визуального анализа скриншота, содержащий название компонента и описание.
|
|
1321
|
+
*/
|
|
1322
|
+
export declare type DesignScreenshotItem = {
|
|
1323
|
+
/** Component or visual element name / Название компонента или визуального элемента */
|
|
1324
|
+
name: string;
|
|
1325
|
+
/** Description of the component or visual element / Описание компонента или визуального элемента */
|
|
1326
|
+
description: string;
|
|
1327
|
+
};
|
|
1328
|
+
|
|
1329
|
+
/**
|
|
1330
|
+
* List of screenshot visual analysis items.
|
|
1331
|
+
*
|
|
1332
|
+
* Список элементов визуального анализа скриншотов.
|
|
1333
|
+
*/
|
|
1334
|
+
export declare type DesignScreenshotList = DesignScreenshotItem[];
|
|
1335
|
+
|
|
1136
1336
|
/**
|
|
1137
1337
|
* Design structure class item containing class index, CSS class name, and completeness flag.
|
|
1138
1338
|
*
|
|
@@ -3383,6 +3583,8 @@ export declare class LibraryAiPromptItem {
|
|
|
3383
3583
|
protected readonly dir: string[];
|
|
3384
3584
|
/** Item instance for working with MCP files. / Экземпляр элемента для работы с файлами MCP. */
|
|
3385
3585
|
protected readonly itemMcp: LibraryAiMcpItem;
|
|
3586
|
+
/** Item instance for working with screenshot files. / Экземпляр элемента для работы с файлами скриншотов. */
|
|
3587
|
+
protected readonly itemScreenshot: LibraryAiPromptScreenshot;
|
|
3386
3588
|
/**
|
|
3387
3589
|
* Constructor for LibraryAiPromptItem.
|
|
3388
3590
|
*
|
|
@@ -3509,22 +3711,6 @@ export declare class LibraryAiPromptItem {
|
|
|
3509
3711
|
* @protected
|
|
3510
3712
|
*/
|
|
3511
3713
|
protected getPathString(dirFile?: string): string;
|
|
3512
|
-
/**
|
|
3513
|
-
* Formats and returns the screenshot section for the prompt.
|
|
3514
|
-
*
|
|
3515
|
-
* Форматирует и возвращает секцию скриншотов для промпта.
|
|
3516
|
-
* @returns formatted screenshot list or undefined / отформатированный список скриншотов или undefined
|
|
3517
|
-
* @protected
|
|
3518
|
-
*/
|
|
3519
|
-
protected getScreenshot(): string | undefined;
|
|
3520
|
-
/**
|
|
3521
|
-
* Retrieves the list of files in the screenshot directory.
|
|
3522
|
-
*
|
|
3523
|
-
* Получает список файлов в директории скриншотов.
|
|
3524
|
-
* @returns list of screenshot file names or undefined / список имен файлов скриншотов или undefined
|
|
3525
|
-
* @protected
|
|
3526
|
-
*/
|
|
3527
|
-
protected getScreenshotList(): string[] | undefined;
|
|
3528
3714
|
/**
|
|
3529
3715
|
* Formats and returns the types section for the prompt.
|
|
3530
3716
|
* Copies the types file to the root types directory and links to the copy.
|
|
@@ -3536,13 +3722,13 @@ export declare class LibraryAiPromptItem {
|
|
|
3536
3722
|
*/
|
|
3537
3723
|
protected getTypes(): string | undefined;
|
|
3538
3724
|
/**
|
|
3539
|
-
* Returns the copied types
|
|
3725
|
+
* Returns the directory name for the copied types based on the project name.
|
|
3540
3726
|
*
|
|
3541
|
-
* Возвращает имя
|
|
3542
|
-
* @returns
|
|
3727
|
+
* Возвращает имя директории для скопированных типов на основе названия проекта.
|
|
3728
|
+
* @returns directory name / имя директории
|
|
3543
3729
|
* @protected
|
|
3544
3730
|
*/
|
|
3545
|
-
protected
|
|
3731
|
+
protected getTypesDirName(): string;
|
|
3546
3732
|
/**
|
|
3547
3733
|
* Returns path segments for the copied types file in the root types directory.
|
|
3548
3734
|
*
|
|
@@ -3570,6 +3756,122 @@ export declare class LibraryAiPromptItem {
|
|
|
3570
3756
|
protected readFile(dirFile: string): string;
|
|
3571
3757
|
}
|
|
3572
3758
|
|
|
3759
|
+
/**
|
|
3760
|
+
* Class representing screenshot handling in the AI prompt generation process.
|
|
3761
|
+
* Manages reading screenshot image references, copying HTML/CSS showcase artifacts, and enriching screenshot lists with AI descriptions.
|
|
3762
|
+
*
|
|
3763
|
+
* Класс, представляющий обработку скриншотов в процессе генерации промпта для ИИ.
|
|
3764
|
+
* Управляет чтением ссылок на изображения скриншотов, копированием HTML/CSS артефактов витрины и обогащением списка скриншотов описаниями ИИ.
|
|
3765
|
+
*/
|
|
3766
|
+
export declare class LibraryAiPromptScreenshot {
|
|
3767
|
+
protected readonly dir: string[];
|
|
3768
|
+
protected readonly projectName: string;
|
|
3769
|
+
/** Map of screenshot file names to their textual descriptions. / Карта имен файлов скриншотов и их текстовых описаний. */
|
|
3770
|
+
protected descriptionsMap?: Map<string, string>;
|
|
3771
|
+
/**
|
|
3772
|
+
* Constructor for LibraryAiPromptScreenshot.
|
|
3773
|
+
*
|
|
3774
|
+
* Конструктор для LibraryAiPromptScreenshot.
|
|
3775
|
+
* @param dir Path segments to the directory / Сегменты пути к директории
|
|
3776
|
+
* @param projectName Project name from package.json / Название проекта из package.json
|
|
3777
|
+
*/
|
|
3778
|
+
constructor(dir?: string[], projectName?: string);
|
|
3779
|
+
/**
|
|
3780
|
+
* Checks if the screenshot directory exists.
|
|
3781
|
+
*
|
|
3782
|
+
* Проверяет, существует ли директория со скриншотами.
|
|
3783
|
+
* @returns true if screenshot directory exists / true, если директория скриншотов существует
|
|
3784
|
+
*/
|
|
3785
|
+
isScreenshot(): boolean;
|
|
3786
|
+
/**
|
|
3787
|
+
* Formats and returns the screenshot section for the AI prompt.
|
|
3788
|
+
* Copies HTML and CSS showcase files to the root types directory and enriches screenshot image references with descriptions.
|
|
3789
|
+
*
|
|
3790
|
+
* Форматирует и возвращает секцию скриншотов для промпта ИИ.
|
|
3791
|
+
* Копирует файлы HTML и CSS витрины в корневую директорию типов и обогащает ссылки на изображения скриншотов описаниями.
|
|
3792
|
+
* @returns formatted screenshot section or undefined / отформатированная секция скриншотов или undefined
|
|
3793
|
+
*/
|
|
3794
|
+
make(): string | undefined;
|
|
3795
|
+
/**
|
|
3796
|
+
* Checks whether the file is an image file and not a metadata/code file.
|
|
3797
|
+
*
|
|
3798
|
+
* Проверяет, является ли файл изображением, а не файлом метаданных/кода.
|
|
3799
|
+
* @param fileName file name to verify / имя файла для проверки
|
|
3800
|
+
* @returns true if file is an image / true, если файл является изображением
|
|
3801
|
+
* @protected
|
|
3802
|
+
*/
|
|
3803
|
+
protected isImageFile(fileName: string): boolean;
|
|
3804
|
+
/**
|
|
3805
|
+
* Retrieves and caches the map of screenshot descriptions from screenshot.json.
|
|
3806
|
+
*
|
|
3807
|
+
* Получает и кэширует карту описаний скриншотов из screenshot.json.
|
|
3808
|
+
* @returns map of file names to descriptions / карта имен файлов к описаниям
|
|
3809
|
+
* @protected
|
|
3810
|
+
*/
|
|
3811
|
+
protected getDescriptionsMap(): Map<string, string>;
|
|
3812
|
+
/**
|
|
3813
|
+
* Constructs a full path for a file or directory within the item's directory.
|
|
3814
|
+
*
|
|
3815
|
+
* Создает полный путь к файлу или директории внутри директории элемента.
|
|
3816
|
+
* @param dirFile File or directory name / Имя файла или директории
|
|
3817
|
+
* @returns path segments / сегменты пути
|
|
3818
|
+
* @protected
|
|
3819
|
+
*/
|
|
3820
|
+
protected getPath(dirFile: string): string[];
|
|
3821
|
+
/**
|
|
3822
|
+
* Returns the directory path or file path within the directory as a string.
|
|
3823
|
+
*
|
|
3824
|
+
* Возвращает путь к директории или путь к файлу внутри директории в виде строки.
|
|
3825
|
+
* @param dirFile optional file name or subpath / опциональное имя файла или подпуть
|
|
3826
|
+
* @returns formatted path string / отформатированная строка пути
|
|
3827
|
+
* @protected
|
|
3828
|
+
*/
|
|
3829
|
+
protected getPathString(dirFile?: string): string;
|
|
3830
|
+
/**
|
|
3831
|
+
* Retrieves the list of files in the screenshot directory.
|
|
3832
|
+
*
|
|
3833
|
+
* Получает список файлов в директории скриншотов.
|
|
3834
|
+
* @returns list of screenshot file names or undefined / список имен файлов скриншотов или undefined
|
|
3835
|
+
* @protected
|
|
3836
|
+
*/
|
|
3837
|
+
protected getScreenshotList(): string[] | undefined;
|
|
3838
|
+
/**
|
|
3839
|
+
* Constructs a full path for a file inside the screenshot directory.
|
|
3840
|
+
*
|
|
3841
|
+
* Создает полный путь к файлу внутри директории скриншотов.
|
|
3842
|
+
* @param fileName File name / Имя файла
|
|
3843
|
+
* @returns path segments / сегменты пути
|
|
3844
|
+
* @protected
|
|
3845
|
+
*/
|
|
3846
|
+
protected getScreenshotPath(fileName: string): string[];
|
|
3847
|
+
/**
|
|
3848
|
+
* Returns the directory name for the copied files based on the project name.
|
|
3849
|
+
*
|
|
3850
|
+
* Возвращает имя директории для скопированных файлов на основе названия проекта.
|
|
3851
|
+
* @returns directory name / имя директории
|
|
3852
|
+
* @protected
|
|
3853
|
+
*/
|
|
3854
|
+
protected getTypesDirName(): string;
|
|
3855
|
+
/**
|
|
3856
|
+
* Returns path segments for a copied file in the root types directory.
|
|
3857
|
+
*
|
|
3858
|
+
* Возвращает сегменты пути для скопированного файла в корневой директории типов.
|
|
3859
|
+
* @param fileName File name / Имя файла
|
|
3860
|
+
* @returns target path segments / сегменты целевого пути
|
|
3861
|
+
* @protected
|
|
3862
|
+
*/
|
|
3863
|
+
protected getTypesPath(fileName: string): string[];
|
|
3864
|
+
/**
|
|
3865
|
+
* Copies a screenshot artifact file to the target destination in the root types directory.
|
|
3866
|
+
*
|
|
3867
|
+
* Копирует файл артефакта скриншота в целевое назначение в корневой директории типов.
|
|
3868
|
+
* @param fileName file name to copy / имя файла для копирования
|
|
3869
|
+
* @returns target path segments / сегменты целевого пути
|
|
3870
|
+
* @protected
|
|
3871
|
+
*/
|
|
3872
|
+
protected copyScreenshotFile(fileName: string): string[];
|
|
3873
|
+
}
|
|
3874
|
+
|
|
3573
3875
|
/**
|
|
3574
3876
|
* List of all library items across the design system.
|
|
3575
3877
|
*
|
|
@@ -4695,20 +4997,20 @@ export declare interface ScreenshotMetrics {
|
|
|
4695
4997
|
export declare interface ScreenshotOptions {
|
|
4696
4998
|
/** Additional CLI flags for browser launch / Дополнительные CLI-флаги для запуска браузера */
|
|
4697
4999
|
args?: string[];
|
|
4698
|
-
/**
|
|
4699
|
-
|
|
5000
|
+
/** Image output format / Формат сохранения изображения */
|
|
5001
|
+
format?: 'png' | 'jpeg' | 'webp';
|
|
5002
|
+
/** Whether to capture full scrollable page height / Делать ли снимок всей прокручиваемой страницы */
|
|
5003
|
+
fullPage?: boolean;
|
|
5004
|
+
/** Image compression quality (1-100) / Качество сжатия изображения (1-100) */
|
|
5005
|
+
quality?: number;
|
|
4700
5006
|
/** Maximum timeout in milliseconds for loading the page / Максимальный таймаут в миллисекундах для загрузки страницы */
|
|
4701
5007
|
timeout?: number;
|
|
5008
|
+
/** Navigation lifecycle event conditions to consider page loaded / Условия событий жизненного цикла навигации для завершения загрузки */
|
|
5009
|
+
waitUntil?: PuppeteerLifeCycleEvent | PuppeteerLifeCycleEvent[];
|
|
4702
5010
|
/** Width of the screenshot viewport in pixels / Ширина области просмотра скриншота в пикселях */
|
|
4703
5011
|
width?: number;
|
|
4704
5012
|
/** Height of the screenshot viewport in pixels / Высота области просмотра скриншота в пикселях */
|
|
4705
5013
|
height?: number;
|
|
4706
|
-
/** Image output format / Формат сохранения изображения */
|
|
4707
|
-
format?: 'png' | 'jpeg' | 'webp';
|
|
4708
|
-
/** Image compression quality (1-100) / Качество сжатия изображения (1-100) */
|
|
4709
|
-
quality?: number;
|
|
4710
|
-
/** Whether to capture full scrollable page height / Делать ли снимок всей прокручиваемой страницы */
|
|
4711
|
-
fullPage?: boolean;
|
|
4712
5014
|
}
|
|
4713
5015
|
|
|
4714
5016
|
/**
|