@dxtmisha/scripts 0.11.8 → 1.1.0
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 +77 -0
- package/ai-resources/componentMaterials.md +19 -0
- package/ai-resources/componentPrompt.md +381 -0
- package/ai-resources/componentWiki.md +13 -0
- package/bin/arguments.ts +168 -0
- package/bin/build-packages.ts +34 -3
- package/bin/build-publish-packages.ts +12 -2
- package/bin/design-component.ts +7 -1
- package/bin/design-constructor.ts +22 -3
- package/bin/design-figma.ts +26 -4
- package/bin/design-flags.ts +14 -2
- package/bin/design-library.ts +7 -1
- package/bin/design-package.ts +29 -5
- package/bin/design-prompt.ts +27 -3
- package/bin/design-screenshot.ts +12 -2
- package/bin/design-types-save.ts +32 -5
- package/bin/design-types.ts +32 -6
- package/bin/design-ui.ts +21 -3
- package/bin/design-wiki-storm.ts +11 -3
- package/dist/AiZAi-BiLAcdFy.js +232 -0
- package/dist/PropertiesConfig-BKZz_FWW.js +262 -0
- package/{src/config.ts → dist/config.d.ts} +185 -158
- package/dist/config.js +20 -0
- package/dist/figmaApiTypes-CArSsNW8.js +6 -0
- package/dist/library-ai.d.ts +482 -0
- package/dist/library-ai.js +2 -0
- package/dist/library-figma.d.ts +462 -0
- package/dist/library-figma.js +75 -0
- package/dist/library-ui.d.ts +586 -0
- package/dist/library-ui.js +3760 -0
- package/dist/library.d.ts +4910 -0
- package/dist/library.js +1568 -0
- package/dist/propertyTypes-C64u6rT3.js +236 -0
- package/package.json +76 -27
- package/bin/ai-doc.ts +0 -7
- package/bin/build-functional.ts +0 -5
- package/bin/design-component-wiki.ts +0 -11
- package/src/classes/Ai/AiAbstract.ts +0 -242
- package/src/classes/Ai/AiClaude.ts +0 -26
- package/src/classes/Ai/AiClaudeAgent.ts +0 -16
- package/src/classes/Ai/AiClaudeAgentLite.ts +0 -86
- package/src/classes/Ai/AiClaudeCli.ts +0 -24
- package/src/classes/Ai/AiClaudeCliLite.ts +0 -108
- package/src/classes/Ai/AiClaudeLite.ts +0 -112
- package/src/classes/Ai/AiDoc.ts +0 -81
- package/src/classes/Ai/AiDocItem.ts +0 -27
- package/src/classes/Ai/AiDocItemAbstract.ts +0 -209
- package/src/classes/Ai/AiDocItemClasses.ts +0 -27
- package/src/classes/Ai/AiDocItemComposables.ts +0 -20
- package/src/classes/Ai/AiDocType.ts +0 -45
- package/src/classes/Ai/AiGoogle.ts +0 -26
- package/src/classes/Ai/AiGoogleCli.ts +0 -24
- package/src/classes/Ai/AiGoogleCliLite.ts +0 -108
- package/src/classes/Ai/AiGoogleLite.ts +0 -78
- package/src/classes/Ai/AiOpenAi.ts +0 -26
- package/src/classes/Ai/AiOpenAiLite.ts +0 -107
- package/src/classes/Ai/AiZAi.ts +0 -17
- package/src/classes/Ai/AiZAiLite.ts +0 -77
- package/src/classes/Ai/ApiTmp.ts +0 -43
- package/src/classes/BrowserItem.ts +0 -408
- package/src/classes/Build/BuildFunctional.ts +0 -54
- package/src/classes/Build/BuildPackages.ts +0 -137
- package/src/classes/Build/BuildPublishPackages.ts +0 -105
- package/src/classes/BuildItem.ts +0 -187
- package/src/classes/Component/ComponentCreator.ts +0 -45
- package/src/classes/Component/ComponentItem.ts +0 -161
- package/src/classes/Component/ComponentWiki.ts +0 -258
- package/src/classes/Component/ComponentWikiFile.ts +0 -138
- package/src/classes/Design/DesignCommand.ts +0 -243
- package/src/classes/Design/DesignComponent.ts +0 -824
- package/src/classes/Design/DesignConstructor.ts +0 -222
- package/src/classes/Design/DesignConstructors.ts +0 -101
- package/src/classes/Design/DesignFigma.ts +0 -61
- package/src/classes/Design/DesignFlags.ts +0 -215
- package/src/classes/Design/DesignReplace.ts +0 -672
- package/src/classes/Design/DesignScreenshot.ts +0 -140
- package/src/classes/Design/DesignStructure.ts +0 -201
- package/src/classes/Design/DesignStructureClasses.ts +0 -105
- package/src/classes/Design/DesignStructureItemAbstract.ts +0 -52
- package/src/classes/Design/DesignStructureRead.ts +0 -349
- package/src/classes/Design/DesignStructureStyles.ts +0 -45
- package/src/classes/Design/DesignTypes.ts +0 -94
- package/src/classes/Design/DesignTypesAi.ts +0 -135
- package/src/classes/Design/DesignTypesDescription.ts +0 -121
- package/src/classes/Design/DesignTypesMake.ts +0 -460
- package/src/classes/Design/DesignTypesMcp.ts +0 -90
- package/src/classes/Design/DesignTypesPrompts.ts +0 -332
- package/src/classes/Design/DesignTypescript.ts +0 -244
- package/src/classes/Design/DesignUi.ts +0 -143
- package/src/classes/Design/DesignWiki.ts +0 -52
- package/src/classes/Design/DesignWikiStorm.ts +0 -95
- package/src/classes/Design/DesignWikiStormItem.ts +0 -316
- package/src/classes/FigmaApi.ts +0 -190
- package/src/classes/Git/GitRead.ts +0 -261
- package/src/classes/Library/LibraryAiMcpItem.ts +0 -67
- package/src/classes/Library/LibraryAiPrompt.ts +0 -268
- package/src/classes/Library/LibraryAiPromptItem.ts +0 -331
- package/src/classes/Library/LibraryAiWiki.ts +0 -127
- package/src/classes/Library/LibraryAiWikiItem.ts +0 -79
- package/src/classes/Library/LibraryExport.ts +0 -167
- package/src/classes/Library/LibraryFlags.ts +0 -62
- package/src/classes/Library/LibraryItems.ts +0 -138
- package/src/classes/Library/LibraryList.ts +0 -189
- package/src/classes/Library/LibraryMedia.ts +0 -139
- package/src/classes/Library/LibraryPlugin.ts +0 -73
- package/src/classes/Library/LibraryTypes.ts +0 -130
- package/src/classes/Package/PackageFile.ts +0 -154
- package/src/classes/Package/PackageInit.ts +0 -54
- package/src/classes/Package/PackageItem.ts +0 -329
- package/src/classes/Properties/Properties.ts +0 -175
- package/src/classes/Properties/PropertiesCache.ts +0 -248
- package/src/classes/Properties/PropertiesConfig.ts +0 -213
- package/src/classes/Properties/PropertiesConvector.ts +0 -52
- package/src/classes/Properties/PropertiesFile.ts +0 -522
- package/src/classes/Properties/PropertiesImport.ts +0 -182
- package/src/classes/Properties/PropertiesItems.ts +0 -605
- package/src/classes/Properties/PropertiesKeys.ts +0 -121
- package/src/classes/Properties/PropertiesMain.ts +0 -138
- package/src/classes/Properties/PropertiesPalette.ts +0 -149
- package/src/classes/Properties/PropertiesPath.ts +0 -193
- package/src/classes/Properties/PropertiesScss.ts +0 -261
- package/src/classes/Properties/PropertiesSeparator.ts +0 -118
- package/src/classes/Properties/PropertiesSettings.ts +0 -104
- package/src/classes/Properties/PropertiesStandard.ts +0 -180
- package/src/classes/Properties/PropertiesTool.ts +0 -80
- package/src/classes/Properties/PropertiesTypes.ts +0 -147
- package/src/classes/Properties/PropertiesValues.ts +0 -75
- package/src/classes/Properties/PropertiesWrap.ts +0 -187
- package/src/classes/Properties/convector/convectorColor.ts +0 -27
- package/src/classes/Properties/convector/convectorFontFamilies.ts +0 -18
- package/src/classes/Properties/convector/convectorShadow.ts +0 -61
- package/src/classes/Properties/convector/convectorTypography.ts +0 -19
- package/src/classes/Properties/to/PropertiesToAbstract.ts +0 -51
- package/src/classes/Properties/to/PropertiesToAnimate.ts +0 -59
- package/src/classes/Properties/to/PropertiesToClass.ts +0 -49
- package/src/classes/Properties/to/PropertiesToClone.ts +0 -114
- package/src/classes/Properties/to/PropertiesToComponent.ts +0 -52
- package/src/classes/Properties/to/PropertiesToDrag.ts +0 -231
- package/src/classes/Properties/to/PropertiesToDuplicate.ts +0 -165
- package/src/classes/Properties/to/PropertiesToFull.ts +0 -36
- package/src/classes/Properties/to/PropertiesToLink.ts +0 -259
- package/src/classes/Properties/to/PropertiesToMedia.ts +0 -187
- package/src/classes/Properties/to/PropertiesToMulti.ts +0 -101
- package/src/classes/Properties/to/PropertiesToNone.ts +0 -46
- package/src/classes/Properties/to/PropertiesToPalette.ts +0 -241
- package/src/classes/Properties/to/PropertiesToProperty.ts +0 -31
- package/src/classes/Properties/to/PropertiesToRemove.ts +0 -33
- package/src/classes/Properties/to/PropertiesToReplace.ts +0 -77
- package/src/classes/Properties/to/PropertiesToRoot.ts +0 -40
- package/src/classes/Properties/to/PropertiesToSimilar.ts +0 -128
- package/src/classes/Properties/to/PropertiesToSort.ts +0 -146
- package/src/classes/Properties/to/PropertiesToState.ts +0 -65
- package/src/classes/Properties/to/PropertiesToStyle.ts +0 -52
- package/src/classes/Properties/to/PropertiesToSub.ts +0 -95
- package/src/classes/Properties/to/PropertiesToSubclass.ts +0 -76
- package/src/classes/Properties/to/PropertiesToVar.ts +0 -194
- package/src/classes/Properties/to/PropertiesToVariable.ts +0 -176
- package/src/classes/Styles/Styles.ts +0 -247
- package/src/classes/Styles/StylesClasses.ts +0 -86
- package/src/classes/Styles/StylesProperties.ts +0 -197
- package/src/classes/Styles/StylesRoot.ts +0 -103
- package/src/classes/Styles/StylesTool.ts +0 -112
- package/src/classes/Styles/to/StylesToAbstract.ts +0 -93
- package/src/classes/Styles/to/StylesToAnimate.ts +0 -19
- package/src/classes/Styles/to/StylesToClass.ts +0 -25
- package/src/classes/Styles/to/StylesToClassFull.ts +0 -19
- package/src/classes/Styles/to/StylesToContainer.ts +0 -24
- package/src/classes/Styles/to/StylesToMedia.ts +0 -19
- package/src/classes/Styles/to/StylesToProperty.ts +0 -123
- package/src/classes/Styles/to/StylesToRoot.ts +0 -14
- package/src/classes/Styles/to/StylesToSelector.ts +0 -71
- package/src/classes/Styles/to/StylesToVar.ts +0 -105
- package/src/classes/Styles/to/StylesToVirtual.ts +0 -33
- package/src/composables/useAi.ts +0 -38
- package/src/demo/ai.ts +0 -10
- package/src/functions/getComponentPaths.ts +0 -13
- package/src/functions/getConfigAi.ts +0 -14
- package/src/functions/getConstructorProperties.ts +0 -54
- package/src/functions/getDirname.ts +0 -17
- package/src/functions/getNameDirByPaths.ts +0 -16
- package/src/functions/getPackageJson.ts +0 -19
- package/src/functions/hasNativeDirname.ts +0 -8
- package/src/functions/run.ts +0 -47
- package/src/functions/toPathStandardSep.ts +0 -14
- package/src/library-ai.ts +0 -10
- package/src/library.ts +0 -73
- package/src/media/ai/ai-doc-types.ts +0 -21
- package/src/media/properties/css.ts +0 -634
- package/src/media/properties/cssSelector.ts +0 -74
- package/src/media/properties/cssVirtual.ts +0 -12
- package/src/media/properties/listSort.ts +0 -113
- package/src/media/properties/style.ts +0 -81
- package/src/media/templates/component/DesignComponent.mdx +0 -30
- package/src/media/templates/component/DesignComponent.stories.ts +0 -34
- package/src/media/templates/component/DesignComponent.vue +0 -54
- package/src/media/templates/component/DesignComponentAiWiki.vue +0 -25
- package/src/media/templates/component/index.ts +0 -13
- package/src/media/templates/component/props.ts +0 -27
- package/src/media/templates/component/styleToken.scss +0 -17
- package/src/media/templates/component/wiki.ts +0 -13
- package/src/media/templates/component/wikiData.ts +0 -28
- package/src/media/templates/componentDoc/ComponentDoc.vue +0 -26
- package/src/media/templates/componentDoc/index.ts +0 -12
- package/src/media/templates/componentDoc/materials/README.md +0 -8
- package/src/media/templates/componentDoc/materials/prompt.md +0 -38
- package/src/media/templates/componentDoc/subcomponents/_.gitignore.txt +0 -0
- package/src/media/templates/componentDoc/types.ts +0 -15
- package/src/media/templates/componentDoc/wiki/ComponentDoc.mdx +0 -13
- package/src/media/templates/componentDoc/wiki/ComponentDoc.stories.ts +0 -24
- package/src/media/templates/componentDoc/wiki/prompt.md +0 -41
- package/src/media/templates/constructors/Constructors.ts +0 -33
- package/src/media/templates/constructors/ConstructorsDesign.tsx +0 -129
- package/src/media/templates/constructors/basicTypes.ts +0 -0
- package/src/media/templates/constructors/index.ts +0 -5
- package/src/media/templates/constructors/props.ts +0 -28
- package/src/media/templates/constructors/style.scss +0 -5
- package/src/media/templates/constructors/types.ts +0 -47
- package/src/media/templates/packages/figma/README.md +0 -1
- package/src/media/templates/packages/figma/_.gitignore.txt +0 -29
- package/src/media/templates/packages/figma/ai.sample.config.ts +0 -2
- package/src/media/templates/packages/figma/design.config.json +0 -3
- package/src/media/templates/packages/figma/index.html +0 -12
- package/src/media/templates/packages/figma/manifest.json +0 -25
- package/src/media/templates/packages/figma/package.json +0 -37
- package/src/media/templates/packages/figma/src/App.vue +0 -9
- package/src/media/templates/packages/figma/src/classes/_.gitignore.txt +0 -1
- package/src/media/templates/packages/figma/src/code.ts +0 -16
- package/src/media/templates/packages/figma/src/components/_.gitignore.txt +0 -1
- package/src/media/templates/packages/figma/src/composables/_.gitignore.txt +0 -1
- package/src/media/templates/packages/figma/src/config.ts +0 -0
- package/src/media/templates/packages/figma/src/functions/_.gitignore.txt +0 -1
- package/src/media/templates/packages/figma/src/library.ts +0 -0
- package/src/media/templates/packages/figma/src/main.ts +0 -4
- package/src/media/templates/packages/figma/src/media/_.gitignore.txt +0 -1
- package/src/media/templates/packages/figma/src/storybook/_.gitignore.txt +0 -1
- package/src/media/templates/packages/figma/src/types/_.gitignore.txt +0 -1
- package/src/media/templates/packages/figma/src/vite-env.d.ts +0 -1
- package/src/media/templates/packages/figma/tsconfig.app.json +0 -12
- package/src/media/templates/packages/figma/tsconfig.json +0 -7
- package/src/media/templates/packages/figma/tsconfig.node.json +0 -8
- package/src/media/templates/packages/figma/vite.config.ts +0 -7
- package/src/media/templates/packages/library/README.md +0 -1
- package/src/media/templates/packages/library/_.gitignore.txt +0 -27
- package/src/media/templates/packages/library/ai-description.md +0 -15
- package/src/media/templates/packages/library/design.config.json +0 -3
- package/src/media/templates/packages/library/index.html +0 -12
- package/src/media/templates/packages/library/materials/README.md +0 -8
- package/src/media/templates/packages/library/materials/prompt.md +0 -45
- package/src/media/templates/packages/library/package.json +0 -46
- package/src/media/templates/packages/library/src/App.vue +0 -8
- package/src/media/templates/packages/library/src/classes/_.gitignore.txt +0 -1
- package/src/media/templates/packages/library/src/components/_.gitignore.txt +0 -1
- package/src/media/templates/packages/library/src/composables/_.gitignore.txt +0 -1
- package/src/media/templates/packages/library/src/functions/_.gitignore.txt +0 -1
- package/src/media/templates/packages/library/src/library.ts +0 -0
- package/src/media/templates/packages/library/src/main.ts +0 -6
- package/src/media/templates/packages/library/src/style.scss +0 -0
- package/src/media/templates/packages/library/src/types/_.gitignore.txt +0 -1
- package/src/media/templates/packages/library/src/vite-env.d.ts +0 -1
- package/src/media/templates/packages/library/tsconfig.app.json +0 -11
- package/src/media/templates/packages/library/tsconfig.json +0 -7
- package/src/media/templates/packages/library/tsconfig.node.json +0 -7
- package/src/media/templates/packages/library/vite.config.ts +0 -14
- package/src/media/templates/packages/nitro/README.md +0 -1
- package/src/media/templates/packages/nitro/_.gitignore.txt +0 -28
- package/src/media/templates/packages/nitro/index.html +0 -2
- package/src/media/templates/packages/nitro/package.json +0 -25
- package/src/media/templates/packages/nitro/server/plugins/ui-plugin.ts +0 -7
- package/src/media/templates/packages/nitro/server/routes/api/hello.ts +0 -13
- package/src/media/templates/packages/nitro/src/App.vue +0 -10
- package/src/media/templates/packages/nitro/src/assets/_.gitignore.txt +0 -0
- package/src/media/templates/packages/nitro/src/components/_.gitignore.txt +0 -0
- package/src/media/templates/packages/nitro/src/composables/_.gitignore.txt +0 -0
- package/src/media/templates/packages/nitro/src/entry-client.ts +0 -13
- package/src/media/templates/packages/nitro/src/entry-server.ts +0 -29
- package/src/media/templates/packages/nitro/src/main.ts +0 -14
- package/src/media/templates/packages/nitro/src/pages/HomePage.vue +0 -8
- package/src/media/templates/packages/nitro/src/router.ts +0 -11
- package/src/media/templates/packages/nitro/src/style.scss +0 -0
- package/src/media/templates/packages/nitro/src/templates/main.html +0 -21
- package/src/media/templates/packages/nitro/src/vite-env.d.ts +0 -11
- package/src/media/templates/packages/nitro/tsconfig.app.json +0 -14
- package/src/media/templates/packages/nitro/tsconfig.json +0 -7
- package/src/media/templates/packages/nitro/tsconfig.node.json +0 -12
- package/src/media/templates/packages/nitro/vite.config.ts +0 -17
- package/src/media/templates/packages/project/README.md +0 -1
- package/src/media/templates/packages/project/_.gitignore.txt +0 -28
- package/src/media/templates/packages/project/design.config.json +0 -3
- package/src/media/templates/packages/project/index.html +0 -12
- package/src/media/templates/packages/project/materials/README.md +0 -8
- package/src/media/templates/packages/project/materials/prompt.md +0 -41
- package/src/media/templates/packages/project/package.json +0 -13
- package/src/media/templates/packages/project/public/_.gitignore.txt +0 -0
- package/src/media/templates/packages/project/src/App.vue +0 -12
- package/src/media/templates/packages/project/src/assets/_.gitignore.txt +0 -0
- package/src/media/templates/packages/project/src/components/_.gitignore.txt +0 -0
- package/src/media/templates/packages/project/src/composables/_.gitignore.txt +0 -0
- package/src/media/templates/packages/project/src/main.ts +0 -6
- package/src/media/templates/packages/project/src/style.scss +0 -0
- package/src/media/templates/packages/project/src/vite-env.d.ts +0 -1
- package/src/media/templates/packages/project/tsconfig.app.json +0 -11
- package/src/media/templates/packages/project/tsconfig.json +0 -7
- package/src/media/templates/packages/project/tsconfig.node.json +0 -7
- package/src/media/templates/packages/project/vite.config.ts +0 -7
- package/src/media/templates/prompts/aiCodeGlobalPrompt.en.md +0 -22
- package/src/media/templates/prompts/aiCodeGlobalPrompt.ru.md +0 -21
- package/src/media/templates/prompts/aiCodeVuePrompt.en.md +0 -17
- package/src/media/templates/prompts/aiCodeVuePrompt.ru.md +0 -17
- package/src/media/templates/prompts/aiDocClassPrompt.en.txt +0 -63
- package/src/media/templates/prompts/aiDocClassPrompt.ru.txt +0 -63
- package/src/media/templates/prompts/aiDocComposablePrompt.en.txt +0 -67
- package/src/media/templates/prompts/aiDocComposablePrompt.ru.txt +0 -67
- package/src/media/templates/prompts/aiDocFunctionPrompt.en.txt +0 -57
- package/src/media/templates/prompts/aiDocFunctionPrompt.ru.txt +0 -57
- package/src/media/templates/prompts/componentPrompt.en.txt +0 -182
- package/src/media/templates/prompts/componentPrompt.ru.txt +0 -182
- package/src/media/templates/prompts/demoClassEn.mdx +0 -111
- package/src/media/templates/prompts/demoClassRu.mdx +0 -111
- package/src/media/templates/prompts/demoComponentEn.mdx +0 -282
- package/src/media/templates/prompts/demoComponentRu.mdx +0 -282
- package/src/media/templates/prompts/demoComposableEn.mdx +0 -103
- package/src/media/templates/prompts/demoComposableRu.mdx +0 -103
- package/src/media/templates/prompts/demoDocEn.mdx +0 -30
- package/src/media/templates/prompts/demoDocRu.mdx +0 -30
- package/src/media/templates/viteComponentTemplateConfig.ts +0 -14
- package/src/types/aiTypes.ts +0 -19
- package/src/types/configTypes.ts +0 -69
- package/src/types/designTypes.ts +0 -167
- package/src/types/figmaApiTypes.ts +0 -337
- package/src/types/gitTypes.ts +0 -59
- package/src/types/libraryTypes.ts +0 -49
- package/src/types/propertyTypes.ts +0 -586
- package/src/types/screenshotTypes.ts +0 -55
- package/src/types/webTypes.ts +0 -134
- package/src/vite-env.d.ts +0 -1
|
@@ -1,268 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
UI_FILE_AI_MCP_ALL,
|
|
3
|
-
UI_FILE_AI_PROMPT_INSTRUCTION,
|
|
4
|
-
UI_FILE_AI_PROMPT_PROMPT,
|
|
5
|
-
UI_MODULES
|
|
6
|
-
} from '../../config'
|
|
7
|
-
|
|
8
|
-
import { PropertiesFile } from '../Properties/PropertiesFile'
|
|
9
|
-
import { LibraryAiPromptItem } from './LibraryAiPromptItem'
|
|
10
|
-
|
|
11
|
-
import vuePromptText from '../../media/templates/prompts/aiCodeVuePrompt.en.md?raw'
|
|
12
|
-
import globalPromptText from '../../media/templates/prompts/aiCodeGlobalPrompt.en.md?raw'
|
|
13
|
-
|
|
14
|
-
const LIBRARY_AI_PROMPT_LIST_DIRS = [
|
|
15
|
-
UI_MODULES
|
|
16
|
-
]
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* Class for generating a consolidated AI prompt for the library.
|
|
20
|
-
* It scans directories for prompt items and instructions to create a final prompt file.
|
|
21
|
-
*
|
|
22
|
-
* Класс для генерации консолидированного промпта ИИ для библиотеки.
|
|
23
|
-
* Сканирует директории на наличие элементов промпта и инструкций для создания итогового файла промпта.
|
|
24
|
-
*/
|
|
25
|
-
export class LibraryAiPrompt {
|
|
26
|
-
/** List of directories to scan. / Список директорий для сканирования. */
|
|
27
|
-
protected readonly dirs: string[]
|
|
28
|
-
|
|
29
|
-
/** Regular expression to identify files in directories. / Регулярное выражение для идентификации файлов в директориях. */
|
|
30
|
-
protected readonly exFileOnDirs = /^.+\.[^.]{2,4}$/
|
|
31
|
-
/** Regular expression to exclude hidden files/directories. / Регулярное выражение для исключения скрытых файлов/директорий. */
|
|
32
|
-
protected readonly exNotRead = /^\./
|
|
33
|
-
|
|
34
|
-
/**
|
|
35
|
-
* Constructor for LibraryAiPrompt.
|
|
36
|
-
*
|
|
37
|
-
* Конструктор для LibraryAiPrompt.
|
|
38
|
-
* @param dirs Additional directories to scan / Дополнительные директории для сканирования
|
|
39
|
-
* @param isMcp Flag indicating whether to generate MCP configuration file / Флаг, указывающий, нужно ли генерировать конфигурационный файл MCP
|
|
40
|
-
*/
|
|
41
|
-
constructor(
|
|
42
|
-
dirs: string[] = [],
|
|
43
|
-
protected readonly isMcp: boolean = false
|
|
44
|
-
) {
|
|
45
|
-
this.dirs = [
|
|
46
|
-
...LIBRARY_AI_PROMPT_LIST_DIRS,
|
|
47
|
-
...dirs
|
|
48
|
-
]
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
/**
|
|
52
|
-
* Main method to generate the AI prompt file.
|
|
53
|
-
*
|
|
54
|
-
* Основной метод для генерации файла промпта ИИ.
|
|
55
|
-
*/
|
|
56
|
-
make(): void {
|
|
57
|
-
console.log('Generating AI prompt...')
|
|
58
|
-
|
|
59
|
-
const list = this.getList()
|
|
60
|
-
const prompts = [
|
|
61
|
-
`
|
|
62
|
-
# System Role: AI Coding Assistant & Project Analyzer
|
|
63
|
-
Consolidated documentation, architectural guidelines, and mandatory rules for the project.
|
|
64
|
-
`.trim(),
|
|
65
|
-
this.getGlobalPrompt(),
|
|
66
|
-
this.getVuePrompt()
|
|
67
|
-
]
|
|
68
|
-
const mcpData: Record<string, any>[] = []
|
|
69
|
-
|
|
70
|
-
if (list.length > 0) {
|
|
71
|
-
list.forEach((item) => {
|
|
72
|
-
const prompt = item.make()
|
|
73
|
-
|
|
74
|
-
if (prompt) {
|
|
75
|
-
prompts.push(prompt)
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
if (this.isMcp) {
|
|
79
|
-
const mcp = item.getMcp()
|
|
80
|
-
|
|
81
|
-
if (mcp) {
|
|
82
|
-
mcpData.push(...mcp)
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
})
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
const instruction = this.getInstruction()
|
|
89
|
-
|
|
90
|
-
if (instruction) {
|
|
91
|
-
prompts.push(instruction)
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
prompts.push(this.getAuditPrompt())
|
|
95
|
-
|
|
96
|
-
this.write(prompts)
|
|
97
|
-
|
|
98
|
-
if (this.isMcp) {
|
|
99
|
-
this.writeMcp(mcpData)
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
console.log('end')
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
/**
|
|
106
|
-
* Checks if there are any files in the provided list.
|
|
107
|
-
*
|
|
108
|
-
* Проверяет, есть ли файлы в предоставленном списке.
|
|
109
|
-
* @param dirs list of file/directory names / список имен файлов/директорий
|
|
110
|
-
* @returns true if any file is found / true, если найден хотя бы один файл
|
|
111
|
-
* @protected
|
|
112
|
-
*/
|
|
113
|
-
protected isFileOnDirs(dirs: string[]): boolean {
|
|
114
|
-
return dirs.some(path => this.exFileOnDirs.test(path))
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
/**
|
|
118
|
-
* Retrieves the final self-audit prompt for AI code verification.
|
|
119
|
-
*
|
|
120
|
-
* Получает итоговый промпт самоаудита для проверки кода ИИ.
|
|
121
|
-
* @returns formatted audit prompt / отформатированный промпт аудита
|
|
122
|
-
* @protected
|
|
123
|
-
*/
|
|
124
|
-
protected getAuditPrompt(): string {
|
|
125
|
-
return `
|
|
126
|
-
## Mandatory Final Self-Audit (CRITICAL GUARD & STRICT COMPLIANCE)
|
|
127
|
-
|
|
128
|
-
🔴 **STOP! BEFORE DECLARING WORK COMPLETE OR ENDING YOUR TURN, YOU MUST AUDIT ALL CODE!** 🔴
|
|
129
|
-
|
|
130
|
-
1. **Mandatory Full Re-Study**: Inspect EVERY single line of code created or modified in this task.
|
|
131
|
-
2. **Rule-by-Rule Compliance Check**: Cross-reference all code changes against ALL architectural conventions, coding standards, JSDoc/TSDoc guidelines, and package rules defined in \`ai-prompt.md\`.
|
|
132
|
-
3. **Zero Ignored Rules**: Ensure NO project rule, typing constraint, or code structure guideline was bypassed, forgotten, or ignored.
|
|
133
|
-
4. **Self-Correction**: If any discrepancy, missing typing, bad JSDoc formatting, or rule violation is found during this audit, fix it IMMEDIATELY before concluding your turn.
|
|
134
|
-
`.trim()
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
/**
|
|
138
|
-
* Retrieves high-priority instructions from a specific file.
|
|
139
|
-
*
|
|
140
|
-
* Получает высокоприоритетные инструкции из специального файла.
|
|
141
|
-
* @returns formatted instructions or undefined / отформатированные инструкции или undefined
|
|
142
|
-
* @protected
|
|
143
|
-
*/
|
|
144
|
-
protected getInstruction(): string | undefined {
|
|
145
|
-
if (PropertiesFile.is(UI_FILE_AI_PROMPT_INSTRUCTION)) {
|
|
146
|
-
return `
|
|
147
|
-
## High-Priority Directives (Overrides Base Rules)
|
|
148
|
-
${PropertiesFile.readFileOnly(UI_FILE_AI_PROMPT_INSTRUCTION)}
|
|
149
|
-
`.trim()
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
/**
|
|
154
|
-
* Retrieves the Vue component implementation prompt.
|
|
155
|
-
*
|
|
156
|
-
* Получает промпт по реализации Vue-компонентов.
|
|
157
|
-
* @returns formatted Vue prompt or undefined / отформатированный промпт Vue или undefined
|
|
158
|
-
* @protected
|
|
159
|
-
*/
|
|
160
|
-
protected getVuePrompt(): string {
|
|
161
|
-
return `
|
|
162
|
-
## Vue Component Implementation Rules
|
|
163
|
-
${vuePromptText}
|
|
164
|
-
`.trim()
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
/**
|
|
168
|
-
* Retrieves the global code implementation prompt.
|
|
169
|
-
*
|
|
170
|
-
* Получает глобальный промпт по реализации кода.
|
|
171
|
-
* @returns formatted global prompt or undefined / отформатированный глобальный промпт или undefined
|
|
172
|
-
* @protected
|
|
173
|
-
*/
|
|
174
|
-
protected getGlobalPrompt(): string {
|
|
175
|
-
return `
|
|
176
|
-
## Global Code Implementation Rules
|
|
177
|
-
${globalPromptText}
|
|
178
|
-
`.trim()
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
/**
|
|
182
|
-
* Recursively scans directories to collect LibraryAiPromptItem instances.
|
|
183
|
-
*
|
|
184
|
-
* Рекурсивно сканирует директории для сбора экземпляров LibraryAiPromptItem.
|
|
185
|
-
* @param dirs directories to scan / директории для сканирования
|
|
186
|
-
* @param path current path segments / текущие сегменты пути
|
|
187
|
-
* @param limit recursion depth limit / лимит глубины рекурсии
|
|
188
|
-
* @returns list of prompt items / список элементов промпта
|
|
189
|
-
* @protected
|
|
190
|
-
*/
|
|
191
|
-
protected getList(
|
|
192
|
-
dirs: string[] = this.dirs,
|
|
193
|
-
path: string[] = [],
|
|
194
|
-
limit = 4
|
|
195
|
-
): LibraryAiPromptItem[] {
|
|
196
|
-
if (limit <= 0) {
|
|
197
|
-
return []
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
const items: LibraryAiPromptItem[] = []
|
|
201
|
-
|
|
202
|
-
for (const dir of dirs) {
|
|
203
|
-
if (this.exNotRead.test(dir)) {
|
|
204
|
-
continue
|
|
205
|
-
}
|
|
206
|
-
|
|
207
|
-
const pathDir = [...path, dir]
|
|
208
|
-
const list = PropertiesFile.readDir(pathDir)
|
|
209
|
-
|
|
210
|
-
if (
|
|
211
|
-
!this.isFileOnDirs(list)
|
|
212
|
-
|| dir === UI_MODULES
|
|
213
|
-
) {
|
|
214
|
-
items.push(...this.getList(
|
|
215
|
-
list,
|
|
216
|
-
pathDir,
|
|
217
|
-
limit - 1
|
|
218
|
-
))
|
|
219
|
-
} else {
|
|
220
|
-
const promptItem = new LibraryAiPromptItem(pathDir)
|
|
221
|
-
|
|
222
|
-
if (promptItem.isPrompt()) {
|
|
223
|
-
items.push(promptItem)
|
|
224
|
-
}
|
|
225
|
-
}
|
|
226
|
-
}
|
|
227
|
-
|
|
228
|
-
return items
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
/**
|
|
232
|
-
* Writes the collected prompts to a file.
|
|
233
|
-
*
|
|
234
|
-
* Записывает собранные промпты в файл.
|
|
235
|
-
* @param prompts list of prompt strings / список строк промптов
|
|
236
|
-
* @returns this instance / этот экземпляр
|
|
237
|
-
* @protected
|
|
238
|
-
*/
|
|
239
|
-
protected write(prompts: string[]): this {
|
|
240
|
-
PropertiesFile.writeByPath(
|
|
241
|
-
UI_FILE_AI_PROMPT_PROMPT,
|
|
242
|
-
prompts.join(`
|
|
243
|
-
|
|
244
|
-
---
|
|
245
|
-
|
|
246
|
-
`)
|
|
247
|
-
)
|
|
248
|
-
|
|
249
|
-
return this
|
|
250
|
-
}
|
|
251
|
-
|
|
252
|
-
/**
|
|
253
|
-
* Writes the collected MCP definitions to a file.
|
|
254
|
-
*
|
|
255
|
-
* Записывает собранные определения MCP в файл.
|
|
256
|
-
* @param mcpData list of MCP resource definitions / список определений ресурсов MCP
|
|
257
|
-
* @returns this instance / этот экземпляр
|
|
258
|
-
* @protected
|
|
259
|
-
*/
|
|
260
|
-
protected writeMcp(mcpData: Record<string, any>[]): this {
|
|
261
|
-
PropertiesFile.writeByPath(
|
|
262
|
-
UI_FILE_AI_MCP_ALL,
|
|
263
|
-
mcpData
|
|
264
|
-
)
|
|
265
|
-
|
|
266
|
-
return this
|
|
267
|
-
}
|
|
268
|
-
}
|
|
@@ -1,331 +0,0 @@
|
|
|
1
|
-
import { PropertiesFile } from '../Properties/PropertiesFile'
|
|
2
|
-
import { LibraryAiMcpItem } from './LibraryAiMcpItem'
|
|
3
|
-
import { getPackageJson } from '../../functions/getPackageJson'
|
|
4
|
-
|
|
5
|
-
import {
|
|
6
|
-
UI_DIR_AI_PROMPT_SCREENSHOT,
|
|
7
|
-
UI_FILE_AI_PROMPT_DESCRIPTION,
|
|
8
|
-
UI_FILE_AI_PROMPT_DEVELOPER,
|
|
9
|
-
UI_FILE_AI_PROMPT_INFO,
|
|
10
|
-
UI_FILE_AI_PROMPT_TYPES
|
|
11
|
-
} from '../../config'
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* Class representing an item in the AI prompt generation process.
|
|
15
|
-
* Handles reading and aggregating various project-related files (descriptions, info, types, screenshots)
|
|
16
|
-
* to build a context-rich prompt for AI.
|
|
17
|
-
*
|
|
18
|
-
* Класс, представляющий элемент в процессе создания промпта для ИИ.
|
|
19
|
-
* Управляет чтением и агрегацией различных файлов проекта (описания, информация, типы, скриншоты)
|
|
20
|
-
* для создания насыщенного контекстом промпта для ИИ.
|
|
21
|
-
*/
|
|
22
|
-
export class LibraryAiPromptItem {
|
|
23
|
-
/** Item instance for working with MCP files. / Экземпляр элемента для работы с файлами MCP. */
|
|
24
|
-
protected readonly itemMcp: LibraryAiMcpItem
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* Constructor for LibraryAiPromptItem.
|
|
28
|
-
*
|
|
29
|
-
* Конструктор для LibraryAiPromptItem.
|
|
30
|
-
* @param dir Path segments to the directory / Сегменты пути к директории
|
|
31
|
-
*/
|
|
32
|
-
constructor(
|
|
33
|
-
protected readonly dir: string[] = []
|
|
34
|
-
) {
|
|
35
|
-
this.itemMcp = new LibraryAiMcpItem(this.dir)
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
/**
|
|
39
|
-
* Returns directory path segments.
|
|
40
|
-
*
|
|
41
|
-
* Возвращает сегменты пути к директории.
|
|
42
|
-
* @returns path segments / сегменты пути
|
|
43
|
-
*/
|
|
44
|
-
getDir(): string[] {
|
|
45
|
-
return this.dir
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
/**
|
|
49
|
-
* Reads and returns the list of MCP resource definitions from ai-mcp-resources.json.
|
|
50
|
-
*
|
|
51
|
-
* Читает и возвращает список определений ресурсов MCP из ai-mcp-resources.json.
|
|
52
|
-
* @returns list of MCP resource items or undefined / список элементов ресурсов MCP или undefined
|
|
53
|
-
*/
|
|
54
|
-
getMcp(): Record<string, any>[] | undefined {
|
|
55
|
-
return this.itemMcp.make()
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
/**
|
|
59
|
-
* Returns the project name from package.json.
|
|
60
|
-
*
|
|
61
|
-
* Возвращает название проекта из package.json.
|
|
62
|
-
* @returns project name or 'none' / название проекта или 'none'
|
|
63
|
-
*/
|
|
64
|
-
getProjectName(): string {
|
|
65
|
-
return getPackageJson(this.dir)?.name ?? 'none'
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
/**
|
|
69
|
-
* Checks if any prompt-related files or directories exist.
|
|
70
|
-
*
|
|
71
|
-
* Проверяет, существуют ли какие-либо файлы или директории, связанные с промптами.
|
|
72
|
-
* @returns true if any prompt content is found / true, если найден какой-либо контент для промпта
|
|
73
|
-
*/
|
|
74
|
-
isPrompt(): boolean {
|
|
75
|
-
return this.isDescription()
|
|
76
|
-
|| this.isInfo()
|
|
77
|
-
|| this.isTypes()
|
|
78
|
-
|| this.isScreenshot()
|
|
79
|
-
|| this.isDeveloper()
|
|
80
|
-
|| this.isMcp()
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
/**
|
|
84
|
-
* Checks if the description file exists.
|
|
85
|
-
*
|
|
86
|
-
* Проверяет, существует ли файл описания.
|
|
87
|
-
* @returns true if description file exists / true, если файл описания существует
|
|
88
|
-
*/
|
|
89
|
-
isDescription(): boolean {
|
|
90
|
-
return PropertiesFile.is(this.getPath(UI_FILE_AI_PROMPT_DESCRIPTION))
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
/**
|
|
94
|
-
* Checks if the developer prompt file exists.
|
|
95
|
-
*
|
|
96
|
-
* Проверяет, существует ли файл промпта разработчика.
|
|
97
|
-
* @returns true if developer prompt file exists / true, если файл промпта разработчика существует
|
|
98
|
-
*/
|
|
99
|
-
isDeveloper(): boolean {
|
|
100
|
-
return PropertiesFile.is(this.getPath(UI_FILE_AI_PROMPT_DEVELOPER))
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
/**
|
|
104
|
-
* Checks if the information file exists.
|
|
105
|
-
*
|
|
106
|
-
* Проверяет, существует ли файл с информацией.
|
|
107
|
-
* @returns true if info file exists / true, если файл информации существует
|
|
108
|
-
*/
|
|
109
|
-
isInfo(): boolean {
|
|
110
|
-
return PropertiesFile.is(this.getPath(UI_FILE_AI_PROMPT_INFO))
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
/**
|
|
114
|
-
* Checks if the ai-mcp-resources.json file exists.
|
|
115
|
-
*
|
|
116
|
-
* Проверяет, существует ли файл ai-mcp-resources.json.
|
|
117
|
-
* @returns true if ai-mcp-resources.json file exists / true, если файл ai-mcp-resources.json существует
|
|
118
|
-
*/
|
|
119
|
-
isMcp(): boolean {
|
|
120
|
-
return this.itemMcp.isMcp()
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
/**
|
|
124
|
-
* Checks if the screenshot directory exists.
|
|
125
|
-
*
|
|
126
|
-
* Проверяет, существует ли директория со скриншотами.
|
|
127
|
-
* @returns true if screenshot directory exists / true, если директория скриншотов существует
|
|
128
|
-
*/
|
|
129
|
-
isScreenshot(): boolean {
|
|
130
|
-
return PropertiesFile.is(this.getPath(UI_DIR_AI_PROMPT_SCREENSHOT))
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
/**
|
|
134
|
-
* Checks if the types file exists.
|
|
135
|
-
*
|
|
136
|
-
* Проверяет, существует ли файл с типами.
|
|
137
|
-
* @returns true if types file exists / true, если файл типов существует
|
|
138
|
-
*/
|
|
139
|
-
isTypes(): boolean {
|
|
140
|
-
return PropertiesFile.is(this.getPath(UI_FILE_AI_PROMPT_TYPES))
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
/**
|
|
144
|
-
* Gathers all available prompt content and formats it as a single string.
|
|
145
|
-
*
|
|
146
|
-
* Собирает весь доступный контент промпта и форматирует его в виде одной строки.
|
|
147
|
-
* @returns formatted prompt content or undefined / отформатированный контент промпта или undefined
|
|
148
|
-
*/
|
|
149
|
-
make(): string | undefined {
|
|
150
|
-
console.log(this.getProjectName())
|
|
151
|
-
|
|
152
|
-
const data = [
|
|
153
|
-
this.getDescription(),
|
|
154
|
-
this.getInfo(),
|
|
155
|
-
this.getTypes(),
|
|
156
|
-
this.getScreenshot(),
|
|
157
|
-
this.getDeveloper()
|
|
158
|
-
].filter(item => item !== undefined) as string[]
|
|
159
|
-
|
|
160
|
-
if (data.length > 0) {
|
|
161
|
-
return `
|
|
162
|
-
# ${this.getProjectName()}
|
|
163
|
-
## Project location: Root directory
|
|
164
|
-
The project is located at: '${this.getPathString()}'.
|
|
165
|
-
|
|
166
|
-
${data.join('\n\n')}
|
|
167
|
-
`.trim()
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
return undefined
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
/**
|
|
174
|
-
* Formats and returns the description section for the prompt.
|
|
175
|
-
*
|
|
176
|
-
* Форматирует и возвращает секцию описания для промпта.
|
|
177
|
-
* @returns formatted description or undefined / отформатированное описание или undefined
|
|
178
|
-
* @protected
|
|
179
|
-
*/
|
|
180
|
-
protected getDescription(): string | undefined {
|
|
181
|
-
if (this.isDescription()) {
|
|
182
|
-
console.log('-- Description')
|
|
183
|
-
|
|
184
|
-
return `
|
|
185
|
-
## Package Description & Module Overview
|
|
186
|
-
${this.readFile(UI_FILE_AI_PROMPT_DESCRIPTION)}
|
|
187
|
-
`.trim()
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
return undefined
|
|
191
|
-
}
|
|
192
|
-
|
|
193
|
-
/**
|
|
194
|
-
* Formats and returns the developer prompt section.
|
|
195
|
-
*
|
|
196
|
-
* Форматирует и возвращает секцию промпта для разработчика.
|
|
197
|
-
* @returns formatted developer prompt or undefined / отформатированный промпт разработчика или undefined
|
|
198
|
-
* @protected
|
|
199
|
-
*/
|
|
200
|
-
protected getDeveloper(): string | undefined {
|
|
201
|
-
if (this.isDeveloper()) {
|
|
202
|
-
console.log('-- Developer')
|
|
203
|
-
|
|
204
|
-
return `
|
|
205
|
-
## Developer Rules (Must Read Before Modifying Code)
|
|
206
|
-
'${this.getPathString()}/${UI_FILE_AI_PROMPT_DEVELOPER}'
|
|
207
|
-
`.trim()
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
return undefined
|
|
211
|
-
}
|
|
212
|
-
|
|
213
|
-
/**
|
|
214
|
-
* Formats and returns the info section for the prompt.
|
|
215
|
-
*
|
|
216
|
-
* Форматирует и возвращает секцию информации для промпта.
|
|
217
|
-
* @returns formatted info or undefined / отформатированная информация или undefined
|
|
218
|
-
* @protected
|
|
219
|
-
*/
|
|
220
|
-
protected getInfo(): string | undefined {
|
|
221
|
-
if (this.isInfo()) {
|
|
222
|
-
console.log('-- Info')
|
|
223
|
-
|
|
224
|
-
return `
|
|
225
|
-
## Package Core Information
|
|
226
|
-
${this.readFile(UI_FILE_AI_PROMPT_INFO)}
|
|
227
|
-
`.trim()
|
|
228
|
-
}
|
|
229
|
-
|
|
230
|
-
return undefined
|
|
231
|
-
}
|
|
232
|
-
|
|
233
|
-
/**
|
|
234
|
-
* Constructs a full path for a file within the item's directory.
|
|
235
|
-
*
|
|
236
|
-
* Создает полный путь к файлу внутри директории элемента.
|
|
237
|
-
* @param dirFile File name / Имя файла
|
|
238
|
-
* @returns path segments / сегменты пути
|
|
239
|
-
* @protected
|
|
240
|
-
*/
|
|
241
|
-
protected getPath(dirFile: string): string[] {
|
|
242
|
-
return [...this.dir, dirFile]
|
|
243
|
-
}
|
|
244
|
-
|
|
245
|
-
/**
|
|
246
|
-
* Returns the directory path as a string joined by a slash.
|
|
247
|
-
*
|
|
248
|
-
* Возвращает путь к директории в виде строки, объединенной слешем.
|
|
249
|
-
* @returns path string / строка пути
|
|
250
|
-
* @protected
|
|
251
|
-
*/
|
|
252
|
-
protected getPathString(): string {
|
|
253
|
-
return this.dir.join('/')
|
|
254
|
-
}
|
|
255
|
-
|
|
256
|
-
/**
|
|
257
|
-
* Formats and returns the screenshot section for the prompt.
|
|
258
|
-
*
|
|
259
|
-
* Форматирует и возвращает секцию скриншотов для промпта.
|
|
260
|
-
* @returns formatted screenshot list or undefined / отформатированный список скриншотов или undefined
|
|
261
|
-
* @protected
|
|
262
|
-
*/
|
|
263
|
-
protected getScreenshot(): string | undefined {
|
|
264
|
-
const list = this.getScreenshotList()
|
|
265
|
-
|
|
266
|
-
if (list) {
|
|
267
|
-
console.log('-- Screenshot')
|
|
268
|
-
|
|
269
|
-
const screenshot: string = list.map(item => `- '${this.getPathString()}/${UI_DIR_AI_PROMPT_SCREENSHOT}/${item}'`).join('\n')
|
|
270
|
-
|
|
271
|
-
return `## Component Visual References (Screenshots)
|
|
272
|
-
${screenshot}
|
|
273
|
-
`.trim()
|
|
274
|
-
}
|
|
275
|
-
|
|
276
|
-
return undefined
|
|
277
|
-
}
|
|
278
|
-
|
|
279
|
-
/**
|
|
280
|
-
* Retrieves the list of files in the screenshot directory.
|
|
281
|
-
*
|
|
282
|
-
* Получает список файлов в директории скриншотов.
|
|
283
|
-
* @returns list of screenshot file names or undefined / список имен файлов скриншотов или undefined
|
|
284
|
-
* @protected
|
|
285
|
-
*/
|
|
286
|
-
protected getScreenshotList(): string[] | undefined {
|
|
287
|
-
if (this.isScreenshot()) {
|
|
288
|
-
return PropertiesFile.readDir(this.getPath(UI_DIR_AI_PROMPT_SCREENSHOT))
|
|
289
|
-
}
|
|
290
|
-
|
|
291
|
-
return undefined
|
|
292
|
-
}
|
|
293
|
-
|
|
294
|
-
/**
|
|
295
|
-
* Formats and returns the types section for the prompt.
|
|
296
|
-
*
|
|
297
|
-
* Форматирует и возвращает секцию типов для промпта.
|
|
298
|
-
* @returns formatted types reference or undefined / отформатированная ссылка на типы или undefined
|
|
299
|
-
* @protected
|
|
300
|
-
*/
|
|
301
|
-
protected getTypes(): string | undefined {
|
|
302
|
-
if (this.isTypes()) {
|
|
303
|
-
console.log('-- Types')
|
|
304
|
-
|
|
305
|
-
return `
|
|
306
|
-
## Package Type Definitions (Must Read in Full When Working with Package)
|
|
307
|
-
'${this.getPathString()}/${UI_FILE_AI_PROMPT_TYPES}'
|
|
308
|
-
`.trim()
|
|
309
|
-
}
|
|
310
|
-
|
|
311
|
-
return undefined
|
|
312
|
-
}
|
|
313
|
-
|
|
314
|
-
/**
|
|
315
|
-
* Reads content of a file by its name relative to the item's directory.
|
|
316
|
-
*
|
|
317
|
-
* Читает содержимое файла по его имени относительно директории элемента.
|
|
318
|
-
* @param dirFile File name / Имя файла
|
|
319
|
-
* @returns file content / содержимое файла
|
|
320
|
-
* @protected
|
|
321
|
-
*/
|
|
322
|
-
protected readFile(dirFile: string): string {
|
|
323
|
-
const file = PropertiesFile.readFileOnly(this.getPath(dirFile))
|
|
324
|
-
|
|
325
|
-
if (file) {
|
|
326
|
-
return file.replace(/([ '"`]|^)\.\//g, `$1${this.getPathString()}/`)
|
|
327
|
-
}
|
|
328
|
-
|
|
329
|
-
return ''
|
|
330
|
-
}
|
|
331
|
-
}
|