@kaynooo/cli-code 0.11.0 → 0.13.0
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/cli.js +37 -8
- package/dist/hotspots-cli.js +33 -4
- package/dist/peek-cli.js +34 -6
- package/dist/todo-scan-cli.js +30 -2
- package/package.json +2 -2
package/dist/cli.js
CHANGED
|
@@ -29,7 +29,9 @@ function outputMode(stream = process2.stdout, env = process2.env) {
|
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
// ../kit/src/style.ts
|
|
32
|
+
import { resolve as resolve3 } from "path";
|
|
32
33
|
import process6 from "process";
|
|
34
|
+
import { pathToFileURL } from "url";
|
|
33
35
|
|
|
34
36
|
// ../../node_modules/.bun/@kaynooo+utils@2.31.2+d0769e28dc4dad16/node_modules/@kaynooo/utils/dist/chunk-mtetydvc.js
|
|
35
37
|
function x(s) {
|
|
@@ -328,13 +330,13 @@ function userConfigPath(bin, where = {}) {
|
|
|
328
330
|
// ../kit/src/theme.ts
|
|
329
331
|
var DEFAULT = {
|
|
330
332
|
colors: { accent: "cyan", id: "yellow", path: "blue", label: "dim", value: "bold", ok: "green", warn: "yellow", problem: "red", note: "dim", passed: "green", failed: "red", running: "cyan", queued: "yellow", skipped: "dim" },
|
|
331
|
-
glyphs: { ok: "\u2713", warn: "\u25B2", problem: "\u2717", note: "\u203A", passed: "\u2713", failed: "\u2717", running: "\u25CF", queued: "\u25CB", skipped: "-", bar: "\u2501" },
|
|
333
|
+
glyphs: { ok: "\u2713", warn: "\u25B2", problem: "\u2717", note: "\u203A", passed: "\u2713", failed: "\u2717", running: "\u25CF", queued: "\u25CB", skipped: "-", bar: "\u2501", rule: "\u2500", corner: "\u256D" },
|
|
332
334
|
accents: ["cyan", "magenta", "green", "blue", "yellow", "redBright"],
|
|
333
335
|
bins: {}
|
|
334
336
|
};
|
|
335
337
|
var BRIGHT = { accent: "cyanBright", id: "yellowBright", path: "blueBright", label: "white", value: "bold whiteBright", ok: "greenBright", warn: "yellowBright", problem: "redBright", note: "white", passed: "greenBright", failed: "redBright", running: "cyanBright", queued: "yellowBright", skipped: "white" };
|
|
336
338
|
var MONO = { accent: "bold", id: "bold", path: "underline", label: "dim", value: "bold", ok: "bold", warn: "bold", problem: "bold", note: "dim", passed: "bold", failed: "bold", running: "bold", queued: "dim", skipped: "dim" };
|
|
337
|
-
var ASCII = { ok: "+", warn: "!", problem: "x", note: ">", passed: "+", failed: "x", running: "*", queued: "o", skipped: "-", bar: "#" };
|
|
339
|
+
var ASCII = { ok: "+", warn: "!", problem: "x", note: ">", passed: "+", failed: "x", running: "*", queued: "o", skipped: "-", bar: "#", rule: "-", corner: "+" };
|
|
338
340
|
var PRESETS = {
|
|
339
341
|
default: {},
|
|
340
342
|
"high-contrast": { colors: BRIGHT, accents: ["cyanBright", "magentaBright", "greenBright", "blueBright", "yellowBright", "redBright"] },
|
|
@@ -528,6 +530,32 @@ var STATUS_WORDS = {
|
|
|
528
530
|
skipped: ["skipped", "cancelled", "canceled", "manual"]
|
|
529
531
|
};
|
|
530
532
|
var STATUS_OF = new Map(Object.entries(STATUS_WORDS).flatMap(([status, words]) => words.map((word) => [word, status])));
|
|
533
|
+
function header(bin, context, stream, env = process6.env) {
|
|
534
|
+
if (!takesControlCodes(stream, env))
|
|
535
|
+
return "";
|
|
536
|
+
const colors = paint(stream, env);
|
|
537
|
+
const hash = [...bin].reduce((sum, char) => sum + char.charCodeAt(0), 0);
|
|
538
|
+
const { theme } = activeTheme();
|
|
539
|
+
const spec = theme.bins[bin] ?? theme.accents[hash % theme.accents.length];
|
|
540
|
+
const accent = tinted(typeof spec === "string" && spec.split(" ").includes("bold") ? colors : colors.bold, spec, env);
|
|
541
|
+
return `${accent(bin)}${context === undefined ? "" : colors.dim(` \u203A ${context}`)}`;
|
|
542
|
+
}
|
|
543
|
+
function link(text, url, stream, env = process6.env) {
|
|
544
|
+
if (takesControlCodes(stream, env))
|
|
545
|
+
return `\x1B]8;;${url}\x1B\\${text}\x1B]8;;\x1B\\`;
|
|
546
|
+
return text === url ? text : `${text} (${url})`;
|
|
547
|
+
}
|
|
548
|
+
function printHeader(bin, context, stream = process6.stdout, env = process6.env) {
|
|
549
|
+
const line = header(bin, context, stream, env);
|
|
550
|
+
if (line !== "")
|
|
551
|
+
console.log(line);
|
|
552
|
+
}
|
|
553
|
+
function hyperlink(text, url, stream, env = process6.env) {
|
|
554
|
+
return takesControlCodes(stream, env) ? link(text, url, stream, env) : text;
|
|
555
|
+
}
|
|
556
|
+
function fileLink(text, path, stream, from = process6.cwd(), env = process6.env) {
|
|
557
|
+
return hyperlink(text, pathToFileURL(resolve3(from, path)).href, stream, env);
|
|
558
|
+
}
|
|
531
559
|
|
|
532
560
|
// ../kit/src/format.ts
|
|
533
561
|
function upTo(text, separator) {
|
|
@@ -1390,7 +1418,7 @@ var {Glob } = globalThis.Bun;
|
|
|
1390
1418
|
var SESSION_FILES = new Glob("*.json");
|
|
1391
1419
|
var ACCOUNT_DIRS = new Glob("*/sessions");
|
|
1392
1420
|
// src/hotspots.ts
|
|
1393
|
-
import { join as join7 } from "path";
|
|
1421
|
+
import { basename, join as join7 } from "path";
|
|
1394
1422
|
import process14 from "process";
|
|
1395
1423
|
|
|
1396
1424
|
// src/churn.ts
|
|
@@ -1587,7 +1615,8 @@ async function hotspots(args) {
|
|
|
1587
1615
|
return colors.red(text);
|
|
1588
1616
|
return top > 0 && score >= top * WARM ? colors.yellow(text) : text;
|
|
1589
1617
|
};
|
|
1590
|
-
|
|
1618
|
+
printHeader("hotspots", `${basename(cwd)} \xB7 since ${values.since ?? DEFAULT_SINCE}`);
|
|
1619
|
+
console.log(table([["rank", "score", "churn", "recent", "complexity", "lines", "file", "most complex declaration"], ...shown.map((row) => [colors.dim(String(row.rank)), heat(row.score, String(row.score)), ...[row.churn, row.recent, row.complexity, row.lines].map(String), fileLink(path(row.path), row.path, process14.stdout, cwd), row.worst === undefined ? "" : `${row.worst.name} (${row.worst.complexity}, line ${row.worst.line})`])], { header: true, align: ["right", "right", "right", "right", "right", "right", "left", "left"] }));
|
|
1591
1620
|
if (footer !== undefined)
|
|
1592
1621
|
console.log(footer);
|
|
1593
1622
|
return 0;
|
|
@@ -1595,7 +1624,7 @@ async function hotspots(args) {
|
|
|
1595
1624
|
|
|
1596
1625
|
// src/peek.ts
|
|
1597
1626
|
import { realpathSync as realpathSync2 } from "fs";
|
|
1598
|
-
import { isAbsolute as isAbsolute2, join as join8, relative as relative2, resolve as
|
|
1627
|
+
import { isAbsolute as isAbsolute2, join as join8, relative as relative2, resolve as resolve4, sep } from "path";
|
|
1599
1628
|
import process15 from "process";
|
|
1600
1629
|
|
|
1601
1630
|
// src/source.ts
|
|
@@ -1810,7 +1839,7 @@ async function readableRoot() {
|
|
|
1810
1839
|
async function isOutside(path) {
|
|
1811
1840
|
let real;
|
|
1812
1841
|
try {
|
|
1813
|
-
real = realpathSync2(
|
|
1842
|
+
real = realpathSync2(resolve4(process15.cwd(), path));
|
|
1814
1843
|
} catch {
|
|
1815
1844
|
return false;
|
|
1816
1845
|
}
|
|
@@ -1824,7 +1853,7 @@ async function checkInside(path) {
|
|
|
1824
1853
|
async function pipedSpans(text, context) {
|
|
1825
1854
|
const spans = [];
|
|
1826
1855
|
for (const [path, numbers] of locations(text)) {
|
|
1827
|
-
const source = await isOutside(path) ? undefined : await readText(
|
|
1856
|
+
const source = await isOutside(path) ? undefined : await readText(resolve4(process15.cwd(), path));
|
|
1828
1857
|
if (source !== undefined)
|
|
1829
1858
|
spans.push(...spansAround(path, source.replace(TRAILING_NEWLINE2, "").split(`
|
|
1830
1859
|
`).length, numbers, context));
|
|
@@ -1833,7 +1862,7 @@ async function pipedSpans(text, context) {
|
|
|
1833
1862
|
}
|
|
1834
1863
|
async function textOf(path) {
|
|
1835
1864
|
await checkInside(path);
|
|
1836
|
-
const text = await readText(
|
|
1865
|
+
const text = await readText(resolve4(process15.cwd(), path));
|
|
1837
1866
|
if (text === undefined)
|
|
1838
1867
|
fail(`cannot read ${path} (missing, binary or too large)`, 1);
|
|
1839
1868
|
return text;
|
package/dist/hotspots-cli.js
CHANGED
|
@@ -29,7 +29,9 @@ function outputMode(stream = process2.stdout, env = process2.env) {
|
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
// ../kit/src/style.ts
|
|
32
|
+
import { resolve as resolve3 } from "path";
|
|
32
33
|
import process6 from "process";
|
|
34
|
+
import { pathToFileURL } from "url";
|
|
33
35
|
|
|
34
36
|
// ../../node_modules/.bun/@kaynooo+utils@2.31.2+d0769e28dc4dad16/node_modules/@kaynooo/utils/dist/chunk-mtetydvc.js
|
|
35
37
|
function x(s) {
|
|
@@ -328,13 +330,13 @@ function userConfigPath(bin, where = {}) {
|
|
|
328
330
|
// ../kit/src/theme.ts
|
|
329
331
|
var DEFAULT = {
|
|
330
332
|
colors: { accent: "cyan", id: "yellow", path: "blue", label: "dim", value: "bold", ok: "green", warn: "yellow", problem: "red", note: "dim", passed: "green", failed: "red", running: "cyan", queued: "yellow", skipped: "dim" },
|
|
331
|
-
glyphs: { ok: "\u2713", warn: "\u25B2", problem: "\u2717", note: "\u203A", passed: "\u2713", failed: "\u2717", running: "\u25CF", queued: "\u25CB", skipped: "-", bar: "\u2501" },
|
|
333
|
+
glyphs: { ok: "\u2713", warn: "\u25B2", problem: "\u2717", note: "\u203A", passed: "\u2713", failed: "\u2717", running: "\u25CF", queued: "\u25CB", skipped: "-", bar: "\u2501", rule: "\u2500", corner: "\u256D" },
|
|
332
334
|
accents: ["cyan", "magenta", "green", "blue", "yellow", "redBright"],
|
|
333
335
|
bins: {}
|
|
334
336
|
};
|
|
335
337
|
var BRIGHT = { accent: "cyanBright", id: "yellowBright", path: "blueBright", label: "white", value: "bold whiteBright", ok: "greenBright", warn: "yellowBright", problem: "redBright", note: "white", passed: "greenBright", failed: "redBright", running: "cyanBright", queued: "yellowBright", skipped: "white" };
|
|
336
338
|
var MONO = { accent: "bold", id: "bold", path: "underline", label: "dim", value: "bold", ok: "bold", warn: "bold", problem: "bold", note: "dim", passed: "bold", failed: "bold", running: "bold", queued: "dim", skipped: "dim" };
|
|
337
|
-
var ASCII = { ok: "+", warn: "!", problem: "x", note: ">", passed: "+", failed: "x", running: "*", queued: "o", skipped: "-", bar: "#" };
|
|
339
|
+
var ASCII = { ok: "+", warn: "!", problem: "x", note: ">", passed: "+", failed: "x", running: "*", queued: "o", skipped: "-", bar: "#", rule: "-", corner: "+" };
|
|
338
340
|
var PRESETS = {
|
|
339
341
|
default: {},
|
|
340
342
|
"high-contrast": { colors: BRIGHT, accents: ["cyanBright", "magentaBright", "greenBright", "blueBright", "yellowBright", "redBright"] },
|
|
@@ -528,6 +530,32 @@ var STATUS_WORDS = {
|
|
|
528
530
|
skipped: ["skipped", "cancelled", "canceled", "manual"]
|
|
529
531
|
};
|
|
530
532
|
var STATUS_OF = new Map(Object.entries(STATUS_WORDS).flatMap(([status, words]) => words.map((word) => [word, status])));
|
|
533
|
+
function header(bin, context, stream, env = process6.env) {
|
|
534
|
+
if (!takesControlCodes(stream, env))
|
|
535
|
+
return "";
|
|
536
|
+
const colors = paint(stream, env);
|
|
537
|
+
const hash = [...bin].reduce((sum, char) => sum + char.charCodeAt(0), 0);
|
|
538
|
+
const { theme } = activeTheme();
|
|
539
|
+
const spec = theme.bins[bin] ?? theme.accents[hash % theme.accents.length];
|
|
540
|
+
const accent = tinted(typeof spec === "string" && spec.split(" ").includes("bold") ? colors : colors.bold, spec, env);
|
|
541
|
+
return `${accent(bin)}${context === undefined ? "" : colors.dim(` \u203A ${context}`)}`;
|
|
542
|
+
}
|
|
543
|
+
function link(text, url, stream, env = process6.env) {
|
|
544
|
+
if (takesControlCodes(stream, env))
|
|
545
|
+
return `\x1B]8;;${url}\x1B\\${text}\x1B]8;;\x1B\\`;
|
|
546
|
+
return text === url ? text : `${text} (${url})`;
|
|
547
|
+
}
|
|
548
|
+
function printHeader(bin, context, stream = process6.stdout, env = process6.env) {
|
|
549
|
+
const line = header(bin, context, stream, env);
|
|
550
|
+
if (line !== "")
|
|
551
|
+
console.log(line);
|
|
552
|
+
}
|
|
553
|
+
function hyperlink(text, url, stream, env = process6.env) {
|
|
554
|
+
return takesControlCodes(stream, env) ? link(text, url, stream, env) : text;
|
|
555
|
+
}
|
|
556
|
+
function fileLink(text, path, stream, from = process6.cwd(), env = process6.env) {
|
|
557
|
+
return hyperlink(text, pathToFileURL(resolve3(from, path)).href, stream, env);
|
|
558
|
+
}
|
|
531
559
|
|
|
532
560
|
// ../kit/src/format.ts
|
|
533
561
|
function upTo(text, separator) {
|
|
@@ -1390,7 +1418,7 @@ var {Glob } = globalThis.Bun;
|
|
|
1390
1418
|
var SESSION_FILES = new Glob("*.json");
|
|
1391
1419
|
var ACCOUNT_DIRS = new Glob("*/sessions");
|
|
1392
1420
|
// src/hotspots.ts
|
|
1393
|
-
import { join as join7 } from "path";
|
|
1421
|
+
import { basename, join as join7 } from "path";
|
|
1394
1422
|
import process14 from "process";
|
|
1395
1423
|
|
|
1396
1424
|
// src/churn.ts
|
|
@@ -1587,7 +1615,8 @@ async function hotspots(args) {
|
|
|
1587
1615
|
return colors.red(text);
|
|
1588
1616
|
return top > 0 && score >= top * WARM ? colors.yellow(text) : text;
|
|
1589
1617
|
};
|
|
1590
|
-
|
|
1618
|
+
printHeader("hotspots", `${basename(cwd)} \xB7 since ${values.since ?? DEFAULT_SINCE}`);
|
|
1619
|
+
console.log(table([["rank", "score", "churn", "recent", "complexity", "lines", "file", "most complex declaration"], ...shown.map((row) => [colors.dim(String(row.rank)), heat(row.score, String(row.score)), ...[row.churn, row.recent, row.complexity, row.lines].map(String), fileLink(path(row.path), row.path, process14.stdout, cwd), row.worst === undefined ? "" : `${row.worst.name} (${row.worst.complexity}, line ${row.worst.line})`])], { header: true, align: ["right", "right", "right", "right", "right", "right", "left", "left"] }));
|
|
1591
1620
|
if (footer !== undefined)
|
|
1592
1621
|
console.log(footer);
|
|
1593
1622
|
return 0;
|
package/dist/peek-cli.js
CHANGED
|
@@ -29,7 +29,9 @@ function outputMode(stream = process2.stdout, env = process2.env) {
|
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
// ../kit/src/style.ts
|
|
32
|
+
import { resolve as resolve3 } from "path";
|
|
32
33
|
import process6 from "process";
|
|
34
|
+
import { pathToFileURL } from "url";
|
|
33
35
|
|
|
34
36
|
// ../../node_modules/.bun/@kaynooo+utils@2.31.2+d0769e28dc4dad16/node_modules/@kaynooo/utils/dist/chunk-mtetydvc.js
|
|
35
37
|
function x(s) {
|
|
@@ -328,13 +330,13 @@ function userConfigPath(bin, where = {}) {
|
|
|
328
330
|
// ../kit/src/theme.ts
|
|
329
331
|
var DEFAULT = {
|
|
330
332
|
colors: { accent: "cyan", id: "yellow", path: "blue", label: "dim", value: "bold", ok: "green", warn: "yellow", problem: "red", note: "dim", passed: "green", failed: "red", running: "cyan", queued: "yellow", skipped: "dim" },
|
|
331
|
-
glyphs: { ok: "\u2713", warn: "\u25B2", problem: "\u2717", note: "\u203A", passed: "\u2713", failed: "\u2717", running: "\u25CF", queued: "\u25CB", skipped: "-", bar: "\u2501" },
|
|
333
|
+
glyphs: { ok: "\u2713", warn: "\u25B2", problem: "\u2717", note: "\u203A", passed: "\u2713", failed: "\u2717", running: "\u25CF", queued: "\u25CB", skipped: "-", bar: "\u2501", rule: "\u2500", corner: "\u256D" },
|
|
332
334
|
accents: ["cyan", "magenta", "green", "blue", "yellow", "redBright"],
|
|
333
335
|
bins: {}
|
|
334
336
|
};
|
|
335
337
|
var BRIGHT = { accent: "cyanBright", id: "yellowBright", path: "blueBright", label: "white", value: "bold whiteBright", ok: "greenBright", warn: "yellowBright", problem: "redBright", note: "white", passed: "greenBright", failed: "redBright", running: "cyanBright", queued: "yellowBright", skipped: "white" };
|
|
336
338
|
var MONO = { accent: "bold", id: "bold", path: "underline", label: "dim", value: "bold", ok: "bold", warn: "bold", problem: "bold", note: "dim", passed: "bold", failed: "bold", running: "bold", queued: "dim", skipped: "dim" };
|
|
337
|
-
var ASCII = { ok: "+", warn: "!", problem: "x", note: ">", passed: "+", failed: "x", running: "*", queued: "o", skipped: "-", bar: "#" };
|
|
339
|
+
var ASCII = { ok: "+", warn: "!", problem: "x", note: ">", passed: "+", failed: "x", running: "*", queued: "o", skipped: "-", bar: "#", rule: "-", corner: "+" };
|
|
338
340
|
var PRESETS = {
|
|
339
341
|
default: {},
|
|
340
342
|
"high-contrast": { colors: BRIGHT, accents: ["cyanBright", "magentaBright", "greenBright", "blueBright", "yellowBright", "redBright"] },
|
|
@@ -528,6 +530,32 @@ var STATUS_WORDS = {
|
|
|
528
530
|
skipped: ["skipped", "cancelled", "canceled", "manual"]
|
|
529
531
|
};
|
|
530
532
|
var STATUS_OF = new Map(Object.entries(STATUS_WORDS).flatMap(([status, words]) => words.map((word) => [word, status])));
|
|
533
|
+
function header(bin, context, stream, env = process6.env) {
|
|
534
|
+
if (!takesControlCodes(stream, env))
|
|
535
|
+
return "";
|
|
536
|
+
const colors = paint(stream, env);
|
|
537
|
+
const hash = [...bin].reduce((sum, char) => sum + char.charCodeAt(0), 0);
|
|
538
|
+
const { theme } = activeTheme();
|
|
539
|
+
const spec = theme.bins[bin] ?? theme.accents[hash % theme.accents.length];
|
|
540
|
+
const accent = tinted(typeof spec === "string" && spec.split(" ").includes("bold") ? colors : colors.bold, spec, env);
|
|
541
|
+
return `${accent(bin)}${context === undefined ? "" : colors.dim(` \u203A ${context}`)}`;
|
|
542
|
+
}
|
|
543
|
+
function link(text, url, stream, env = process6.env) {
|
|
544
|
+
if (takesControlCodes(stream, env))
|
|
545
|
+
return `\x1B]8;;${url}\x1B\\${text}\x1B]8;;\x1B\\`;
|
|
546
|
+
return text === url ? text : `${text} (${url})`;
|
|
547
|
+
}
|
|
548
|
+
function printHeader(bin, context, stream = process6.stdout, env = process6.env) {
|
|
549
|
+
const line = header(bin, context, stream, env);
|
|
550
|
+
if (line !== "")
|
|
551
|
+
console.log(line);
|
|
552
|
+
}
|
|
553
|
+
function hyperlink(text, url, stream, env = process6.env) {
|
|
554
|
+
return takesControlCodes(stream, env) ? link(text, url, stream, env) : text;
|
|
555
|
+
}
|
|
556
|
+
function fileLink(text, path, stream, from = process6.cwd(), env = process6.env) {
|
|
557
|
+
return hyperlink(text, pathToFileURL(resolve3(from, path)).href, stream, env);
|
|
558
|
+
}
|
|
531
559
|
|
|
532
560
|
// ../kit/src/format.ts
|
|
533
561
|
function upTo(text, separator) {
|
|
@@ -1391,7 +1419,7 @@ var SESSION_FILES = new Glob("*.json");
|
|
|
1391
1419
|
var ACCOUNT_DIRS = new Glob("*/sessions");
|
|
1392
1420
|
// src/peek.ts
|
|
1393
1421
|
import { realpathSync as realpathSync2 } from "fs";
|
|
1394
|
-
import { isAbsolute as isAbsolute2, join as join7, relative as relative2, resolve as
|
|
1422
|
+
import { isAbsolute as isAbsolute2, join as join7, relative as relative2, resolve as resolve4, sep } from "path";
|
|
1395
1423
|
import process14 from "process";
|
|
1396
1424
|
|
|
1397
1425
|
// src/files.ts
|
|
@@ -1646,7 +1674,7 @@ async function readableRoot() {
|
|
|
1646
1674
|
async function isOutside(path) {
|
|
1647
1675
|
let real;
|
|
1648
1676
|
try {
|
|
1649
|
-
real = realpathSync2(
|
|
1677
|
+
real = realpathSync2(resolve4(process14.cwd(), path));
|
|
1650
1678
|
} catch {
|
|
1651
1679
|
return false;
|
|
1652
1680
|
}
|
|
@@ -1660,7 +1688,7 @@ async function checkInside(path) {
|
|
|
1660
1688
|
async function pipedSpans(text, context) {
|
|
1661
1689
|
const spans = [];
|
|
1662
1690
|
for (const [path, numbers] of locations(text)) {
|
|
1663
|
-
const source = await isOutside(path) ? undefined : await readText(
|
|
1691
|
+
const source = await isOutside(path) ? undefined : await readText(resolve4(process14.cwd(), path));
|
|
1664
1692
|
if (source !== undefined)
|
|
1665
1693
|
spans.push(...spansAround(path, source.replace(TRAILING_NEWLINE2, "").split(`
|
|
1666
1694
|
`).length, numbers, context));
|
|
@@ -1669,7 +1697,7 @@ async function pipedSpans(text, context) {
|
|
|
1669
1697
|
}
|
|
1670
1698
|
async function textOf(path) {
|
|
1671
1699
|
await checkInside(path);
|
|
1672
|
-
const text = await readText(
|
|
1700
|
+
const text = await readText(resolve4(process14.cwd(), path));
|
|
1673
1701
|
if (text === undefined)
|
|
1674
1702
|
fail(`cannot read ${path} (missing, binary or too large)`, 1);
|
|
1675
1703
|
return text;
|
package/dist/todo-scan-cli.js
CHANGED
|
@@ -29,7 +29,9 @@ function outputMode(stream = process2.stdout, env = process2.env) {
|
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
// ../kit/src/style.ts
|
|
32
|
+
import { resolve as resolve3 } from "path";
|
|
32
33
|
import process6 from "process";
|
|
34
|
+
import { pathToFileURL } from "url";
|
|
33
35
|
|
|
34
36
|
// ../../node_modules/.bun/@kaynooo+utils@2.31.2+d0769e28dc4dad16/node_modules/@kaynooo/utils/dist/chunk-mtetydvc.js
|
|
35
37
|
function x(s) {
|
|
@@ -328,13 +330,13 @@ function userConfigPath(bin, where = {}) {
|
|
|
328
330
|
// ../kit/src/theme.ts
|
|
329
331
|
var DEFAULT = {
|
|
330
332
|
colors: { accent: "cyan", id: "yellow", path: "blue", label: "dim", value: "bold", ok: "green", warn: "yellow", problem: "red", note: "dim", passed: "green", failed: "red", running: "cyan", queued: "yellow", skipped: "dim" },
|
|
331
|
-
glyphs: { ok: "\u2713", warn: "\u25B2", problem: "\u2717", note: "\u203A", passed: "\u2713", failed: "\u2717", running: "\u25CF", queued: "\u25CB", skipped: "-", bar: "\u2501" },
|
|
333
|
+
glyphs: { ok: "\u2713", warn: "\u25B2", problem: "\u2717", note: "\u203A", passed: "\u2713", failed: "\u2717", running: "\u25CF", queued: "\u25CB", skipped: "-", bar: "\u2501", rule: "\u2500", corner: "\u256D" },
|
|
332
334
|
accents: ["cyan", "magenta", "green", "blue", "yellow", "redBright"],
|
|
333
335
|
bins: {}
|
|
334
336
|
};
|
|
335
337
|
var BRIGHT = { accent: "cyanBright", id: "yellowBright", path: "blueBright", label: "white", value: "bold whiteBright", ok: "greenBright", warn: "yellowBright", problem: "redBright", note: "white", passed: "greenBright", failed: "redBright", running: "cyanBright", queued: "yellowBright", skipped: "white" };
|
|
336
338
|
var MONO = { accent: "bold", id: "bold", path: "underline", label: "dim", value: "bold", ok: "bold", warn: "bold", problem: "bold", note: "dim", passed: "bold", failed: "bold", running: "bold", queued: "dim", skipped: "dim" };
|
|
337
|
-
var ASCII = { ok: "+", warn: "!", problem: "x", note: ">", passed: "+", failed: "x", running: "*", queued: "o", skipped: "-", bar: "#" };
|
|
339
|
+
var ASCII = { ok: "+", warn: "!", problem: "x", note: ">", passed: "+", failed: "x", running: "*", queued: "o", skipped: "-", bar: "#", rule: "-", corner: "+" };
|
|
338
340
|
var PRESETS = {
|
|
339
341
|
default: {},
|
|
340
342
|
"high-contrast": { colors: BRIGHT, accents: ["cyanBright", "magentaBright", "greenBright", "blueBright", "yellowBright", "redBright"] },
|
|
@@ -528,6 +530,32 @@ var STATUS_WORDS = {
|
|
|
528
530
|
skipped: ["skipped", "cancelled", "canceled", "manual"]
|
|
529
531
|
};
|
|
530
532
|
var STATUS_OF = new Map(Object.entries(STATUS_WORDS).flatMap(([status, words]) => words.map((word) => [word, status])));
|
|
533
|
+
function header(bin, context, stream, env = process6.env) {
|
|
534
|
+
if (!takesControlCodes(stream, env))
|
|
535
|
+
return "";
|
|
536
|
+
const colors = paint(stream, env);
|
|
537
|
+
const hash = [...bin].reduce((sum, char) => sum + char.charCodeAt(0), 0);
|
|
538
|
+
const { theme } = activeTheme();
|
|
539
|
+
const spec = theme.bins[bin] ?? theme.accents[hash % theme.accents.length];
|
|
540
|
+
const accent = tinted(typeof spec === "string" && spec.split(" ").includes("bold") ? colors : colors.bold, spec, env);
|
|
541
|
+
return `${accent(bin)}${context === undefined ? "" : colors.dim(` \u203A ${context}`)}`;
|
|
542
|
+
}
|
|
543
|
+
function link(text, url, stream, env = process6.env) {
|
|
544
|
+
if (takesControlCodes(stream, env))
|
|
545
|
+
return `\x1B]8;;${url}\x1B\\${text}\x1B]8;;\x1B\\`;
|
|
546
|
+
return text === url ? text : `${text} (${url})`;
|
|
547
|
+
}
|
|
548
|
+
function printHeader(bin, context, stream = process6.stdout, env = process6.env) {
|
|
549
|
+
const line = header(bin, context, stream, env);
|
|
550
|
+
if (line !== "")
|
|
551
|
+
console.log(line);
|
|
552
|
+
}
|
|
553
|
+
function hyperlink(text, url, stream, env = process6.env) {
|
|
554
|
+
return takesControlCodes(stream, env) ? link(text, url, stream, env) : text;
|
|
555
|
+
}
|
|
556
|
+
function fileLink(text, path, stream, from = process6.cwd(), env = process6.env) {
|
|
557
|
+
return hyperlink(text, pathToFileURL(resolve3(from, path)).href, stream, env);
|
|
558
|
+
}
|
|
531
559
|
|
|
532
560
|
// ../kit/src/format.ts
|
|
533
561
|
function upTo(text, separator) {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kaynooo/cli-code",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.13.0",
|
|
5
5
|
"description": "peek, todo-scan and hotspots: source read by spans, symbols and outlines in one call, the TODO and issue-reference comments of a repository with stale ones flagged, and the files ranked by complexity times git churn.",
|
|
6
6
|
"author": "Kaynooo <contact@kaynooo.fr>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -43,6 +43,6 @@
|
|
|
43
43
|
"hotspots": "$npm_execpath src/hotspots-cli.ts"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
|
-
"@kaynooo/cli-kit": "0.
|
|
46
|
+
"@kaynooo/cli-kit": "0.29.0"
|
|
47
47
|
}
|
|
48
48
|
}
|