@gitsense/gsc-utils 0.2.18 → 0.2.19

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.
@@ -8797,21 +8797,22 @@ function formatToolBlock(toolData) {
8797
8797
  * @param {string} markdownContent - The original markdown string containing code blocks.
8798
8798
  * @param {string} toolName - The 'tool' property value of the target GitSense Chat Tool Block to replace.
8799
8799
  * @param {Object} newToolData - The new tool data object to insert into the block.
8800
+ * @param {Object} CodeBlockUtils - The CodeBlockUtils class to avoid a circular dependency since we can't require it.
8800
8801
  * @returns {string} The markdown content with the specified tool block updated.
8801
8802
  * @throws {Error} If the target tool block is not found or if CodeBlockUtils encounters an error.
8802
8803
  */
8803
- function replaceToolBlock(markdownContent, toolName, newToolData, processCodeBlocks, updateCodeBlockByIndex) {
8804
+ function replaceToolBlock(markdownContent, toolName, newToolData, CodeBlockUtils) {
8804
8805
  if (typeof markdownContent !== 'string' || !toolName || !newToolData) {
8805
8806
  throw new Error("Missing required parameters for replaceToolBlock.");
8806
8807
  }
8807
8808
 
8808
8809
  // We can't require them as this will create a circular dependency
8809
- if (!processCodeBlocks || !updateCodeBlockByIndex) {
8810
- throw new Error("Missing required dependencies processCodeBlocks and/or updateCodeBlockByIndex.");
8810
+ if (!CodeBlockUtils) {
8811
+ throw new Error("Missing required CodeBlockUtils dependency");
8811
8812
  }
8812
8813
 
8813
8814
  // 1. Process the markdown content to find all code blocks
8814
- const { blocks, warnings } = processCodeBlocks(markdownContent, { silent: true });
8815
+ const { blocks, warnings } = CodeBlockUtils.processCodeBlocks(markdownContent, { silent: true });
8815
8816
 
8816
8817
  let targetBlockIndex = -1;
8817
8818
 
@@ -8834,7 +8835,7 @@ function replaceToolBlock(markdownContent, toolName, newToolData, processCodeBlo
8834
8835
 
8835
8836
  // 4. Use CodeBlockUtils.updateCodeBlockByIndex to perform the replacement
8836
8837
  // The language for GitSense Tool Blocks is always 'txt'
8837
- const updatedMarkdown = updateCodeBlockByIndex(
8838
+ const updatedMarkdown = CodeBlockUtils.updateCodeBlockByIndex(
8838
8839
  markdownContent,
8839
8840
  targetBlockIndex,
8840
8841
  newContentBetweenFences,
@@ -8795,21 +8795,22 @@ function formatToolBlock(toolData) {
8795
8795
  * @param {string} markdownContent - The original markdown string containing code blocks.
8796
8796
  * @param {string} toolName - The 'tool' property value of the target GitSense Chat Tool Block to replace.
8797
8797
  * @param {Object} newToolData - The new tool data object to insert into the block.
8798
+ * @param {Object} CodeBlockUtils - The CodeBlockUtils class to avoid a circular dependency since we can't require it.
8798
8799
  * @returns {string} The markdown content with the specified tool block updated.
8799
8800
  * @throws {Error} If the target tool block is not found or if CodeBlockUtils encounters an error.
8800
8801
  */
8801
- function replaceToolBlock(markdownContent, toolName, newToolData, processCodeBlocks, updateCodeBlockByIndex) {
8802
+ function replaceToolBlock(markdownContent, toolName, newToolData, CodeBlockUtils) {
8802
8803
  if (typeof markdownContent !== 'string' || !toolName || !newToolData) {
8803
8804
  throw new Error("Missing required parameters for replaceToolBlock.");
8804
8805
  }
8805
8806
 
8806
8807
  // We can't require them as this will create a circular dependency
8807
- if (!processCodeBlocks || !updateCodeBlockByIndex) {
8808
- throw new Error("Missing required dependencies processCodeBlocks and/or updateCodeBlockByIndex.");
8808
+ if (!CodeBlockUtils) {
8809
+ throw new Error("Missing required CodeBlockUtils dependency");
8809
8810
  }
8810
8811
 
8811
8812
  // 1. Process the markdown content to find all code blocks
8812
- const { blocks, warnings } = processCodeBlocks(markdownContent, { silent: true });
8813
+ const { blocks, warnings } = CodeBlockUtils.processCodeBlocks(markdownContent, { silent: true });
8813
8814
 
8814
8815
  let targetBlockIndex = -1;
8815
8816
 
@@ -8832,7 +8833,7 @@ function replaceToolBlock(markdownContent, toolName, newToolData, processCodeBlo
8832
8833
 
8833
8834
  // 4. Use CodeBlockUtils.updateCodeBlockByIndex to perform the replacement
8834
8835
  // The language for GitSense Tool Blocks is always 'txt'
8835
- const updatedMarkdown = updateCodeBlockByIndex(
8836
+ const updatedMarkdown = CodeBlockUtils.updateCodeBlockByIndex(
8836
8837
  markdownContent,
8837
8838
  targetBlockIndex,
8838
8839
  newContentBetweenFences,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gitsense/gsc-utils",
3
- "version": "0.2.18",
3
+ "version": "0.2.19",
4
4
  "description": "Utilities for GitSense Chat (GSC)",
5
5
  "main": "dist/gsc-utils.cjs.js",
6
6
  "module": "dist/gsc-utils.esm.js",
@@ -114,21 +114,22 @@ function formatToolBlock(toolData) {
114
114
  * @param {string} markdownContent - The original markdown string containing code blocks.
115
115
  * @param {string} toolName - The 'tool' property value of the target GitSense Chat Tool Block to replace.
116
116
  * @param {Object} newToolData - The new tool data object to insert into the block.
117
+ * @param {Object} CodeBlockUtils - The CodeBlockUtils class to avoid a circular dependency since we can't require it.
117
118
  * @returns {string} The markdown content with the specified tool block updated.
118
119
  * @throws {Error} If the target tool block is not found or if CodeBlockUtils encounters an error.
119
120
  */
120
- function replaceToolBlock(markdownContent, toolName, newToolData, processCodeBlocks, updateCodeBlockByIndex) {
121
+ function replaceToolBlock(markdownContent, toolName, newToolData, CodeBlockUtils) {
121
122
  if (typeof markdownContent !== 'string' || !toolName || !newToolData) {
122
123
  throw new Error("Missing required parameters for replaceToolBlock.");
123
124
  }
124
125
 
125
126
  // We can't require them as this will create a circular dependency
126
- if (!processCodeBlocks || !updateCodeBlockByIndex) {
127
- throw new Error("Missing required dependencies processCodeBlocks and/or updateCodeBlockByIndex.");
127
+ if (!CodeBlockUtils) {
128
+ throw new Error("Missing required CodeBlockUtils dependency");
128
129
  }
129
130
 
130
131
  // 1. Process the markdown content to find all code blocks
131
- const { blocks, warnings } = processCodeBlocks(markdownContent, { silent: true });
132
+ const { blocks, warnings } = CodeBlockUtils.processCodeBlocks(markdownContent, { silent: true });
132
133
 
133
134
  let targetBlockIndex = -1;
134
135
 
@@ -151,7 +152,7 @@ function replaceToolBlock(markdownContent, toolName, newToolData, processCodeBlo
151
152
 
152
153
  // 4. Use CodeBlockUtils.updateCodeBlockByIndex to perform the replacement
153
154
  // The language for GitSense Tool Blocks is always 'txt'
154
- const updatedMarkdown = updateCodeBlockByIndex(
155
+ const updatedMarkdown = CodeBlockUtils.updateCodeBlockByIndex(
155
156
  markdownContent,
156
157
  targetBlockIndex,
157
158
  newContentBetweenFences,