@dxtmisha/scripts 1.1.2 → 1.1.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/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-cli' | 'claude-agent' | 'gemini' | 'gemini-cli' | 'openai' | 'zai';
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, and dumps HTML and CSS artifacts.
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-браузер, делает скриншоты и сохраняет HTML и CSS артефакты.
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 file name based on the project name.
3725
+ * Returns the directory name for the copied types based on the project name.
3540
3726
  *
3541
- * Возвращает имя скопированного файла типов на основе названия проекта.
3542
- * @returns file name / имя файла
3727
+ * Возвращает имя директории для скопированных типов на основе названия проекта.
3728
+ * @returns directory name / имя директории
3543
3729
  * @protected
3544
3730
  */
3545
- protected getTypesFileName(): string;
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
- /** Navigation lifecycle event conditions to consider page loaded / Условия событий жизненного цикла навигации для завершения загрузки */
4699
- waitUntil?: PuppeteerLifeCycleEvent | PuppeteerLifeCycleEvent[];
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
  /**