@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/CHANGELOG.md CHANGED
@@ -2,15 +2,53 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file.
4
4
 
5
+ ## [1.1.4] - 2026-09-08
6
+
7
+ ### Added
8
+ - **`AiAntigravityCli` & `AiAntigravityCliLite` AI Providers**:
9
+ - 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.
10
+ - Added support for `'antigravity-cli'` provider identifier in `AiType` (`src/types/configTypes.ts`) and registry-based factory resolution in `useAi()` (`src/composables/useAi.ts`).
11
+ - Exported `AiAntigravityCli` and `AiAntigravityCliLite` in `src/library.ts`.
12
+ - Added unit test suite in `src/classes/Ai/__tests__/AiAntigravityCli.test.ts` and updated `src/composables/__tests__/useAi.test.ts`.
13
+ - **`DesignScreenshotDescription` Analysis Class**:
14
+ - 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`).
15
+ - Added prompt templates `aiScreenshotDescription.en.md` and `aiScreenshotDescription.ru.md` instructing AI to identify and describe visible components and documentation showcases.
16
+ - Added `DesignScreenshotItem` and `DesignScreenshotList` types in `src/types/screenshotTypes.ts`.
17
+ - Added comprehensive test suite in `src/classes/Design/__tests__/DesignScreenshotDescription.test.ts`.
18
+ - **`LibraryAiPromptScreenshot` Handler**:
19
+ - Implemented dedicated `LibraryAiPromptScreenshot` class (`src/classes/Library/LibraryAiPromptScreenshot.ts`) to modularize screenshot handling, artifact copying, and visual context generation.
20
+ - Added support for copying `screenshot-code.html` and `screenshot-styles.css` into isolated project directories under `ai-packages-types/<project-folder>/`.
21
+ - Added automatic annotation of screenshot image references in `ai-prompt.md` with descriptions loaded from `screenshot.json`.
22
+ - 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`.
23
+ - Added unit test suite in `src/classes/Library/__tests__/LibraryAiPromptScreenshot.test.ts`.
24
+ - **Global AI Prompt Rule for Visual Context**:
25
+ - 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.
26
+ - **Storybook Documentation for AI Providers**:
27
+ - Added multi-language Storybook documentation (EN, RU, VI) for `AiAntigravityCli` and `AiAntigravityCliLite` in `src/storybook/classes/`.
28
+ - 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`).
29
+ - Updated AI Configuration Storybook documentation (`src/storybook/ai/config/config.*.mdx`) with updated provider lists and configuration details.
30
+
31
+ ### Changed
32
+ - **AI Prompt Generation (`LibraryAiPrompt` & `LibraryAiPromptItem`)**:
33
+ - Updated `LibraryAiPrompt.make()` to clean and recreate `ai-packages-types` on each run, ensuring removal of stale type declarations and screenshot artifacts.
34
+ - Updated `LibraryAiPromptItem` to store package type definitions in dedicated project subdirectories (`ai-packages-types/<project-folder>/ai-types.md`) instead of flat files.
35
+ - Refactored `LibraryAiPromptItem` to delegate all screenshot operations directly to `LibraryAiPromptScreenshot`.
36
+ - **Multimodal AI Payload (`AiGoogleLite`)**:
37
+ - Fixed `@google/genai` request payload for multimodal inputs by properly structuring user message parts.
38
+ - **Type Definitions (`screenshotTypes.ts`)**:
39
+ - Standardized property order (`width` before `height`) and sorted types and constants alphabetically.
40
+
5
41
  ## [1.1.2] - 2026-09-07
6
42
 
7
43
  ### Fixed
8
44
  - **Web-Types Generator AST Parsing (`DesignWikiStormItem`)**:
9
45
  - Replaced runtime dynamic Node.js ESM imports (`await import(...)`) of `wikiData.ts` with static TypeScript AST parsing via the TypeScript Compiler API (`ts.createSourceFile`).
10
46
  - Fixed `ERR_MODULE_NOT_FOUND` resolution errors occurring when `@dxtmisha/scripts` is installed and executed as an external package in consumer repositories containing extensionless TypeScript imports (`'../../../wiki/wiki'`, `'./props'`).
11
- - Added AST-based extraction for default prop values (`getDefaultsFromProps`) from `props.ts` and design wiki configurations (`getWikiDesign`) from `src/wiki/wiki.ts`.
47
+ - Added recursive scanning and parsing of all files in the `src/wiki/` directory (e.g. `wikiStyle.ts`, `wiki.ts`, `wikiDescriptions.ts`), merging all `wiki*` dictionaries and descriptions into a centralized AST cache (`wikiDesignCache`).
48
+ - Added AST evaluation for `PropertyAccessExpression` nodes, supporting `StorybookControl.*` (e.g. `'select'`, `'boolean'`, `'number'`, `'string'`) and `StorybookCategory.*` (e.g. `'Styles'`, `'Actions'`, `'Adaptive'`, `'ARIA'`) enum values.
49
+ - Added AST-based extraction for default prop values (`getDefaultsFromProps`) from `props.ts`.
12
50
  - Fixed TypeScript typing in `getSlots()` by removing unsupported `description` access on `StorybookSlotProperty`.
13
- - Updated unit tests in `src/classes/Design/__tests__/DesignWikiStorm.test.ts` to test AST metadata extraction.
51
+ - Updated unit tests in `src/classes/Design/__tests__/DesignWikiStorm.test.ts` to test AST metadata extraction, directory scanning, and enum evaluation.
14
52
 
15
53
  ## [1.1.1] - 2026-09-07
16
54
 
@@ -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: [...this.toImages(), { parts: [...this.toContents(), { text: t }] }],
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"], ee = ["src", v], j = ["src", "library.ts"], M = [
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
- ], N = ".gitignore", P = "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 = "flags", U = "media", W = "design", G = "plugin", K = "style", q = "wiki", J = "vite.config.ts", Y = "vite-workers.config.ts", X = "index.ts", Z = "ai-types.md", Q = "ai-description.md", $ = "ai-mcp-resources.json", te = "ai-mcp-all-resources.json", ne = "ai-mcp-all-resources.ts", re = "style.scss", ie = "ui-properties.scss", ae = "scss", oe = "classes", se = [
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, j as UI_DIRS_FILE_EXPORT, E as UI_DIRS_ICONS, A as UI_DIRS_LIBRARY, M as UI_DIRS_LIST_EXPORT, k as UI_DIRS_STYLES, T as UI_DIRS_TOKENS, ee 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, ae as UI_EXTENSION_STYLE, Q as UI_FILE_AI_DESCRIPTION, $ as UI_FILE_AI_MCP, te as UI_FILE_AI_MCP_ALL, ne 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, B as UI_FILE_AI_PROMPT_TYPES, Z as UI_FILE_AI_TYPES, N as UI_FILE_GITIGNORE, X as UI_FILE_INDEX, W as UI_FILE_NAME_DESIGN, H as UI_FILE_NAME_FLAGS, U as UI_FILE_NAME_MEDIA, G as UI_FILE_NAME_PLUGIN, K as UI_FILE_NAME_STYLE, J as UI_FILE_NAME_VITE, Y as UI_FILE_NAME_VITE_WORKERS, q as UI_FILE_NAME_WIKI, P as UI_FILE_PACKAGE, F as UI_FILE_PROPERTY, ie as UI_FILE_STYLE_PROPERTIES, re 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, se as UI_PROPERTY_FOR_PROPS, oe as UI_STRUCTURE_CLASSES };
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 };
@@ -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-P-St-CZL.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-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 };
@@ -3608,10 +3608,41 @@ defineOptions({
3608
3608
  let n = A(t.getProjectName());
3609
3609
  return e.writeByPath(oe, `@forward "./src/styles/${n}/style.scss";`), this;
3610
3610
  }
3611
- }, Tr = class {
3611
+ }, Tr = {
3612
+ text: "text",
3613
+ string: "string",
3614
+ number: "number",
3615
+ boolean: "boolean",
3616
+ select: "select",
3617
+ array: "array",
3618
+ object: "object"
3619
+ }, Er = {
3620
+ actions: "Actions",
3621
+ adaptive: "Adaptive",
3622
+ aria: "ARIA",
3623
+ arrow: "Arrow",
3624
+ attributes: "Attributes",
3625
+ bars: "Bars",
3626
+ counter: "Counter",
3627
+ form: "Form",
3628
+ hook: "Hook",
3629
+ icon: "Icon",
3630
+ information: "Information",
3631
+ mask: "Mask",
3632
+ option: "Options",
3633
+ search: "Search",
3634
+ sort: "Sort",
3635
+ status: "Status",
3636
+ style: "Styles",
3637
+ technical: "Technical",
3638
+ text: "Text",
3639
+ value: "Values"
3640
+ }, Dr = class n {
3612
3641
  project;
3613
3642
  path;
3614
3643
  data;
3644
+ static wikiDesignCache;
3645
+ static wikiDescriptionsCache;
3615
3646
  wiki;
3616
3647
  dataComponent;
3617
3648
  constructor(e, t, n) {
@@ -3742,24 +3773,11 @@ defineOptions({
3742
3773
  getPaths(e) {
3743
3774
  return [...this.getDirs(), ...e];
3744
3775
  }
3776
+ getWikiDescriptions() {
3777
+ return n.wikiDescriptionsCache || this.loadWikiFiles(), n.wikiDescriptionsCache;
3778
+ }
3745
3779
  getWikiDesign() {
3746
- let t = [
3747
- ".",
3748
- "src",
3749
- "wiki",
3750
- "wiki.ts"
3751
- ];
3752
- if (e.is(t)) {
3753
- let n = e.readFileOnly(t);
3754
- if (n) {
3755
- let e = M.createSourceFile("wiki.ts", n, M.ScriptTarget.Latest, !0), t = this.extractVariables(e);
3756
- for (let [e, n] of t.entries()) if (e.startsWith("wiki")) {
3757
- let e = this.evalNode(n, t);
3758
- if (w(e)) return e;
3759
- }
3760
- }
3761
- }
3762
- return {};
3780
+ return n.wikiDesignCache ? n.wikiDesignCache : (this.loadWikiFiles(), n.wikiDesignCache ?? {});
3763
3781
  }
3764
3782
  cleanType(e) {
3765
3783
  let t = e.trim();
@@ -3803,6 +3821,13 @@ defineOptions({
3803
3821
  }
3804
3822
  return n;
3805
3823
  }
3824
+ if (M.isPropertyAccessExpression(e)) {
3825
+ let n = e.expression.getText().replace(/^['"]|['"]$/g, ""), r = e.name.text;
3826
+ if (n === "StorybookControl") return Tr[r] ?? r;
3827
+ if (n === "StorybookCategory") return Er[r] ?? r;
3828
+ let i = this.evalNode(e.expression, t);
3829
+ return w(i) && r in i ? i[r] : r;
3830
+ }
3806
3831
  if (M.isIdentifier(e)) {
3807
3832
  let n = e.text;
3808
3833
  return t.has(n) ? this.evalNode(t.get(n), t) : void 0;
@@ -3819,11 +3844,40 @@ defineOptions({
3819
3844
  async initWiki() {
3820
3845
  let e = await this.getData();
3821
3846
  if (e) {
3822
- let { WikiStorybook: t } = await import("@dxtmisha/wiki"), { wiki: n, wikiDescriptions: r } = await import("@dxtmisha/wiki/media");
3823
- return new t(e.component, e.props, e.defaults, e.wikiDesign, n, r);
3847
+ let { WikiStorybook: t } = await import("@dxtmisha/wiki"), { wiki: n, wikiDescriptions: r } = await import("@dxtmisha/wiki/media"), i = this.getWikiDescriptions(), a = i && i.length > 0 ? [...r, ...i] : r;
3848
+ return new t(e.component, e.props, e.defaults, e.wikiDesign, n, a);
3849
+ }
3850
+ }
3851
+ loadWikiFiles() {
3852
+ if (n.wikiDesignCache) return;
3853
+ let t = [[
3854
+ ".",
3855
+ "src",
3856
+ "wiki"
3857
+ ], ["src", "wiki"]].find((t) => e.is(t));
3858
+ if (!t) {
3859
+ n.wikiDesignCache = {};
3860
+ return;
3861
+ }
3862
+ let r = e.readDirRecursive(t).filter((e) => e.endsWith(".ts") || e.endsWith(".js")), i = /* @__PURE__ */ new Map();
3863
+ for (let n of r) {
3864
+ let r = [...t, n], a = e.readFileOnly(r);
3865
+ if (a) {
3866
+ let e = M.createSourceFile(n, a, M.ScriptTarget.Latest, !0), t = this.extractVariables(e);
3867
+ for (let [e, n] of t.entries()) i.set(e, n);
3868
+ }
3869
+ }
3870
+ let a = {};
3871
+ for (let [e, t] of i.entries()) if (e === "wikiDescriptions" || e.endsWith("Descriptions")) {
3872
+ let e = this.evalNode(t, i);
3873
+ S(e) && (n.wikiDescriptionsCache = e);
3874
+ } else if (e.startsWith("wiki")) {
3875
+ let e = this.evalNode(t, i);
3876
+ w(e) && Object.assign(a, e);
3824
3877
  }
3878
+ n.wikiDesignCache = a;
3825
3879
  }
3826
- }, Er = class {
3880
+ }, Or = class {
3827
3881
  dir;
3828
3882
  components;
3829
3883
  constructor(e = "dist") {
@@ -3849,7 +3903,7 @@ defineOptions({
3849
3903
  async getComponents() {
3850
3904
  let e = g(), t = [];
3851
3905
  if (e) for (let n of this.components.getComponentList()) {
3852
- let r = new Tr(e.name, this.components.getComponentsPath(), n);
3906
+ let r = new Dr(e.name, this.components.getComponentsPath(), n);
3853
3907
  await r.init();
3854
3908
  let i = await r.get();
3855
3909
  i && t.push(i);
@@ -3858,4 +3912,4 @@ defineOptions({
3858
3912
  }
3859
3913
  };
3860
3914
  //#endregion
3861
- export { Te as ComponentCreator, Rn as DesignConstructors, Kn as DesignFlags, wr as DesignUi, Er as DesignWikiStorm, fe as PackageInit };
3915
+ export { Te as ComponentCreator, Rn as DesignConstructors, Kn as DesignFlags, wr as DesignUi, Or as DesignWikiStorm, fe as PackageInit };