@dxtmisha/scripts 1.1.6 → 1.1.7

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 CHANGED
@@ -2,6 +2,31 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file.
4
4
 
5
+ ## [1.1.7] - 2026-09-10
6
+
7
+ ### Added
8
+ - **`DesignTypesAi.toAiCode()`**:
9
+ - Implemented `toAiCode(content, prompt, code)` method in `DesignTypesAi` to execute AI generation via `toAi` and automatically strip markdown code block fences (````typescript`, ````ts`, ````javascript`, ```` `, etc.) from the output.
10
+ - Added unit test coverage for `toAiCode` in `src/classes/Design/__tests__/DesignTypesAi.test.ts`.
11
+ - Added method documentation in Storybook MDX references (`DesignTypesAi.ru.mdx`, `DesignTypesAi.en.mdx`, `DesignTypesAi.vi.mdx`).
12
+ - **`AiAbstract.getConfigDetails()`**:
13
+ - Implemented protected `getConfigDetails()` method in `AiAbstract` to format non-empty configuration parameters into a clean parenthetical string (e.g. ` (effort: high)`).
14
+
15
+ ### Changed
16
+ - **Type Optimization Pipeline (`DesignTypesMake.toAiEdit`)**:
17
+ - Updated `toAiEdit` in `DesignTypesMake` to call `this.ai.toAiCode` instead of `this.ai.toAi`, ensuring generated declaration files are free of markdown syntax artifacts.
18
+ - **AI Client Initialization Logging (`AiAbstract.generate`)**:
19
+ - Integrated `this.getConfigDetails()` into the initialization log message in `AiAbstract.generate()` to cleanly display active configuration parameters without printing empty brackets.
20
+
21
+ ## [1.1.6] - 2026-09-10
22
+
23
+ ### Fixed
24
+ - **Antigravity CLI Argument Formatting (`AiAntigravityCliLite`)**:
25
+ - Fixed command execution by passing prompt via `-p` (`--print`) flag instead of positional argument.
26
+ - Replaced unsupported `--yolo` flag with `--dangerously-skip-permissions`.
27
+ - Added automatic `--effort` resolution (`getEffort()`), defaulting to `high` for Gemini models to meet CLI requirements and supporting custom configuration via `aiConfig.effort`.
28
+ - Updated unit test assertions in `AiAntigravityCli.test.ts`.
29
+
5
30
  ## [1.1.5] - 2026-09-09
6
31
 
7
32
  ### Added
@@ -1,7 +1,7 @@
1
1
  import { t as e } from "./PropertiesConfig-BBsuNndv.js";
2
- import { forEach as t, random as n, sleep as r } from "@dxtmisha/functional-basic";
2
+ import { forEach as t, isFilled as n, random as r, sleep as i } from "@dxtmisha/functional-basic";
3
3
  //#region src/classes/Ai/AiAbstract.ts
