@dxtmisha/scripts 1.1.5 → 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 +25 -0
- package/dist/{AiZAi-B4ih4xL2.js → AiZAi-3DWR6wJr.js} +23 -20
- package/dist/library-ai.d.ts +7 -0
- package/dist/library-ai.js +1 -1
- package/dist/library.d.ts +25 -0
- package/dist/library.js +16 -6
- package/package.json +1 -1
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,
|
|
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
|
|
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,
|
|
49
|
-
if (this.ai || (await this.init(), console.log(`[Ai] Initialized AI client with model: ${this.model}`)), this.ai) {
|
|
50
|
-
let a = 1 +
|
|
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
|
|
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
|
|
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
|
|
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
|
-
},
|
|
123
|
+
}, c = class extends s {
|
|
121
124
|
constructor() {
|
|
122
|
-
super(...
|
|
125
|
+
super(...o());
|
|
123
126
|
}
|
|
124
|
-
},
|
|
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
|
-
},
|
|
155
|
+
}, u = class extends l {
|
|
153
156
|
constructor() {
|
|
154
|
-
super(...
|
|
157
|
+
super(...o());
|
|
155
158
|
}
|
|
156
|
-
},
|
|
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
|
-
},
|
|
207
|
+
}, f = class extends d {
|
|
205
208
|
constructor() {
|
|
206
|
-
super(...
|
|
209
|
+
super(...o());
|
|
207
210
|
}
|
|
208
|
-
},
|
|
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
|
-
},
|
|
236
|
+
}, m = class extends p {
|
|
234
237
|
constructor() {
|
|
235
|
-
super(...
|
|
238
|
+
super(...o());
|
|
236
239
|
}
|
|
237
240
|
};
|
|
238
241
|
//#endregion
|
|
239
|
-
export {
|
|
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 };
|
package/dist/library-ai.d.ts
CHANGED
|
@@ -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
|
*
|
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-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
|
*
|
|
@@ -224,6 +231,14 @@ export declare class AiAntigravityCli extends AiAntigravityCliLite {
|
|
|
224
231
|
export declare class AiAntigravityCliLite extends AiAbstract<{}> {
|
|
225
232
|
/** Temporary prompt file manager / Менеджер временных файлов промпта */
|
|
226
233
|
protected readonly tmp: ApiTmp;
|
|
234
|
+
/**
|
|
235
|
+
* Resolves the effort level for Antigravity CLI execution.
|
|
236
|
+
*
|
|
237
|
+
* Определяет уровень усилий (effort) для выполнения Antigravity CLI.
|
|
238
|
+
* @param model model identifier / идентификатор модели
|
|
239
|
+
* @returns effort level or undefined / уровень усилий или undefined
|
|
240
|
+
*/
|
|
241
|
+
protected getEffort(model?: string): string | undefined;
|
|
227
242
|
/**
|
|
228
243
|
* Initializes the client instance.
|
|
229
244
|
*
|
|
@@ -1556,6 +1571,16 @@ export declare class DesignTypesAi {
|
|
|
1556
1571
|
* @returns AI generated content or undefined / сгенерированный ИИ контент или undefined
|
|
1557
1572
|
*/
|
|
1558
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>;
|
|
1559
1584
|
/**
|
|
1560
1585
|
* Sends content and a prompt to the AI for processing and parses the resulting JSON response.
|
|
1561
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-
|
|
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";
|
|
@@ -26,6 +26,10 @@ var Se = "./ai-tmp", V = class e {
|
|
|
26
26
|
}
|
|
27
27
|
}, H = class extends l {
|
|
28
28
|
tmp = new V();
|
|
29
|
+
getEffort(e) {
|
|
30
|
+
if (this.config?.effort) return this.config.effort;
|
|
31
|
+
if (e && /gemini/i.test(e) && !e.includes("(")) return "high";
|
|
32
|
+
}
|
|
29
33
|
async init() {
|
|
30
34
|
this.ai = {};
|
|
31
35
|
}
|
|
@@ -37,13 +41,15 @@ var Se = "./ai-tmp", V = class e {
|
|
|
37
41
|
}
|
|
38
42
|
async response(e, t) {
|
|
39
43
|
return new Promise((n) => {
|
|
40
|
-
let r = [
|
|
41
|
-
|
|
44
|
+
let r = [...this.toContents(), this.tmp.createFile(t)].join("\n\n##################\n\n"), i = this.getEffort(e), a = [
|
|
45
|
+
"-p",
|
|
46
|
+
`${r} -- Output strictly the code/answer. No preamble, no chatter, no reasoning`,
|
|
42
47
|
...e ? ["--model", e] : [],
|
|
43
|
-
"--
|
|
48
|
+
...i ? ["--effort", i] : [],
|
|
49
|
+
"--dangerously-skip-permissions"
|
|
44
50
|
];
|
|
45
51
|
try {
|
|
46
|
-
L("agy",
|
|
52
|
+
L("agy", a, {
|
|
47
53
|
encoding: "utf8",
|
|
48
54
|
env: { ...process.env }
|
|
49
55
|
}, (e, t, r) => {
|
|
@@ -692,6 +698,10 @@ ${e}\n\`\`\``);
|
|
|
692
698
|
if (i) return i;
|
|
693
699
|
}
|
|
694
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
|
+
}
|
|
695
705
|
async toAiJson(e, t, n) {
|
|
696
706
|
let r = await this.toAi(e, t, n);
|
|
697
707
|
if (r) try {
|
|
@@ -1044,7 +1054,7 @@ ${e}\n\`\`\``);
|
|
|
1044
1054
|
await Promise.all(Array.from({ length: Math.min(this.AI_TYPES_CONCURRENCY, n) }, () => a()));
|
|
1045
1055
|
}
|
|
1046
1056
|
async toAiEdit(e, t) {
|
|
1047
|
-
return await this.ai.
|
|
1057
|
+
return await this.ai.toAiCode(e, Xe, t);
|
|
1048
1058
|
}
|
|
1049
1059
|
}, Qe = class {
|
|
1050
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.
|
|
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": [
|