@probelabs/probe 0.6.0-rc123 → 0.6.0-rc124

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.
@@ -28902,6 +28902,37 @@ var init_semantics = __esm({
28902
28902
  }
28903
28903
  }
28904
28904
  }
28905
+ // Curly braces inside quoted label segments can be confusing because
28906
+ // braces also delimit decision/hexagon shapes. We allow them in quoted
28907
+ // text but suggest replacing with HTML entities so renderers remain stable.
28908
+ checkCurlyInQuoted(contentNodes) {
28909
+ if (!contentNodes)
28910
+ return;
28911
+ for (const cn of contentNodes) {
28912
+ const ch = cn.children || {};
28913
+ const qs = ch.QuotedString || [];
28914
+ for (const q of qs) {
28915
+ const raw = String(q.image || "");
28916
+ const inner = raw.length >= 2 && (raw.startsWith('"') || raw.startsWith("'")) ? raw.slice(1, -1) : raw;
28917
+ const i = inner.indexOf("{");
28918
+ const j = inner.indexOf("}");
28919
+ if (i >= 0 || j >= 0) {
28920
+ const rel = i >= 0 ? i : j;
28921
+ const col = (q.startColumn ?? 1) + 1 + Math.max(0, rel);
28922
+ this.ctx.errors.push({
28923
+ line: q.startLine ?? 1,
28924
+ column: col,
28925
+ severity: "warning",
28926
+ code: "FL-LABEL-CURLY-IN-QUOTED",
28927
+ message: "Curly braces inside quoted label text may be parsed as a shape by Mermaid. Replace { and } with HTML entities.",
28928
+ hint: 'Use { and } for { and } inside quoted text, e.g., "tyk-trace-{id}".',
28929
+ length: 1
28930
+ });
28931
+ break;
28932
+ }
28933
+ }
28934
+ }
28935
+ }
28905
28936
  warnParensInUnquoted(contentNodes) {
28906
28937
  if (!contentNodes)
28907
28938
  return;
@@ -28953,6 +28984,7 @@ var init_semantics = __esm({
28953
28984
  if (openTok) {
28954
28985
  this.checkEmptyContent(openTok, contentNodes.length ? contentNodes : void 0);
28955
28986
  this.checkDoubleInSingleQuoted(contentNodes);
28987
+ this.checkCurlyInQuoted(contentNodes);
28956
28988
  this.checkBackticksInContent(contentNodes);
28957
28989
  this.warnParensInUnquoted(contentNodes);
28958
28990
  if (this.ctx.strict) {
@@ -32385,6 +32417,51 @@ function computeFixes(text, errors, level = "safe") {
32385
32417
  edits.push(replaceRange(text, at(e), e.length ?? 1, ""));
32386
32418
  continue;
32387
32419
  }
32420
+ if (is("FL-LABEL-CURLY-IN-QUOTED", e)) {
32421
+ const lineText = lineTextAt(text, e.line);
32422
+ const caret0 = Math.max(0, e.column - 1);
32423
+ let qOpenIdx = -1;
32424
+ let qChar = null;
32425
+ for (let i = caret0; i >= 0; i--) {
32426
+ const ch2 = lineText[i];
32427
+ const code = ch2 ? ch2.charCodeAt(0) : -1;
32428
+ if (code === 34 || code === 39) {
32429
+ const bs = i > 0 && lineText[i - 1] === "\\";
32430
+ if (!bs) {
32431
+ qOpenIdx = i;
32432
+ qChar = ch2;
32433
+ break;
32434
+ }
32435
+ }
32436
+ }
32437
+ if (qOpenIdx !== -1 && qChar) {
32438
+ let qCloseIdx = -1;
32439
+ for (let j = qOpenIdx + 1; j < lineText.length; j++) {
32440
+ const ch2 = lineText[j];
32441
+ const code = ch2 ? ch2.charCodeAt(0) : -1;
32442
+ if (code === (qChar ? qChar.charCodeAt(0) : -1)) {
32443
+ const bs = lineText[j - 1] === "\\";
32444
+ if (!bs) {
32445
+ qCloseIdx = j;
32446
+ break;
32447
+ }
32448
+ }
32449
+ }
32450
+ if (qCloseIdx > qOpenIdx) {
32451
+ const inner = lineText.slice(qOpenIdx + 1, qCloseIdx);
32452
+ const replaced = inner.replace(/\{/g, "&#123;").replace(/\}/g, "&#125;");
32453
+ if (replaced !== inner) {
32454
+ edits.push({ start: { line: e.line, column: qOpenIdx + 2 }, end: { line: e.line, column: qCloseIdx + 1 }, newText: replaced });
32455
+ continue;
32456
+ }
32457
+ }
32458
+ }
32459
+ const ch = lineText[caret0] || "";
32460
+ const rep = ch === "{" ? "&#123;" : ch === "}" ? "&#125;" : ch;
32461
+ if (rep !== ch)
32462
+ edits.push(replaceRange(text, at(e), e.length ?? 1, rep));
32463
+ continue;
32464
+ }
32388
32465
  if (is("FL-LABEL-DOUBLE-IN-DOUBLE", e)) {
32389
32466
  const lineText = lineTextAt(text, e.line);
32390
32467
  const caret0 = Math.max(0, e.column - 1);
@@ -32862,6 +32939,8 @@ function computeFixes(text, errors, level = "safe") {
32862
32939
  const lineText = lineTextAt(text, e.line);
32863
32940
  const mLR = /^(\s*)Note\s+(left|right)\s+of\s+(.+?)\s+(.+)$/.exec(lineText);
32864
32941
  const mOver = /^(\s*)Note\s+over\s+(.+?)\s+(.+)$/.exec(lineText);
32942
+ const mLRml = /^(\s*)Note\s+(left|right)\s+of\s+([^:]+?)\s*$/.exec(lineText);
32943
+ const mOverml = /^(\s*)Note\s+over\s+([^:]+?)\s*$/.exec(lineText);
32865
32944
  let insertCol = e.column;
32866
32945
  if (mLR) {
32867
32946
  const indent = mLR[1] || "";
@@ -32871,6 +32950,26 @@ function computeFixes(text, errors, level = "safe") {
32871
32950
  const indent = mOver[1] || "";
32872
32951
  const beforeHeader = `${indent}Note over ${mOver[2]}`;
32873
32952
  insertCol = beforeHeader.length + 1;
32953
+ } else if (mLRml || mOverml) {
32954
+ const lines = text.split(/\r?\n/);
32955
+ const headerIdx = Math.max(0, e.line - 1);
32956
+ let endIdx = -1;
32957
+ for (let i = headerIdx + 1; i < lines.length; i++) {
32958
+ if (/^\s*end\s+note\s*$/i.test(lines[i] || "")) {
32959
+ endIdx = i;
32960
+ break;
32961
+ }
32962
+ }
32963
+ const indent = (mLRml ? mLRml[1] : mOverml[1]) || "";
32964
+ const beforeHeader = mLRml ? `${indent}Note ${mLRml[2]} of ${mLRml[3].trimEnd()}` : `${indent}Note over ${mOverml[2].trimEnd()}`;
32965
+ const body = endIdx !== -1 ? lines.slice(headerIdx + 1, endIdx).map((s) => s.trim()).join(" ") : "";
32966
+ const newHeader = `${beforeHeader} : ${body}`.replace(/\s+$/, "");
32967
+ const hdrLine = lineTextAt(text, e.line);
32968
+ edits.push({ start: { line: e.line, column: 1 }, end: { line: e.line, column: hdrLine.length + 1 }, newText: newHeader });
32969
+ if (endIdx !== -1) {
32970
+ edits.push({ start: { line: headerIdx + 2, column: 1 }, end: { line: endIdx + 2, column: 1 }, newText: "" });
32971
+ }
32972
+ continue;
32874
32973
  }
32875
32974
  const idx0 = Math.max(0, insertCol - 1);
32876
32975
  const nextCh = lineText[idx0] || "";
@@ -54774,6 +54774,37 @@ var init_semantics = __esm({
54774
54774
  }
54775
54775
  }
54776
54776
  }
54777
+ // Curly braces inside quoted label segments can be confusing because
54778
+ // braces also delimit decision/hexagon shapes. We allow them in quoted
54779
+ // text but suggest replacing with HTML entities so renderers remain stable.
54780
+ checkCurlyInQuoted(contentNodes) {
54781
+ if (!contentNodes)
54782
+ return;
54783
+ for (const cn of contentNodes) {
54784
+ const ch = cn.children || {};
54785
+ const qs = ch.QuotedString || [];
54786
+ for (const q3 of qs) {
54787
+ const raw = String(q3.image || "");
54788
+ const inner = raw.length >= 2 && (raw.startsWith('"') || raw.startsWith("'")) ? raw.slice(1, -1) : raw;
54789
+ const i3 = inner.indexOf("{");
54790
+ const j3 = inner.indexOf("}");
54791
+ if (i3 >= 0 || j3 >= 0) {
54792
+ const rel = i3 >= 0 ? i3 : j3;
54793
+ const col = (q3.startColumn ?? 1) + 1 + Math.max(0, rel);
54794
+ this.ctx.errors.push({
54795
+ line: q3.startLine ?? 1,
54796
+ column: col,
54797
+ severity: "warning",
54798
+ code: "FL-LABEL-CURLY-IN-QUOTED",
54799
+ message: "Curly braces inside quoted label text may be parsed as a shape by Mermaid. Replace { and } with HTML entities.",
54800
+ hint: 'Use &#123; and &#125; for { and } inside quoted text, e.g., "tyk-trace-&#123;id&#125;".',
54801
+ length: 1
54802
+ });
54803
+ break;
54804
+ }
54805
+ }
54806
+ }
54807
+ }
54777
54808
  warnParensInUnquoted(contentNodes) {
54778
54809
  if (!contentNodes)
54779
54810
  return;
@@ -54825,6 +54856,7 @@ var init_semantics = __esm({
54825
54856
  if (openTok) {
54826
54857
  this.checkEmptyContent(openTok, contentNodes.length ? contentNodes : void 0);
54827
54858
  this.checkDoubleInSingleQuoted(contentNodes);
54859
+ this.checkCurlyInQuoted(contentNodes);
54828
54860
  this.checkBackticksInContent(contentNodes);
54829
54861
  this.warnParensInUnquoted(contentNodes);
54830
54862
  if (this.ctx.strict) {
@@ -58257,6 +58289,51 @@ function computeFixes(text, errors, level = "safe") {
58257
58289
  edits.push(replaceRange(text, at(e3), e3.length ?? 1, ""));
58258
58290
  continue;
58259
58291
  }
58292
+ if (is("FL-LABEL-CURLY-IN-QUOTED", e3)) {
58293
+ const lineText = lineTextAt(text, e3.line);
58294
+ const caret0 = Math.max(0, e3.column - 1);
58295
+ let qOpenIdx = -1;
58296
+ let qChar = null;
58297
+ for (let i3 = caret0; i3 >= 0; i3--) {
58298
+ const ch2 = lineText[i3];
58299
+ const code = ch2 ? ch2.charCodeAt(0) : -1;
58300
+ if (code === 34 || code === 39) {
58301
+ const bs = i3 > 0 && lineText[i3 - 1] === "\\";
58302
+ if (!bs) {
58303
+ qOpenIdx = i3;
58304
+ qChar = ch2;
58305
+ break;
58306
+ }
58307
+ }
58308
+ }
58309
+ if (qOpenIdx !== -1 && qChar) {
58310
+ let qCloseIdx = -1;
58311
+ for (let j3 = qOpenIdx + 1; j3 < lineText.length; j3++) {
58312
+ const ch2 = lineText[j3];
58313
+ const code = ch2 ? ch2.charCodeAt(0) : -1;
58314
+ if (code === (qChar ? qChar.charCodeAt(0) : -1)) {
58315
+ const bs = lineText[j3 - 1] === "\\";
58316
+ if (!bs) {
58317
+ qCloseIdx = j3;
58318
+ break;
58319
+ }
58320
+ }
58321
+ }
58322
+ if (qCloseIdx > qOpenIdx) {
58323
+ const inner = lineText.slice(qOpenIdx + 1, qCloseIdx);
58324
+ const replaced = inner.replace(/\{/g, "&#123;").replace(/\}/g, "&#125;");
58325
+ if (replaced !== inner) {
58326
+ edits.push({ start: { line: e3.line, column: qOpenIdx + 2 }, end: { line: e3.line, column: qCloseIdx + 1 }, newText: replaced });
58327
+ continue;
58328
+ }
58329
+ }
58330
+ }
58331
+ const ch = lineText[caret0] || "";
58332
+ const rep = ch === "{" ? "&#123;" : ch === "}" ? "&#125;" : ch;
58333
+ if (rep !== ch)
58334
+ edits.push(replaceRange(text, at(e3), e3.length ?? 1, rep));
58335
+ continue;
58336
+ }
58260
58337
  if (is("FL-LABEL-DOUBLE-IN-DOUBLE", e3)) {
58261
58338
  const lineText = lineTextAt(text, e3.line);
58262
58339
  const caret0 = Math.max(0, e3.column - 1);
@@ -58734,6 +58811,8 @@ function computeFixes(text, errors, level = "safe") {
58734
58811
  const lineText = lineTextAt(text, e3.line);
58735
58812
  const mLR = /^(\s*)Note\s+(left|right)\s+of\s+(.+?)\s+(.+)$/.exec(lineText);
58736
58813
  const mOver = /^(\s*)Note\s+over\s+(.+?)\s+(.+)$/.exec(lineText);
58814
+ const mLRml = /^(\s*)Note\s+(left|right)\s+of\s+([^:]+?)\s*$/.exec(lineText);
58815
+ const mOverml = /^(\s*)Note\s+over\s+([^:]+?)\s*$/.exec(lineText);
58737
58816
  let insertCol = e3.column;
58738
58817
  if (mLR) {
58739
58818
  const indent = mLR[1] || "";
@@ -58743,6 +58822,26 @@ function computeFixes(text, errors, level = "safe") {
58743
58822
  const indent = mOver[1] || "";
58744
58823
  const beforeHeader = `${indent}Note over ${mOver[2]}`;
58745
58824
  insertCol = beforeHeader.length + 1;
58825
+ } else if (mLRml || mOverml) {
58826
+ const lines = text.split(/\r?\n/);
58827
+ const headerIdx = Math.max(0, e3.line - 1);
58828
+ let endIdx = -1;
58829
+ for (let i3 = headerIdx + 1; i3 < lines.length; i3++) {
58830
+ if (/^\s*end\s+note\s*$/i.test(lines[i3] || "")) {
58831
+ endIdx = i3;
58832
+ break;
58833
+ }
58834
+ }
58835
+ const indent = (mLRml ? mLRml[1] : mOverml[1]) || "";
58836
+ const beforeHeader = mLRml ? `${indent}Note ${mLRml[2]} of ${mLRml[3].trimEnd()}` : `${indent}Note over ${mOverml[2].trimEnd()}`;
58837
+ const body = endIdx !== -1 ? lines.slice(headerIdx + 1, endIdx).map((s3) => s3.trim()).join(" ") : "";
58838
+ const newHeader = `${beforeHeader} : ${body}`.replace(/\s+$/, "");
58839
+ const hdrLine = lineTextAt(text, e3.line);
58840
+ edits.push({ start: { line: e3.line, column: 1 }, end: { line: e3.line, column: hdrLine.length + 1 }, newText: newHeader });
58841
+ if (endIdx !== -1) {
58842
+ edits.push({ start: { line: headerIdx + 2, column: 1 }, end: { line: endIdx + 2, column: 1 }, newText: "" });
58843
+ }
58844
+ continue;
58746
58845
  }
58747
58846
  const idx0 = Math.max(0, insertCol - 1);
58748
58847
  const nextCh = lineText[idx0] || "";
package/cjs/index.cjs CHANGED
@@ -54973,6 +54973,37 @@ var init_semantics = __esm({
54973
54973
  }
54974
54974
  }
54975
54975
  }
54976
+ // Curly braces inside quoted label segments can be confusing because
54977
+ // braces also delimit decision/hexagon shapes. We allow them in quoted
54978
+ // text but suggest replacing with HTML entities so renderers remain stable.
54979
+ checkCurlyInQuoted(contentNodes) {
54980
+ if (!contentNodes)
54981
+ return;
54982
+ for (const cn of contentNodes) {
54983
+ const ch = cn.children || {};
54984
+ const qs = ch.QuotedString || [];
54985
+ for (const q3 of qs) {
54986
+ const raw = String(q3.image || "");
54987
+ const inner = raw.length >= 2 && (raw.startsWith('"') || raw.startsWith("'")) ? raw.slice(1, -1) : raw;
54988
+ const i3 = inner.indexOf("{");
54989
+ const j3 = inner.indexOf("}");
54990
+ if (i3 >= 0 || j3 >= 0) {
54991
+ const rel = i3 >= 0 ? i3 : j3;
54992
+ const col = (q3.startColumn ?? 1) + 1 + Math.max(0, rel);
54993
+ this.ctx.errors.push({
54994
+ line: q3.startLine ?? 1,
54995
+ column: col,
54996
+ severity: "warning",
54997
+ code: "FL-LABEL-CURLY-IN-QUOTED",
54998
+ message: "Curly braces inside quoted label text may be parsed as a shape by Mermaid. Replace { and } with HTML entities.",
54999
+ hint: 'Use &#123; and &#125; for { and } inside quoted text, e.g., "tyk-trace-&#123;id&#125;".',
55000
+ length: 1
55001
+ });
55002
+ break;
55003
+ }
55004
+ }
55005
+ }
55006
+ }
54976
55007
  warnParensInUnquoted(contentNodes) {
54977
55008
  if (!contentNodes)
54978
55009
  return;
@@ -55024,6 +55055,7 @@ var init_semantics = __esm({
55024
55055
  if (openTok) {
55025
55056
  this.checkEmptyContent(openTok, contentNodes.length ? contentNodes : void 0);
55026
55057
  this.checkDoubleInSingleQuoted(contentNodes);
55058
+ this.checkCurlyInQuoted(contentNodes);
55027
55059
  this.checkBackticksInContent(contentNodes);
55028
55060
  this.warnParensInUnquoted(contentNodes);
55029
55061
  if (this.ctx.strict) {
@@ -58456,6 +58488,51 @@ function computeFixes(text, errors, level = "safe") {
58456
58488
  edits.push(replaceRange(text, at(e3), e3.length ?? 1, ""));
58457
58489
  continue;
58458
58490
  }
58491
+ if (is("FL-LABEL-CURLY-IN-QUOTED", e3)) {
58492
+ const lineText = lineTextAt(text, e3.line);
58493
+ const caret0 = Math.max(0, e3.column - 1);
58494
+ let qOpenIdx = -1;
58495
+ let qChar = null;
58496
+ for (let i3 = caret0; i3 >= 0; i3--) {
58497
+ const ch2 = lineText[i3];
58498
+ const code = ch2 ? ch2.charCodeAt(0) : -1;
58499
+ if (code === 34 || code === 39) {
58500
+ const bs = i3 > 0 && lineText[i3 - 1] === "\\";
58501
+ if (!bs) {
58502
+ qOpenIdx = i3;
58503
+ qChar = ch2;
58504
+ break;
58505
+ }
58506
+ }
58507
+ }
58508
+ if (qOpenIdx !== -1 && qChar) {
58509
+ let qCloseIdx = -1;
58510
+ for (let j3 = qOpenIdx + 1; j3 < lineText.length; j3++) {
58511
+ const ch2 = lineText[j3];
58512
+ const code = ch2 ? ch2.charCodeAt(0) : -1;
58513
+ if (code === (qChar ? qChar.charCodeAt(0) : -1)) {
58514
+ const bs = lineText[j3 - 1] === "\\";
58515
+ if (!bs) {
58516
+ qCloseIdx = j3;
58517
+ break;
58518
+ }
58519
+ }
58520
+ }
58521
+ if (qCloseIdx > qOpenIdx) {
58522
+ const inner = lineText.slice(qOpenIdx + 1, qCloseIdx);
58523
+ const replaced = inner.replace(/\{/g, "&#123;").replace(/\}/g, "&#125;");
58524
+ if (replaced !== inner) {
58525
+ edits.push({ start: { line: e3.line, column: qOpenIdx + 2 }, end: { line: e3.line, column: qCloseIdx + 1 }, newText: replaced });
58526
+ continue;
58527
+ }
58528
+ }
58529
+ }
58530
+ const ch = lineText[caret0] || "";
58531
+ const rep = ch === "{" ? "&#123;" : ch === "}" ? "&#125;" : ch;
58532
+ if (rep !== ch)
58533
+ edits.push(replaceRange(text, at(e3), e3.length ?? 1, rep));
58534
+ continue;
58535
+ }
58459
58536
  if (is("FL-LABEL-DOUBLE-IN-DOUBLE", e3)) {
58460
58537
  const lineText = lineTextAt(text, e3.line);
58461
58538
  const caret0 = Math.max(0, e3.column - 1);
@@ -58933,6 +59010,8 @@ function computeFixes(text, errors, level = "safe") {
58933
59010
  const lineText = lineTextAt(text, e3.line);
58934
59011
  const mLR = /^(\s*)Note\s+(left|right)\s+of\s+(.+?)\s+(.+)$/.exec(lineText);
58935
59012
  const mOver = /^(\s*)Note\s+over\s+(.+?)\s+(.+)$/.exec(lineText);
59013
+ const mLRml = /^(\s*)Note\s+(left|right)\s+of\s+([^:]+?)\s*$/.exec(lineText);
59014
+ const mOverml = /^(\s*)Note\s+over\s+([^:]+?)\s*$/.exec(lineText);
58936
59015
  let insertCol = e3.column;
58937
59016
  if (mLR) {
58938
59017
  const indent = mLR[1] || "";
@@ -58942,6 +59021,26 @@ function computeFixes(text, errors, level = "safe") {
58942
59021
  const indent = mOver[1] || "";
58943
59022
  const beforeHeader = `${indent}Note over ${mOver[2]}`;
58944
59023
  insertCol = beforeHeader.length + 1;
59024
+ } else if (mLRml || mOverml) {
59025
+ const lines = text.split(/\r?\n/);
59026
+ const headerIdx = Math.max(0, e3.line - 1);
59027
+ let endIdx = -1;
59028
+ for (let i3 = headerIdx + 1; i3 < lines.length; i3++) {
59029
+ if (/^\s*end\s+note\s*$/i.test(lines[i3] || "")) {
59030
+ endIdx = i3;
59031
+ break;
59032
+ }
59033
+ }
59034
+ const indent = (mLRml ? mLRml[1] : mOverml[1]) || "";
59035
+ const beforeHeader = mLRml ? `${indent}Note ${mLRml[2]} of ${mLRml[3].trimEnd()}` : `${indent}Note over ${mOverml[2].trimEnd()}`;
59036
+ const body = endIdx !== -1 ? lines.slice(headerIdx + 1, endIdx).map((s3) => s3.trim()).join(" ") : "";
59037
+ const newHeader = `${beforeHeader} : ${body}`.replace(/\s+$/, "");
59038
+ const hdrLine = lineTextAt(text, e3.line);
59039
+ edits.push({ start: { line: e3.line, column: 1 }, end: { line: e3.line, column: hdrLine.length + 1 }, newText: newHeader });
59040
+ if (endIdx !== -1) {
59041
+ edits.push({ start: { line: headerIdx + 2, column: 1 }, end: { line: endIdx + 2, column: 1 }, newText: "" });
59042
+ }
59043
+ continue;
58945
59044
  }
58946
59045
  const idx0 = Math.max(0, insertCol - 1);
58947
59046
  const nextCh = lineText[idx0] || "";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@probelabs/probe",
3
- "version": "0.6.0-rc123",
3
+ "version": "0.6.0-rc124",
4
4
  "description": "Node.js wrapper for the probe code search tool",
5
5
  "main": "src/index.js",
6
6
  "module": "src/index.js",
@@ -80,7 +80,7 @@
80
80
  "@opentelemetry/sdk-node": "^0.203.0",
81
81
  "@opentelemetry/sdk-trace-base": "^1.30.0",
82
82
  "@opentelemetry/semantic-conventions": "^1.36.0",
83
- "@probelabs/maid": "^0.0.9",
83
+ "@probelabs/maid": "^0.0.10",
84
84
  "ai": "^5.0.0",
85
85
  "axios": "^1.8.3",
86
86
  "fs-extra": "^11.1.1",