@aigne/afs-cli 1.11.0-beta.1 → 1.11.0-beta.10
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/README.md +262 -15
- package/dist/_virtual/rolldown_runtime.cjs +29 -0
- package/dist/_virtual/rolldown_runtime.mjs +7 -0
- package/dist/cli.cjs +40 -0
- package/dist/cli.d.cts +2 -0
- package/dist/cli.d.mts +2 -1
- package/dist/cli.mjs +36 -24
- package/dist/cli.mjs.map +1 -0
- package/dist/config/afs-loader.cjs +578 -0
- package/dist/config/afs-loader.d.cts +19 -0
- package/dist/config/afs-loader.d.cts.map +1 -0
- package/dist/config/afs-loader.d.mts +19 -0
- package/dist/config/afs-loader.d.mts.map +1 -0
- package/dist/config/afs-loader.mjs +576 -0
- package/dist/config/afs-loader.mjs.map +1 -0
- package/dist/config/env.cjs +46 -0
- package/dist/config/env.mjs +46 -0
- package/dist/config/env.mjs.map +1 -0
- package/dist/config/loader.cjs +219 -0
- package/dist/config/loader.mjs +217 -0
- package/dist/config/loader.mjs.map +1 -0
- package/dist/config/mount-commands.cjs +226 -0
- package/dist/config/mount-commands.d.cts +14 -0
- package/dist/config/mount-commands.d.cts.map +1 -0
- package/dist/config/mount-commands.d.mts +14 -0
- package/dist/config/mount-commands.d.mts.map +1 -0
- package/dist/config/mount-commands.mjs +220 -0
- package/dist/config/mount-commands.mjs.map +1 -0
- package/dist/config/schema.cjs +99 -0
- package/dist/config/schema.mjs +98 -0
- package/dist/config/schema.mjs.map +1 -0
- 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 +98 -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 +99 -0
- package/dist/core/commands/exec.mjs.map +1 -0
- package/dist/core/commands/explain.cjs +278 -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 +279 -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 +222 -0
- package/dist/core/commands/mount.d.cts +35 -0
- package/dist/core/commands/mount.d.cts.map +1 -0
- package/dist/core/commands/mount.d.mts +35 -0
- package/dist/core/commands/mount.d.mts.map +1 -0
- package/dist/core/commands/mount.mjs +223 -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 +267 -0
- package/dist/core/commands/serve.d.mts +2 -0
- package/dist/core/commands/serve.mjs +267 -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 +18 -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 +19 -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 +99 -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 +98 -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/credential/auth-server.cjs +247 -0
- package/dist/credential/auth-server.mjs +247 -0
- package/dist/credential/auth-server.mjs.map +1 -0
- package/dist/credential/cli-auth-context.cjs +86 -0
- package/dist/credential/cli-auth-context.d.mts +1 -0
- package/dist/credential/cli-auth-context.mjs +86 -0
- package/dist/credential/cli-auth-context.mjs.map +1 -0
- package/dist/credential/index.cjs +5 -0
- package/dist/credential/index.d.mts +4 -0
- package/dist/credential/index.mjs +7 -0
- package/dist/credential/mcp-auth-context.cjs +186 -0
- package/dist/credential/mcp-auth-context.d.mts +1 -0
- package/dist/credential/mcp-auth-context.mjs +186 -0
- package/dist/credential/mcp-auth-context.mjs.map +1 -0
- package/dist/credential/resolver.cjs +127 -0
- package/dist/credential/resolver.d.mts +1 -0
- package/dist/credential/resolver.mjs +127 -0
- package/dist/credential/resolver.mjs.map +1 -0
- package/dist/credential/store.cjs +106 -0
- package/dist/credential/store.d.cts +30 -0
- package/dist/credential/store.d.cts.map +1 -0
- package/dist/credential/store.d.mts +30 -0
- package/dist/credential/store.d.mts.map +1 -0
- package/dist/credential/store.mjs +106 -0
- package/dist/credential/store.mjs.map +1 -0
- package/dist/errors.cjs +18 -0
- package/dist/errors.mjs +18 -0
- package/dist/errors.mjs.map +1 -0
- package/dist/explorer/actions.cjs +311 -0
- package/dist/explorer/actions.mjs +305 -0
- package/dist/explorer/actions.mjs.map +1 -0
- package/dist/explorer/components/dialog.cjs +508 -0
- package/dist/explorer/components/dialog.mjs +509 -0
- package/dist/explorer/components/dialog.mjs.map +1 -0
- package/dist/explorer/components/file-list.cjs +107 -0
- package/dist/explorer/components/file-list.mjs +107 -0
- package/dist/explorer/components/file-list.mjs.map +1 -0
- package/dist/explorer/components/function-bar.cjs +55 -0
- package/dist/explorer/components/function-bar.mjs +55 -0
- package/dist/explorer/components/function-bar.mjs.map +1 -0
- package/dist/explorer/components/index.cjs +5 -0
- package/dist/explorer/components/index.mjs +7 -0
- package/dist/explorer/components/metadata-panel.cjs +219 -0
- package/dist/explorer/components/metadata-panel.mjs +219 -0
- package/dist/explorer/components/metadata-panel.mjs.map +1 -0
- package/dist/explorer/components/status-bar.cjs +53 -0
- package/dist/explorer/components/status-bar.mjs +54 -0
- package/dist/explorer/components/status-bar.mjs.map +1 -0
- package/dist/explorer/keybindings.cjs +214 -0
- package/dist/explorer/keybindings.mjs +213 -0
- package/dist/explorer/keybindings.mjs.map +1 -0
- package/dist/explorer/screen.cjs +251 -0
- 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 +250 -0
- package/dist/explorer/screen.mjs.map +1 -0
- package/dist/explorer/state.cjs +53 -0
- package/dist/explorer/state.mjs +53 -0
- package/dist/explorer/state.mjs.map +1 -0
- package/dist/explorer/theme.cjs +160 -0
- package/dist/explorer/theme.mjs +157 -0
- package/dist/explorer/theme.mjs.map +1 -0
- package/dist/index.cjs +12 -0
- package/dist/index.d.cts +6 -0
- package/dist/index.d.mts +7 -4
- package/dist/index.mjs +7 -2
- package/dist/mcp/http-transport.cjs +87 -0
- package/dist/mcp/http-transport.mjs +87 -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 +74 -0
- package/dist/mcp/server.mjs +73 -0
- package/dist/mcp/server.mjs.map +1 -0
- package/dist/mcp/tools.cjs +152 -0
- package/dist/mcp/tools.mjs +152 -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.cjs +105 -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/path-utils.mjs +104 -0
- package/dist/path-utils.mjs.map +1 -0
- package/dist/repl.cjs +491 -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 +491 -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 +12 -0
- package/dist/ui/header.mjs +13 -0
- package/dist/ui/header.mjs.map +1 -0
- package/dist/ui/index.cjs +8 -0
- package/dist/ui/index.mjs +9 -0
- package/dist/ui/index.mjs.map +1 -0
- package/dist/ui/terminal.cjs +88 -0
- package/dist/ui/terminal.mjs +88 -0
- package/dist/ui/terminal.mjs.map +1 -0
- package/dist/version.cjs +9 -0
- package/dist/version.d.cts +5 -0
- package/dist/version.d.cts.map +1 -0
- package/dist/version.d.mts +5 -0
- package/dist/version.d.mts.map +1 -0
- package/dist/version.mjs +9 -0
- package/dist/version.mjs.map +1 -0
- package/package.json +77 -11
- package/.turbo/turbo-build.log +0 -18
- package/.turbo/turbo-check-types.log +0 -4
- package/dist/version--p6A8sKX.mjs +0 -5
- package/src/cli.test.ts +0 -8
- package/src/cli.ts +0 -29
- package/src/index.ts +0 -7
- package/src/version.ts +0 -1
- package/tsconfig.json +0 -16
package/dist/repl.cjs
ADDED
|
@@ -0,0 +1,491 @@
|
|
|
1
|
+
const require_rolldown_runtime = require('./_virtual/rolldown_runtime.cjs');
|
|
2
|
+
const require_cli_auth_context = require('./credential/cli-auth-context.cjs');
|
|
3
|
+
const require_store = require('./credential/store.cjs');
|
|
4
|
+
const require_afs_loader = require('./config/afs-loader.cjs');
|
|
5
|
+
const require_index = require('./core/executor/index.cjs');
|
|
6
|
+
let node_path = require("node:path");
|
|
7
|
+
let node_readline = require("node:readline");
|
|
8
|
+
let ufo = require("ufo");
|
|
9
|
+
|
|
10
|
+
//#region src/repl.ts
|
|
11
|
+
/**
|
|
12
|
+
* AFS CLI Interactive REPL
|
|
13
|
+
*
|
|
14
|
+
* Single-file REPL implementation for `afs -i` / `afs --interactive`.
|
|
15
|
+
* Provides: REPL loop, cd/pwd, Tab completion, explore TUI integration.
|
|
16
|
+
*/
|
|
17
|
+
/** Commands that default to current path when no path argument is given in REPL */
|
|
18
|
+
const DEFAULT_PATH_COMMANDS = new Set([
|
|
19
|
+
"ls",
|
|
20
|
+
"read",
|
|
21
|
+
"stat",
|
|
22
|
+
"explain",
|
|
23
|
+
"explore"
|
|
24
|
+
]);
|
|
25
|
+
const ALL_COMMANDS = [
|
|
26
|
+
"ls",
|
|
27
|
+
"read",
|
|
28
|
+
"write",
|
|
29
|
+
"delete",
|
|
30
|
+
"stat",
|
|
31
|
+
"exec",
|
|
32
|
+
"explain",
|
|
33
|
+
"mount",
|
|
34
|
+
"explore",
|
|
35
|
+
"cd",
|
|
36
|
+
"pwd",
|
|
37
|
+
"help",
|
|
38
|
+
"exit"
|
|
39
|
+
];
|
|
40
|
+
function createReplContext(options) {
|
|
41
|
+
return {
|
|
42
|
+
executor: options.executor,
|
|
43
|
+
afs: options.afs,
|
|
44
|
+
version: options.version,
|
|
45
|
+
currentPath: "/",
|
|
46
|
+
currentNamespace: null,
|
|
47
|
+
completionCache: /* @__PURE__ */ new Map()
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
function getPrompt(ctx) {
|
|
51
|
+
const dirname = ctx.currentPath === "/" ? "/" : (0, node_path.basename)(ctx.currentPath);
|
|
52
|
+
return `afs ${ctx.currentNamespace ? `${ctx.currentNamespace}:` : ""}${dirname}> `;
|
|
53
|
+
}
|
|
54
|
+
function getBanner(ctx) {
|
|
55
|
+
const mountCount = ctx.afs.getMounts().length;
|
|
56
|
+
const plural = mountCount === 1 ? "provider" : "providers";
|
|
57
|
+
return `AFS Interactive Shell v${ctx.version} — ${mountCount} ${plural} mounted. Type "help" for commands.`;
|
|
58
|
+
}
|
|
59
|
+
async function handleBuiltinCommand(input, ctx) {
|
|
60
|
+
const trimmed = input.trim();
|
|
61
|
+
if (!trimmed) return null;
|
|
62
|
+
const parts = trimmed.split(/\s+/);
|
|
63
|
+
switch (parts[0]) {
|
|
64
|
+
case "exit":
|
|
65
|
+
case "quit": return {
|
|
66
|
+
exit: true,
|
|
67
|
+
output: "Bye!"
|
|
68
|
+
};
|
|
69
|
+
case "help": return { output: formatHelp() };
|
|
70
|
+
case "pwd": return handlePwd(ctx);
|
|
71
|
+
case "cd": return handleCd(parts.slice(1).join(" "), ctx);
|
|
72
|
+
default: return null;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
function formatHelp() {
|
|
76
|
+
return [
|
|
77
|
+
"Available commands:",
|
|
78
|
+
"",
|
|
79
|
+
" AFS Commands:",
|
|
80
|
+
" ls [path] List directory contents (default: current dir)",
|
|
81
|
+
" read [path] Read file content (default: current node)",
|
|
82
|
+
" write <path> [content] Write content to file",
|
|
83
|
+
" delete <path> Delete file or directory",
|
|
84
|
+
" stat [path] Get file or directory info (default: current node)",
|
|
85
|
+
" exec <action> Execute an action",
|
|
86
|
+
" explain [topic] Explain AFS concepts or paths (default: current path)",
|
|
87
|
+
" mount Mount management",
|
|
88
|
+
" explore [path] Interactive TUI explorer (default: current dir)",
|
|
89
|
+
"",
|
|
90
|
+
" REPL Commands:",
|
|
91
|
+
" cd [path] Change working directory",
|
|
92
|
+
" pwd Print working directory",
|
|
93
|
+
" help Show this help",
|
|
94
|
+
" exit / quit Exit REPL",
|
|
95
|
+
"",
|
|
96
|
+
" Tips:",
|
|
97
|
+
" - Commands work with or without 'afs' prefix",
|
|
98
|
+
" - Use Tab for command and path completion",
|
|
99
|
+
" - Ctrl+D to exit"
|
|
100
|
+
].join("\n");
|
|
101
|
+
}
|
|
102
|
+
function handlePwd(ctx) {
|
|
103
|
+
if (ctx.currentNamespace) return { output: `@${ctx.currentNamespace}${ctx.currentPath}` };
|
|
104
|
+
return { output: ctx.currentPath };
|
|
105
|
+
}
|
|
106
|
+
async function handleCd(target, ctx) {
|
|
107
|
+
if (!target || target.trim() === "") {
|
|
108
|
+
ctx.currentPath = "/";
|
|
109
|
+
return {};
|
|
110
|
+
}
|
|
111
|
+
const trimmed = target.trim();
|
|
112
|
+
if (trimmed === "@default") {
|
|
113
|
+
ctx.currentNamespace = null;
|
|
114
|
+
ctx.currentPath = "/";
|
|
115
|
+
return {};
|
|
116
|
+
}
|
|
117
|
+
if (trimmed.startsWith("@")) {
|
|
118
|
+
const rest = trimmed.slice(1);
|
|
119
|
+
const slashIdx = rest.indexOf("/");
|
|
120
|
+
if (slashIdx === -1) {
|
|
121
|
+
const ns$1 = rest;
|
|
122
|
+
if (!ns$1) return { output: "cd: invalid namespace" };
|
|
123
|
+
try {
|
|
124
|
+
const canonicalPath = `$afs:${ns$1}/`;
|
|
125
|
+
await ctx.afs.stat(canonicalPath);
|
|
126
|
+
ctx.currentNamespace = ns$1;
|
|
127
|
+
ctx.currentPath = "/";
|
|
128
|
+
return {};
|
|
129
|
+
} catch {
|
|
130
|
+
return { output: `cd: no such path: @${ns$1}/` };
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
const ns = rest.slice(0, slashIdx);
|
|
134
|
+
const path = rest.slice(slashIdx) || "/";
|
|
135
|
+
if (!ns) return { output: "cd: invalid namespace" };
|
|
136
|
+
try {
|
|
137
|
+
const canonicalPath = `$afs:${ns}${path}`;
|
|
138
|
+
await ctx.afs.stat(canonicalPath);
|
|
139
|
+
ctx.currentNamespace = ns;
|
|
140
|
+
ctx.currentPath = path;
|
|
141
|
+
return {};
|
|
142
|
+
} catch {
|
|
143
|
+
return { output: `cd: no such path: @${ns}${path}` };
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
if (trimmed.startsWith("/")) {
|
|
147
|
+
const resolved$1 = normalizePath(trimmed);
|
|
148
|
+
try {
|
|
149
|
+
const canonicalPath = ctx.currentNamespace ? `$afs:${ctx.currentNamespace}${resolved$1}` : resolved$1;
|
|
150
|
+
await ctx.afs.stat(canonicalPath);
|
|
151
|
+
ctx.currentPath = resolved$1;
|
|
152
|
+
return {};
|
|
153
|
+
} catch {
|
|
154
|
+
return { output: `cd: no such path: ${trimmed}` };
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
const resolved = normalizePath((0, ufo.joinURL)(ctx.currentPath, trimmed));
|
|
158
|
+
try {
|
|
159
|
+
const canonicalPath = ctx.currentNamespace ? `$afs:${ctx.currentNamespace}${resolved}` : resolved;
|
|
160
|
+
await ctx.afs.stat(canonicalPath);
|
|
161
|
+
ctx.currentPath = resolved;
|
|
162
|
+
return {};
|
|
163
|
+
} catch {
|
|
164
|
+
return { output: `cd: no such path: ${trimmed}` };
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
function normalizePath(path) {
|
|
168
|
+
const parts = path.split("/").filter(Boolean);
|
|
169
|
+
const resolved = [];
|
|
170
|
+
for (const part of parts) if (part === "..") resolved.pop();
|
|
171
|
+
else if (part !== ".") resolved.push(part);
|
|
172
|
+
return `/${resolved.join("/")}`;
|
|
173
|
+
}
|
|
174
|
+
function resolveArgvPath(input, ctx) {
|
|
175
|
+
const tokens = tokenize(input);
|
|
176
|
+
if (tokens.length === 0) return tokens;
|
|
177
|
+
let cmdIdx = 0;
|
|
178
|
+
if (tokens[0] === "afs" && tokens.length > 1) cmdIdx = 1;
|
|
179
|
+
const cmd = tokens[cmdIdx];
|
|
180
|
+
if (!cmd) return tokens;
|
|
181
|
+
let argIdx = -1;
|
|
182
|
+
for (let i = cmdIdx + 1; i < tokens.length; i++) {
|
|
183
|
+
const token = tokens[i];
|
|
184
|
+
if (!token.startsWith("-")) {
|
|
185
|
+
if (cmd === "mount" && (token === "list" || token === "ls" || token === "add" || token === "remove")) continue;
|
|
186
|
+
argIdx = i;
|
|
187
|
+
break;
|
|
188
|
+
}
|
|
189
|
+
if (token.startsWith("--") && !token.includes("=") && i + 1 < tokens.length) i++;
|
|
190
|
+
}
|
|
191
|
+
if (argIdx === -1) {
|
|
192
|
+
if (DEFAULT_PATH_COMMANDS.has(cmd)) {
|
|
193
|
+
const currentFullPath = ctx.currentNamespace ? `@${ctx.currentNamespace}${ctx.currentPath}` : ctx.currentPath;
|
|
194
|
+
tokens.push(currentFullPath);
|
|
195
|
+
}
|
|
196
|
+
return tokens;
|
|
197
|
+
}
|
|
198
|
+
const arg = tokens[argIdx];
|
|
199
|
+
if (arg.startsWith("/") || arg.startsWith("@") || arg.startsWith("$afs")) return tokens;
|
|
200
|
+
const resolved = normalizePath((0, ufo.joinURL)(ctx.currentPath, arg));
|
|
201
|
+
tokens[argIdx] = ctx.currentNamespace ? `@${ctx.currentNamespace}${resolved}` : resolved;
|
|
202
|
+
return tokens;
|
|
203
|
+
}
|
|
204
|
+
function tokenize(input) {
|
|
205
|
+
const tokens = [];
|
|
206
|
+
let current = "";
|
|
207
|
+
let inQuote = false;
|
|
208
|
+
let quoteChar = "";
|
|
209
|
+
for (let i = 0; i < input.length; i++) {
|
|
210
|
+
const char = input[i];
|
|
211
|
+
if (inQuote) if (char === quoteChar) inQuote = false;
|
|
212
|
+
else current += char;
|
|
213
|
+
else if (char === "\"" || char === "'") {
|
|
214
|
+
inQuote = true;
|
|
215
|
+
quoteChar = char;
|
|
216
|
+
} else if (char === " " || char === " ") {
|
|
217
|
+
if (current) {
|
|
218
|
+
tokens.push(current);
|
|
219
|
+
current = "";
|
|
220
|
+
}
|
|
221
|
+
} else current += char;
|
|
222
|
+
}
|
|
223
|
+
if (current) tokens.push(current);
|
|
224
|
+
return tokens;
|
|
225
|
+
}
|
|
226
|
+
function isExploreCommand(cmd) {
|
|
227
|
+
const normalized = cmd.replace(/^afs\s+/, "").trim();
|
|
228
|
+
return normalized === "explore" || normalized.startsWith("explore ");
|
|
229
|
+
}
|
|
230
|
+
function parseExplorePath(cmd, ctx) {
|
|
231
|
+
const path = cmd.replace(/^afs\s+/, "").trim().split(/\s+/)[1];
|
|
232
|
+
if (!path) {
|
|
233
|
+
if (ctx.currentNamespace) return `$afs:${ctx.currentNamespace}${ctx.currentPath}`;
|
|
234
|
+
return ctx.currentPath;
|
|
235
|
+
}
|
|
236
|
+
if (!path.startsWith("/") && !path.startsWith("@") && !path.startsWith("$afs")) {
|
|
237
|
+
const resolved = normalizePath((0, ufo.joinURL)(ctx.currentPath, path));
|
|
238
|
+
if (ctx.currentNamespace) return `$afs:${ctx.currentNamespace}${resolved}`;
|
|
239
|
+
return resolved;
|
|
240
|
+
}
|
|
241
|
+
return path;
|
|
242
|
+
}
|
|
243
|
+
function createCompleter(ctx) {
|
|
244
|
+
return function completer(line, callback) {
|
|
245
|
+
const tokens = line.trimStart().split(/\s+/);
|
|
246
|
+
if (tokens.length <= 1) {
|
|
247
|
+
const partial = tokens[0] || "";
|
|
248
|
+
callback(null, [ALL_COMMANDS.filter((c) => c.startsWith(partial)), partial]);
|
|
249
|
+
return;
|
|
250
|
+
}
|
|
251
|
+
const lastToken = tokens[tokens.length - 1];
|
|
252
|
+
if (lastToken.startsWith("-")) {
|
|
253
|
+
callback(null, [[], lastToken]);
|
|
254
|
+
return;
|
|
255
|
+
}
|
|
256
|
+
let parentDir;
|
|
257
|
+
let prefix;
|
|
258
|
+
if (lastToken.includes("/")) {
|
|
259
|
+
const lastSlash = lastToken.lastIndexOf("/");
|
|
260
|
+
const parentPart = lastToken.slice(0, lastSlash + 1) || "/";
|
|
261
|
+
prefix = lastToken.slice(lastSlash + 1);
|
|
262
|
+
if (parentPart.startsWith("/") || parentPart.startsWith("@") || parentPart.startsWith("$afs")) parentDir = parentPart;
|
|
263
|
+
else parentDir = (0, ufo.joinURL)(ctx.currentPath, parentPart);
|
|
264
|
+
} else {
|
|
265
|
+
parentDir = ctx.currentPath;
|
|
266
|
+
prefix = lastToken;
|
|
267
|
+
}
|
|
268
|
+
const queryPath = ctx.currentNamespace && !parentDir.startsWith("@") && !parentDir.startsWith("$afs") ? `$afs:${ctx.currentNamespace}${parentDir}` : parentDir;
|
|
269
|
+
const cacheKey = queryPath;
|
|
270
|
+
const cached = ctx.completionCache.get(cacheKey);
|
|
271
|
+
if (cached) {
|
|
272
|
+
callback(null, [buildCompletions(cached, prefix, lastToken), lastToken]);
|
|
273
|
+
return;
|
|
274
|
+
}
|
|
275
|
+
ctx.afs.list(queryPath).then((result) => {
|
|
276
|
+
const entries = result.data || [];
|
|
277
|
+
ctx.completionCache.set(cacheKey, entries);
|
|
278
|
+
callback(null, [buildCompletions(entries, prefix, lastToken), lastToken]);
|
|
279
|
+
}).catch(() => {
|
|
280
|
+
callback(null, [[], lastToken]);
|
|
281
|
+
});
|
|
282
|
+
};
|
|
283
|
+
}
|
|
284
|
+
function buildCompletions(entries, prefix, lastToken) {
|
|
285
|
+
return entries.filter((e) => {
|
|
286
|
+
return (0, node_path.basename)(e.path).startsWith(prefix);
|
|
287
|
+
}).map((e) => {
|
|
288
|
+
const name = (0, node_path.basename)(e.path);
|
|
289
|
+
const suffix = typeof e.meta?.childrenCount === "number" ? "/" : " ";
|
|
290
|
+
if (lastToken.includes("/")) {
|
|
291
|
+
const lastSlash = lastToken.lastIndexOf("/");
|
|
292
|
+
return lastToken.slice(0, lastSlash + 1) + name + suffix;
|
|
293
|
+
}
|
|
294
|
+
return name + suffix;
|
|
295
|
+
});
|
|
296
|
+
}
|
|
297
|
+
function cleanupStdinAfterBlessed() {
|
|
298
|
+
const stdin = process.stdin;
|
|
299
|
+
stdin.removeAllListeners("keypress");
|
|
300
|
+
stdin.removeAllListeners("data");
|
|
301
|
+
delete stdin._blessedInput;
|
|
302
|
+
delete stdin._keypressHandler;
|
|
303
|
+
delete stdin._dataHandler;
|
|
304
|
+
delete stdin._keypressDecoder;
|
|
305
|
+
delete stdin._kpiListener;
|
|
306
|
+
if (stdin.setRawMode) stdin.setRawMode(false);
|
|
307
|
+
if (stdin._readableState) {
|
|
308
|
+
stdin._readableState.flowing = null;
|
|
309
|
+
stdin._readableState.reading = false;
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
const SPINNER_FRAMES = [
|
|
313
|
+
"⠋",
|
|
314
|
+
"⠙",
|
|
315
|
+
"⠹",
|
|
316
|
+
"⠸",
|
|
317
|
+
"⠼",
|
|
318
|
+
"⠴",
|
|
319
|
+
"⠦",
|
|
320
|
+
"⠧",
|
|
321
|
+
"⠇",
|
|
322
|
+
"⠏"
|
|
323
|
+
];
|
|
324
|
+
const SPINNER_INTERVAL_MS = 80;
|
|
325
|
+
function createSpinner() {
|
|
326
|
+
let frameIdx = 0;
|
|
327
|
+
let text = "";
|
|
328
|
+
let timer = null;
|
|
329
|
+
return {
|
|
330
|
+
start(initialText) {
|
|
331
|
+
text = initialText;
|
|
332
|
+
timer = setInterval(() => {
|
|
333
|
+
const frame = SPINNER_FRAMES[frameIdx % SPINNER_FRAMES.length];
|
|
334
|
+
process.stderr.write(`\r${frame} ${text}`);
|
|
335
|
+
frameIdx++;
|
|
336
|
+
}, SPINNER_INTERVAL_MS);
|
|
337
|
+
},
|
|
338
|
+
update(newText) {
|
|
339
|
+
text = newText;
|
|
340
|
+
},
|
|
341
|
+
stop() {
|
|
342
|
+
if (timer) {
|
|
343
|
+
clearInterval(timer);
|
|
344
|
+
timer = null;
|
|
345
|
+
}
|
|
346
|
+
process.stderr.write("\r\x1B[K");
|
|
347
|
+
}
|
|
348
|
+
};
|
|
349
|
+
}
|
|
350
|
+
async function startRepl(options) {
|
|
351
|
+
const { cwd, version, onExit, extraProviders } = options;
|
|
352
|
+
const spinner = createSpinner();
|
|
353
|
+
spinner.start("Mounting providers...");
|
|
354
|
+
let failures = [];
|
|
355
|
+
const { afs, failures: mountFailures } = await require_afs_loader.loadAFS(cwd, {
|
|
356
|
+
authContext: require_cli_auth_context.createCLIAuthContext(),
|
|
357
|
+
credentialStore: require_store.createCredentialStore(),
|
|
358
|
+
onProgress({ total, completed, failed }) {
|
|
359
|
+
spinner.update(`Mounting providers... (${completed}/${total}${failed > 0 ? `, ${failed} failed` : ""})`);
|
|
360
|
+
}
|
|
361
|
+
});
|
|
362
|
+
failures = mountFailures;
|
|
363
|
+
if (extraProviders) for (const { provider, mountPath } of extraProviders) try {
|
|
364
|
+
await afs.mount(provider, mountPath);
|
|
365
|
+
} catch (e) {
|
|
366
|
+
const msg = e instanceof Error ? e.message : String(e);
|
|
367
|
+
failures.push({
|
|
368
|
+
path: mountPath,
|
|
369
|
+
reason: msg
|
|
370
|
+
});
|
|
371
|
+
}
|
|
372
|
+
spinner.stop();
|
|
373
|
+
if (failures.length > 0) {
|
|
374
|
+
const noun = failures.length === 1 ? "mount" : "mounts";
|
|
375
|
+
console.warn(`⚠ ${failures.length} ${noun} failed:`);
|
|
376
|
+
for (const f of failures) console.warn(` - ${f.path}: ${f.reason}`);
|
|
377
|
+
}
|
|
378
|
+
const executor = new require_index.AFSCommandExecutor(afs, {
|
|
379
|
+
cwd,
|
|
380
|
+
tty: true,
|
|
381
|
+
version
|
|
382
|
+
});
|
|
383
|
+
const ctx = createReplContext({
|
|
384
|
+
executor,
|
|
385
|
+
afs,
|
|
386
|
+
version
|
|
387
|
+
});
|
|
388
|
+
console.log(getBanner(ctx));
|
|
389
|
+
let closed = false;
|
|
390
|
+
let rl;
|
|
391
|
+
let originalDataHandler = null;
|
|
392
|
+
function startReplLoop() {
|
|
393
|
+
const stdin = process.stdin;
|
|
394
|
+
if (stdin._readableState) {
|
|
395
|
+
stdin._readableState.flowing = null;
|
|
396
|
+
stdin._readableState.reading = false;
|
|
397
|
+
}
|
|
398
|
+
rl = (0, node_readline.createInterface)({
|
|
399
|
+
input: process.stdin,
|
|
400
|
+
output: process.stdout,
|
|
401
|
+
prompt: getPrompt(ctx),
|
|
402
|
+
historySize: 100,
|
|
403
|
+
completer: createCompleter(ctx)
|
|
404
|
+
});
|
|
405
|
+
if (!originalDataHandler && stdin.listenerCount("data") > 0) originalDataHandler = stdin.listeners("data")[0] ?? null;
|
|
406
|
+
if (stdin.listenerCount("data") === 0 && originalDataHandler) {
|
|
407
|
+
stdin.on("data", originalDataHandler);
|
|
408
|
+
stdin.resume();
|
|
409
|
+
}
|
|
410
|
+
rl.on("line", async (line) => {
|
|
411
|
+
const trimmed = line.trim();
|
|
412
|
+
if (!trimmed) {
|
|
413
|
+
if (!closed) rl.prompt();
|
|
414
|
+
return;
|
|
415
|
+
}
|
|
416
|
+
if (isExploreCommand(trimmed)) {
|
|
417
|
+
await handleExplore(trimmed, ctx);
|
|
418
|
+
return;
|
|
419
|
+
}
|
|
420
|
+
const builtinResult = await handleBuiltinCommand(trimmed, ctx);
|
|
421
|
+
if (builtinResult) {
|
|
422
|
+
if (builtinResult.output) console.log(builtinResult.output);
|
|
423
|
+
if (builtinResult.exit) {
|
|
424
|
+
closed = true;
|
|
425
|
+
rl.close();
|
|
426
|
+
return;
|
|
427
|
+
}
|
|
428
|
+
if (!closed) {
|
|
429
|
+
rl.setPrompt(getPrompt(ctx));
|
|
430
|
+
rl.prompt();
|
|
431
|
+
}
|
|
432
|
+
return;
|
|
433
|
+
}
|
|
434
|
+
const resolved = resolveArgvPath(trimmed, ctx);
|
|
435
|
+
try {
|
|
436
|
+
const result = await executor.execute(resolved);
|
|
437
|
+
if (result.formatted) console.log(result.formatted);
|
|
438
|
+
if (!result.success && result.error) {
|
|
439
|
+
if (!result.formatted.includes(result.error.message)) console.error(result.error.message);
|
|
440
|
+
}
|
|
441
|
+
} catch (e) {
|
|
442
|
+
const msg = e instanceof Error ? e.message : String(e);
|
|
443
|
+
console.error(`Error: ${msg}`);
|
|
444
|
+
}
|
|
445
|
+
ctx.completionCache.clear();
|
|
446
|
+
if (!closed) rl.prompt();
|
|
447
|
+
});
|
|
448
|
+
rl.on("close", () => {
|
|
449
|
+
if (!closed) {
|
|
450
|
+
closed = true;
|
|
451
|
+
console.log("\nBye!");
|
|
452
|
+
}
|
|
453
|
+
});
|
|
454
|
+
rl.prompt();
|
|
455
|
+
}
|
|
456
|
+
async function handleExplore(trimmed, ctx$1) {
|
|
457
|
+
rl.removeAllListeners("line");
|
|
458
|
+
rl.removeAllListeners("close");
|
|
459
|
+
rl.close();
|
|
460
|
+
cleanupStdinAfterBlessed();
|
|
461
|
+
try {
|
|
462
|
+
const { createExplorerScreen } = await Promise.resolve().then(() => require("./explorer/screen.cjs"));
|
|
463
|
+
const startPath = parseExplorePath(trimmed, ctx$1);
|
|
464
|
+
await createExplorerScreen({
|
|
465
|
+
afs: ctx$1.afs,
|
|
466
|
+
startPath,
|
|
467
|
+
version: ctx$1.version,
|
|
468
|
+
onExit: () => {}
|
|
469
|
+
});
|
|
470
|
+
} catch {}
|
|
471
|
+
await new Promise((resolve) => setTimeout(resolve, 100));
|
|
472
|
+
cleanupStdinAfterBlessed();
|
|
473
|
+
process.stdout.write("\x1B[?1049l");
|
|
474
|
+
process.stdout.write("\x1B[?25h");
|
|
475
|
+
console.log("");
|
|
476
|
+
if (!closed) startReplLoop();
|
|
477
|
+
}
|
|
478
|
+
startReplLoop();
|
|
479
|
+
return new Promise((resolve) => {
|
|
480
|
+
const checkClosed = setInterval(() => {
|
|
481
|
+
if (closed) {
|
|
482
|
+
clearInterval(checkClosed);
|
|
483
|
+
if (onExit) onExit().catch(() => {}).then(resolve);
|
|
484
|
+
else resolve();
|
|
485
|
+
}
|
|
486
|
+
}, 100);
|
|
487
|
+
});
|
|
488
|
+
}
|
|
489
|
+
|
|
490
|
+
//#endregion
|
|
491
|
+
exports.startRepl = startRepl;
|
package/dist/repl.d.cts
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { AFS, AFSModule } from "@aigne/afs";
|
|
2
|
+
|
|
3
|
+
//#region src/repl.d.ts
|
|
4
|
+
declare function startRepl(options: {
|
|
5
|
+
cwd: string;
|
|
6
|
+
version: string;
|
|
7
|
+
onExit?: () => Promise<void>; /** Pre-created providers to mount directly (e.g. mock-based providers that can't be recreated from URI) */
|
|
8
|
+
extraProviders?: Array<{
|
|
9
|
+
provider: AFSModule;
|
|
10
|
+
mountPath: string;
|
|
11
|
+
}>;
|
|
12
|
+
}): Promise<void>;
|
|
13
|
+
//#endregion
|
|
14
|
+
export { startRepl };
|
|
15
|
+
//# sourceMappingURL=repl.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"repl.d.cts","names":[],"sources":["../src/repl.ts"],"mappings":";;;iBAiiBsB,SAAA,CAAU,OAAA;EAC9B,GAAA;EACA,OAAA;EACA,MAAA,SAAe,OAAA;EAEf,cAAA,GAAiB,KAAA;IAAQ,QAAA,EAAU,SAAA;IAAW,SAAA;EAAA;AAAA,IAC5C,OAAA"}
|
package/dist/repl.d.mts
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import "./core/executor/index.mjs";
|
|
2
|
+
import { AFS, AFSModule } from "@aigne/afs";
|
|
3
|
+
|
|
4
|
+
//#region src/repl.d.ts
|
|
5
|
+
declare function startRepl(options: {
|
|
6
|
+
cwd: string;
|
|
7
|
+
version: string;
|
|
8
|
+
onExit?: () => Promise<void>; /** Pre-created providers to mount directly (e.g. mock-based providers that can't be recreated from URI) */
|
|
9
|
+
extraProviders?: Array<{
|
|
10
|
+
provider: AFSModule;
|
|
11
|
+
mountPath: string;
|
|
12
|
+
}>;
|
|
13
|
+
}): Promise<void>;
|
|
14
|
+
//#endregion
|
|
15
|
+
export { startRepl };
|
|
16
|
+
//# sourceMappingURL=repl.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"repl.d.mts","names":[],"sources":["../src/repl.ts"],"mappings":";;;;iBAiiBsB,SAAA,CAAU,OAAA;EAC9B,GAAA;EACA,OAAA;EACA,MAAA,SAAe,OAAA;EAEf,cAAA,GAAiB,KAAA;IAAQ,QAAA,EAAU,SAAA;IAAW,SAAA;EAAA;AAAA,IAC5C,OAAA"}
|