@qodalis/cli 2.0.0-beta.5 → 2.0.0-beta.7
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/README.md +11 -0
- package/package.json +2 -2
- package/public-api.d.mts +34 -91
- package/public-api.d.ts +34 -91
- package/public-api.js +1 -618
- package/public-api.js.map +1 -1
- package/public-api.mjs +2 -614
- package/public-api.mjs.map +1 -1
package/public-api.mjs
CHANGED
|
@@ -410,7 +410,7 @@ var CliBackgroundServiceRegistry_TOKEN = "cli-background-service-registry";
|
|
|
410
410
|
var CliPackageManagerService_TOKEN = "cli-package-manager-service";
|
|
411
411
|
|
|
412
412
|
// src/lib/version.ts
|
|
413
|
-
var LIBRARY_VERSION = "2.0.0-beta.
|
|
413
|
+
var LIBRARY_VERSION = "2.0.0-beta.7";
|
|
414
414
|
var API_VERSION = 2;
|
|
415
415
|
var CliAliasCommandProcessor = class {
|
|
416
416
|
constructor() {
|
|
@@ -605,105 +605,6 @@ var CliCaptureCommandProcessor = class {
|
|
|
605
605
|
setTimeout(() => URL.revokeObjectURL(url), 1e3);
|
|
606
606
|
}
|
|
607
607
|
};
|
|
608
|
-
var CliBase64CommandProcessor = class {
|
|
609
|
-
constructor() {
|
|
610
|
-
this.command = "base64";
|
|
611
|
-
this.aliases = ["b64"];
|
|
612
|
-
this.description = "Encode or decode Base64 strings";
|
|
613
|
-
this.author = DefaultLibraryAuthor;
|
|
614
|
-
this.processors = [];
|
|
615
|
-
this.metadata = {
|
|
616
|
-
icon: "\u{1F523}",
|
|
617
|
-
module: "misc"
|
|
618
|
-
};
|
|
619
|
-
this.processors = [
|
|
620
|
-
{
|
|
621
|
-
command: "encode",
|
|
622
|
-
aliases: ["enc", "e"],
|
|
623
|
-
description: "Encode text to Base64",
|
|
624
|
-
acceptsRawInput: true,
|
|
625
|
-
valueRequired: true,
|
|
626
|
-
processCommand: async (command2, context2) => {
|
|
627
|
-
const text = command2.value || command2.data || "";
|
|
628
|
-
const encoded = btoa(
|
|
629
|
-
new TextEncoder().encode(text).reduce(
|
|
630
|
-
(data, byte) => data + String.fromCharCode(byte),
|
|
631
|
-
""
|
|
632
|
-
)
|
|
633
|
-
);
|
|
634
|
-
context2.writer.writeln(encoded);
|
|
635
|
-
context2.process.output(encoded);
|
|
636
|
-
},
|
|
637
|
-
writeDescription: (context2) => {
|
|
638
|
-
const { writer } = context2;
|
|
639
|
-
writer.writeln("Encode text to Base64 format");
|
|
640
|
-
writer.writeln();
|
|
641
|
-
writer.writeln(`\u{1F4CB} ${context2.translator.t("cli.common.usage", "Usage:")}`);
|
|
642
|
-
writer.writeln(
|
|
643
|
-
` ${writer.wrapInColor("base64 encode <text>", CliForegroundColor.Cyan)}`
|
|
644
|
-
);
|
|
645
|
-
writer.writeln();
|
|
646
|
-
writer.writeln(`\u{1F4DD} ${context2.translator.t("cli.common.examples", "Examples:")}`);
|
|
647
|
-
writer.writeln(
|
|
648
|
-
` base64 encode Hello World ${writer.wrapInColor("# \u2192 SGVsbG8gV29ybGQ=", CliForegroundColor.Green)}`
|
|
649
|
-
);
|
|
650
|
-
}
|
|
651
|
-
},
|
|
652
|
-
{
|
|
653
|
-
command: "decode",
|
|
654
|
-
aliases: ["dec", "d"],
|
|
655
|
-
description: "Decode a Base64 string",
|
|
656
|
-
acceptsRawInput: true,
|
|
657
|
-
valueRequired: true,
|
|
658
|
-
processCommand: async (command2, context2) => {
|
|
659
|
-
const encoded = command2.value || command2.data || "";
|
|
660
|
-
try {
|
|
661
|
-
const bytes = Uint8Array.from(
|
|
662
|
-
atob(encoded),
|
|
663
|
-
(c) => c.charCodeAt(0)
|
|
664
|
-
);
|
|
665
|
-
const decoded = new TextDecoder().decode(bytes);
|
|
666
|
-
context2.writer.writeln(decoded);
|
|
667
|
-
context2.process.output(decoded);
|
|
668
|
-
} catch {
|
|
669
|
-
context2.writer.writeError("Invalid Base64 string");
|
|
670
|
-
context2.process.exit(-1);
|
|
671
|
-
}
|
|
672
|
-
},
|
|
673
|
-
writeDescription: (context2) => {
|
|
674
|
-
const { writer } = context2;
|
|
675
|
-
writer.writeln("Decode a Base64 string back to text");
|
|
676
|
-
writer.writeln();
|
|
677
|
-
writer.writeln(`\u{1F4CB} ${context2.translator.t("cli.common.usage", "Usage:")}`);
|
|
678
|
-
writer.writeln(
|
|
679
|
-
` ${writer.wrapInColor("base64 decode <base64>", CliForegroundColor.Cyan)}`
|
|
680
|
-
);
|
|
681
|
-
writer.writeln();
|
|
682
|
-
writer.writeln(`\u{1F4DD} ${context2.translator.t("cli.common.examples", "Examples:")}`);
|
|
683
|
-
writer.writeln(
|
|
684
|
-
` base64 decode SGVsbG8gV29ybGQ= ${writer.wrapInColor("# \u2192 Hello World", CliForegroundColor.Green)}`
|
|
685
|
-
);
|
|
686
|
-
}
|
|
687
|
-
}
|
|
688
|
-
];
|
|
689
|
-
}
|
|
690
|
-
async processCommand(command2, context2) {
|
|
691
|
-
context2.executor.showHelp(command2, context2);
|
|
692
|
-
}
|
|
693
|
-
writeDescription(context2) {
|
|
694
|
-
const { writer, translator: t } = context2;
|
|
695
|
-
writer.writeln(t.t("cli.base64.long_description", "Encode and decode Base64 strings"));
|
|
696
|
-
writer.writeln(t.t("cli.base64.utf8_note", "Supports UTF-8 text encoding"));
|
|
697
|
-
writer.writeln();
|
|
698
|
-
writer.writeln(`\u{1F4CB} ${t.t("cli.common.usage", "Usage:")}`);
|
|
699
|
-
writer.writeln(
|
|
700
|
-
` ${writer.wrapInColor("base64 encode <text>", CliForegroundColor.Cyan)} ${t.t("cli.base64.encode_desc", "Encode text to Base64")}`
|
|
701
|
-
);
|
|
702
|
-
writer.writeln(
|
|
703
|
-
` ${writer.wrapInColor("base64 decode <base64>", CliForegroundColor.Cyan)} ${t.t("cli.base64.decode_desc", "Decode Base64 to text")}`
|
|
704
|
-
);
|
|
705
|
-
}
|
|
706
|
-
};
|
|
707
608
|
var CliCalCommandProcessor = class {
|
|
708
609
|
constructor() {
|
|
709
610
|
this.command = "cal";
|
|
@@ -1479,255 +1380,6 @@ var CliEvalCommandProcessor = class {
|
|
|
1479
1380
|
);
|
|
1480
1381
|
}
|
|
1481
1382
|
};
|
|
1482
|
-
var CliHashCommandProcessor = class {
|
|
1483
|
-
constructor() {
|
|
1484
|
-
this.command = "hash";
|
|
1485
|
-
this.description = "Generate hash digests of text";
|
|
1486
|
-
this.author = DefaultLibraryAuthor;
|
|
1487
|
-
this.processors = [];
|
|
1488
|
-
this.metadata = {
|
|
1489
|
-
icon: "#\uFE0F\u20E3",
|
|
1490
|
-
module: "misc"
|
|
1491
|
-
};
|
|
1492
|
-
const algorithms = [
|
|
1493
|
-
{ command: "sha256", algo: "SHA-256", aliases: ["sha-256"] },
|
|
1494
|
-
{ command: "sha1", algo: "SHA-1", aliases: ["sha-1"] },
|
|
1495
|
-
{ command: "sha384", algo: "SHA-384", aliases: ["sha-384"] },
|
|
1496
|
-
{ command: "sha512", algo: "SHA-512", aliases: ["sha-512"] }
|
|
1497
|
-
];
|
|
1498
|
-
this.processors = algorithms.map(({ command: command2, algo, aliases }) => ({
|
|
1499
|
-
command: command2,
|
|
1500
|
-
aliases,
|
|
1501
|
-
description: `Generate ${algo} hash`,
|
|
1502
|
-
acceptsRawInput: true,
|
|
1503
|
-
valueRequired: true,
|
|
1504
|
-
processCommand: async (cmd, context2) => {
|
|
1505
|
-
const text = cmd.value || cmd.data || "";
|
|
1506
|
-
try {
|
|
1507
|
-
const encoded = new TextEncoder().encode(text);
|
|
1508
|
-
const hashBuffer = await crypto.subtle.digest(
|
|
1509
|
-
algo,
|
|
1510
|
-
encoded
|
|
1511
|
-
);
|
|
1512
|
-
const hashArray = Array.from(new Uint8Array(hashBuffer));
|
|
1513
|
-
const hex = hashArray.map((b) => b.toString(16).padStart(2, "0")).join("");
|
|
1514
|
-
context2.writer.writeln(hex);
|
|
1515
|
-
context2.process.output(hex);
|
|
1516
|
-
} catch {
|
|
1517
|
-
context2.writer.writeError(`Failed to compute ${algo} hash`);
|
|
1518
|
-
context2.process.exit(-1);
|
|
1519
|
-
}
|
|
1520
|
-
},
|
|
1521
|
-
writeDescription: (context2) => {
|
|
1522
|
-
const { writer } = context2;
|
|
1523
|
-
writer.writeln(
|
|
1524
|
-
`Generate a ${algo} hash digest of the input text`
|
|
1525
|
-
);
|
|
1526
|
-
writer.writeln();
|
|
1527
|
-
writer.writeln(`\u{1F4CB} ${context2.translator.t("cli.common.usage", "Usage:")}`);
|
|
1528
|
-
writer.writeln(
|
|
1529
|
-
` ${writer.wrapInColor(`hash ${command2} <text>`, CliForegroundColor.Cyan)}`
|
|
1530
|
-
);
|
|
1531
|
-
}
|
|
1532
|
-
}));
|
|
1533
|
-
}
|
|
1534
|
-
async processCommand(command2, context2) {
|
|
1535
|
-
context2.executor.showHelp(command2, context2);
|
|
1536
|
-
}
|
|
1537
|
-
writeDescription(context2) {
|
|
1538
|
-
const { writer, translator: t } = context2;
|
|
1539
|
-
writer.writeln(
|
|
1540
|
-
t.t("cli.hash.long_description", "Generate cryptographic hash digests using the Web Crypto API")
|
|
1541
|
-
);
|
|
1542
|
-
writer.writeln();
|
|
1543
|
-
writer.writeln(`\u{1F4CB} ${t.t("cli.common.usage", "Usage:")}`);
|
|
1544
|
-
writer.writeln(
|
|
1545
|
-
` ${writer.wrapInColor("hash sha256 <text>", CliForegroundColor.Cyan)} SHA-256 hash`
|
|
1546
|
-
);
|
|
1547
|
-
writer.writeln(
|
|
1548
|
-
` ${writer.wrapInColor("hash sha1 <text>", CliForegroundColor.Cyan)} SHA-1 hash`
|
|
1549
|
-
);
|
|
1550
|
-
writer.writeln(
|
|
1551
|
-
` ${writer.wrapInColor("hash sha384 <text>", CliForegroundColor.Cyan)} SHA-384 hash`
|
|
1552
|
-
);
|
|
1553
|
-
writer.writeln(
|
|
1554
|
-
` ${writer.wrapInColor("hash sha512 <text>", CliForegroundColor.Cyan)} SHA-512 hash`
|
|
1555
|
-
);
|
|
1556
|
-
writer.writeln();
|
|
1557
|
-
writer.writeln(`\u{1F4DD} ${t.t("cli.common.examples", "Examples:")}`);
|
|
1558
|
-
writer.writeln(
|
|
1559
|
-
` hash sha256 hello ${writer.wrapInColor("# \u2192 2cf24dba5fb0a30e...", CliForegroundColor.Green)}`
|
|
1560
|
-
);
|
|
1561
|
-
}
|
|
1562
|
-
};
|
|
1563
|
-
var CliHexCommandProcessor = class {
|
|
1564
|
-
constructor() {
|
|
1565
|
-
this.command = "hex";
|
|
1566
|
-
this.description = "Hex encode/decode and number base conversions";
|
|
1567
|
-
this.author = DefaultLibraryAuthor;
|
|
1568
|
-
this.processors = [];
|
|
1569
|
-
this.metadata = {
|
|
1570
|
-
icon: "0\uFE0F\u20E3",
|
|
1571
|
-
module: "misc"
|
|
1572
|
-
};
|
|
1573
|
-
this.processors = [
|
|
1574
|
-
{
|
|
1575
|
-
command: "encode",
|
|
1576
|
-
aliases: ["enc"],
|
|
1577
|
-
description: "Encode text to hexadecimal",
|
|
1578
|
-
acceptsRawInput: true,
|
|
1579
|
-
valueRequired: true,
|
|
1580
|
-
processCommand: async (command2, context2) => {
|
|
1581
|
-
const text = command2.value || command2.data || "";
|
|
1582
|
-
const hex = Array.from(new TextEncoder().encode(text)).map((b) => b.toString(16).padStart(2, "0")).join("");
|
|
1583
|
-
context2.writer.writeln(hex);
|
|
1584
|
-
context2.process.output(hex);
|
|
1585
|
-
},
|
|
1586
|
-
writeDescription: (context2) => {
|
|
1587
|
-
const { writer } = context2;
|
|
1588
|
-
writer.writeln("Encode text to hexadecimal representation");
|
|
1589
|
-
writer.writeln();
|
|
1590
|
-
writer.writeln(`\u{1F4CB} ${context2.translator.t("cli.common.usage", "Usage:")}`);
|
|
1591
|
-
writer.writeln(
|
|
1592
|
-
` ${writer.wrapInColor("hex encode <text>", CliForegroundColor.Cyan)}`
|
|
1593
|
-
);
|
|
1594
|
-
}
|
|
1595
|
-
},
|
|
1596
|
-
{
|
|
1597
|
-
command: "decode",
|
|
1598
|
-
aliases: ["dec"],
|
|
1599
|
-
description: "Decode hexadecimal to text",
|
|
1600
|
-
acceptsRawInput: true,
|
|
1601
|
-
valueRequired: true,
|
|
1602
|
-
processCommand: async (command2, context2) => {
|
|
1603
|
-
const hexStr = command2.value || command2.data || "";
|
|
1604
|
-
try {
|
|
1605
|
-
const bytes = new Uint8Array(
|
|
1606
|
-
(hexStr.match(/.{1,2}/g) || []).map(
|
|
1607
|
-
(byte) => parseInt(byte, 16)
|
|
1608
|
-
)
|
|
1609
|
-
);
|
|
1610
|
-
const text = new TextDecoder().decode(bytes);
|
|
1611
|
-
context2.writer.writeln(text);
|
|
1612
|
-
context2.process.output(text);
|
|
1613
|
-
} catch {
|
|
1614
|
-
context2.writer.writeError("Invalid hex string");
|
|
1615
|
-
context2.process.exit(-1);
|
|
1616
|
-
}
|
|
1617
|
-
},
|
|
1618
|
-
writeDescription: (context2) => {
|
|
1619
|
-
const { writer } = context2;
|
|
1620
|
-
writer.writeln("Decode hexadecimal back to text");
|
|
1621
|
-
writer.writeln();
|
|
1622
|
-
writer.writeln(`\u{1F4CB} ${context2.translator.t("cli.common.usage", "Usage:")}`);
|
|
1623
|
-
writer.writeln(
|
|
1624
|
-
` ${writer.wrapInColor("hex decode <hex>", CliForegroundColor.Cyan)}`
|
|
1625
|
-
);
|
|
1626
|
-
}
|
|
1627
|
-
},
|
|
1628
|
-
{
|
|
1629
|
-
command: "convert",
|
|
1630
|
-
aliases: ["conv"],
|
|
1631
|
-
description: "Convert a number between bases",
|
|
1632
|
-
acceptsRawInput: true,
|
|
1633
|
-
valueRequired: true,
|
|
1634
|
-
parameters: [
|
|
1635
|
-
{
|
|
1636
|
-
name: "from",
|
|
1637
|
-
description: "Source base (default: 10)",
|
|
1638
|
-
type: "number",
|
|
1639
|
-
required: false
|
|
1640
|
-
},
|
|
1641
|
-
{
|
|
1642
|
-
name: "to",
|
|
1643
|
-
description: "Target base (default: 16)",
|
|
1644
|
-
type: "number",
|
|
1645
|
-
required: false
|
|
1646
|
-
}
|
|
1647
|
-
],
|
|
1648
|
-
processCommand: async (command2, context2) => {
|
|
1649
|
-
const { writer } = context2;
|
|
1650
|
-
const input = command2.value || "";
|
|
1651
|
-
const fromBase = parseInt(command2.args["from"]) || 10;
|
|
1652
|
-
const toBase = parseInt(command2.args["to"]) || 16;
|
|
1653
|
-
if (fromBase < 2 || fromBase > 36 || toBase < 2 || toBase > 36) {
|
|
1654
|
-
writer.writeError("Base must be between 2 and 36");
|
|
1655
|
-
context2.process.exit(-1);
|
|
1656
|
-
return;
|
|
1657
|
-
}
|
|
1658
|
-
try {
|
|
1659
|
-
const num = parseInt(input, fromBase);
|
|
1660
|
-
if (isNaN(num)) {
|
|
1661
|
-
writer.writeError(
|
|
1662
|
-
`Invalid number for base ${fromBase}`
|
|
1663
|
-
);
|
|
1664
|
-
context2.process.exit(-1);
|
|
1665
|
-
return;
|
|
1666
|
-
}
|
|
1667
|
-
const result = num.toString(toBase);
|
|
1668
|
-
writer.writeln(
|
|
1669
|
-
` ${writer.wrapInColor(`Base ${fromBase}:`, CliForegroundColor.Cyan)} ${input}`
|
|
1670
|
-
);
|
|
1671
|
-
writer.writeln(
|
|
1672
|
-
` ${writer.wrapInColor(`Base ${toBase}:`, CliForegroundColor.Cyan)} ${result}`
|
|
1673
|
-
);
|
|
1674
|
-
if (fromBase !== 10 && toBase !== 10) {
|
|
1675
|
-
writer.writeln(
|
|
1676
|
-
` ${writer.wrapInColor("Base 10:", CliForegroundColor.Cyan)} ${num}`
|
|
1677
|
-
);
|
|
1678
|
-
}
|
|
1679
|
-
context2.process.output(result);
|
|
1680
|
-
} catch {
|
|
1681
|
-
writer.writeError("Conversion failed");
|
|
1682
|
-
context2.process.exit(-1);
|
|
1683
|
-
}
|
|
1684
|
-
},
|
|
1685
|
-
writeDescription: (context2) => {
|
|
1686
|
-
const { writer } = context2;
|
|
1687
|
-
writer.writeln(
|
|
1688
|
-
"Convert a number between different bases (2-36)"
|
|
1689
|
-
);
|
|
1690
|
-
writer.writeln();
|
|
1691
|
-
writer.writeln(`\u{1F4CB} ${context2.translator.t("cli.common.usage", "Usage:")}`);
|
|
1692
|
-
writer.writeln(
|
|
1693
|
-
` ${writer.wrapInColor("hex convert <number> [--from=N] [--to=N]", CliForegroundColor.Cyan)}`
|
|
1694
|
-
);
|
|
1695
|
-
writer.writeln();
|
|
1696
|
-
writer.writeln(`\u{1F4DD} ${context2.translator.t("cli.common.examples", "Examples:")}`);
|
|
1697
|
-
writer.writeln(
|
|
1698
|
-
` hex convert 255 ${writer.wrapInColor("# Decimal \u2192 Hex (ff)", CliForegroundColor.Green)}`
|
|
1699
|
-
);
|
|
1700
|
-
writer.writeln(
|
|
1701
|
-
` hex convert ff --from=16 --to=2 ${writer.wrapInColor("# Hex \u2192 Binary (11111111)", CliForegroundColor.Green)}`
|
|
1702
|
-
);
|
|
1703
|
-
writer.writeln(
|
|
1704
|
-
` hex convert 1010 --from=2 ${writer.wrapInColor("# Binary \u2192 Hex (a)", CliForegroundColor.Green)}`
|
|
1705
|
-
);
|
|
1706
|
-
}
|
|
1707
|
-
}
|
|
1708
|
-
];
|
|
1709
|
-
}
|
|
1710
|
-
async processCommand(command2, context2) {
|
|
1711
|
-
context2.executor.showHelp(command2, context2);
|
|
1712
|
-
}
|
|
1713
|
-
writeDescription(context2) {
|
|
1714
|
-
const { writer, translator: t } = context2;
|
|
1715
|
-
writer.writeln(
|
|
1716
|
-
t.t("cli.hex.long_description", "Hex encode/decode text and convert numbers between bases")
|
|
1717
|
-
);
|
|
1718
|
-
writer.writeln();
|
|
1719
|
-
writer.writeln(`\u{1F4CB} ${t.t("cli.common.usage", "Usage:")}`);
|
|
1720
|
-
writer.writeln(
|
|
1721
|
-
` ${writer.wrapInColor("hex encode <text>", CliForegroundColor.Cyan)} ${t.t("cli.hex.text_to_hex", "Text to hex")}`
|
|
1722
|
-
);
|
|
1723
|
-
writer.writeln(
|
|
1724
|
-
` ${writer.wrapInColor("hex decode <hex>", CliForegroundColor.Cyan)} ${t.t("cli.hex.hex_to_text", "Hex to text")}`
|
|
1725
|
-
);
|
|
1726
|
-
writer.writeln(
|
|
1727
|
-
` ${writer.wrapInColor("hex convert <num> [--from --to]", CliForegroundColor.Cyan)} ${t.t("cli.hex.base_conversion", "Base conversion")}`
|
|
1728
|
-
);
|
|
1729
|
-
}
|
|
1730
|
-
};
|
|
1731
1383
|
var CliJsonCommandProcessor = class {
|
|
1732
1384
|
constructor() {
|
|
1733
1385
|
this.command = "json";
|
|
@@ -1854,134 +1506,6 @@ var CliJsonCommandProcessor = class {
|
|
|
1854
1506
|
);
|
|
1855
1507
|
}
|
|
1856
1508
|
};
|
|
1857
|
-
var CliJwtCommandProcessor = class {
|
|
1858
|
-
constructor() {
|
|
1859
|
-
this.command = "jwt";
|
|
1860
|
-
this.description = "Decode and inspect JWT tokens";
|
|
1861
|
-
this.author = DefaultLibraryAuthor;
|
|
1862
|
-
this.processors = [];
|
|
1863
|
-
this.metadata = {
|
|
1864
|
-
icon: "\u{1F511}",
|
|
1865
|
-
module: "misc"
|
|
1866
|
-
};
|
|
1867
|
-
this.processors = [
|
|
1868
|
-
{
|
|
1869
|
-
command: "decode",
|
|
1870
|
-
aliases: ["d"],
|
|
1871
|
-
description: "Decode a JWT token",
|
|
1872
|
-
acceptsRawInput: true,
|
|
1873
|
-
valueRequired: true,
|
|
1874
|
-
processCommand: async (command2, context2) => {
|
|
1875
|
-
const token = command2.value || command2.data || "";
|
|
1876
|
-
const { writer } = context2;
|
|
1877
|
-
const parts = token.split(".");
|
|
1878
|
-
if (parts.length !== 3) {
|
|
1879
|
-
writer.writeError(
|
|
1880
|
-
"Invalid JWT token (expected 3 parts separated by dots)"
|
|
1881
|
-
);
|
|
1882
|
-
context2.process.exit(-1);
|
|
1883
|
-
return;
|
|
1884
|
-
}
|
|
1885
|
-
try {
|
|
1886
|
-
const header = JSON.parse(
|
|
1887
|
-
this.base64UrlDecode(parts[0])
|
|
1888
|
-
);
|
|
1889
|
-
const payload = JSON.parse(
|
|
1890
|
-
this.base64UrlDecode(parts[1])
|
|
1891
|
-
);
|
|
1892
|
-
writer.writeln(
|
|
1893
|
-
writer.wrapInColor(
|
|
1894
|
-
"Header:",
|
|
1895
|
-
CliForegroundColor.Yellow
|
|
1896
|
-
)
|
|
1897
|
-
);
|
|
1898
|
-
writer.writeln(JSON.stringify(header, null, 2));
|
|
1899
|
-
writer.writeln();
|
|
1900
|
-
writer.writeln(
|
|
1901
|
-
writer.wrapInColor(
|
|
1902
|
-
"Payload:",
|
|
1903
|
-
CliForegroundColor.Yellow
|
|
1904
|
-
)
|
|
1905
|
-
);
|
|
1906
|
-
writer.writeln(JSON.stringify(payload, null, 2));
|
|
1907
|
-
writer.writeln();
|
|
1908
|
-
if (payload.exp) {
|
|
1909
|
-
const expDate = new Date(payload.exp * 1e3);
|
|
1910
|
-
const isExpired = expDate.getTime() < Date.now();
|
|
1911
|
-
writer.writeln(
|
|
1912
|
-
`${writer.wrapInColor("Expires:", CliForegroundColor.Yellow)} ${expDate.toLocaleString()} ${isExpired ? writer.wrapInColor(
|
|
1913
|
-
"(EXPIRED)",
|
|
1914
|
-
CliForegroundColor.Red
|
|
1915
|
-
) : writer.wrapInColor(
|
|
1916
|
-
"(valid)",
|
|
1917
|
-
CliForegroundColor.Green
|
|
1918
|
-
)}`
|
|
1919
|
-
);
|
|
1920
|
-
}
|
|
1921
|
-
if (payload.iat) {
|
|
1922
|
-
const iatDate = new Date(payload.iat * 1e3);
|
|
1923
|
-
writer.writeln(
|
|
1924
|
-
`${writer.wrapInColor("Issued:", CliForegroundColor.Yellow)} ${iatDate.toLocaleString()}`
|
|
1925
|
-
);
|
|
1926
|
-
}
|
|
1927
|
-
writer.writeln();
|
|
1928
|
-
writer.writeln(
|
|
1929
|
-
writer.wrapInColor(
|
|
1930
|
-
"Signature:",
|
|
1931
|
-
CliForegroundColor.Yellow
|
|
1932
|
-
) + ` ${parts[2].substring(0, 20)}...`
|
|
1933
|
-
);
|
|
1934
|
-
context2.process.output({ header, payload });
|
|
1935
|
-
} catch {
|
|
1936
|
-
writer.writeError("Failed to decode JWT token");
|
|
1937
|
-
context2.process.exit(-1);
|
|
1938
|
-
}
|
|
1939
|
-
},
|
|
1940
|
-
writeDescription: (context2) => {
|
|
1941
|
-
const { writer } = context2;
|
|
1942
|
-
writer.writeln(
|
|
1943
|
-
"Decode a JWT token and display its header and payload"
|
|
1944
|
-
);
|
|
1945
|
-
writer.writeln(
|
|
1946
|
-
"Shows expiration status and issue date if present"
|
|
1947
|
-
);
|
|
1948
|
-
writer.writeln();
|
|
1949
|
-
writer.writeln(`\u{1F4CB} ${context2.translator.t("cli.common.usage", "Usage:")}`);
|
|
1950
|
-
writer.writeln(
|
|
1951
|
-
` ${writer.wrapInColor("jwt decode <token>", CliForegroundColor.Cyan)}`
|
|
1952
|
-
);
|
|
1953
|
-
}
|
|
1954
|
-
}
|
|
1955
|
-
];
|
|
1956
|
-
}
|
|
1957
|
-
async processCommand(command2, context2) {
|
|
1958
|
-
context2.executor.showHelp(command2, context2);
|
|
1959
|
-
}
|
|
1960
|
-
writeDescription(context2) {
|
|
1961
|
-
const { writer, translator: t } = context2;
|
|
1962
|
-
writer.writeln(t.t("cli.jwt.long_description", "Decode and inspect JSON Web Tokens (JWT)"));
|
|
1963
|
-
writer.writeln();
|
|
1964
|
-
writer.writeln(`\u{1F4CB} ${t.t("cli.common.usage", "Usage:")}`);
|
|
1965
|
-
writer.writeln(
|
|
1966
|
-
` ${writer.wrapInColor("jwt decode <token>", CliForegroundColor.Cyan)} ${t.t("cli.jwt.decode_display", "Decode and display JWT contents")}`
|
|
1967
|
-
);
|
|
1968
|
-
writer.writeln();
|
|
1969
|
-
writer.writeln(
|
|
1970
|
-
`\u{1F4DD} ${t.t("cli.jwt.shows", "Shows: header, payload, expiration status, issue date")}`
|
|
1971
|
-
);
|
|
1972
|
-
}
|
|
1973
|
-
base64UrlDecode(str) {
|
|
1974
|
-
str = str.replace(/-/g, "+").replace(/_/g, "/");
|
|
1975
|
-
while (str.length % 4) {
|
|
1976
|
-
str += "=";
|
|
1977
|
-
}
|
|
1978
|
-
return decodeURIComponent(
|
|
1979
|
-
atob(str).split("").map(
|
|
1980
|
-
(c) => "%" + ("00" + c.charCodeAt(0).toString(16)).slice(-2)
|
|
1981
|
-
).join("")
|
|
1982
|
-
);
|
|
1983
|
-
}
|
|
1984
|
-
};
|
|
1985
1509
|
var LOREM_WORDS = [
|
|
1986
1510
|
"lorem",
|
|
1987
1511
|
"ipsum",
|
|
@@ -3078,137 +2602,6 @@ var CliUptimeCommandProcessor = class {
|
|
|
3078
2602
|
);
|
|
3079
2603
|
}
|
|
3080
2604
|
};
|
|
3081
|
-
var CliUrlCommandProcessor = class {
|
|
3082
|
-
constructor() {
|
|
3083
|
-
this.command = "url";
|
|
3084
|
-
this.description = "Encode or decode URLs";
|
|
3085
|
-
this.author = DefaultLibraryAuthor;
|
|
3086
|
-
this.processors = [];
|
|
3087
|
-
this.metadata = {
|
|
3088
|
-
icon: "\u{1F517}",
|
|
3089
|
-
module: "misc"
|
|
3090
|
-
};
|
|
3091
|
-
this.processors = [
|
|
3092
|
-
{
|
|
3093
|
-
command: "encode",
|
|
3094
|
-
aliases: ["enc"],
|
|
3095
|
-
description: "URL-encode a string",
|
|
3096
|
-
acceptsRawInput: true,
|
|
3097
|
-
valueRequired: true,
|
|
3098
|
-
processCommand: async (command2, context2) => {
|
|
3099
|
-
const text = command2.value || command2.data || "";
|
|
3100
|
-
const encoded = encodeURIComponent(text);
|
|
3101
|
-
context2.writer.writeln(encoded);
|
|
3102
|
-
context2.process.output(encoded);
|
|
3103
|
-
},
|
|
3104
|
-
writeDescription: (context2) => {
|
|
3105
|
-
const { writer } = context2;
|
|
3106
|
-
writer.writeln("URL-encode a string");
|
|
3107
|
-
writer.writeln();
|
|
3108
|
-
writer.writeln(`\u{1F4CB} ${context2.translator.t("cli.common.usage", "Usage:")}`);
|
|
3109
|
-
writer.writeln(
|
|
3110
|
-
` ${writer.wrapInColor("url encode <text>", CliForegroundColor.Cyan)}`
|
|
3111
|
-
);
|
|
3112
|
-
writer.writeln();
|
|
3113
|
-
writer.writeln(`\u{1F4DD} ${context2.translator.t("cli.common.examples", "Examples:")}`);
|
|
3114
|
-
writer.writeln(
|
|
3115
|
-
` url encode hello world ${writer.wrapInColor("# \u2192 hello%20world", CliForegroundColor.Green)}`
|
|
3116
|
-
);
|
|
3117
|
-
}
|
|
3118
|
-
},
|
|
3119
|
-
{
|
|
3120
|
-
command: "decode",
|
|
3121
|
-
aliases: ["dec"],
|
|
3122
|
-
description: "URL-decode a string",
|
|
3123
|
-
acceptsRawInput: true,
|
|
3124
|
-
valueRequired: true,
|
|
3125
|
-
processCommand: async (command2, context2) => {
|
|
3126
|
-
const text = command2.value || command2.data || "";
|
|
3127
|
-
try {
|
|
3128
|
-
const decoded = decodeURIComponent(text);
|
|
3129
|
-
context2.writer.writeln(decoded);
|
|
3130
|
-
context2.process.output(decoded);
|
|
3131
|
-
} catch {
|
|
3132
|
-
context2.writer.writeError("Invalid URL-encoded string");
|
|
3133
|
-
context2.process.exit(-1);
|
|
3134
|
-
}
|
|
3135
|
-
},
|
|
3136
|
-
writeDescription: (context2) => {
|
|
3137
|
-
const { writer } = context2;
|
|
3138
|
-
writer.writeln("URL-decode a string");
|
|
3139
|
-
writer.writeln();
|
|
3140
|
-
writer.writeln(`\u{1F4CB} ${context2.translator.t("cli.common.usage", "Usage:")}`);
|
|
3141
|
-
writer.writeln(
|
|
3142
|
-
` ${writer.wrapInColor("url decode <text>", CliForegroundColor.Cyan)}`
|
|
3143
|
-
);
|
|
3144
|
-
writer.writeln();
|
|
3145
|
-
writer.writeln(`\u{1F4DD} ${context2.translator.t("cli.common.examples", "Examples:")}`);
|
|
3146
|
-
writer.writeln(
|
|
3147
|
-
` url decode hello%20world ${writer.wrapInColor("# \u2192 hello world", CliForegroundColor.Green)}`
|
|
3148
|
-
);
|
|
3149
|
-
}
|
|
3150
|
-
},
|
|
3151
|
-
{
|
|
3152
|
-
command: "parse",
|
|
3153
|
-
description: "Parse a URL into its components",
|
|
3154
|
-
acceptsRawInput: true,
|
|
3155
|
-
valueRequired: true,
|
|
3156
|
-
processCommand: async (command2, context2) => {
|
|
3157
|
-
const input = command2.value || command2.data || "";
|
|
3158
|
-
try {
|
|
3159
|
-
const url = new URL(input);
|
|
3160
|
-
const parts = {
|
|
3161
|
-
protocol: url.protocol,
|
|
3162
|
-
hostname: url.hostname,
|
|
3163
|
-
port: url.port || "(default)",
|
|
3164
|
-
pathname: url.pathname,
|
|
3165
|
-
search: url.search || "(none)",
|
|
3166
|
-
hash: url.hash || "(none)",
|
|
3167
|
-
origin: url.origin
|
|
3168
|
-
};
|
|
3169
|
-
const { writer } = context2;
|
|
3170
|
-
Object.entries(parts).forEach(([key, value]) => {
|
|
3171
|
-
writer.writeln(
|
|
3172
|
-
` ${writer.wrapInColor(key.padEnd(12), CliForegroundColor.Cyan)} ${value}`
|
|
3173
|
-
);
|
|
3174
|
-
});
|
|
3175
|
-
context2.process.output(parts);
|
|
3176
|
-
} catch {
|
|
3177
|
-
context2.writer.writeError("Invalid URL");
|
|
3178
|
-
context2.process.exit(-1);
|
|
3179
|
-
}
|
|
3180
|
-
},
|
|
3181
|
-
writeDescription: (context2) => {
|
|
3182
|
-
const { writer } = context2;
|
|
3183
|
-
writer.writeln("Parse a URL and display its components");
|
|
3184
|
-
writer.writeln();
|
|
3185
|
-
writer.writeln(`\u{1F4CB} ${context2.translator.t("cli.common.usage", "Usage:")}`);
|
|
3186
|
-
writer.writeln(
|
|
3187
|
-
` ${writer.wrapInColor("url parse <url>", CliForegroundColor.Cyan)}`
|
|
3188
|
-
);
|
|
3189
|
-
}
|
|
3190
|
-
}
|
|
3191
|
-
];
|
|
3192
|
-
}
|
|
3193
|
-
async processCommand(command2, context2) {
|
|
3194
|
-
context2.executor.showHelp(command2, context2);
|
|
3195
|
-
}
|
|
3196
|
-
writeDescription(context2) {
|
|
3197
|
-
const { writer, translator: t } = context2;
|
|
3198
|
-
writer.writeln(t.t("cli.url.long_description", "Encode, decode, and parse URLs"));
|
|
3199
|
-
writer.writeln();
|
|
3200
|
-
writer.writeln(`\u{1F4CB} ${t.t("cli.common.usage", "Usage:")}`);
|
|
3201
|
-
writer.writeln(
|
|
3202
|
-
` ${writer.wrapInColor("url encode <text>", CliForegroundColor.Cyan)} ${t.t("cli.url.encode_desc", "URL-encode a string")}`
|
|
3203
|
-
);
|
|
3204
|
-
writer.writeln(
|
|
3205
|
-
` ${writer.wrapInColor("url decode <text>", CliForegroundColor.Cyan)} ${t.t("cli.url.decode_desc", "URL-decode a string")}`
|
|
3206
|
-
);
|
|
3207
|
-
writer.writeln(
|
|
3208
|
-
` ${writer.wrapInColor("url parse <url>", CliForegroundColor.Cyan)} ${t.t("cli.url.parse_desc", "Parse URL components")}`
|
|
3209
|
-
);
|
|
3210
|
-
}
|
|
3211
|
-
};
|
|
3212
2605
|
var CliYesCommandProcessor = class {
|
|
3213
2606
|
constructor() {
|
|
3214
2607
|
this.command = "yes";
|
|
@@ -10203,21 +9596,16 @@ var miscProcessors = [
|
|
|
10203
9596
|
new CliSleepCommandProcessor(),
|
|
10204
9597
|
new CliUnameCommandProcessor(),
|
|
10205
9598
|
new CliTimeCommandProcessor(),
|
|
10206
|
-
new CliBase64CommandProcessor(),
|
|
10207
9599
|
new CliJsonCommandProcessor(),
|
|
10208
|
-
new CliUrlCommandProcessor(),
|
|
10209
|
-
new CliHashCommandProcessor(),
|
|
10210
9600
|
new CliRandomCommandProcessor(),
|
|
10211
9601
|
new CliUptimeCommandProcessor(),
|
|
10212
9602
|
new CliOpenCommandProcessor(),
|
|
10213
9603
|
new CliLoremCommandProcessor(),
|
|
10214
9604
|
new CliTimestampCommandProcessor(),
|
|
10215
9605
|
new CliColorCommandProcessor(),
|
|
10216
|
-
new CliJwtCommandProcessor(),
|
|
10217
9606
|
new CliCalCommandProcessor(),
|
|
10218
9607
|
new CliSeqCommandProcessor(),
|
|
10219
9608
|
new CliScreenCommandProcessor(),
|
|
10220
|
-
new CliHexCommandProcessor(),
|
|
10221
9609
|
new CliClipboardCommandProcessor(),
|
|
10222
9610
|
new CliConvertCommandProcessor(),
|
|
10223
9611
|
new CliYesCommandProcessor()
|
|
@@ -16094,6 +15482,6 @@ function createInMemoryKvStore() {
|
|
|
16094
15482
|
};
|
|
16095
15483
|
}
|
|
16096
15484
|
|
|
16097
|
-
export { API_VERSION, CLi_Name_Art, CapturingTerminalWriter, CliAliasCommandProcessor, CliArgsParser, CliBackgroundServiceRegistry_TOKEN,
|
|
15485
|
+
export { API_VERSION, CLi_Name_Art, CapturingTerminalWriter, CliAliasCommandProcessor, CliArgsParser, CliBackgroundServiceRegistry_TOKEN, CliBoot, CliCalCommandProcessor, CliCaptureCommandProcessor, CliClearCommandProcessor, CliClipboard, CliClipboardCommandProcessor, CliColorCommandProcessor, CliCommandExecutionContext, CliCommandExecutor, CliCommandHistory, CliCommandHistory_TOKEN, CliCommandProcessorRegistry, CliConfigureCommandProcessor, CliConvertCommandProcessor, CliDebugCommandProcessor, CliDefaultPingServerService, CliDiffCommandProcessor, CliDragDropService, CliEchoCommandProcessor, CliEngine, CliEnvCommandProcessor, CliEnvironment, CliEvalCommandProcessor, CliExecutionContext, CliExecutionProcess, CliExportCommandProcessor, CliFeedbackCommandProcessor, CliFontSizeCommandProcessor, CliHelpCommandProcessor, CliHistoryCommandProcessor, CliHotKeysCommandProcessor, CliInputReader, CliJsonCommandProcessor, CliKeyValueStore, CliKillCommandProcessor, CliLogger, CliLoremCommandProcessor, CliModuleRegistry_TOKEN, CliNanoCommandProcessor, CliOpenCommandProcessor, CliPackageManagerService, CliPackageManagerService_TOKEN, CliPackagesCommandProcessor, CliPingCommandProcessor, CliProcessRegistry, CliProcessRegistry_TOKEN, CliProcessorsRegistry_TOKEN, CliPsCommandProcessor, CliRandomCommandProcessor, CliScreenCommandProcessor, CliSeqCommandProcessor, CliServerCommandProcessor, CliServerConnection, CliServerManager, CliServerManager_TOKEN, CliServerMultiProxyProcessor, CliServerProxyProcessor, CliServiceContainer, CliServicesCommandProcessor, CliSleepCommandProcessor, CliSnippetCommandProcessor, CliSshCommandProcessor, CliStateStore, CliStateStoreManager, CliStateStoreManager_TOKEN, CliTerminalProgressBar, CliTerminalSpinner, CliTerminalTextAnimator, CliTerminalWriter, CliTestHarness, CliThemeCommandProcessor, CliTimeCommandProcessor, CliTimestampCommandProcessor, CliUnAliasCommandProcessor, CliUnameCommandProcessor, CliUnsetCommandProcessor, CliUptimeCommandProcessor, CliVersionCommandProcessor, CliYesCommandProcessor, CommandParser, ICliEnvironment_TOKEN, ICliPingServerService_TOKEN, JsFallbackAccelerator, LIBRARY_VERSION, OverlayAddon, ProcessExitedError, ScriptLoaderService, builtinProcessors, computeDiff, contextGlobalParameter, createServerModule, executeOnServer, formatDiff, getAccelerator, getCliNameArt, getGreetingBasedOnTime, groupBy, helpGlobalParameter, hotkeysInfo, initWasmAccelerator, isWasmAccelerated, miscProcessors, openLink, reconcileArgs, renderServerResponse, systemProcessors, themeInfos, themes, versionGlobalParameter, welcomeModule };
|
|
16098
15486
|
//# sourceMappingURL=public-api.mjs.map
|
|
16099
15487
|
//# sourceMappingURL=public-api.mjs.map
|