koneck 2.25.51 → 2.25.53
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/activity.d.ts +30 -0
- package/dist/activity.d.ts.map +1 -0
- package/dist/activity.js +59 -0
- package/dist/activity.js.map +1 -0
- package/dist/ink-chat.d.ts +8 -0
- package/dist/ink-chat.d.ts.map +1 -1
- package/dist/ink-chat.js +52 -2
- package/dist/ink-chat.js.map +1 -1
- package/dist/key-choice.d.ts +22 -0
- package/dist/key-choice.d.ts.map +1 -0
- package/dist/key-choice.js +110 -0
- package/dist/key-choice.js.map +1 -0
- package/dist/logo.d.ts +16 -3
- package/dist/logo.d.ts.map +1 -1
- package/dist/logo.js +38 -17
- package/dist/logo.js.map +1 -1
- package/dist/workspace-trust.d.ts.map +1 -1
- package/dist/workspace-trust.js +13 -14
- package/dist/workspace-trust.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export interface KeyChoice<T> {
|
|
2
|
+
/** The single character the label advertises. Matched case-insensitively. */
|
|
3
|
+
key: string;
|
|
4
|
+
label: string;
|
|
5
|
+
value: T;
|
|
6
|
+
}
|
|
7
|
+
/** Which choice a keypress selects, or null if it selects nothing. */
|
|
8
|
+
export declare function matchChoiceKey<T>(choices: readonly KeyChoice<T>[], input: string): number | null;
|
|
9
|
+
/** The lines of the list, with the caret on the highlighted row. */
|
|
10
|
+
export declare function renderChoiceLines<T>(choices: readonly KeyChoice<T>[], selected: number, caret?: string): string[];
|
|
11
|
+
/**
|
|
12
|
+
* Asks, and returns the chosen value.
|
|
13
|
+
*
|
|
14
|
+
* Falls back to reading a whole line where there is no terminal to take single keys from. A piped
|
|
15
|
+
* answer of "y" should still work, and refusing to run because stdin is not a tty would make the
|
|
16
|
+
* prompt worse than whatever it is guarding.
|
|
17
|
+
*/
|
|
18
|
+
export declare function askChoice<T>(message: string, choices: readonly KeyChoice<T>[], onCancel: T, io?: {
|
|
19
|
+
input?: NodeJS.ReadStream;
|
|
20
|
+
output?: NodeJS.WriteStream;
|
|
21
|
+
}): Promise<T>;
|
|
22
|
+
//# sourceMappingURL=key-choice.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"key-choice.d.ts","sourceRoot":"","sources":["../src/key-choice.ts"],"names":[],"mappings":"AAiBA,MAAM,WAAW,SAAS,CAAC,CAAC;IAC1B,6EAA6E;IAC7E,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,CAAC,CAAC;CACV;AAED,sEAAsE;AACtE,wBAAgB,cAAc,CAAC,CAAC,EAAE,OAAO,EAAE,SAAS,SAAS,CAAC,CAAC,CAAC,EAAE,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAKhG;AAED,oEAAoE;AACpE,wBAAgB,iBAAiB,CAAC,CAAC,EACjC,OAAO,EAAE,SAAS,SAAS,CAAC,CAAC,CAAC,EAAE,EAChC,QAAQ,EAAE,MAAM,EAChB,KAAK,SAAM,GACV,MAAM,EAAE,CAGV;AAED;;;;;;GAMG;AACH,wBAAsB,SAAS,CAAC,CAAC,EAC/B,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,SAAS,SAAS,CAAC,CAAC,CAAC,EAAE,EAChC,QAAQ,EAAE,CAAC,EACX,EAAE,GAAE;IAAE,KAAK,CAAC,EAAE,MAAM,CAAC,UAAU,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAC,WAAW,CAAA;CAAO,GAClE,OAAO,CAAC,CAAC,CAAC,CA+DZ"}
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import readline from 'readline';
|
|
2
|
+
/**
|
|
3
|
+
* A short prompt answered either by pressing the letter it advertises or by the arrows.
|
|
4
|
+
*
|
|
5
|
+
* The workspace-trust prompt offered "[Y] Allow for this session", "[A] Always allow this
|
|
6
|
+
* workspace", "[N] Cancel" — and then ignored Y, A and N entirely. It was an inquirer select,
|
|
7
|
+
* which understands arrows and enter and has no notion of a shortcut, so the brackets were
|
|
8
|
+
* decoration. Labelling a key that does nothing is worse than offering no key at all: the first
|
|
9
|
+
* thing anybody does is press it.
|
|
10
|
+
*
|
|
11
|
+
* Both work here. The letters are what the labels promise; the arrows are what someone who did
|
|
12
|
+
* not read the labels will reach for.
|
|
13
|
+
*/
|
|
14
|
+
const ESC = String.fromCharCode(27);
|
|
15
|
+
/** Which choice a keypress selects, or null if it selects nothing. */
|
|
16
|
+
export function matchChoiceKey(choices, input) {
|
|
17
|
+
const typed = (input ?? '').trim().toLowerCase();
|
|
18
|
+
if (typed.length !== 1)
|
|
19
|
+
return null;
|
|
20
|
+
const index = choices.findIndex(c => c.key.toLowerCase() === typed);
|
|
21
|
+
return index === -1 ? null : index;
|
|
22
|
+
}
|
|
23
|
+
/** The lines of the list, with the caret on the highlighted row. */
|
|
24
|
+
export function renderChoiceLines(choices, selected, caret = '>') {
|
|
25
|
+
return choices.map((choice, i) => `${i === selected ? caret : ' '.repeat(caret.length)} [${choice.key.toUpperCase()}] ${choice.label}`);
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Asks, and returns the chosen value.
|
|
29
|
+
*
|
|
30
|
+
* Falls back to reading a whole line where there is no terminal to take single keys from. A piped
|
|
31
|
+
* answer of "y" should still work, and refusing to run because stdin is not a tty would make the
|
|
32
|
+
* prompt worse than whatever it is guarding.
|
|
33
|
+
*/
|
|
34
|
+
export async function askChoice(message, choices, onCancel, io = {}) {
|
|
35
|
+
const input = io.input ?? process.stdin;
|
|
36
|
+
const output = io.output ?? process.stdout;
|
|
37
|
+
if (choices.length === 0)
|
|
38
|
+
return onCancel;
|
|
39
|
+
output.write(message + '\n');
|
|
40
|
+
if (!input.isTTY) {
|
|
41
|
+
for (const line of renderChoiceLines(choices, -1))
|
|
42
|
+
output.write(line + '\n');
|
|
43
|
+
const rl = readline.createInterface({ input, output });
|
|
44
|
+
const answer = await new Promise(resolve => rl.question('> ', resolve));
|
|
45
|
+
rl.close();
|
|
46
|
+
const index = matchChoiceKey(choices, answer);
|
|
47
|
+
return index === null ? onCancel : choices[index].value;
|
|
48
|
+
}
|
|
49
|
+
let selected = 0;
|
|
50
|
+
const draw = (first) => {
|
|
51
|
+
// Redrawn in place rather than reprinted, so arrowing through the list does not scroll the
|
|
52
|
+
// question it belongs to off the screen.
|
|
53
|
+
if (!first)
|
|
54
|
+
output.write(`${ESC}[${choices.length}A`);
|
|
55
|
+
for (const line of renderChoiceLines(choices, selected)) {
|
|
56
|
+
output.write(`${ESC}[2K` + line + '\n');
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
draw(true);
|
|
60
|
+
readline.emitKeypressEvents(input);
|
|
61
|
+
const wasRaw = input.isRaw === true;
|
|
62
|
+
const wasPaused = input.isPaused();
|
|
63
|
+
input.setRawMode(true);
|
|
64
|
+
input.resume();
|
|
65
|
+
return new Promise(resolve => {
|
|
66
|
+
const finish = (value, label) => {
|
|
67
|
+
input.off('keypress', onKey);
|
|
68
|
+
// Left as it was found: the chat UI takes stdin next, and a stream left raw or flowing when
|
|
69
|
+
// it was not is exactly what breaks the first keystroke after this prompt.
|
|
70
|
+
input.setRawMode(wasRaw);
|
|
71
|
+
if (wasPaused)
|
|
72
|
+
input.pause();
|
|
73
|
+
output.write(` ${label}\n`);
|
|
74
|
+
resolve(value);
|
|
75
|
+
};
|
|
76
|
+
const onKey = (str, key) => {
|
|
77
|
+
if (key?.ctrl && key.name === 'c') {
|
|
78
|
+
finish(onCancel, 'cancelled');
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
if (key?.name === 'escape') {
|
|
82
|
+
finish(onCancel, 'cancelled');
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
85
|
+
if (key?.name === 'up') {
|
|
86
|
+
selected = (selected - 1 + choices.length) % choices.length;
|
|
87
|
+
draw(false);
|
|
88
|
+
return;
|
|
89
|
+
}
|
|
90
|
+
if (key?.name === 'down') {
|
|
91
|
+
selected = (selected + 1) % choices.length;
|
|
92
|
+
draw(false);
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
95
|
+
if (key?.name === 'return' || key?.name === 'enter') {
|
|
96
|
+
const chosen = choices[selected];
|
|
97
|
+
finish(chosen.value, chosen.label);
|
|
98
|
+
return;
|
|
99
|
+
}
|
|
100
|
+
const index = matchChoiceKey(choices, str);
|
|
101
|
+
if (index !== null) {
|
|
102
|
+
selected = index;
|
|
103
|
+
draw(false);
|
|
104
|
+
finish(choices[index].value, choices[index].label);
|
|
105
|
+
}
|
|
106
|
+
};
|
|
107
|
+
input.on('keypress', onKey);
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
//# sourceMappingURL=key-choice.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"key-choice.js","sourceRoot":"","sources":["../src/key-choice.ts"],"names":[],"mappings":"AAAA,OAAO,QAAQ,MAAM,UAAU,CAAC;AAEhC;;;;;;;;;;;GAWG;AAEH,MAAM,GAAG,GAAG,MAAM,CAAC,YAAY,CAAC,EAAE,CAAC,CAAC;AASpC,sEAAsE;AACtE,MAAM,UAAU,cAAc,CAAI,OAAgC,EAAE,KAAa;IAC/E,MAAM,KAAK,GAAG,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;IACjD,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,IAAI,CAAC;IACpC,MAAM,KAAK,GAAG,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,WAAW,EAAE,KAAK,KAAK,CAAC,CAAC;IACpE,OAAO,KAAK,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC;AACrC,CAAC;AAED,oEAAoE;AACpE,MAAM,UAAU,iBAAiB,CAC/B,OAAgC,EAChC,QAAgB,EAChB,KAA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,CAAE,CAAC,KAAK,EAAE,OAAO,CAAC,KAAK,CAAE,CAAC,KAAK,CAAC,CAAC;YACvD,CAAC;QACH,CAAC,CAAC;QACF,KAAK,CAAC,EAAE,CAAC,UAAU,EAAE,KAAK,CAAC,CAAC;IAC9B,CAAC,CAAC,CAAC;AACL,CAAC"}
|
package/dist/logo.d.ts
CHANGED
|
@@ -10,12 +10,25 @@
|
|
|
10
10
|
* than no logo. Blocks are in the classic code page, so they are the safer half of that set, but
|
|
11
11
|
* anyone forcing ASCII has said what they want.
|
|
12
12
|
*/
|
|
13
|
-
/**
|
|
13
|
+
/**
|
|
14
|
+
* Half-block art, 34 columns by 11 rows.
|
|
15
|
+
*
|
|
16
|
+
* The size is not arbitrary: the mark is 1.51 times wider than it is tall, and half-blocks make
|
|
17
|
+
* each sub-cell roughly square, so 34 columns over 22 half-rows reproduces that. The first attempt
|
|
18
|
+
* was 22 by 7 and the arms of the two K's merged into a single blob with a diamond hole — at that
|
|
19
|
+
* width a diagonal two cells thick has nowhere to go.
|
|
20
|
+
*/
|
|
14
21
|
export declare const LOGO_BLOCKS: readonly string[];
|
|
15
|
-
/**
|
|
22
|
+
/**
|
|
23
|
+
* The same shape in characters every terminal has.
|
|
24
|
+
*
|
|
25
|
+
* Generated from the same pixels rather than transcribed by hand — # for a full cell, " and _ for
|
|
26
|
+
* the halves, which is as near as a plain font gets to a half-block. A hand-drawn version drifts
|
|
27
|
+
* from the mark the moment either is edited.
|
|
28
|
+
*/
|
|
16
29
|
export declare const LOGO_ASCII: readonly string[];
|
|
17
30
|
/** How wide the logo needs the terminal to be before it is worth drawing. */
|
|
18
|
-
export declare const LOGO_MIN_COLUMNS =
|
|
31
|
+
export declare const LOGO_MIN_COLUMNS = 38;
|
|
19
32
|
/**
|
|
20
33
|
* The logo for this terminal, or nothing when it will not fit.
|
|
21
34
|
*
|
package/dist/logo.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logo.d.ts","sourceRoot":"","sources":["../src/logo.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH
|
|
1
|
+
{"version":3,"file":"logo.d.ts","sourceRoot":"","sources":["../src/logo.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH;;;;;;;GAOG;AACH,eAAO,MAAM,WAAW,EAAE,SAAS,MAAM,EAYxC,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,UAAU,EAAE,SAAS,MAAM,EAYvC,CAAC;AAEF,6EAA6E;AAC7E,eAAO,MAAM,gBAAgB,KAAK,CAAC;AAEnC;;;;;GAKG;AACH,wBAAgB,OAAO,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,UAAQ,GAAG,SAAS,MAAM,EAAE,CAGzE"}
|
package/dist/logo.js
CHANGED
|
@@ -10,28 +10,49 @@
|
|
|
10
10
|
* than no logo. Blocks are in the classic code page, so they are the safer half of that set, but
|
|
11
11
|
* anyone forcing ASCII has said what they want.
|
|
12
12
|
*/
|
|
13
|
-
/**
|
|
13
|
+
/**
|
|
14
|
+
* Half-block art, 34 columns by 11 rows.
|
|
15
|
+
*
|
|
16
|
+
* The size is not arbitrary: the mark is 1.51 times wider than it is tall, and half-blocks make
|
|
17
|
+
* each sub-cell roughly square, so 34 columns over 22 half-rows reproduces that. The first attempt
|
|
18
|
+
* was 22 by 7 and the arms of the two K's merged into a single blob with a diamond hole — at that
|
|
19
|
+
* width a diagonal two cells thick has nowhere to go.
|
|
20
|
+
*/
|
|
14
21
|
export const LOGO_BLOCKS = [
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
+
" ▄ ▄",
|
|
23
|
+
" ▄██ ██▄",
|
|
24
|
+
"▄▄▄▄▄ ▄████ ████▄ ▄▄▄▄▄",
|
|
25
|
+
"█████ ▄████▀ ▀████▄ █████",
|
|
26
|
+
"█████ ▄▄████▀ ▀████▄▄ █████",
|
|
27
|
+
"███████████ ███████████",
|
|
28
|
+
"██████▀▀████▄ ▄████▀▀██████",
|
|
29
|
+
"█████ ▀█████ █████▀ █████",
|
|
30
|
+
"████▀ ▀████ ████▀ ▀████",
|
|
31
|
+
" ▀██ ██▀",
|
|
32
|
+
" ▀ ▀",
|
|
22
33
|
];
|
|
23
|
-
/**
|
|
34
|
+
/**
|
|
35
|
+
* The same shape in characters every terminal has.
|
|
36
|
+
*
|
|
37
|
+
* Generated from the same pixels rather than transcribed by hand — # for a full cell, " and _ for
|
|
38
|
+
* the halves, which is as near as a plain font gets to a half-block. A hand-drawn version drifts
|
|
39
|
+
* from the mark the moment either is edited.
|
|
40
|
+
*/
|
|
24
41
|
export const LOGO_ASCII = [
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
42
|
+
" _ _",
|
|
43
|
+
" _## ##_",
|
|
44
|
+
"_____ _#### ####_ _____",
|
|
45
|
+
"##### _####\" \"####_ #####",
|
|
46
|
+
"##### __####\" \"####__ #####",
|
|
47
|
+
"########### ###########",
|
|
48
|
+
"######\"\"####_ _####\"\"######",
|
|
49
|
+
"##### \"##### #####\" #####",
|
|
50
|
+
"####\" \"#### ####\" \"####",
|
|
51
|
+
" \"## ##\"",
|
|
52
|
+
" \" \"",
|
|
32
53
|
];
|
|
33
54
|
/** How wide the logo needs the terminal to be before it is worth drawing. */
|
|
34
|
-
export const LOGO_MIN_COLUMNS =
|
|
55
|
+
export const LOGO_MIN_COLUMNS = 38;
|
|
35
56
|
/**
|
|
36
57
|
* The logo for this terminal, or nothing when it will not fit.
|
|
37
58
|
*
|
package/dist/logo.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logo.js","sourceRoot":"","sources":["../src/logo.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH
|
|
1
|
+
{"version":3,"file":"logo.js","sourceRoot":"","sources":["../src/logo.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,WAAW,GAAsB;IAC5C,qBAAqB;IACrB,uBAAuB;IACvB,oCAAoC;IACpC,oCAAoC;IACpC,oCAAoC;IACpC,oCAAoC;IACpC,oCAAoC;IACpC,oCAAoC;IACpC,oCAAoC;IACpC,uBAAuB;IACvB,qBAAqB;CACtB,CAAC;AAEF;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,UAAU,GAAsB;IAC3C,qBAAqB;IACrB,uBAAuB;IACvB,oCAAoC;IACpC,sCAAsC;IACtC,sCAAsC;IACtC,oCAAoC;IACpC,wCAAwC;IACxC,sCAAsC;IACtC,wCAAwC;IACxC,yBAAyB;IACzB,uBAAuB;CACxB,CAAC;AAEF,6EAA6E;AAC7E,MAAM,CAAC,MAAM,gBAAgB,GAAG,EAAE,CAAC;AAEnC;;;;;GAKG;AACH,MAAM,UAAU,OAAO,CAAC,OAAe,EAAE,KAAK,GAAG,KAAK;IACpD,IAAI,OAAO,GAAG,gBAAgB;QAAE,OAAO,EAAE,CAAC;IAC1C,OAAO,KAAK,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,WAAW,CAAC;AAC1C,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"workspace-trust.d.ts","sourceRoot":"","sources":["../src/workspace-trust.ts"],"names":[],"mappings":"AA6BA,wBAAsB,kBAAkB,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAGrF;AAED,wBAAsB,cAAc,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAO9E;AAED;;;GAGG;AACH,wBAAsB,qBAAqB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,
|
|
1
|
+
{"version":3,"file":"workspace-trust.d.ts","sourceRoot":"","sources":["../src/workspace-trust.ts"],"names":[],"mappings":"AA6BA,wBAAsB,kBAAkB,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAGrF;AAED,wBAAsB,cAAc,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAO9E;AAED;;;GAGG;AACH,wBAAsB,qBAAqB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAqBzE"}
|
package/dist/workspace-trust.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import fs from 'fs/promises';
|
|
2
2
|
import os from 'os';
|
|
3
3
|
import path from 'path';
|
|
4
|
-
import {
|
|
4
|
+
import { askChoice } from './key-choice.js';
|
|
5
5
|
import chalk from 'chalk';
|
|
6
6
|
const cyan = chalk.hex('#54D7E7');
|
|
7
7
|
const muted = chalk.hex('#A7B7BE');
|
|
@@ -40,19 +40,18 @@ export async function requestWorkspaceTrust(cwd) {
|
|
|
40
40
|
if (await isWorkspaceTrusted(cwd))
|
|
41
41
|
return true;
|
|
42
42
|
const workspace = path.resolve(cwd);
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
});
|
|
43
|
+
// Asked with a prompt that honours the letters it prints. This used to be an inquirer select,
|
|
44
|
+
// which understands arrows and enter and nothing else, so Y, A and N were decoration — and
|
|
45
|
+
// pressing the key the label advertises is the first thing anybody tries.
|
|
46
|
+
const choice = await askChoice(cyan('╭─ [GRANT PERMISSION] ') +
|
|
47
|
+
chalk.white('Allow KONECK access to ') +
|
|
48
|
+
chalk.white.bold(workspace) +
|
|
49
|
+
chalk.white('?') + '\n' +
|
|
50
|
+
cyan('╰─ ') + muted('press a letter, or the arrows and enter'), [
|
|
51
|
+
{ key: 'y', label: chalk.white('Allow for this session'), value: 'once' },
|
|
52
|
+
{ key: 'a', label: chalk.white('Always allow this workspace'), value: 'always' },
|
|
53
|
+
{ key: 'n', label: muted('Cancel'), value: 'exit' },
|
|
54
|
+
], 'exit');
|
|
56
55
|
if (choice === 'always')
|
|
57
56
|
await trustWorkspace(cwd);
|
|
58
57
|
return choice !== 'exit';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"workspace-trust.js","sourceRoot":"","sources":["../src/workspace-trust.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,aAAa,CAAC;AAC7B,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"workspace-trust.js","sourceRoot":"","sources":["../src/workspace-trust.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,aAAa,CAAC;AAC7B,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,MAAM,IAAI,GAAG,KAAK,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;AAClC,MAAM,KAAK,GAAG,KAAK,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;AAOnC,SAAS,SAAS,CAAC,IAAI,GAAG,EAAE,CAAC,OAAO,EAAE;IACpC,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,SAAS,EAAE,yBAAyB,CAAC,CAAC;AAC/D,CAAC;AAED,KAAK,UAAU,cAAc,CAAC,IAAa;IACzC,IAAI,CAAC;QACH,MAAM,GAAG,GAAG,MAAM,EAAE,CAAC,QAAQ,CAAC,SAAS,CAAC,IAAI,CAAC,EAA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