@intlayer/chokidar 8.1.0 → 8.1.2

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.
Files changed (104) hide show
  1. package/dist/assets/installSkills/skills/angular.md +131 -24
  2. package/dist/assets/installSkills/skills/astro.md +17 -2
  3. package/dist/assets/installSkills/skills/cli.md +42 -4
  4. package/dist/assets/installSkills/skills/config.md +53 -3
  5. package/dist/assets/installSkills/skills/content.md +247 -5
  6. package/dist/assets/installSkills/skills/next_js.md +93 -13
  7. package/dist/assets/installSkills/skills/preact.md +82 -0
  8. package/dist/assets/installSkills/skills/react.md +77 -9
  9. package/dist/assets/installSkills/skills/remote_content.md +23 -2
  10. package/dist/assets/installSkills/skills/solid.md +87 -0
  11. package/dist/assets/installSkills/skills/svelte.md +61 -10
  12. package/dist/assets/installSkills/skills/usage.md +18 -83
  13. package/dist/assets/installSkills/skills/vue.md +19 -6
  14. package/dist/cjs/_virtual/_utils_asset.cjs +1 -1
  15. package/dist/cjs/build.cjs +51 -0
  16. package/dist/cjs/buildIntlayerDictionary/buildIntlayerDictionary.cjs +1 -1
  17. package/dist/cjs/buildIntlayerDictionary/writeDynamicDictionary.cjs +1 -1
  18. package/dist/cjs/buildIntlayerDictionary/writeFetchDictionary.cjs +1 -1
  19. package/dist/cjs/buildIntlayerDictionary/writeMergedDictionary.cjs +1 -1
  20. package/dist/cjs/buildIntlayerDictionary/writeRemoteDictionary.cjs +1 -1
  21. package/dist/cjs/buildIntlayerDictionary/writeUnmergedDictionary.cjs +1 -1
  22. package/dist/cjs/cleanOutputDir.cjs +1 -1
  23. package/dist/cjs/cleanRemovedContentDeclaration.cjs +4 -4
  24. package/dist/cjs/cli.cjs +21 -0
  25. package/dist/cjs/createDictionaryEntryPoint/createDictionaryEntryPoint.cjs +1 -1
  26. package/dist/cjs/createDictionaryEntryPoint/generateDictionaryListContent.cjs +1 -1
  27. package/dist/cjs/createDictionaryEntryPoint/getBuiltDictionariesPath.cjs +2 -2
  28. package/dist/cjs/createDictionaryEntryPoint/getBuiltDynamicDictionariesPath.cjs +2 -2
  29. package/dist/cjs/createDictionaryEntryPoint/getBuiltFetchDictionariesPath.cjs +2 -2
  30. package/dist/cjs/createDictionaryEntryPoint/getBuiltRemoteDictionariesPath.cjs +2 -2
  31. package/dist/cjs/createDictionaryEntryPoint/getBuiltUnmergedDictionariesPath.cjs +2 -2
  32. package/dist/cjs/createType/createModuleAugmentation.cjs +1 -1
  33. package/dist/cjs/filterInvalidDictionaries.cjs +1 -1
  34. package/dist/cjs/handleAdditionalContentDeclarationFile.cjs +1 -1
  35. package/dist/cjs/handleContentDeclarationFileChange.cjs +3 -3
  36. package/dist/cjs/handleContentDeclarationFileMoved.cjs +1 -1
  37. package/dist/cjs/handleUnlinkedContentDeclarationFile.cjs +2 -2
  38. package/dist/cjs/index.cjs +20 -20
  39. package/dist/cjs/initConfig/index.cjs +1 -1
  40. package/dist/cjs/installSkills/index.cjs +88 -71
  41. package/dist/cjs/installSkills/index.cjs.map +1 -1
  42. package/dist/cjs/listGitFiles.cjs +2 -2
  43. package/dist/cjs/listProjects.cjs +1 -1
  44. package/dist/cjs/loadDictionaries/getIntlayerBundle.cjs +1 -1
  45. package/dist/cjs/loadDictionaries/index.cjs +1 -1
  46. package/dist/cjs/loadDictionaries/loadContentDeclaration.cjs +1 -1
  47. package/dist/cjs/loadDictionaries/loadDictionaries.cjs +1 -1
  48. package/dist/cjs/prepareIntlayer.cjs +4 -4
  49. package/dist/cjs/transformFiles/transformFiles.cjs +2 -2
  50. package/dist/cjs/utils/formatter.cjs +1 -1
  51. package/dist/cjs/utils/index.cjs +46 -0
  52. package/dist/cjs/watcher.cjs +3 -3
  53. package/dist/cjs/writeContentDeclaration/processContentDeclarationContent.cjs +2 -2
  54. package/dist/cjs/writeContentDeclaration/writeContentDeclaration.cjs +2 -2
  55. package/dist/cjs/writeContentDeclaration/writeJSFile.cjs +3 -3
  56. package/dist/esm/_virtual/_utils_asset.mjs +1 -1
  57. package/dist/esm/build.mjs +24 -0
  58. package/dist/esm/buildIntlayerDictionary/buildIntlayerDictionary.mjs +1 -1
  59. package/dist/esm/buildIntlayerDictionary/writeDynamicDictionary.mjs +1 -1
  60. package/dist/esm/buildIntlayerDictionary/writeFetchDictionary.mjs +1 -1
  61. package/dist/esm/buildIntlayerDictionary/writeMergedDictionary.mjs +1 -1
  62. package/dist/esm/buildIntlayerDictionary/writeRemoteDictionary.mjs +1 -1
  63. package/dist/esm/buildIntlayerDictionary/writeUnmergedDictionary.mjs +1 -1
  64. package/dist/esm/cleanOutputDir.mjs +1 -1
  65. package/dist/esm/cleanRemovedContentDeclaration.mjs +4 -4
  66. package/dist/esm/cli.mjs +8 -0
  67. package/dist/esm/createDictionaryEntryPoint/createDictionaryEntryPoint.mjs +1 -1
  68. package/dist/esm/createDictionaryEntryPoint/generateDictionaryListContent.mjs +1 -1
  69. package/dist/esm/createDictionaryEntryPoint/getBuiltDictionariesPath.mjs +2 -2
  70. package/dist/esm/createDictionaryEntryPoint/getBuiltDynamicDictionariesPath.mjs +2 -2
  71. package/dist/esm/createDictionaryEntryPoint/getBuiltFetchDictionariesPath.mjs +2 -2
  72. package/dist/esm/createDictionaryEntryPoint/getBuiltRemoteDictionariesPath.mjs +2 -2
  73. package/dist/esm/createDictionaryEntryPoint/getBuiltUnmergedDictionariesPath.mjs +2 -2
  74. package/dist/esm/createType/createModuleAugmentation.mjs +1 -1
  75. package/dist/esm/filterInvalidDictionaries.mjs +1 -1
  76. package/dist/esm/handleAdditionalContentDeclarationFile.mjs +1 -1
  77. package/dist/esm/handleContentDeclarationFileChange.mjs +3 -3
  78. package/dist/esm/handleContentDeclarationFileMoved.mjs +1 -1
  79. package/dist/esm/handleUnlinkedContentDeclarationFile.mjs +2 -2
  80. package/dist/esm/index.mjs +20 -20
  81. package/dist/esm/initConfig/index.mjs +1 -1
  82. package/dist/esm/installSkills/index.mjs +88 -70
  83. package/dist/esm/installSkills/index.mjs.map +1 -1
  84. package/dist/esm/listGitFiles.mjs +2 -2
  85. package/dist/esm/listProjects.mjs +1 -1
  86. package/dist/esm/loadDictionaries/getIntlayerBundle.mjs +1 -1
  87. package/dist/esm/loadDictionaries/index.mjs +1 -1
  88. package/dist/esm/loadDictionaries/loadContentDeclaration.mjs +1 -1
  89. package/dist/esm/loadDictionaries/loadDictionaries.mjs +1 -1
  90. package/dist/esm/prepareIntlayer.mjs +4 -4
  91. package/dist/esm/transformFiles/transformFiles.mjs +2 -2
  92. package/dist/esm/utils/formatter.mjs +1 -1
  93. package/dist/esm/utils/index.mjs +20 -0
  94. package/dist/esm/watcher.mjs +3 -3
  95. package/dist/esm/writeContentDeclaration/processContentDeclarationContent.mjs +2 -2
  96. package/dist/esm/writeContentDeclaration/writeContentDeclaration.mjs +2 -2
  97. package/dist/esm/writeContentDeclaration/writeJSFile.mjs +3 -3
  98. package/dist/types/build.d.ts +29 -0
  99. package/dist/types/cli.d.ts +8 -0
  100. package/dist/types/index.d.ts +16 -16
  101. package/dist/types/installSkills/index.d.ts +43 -1
  102. package/dist/types/installSkills/index.d.ts.map +1 -1
  103. package/dist/types/utils/index.d.ts +19 -0
  104. package/package.json +44 -12
