@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.
package/dist/gsc-utils.cjs.js
CHANGED
|
@@ -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,
|
|
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 (!
|
|
8810
|
-
throw new Error("Missing required
|
|
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,
|
package/dist/gsc-utils.esm.js
CHANGED
|
@@ -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,
|
|
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 (!
|
|
8808
|
-
throw new Error("Missing required
|
|
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
package/src/GSToolBlockUtils.js
CHANGED
|
@@ -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,
|
|
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 (!
|
|
127
|
-
throw new Error("Missing required
|
|
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,
|