@promptbook/cli 0.112.0-32 → 0.112.0-34

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 (323) hide show
  1. package/esm/index.es.js +571 -538
  2. package/esm/index.es.js.map +1 -1
  3. package/esm/scripts/find-fresh-emoji-tags/find-fresh-emoji-tags.d.ts +1 -3
  4. package/esm/scripts/find-refactor-candidates/analyzeSourceFileForRefactorCandidate.d.ts +27 -0
  5. package/esm/scripts/find-refactor-candidates/buildPromptContent.d.ts +8 -0
  6. package/esm/scripts/find-refactor-candidates/find-refactor-candidates.d.ts +1 -3
  7. package/esm/scripts/find-refactor-candidates/findRefactorCandidatesInProject.d.ts +8 -0
  8. package/esm/scripts/find-refactor-candidates/loadExistingPromptTargets.d.ts +7 -0
  9. package/esm/scripts/find-refactor-candidates/normalizeRefactorCandidatePath.d.ts +7 -0
  10. package/esm/scripts/find-refactor-candidates/writeRefactorCandidatePrompts.d.ts +27 -0
  11. package/esm/scripts/utils/autocommit/isWorkingTreeClean.d.ts +1 -3
  12. package/esm/src/_packages/types.index.d.ts +49 -49
  13. package/esm/src/book-components/Chat/Chat/ChatInputAreaDictationPanel.d.ts +42 -0
  14. package/esm/src/book-components/Chat/Chat/ChatMessageItem.d.ts +1 -14
  15. package/esm/src/book-components/Chat/Chat/ChatMessageRichContent.d.ts +32 -0
  16. package/esm/src/book-components/Chat/Chat/ChatMessageToolCallChips.d.ts +22 -0
  17. package/esm/src/book-components/Chat/Chat/StreamingFeaturePlaceholder.d.ts +33 -0
  18. package/esm/src/book-components/Chat/Chat/createChatMessageToolCallRenderModel.d.ts +76 -0
  19. package/esm/src/book-components/Chat/Chat/createProgressCardChecklistMarkdown.d.ts +16 -0
  20. package/esm/src/book-components/Chat/Chat/renderEmailToolCallDetails.d.ts +26 -0
  21. package/esm/src/book-components/Chat/Chat/renderMemoryToolCallDetails.d.ts +31 -0
  22. package/esm/src/book-components/Chat/Chat/renderPopupToolCallDetails.d.ts +32 -0
  23. package/esm/src/book-components/Chat/Chat/renderRunBrowserToolCallDetails.d.ts +31 -0
  24. package/esm/src/book-components/Chat/Chat/renderSearchToolCallDetails.d.ts +31 -0
  25. package/esm/src/book-components/Chat/Chat/renderSelfLearningToolCallDetails.d.ts +38 -0
  26. package/esm/src/book-components/Chat/Chat/renderTimeToolCallDetails.d.ts +38 -0
  27. package/esm/src/book-components/Chat/Chat/renderTimeoutToolCallDetails.d.ts +46 -0
  28. package/esm/src/book-components/Chat/Chat/renderToolCallClockPanel.d.ts +33 -0
  29. package/esm/src/book-components/Chat/Chat/renderToolCallDetails.d.ts +2 -2
  30. package/esm/src/book-components/Chat/Chat/renderToolCallProgressPlaceholder.d.ts +29 -0
  31. package/esm/src/book-components/Chat/Chat/renderWalletCredentialToolCallDetails.d.ts +26 -0
  32. package/esm/src/book-components/Chat/Chat/resolveToolCallProgressMessage.d.ts +9 -0
  33. package/esm/src/book-components/Chat/Chat/useChatInputAreaAttachments.d.ts +32 -0
  34. package/esm/src/book-components/Chat/Chat/useChatInputAreaDictation.d.ts +76 -0
  35. package/esm/src/book-components/Chat/Chat/useChatMessageAvatarTooltip.d.ts +31 -0
  36. package/esm/src/book-components/Chat/Chat/useChatMessageSpeechPlayback.d.ts +29 -0
  37. package/esm/src/cli/$runPromptbookCli.d.ts +1 -3
  38. package/esm/src/cli/cli-commands/_boilerplate.d.ts +2 -4
  39. package/esm/src/cli/cli-commands/about.d.ts +1 -1
  40. package/esm/src/cli/cli-commands/coder/find-fresh-emoji-tags.d.ts +2 -4
  41. package/esm/src/cli/cli-commands/coder/find-refactor-candidates.d.ts +2 -4
  42. package/esm/src/cli/cli-commands/coder/generate-boilerplates.d.ts +2 -4
  43. package/esm/src/cli/cli-commands/coder/init.d.ts +2 -4
  44. package/esm/src/cli/cli-commands/coder/run.d.ts +2 -4
  45. package/esm/src/cli/cli-commands/coder/verify.d.ts +2 -4
  46. package/esm/src/cli/cli-commands/coder.d.ts +2 -4
  47. package/esm/src/cli/cli-commands/hello.d.ts +1 -1
  48. package/esm/src/cli/cli-commands/list-models.d.ts +2 -4
  49. package/esm/src/cli/cli-commands/list-scrapers.d.ts +2 -4
  50. package/esm/src/cli/cli-commands/login.d.ts +1 -1
  51. package/esm/src/cli/cli-commands/make.d.ts +1 -1
  52. package/esm/src/cli/cli-commands/prettify.d.ts +1 -1
  53. package/esm/src/cli/cli-commands/run.d.ts +1 -1
  54. package/esm/src/cli/cli-commands/runInteractiveChatbot.d.ts +1 -1
  55. package/esm/src/cli/cli-commands/start-agents-server.d.ts +2 -4
  56. package/esm/src/cli/cli-commands/start-pipelines-server.d.ts +1 -1
  57. package/esm/src/cli/cli-commands/test-command.d.ts +1 -1
  58. package/esm/src/cli/main.d.ts +2 -4
  59. package/esm/src/cli/promptbookCli.d.ts +1 -1
  60. package/esm/src/commitments/USE_BROWSER/fetchUrlContent.d.ts +1 -3
  61. package/esm/src/conversion/archive/loadArchive.d.ts +1 -3
  62. package/esm/src/conversion/archive/saveArchive.d.ts +1 -1
  63. package/esm/src/conversion/validation/_importPipeline.d.ts +2 -4
  64. package/esm/src/dialogs/simple-prompt/SimplePromptInterfaceTools.d.ts +1 -3
  65. package/esm/src/executables/$provideExecutablesForNode.d.ts +1 -1
  66. package/esm/src/executables/apps/locateLibreoffice.d.ts +2 -4
  67. package/esm/src/executables/apps/locatePandoc.d.ts +2 -4
  68. package/esm/src/executables/locateApp.d.ts +2 -4
  69. package/esm/src/executables/platforms/locateAppOnLinux.d.ts +2 -4
  70. package/esm/src/executables/platforms/locateAppOnMacOs.d.ts +2 -4
  71. package/esm/src/executables/platforms/locateAppOnWindows.d.ts +2 -4
  72. package/esm/src/execution/translation/automatic-translate/translateMessages.d.ts +2 -4
  73. package/esm/src/execution/utils/$provideExecutionToolsForNode.d.ts +2 -4
  74. package/esm/src/llm-providers/_common/register/$provideEnvFilename.d.ts +1 -3
  75. package/esm/src/llm-providers/_common/register/$provideLlmToolsConfigurationFromEnv.d.ts +1 -3
  76. package/esm/src/llm-providers/_common/register/$provideLlmToolsForWizardOrCli.d.ts +1 -1
  77. package/esm/src/llm-providers/_common/register/$provideLlmToolsFromEnv.d.ts +1 -3
  78. package/esm/src/llm-providers/_multiple/playground/playground.d.ts +1 -3
  79. package/esm/src/llm-providers/agent/playground/playground.d.ts +1 -1
  80. package/esm/src/llm-providers/anthropic-claude/playground/playground.d.ts +1 -1
  81. package/esm/src/llm-providers/azure-openai/playground/playground.d.ts +2 -4
  82. package/esm/src/llm-providers/ollama/playground/playground.d.ts +2 -4
  83. package/esm/src/llm-providers/openai/playground/playground.d.ts +2 -4
  84. package/esm/src/llm-providers/remote/playground/playground.d.ts +1 -3
  85. package/esm/src/llm-providers/vercel/playground/playground.d.ts +2 -4
  86. package/esm/src/playground/permanent/_boilerplate.d.ts +1 -3
  87. package/esm/src/playground/permanent/agent-with-browser-playground.d.ts +1 -3
  88. package/esm/src/playground/permanent/error-handling-playground.d.ts +1 -3
  89. package/esm/src/playground/playground.d.ts +2 -4
  90. package/esm/src/remote-server/startAgentServer.d.ts +1 -3
  91. package/esm/src/remote-server/startRemoteServer.d.ts +1 -2
  92. package/esm/src/scrapers/_boilerplate/BoilerplateScraper.d.ts +4 -6
  93. package/esm/src/scrapers/_boilerplate/playground/boilerplate-scraper-playground.d.ts +1 -3
  94. package/esm/src/scrapers/_common/register/$provideFilesystemForNode.d.ts +2 -4
  95. package/esm/src/scrapers/_common/register/$provideScrapersForNode.d.ts +2 -4
  96. package/esm/src/scrapers/_common/register/$provideScriptingForNode.d.ts +2 -4
  97. package/esm/src/scrapers/_common/utils/getScraperIntermediateSource.d.ts +1 -1
  98. package/esm/src/scrapers/document/DocumentScraper.d.ts +1 -1
  99. package/esm/src/scrapers/document/playground/document-scraper-playground.d.ts +1 -3
  100. package/esm/src/scrapers/document-legacy/LegacyDocumentScraper.d.ts +1 -1
  101. package/esm/src/scrapers/document-legacy/playground/legacy-document-scraper-playground.d.ts +1 -3
  102. package/esm/src/scrapers/markdown/playground/markdown-scraper-playground.d.ts +1 -3
  103. package/esm/src/scrapers/markitdown/MarkitdownScraper.d.ts +1 -1
  104. package/esm/src/scrapers/markitdown/playground/markitdown-scraper-playground.d.ts +1 -3
  105. package/esm/src/scrapers/pdf/PdfScraper.d.ts +1 -1
  106. package/esm/src/scrapers/pdf/playground/pdf-scraper-playground.d.ts +1 -3
  107. package/esm/src/scrapers/website/WebsiteScraper.d.ts +1 -1
  108. package/esm/src/scrapers/website/playground/website-scraper-playground.d.ts +1 -3
  109. package/esm/src/speech-recognition/BrowserSpeechRecognition.d.ts +2 -4
  110. package/esm/src/storage/file-cache-storage/FileCacheStorage.d.ts +2 -4
  111. package/esm/src/storage/local-storage/getIndexedDbStorage.d.ts +1 -3
  112. package/esm/src/storage/local-storage/getLocalStorage.d.ts +1 -3
  113. package/esm/src/storage/local-storage/getSessionStorage.d.ts +1 -3
  114. package/esm/src/transpilers/openai-sdk/playground/playground.d.ts +1 -3
  115. package/esm/src/types/InputParameters_private.d.ts +11 -0
  116. package/esm/src/types/Parameters_private.d.ts +16 -0
  117. package/esm/src/types/ReservedParameters_private.d.ts +10 -0
  118. package/esm/src/types/number_bytes.d.ts +21 -0
  119. package/esm/src/types/number_id.d.ts +13 -0
  120. package/esm/src/types/number_likeness.d.ts +8 -0
  121. package/esm/src/types/number_milliseconds.d.ts +33 -0
  122. package/esm/src/types/number_percent.d.ts +18 -0
  123. package/esm/src/types/number_positive.d.ts +16 -0
  124. package/esm/src/types/number_usd.d.ts +6 -106
  125. package/esm/src/types/string_agent_hash_private.d.ts +9 -0
  126. package/esm/src/types/string_agent_name_in_book_private.d.ts +8 -0
  127. package/esm/src/types/string_agent_name_private.d.ts +9 -0
  128. package/esm/src/types/string_agent_permanent_id_private.d.ts +10 -0
  129. package/esm/src/types/string_base64_private.d.ts +17 -0
  130. package/esm/src/types/string_business_category_name_private.d.ts +6 -0
  131. package/esm/src/types/string_char_private.d.ts +8 -0
  132. package/esm/src/types/string_chat_prompt_private.d.ts +9 -0
  133. package/esm/src/types/string_completion_prompt_private.d.ts +9 -0
  134. package/esm/src/types/string_email_private.d.ts +16 -0
  135. package/esm/src/types/string_host_private.d.ts +55 -0
  136. package/esm/src/types/string_mime_type_private.d.ts +17 -0
  137. package/esm/src/types/string_model_description_private.d.ts +8 -0
  138. package/esm/src/types/string_model_name_private.d.ts +8 -0
  139. package/esm/src/types/string_name_private.d.ts +9 -0
  140. package/esm/src/types/string_page_private.d.ts +9 -0
  141. package/esm/src/types/string_parameter_name.d.ts +74 -31
  142. package/esm/src/types/string_parameter_value_private.d.ts +9 -0
  143. package/esm/src/types/string_persona_description_private.d.ts +8 -0
  144. package/esm/src/types/string_prompt_image_private.d.ts +8 -0
  145. package/esm/src/types/string_prompt_private.d.ts +8 -0
  146. package/esm/src/types/string_reserved_parameter_name_private.d.ts +11 -0
  147. package/esm/src/types/string_system_message_private.d.ts +9 -0
  148. package/esm/src/types/string_template_private.d.ts +8 -0
  149. package/esm/src/types/string_text_prompt_private.d.ts +9 -0
  150. package/esm/src/types/string_title_private.d.ts +9 -0
  151. package/esm/src/types/string_url.d.ts +50 -46
  152. package/esm/src/types/string_url_private.d.ts +88 -0
  153. package/esm/src/types/typeAliases.d.ts +7 -1
  154. package/esm/src/utils/execCommand/$execCommand.d.ts +1 -3
  155. package/esm/src/utils/execCommand/$execCommands.d.ts +1 -3
  156. package/esm/src/utils/files/$induceBookDownload.d.ts +1 -3
  157. package/esm/src/utils/files/$induceFileDownload.d.ts +1 -3
  158. package/esm/src/utils/files/ObjectUrl.d.ts +1 -3
  159. package/esm/src/version.d.ts +1 -1
  160. package/esm/src/wizard/$getCompiledBook.d.ts +2 -4
  161. package/esm/src/wizard/wizard.d.ts +2 -4
  162. package/package.json +1 -1
  163. package/umd/index.umd.js +571 -538
  164. package/umd/index.umd.js.map +1 -1
  165. package/umd/scripts/find-fresh-emoji-tags/find-fresh-emoji-tags.d.ts +1 -3
  166. package/umd/scripts/find-refactor-candidates/analyzeSourceFileForRefactorCandidate.d.ts +27 -0
  167. package/umd/scripts/find-refactor-candidates/buildPromptContent.d.ts +8 -0
  168. package/umd/scripts/find-refactor-candidates/find-refactor-candidates.d.ts +1 -3
  169. package/umd/scripts/find-refactor-candidates/findRefactorCandidatesInProject.d.ts +8 -0
  170. package/umd/scripts/find-refactor-candidates/loadExistingPromptTargets.d.ts +7 -0
  171. package/umd/scripts/find-refactor-candidates/normalizeRefactorCandidatePath.d.ts +7 -0
  172. package/umd/scripts/find-refactor-candidates/writeRefactorCandidatePrompts.d.ts +27 -0
  173. package/umd/scripts/utils/autocommit/isWorkingTreeClean.d.ts +1 -3
  174. package/umd/src/_packages/types.index.d.ts +49 -49
  175. package/umd/src/book-components/Chat/Chat/ChatInputAreaDictationPanel.d.ts +42 -0
  176. package/umd/src/book-components/Chat/Chat/ChatMessageItem.d.ts +1 -14
  177. package/umd/src/book-components/Chat/Chat/ChatMessageRichContent.d.ts +32 -0
  178. package/umd/src/book-components/Chat/Chat/ChatMessageToolCallChips.d.ts +22 -0
  179. package/umd/src/book-components/Chat/Chat/StreamingFeaturePlaceholder.d.ts +33 -0
  180. package/umd/src/book-components/Chat/Chat/createChatMessageToolCallRenderModel.d.ts +76 -0
  181. package/umd/src/book-components/Chat/Chat/createProgressCardChecklistMarkdown.d.ts +16 -0
  182. package/umd/src/book-components/Chat/Chat/renderEmailToolCallDetails.d.ts +26 -0
  183. package/umd/src/book-components/Chat/Chat/renderMemoryToolCallDetails.d.ts +31 -0
  184. package/umd/src/book-components/Chat/Chat/renderPopupToolCallDetails.d.ts +32 -0
  185. package/umd/src/book-components/Chat/Chat/renderRunBrowserToolCallDetails.d.ts +31 -0
  186. package/umd/src/book-components/Chat/Chat/renderSearchToolCallDetails.d.ts +31 -0
  187. package/umd/src/book-components/Chat/Chat/renderSelfLearningToolCallDetails.d.ts +38 -0
  188. package/umd/src/book-components/Chat/Chat/renderTimeToolCallDetails.d.ts +38 -0
  189. package/umd/src/book-components/Chat/Chat/renderTimeoutToolCallDetails.d.ts +46 -0
  190. package/umd/src/book-components/Chat/Chat/renderToolCallClockPanel.d.ts +33 -0
  191. package/umd/src/book-components/Chat/Chat/renderToolCallDetails.d.ts +2 -2
  192. package/umd/src/book-components/Chat/Chat/renderToolCallProgressPlaceholder.d.ts +29 -0
  193. package/umd/src/book-components/Chat/Chat/renderWalletCredentialToolCallDetails.d.ts +26 -0
  194. package/umd/src/book-components/Chat/Chat/resolveToolCallProgressMessage.d.ts +9 -0
  195. package/umd/src/book-components/Chat/Chat/useChatInputAreaAttachments.d.ts +32 -0
  196. package/umd/src/book-components/Chat/Chat/useChatInputAreaDictation.d.ts +76 -0
  197. package/umd/src/book-components/Chat/Chat/useChatMessageAvatarTooltip.d.ts +31 -0
  198. package/umd/src/book-components/Chat/Chat/useChatMessageSpeechPlayback.d.ts +29 -0
  199. package/umd/src/cli/$runPromptbookCli.d.ts +1 -3
  200. package/umd/src/cli/cli-commands/_boilerplate.d.ts +2 -4
  201. package/umd/src/cli/cli-commands/about.d.ts +1 -1
  202. package/umd/src/cli/cli-commands/coder/find-fresh-emoji-tags.d.ts +2 -4
  203. package/umd/src/cli/cli-commands/coder/find-refactor-candidates.d.ts +2 -4
  204. package/umd/src/cli/cli-commands/coder/generate-boilerplates.d.ts +2 -4
  205. package/umd/src/cli/cli-commands/coder/init.d.ts +2 -4
  206. package/umd/src/cli/cli-commands/coder/run.d.ts +2 -4
  207. package/umd/src/cli/cli-commands/coder/verify.d.ts +2 -4
  208. package/umd/src/cli/cli-commands/coder.d.ts +2 -4
  209. package/umd/src/cli/cli-commands/hello.d.ts +1 -1
  210. package/umd/src/cli/cli-commands/list-models.d.ts +2 -4
  211. package/umd/src/cli/cli-commands/list-scrapers.d.ts +2 -4
  212. package/umd/src/cli/cli-commands/login.d.ts +1 -1
  213. package/umd/src/cli/cli-commands/make.d.ts +1 -1
  214. package/umd/src/cli/cli-commands/prettify.d.ts +1 -1
  215. package/umd/src/cli/cli-commands/run.d.ts +1 -1
  216. package/umd/src/cli/cli-commands/runInteractiveChatbot.d.ts +1 -1
  217. package/umd/src/cli/cli-commands/start-agents-server.d.ts +2 -4
  218. package/umd/src/cli/cli-commands/start-pipelines-server.d.ts +1 -1
  219. package/umd/src/cli/cli-commands/test-command.d.ts +1 -1
  220. package/umd/src/cli/main.d.ts +2 -4
  221. package/umd/src/cli/promptbookCli.d.ts +1 -1
  222. package/umd/src/commitments/USE_BROWSER/fetchUrlContent.d.ts +1 -3
  223. package/umd/src/conversion/archive/loadArchive.d.ts +1 -3
  224. package/umd/src/conversion/archive/saveArchive.d.ts +1 -1
  225. package/umd/src/conversion/validation/_importPipeline.d.ts +2 -4
  226. package/umd/src/dialogs/simple-prompt/SimplePromptInterfaceTools.d.ts +1 -3
  227. package/umd/src/executables/$provideExecutablesForNode.d.ts +1 -1
  228. package/umd/src/executables/apps/locateLibreoffice.d.ts +2 -4
  229. package/umd/src/executables/apps/locatePandoc.d.ts +2 -4
  230. package/umd/src/executables/locateApp.d.ts +2 -4
  231. package/umd/src/executables/platforms/locateAppOnLinux.d.ts +2 -4
  232. package/umd/src/executables/platforms/locateAppOnMacOs.d.ts +2 -4
  233. package/umd/src/executables/platforms/locateAppOnWindows.d.ts +2 -4
  234. package/umd/src/execution/translation/automatic-translate/translateMessages.d.ts +2 -4
  235. package/umd/src/execution/utils/$provideExecutionToolsForNode.d.ts +2 -4
  236. package/umd/src/llm-providers/_common/register/$provideEnvFilename.d.ts +1 -3
  237. package/umd/src/llm-providers/_common/register/$provideLlmToolsConfigurationFromEnv.d.ts +1 -3
  238. package/umd/src/llm-providers/_common/register/$provideLlmToolsForWizardOrCli.d.ts +1 -1
  239. package/umd/src/llm-providers/_common/register/$provideLlmToolsFromEnv.d.ts +1 -3
  240. package/umd/src/llm-providers/_multiple/playground/playground.d.ts +1 -3
  241. package/umd/src/llm-providers/agent/playground/playground.d.ts +1 -1
  242. package/umd/src/llm-providers/anthropic-claude/playground/playground.d.ts +1 -1
  243. package/umd/src/llm-providers/azure-openai/playground/playground.d.ts +2 -4
  244. package/umd/src/llm-providers/ollama/playground/playground.d.ts +2 -4
  245. package/umd/src/llm-providers/openai/playground/playground.d.ts +2 -4
  246. package/umd/src/llm-providers/remote/playground/playground.d.ts +1 -3
  247. package/umd/src/llm-providers/vercel/playground/playground.d.ts +2 -4
  248. package/umd/src/playground/permanent/_boilerplate.d.ts +1 -3
  249. package/umd/src/playground/permanent/agent-with-browser-playground.d.ts +1 -3
  250. package/umd/src/playground/permanent/error-handling-playground.d.ts +1 -3
  251. package/umd/src/playground/playground.d.ts +2 -4
  252. package/umd/src/remote-server/startAgentServer.d.ts +1 -3
  253. package/umd/src/remote-server/startRemoteServer.d.ts +1 -2
  254. package/umd/src/scrapers/_boilerplate/BoilerplateScraper.d.ts +4 -6
  255. package/umd/src/scrapers/_boilerplate/playground/boilerplate-scraper-playground.d.ts +1 -3
  256. package/umd/src/scrapers/_common/register/$provideFilesystemForNode.d.ts +2 -4
  257. package/umd/src/scrapers/_common/register/$provideScrapersForNode.d.ts +2 -4
  258. package/umd/src/scrapers/_common/register/$provideScriptingForNode.d.ts +2 -4
  259. package/umd/src/scrapers/_common/utils/getScraperIntermediateSource.d.ts +1 -1
  260. package/umd/src/scrapers/document/DocumentScraper.d.ts +1 -1
  261. package/umd/src/scrapers/document/playground/document-scraper-playground.d.ts +1 -3
  262. package/umd/src/scrapers/document-legacy/LegacyDocumentScraper.d.ts +1 -1
  263. package/umd/src/scrapers/document-legacy/playground/legacy-document-scraper-playground.d.ts +1 -3
  264. package/umd/src/scrapers/markdown/playground/markdown-scraper-playground.d.ts +1 -3
  265. package/umd/src/scrapers/markitdown/MarkitdownScraper.d.ts +1 -1
  266. package/umd/src/scrapers/markitdown/playground/markitdown-scraper-playground.d.ts +1 -3
  267. package/umd/src/scrapers/pdf/PdfScraper.d.ts +1 -1
  268. package/umd/src/scrapers/pdf/playground/pdf-scraper-playground.d.ts +1 -3
  269. package/umd/src/scrapers/website/WebsiteScraper.d.ts +1 -1
  270. package/umd/src/scrapers/website/playground/website-scraper-playground.d.ts +1 -3
  271. package/umd/src/speech-recognition/BrowserSpeechRecognition.d.ts +2 -4
  272. package/umd/src/storage/file-cache-storage/FileCacheStorage.d.ts +2 -4
  273. package/umd/src/storage/local-storage/getIndexedDbStorage.d.ts +1 -3
  274. package/umd/src/storage/local-storage/getLocalStorage.d.ts +1 -3
  275. package/umd/src/storage/local-storage/getSessionStorage.d.ts +1 -3
  276. package/umd/src/transpilers/openai-sdk/playground/playground.d.ts +1 -3
  277. package/umd/src/types/InputParameters_private.d.ts +11 -0
  278. package/umd/src/types/Parameters_private.d.ts +16 -0
  279. package/umd/src/types/ReservedParameters_private.d.ts +10 -0
  280. package/umd/src/types/number_bytes.d.ts +21 -0
  281. package/umd/src/types/number_id.d.ts +13 -0
  282. package/umd/src/types/number_likeness.d.ts +8 -0
  283. package/umd/src/types/number_milliseconds.d.ts +33 -0
  284. package/umd/src/types/number_percent.d.ts +18 -0
  285. package/umd/src/types/number_positive.d.ts +16 -0
  286. package/umd/src/types/number_usd.d.ts +6 -106
  287. package/umd/src/types/string_agent_hash_private.d.ts +9 -0
  288. package/umd/src/types/string_agent_name_in_book_private.d.ts +8 -0
  289. package/umd/src/types/string_agent_name_private.d.ts +9 -0
  290. package/umd/src/types/string_agent_permanent_id_private.d.ts +10 -0
  291. package/umd/src/types/string_base64_private.d.ts +17 -0
  292. package/umd/src/types/string_business_category_name_private.d.ts +6 -0
  293. package/umd/src/types/string_char_private.d.ts +8 -0
  294. package/umd/src/types/string_chat_prompt_private.d.ts +9 -0
  295. package/umd/src/types/string_completion_prompt_private.d.ts +9 -0
  296. package/umd/src/types/string_email_private.d.ts +16 -0
  297. package/umd/src/types/string_host_private.d.ts +55 -0
  298. package/umd/src/types/string_mime_type_private.d.ts +17 -0
  299. package/umd/src/types/string_model_description_private.d.ts +8 -0
  300. package/umd/src/types/string_model_name_private.d.ts +8 -0
  301. package/umd/src/types/string_name_private.d.ts +9 -0
  302. package/umd/src/types/string_page_private.d.ts +9 -0
  303. package/umd/src/types/string_parameter_name.d.ts +74 -31
  304. package/umd/src/types/string_parameter_value_private.d.ts +9 -0
  305. package/umd/src/types/string_persona_description_private.d.ts +8 -0
  306. package/umd/src/types/string_prompt_image_private.d.ts +8 -0
  307. package/umd/src/types/string_prompt_private.d.ts +8 -0
  308. package/umd/src/types/string_reserved_parameter_name_private.d.ts +11 -0
  309. package/umd/src/types/string_system_message_private.d.ts +9 -0
  310. package/umd/src/types/string_template_private.d.ts +8 -0
  311. package/umd/src/types/string_text_prompt_private.d.ts +9 -0
  312. package/umd/src/types/string_title_private.d.ts +9 -0
  313. package/umd/src/types/string_url.d.ts +50 -46
  314. package/umd/src/types/string_url_private.d.ts +88 -0
  315. package/umd/src/types/typeAliases.d.ts +7 -1
  316. package/umd/src/utils/execCommand/$execCommand.d.ts +1 -3
  317. package/umd/src/utils/execCommand/$execCommands.d.ts +1 -3
  318. package/umd/src/utils/files/$induceBookDownload.d.ts +1 -3
  319. package/umd/src/utils/files/$induceFileDownload.d.ts +1 -3
  320. package/umd/src/utils/files/ObjectUrl.d.ts +1 -3
  321. package/umd/src/version.d.ts +1 -1
  322. package/umd/src/wizard/$getCompiledBook.d.ts +2 -4
  323. package/umd/src/wizard/wizard.d.ts +2 -4
