@jvittechs/jai1-cli 0.1.79 → 0.1.80
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 +135 -135
- package/dist/cli.js.map +1 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -33,7 +33,7 @@ var NetworkError = class extends Jai1Error {
|
|
|
33
33
|
// package.json
|
|
34
34
|
var package_default = {
|
|
35
35
|
name: "@jvittechs/jai1-cli",
|
|
36
|
-
version: "0.1.
|
|
36
|
+
version: "0.1.80",
|
|
37
37
|
description: "A unified CLI tool for JV-IT TECHS developers to manage Jai1 Framework. Please contact TeamAI for usage instructions.",
|
|
38
38
|
type: "module",
|
|
39
39
|
bin: {
|
|
@@ -895,9 +895,9 @@ var UnifiedApplyApp = ({
|
|
|
895
895
|
(c) => c.filepath.toLowerCase().includes(query) || c.name.toLowerCase().includes(query) || c.tags && c.tags.some((t) => t.toLowerCase().includes(query))
|
|
896
896
|
);
|
|
897
897
|
}, [components, searchQuery]);
|
|
898
|
-
useInput((
|
|
898
|
+
useInput((input2, key) => {
|
|
899
899
|
if (viewState === "summary") {
|
|
900
|
-
if (key.return ||
|
|
900
|
+
if (key.return || input2 === "q" || key.escape) {
|
|
901
901
|
onExit();
|
|
902
902
|
}
|
|
903
903
|
return;
|
|
@@ -911,7 +911,7 @@ var UnifiedApplyApp = ({
|
|
|
911
911
|
else setFocusArea("search");
|
|
912
912
|
return;
|
|
913
913
|
}
|
|
914
|
-
if (key.escape ||
|
|
914
|
+
if (key.escape || input2 === "q") {
|
|
915
915
|
onExit();
|
|
916
916
|
return;
|
|
917
917
|
}
|
|
@@ -926,7 +926,7 @@ var UnifiedApplyApp = ({
|
|
|
926
926
|
setCursorIndex((prev) => Math.max(0, prev - 1));
|
|
927
927
|
} else if (key.downArrow) {
|
|
928
928
|
setCursorIndex((prev) => Math.min(filteredComponents.length - 1, prev + 1));
|
|
929
|
-
} else if (
|
|
929
|
+
} else if (input2 === " ") {
|
|
930
930
|
const current = filteredComponents[cursorIndex];
|
|
931
931
|
if (current) {
|
|
932
932
|
setSelectedPaths((prev) => {
|
|
@@ -939,13 +939,13 @@ var UnifiedApplyApp = ({
|
|
|
939
939
|
return next;
|
|
940
940
|
});
|
|
941
941
|
}
|
|
942
|
-
} else if (
|
|
942
|
+
} else if (input2 === "a") {
|
|
943
943
|
setSelectedPaths((prev) => {
|
|
944
944
|
const next = new Set(prev);
|
|
945
945
|
filteredComponents.forEach((c) => next.add(c.filepath));
|
|
946
946
|
return next;
|
|
947
947
|
});
|
|
948
|
-
} else if (
|
|
948
|
+
} else if (input2 === "c") {
|
|
949
949
|
setSelectedPaths(/* @__PURE__ */ new Set());
|
|
950
950
|
}
|
|
951
951
|
}
|
|
@@ -954,7 +954,7 @@ var UnifiedApplyApp = ({
|
|
|
954
954
|
setSelectedPackageIndex((prev) => Math.max(0, prev - 1));
|
|
955
955
|
} else if (key.rightArrow) {
|
|
956
956
|
setSelectedPackageIndex((prev) => Math.min(tags.length - 1, prev + 1));
|
|
957
|
-
} else if (
|
|
957
|
+
} else if (input2 === " " || key.return) {
|
|
958
958
|
const tag = tags[selectedPackageIndex];
|
|
959
959
|
if (tag) {
|
|
960
960
|
const packageComponents = components.filter((c) => c.tags?.includes(tag.tag));
|
|
@@ -1332,7 +1332,7 @@ var MainMenuView = ({ ideContexts, onSelect }) => {
|
|
|
1332
1332
|
available: ideContexts.some((ctx) => ctx.ide === "jai1")
|
|
1333
1333
|
}
|
|
1334
1334
|
];
|
|
1335
|
-
useInput2((
|
|
1335
|
+
useInput2((input2, key) => {
|
|
1336
1336
|
if (key.upArrow) {
|
|
1337
1337
|
setSelectedIndex((prev) => Math.max(0, prev - 1));
|
|
1338
1338
|
} else if (key.downArrow) {
|
|
@@ -1434,13 +1434,13 @@ var IDEOverviewView = ({
|
|
|
1434
1434
|
count: ideContext.stats.byType.context
|
|
1435
1435
|
});
|
|
1436
1436
|
}
|
|
1437
|
-
useInput3((
|
|
1437
|
+
useInput3((input2, key) => {
|
|
1438
1438
|
if (key.tab || key.rightArrow) {
|
|
1439
1439
|
setSelectedTabIndex((prev) => Math.min(tabs.length - 1, prev + 1));
|
|
1440
1440
|
} else if (key.leftArrow) {
|
|
1441
1441
|
setSelectedTabIndex((prev) => Math.max(0, prev - 1));
|
|
1442
1442
|
}
|
|
1443
|
-
const num = parseInt(
|
|
1443
|
+
const num = parseInt(input2, 10);
|
|
1444
1444
|
if (!isNaN(num) && num >= 1 && num <= tabs.length) {
|
|
1445
1445
|
setSelectedTabIndex(num - 1);
|
|
1446
1446
|
}
|
|
@@ -1502,7 +1502,7 @@ import React7, { useState as useState4 } from "react";
|
|
|
1502
1502
|
import { Box as Box5, Text as Text6, useInput as useInput4 } from "ink";
|
|
1503
1503
|
var ListView = ({ items, contentType, onSelect, onBack }) => {
|
|
1504
1504
|
const [selectedIndex, setSelectedIndex] = useState4(0);
|
|
1505
|
-
useInput4((
|
|
1505
|
+
useInput4((input2, key) => {
|
|
1506
1506
|
if (key.upArrow) {
|
|
1507
1507
|
setSelectedIndex((prev) => Math.max(0, prev - 1));
|
|
1508
1508
|
} else if (key.downArrow) {
|
|
@@ -1553,18 +1553,18 @@ var DetailView = ({ item, scrollPosition: initialScroll, onBack }) => {
|
|
|
1553
1553
|
const [scrollPosition, setScrollPosition] = useState5(initialScroll);
|
|
1554
1554
|
const maxVisibleLines = 25;
|
|
1555
1555
|
const maxScroll = Math.max(0, item.previewLines.length - maxVisibleLines);
|
|
1556
|
-
useInput5((
|
|
1557
|
-
if (key.upArrow ||
|
|
1556
|
+
useInput5((input2, key) => {
|
|
1557
|
+
if (key.upArrow || input2 === "k") {
|
|
1558
1558
|
setScrollPosition((prev) => Math.max(0, prev - 1));
|
|
1559
|
-
} else if (key.downArrow ||
|
|
1559
|
+
} else if (key.downArrow || input2 === "j") {
|
|
1560
1560
|
setScrollPosition((prev) => Math.min(maxScroll, prev + 1));
|
|
1561
|
-
} else if (key.pageDown ||
|
|
1561
|
+
} else if (key.pageDown || input2 === "d") {
|
|
1562
1562
|
setScrollPosition((prev) => Math.min(maxScroll, prev + 5));
|
|
1563
|
-
} else if (key.pageUp ||
|
|
1563
|
+
} else if (key.pageUp || input2 === "u") {
|
|
1564
1564
|
setScrollPosition((prev) => Math.max(0, prev - 5));
|
|
1565
|
-
} else if (
|
|
1565
|
+
} else if (input2 === "g") {
|
|
1566
1566
|
setScrollPosition(0);
|
|
1567
|
-
} else if (
|
|
1567
|
+
} else if (input2 === "G") {
|
|
1568
1568
|
setScrollPosition(maxScroll);
|
|
1569
1569
|
} else if (key.escape || key.backspace) {
|
|
1570
1570
|
onBack();
|
|
@@ -1960,8 +1960,8 @@ var ContextApp = ({ initialIDE, initialType, onExit }) => {
|
|
|
1960
1960
|
setLoading(false);
|
|
1961
1961
|
});
|
|
1962
1962
|
}, [initialIDE]);
|
|
1963
|
-
useInput6((
|
|
1964
|
-
if (
|
|
1963
|
+
useInput6((input2, key) => {
|
|
1964
|
+
if (input2 === "q") {
|
|
1965
1965
|
onExit();
|
|
1966
1966
|
return;
|
|
1967
1967
|
}
|
|
@@ -2888,7 +2888,7 @@ var MENU_ITEMS = [
|
|
|
2888
2888
|
];
|
|
2889
2889
|
var MenuView = ({ onSelect }) => {
|
|
2890
2890
|
const [selectedIndex, setSelectedIndex] = useState7(0);
|
|
2891
|
-
useInput7((
|
|
2891
|
+
useInput7((input2, key) => {
|
|
2892
2892
|
if (key.upArrow) {
|
|
2893
2893
|
setSelectedIndex((prev) => Math.max(0, prev - 1));
|
|
2894
2894
|
} else if (key.downArrow) {
|
|
@@ -3501,7 +3501,7 @@ var AgenticGuideView = ({ onBack }) => {
|
|
|
3501
3501
|
const [isTyping, setIsTyping] = useState8(false);
|
|
3502
3502
|
const [selectedSuggestion, setSelectedSuggestion] = useState8(0);
|
|
3503
3503
|
const [focusArea, setFocusArea] = useState8("input");
|
|
3504
|
-
useInput8((
|
|
3504
|
+
useInput8((input2, key) => {
|
|
3505
3505
|
if (key.escape) {
|
|
3506
3506
|
onBack();
|
|
3507
3507
|
return;
|
|
@@ -3633,7 +3633,7 @@ var GuideApp = ({ initialTopic, onExit }) => {
|
|
|
3633
3633
|
setCurrentTopic(TOPIC_MAP[initialTopic]);
|
|
3634
3634
|
}
|
|
3635
3635
|
}, [initialTopic]);
|
|
3636
|
-
useInput9((
|
|
3636
|
+
useInput9((input2, key) => {
|
|
3637
3637
|
if (key.escape || currentTopic !== "menu" && key.backspace) {
|
|
3638
3638
|
if (currentTopic === "menu") {
|
|
3639
3639
|
onExit();
|
|
@@ -3643,7 +3643,7 @@ var GuideApp = ({ initialTopic, onExit }) => {
|
|
|
3643
3643
|
}
|
|
3644
3644
|
return;
|
|
3645
3645
|
}
|
|
3646
|
-
if (
|
|
3646
|
+
if (input2 === "q") {
|
|
3647
3647
|
onExit();
|
|
3648
3648
|
return;
|
|
3649
3649
|
}
|
|
@@ -4142,7 +4142,7 @@ var ModelSelector = ({
|
|
|
4142
4142
|
const allowedModels = models.filter((m) => m.allowed);
|
|
4143
4143
|
const currentIndex = allowedModels.findIndex((m) => m.id === currentModel);
|
|
4144
4144
|
const [selectedIndex, setSelectedIndex] = useState12(Math.max(0, currentIndex));
|
|
4145
|
-
useInput10((
|
|
4145
|
+
useInput10((input2, key) => {
|
|
4146
4146
|
if (key.escape) {
|
|
4147
4147
|
onCancel();
|
|
4148
4148
|
return;
|
|
@@ -4268,7 +4268,7 @@ var ChatApp = ({ service, initialModel }) => {
|
|
|
4268
4268
|
}
|
|
4269
4269
|
return false;
|
|
4270
4270
|
}, [refetch, exit]);
|
|
4271
|
-
useInput11((
|
|
4271
|
+
useInput11((input2, key) => {
|
|
4272
4272
|
if (showSlashMenu) {
|
|
4273
4273
|
if (key.upArrow) {
|
|
4274
4274
|
setSlashMenuIndex((i) => Math.max(0, i - 1));
|
|
@@ -4296,7 +4296,7 @@ var ChatApp = ({ service, initialModel }) => {
|
|
|
4296
4296
|
}
|
|
4297
4297
|
return;
|
|
4298
4298
|
}
|
|
4299
|
-
if (currentView === "error" && (key.return ||
|
|
4299
|
+
if (currentView === "error" && (key.return || input2 === "r")) {
|
|
4300
4300
|
setCurrentView("loading");
|
|
4301
4301
|
refetch();
|
|
4302
4302
|
return;
|
|
@@ -4551,9 +4551,9 @@ var TranslationService = class {
|
|
|
4551
4551
|
/**
|
|
4552
4552
|
* Detect input type
|
|
4553
4553
|
*/
|
|
4554
|
-
async detectInputType(
|
|
4554
|
+
async detectInputType(input2) {
|
|
4555
4555
|
try {
|
|
4556
|
-
const stat = await fs7.stat(
|
|
4556
|
+
const stat = await fs7.stat(input2);
|
|
4557
4557
|
if (stat.isDirectory()) return "folder";
|
|
4558
4558
|
if (stat.isFile()) return "file";
|
|
4559
4559
|
} catch {
|
|
@@ -4785,7 +4785,7 @@ Return ONLY the translated content, no explanations.`;
|
|
|
4785
4785
|
};
|
|
4786
4786
|
|
|
4787
4787
|
// src/commands/translate.ts
|
|
4788
|
-
async function handleTranslate(
|
|
4788
|
+
async function handleTranslate(input2, options) {
|
|
4789
4789
|
const configService = new ConfigService();
|
|
4790
4790
|
const config = await configService.load();
|
|
4791
4791
|
if (!config) {
|
|
@@ -4793,16 +4793,16 @@ async function handleTranslate(input, options) {
|
|
|
4793
4793
|
}
|
|
4794
4794
|
const llmService = new LlmProxyService(config);
|
|
4795
4795
|
const translationService = new TranslationService(llmService, options, options.model);
|
|
4796
|
-
const inputType = await translationService.detectInputType(
|
|
4796
|
+
const inputType = await translationService.detectInputType(input2);
|
|
4797
4797
|
switch (inputType) {
|
|
4798
4798
|
case "text":
|
|
4799
|
-
await handleTextTranslation(translationService,
|
|
4799
|
+
await handleTextTranslation(translationService, input2, options);
|
|
4800
4800
|
break;
|
|
4801
4801
|
case "file":
|
|
4802
|
-
await handleFileTranslation(translationService,
|
|
4802
|
+
await handleFileTranslation(translationService, input2, options);
|
|
4803
4803
|
break;
|
|
4804
4804
|
case "folder":
|
|
4805
|
-
await handleFolderTranslation(translationService,
|
|
4805
|
+
await handleFolderTranslation(translationService, input2, options);
|
|
4806
4806
|
break;
|
|
4807
4807
|
}
|
|
4808
4808
|
}
|
|
@@ -4879,8 +4879,8 @@ async function handleFolderTranslation(service, folderPath, options) {
|
|
|
4879
4879
|
}
|
|
4880
4880
|
}
|
|
4881
4881
|
function createTranslateCommand() {
|
|
4882
|
-
const cmd = new Command14("translate").description("D\u1ECBch v\u0103n b\u1EA3n, file ho\u1EB7c th\u01B0 m\u1EE5c b\u1EB1ng AI").argument("<input>", "Chu\u1ED7i v\u0103n b\u1EA3n, \u0111\u01B0\u1EDDng d\u1EABn file ho\u1EB7c th\u01B0 m\u1EE5c").option("--to <language>", "M\xE3 ng\xF4n ng\u1EEF \u0111\xEDch (m\u1EB7c \u0111\u1ECBnh: vi)", "vi").option("-o, --output <path>", "\u0110\u01B0\u1EDDng d\u1EABn output (file/th\u01B0 m\u1EE5c)").option("--dry-run", "Xem tr\u01B0\u1EDBc kh\xF4ng l\u01B0u file").option("--concurrency <number>", "S\u1ED1 file x\u1EED l\xFD song song (m\u1EB7c \u0111\u1ECBnh: 3)", "3").option("--model <model>", "Model LLM (m\u1EB7c \u0111\u1ECBnh: gpt-5.1-codex-mini)").option("--json", "Xu\u1EA5t k\u1EBFt qu\u1EA3 d\u1EA1ng JSON").action(async (
|
|
4883
|
-
await handleTranslate(
|
|
4882
|
+
const cmd = new Command14("translate").description("D\u1ECBch v\u0103n b\u1EA3n, file ho\u1EB7c th\u01B0 m\u1EE5c b\u1EB1ng AI").argument("<input>", "Chu\u1ED7i v\u0103n b\u1EA3n, \u0111\u01B0\u1EDDng d\u1EABn file ho\u1EB7c th\u01B0 m\u1EE5c").option("--to <language>", "M\xE3 ng\xF4n ng\u1EEF \u0111\xEDch (m\u1EB7c \u0111\u1ECBnh: vi)", "vi").option("-o, --output <path>", "\u0110\u01B0\u1EDDng d\u1EABn output (file/th\u01B0 m\u1EE5c)").option("--dry-run", "Xem tr\u01B0\u1EDBc kh\xF4ng l\u01B0u file").option("--concurrency <number>", "S\u1ED1 file x\u1EED l\xFD song song (m\u1EB7c \u0111\u1ECBnh: 3)", "3").option("--model <model>", "Model LLM (m\u1EB7c \u0111\u1ECBnh: gpt-5.1-codex-mini)").option("--json", "Xu\u1EA5t k\u1EBFt qu\u1EA3 d\u1EA1ng JSON").action(async (input2, options) => {
|
|
4883
|
+
await handleTranslate(input2, options);
|
|
4884
4884
|
});
|
|
4885
4885
|
return cmd;
|
|
4886
4886
|
}
|
|
@@ -4940,12 +4940,12 @@ var UtilsService = class {
|
|
|
4940
4940
|
/**
|
|
4941
4941
|
* Hash text or file using specified algorithm
|
|
4942
4942
|
*/
|
|
4943
|
-
async hash(
|
|
4943
|
+
async hash(input2, algorithm) {
|
|
4944
4944
|
if (algorithm === "bcrypt") {
|
|
4945
4945
|
throw new Error("Use hashBcrypt for bcrypt algorithm");
|
|
4946
4946
|
}
|
|
4947
4947
|
const hash = crypto.createHash(algorithm);
|
|
4948
|
-
hash.update(
|
|
4948
|
+
hash.update(input2);
|
|
4949
4949
|
return hash.digest("hex");
|
|
4950
4950
|
}
|
|
4951
4951
|
/**
|
|
@@ -4958,14 +4958,14 @@ var UtilsService = class {
|
|
|
4958
4958
|
/**
|
|
4959
4959
|
* Hash using bcrypt
|
|
4960
4960
|
*/
|
|
4961
|
-
async hashBcrypt(
|
|
4962
|
-
return bcrypt.hash(
|
|
4961
|
+
async hashBcrypt(input2, rounds = 10) {
|
|
4962
|
+
return bcrypt.hash(input2, rounds);
|
|
4963
4963
|
}
|
|
4964
4964
|
/**
|
|
4965
4965
|
* Base64 encode
|
|
4966
4966
|
*/
|
|
4967
|
-
base64Encode(
|
|
4968
|
-
const buffer = typeof
|
|
4967
|
+
base64Encode(input2, urlSafe = false) {
|
|
4968
|
+
const buffer = typeof input2 === "string" ? Buffer.from(input2, "utf-8") : input2;
|
|
4969
4969
|
let encoded = buffer.toString("base64");
|
|
4970
4970
|
if (urlSafe) {
|
|
4971
4971
|
encoded = encoded.replace(/\+/g, "-").replace(/\//g, "_").replace(/=/g, "");
|
|
@@ -4975,8 +4975,8 @@ var UtilsService = class {
|
|
|
4975
4975
|
/**
|
|
4976
4976
|
* Base64 decode
|
|
4977
4977
|
*/
|
|
4978
|
-
base64Decode(
|
|
4979
|
-
let normalized =
|
|
4978
|
+
base64Decode(input2) {
|
|
4979
|
+
let normalized = input2.replace(/-/g, "+").replace(/_/g, "/");
|
|
4980
4980
|
while (normalized.length % 4) {
|
|
4981
4981
|
normalized += "=";
|
|
4982
4982
|
}
|
|
@@ -5105,14 +5105,14 @@ var UtilsService = class {
|
|
|
5105
5105
|
/**
|
|
5106
5106
|
* URL encode
|
|
5107
5107
|
*/
|
|
5108
|
-
urlEncode(
|
|
5109
|
-
return full ? encodeURI(
|
|
5108
|
+
urlEncode(input2, full = false) {
|
|
5109
|
+
return full ? encodeURI(input2) : encodeURIComponent(input2);
|
|
5110
5110
|
}
|
|
5111
5111
|
/**
|
|
5112
5112
|
* URL decode
|
|
5113
5113
|
*/
|
|
5114
|
-
urlDecode(
|
|
5115
|
-
return full ? decodeURI(
|
|
5114
|
+
urlDecode(input2, full = false) {
|
|
5115
|
+
return full ? decodeURI(input2) : decodeURIComponent(input2);
|
|
5116
5116
|
}
|
|
5117
5117
|
/**
|
|
5118
5118
|
* Format bytes to human-readable size
|
|
@@ -5222,7 +5222,7 @@ Examples:
|
|
|
5222
5222
|
|
|
5223
5223
|
// src/commands/utils/hash.ts
|
|
5224
5224
|
import { Command as Command17 } from "commander";
|
|
5225
|
-
async function handleHashGeneration(
|
|
5225
|
+
async function handleHashGeneration(input2, options) {
|
|
5226
5226
|
const service = new UtilsService();
|
|
5227
5227
|
try {
|
|
5228
5228
|
let hash;
|
|
@@ -5233,14 +5233,14 @@ async function handleHashGeneration(input, options) {
|
|
|
5233
5233
|
}
|
|
5234
5234
|
hash = await service.hashFile(options.file, options.algorithm);
|
|
5235
5235
|
} else {
|
|
5236
|
-
if (!
|
|
5236
|
+
if (!input2) {
|
|
5237
5237
|
console.error("\u274C Please provide input text or use --file option");
|
|
5238
5238
|
process.exit(1);
|
|
5239
5239
|
}
|
|
5240
5240
|
if (options.algorithm === "bcrypt") {
|
|
5241
|
-
hash = await service.hashBcrypt(
|
|
5241
|
+
hash = await service.hashBcrypt(input2, options.rounds);
|
|
5242
5242
|
} else {
|
|
5243
|
-
hash = await service.hash(
|
|
5243
|
+
hash = await service.hash(input2, options.algorithm);
|
|
5244
5244
|
}
|
|
5245
5245
|
}
|
|
5246
5246
|
console.log("\u{1F512} Hash Result:");
|
|
@@ -5273,8 +5273,8 @@ Examples:
|
|
|
5273
5273
|
$ jai1 utils hash "password" --algorithm bcrypt --rounds 12
|
|
5274
5274
|
$ jai1 utils hash --file ./myfile.txt
|
|
5275
5275
|
$ jai1 utils hash --file ./image.png --algorithm sha512
|
|
5276
|
-
`).action(async (
|
|
5277
|
-
await handleHashGeneration(
|
|
5276
|
+
`).action(async (input2, options) => {
|
|
5277
|
+
await handleHashGeneration(input2, {
|
|
5278
5278
|
...options,
|
|
5279
5279
|
rounds: parseInt(options.rounds, 10)
|
|
5280
5280
|
});
|
|
@@ -5285,7 +5285,7 @@ Examples:
|
|
|
5285
5285
|
// src/commands/utils/base64-encode.ts
|
|
5286
5286
|
import { Command as Command18 } from "commander";
|
|
5287
5287
|
import { readFile as readFile2 } from "fs/promises";
|
|
5288
|
-
async function handleBase64Encode(
|
|
5288
|
+
async function handleBase64Encode(input2, options) {
|
|
5289
5289
|
const service = new UtilsService();
|
|
5290
5290
|
try {
|
|
5291
5291
|
let encoded;
|
|
@@ -5293,11 +5293,11 @@ async function handleBase64Encode(input, options) {
|
|
|
5293
5293
|
const content = await readFile2(options.file);
|
|
5294
5294
|
encoded = service.base64Encode(content, options.urlSafe);
|
|
5295
5295
|
} else {
|
|
5296
|
-
if (!
|
|
5296
|
+
if (!input2) {
|
|
5297
5297
|
console.error("\u274C Please provide input text or use --file option");
|
|
5298
5298
|
process.exit(1);
|
|
5299
5299
|
}
|
|
5300
|
-
encoded = service.base64Encode(
|
|
5300
|
+
encoded = service.base64Encode(input2, options.urlSafe);
|
|
5301
5301
|
}
|
|
5302
5302
|
console.log("\u{1F4DD} Base64 Encoded:");
|
|
5303
5303
|
console.log("\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500");
|
|
@@ -5322,8 +5322,8 @@ Examples:
|
|
|
5322
5322
|
$ jai1 utils base64-encode "hello world" --url-safe
|
|
5323
5323
|
$ jai1 utils base64-encode --file ./document.txt
|
|
5324
5324
|
$ jai1 utils base64-encode --file ./image.png
|
|
5325
|
-
`).action(async (
|
|
5326
|
-
await handleBase64Encode(
|
|
5325
|
+
`).action(async (input2, options) => {
|
|
5326
|
+
await handleBase64Encode(input2, options);
|
|
5327
5327
|
});
|
|
5328
5328
|
return cmd;
|
|
5329
5329
|
}
|
|
@@ -5331,18 +5331,18 @@ Examples:
|
|
|
5331
5331
|
// src/commands/utils/base64-decode.ts
|
|
5332
5332
|
import { Command as Command19 } from "commander";
|
|
5333
5333
|
import { readFile as readFile3, writeFile } from "fs/promises";
|
|
5334
|
-
async function handleBase64Decode(
|
|
5334
|
+
async function handleBase64Decode(input2, options) {
|
|
5335
5335
|
const service = new UtilsService();
|
|
5336
5336
|
try {
|
|
5337
5337
|
let encodedInput;
|
|
5338
5338
|
if (options.file) {
|
|
5339
5339
|
encodedInput = await readFile3(options.file, "utf-8");
|
|
5340
5340
|
} else {
|
|
5341
|
-
if (!
|
|
5341
|
+
if (!input2) {
|
|
5342
5342
|
console.error("\u274C Please provide Base64 input or use --file option");
|
|
5343
5343
|
process.exit(1);
|
|
5344
5344
|
}
|
|
5345
|
-
encodedInput =
|
|
5345
|
+
encodedInput = input2;
|
|
5346
5346
|
}
|
|
5347
5347
|
const decoded = service.base64Decode(encodedInput.trim());
|
|
5348
5348
|
if (options.output) {
|
|
@@ -5367,8 +5367,8 @@ Examples:
|
|
|
5367
5367
|
$ jai1 utils base64-decode --file ./encoded.txt
|
|
5368
5368
|
$ jai1 utils base64-decode "aGVsbG8=" --output ./decoded.txt
|
|
5369
5369
|
$ jai1 utils base64-decode --file ./encoded.txt --output ./image.png
|
|
5370
|
-
`).action(async (
|
|
5371
|
-
await handleBase64Decode(
|
|
5370
|
+
`).action(async (input2, options) => {
|
|
5371
|
+
await handleBase64Decode(input2, options);
|
|
5372
5372
|
});
|
|
5373
5373
|
return cmd;
|
|
5374
5374
|
}
|
|
@@ -5519,10 +5519,10 @@ Examples:
|
|
|
5519
5519
|
|
|
5520
5520
|
// src/commands/utils/unix-time.ts
|
|
5521
5521
|
import { Command as Command22 } from "commander";
|
|
5522
|
-
async function handleUnixTime(
|
|
5522
|
+
async function handleUnixTime(input2, options) {
|
|
5523
5523
|
const service = new UtilsService();
|
|
5524
5524
|
try {
|
|
5525
|
-
if (!
|
|
5525
|
+
if (!input2) {
|
|
5526
5526
|
const now = /* @__PURE__ */ new Date();
|
|
5527
5527
|
const timestamp = service.dateToUnix(now, options.ms);
|
|
5528
5528
|
console.log("\u{1F552} Current Unix Timestamp:");
|
|
@@ -5532,8 +5532,8 @@ async function handleUnixTime(input, options) {
|
|
|
5532
5532
|
console.log(` ISO: ${now.toISOString()}`);
|
|
5533
5533
|
console.log(` Local: ${now.toLocaleString()}`);
|
|
5534
5534
|
console.log();
|
|
5535
|
-
} else if (/^\d+$/.test(
|
|
5536
|
-
const timestamp = parseInt(
|
|
5535
|
+
} else if (/^\d+$/.test(input2)) {
|
|
5536
|
+
const timestamp = parseInt(input2, 10);
|
|
5537
5537
|
const date = service.unixToDate(timestamp, options.ms);
|
|
5538
5538
|
console.log("\u{1F552} Unix Timestamp to Date:");
|
|
5539
5539
|
console.log("\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500");
|
|
@@ -5546,7 +5546,7 @@ async function handleUnixTime(input, options) {
|
|
|
5546
5546
|
}
|
|
5547
5547
|
console.log();
|
|
5548
5548
|
} else {
|
|
5549
|
-
const date = new Date(
|
|
5549
|
+
const date = new Date(input2);
|
|
5550
5550
|
if (isNaN(date.getTime())) {
|
|
5551
5551
|
console.error("\u274C Invalid date format");
|
|
5552
5552
|
process.exit(1);
|
|
@@ -5554,7 +5554,7 @@ async function handleUnixTime(input, options) {
|
|
|
5554
5554
|
const timestamp = service.dateToUnix(date, options.ms);
|
|
5555
5555
|
console.log("\u{1F552} Date to Unix Timestamp:");
|
|
5556
5556
|
console.log("\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500");
|
|
5557
|
-
console.log(` Input: ${
|
|
5557
|
+
console.log(` Input: ${input2}`);
|
|
5558
5558
|
console.log(` Parsed: ${date.toISOString()}`);
|
|
5559
5559
|
console.log();
|
|
5560
5560
|
console.log(` ${timestamp}${options.ms ? " (ms)" : ""}`);
|
|
@@ -5574,8 +5574,8 @@ Examples:
|
|
|
5574
5574
|
$ jai1 utils unix-time "2024-01-15 10:30:00"
|
|
5575
5575
|
$ jai1 utils unix-time "2024-01-15" --format local
|
|
5576
5576
|
$ jai1 utils unix-time --ms
|
|
5577
|
-
`).action(async (
|
|
5578
|
-
await handleUnixTime(
|
|
5577
|
+
`).action(async (input2, options) => {
|
|
5578
|
+
await handleUnixTime(input2, options);
|
|
5579
5579
|
});
|
|
5580
5580
|
return cmd;
|
|
5581
5581
|
}
|
|
@@ -5632,10 +5632,10 @@ Examples:
|
|
|
5632
5632
|
|
|
5633
5633
|
// src/commands/utils/url-encode.ts
|
|
5634
5634
|
import { Command as Command24 } from "commander";
|
|
5635
|
-
async function handleUrlEncode(
|
|
5635
|
+
async function handleUrlEncode(input2, options) {
|
|
5636
5636
|
const service = new UtilsService();
|
|
5637
5637
|
try {
|
|
5638
|
-
const encoded = service.urlEncode(
|
|
5638
|
+
const encoded = service.urlEncode(input2, options.full);
|
|
5639
5639
|
console.log("\u{1F517} URL Encoded:");
|
|
5640
5640
|
console.log("\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500");
|
|
5641
5641
|
if (options.full) {
|
|
@@ -5658,18 +5658,18 @@ Examples:
|
|
|
5658
5658
|
$ jai1 utils url-encode "hello world & test"
|
|
5659
5659
|
$ jai1 utils url-encode "name=John Doe&age=30"
|
|
5660
5660
|
$ jai1 utils url-encode "https://example.com/path with spaces" --full
|
|
5661
|
-
`).showHelpAfterError("(add --help for additional examples)").action(async (
|
|
5662
|
-
await handleUrlEncode(
|
|
5661
|
+
`).showHelpAfterError("(add --help for additional examples)").action(async (input2, options) => {
|
|
5662
|
+
await handleUrlEncode(input2, options);
|
|
5663
5663
|
});
|
|
5664
5664
|
return cmd;
|
|
5665
5665
|
}
|
|
5666
5666
|
|
|
5667
5667
|
// src/commands/utils/url-decode.ts
|
|
5668
5668
|
import { Command as Command25 } from "commander";
|
|
5669
|
-
async function handleUrlDecode(
|
|
5669
|
+
async function handleUrlDecode(input2, options) {
|
|
5670
5670
|
const service = new UtilsService();
|
|
5671
5671
|
try {
|
|
5672
|
-
const decoded = service.urlDecode(
|
|
5672
|
+
const decoded = service.urlDecode(input2, options.full);
|
|
5673
5673
|
console.log("\u{1F517} URL Decoded:");
|
|
5674
5674
|
console.log("\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500");
|
|
5675
5675
|
if (options.full) {
|
|
@@ -5692,8 +5692,8 @@ Examples:
|
|
|
5692
5692
|
$ jai1 utils url-decode "hello%20world%20%26%20test"
|
|
5693
5693
|
$ jai1 utils url-decode "name%3DJohn%20Doe%26age%3D30"
|
|
5694
5694
|
$ jai1 utils url-decode "https://example.com/path%20with%20spaces" --full
|
|
5695
|
-
`).showHelpAfterError("(add --help for additional examples)").action(async (
|
|
5696
|
-
await handleUrlDecode(
|
|
5695
|
+
`).showHelpAfterError("(add --help for additional examples)").action(async (input2, options) => {
|
|
5696
|
+
await handleUrlDecode(input2, options);
|
|
5697
5697
|
});
|
|
5698
5698
|
return cmd;
|
|
5699
5699
|
}
|
|
@@ -5829,14 +5829,14 @@ var PasswordView = () => {
|
|
|
5829
5829
|
React27.useEffect(() => {
|
|
5830
5830
|
handleGenerate();
|
|
5831
5831
|
}, []);
|
|
5832
|
-
useInput12((
|
|
5832
|
+
useInput12((input2, key) => {
|
|
5833
5833
|
if (key.tab) {
|
|
5834
5834
|
if (focusedField === "length") setFocusedField("count");
|
|
5835
5835
|
else if (focusedField === "count") setFocusedField("generate");
|
|
5836
5836
|
else setFocusedField("length");
|
|
5837
5837
|
} else if (key.return) {
|
|
5838
5838
|
handleGenerate();
|
|
5839
|
-
} else if (
|
|
5839
|
+
} else if (input2 === "c" && passwords.length > 0) {
|
|
5840
5840
|
handleCopy(0);
|
|
5841
5841
|
}
|
|
5842
5842
|
});
|
|
@@ -5919,7 +5919,7 @@ var UuidView = () => {
|
|
|
5919
5919
|
React28.useEffect(() => {
|
|
5920
5920
|
handleGenerate();
|
|
5921
5921
|
}, []);
|
|
5922
|
-
useInput13((
|
|
5922
|
+
useInput13((input2, key) => {
|
|
5923
5923
|
if (key.tab) {
|
|
5924
5924
|
const fields = ["count", "uppercase", "hyphens", "generate"];
|
|
5925
5925
|
const currentIndex = fields.indexOf(focusedField);
|
|
@@ -5932,7 +5932,7 @@ var UuidView = () => {
|
|
|
5932
5932
|
} else {
|
|
5933
5933
|
handleGenerate();
|
|
5934
5934
|
}
|
|
5935
|
-
} else if (
|
|
5935
|
+
} else if (input2 === "c" && uuids.length > 0) {
|
|
5936
5936
|
handleCopy(0);
|
|
5937
5937
|
}
|
|
5938
5938
|
});
|
|
@@ -6007,7 +6007,7 @@ var HashView = () => {
|
|
|
6007
6007
|
React29.useEffect(() => {
|
|
6008
6008
|
handleGenerate();
|
|
6009
6009
|
}, []);
|
|
6010
|
-
useInput14((
|
|
6010
|
+
useInput14((input2, key) => {
|
|
6011
6011
|
if (key.tab) {
|
|
6012
6012
|
const fields = ["text", "algorithm", "generate"];
|
|
6013
6013
|
const currentIndex = fields.indexOf(focusedField);
|
|
@@ -6020,7 +6020,7 @@ var HashView = () => {
|
|
|
6020
6020
|
} else if (key.rightArrow && focusedField === "algorithm") {
|
|
6021
6021
|
const currentIndex = ALGORITHMS.indexOf(algorithm);
|
|
6022
6022
|
setAlgorithm(ALGORITHMS[(currentIndex + 1) % ALGORITHMS.length]);
|
|
6023
|
-
} else if (
|
|
6023
|
+
} else if (input2 === "c" && hash) {
|
|
6024
6024
|
handleCopy();
|
|
6025
6025
|
}
|
|
6026
6026
|
});
|
|
@@ -6086,7 +6086,7 @@ import React30, { useState as useState17 } from "react";
|
|
|
6086
6086
|
import { Box as Box20, Text as Text21, useInput as useInput15 } from "ink";
|
|
6087
6087
|
import TextInput7 from "ink-text-input";
|
|
6088
6088
|
var Base64View = () => {
|
|
6089
|
-
const [
|
|
6089
|
+
const [input2, setInput] = useState17("");
|
|
6090
6090
|
const [mode, setMode] = useState17("encode");
|
|
6091
6091
|
const [urlSafe, setUrlSafe] = useState17(false);
|
|
6092
6092
|
const [result, setResult] = useState17("");
|
|
@@ -6094,7 +6094,7 @@ var Base64View = () => {
|
|
|
6094
6094
|
const [focusedField, setFocusedField] = useState17("input");
|
|
6095
6095
|
const [copied, setCopied] = useState17(false);
|
|
6096
6096
|
const service = new UtilsService();
|
|
6097
|
-
useInput15((
|
|
6097
|
+
useInput15((input3, key) => {
|
|
6098
6098
|
if (key.tab) {
|
|
6099
6099
|
const fields = ["input", "mode", "urlsafe", "convert"];
|
|
6100
6100
|
const currentIndex = fields.indexOf(focusedField);
|
|
@@ -6109,22 +6109,22 @@ var Base64View = () => {
|
|
|
6109
6109
|
} else {
|
|
6110
6110
|
handleConvert();
|
|
6111
6111
|
}
|
|
6112
|
-
} else if (
|
|
6112
|
+
} else if (input3 === "c" && result) {
|
|
6113
6113
|
handleCopy();
|
|
6114
6114
|
}
|
|
6115
6115
|
});
|
|
6116
6116
|
const handleConvert = () => {
|
|
6117
|
-
if (!
|
|
6117
|
+
if (!input2) {
|
|
6118
6118
|
setError("Input cannot be empty");
|
|
6119
6119
|
return;
|
|
6120
6120
|
}
|
|
6121
6121
|
try {
|
|
6122
6122
|
setError("");
|
|
6123
6123
|
if (mode === "encode") {
|
|
6124
|
-
const encoded = service.base64Encode(
|
|
6124
|
+
const encoded = service.base64Encode(input2, urlSafe);
|
|
6125
6125
|
setResult(encoded);
|
|
6126
6126
|
} else {
|
|
6127
|
-
const decoded = service.base64Decode(
|
|
6127
|
+
const decoded = service.base64Decode(input2);
|
|
6128
6128
|
setResult(decoded.toString("utf-8"));
|
|
6129
6129
|
}
|
|
6130
6130
|
setCopied(false);
|
|
@@ -6153,7 +6153,7 @@ var Base64View = () => {
|
|
|
6153
6153
|
marginBottom: 1
|
|
6154
6154
|
},
|
|
6155
6155
|
/* @__PURE__ */ React30.createElement(Text21, { bold: true, color: "yellow", marginBottom: 1 }, "Options:"),
|
|
6156
|
-
/* @__PURE__ */ React30.createElement(Box20, { marginBottom: 1, flexDirection: "column" }, /* @__PURE__ */ React30.createElement(Box20, { marginBottom: 0 }, /* @__PURE__ */ React30.createElement(Text21, { color: focusedField === "input" ? "green" : void 0 }, focusedField === "input" ? "\u25B6 " : " ", "Input text:")), /* @__PURE__ */ React30.createElement(Box20, { marginLeft: 2, width: 60 }, focusedField === "input" ? /* @__PURE__ */ React30.createElement(TextInput7, { value:
|
|
6156
|
+
/* @__PURE__ */ React30.createElement(Box20, { marginBottom: 1, flexDirection: "column" }, /* @__PURE__ */ React30.createElement(Box20, { marginBottom: 0 }, /* @__PURE__ */ React30.createElement(Text21, { color: focusedField === "input" ? "green" : void 0 }, focusedField === "input" ? "\u25B6 " : " ", "Input text:")), /* @__PURE__ */ React30.createElement(Box20, { marginLeft: 2, width: 60 }, focusedField === "input" ? /* @__PURE__ */ React30.createElement(TextInput7, { value: input2, onChange: setInput, placeholder: "Enter text..." }) : /* @__PURE__ */ React30.createElement(Text21, { dimColor: !input2 }, input2 || "(empty)"))),
|
|
6157
6157
|
/* @__PURE__ */ React30.createElement(Box20, { marginBottom: 1 }, /* @__PURE__ */ React30.createElement(Box20, { width: 20 }, /* @__PURE__ */ React30.createElement(Text21, { color: focusedField === "mode" ? "green" : void 0 }, focusedField === "mode" ? "\u25B6 " : " ", "Mode:")), /* @__PURE__ */ React30.createElement(Text21, { bold: true, color: focusedField === "mode" ? "yellow" : void 0 }, mode === "encode" ? "ENCODE" : "DECODE"), focusedField === "mode" && /* @__PURE__ */ React30.createElement(Text21, { dimColor: true }, " (Enter to toggle)")),
|
|
6158
6158
|
mode === "encode" && /* @__PURE__ */ React30.createElement(Box20, { marginBottom: 1 }, /* @__PURE__ */ React30.createElement(Text21, { color: focusedField === "urlsafe" ? "green" : void 0 }, focusedField === "urlsafe" ? "\u25B6 " : " ", "[", urlSafe ? "\u2713" : " ", "] URL-Safe (+ \u2192 -, / \u2192 _)")),
|
|
6159
6159
|
/* @__PURE__ */ React30.createElement(Box20, { marginTop: 1 }, /* @__PURE__ */ React30.createElement(
|
|
@@ -6198,14 +6198,14 @@ import React31, { useState as useState18 } from "react";
|
|
|
6198
6198
|
import { Box as Box21, Text as Text22, useInput as useInput16 } from "ink";
|
|
6199
6199
|
import TextInput8 from "ink-text-input";
|
|
6200
6200
|
var UrlView = () => {
|
|
6201
|
-
const [
|
|
6201
|
+
const [input2, setInput] = useState18("");
|
|
6202
6202
|
const [mode, setMode] = useState18("encode");
|
|
6203
6203
|
const [fullUrl, setFullUrl] = useState18(false);
|
|
6204
6204
|
const [result, setResult] = useState18("");
|
|
6205
6205
|
const [focusedField, setFocusedField] = useState18("input");
|
|
6206
6206
|
const [copied, setCopied] = useState18(false);
|
|
6207
6207
|
const service = new UtilsService();
|
|
6208
|
-
useInput16((
|
|
6208
|
+
useInput16((input3, key) => {
|
|
6209
6209
|
if (key.tab) {
|
|
6210
6210
|
const fields = ["input", "mode", "full", "convert"];
|
|
6211
6211
|
const currentIndex = fields.indexOf(focusedField);
|
|
@@ -6219,17 +6219,17 @@ var UrlView = () => {
|
|
|
6219
6219
|
} else {
|
|
6220
6220
|
handleConvert();
|
|
6221
6221
|
}
|
|
6222
|
-
} else if (
|
|
6222
|
+
} else if (input3 === "c" && result) {
|
|
6223
6223
|
handleCopy();
|
|
6224
6224
|
}
|
|
6225
6225
|
});
|
|
6226
6226
|
const handleConvert = () => {
|
|
6227
|
-
if (!
|
|
6227
|
+
if (!input2) return;
|
|
6228
6228
|
if (mode === "encode") {
|
|
6229
|
-
const encoded = fullUrl ? service.urlEncode(
|
|
6229
|
+
const encoded = fullUrl ? service.urlEncode(input2, true) : service.urlEncode(input2, false);
|
|
6230
6230
|
setResult(encoded);
|
|
6231
6231
|
} else {
|
|
6232
|
-
const decoded = fullUrl ? service.urlDecode(
|
|
6232
|
+
const decoded = fullUrl ? service.urlDecode(input2, true) : service.urlDecode(input2, false);
|
|
6233
6233
|
setResult(decoded);
|
|
6234
6234
|
}
|
|
6235
6235
|
setCopied(false);
|
|
@@ -6254,7 +6254,7 @@ var UrlView = () => {
|
|
|
6254
6254
|
marginBottom: 1
|
|
6255
6255
|
},
|
|
6256
6256
|
/* @__PURE__ */ React31.createElement(Text22, { bold: true, color: "yellow", marginBottom: 1 }, "Options:"),
|
|
6257
|
-
/* @__PURE__ */ React31.createElement(Box21, { marginBottom: 1, flexDirection: "column" }, /* @__PURE__ */ React31.createElement(Box21, { marginBottom: 0 }, /* @__PURE__ */ React31.createElement(Text22, { color: focusedField === "input" ? "green" : void 0 }, focusedField === "input" ? "\u25B6 " : " ", "Input text:")), /* @__PURE__ */ React31.createElement(Box21, { marginLeft: 2, width: 60 }, focusedField === "input" ? /* @__PURE__ */ React31.createElement(TextInput8, { value:
|
|
6257
|
+
/* @__PURE__ */ React31.createElement(Box21, { marginBottom: 1, flexDirection: "column" }, /* @__PURE__ */ React31.createElement(Box21, { marginBottom: 0 }, /* @__PURE__ */ React31.createElement(Text22, { color: focusedField === "input" ? "green" : void 0 }, focusedField === "input" ? "\u25B6 " : " ", "Input text:")), /* @__PURE__ */ React31.createElement(Box21, { marginLeft: 2, width: 60 }, focusedField === "input" ? /* @__PURE__ */ React31.createElement(TextInput8, { value: input2, onChange: setInput, placeholder: "Enter text or URL..." }) : /* @__PURE__ */ React31.createElement(Text22, { dimColor: !input2 }, input2 || "(empty)"))),
|
|
6258
6258
|
/* @__PURE__ */ React31.createElement(Box21, { marginBottom: 1 }, /* @__PURE__ */ React31.createElement(Box21, { width: 20 }, /* @__PURE__ */ React31.createElement(Text22, { color: focusedField === "mode" ? "green" : void 0 }, focusedField === "mode" ? "\u25B6 " : " ", "Mode:")), /* @__PURE__ */ React31.createElement(Text22, { bold: true, color: focusedField === "mode" ? "yellow" : void 0 }, mode === "encode" ? "ENCODE" : "DECODE"), focusedField === "mode" && /* @__PURE__ */ React31.createElement(Text22, { dimColor: true }, " (Enter to toggle)")),
|
|
6259
6259
|
/* @__PURE__ */ React31.createElement(Box21, { marginBottom: 1 }, /* @__PURE__ */ React31.createElement(Text22, { color: focusedField === "full" ? "green" : void 0 }, focusedField === "full" ? "\u25B6 " : " ", "[", fullUrl ? "\u2713" : " ", "] Full URL (encode/decode entire URL)")),
|
|
6260
6260
|
/* @__PURE__ */ React31.createElement(Box21, { marginTop: 1 }, /* @__PURE__ */ React31.createElement(
|
|
@@ -6288,7 +6288,7 @@ import React32, { useState as useState19 } from "react";
|
|
|
6288
6288
|
import { Box as Box22, Text as Text23, useInput as useInput17 } from "ink";
|
|
6289
6289
|
import TextInput9 from "ink-text-input";
|
|
6290
6290
|
var UnixTimeView = () => {
|
|
6291
|
-
const [
|
|
6291
|
+
const [input2, setInput] = useState19("");
|
|
6292
6292
|
const [mode, setMode] = useState19("now");
|
|
6293
6293
|
const [format, setFormat] = useState19("iso");
|
|
6294
6294
|
const [useMs, setUseMs] = useState19(false);
|
|
@@ -6297,7 +6297,7 @@ var UnixTimeView = () => {
|
|
|
6297
6297
|
const [focusedField, setFocusedField] = useState19("mode");
|
|
6298
6298
|
const [copied, setCopied] = useState19(false);
|
|
6299
6299
|
const service = new UtilsService();
|
|
6300
|
-
useInput17((
|
|
6300
|
+
useInput17((input3, key) => {
|
|
6301
6301
|
if (key.tab) {
|
|
6302
6302
|
const fields = mode === "now" ? ["mode", "ms", "convert"] : mode === "to-human" ? ["mode", "input", "format", "convert"] : ["mode", "input", "convert"];
|
|
6303
6303
|
const currentIndex = fields.indexOf(focusedField);
|
|
@@ -6318,7 +6318,7 @@ var UnixTimeView = () => {
|
|
|
6318
6318
|
} else {
|
|
6319
6319
|
handleConvert();
|
|
6320
6320
|
}
|
|
6321
|
-
} else if (
|
|
6321
|
+
} else if (input3 === "c" && result) {
|
|
6322
6322
|
handleCopy();
|
|
6323
6323
|
}
|
|
6324
6324
|
});
|
|
@@ -6329,18 +6329,18 @@ var UnixTimeView = () => {
|
|
|
6329
6329
|
const timestamp = service.unixTimeCurrent(useMs);
|
|
6330
6330
|
setResult(timestamp.toString());
|
|
6331
6331
|
} else if (mode === "to-human") {
|
|
6332
|
-
if (!
|
|
6332
|
+
if (!input2) {
|
|
6333
6333
|
setError("Please enter a timestamp");
|
|
6334
6334
|
return;
|
|
6335
6335
|
}
|
|
6336
|
-
const human = service.unixTimeToHuman(parseInt(
|
|
6336
|
+
const human = service.unixTimeToHuman(parseInt(input2, 10), format);
|
|
6337
6337
|
setResult(human);
|
|
6338
6338
|
} else {
|
|
6339
|
-
if (!
|
|
6339
|
+
if (!input2) {
|
|
6340
6340
|
setError("Please enter a date string");
|
|
6341
6341
|
return;
|
|
6342
6342
|
}
|
|
6343
|
-
const timestamp = service.unixTimeFromString(
|
|
6343
|
+
const timestamp = service.unixTimeFromString(input2);
|
|
6344
6344
|
setResult(timestamp.toString());
|
|
6345
6345
|
}
|
|
6346
6346
|
setCopied(false);
|
|
@@ -6373,11 +6373,11 @@ var UnixTimeView = () => {
|
|
|
6373
6373
|
mode !== "now" && /* @__PURE__ */ React32.createElement(Box22, { marginBottom: 1, flexDirection: "column" }, /* @__PURE__ */ React32.createElement(Box22, { marginBottom: 0 }, /* @__PURE__ */ React32.createElement(Text23, { color: focusedField === "input" ? "green" : void 0 }, focusedField === "input" ? "\u25B6 " : " ", mode === "to-human" ? "Timestamp:" : "Date string:")), /* @__PURE__ */ React32.createElement(Box22, { marginLeft: 2, width: 50 }, focusedField === "input" ? /* @__PURE__ */ React32.createElement(
|
|
6374
6374
|
TextInput9,
|
|
6375
6375
|
{
|
|
6376
|
-
value:
|
|
6376
|
+
value: input2,
|
|
6377
6377
|
onChange: setInput,
|
|
6378
6378
|
placeholder: mode === "to-human" ? "1702550400" : "2024-01-15 10:30:00"
|
|
6379
6379
|
}
|
|
6380
|
-
) : /* @__PURE__ */ React32.createElement(Text23, { dimColor: !
|
|
6380
|
+
) : /* @__PURE__ */ React32.createElement(Text23, { dimColor: !input2 }, input2 || "(empty)"))),
|
|
6381
6381
|
mode === "to-human" && /* @__PURE__ */ React32.createElement(Box22, { marginBottom: 1 }, /* @__PURE__ */ React32.createElement(Box22, { width: 20 }, /* @__PURE__ */ React32.createElement(Text23, { color: focusedField === "format" ? "green" : void 0 }, focusedField === "format" ? "\u25B6 " : " ", "Format:")), /* @__PURE__ */ React32.createElement(Text23, { bold: true, color: focusedField === "format" ? "yellow" : void 0 }, format.toUpperCase()), focusedField === "format" && /* @__PURE__ */ React32.createElement(Text23, { dimColor: true }, " (Enter to cycle)")),
|
|
6382
6382
|
mode === "now" && /* @__PURE__ */ React32.createElement(Box22, { marginBottom: 1 }, /* @__PURE__ */ React32.createElement(Text23, { color: focusedField === "ms" ? "green" : void 0 }, focusedField === "ms" ? "\u25B6 " : " ", "[", useMs ? "\u2713" : " ", "] Milliseconds")),
|
|
6383
6383
|
/* @__PURE__ */ React32.createElement(Box22, { marginTop: 1 }, /* @__PURE__ */ React32.createElement(
|
|
@@ -6431,7 +6431,7 @@ var JwtView = () => {
|
|
|
6431
6431
|
const [focusedField, setFocusedField] = useState20("mode");
|
|
6432
6432
|
const [copied, setCopied] = useState20(false);
|
|
6433
6433
|
const service = new UtilsService();
|
|
6434
|
-
useInput18((
|
|
6434
|
+
useInput18((input2, key) => {
|
|
6435
6435
|
if (key.tab) {
|
|
6436
6436
|
const fields = mode === "decode" ? ["mode", "token", "process"] : ["mode", "payload", "secret", "process"];
|
|
6437
6437
|
const currentIndex = fields.indexOf(focusedField);
|
|
@@ -6444,7 +6444,7 @@ var JwtView = () => {
|
|
|
6444
6444
|
} else {
|
|
6445
6445
|
handleProcess();
|
|
6446
6446
|
}
|
|
6447
|
-
} else if (
|
|
6447
|
+
} else if (input2 === "c" && result.token) {
|
|
6448
6448
|
handleCopy();
|
|
6449
6449
|
}
|
|
6450
6450
|
});
|
|
@@ -6569,12 +6569,12 @@ var CronView = () => {
|
|
|
6569
6569
|
const [focusedField, setFocusedField] = useState21("expression");
|
|
6570
6570
|
const [copied, setCopied] = useState21(false);
|
|
6571
6571
|
const service = new UtilsService();
|
|
6572
|
-
useInput19((
|
|
6572
|
+
useInput19((input2, key) => {
|
|
6573
6573
|
if (key.tab) {
|
|
6574
6574
|
setFocusedField(focusedField === "expression" ? "parse" : "expression");
|
|
6575
6575
|
} else if (key.return) {
|
|
6576
6576
|
handleParse();
|
|
6577
|
-
} else if (
|
|
6577
|
+
} else if (input2 === "c" && result) {
|
|
6578
6578
|
handleCopy();
|
|
6579
6579
|
}
|
|
6580
6580
|
});
|
|
@@ -6675,14 +6675,14 @@ var TimezoneView = () => {
|
|
|
6675
6675
|
const [focusedField, setFocusedField] = useState22("time");
|
|
6676
6676
|
const [copied, setCopied] = useState22(false);
|
|
6677
6677
|
const service = new UtilsService();
|
|
6678
|
-
useInput20((
|
|
6678
|
+
useInput20((input2, key) => {
|
|
6679
6679
|
if (key.tab) {
|
|
6680
6680
|
const fields = ["time", "from", "to", "convert"];
|
|
6681
6681
|
const currentIndex = fields.indexOf(focusedField);
|
|
6682
6682
|
setFocusedField(fields[(currentIndex + 1) % fields.length]);
|
|
6683
6683
|
} else if (key.return) {
|
|
6684
6684
|
handleConvert();
|
|
6685
|
-
} else if (
|
|
6685
|
+
} else if (input2 === "c" && result) {
|
|
6686
6686
|
handleCopy();
|
|
6687
6687
|
}
|
|
6688
6688
|
});
|
|
@@ -6801,7 +6801,7 @@ var HttpView = () => {
|
|
|
6801
6801
|
const [focusedField, setFocusedField] = useState23("url");
|
|
6802
6802
|
const [copied, setCopied] = useState23(false);
|
|
6803
6803
|
const service = new UtilsService();
|
|
6804
|
-
useInput21((
|
|
6804
|
+
useInput21((input2, key) => {
|
|
6805
6805
|
if (loading) return;
|
|
6806
6806
|
if (key.tab) {
|
|
6807
6807
|
const fields = ["url", "method", "headers", "body", "send"];
|
|
@@ -6815,7 +6815,7 @@ var HttpView = () => {
|
|
|
6815
6815
|
setMethod(METHODS[(currentIndex + 1) % METHODS.length]);
|
|
6816
6816
|
} else if (key.return && focusedField === "send") {
|
|
6817
6817
|
handleSend();
|
|
6818
|
-
} else if (
|
|
6818
|
+
} else if (input2 === "c" && response) {
|
|
6819
6819
|
handleCopy();
|
|
6820
6820
|
}
|
|
6821
6821
|
});
|
|
@@ -6946,7 +6946,7 @@ var MarkdownView = () => {
|
|
|
6946
6946
|
const [content, setContent] = useState24("");
|
|
6947
6947
|
const [error, setError] = useState24("");
|
|
6948
6948
|
const [focusedField, setFocusedField] = useState24("file");
|
|
6949
|
-
useInput22((
|
|
6949
|
+
useInput22((input2, key) => {
|
|
6950
6950
|
if (key.tab) {
|
|
6951
6951
|
setFocusedField(focusedField === "file" ? "preview" : "file");
|
|
6952
6952
|
} else if (key.return) {
|
|
@@ -7061,20 +7061,20 @@ var UtilsApp = ({ onExit }) => {
|
|
|
7061
7061
|
const [selectedIndex, setSelectedIndex] = useState25(0);
|
|
7062
7062
|
const [activeView, setActiveView] = useState25(null);
|
|
7063
7063
|
const { exit } = useApp5();
|
|
7064
|
-
useInput23((
|
|
7064
|
+
useInput23((input2, key) => {
|
|
7065
7065
|
if (activeView) {
|
|
7066
7066
|
if (key.escape) {
|
|
7067
7067
|
setActiveView(null);
|
|
7068
7068
|
}
|
|
7069
7069
|
return;
|
|
7070
7070
|
}
|
|
7071
|
-
if (key.upArrow ||
|
|
7071
|
+
if (key.upArrow || input2 === "k") {
|
|
7072
7072
|
setSelectedIndex((prev) => prev > 0 ? prev - 1 : MENU_ITEMS2.length - 1);
|
|
7073
|
-
} else if (key.downArrow ||
|
|
7073
|
+
} else if (key.downArrow || input2 === "j") {
|
|
7074
7074
|
setSelectedIndex((prev) => prev < MENU_ITEMS2.length - 1 ? prev + 1 : 0);
|
|
7075
7075
|
} else if (key.return) {
|
|
7076
7076
|
setActiveView(MENU_ITEMS2[selectedIndex].id);
|
|
7077
|
-
} else if (
|
|
7077
|
+
} else if (input2 === "q" || key.escape) {
|
|
7078
7078
|
onExit();
|
|
7079
7079
|
exit();
|
|
7080
7080
|
}
|
|
@@ -7406,7 +7406,7 @@ Post-Init Commands:`);
|
|
|
7406
7406
|
import { Command as Command31 } from "commander";
|
|
7407
7407
|
import { promises as fs10 } from "fs";
|
|
7408
7408
|
import { join as join5 } from "path";
|
|
7409
|
-
import
|
|
7409
|
+
import { select as select2, input, checkbox as checkbox3 } from "@inquirer/prompts";
|
|
7410
7410
|
import { execa as execa2 } from "execa";
|
|
7411
7411
|
|
|
7412
7412
|
// src/services/hook-executor.service.ts
|
|
@@ -7504,14 +7504,14 @@ function createKitCreateCommand() {
|
|
|
7504
7504
|
console.log("\u{1F4DD} Please provide project details:");
|
|
7505
7505
|
for (const v of kit.config.variables) {
|
|
7506
7506
|
if (v.type === "select" && v.options) {
|
|
7507
|
-
const answer = await
|
|
7507
|
+
const answer = await select2({
|
|
7508
7508
|
message: v.prompt,
|
|
7509
7509
|
choices: v.options.map((opt) => ({ name: opt, value: opt })),
|
|
7510
7510
|
default: v.default
|
|
7511
7511
|
});
|
|
7512
7512
|
variables[v.name] = answer;
|
|
7513
7513
|
} else {
|
|
7514
|
-
const answer = await
|
|
7514
|
+
const answer = await input({
|
|
7515
7515
|
message: v.prompt,
|
|
7516
7516
|
default: v.default
|
|
7517
7517
|
});
|
|
@@ -7561,7 +7561,7 @@ function createKitCreateCommand() {
|
|
|
7561
7561
|
}
|
|
7562
7562
|
} else {
|
|
7563
7563
|
const defaultTargets = kit.config.ide?.defaultTargets || [];
|
|
7564
|
-
const answer = await
|
|
7564
|
+
const answer = await checkbox3({
|
|
7565
7565
|
message: "Ch\u1ECDn IDE \u0111\u1EC3 sync framework:",
|
|
7566
7566
|
choices: ideChoices.map((c) => ({
|
|
7567
7567
|
...c,
|
|
@@ -7790,7 +7790,7 @@ function getInstallCommand(packageManager2) {
|
|
|
7790
7790
|
|
|
7791
7791
|
// src/commands/clean.ts
|
|
7792
7792
|
import { Command as Command34 } from "commander";
|
|
7793
|
-
import { confirm as confirm5, select as
|
|
7793
|
+
import { confirm as confirm5, select as select3 } from "@inquirer/prompts";
|
|
7794
7794
|
import { join as join6 } from "path";
|
|
7795
7795
|
function createCleanCommand() {
|
|
7796
7796
|
return new Command34("clean").description("Clean up backups, cache, and temporary files").option("-y, --yes", "Skip confirmation").option("--backups", "Clean only backup files").option("--all", "Clean all (backups + cache)").action(async (options) => {
|
|
@@ -7854,7 +7854,7 @@ async function handleClean(options) {
|
|
|
7854
7854
|
console.log(` Path: ${target.path}
|
|
7855
7855
|
`);
|
|
7856
7856
|
}
|
|
7857
|
-
const action = await
|
|
7857
|
+
const action = await select3({
|
|
7858
7858
|
message: "What do you want to clean?",
|
|
7859
7859
|
choices: [
|
|
7860
7860
|
...availableTargets.map(({ target, info }) => ({
|
|
@@ -9028,7 +9028,7 @@ function createClearBackupsCommand() {
|
|
|
9028
9028
|
|
|
9029
9029
|
// src/commands/vscode/index.ts
|
|
9030
9030
|
import { Command as Command41 } from "commander";
|
|
9031
|
-
import { checkbox as
|
|
9031
|
+
import { checkbox as checkbox4, confirm as confirm8, select as select4 } from "@inquirer/prompts";
|
|
9032
9032
|
import fs12 from "fs/promises";
|
|
9033
9033
|
import path6 from "path";
|
|
9034
9034
|
import { existsSync as existsSync3 } from "fs";
|
|
@@ -9211,7 +9211,7 @@ async function interactiveMode2() {
|
|
|
9211
9211
|
console.log("\u2502 \u2022 Nh\u1EA5n ENTER \u0111\u1EC3 x\xE1c nh\u1EADn v\xE0 \xE1p d\u1EE5ng \u2502");
|
|
9212
9212
|
console.log("\u2502 \u2022 Nh\u1EA5n Ctrl+C \u0111\u1EC3 h\u1EE7y \u2502");
|
|
9213
9213
|
console.log("\u2570\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u256F\n");
|
|
9214
|
-
const action = await
|
|
9214
|
+
const action = await select4({
|
|
9215
9215
|
message: "B\u1EA1n mu\u1ED1n l\xE0m g\xEC?",
|
|
9216
9216
|
choices: [
|
|
9217
9217
|
{ name: "\u2705 Enable c\xE1c nh\xF3m t\u1ED1i \u01B0u", value: "enable" },
|
|
@@ -9235,7 +9235,7 @@ async function selectGroupsToApply2(action) {
|
|
|
9235
9235
|
value: key
|
|
9236
9236
|
}));
|
|
9237
9237
|
try {
|
|
9238
|
-
const selectedGroups = await
|
|
9238
|
+
const selectedGroups = await checkbox4({
|
|
9239
9239
|
message: `Ch\u1ECDn c\xE1c nh\xF3m \u0111\u1EC3 ${action === "enable" ? "enable" : "disable"} (SPACE \u0111\u1EC3 ch\u1ECDn, ENTER \u0111\u1EC3 x\xE1c nh\u1EADn):`,
|
|
9240
9240
|
choices
|
|
9241
9241
|
});
|
|
@@ -9437,7 +9437,7 @@ async function printStats2() {
|
|
|
9437
9437
|
|
|
9438
9438
|
// src/commands/migrate-ide.ts
|
|
9439
9439
|
import { Command as Command44 } from "commander";
|
|
9440
|
-
import { checkbox as
|
|
9440
|
+
import { checkbox as checkbox5, confirm as confirm9 } from "@inquirer/prompts";
|
|
9441
9441
|
function createMigrateIdeCommand() {
|
|
9442
9442
|
const cmd = new Command44("migrate-ide").description("Migrate .jai1 rules v\xE0 workflows sang IDEs (Cursor, Windsurf, Claude Code, etc.)").option("--ide <ides...>", "Target IDEs (cursor, windsurf, antigravity, claudecode, opencode)").option("--type <types...>", "Content types (rules, workflows, commands)").option("--dry-run", "Preview changes without writing files").action(async (options) => {
|
|
9443
9443
|
await runMigrateIde(options);
|
|
@@ -9467,7 +9467,7 @@ async function runMigrateIde(options) {
|
|
|
9467
9467
|
value: ide
|
|
9468
9468
|
};
|
|
9469
9469
|
});
|
|
9470
|
-
selectedIdes = await
|
|
9470
|
+
selectedIdes = await checkbox5({
|
|
9471
9471
|
message: "Ch\u1ECDn IDE(s) \u0111\u1EC3 migrate (SPACE \u0111\u1EC3 ch\u1ECDn, ENTER \u0111\u1EC3 x\xE1c nh\u1EADn):",
|
|
9472
9472
|
choices: ideChoices
|
|
9473
9473
|
});
|
|
@@ -9486,7 +9486,7 @@ async function runMigrateIde(options) {
|
|
|
9486
9486
|
{ name: `Workflows (${content.workflows.length} files)`, value: "workflows" },
|
|
9487
9487
|
{ name: `Commands (${content.commands.length} files)`, value: "commands" }
|
|
9488
9488
|
];
|
|
9489
|
-
selectedTypes = await
|
|
9489
|
+
selectedTypes = await checkbox5({
|
|
9490
9490
|
message: "Ch\u1ECDn content types \u0111\u1EC3 migrate:",
|
|
9491
9491
|
choices: typeChoices
|
|
9492
9492
|
});
|