@polka-codes/cli 0.9.73 → 0.9.74
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/index.js +241 -44
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -37660,7 +37660,7 @@ var {
|
|
|
37660
37660
|
Help
|
|
37661
37661
|
} = import__.default;
|
|
37662
37662
|
// package.json
|
|
37663
|
-
var version = "0.9.
|
|
37663
|
+
var version = "0.9.74";
|
|
37664
37664
|
|
|
37665
37665
|
// src/commands/code.ts
|
|
37666
37666
|
import { readFile as readFile4 } from "node:fs/promises";
|
|
@@ -67138,6 +67138,7 @@ var vertex = createVertex2();
|
|
|
67138
67138
|
// ../../node_modules/@inquirer/core/dist/lib/key.js
|
|
67139
67139
|
var isUpKey = (key, keybindings = []) => key.name === "up" || keybindings.includes("vim") && key.name === "k" || keybindings.includes("emacs") && key.ctrl && key.name === "p";
|
|
67140
67140
|
var isDownKey = (key, keybindings = []) => key.name === "down" || keybindings.includes("vim") && key.name === "j" || keybindings.includes("emacs") && key.ctrl && key.name === "n";
|
|
67141
|
+
var isSpaceKey = (key) => key.name === "space";
|
|
67141
67142
|
var isBackspaceKey = (key) => key.name === "backspace";
|
|
67142
67143
|
var isTabKey = (key) => key.name === "tab";
|
|
67143
67144
|
var isNumberKey = (key) => "1234567890".includes(key.name);
|
|
@@ -68632,6 +68633,179 @@ class Separator {
|
|
|
68632
68633
|
return Boolean(choice && typeof choice === "object" && "type" in choice && choice.type === "separator");
|
|
68633
68634
|
}
|
|
68634
68635
|
}
|
|
68636
|
+
// ../../node_modules/@inquirer/checkbox/dist/index.js
|
|
68637
|
+
import { styleText as styleText3 } from "node:util";
|
|
68638
|
+
var checkboxTheme = {
|
|
68639
|
+
icon: {
|
|
68640
|
+
checked: styleText3("green", dist_default2.circleFilled),
|
|
68641
|
+
unchecked: dist_default2.circle,
|
|
68642
|
+
cursor: dist_default2.pointer
|
|
68643
|
+
},
|
|
68644
|
+
style: {
|
|
68645
|
+
disabledChoice: (text2) => styleText3("dim", `- ${text2}`),
|
|
68646
|
+
renderSelectedChoices: (selectedChoices) => selectedChoices.map((choice) => choice.short).join(", "),
|
|
68647
|
+
description: (text2) => styleText3("cyan", text2),
|
|
68648
|
+
keysHelpTip: (keys) => keys.map(([key, action]) => `${styleText3("bold", key)} ${styleText3("dim", action)}`).join(styleText3("dim", " • "))
|
|
68649
|
+
},
|
|
68650
|
+
keybindings: []
|
|
68651
|
+
};
|
|
68652
|
+
function isSelectable(item) {
|
|
68653
|
+
return !Separator.isSeparator(item) && !item.disabled;
|
|
68654
|
+
}
|
|
68655
|
+
function isChecked(item) {
|
|
68656
|
+
return isSelectable(item) && item.checked;
|
|
68657
|
+
}
|
|
68658
|
+
function toggle(item) {
|
|
68659
|
+
return isSelectable(item) ? { ...item, checked: !item.checked } : item;
|
|
68660
|
+
}
|
|
68661
|
+
function check2(checked) {
|
|
68662
|
+
return function(item) {
|
|
68663
|
+
return isSelectable(item) ? { ...item, checked } : item;
|
|
68664
|
+
};
|
|
68665
|
+
}
|
|
68666
|
+
function normalizeChoices(choices) {
|
|
68667
|
+
return choices.map((choice) => {
|
|
68668
|
+
if (Separator.isSeparator(choice))
|
|
68669
|
+
return choice;
|
|
68670
|
+
if (typeof choice === "string") {
|
|
68671
|
+
return {
|
|
68672
|
+
value: choice,
|
|
68673
|
+
name: choice,
|
|
68674
|
+
short: choice,
|
|
68675
|
+
checkedName: choice,
|
|
68676
|
+
disabled: false,
|
|
68677
|
+
checked: false
|
|
68678
|
+
};
|
|
68679
|
+
}
|
|
68680
|
+
const name17 = choice.name ?? String(choice.value);
|
|
68681
|
+
const normalizedChoice = {
|
|
68682
|
+
value: choice.value,
|
|
68683
|
+
name: name17,
|
|
68684
|
+
short: choice.short ?? name17,
|
|
68685
|
+
checkedName: choice.checkedName ?? name17,
|
|
68686
|
+
disabled: choice.disabled ?? false,
|
|
68687
|
+
checked: choice.checked ?? false
|
|
68688
|
+
};
|
|
68689
|
+
if (choice.description) {
|
|
68690
|
+
normalizedChoice.description = choice.description;
|
|
68691
|
+
}
|
|
68692
|
+
return normalizedChoice;
|
|
68693
|
+
});
|
|
68694
|
+
}
|
|
68695
|
+
var dist_default3 = createPrompt((config3, done) => {
|
|
68696
|
+
const { pageSize = 7, loop = true, required: required2, validate: validate2 = () => true } = config3;
|
|
68697
|
+
const shortcuts = { all: "a", invert: "i", ...config3.shortcuts };
|
|
68698
|
+
const theme = makeTheme(checkboxTheme, config3.theme);
|
|
68699
|
+
const { keybindings } = theme;
|
|
68700
|
+
const [status, setStatus] = useState("idle");
|
|
68701
|
+
const prefix = usePrefix({ status, theme });
|
|
68702
|
+
const [items, setItems] = useState(normalizeChoices(config3.choices));
|
|
68703
|
+
const bounds = useMemo(() => {
|
|
68704
|
+
const first = items.findIndex(isSelectable);
|
|
68705
|
+
const last = items.findLastIndex(isSelectable);
|
|
68706
|
+
if (first === -1) {
|
|
68707
|
+
throw new ValidationError("[checkbox prompt] No selectable choices. All choices are disabled.");
|
|
68708
|
+
}
|
|
68709
|
+
return { first, last };
|
|
68710
|
+
}, [items]);
|
|
68711
|
+
const [active, setActive] = useState(bounds.first);
|
|
68712
|
+
const [errorMsg, setError] = useState();
|
|
68713
|
+
useKeypress(async (key) => {
|
|
68714
|
+
if (isEnterKey(key)) {
|
|
68715
|
+
const selection = items.filter(isChecked);
|
|
68716
|
+
const isValid2 = await validate2([...selection]);
|
|
68717
|
+
if (required2 && !items.some(isChecked)) {
|
|
68718
|
+
setError("At least one choice must be selected");
|
|
68719
|
+
} else if (isValid2 === true) {
|
|
68720
|
+
setStatus("done");
|
|
68721
|
+
done(selection.map((choice) => choice.value));
|
|
68722
|
+
} else {
|
|
68723
|
+
setError(isValid2 || "You must select a valid value");
|
|
68724
|
+
}
|
|
68725
|
+
} else if (isUpKey(key, keybindings) || isDownKey(key, keybindings)) {
|
|
68726
|
+
if (loop || isUpKey(key, keybindings) && active !== bounds.first || isDownKey(key, keybindings) && active !== bounds.last) {
|
|
68727
|
+
const offset = isUpKey(key, keybindings) ? -1 : 1;
|
|
68728
|
+
let next = active;
|
|
68729
|
+
do {
|
|
68730
|
+
next = (next + offset + items.length) % items.length;
|
|
68731
|
+
} while (!isSelectable(items[next]));
|
|
68732
|
+
setActive(next);
|
|
68733
|
+
}
|
|
68734
|
+
} else if (isSpaceKey(key)) {
|
|
68735
|
+
setError(undefined);
|
|
68736
|
+
setItems(items.map((choice, i2) => i2 === active ? toggle(choice) : choice));
|
|
68737
|
+
} else if (key.name === shortcuts.all) {
|
|
68738
|
+
const selectAll = items.some((choice) => isSelectable(choice) && !choice.checked);
|
|
68739
|
+
setItems(items.map(check2(selectAll)));
|
|
68740
|
+
} else if (key.name === shortcuts.invert) {
|
|
68741
|
+
setItems(items.map(toggle));
|
|
68742
|
+
} else if (isNumberKey(key)) {
|
|
68743
|
+
const selectedIndex = Number(key.name) - 1;
|
|
68744
|
+
let selectableIndex = -1;
|
|
68745
|
+
const position = items.findIndex((item) => {
|
|
68746
|
+
if (Separator.isSeparator(item))
|
|
68747
|
+
return false;
|
|
68748
|
+
selectableIndex++;
|
|
68749
|
+
return selectableIndex === selectedIndex;
|
|
68750
|
+
});
|
|
68751
|
+
const selectedItem = items[position];
|
|
68752
|
+
if (selectedItem && isSelectable(selectedItem)) {
|
|
68753
|
+
setActive(position);
|
|
68754
|
+
setItems(items.map((choice, i2) => i2 === position ? toggle(choice) : choice));
|
|
68755
|
+
}
|
|
68756
|
+
}
|
|
68757
|
+
});
|
|
68758
|
+
const message = theme.style.message(config3.message, status);
|
|
68759
|
+
let description;
|
|
68760
|
+
const page = usePagination({
|
|
68761
|
+
items,
|
|
68762
|
+
active,
|
|
68763
|
+
renderItem({ item, isActive }) {
|
|
68764
|
+
if (Separator.isSeparator(item)) {
|
|
68765
|
+
return ` ${item.separator}`;
|
|
68766
|
+
}
|
|
68767
|
+
if (item.disabled) {
|
|
68768
|
+
const disabledLabel = typeof item.disabled === "string" ? item.disabled : "(disabled)";
|
|
68769
|
+
return theme.style.disabledChoice(`${item.name} ${disabledLabel}`);
|
|
68770
|
+
}
|
|
68771
|
+
if (isActive) {
|
|
68772
|
+
description = item.description;
|
|
68773
|
+
}
|
|
68774
|
+
const checkbox = item.checked ? theme.icon.checked : theme.icon.unchecked;
|
|
68775
|
+
const name17 = item.checked ? item.checkedName : item.name;
|
|
68776
|
+
const color = isActive ? theme.style.highlight : (x2) => x2;
|
|
68777
|
+
const cursor = isActive ? theme.icon.cursor : " ";
|
|
68778
|
+
return color(`${cursor}${checkbox} ${name17}`);
|
|
68779
|
+
},
|
|
68780
|
+
pageSize,
|
|
68781
|
+
loop
|
|
68782
|
+
});
|
|
68783
|
+
if (status === "done") {
|
|
68784
|
+
const selection = items.filter(isChecked);
|
|
68785
|
+
const answer = theme.style.answer(theme.style.renderSelectedChoices(selection, items));
|
|
68786
|
+
return [prefix, message, answer].filter(Boolean).join(" ");
|
|
68787
|
+
}
|
|
68788
|
+
const keys = [
|
|
68789
|
+
["↑↓", "navigate"],
|
|
68790
|
+
["space", "select"]
|
|
68791
|
+
];
|
|
68792
|
+
if (shortcuts.all)
|
|
68793
|
+
keys.push([shortcuts.all, "all"]);
|
|
68794
|
+
if (shortcuts.invert)
|
|
68795
|
+
keys.push([shortcuts.invert, "invert"]);
|
|
68796
|
+
keys.push(["⏎", "submit"]);
|
|
68797
|
+
const helpLine = theme.style.keysHelpTip(keys);
|
|
68798
|
+
const lines = [
|
|
68799
|
+
[prefix, message].filter(Boolean).join(" "),
|
|
68800
|
+
page,
|
|
68801
|
+
" ",
|
|
68802
|
+
description ? theme.style.description(description) : "",
|
|
68803
|
+
errorMsg ? theme.style.error(errorMsg) : "",
|
|
68804
|
+
helpLine
|
|
68805
|
+
].filter(Boolean).join(`
|
|
68806
|
+
`).trimEnd();
|
|
68807
|
+
return `${lines}${cursorHide}`;
|
|
68808
|
+
});
|
|
68635
68809
|
// ../../node_modules/@inquirer/confirm/dist/index.js
|
|
68636
68810
|
function getBooleanValue(value, defaultValue) {
|
|
68637
68811
|
let answer = defaultValue !== false;
|
|
@@ -68644,7 +68818,7 @@ function getBooleanValue(value, defaultValue) {
|
|
|
68644
68818
|
function boolToString(value) {
|
|
68645
68819
|
return value ? "Yes" : "No";
|
|
68646
68820
|
}
|
|
68647
|
-
var
|
|
68821
|
+
var dist_default4 = createPrompt((config3, done) => {
|
|
68648
68822
|
const { transformer = boolToString } = config3;
|
|
68649
68823
|
const [status, setStatus] = useState("idle");
|
|
68650
68824
|
const [value, setValue] = useState("");
|
|
@@ -68681,7 +68855,7 @@ var dist_default3 = createPrompt((config3, done) => {
|
|
|
68681
68855
|
var inputTheme = {
|
|
68682
68856
|
validationFailureMode: "keep"
|
|
68683
68857
|
};
|
|
68684
|
-
var
|
|
68858
|
+
var dist_default5 = createPrompt((config3, done) => {
|
|
68685
68859
|
const { prefill = "tab" } = config3;
|
|
68686
68860
|
const theme = makeTheme(inputTheme, config3.theme);
|
|
68687
68861
|
const [status, setStatus] = useState("idle");
|
|
@@ -68762,7 +68936,7 @@ var dist_default4 = createPrompt((config3, done) => {
|
|
|
68762
68936
|
];
|
|
68763
68937
|
});
|
|
68764
68938
|
// ../../node_modules/@inquirer/password/dist/index.js
|
|
68765
|
-
var
|
|
68939
|
+
var dist_default6 = createPrompt((config3, done) => {
|
|
68766
68940
|
const { validate: validate2 = () => true } = config3;
|
|
68767
68941
|
const theme = makeTheme(config3.theme);
|
|
68768
68942
|
const [status, setStatus] = useState("idle");
|
|
@@ -68810,21 +68984,21 @@ var dist_default5 = createPrompt((config3, done) => {
|
|
|
68810
68984
|
return [[prefix, message, config3.mask ? formattedValue : helpTip].join(" "), error46];
|
|
68811
68985
|
});
|
|
68812
68986
|
// ../../node_modules/@inquirer/select/dist/index.js
|
|
68813
|
-
import { styleText as
|
|
68987
|
+
import { styleText as styleText4 } from "node:util";
|
|
68814
68988
|
var selectTheme = {
|
|
68815
68989
|
icon: { cursor: dist_default2.pointer },
|
|
68816
68990
|
style: {
|
|
68817
|
-
disabled: (text2) =>
|
|
68818
|
-
description: (text2) =>
|
|
68819
|
-
keysHelpTip: (keys) => keys.map(([key, action]) => `${
|
|
68991
|
+
disabled: (text2) => styleText4("dim", `- ${text2}`),
|
|
68992
|
+
description: (text2) => styleText4("cyan", text2),
|
|
68993
|
+
keysHelpTip: (keys) => keys.map(([key, action]) => `${styleText4("bold", key)} ${styleText4("dim", action)}`).join(styleText4("dim", " • "))
|
|
68820
68994
|
},
|
|
68821
68995
|
indexMode: "hidden",
|
|
68822
68996
|
keybindings: []
|
|
68823
68997
|
};
|
|
68824
|
-
function
|
|
68998
|
+
function isSelectable2(item) {
|
|
68825
68999
|
return !Separator.isSeparator(item) && !item.disabled;
|
|
68826
69000
|
}
|
|
68827
|
-
function
|
|
69001
|
+
function normalizeChoices2(choices) {
|
|
68828
69002
|
return choices.map((choice) => {
|
|
68829
69003
|
if (Separator.isSeparator(choice))
|
|
68830
69004
|
return choice;
|
|
@@ -68849,7 +69023,7 @@ function normalizeChoices(choices) {
|
|
|
68849
69023
|
return normalizedChoice;
|
|
68850
69024
|
});
|
|
68851
69025
|
}
|
|
68852
|
-
var
|
|
69026
|
+
var dist_default7 = createPrompt((config3, done) => {
|
|
68853
69027
|
const { loop = true, pageSize = 7 } = config3;
|
|
68854
69028
|
const theme = makeTheme(selectTheme, config3.theme);
|
|
68855
69029
|
const { keybindings } = theme;
|
|
@@ -68857,10 +69031,10 @@ var dist_default6 = createPrompt((config3, done) => {
|
|
|
68857
69031
|
const prefix = usePrefix({ status, theme });
|
|
68858
69032
|
const searchTimeoutRef = useRef();
|
|
68859
69033
|
const searchEnabled = !keybindings.includes("vim");
|
|
68860
|
-
const items = useMemo(() =>
|
|
69034
|
+
const items = useMemo(() => normalizeChoices2(config3.choices), [config3.choices]);
|
|
68861
69035
|
const bounds = useMemo(() => {
|
|
68862
|
-
const first = items.findIndex(
|
|
68863
|
-
const last = items.findLastIndex(
|
|
69036
|
+
const first = items.findIndex(isSelectable2);
|
|
69037
|
+
const last = items.findLastIndex(isSelectable2);
|
|
68864
69038
|
if (first === -1) {
|
|
68865
69039
|
throw new ValidationError("[select prompt] No selectable choices. All choices are disabled.");
|
|
68866
69040
|
}
|
|
@@ -68869,7 +69043,7 @@ var dist_default6 = createPrompt((config3, done) => {
|
|
|
68869
69043
|
const defaultItemIndex = useMemo(() => {
|
|
68870
69044
|
if (!("default" in config3))
|
|
68871
69045
|
return -1;
|
|
68872
|
-
return items.findIndex((item) =>
|
|
69046
|
+
return items.findIndex((item) => isSelectable2(item) && item.value === config3.default);
|
|
68873
69047
|
}, [config3.default, items]);
|
|
68874
69048
|
const [active, setActive] = useState(defaultItemIndex === -1 ? bounds.first : defaultItemIndex);
|
|
68875
69049
|
const selectedChoice = items[active];
|
|
@@ -68885,7 +69059,7 @@ var dist_default6 = createPrompt((config3, done) => {
|
|
|
68885
69059
|
let next = active;
|
|
68886
69060
|
do {
|
|
68887
69061
|
next = (next + offset + items.length) % items.length;
|
|
68888
|
-
} while (!
|
|
69062
|
+
} while (!isSelectable2(items[next]));
|
|
68889
69063
|
setActive(next);
|
|
68890
69064
|
}
|
|
68891
69065
|
} else if (isNumberKey(key) && !Number.isNaN(Number(rl.line))) {
|
|
@@ -68898,7 +69072,7 @@ var dist_default6 = createPrompt((config3, done) => {
|
|
|
68898
69072
|
return selectableIndex === selectedIndex;
|
|
68899
69073
|
});
|
|
68900
69074
|
const item = items[position];
|
|
68901
|
-
if (item != null &&
|
|
69075
|
+
if (item != null && isSelectable2(item)) {
|
|
68902
69076
|
setActive(position);
|
|
68903
69077
|
}
|
|
68904
69078
|
searchTimeoutRef.current = setTimeout(() => {
|
|
@@ -68909,7 +69083,7 @@ var dist_default6 = createPrompt((config3, done) => {
|
|
|
68909
69083
|
} else if (searchEnabled) {
|
|
68910
69084
|
const searchTerm = rl.line.toLowerCase();
|
|
68911
69085
|
const matchIndex = items.findIndex((item) => {
|
|
68912
|
-
if (Separator.isSeparator(item) || !
|
|
69086
|
+
if (Separator.isSeparator(item) || !isSelectable2(item))
|
|
68913
69087
|
return false;
|
|
68914
69088
|
return item.name.toLowerCase().startsWith(searchTerm);
|
|
68915
69089
|
});
|
|
@@ -69384,16 +69558,16 @@ ${content}`;
|
|
|
69384
69558
|
},
|
|
69385
69559
|
askFollowupQuestion: async (question, answerOptions) => {
|
|
69386
69560
|
if (answerOptions.length === 0) {
|
|
69387
|
-
return await
|
|
69561
|
+
return await dist_default5({ message: question });
|
|
69388
69562
|
}
|
|
69389
69563
|
const otherMessage = "Other (enter text)";
|
|
69390
69564
|
answerOptions.push(otherMessage);
|
|
69391
|
-
const answer = await
|
|
69565
|
+
const answer = await dist_default7({
|
|
69392
69566
|
message: question,
|
|
69393
69567
|
choices: answerOptions.map((option) => ({ name: option, value: option }))
|
|
69394
69568
|
});
|
|
69395
69569
|
if (answer === otherMessage) {
|
|
69396
|
-
return await
|
|
69570
|
+
return await dist_default5({ message: "Enter your answer:" });
|
|
69397
69571
|
}
|
|
69398
69572
|
return answer;
|
|
69399
69573
|
},
|
|
@@ -84086,7 +84260,7 @@ function applyCacheControl(messages, provider3, modelId) {
|
|
|
84086
84260
|
async function getUserInput(message, options = {}) {
|
|
84087
84261
|
const { default: defaultValue, throwOnCancel = false } = options;
|
|
84088
84262
|
try {
|
|
84089
|
-
let result = await
|
|
84263
|
+
let result = await dist_default5({
|
|
84090
84264
|
message: `${message}${source_default.gray(" (type .m for multiline)")}`,
|
|
84091
84265
|
default: defaultValue
|
|
84092
84266
|
});
|
|
@@ -84460,7 +84634,7 @@ async function confirm(input, context) {
|
|
|
84460
84634
|
await new Promise((resolve4) => setTimeout(resolve4, 50));
|
|
84461
84635
|
try {
|
|
84462
84636
|
process.stderr.write("\x07");
|
|
84463
|
-
const result = await
|
|
84637
|
+
const result = await dist_default4({ message: input.message });
|
|
84464
84638
|
return result;
|
|
84465
84639
|
} catch (_e) {
|
|
84466
84640
|
throw new UserCancelledError;
|
|
@@ -84487,7 +84661,7 @@ async function select(input2, context) {
|
|
|
84487
84661
|
await new Promise((resolve4) => setTimeout(resolve4, 50));
|
|
84488
84662
|
try {
|
|
84489
84663
|
process.stderr.write("\x07");
|
|
84490
|
-
const result = await
|
|
84664
|
+
const result = await dist_default7({ message: input2.message, choices: input2.choices });
|
|
84491
84665
|
return result;
|
|
84492
84666
|
} catch (_e) {
|
|
84493
84667
|
throw new UserCancelledError;
|
|
@@ -85806,14 +85980,14 @@ var fixWorkflow = async (input2, context) => {
|
|
|
85806
85980
|
let formatCommand;
|
|
85807
85981
|
if (!command) {
|
|
85808
85982
|
const config4 = await loadConfig();
|
|
85809
|
-
const
|
|
85983
|
+
const check3 = config4?.scripts?.check;
|
|
85810
85984
|
const test = config4?.scripts?.test;
|
|
85811
85985
|
const format = config4?.scripts?.format;
|
|
85812
85986
|
let checkCommand;
|
|
85813
|
-
if (typeof
|
|
85814
|
-
checkCommand =
|
|
85815
|
-
} else if (
|
|
85816
|
-
checkCommand =
|
|
85987
|
+
if (typeof check3 === "string") {
|
|
85988
|
+
checkCommand = check3;
|
|
85989
|
+
} else if (check3) {
|
|
85990
|
+
checkCommand = check3.command;
|
|
85817
85991
|
}
|
|
85818
85992
|
let testCommand;
|
|
85819
85993
|
if (typeof test === "string") {
|
|
@@ -87694,7 +87868,7 @@ var fetchOllamaModels = async () => {
|
|
|
87694
87868
|
}
|
|
87695
87869
|
};
|
|
87696
87870
|
async function configPrompt(existingConfig) {
|
|
87697
|
-
const provider3 = await
|
|
87871
|
+
const provider3 = await dist_default7({
|
|
87698
87872
|
message: "Choose AI Provider:",
|
|
87699
87873
|
choices: Object.entries(AiProvider).map(([key, value]) => ({ name: key, value })),
|
|
87700
87874
|
default: existingConfig?.provider
|
|
@@ -87702,7 +87876,7 @@ async function configPrompt(existingConfig) {
|
|
|
87702
87876
|
let model = existingConfig?.model;
|
|
87703
87877
|
switch (provider3) {
|
|
87704
87878
|
case "anthropic" /* Anthropic */:
|
|
87705
|
-
model = await
|
|
87879
|
+
model = await dist_default7({
|
|
87706
87880
|
message: "Choose Model ID:",
|
|
87707
87881
|
choices: Object.keys(prices_default["anthropic" /* Anthropic */]).map((key) => ({ name: key, value: key })),
|
|
87708
87882
|
default: existingConfig?.model ?? "claude-opus-4-20250514"
|
|
@@ -87712,18 +87886,18 @@ async function configPrompt(existingConfig) {
|
|
|
87712
87886
|
{
|
|
87713
87887
|
const models = await fetchOllamaModels();
|
|
87714
87888
|
if (models && models.length > 0) {
|
|
87715
|
-
model = await
|
|
87889
|
+
model = await dist_default7({
|
|
87716
87890
|
message: "Choose Model ID:",
|
|
87717
87891
|
choices: models.map((model2) => ({ name: model2, value: model2 })),
|
|
87718
87892
|
default: existingConfig?.model
|
|
87719
87893
|
});
|
|
87720
87894
|
} else {
|
|
87721
|
-
model = await
|
|
87895
|
+
model = await dist_default5({ message: "Enter Model ID:" });
|
|
87722
87896
|
}
|
|
87723
87897
|
}
|
|
87724
87898
|
break;
|
|
87725
87899
|
case "deepseek" /* DeepSeek */:
|
|
87726
|
-
model = await
|
|
87900
|
+
model = await dist_default7({
|
|
87727
87901
|
message: "Choose Model ID:",
|
|
87728
87902
|
choices: [
|
|
87729
87903
|
{ name: "deepseek-chat", value: "deepseek-chat" },
|
|
@@ -87733,16 +87907,16 @@ async function configPrompt(existingConfig) {
|
|
|
87733
87907
|
});
|
|
87734
87908
|
break;
|
|
87735
87909
|
case "openrouter" /* OpenRouter */:
|
|
87736
|
-
model = await
|
|
87910
|
+
model = await dist_default5({ message: "Enter Model ID (Visit https://openrouter.ai/models for available models):" });
|
|
87737
87911
|
break;
|
|
87738
87912
|
}
|
|
87739
87913
|
let apiKey;
|
|
87740
87914
|
if (provider3 !== "ollama" /* Ollama */) {
|
|
87741
|
-
apiKey = await
|
|
87915
|
+
apiKey = await dist_default6({ message: "Enter API Key:", mask: "*" });
|
|
87742
87916
|
}
|
|
87743
87917
|
let baseURL;
|
|
87744
87918
|
if (provider3 === "ollama" /* Ollama */) {
|
|
87745
|
-
baseURL = await
|
|
87919
|
+
baseURL = await dist_default5({ message: "Enter Ollama Base URL:", default: "http://localhost:11434" });
|
|
87746
87920
|
}
|
|
87747
87921
|
return { provider: provider3, model, apiKey, baseURL };
|
|
87748
87922
|
}
|
|
@@ -87761,7 +87935,7 @@ var initCommand = new Command("init").description("Initialize polkacodes configu
|
|
|
87761
87935
|
const exists = existsSync2(configPath);
|
|
87762
87936
|
if (exists) {
|
|
87763
87937
|
if (interactive) {
|
|
87764
|
-
const proceed = await
|
|
87938
|
+
const proceed = await dist_default4({
|
|
87765
87939
|
message: `Found existing config at ${configPath}. Do you want to proceed? This will overwrite the existing config.`,
|
|
87766
87940
|
default: false
|
|
87767
87941
|
});
|
|
@@ -87772,7 +87946,7 @@ var initCommand = new Command("init").description("Initialize polkacodes configu
|
|
|
87772
87946
|
}
|
|
87773
87947
|
} else if (!options.global) {
|
|
87774
87948
|
if (interactive) {
|
|
87775
|
-
const location = await
|
|
87949
|
+
const location = await dist_default7({
|
|
87776
87950
|
message: "No config file found. Do you want to create one?",
|
|
87777
87951
|
choices: [
|
|
87778
87952
|
{ name: `Create a global config at ${globalConfigPath}`, value: "global" },
|
|
@@ -87798,7 +87972,7 @@ var initCommand = new Command("init").description("Initialize polkacodes configu
|
|
|
87798
87972
|
if (apiKey && !isGlobal) {
|
|
87799
87973
|
let option = "local";
|
|
87800
87974
|
if (interactive) {
|
|
87801
|
-
option = await
|
|
87975
|
+
option = await dist_default7({
|
|
87802
87976
|
message: "It is not recommended to store API keys in the local config file. How would you like to proceed?",
|
|
87803
87977
|
choices: [
|
|
87804
87978
|
{ name: "Save API key in the local config file", value: "local" },
|
|
@@ -87852,7 +88026,7 @@ var initCommand = new Command("init").description("Initialize polkacodes configu
|
|
|
87852
88026
|
logger.info(`Configuration saved to ${configPath}`);
|
|
87853
88027
|
let shouldAnalyze = false;
|
|
87854
88028
|
if (!isGlobal && interactive) {
|
|
87855
|
-
shouldAnalyze = await
|
|
88029
|
+
shouldAnalyze = await dist_default4({
|
|
87856
88030
|
message: "Would you like to analyze the project to generate recommended configuration?",
|
|
87857
88031
|
default: false
|
|
87858
88032
|
});
|
|
@@ -88014,7 +88188,7 @@ var reviewCommand = new Command("review").description("Review a GitHub pull requ
|
|
|
88014
88188
|
interactive: !yes && !json2
|
|
88015
88189
|
});
|
|
88016
88190
|
if (reviewResult) {
|
|
88017
|
-
|
|
88191
|
+
let formattedReview = formatReviewForConsole(reviewResult);
|
|
88018
88192
|
if (json2) {
|
|
88019
88193
|
console.log(JSON.stringify(reviewResult, null, 2));
|
|
88020
88194
|
} else if (formattedReview) {
|
|
@@ -88027,10 +88201,33 @@ var reviewCommand = new Command("review").description("Review a GitHub pull requ
|
|
|
88027
88201
|
} else if (process.stdin.isTTY && !json2) {
|
|
88028
88202
|
await new Promise((resolve4) => setTimeout(resolve4, 50));
|
|
88029
88203
|
try {
|
|
88030
|
-
|
|
88204
|
+
const answer = await dist_default7({
|
|
88031
88205
|
message: "Do you wish polka-codes to address the review results?",
|
|
88032
|
-
|
|
88206
|
+
choices: [
|
|
88207
|
+
{ name: "No", value: "no" },
|
|
88208
|
+
{ name: "Yes", value: "yes" },
|
|
88209
|
+
{ name: "Select findings", value: "select" }
|
|
88210
|
+
],
|
|
88211
|
+
default: "no"
|
|
88033
88212
|
});
|
|
88213
|
+
if (answer === "yes") {
|
|
88214
|
+
shouldRunTask = true;
|
|
88215
|
+
} else if (answer === "select") {
|
|
88216
|
+
const selectedIndices = await dist_default3({
|
|
88217
|
+
message: "Select findings to address",
|
|
88218
|
+
choices: reviewResult.specificReviews.map((review3, index) => ({
|
|
88219
|
+
name: `${review3.file}:${review3.lines} - ${review3.review.split(`
|
|
88220
|
+
`)[0]}`,
|
|
88221
|
+
value: index,
|
|
88222
|
+
checked: true
|
|
88223
|
+
}))
|
|
88224
|
+
});
|
|
88225
|
+
if (selectedIndices.length > 0) {
|
|
88226
|
+
shouldRunTask = true;
|
|
88227
|
+
reviewResult.specificReviews = reviewResult.specificReviews.filter((_, index) => selectedIndices.includes(index));
|
|
88228
|
+
formattedReview = formatReviewForConsole(reviewResult);
|
|
88229
|
+
}
|
|
88230
|
+
}
|
|
88034
88231
|
} catch (error46) {
|
|
88035
88232
|
if (error46 instanceof Error && error46.name === "ExitPromptError") {
|
|
88036
88233
|
return;
|