package/umd/index.umd.js CHANGED
@@ -60,7 +60,7 @@
60
60
  * @generated
61
61
  * @see https://github.com/webgptorg/promptbook
62
62
  */
63
- const PROMPTBOOK_ENGINE_VERSION = '0.112.0-32';
63
+ const PROMPTBOOK_ENGINE_VERSION = '0.112.0-34';
64
64
  /**
65
65
  * TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
66
66
  * Note: [💞] Ignore a discrepancy between file name and entity name
@@ -1599,11 +1599,11 @@
1599
1599
  return process.exit(0);
1600
1600
  }));
1601
1601
  }
1602
+ /** Note: [🟡] Code for CLI command [about](src/cli/cli-commands/about.ts) should never be published outside of `@promptbook/cli` */
1602
1603
  /**
1603
1604
  * TODO: [🕋] Use here `aboutPromptbookInformation`
1604
1605
  * TODO: [🗽] Unite branding and make single place for it
1605
1606
  * Note: [💞] Ignore a discrepancy between file name and entity name
1606
- * Note: [🟡] Code in this file should never be published outside of `@promptbook/cli`
1607
1607
  */
1608
1608
 
1609
1609
  /**
@@ -1635,10 +1635,8 @@
1635
1635
  return process.exit(0);
1636
1636
  }));
1637
1637
  }
1638
- /**
1639
- * Note: [💞] Ignore a discrepancy between file name and entity name
1640
- * Note: [🟡] Code in this file should never be published outside of `@promptbook/cli`
1641
- */
1638
+ /** Note: [🟡] Code for CLI command [find-fresh-emoji-tags](src/cli/cli-commands/coder/find-fresh-emoji-tags.ts) should never be published outside of `@promptbook/cli` */
1639
+ /** Note: [💞] Ignore a discrepancy between file name and entity name */
1642
1640
 
1643
1641
  /**
1644
1642
  * Initializes `coder find-refactor-candidates` command for Promptbook CLI utilities
@@ -1673,10 +1671,8 @@
1673
1671
  return process.exit(0);
1674
1672
  }));
1675
1673
  }
1676
- /**
1677
- * Note: [💞] Ignore a discrepancy between file name and entity name
1678
- * Note: [🟡] Code in this file should never be published outside of `@promptbook/cli`
1679
- */
1674
+ /** Note: [🟡] Code for CLI command [find-refactor-candidates](src/cli/cli-commands/coder/find-refactor-candidates.ts) should never be published outside of `@promptbook/cli` */
1675
+ /** Note: [💞] Ignore a discrepancy between file name and entity name */
1680
1676
 
1681
1677
  /**
1682
1678
  * Initializes `coder generate-boilerplates` command for Promptbook CLI utilities
@@ -1825,10 +1821,8 @@
1825
1821
  }
1826
1822
  return `${template}-${title}`;
1827
1823
  }
1828
- /**
1829
- * Note: [💞] Ignore a discrepancy between file name and entity name
1830
- * Note: [🟡] Code in this file should never be published outside of `@promptbook/cli`
1831
- */
1824
+ /** Note: [🟡] Code for CLI command [generate-boilerplates](src/cli/cli-commands/coder/generate-boilerplates.ts) should never be published outside of `@promptbook/cli` */
1825
+ /** Note: [💞] Ignore a discrepancy between file name and entity name */
1832
1826
 
