@aigne/afs-cli 1.11.0-beta.6 → 1.11.0-beta.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.cjs +27 -353
- package/dist/cli.d.cts +2 -1
- package/dist/cli.d.mts +2 -1
- package/dist/cli.mjs +28 -353
- package/dist/cli.mjs.map +1 -1
- package/dist/config/afs-loader.cjs +123 -0
- package/dist/config/afs-loader.d.cts +14 -0
- package/dist/config/afs-loader.d.cts.map +1 -0
- package/dist/config/afs-loader.d.mts +14 -0
- package/dist/config/afs-loader.d.mts.map +1 -0
- package/dist/config/afs-loader.mjs +122 -0
- package/dist/config/afs-loader.mjs.map +1 -0
- package/dist/config/loader.cjs +2 -2
- package/dist/config/loader.mjs +2 -2
- package/dist/{commands/mount.cjs → config/mount-commands.cjs} +13 -49
- package/dist/config/mount-commands.d.cts +20 -0
- package/dist/config/mount-commands.d.cts.map +1 -0
- package/dist/config/mount-commands.d.mts +20 -0
- package/dist/config/mount-commands.d.mts.map +1 -0
- package/dist/{commands/mount.mjs → config/mount-commands.mjs} +14 -49
- package/dist/config/mount-commands.mjs.map +1 -0
- package/dist/config/schema.cjs +9 -1
- package/dist/config/schema.mjs +9 -1
- package/dist/config/schema.mjs.map +1 -1
- package/dist/core/commands/delete.cjs +41 -0
- package/dist/core/commands/delete.d.cts +18 -0
- package/dist/core/commands/delete.d.cts.map +1 -0
- package/dist/core/commands/delete.d.mts +18 -0
- package/dist/core/commands/delete.d.mts.map +1 -0
- package/dist/core/commands/delete.mjs +42 -0
- package/dist/core/commands/delete.mjs.map +1 -0
- package/dist/core/commands/exec.cjs +95 -0
- package/dist/core/commands/exec.d.cts +26 -0
- package/dist/core/commands/exec.d.cts.map +1 -0
- package/dist/core/commands/exec.d.mts +26 -0
- package/dist/core/commands/exec.d.mts.map +1 -0
- package/dist/core/commands/exec.mjs +96 -0
- package/dist/core/commands/exec.mjs.map +1 -0
- package/dist/core/commands/explain.cjs +254 -0
- package/dist/core/commands/explain.d.cts +25 -0
- package/dist/core/commands/explain.d.cts.map +1 -0
- package/dist/core/commands/explain.d.mts +25 -0
- package/dist/core/commands/explain.d.mts.map +1 -0
- package/dist/core/commands/explain.mjs +255 -0
- package/dist/core/commands/explain.mjs.map +1 -0
- package/dist/core/commands/explore.cjs +30 -0
- package/dist/core/commands/explore.d.mts +2 -0
- package/dist/core/commands/explore.mjs +31 -0
- package/dist/core/commands/explore.mjs.map +1 -0
- package/dist/core/commands/index.cjs +36 -0
- package/dist/core/commands/index.d.cts +21 -0
- package/dist/core/commands/index.d.cts.map +1 -0
- package/dist/core/commands/index.d.mts +24 -0
- package/dist/core/commands/index.d.mts.map +1 -0
- package/dist/core/commands/index.mjs +37 -0
- package/dist/core/commands/index.mjs.map +1 -0
- package/dist/core/commands/ls.cjs +57 -0
- package/dist/core/commands/ls.d.cts +21 -0
- package/dist/core/commands/ls.d.cts.map +1 -0
- package/dist/core/commands/ls.d.mts +21 -0
- package/dist/core/commands/ls.d.mts.map +1 -0
- package/dist/core/commands/ls.mjs +58 -0
- package/dist/core/commands/ls.mjs.map +1 -0
- package/dist/core/commands/mount.cjs +139 -0
- package/dist/core/commands/mount.d.cts +33 -0
- package/dist/core/commands/mount.d.cts.map +1 -0
- package/dist/core/commands/mount.d.mts +33 -0
- package/dist/core/commands/mount.d.mts.map +1 -0
- package/dist/core/commands/mount.mjs +140 -0
- package/dist/core/commands/mount.mjs.map +1 -0
- package/dist/core/commands/read.cjs +48 -0
- package/dist/core/commands/read.d.cts +17 -0
- package/dist/core/commands/read.d.cts.map +1 -0
- package/dist/core/commands/read.d.mts +17 -0
- package/dist/core/commands/read.d.mts.map +1 -0
- package/dist/core/commands/read.mjs +49 -0
- package/dist/core/commands/read.mjs.map +1 -0
- package/dist/core/commands/search.cjs +40 -0
- package/dist/core/commands/search.d.mts +2 -0
- package/dist/core/commands/search.mjs +41 -0
- package/dist/core/commands/search.mjs.map +1 -0
- package/dist/core/commands/serve.cjs +242 -0
- package/dist/core/commands/serve.d.mts +2 -0
- package/dist/core/commands/serve.mjs +242 -0
- package/dist/core/commands/serve.mjs.map +1 -0
- package/dist/core/commands/stat.cjs +53 -0
- package/dist/core/commands/stat.d.cts +17 -0
- package/dist/core/commands/stat.d.cts.map +1 -0
- package/dist/core/commands/stat.d.mts +17 -0
- package/dist/core/commands/stat.d.mts.map +1 -0
- package/dist/core/commands/stat.mjs +54 -0
- package/dist/core/commands/stat.mjs.map +1 -0
- package/dist/core/commands/types.cjs +13 -0
- package/dist/core/commands/types.d.cts +54 -0
- package/dist/core/commands/types.d.cts.map +1 -0
- package/dist/core/commands/types.d.mts +54 -0
- package/dist/core/commands/types.d.mts.map +1 -0
- package/dist/core/commands/types.mjs +14 -0
- package/dist/core/commands/types.mjs.map +1 -0
- package/dist/core/commands/write.cjs +70 -0
- package/dist/core/commands/write.d.cts +20 -0
- package/dist/core/commands/write.d.cts.map +1 -0
- package/dist/core/commands/write.d.mts +20 -0
- package/dist/core/commands/write.d.mts.map +1 -0
- package/dist/core/commands/write.mjs +71 -0
- package/dist/core/commands/write.mjs.map +1 -0
- package/dist/core/executor/index.cjs +196 -0
- package/dist/core/executor/index.d.cts +77 -0
- package/dist/core/executor/index.d.cts.map +1 -0
- package/dist/core/executor/index.d.mts +77 -0
- package/dist/core/executor/index.d.mts.map +1 -0
- package/dist/core/executor/index.mjs +195 -0
- package/dist/core/executor/index.mjs.map +1 -0
- package/dist/core/formatters/delete.cjs +37 -0
- package/dist/core/formatters/delete.d.cts +18 -0
- package/dist/core/formatters/delete.d.cts.map +1 -0
- package/dist/core/formatters/delete.d.mts +18 -0
- package/dist/core/formatters/delete.d.mts.map +1 -0
- package/dist/core/formatters/delete.mjs +37 -0
- package/dist/core/formatters/delete.mjs.map +1 -0
- package/dist/core/formatters/exec.cjs +60 -0
- package/dist/core/formatters/exec.d.cts +18 -0
- package/dist/core/formatters/exec.d.cts.map +1 -0
- package/dist/core/formatters/exec.d.mts +18 -0
- package/dist/core/formatters/exec.d.mts.map +1 -0
- package/dist/core/formatters/exec.mjs +60 -0
- package/dist/core/formatters/exec.mjs.map +1 -0
- package/dist/core/formatters/explain.cjs +97 -0
- package/dist/core/formatters/explain.d.cts +11 -0
- package/dist/core/formatters/explain.d.cts.map +1 -0
- package/dist/core/formatters/explain.d.mts +11 -0
- package/dist/core/formatters/explain.d.mts.map +1 -0
- package/dist/core/formatters/explain.mjs +96 -0
- package/dist/core/formatters/explain.mjs.map +1 -0
- package/dist/core/formatters/index.d.mts +9 -0
- package/dist/core/formatters/ls.cjs +179 -0
- package/dist/core/formatters/ls.d.cts +20 -0
- package/dist/core/formatters/ls.d.cts.map +1 -0
- package/dist/core/formatters/ls.d.mts +20 -0
- package/dist/core/formatters/ls.d.mts.map +1 -0
- package/dist/core/formatters/ls.mjs +179 -0
- package/dist/core/formatters/ls.mjs.map +1 -0
- package/dist/core/formatters/mount.cjs +55 -0
- package/dist/core/formatters/mount.d.cts +15 -0
- package/dist/core/formatters/mount.d.cts.map +1 -0
- package/dist/core/formatters/mount.d.mts +15 -0
- package/dist/core/formatters/mount.d.mts.map +1 -0
- package/dist/core/formatters/mount.mjs +55 -0
- package/dist/core/formatters/mount.mjs.map +1 -0
- package/dist/core/formatters/read.cjs +100 -0
- package/dist/core/formatters/read.d.cts +22 -0
- package/dist/core/formatters/read.d.cts.map +1 -0
- package/dist/core/formatters/read.d.mts +22 -0
- package/dist/core/formatters/read.d.mts.map +1 -0
- package/dist/core/formatters/read.mjs +100 -0
- package/dist/core/formatters/read.mjs.map +1 -0
- package/dist/core/formatters/search.cjs +44 -0
- package/dist/core/formatters/search.d.mts +1 -0
- package/dist/core/formatters/search.mjs +44 -0
- package/dist/core/formatters/search.mjs.map +1 -0
- package/dist/core/formatters/stat.cjs +155 -0
- package/dist/core/formatters/stat.d.cts +15 -0
- package/dist/core/formatters/stat.d.cts.map +1 -0
- package/dist/core/formatters/stat.d.mts +15 -0
- package/dist/core/formatters/stat.d.mts.map +1 -0
- package/dist/core/formatters/stat.mjs +155 -0
- package/dist/core/formatters/stat.mjs.map +1 -0
- package/dist/core/formatters/write.cjs +51 -0
- package/dist/core/formatters/write.d.cts +22 -0
- package/dist/core/formatters/write.d.cts.map +1 -0
- package/dist/core/formatters/write.d.mts +22 -0
- package/dist/core/formatters/write.d.mts.map +1 -0
- package/dist/core/formatters/write.mjs +51 -0
- package/dist/core/formatters/write.mjs.map +1 -0
- package/dist/core/helpers/exec-args.cjs +142 -0
- package/dist/core/helpers/exec-args.d.cts +46 -0
- package/dist/core/helpers/exec-args.d.cts.map +1 -0
- package/dist/core/helpers/exec-args.d.mts +46 -0
- package/dist/core/helpers/exec-args.d.mts.map +1 -0
- package/dist/core/helpers/exec-args.mjs +139 -0
- package/dist/core/helpers/exec-args.mjs.map +1 -0
- package/dist/core/helpers/stdin.cjs +41 -0
- package/dist/core/helpers/stdin.d.cts +15 -0
- package/dist/core/helpers/stdin.d.cts.map +1 -0
- package/dist/core/helpers/stdin.d.mts +15 -0
- package/dist/core/helpers/stdin.d.mts.map +1 -0
- package/dist/core/helpers/stdin.mjs +41 -0
- package/dist/core/helpers/stdin.mjs.map +1 -0
- package/dist/core/index.cjs +49 -0
- package/dist/core/index.d.cts +24 -0
- package/dist/core/index.d.mts +25 -0
- package/dist/core/index.mjs +24 -0
- package/dist/core/path-utils.cjs +1 -0
- package/dist/core/path-utils.mjs +3 -0
- package/dist/core/types.d.cts +24 -0
- package/dist/core/types.d.cts.map +1 -0
- package/dist/core/types.d.mts +24 -0
- package/dist/core/types.d.mts.map +1 -0
- package/dist/errors.cjs +0 -11
- package/dist/errors.mjs +1 -11
- package/dist/errors.mjs.map +1 -1
- package/dist/explorer/actions.cjs +67 -32
- package/dist/explorer/actions.mjs +66 -32
- package/dist/explorer/actions.mjs.map +1 -1
- package/dist/explorer/components/dialog.cjs +170 -46
- package/dist/explorer/components/dialog.mjs +170 -46
- package/dist/explorer/components/dialog.mjs.map +1 -1
- package/dist/explorer/components/metadata-panel.cjs +86 -3
- package/dist/explorer/components/metadata-panel.mjs +86 -3
- package/dist/explorer/components/metadata-panel.mjs.map +1 -1
- package/dist/explorer/screen.cjs +63 -27
- package/dist/explorer/screen.d.cts +23 -0
- package/dist/explorer/screen.d.cts.map +1 -0
- package/dist/explorer/screen.d.mts +23 -0
- package/dist/explorer/screen.d.mts.map +1 -0
- package/dist/explorer/screen.mjs +63 -27
- package/dist/explorer/screen.mjs.map +1 -1
- package/dist/explorer/theme.cjs +1 -1
- package/dist/explorer/theme.mjs +1 -1
- package/dist/explorer/theme.mjs.map +1 -1
- package/dist/index.cjs +7 -1
- package/dist/index.d.cts +4 -1
- package/dist/index.d.mts +4 -1
- package/dist/index.mjs +4 -1
- package/dist/mcp/http-transport.cjs +68 -0
- package/dist/mcp/http-transport.mjs +68 -0
- package/dist/mcp/http-transport.mjs.map +1 -0
- package/dist/mcp/prompts.cjs +48 -0
- package/dist/mcp/prompts.mjs +48 -0
- package/dist/mcp/prompts.mjs.map +1 -0
- package/dist/mcp/resources.cjs +25 -0
- package/dist/mcp/resources.mjs +25 -0
- package/dist/mcp/resources.mjs.map +1 -0
- package/dist/mcp/server.cjs +30 -0
- package/dist/mcp/server.mjs +30 -0
- package/dist/mcp/server.mjs.map +1 -0
- package/dist/mcp/tools.cjs +196 -0
- package/dist/mcp/tools.mjs +196 -0
- package/dist/mcp/tools.mjs.map +1 -0
- package/dist/node_modules/.pnpm/urlpattern-polyfill@10.1.0/node_modules/urlpattern-polyfill/dist/index.d.cts +10 -0
- package/dist/node_modules/.pnpm/urlpattern-polyfill@10.1.0/node_modules/urlpattern-polyfill/dist/index.d.cts.map +1 -0
- package/dist/node_modules/.pnpm/urlpattern-polyfill@10.1.0/node_modules/urlpattern-polyfill/dist/index.d.mts +10 -0
- package/dist/node_modules/.pnpm/urlpattern-polyfill@10.1.0/node_modules/urlpattern-polyfill/dist/index.d.mts.map +1 -0
- package/dist/node_modules/.pnpm/urlpattern-polyfill@10.1.0/node_modules/urlpattern-polyfill/dist/types.d.cts +46 -0
- package/dist/node_modules/.pnpm/urlpattern-polyfill@10.1.0/node_modules/urlpattern-polyfill/dist/types.d.cts.map +1 -0
- package/dist/node_modules/.pnpm/urlpattern-polyfill@10.1.0/node_modules/urlpattern-polyfill/dist/types.d.mts +46 -0
- package/dist/node_modules/.pnpm/urlpattern-polyfill@10.1.0/node_modules/urlpattern-polyfill/dist/types.d.mts.map +1 -0
- package/dist/node_modules/.pnpm/urlpattern-polyfill@10.1.0/node_modules/urlpattern-polyfill/dist/urlpattern.cjs +902 -0
- package/dist/node_modules/.pnpm/urlpattern-polyfill@10.1.0/node_modules/urlpattern-polyfill/dist/urlpattern.mjs +902 -0
- package/dist/node_modules/.pnpm/urlpattern-polyfill@10.1.0/node_modules/urlpattern-polyfill/dist/urlpattern.mjs.map +1 -0
- package/dist/node_modules/.pnpm/urlpattern-polyfill@10.1.0/node_modules/urlpattern-polyfill/index.cjs +6 -0
- package/dist/node_modules/.pnpm/urlpattern-polyfill@10.1.0/node_modules/urlpattern-polyfill/index.mjs +8 -0
- package/dist/node_modules/.pnpm/urlpattern-polyfill@10.1.0/node_modules/urlpattern-polyfill/index.mjs.map +1 -0
- package/dist/path-utils.d.cts +50 -0
- package/dist/path-utils.d.cts.map +1 -0
- package/dist/path-utils.d.mts +50 -0
- package/dist/path-utils.d.mts.map +1 -0
- package/dist/repl.cjs +485 -0
- package/dist/repl.d.cts +15 -0
- package/dist/repl.d.cts.map +1 -0
- package/dist/repl.d.mts +16 -0
- package/dist/repl.d.mts.map +1 -0
- package/dist/repl.mjs +485 -0
- package/dist/repl.mjs.map +1 -0
- package/dist/serve.cjs +146 -0
- package/dist/serve.d.cts +41 -0
- package/dist/serve.d.cts.map +1 -0
- package/dist/serve.d.mts +41 -0
- package/dist/serve.d.mts.map +1 -0
- package/dist/serve.mjs +146 -0
- package/dist/serve.mjs.map +1 -0
- package/dist/ui/header.cjs +1 -40
- package/dist/ui/header.mjs +1 -39
- package/dist/ui/header.mjs.map +1 -1
- package/dist/ui/index.cjs +2 -9
- package/dist/ui/index.mjs +2 -7
- package/dist/ui/index.mjs.map +1 -1
- package/dist/ui/terminal.cjs +1 -10
- package/dist/ui/terminal.mjs +1 -8
- package/dist/ui/terminal.mjs.map +1 -1
- package/package.json +29 -16
- package/dist/commands/exec.cjs +0 -164
- package/dist/commands/exec.mjs +0 -160
- package/dist/commands/exec.mjs.map +0 -1
- package/dist/commands/explain.cjs +0 -244
- package/dist/commands/explain.mjs +0 -242
- package/dist/commands/explain.mjs.map +0 -1
- package/dist/commands/index.cjs +0 -8
- package/dist/commands/index.mjs +0 -10
- package/dist/commands/ls.cjs +0 -242
- package/dist/commands/ls.mjs +0 -242
- package/dist/commands/ls.mjs.map +0 -1
- package/dist/commands/mount.mjs.map +0 -1
- package/dist/commands/read.cjs +0 -264
- package/dist/commands/read.mjs +0 -263
- package/dist/commands/read.mjs.map +0 -1
- package/dist/commands/serve.cjs +0 -144
- package/dist/commands/serve.mjs +0 -143
- package/dist/commands/serve.mjs.map +0 -1
- package/dist/commands/stat.cjs +0 -195
- package/dist/commands/stat.mjs +0 -195
- package/dist/commands/stat.mjs.map +0 -1
- package/dist/commands/write.cjs +0 -85
- package/dist/commands/write.mjs +0 -85
- package/dist/commands/write.mjs.map +0 -1
- package/dist/config/provider-factory.cjs +0 -400
- package/dist/config/provider-factory.mjs +0 -401
- package/dist/config/provider-factory.mjs.map +0 -1
- package/dist/config/uri-parser.cjs +0 -285
- package/dist/config/uri-parser.mjs +0 -285
- package/dist/config/uri-parser.mjs.map +0 -1
- package/dist/runtime.cjs +0 -120
- package/dist/runtime.mjs +0 -120
- package/dist/runtime.mjs.map +0 -1
- package/dist/utils/meta.cjs +0 -51
- package/dist/utils/meta.mjs +0 -49
- package/dist/utils/meta.mjs.map +0 -1
|
@@ -255,8 +255,9 @@ function createDialogManager(blessed, options) {
|
|
|
255
255
|
const required = inputSchema?.required || [];
|
|
256
256
|
const propNames = Object.keys(properties);
|
|
257
257
|
if (propNames.length === 0) {
|
|
258
|
-
|
|
259
|
-
|
|
258
|
+
this.showConfirm(`Execute action on ${path}?`, () => {
|
|
259
|
+
onSubmit({});
|
|
260
|
+
});
|
|
260
261
|
return;
|
|
261
262
|
}
|
|
262
263
|
const dialogHeight = Math.min(propNames.length * 3 + 8, 25);
|
|
@@ -269,7 +270,7 @@ function createDialogManager(blessed, options) {
|
|
|
269
270
|
right: 1,
|
|
270
271
|
bottom: 3,
|
|
271
272
|
keys: true,
|
|
272
|
-
vi:
|
|
273
|
+
vi: false
|
|
273
274
|
});
|
|
274
275
|
const inputs = [];
|
|
275
276
|
let yPos = 0;
|
|
@@ -288,28 +289,23 @@ function createDialogManager(blessed, options) {
|
|
|
288
289
|
style: { fg: require_theme.Colors.fg.normal }
|
|
289
290
|
});
|
|
290
291
|
yPos += 1;
|
|
291
|
-
const
|
|
292
|
+
const inputBox = blessed.box({
|
|
292
293
|
parent: form,
|
|
293
|
-
name: propName,
|
|
294
294
|
top: yPos,
|
|
295
295
|
left: 0,
|
|
296
296
|
width: "100%-2",
|
|
297
297
|
height: 1,
|
|
298
|
-
|
|
299
|
-
mouse: true,
|
|
300
|
-
inputOnFocus: false,
|
|
298
|
+
tags: true,
|
|
301
299
|
style: {
|
|
302
300
|
fg: require_theme.Colors.fg.normal,
|
|
303
|
-
bg: require_theme.Colors.bg.input
|
|
304
|
-
focus: {
|
|
305
|
-
fg: "white",
|
|
306
|
-
bg: require_theme.Colors.bg.inputFocus
|
|
307
|
-
}
|
|
301
|
+
bg: require_theme.Colors.bg.input
|
|
308
302
|
}
|
|
309
303
|
});
|
|
310
304
|
inputs.push({
|
|
311
305
|
name: propName,
|
|
312
|
-
|
|
306
|
+
value: "",
|
|
307
|
+
cursor: 0,
|
|
308
|
+
box: inputBox
|
|
313
309
|
});
|
|
314
310
|
yPos += 2;
|
|
315
311
|
}
|
|
@@ -318,57 +314,185 @@ function createDialogManager(blessed, options) {
|
|
|
318
314
|
bottom: 1,
|
|
319
315
|
left: 1,
|
|
320
316
|
tags: true,
|
|
321
|
-
content: "{gray-fg}Tab: next |
|
|
317
|
+
content: "{gray-fg}Tab: next | ←→: move cursor | Enter: submit | Esc: cancel{/gray-fg}"
|
|
322
318
|
});
|
|
323
319
|
let focusIndex = 0;
|
|
324
|
-
const
|
|
325
|
-
|
|
320
|
+
const renderInput = (state, focused) => {
|
|
321
|
+
if (focused) {
|
|
322
|
+
const before = state.value.slice(0, state.cursor);
|
|
323
|
+
const cursorChar = state.value[state.cursor] || "█";
|
|
324
|
+
const after = state.value.slice(state.cursor + 1);
|
|
325
|
+
state.box.setContent(`${before}{white-bg}{black-fg}${cursorChar}{/black-fg}{/white-bg}${after}`);
|
|
326
|
+
state.box.style.bg = require_theme.Colors.bg.inputFocus;
|
|
327
|
+
} else {
|
|
328
|
+
state.box.setContent(state.value || "");
|
|
329
|
+
state.box.style.bg = require_theme.Colors.bg.input;
|
|
330
|
+
}
|
|
326
331
|
};
|
|
327
332
|
const focusInput = (index) => {
|
|
328
|
-
const
|
|
329
|
-
const
|
|
330
|
-
if (
|
|
331
|
-
if (
|
|
333
|
+
const prevState = inputs[focusIndex];
|
|
334
|
+
const nextState = inputs[index];
|
|
335
|
+
if (nextState) {
|
|
336
|
+
if (prevState) renderInput(prevState, false);
|
|
332
337
|
focusIndex = index;
|
|
333
|
-
|
|
334
|
-
activateInput(nextItem.input);
|
|
338
|
+
renderInput(nextState, true);
|
|
335
339
|
parent.render();
|
|
336
340
|
}
|
|
337
341
|
};
|
|
338
|
-
|
|
339
|
-
const
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
focusInput((focusIndex
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
342
|
+
const keypressHandler = (ch, key) => {
|
|
343
|
+
const state = inputs[focusIndex];
|
|
344
|
+
if (!state) return;
|
|
345
|
+
const keyName = key?.name || "";
|
|
346
|
+
if (keyName === "tab") {
|
|
347
|
+
if (key.shift) focusInput((focusIndex - 1 + inputs.length) % inputs.length);
|
|
348
|
+
else focusInput((focusIndex + 1) % inputs.length);
|
|
349
|
+
return;
|
|
350
|
+
}
|
|
351
|
+
if (keyName === "enter" || keyName === "return") {
|
|
348
352
|
submitForm();
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
353
|
+
return;
|
|
354
|
+
}
|
|
355
|
+
if (keyName === "escape") return;
|
|
356
|
+
if (keyName === "left") {
|
|
357
|
+
state.cursor = Math.max(0, state.cursor - 1);
|
|
358
|
+
renderInput(state, true);
|
|
359
|
+
parent.render();
|
|
360
|
+
return;
|
|
361
|
+
}
|
|
362
|
+
if (keyName === "right") {
|
|
363
|
+
state.cursor = Math.min(state.value.length, state.cursor + 1);
|
|
364
|
+
renderInput(state, true);
|
|
365
|
+
parent.render();
|
|
366
|
+
return;
|
|
367
|
+
}
|
|
368
|
+
if (keyName === "home") {
|
|
369
|
+
state.cursor = 0;
|
|
370
|
+
renderInput(state, true);
|
|
371
|
+
parent.render();
|
|
372
|
+
return;
|
|
373
|
+
}
|
|
374
|
+
if (keyName === "end") {
|
|
375
|
+
state.cursor = state.value.length;
|
|
376
|
+
renderInput(state, true);
|
|
377
|
+
parent.render();
|
|
378
|
+
return;
|
|
379
|
+
}
|
|
380
|
+
if (keyName === "backspace") {
|
|
381
|
+
if (state.cursor > 0) {
|
|
382
|
+
state.value = state.value.slice(0, state.cursor - 1) + state.value.slice(state.cursor);
|
|
383
|
+
state.cursor--;
|
|
384
|
+
renderInput(state, true);
|
|
385
|
+
parent.render();
|
|
386
|
+
}
|
|
387
|
+
return;
|
|
388
|
+
}
|
|
389
|
+
if (keyName === "delete") {
|
|
390
|
+
if (state.cursor < state.value.length) {
|
|
391
|
+
state.value = state.value.slice(0, state.cursor) + state.value.slice(state.cursor + 1);
|
|
392
|
+
renderInput(state, true);
|
|
393
|
+
parent.render();
|
|
394
|
+
}
|
|
395
|
+
return;
|
|
396
|
+
}
|
|
397
|
+
if (ch && ch.length === 1 && !key.ctrl && !key.meta) {
|
|
398
|
+
state.value = state.value.slice(0, state.cursor) + ch + state.value.slice(state.cursor);
|
|
399
|
+
state.cursor++;
|
|
400
|
+
renderInput(state, true);
|
|
401
|
+
parent.render();
|
|
402
|
+
}
|
|
403
|
+
};
|
|
355
404
|
const submitForm = () => {
|
|
405
|
+
parent.removeListener("keypress", keypressHandler);
|
|
356
406
|
const params = {};
|
|
357
|
-
for (const { name,
|
|
358
|
-
const
|
|
359
|
-
if (
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
407
|
+
for (const { name, value } of inputs) {
|
|
408
|
+
const trimmed = value.trim();
|
|
409
|
+
if (trimmed) {
|
|
410
|
+
const expectedType = properties[name]?.type || "string";
|
|
411
|
+
if (expectedType === "string") params[name] = trimmed;
|
|
412
|
+
else if (expectedType === "number" || expectedType === "integer") {
|
|
413
|
+
const num = Number(trimmed);
|
|
414
|
+
params[name] = Number.isNaN(num) ? trimmed : num;
|
|
415
|
+
} else if (expectedType === "boolean") params[name] = trimmed.toLowerCase() === "true";
|
|
416
|
+
else if (expectedType === "object" || expectedType === "array") try {
|
|
417
|
+
params[name] = JSON.parse(trimmed);
|
|
418
|
+
} catch {
|
|
419
|
+
params[name] = trimmed;
|
|
420
|
+
}
|
|
421
|
+
else try {
|
|
422
|
+
params[name] = JSON.parse(trimmed);
|
|
423
|
+
} catch {
|
|
424
|
+
params[name] = trimmed;
|
|
425
|
+
}
|
|
363
426
|
}
|
|
364
427
|
}
|
|
365
428
|
close();
|
|
366
429
|
onSubmit(params);
|
|
367
430
|
};
|
|
431
|
+
const originalClose = close;
|
|
432
|
+
const closeWithCleanup = () => {
|
|
433
|
+
parent.removeListener("keypress", keypressHandler);
|
|
434
|
+
originalClose();
|
|
435
|
+
};
|
|
368
436
|
dialog.key(["escape"], () => {
|
|
437
|
+
closeWithCleanup();
|
|
438
|
+
});
|
|
439
|
+
dialog.focus();
|
|
440
|
+
parent.render();
|
|
441
|
+
setTimeout(() => {
|
|
442
|
+
parent.on("keypress", keypressHandler);
|
|
443
|
+
focusInput(0);
|
|
444
|
+
}, 50);
|
|
445
|
+
},
|
|
446
|
+
showActionPicker(nodePath, actions, onSelect) {
|
|
447
|
+
close();
|
|
448
|
+
const nodeName = nodePath.split("/").pop() || nodePath;
|
|
449
|
+
const dialogHeight = Math.min(actions.length + 6, 20);
|
|
450
|
+
const dialog = createDialog(`Actions: ${nodeName}`, "50%", dialogHeight, { skipDefaultKeys: true });
|
|
451
|
+
currentDialog = dialog;
|
|
452
|
+
let selectedIndex = 0;
|
|
453
|
+
const renderContent = () => {
|
|
454
|
+
const lines = [""];
|
|
455
|
+
for (let i = 0; i < actions.length; i++) {
|
|
456
|
+
const action = actions[i];
|
|
457
|
+
if (!action) continue;
|
|
458
|
+
const prefix = i === selectedIndex ? " {inverse}" : " ";
|
|
459
|
+
const suffix = i === selectedIndex ? "{/inverse}" : "";
|
|
460
|
+
lines.push(`${prefix}[${i + 1}] ${action.name}${suffix}`);
|
|
461
|
+
if (action.description) lines.push(` {gray-fg}${action.description}{/gray-fg}`);
|
|
462
|
+
}
|
|
463
|
+
lines.push("");
|
|
464
|
+
lines.push(" {gray-fg}↑/↓: select | Enter: execute | Esc: cancel{/gray-fg}");
|
|
465
|
+
dialog.setContent(lines.join("\n"));
|
|
466
|
+
parent.render();
|
|
467
|
+
};
|
|
468
|
+
renderContent();
|
|
469
|
+
dialog.key(["up", "k"], () => {
|
|
470
|
+
selectedIndex = (selectedIndex - 1 + actions.length) % actions.length;
|
|
471
|
+
renderContent();
|
|
472
|
+
});
|
|
473
|
+
dialog.key(["down", "j"], () => {
|
|
474
|
+
selectedIndex = (selectedIndex + 1) % actions.length;
|
|
475
|
+
renderContent();
|
|
476
|
+
});
|
|
477
|
+
for (let i = 1; i <= Math.min(9, actions.length); i++) dialog.key([String(i)], () => {
|
|
478
|
+
const action = actions[i - 1];
|
|
479
|
+
if (action) {
|
|
480
|
+
close();
|
|
481
|
+
onSelect(action);
|
|
482
|
+
}
|
|
483
|
+
});
|
|
484
|
+
dialog.key(["enter"], () => {
|
|
485
|
+
const action = actions[selectedIndex];
|
|
486
|
+
if (action) {
|
|
487
|
+
close();
|
|
488
|
+
onSelect(action);
|
|
489
|
+
}
|
|
490
|
+
});
|
|
491
|
+
dialog.key(["escape", "q"], () => {
|
|
369
492
|
close();
|
|
370
493
|
});
|
|
371
|
-
|
|
494
|
+
dialog.focus();
|
|
495
|
+
parent.render();
|
|
372
496
|
},
|
|
373
497
|
close,
|
|
374
498
|
isOpen() {
|
|
@@ -255,8 +255,9 @@ function createDialogManager(blessed, options) {
|
|
|
255
255
|
const required = inputSchema?.required || [];
|
|
256
256
|
const propNames = Object.keys(properties);
|
|
257
257
|
if (propNames.length === 0) {
|
|
258
|
-
|
|
259
|
-
|
|
258
|
+
this.showConfirm(`Execute action on ${path}?`, () => {
|
|
259
|
+
onSubmit({});
|
|
260
|
+
});
|
|
260
261
|
return;
|
|
261
262
|
}
|
|
262
263
|
const dialogHeight = Math.min(propNames.length * 3 + 8, 25);
|
|
@@ -269,7 +270,7 @@ function createDialogManager(blessed, options) {
|
|
|
269
270
|
right: 1,
|
|
270
271
|
bottom: 3,
|
|
271
272
|
keys: true,
|
|
272
|
-
vi:
|
|
273
|
+
vi: false
|
|
273
274
|
});
|
|
274
275
|
const inputs = [];
|
|
275
276
|
let yPos = 0;
|
|
@@ -288,28 +289,23 @@ function createDialogManager(blessed, options) {
|
|
|
288
289
|
style: { fg: Colors.fg.normal }
|
|
289
290
|
});
|
|
290
291
|
yPos += 1;
|
|
291
|
-
const
|
|
292
|
+
const inputBox = blessed.box({
|
|
292
293
|
parent: form,
|
|
293
|
-
name: propName,
|
|
294
294
|
top: yPos,
|
|
295
295
|
left: 0,
|
|
296
296
|
width: "100%-2",
|
|
297
297
|
height: 1,
|
|
298
|
-
|
|
299
|
-
mouse: true,
|
|
300
|
-
inputOnFocus: false,
|
|
298
|
+
tags: true,
|
|
301
299
|
style: {
|
|
302
300
|
fg: Colors.fg.normal,
|
|
303
|
-
bg: Colors.bg.input
|
|
304
|
-
focus: {
|
|
305
|
-
fg: "white",
|
|
306
|
-
bg: Colors.bg.inputFocus
|
|
307
|
-
}
|
|
301
|
+
bg: Colors.bg.input
|
|
308
302
|
}
|
|
309
303
|
});
|
|
310
304
|
inputs.push({
|
|
311
305
|
name: propName,
|
|
312
|
-
|
|
306
|
+
value: "",
|
|
307
|
+
cursor: 0,
|
|
308
|
+
box: inputBox
|
|
313
309
|
});
|
|
314
310
|
yPos += 2;
|
|
315
311
|
}
|
|
@@ -318,57 +314,185 @@ function createDialogManager(blessed, options) {
|
|
|
318
314
|
bottom: 1,
|
|
319
315
|
left: 1,
|
|
320
316
|
tags: true,
|
|
321
|
-
content: "{gray-fg}Tab: next |
|
|
317
|
+
content: "{gray-fg}Tab: next | ←→: move cursor | Enter: submit | Esc: cancel{/gray-fg}"
|
|
322
318
|
});
|
|
323
319
|
let focusIndex = 0;
|
|
324
|
-
const
|
|
325
|
-
|
|
320
|
+
const renderInput = (state, focused) => {
|
|
321
|
+
if (focused) {
|
|
322
|
+
const before = state.value.slice(0, state.cursor);
|
|
323
|
+
const cursorChar = state.value[state.cursor] || "█";
|
|
324
|
+
const after = state.value.slice(state.cursor + 1);
|
|
325
|
+
state.box.setContent(`${before}{white-bg}{black-fg}${cursorChar}{/black-fg}{/white-bg}${after}`);
|
|
326
|
+
state.box.style.bg = Colors.bg.inputFocus;
|
|
327
|
+
} else {
|
|
328
|
+
state.box.setContent(state.value || "");
|
|
329
|
+
state.box.style.bg = Colors.bg.input;
|
|
330
|
+
}
|
|
326
331
|
};
|
|
327
332
|
const focusInput = (index) => {
|
|
328
|
-
const
|
|
329
|
-
const
|
|
330
|
-
if (
|
|
331
|
-
if (
|
|
333
|
+
const prevState = inputs[focusIndex];
|
|
334
|
+
const nextState = inputs[index];
|
|
335
|
+
if (nextState) {
|
|
336
|
+
if (prevState) renderInput(prevState, false);
|
|
332
337
|
focusIndex = index;
|
|
333
|
-
|
|
334
|
-
activateInput(nextItem.input);
|
|
338
|
+
renderInput(nextState, true);
|
|
335
339
|
parent.render();
|
|
336
340
|
}
|
|
337
341
|
};
|
|
338
|
-
|
|
339
|
-
const
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
focusInput((focusIndex
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
342
|
+
const keypressHandler = (ch, key) => {
|
|
343
|
+
const state = inputs[focusIndex];
|
|
344
|
+
if (!state) return;
|
|
345
|
+
const keyName = key?.name || "";
|
|
346
|
+
if (keyName === "tab") {
|
|
347
|
+
if (key.shift) focusInput((focusIndex - 1 + inputs.length) % inputs.length);
|
|
348
|
+
else focusInput((focusIndex + 1) % inputs.length);
|
|
349
|
+
return;
|
|
350
|
+
}
|
|
351
|
+
if (keyName === "enter" || keyName === "return") {
|
|
348
352
|
submitForm();
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
353
|
+
return;
|
|
354
|
+
}
|
|
355
|
+
if (keyName === "escape") return;
|
|
356
|
+
if (keyName === "left") {
|
|
357
|
+
state.cursor = Math.max(0, state.cursor - 1);
|
|
358
|
+
renderInput(state, true);
|
|
359
|
+
parent.render();
|
|
360
|
+
return;
|
|
361
|
+
}
|
|
362
|
+
if (keyName === "right") {
|
|
363
|
+
state.cursor = Math.min(state.value.length, state.cursor + 1);
|
|
364
|
+
renderInput(state, true);
|
|
365
|
+
parent.render();
|
|
366
|
+
return;
|
|
367
|
+
}
|
|
368
|
+
if (keyName === "home") {
|
|
369
|
+
state.cursor = 0;
|
|
370
|
+
renderInput(state, true);
|
|
371
|
+
parent.render();
|
|
372
|
+
return;
|
|
373
|
+
}
|
|
374
|
+
if (keyName === "end") {
|
|
375
|
+
state.cursor = state.value.length;
|
|
376
|
+
renderInput(state, true);
|
|
377
|
+
parent.render();
|
|
378
|
+
return;
|
|
379
|
+
}
|
|
380
|
+
if (keyName === "backspace") {
|
|
381
|
+
if (state.cursor > 0) {
|
|
382
|
+
state.value = state.value.slice(0, state.cursor - 1) + state.value.slice(state.cursor);
|
|
383
|
+
state.cursor--;
|
|
384
|
+
renderInput(state, true);
|
|
385
|
+
parent.render();
|
|
386
|
+
}
|
|
387
|
+
return;
|
|
388
|
+
}
|
|
389
|
+
if (keyName === "delete") {
|
|
390
|
+
if (state.cursor < state.value.length) {
|
|
391
|
+
state.value = state.value.slice(0, state.cursor) + state.value.slice(state.cursor + 1);
|
|
392
|
+
renderInput(state, true);
|
|
393
|
+
parent.render();
|
|
394
|
+
}
|
|
395
|
+
return;
|
|
396
|
+
}
|
|
397
|
+
if (ch && ch.length === 1 && !key.ctrl && !key.meta) {
|
|
398
|
+
state.value = state.value.slice(0, state.cursor) + ch + state.value.slice(state.cursor);
|
|
399
|
+
state.cursor++;
|
|
400
|
+
renderInput(state, true);
|
|
401
|
+
parent.render();
|
|
402
|
+
}
|
|
403
|
+
};
|
|
355
404
|
const submitForm = () => {
|
|
405
|
+
parent.removeListener("keypress", keypressHandler);
|
|
356
406
|
const params = {};
|
|
357
|
-
for (const { name,
|
|
358
|
-
const
|
|
359
|
-
if (
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
407
|
+
for (const { name, value } of inputs) {
|
|
408
|
+
const trimmed = value.trim();
|
|
409
|
+
if (trimmed) {
|
|
410
|
+
const expectedType = properties[name]?.type || "string";
|
|
411
|
+
if (expectedType === "string") params[name] = trimmed;
|
|
412
|
+
else if (expectedType === "number" || expectedType === "integer") {
|
|
413
|
+
const num = Number(trimmed);
|
|
414
|
+
params[name] = Number.isNaN(num) ? trimmed : num;
|
|
415
|
+
} else if (expectedType === "boolean") params[name] = trimmed.toLowerCase() === "true";
|
|
416
|
+
else if (expectedType === "object" || expectedType === "array") try {
|
|
417
|
+
params[name] = JSON.parse(trimmed);
|
|
418
|
+
} catch {
|
|
419
|
+
params[name] = trimmed;
|
|
420
|
+
}
|
|
421
|
+
else try {
|
|
422
|
+
params[name] = JSON.parse(trimmed);
|
|
423
|
+
} catch {
|
|
424
|
+
params[name] = trimmed;
|
|
425
|
+
}
|
|
363
426
|
}
|
|
364
427
|
}
|
|
365
428
|
close();
|
|
366
429
|
onSubmit(params);
|
|
367
430
|
};
|
|
431
|
+
const originalClose = close;
|
|
432
|
+
const closeWithCleanup = () => {
|
|
433
|
+
parent.removeListener("keypress", keypressHandler);
|
|
434
|
+
originalClose();
|
|
435
|
+
};
|
|
368
436
|
dialog.key(["escape"], () => {
|
|
437
|
+
closeWithCleanup();
|
|
438
|
+
});
|
|
439
|
+
dialog.focus();
|
|
440
|
+
parent.render();
|
|
441
|
+
setTimeout(() => {
|
|
442
|
+
parent.on("keypress", keypressHandler);
|
|
443
|
+
focusInput(0);
|
|
444
|
+
}, 50);
|
|
445
|
+
},
|
|
446
|
+
showActionPicker(nodePath, actions, onSelect) {
|
|
447
|
+
close();
|
|
448
|
+
const nodeName = nodePath.split("/").pop() || nodePath;
|
|
449
|
+
const dialogHeight = Math.min(actions.length + 6, 20);
|
|
450
|
+
const dialog = createDialog(`Actions: ${nodeName}`, "50%", dialogHeight, { skipDefaultKeys: true });
|
|
451
|
+
currentDialog = dialog;
|
|
452
|
+
let selectedIndex = 0;
|
|
453
|
+
const renderContent = () => {
|
|
454
|
+
const lines = [""];
|
|
455
|
+
for (let i = 0; i < actions.length; i++) {
|
|
456
|
+
const action = actions[i];
|
|
457
|
+
if (!action) continue;
|
|
458
|
+
const prefix = i === selectedIndex ? " {inverse}" : " ";
|
|
459
|
+
const suffix = i === selectedIndex ? "{/inverse}" : "";
|
|
460
|
+
lines.push(`${prefix}[${i + 1}] ${action.name}${suffix}`);
|
|
461
|
+
if (action.description) lines.push(` {gray-fg}${action.description}{/gray-fg}`);
|
|
462
|
+
}
|
|
463
|
+
lines.push("");
|
|
464
|
+
lines.push(" {gray-fg}↑/↓: select | Enter: execute | Esc: cancel{/gray-fg}");
|
|
465
|
+
dialog.setContent(lines.join("\n"));
|
|
466
|
+
parent.render();
|
|
467
|
+
};
|
|
468
|
+
renderContent();
|
|
469
|
+
dialog.key(["up", "k"], () => {
|
|
470
|
+
selectedIndex = (selectedIndex - 1 + actions.length) % actions.length;
|
|
471
|
+
renderContent();
|
|
472
|
+
});
|
|
473
|
+
dialog.key(["down", "j"], () => {
|
|
474
|
+
selectedIndex = (selectedIndex + 1) % actions.length;
|
|
475
|
+
renderContent();
|
|
476
|
+
});
|
|
477
|
+
for (let i = 1; i <= Math.min(9, actions.length); i++) dialog.key([String(i)], () => {
|
|
478
|
+
const action = actions[i - 1];
|
|
479
|
+
if (action) {
|
|
480
|
+
close();
|
|
481
|
+
onSelect(action);
|
|
482
|
+
}
|
|
483
|
+
});
|
|
484
|
+
dialog.key(["enter"], () => {
|
|
485
|
+
const action = actions[selectedIndex];
|
|
486
|
+
if (action) {
|
|
487
|
+
close();
|
|
488
|
+
onSelect(action);
|
|
489
|
+
}
|
|
490
|
+
});
|
|
491
|
+
dialog.key(["escape", "q"], () => {
|
|
369
492
|
close();
|
|
370
493
|
});
|
|
371
|
-
|
|
494
|
+
dialog.focus();
|
|
495
|
+
parent.render();
|
|
372
496
|
},
|
|
373
497
|
close,
|
|
374
498
|
isOpen() {
|