@gitsense/gsc-utils 0.2.17 → 0.2.18

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.
@@ -10460,7 +10460,7 @@ const { updateCodeBlockByIndex: updateCodeBlockByIndex$1, updateCodeBlockByUUID,
10460
10460
  const { formatWithLineNumbers: formatWithLineNumbers$1, formatBlockWithLineNumbers: formatBlockWithLineNumbers$1, formatBlocksWithLineNumbers: formatBlocksWithLineNumbers$1, removeLineNumbers: removeLineNumbers$1 } = lineNumberFormatter;
10461
10461
 
10462
10462
  // Export all imported items
10463
- var CodeBlockUtils$4 = {
10463
+ var CodeBlockUtils$5 = {
10464
10464
  // Constants
10465
10465
  COMMENT_STYLES: COMMENT_STYLES$1,
10466
10466
 
@@ -10527,7 +10527,7 @@ var CodeBlockUtils$4 = {
10527
10527
  * Authors: Gemini 2.5 Flash Thinking (v1.0.0), Gemini 2.5 Flash (v1.1.0)
10528
10528
  */
10529
10529
 
10530
- const CodeBlockUtils$3 = CodeBlockUtils$4;
10530
+ const CodeBlockUtils$4 = CodeBlockUtils$5;
10531
10531
  const MessageUtils$2 = MessageUtils$3;
10532
10532
 
10533
10533
  /**
@@ -10666,7 +10666,7 @@ function parseContextSection$1(sectionText) {
10666
10666
  }
10667
10667
  });
10668
10668
 
10669
- const { blocks, warnings } = CodeBlockUtils$3.extractCodeBlocks(sectionText, { silent: true });
10669
+ const { blocks, warnings } = CodeBlockUtils$4.extractCodeBlocks(sectionText, { silent: true });
10670
10670
  const codeBlocks = blocks.filter(block => block.type === 'code');
10671
10671
 
10672
10672
  if (codeBlocks.length === 0) {
@@ -10932,7 +10932,7 @@ var constants = {
10932
10932
  * Authors: Gemini 2.5 Flash (v1.0.0)
10933
10933
  */
10934
10934
 
10935
- const CodeBlockUtils$2 = CodeBlockUtils$4;
10935
+ const CodeBlockUtils$3 = CodeBlockUtils$5;
10936
10936
  const GSToolBlockUtils$1 = GSToolBlockUtils$3;
10937
10937
  const JsonUtils$1 = JsonUtils$2;
10938
10938
  const { ANALYZE_HEADER_PREFIX } = constants;
@@ -10949,7 +10949,7 @@ const { ANALYZE_HEADER_PREFIX } = constants;
10949
10949
  */
10950
10950
  function processLLMAnalysisResponse$2(messageContent, stoppedStreaming) {
10951
10951
  const silent = { silent: true };
10952
- const { blocks, warnings } = CodeBlockUtils$2.extractCodeBlocks(messageContent, silent);
10952
+ const { blocks, warnings } = CodeBlockUtils$3.extractCodeBlocks(messageContent, silent);
10953
10953
 
10954
10954
  const analysisBlocks = [];
10955
10955
  const analysisMetadataBlocks = [];
@@ -11206,6 +11206,7 @@ var instructionLoader = {
11206
11206
  const fs$6 = require$$0.promises;
11207
11207
  const path$4 = require$$1;
11208
11208
  const { getAnalyzerInstructionsContent: getAnalyzerInstructionsContent$2 } = instructionLoader;
11209
+ const CodeBlockUtils$2 = CodeBlockUtils$5;
11209
11210
 
11210
11211
  /**
11211
11212
  * Reads and parses the config.json file in a directory.
@@ -11303,10 +11304,21 @@ async function getAnalyzers$2(analyzeMessagesBasePath, options = {}) {
11303
11304
  const analyzerId = `${analyzerName}::${contentType}::${instructionsType}`;
11304
11305
  const analyzerFullLabel = `${analyzerLabel} (${contentLabel} - ${instructionsLabel})`;
11305
11306
 
11306
- let descriptionContent = null;
11307
+ let description = null;
11307
11308
  if (includeDescription) {
11308
11309
  try {
11309
- descriptionContent = await getAnalyzerInstructionsContent$2(analyzeMessagesBasePath, analyzerId);
11310
+ const content = await getAnalyzerInstructionsContent$2(analyzeMessagesBasePath, analyzerId);
11311
+ const { blocks, warnings } = CodeBlockUtils$2.extractCodeBlocks(content, { silent: true });
11312
+ const jsonBlock = blocks.find(block => block.language === 'json');
11313
+
11314
+ if (jsonBlock && jsonBlock.content) {
11315
+ try {
11316
+ const json = JSON.parse(jsonBlock.content);
11317
+ description = json.description;
11318
+ } catch(error) {
11319
+ console.warn(`${analyzerId} contains an invalid JSON`);
11320
+ }
11321
+ }
11310
11322
  } catch (descError) {
11311
11323
  console.warn(`Warning: Could not load description for ${analyzerId}: ${descError.message}`);
11312
11324
  descriptionContent = null;
@@ -11318,7 +11330,7 @@ async function getAnalyzers$2(analyzeMessagesBasePath, options = {}) {
11318
11330
  label: analyzerFullLabel,
11319
11331
  name: analyzerName,
11320
11332
  protected: analyzerConfig?.protected || false,
11321
- ...(descriptionContent && { description: descriptionContent })
11333
+ description
11322
11334
  });
11323
11335
  } catch (error) {
11324
11336
  // If 1.md doesn't exist, this is not a complete analyzer configuration, skip.
@@ -11491,7 +11503,7 @@ var saver = {
11491
11503
 
11492
11504
  const fs$4 = require$$0.promises;
11493
11505
  const path$2 = require$$1;
11494
- const CodeBlockUtils$1 = CodeBlockUtils$4;
11506
+ const CodeBlockUtils$1 = CodeBlockUtils$5;
11495
11507
 
11496
11508
  /**
11497
11509
  * Deduces the JSON schema type and format/items from a string value pattern.
@@ -12120,7 +12132,7 @@ var EnvUtils$1 = {
12120
12132
  */
12121
12133
 
12122
12134
  const ChatUtils = ChatUtils$1;
12123
- const CodeBlockUtils = CodeBlockUtils$4;
12135
+ const CodeBlockUtils = CodeBlockUtils$5;
12124
12136
  const ContextUtils = ContextUtils$2;
12125
12137
  const MessageUtils = MessageUtils$3;
12126
12138
  const AnalysisBlockUtils = AnalysisBlockUtils$3;
@@ -10458,7 +10458,7 @@ const { updateCodeBlockByIndex: updateCodeBlockByIndex$1, updateCodeBlockByUUID,
10458
10458
  const { formatWithLineNumbers: formatWithLineNumbers$1, formatBlockWithLineNumbers: formatBlockWithLineNumbers$1, formatBlocksWithLineNumbers: formatBlocksWithLineNumbers$1, removeLineNumbers: removeLineNumbers$1 } = lineNumberFormatter;
10459
10459
 
10460
10460
  // Export all imported items
10461
- var CodeBlockUtils$4 = {
10461
+ var CodeBlockUtils$5 = {
10462
10462
  // Constants
10463
10463
  COMMENT_STYLES: COMMENT_STYLES$1,
10464
10464
 
@@ -10525,7 +10525,7 @@ var CodeBlockUtils$4 = {
10525
10525
  * Authors: Gemini 2.5 Flash Thinking (v1.0.0), Gemini 2.5 Flash (v1.1.0)
10526
10526
  */
10527
10527
 
10528
- const CodeBlockUtils$3 = CodeBlockUtils$4;
10528
+ const CodeBlockUtils$4 = CodeBlockUtils$5;
10529
10529
  const MessageUtils$2 = MessageUtils$3;
10530
10530
 
10531
10531
  /**
@@ -10664,7 +10664,7 @@ function parseContextSection$1(sectionText) {
10664
10664
  }
10665
10665
  });
10666
10666
 
10667
- const { blocks, warnings } = CodeBlockUtils$3.extractCodeBlocks(sectionText, { silent: true });
10667
+ const { blocks, warnings } = CodeBlockUtils$4.extractCodeBlocks(sectionText, { silent: true });
10668
10668
  const codeBlocks = blocks.filter(block => block.type === 'code');
10669
10669
 
10670
10670
  if (codeBlocks.length === 0) {
@@ -10930,7 +10930,7 @@ var constants = {
10930
10930
  * Authors: Gemini 2.5 Flash (v1.0.0)
10931
10931
  */
10932
10932
 
10933
- const CodeBlockUtils$2 = CodeBlockUtils$4;
10933
+ const CodeBlockUtils$3 = CodeBlockUtils$5;
10934
10934
  const GSToolBlockUtils$1 = GSToolBlockUtils$3;
10935
10935
  const JsonUtils$1 = JsonUtils$2;
10936
10936
  const { ANALYZE_HEADER_PREFIX } = constants;
@@ -10947,7 +10947,7 @@ const { ANALYZE_HEADER_PREFIX } = constants;
10947
10947
  */
10948
10948
  function processLLMAnalysisResponse$2(messageContent, stoppedStreaming) {
10949
10949
  const silent = { silent: true };
10950
- const { blocks, warnings } = CodeBlockUtils$2.extractCodeBlocks(messageContent, silent);
10950
+ const { blocks, warnings } = CodeBlockUtils$3.extractCodeBlocks(messageContent, silent);
10951
10951
 
10952
10952
  const analysisBlocks = [];
10953
10953
  const analysisMetadataBlocks = [];
@@ -11204,6 +11204,7 @@ var instructionLoader = {
11204
11204
  const fs$6 = require$$0.promises;
11205
11205
  const path$4 = require$$1;
11206
11206
  const { getAnalyzerInstructionsContent: getAnalyzerInstructionsContent$2 } = instructionLoader;
11207
+ const CodeBlockUtils$2 = CodeBlockUtils$5;
11207
11208
 
11208
11209
  /**
11209
11210
  * Reads and parses the config.json file in a directory.
@@ -11301,10 +11302,21 @@ async function getAnalyzers$2(analyzeMessagesBasePath, options = {}) {
11301
11302
  const analyzerId = `${analyzerName}::${contentType}::${instructionsType}`;
11302
11303
  const analyzerFullLabel = `${analyzerLabel} (${contentLabel} - ${instructionsLabel})`;
11303
11304
 
11304
- let descriptionContent = null;
11305
+ let description = null;
11305
11306
  if (includeDescription) {
11306
11307
  try {
11307
- descriptionContent = await getAnalyzerInstructionsContent$2(analyzeMessagesBasePath, analyzerId);
11308
+ const content = await getAnalyzerInstructionsContent$2(analyzeMessagesBasePath, analyzerId);
11309
+ const { blocks, warnings } = CodeBlockUtils$2.extractCodeBlocks(content, { silent: true });
11310
+ const jsonBlock = blocks.find(block => block.language === 'json');
11311
+
11312
+ if (jsonBlock && jsonBlock.content) {
11313
+ try {
11314
+ const json = JSON.parse(jsonBlock.content);
11315
+ description = json.description;
11316
+ } catch(error) {
11317
+ console.warn(`${analyzerId} contains an invalid JSON`);
11318
+ }
11319
+ }
11308
11320
  } catch (descError) {
11309
11321
  console.warn(`Warning: Could not load description for ${analyzerId}: ${descError.message}`);
11310
11322
  descriptionContent = null;
@@ -11316,7 +11328,7 @@ async function getAnalyzers$2(analyzeMessagesBasePath, options = {}) {
11316
11328
  label: analyzerFullLabel,
11317
11329
  name: analyzerName,
11318
11330
  protected: analyzerConfig?.protected || false,
11319
- ...(descriptionContent && { description: descriptionContent })
11331
+ description
11320
11332
  });
11321
11333
  } catch (error) {
11322
11334
  // If 1.md doesn't exist, this is not a complete analyzer configuration, skip.
@@ -11489,7 +11501,7 @@ var saver = {
11489
11501
 
11490
11502
  const fs$4 = require$$0.promises;
11491
11503
  const path$2 = require$$1;
11492
- const CodeBlockUtils$1 = CodeBlockUtils$4;
11504
+ const CodeBlockUtils$1 = CodeBlockUtils$5;
11493
11505
 
11494
11506
  /**
11495
11507
  * Deduces the JSON schema type and format/items from a string value pattern.
@@ -12118,7 +12130,7 @@ var EnvUtils$1 = {
12118
12130
  */
12119
12131
 
12120
12132
  const ChatUtils = ChatUtils$1;
12121
- const CodeBlockUtils = CodeBlockUtils$4;
12133
+ const CodeBlockUtils = CodeBlockUtils$5;
12122
12134
  const ContextUtils = ContextUtils$2;
12123
12135
  const MessageUtils = MessageUtils$3;
12124
12136
  const AnalysisBlockUtils = AnalysisBlockUtils$3;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gitsense/gsc-utils",
3
- "version": "0.2.17",
3
+ "version": "0.2.18",
4
4
  "description": "Utilities for GitSense Chat (GSC)",
5
5
  "main": "dist/gsc-utils.cjs.js",
6
6
  "module": "dist/gsc-utils.esm.js",
@@ -13,6 +13,7 @@
13
13
  const fs = require('fs').promises;
14
14
  const path = require('path');
15
15
  const { getAnalyzerInstructionsContent } = require('./instructionLoader');
16
+ const CodeBlockUtils = require('../CodeBlockUtils');
16
17
 
17
18
  /**
18
19
  * Reads and parses the config.json file in a directory.
@@ -110,10 +111,21 @@ async function getAnalyzers(analyzeMessagesBasePath, options = {}) {
110
111
  const analyzerId = `${analyzerName}::${contentType}::${instructionsType}`;
111
112
  const analyzerFullLabel = `${analyzerLabel} (${contentLabel} - ${instructionsLabel})`;
112
113
 
113
- let descriptionContent = null;
114
+ let description = null;
114
115
  if (includeDescription) {
115
116
  try {
116
- descriptionContent = await getAnalyzerInstructionsContent(analyzeMessagesBasePath, analyzerId);
117
+ const content = await getAnalyzerInstructionsContent(analyzeMessagesBasePath, analyzerId);
118
+ const { blocks, warnings } = CodeBlockUtils.extractCodeBlocks(content, { silent: true });
119
+ const jsonBlock = blocks.find(block => block.language === 'json');
120
+
121
+ if (jsonBlock && jsonBlock.content) {
122
+ try {
123
+ const json = JSON.parse(jsonBlock.content);
124
+ description = json.description;
125
+ } catch(error) {
126
+ console.warn(`${analyzerId} contains an invalid JSON`);
127
+ }
128
+ }
117
129
  } catch (descError) {
118
130
  console.warn(`Warning: Could not load description for ${analyzerId}: ${descError.message}`);
119
131
  descriptionContent = null;
@@ -125,7 +137,7 @@ async function getAnalyzers(analyzeMessagesBasePath, options = {}) {
125
137
  label: analyzerFullLabel,
126
138
  name: analyzerName,
127
139
  protected: analyzerConfig?.protected || false,
128
- ...(descriptionContent && { description: descriptionContent })
140
+ description
129
141
  });
130
142
  } catch (error) {
131
143
  // If 1.md doesn't exist, this is not a complete analyzer configuration, skip.