1833
1827
  /**
1834
1828
  * Relative path to the root prompts directory used by Promptbook coder utilities.
@@ -2024,10 +2018,8 @@
2024
2018
  return false;
2025
2019
  }
2026
2020
  }
2027
- /**
2028
- * Note: [💞] Ignore a discrepancy between file name and entity name
2029
- * Note: [🟡] Code in this file should never be published outside of `@promptbook/cli`
2030
- */
2021
+ /** Note: [🟡] Code for CLI command [init](src/cli/cli-commands/coder/init.ts) should never be published outside of `@promptbook/cli` */
2022
+ /** Note: [💞] Ignore a discrepancy between file name and entity name */
2031
2023
 
2032
2024
  /**
2033
2025
  * Initializes `coder run` command for Promptbook CLI utilities
@@ -2132,10 +2124,8 @@
2132
2124
  }
2133
2125
  return parsed;
2134
2126
  }
2135
- /**
2136
- * Note: [💞] Ignore a discrepancy between file name and entity name
2137
- * Note: [🟡] Code in this file should never be published outside of `@promptbook/cli`
2138
- */
2127
+ /** Note: [🟡] Code for CLI command [run](src/cli/cli-commands/coder/run.ts) should never be published outside of `@promptbook/cli` */
2128
+ /** Note: [💞] Ignore a discrepancy between file name and entity name */
2139
2129
 
2140
2130
  /**
2141
2131
  * Initializes `coder verify` command for Promptbook CLI utilities
@@ -2171,10 +2161,8 @@
2171
2161
  return process.exit(0);
2172
2162
  }));
2173
2163
  }
2174
- /**
2175
- * Note: [💞] Ignore a discrepancy between file name and entity name
2176
- * Note: [🟡] Code in this file should never be published outside of `@promptbook/cli`
2177
- */
2164
+ /** Note: [🟡] Code for CLI command [verify](src/cli/cli-commands/coder/verify.ts) should never be published outside of `@promptbook/cli` */
2165
+ /** Note: [💞] Ignore a discrepancy between file name and entity name */
2178
2166
 
2179
2167
  /**
2180
2168
  * Initializes `coder` command with subcommands for Promptbook CLI utilities
@@ -2218,10 +2206,8 @@
2218
2206
  coderCommand.help();
2219
2207
  });
2220
2208
  }
2221
- /**
2222
- * Note: [💞] Ignore a discrepancy between file name and entity name
2223
- * Note: [🟡] Code in this file should never be published outside of `@promptbook/cli`
2224
- */
2209
+ /** Note: [🟡] Code for CLI command [coder](src/cli/cli-commands/coder.ts) should never be published outside of `@promptbook/cli` */
2210
+ /** Note: [💞] Ignore a discrepancy between file name and entity name */
2225
2211
 
2226
2212
  /**
2227
2213
  * Initializes testing `hello` command for Promptbook CLI utilities
@@ -2246,10 +2232,10 @@
2246
2232
  return process.exit(0);
2247
2233
  }));
2248
2234
  }
2235
+ /** Note: [🟡] Code for CLI command [hello](src/cli/cli-commands/hello.ts) should never be published outside of `@promptbook/cli` */
2249
2236
  /**
2250
2237
  * TODO: [🧠][🐣] Make here some easter egg with generated hello greeting via LLM models
2251
2238
  * Note: [💞] Ignore a discrepancy between file name and entity name
2252
- * Note: [🟡] Code in this file should never be published outside of `@promptbook/cli`
2253
2239
  */
2254
2240
 
2255
2241
  /**
@@ -2690,10 +2676,8 @@
2690
2676
  watch: promises.watch,
2691
2677
  };
2692
2678
  }
2693
- /**
2694
- * Note: [🟢] Code in this file should never be never released in packages that could be imported into browser environment
2695
- * TODO: [🏓] Unite `xxxForServer` and `xxxForNode` naming
2696
- */
2679
+ /** Note: [🟢] Code for Node scraper registration helper [$provideFilesystemForNode](src/scrapers/_common/register/$provideFilesystemForNode.ts) should never be published into packages that could be imported into browser environment */
2680
+ /** TODO: [🏓] Unite `xxxForServer` and `xxxForNode` naming */
2697
2681
 
2698
2682
  /**
2699
2683
  * Checks if the file exists
@@ -2779,9 +2763,7 @@
2779
2763
  }
2780
2764
  return null;
2781
2765
  }
2782
- /**
2783
- * Note: [🟢] Code in this file should never be never released in packages that could be imported into browser environment
2784
- */
2766
+ /** Note: [🟢] Code for Node environment helper [$provideEnvFilename](src/llm-providers/_common/register/$provideEnvFilename.ts) should never be published into packages that could be imported into browser environment */
2785
2767
 
2786
2768
  /**
2787
2769
  * Stores data in .env variables
@@ -3865,10 +3847,8 @@
3865
3847
  // [0] When `setItem` and `removeItem` called, the state of the file system should be the same
3866
3848
  }
3867
3849
  }
3868
- /**
3869
- * TODO: [🌗] Maybe some checkers, not all valid JSONs are desired and valid values
3870
- * Note: [🟢] Code in this file should never be never released in packages that could be imported into browser environment
3871
- */
3850
+ /** Note: [🟢] Code for Node file-cache storage [FileCacheStorage](src/storage/file-cache-storage/FileCacheStorage.ts) should never be published into packages that could be imported into browser environment */
3851
+ /** TODO: [🌗] Maybe some checkers, not all valid JSONs are desired and valid values */
3872
3852
 
3873
3853
  /**
3874
3854
  * This error indicates problems parsing the format value
@@ -8158,9 +8138,7 @@
8158
8138
  .filter((configuration) => configuration !== null);
8159
8139
  return llmToolsConfiguration;
8160
8140
  }
8161
- /**
8162
- * Note: [🟢] Code in this file should never be never released in packages that could be imported into browser environment
8163
- */
8141
+ /** Note: [🟢] Code for Node environment helper [$provideLlmToolsConfigurationFromEnv](src/llm-providers/_common/register/$provideLlmToolsConfigurationFromEnv.ts) should never be published into packages that could be imported into browser environment */
8164
8142
 
8165
8143
  /**
8166
8144
  * Profile for Multiple providers aggregation
@@ -8491,20 +8469,18 @@
8491
8469
  }
8492
8470
  return createLlmToolsFromConfiguration(configuration, options);
8493
8471
  }
8472
+ /** Note: [🟢] Code for Node environment helper [$provideLlmToolsFromEnv](src/llm-providers/_common/register/$provideLlmToolsFromEnv.ts) should never be published into packages that could be imported into browser environment */
8494
8473
  /**
8495
8474
  * TODO: The architecture for LLM tools configuration consists of three key functions:
8496
8475
  * 1. `$provideLlmToolsFromEnv` - High-level function that detects available providers from env vars and returns ready-to-use LLM tools
8497
8476
  * 2. `$provideLlmToolsConfigurationFromEnv` - Middle layer that extracts configuration objects from environment variables
8498
8477
  * 3. `createLlmToolsFromConfiguration` - Low-level function that instantiates LLM tools from explicit configuration
8499
- *
8500
8478
  * This layered approach allows flexibility in how tools are configured:
8501
8479
  * - Use $provideLlmToolsFromEnv for automatic detection and setup in Node.js environments
8502
8480
  * - Use $provideLlmToolsConfigurationFromEnv to extract config objects for modification before instantiation
8503
8481
  * - Use createLlmToolsFromConfiguration for explicit control over tool configurations
8504
- *
8505
8482
  * TODO: [🧠][🍛] Which name is better `$provideLlmToolsFromEnv` or `$provideLlmToolsFromEnvironment`?
8506
8483
  * TODO: [🧠] Is there some meaningfull way how to test this util
8507
- * Note: [🟢] Code in this file should never be never released in packages that could be imported into browser environment
8508
8484
  * TODO: [🥃] Allow `ptbk make` without llm tools
8509
8485
  * TODO: This should be maybe not under `_common` but under `utils`
8510
8486
  * TODO: [®] DRY Register logic
@@ -8567,8 +8543,8 @@
8567
8543
  isCacheReloaded,
8568
8544
  });
8569
8545
  }
8546
+ /** Note: [🟢] Code for Node environment helper [$provideLlmToolsForWizardOrCli](src/llm-providers/_common/register/$provideLlmToolsForWizardOrCli.ts) should never be published into packages that could be imported into browser environment */
8570
8547
  /**
8571
- * Note: [🟢] Code in this file should never be never released in packages that could be imported into browser environment
8572
8548
  * TODO: [👷‍♂️] Write a comprehensive manual about the construction of LLM tools
8573
8549
  * TODO: [🥃] Allow `ptbk make` without llm tools
8574
8550
  * TODO: This should be maybe not under `_common` but under `utils-internal` / `utils/internal`
@@ -8737,10 +8713,8 @@
8737
8713
  return process.exit(0);
8738
8714
  }));
8739
8715
  }
8740
- /**
8741
- * Note: [💞] Ignore a discrepancy between file name and entity name
8742
- * Note: [🟡] Code in this file should never be published outside of `@promptbook/cli`
8743
- */
8716
+ /** Note: [🟡] Code for CLI command [list-models](src/cli/cli-commands/list-models.ts) should never be published outside of `@promptbook/cli` */
8717
+ /** Note: [💞] Ignore a discrepancy between file name and entity name */
8744
8718
 
8745
8719
  /**
8746
8720
  * Normalize options for `execCommand` and `execCommands`
@@ -8907,9 +8881,7 @@
8907
8881
  }
8908
8882
  });
8909
8883
  }
8910
- /**
8911
- * Note: [🟢] Code in this file should never be never released in packages that could be imported into browser environment
8912
- */
8884
+ /** Note: [🟢] Code for Node command-execution helper [$execCommand](src/utils/execCommand/$execCommand.ts) should never be published into packages that could be imported into browser environment */
8913
8885
 
8914
8886
  /**
8915
8887
  * Attempts to locate the specified application on a Linux system using the 'which' command.
@@ -8927,10 +8899,8 @@
8927
8899
  return null;
8928
8900
  }
8929
8901
  }
8930
- /**
8931
- * TODO: [🧠][♿] Maybe export through `@promptbook/node`
8932
- * Note: [🟢] Code in this file should never be never released in packages that could be imported into browser environment
8933
- */
8902
+ /** Note: [🟢] Code for Node executable locator [locateAppOnLinux](src/executables/platforms/locateAppOnLinux.ts) should never be published into packages that could be imported into browser environment */
8903
+ /** TODO: [🧠][♿] Maybe export through `@promptbook/node` */
8934
8904
 
8935
8905
  /**
8936
8906
  * Checks if the file is executable
@@ -8983,10 +8953,8 @@
8983
8953
  return null;
8984
8954
  }
8985
8955
  }
8986
- /**
8987
- * TODO: [🧠][♿] Maybe export through `@promptbook/node`
8988
- * Note: [🟢] Code in this file should never be never released in packages that could be imported into browser environment
8989
- */
8956
+ /** Note: [🟢] Code for Node executable locator [locateAppOnMacOs](src/executables/platforms/locateAppOnMacOs.ts) should never be published into packages that could be imported into browser environment */
8957
+ /** TODO: [🧠][♿] Maybe export through `@promptbook/node` */
8990
8958
 
8991
8959
  /**
8992
8960
  * Attempts to locate the specified application on a Windows system by searching common installation directories.
@@ -9015,10 +8983,8 @@
9015
8983
  return null;
9016
8984
  }
9017
8985
  }
9018
- /**
9019
- * TODO: [🧠][♿] Maybe export through `@promptbook/node`
9020
- * Note: [🟢] Code in this file should never be never released in packages that could be imported into browser environment
9021
- */
8986
+ /** Note: [🟢] Code for Node executable locator [locateAppOnWindows](src/executables/platforms/locateAppOnWindows.ts) should never be published into packages that could be imported into browser environment */
8987
+ /** TODO: [🧠][♿] Maybe export through `@promptbook/node` */
9022
8988
 
9023
8989
  /**
9024
8990
  * Locates an application on the system
@@ -9055,10 +9021,8 @@
9055
9021
  }
9056
9022
  }
9057
9023
  }
9058
- /**
9059
- * TODO: [🧠][♿] Maybe export through `@promptbook/node`
9060
- * Note: [🟢] Code in this file should never be never released in packages that could be imported into browser environment
9061
- */
9024
+ /** Note: [🟢] Code for Node executable locator [locateApp](src/executables/locateApp.ts) should never be published into packages that could be imported into browser environment */
9025
+ /** TODO: [🧠][♿] Maybe export through `@promptbook/node` */
9062
9026
 
9063
9027
  /**
9064
9028
  * Locates the LibreOffice executable on the current system by searching platform-specific paths.
@@ -9074,10 +9038,8 @@
9074
9038
  macOsName: 'LibreOffice',
9075
9039
  });
9076
9040
  }
9077
- /**
9078
- * TODO: [🧠][♿] Maybe export through `@promptbook/node` OR `@promptbook/legacy-documents`
9079
- * Note: [🟢] Code in this file should never be never released in packages that could be imported into browser environment
9080
- */
9041
+ /** Note: [🟢] Code for Node executable locator [locateLibreoffice](src/executables/apps/locateLibreoffice.ts) should never be published into packages that could be imported into browser environment */
9042
+ /** TODO: [🧠][♿] Maybe export through `@promptbook/node` OR `@promptbook/legacy-documents` */
9081
9043
 
9082
9044
  /**
9083
9045
  * Locates the Pandoc executable on the current system by searching platform-specific paths.
@@ -9093,10 +9055,8 @@
9093
9055
  macOsName: 'Pandoc',
9094
9056
  });
9095
9057
  }
9096
- /**
9097
- * TODO: [🧠][♿] Maybe export through `@promptbook/node` OR `@promptbook/documents`
9098
- * Note: [🟢] Code in this file should never be never released in packages that could be imported into browser environment
9099
- */
9058
+ /** Note: [🟢] Code for Node executable locator [locatePandoc](src/executables/apps/locatePandoc.ts) should never be published into packages that could be imported into browser environment */
9059
+ /** TODO: [🧠][♿] Maybe export through `@promptbook/node` OR `@promptbook/documents` */
9100
9060
 
9101
9061
  /**
9102
9062
  * Provides paths to required executables (i.e. as Pandoc and LibreOffice) for Node.js environments.
@@ -9113,9 +9073,9 @@
9113
9073
  // <- TODO: [🧠] `null` vs `undefined`
9114
9074
  };
9115
9075
  }
9076
+ /** Note: [🟢] Code for Node executable locator [$provideExecutablesForNode](src/executables/$provideExecutablesForNode.ts) should never be published into packages that could be imported into browser environment */
9116
9077
  /**
9117
9078
  * TODO: [🧠] Allow to override the executables without need to call `locatePandoc` / `locateLibreoffice` in case of provided
9118
- * Note: [🟢] Code in this file should never be never released in packages that could be imported into browser environment
9119
9079
  * TODO: [🏓] Unite `xxxForServer` and `xxxForNode` naming
9120
9080
  */
9121
9081
 
@@ -9155,10 +9115,8 @@
9155
9115
  }
9156
9116
  return scrapers;
9157
9117
  }
9158
- /**
9159
- * Note: [🟢] Code in this file should never be never released in packages that could be imported into browser environment
9160
- * TODO: [🏓] Unite `xxxForServer` and `xxxForNode` naming
9161
- */
9118
+ /** Note: [🟢] Code for Node scraper registration helper [$provideScrapersForNode](src/scrapers/_common/register/$provideScrapersForNode.ts) should never be published into packages that could be imported into browser environment */
9119
+ /** TODO: [🏓] Unite `xxxForServer` and `xxxForNode` naming */
9162
9120
 
