@gitsense/gsc-utils 0.2.32 → 0.2.35
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 +68 -40
- package/dist/gsc-utils.esm.js +68 -40
- package/package.json +1 -1
- package/src/AnalysisBlockUtils.js +5 -2
- package/src/AnalyzerUtils/schemaLoader.js +42 -37
- package/src/CodeBlockUtils/blockProcessor.js +1 -1
- package/src/SVGUtils.js +20 -0
package/dist/gsc-utils.cjs.js
CHANGED
|
@@ -1426,7 +1426,10 @@ function parseOverviewMetadata$1(content) {
|
|
|
1426
1426
|
const lines = content.split('\n');
|
|
1427
1427
|
|
|
1428
1428
|
// Regex to capture "Field Name" and "Value" from lines like '* **Field Name: ** Value'
|
|
1429
|
-
const
|
|
1429
|
+
const fieldRegex1 = /^\*\s+\*\*([\w\s.-]+):\*\*\s+(.*)$/;
|
|
1430
|
+
const fieldRegex2 = /^\*\s+\*\*([\w\s.-]+)\*\*:\s+(.*)$/;
|
|
1431
|
+
const fieldRegex3 = /^.*?(Chat ID|Path).*:\s*(\d+)$/m;
|
|
1432
|
+
|
|
1430
1433
|
let foundList = false;
|
|
1431
1434
|
let currentKey = null; // For potential multi-line handling in the future
|
|
1432
1435
|
|
|
@@ -1442,7 +1445,7 @@ function parseOverviewMetadata$1(content) {
|
|
|
1442
1445
|
break;
|
|
1443
1446
|
}
|
|
1444
1447
|
|
|
1445
|
-
const match = trimmedLine.match(
|
|
1448
|
+
const match = trimmedLine.match(fieldRegex1) || trimmedLine.match(fieldRegex2) || trimmedLine.match(fieldRegex3);
|
|
1446
1449
|
|
|
1447
1450
|
if (match) {
|
|
1448
1451
|
foundList = true;
|
|
@@ -9970,7 +9973,7 @@ function fixTextCodeBlocks$2(text) {
|
|
|
9970
9973
|
if (validation["Block-UUID"] === "INVALID UUID") {
|
|
9971
9974
|
blockModified = true;
|
|
9972
9975
|
modified = true;
|
|
9973
|
-
return
|
|
9976
|
+
return ` ${fieldPart}: ${validation["Correct Block-UUID"]}`;
|
|
9974
9977
|
}
|
|
9975
9978
|
}
|
|
9976
9979
|
return line;
|
|
@@ -12137,15 +12140,20 @@ var saver = {
|
|
|
12137
12140
|
|
|
12138
12141
|
/**
|
|
12139
12142
|
* Component: AnalyzerUtils Schema Loader
|
|
12140
|
-
* Block-UUID:
|
|
12141
|
-
* Parent-UUID:
|
|
12142
|
-
* Version: 1.
|
|
12143
|
+
* Block-UUID: 20ac37ba-6ff7-462e-9e08-3204df118b03
|
|
12144
|
+
* Parent-UUID: bf25c501-f9e1-4e5b-ad22-9ed24ba50787
|
|
12145
|
+
* Version: 1.5.0
|
|
12143
12146
|
* Description: Provides utility functions for retrieving and deducing JSON schemas for analyzers.
|
|
12144
12147
|
* Language: JavaScript
|
|
12145
|
-
* Created-at:
|
|
12146
|
-
* Authors: Gemini 2.5 Flash (v1.0.0), Gemini 2.5 Pro (v1.1.0), Claude Haiku 4.5 (v1.2.0), Claude Haiku 4.5 (v1.3.0), Qwen 3 Coder 480B - Cerebras (v1.4.0), GLM-4.6 (v1.4.1)
|
|
12148
|
+
* Created-at: 2026-02-15T06:21:20.089Z
|
|
12149
|
+
* Authors: Gemini 2.5 Flash (v1.0.0), Gemini 2.5 Pro (v1.1.0), Claude Haiku 4.5 (v1.2.0), Claude Haiku 4.5 (v1.3.0), Qwen 3 Coder 480B - Cerebras (v1.4.0), GLM-4.6 (v1.4.1), GLM-4.7 (v1.5.0)
|
|
12147
12150
|
*/
|
|
12148
12151
|
|
|
12152
|
+
const fs$5 = require$$0.promises;
|
|
12153
|
+
const path$3 = require$$1;
|
|
12154
|
+
const CodeBlockUtils$3 = CodeBlockUtils$7;
|
|
12155
|
+
const { preprocessJsonForValidation: preprocessJsonForValidation$3 } = jsonParser;
|
|
12156
|
+
|
|
12149
12157
|
/**
|
|
12150
12158
|
* Parses the 'Custom Metadata Definitions' block from the markdown content.
|
|
12151
12159
|
* Handles both formats:
|
|
@@ -12158,46 +12166,45 @@ var saver = {
|
|
|
12158
12166
|
function parseMetadataDefinitions(markdownContent) {
|
|
12159
12167
|
const definitions = new Map();
|
|
12160
12168
|
|
|
12161
|
-
// Match
|
|
12162
|
-
const
|
|
12163
|
-
|
|
12169
|
+
// Match both "### Fixed Metadata Definitions" and "### Custom Metadata Definitions" sections
|
|
12170
|
+
const sectionHeaders = ['### Fixed Metadata Definitions', '### Custom Metadata Definitions'];
|
|
12171
|
+
|
|
12172
|
+
for (const sectionHeader of sectionHeaders) {
|
|
12173
|
+
const sectionRegex = new RegExp(`${sectionHeader}\\s*([\\s\\S]*?)(?=\`\`\\|\\n##|\\n---)`);
|
|
12174
|
+
const match = markdownContent.match(sectionRegex);
|
|
12164
12175
|
|
|
12165
|
-
|
|
12166
|
-
|
|
12167
|
-
|
|
12176
|
+
if (!match || !match[1]) {
|
|
12177
|
+
continue;
|
|
12178
|
+
}
|
|
12168
12179
|
|
|
12169
|
-
|
|
12170
|
-
|
|
12171
|
-
|
|
12172
|
-
|
|
12173
|
-
|
|
12174
|
-
|
|
12175
|
-
|
|
12176
|
-
|
|
12177
|
-
|
|
12178
|
-
|
|
12179
|
-
|
|
12180
|
-
|
|
12181
|
-
|
|
12182
|
-
|
|
12183
|
-
|
|
12184
|
-
|
|
12185
|
-
|
|
12186
|
-
|
|
12187
|
-
|
|
12188
|
-
|
|
12189
|
-
|
|
12180
|
+
const definitionBlock = match[1];
|
|
12181
|
+
|
|
12182
|
+
// Regex to match both formats:
|
|
12183
|
+
// Format 1: * `fieldName` (type): description
|
|
12184
|
+
// Format 2: * fieldName (type): description
|
|
12185
|
+
// Capture groups:
|
|
12186
|
+
// Group 1: backtick-wrapped field name (if present)
|
|
12187
|
+
// Group 2: non-backtick field name (if present)
|
|
12188
|
+
// Group 3: field type
|
|
12189
|
+
// Group 4: description
|
|
12190
|
+
const lineRegex = /^\s*\*\s+(?:`([^`]+)`|([a-zA-Z0-9_-]+))\s+\(([^)]+)\):\s*(.+)/gm;
|
|
12191
|
+
|
|
12192
|
+
let lineMatch;
|
|
12193
|
+
while ((lineMatch = lineRegex.exec(definitionBlock)) !== null) {
|
|
12194
|
+
// Extract field name from either group 1 (backtick-wrapped) or group 2 (plain)
|
|
12195
|
+
const fieldName = (lineMatch[1] || lineMatch[2]).trim();
|
|
12196
|
+
const fieldType = lineMatch[3].trim();
|
|
12197
|
+
const description = lineMatch[4].trim();
|
|
12198
|
+
|
|
12199
|
+
if (fieldName && fieldType && description) {
|
|
12200
|
+
definitions.set(fieldName, { type: fieldType, description });
|
|
12201
|
+
}
|
|
12190
12202
|
}
|
|
12191
12203
|
}
|
|
12192
12204
|
|
|
12193
12205
|
return definitions;
|
|
12194
12206
|
}
|
|
12195
12207
|
|
|
12196
|
-
const fs$5 = require$$0.promises;
|
|
12197
|
-
const path$3 = require$$1;
|
|
12198
|
-
const CodeBlockUtils$3 = CodeBlockUtils$7;
|
|
12199
|
-
const { preprocessJsonForValidation: preprocessJsonForValidation$3 } = jsonParser;
|
|
12200
|
-
|
|
12201
12208
|
/**
|
|
12202
12209
|
* Maps a simple type string (from the definitions block) to a JSON schema type object.
|
|
12203
12210
|
* @param {string} simpleType - The type string (e.g., "number", "array of strings").
|
|
@@ -12346,6 +12353,7 @@ async function getAnalyzerSchema$2(analyzersBasePath, analyzerId) {
|
|
|
12346
12353
|
const schema = {
|
|
12347
12354
|
type: 'object',
|
|
12348
12355
|
description: rawJson.description,
|
|
12356
|
+
label: rawJson.label,
|
|
12349
12357
|
version: rawJson.version,
|
|
12350
12358
|
properties: {},
|
|
12351
12359
|
required: [],
|
|
@@ -24053,6 +24061,16 @@ let SVGUtils$1 = class SVGUtils {
|
|
|
24053
24061
|
return this.create(xml, params);
|
|
24054
24062
|
}
|
|
24055
24063
|
|
|
24064
|
+
/**
|
|
24065
|
+
* Generate commandPallete SVG icon
|
|
24066
|
+
* @param {Object} params - Configuration parameters
|
|
24067
|
+
* @returns {Element} SVG element
|
|
24068
|
+
*/
|
|
24069
|
+
static commandPallete(params) {
|
|
24070
|
+
const xml = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16"><path d="m6.354 8.04-4.773 4.773a.75.75 0 1 0 1.061 1.06L7.945 8.57a.75.75 0 0 0 0-1.06L2.642 2.206a.75.75 0 0 0-1.06 1.061L6.353 8.04ZM8.75 11.5a.75.75 0 0 0 0 1.5h5.5a.75.75 0 0 0 0-1.5h-5.5Z"></path></svg>`;
|
|
24071
|
+
return this.create(xml, params);
|
|
24072
|
+
}
|
|
24073
|
+
|
|
24056
24074
|
/**
|
|
24057
24075
|
* Generate comment SVG icon
|
|
24058
24076
|
* @param {Object} params - Configuration parameters
|
|
@@ -24962,6 +24980,16 @@ let SVGUtils$1 = class SVGUtils {
|
|
|
24962
24980
|
return this.create(xml, params);
|
|
24963
24981
|
}
|
|
24964
24982
|
|
|
24983
|
+
/**
|
|
24984
|
+
* Generate terminal SVG icon
|
|
24985
|
+
* @param {Object} params - Configuration parameters
|
|
24986
|
+
* @returns {Element} SVG element
|
|
24987
|
+
*/
|
|
24988
|
+
static terminal(params) {
|
|
24989
|
+
const xml = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16"><path d="M0 2.75C0 1.784.784 1 1.75 1h12.5c.966 0 1.75.784 1.75 1.75v10.5A1.75 1.75 0 0 1 14.25 15H1.75A1.75 1.75 0 0 1 0 13.25Zm1.75-.25a.25.25 0 0 0-.25.25v10.5c0 .138.112.25.25.25h12.5a.25.25 0 0 0 .25-.25V2.75a.25.25 0 0 0-.25-.25ZM7.25 8a.749.749 0 0 1-.22.53l-2.25 2.25a.749.749 0 0 1-1.275-.326.749.749 0 0 1 .215-.734L5.44 8 3.72 6.28a.749.749 0 0 1 .326-1.275.749.749 0 0 1 .734.215l2.25 2.25c.141.14.22.331.22.53Zm1.5 1.5h3a.75.75 0 0 1 0 1.5h-3a.75.75 0 0 1 0-1.5Z"></path></svg>`;
|
|
24990
|
+
return this.create(xml, params);
|
|
24991
|
+
}
|
|
24992
|
+
|
|
24965
24993
|
/**
|
|
24966
24994
|
* Generate toggle SVG icon
|
|
24967
24995
|
* @param {Object} params - Configuration parameters
|
package/dist/gsc-utils.esm.js
CHANGED
|
@@ -1424,7 +1424,10 @@ function parseOverviewMetadata$1(content) {
|
|
|
1424
1424
|
const lines = content.split('\n');
|
|
1425
1425
|
|
|
1426
1426
|
// Regex to capture "Field Name" and "Value" from lines like '* **Field Name: ** Value'
|
|
1427
|
-
const
|
|
1427
|
+
const fieldRegex1 = /^\*\s+\*\*([\w\s.-]+):\*\*\s+(.*)$/;
|
|
1428
|
+
const fieldRegex2 = /^\*\s+\*\*([\w\s.-]+)\*\*:\s+(.*)$/;
|
|
1429
|
+
const fieldRegex3 = /^.*?(Chat ID|Path).*:\s*(\d+)$/m;
|
|
1430
|
+
|
|
1428
1431
|
let foundList = false;
|
|
1429
1432
|
let currentKey = null; // For potential multi-line handling in the future
|
|
1430
1433
|
|
|
@@ -1440,7 +1443,7 @@ function parseOverviewMetadata$1(content) {
|
|
|
1440
1443
|
break;
|
|
1441
1444
|
}
|
|
1442
1445
|
|
|
1443
|
-
const match = trimmedLine.match(
|
|
1446
|
+
const match = trimmedLine.match(fieldRegex1) || trimmedLine.match(fieldRegex2) || trimmedLine.match(fieldRegex3);
|
|
1444
1447
|
|
|
1445
1448
|
if (match) {
|
|
1446
1449
|
foundList = true;
|
|
@@ -9968,7 +9971,7 @@ function fixTextCodeBlocks$2(text) {
|
|
|
9968
9971
|
if (validation["Block-UUID"] === "INVALID UUID") {
|
|
9969
9972
|
blockModified = true;
|
|
9970
9973
|
modified = true;
|
|
9971
|
-
return
|
|
9974
|
+
return ` ${fieldPart}: ${validation["Correct Block-UUID"]}`;
|
|
9972
9975
|
}
|
|
9973
9976
|
}
|
|
9974
9977
|
return line;
|
|
@@ -12135,15 +12138,20 @@ var saver = {
|
|
|
12135
12138
|
|
|
12136
12139
|
/**
|
|
12137
12140
|
* Component: AnalyzerUtils Schema Loader
|
|
12138
|
-
* Block-UUID:
|
|
12139
|
-
* Parent-UUID:
|
|
12140
|
-
* Version: 1.
|
|
12141
|
+
* Block-UUID: 20ac37ba-6ff7-462e-9e08-3204df118b03
|
|
12142
|
+
* Parent-UUID: bf25c501-f9e1-4e5b-ad22-9ed24ba50787
|
|
12143
|
+
* Version: 1.5.0
|
|
12141
12144
|
* Description: Provides utility functions for retrieving and deducing JSON schemas for analyzers.
|
|
12142
12145
|
* Language: JavaScript
|
|
12143
|
-
* Created-at:
|
|
12144
|
-
* Authors: Gemini 2.5 Flash (v1.0.0), Gemini 2.5 Pro (v1.1.0), Claude Haiku 4.5 (v1.2.0), Claude Haiku 4.5 (v1.3.0), Qwen 3 Coder 480B - Cerebras (v1.4.0), GLM-4.6 (v1.4.1)
|
|
12146
|
+
* Created-at: 2026-02-15T06:21:20.089Z
|
|
12147
|
+
* Authors: Gemini 2.5 Flash (v1.0.0), Gemini 2.5 Pro (v1.1.0), Claude Haiku 4.5 (v1.2.0), Claude Haiku 4.5 (v1.3.0), Qwen 3 Coder 480B - Cerebras (v1.4.0), GLM-4.6 (v1.4.1), GLM-4.7 (v1.5.0)
|
|
12145
12148
|
*/
|
|
12146
12149
|
|
|
12150
|
+
const fs$5 = require$$0.promises;
|
|
12151
|
+
const path$3 = require$$1;
|
|
12152
|
+
const CodeBlockUtils$3 = CodeBlockUtils$7;
|
|
12153
|
+
const { preprocessJsonForValidation: preprocessJsonForValidation$3 } = jsonParser;
|
|
12154
|
+
|
|
12147
12155
|
/**
|
|
12148
12156
|
* Parses the 'Custom Metadata Definitions' block from the markdown content.
|
|
12149
12157
|
* Handles both formats:
|
|
@@ -12156,46 +12164,45 @@ var saver = {
|
|
|
12156
12164
|
function parseMetadataDefinitions(markdownContent) {
|
|
12157
12165
|
const definitions = new Map();
|
|
12158
12166
|
|
|
12159
|
-
// Match
|
|
12160
|
-
const
|
|
12161
|
-
|
|
12167
|
+
// Match both "### Fixed Metadata Definitions" and "### Custom Metadata Definitions" sections
|
|
12168
|
+
const sectionHeaders = ['### Fixed Metadata Definitions', '### Custom Metadata Definitions'];
|
|
12169
|
+
|
|
12170
|
+
for (const sectionHeader of sectionHeaders) {
|
|
12171
|
+
const sectionRegex = new RegExp(`${sectionHeader}\\s*([\\s\\S]*?)(?=\`\`\\|\\n##|\\n---)`);
|
|
12172
|
+
const match = markdownContent.match(sectionRegex);
|
|
12162
12173
|
|
|
12163
|
-
|
|
12164
|
-
|
|
12165
|
-
|
|
12174
|
+
if (!match || !match[1]) {
|
|
12175
|
+
continue;
|
|
12176
|
+
}
|
|
12166
12177
|
|
|
12167
|
-
|
|
12168
|
-
|
|
12169
|
-
|
|
12170
|
-
|
|
12171
|
-
|
|
12172
|
-
|
|
12173
|
-
|
|
12174
|
-
|
|
12175
|
-
|
|
12176
|
-
|
|
12177
|
-
|
|
12178
|
-
|
|
12179
|
-
|
|
12180
|
-
|
|
12181
|
-
|
|
12182
|
-
|
|
12183
|
-
|
|
12184
|
-
|
|
12185
|
-
|
|
12186
|
-
|
|
12187
|
-
|
|
12178
|
+
const definitionBlock = match[1];
|
|
12179
|
+
|
|
12180
|
+
// Regex to match both formats:
|
|
12181
|
+
// Format 1: * `fieldName` (type): description
|
|
12182
|
+
// Format 2: * fieldName (type): description
|
|
12183
|
+
// Capture groups:
|
|
12184
|
+
// Group 1: backtick-wrapped field name (if present)
|
|
12185
|
+
// Group 2: non-backtick field name (if present)
|
|
12186
|
+
// Group 3: field type
|
|
12187
|
+
// Group 4: description
|
|
12188
|
+
const lineRegex = /^\s*\*\s+(?:`([^`]+)`|([a-zA-Z0-9_-]+))\s+\(([^)]+)\):\s*(.+)/gm;
|
|
12189
|
+
|
|
12190
|
+
let lineMatch;
|
|
12191
|
+
while ((lineMatch = lineRegex.exec(definitionBlock)) !== null) {
|
|
12192
|
+
// Extract field name from either group 1 (backtick-wrapped) or group 2 (plain)
|
|
12193
|
+
const fieldName = (lineMatch[1] || lineMatch[2]).trim();
|
|
12194
|
+
const fieldType = lineMatch[3].trim();
|
|
12195
|
+
const description = lineMatch[4].trim();
|
|
12196
|
+
|
|
12197
|
+
if (fieldName && fieldType && description) {
|
|
12198
|
+
definitions.set(fieldName, { type: fieldType, description });
|
|
12199
|
+
}
|
|
12188
12200
|
}
|
|
12189
12201
|
}
|
|
12190
12202
|
|
|
12191
12203
|
return definitions;
|
|
12192
12204
|
}
|
|
12193
12205
|
|
|
12194
|
-
const fs$5 = require$$0.promises;
|
|
12195
|
-
const path$3 = require$$1;
|
|
12196
|
-
const CodeBlockUtils$3 = CodeBlockUtils$7;
|
|
12197
|
-
const { preprocessJsonForValidation: preprocessJsonForValidation$3 } = jsonParser;
|
|
12198
|
-
|
|
12199
12206
|
/**
|
|
12200
12207
|
* Maps a simple type string (from the definitions block) to a JSON schema type object.
|
|
12201
12208
|
* @param {string} simpleType - The type string (e.g., "number", "array of strings").
|
|
@@ -12344,6 +12351,7 @@ async function getAnalyzerSchema$2(analyzersBasePath, analyzerId) {
|
|
|
12344
12351
|
const schema = {
|
|
12345
12352
|
type: 'object',
|
|
12346
12353
|
description: rawJson.description,
|
|
12354
|
+
label: rawJson.label,
|
|
12347
12355
|
version: rawJson.version,
|
|
12348
12356
|
properties: {},
|
|
12349
12357
|
required: [],
|
|
@@ -24051,6 +24059,16 @@ let SVGUtils$1 = class SVGUtils {
|
|
|
24051
24059
|
return this.create(xml, params);
|
|
24052
24060
|
}
|
|
24053
24061
|
|
|
24062
|
+
/**
|
|
24063
|
+
* Generate commandPallete SVG icon
|
|
24064
|
+
* @param {Object} params - Configuration parameters
|
|
24065
|
+
* @returns {Element} SVG element
|
|
24066
|
+
*/
|
|
24067
|
+
static commandPallete(params) {
|
|
24068
|
+
const xml = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16"><path d="m6.354 8.04-4.773 4.773a.75.75 0 1 0 1.061 1.06L7.945 8.57a.75.75 0 0 0 0-1.06L2.642 2.206a.75.75 0 0 0-1.06 1.061L6.353 8.04ZM8.75 11.5a.75.75 0 0 0 0 1.5h5.5a.75.75 0 0 0 0-1.5h-5.5Z"></path></svg>`;
|
|
24069
|
+
return this.create(xml, params);
|
|
24070
|
+
}
|
|
24071
|
+
|
|
24054
24072
|
/**
|
|
24055
24073
|
* Generate comment SVG icon
|
|
24056
24074
|
* @param {Object} params - Configuration parameters
|
|
@@ -24960,6 +24978,16 @@ let SVGUtils$1 = class SVGUtils {
|
|
|
24960
24978
|
return this.create(xml, params);
|
|
24961
24979
|
}
|
|
24962
24980
|
|
|
24981
|
+
/**
|
|
24982
|
+
* Generate terminal SVG icon
|
|
24983
|
+
* @param {Object} params - Configuration parameters
|
|
24984
|
+
* @returns {Element} SVG element
|
|
24985
|
+
*/
|
|
24986
|
+
static terminal(params) {
|
|
24987
|
+
const xml = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16"><path d="M0 2.75C0 1.784.784 1 1.75 1h12.5c.966 0 1.75.784 1.75 1.75v10.5A1.75 1.75 0 0 1 14.25 15H1.75A1.75 1.75 0 0 1 0 13.25Zm1.75-.25a.25.25 0 0 0-.25.25v10.5c0 .138.112.25.25.25h12.5a.25.25 0 0 0 .25-.25V2.75a.25.25 0 0 0-.25-.25ZM7.25 8a.749.749 0 0 1-.22.53l-2.25 2.25a.749.749 0 0 1-1.275-.326.749.749 0 0 1 .215-.734L5.44 8 3.72 6.28a.749.749 0 0 1 .326-1.275.749.749 0 0 1 .734.215l2.25 2.25c.141.14.22.331.22.53Zm1.5 1.5h3a.75.75 0 0 1 0 1.5h-3a.75.75 0 0 1 0-1.5Z"></path></svg>`;
|
|
24988
|
+
return this.create(xml, params);
|
|
24989
|
+
}
|
|
24990
|
+
|
|
24963
24991
|
/**
|
|
24964
24992
|
* Generate toggle SVG icon
|
|
24965
24993
|
* @param {Object} params - Configuration parameters
|
package/package.json
CHANGED
|
@@ -60,7 +60,10 @@ function parseOverviewMetadata(content) {
|
|
|
60
60
|
const lines = content.split('\n');
|
|
61
61
|
|
|
62
62
|
// Regex to capture "Field Name" and "Value" from lines like '* **Field Name: ** Value'
|
|
63
|
-
const
|
|
63
|
+
const fieldRegex1 = /^\*\s+\*\*([\w\s.-]+):\*\*\s+(.*)$/;
|
|
64
|
+
const fieldRegex2 = /^\*\s+\*\*([\w\s.-]+)\*\*:\s+(.*)$/;
|
|
65
|
+
const fieldRegex3 = /^.*?(Chat ID|Path).*:\s*(\d+)$/m;
|
|
66
|
+
|
|
64
67
|
let foundList = false;
|
|
65
68
|
let currentKey = null; // For potential multi-line handling in the future
|
|
66
69
|
|
|
@@ -76,7 +79,7 @@ function parseOverviewMetadata(content) {
|
|
|
76
79
|
break;
|
|
77
80
|
}
|
|
78
81
|
|
|
79
|
-
const match = trimmedLine.match(
|
|
82
|
+
const match = trimmedLine.match(fieldRegex1) || trimmedLine.match(fieldRegex2) || trimmedLine.match(fieldRegex3)
|
|
80
83
|
|
|
81
84
|
if (match) {
|
|
82
85
|
foundList = true;
|
|
@@ -1,15 +1,20 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Component: AnalyzerUtils Schema Loader
|
|
3
|
-
* Block-UUID:
|
|
4
|
-
* Parent-UUID:
|
|
5
|
-
* Version: 1.
|
|
3
|
+
* Block-UUID: 20ac37ba-6ff7-462e-9e08-3204df118b03
|
|
4
|
+
* Parent-UUID: bf25c501-f9e1-4e5b-ad22-9ed24ba50787
|
|
5
|
+
* Version: 1.5.0
|
|
6
6
|
* Description: Provides utility functions for retrieving and deducing JSON schemas for analyzers.
|
|
7
7
|
* Language: JavaScript
|
|
8
|
-
* Created-at:
|
|
9
|
-
* Authors: Gemini 2.5 Flash (v1.0.0), Gemini 2.5 Pro (v1.1.0), Claude Haiku 4.5 (v1.2.0), Claude Haiku 4.5 (v1.3.0), Qwen 3 Coder 480B - Cerebras (v1.4.0), GLM-4.6 (v1.4.1)
|
|
8
|
+
* Created-at: 2026-02-15T06:21:20.089Z
|
|
9
|
+
* Authors: Gemini 2.5 Flash (v1.0.0), Gemini 2.5 Pro (v1.1.0), Claude Haiku 4.5 (v1.2.0), Claude Haiku 4.5 (v1.3.0), Qwen 3 Coder 480B - Cerebras (v1.4.0), GLM-4.6 (v1.4.1), GLM-4.7 (v1.5.0)
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
12
|
|
|
13
|
+
const fs = require('fs').promises;
|
|
14
|
+
const path = require('path');
|
|
15
|
+
const CodeBlockUtils = require('../CodeBlockUtils');
|
|
16
|
+
const { preprocessJsonForValidation } = require('./jsonParser');
|
|
17
|
+
|
|
13
18
|
/**
|
|
14
19
|
* Parses the 'Custom Metadata Definitions' block from the markdown content.
|
|
15
20
|
* Handles both formats:
|
|
@@ -22,46 +27,45 @@
|
|
|
22
27
|
function parseMetadataDefinitions(markdownContent) {
|
|
23
28
|
const definitions = new Map();
|
|
24
29
|
|
|
25
|
-
// Match
|
|
26
|
-
const
|
|
27
|
-
|
|
30
|
+
// Match both "### Fixed Metadata Definitions" and "### Custom Metadata Definitions" sections
|
|
31
|
+
const sectionHeaders = ['### Fixed Metadata Definitions', '### Custom Metadata Definitions'];
|
|
32
|
+
|
|
33
|
+
for (const sectionHeader of sectionHeaders) {
|
|
34
|
+
const sectionRegex = new RegExp(`${sectionHeader}\\s*([\\s\\S]*?)(?=\`\`\\|\\n##|\\n---)`);
|
|
35
|
+
const match = markdownContent.match(sectionRegex);
|
|
28
36
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
37
|
+
if (!match || !match[1]) {
|
|
38
|
+
continue;
|
|
39
|
+
}
|
|
32
40
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
41
|
+
const definitionBlock = match[1];
|
|
42
|
+
|
|
43
|
+
// Regex to match both formats:
|
|
44
|
+
// Format 1: * `fieldName` (type): description
|
|
45
|
+
// Format 2: * fieldName (type): description
|
|
46
|
+
// Capture groups:
|
|
47
|
+
// Group 1: backtick-wrapped field name (if present)
|
|
48
|
+
// Group 2: non-backtick field name (if present)
|
|
49
|
+
// Group 3: field type
|
|
50
|
+
// Group 4: description
|
|
51
|
+
const lineRegex = /^\s*\*\s+(?:`([^`]+)`|([a-zA-Z0-9_-]+))\s+\(([^)]+)\):\s*(.+)/gm;
|
|
52
|
+
|
|
53
|
+
let lineMatch;
|
|
54
|
+
while ((lineMatch = lineRegex.exec(definitionBlock)) !== null) {
|
|
55
|
+
// Extract field name from either group 1 (backtick-wrapped) or group 2 (plain)
|
|
56
|
+
const fieldName = (lineMatch[1] || lineMatch[2]).trim();
|
|
57
|
+
const fieldType = lineMatch[3].trim();
|
|
58
|
+
const description = lineMatch[4].trim();
|
|
59
|
+
|
|
60
|
+
if (fieldName && fieldType && description) {
|
|
61
|
+
definitions.set(fieldName, { type: fieldType, description });
|
|
62
|
+
}
|
|
54
63
|
}
|
|
55
64
|
}
|
|
56
65
|
|
|
57
66
|
return definitions;
|
|
58
67
|
}
|
|
59
68
|
|
|
60
|
-
const fs = require('fs').promises;
|
|
61
|
-
const path = require('path');
|
|
62
|
-
const CodeBlockUtils = require('../CodeBlockUtils');
|
|
63
|
-
const { preprocessJsonForValidation } = require('./jsonParser');
|
|
64
|
-
|
|
65
69
|
/**
|
|
66
70
|
* Maps a simple type string (from the definitions block) to a JSON schema type object.
|
|
67
71
|
* @param {string} simpleType - The type string (e.g., "number", "array of strings").
|
|
@@ -210,6 +214,7 @@ async function getAnalyzerSchema(analyzersBasePath, analyzerId) {
|
|
|
210
214
|
const schema = {
|
|
211
215
|
type: 'object',
|
|
212
216
|
description: rawJson.description,
|
|
217
|
+
label: rawJson.label,
|
|
213
218
|
version: rawJson.version,
|
|
214
219
|
properties: {},
|
|
215
220
|
required: [],
|
|
@@ -511,7 +511,7 @@ function fixTextCodeBlocks(text) {
|
|
|
511
511
|
if (validation["Block-UUID"] === "INVALID UUID") {
|
|
512
512
|
blockModified = true;
|
|
513
513
|
modified = true;
|
|
514
|
-
return
|
|
514
|
+
return ` ${fieldPart}: ${validation["Correct Block-UUID"]}`;
|
|
515
515
|
}
|
|
516
516
|
}
|
|
517
517
|
return line;
|
package/src/SVGUtils.js
CHANGED
|
@@ -377,6 +377,16 @@ class SVGUtils {
|
|
|
377
377
|
return this.create(xml, params);
|
|
378
378
|
}
|
|
379
379
|
|
|
380
|
+
/**
|
|
381
|
+
* Generate commandPallete SVG icon
|
|
382
|
+
* @param {Object} params - Configuration parameters
|
|
383
|
+
* @returns {Element} SVG element
|
|
384
|
+
*/
|
|
385
|
+
static commandPallete(params) {
|
|
386
|
+
const xml = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16"><path d="m6.354 8.04-4.773 4.773a.75.75 0 1 0 1.061 1.06L7.945 8.57a.75.75 0 0 0 0-1.06L2.642 2.206a.75.75 0 0 0-1.06 1.061L6.353 8.04ZM8.75 11.5a.75.75 0 0 0 0 1.5h5.5a.75.75 0 0 0 0-1.5h-5.5Z"></path></svg>`;
|
|
387
|
+
return this.create(xml, params);
|
|
388
|
+
}
|
|
389
|
+
|
|
380
390
|
/**
|
|
381
391
|
* Generate comment SVG icon
|
|
382
392
|
* @param {Object} params - Configuration parameters
|
|
@@ -1286,6 +1296,16 @@ class SVGUtils {
|
|
|
1286
1296
|
return this.create(xml, params);
|
|
1287
1297
|
}
|
|
1288
1298
|
|
|
1299
|
+
/**
|
|
1300
|
+
* Generate terminal SVG icon
|
|
1301
|
+
* @param {Object} params - Configuration parameters
|
|
1302
|
+
* @returns {Element} SVG element
|
|
1303
|
+
*/
|
|
1304
|
+
static terminal(params) {
|
|
1305
|
+
const xml = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16"><path d="M0 2.75C0 1.784.784 1 1.75 1h12.5c.966 0 1.75.784 1.75 1.75v10.5A1.75 1.75 0 0 1 14.25 15H1.75A1.75 1.75 0 0 1 0 13.25Zm1.75-.25a.25.25 0 0 0-.25.25v10.5c0 .138.112.25.25.25h12.5a.25.25 0 0 0 .25-.25V2.75a.25.25 0 0 0-.25-.25ZM7.25 8a.749.749 0 0 1-.22.53l-2.25 2.25a.749.749 0 0 1-1.275-.326.749.749 0 0 1 .215-.734L5.44 8 3.72 6.28a.749.749 0 0 1 .326-1.275.749.749 0 0 1 .734.215l2.25 2.25c.141.14.22.331.22.53Zm1.5 1.5h3a.75.75 0 0 1 0 1.5h-3a.75.75 0 0 1 0-1.5Z"></path></svg>`;
|
|
1306
|
+
return this.create(xml, params);
|
|
1307
|
+
}
|
|
1308
|
+
|
|
1289
1309
|
/**
|
|
1290
1310
|
* Generate toggle SVG icon
|
|
1291
1311
|
* @param {Object} params - Configuration parameters
|