@make-u-free/migi 0.1.4 → 0.1.5
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/package.json +1 -1
- package/src/permissions.js +16 -2
package/package.json
CHANGED
package/src/permissions.js
CHANGED
|
@@ -8,15 +8,29 @@ const AUTO_APPROVED = new Set(['read_file', 'list_files', 'search_content'])
|
|
|
8
8
|
* bin/migi.js から readline の question 関数を受け取る
|
|
9
9
|
*/
|
|
10
10
|
export function createPermissionChecker(promptFn) {
|
|
11
|
+
let approveAll = false
|
|
12
|
+
|
|
11
13
|
return async function checkPermission(toolName, args) {
|
|
12
14
|
if (AUTO_APPROVED.has(toolName)) return true
|
|
15
|
+
if (approveAll) {
|
|
16
|
+
console.log(chalk.dim(` [${toolName}] 自動承認`))
|
|
17
|
+
return true
|
|
18
|
+
}
|
|
13
19
|
|
|
14
20
|
console.log(chalk.yellow('\n ⚡ 実行確認'))
|
|
15
21
|
console.log(chalk.dim(` ツール : ${toolName}`))
|
|
16
22
|
if (args.path) console.log(chalk.dim(` パス : ${args.path}`))
|
|
17
23
|
if (args.command) console.log(chalk.dim(` コマンド: ${args.command}`))
|
|
18
24
|
|
|
19
|
-
const answer = await promptFn(chalk.yellow(' 実行しますか? [y/N] '))
|
|
20
|
-
|
|
25
|
+
const answer = await promptFn(chalk.yellow(' 実行しますか? [y/a/N] y=yes a=以降すべてyes N=no > '))
|
|
26
|
+
const input = answer.trim().toLowerCase()
|
|
27
|
+
|
|
28
|
+
if (input === 'a') {
|
|
29
|
+
approveAll = true
|
|
30
|
+
console.log(chalk.green(' 以降の操作をすべて自動承認します。'))
|
|
31
|
+
return true
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
return input === 'y'
|
|
21
35
|
}
|
|
22
36
|
}
|