9163
9121
  /**
9164
9122
  * Global registry for storing metadata about all available scrapers and converters.
@@ -9292,10 +9250,8 @@
9292
9250
  return process.exit(0);
9293
9251
  }));
9294
9252
  }
9295
- /**
9296
- * Note: [💞] Ignore a discrepancy between file name and entity name
9297
- * Note: [🟡] Code in this file should never be published outside of `@promptbook/cli`
9298
- */
9253
+ /** Note: [🟡] Code for CLI command [list-scrapers](src/cli/cli-commands/list-scrapers.ts) should never be published outside of `@promptbook/cli` */
9254
+ /** Note: [💞] Ignore a discrepancy between file name and entity name */
9299
9255
 
9300
9256
  /**
9301
9257
  * Initializes `login` command for Promptbook CLI utilities
@@ -9322,10 +9278,10 @@
9322
9278
  return process.exit(0);
9323
9279
  }));
9324
9280
  }
9281
+ /** Note: [🟡] Code for CLI command [login](src/cli/cli-commands/login.ts) should never be published outside of `@promptbook/cli` */
9325
9282
  /**
9326
9283
  * TODO: Implement non-interactive login
9327
9284
  * Note: [💞] Ignore a discrepancy between file name and entity name
9328
- * Note: [🟡] Code in this file should never be published outside of `@promptbook/cli`
9329
9285
  */
9330
9286
 
9331
9287
  /**
@@ -9646,9 +9602,7 @@
9646
9602
  }
9647
9603
  return collectionJson;
9648
9604
  }
9649
- /**
9650
- * Note: [🟢] Code in this file should never be never released in packages that could be imported into browser environment
9651
- */
9605
+ /** Note: [🟢] Code for Node archive helper [loadArchive](src/conversion/archive/loadArchive.ts) should never be published into packages that could be imported into browser environment */
9652
9606
 
9653
9607
  var PipelineCollection = [{title:"Prepare Knowledge from Markdown",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-from-markdown.book",formfactorName:"GENERIC",parameters:[{name:"knowledgeContent",description:"Markdown document content",isInput:true,isOutput:false},{name:"knowledgePieces",description:"The knowledge JSON object",isInput:false,isOutput:true}],tasks:[{taskType:"PROMPT_TASK",name:"knowledge",title:"Knowledge",content:"You are experienced data researcher, extract the important knowledge from the document.\n\n# Rules\n\n- Make pieces of information concise, clear, and easy to understand\n- One piece of information should be approximately 1 paragraph\n- Divide the paragraphs by markdown horizontal lines ---\n- Omit irrelevant information\n- Group redundant information\n- Write just extracted information, nothing else\n\n# The document\n\nTake information from this document:\n\n> {knowledgeContent}",resultingParameterName:"knowledgePieces",dependentParameterNames:["knowledgeContent"]}],personas:[],preparations:[],knowledgeSources:[],knowledgePieces:[],sources:[{type:"BOOK",path:null,content:"# Prepare Knowledge from Markdown\n\n- PIPELINE URL `https://promptbook.studio/promptbook/prepare-knowledge-from-markdown.book`\n- INPUT PARAMETER `{knowledgeContent}` Markdown document content\n- OUTPUT PARAMETER `{knowledgePieces}` The knowledge JSON object\n\n## Knowledge\n\n<!-- TODO: [🍆] -FORMAT JSON -->\n\n```markdown\nYou are experienced data researcher, extract the important knowledge from the document.\n\n# Rules\n\n- Make pieces of information concise, clear, and easy to understand\n- One piece of information should be approximately 1 paragraph\n- Divide the paragraphs by markdown horizontal lines ---\n- Omit irrelevant information\n- Group redundant information\n- Write just extracted information, nothing else\n\n# The document\n\nTake information from this document:\n\n> {knowledgeContent}\n```\n\n`-> {knowledgePieces}`\n"}],sourceFile:"./books/prepare-knowledge-from-markdown.book"},{title:"Prepare Keywords",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-keywords.book",formfactorName:"GENERIC",parameters:[{name:"knowledgePieceContent",description:"The content",isInput:true,isOutput:false},{name:"keywords",description:"Keywords separated by comma",isInput:false,isOutput:true}],tasks:[{taskType:"PROMPT_TASK",name:"knowledge",title:"Knowledge",content:"You are experienced data researcher, detect the important keywords in the document.\n\n# Rules\n\n- Write just keywords separated by comma\n\n# The document\n\nTake information from this document:\n\n> {knowledgePieceContent}",resultingParameterName:"keywords",dependentParameterNames:["knowledgePieceContent"]}],personas:[],preparations:[],knowledgeSources:[],knowledgePieces:[],sources:[{type:"BOOK",path:null,content:"# Prepare Keywords\n\n- PIPELINE URL `https://promptbook.studio/promptbook/prepare-knowledge-keywords.book`\n- INPUT PARAMETER `{knowledgePieceContent}` The content\n- OUTPUT PARAMETER `{keywords}` Keywords separated by comma\n\n## Knowledge\n\n<!-- TODO: [🍆] -FORMAT JSON -->\n\n```markdown\nYou are experienced data researcher, detect the important keywords in the document.\n\n# Rules\n\n- Write just keywords separated by comma\n\n# The document\n\nTake information from this document:\n\n> {knowledgePieceContent}\n```\n\n`-> {keywords}`\n"}],sourceFile:"./books/prepare-knowledge-keywords.book"},{title:"Prepare Knowledge-piece Title",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-title.book",formfactorName:"GENERIC",parameters:[{name:"knowledgePieceContent",description:"The content",isInput:true,isOutput:false},{name:"title",description:"The title of the document",isInput:false,isOutput:true}],tasks:[{taskType:"PROMPT_TASK",name:"knowledge",title:"Knowledge",content:"You are experienced content creator, write best title for the document.\n\n# Rules\n\n- Write just title, nothing else\n- Write maximum 5 words for the title\n\n# The document\n\n> {knowledgePieceContent}",resultingParameterName:"title",expectations:{words:{min:1,max:8}},dependentParameterNames:["knowledgePieceContent"]}],personas:[],preparations:[],knowledgeSources:[],knowledgePieces:[],sources:[{type:"BOOK",path:null,content:"# Prepare Knowledge-piece Title\n\n- PIPELINE URL `https://promptbook.studio/promptbook/prepare-knowledge-title.book`\n- INPUT PARAMETER `{knowledgePieceContent}` The content\n- OUTPUT PARAMETER `{title}` The title of the document\n\n## Knowledge\n\n- EXPECT MIN 1 WORD\n- EXPECT MAX 8 WORDS\n\n```markdown\nYou are experienced content creator, write best title for the document.\n\n# Rules\n\n- Write just title, nothing else\n- Write maximum 5 words for the title\n\n# The document\n\n> {knowledgePieceContent}\n```\n\n`-> {title}`\n"}],sourceFile:"./books/prepare-knowledge-title.book"},{title:"Prepare Persona",pipelineUrl:"https://promptbook.studio/promptbook/prepare-persona.book",formfactorName:"GENERIC",parameters:[{name:"availableModels",description:"List of available model names together with their descriptions as JSON",isInput:true,isOutput:false},{name:"personaDescription",description:"Description of the persona",isInput:true,isOutput:false},{name:"modelsRequirements",description:"Specific requirements for the model",isInput:false,isOutput:true}],tasks:[{taskType:"PROMPT_TASK",name:"make-model-requirements",title:"Make modelRequirements",content:"You are an experienced AI engineer, you need to find the best models for virtual assistants:\n\n## Example\n\n```json\n[\n {\n \"modelName\": \"gpt-4o\",\n \"systemMessage\": \"You are experienced AI engineer and helpful assistant.\",\n \"temperature\": 0.7\n },\n {\n \"modelName\": \"claude-3-5-sonnet\",\n \"systemMessage\": \"You are a friendly and knowledgeable chatbot.\",\n \"temperature\": 0.5\n }\n]\n```\n\n## Instructions\n\n- Your output format is JSON array\n- Sort best-fitting models first\n- Omit any models that are not suitable\n- Write just the JSON, no other text should be present\n- Array contain items with following keys:\n - `modelName`: The name of the model to use\n - `systemMessage`: The system message to provide context to the model\n - `temperature`: The sampling temperature to use\n\n### Key `modelName`\n\nHere are the available models:\n\n```json\n{availableModels}\n```\n\n### Key `systemMessage`\n\nThe system message is used to communicate instructions or provide context to the model at the beginning of a conversation. It is displayed in a different format compared to user messages, helping the model understand its role in the conversation. The system message typically guides the model's behavior, sets the tone, or specifies desired output from the model. By utilizing the system message effectively, users can steer the model towards generating more accurate and relevant responses.\n\nFor example:\n\n> You are an experienced AI engineer and helpful assistant.\n\n> You are a friendly and knowledgeable chatbot.\n\n### Key `temperature`\n\nThe sampling temperature, between 0 and 1. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. If set to 0, the model will use log probability to automatically increase the temperature until certain thresholds are hit.\n\nYou can pick a value between 0 and 2. For example:\n\n- `0.1`: Low temperature, extremely conservative and deterministic\n- `0.5`: Medium temperature, balanced between conservative and creative\n- `1.0`: High temperature, creative and bit random\n- `1.5`: Very high temperature, extremely creative and often chaotic and unpredictable\n- `2.0`: Maximum temperature, completely random and unpredictable, for some extreme creative use cases\n\n# The assistant\n\nTake this description of the persona:\n\n> {personaDescription}",resultingParameterName:"modelsRequirements",format:"JSON",dependentParameterNames:["availableModels","personaDescription"]}],personas:[],preparations:[],knowledgeSources:[],knowledgePieces:[],sources:[{type:"BOOK",path:null,content:"# Prepare Persona\n\n- PIPELINE URL `https://promptbook.studio/promptbook/prepare-persona.book`\n- INPUT PARAMETER `{availableModels}` List of available model names together with their descriptions as JSON\n- INPUT PARAMETER `{personaDescription}` Description of the persona\n- OUTPUT PARAMETER `{modelsRequirements}` Specific requirements for the model\n\n## Make modelRequirements\n\n- FORMAT JSON\n\n```markdown\nYou are an experienced AI engineer, you need to find the best models for virtual assistants:\n\n## Example\n\n\\`\\`\\`json\n[\n {\n \"modelName\": \"gpt-4o\",\n \"systemMessage\": \"You are experienced AI engineer and helpful assistant.\",\n \"temperature\": 0.7\n },\n {\n \"modelName\": \"claude-3-5-sonnet\",\n \"systemMessage\": \"You are a friendly and knowledgeable chatbot.\",\n \"temperature\": 0.5\n }\n]\n\\`\\`\\`\n\n## Instructions\n\n- Your output format is JSON array\n- Sort best-fitting models first\n- Omit any models that are not suitable\n- Write just the JSON, no other text should be present\n- Array contain items with following keys:\n - `modelName`: The name of the model to use\n - `systemMessage`: The system message to provide context to the model\n - `temperature`: The sampling temperature to use\n\n### Key `modelName`\n\nHere are the available models:\n\n\\`\\`\\`json\n{availableModels}\n\\`\\`\\`\n\n### Key `systemMessage`\n\nThe system message is used to communicate instructions or provide context to the model at the beginning of a conversation. It is displayed in a different format compared to user messages, helping the model understand its role in the conversation. The system message typically guides the model's behavior, sets the tone, or specifies desired output from the model. By utilizing the system message effectively, users can steer the model towards generating more accurate and relevant responses.\n\nFor example:\n\n> You are an experienced AI engineer and helpful assistant.\n\n> You are a friendly and knowledgeable chatbot.\n\n### Key `temperature`\n\nThe sampling temperature, between 0 and 1. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. If set to 0, the model will use log probability to automatically increase the temperature until certain thresholds are hit.\n\nYou can pick a value between 0 and 2. For example:\n\n- `0.1`: Low temperature, extremely conservative and deterministic\n- `0.5`: Medium temperature, balanced between conservative and creative\n- `1.0`: High temperature, creative and bit random\n- `1.5`: Very high temperature, extremely creative and often chaotic and unpredictable\n- `2.0`: Maximum temperature, completely random and unpredictable, for some extreme creative use cases\n\n# The assistant\n\nTake this description of the persona:\n\n> {personaDescription}\n```\n\n`-> {modelsRequirements}`\n"}],sourceFile:"./books/prepare-persona.book"},{title:"Prepare Title",pipelineUrl:"https://promptbook.studio/promptbook/prepare-title.book",formfactorName:"GENERIC",parameters:[{name:"book",description:"The book to prepare the title for",isInput:true,isOutput:false},{name:"title",description:"Best title for the book",isInput:false,isOutput:true}],tasks:[{taskType:"PROMPT_TASK",name:"make-title",title:"Make title",content:"Make best title for given text which describes the workflow:\n\n## Rules\n\n- Write just title, nothing else\n- Title should be concise and clear - Write maximum ideally 2 words, maximum 5 words\n- Title starts with emoticon\n- Title should not mention the input and output of the workflow but the main purpose of the workflow\n _For example, not \"✍ Convert Knowledge-piece to title\" but \"✍ Title\"_\n\n## The workflow\n\n> {book}",resultingParameterName:"title",expectations:{words:{min:1,max:8},lines:{min:1,max:1}},dependentParameterNames:["book"]}],personas:[],preparations:[],knowledgeSources:[],knowledgePieces:[],sources:[{type:"BOOK",path:null,content:"# Prepare Title\n\n- PIPELINE URL `https://promptbook.studio/promptbook/prepare-title.book`\n- INPUT PARAMETER `{book}` The book to prepare the title for\n- OUTPUT PARAMETER `{title}` Best title for the book\n\n## Make title\n\n- EXPECT MIN 1 Word\n- EXPECT MAX 8 Words\n- EXPECT EXACTLY 1 Line\n\n```markdown\nMake best title for given text which describes the workflow:\n\n## Rules\n\n- Write just title, nothing else\n- Title should be concise and clear - Write maximum ideally 2 words, maximum 5 words\n- Title starts with emoticon\n- Title should not mention the input and output of the workflow but the main purpose of the workflow\n _For example, not \"✍ Convert Knowledge-piece to title\" but \"✍ Title\"_\n\n## The workflow\n\n> {book}\n```\n\n`-> {title}`\n"}],sourceFile:"./books/prepare-title.book"}];
9654
9608
 
@@ -16061,12 +16015,12 @@
16061
16015
  };
16062
16016
  return fileHandler;
16063
16017
  }
16018
+ /** Note: [🟢] Code for Node scraper helper [getScraperIntermediateSource](src/scrapers/_common/utils/getScraperIntermediateSource.ts) should never be published into packages that could be imported into browser environment */
16064
16019
  /**
16065
16020
  * Note: Not using `FileCacheStorage` for two reasons:
16066
16021
  * 1) Need to store more than serialized JSONs
16067
16022
  * 2) Need to switch between a `rootDirname` and `cacheDirname` <- TODO: [😡]
16068
16023
  * TODO: [🐱‍🐉][🧠] Make some smart crop
16069
- * Note: [🟢] Code in this file should never be never released in packages that could be imported into browser environment
16070
16024
  */
16071
16025
 
16072
16026
  /**
@@ -16398,11 +16352,11 @@
16398
16352
  return knowledge;
16399
16353
  }
16400
16354
  }
16355
+ /** Note: [🟢] Code for Node scraper implementation [WebsiteScraper](src/scrapers/website/WebsiteScraper.ts) should never be published into packages that could be imported into browser environment */
16401
16356
  /**
16402
16357
  * TODO: [👣] Scraped website in .md can act as cache item - there is no need to run conversion each time
16403
16358
  * TODO: [🪂] Do it in parallel 11:11
16404
16359
  * Note: No need to aggregate usage here, it is done by intercepting the llmTools
16405
- * Note: [🟢] Code in this file should never be never released in packages that could be imported into browser environment
16406
16360
  */
16407
16361
 
