@kaddo/cli 3.129.1 → 3.129.2
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/core.js +46 -31
- package/dist/index.js +46 -31
- package/package.json +1 -1
package/dist/core.js
CHANGED
|
@@ -10456,55 +10456,69 @@ function sha256(content) {
|
|
|
10456
10456
|
}
|
|
10457
10457
|
var SHINGLE_SIZE = 6;
|
|
10458
10458
|
var MIN_SHARED_RUN = 6;
|
|
10459
|
-
function
|
|
10460
|
-
|
|
10459
|
+
function stripNoise(text2) {
|
|
10460
|
+
return text2.replace(/```[\s\S]*?```/g, " ").replace(/`[^`]*`/g, " ").replace(/https?:\/\/\S+|www\.\S+/gi, " ");
|
|
10461
|
+
}
|
|
10462
|
+
function contentBlocks(body) {
|
|
10463
|
+
const blocks = [];
|
|
10464
|
+
let cur = [];
|
|
10461
10465
|
let inFence = false;
|
|
10466
|
+
const flush = () => {
|
|
10467
|
+
if (cur.length) blocks.push(cur);
|
|
10468
|
+
cur = [];
|
|
10469
|
+
};
|
|
10462
10470
|
for (const raw of body.split(/\r?\n/)) {
|
|
10463
10471
|
const t = raw.trim();
|
|
10464
10472
|
if (/^```/.test(t)) {
|
|
10465
10473
|
inFence = !inFence;
|
|
10474
|
+
flush();
|
|
10466
10475
|
continue;
|
|
10467
10476
|
}
|
|
10468
10477
|
if (inFence) continue;
|
|
10469
|
-
if (/^#{1,6}\s/.test(t))
|
|
10470
|
-
|
|
10471
|
-
|
|
10478
|
+
if (t === "" || /^#{1,6}\s/.test(t) || /^>/.test(t)) {
|
|
10479
|
+
flush();
|
|
10480
|
+
continue;
|
|
10481
|
+
}
|
|
10482
|
+
const isListItem = /^([-*+]\s+|\d+\.\s+)/.test(t);
|
|
10483
|
+
if (isListItem) flush();
|
|
10484
|
+
const text2 = stripNoise(t.replace(/^([-*+]\s+|\d+\.\s+)/, ""));
|
|
10472
10485
|
const matched = text2.toLowerCase().match(/[a-záéíóúñü0-9]+/gi);
|
|
10473
|
-
if (matched)
|
|
10486
|
+
if (matched) cur.push(...matched);
|
|
10474
10487
|
}
|
|
10475
|
-
|
|
10488
|
+
flush();
|
|
10489
|
+
return blocks;
|
|
10476
10490
|
}
|
|
10477
10491
|
function buildShingles(body) {
|
|
10478
|
-
const
|
|
10479
|
-
const keys = [];
|
|
10492
|
+
const blocks = contentBlocks(body);
|
|
10480
10493
|
const set = /* @__PURE__ */ new Set();
|
|
10481
|
-
for (
|
|
10482
|
-
|
|
10483
|
-
|
|
10484
|
-
|
|
10494
|
+
for (const block of blocks) {
|
|
10495
|
+
for (let i = 0; i + SHINGLE_SIZE <= block.length; i++) {
|
|
10496
|
+
set.add(block.slice(i, i + SHINGLE_SIZE).join(" "));
|
|
10497
|
+
}
|
|
10485
10498
|
}
|
|
10486
|
-
return {
|
|
10499
|
+
return { blocks, set };
|
|
10487
10500
|
}
|
|
10488
10501
|
function longestSharedRun(a, b) {
|
|
10489
10502
|
let best = 0;
|
|
10490
|
-
let
|
|
10491
|
-
|
|
10492
|
-
|
|
10493
|
-
|
|
10494
|
-
|
|
10495
|
-
|
|
10496
|
-
|
|
10497
|
-
|
|
10498
|
-
|
|
10499
|
-
|
|
10503
|
+
let bestSnippet = "";
|
|
10504
|
+
for (const block of a.blocks) {
|
|
10505
|
+
let run = 0;
|
|
10506
|
+
let runStart = 0;
|
|
10507
|
+
for (let i = 0; i + SHINGLE_SIZE <= block.length; i++) {
|
|
10508
|
+
const key = block.slice(i, i + SHINGLE_SIZE).join(" ");
|
|
10509
|
+
if (b.set.has(key)) {
|
|
10510
|
+
if (run === 0) runStart = i;
|
|
10511
|
+
run += 1;
|
|
10512
|
+
if (run > best) {
|
|
10513
|
+
best = run;
|
|
10514
|
+
bestSnippet = block.slice(runStart, runStart + SHINGLE_SIZE + run - 1).join(" ");
|
|
10515
|
+
}
|
|
10516
|
+
} else {
|
|
10517
|
+
run = 0;
|
|
10500
10518
|
}
|
|
10501
|
-
} else {
|
|
10502
|
-
run = 0;
|
|
10503
10519
|
}
|
|
10504
10520
|
}
|
|
10505
|
-
|
|
10506
|
-
const snippet = a.words.slice(bestStart, bestStart + SHINGLE_SIZE + best - 1).join(" ");
|
|
10507
|
-
return { length: best, snippet };
|
|
10521
|
+
return { length: best, snippet: bestSnippet };
|
|
10508
10522
|
}
|
|
10509
10523
|
var NORMATIVE_RE = /(^|[^a-záéíóúñü])(must|should|shall|debe[ns]?|deber[ií]a[ns]?|se\s+debe|hay\s+que|requiere[ns]?|require[sd]?|no\s+debe|invariant[e]?|invariants|restricci[oó]n|constraint|regla|obligatori[oa])([^a-záéíóúñü]|$)/i;
|
|
10510
10524
|
var PAST_RESULT_RE = /(compil[aoeéó]\w*|compiled|benchmark\w*|passed|succeed\w*|succeeded|ran\s+successfully|ejecut\w*|resultad\w*|crates?\b|ns\/op|µs\b|throughput|latenc\w*|baseline|measured|medid\w*|\d+\s*%|\bx\d|faster|slower)/i;
|
|
@@ -10660,8 +10674,9 @@ function buildConsolidationPlan(dir, opts = {}) {
|
|
|
10660
10674
|
}
|
|
10661
10675
|
for (const la of scoped) {
|
|
10662
10676
|
if (!isCompletedWorkItem(la)) continue;
|
|
10663
|
-
const
|
|
10664
|
-
if (!
|
|
10677
|
+
const learningRaw = sectionBody(la.body, ["Learning", "Aprendizaje", "Aprendizajes", "Learnings"]);
|
|
10678
|
+
if (!learningRaw) continue;
|
|
10679
|
+
const learning = stripNoise(learningRaw);
|
|
10665
10680
|
const ruleFragment = firstRuleFragment(learning);
|
|
10666
10681
|
if (!ruleFragment) continue;
|
|
10667
10682
|
opportunities.push({
|
package/dist/index.js
CHANGED
|
@@ -25963,55 +25963,69 @@ function sha256(content) {
|
|
|
25963
25963
|
}
|
|
25964
25964
|
var SHINGLE_SIZE = 6;
|
|
25965
25965
|
var MIN_SHARED_RUN = 6;
|
|
25966
|
-
function
|
|
25967
|
-
|
|
25966
|
+
function stripNoise(text2) {
|
|
25967
|
+
return text2.replace(/```[\s\S]*?```/g, " ").replace(/`[^`]*`/g, " ").replace(/https?:\/\/\S+|www\.\S+/gi, " ");
|
|
25968
|
+
}
|
|
25969
|
+
function contentBlocks(body) {
|
|
25970
|
+
const blocks = [];
|
|
25971
|
+
let cur = [];
|
|
25968
25972
|
let inFence = false;
|
|
25973
|
+
const flush2 = () => {
|
|
25974
|
+
if (cur.length) blocks.push(cur);
|
|
25975
|
+
cur = [];
|
|
25976
|
+
};
|
|
25969
25977
|
for (const raw of body.split(/\r?\n/)) {
|
|
25970
25978
|
const t = raw.trim();
|
|
25971
25979
|
if (/^```/.test(t)) {
|
|
25972
25980
|
inFence = !inFence;
|
|
25981
|
+
flush2();
|
|
25973
25982
|
continue;
|
|
25974
25983
|
}
|
|
25975
25984
|
if (inFence) continue;
|
|
25976
|
-
if (/^#{1,6}\s/.test(t))
|
|
25977
|
-
|
|
25978
|
-
|
|
25985
|
+
if (t === "" || /^#{1,6}\s/.test(t) || /^>/.test(t)) {
|
|
25986
|
+
flush2();
|
|
25987
|
+
continue;
|
|
25988
|
+
}
|
|
25989
|
+
const isListItem = /^([-*+]\s+|\d+\.\s+)/.test(t);
|
|
25990
|
+
if (isListItem) flush2();
|
|
25991
|
+
const text2 = stripNoise(t.replace(/^([-*+]\s+|\d+\.\s+)/, ""));
|
|
25979
25992
|
const matched = text2.toLowerCase().match(/[a-záéíóúñü0-9]+/gi);
|
|
25980
|
-
if (matched)
|
|
25993
|
+
if (matched) cur.push(...matched);
|
|
25981
25994
|
}
|
|
25982
|
-
|
|
25995
|
+
flush2();
|
|
25996
|
+
return blocks;
|
|
25983
25997
|
}
|
|
25984
25998
|
function buildShingles(body) {
|
|
25985
|
-
const
|
|
25986
|
-
const keys = [];
|
|
25999
|
+
const blocks = contentBlocks(body);
|
|
25987
26000
|
const set = /* @__PURE__ */ new Set();
|
|
25988
|
-
for (
|
|
25989
|
-
|
|
25990
|
-
|
|
25991
|
-
|
|
26001
|
+
for (const block of blocks) {
|
|
26002
|
+
for (let i = 0; i + SHINGLE_SIZE <= block.length; i++) {
|
|
26003
|
+
set.add(block.slice(i, i + SHINGLE_SIZE).join(" "));
|
|
26004
|
+
}
|
|
25992
26005
|
}
|
|
25993
|
-
return {
|
|
26006
|
+
return { blocks, set };
|
|
25994
26007
|
}
|
|
25995
26008
|
function longestSharedRun(a, b) {
|
|
25996
26009
|
let best = 0;
|
|
25997
|
-
let
|
|
25998
|
-
|
|
25999
|
-
|
|
26000
|
-
|
|
26001
|
-
|
|
26002
|
-
|
|
26003
|
-
|
|
26004
|
-
|
|
26005
|
-
|
|
26006
|
-
|
|
26010
|
+
let bestSnippet = "";
|
|
26011
|
+
for (const block of a.blocks) {
|
|
26012
|
+
let run = 0;
|
|
26013
|
+
let runStart = 0;
|
|
26014
|
+
for (let i = 0; i + SHINGLE_SIZE <= block.length; i++) {
|
|
26015
|
+
const key = block.slice(i, i + SHINGLE_SIZE).join(" ");
|
|
26016
|
+
if (b.set.has(key)) {
|
|
26017
|
+
if (run === 0) runStart = i;
|
|
26018
|
+
run += 1;
|
|
26019
|
+
if (run > best) {
|
|
26020
|
+
best = run;
|
|
26021
|
+
bestSnippet = block.slice(runStart, runStart + SHINGLE_SIZE + run - 1).join(" ");
|
|
26022
|
+
}
|
|
26023
|
+
} else {
|
|
26024
|
+
run = 0;
|
|
26007
26025
|
}
|
|
26008
|
-
} else {
|
|
26009
|
-
run = 0;
|
|
26010
26026
|
}
|
|
26011
26027
|
}
|
|
26012
|
-
|
|
26013
|
-
const snippet = a.words.slice(bestStart, bestStart + SHINGLE_SIZE + best - 1).join(" ");
|
|
26014
|
-
return { length: best, snippet };
|
|
26028
|
+
return { length: best, snippet: bestSnippet };
|
|
26015
26029
|
}
|
|
26016
26030
|
var NORMATIVE_RE = /(^|[^a-záéíóúñü])(must|should|shall|debe[ns]?|deber[ií]a[ns]?|se\s+debe|hay\s+que|requiere[ns]?|require[sd]?|no\s+debe|invariant[e]?|invariants|restricci[oó]n|constraint|regla|obligatori[oa])([^a-záéíóúñü]|$)/i;
|
|
26017
26031
|
var PAST_RESULT_RE = /(compil[aoeéó]\w*|compiled|benchmark\w*|passed|succeed\w*|succeeded|ran\s+successfully|ejecut\w*|resultad\w*|crates?\b|ns\/op|µs\b|throughput|latenc\w*|baseline|measured|medid\w*|\d+\s*%|\bx\d|faster|slower)/i;
|
|
@@ -26167,8 +26181,9 @@ function buildConsolidationPlan(dir, opts = {}) {
|
|
|
26167
26181
|
}
|
|
26168
26182
|
for (const la of scoped) {
|
|
26169
26183
|
if (!isCompletedWorkItem(la)) continue;
|
|
26170
|
-
const
|
|
26171
|
-
if (!
|
|
26184
|
+
const learningRaw = sectionBody(la.body, ["Learning", "Aprendizaje", "Aprendizajes", "Learnings"]);
|
|
26185
|
+
if (!learningRaw) continue;
|
|
26186
|
+
const learning = stripNoise(learningRaw);
|
|
26172
26187
|
const ruleFragment = firstRuleFragment(learning);
|
|
26173
26188
|
if (!ruleFragment) continue;
|
|
26174
26189
|
opportunities.push({
|