@probelabs/probe 0.6.0-rc64 → 0.6.0-rc66
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/build/agent/index.js +39 -1
- package/build/agent/schemaUtils.js +36 -2
- package/build/tools/system-message.js +14 -1
- package/cjs/agent/ProbeAgent.cjs +39 -1
- package/cjs/index.cjs +39 -1
- package/package.json +4 -2
- package/scripts/postinstall.js +13 -3
- package/src/agent/schemaUtils.js +36 -2
- package/src/tools/system-message.js +14 -1
package/build/agent/index.js
CHANGED
|
@@ -1843,7 +1843,20 @@ You are Probe, a specialized code intelligence assistant. Your objective is to a
|
|
|
1843
1843
|
* Probe Action 2: \`search\` query: \`import AND "pkg/errors"\`, path: \`"service/"\` (Check where a potential custom error package is used)
|
|
1844
1844
|
* (Analysis: Confirms \`pkg/errors\` is widely used.)
|
|
1845
1845
|
* Probe Action 3: \`query\` language: \`go\`, pattern: \`errors.Wrap($$$)\`, path: \`"service/"\` (Find structural usage of the custom wrapper)
|
|
1846
|
-
* (Response: Summarize error handling: Mention standard \`fmt.Errorf\` and the prevalent use of a custom \`errors.Wrap\` function from \`pkg/errors\`, providing examples from locations found by search/query like \`service/user/handler.go\`.)
|
|
1846
|
+
* (Response: Summarize error handling: Mention standard \`fmt.Errorf\` and the prevalent use of a custom \`errors.Wrap\` function from \`pkg/errors\`, providing examples from locations found by search/query like \`service/user/handler.go\`.)
|
|
1847
|
+
|
|
1848
|
+
<mermaid-instructions>
|
|
1849
|
+
For GitHub-compatible mermaid diagrams, avoid single quotes and parentheses in node labels:
|
|
1850
|
+
|
|
1851
|
+
**Rules:**
|
|
1852
|
+
- NO single quotes in any node labels: 'text' \u2192 "text" or text
|
|
1853
|
+
- NO parentheses in square brackets: [Text (detail)] \u2192 [Text - detail]
|
|
1854
|
+
- NO complex expressions in diamonds: {a && b} \u2192 {condition}
|
|
1855
|
+
|
|
1856
|
+
**Examples:**
|
|
1857
|
+
- \u2705 [Load Config] ["Run command"] {Valid?}
|
|
1858
|
+
- \u274C [Load (config)] [Run 'command'] {isValid('x')}
|
|
1859
|
+
</mermaid-instructions>`;
|
|
1847
1860
|
}
|
|
1848
1861
|
});
|
|
1849
1862
|
|
|
@@ -2440,6 +2453,31 @@ async function validateMermaidDiagram(diagram) {
|
|
|
2440
2453
|
detailedError: `Line "${line}" contains an unclosed bracket`
|
|
2441
2454
|
};
|
|
2442
2455
|
}
|
|
2456
|
+
const nodeWithParens = line.match(/\[[^"\[\]]*\([^"\[\]]*\]/);
|
|
2457
|
+
if (nodeWithParens) {
|
|
2458
|
+
return {
|
|
2459
|
+
isValid: false,
|
|
2460
|
+
error: `Parentheses in node label on line ${i + 1} (GitHub incompatible)`,
|
|
2461
|
+
detailedError: `Line "${line}" contains parentheses inside node label brackets. GitHub mermaid renderer fails with 'got PS' error. Use quotes or escape characters instead.`
|
|
2462
|
+
};
|
|
2463
|
+
}
|
|
2464
|
+
const nodeWithQuotes = line.match(/\{[^{}]*'[^{}]*\}|\[[^[\]]*'[^[\]]*\]/);
|
|
2465
|
+
if (nodeWithQuotes) {
|
|
2466
|
+
return {
|
|
2467
|
+
isValid: false,
|
|
2468
|
+
error: `Single quotes in node label on line ${i + 1} (GitHub incompatible)`,
|
|
2469
|
+
detailedError: `Line "${line}" contains single quotes inside node label. GitHub mermaid renderer fails with 'got PS' error. Use double quotes or escape characters instead.`
|
|
2470
|
+
};
|
|
2471
|
+
}
|
|
2472
|
+
const diamondWithComplexContent = line.match(/\{[^"{}]*[()'"<>&][^"{}]*\}/);
|
|
2473
|
+
const hasHtmlBreak = line.match(/\{[^{}]*<br\s*\/?>.*\}/);
|
|
2474
|
+
if (diamondWithComplexContent && !line.match(/\{\"[^\"]*\"\}/) && !hasHtmlBreak) {
|
|
2475
|
+
return {
|
|
2476
|
+
isValid: false,
|
|
2477
|
+
error: `Complex expression in diamond node on line ${i + 1} (GitHub incompatible)`,
|
|
2478
|
+
detailedError: `Line "${line}" contains special characters in diamond node that may cause GitHub parsing errors. Use simpler text or escape characters.`
|
|
2479
|
+
};
|
|
2480
|
+
}
|
|
2443
2481
|
}
|
|
2444
2482
|
if (diagramType === "sequence") {
|
|
2445
2483
|
if (line.includes("->>") && !line.includes(":")) {
|
|
@@ -327,14 +327,14 @@ export async function validateMermaidDiagram(diagram) {
|
|
|
327
327
|
};
|
|
328
328
|
}
|
|
329
329
|
|
|
330
|
-
//
|
|
330
|
+
// GitHub-compatible strict syntax validation
|
|
331
331
|
const lines = trimmedDiagram.split('\n');
|
|
332
332
|
|
|
333
333
|
for (let i = 0; i < lines.length; i++) {
|
|
334
334
|
const line = lines[i].trim();
|
|
335
335
|
if (!line) continue;
|
|
336
336
|
|
|
337
|
-
// Check for
|
|
337
|
+
// Check for GitHub-incompatible patterns that cause "got 'PS'" errors
|
|
338
338
|
if (diagramType === 'flowchart') {
|
|
339
339
|
// Check for unbalanced brackets in node labels
|
|
340
340
|
const brackets = line.match(/\[[^\]]*$/); // Unclosed bracket
|
|
@@ -345,6 +345,40 @@ export async function validateMermaidDiagram(diagram) {
|
|
|
345
345
|
detailedError: `Line "${line}" contains an unclosed bracket`
|
|
346
346
|
};
|
|
347
347
|
}
|
|
348
|
+
|
|
349
|
+
// GitHub-strict: Check for parentheses inside node labels (causes PS token error)
|
|
350
|
+
// But allow parentheses inside double-quoted strings
|
|
351
|
+
const nodeWithParens = line.match(/\[[^"\[\]]*\([^"\[\]]*\]/);
|
|
352
|
+
if (nodeWithParens) {
|
|
353
|
+
return {
|
|
354
|
+
isValid: false,
|
|
355
|
+
error: `Parentheses in node label on line ${i + 1} (GitHub incompatible)`,
|
|
356
|
+
detailedError: `Line "${line}" contains parentheses inside node label brackets. GitHub mermaid renderer fails with 'got PS' error. Use quotes or escape characters instead.`
|
|
357
|
+
};
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
// GitHub-strict: Check for single quotes inside node labels (causes PS token error)
|
|
361
|
+
const nodeWithQuotes = line.match(/\{[^{}]*'[^{}]*\}|\[[^[\]]*'[^[\]]*\]/);
|
|
362
|
+
if (nodeWithQuotes) {
|
|
363
|
+
return {
|
|
364
|
+
isValid: false,
|
|
365
|
+
error: `Single quotes in node label on line ${i + 1} (GitHub incompatible)`,
|
|
366
|
+
detailedError: `Line "${line}" contains single quotes inside node label. GitHub mermaid renderer fails with 'got PS' error. Use double quotes or escape characters instead.`
|
|
367
|
+
};
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
// GitHub-strict: Check for complex expressions inside diamond nodes
|
|
371
|
+
// Allow double-quoted strings in diamond nodes, but catch problematic single quotes and complex expressions
|
|
372
|
+
// Allow HTML breaks (<br/>, <br>, etc.) but catch other problematic patterns
|
|
373
|
+
const diamondWithComplexContent = line.match(/\{[^"{}]*[()'"<>&][^"{}]*\}/);
|
|
374
|
+
const hasHtmlBreak = line.match(/\{[^{}]*<br\s*\/?>.*\}/);
|
|
375
|
+
if (diamondWithComplexContent && !line.match(/\{\"[^\"]*\"\}/) && !hasHtmlBreak) {
|
|
376
|
+
return {
|
|
377
|
+
isValid: false,
|
|
378
|
+
error: `Complex expression in diamond node on line ${i + 1} (GitHub incompatible)`,
|
|
379
|
+
detailedError: `Line "${line}" contains special characters in diamond node that may cause GitHub parsing errors. Use simpler text or escape characters.`
|
|
380
|
+
};
|
|
381
|
+
}
|
|
348
382
|
}
|
|
349
383
|
|
|
350
384
|
if (diagramType === 'sequence') {
|
|
@@ -66,4 +66,17 @@ You are Probe, a specialized code intelligence assistant. Your objective is to a
|
|
|
66
66
|
* Probe Action 2: \`search\` query: \`import AND "pkg/errors"\`, path: \`"service/"\` (Check where a potential custom error package is used)
|
|
67
67
|
* (Analysis: Confirms \`pkg/errors\` is widely used.)
|
|
68
68
|
* Probe Action 3: \`query\` language: \`go\`, pattern: \`errors.Wrap($$$)\`, path: \`"service/"\` (Find structural usage of the custom wrapper)
|
|
69
|
-
* (Response: Summarize error handling: Mention standard \`fmt.Errorf\` and the prevalent use of a custom \`errors.Wrap\` function from \`pkg/errors\`, providing examples from locations found by search/query like \`service/user/handler.go\`.)
|
|
69
|
+
* (Response: Summarize error handling: Mention standard \`fmt.Errorf\` and the prevalent use of a custom \`errors.Wrap\` function from \`pkg/errors\`, providing examples from locations found by search/query like \`service/user/handler.go\`.)
|
|
70
|
+
|
|
71
|
+
<mermaid-instructions>
|
|
72
|
+
For GitHub-compatible mermaid diagrams, avoid single quotes and parentheses in node labels:
|
|
73
|
+
|
|
74
|
+
**Rules:**
|
|
75
|
+
- NO single quotes in any node labels: 'text' → "text" or text
|
|
76
|
+
- NO parentheses in square brackets: [Text (detail)] → [Text - detail]
|
|
77
|
+
- NO complex expressions in diamonds: {a && b} → {condition}
|
|
78
|
+
|
|
79
|
+
**Examples:**
|
|
80
|
+
- ✅ [Load Config] ["Run command"] {Valid?}
|
|
81
|
+
- ❌ [Load (config)] [Run 'command'] {isValid('x')}
|
|
82
|
+
</mermaid-instructions>`
|
package/cjs/agent/ProbeAgent.cjs
CHANGED
|
@@ -1864,7 +1864,20 @@ You are Probe, a specialized code intelligence assistant. Your objective is to a
|
|
|
1864
1864
|
* Probe Action 2: \`search\` query: \`import AND "pkg/errors"\`, path: \`"service/"\` (Check where a potential custom error package is used)
|
|
1865
1865
|
* (Analysis: Confirms \`pkg/errors\` is widely used.)
|
|
1866
1866
|
* Probe Action 3: \`query\` language: \`go\`, pattern: \`errors.Wrap($$$)\`, path: \`"service/"\` (Find structural usage of the custom wrapper)
|
|
1867
|
-
* (Response: Summarize error handling: Mention standard \`fmt.Errorf\` and the prevalent use of a custom \`errors.Wrap\` function from \`pkg/errors\`, providing examples from locations found by search/query like \`service/user/handler.go\`.)
|
|
1867
|
+
* (Response: Summarize error handling: Mention standard \`fmt.Errorf\` and the prevalent use of a custom \`errors.Wrap\` function from \`pkg/errors\`, providing examples from locations found by search/query like \`service/user/handler.go\`.)
|
|
1868
|
+
|
|
1869
|
+
<mermaid-instructions>
|
|
1870
|
+
For GitHub-compatible mermaid diagrams, avoid single quotes and parentheses in node labels:
|
|
1871
|
+
|
|
1872
|
+
**Rules:**
|
|
1873
|
+
- NO single quotes in any node labels: 'text' \u2192 "text" or text
|
|
1874
|
+
- NO parentheses in square brackets: [Text (detail)] \u2192 [Text - detail]
|
|
1875
|
+
- NO complex expressions in diamonds: {a && b} \u2192 {condition}
|
|
1876
|
+
|
|
1877
|
+
**Examples:**
|
|
1878
|
+
- \u2705 [Load Config] ["Run command"] {Valid?}
|
|
1879
|
+
- \u274C [Load (config)] [Run 'command'] {isValid('x')}
|
|
1880
|
+
</mermaid-instructions>`;
|
|
1868
1881
|
}
|
|
1869
1882
|
});
|
|
1870
1883
|
|
|
@@ -2427,6 +2440,31 @@ async function validateMermaidDiagram(diagram) {
|
|
|
2427
2440
|
detailedError: `Line "${line}" contains an unclosed bracket`
|
|
2428
2441
|
};
|
|
2429
2442
|
}
|
|
2443
|
+
const nodeWithParens = line.match(/\[[^"\[\]]*\([^"\[\]]*\]/);
|
|
2444
|
+
if (nodeWithParens) {
|
|
2445
|
+
return {
|
|
2446
|
+
isValid: false,
|
|
2447
|
+
error: `Parentheses in node label on line ${i + 1} (GitHub incompatible)`,
|
|
2448
|
+
detailedError: `Line "${line}" contains parentheses inside node label brackets. GitHub mermaid renderer fails with 'got PS' error. Use quotes or escape characters instead.`
|
|
2449
|
+
};
|
|
2450
|
+
}
|
|
2451
|
+
const nodeWithQuotes = line.match(/\{[^{}]*'[^{}]*\}|\[[^[\]]*'[^[\]]*\]/);
|
|
2452
|
+
if (nodeWithQuotes) {
|
|
2453
|
+
return {
|
|
2454
|
+
isValid: false,
|
|
2455
|
+
error: `Single quotes in node label on line ${i + 1} (GitHub incompatible)`,
|
|
2456
|
+
detailedError: `Line "${line}" contains single quotes inside node label. GitHub mermaid renderer fails with 'got PS' error. Use double quotes or escape characters instead.`
|
|
2457
|
+
};
|
|
2458
|
+
}
|
|
2459
|
+
const diamondWithComplexContent = line.match(/\{[^"{}]*[()'"<>&][^"{}]*\}/);
|
|
2460
|
+
const hasHtmlBreak = line.match(/\{[^{}]*<br\s*\/?>.*\}/);
|
|
2461
|
+
if (diamondWithComplexContent && !line.match(/\{\"[^\"]*\"\}/) && !hasHtmlBreak) {
|
|
2462
|
+
return {
|
|
2463
|
+
isValid: false,
|
|
2464
|
+
error: `Complex expression in diamond node on line ${i + 1} (GitHub incompatible)`,
|
|
2465
|
+
detailedError: `Line "${line}" contains special characters in diamond node that may cause GitHub parsing errors. Use simpler text or escape characters.`
|
|
2466
|
+
};
|
|
2467
|
+
}
|
|
2430
2468
|
}
|
|
2431
2469
|
if (diagramType === "sequence") {
|
|
2432
2470
|
if (line.includes("->>") && !line.includes(":")) {
|
package/cjs/index.cjs
CHANGED
|
@@ -1633,7 +1633,20 @@ You are Probe, a specialized code intelligence assistant. Your objective is to a
|
|
|
1633
1633
|
* Probe Action 2: \`search\` query: \`import AND "pkg/errors"\`, path: \`"service/"\` (Check where a potential custom error package is used)
|
|
1634
1634
|
* (Analysis: Confirms \`pkg/errors\` is widely used.)
|
|
1635
1635
|
* Probe Action 3: \`query\` language: \`go\`, pattern: \`errors.Wrap($$$)\`, path: \`"service/"\` (Find structural usage of the custom wrapper)
|
|
1636
|
-
* (Response: Summarize error handling: Mention standard \`fmt.Errorf\` and the prevalent use of a custom \`errors.Wrap\` function from \`pkg/errors\`, providing examples from locations found by search/query like \`service/user/handler.go\`.)
|
|
1636
|
+
* (Response: Summarize error handling: Mention standard \`fmt.Errorf\` and the prevalent use of a custom \`errors.Wrap\` function from \`pkg/errors\`, providing examples from locations found by search/query like \`service/user/handler.go\`.)
|
|
1637
|
+
|
|
1638
|
+
<mermaid-instructions>
|
|
1639
|
+
For GitHub-compatible mermaid diagrams, avoid single quotes and parentheses in node labels:
|
|
1640
|
+
|
|
1641
|
+
**Rules:**
|
|
1642
|
+
- NO single quotes in any node labels: 'text' \u2192 "text" or text
|
|
1643
|
+
- NO parentheses in square brackets: [Text (detail)] \u2192 [Text - detail]
|
|
1644
|
+
- NO complex expressions in diamonds: {a && b} \u2192 {condition}
|
|
1645
|
+
|
|
1646
|
+
**Examples:**
|
|
1647
|
+
- \u2705 [Load Config] ["Run command"] {Valid?}
|
|
1648
|
+
- \u274C [Load (config)] [Run 'command'] {isValid('x')}
|
|
1649
|
+
</mermaid-instructions>`;
|
|
1637
1650
|
}
|
|
1638
1651
|
});
|
|
1639
1652
|
|
|
@@ -2501,6 +2514,31 @@ async function validateMermaidDiagram(diagram) {
|
|
|
2501
2514
|
detailedError: `Line "${line}" contains an unclosed bracket`
|
|
2502
2515
|
};
|
|
2503
2516
|
}
|
|
2517
|
+
const nodeWithParens = line.match(/\[[^"\[\]]*\([^"\[\]]*\]/);
|
|
2518
|
+
if (nodeWithParens) {
|
|
2519
|
+
return {
|
|
2520
|
+
isValid: false,
|
|
2521
|
+
error: `Parentheses in node label on line ${i + 1} (GitHub incompatible)`,
|
|
2522
|
+
detailedError: `Line "${line}" contains parentheses inside node label brackets. GitHub mermaid renderer fails with 'got PS' error. Use quotes or escape characters instead.`
|
|
2523
|
+
};
|
|
2524
|
+
}
|
|
2525
|
+
const nodeWithQuotes = line.match(/\{[^{}]*'[^{}]*\}|\[[^[\]]*'[^[\]]*\]/);
|
|
2526
|
+
if (nodeWithQuotes) {
|
|
2527
|
+
return {
|
|
2528
|
+
isValid: false,
|
|
2529
|
+
error: `Single quotes in node label on line ${i + 1} (GitHub incompatible)`,
|
|
2530
|
+
detailedError: `Line "${line}" contains single quotes inside node label. GitHub mermaid renderer fails with 'got PS' error. Use double quotes or escape characters instead.`
|
|
2531
|
+
};
|
|
2532
|
+
}
|
|
2533
|
+
const diamondWithComplexContent = line.match(/\{[^"{}]*[()'"<>&][^"{}]*\}/);
|
|
2534
|
+
const hasHtmlBreak = line.match(/\{[^{}]*<br\s*\/?>.*\}/);
|
|
2535
|
+
if (diamondWithComplexContent && !line.match(/\{\"[^\"]*\"\}/) && !hasHtmlBreak) {
|
|
2536
|
+
return {
|
|
2537
|
+
isValid: false,
|
|
2538
|
+
error: `Complex expression in diamond node on line ${i + 1} (GitHub incompatible)`,
|
|
2539
|
+
detailedError: `Line "${line}" contains special characters in diamond node that may cause GitHub parsing errors. Use simpler text or escape characters.`
|
|
2540
|
+
};
|
|
2541
|
+
}
|
|
2504
2542
|
}
|
|
2505
2543
|
if (diagramType === "sequence") {
|
|
2506
2544
|
if (line.includes("->>") && !line.includes(":")) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@probelabs/probe",
|
|
3
|
-
"version": "0.6.0-
|
|
3
|
+
"version": "0.6.0-rc66",
|
|
4
4
|
"description": "Node.js wrapper for the probe code search tool",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"module": "src/index.js",
|
|
@@ -31,7 +31,9 @@
|
|
|
31
31
|
"bin/probe.exe",
|
|
32
32
|
"bin/.gitkeep",
|
|
33
33
|
"scripts/postinstall.js",
|
|
34
|
-
"build/**/*"
|
|
34
|
+
"build/**/*",
|
|
35
|
+
"MERMAID_SUPPORT_SUMMARY.md",
|
|
36
|
+
"GITHUB_MERMAID_COMPATIBILITY.md"
|
|
35
37
|
],
|
|
36
38
|
"scripts": {
|
|
37
39
|
"postinstall": "node scripts/postinstall.js",
|
package/scripts/postinstall.js
CHANGED
|
@@ -24,6 +24,18 @@ const binDir = path.resolve(__dirname, '..', 'bin');
|
|
|
24
24
|
*/
|
|
25
25
|
async function main() {
|
|
26
26
|
try {
|
|
27
|
+
// Skip postinstall if binary already exists (for CI or development)
|
|
28
|
+
const isWindows = process.platform === 'win32';
|
|
29
|
+
const targetBinaryName = isWindows ? 'probe.exe' : 'probe-binary';
|
|
30
|
+
const targetBinaryPath = path.join(binDir, targetBinaryName);
|
|
31
|
+
|
|
32
|
+
if (await fs.pathExists(targetBinaryPath)) {
|
|
33
|
+
if (process.env.DEBUG === '1' || process.env.VERBOSE === '1') {
|
|
34
|
+
console.log(`Probe binary already exists at ${targetBinaryPath}, skipping download`);
|
|
35
|
+
}
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
|
|
27
39
|
// Create the bin directory if it doesn't exist
|
|
28
40
|
if (process.env.DEBUG === '1' || process.env.VERBOSE === '1') {
|
|
29
41
|
console.log(`Creating bin directory at: ${binDir}`);
|
|
@@ -109,9 +121,7 @@ You can download the binary from: https://github.com/probelabs/probe/releases
|
|
|
109
121
|
}
|
|
110
122
|
|
|
111
123
|
// Get the path to the target binary (preserve the Node.js wrapper script)
|
|
112
|
-
|
|
113
|
-
const targetBinaryName = isWindows ? 'probe.exe' : 'probe-binary';
|
|
114
|
-
const targetBinaryPath = path.join(binDir, targetBinaryName);
|
|
124
|
+
// (variables already declared at the beginning of main function)
|
|
115
125
|
|
|
116
126
|
// Copy the downloaded binary to the correct location
|
|
117
127
|
if (binaryPath !== targetBinaryPath) {
|
package/src/agent/schemaUtils.js
CHANGED
|
@@ -327,14 +327,14 @@ export async function validateMermaidDiagram(diagram) {
|
|
|
327
327
|
};
|
|
328
328
|
}
|
|
329
329
|
|
|
330
|
-
//
|
|
330
|
+
// GitHub-compatible strict syntax validation
|
|
331
331
|
const lines = trimmedDiagram.split('\n');
|
|
332
332
|
|
|
333
333
|
for (let i = 0; i < lines.length; i++) {
|
|
334
334
|
const line = lines[i].trim();
|
|
335
335
|
if (!line) continue;
|
|
336
336
|
|
|
337
|
-
// Check for
|
|
337
|
+
// Check for GitHub-incompatible patterns that cause "got 'PS'" errors
|
|
338
338
|
if (diagramType === 'flowchart') {
|
|
339
339
|
// Check for unbalanced brackets in node labels
|
|
340
340
|
const brackets = line.match(/\[[^\]]*$/); // Unclosed bracket
|
|
@@ -345,6 +345,40 @@ export async function validateMermaidDiagram(diagram) {
|
|
|
345
345
|
detailedError: `Line "${line}" contains an unclosed bracket`
|
|
346
346
|
};
|
|
347
347
|
}
|
|
348
|
+
|
|
349
|
+
// GitHub-strict: Check for parentheses inside node labels (causes PS token error)
|
|
350
|
+
// But allow parentheses inside double-quoted strings
|
|
351
|
+
const nodeWithParens = line.match(/\[[^"\[\]]*\([^"\[\]]*\]/);
|
|
352
|
+
if (nodeWithParens) {
|
|
353
|
+
return {
|
|
354
|
+
isValid: false,
|
|
355
|
+
error: `Parentheses in node label on line ${i + 1} (GitHub incompatible)`,
|
|
356
|
+
detailedError: `Line "${line}" contains parentheses inside node label brackets. GitHub mermaid renderer fails with 'got PS' error. Use quotes or escape characters instead.`
|
|
357
|
+
};
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
// GitHub-strict: Check for single quotes inside node labels (causes PS token error)
|
|
361
|
+
const nodeWithQuotes = line.match(/\{[^{}]*'[^{}]*\}|\[[^[\]]*'[^[\]]*\]/);
|
|
362
|
+
if (nodeWithQuotes) {
|
|
363
|
+
return {
|
|
364
|
+
isValid: false,
|
|
365
|
+
error: `Single quotes in node label on line ${i + 1} (GitHub incompatible)`,
|
|
366
|
+
detailedError: `Line "${line}" contains single quotes inside node label. GitHub mermaid renderer fails with 'got PS' error. Use double quotes or escape characters instead.`
|
|
367
|
+
};
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
// GitHub-strict: Check for complex expressions inside diamond nodes
|
|
371
|
+
// Allow double-quoted strings in diamond nodes, but catch problematic single quotes and complex expressions
|
|
372
|
+
// Allow HTML breaks (<br/>, <br>, etc.) but catch other problematic patterns
|
|
373
|
+
const diamondWithComplexContent = line.match(/\{[^"{}]*[()'"<>&][^"{}]*\}/);
|
|
374
|
+
const hasHtmlBreak = line.match(/\{[^{}]*<br\s*\/?>.*\}/);
|
|
375
|
+
if (diamondWithComplexContent && !line.match(/\{\"[^\"]*\"\}/) && !hasHtmlBreak) {
|
|
376
|
+
return {
|
|
377
|
+
isValid: false,
|
|
378
|
+
error: `Complex expression in diamond node on line ${i + 1} (GitHub incompatible)`,
|
|
379
|
+
detailedError: `Line "${line}" contains special characters in diamond node that may cause GitHub parsing errors. Use simpler text or escape characters.`
|
|
380
|
+
};
|
|
381
|
+
}
|
|
348
382
|
}
|
|
349
383
|
|
|
350
384
|
if (diagramType === 'sequence') {
|
|
@@ -66,4 +66,17 @@ You are Probe, a specialized code intelligence assistant. Your objective is to a
|
|
|
66
66
|
* Probe Action 2: \`search\` query: \`import AND "pkg/errors"\`, path: \`"service/"\` (Check where a potential custom error package is used)
|
|
67
67
|
* (Analysis: Confirms \`pkg/errors\` is widely used.)
|
|
68
68
|
* Probe Action 3: \`query\` language: \`go\`, pattern: \`errors.Wrap($$$)\`, path: \`"service/"\` (Find structural usage of the custom wrapper)
|
|
69
|
-
* (Response: Summarize error handling: Mention standard \`fmt.Errorf\` and the prevalent use of a custom \`errors.Wrap\` function from \`pkg/errors\`, providing examples from locations found by search/query like \`service/user/handler.go\`.)
|
|
69
|
+
* (Response: Summarize error handling: Mention standard \`fmt.Errorf\` and the prevalent use of a custom \`errors.Wrap\` function from \`pkg/errors\`, providing examples from locations found by search/query like \`service/user/handler.go\`.)
|
|
70
|
+
|
|
71
|
+
<mermaid-instructions>
|
|
72
|
+
For GitHub-compatible mermaid diagrams, avoid single quotes and parentheses in node labels:
|
|
73
|
+
|
|
74
|
+
**Rules:**
|
|
75
|
+
- NO single quotes in any node labels: 'text' → "text" or text
|
|
76
|
+
- NO parentheses in square brackets: [Text (detail)] → [Text - detail]
|
|
77
|
+
- NO complex expressions in diamonds: {a && b} → {condition}
|
|
78
|
+
|
|
79
|
+
**Examples:**
|
|
80
|
+
- ✅ [Load Config] ["Run command"] {Valid?}
|
|
81
|
+
- ❌ [Load (config)] [Run 'command'] {isValid('x')}
|
|
82
|
+
</mermaid-instructions>`
|