16408
16362
  /**
@@ -16525,9 +16479,7 @@
16525
16479
  `);
16526
16480
  }
16527
16481
  }
16528
- /**
16529
- * Note: [🟢] Code in this file should never be never released in packages that could be imported into browser environment
16530
- */
16482
+ /** Note: [🟢] Code for Node browser-fetch helper [fetchUrlContent](src/commitments/USE_BROWSER/fetchUrlContent.ts) should never be published into packages that could be imported into browser environment */
16531
16483
 
16532
16484
  /**
16533
16485
  * Cached implementation of `run_browser` when it can be resolved.
@@ -28283,10 +28235,8 @@
28283
28235
  };
28284
28236
  return tools;
28285
28237
  }
28286
- /**
28287
- * Note: [🟢] Code in this file should never be never released in packages that could be imported into browser environment
28288
- * TODO: [🏓] Unite `xxxForServer` and `xxxForNode` naming
28289
- */
28238
+ /** Note: [🟢] Code for Node execution helper [$provideExecutionToolsForNode](src/execution/utils/$provideExecutionToolsForNode.ts) should never be published into packages that could be imported into browser environment */
28239
+ /** TODO: [🏓] Unite `xxxForServer` and `xxxForNode` naming */
28290
28240
 
28291
28241
  /**
28292
28242
  * Checks if the directory exists
@@ -28636,10 +28586,10 @@
28636
28586
  const data = await archive.generateAsync({ type: 'nodebuffer', streamFiles: true });
28637
28587
  await fs.writeFile(filePath, data);
28638
28588
  }
28589
+ /** Note: [🟢] Code for Node archive helper [saveArchive](src/conversion/archive/saveArchive.ts) should never be published into packages that could be imported into browser environment */
28639
28590
  /**
28640
28591
  * TODO: Add metadata to zip
28641
28592
  * TODO: Compression level and other zip options from config
28642
- * Note: [🟢] Code in this file should never be never released in packages that could be imported into browser environment
28643
28593
  */
28644
28594
 
28645
28595
  /**
@@ -28727,10 +28677,8 @@
28727
28677
  // TODO: [🔱] Do here auto-installation
28728
28678
  return [new JavascriptExecutionTools({ ...options, functions: getAllCommitmentsToolFunctionsForNode() })];
28729
28679
  }
28730
- /**
28731
- * Note: [🟢] Code in this file should never be never released in packages that could be imported into browser environment
28732
- * TODO: [🏓] Unite `xxxForServer` and `xxxForNode` naming
28733
- */
28680
+ /** Note: [🟢] Code for Node scraper registration helper [$provideScriptingForNode](src/scrapers/_common/register/$provideScriptingForNode.ts) should never be published into packages that could be imported into browser environment */
28681
+ /** TODO: [🏓] Unite `xxxForServer` and `xxxForNode` naming */
28734
28682
 
28735
28683
  /**
28736
28684
  * Initializes `make` command for Promptbook CLI utilities
@@ -28969,11 +28917,11 @@
28969
28917
  return process.exit(0);
28970
28918
  }));
28971
28919
  }
28920
+ /** Note: [🟡] Code for CLI command [make](src/cli/cli-commands/make.ts) should never be published outside of `@promptbook/cli` */
28972
28921
  /**
28973
28922
  * TODO: [🥃][main] !!3 Allow `ptbk make` without configuring any llm tools
28974
28923
  * TODO: [0] DRY Javascript and typescript - Maybe make ONLY typescript and for javascript just remove types
28975
28924
  * Note: [💞] Ignore a discrepancy between file name and entity name
28976
- * Note: [🟡] Code in this file should never be published outside of `@promptbook/cli`
28977
28925
  * TODO: [🖇] What about symlinks? Maybe flag --follow-symlinks
28978
28926
  */
28979
28927
 
@@ -29107,10 +29055,10 @@
29107
29055
  return process.exit(0);
29108
29056
  }));
29109
29057
  }
29058
+ /** Note: [🟡] Code for CLI command [prettify](src/cli/cli-commands/prettify.ts) should never be published outside of `@promptbook/cli` */
29110
29059
  /**
29111
29060
  * TODO: [😶] Unite folder listing
29112
29061
  * Note: [💞] Ignore a discrepancy between file name and entity name
29113
- * Note: [🟡] Code in this file should never be published outside of `@promptbook/cli`
29114
29062
  * TODO: [🖇] What about symlinks? Maybe flag --follow-symlinks
29115
29063
  */
29116
29064
 
@@ -29565,10 +29513,8 @@
29565
29513
 