4
- var i = class {
4
+ var a = class {
5
5
  key;
6
6
  model;
7
7
  config;
@@ -45,28 +45,31 @@ var i = class {
45
45
  setConfig(e) {
46
46
  return this.config = e, this;
47
47
  }
48
- async generate(e, t = !0, i = 0) {
49
- if (this.ai || (await this.init(), console.log(`[Ai] Initialized AI client with model: ${this.model}`)), this.ai) {
50
- let a = 1 + i, o = n(1e3, 2e3);
48
+ async generate(e, t = !0, n = 0) {
49
+ if (this.ai || (await this.init(), console.log(`[Ai] Initialized AI client with model: ${this.model}${this.getConfigDetails()}`)), this.ai) {
50
+ let a = 1 + n, o = r(1e3, 2e3);
51
51
  for (let n = 1; n <= a; n++) {
52
52
  console.log(`[Ai] Generating${a > 1 ? ` (attempt ${n}/${a})` : ""}`);
53
53
  try {
54
54
  let t = await this.response(this.model, this.getMainContents(e));
55
55
  return console.log(`[Ai] End (length: ${t.length})`), t;
56
56
  } catch (e) {
57
- console.error(`[Ai] Generation error (attempt ${n}/${a}):`, e), n < a ? (console.log(`[Ai] Retrying in ${Math.round(o)}ms...`), await r(o), o = Math.round(o * 1.6)) : t && process.exit(1);
57
+ console.error(`[Ai] Generation error (attempt ${n}/${a}):`, e), n < a ? (console.log(`[Ai] Retrying in ${Math.round(o)}ms...`), await i(o), o = Math.round(o * 1.6)) : t && process.exit(1);
58
58
  }
59
59
  }
60
60
  }
61
61
  return "";
62
62
  }
63
+ getConfigDetails() {
64
+ return n(this.config) ? ` (${Object.entries(this.config).map(([e, t]) => `${e}: ${typeof t == "object" ? JSON.stringify(t) : t}`).join(", ")})` : "";
65
+ }
63
66
  getMainContents(e) {
64
67
  return `${this.prompt}\n${e}`;
65
68
  }
66
69
  };
67
70
  //#endregion
68
71
  //#region src/functions/getConfigAi.ts
69
- function a() {
72
+ function o() {
70
73
  return [
71
74
  e.getAiKey(),
72
75
  e.getAiModel(),
@@ -75,7 +78,7 @@ function a() {
75
78
  }
76
79
  //#endregion
77
80
  //#region src/classes/Ai/AiClaudeLite.ts
78
- var o = class extends i {
81
+ var s = class extends a {
79
82
  async init() {
80
83
  let { Anthropic: e } = await import("@anthropic-ai/sdk");
81
84
  this.ai = new e({ apiKey: this.key });
@@ -117,11 +120,11 @@ var o = class extends i {
117
120
  if (e.type === "text" && "text" in e) return e.text;
118
121
  }).join("\n") : "";
119
122
  }
120
- }, s = class extends o {
123
+ }, c = class extends s {
121
124
  constructor() {
122
- super(...a());
125
+ super(...o());
123
126
  }
124
- }, c = class extends i {
127
+ }, l = class extends a {
125
128
  async init() {
126
129
  let { GoogleGenAI: e } = await import("@google/genai");
127
130
  this.ai = new e({ apiKey: this.key });
@@ -149,11 +152,11 @@ var o = class extends i {
149
152
  config: this.config
150
153
  }))?.text ?? "";
151
154
  }
152
- }, l = class extends c {
155
+ }, u = class extends l {
153
156
  constructor() {
154
- super(...a());
157
+ super(...o());
155
158
  }
156
- }, u = class extends i {
159
+ }, d = class extends a {
157
160
  async init() {
158
161
  let { OpenAI: e } = await import("openai");
159
162
  this.ai = new e({ apiKey: this.key });
@@ -201,11 +204,11 @@ var o = class extends i {
201
204
  ...this.config
202
205
  }))?.choices?.[0]?.message?.content ?? "";
203
206
  }
204
- }, d = class extends u {
207
+ }, f = class extends d {
205
208
  constructor() {
206
- super(...a());
209
+ super(...o());
207
210
  }
208
- }, f = class extends i {
211
+ }, p = class extends a {
209
212
  async init() {
210
213
  let { createXai: e } = await import("@ai-sdk/xai");
211
214
  this.ai = e({ apiKey: this.key });
@@ -230,10 +233,10 @@ var o = class extends i {
230
233
  });
231
234
  return o ?? "";
232
235
  }
233
- }, p = class extends f {
236
+ }, m = class extends p {
234
237
  constructor() {
235
- super(...a());
238
+ super(...o());
236
239
  }
237
240
  };
238
241
  //#endregion
239
- export { l as a, o as c, u as i, a as l, f as n, c as o, d as r, s, p as t, i as u };
242
+ export { u as a, s as c, d as i, o as l, p as n, l as o, f as r, c as s, m as t, a as u };
@@ -137,6 +137,13 @@ export declare abstract class AiAbstract<AI = any> {
137
137
  * @returns generated response text / сгенерированный текст ответа
138
138
  */
139
139
  generate(contents: string, exitOnError?: boolean, maxRetries?: number): Promise<string>;
140
+ /**
141
+ * Returns formatted configuration details for logging.
142
+ *
143
+ * Возвращает отформатированные детали конфигурации для логирования.
144
+ * @returns formatted configuration string or empty string / отформатированная строка конфигурации или пустая строка
145
+ */
146
+ protected getConfigDetails(): string;
140
147
  /**
141
148
  * Combines persistent prompt prefix with provided contents.
142
149
  *
@@ -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-B4ih4xL2.js";
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-3DWR6wJr.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
@@ -145,6 +145,13 @@ export declare abstract class AiAbstract<AI = any> {
145
145
  * @returns generated response text / сгенерированный текст ответа
146
146
  */
147
147
  generate(contents: string, exitOnError?: boolean, maxRetries?: number): Promise<string>;
148
+ /**
149
+ * Returns formatted configuration details for logging.
150
+ *
151
+ * Возвращает отформатированные детали конфигурации для логирования.
152
+ * @returns formatted configuration string or empty string / отформатированная строка конфигурации или пустая строка
153
+ */
154
+ protected getConfigDetails(): string;
148
155
  /**
149
156
  * Combines persistent prompt prefix with provided contents.
150
157
  *
@@ -1564,6 +1571,16 @@ export declare class DesignTypesAi {
1564
1571
  * @returns AI generated content or undefined / сгенерированный ИИ контент или undefined
1565
1572
  */
1566
1573
  toAi(content: string, prompt: string, code?: string): Promise<string | undefined>;
1574
+ /**
1575
+ * Sends content and a prompt to the AI for processing and cleans markdown code block fences from the result.
1576
+ *
1577
+ * Отправляет контент и промпт ИИ для обработки и очищает разметку markdown-блоков кода из результата.
1578
+ * @param content content for processing / контент для обработки
1579
+ * @param prompt instructions for the AI / инструкции для ИИ
1580
+ * @param code code to optimize / код для оптимизации
1581
+ * @returns cleaned code string or undefined / очищенная строка кода или undefined
1582
+ */
1583
+ toAiCode(content: string, prompt: string, code?: string): Promise<string | undefined>;
1567
1584
  /**
1568
1585
  * Sends content and a prompt to the AI for processing and parses the resulting JSON response.
1569
1586
  *
package/dist/library.js CHANGED
@@ -1,4 +1,4 @@
1
- import { a as e, c as t, i as n, l as r, n as i, o as a, r as o, s, t as c, u as l } from "./AiZAi-B4ih4xL2.js";
1
+ import { a as e, c as t, i as n, l as r, n as i, o as a, r as o, s, t as c, u as l } from "./AiZAi-3DWR6wJr.js";
2
2
  import { n as u, t as d } from "./PropertiesConfig-BBsuNndv.js";
3
3
  import { UI_DIRS_FILE_EXPORT as ee, UI_DIRS_LIST_EXPORT as te, UI_DIR_AI_PROMPT_SCREENSHOT as f, UI_DIR_AI_TYPES as p, UI_DIR_AI_TYPES_LIST as m, UI_DIR_PACKAGES as ne, UI_DIR_RESOURCES as re, UI_FILE_AI_DESCRIPTION as h, UI_FILE_AI_MCP as g, UI_FILE_AI_MCP_ALL as _, UI_FILE_AI_MCP_ALL_TS as v, UI_FILE_AI_PROMPT_DESCRIPTION as y, UI_FILE_AI_PROMPT_DEVELOPER as b, UI_FILE_AI_PROMPT_INFO as x, UI_FILE_AI_PROMPT_INSTRUCTION as ie, UI_FILE_AI_PROMPT_PROMPT as S, UI_FILE_AI_PROMPT_SCREENSHOT_CODE as C, UI_FILE_AI_PROMPT_SCREENSHOT_JSON as ae, UI_FILE_AI_PROMPT_SCREENSHOT_STYLES as w, UI_FILE_AI_PROMPT_TYPES as T, UI_FILE_AI_TYPES as E, UI_FILE_GITIGNORE as oe, UI_FILE_PACKAGE as se, UI_FLAG_NOT_EXPORT as ce, UI_MODULES as D } from "./config.js";
4
4
  import { a as O, i as le, n as ue, r as de, t as fe } from "./propertyTypes-CstobYcc.js";
@@ -698,6 +698,10 @@ ${e}\n\`\`\``);
698
698
  if (i) return i;
699
699
  }
700
700
  }
701
+ async toAiCode(e, t, n) {
702
+ let r = await this.toAi(e, t, n);
703
+ if (r) return r.replace(/```[a-zA-Z]*|```/g, "").trim();
704
+ }
701
705
  async toAiJson(e, t, n) {
702
706
  let r = await this.toAi(e, t, n);
703
707
  if (r) try {
@@ -1050,7 +1054,7 @@ ${e}\n\`\`\``);
1050
1054
  await Promise.all(Array.from({ length: Math.min(this.AI_TYPES_CONCURRENCY, n) }, () => a()));
1051
1055
  }
1052
1056
  async toAiEdit(e, t) {
1053
- return await this.ai.toAi(e, Xe, t);
1057
+ return await this.ai.toAiCode(e, Xe, t);
1054
1058
  }
1055
1059
  }, Qe = class {
1056
1060
  ai;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@dxtmisha/scripts",
3
3
  "private": false,
4
- "version": "1.1.6",
4
+ "version": "1.1.7",
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": [