@gitsense/gsc-utils 0.2.10 → 0.2.11

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.
@@ -10774,7 +10774,7 @@ function formatContextContent$1(items, contentType, contentOption) {
10774
10774
  // For batch analysis, we want the full file content.
10775
10775
  // The `if (!escapedContent.includes('Component: New Analyzer Chat') && escapedContent.match(summary))`
10776
10776
  // logic is specific to the frontend's overview builder and should not be applied here.
10777
- result += "```"+(itemMeta.highlight || '')+"\n"+escapedContent+"\n```";
10777
+ result += "```"+(item.highlight || '')+"\n"+escapedContent+"\n```";
10778
10778
 
10779
10779
  if (index !== items.length - 1) {
10780
10780
  result += '\n---End of Item---\n';
@@ -11831,13 +11831,13 @@ var LLMUtils$1 = {
11831
11831
 
11832
11832
  /*
11833
11833
  * Component: Config Utilities
11834
- * Block-UUID: 89016e46-9898-42f0-bef4-564e442cfaf3
11835
- * Parent-UUID: N/A
11836
- * Version: 1.0.0
11834
+ * Block-UUID: 4f0bc5b4-acc6-44e4-8344-db9e3df89c0d
11835
+ * Parent-UUID: 89016e46-9898-42f0-bef4-564e442cfaf3
11836
+ * Version: 1.1.0
11837
11837
  * Description: Provides utility functions for loading and accessing application configuration from data/chats.json.
11838
11838
  * Language: JavaScript
11839
- * Created-at: 2025-08-28T17:46:26.948Z
11840
- * Authors: Gemini 2.5 Flash (v1.0.0)
11839
+ * Created-at: 2025-09-02T04:04:42.681Z
11840
+ * Authors: Gemini 2.5 Flash (v1.0.0), Gemini 2.5 Flash (v1.1.0)
11841
11841
  */
11842
11842
 
11843
11843
  const fs$1 = require$$0.promises;
@@ -11908,11 +11908,34 @@ function getApiKeyName$1(config, providerName) {
11908
11908
  return providerConfig ? providerConfig.apiKeyName : null;
11909
11909
  }
11910
11910
 
11911
+ /**
11912
+ * Retrieves the first provider configuration for a given model name.
11913
+ * This method assumes only one provider is relevant per model, even if the configuration
11914
+ * lists multiple in a 'providers' array, and will return the first one found.
11915
+ *
11916
+ * @param {Object} config - The loaded configuration object.
11917
+ * @param {string} modelName - The user-friendly name of the model (e.g., "Gemini 2.5 Flash").
11918
+ * @returns {Object|null} The first provider's configuration object for the model, or null if not found.
11919
+ */
11920
+ function getProviderForModel(config, modelName) {
11921
+ if (!config || !config.models || !Array.isArray(config.models)) {
11922
+ return null;
11923
+ }
11924
+
11925
+ const modelEntry = config.models.find(m => m.name === modelName);
11926
+ if (!modelEntry || !modelEntry.providers || !Array.isArray(modelEntry.providers) || modelEntry.providers.length === 0) {
11927
+ return null;
11928
+ }
11929
+
11930
+ return modelEntry.providers[0];
11931
+ }
11932
+
11911
11933
  var ConfigUtils$1 = {
11912
11934
  loadConfig: loadConfig$1,
11913
11935
  getProviderConfig: getProviderConfig$1,
11914
11936
  getModelProviderDetails: getModelProviderDetails$1,
11915
- getApiKeyName: getApiKeyName$1
11937
+ getApiKeyName: getApiKeyName$1,
11938
+ getProviderForModel
11916
11939
  };
11917
11940
 
11918
11941
  /*
@@ -10772,7 +10772,7 @@ function formatContextContent$1(items, contentType, contentOption) {
10772
10772
  // For batch analysis, we want the full file content.
10773
10773
  // The `if (!escapedContent.includes('Component: New Analyzer Chat') && escapedContent.match(summary))`
10774
10774
  // logic is specific to the frontend's overview builder and should not be applied here.
10775
- result += "```"+(itemMeta.highlight || '')+"\n"+escapedContent+"\n```";
10775
+ result += "```"+(item.highlight || '')+"\n"+escapedContent+"\n```";
10776
10776
 
10777
10777
  if (index !== items.length - 1) {
10778
10778
  result += '\n---End of Item---\n';
@@ -11829,13 +11829,13 @@ var LLMUtils$1 = {
11829
11829
 
11830
11830
  /*
11831
11831
  * Component: Config Utilities
11832
- * Block-UUID: 89016e46-9898-42f0-bef4-564e442cfaf3
11833
- * Parent-UUID: N/A
11834
- * Version: 1.0.0
11832
+ * Block-UUID: 4f0bc5b4-acc6-44e4-8344-db9e3df89c0d
11833
+ * Parent-UUID: 89016e46-9898-42f0-bef4-564e442cfaf3
11834
+ * Version: 1.1.0
11835
11835
  * Description: Provides utility functions for loading and accessing application configuration from data/chats.json.
11836
11836
  * Language: JavaScript
11837
- * Created-at: 2025-08-28T17:46:26.948Z
11838
- * Authors: Gemini 2.5 Flash (v1.0.0)
11837
+ * Created-at: 2025-09-02T04:04:42.681Z
11838
+ * Authors: Gemini 2.5 Flash (v1.0.0), Gemini 2.5 Flash (v1.1.0)
11839
11839
  */
11840
11840
 
11841
11841
  const fs$1 = require$$0.promises;
@@ -11906,11 +11906,34 @@ function getApiKeyName$1(config, providerName) {
11906
11906
  return providerConfig ? providerConfig.apiKeyName : null;
11907
11907
  }
11908
11908
 
11909
+ /**
11910
+ * Retrieves the first provider configuration for a given model name.
11911
+ * This method assumes only one provider is relevant per model, even if the configuration
11912
+ * lists multiple in a 'providers' array, and will return the first one found.
11913
+ *
11914
+ * @param {Object} config - The loaded configuration object.
11915
+ * @param {string} modelName - The user-friendly name of the model (e.g., "Gemini 2.5 Flash").
11916
+ * @returns {Object|null} The first provider's configuration object for the model, or null if not found.
11917
+ */
11918
+ function getProviderForModel(config, modelName) {
11919
+ if (!config || !config.models || !Array.isArray(config.models)) {
11920
+ return null;
11921
+ }
11922
+
11923
+ const modelEntry = config.models.find(m => m.name === modelName);
11924
+ if (!modelEntry || !modelEntry.providers || !Array.isArray(modelEntry.providers) || modelEntry.providers.length === 0) {
11925
+ return null;
11926
+ }
11927
+
11928
+ return modelEntry.providers[0];
11929
+ }
11930
+
11909
11931
  var ConfigUtils$1 = {
11910
11932
  loadConfig: loadConfig$1,
11911
11933
  getProviderConfig: getProviderConfig$1,
11912
11934
  getModelProviderDetails: getModelProviderDetails$1,
11913
- getApiKeyName: getApiKeyName$1
11935
+ getApiKeyName: getApiKeyName$1,
11936
+ getProviderForModel
11914
11937
  };
11915
11938
 
11916
11939
  /*
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gitsense/gsc-utils",
3
- "version": "0.2.10",
3
+ "version": "0.2.11",
4
4
  "description": "Utilities for GitSense Chat (GSC)",
5
5
  "main": "dist/gsc-utils.cjs.js",
6
6
  "module": "dist/gsc-utils.esm.js",
@@ -1,12 +1,12 @@
1
1
  /*
2
2
  * Component: Config Utilities
3
- * Block-UUID: 89016e46-9898-42f0-bef4-564e442cfaf3
4
- * Parent-UUID: N/A
5
- * Version: 1.0.0
3
+ * Block-UUID: 4f0bc5b4-acc6-44e4-8344-db9e3df89c0d
4
+ * Parent-UUID: 89016e46-9898-42f0-bef4-564e442cfaf3
5
+ * Version: 1.1.0
6
6
  * Description: Provides utility functions for loading and accessing application configuration from data/chats.json.
7
7
  * Language: JavaScript
8
- * Created-at: 2025-08-28T17:46:26.948Z
9
- * Authors: Gemini 2.5 Flash (v1.0.0)
8
+ * Created-at: 2025-09-02T04:04:42.681Z
9
+ * Authors: Gemini 2.5 Flash (v1.0.0), Gemini 2.5 Flash (v1.1.0)
10
10
  */
11
11
 
12
12
 
@@ -78,9 +78,32 @@ function getApiKeyName(config, providerName) {
78
78
  return providerConfig ? providerConfig.apiKeyName : null;
79
79
  }
80
80
 
81
+ /**
82
+ * Retrieves the first provider configuration for a given model name.
83
+ * This method assumes only one provider is relevant per model, even if the configuration
84
+ * lists multiple in a 'providers' array, and will return the first one found.
85
+ *
86
+ * @param {Object} config - The loaded configuration object.
87
+ * @param {string} modelName - The user-friendly name of the model (e.g., "Gemini 2.5 Flash").
88
+ * @returns {Object|null} The first provider's configuration object for the model, or null if not found.
89
+ */
90
+ function getProviderForModel(config, modelName) {
91
+ if (!config || !config.models || !Array.isArray(config.models)) {
92
+ return null;
93
+ }
94
+
95
+ const modelEntry = config.models.find(m => m.name === modelName);
96
+ if (!modelEntry || !modelEntry.providers || !Array.isArray(modelEntry.providers) || modelEntry.providers.length === 0) {
97
+ return null;
98
+ }
99
+
100
+ return modelEntry.providers[0];
101
+ }
102
+
81
103
  module.exports = {
82
104
  loadConfig,
83
105
  getProviderConfig,
84
106
  getModelProviderDetails,
85
- getApiKeyName
107
+ getApiKeyName,
108
+ getProviderForModel
86
109
  };
@@ -319,7 +319,7 @@ function formatContextContent(items, contentType, contentOption) {
319
319
  // For batch analysis, we want the full file content.
320
320
  // The `if (!escapedContent.includes('Component: New Analyzer Chat') && escapedContent.match(summary))`
321
321
  // logic is specific to the frontend's overview builder and should not be applied here.
322
- result += "```"+(itemMeta.highlight || '')+"\n"+escapedContent+"\n```";
322
+ result += "```"+(item.highlight || '')+"\n"+escapedContent+"\n```";
323
323
 
324
324
  if (index !== items.length - 1) {
325
325
  result += '\n---End of Item---\n';