29566
29514
  `));
29567
29515
  }
29568
- /**
29569
- * TODO: Write unit test
29570
- * Note: [🟢] Code in this file should never be never released in packages that could be imported into browser environment
29571
- */
29516
+ /** Note: [🟢] Code for Node wizard helper [$getCompiledBook](src/wizard/$getCompiledBook.ts) should never be published into packages that could be imported into browser environment */
29517
+ /** TODO: Write unit test */
29572
29518
 
29573
29519
  /**
29574
29520
  * Run the interactive chatbot in CLI
@@ -29667,10 +29613,10 @@
29667
29613
  }
29668
29614
  }
29669
29615
  }
29616
+ /** Note: [🟡] Code for CLI command [runInteractiveChatbot](src/cli/cli-commands/runInteractiveChatbot.ts) should never be published outside of `@promptbook/cli` */
29670
29617
  /**
29671
29618
  * TODO: Saving reports from the chatbot conversation
29672
29619
  * TODO: [⛲️] This is the right place to start implementing INK
29673
- * Note: [🟡] Code in this file should never be published outside of `@promptbook/cli`
29674
29620
  */
29675
29621
 
29676
29622
  /**
@@ -29925,12 +29871,12 @@
29925
29871
  return process.exit(0);
29926
29872
  }));
29927
29873
  }
29874
+ /** Note: [🟡] Code for CLI command [run](src/cli/cli-commands/run.ts) should never be published outside of `@promptbook/cli` */
29928
29875
  /**
29929
29876
  * TODO: !!5 Catch and wrap all errors from CLI
29930
29877
  * TODO: [🧠] Pass `maxExecutionAttempts`, `csvSettings`
29931
29878
  * TODO: [🥃][main] !!3 Allow `ptbk run` without configuring any llm tools
29932
29879
  * Note: [💞] Ignore a discrepancy between file name and entity name
29933
- * Note: [🟡] Code in this file should never be published outside of `@promptbook/cli`
29934
29880
  * TODO: [🖇] What about symlinks? Maybe flag --follow-symlinks
29935
29881
  */
29936
29882
 
@@ -29959,9 +29905,7 @@
29959
29905
  isVerbose: true,
29960
29906
  });
29961
29907
  }
29962
- /**
29963
- * Note: [🟢] Code in this file should never be never released in packages that could be imported into browser environment
29964
- */
29908
+ /** Note: [🟢] Code for Node server bootstrap [startAgentServer](src/remote-server/startAgentServer.ts) should never be published into packages that could be imported into browser environment */
29965
29909
 
29966
29910
  /**
29967
29911
  * Initializes `start-agents-server` command for Promptbook CLI utilities
@@ -30045,10 +29989,8 @@
30045
29989
  await startAgentServer({ port });
30046
29990
  }));
30047
29991
  }
30048
- /**
30049
- * Note: [💞] Ignore a discrepancy between file name and entity name
30050
- * Note: [🟡] Code in this file should never be published outside of `@promptbook/cli`
30051
- */
29992
+ /** Note: [🟡] Code for CLI command [start-agents-server](src/cli/cli-commands/start-agents-server.ts) should never be published outside of `@promptbook/cli` */
29993
+ /** Note: [💞] Ignore a discrepancy between file name and entity name */
30052
29994
 
30053
29995
  // TODO: [🥺] List running services from REMOTE_SERVER_URLS
30054
29996
  // TODO: [🥺] Import directly from YML
@@ -31254,8 +31196,8 @@
31254
31196
  },
31255
31197
  };
31256
31198
  }
31199
+ /** Note: [🟢] Code for Node server bootstrap [startRemoteServer](src/remote-server/startRemoteServer.ts) should never be published into packages that could be imported into browser environment */
31257
31200
  /**
31258
-
31259
31201
  * TODO: [🕋] Use here `aboutPromptbookInformation`
31260
31202
  * TODO: [🌡] Add CORS and security - probably via `helmet`
31261
31203
  * TODO: Split this file into multiple functions - handler for each request
@@ -31268,7 +31210,6 @@
31268
31210
  * TODO: [🃏] Pass here some security token to prevent malitious usage and/or DDoS
31269
31211
  * TODO: [0] Set unavailable models as undefined in `RemoteLlmExecutionTools` NOT throw error here
31270
31212
  * TODO: Allow to constrain anonymous mode for specific models / providers
31271
- * Note: [🟢] Code in this file should never be never released in packages that could be imported into browser environment
31272
31213
  */
31273
31214
 
31274
31215
  /**
@@ -31370,10 +31311,10 @@
31370
31311
  return await waitasecond.forEver();
31371
31312
  }));
31372
31313
  }
31314
+ /** Note: [🟡] Code for CLI command [start-pipelines-server](src/cli/cli-commands/start-pipelines-server.ts) should never be published outside of `@promptbook/cli` */
31373
31315
  /**
31374
31316
  * TODO: [🕋] Use here `aboutPromptbookInformation`
31375
31317
  * Note: [💞] Ignore a discrepancy between file name and entity name
31376
- * Note: [🟡] Code in this file should never be published outside of `@promptbook/cli`
31377
31318
  */
31378
31319
 
31379
31320
  /**
@@ -31460,10 +31401,10 @@
31460
31401
  return process.exit(0);
31461
31402
  }));
31462
31403
  }
31404
+ /** Note: [🟡] Code for CLI command [test-command](src/cli/cli-commands/test-command.ts) should never be published outside of `@promptbook/cli` */
31463
31405
  /**
31464
31406
  * TODO: [😶] Unite folder listing
31465
31407
  * Note: [💞] Ignore a discrepancy between file name and entity name
31466
- * Note: [🟡] Code in this file should never be published outside of `@promptbook/cli`
31467
31408
  * TODO: [🖇] What about symlinks? Maybe flag --follow-symlinks
31468
31409
  * Note: This is named "test-command.ts" to avoid name collision with jest unit test files
31469
31410
  */
@@ -31521,12 +31462,12 @@
31521
31462
  program.commands.forEach($addGlobalOptionsToCommand);
31522
31463
  program.parse(process.argv);
31523
31464
  }
31465
+ /** Note: [🟡] Code for CLI program [promptbookCli](src/cli/promptbookCli.ts) should never be published outside of `@promptbook/cli` */
31524
31466
  /**
31525
31467
  * TODO: [🧠] Maybe `run` command the default, instead of `ptbk run ./foo.book` -> `ptbk ./foo.book`
31526
31468
  * TODO: [🥠] Do not export, its just for CLI script
31527
31469
  * TODO: [🕌] When more functionalities, rename
31528
31470
  * Note: 11:11
31529
- * Note: [🟡] Code in this file should never be published outside of `@promptbook/cli`
31530
31471
  */
31531
31472
 
31532
31473
  /**
@@ -31547,9 +31488,7 @@
31547
31488
  }
31548
31489
  await promptbookCli();
31549
31490
  }
31550
- /**
31551
- * Note: [🟡] Code in this file should never be published outside of `@promptbook/cli`
31552
- */
31491
+ /** Note: [🟡] Code for CLI bootstrap [$runPromptbookCli](src/cli/$runPromptbookCli.ts) should never be published outside of `@promptbook/cli` */
31553
31492
 
31554
31493
  /**
31555
31494
  * Note: [🔺] Purpose of this file is to export CLI for production environment
@@ -31563,10 +31502,8 @@
31563
31502
  // Note: [🥠]
31564
31503
  _initialize_promptbookCli: $runPromptbookCli,
31565
31504
  };
31566
- /**
31567
- * Note: [💞] Ignore a discrepancy between file name and entity name
31568
- * Note: [🟡] Code in this file should never be published outside of `@promptbook/cli`
31569
- */
31505
+ /** Note: [🟡] Code for CLI entrypoint [main](src/cli/main.ts) should never be published outside of `@promptbook/cli` */
31506
+ /** Note: [💞] Ignore a discrepancy between file name and entity name */
31570
31507
 
31571
31508
  /**
31572
31509
  * Registration of LLM provider metadata
@@ -37892,12 +37829,10 @@
37892
37829
  return knowledge;
37893
37830
  }
37894
37831
  }
37895
- /**
37896
- * TODO: [👣] Converted documents can act as cached items - there is no need to run conversion each time
37897
- * TODO: [🪂] Do it in parallel
37898
- * Note: No need to aggregate usage here, it is done by intercepting the llmTools
37899
- * @@ Note: [🟢] Code in this file should never be never released in packages that could be imported into browser environment
37900
- */
37832
+ /** TODO: [👣] Converted documents can act as cached items - there is no need to run conversion each time */
37833
+ /** TODO: [🪂] Do it in parallel */
37834
+ /** Note: No need to aggregate usage here, it is done by intercepting the llmTools */
37835
+ /** Note: [🟢] Code for Node scraper boilerplate [BoilerplateScraper](src/scrapers/_boilerplate/BoilerplateScraper.ts) should never be published into packages that could be imported into browser environment */
37901
37836
 
37902
37837
  /**
37903
37838
  * Constructor of `BoilerplateScraper`
@@ -38055,11 +37990,11 @@
38055
37990
  return knowledge;
38056
37991
  }
38057
37992
  }
37993
+ /** Note: [🟢] Code for Node scraper implementation [DocumentScraper](src/scrapers/document/DocumentScraper.ts) should never be published into packages that could be imported into browser environment */
38058
37994
  /**
38059
37995
  * TODO: [👣] Converted documents can act as cached items - there is no need to run conversion each time
38060
37996
  * TODO: [🪂] Do it in parallel 11:11
38061
37997
  * Note: No need to aggregate usage here, it is done by intercepting the llmTools
38062
- * Note: [🟢] Code in this file should never be never released in packages that could be imported into browser environment
38063
37998
  */
38064
37999
 
38065
38000
  /**
@@ -38222,11 +38157,11 @@
38222
38157
  return knowledge;
38223
38158
  }
38224
38159
  }
38160
+ /** Note: [🟢] Code for Node scraper implementation [LegacyDocumentScraper](src/scrapers/document-legacy/LegacyDocumentScraper.ts) should never be published into packages that could be imported into browser environment */
38225
38161
  /**
38226
38162
  * TODO: [👣] Converted documents can act as cached items - there is no need to run conversion each time
38227
38163
  * TODO: [🪂] Do it in parallel 11:11
38228
38164
  * Note: No need to aggregate usage here, it is done by intercepting the llmTools
38229
- * Note: [🟢] Code in this file should never be never released in packages that could be imported into browser environment
38230
38165
  */
38231
38166
 
38232
38167
  /**
@@ -38460,12 +38395,12 @@
38460
38395
  return knowledge;
38461
38396
  }
38462
38397
  }
38398
+ /** Note: [🟢] Code for Node scraper implementation [MarkitdownScraper](src/scrapers/markitdown/MarkitdownScraper.ts) should never be published into packages that could be imported into browser environment */
38463
38399
  /**
38464
38400
  * TODO: [🧠][🌜] Export only from `@promptbook/markitdown` or `@promptbook/pdf` NOT both
38465
38401
  * TODO: [👣] Converted documents can act as cached items - there is no need to run conversion each time
38466
38402
  * TODO: [🪂] Do it in parallel
38467
38403
  * Note: No need to aggregate usage here, it is done by intercepting the llmTools
38468
- * Note: [🟢] Code in this file should never be never released in packages that could be imported into browser environment
38469
38404
  */
38470
38405
 
38471
38406
  /**
@@ -38569,11 +38504,11 @@
38569
38504
  throw new NotYetImplementedError('PDF scraping not yet implemented');
38570
38505
  }
38571
38506
  }
38507
+ /** Note: [🟢] Code for Node scraper implementation [PdfScraper](src/scrapers/pdf/PdfScraper.ts) should never be published into packages that could be imported into browser environment */
38572
38508
  /**
38573
38509
  * TODO: [👣] Converted pdf documents can act as cached items - there is no need to run conversion each time
38574
38510
  * TODO: [🪂] Do it in parallel 11:11
38575
38511
  * Note: No need to aggregate usage here, it is done by intercepting the llmTools
38576
- * Note: [🟢] Code in this file should never be never released in packages that could be imported into browser environment
38577
38512
  */
38578
38513
 
38579
38514
  /**
@@ -40450,15 +40385,357 @@
40450
40385
  //========================================/
40451
40386
  // console.info(`[ Done 🤪 Find fresh emoji tag ]`);
40452
40387
  }
40453
- /**
40454
- * Note: [🟡] Code in this file should never be published outside of `@promptbook/cli`
40455
- */
40388
+ /** Note: [🟡] Code for CLI support script [find-fresh-emoji-tags](scripts/find-fresh-emoji-tags/find-fresh-emoji-tags.ts) should never be published outside of `@promptbook/cli` */
40456
40389
 
40457
40390
  var findFreshEmojiTags = /*#__PURE__*/Object.freeze({
40458
40391
  __proto__: null,
40459
40392
  findFreshEmojiTag: findFreshEmojiTag
40460
40393
  });
40461
40394
 
40395
+ /**
40396
+ * Root folders that contain source-like files for scanning.
40397
+ */
40398
+ const SOURCE_ROOTS = ['src', 'apps', 'scripts', 'examples', 'agents', 'other'];
40399
+ /**
40400
+ * File extensions treated as source code.
40401
+ */
40402
+ const SOURCE_FILE_EXTENSIONS = ['.ts', '.tsx', '.js', '.jsx'];
40403
+ /**
40404
+ * Glob patterns that should be ignored when scanning for source files.
40405
+ */
40406
+ const SOURCE_FILE_IGNORE_GLOBS = [
40407
+ '**/node_modules/**',
40408
+ '**/packages/**',
40409
+ '**/.*/**',
40410
+ '**/.git/**',
40411
+ '**/.idea/**',
40412
+ '**/.vscode/**',
40413
+ '**/.promptbook/**',
40414
+ '**/.next/**',
40415
+ '**/.tmp/**',
40416
+ '**/tmp/**',
40417
+ '**/coverage/**',
40418
+ '**/dist/**',
40419
+ '**/build/**',
40420
+ '**/out/**',
40421
+ '**/prompts/**',
40422
+ '**/changelog/**',
40423
+ ];
40424
+ /**
40425
+ * Default maximum line count for source files.
40426
+ */
40427
+ const DEFAULT_MAX_LINE_COUNT = 2000;
40428
+ /**
40429
+ * Per-extension line count limits.
40430
+ */
40431
+ const LINE_COUNT_LIMITS_BY_EXTENSION = {
40432
+ '.ts': 2000,
40433
+ '.tsx': 2000,
40434
+ '.js': 2000,
40435
+ '.jsx': 2000,
40436
+ };
40437
+ /**
40438
+ * Glob patterns that are exempt from line-count checks.
40439
+ */
40440
+ const LINE_COUNT_EXEMPT_GLOBS = ['other/cspell-dictionaries/**/*.txt'];
40441
+ /**
40442
+ * Maximum number of entities before a file is flagged.
40443
+ */
40444
+ const MAX_ENTITIES_PER_FILE = 20;
40445
+ /**
40446
+ * File extensions eligible for entity counting.
40447
+ */
40448
+ const ENTITY_COUNT_EXTENSIONS = ['.ts', '.tsx', '.js', '.jsx'];
40449
+ /**
40450
+ * Markers that identify generated files which should be skipped.
40451
+ */
40452
+ const GENERATED_CODE_MARKERS = [
40453
+ 'WARNING: This code has been generated',
40454
+ 'This code has been generated so that any manual changes will be overwritten',
40455
+ ];
40456
+ /**
40457
+ * Name of the prompts directory.
40458
+ */
40459
+ const PROMPTS_DIR_NAME = 'prompts';
40460
+ /**
40461
+ * Step size used for prompt numbering.
40462
+ */
40463
+ const PROMPT_NUMBER_STEP = 10;
40464
+ /**
40465
+ * Prefix used for generated prompt slugs.
40466
+ */
40467
+ const PROMPT_SLUG_PREFIX = 'refactor';
40468
+ /**
40469
+ * Label used to mark the target file in generated prompts.
40470
+ */
40471
+ const PROMPT_TARGET_LABEL = 'Target file';
40472
+ /**
40473
+ * Maximum length for generated prompt slugs.
40474
+ */
40475
+ const PROMPT_SLUG_MAX_LENGTH = 80;
40476
+ /**
40477
+ * Note: [?] Code in this file should never be published in any package
40478
+ */
40479
+
40480
+ /**
40481
+ * Normalizes a repo-relative path to use forward slashes.
40482
+ *
40483
+ * @private function of findRefactorCandidates
40484
+ */
40485
+ function normalizeRefactorCandidatePath(pathValue) {
40486
+ const normalized = pathValue.replaceAll('\\', '/');
40487
+ return normalized.replace(/^\.\//, '');
40488
+ }
40489
+ /** Note: [🟡] Code for repository script [normalizeRefactorCandidatePath](scripts/find-refactor-candidates/normalizeRefactorCandidatePath.ts) should never be published outside of `@promptbook/cli`*/
40490
+
40491
+ /**
40492
+ * Resolves whether a source file should produce a refactor candidate entry.
40493
+ *
40494
+ * @private function of findRefactorCandidates
40495
+ */
40496
+ async function analyzeSourceFileForRefactorCandidate(options) {
40497
+ const { filePath, lineCountExemptPaths, rootDir } = options;
40498
+ const normalizedAbsolutePath = normalizeAbsolutePath$1(filePath);
40499
+ const content = await promises.readFile(filePath, 'utf-8');
40500
+ if (isGeneratedFile(content)) {
40501
+ return null;
40502
+ }
40503
+ const extension = path.extname(filePath).toLowerCase();
40504
+ const relativePath = normalizeRefactorCandidatePath(path.relative(rootDir, filePath));
40505
+ const reasons = [];
40506
+ if (!lineCountExemptPaths.has(normalizedAbsolutePath)) {
40507
+ const lineCount = countLines(content);
40508
+ const maxLines = getMaxLinesForExtension(extension);
40509
+ if (lineCount > maxLines) {
40510
+ reasons.push(`lines ${lineCount}/${maxLines}`);
40511
+ }
40512
+ }
40513
+ if (ENTITY_COUNT_EXTENSIONS.includes(extension)) {
40514
+ const entityCount = countEntities(content, extension, filePath);
40515
+ if (entityCount > MAX_ENTITIES_PER_FILE) {
40516
+ reasons.push(`entities ${entityCount}/${MAX_ENTITIES_PER_FILE}`);
40517
+ }
40518
+ }
40519
+ if (reasons.length === 0) {
40520
+ return null;
40521
+ }
40522
+ return {
40523
+ absolutePath: filePath,
40524
+ relativePath,
40525
+ reasons,
40526
+ };
40527
+ }
40528
+ /**
40529
+ * Determines whether a file is generated by scanning for known markers.
40530
+ *
40531
+ * @private function of analyzeSourceFileForRefactorCandidate
40532
+ */
40533
+ function isGeneratedFile(content) {
40534
+ return GENERATED_CODE_MARKERS.some((marker) => content.includes(marker));
40535
+ }
40536
+ /**
40537
+ * Gets the maximum allowed lines for a file extension.
40538
+ *
40539
+ * @private function of analyzeSourceFileForRefactorCandidate
40540
+ */
40541
+ function getMaxLinesForExtension(extension) {
40542
+ var _a;
40543
+ return (_a = LINE_COUNT_LIMITS_BY_EXTENSION[extension]) !== null && _a !== void 0 ? _a : DEFAULT_MAX_LINE_COUNT;
40544
+ }
40545
+ /**
40546
+ * Counts lines while ignoring a trailing newline.
40547
+ *
40548
+ * @private function of analyzeSourceFileForRefactorCandidate
40549
+ */
40550
+ function countLines(content) {
40551
+ if (content.length === 0) {
40552
+ return 0;
40553
+ }
40554
+ const lines = content.split(/\r?\n/);
40555
+ return lines[lines.length - 1] === '' ? lines.length - 1 : lines.length;
40556
+ }
40557
+ /**
40558
+ * Counts top-level entities in a source file.
40559
+ *
40560
+ * @private function of analyzeSourceFileForRefactorCandidate
40561
+ */
40562
+ function countEntities(content, extension, filePath) {
40563
+ const scriptKind = getScriptKindForExtension(extension);
40564
+ const sourceFile = ts__namespace.createSourceFile(filePath, content, ts__namespace.ScriptTarget.Latest, false, scriptKind);
40565
+ return countEntitiesInSourceFile(sourceFile);
40566
+ }
40567
+ /**
40568
+ * Counts top-level entities in a parsed TypeScript source file.
40569
+ *
40570
+ * @private function of analyzeSourceFileForRefactorCandidate
40571
+ */
40572
+ function countEntitiesInSourceFile(sourceFile) {
40573
+ let count = 0;
40574
+ // Only count top-level declarations to avoid inflating with members or nested scopes.
40575
+ for (const statement of sourceFile.statements) {
40576
+ if (ts__namespace.isFunctionDeclaration(statement) ||
40577
+ ts__namespace.isClassDeclaration(statement) ||
40578
+ ts__namespace.isInterfaceDeclaration(statement) ||
40579
+ ts__namespace.isTypeAliasDeclaration(statement) ||
40580
+ ts__namespace.isEnumDeclaration(statement) ||
40581
+ ts__namespace.isModuleDeclaration(statement)) {
40582
+ count += 1;
40583
+ continue;
40584
+ }
40585
+ if (ts__namespace.isVariableStatement(statement)) {
40586
+ for (const declaration of statement.declarationList.declarations) {
40587
+ const initializer = declaration.initializer;
40588
+ if (initializer &&
40589
+ (ts__namespace.isArrowFunction(initializer) ||
40590
+ ts__namespace.isFunctionExpression(initializer) ||
40591
+ ts__namespace.isClassExpression(initializer))) {
40592
+ count += 1;
40593
+ }
40594
+ }
40595
+ }
40596
+ }
40597
+ return count;
40598
+ }
40599
+ /**
40600
+ * Resolves the script kind for a source file extension.
40601
+ *
40602
+ * @private function of analyzeSourceFileForRefactorCandidate
40603
+ */
40604
+ function getScriptKindForExtension(extension) {
40605
+ if (extension === '.tsx') {
40606
+ return ts__namespace.ScriptKind.TSX;
40607
+ }
40608
+ if (extension === '.jsx') {
40609
+ return ts__namespace.ScriptKind.JSX;
40610
+ }
40611
+ if (extension === '.js') {
40612
+ return ts__namespace.ScriptKind.JS;
40613
+ }
40614
+ return ts__namespace.ScriptKind.TS;
40615
+ }
40616
+ /**
40617
+ * Normalizes an absolute path for consistent comparisons.
40618
+ *
40619
+ * @private function of analyzeSourceFileForRefactorCandidate
40620
+ */
40621
+ function normalizeAbsolutePath$1(pathValue) {
40622
+ const normalized = path.resolve(pathValue);
40623
+ return process.platform === 'win32' ? normalized.toLowerCase() : normalized;
40624
+ }
40625
+ /** Note: [🟡] Code for repository script [analyzeSourceFileForRefactorCandidate](scripts/find-refactor-candidates/analyzeSourceFileForRefactorCandidate.ts) should never be published outside of `@promptbook/cli` */
40626
+
40627
+ /**
40628
+ * Scans the repository and returns all files that qualify as refactor candidates.
40629
+ *
40630
+ * @private function of findRefactorCandidates
40631
+ */
40632
+ async function findRefactorCandidatesInProject(rootDir) {
40633
+ const lineCountExemptPaths = await buildExemptPathSet(rootDir, LINE_COUNT_EXEMPT_GLOBS);
40634
+ const sourceFiles = await listSourceFiles(rootDir);
40635
+ const candidates = [];
40636
+ for (const filePath of sourceFiles) {
40637
+ const candidate = await analyzeSourceFileForRefactorCandidate({
40638
+ filePath,
40639
+ lineCountExemptPaths,
40640
+ rootDir,
40641
+ });
40642
+ if (candidate) {
40643
+ candidates.push(candidate);
40644
+ }
40645
+ }
40646
+ return candidates;
40647
+ }
40648
+ /**
40649
+ * Lists all source files to scan based on configured roots and extensions.
40650
+ *
40651
+ * @private function of findRefactorCandidatesInProject
40652
+ */
40653
+ async function listSourceFiles(rootDir) {
40654
+ const extensions = SOURCE_FILE_EXTENSIONS.map((extension) => extension.replace(/^\./, '')).join(',');
40655
+ const extensionGlob = `{${extensions}}`;
40656
+ const patterns = [...SOURCE_ROOTS.map((root) => `${root}/**/*.${extensionGlob}`), `*.${extensionGlob}`];
40657
+ const files = new Set();
40658
+ for (const pattern of patterns) {
40659
+ const matches = await glob__default["default"](pattern, {
40660
+ cwd: rootDir,
40661
+ ignore: SOURCE_FILE_IGNORE_GLOBS,
40662
+ nodir: true,
40663
+ absolute: true,
40664
+ });
40665
+ for (const match of matches) {
40666
+ files.add(match);
40667
+ }
40668
+ }
40669
+ return Array.from(files).sort();
40670
+ }
40671
+ /**
40672
+ * Builds a set of normalized absolute paths exempt from line-count checks.
40673
+ *
40674
+ * @private function of findRefactorCandidatesInProject
40675
+ */
40676
+ async function buildExemptPathSet(rootDir, patterns) {
40677
+ const exemptPaths = new Set();
40678
+ for (const pattern of patterns) {
40679
+ const matches = await glob__default["default"](pattern, {
40680
+ cwd: rootDir,
40681
+ ignore: SOURCE_FILE_IGNORE_GLOBS,
40682
+ nodir: true,
40683
+ absolute: true,
40684
+ });
40685
+ for (const match of matches) {
40686
+ exemptPaths.add(normalizeAbsolutePath(match));
40687
+ }
40688
+ }
40689
+ return exemptPaths;
40690
+ }
40691
+ /**
40692
+ * Normalizes an absolute path for consistent comparisons.
40693
+ *
40694
+ * @private function of findRefactorCandidatesInProject
40695
+ */
40696
+ function normalizeAbsolutePath(pathValue) {
40697
+ const normalized = path.resolve(pathValue);
40698
+ return process.platform === 'win32' ? normalized.toLowerCase() : normalized;
40699
+ }
40700
+ /** Note: [🟡] Code for repository script [findRefactorCandidatesInProject](scripts/find-refactor-candidates/findRefactorCandidatesInProject.ts) should never be published outside of `@promptbook/cli` */
40701
+
40702
+ /**
40703
+ * Collects all repo-relative target paths already referenced in prompts.
40704
+ *
40705
+ * @private function of findRefactorCandidates
40706
+ */
40707
+ async function loadExistingPromptTargets(promptsDir) {
40708
+ var _a;
40709
+ if (!fs.existsSync(promptsDir)) {
40710
+ return new Set();
40711
+ }
40712
+ const promptFiles = await glob__default["default"]('**/*.md', {
40713
+ cwd: promptsDir,
40714
+ nodir: true,
40715
+ });
40716
+ const targets = new Set();
40717
+ const targetRegex = new RegExp(`^\\s*-\\s+${escapeRegExp(PROMPT_TARGET_LABEL)}:\\s+\\\`(?<path>[^\\\`]+)\\\``, 'gm');
40718
+ for (const promptFile of promptFiles) {
40719
+ const content = await promises.readFile(path.join(promptsDir, promptFile), 'utf-8');
40720
+ for (const match of content.matchAll(targetRegex)) {
40721
+ const captured = (_a = match.groups) === null || _a === void 0 ? void 0 : _a.path;
40722
+ if (captured) {
40723
+ targets.add(normalizeRefactorCandidatePath(captured));
40724
+ }
40725
+ }
40726
+ }
40727
+ return targets;
40728
+ }
40729
+ /**
40730
+ * Escapes a string for use in a regular expression literal.
40731
+ *
40732
+ * @private function of loadExistingPromptTargets
40733
+ */
40734
+ function escapeRegExp(value) {
40735
+ return value.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
40736
+ }
40737
+ /** Note: [🟡] Code for repository script [loadExistingPromptTargets](scripts/find-refactor-candidates/loadExistingPromptTargets.ts) should never be published outside of `@promptbook/cli` */
40738
+
40462
40739
  /**
40463
40740
  * Calculates the next available prompt numbering sequence for a month.
40464
40741
  */