@@ -1,11 +1,11 @@
1
- import { createDictionaryEntryPoint } from "./createDictionaryEntryPoint/createDictionaryEntryPoint.mjs";
2
1
  import { writeJsonIfChanged } from "./writeJsonIfChanged.mjs";
2
+ import { createDictionaryEntryPoint } from "./createDictionaryEntryPoint/createDictionaryEntryPoint.mjs";
3
+ import { getUnmergedDictionaries } from "@intlayer/unmerged-dictionaries-entry";
3
4
  import { readFile, rm } from "node:fs/promises";
4
- import { colorizeKey, colorizePath, getAppLogger, normalizePath } from "@intlayer/config/client";
5
5
  import { join, normalize, relative } from "node:path";
6
- import { getDictionaries } from "@intlayer/dictionaries-entry";
7
- import { getUnmergedDictionaries } from "@intlayer/unmerged-dictionaries-entry";
6
+ import { colorizeKey, colorizePath, getAppLogger, normalizePath } from "@intlayer/config/client";
8
7
  import fg from "fast-glob";
8
+ import { getDictionaries } from "@intlayer/dictionaries-entry";
9
9
 
10
10
  //#region src/cleanRemovedContentDeclaration.ts
11
11
  const cleanRemovedContentDeclaration = async (filePath, keysToKeep, configuration) => {
@@ -0,0 +1,8 @@
1
+ import { initIntlayer } from "./init/index.mjs";
2
+ import { SKILLS, SKILLS_METADATA, installSkills } from "./installSkills/index.mjs";
3
+ import { listGitFiles, listGitLines } from "./listGitFiles.mjs";
4
+ import { listProjects } from "./listProjects.mjs";
5
+ import { extractDictionaryKey } from "./transformFiles/extractDictionaryKey.mjs";
6
+ import { ATTRIBUTES_TO_EXTRACT, extractIntlayer, generateKey, shouldExtract, transformFiles } from "./transformFiles/transformFiles.mjs";
7
+
8
+ export { ATTRIBUTES_TO_EXTRACT, SKILLS, SKILLS_METADATA, extractDictionaryKey, extractIntlayer, generateKey, initIntlayer, installSkills, listGitFiles, listGitLines, listProjects, shouldExtract, transformFiles };
@@ -6,9 +6,9 @@ import { getBuiltDynamicDictionariesPath } from "./getBuiltDynamicDictionariesPa
6
6
  import { getBuiltFetchDictionariesPath } from "./getBuiltFetchDictionariesPath.mjs";
7
7
  import { getBuiltRemoteDictionariesPath } from "./getBuiltRemoteDictionariesPath.mjs";
8
8
  import { getBuiltUnmergedDictionariesPath } from "./getBuiltUnmergedDictionariesPath.mjs";
9
+ import { getConfiguration } from "@intlayer/config";
9
10
  import { mkdir } from "node:fs/promises";
10
11
  import { resolve } from "node:path";
11
- import { getConfiguration } from "@intlayer/config";
12
12
 
13
13
  //#region src/createDictionaryEntryPoint/createDictionaryEntryPoint.ts
14
14
  const writeDictionaryFiles = async (paths, fileName, importType, functionName, format, configuration = getConfiguration()) => {
@@ -1,6 +1,6 @@
1
1
  import { getFileHash } from "../utils/getFileHash.mjs";
2
- import { basename, extname, relative } from "node:path";
3
2
  import { getConfiguration, normalizePath } from "@intlayer/config";
3
+ import { basename, extname, relative } from "node:path";
4
4
 
5
5
  //#region src/createDictionaryEntryPoint/generateDictionaryListContent.ts
6
6
  /**
@@ -1,7 +1,7 @@
1
- import { existsSync, mkdirSync } from "node:fs";
1
+ import { normalizePath } from "@intlayer/config";
2
2
  import { basename } from "node:path";
3
+ import { existsSync, mkdirSync } from "node:fs";
3
4
  import fg from "fast-glob";
4
- import { normalizePath } from "@intlayer/config";
5
5
 
6
6
  //#region src/createDictionaryEntryPoint/getBuiltDictionariesPath.ts
7
7
  /**
@@ -1,7 +1,7 @@
1
- import { existsSync, mkdirSync } from "node:fs";
1
+ import { normalizePath } from "@intlayer/config";
2
2
  import { basename } from "node:path";
3
+ import { existsSync, mkdirSync } from "node:fs";
3
4
  import fg from "fast-glob";
4
- import { normalizePath } from "@intlayer/config";
5
5
 
6
6
  //#region src/createDictionaryEntryPoint/getBuiltDynamicDictionariesPath.ts
7
7
  /**
@@ -1,7 +1,7 @@
1
- import { existsSync, mkdirSync } from "node:fs";
1
+ import { normalizePath } from "@intlayer/config";
2
2
  import { basename } from "node:path";
3
+ import { existsSync, mkdirSync } from "node:fs";
3
4
  import fg from "fast-glob";
4
- import { normalizePath } from "@intlayer/config";
5
5
 
6
6
  //#region src/createDictionaryEntryPoint/getBuiltFetchDictionariesPath.ts
7
7
  /**
@@ -1,7 +1,7 @@
1
- import { existsSync, mkdirSync } from "node:fs";
1
+ import { normalizePath } from "@intlayer/config";
2
2
  import { basename } from "node:path";
3
+ import { existsSync, mkdirSync } from "node:fs";
3
4
  import fg from "fast-glob";
4
- import { normalizePath } from "@intlayer/config";
5
5
 
6
6
  //#region src/createDictionaryEntryPoint/getBuiltRemoteDictionariesPath.ts
7
7
  /**
@@ -1,7 +1,7 @@
1
- import { existsSync, mkdirSync } from "node:fs";
1
+ import { normalizePath } from "@intlayer/config";
2
2
  import { basename } from "node:path";
3
+ import { existsSync, mkdirSync } from "node:fs";
3
4
  import fg from "fast-glob";
4
- import { normalizePath } from "@intlayer/config";
5
5
 
6
6
  //#region src/createDictionaryEntryPoint/getBuiltUnmergedDictionariesPath.ts
7
7
  /**
@@ -1,9 +1,9 @@
1
1
  import { writeFileIfChanged } from "../writeFileIfChanged.mjs";
2
2
  import { getFileHash } from "../utils/getFileHash.mjs";
3
+ import { kebabCaseToCamelCase, normalizePath } from "@intlayer/config";
3
4
  import { mkdir } from "node:fs/promises";
4
5
  import { basename, extname, join, relative } from "node:path";
5
6
  import fg from "fast-glob";
6
- import { kebabCaseToCamelCase, normalizePath } from "@intlayer/config";
7
7
  import { printNode, zodToTs } from "zod-to-ts";
8
8
 
9
9
  //#region src/createType/createModuleAugmentation.ts
@@ -1,6 +1,6 @@
1
1
  import { formatLocale, formatPath } from "./utils/formatter.mjs";
2
- import { ANSIColors, colorize, colorizeKey, colorizePath, getAppLogger, x } from "@intlayer/config/client";
3
2
  import { getContent } from "@intlayer/core";
3
+ import { ANSIColors, colorize, colorizeKey, colorizePath, getAppLogger, x } from "@intlayer/config/client";
4
4
 
5
5
  //#region src/filterInvalidDictionaries.ts
6
6
  const isInvalidDictionary = (dictionary, configuration, options) => {
@@ -1,6 +1,6 @@
1
- import { createDictionaryEntryPoint } from "./createDictionaryEntryPoint/createDictionaryEntryPoint.mjs";
2
1
  import { formatPath } from "./utils/formatter.mjs";
3
2
  import { buildDictionary } from "./buildIntlayerDictionary/buildIntlayerDictionary.mjs";
3
+ import { createDictionaryEntryPoint } from "./createDictionaryEntryPoint/createDictionaryEntryPoint.mjs";
4
4
  import { createModuleAugmentation } from "./createType/createModuleAugmentation.mjs";
5
5
  import { createTypes } from "./createType/createType.mjs";
6
6
  import { loadLocalDictionaries } from "./loadDictionaries/loadLocalDictionaries.mjs";
@@ -1,11 +1,11 @@
1
- import { getBuiltDictionariesPath } from "./createDictionaryEntryPoint/getBuiltDictionariesPath.mjs";
2
- import { createDictionaryEntryPoint } from "./createDictionaryEntryPoint/createDictionaryEntryPoint.mjs";
3
- import { cleanRemovedContentDeclaration } from "./cleanRemovedContentDeclaration.mjs";
4
1
  import { formatPath } from "./utils/formatter.mjs";
5
2
  import { buildDictionary } from "./buildIntlayerDictionary/buildIntlayerDictionary.mjs";
3
+ import { getBuiltDictionariesPath } from "./createDictionaryEntryPoint/getBuiltDictionariesPath.mjs";
4
+ import { createDictionaryEntryPoint } from "./createDictionaryEntryPoint/createDictionaryEntryPoint.mjs";
6
5
  import { createModuleAugmentation } from "./createType/createModuleAugmentation.mjs";
7
6
  import { createTypes } from "./createType/createType.mjs";
8
7
  import { loadLocalDictionaries } from "./loadDictionaries/loadLocalDictionaries.mjs";
8
+ import { cleanRemovedContentDeclaration } from "./cleanRemovedContentDeclaration.mjs";
9
9
  import { getAppLogger } from "@intlayer/config";
10
10
 
11
11
  //#region src/handleContentDeclarationFileChange.ts
@@ -1,6 +1,6 @@
1
- import { cleanRemovedContentDeclaration } from "./cleanRemovedContentDeclaration.mjs";
2
1
  import { formatPath } from "./utils/formatter.mjs";
3
2
  import { loadLocalDictionaries } from "./loadDictionaries/loadLocalDictionaries.mjs";
3
+ import { cleanRemovedContentDeclaration } from "./cleanRemovedContentDeclaration.mjs";
4
4
  import { handleContentDeclarationFileChange } from "./handleContentDeclarationFileChange.mjs";
5
5
  import { getAppLogger } from "@intlayer/config";
6
6
 
@@ -1,12 +1,12 @@
1
- import { cleanRemovedContentDeclaration } from "./cleanRemovedContentDeclaration.mjs";
2
1
  import { formatPath } from "./utils/formatter.mjs";
3
2
  import { buildDictionary } from "./buildIntlayerDictionary/buildIntlayerDictionary.mjs";
4
3
  import { createModuleAugmentation } from "./createType/createModuleAugmentation.mjs";
5
4
  import { createTypes } from "./createType/createType.mjs";
6
5
  import { loadLocalDictionaries } from "./loadDictionaries/loadLocalDictionaries.mjs";
7
6
  import { listDictionaries } from "./listDictionariesPath.mjs";
8
- import { normalize } from "node:path";
7
+ import { cleanRemovedContentDeclaration } from "./cleanRemovedContentDeclaration.mjs";
9
8
  import { getAppLogger } from "@intlayer/config";
9
+ import { normalize } from "node:path";
10
10
 
11
11
  //#region src/handleUnlinkedContentDeclarationFile.ts
12
12
  const handleUnlinkedContentDeclarationFile = async (filePath, config) => {
@@ -1,6 +1,10 @@
1
- import { cleanOutputDir } from "./cleanOutputDir.mjs";
2
1
  import { pLimit } from "./utils/pLimit.mjs";
3
2
  import { parallelize } from "./utils/parallelize.mjs";
3
+ import { formatLocale, formatPath } from "./utils/formatter.mjs";
4
+ import { isInvalidDictionary } from "./filterInvalidDictionaries.mjs";
5
+ import { buildDictionary } from "./buildIntlayerDictionary/buildIntlayerDictionary.mjs";
6
+ import { autoDecorateContent } from "./utils/autoDecorateContent.mjs";
7
+ import { resolveObjectPromises } from "./utils/resolveObjectPromises.mjs";
4
8
  import { getFileHash } from "./utils/getFileHash.mjs";
5
9
  import { generateDictionaryListContent } from "./createDictionaryEntryPoint/generateDictionaryListContent.mjs";
6
10
  import { getBuiltDictionariesPath } from "./createDictionaryEntryPoint/getBuiltDictionariesPath.mjs";
@@ -9,40 +13,36 @@ import { getBuiltFetchDictionariesPath } from "./createDictionaryEntryPoint/getB
9
13
  import { getBuiltRemoteDictionariesPath } from "./createDictionaryEntryPoint/getBuiltRemoteDictionariesPath.mjs";
10
14
  import { getBuiltUnmergedDictionariesPath } from "./createDictionaryEntryPoint/getBuiltUnmergedDictionariesPath.mjs";
11
15
  import { createDictionaryEntryPoint } from "./createDictionaryEntryPoint/createDictionaryEntryPoint.mjs";
12
- import { fetchDistantDictionaries } from "./fetchDistantDictionaries.mjs";
13
- import { formatLocale, formatPath } from "./utils/formatter.mjs";
14
- import { isInvalidDictionary } from "./filterInvalidDictionaries.mjs";
15
- import { formatDictionaries, formatDictionariesOutput, formatDictionary, formatDictionaryOutput } from "./formatDictionary.mjs";
16
- import { buildDictionary } from "./buildIntlayerDictionary/buildIntlayerDictionary.mjs";
17
16
  import { createModuleAugmentation } from "./createType/createModuleAugmentation.mjs";
18
17
  import { createTypes } from "./createType/createType.mjs";
19
- import { autoDecorateContent } from "./utils/autoDecorateContent.mjs";
20
- import { resolveObjectPromises } from "./utils/resolveObjectPromises.mjs";
21
18
  import { loadContentDeclarations } from "./loadDictionaries/loadContentDeclaration.mjs";
22
- import { loadLocalDictionaries } from "./loadDictionaries/loadLocalDictionaries.mjs";
23
- import { handleAdditionalContentDeclarationFile } from "./handleAdditionalContentDeclarationFile.mjs";
24
- import { handleContentDeclarationFileChange } from "./handleContentDeclarationFileChange.mjs";
25
- import { listDictionaries, listDictionariesWithStats } from "./listDictionariesPath.mjs";
26
- import { handleUnlinkedContentDeclarationFile } from "./handleUnlinkedContentDeclarationFile.mjs";
27
- import { getContentDeclarationFileTemplate } from "./getContentDeclarationFileTemplate/getContentDeclarationFileTemplate.mjs";
28
- import { initIntlayer } from "./init/index.mjs";
29
- import { SKILLS, SKILLS_METADATA, installSkills } from "./installSkills/index.mjs";
30
- import { listGitFiles, listGitLines } from "./listGitFiles.mjs";
31
- import { listProjects } from "./listProjects.mjs";
19
+ import { formatDictionaries, formatDictionariesOutput, formatDictionary, formatDictionaryOutput } from "./formatDictionary.mjs";
20
+ import { fetchDistantDictionaries } from "./fetchDistantDictionaries.mjs";
32
21
  import { sortAlphabetically } from "./utils/sortAlphabetically.mjs";
33
22
  import { loadRemoteDictionaries } from "./loadDictionaries/loadRemoteDictionaries.mjs";
34
23
  import { loadDictionaries } from "./loadDictionaries/loadDictionaries.mjs";
24
+ import { loadLocalDictionaries } from "./loadDictionaries/loadLocalDictionaries.mjs";
25
+ import { cleanOutputDir } from "./cleanOutputDir.mjs";
26
+ import { listDictionaries, listDictionariesWithStats } from "./listDictionariesPath.mjs";
35
27
  import { runOnce } from "./utils/runOnce.mjs";
36
28
  import { prepareIntlayer } from "./prepareIntlayer.mjs";
37
- import { reduceDictionaryContent } from "./reduceDictionaryContent/reduceDictionaryContent.mjs";
38
29
  import { detectExportedComponentName } from "./writeContentDeclaration/detectExportedComponentName.mjs";
39
- import { extractDictionaryKey } from "./transformFiles/extractDictionaryKey.mjs";
40
30
  import { detectFormatCommand } from "./writeContentDeclaration/detectFormatCommand.mjs";
41
31
  import { transformJSFile } from "./writeContentDeclaration/transformJSFile.mjs";
42
32
  import { getExtensionFromFormat, getFormatFromExtension } from "./utils/getFormatFromExtension.mjs";
33
+ import { getContentDeclarationFileTemplate } from "./getContentDeclarationFileTemplate/getContentDeclarationFileTemplate.mjs";
43
34
  import { writeJSFile } from "./writeContentDeclaration/writeJSFile.mjs";
44
35
  import { writeContentDeclaration } from "./writeContentDeclaration/writeContentDeclaration.mjs";
36
+ import { initIntlayer } from "./init/index.mjs";
37
+ import { SKILLS, SKILLS_METADATA, installSkills } from "./installSkills/index.mjs";
38
+ import { listGitFiles, listGitLines } from "./listGitFiles.mjs";
39
+ import { listProjects } from "./listProjects.mjs";
40
+ import { extractDictionaryKey } from "./transformFiles/extractDictionaryKey.mjs";
45
41
  import { ATTRIBUTES_TO_EXTRACT, extractIntlayer, generateKey, shouldExtract, transformFiles } from "./transformFiles/transformFiles.mjs";
42
+ import { handleAdditionalContentDeclarationFile } from "./handleAdditionalContentDeclarationFile.mjs";
43
+ import { handleContentDeclarationFileChange } from "./handleContentDeclarationFileChange.mjs";
44
+ import { handleUnlinkedContentDeclarationFile } from "./handleUnlinkedContentDeclarationFile.mjs";
45
+ import { reduceDictionaryContent } from "./reduceDictionaryContent/reduceDictionaryContent.mjs";
46
46
  import { buildFilesList } from "./utils/buildFilesList.mjs";
47
47
  import { splitTextByLines } from "./utils/splitTextByLine.mjs";
48
48
  import { getChunk } from "./utils/getChunk.mjs";
@@ -1,7 +1,7 @@
1
1
  import { readAsset } from "../_virtual/_utils_asset.mjs";
2
+ import { colorizePath, logger, searchConfigurationFile, v } from "@intlayer/config";
2
3
  import { writeFile } from "node:fs/promises";
3
4
  import { join, relative } from "node:path";
4
- import { colorizePath, logger, searchConfigurationFile, v } from "@intlayer/config";
5
5
 
6
6
  //#region src/initConfig/index.ts
7
7
  /**
@@ -1,8 +1,7 @@
1
1
  import { readAsset } from "../_virtual/_utils_asset.mjs";
2
- import { promises } from "node:fs";
3
2
  import path from "node:path";
4
3
  import { getMarkdownMetadata } from "@intlayer/core";
5
- import https from "node:https";
4
+ import { promises } from "node:fs";
6
5
 
7
6
  //#region src/installSkills/index.ts
8
7
  const SKILLS_METADATA = {
@@ -14,6 +13,8 @@ const SKILLS_METADATA = {
14
13
  Angular: "Angular-specific syntax and Injectable Function usage",
15
14
  NextJS: "Next.js-specific usage (Server & Client components)",
16
15
  Vue: "Vue-specific composables and syntax",
16
+ Preact: "Preact-specific syntax and hooks usage",
17
+ Solid: "Integrates Intlayer internationalization with SolidJS components. Use when the user asks to \"setup SolidJS i18n\", use the \"useIntlayer\" hook in Solid, or manage locales in a SolidJS application.",
17
18
  Svelte: "Svelte-specific stores and syntax",
18
19
  Astro: "Astro-specific usage and getIntlayer",
19
20
  CLI: "Intlayer CLI commands and usage"
@@ -24,14 +25,54 @@ const SKILLS = Object.keys(SKILLS_METADATA);
24
25
  */
25
26
  const SKILL_FILENAME_MAP = {};
26
27
  /**
27
- * Helper to convert CamelCase to snake_case for directory naming
28
+ * Configuration for Platform paths to keep code clean.
29
+ */
30
+ const PLATFORM_DIRS = {
31
+ Cursor: ".cursor/skills",
32
+ Windsurf: ".windsurf/skills",
33
+ Trae: ".trae/skills",
34
+ OpenCode: ".opencode/skills",
35
+ GitHub: ".github/skills",
36
+ Claude: ".claude/skills",
37
+ VSCode: ".vscode/skills",
38
+ Antigravity: ".agent/skills",
39
+ Augment: ".augment/skills",
40
+ OpenClaw: "skills",
41
+ Cline: ".cline/skills",
42
+ CodeBuddy: ".codebuddy/skills",
43
+ CommandCode: ".commandcode/skills",
44
+ Continue: ".continue/skills",
45
+ Crush: ".crush/skills",
46
+ Droid: ".factory/skills",
47
+ Goose: ".goose/skills",
48
+ Junie: ".junie/skills",
49
+ IFlow: ".iflow/skills",
50
+ KiloCode: ".kilocode/skills",
51
+ Kiro: ".kiro/skills",
52
+ Kode: ".kode/skills",
53
+ MCPJam: ".mcpjam/skills",
54
+ MistralVibe: ".vibe/skills",
55
+ Mux: ".mux/skills",
56
+ OpenHands: ".openhands/skills",
57
+ Pi: ".pi/skills",
58
+ Qoder: ".qoder/skills",
59
+ Qwen: ".qwen/skills",
60
+ RooCode: ".roo/skills",
61
+ TraeCN: ".trae/skills",
62
+ Zencoder: ".zencoder/skills",
63
+ Neovate: ".neovate/skills",
64
+ Pochi: ".pochi/skills",
65
+ Other: "skills"
66
+ };
67
+ /**
68
+ * Helper to convert CamelCase to kebab-case for directory naming
28
69
  */
29
- const camelToSnakeCase = (str) => str.replace(/([a-z0-9])([A-Z])/g, "$1_$2").toLowerCase();
70
+ const camelToKebabCase = (str) => str.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase();
30
71
  /**
31
72
  * Reads the raw markdown content for a specific skill from the assets folder.
32
73
  */
33
74
  const getSkillContent = (skill) => {
34
- const fileName = `./skills/${SKILL_FILENAME_MAP[skill] ?? camelToSnakeCase(skill)}.md`;
75
+ const fileName = `./skills/${SKILL_FILENAME_MAP[skill] ?? camelToKebabCase(skill)}.md`;
35
76
  try {
36
77
  return readAsset(fileName);
37
78
  } catch {
@@ -51,88 +92,65 @@ const getLicenceContent = () => {
51
92
  }
52
93
  };
53
94
  /**
54
- * Fetches the content of a URL (supporting redirects).
95
+ * Fetches the content of a URL using native fetch.
55
96
  */
56
- const fetchUrl = (url) => new Promise((resolve, reject) => {
57
- https.get(url, (res) => {
58
- const { statusCode } = res;
59
- if (statusCode === 301 || statusCode === 302) {
60
- const redirectUrl = res.headers.location;
61
- if (redirectUrl) return fetchUrl(redirectUrl).then(resolve).catch(reject);
62
- }
63
- if (statusCode !== 200) return reject(/* @__PURE__ */ new Error(`Failed to fetch ${url}: Status Code ${statusCode}`));
64
- let data = "";
65
- res.on("data", (chunk) => {
66
- data += chunk;
67
- });
68
- res.on("end", () => {
69
- resolve(data);
70
- });
71
- }).on("error", (err) => {
72
- reject(err);
73
- });
74
- });
97
+ const fetchUrlContent = async (url) => {
98
+ const response = await fetch(url);
99
+ if (!response.ok) throw new Error(`Failed to fetch ${url}: ${response.statusText}`);
100
+ return response.text();
101
+ };
75
102
  /**
76
103
  * Installs skills using the "Agent Skills" directory standard.
77
104
  * Standard: <PROJECT_ROOT>/<CONFIG_DIR>/skills/<SKILL_NAME>/SKILL.md
78
105
  */
79
106
  const installSkills = async (projectRoot, platform, skills) => {
80
- let skillsBaseDir = "";
81
- let useAgentStructure = true;
82
- switch (platform) {
83
- case "Cursor":
84
- skillsBaseDir = path.join(projectRoot, ".cursor/skills");
85
- break;
86
- case "Windsurf":
87
- skillsBaseDir = path.join(projectRoot, ".windsurf/skills");
88
- break;
89
- case "OpenCode":
90
- skillsBaseDir = path.join(projectRoot, ".opencode/skills");
91
- break;
92
- case "GitHub":
93
- skillsBaseDir = path.join(projectRoot, ".github/skills");
94
- break;
95
- case "Claude":
96
- skillsBaseDir = path.join(projectRoot, ".claude/skills");
97
- break;
98
- default:
99
- skillsBaseDir = path.join(projectRoot, "skills");
100
- useAgentStructure = false;
101
- }
107
+ const relativeDir = PLATFORM_DIRS[platform] ?? "skills";
108
+ const skillsBaseDir = path.join(projectRoot, relativeDir);
109
+ const useAgentStructure = platform !== "VSCode";
102
110
  await promises.mkdir(skillsBaseDir, { recursive: true });
103
111
  const createdSkills = [];
104
112
  const licenceContent = getLicenceContent();
105
113
  for (const skill of skills) {
106
- const skillName = `intlayer_${SKILL_FILENAME_MAP[skill] ?? camelToSnakeCase(skill)}`;
114
+ const skillName = `intlayer-${SKILL_FILENAME_MAP[skill] ?? camelToKebabCase(skill)}`;
107
115
  const skillContent = getSkillContent(skill);
108
116
  if (!skillContent) continue;
109
117
  const urls = Array.from(new Set(skillContent.match(/https:\/\/intlayer\.org\/doc\/[^\s)]+\.md/g) || []));
110
118
  if (useAgentStructure) {
111
119
  const skillDir = path.join(skillsBaseDir, skillName);
112
- await promises.mkdir(skillDir, { recursive: true });
113
- const filePath = path.join(skillDir, "SKILL.md");
114
- await promises.writeFile(filePath, skillContent, "utf-8");
115
- if (licenceContent) {
116
- const licencePath = path.join(skillDir, "LICENCE.md");
117
- await promises.writeFile(licencePath, licenceContent, "utf-8");
118
- }
119
- const referenceDir = path.join(skillDir, "reference");
120
+ const referenceDir = path.join(skillDir, "references");
120
121
  await promises.mkdir(referenceDir, { recursive: true });
121
- for (const url of urls) try {
122
- const content = await fetchUrl(url);
123
- const metadata = getMarkdownMetadata(content);
124
- let fileName = "";
125
- if (Array.isArray(metadata.slugs)) fileName = metadata.slugs.filter((slug) => slug !== "doc").join("_");
126
- else fileName = new URL(url).pathname.split("/").filter((part) => part !== "" && part !== "doc").map((part, index, array) => {
127
- if (index === array.length - 1) return part.replace(".md", "");
128
- return part;
129
- }).join("_");
130
- fileName = fileName ? `${fileName}.md` : "index.md";
131
- const docPath = path.join(referenceDir, fileName);
132
- await promises.writeFile(docPath, content, "utf-8");
133
- } catch (error) {
134
- console.warn(`Warning: Could not fetch documentation for ${skill} from ${url}:`, error);
122
+ if (licenceContent) await promises.writeFile(path.join(skillDir, "LICENCE.md"), licenceContent, "utf-8");
123
+ let updatedSkillContent = skillContent;
124
+ const downloadPromises = urls.map(async (url) => {
125
+ try {
126
+ const content = await fetchUrlContent(url);
127
+ const metadata = getMarkdownMetadata(content);
128
+ let fileName = "";
129
+ if (Array.isArray(metadata.slugs)) fileName = metadata.slugs.filter((slug) => slug !== "doc").join("_");
130
+ else fileName = new URL(url).pathname.split("/").filter((part) => part && part !== "doc").map((part) => part.replace(".md", "")).join("_");
131
+ fileName = fileName ? `${fileName}.md` : "index.md";
132
+ return {
133
+ url,
134
+ localRefPath: `references/${fileName}`,
135
+ fileName,
136
+ content,
137
+ success: true
138
+ };
139
+ } catch (error) {
140
+ console.warn(`Warning: Failed to download ref ${url} for skill ${skill}`, error);
141
+ return {
142
+ url,
143
+ success: false
144
+ };
145
+ }
146
+ });
147
+ const results = await Promise.all(downloadPromises);
148
+ for (const res of results) if (res.success && res.fileName && res.content && res.localRefPath) {
149
+ await promises.writeFile(path.join(referenceDir, res.fileName), res.content, "utf-8");
150
+ updatedSkillContent = updatedSkillContent.replaceAll(res.url, res.localRefPath);
135
151
  }
152
+ const filePath = path.join(skillDir, "SKILL.md");
153
+ await promises.writeFile(filePath, updatedSkillContent, "utf-8");
136
154
  createdSkills.push(`${skillName}/SKILL.md`);
137
155
  } else {
138
156
  const fileName = `${skillName}.md`;
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","names":["fs"],"sources":["../../../src/installSkills/index.ts"],"sourcesContent":["import { promises as fs } from 'node:fs';\nimport https from 'node:https';\nimport path from 'node:path';\nimport { readAsset } from 'utils:asset';\nimport { getMarkdownMetadata } from '@intlayer/core';\n\nexport const SKILLS_METADATA = {\n Usage: 'How to use Intlayer in your project',\n RemoteContent: 'How to use Intlayer with Remote/CMS/Server-side content',\n Config: 'Intlayer configuration documentation',\n Content: 'Reference for all Intlayer content node types (t, enu, etc.)',\n React: 'React-specific syntax and hooks usage',\n Angular: 'Angular-specific syntax and Injectable Function usage',\n NextJS: 'Next.js-specific usage (Server & Client components)',\n Vue: 'Vue-specific composables and syntax',\n Svelte: 'Svelte-specific stores and syntax',\n Astro: 'Astro-specific usage and getIntlayer',\n CLI: 'Intlayer CLI commands and usage',\n} as const;\n\nexport const SKILLS = Object.keys(\n SKILLS_METADATA\n) as (keyof typeof SKILLS_METADATA)[];\n\nexport type Skill = (typeof SKILLS)[number];\n\nexport type Platform =\n | 'Cursor'\n | 'Windsurf'\n | 'OpenCode'\n | 'GitHub'\n | 'Claude'\n | 'VSCode'\n | 'Other';\n\n/**\n * Maps specific skill keys to special filenames if they differ from standard snake_case.\n */\nconst SKILL_FILENAME_MAP: Partial<Record<Skill, string>> = {};\n\n/**\n * Helper to convert CamelCase to snake_case for directory naming\n */\nconst camelToSnakeCase = (str: string) =>\n str.replace(/([a-z0-9])([A-Z])/g, '$1_$2').toLowerCase();\n\n/**\n * Reads the raw markdown content for a specific skill from the assets folder.\n */\nconst getSkillContent = (skill: Skill): string => {\n const baseName = SKILL_FILENAME_MAP[skill] ?? camelToSnakeCase(skill);\n // Source files are flat: ./skills/vue.md\n const fileName = `./skills/${baseName}.md`;\n\n try {\n return readAsset(fileName);\n } catch {\n console.warn(\n `Warning: Could not read asset for skill: ${skill} at ${fileName}`\n );\n return '';\n }\n};\n\n/**\n * Reads the licence content from the assets folder.\n */\nconst getLicenceContent = (): string => {\n try {\n return readAsset('./LICENCE.md');\n } catch {\n console.warn('Warning: Could not read LICENCE.md asset');\n return '';\n }\n};\n\n/**\n * Fetches the content of a URL (supporting redirects).\n */\nconst fetchUrl = (url: string): Promise<string> =>\n new Promise((resolve, reject) => {\n https\n .get(url, (res) => {\n const { statusCode } = res;\n\n if (statusCode === 301 || statusCode === 302) {\n const redirectUrl = res.headers.location;\n if (redirectUrl) {\n return fetchUrl(redirectUrl).then(resolve).catch(reject);\n }\n }\n\n if (statusCode !== 200) {\n return reject(\n new Error(`Failed to fetch ${url}: Status Code ${statusCode}`)\n );\n }\n\n let data = '';\n res.on('data', (chunk) => {\n data += chunk;\n });\n res.on('end', () => {\n resolve(data);\n });\n })\n .on('error', (err) => {\n reject(err);\n });\n });\n\n/**\n * Installs skills using the \"Agent Skills\" directory standard.\n * Standard: <PROJECT_ROOT>/<CONFIG_DIR>/skills/<SKILL_NAME>/SKILL.md\n */\nexport const installSkills = async (\n projectRoot: string,\n platform: Platform,\n skills: Skill[]\n): Promise<string> => {\n let skillsBaseDir = '';\n let useAgentStructure = true;\n\n // Determine the root configuration directory based on Platform\n switch (platform) {\n case 'Cursor':\n skillsBaseDir = path.join(projectRoot, '.cursor/skills');\n break;\n case 'Windsurf':\n skillsBaseDir = path.join(projectRoot, '.windsurf/skills');\n break;\n case 'OpenCode':\n skillsBaseDir = path.join(projectRoot, '.opencode/skills');\n break;\n case 'GitHub': // GitHub Copilot Workspace\n skillsBaseDir = path.join(projectRoot, '.github/skills');\n break;\n case 'Claude': // Claude Desktop / Agent\n skillsBaseDir = path.join(projectRoot, '.claude/skills');\n break;\n default:\n // Fallback for generic editors (VSCode, etc.) -> Flat files\n skillsBaseDir = path.join(projectRoot, 'skills');\n useAgentStructure = false;\n }\n\n // Ensure the base directory exists\n await fs.mkdir(skillsBaseDir, { recursive: true });\n\n const createdSkills: string[] = [];\n const licenceContent = getLicenceContent();\n\n for (const skill of skills) {\n const baseName = SKILL_FILENAME_MAP[skill] ?? camelToSnakeCase(skill);\n const skillName = `intlayer_${baseName}`;\n const skillContent = getSkillContent(skill);\n\n if (!skillContent) continue;\n\n const urls = Array.from(\n new Set(\n skillContent.match(/https:\\/\\/intlayer\\.org\\/doc\\/[^\\s)]+\\.md/g) || []\n )\n );\n\n if (useAgentStructure) {\n // Agent Standard: .../skills/<skill-name>/SKILL.md\n const skillDir = path.join(skillsBaseDir, skillName);\n await fs.mkdir(skillDir, { recursive: true });\n\n const filePath = path.join(skillDir, 'SKILL.md');\n await fs.writeFile(filePath, skillContent, 'utf-8');\n\n if (licenceContent) {\n const licencePath = path.join(skillDir, 'LICENCE.md');\n await fs.writeFile(licencePath, licenceContent, 'utf-8');\n }\n\n // Fetch and save documentation files\n const referenceDir = path.join(skillDir, 'reference');\n await fs.mkdir(referenceDir, { recursive: true });\n\n for (const url of urls) {\n try {\n const content = await fetchUrl(url);\n const metadata = getMarkdownMetadata<{\n slugs?: string[];\n }>(content);\n\n let fileName = '';\n\n if (Array.isArray(metadata.slugs)) {\n fileName = metadata.slugs\n .filter((slug) => slug !== 'doc')\n .join('_');\n } else {\n const urlPath = new URL(url).pathname;\n fileName = urlPath\n .split('/')\n .filter((part) => part !== '' && part !== 'doc')\n .map((part, index, array) => {\n if (index === array.length - 1) {\n return part.replace('.md', '');\n }\n return part;\n })\n .join('_');\n }\n\n fileName = fileName ? `${fileName}.md` : 'index.md';\n\n const docPath = path.join(referenceDir, fileName);\n await fs.writeFile(docPath, content, 'utf-8');\n } catch (error) {\n console.warn(\n `Warning: Could not fetch documentation for ${skill} from ${url}:`,\n error\n );\n }\n }\n\n createdSkills.push(`${skillName}/SKILL.md`);\n } else {\n // Flat Structure (Generic): .../skills/<skill-name>.md\n const fileName = `${skillName}.md`;\n const filePath = path.join(skillsBaseDir, fileName);\n await fs.writeFile(filePath, skillContent, 'utf-8');\n createdSkills.push(fileName);\n }\n }\n\n if (createdSkills.length === 0) {\n return `No skill files were created. Check your asset paths.`;\n }\n\n return `Created ${createdSkills.length} skills in ${skillsBaseDir}`;\n};\n"],"mappings":"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"}
1
+ {"version":3,"file":"index.mjs","names":["fs"],"sources":["../../../src/installSkills/index.ts"],"sourcesContent":["import { promises as fs } from 'node:fs';\nimport path from 'node:path';\nimport { readAsset } from 'utils:asset';\nimport { getMarkdownMetadata } from '@intlayer/core';\n\nexport const SKILLS_METADATA = {\n Usage: 'How to use Intlayer in your project',\n RemoteContent: 'How to use Intlayer with Remote/CMS/Server-side content',\n Config: 'Intlayer configuration documentation',\n Content: 'Reference for all Intlayer content node types (t, enu, etc.)',\n React: 'React-specific syntax and hooks usage',\n Angular: 'Angular-specific syntax and Injectable Function usage',\n NextJS: 'Next.js-specific usage (Server & Client components)',\n Vue: 'Vue-specific composables and syntax',\n Preact: 'Preact-specific syntax and hooks usage',\n Solid:\n 'Integrates Intlayer internationalization with SolidJS components. Use when the user asks to \"setup SolidJS i18n\", use the \"useIntlayer\" hook in Solid, or manage locales in a SolidJS application.',\n Svelte: 'Svelte-specific stores and syntax',\n Astro: 'Astro-specific usage and getIntlayer',\n CLI: 'Intlayer CLI commands and usage',\n} as const;\n\nexport const SKILLS = Object.keys(\n SKILLS_METADATA\n) as (keyof typeof SKILLS_METADATA)[];\n\nexport type Skill = (typeof SKILLS)[number];\n\n/**\n * Maps specific skill keys to special filenames if they differ from standard snake_case.\n */\nconst SKILL_FILENAME_MAP: Partial<Record<Skill, string>> = {};\n\n/**\n * Configuration for Platform paths to keep code clean.\n */\nconst PLATFORM_DIRS = {\n Cursor: '.cursor/skills',\n Windsurf: '.windsurf/skills',\n Trae: '.trae/skills',\n OpenCode: '.opencode/skills',\n GitHub: '.github/skills',\n Claude: '.claude/skills',\n VSCode: '.vscode/skills', // Fixed: VSCode usually uses .vscode, not .github\n Antigravity: '.agent/skills',\n Augment: '.augment/skills',\n OpenClaw: 'skills',\n Cline: '.cline/skills',\n CodeBuddy: '.codebuddy/skills',\n CommandCode: '.commandcode/skills',\n Continue: '.continue/skills',\n Crush: '.crush/skills',\n Droid: '.factory/skills',\n Goose: '.goose/skills',\n Junie: '.junie/skills',\n IFlow: '.iflow/skills',\n KiloCode: '.kilocode/skills',\n Kiro: '.kiro/skills',\n Kode: '.kode/skills',\n MCPJam: '.mcpjam/skills',\n MistralVibe: '.vibe/skills',\n Mux: '.mux/skills',\n OpenHands: '.openhands/skills',\n Pi: '.pi/skills',\n Qoder: '.qoder/skills',\n Qwen: '.qwen/skills',\n RooCode: '.roo/skills',\n TraeCN: '.trae/skills',\n Zencoder: '.zencoder/skills',\n Neovate: '.neovate/skills',\n Pochi: '.pochi/skills',\n Other: 'skills',\n};\n\nexport type Platform = keyof typeof PLATFORM_DIRS;\n\n/**\n * Helper to convert CamelCase to kebab-case for directory naming\n */\nconst camelToKebabCase = (str: string) =>\n str.replace(/([a-z0-9])([A-Z])/g, '$1-$2').toLowerCase();\n\n/**\n * Reads the raw markdown content for a specific skill from the assets folder.\n */\nconst getSkillContent = (skill: Skill): string => {\n const baseName = SKILL_FILENAME_MAP[skill] ?? camelToKebabCase(skill);\n const fileName = `./skills/${baseName}.md`;\n\n try {\n return readAsset(fileName);\n } catch {\n console.warn(\n `Warning: Could not read asset for skill: ${skill} at ${fileName}`\n );\n return '';\n }\n};\n\n/**\n * Reads the licence content from the assets folder.\n */\nconst getLicenceContent = (): string => {\n try {\n return readAsset('./LICENCE.md');\n } catch {\n console.warn('Warning: Could not read LICENCE.md asset');\n return '';\n }\n};\n\n/**\n * Fetches the content of a URL using native fetch.\n */\nconst fetchUrlContent = async (url: string): Promise<string> => {\n const response = await fetch(url);\n if (!response.ok) {\n throw new Error(`Failed to fetch ${url}: ${response.statusText}`);\n }\n return response.text();\n};\n\n/**\n * Installs skills using the \"Agent Skills\" directory standard.\n * Standard: <PROJECT_ROOT>/<CONFIG_DIR>/skills/<SKILL_NAME>/SKILL.md\n */\nexport const installSkills = async (\n projectRoot: string,\n platform: Platform,\n skills: Skill[]\n): Promise<string> => {\n // 1. Determine destination directory\n const relativeDir = PLATFORM_DIRS[platform] ?? 'skills';\n const skillsBaseDir = path.join(projectRoot, relativeDir);\n\n const useAgentStructure = platform !== 'VSCode';\n\n // Ensure the base directory exists\n await fs.mkdir(skillsBaseDir, { recursive: true });\n\n const createdSkills: string[] = [];\n const licenceContent = getLicenceContent();\n\n for (const skill of skills) {\n const baseName = SKILL_FILENAME_MAP[skill] ?? camelToKebabCase(skill);\n const skillName = `intlayer-${baseName}`;\n const skillContent = getSkillContent(skill);\n\n if (!skillContent) continue;\n\n // Extract unique URLs\n const urls = Array.from(\n new Set(\n skillContent.match(/https:\\/\\/intlayer\\.org\\/doc\\/[^\\s)]+\\.md/g) || []\n )\n );\n\n if (useAgentStructure) {\n // Agent Standard: .../skills/<skill-name>/SKILL.md\n const skillDir = path.join(skillsBaseDir, skillName);\n const referenceDir = path.join(skillDir, 'references');\n\n // Ensure directories exist\n await fs.mkdir(referenceDir, { recursive: true });\n\n // Write License\n if (licenceContent) {\n await fs.writeFile(\n path.join(skillDir, 'LICENCE.md'),\n licenceContent,\n 'utf-8'\n );\n }\n\n let updatedSkillContent = skillContent;\n\n // Parallel download of references\n const downloadPromises = urls.map(async (url) => {\n try {\n const content = await fetchUrlContent(url);\n const metadata = getMarkdownMetadata<{ slugs?: string[] }>(content);\n\n let fileName = '';\n\n // Determine filename from slugs or URL path\n if (Array.isArray(metadata.slugs)) {\n fileName = metadata.slugs\n .filter((slug) => slug !== 'doc')\n .join('_');\n } else {\n const urlPath = new URL(url).pathname;\n fileName = urlPath\n .split('/')\n .filter((part) => part && part !== 'doc')\n .map((part) => part.replace('.md', '')) // Clean extension for joining\n .join('_');\n }\n\n // Ensure it ends with .md\n fileName = fileName ? `${fileName}.md` : 'index.md';\n const localRefPath = `references/${fileName}`;\n\n return {\n url,\n localRefPath,\n fileName,\n content,\n success: true,\n };\n } catch (error) {\n console.warn(\n `Warning: Failed to download ref ${url} for skill ${skill}`,\n error\n );\n return { url, success: false };\n }\n });\n\n const results = await Promise.all(downloadPromises);\n\n // Process results: Write files and update content string\n for (const res of results) {\n if (res.success && res.fileName && res.content && res.localRefPath) {\n // Write the reference file\n await fs.writeFile(\n path.join(referenceDir, res.fileName),\n res.content,\n 'utf-8'\n );\n\n // Update the main content to point to local file\n updatedSkillContent = updatedSkillContent.replaceAll(\n res.url,\n res.localRefPath\n );\n }\n }\n\n // Write the main SKILL.md\n const filePath = path.join(skillDir, 'SKILL.md');\n await fs.writeFile(filePath, updatedSkillContent, 'utf-8');\n createdSkills.push(`${skillName}/SKILL.md`);\n } else {\n // Flat Structure (Generic/VSCode): .../skills/<skill-name>.md\n const fileName = `${skillName}.md`;\n const filePath = path.join(skillsBaseDir, fileName);\n\n await fs.writeFile(filePath, skillContent, 'utf-8');\n createdSkills.push(fileName);\n }\n }\n\n if (createdSkills.length === 0) {\n return `No skill files were created. Check your asset paths.`;\n }\n\n return `Created ${createdSkills.length} skills in ${skillsBaseDir}`;\n};\n"],"mappings":"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"}
@@ -1,7 +1,7 @@
1
- import { readFileSync } from "node:fs";
2
- import { join } from "node:path";
3
1
  import { getAppLogger } from "@intlayer/config";
2
+ import { join } from "node:path";
4
3
  import configuration from "@intlayer/config/built";
4
+ import { readFileSync } from "node:fs";
5
5
  import simpleGit from "simple-git";
6
6
 
7
7
  //#region src/listGitFiles.ts
@@ -1,6 +1,6 @@
1
+ import { configurationFilesCandidates } from "@intlayer/config";
1
2
  import { dirname } from "node:path";
2
3
  import fg from "fast-glob";
3
- import { configurationFilesCandidates } from "@intlayer/config";
4
4
  import simpleGit from "simple-git";
5
5
 
6
6
  //#region src/listProjects.ts
@@ -1,7 +1,7 @@
1
1
  import { __require } from "../_virtual/_rolldown/runtime.mjs";
2
+ import { bundleFile, configESMxCJSRequire, getProjectRequire, isESModule } from "@intlayer/config";
2
3
  import { readFile } from "node:fs/promises";
3
4
  import { join } from "node:path";
4
- import { bundleFile, configESMxCJSRequire, getProjectRequire, isESModule } from "@intlayer/config";
5
5
  import { builtinModules, createRequire } from "node:module";
6
6
 
7
7
  //#region src/loadDictionaries/getIntlayerBundle.ts
@@ -1,6 +1,6 @@
1
1
  import { formatLocalDictionaries, loadContentDeclarations } from "./loadContentDeclaration.mjs";
2
- import { loadLocalDictionaries } from "./loadLocalDictionaries.mjs";
3
2
  import { formatDistantDictionaries, loadRemoteDictionaries } from "./loadRemoteDictionaries.mjs";
4
3
  import { loadDictionaries } from "./loadDictionaries.mjs";
4
+ import { loadLocalDictionaries } from "./loadLocalDictionaries.mjs";
5
5
 
6
6
  export { formatDistantDictionaries, formatLocalDictionaries, loadContentDeclarations, loadDictionaries, loadLocalDictionaries, loadRemoteDictionaries };
@@ -2,9 +2,9 @@ import { parallelize } from "../utils/parallelize.mjs";
2
2
  import { filterInvalidDictionaries } from "../filterInvalidDictionaries.mjs";
3
3
  import { processContentDeclaration } from "../buildIntlayerDictionary/processContentDeclaration.mjs";
4
4
  import { getIntlayerBundle } from "./getIntlayerBundle.mjs";
5
+ import { cacheDisk, getProjectRequire, loadExternalFile } from "@intlayer/config";
5
6
  import { writeFile } from "node:fs/promises";
6
7
  import { join, relative } from "node:path";
7
- import { cacheDisk, getProjectRequire, loadExternalFile } from "@intlayer/config";
8
8
 
9
9
  //#region src/loadDictionaries/loadContentDeclaration.ts
10
10
  const formatLocalDictionaries = (dictionariesRecord, configuration) => Object.entries(dictionariesRecord).map(([relativePath, dict]) => ({
@@ -1,6 +1,6 @@
1
1
  import { filterInvalidDictionaries } from "../filterInvalidDictionaries.mjs";
2
- import { formatDictionaries } from "../formatDictionary.mjs";
3
2
  import { loadContentDeclarations } from "./loadContentDeclaration.mjs";
3
+ import { formatDictionaries } from "../formatDictionary.mjs";
4
4
  import { loadRemoteDictionaries } from "./loadRemoteDictionaries.mjs";
5
5
  import { DictionariesLogger } from "./log.mjs";
6
6
  import { ANSIColors, colon, colorize, colorizeKey, getAppLogger } from "@intlayer/config/client";
@@ -1,16 +1,16 @@
1
- import { cleanOutputDir } from "./cleanOutputDir.mjs";
2
- import { createDictionaryEntryPoint } from "./createDictionaryEntryPoint/createDictionaryEntryPoint.mjs";
3
1
  import { buildDictionary } from "./buildIntlayerDictionary/buildIntlayerDictionary.mjs";
2
+ import { createDictionaryEntryPoint } from "./createDictionaryEntryPoint/createDictionaryEntryPoint.mjs";
4
3
  import { createModuleAugmentation } from "./createType/createModuleAugmentation.mjs";
5
4
  import { createTypes } from "./createType/createType.mjs";
6
- import { listDictionariesWithStats } from "./listDictionariesPath.mjs";
7
5
  import { loadDictionaries } from "./loadDictionaries/loadDictionaries.mjs";
8
6
  import { writeRemoteDictionary } from "./buildIntlayerDictionary/writeRemoteDictionary.mjs";
7
+ import { cleanOutputDir } from "./cleanOutputDir.mjs";
8
+ import { listDictionariesWithStats } from "./listDictionariesPath.mjs";
9
9
  import { runOnce } from "./utils/runOnce.mjs";
10
10
  import { isCachedConfigurationUpToDate, writeConfiguration } from "./writeConfiguration/index.mjs";
11
+ import { ANSIColors, cacheDisk, colorize, getAppLogger } from "@intlayer/config";
11
12
  import { stat } from "node:fs/promises";
12
13
  import { join } from "node:path";
13
- import { ANSIColors, cacheDisk, colorize, getAppLogger } from "@intlayer/config";
14
14
  import packageJson from "@intlayer/config/package.json" with { type: "json" };
15
15
 
16
16
  //#region src/prepareIntlayer.ts
@@ -1,9 +1,9 @@
1
- import { extractDictionaryKey } from "./extractDictionaryKey.mjs";
2
1
  import { detectFormatCommand } from "../writeContentDeclaration/detectFormatCommand.mjs";
3
2
  import { writeContentDeclaration } from "../writeContentDeclaration/writeContentDeclaration.mjs";
3
+ import { extractDictionaryKey } from "./extractDictionaryKey.mjs";
4
+ import { ANSIColors, camelCaseToKebabCase, colorizePath, getAppLogger, getConfiguration } from "@intlayer/config";
4
5
  import fs from "node:fs/promises";
5
6
  import { basename, dirname, extname, join, relative, resolve } from "node:path";
6
- import { ANSIColors, camelCaseToKebabCase, colorizePath, getAppLogger, getConfiguration } from "@intlayer/config";
7
7
  import { Node, Project, SyntaxKind } from "ts-morph";
8
8
  import { execSync } from "node:child_process";
9
9