@@ -40599,180 +40876,114 @@
40599
40876
  });
40600
40877
 
40601
40878
  /**
40602
- * Root folders that contain source-like files for scanning.
40603
- */
40604
- const SOURCE_ROOTS = ['src', 'apps', 'scripts', 'examples', 'agents', 'other'];
40605
- /**
40606
- * File extensions treated as source code.
40607
- */
40608
- const SOURCE_FILE_EXTENSIONS = ['.ts', '.tsx', '.js', '.jsx'];
40609
- /**
40610
- * Glob patterns that should be ignored when scanning for source files.
40611
- */
40612
- const SOURCE_FILE_IGNORE_GLOBS = [
40613
- '**/node_modules/**',
40614
- '**/packages/**',
40615
- '**/.*/**',
40616
- '**/.git/**',
40617
- '**/.idea/**',
40618
- '**/.vscode/**',
40619
- '**/.promptbook/**',
40620
- '**/.next/**',
40621
- '**/.tmp/**',
40622
- '**/tmp/**',
40623
- '**/coverage/**',
40624
- '**/dist/**',
40625
- '**/build/**',
40626
- '**/out/**',
40627
- '**/prompts/**',
40628
- '**/changelog/**',
40629
- ];
40630
- /**
40631
- * Default maximum line count for source files.
40632
- */
40633
- const DEFAULT_MAX_LINE_COUNT = 2000;
40634
- /**
40635
- * Per-extension line count limits.
40636
- */
40637
- const LINE_COUNT_LIMITS_BY_EXTENSION = {
40638
- '.ts': 2000,
40639
- '.tsx': 2000,
40640
- '.js': 2000,
40641
- '.jsx': 2000,
40642
- };
40643
- /**
40644
- * Glob patterns that are exempt from line-count checks.
40645
- */
40646
- const LINE_COUNT_EXEMPT_GLOBS = ['other/cspell-dictionaries/**/*.txt'];
40647
- /**
40648
- * Maximum number of entities before a file is flagged.
40649
- */
40650
- const MAX_ENTITIES_PER_FILE = 20;
40651
- /**
40652
- * File extensions eligible for entity counting.
40653
- */
40654
- const ENTITY_COUNT_EXTENSIONS = ['.ts', '.tsx', '.js', '.jsx'];
40655
- /**
40656
- * Markers that identify generated files which should be skipped.
40657
- */
40658
- const GENERATED_CODE_MARKERS = [
40659
- 'WARNING: This code has been generated',
40660
- 'This code has been generated so that any manual changes will be overwritten',
40661
- ];
40662
- /**
40663
- * Name of the prompts directory.
40664
- */
40665
- const PROMPTS_DIR_NAME = 'prompts';
40666
- /**
40667
- * Step size used for prompt numbering.
40668
- */
40669
- const PROMPT_NUMBER_STEP = 10;
40670
- /**
40671
- * Prefix used for generated prompt slugs.
40672
- */
40673
- const PROMPT_SLUG_PREFIX = 'refactor';
40674
- /**
40675
- * Label used to mark the target file in generated prompts.
40676
- */
40677
- const PROMPT_TARGET_LABEL = 'Target file';
40678
- /**
40679
- * Maximum length for generated prompt slugs.
40680
- */
40681
- const PROMPT_SLUG_MAX_LENGTH = 80;
40682
- /**
40683
- * Note: [?] Code in this file should never be published in any package
40879
+ * Builds prompt content for a refactor candidate.
40880
+ *
40881
+ * @private function of findRefactorCandidates
40684
40882
  */
40883
+ function buildPromptContent(candidate, emojiTag) {
40884
+ const fileName = path.basename(candidate.relativePath);
40885
+ const guidanceLines = buildPromptGuidance(candidate);
40886
+ return _spaceTrim.spaceTrim((block) => `
40685
40887
 
40686
- if (require.main === module) {
40687
- findRefactorCandidates()
40688
- .catch((error) => {
40689
- assertsError(error);
40690
- console.error(colors__default["default"].bgRed(`${error.name} in ${path.basename(__filename)}`));
40691
- console.error(colors__default["default"].red(error.stack || error.message));
40692
- process.exit(1);
40693
- })
40694
- .then(() => {
40695
- process.exit(0);
40696
- });
40888
+ [ ]
40889
+
40890
+ ${emojiTag} Refactor [\`${fileName}\` file](${candidate.relativePath})
40891
+
40892
+ ${block(guidanceLines.join('\n'))}
40893
+ `);
40697
40894
  }
40698
40895
  /**
40699
- * Initializes environment for this script.
40896
+ * Builds the refactor guidance section for a prompt.
40700
40897
  *
40701
- * @private utility for `findRefactorCandidates`
40898
+ * @private function of buildPromptContent
40702
40899
  */
40703
- function initializeFindRefactorCandidatesRun() {
40704
- dotenv__namespace.config({ path: '.env' });
40900
+ function buildPromptGuidance(candidate) {
40901
+ const guidance = [
40902
+ /* '- @@@' <- TODO: Should be this here? */
40903
+ ];
40904
+ const counts = extractReasonCounts(candidate.reasons);
40905
+ const densityNote = buildDensityNote(counts);
40906
+ if (densityNote) {
40907
+ guidance.push(`- ${densityNote}`);
40908
+ }
40909
+ if (counts.lineCount !== null && counts.maxLines !== null) {
40910
+ guidance.push(`- The file contains excessive lines of code (${counts.lineCount} lines)`, ` - Keep in mind the Single Responsibility Principle (SRP)`, ` - Consider breaking it down into smaller, focused modules or components.`);
40911
+ }
40912
+ if (counts.entityCount !== null && counts.maxEntities !== null) {
40913
+ guidance.push(`- The file defines too many responsibilities (${counts.entityCount} in single file)`, ` - Keep in mind the Single Responsibility Principle (SRP)`, ` - Consider breaking it down into smaller, focused modules or components.`);
40914
+ }
40915
+ guidance.push('- Purpose of this refactoring is to improve code maintainability and readability.', '- Look at the internal structure, the usage and also surrounding code to understand how to best refactor this file.', '- Consider breaking down large functions into smaller, more manageable ones, removing any redundant code, and ensuring that the file adheres to the project coding standards.', '- After the refactoring, ensure that (1) `npm run test-name-discrepancies` and (2) `npm run test-package-generation` are passing successfully.', ' 1. All the things you have moved to new files should correspond the thing in the file with the file name, for example `MyComponent.tsx` should export `MyComponent`.', ' 2. All the things you have moved to new files but are private things to the outside world should have `@private function of TheMainThing` JSDoc comment.', '- Keep in mind DRY *(Do not repeat yourself)* and SOLID principles while refactoring.', '- **Do not change the external behavior** of the code. Focus solely on improving the internal structure and organization of the code.', '- Before you start refactoring, make sure to read the code carefully and understand its current structure and functionality. Do a analysis of the current functionality before you start.');
40916
+ return guidance;
40705
40917
  }
40706
40918
  /**
40707
- * Orchestrates scanning for refactor candidates and generating prompts.
40919
+ * Extracts line and entity counts from refactor reasons.
40708
40920
  *
40709
- * @public exported from `@promptbook/cli`
40921
+ * @private function of buildPromptContent
40710
40922
  */
40711
- async function findRefactorCandidates() {
40712
- initializeFindRefactorCandidatesRun();
40713
- console.info(colors__default["default"].cyan('?? Find refactor candidates'));
40714
- const rootDir = process.cwd();
40715
- const promptsDir = path.join(rootDir, PROMPTS_DIR_NAME);
40716
- const existingTargets = await loadExistingPromptTargets(promptsDir);
40717
- const lineCountExemptPaths = await buildExemptPathSet(rootDir, LINE_COUNT_EXEMPT_GLOBS);
40718
- const sourceFiles = await listSourceFiles(rootDir);
40719
- const candidates = [];
40720
- for (const filePath of sourceFiles) {
40721
- const normalizedPath = normalizeAbsolutePath(filePath);
40722
- const content = await promises.readFile(filePath, 'utf-8');
40723
- if (isGeneratedFile(content)) {
40923
+ function extractReasonCounts(reasons) {
40924
+ let lineCount = null;
40925
+ let maxLines = null;
40926
+ let entityCount = null;
40927
+ let maxEntities = null;
40928
+ for (const reason of reasons) {
40929
+ const lineMatch = reason.match(/lines\s+(?<count>\d+)\/(?<max>\d+)/i);
40930
+ if (lineMatch === null || lineMatch === void 0 ? void 0 : lineMatch.groups) {
40931
+ lineCount = Number(lineMatch.groups.count);
40932
+ maxLines = Number(lineMatch.groups.max);
40724
40933
  continue;
40725
40934
  }
40726
- const extension = path.extname(filePath).toLowerCase();
40727
- const relativePath = normalizeRelativePath(path.relative(rootDir, filePath));
40728
- const reasons = [];
40729
- if (!lineCountExemptPaths.has(normalizedPath)) {
40730
- const lineCount = countLines(content);
40731
- const maxLines = getMaxLinesForExtension(extension);
40732
- if (lineCount > maxLines) {
40733
- reasons.push(`lines ${lineCount}/${maxLines}`);
40734
- }
40735
- }
40736
- if (ENTITY_COUNT_EXTENSIONS.includes(extension)) {
40737
- const entityCount = countEntities(content, extension, filePath);
40738
- if (entityCount > MAX_ENTITIES_PER_FILE) {
40739
- reasons.push(`entities ${entityCount}/${MAX_ENTITIES_PER_FILE}`);
40740
- }
40741
- }
40742
- if (reasons.length > 0) {
40743
- candidates.push({
40744
- absolutePath: filePath,
40745
- relativePath,
40746
- reasons,
40747
- });
40935
+ const entityMatch = reason.match(/entities\s+(?<count>\d+)\/(?<max>\d+)/i);
40936
+ if (entityMatch === null || entityMatch === void 0 ? void 0 : entityMatch.groups) {
40937
+ entityCount = Number(entityMatch.groups.count);
40938
+ maxEntities = Number(entityMatch.groups.max);
40748
40939
  }
40749
40940
  }
40750
- if (candidates.length === 0) {
40751
- console.info(colors__default["default"].green('No refactor candidates found.'));
40752
- return;
40941
+ return {
40942
+ lineCount,
40943
+ maxLines,
40944
+ entityCount,
40945
+ maxEntities,
40946
+ };
40947
+ }
40948
+ /**
40949
+ * Builds a summary note about file density based on counts.
40950
+ *
40951
+ * @private function of buildPromptContent
40952
+ */
40953
+ function buildDensityNote(counts) {
40954
+ if (counts.lineCount !== null && counts.entityCount !== null) {
40955
+ return 'The file mixes multiple concerns, making it harder to follow.';
40753
40956
  }
40754
- for (const candidate of candidates) {
40755
- console.info(colors__default["default"].yellow(`${candidate.relativePath} <- ${candidate.reasons.join('; ')}`));
40957
+ if (counts.lineCount !== null) {
40958
+ return 'The file is large enough that it is hard to follow.';
40756
40959
  }
40757
- const candidatesToWrite = candidates.filter((candidate) => !existingTargets.has(candidate.relativePath));
40758
- const alreadyTracked = candidates.length - candidatesToWrite.length;
40759
- if (candidatesToWrite.length === 0) {
40760
- console.info(colors__default["default"].green('All candidates already have prompts.'));
40761
- return;
40960
+ if (counts.entityCount !== null) {
40961
+ return 'The file is dense enough that it is hard to follow.';
40762
40962
  }
40963
+ return null;
40964
+ }
40965
+ /** Note: [🟡] Code for repository script [buildPromptContent](scripts/find-refactor-candidates/buildPromptContent.ts) should never be published outside of `@promptbook/cli` */
40966
+
40967
+ /**
40968
+ * Creates prompt files for each refactor candidate and returns written filenames.
40969
+ *
40970
+ * @private function of findRefactorCandidates
40971
+ */
40972
+ async function writeRefactorCandidatePrompts(options) {
40973
+ const { candidates, promptsDir, rootDir } = options;
40763
40974
  const promptNumbering = await getPromptNumbering({
40764
40975
  promptsDir,
40765
40976
  step: PROMPT_NUMBER_STEP,
40766
40977
  ignoreGlobs: ['**/node_modules/**'],
40767
40978
  });
40768
40979
  const { selectedEmojis } = await getFreshPromptEmojiTags({
40769
- count: candidatesToWrite.length,
40980
+ count: candidates.length,
40770
40981
  rootDir,
40771
40982
  tagPrefix: '🧹',
40772
40983
  });
40773
40984
  await promises.mkdir(promptsDir, { recursive: true });
40774
40985
  const createdPrompts = [];
40775
- for (const [index, candidate] of candidatesToWrite.entries()) {
40986
+ for (const [index, candidate] of candidates.entries()) {
40776
40987
  const slug = buildPromptSlug(candidate.relativePath);
40777
40988
  const number = promptNumbering.startNumber + index * promptNumbering.step;
40778
40989
  const filename = buildPromptFilename(promptNumbering.datePrefix, number, slug);
@@ -40786,96 +40997,12 @@
40786
40997
  await promises.writeFile(promptPath, promptContent, 'utf-8');
40787
40998
  createdPrompts.push(filename);
40788
40999
  }
40789
- console.info(colors__default["default"].green(`Created ${createdPrompts.length} prompt(s) in ${PROMPTS_DIR_NAME}.`));
40790
- if (alreadyTracked > 0) {
40791
- console.info(colors__default["default"].gray(`Skipped ${alreadyTracked} candidate(s) with existing prompts.`));
40792
- }
40793
- }
40794
- /**
40795
- * Builds prompt content for a refactor candidate.
40796
- *
40797
- * @param candidate - Candidate metadata to include.
40798
- * @param emojiTag - Unique emoji tag for the prompt title.
40799
- */
40800
- function buildPromptContent(candidate, emojiTag) {
40801
- const fileName = path.basename(candidate.relativePath);
40802
- const guidanceLines = buildPromptGuidance(candidate);
40803
- return _spaceTrim.spaceTrim((block) => `
40804
-
40805
- [ ]
40806
-
40807
- ${emojiTag} Refactor [\`${fileName}\` file](${candidate.relativePath})
40808
-
40809
- ${block(guidanceLines.join('\n'))}
40810
- `);
40811
- }
40812
- /**
40813
- * Builds the refactor guidance section for a prompt.
40814
- */
40815
- function buildPromptGuidance(candidate) {
40816
- const guidance = [
40817
- /* '- @@@' <- TODO: Should be this here? */
40818
- ];
40819
- const counts = extractReasonCounts(candidate.reasons);
40820
- const densityNote = buildDensityNote(counts);
40821
- if (densityNote) {
40822
- guidance.push(`- ${densityNote}`);
40823
- }
40824
- if (counts.lineCount !== null && counts.maxLines !== null) {
40825
- guidance.push(`- The file contains excessive lines of code (${counts.lineCount} lines)`, ` - Keep in mind the Single Responsibility Principle (SRP)`, ` - Consider breaking it down into smaller, focused modules or components.`);
40826
- }
40827
- if (counts.entityCount !== null && counts.maxEntities !== null) {
40828
- guidance.push(`- The file defines too many responsibilities (${counts.entityCount} in single file)`, ` - Keep in mind the Single Responsibility Principle (SRP)`, ` - Consider breaking it down into smaller, focused modules or components.`);
40829
- }
40830
- guidance.push('- Purpose of this refactoring is to improve code maintainability and readability.', '- Look at the internal structure, the usage and also surrounding code to understand how to best refactor this file.', '- Consider breaking down large functions into smaller, more manageable ones, removing any redundant code, and ensuring that the file adheres to the project coding standards.', '- After the refactoring, ensure that (1) `npm run test-name-discrepancies` and (2) `npm run test-package-generation` are passing successfully.', ' 1. All the things you have moved to new files should correspond the thing in the file with the file name, for example `MyComponent.tsx` should export `MyComponent`.', ' 2. All the things you have moved to new files but are private things to the outside world should have `@private function of TheMainThing` JSDoc comment.', '- Keep in mind DRY *(Do not repeat yourself)* and SOLID principles while refactoring.', '- **Do not change the external behavior** of the code. Focus solely on improving the internal structure and organization of the code.', '- Before you start refactoring, make sure to read the code carefully and understand its current structure and functionality. Do a analysis of the current functionality before you start.');
40831
- // <- TODO: Leverage `spaceTrim` here
40832
- return guidance;
40833
- }
40834
- /**
40835
- * Extracts line and entity counts from refactor reasons.
40836
- */
40837
- function extractReasonCounts(reasons) {
40838
- let lineCount = null;
40839
- let maxLines = null;
40840
- let entityCount = null;
40841
- let maxEntities = null;
40842
- for (const reason of reasons) {
40843
- const lineMatch = reason.match(/lines\s+(?<count>\d+)\/(?<max>\d+)/i);
40844
- if (lineMatch === null || lineMatch === void 0 ? void 0 : lineMatch.groups) {
40845
- lineCount = Number(lineMatch.groups.count);
40846
- maxLines = Number(lineMatch.groups.max);
40847
- continue;
40848
- }
40849
- const entityMatch = reason.match(/entities\s+(?<count>\d+)\/(?<max>\d+)/i);
40850
- if (entityMatch === null || entityMatch === void 0 ? void 0 : entityMatch.groups) {
40851
- entityCount = Number(entityMatch.groups.count);
40852
- maxEntities = Number(entityMatch.groups.max);
40853
- }
40854
- }
40855
- return {
40856
- lineCount,
40857
- maxLines,
40858
- entityCount,
40859
- maxEntities,
40860
- };
40861
- }
40862
- /**
40863
- * Builds a summary note about file density based on counts.
40864
- */
40865
- function buildDensityNote(counts) {
40866
- if (counts.lineCount !== null && counts.entityCount !== null) {
40867
- return 'The file mixes multiple concerns, making it harder to follow.';
40868
- }
40869
- if (counts.lineCount !== null) {
40870
- return 'The file is large enough that it is hard to follow.';
40871
- }
40872
- if (counts.entityCount !== null) {
40873
- return 'The file is dense enough that it is hard to follow.';
40874
- }
40875
- return null;
41000
+ return createdPrompts;
40876
41001
  }
40877
41002
  /**
40878
41003
  * Creates the prompt slug from a file path while keeping it readable.
41004
+ *
41005
+ * @private function of writeRefactorCandidatePrompts
40879
41006
  */
40880
41007
  function buildPromptSlug(relativePath) {
40881
41008
  const prefixed = `${PROMPT_SLUG_PREFIX}-${normalizeToKebabCase(relativePath) || 'file'}`;
@@ -40887,178 +41014,83 @@
40887
41014
  return `${trimmed}-${hash}`;
40888
41015
  }
40889
41016
  /**
40890
- * Collects all repo-relative target paths already referenced in prompts.
40891
- */
40892
- async function loadExistingPromptTargets(promptsDir) {
40893
- var _a;
40894
- if (!fs.existsSync(promptsDir)) {
40895
- return new Set();
40896
- }
40897
- const promptFiles = await glob__default["default"]('**/*.md', {
40898
- cwd: promptsDir,
40899
- nodir: true,
40900
- });
40901
- const targets = new Set();
40902
- const targetRegex = new RegExp(`^\\s*-\\s+${escapeRegExp(PROMPT_TARGET_LABEL)}:\\s+\\\`(?<path>[^\\\`]+)\\\``, 'gm');
40903
- for (const promptFile of promptFiles) {
40904
- const content = await promises.readFile(path.join(promptsDir, promptFile), 'utf-8');
40905
- for (const match of content.matchAll(targetRegex)) {
40906
- const captured = (_a = match.groups) === null || _a === void 0 ? void 0 : _a.path;
40907
- if (captured) {
40908
- targets.add(normalizeRelativePath(captured));
40909
- }
40910
- }
40911
- }
40912
- return targets;
40913
- }
40914
- /**
40915
- * Lists all source files to scan based on configured roots and extensions.
40916
- */
40917
- async function listSourceFiles(rootDir) {
40918
- const extensions = SOURCE_FILE_EXTENSIONS.map((extension) => extension.replace(/^\./, '')).join(',');
40919
- const extensionGlob = `{${extensions}}`;
40920
- const patterns = [...SOURCE_ROOTS.map((root) => `${root}/**/*.${extensionGlob}`), `*.${extensionGlob}`];
40921
- const files = new Set();
40922
- for (const pattern of patterns) {
40923
- const matches = await glob__default["default"](pattern, {
40924
- cwd: rootDir,
40925
- ignore: SOURCE_FILE_IGNORE_GLOBS,
40926
- nodir: true,
40927
- absolute: true,
40928
- });
40929
- for (const match of matches) {
40930
- files.add(match);
40931
- }
40932
- }
40933
- return Array.from(files).sort();
40934
- }
40935
- /**
40936
- * Builds a set of normalized paths exempt from line-count checks.
40937
- */
40938
- async function buildExemptPathSet(rootDir, patterns) {
40939
- const exemptPaths = new Set();
40940
- for (const pattern of patterns) {
40941
- const matches = await glob__default["default"](pattern, {
40942
- cwd: rootDir,
40943
- ignore: SOURCE_FILE_IGNORE_GLOBS,
40944
- nodir: true,
40945
- absolute: true,
40946
- });
40947
- for (const match of matches) {
40948
- exemptPaths.add(normalizeAbsolutePath(match));
40949
- }
40950
- }
40951
- return exemptPaths;
40952
- }
40953
- /**
40954
- * Determines whether a file is generated by scanning for known markers.
40955
- */
40956
- function isGeneratedFile(content) {
40957
- return GENERATED_CODE_MARKERS.some((marker) => content.includes(marker));
40958
- }
40959
- /**
40960
- * Gets the maximum allowed lines for a file extension.
40961
- */
40962
- function getMaxLinesForExtension(extension) {
40963
- var _a;
40964
- return (_a = LINE_COUNT_LIMITS_BY_EXTENSION[extension]) !== null && _a !== void 0 ? _a : DEFAULT_MAX_LINE_COUNT;
40965
- }
40966
- /**
40967
- * Counts lines while ignoring a trailing newline.
41017
+ * Creates a short stable hash used for trimmed slugs.
41018
+ *
41019
+ * @private function of writeRefactorCandidatePrompts
40968
41020
  */
40969
- function countLines(content) {
40970
- if (content.length === 0) {
40971
- return 0;
41021
+ function hashString(value) {
41022
+ let hash = 5381;
41023
+ for (let i = 0; i < value.length; i += 1) {
41024
+ hash = (hash << 5) + hash + value.charCodeAt(i);
40972
41025
  }
40973
- const lines = content.split(/\r?\n/);
40974
- return lines[lines.length - 1] === '' ? lines.length - 1 : lines.length;
41026
+ return (hash >>> 0).toString(36);
40975
41027
  }
40976
- /**
40977
- * Counts top-level entities in a source file.
40978
- */
40979
- function countEntities(content, extension, filePath) {
40980
- const scriptKind = getScriptKindForExtension(extension);
40981
- const sourceFile = ts__namespace.createSourceFile(filePath, content, ts__namespace.ScriptTarget.Latest, false, scriptKind);
40982
- return countEntitiesInSourceFile(sourceFile);
41028
+ /** Note: [🟡] Code for repository script [writeRefactorCandidatePrompts](scripts/find-refactor-candidates/writeRefactorCandidatePrompts.ts) should never be published outside of `@promptbook/cli` */
41029
+
41030
+ if (require.main === module) {
41031
+ findRefactorCandidates()
41032
+ .catch((error) => {
41033
+ assertsError(error);
41034
+ console.error(colors__default["default"].bgRed(`${error.name} in ${path.basename(__filename)}`));
41035
+ console.error(colors__default["default"].red(error.stack || error.message));
41036
+ process.exit(1);
41037
+ })
41038
+ .then(() => {
41039
+ process.exit(0);
41040
+ });
40983
41041
  }
40984
41042
  /**
40985
- * Counts top-level entities in a parsed TypeScript source file.
41043
+ * Initializes environment for this script.
41044
+ *
41045
+ * @private utility for `findRefactorCandidates`
40986
41046
  */
40987
- function countEntitiesInSourceFile(sourceFile) {
40988
- let count = 0;
40989
- // Only count top-level declarations to avoid inflating with members or nested scopes.
40990
- for (const statement of sourceFile.statements) {
40991
- if (ts__namespace.isFunctionDeclaration(statement) ||
40992
- ts__namespace.isClassDeclaration(statement) ||
40993
- ts__namespace.isInterfaceDeclaration(statement) ||
40994
- ts__namespace.isTypeAliasDeclaration(statement) ||
40995
- ts__namespace.isEnumDeclaration(statement) ||
40996
- ts__namespace.isModuleDeclaration(statement)) {
40997
- count += 1;
40998
- continue;
40999
- }
41000
- if (ts__namespace.isVariableStatement(statement)) {
41001
- for (const declaration of statement.declarationList.declarations) {
41002
- const initializer = declaration.initializer;
41003
- if (initializer &&
41004
- (ts__namespace.isArrowFunction(initializer) ||
41005
- ts__namespace.isFunctionExpression(initializer) ||
41006
- ts__namespace.isClassExpression(initializer))) {
41007
- count += 1;
41008
- }
41009
- }
41010
- }
41011
- }
41012
- return count;
41047
+ function initializeFindRefactorCandidatesRun() {
41048
+ dotenv__namespace.config({ path: '.env' });
41013
41049
  }
41014
41050
  /**
41015
- * Resolves the script kind for a source file extension.
41051
+ * Orchestrates scanning for refactor candidates and generating prompts.
41052
+ *
41053
+ * @public exported from `@promptbook/cli`
41016
41054
  */
41017
- function getScriptKindForExtension(extension) {
41018
- if (extension === '.tsx') {
41019
- return ts__namespace.ScriptKind.TSX;
41055
+ async function findRefactorCandidates() {
41056
+ initializeFindRefactorCandidatesRun();
41057
+ console.info(colors__default["default"].cyan('?? Find refactor candidates'));
41058
+ const rootDir = process.cwd();
41059
+ const promptsDir = path.join(rootDir, PROMPTS_DIR_NAME);
41060
+ const existingTargets = await loadExistingPromptTargets(promptsDir);
41061
+ const candidates = await findRefactorCandidatesInProject(rootDir);
41062
+ if (candidates.length === 0) {
41063
+ console.info(colors__default["default"].green('No refactor candidates found.'));
41064
+ return;
41020
41065
  }
41021
- if (extension === '.jsx') {
41022
- return ts__namespace.ScriptKind.JSX;
41066
+ logRefactorCandidates(candidates);
41067
+ const candidatesToWrite = candidates.filter((candidate) => !existingTargets.has(candidate.relativePath));
41068
+ const alreadyTracked = candidates.length - candidatesToWrite.length;
41069
+ if (candidatesToWrite.length === 0) {
41070
+ console.info(colors__default["default"].green('All candidates already have prompts.'));
41071
+ return;
41023
41072
  }
41024
- if (extension === '.js') {
41025
- return ts__namespace.ScriptKind.JS;
41073
+ const createdPrompts = await writeRefactorCandidatePrompts({
41074
+ candidates: candidatesToWrite,
41075
+ rootDir,
41076
+ promptsDir,
41077
+ });
41078
+ console.info(colors__default["default"].green(`Created ${createdPrompts.length} prompt(s) in ${PROMPTS_DIR_NAME}.`));
41079
+ if (alreadyTracked > 0) {
41080
+ console.info(colors__default["default"].gray(`Skipped ${alreadyTracked} candidate(s) with existing prompts.`));
41026
41081
  }
41027
- return ts__namespace.ScriptKind.TS;
41028
- }
41029
- /**
41030
- * Normalizes a path to use forward slashes.
41031
- */
41032
- function normalizeRelativePath(pathValue) {
41033
- const normalized = pathValue.replace(/\\/g, '/');
41034
- return normalized.replace(/^\.\//, '');
41035
- }
41036
- /**
41037
- * Normalizes an absolute path for consistent comparisons.
41038
- */
41039
- function normalizeAbsolutePath(pathValue) {
41040
- const normalized = path.resolve(pathValue);
41041
- return process.platform === 'win32' ? normalized.toLowerCase() : normalized;
41042
41082
  }
41043
41083
  /**
41044
- * Escapes a string for use in a regular expression literal.
41045
- */
41046
- function escapeRegExp(value) {
41047
- return value.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
41048
- }
41049
- /**
41050
- * Creates a short stable hash used for trimmed slugs.
41084
+ * Prints discovered refactor candidates with their reasons.
41085
+ *
41086
+ * @private function of findRefactorCandidates
41051
41087
  */
41052
- function hashString(value) {
41053
- let hash = 5381;
41054
- for (let i = 0; i < value.length; i += 1) {
41055
- hash = (hash << 5) + hash + value.charCodeAt(i);
41088
+ function logRefactorCandidates(candidates) {
41089
+ for (const candidate of candidates) {
41090
+ console.info(colors__default["default"].yellow(`${candidate.relativePath} <- ${candidate.reasons.join('; ')}`));
41056
41091
  }
41057
- return (hash >>> 0).toString(36);
41058
41092
  }
41059
- /**
41060
- * Note: [?] Code in this file should never be published in any package
41061
- */
41093
+ /** Note: [🟡] Code for repository script [find-refactor-candidates](scripts/find-refactor-candidates/find-refactor-candidates.ts) should never be published outside of `@promptbook/cli` */
41062
41094
 
41063
41095
  var findRefactorCandidates$1 = /*#__PURE__*/Object.freeze({
41064
41096
  __proto__: null,
@@ -41960,9 +41992,7 @@
41960
41992
  });
41961
41993
  return gitStatus.includes(`working tree clean`);
41962
41994
  }
41963
- /**
41964
- * Note: [🟡] Code in this file should never be published outside of `@promptbook/cli`
41965
- */
41995
+ /** Note: [🟡] Code for CLI support script [isWorkingTreeClean](scripts/utils/autocommit/isWorkingTreeClean.ts) should never be published outside of `@promptbook/cli` */
41966
41996
 
41967
41997
  /**
41968
41998
  * Ensures the git working tree is clean before running the prompt.
@@ -43526,6 +43556,9 @@
43526
43556
  - When throwing errors, throw [branded errors](src/errors) and use \`spaceTrim\` utility to write clear and well-formatted multilie detailed error messages.
43527
43557
  - Format errors as markdown, for example \`variabiles\` should be in backticks, important notes can be in bold, etc.
43528
43558
  - Constants should be always \`UPPER_SNAKE_CASE\`
43559
+ - Boolean variables should be always prefixed with "is", for example \`isUserChatJobLeaseExpired\` or \`IS_DEBUG_MODE\`
43560
+ - Do not use abbreviations, for example use \`isExpired\` instead of \`isExp\`, \`translateMessage\` instead of \`t\`, etc.
43561
+ - But it is fine to use well-known abbreviations, for example \`id\`, \`url\`, \`html\`, etc.
43529
43562
  - When writing multiline strings, use \`spaceTrim\` utility
43530
43563
  - DO only the change described here above DO not add any additional features or make any additional changes that are not described in the prompt.
43531
43564
  - If you find some critical issue that is not described in the prompt, report it to the file \`./AGENT_REPORT.md\` on the root of the project