@aigne/afs-cli 1.11.0-beta.6 → 1.11.0-beta.8
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/_virtual/rolldown_runtime.mjs +7 -0
- 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 +567 -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 +565 -0
- package/dist/config/afs-loader.mjs.map +1 -0
- package/dist/config/loader.cjs +28 -11
- package/dist/config/loader.mjs +28 -11
- package/dist/config/loader.mjs.map +1 -1
- package/dist/config/mount-commands.cjs +208 -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 +203 -0
- package/dist/config/mount-commands.mjs.map +1 -0
- package/dist/config/schema.cjs +10 -2
- package/dist/config/schema.mjs +10 -2
- 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 +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 +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 +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 +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/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 +125 -0
- package/dist/credential/resolver.d.mts +1 -0
- package/dist/credential/resolver.mjs +125 -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 +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 +10 -1
- package/dist/index.d.cts +5 -1
- package/dist/index.d.mts +6 -1
- package/dist/index.mjs +6 -1
- 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 +40 -0
- package/dist/mcp/server.mjs +39 -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.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 +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 +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 +30 -17
- 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.cjs +0 -194
- package/dist/commands/mount.mjs +0 -190
- 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
package/dist/cli.cjs
CHANGED
|
@@ -1,366 +1,40 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
const require_rolldown_runtime = require('./_virtual/rolldown_runtime.cjs');
|
|
3
3
|
const require_version = require('./version.cjs');
|
|
4
|
-
const require_exec = require('./commands/exec.cjs');
|
|
5
|
-
const require_loader = require('./config/loader.cjs');
|
|
6
|
-
const require_index = require('./ui/index.cjs');
|
|
7
|
-
const require_mount = require('./commands/mount.cjs');
|
|
8
|
-
const require_explain = require('./commands/explain.cjs');
|
|
9
|
-
const require_ls = require('./commands/ls.cjs');
|
|
10
|
-
const require_read = require('./commands/read.cjs');
|
|
11
|
-
const require_runtime = require('./runtime.cjs');
|
|
12
|
-
const require_serve = require('./commands/serve.cjs');
|
|
13
|
-
const require_stat = require('./commands/stat.cjs');
|
|
14
|
-
const require_write = require('./commands/write.cjs');
|
|
15
|
-
require('./commands/index.cjs');
|
|
16
4
|
const require_errors = require('./errors.cjs');
|
|
17
|
-
const
|
|
18
|
-
|
|
19
|
-
|
|
5
|
+
const require_index = require('./core/executor/index.cjs');
|
|
6
|
+
require('./node_modules/.pnpm/urlpattern-polyfill@10.1.0/node_modules/urlpattern-polyfill/index.cjs');
|
|
7
|
+
require('./core/index.cjs');
|
|
20
8
|
let yargs_helpers = require("yargs/helpers");
|
|
21
9
|
|
|
22
10
|
//#region src/cli.ts
|
|
23
|
-
/**
|
|
24
|
-
* AFS CLI - Command Line Interface
|
|
25
|
-
*
|
|
26
|
-
* Commands:
|
|
27
|
-
* - afs mount list|ls List mount configurations
|
|
28
|
-
* - afs mount add <path> <uri> Add a mount
|
|
29
|
-
* - afs mount remove|rm <path> Remove a mount
|
|
30
|
-
* - afs mount validate Validate mount configuration
|
|
31
|
-
* - afs list|ls [path] List directory
|
|
32
|
-
* - afs stat <path> Get file/directory info
|
|
33
|
-
* - afs read <path> Read file content
|
|
34
|
-
* - afs write <path> Write file content (--content or stdin)
|
|
35
|
-
* - afs exec <path> <action> Execute operation
|
|
36
|
-
* - afs serve Start HTTP server to expose AFS
|
|
37
|
-
* - afs explore [path] Interactive TUI file explorer
|
|
38
|
-
*
|
|
39
|
-
* Output modes (default: human):
|
|
40
|
-
* - --view=human: Human friendly format with colors (default)
|
|
41
|
-
* - --view=llm: LLM optimized output (token-efficient)
|
|
42
|
-
* - --view=default: Machine truth (script/pipe friendly)
|
|
43
|
-
* - --json: Structured JSON
|
|
44
|
-
*/
|
|
45
|
-
function getViewType(argv) {
|
|
46
|
-
if (argv.json) return "json";
|
|
47
|
-
if (argv.view) return argv.view;
|
|
48
|
-
return "human";
|
|
49
|
-
}
|
|
50
|
-
let headerShown = false;
|
|
51
|
-
/**
|
|
52
|
-
* Show header if in human view mode and not already shown
|
|
53
|
-
*/
|
|
54
|
-
async function maybeShowHeader(view) {
|
|
55
|
-
if (view !== "human" || headerShown || !require_index.shouldShowHeader()) return;
|
|
56
|
-
headerShown = true;
|
|
57
|
-
try {
|
|
58
|
-
require_index.printHeader({
|
|
59
|
-
version: require_version.VERSION,
|
|
60
|
-
mountCount: (await new require_loader.ConfigLoader().load(process.cwd())).mounts.length
|
|
61
|
-
});
|
|
62
|
-
} catch {
|
|
63
|
-
require_index.printHeader({
|
|
64
|
-
version: require_version.VERSION,
|
|
65
|
-
mountCount: 0
|
|
66
|
-
});
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
async function showHeaderIfNeeded() {
|
|
70
|
-
const args = process.argv.slice(2);
|
|
71
|
-
if ((args.length === 0 || args.includes("--help") || args.includes("-h") || args.length === 1 && [
|
|
72
|
-
"help",
|
|
73
|
-
"mount",
|
|
74
|
-
"explain"
|
|
75
|
-
].includes(args[0])) && require_index.shouldShowHeader()) try {
|
|
76
|
-
require_index.printHeader({
|
|
77
|
-
version: require_version.VERSION,
|
|
78
|
-
mountCount: (await new require_loader.ConfigLoader().load(process.cwd())).mounts.length
|
|
79
|
-
});
|
|
80
|
-
} catch {
|
|
81
|
-
require_index.printHeader({
|
|
82
|
-
version: require_version.VERSION,
|
|
83
|
-
mountCount: 0
|
|
84
|
-
});
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
11
|
async function main() {
|
|
88
|
-
|
|
89
|
-
const
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
default: 1,
|
|
110
|
-
description: "Maximum depth to list"
|
|
111
|
-
}).option("limit", {
|
|
112
|
-
alias: "n",
|
|
113
|
-
type: "number",
|
|
114
|
-
description: "Maximum number of entries to return"
|
|
115
|
-
}).option("max-children", {
|
|
116
|
-
type: "number",
|
|
117
|
-
description: "Maximum children per directory"
|
|
118
|
-
}).option("pattern", {
|
|
119
|
-
alias: "p",
|
|
120
|
-
type: "string",
|
|
121
|
-
description: "Glob pattern to filter entries (e.g., *.ts, **/*.js)"
|
|
122
|
-
}), async (argv) => {
|
|
123
|
-
const view = getViewType(argv);
|
|
124
|
-
await maybeShowHeader(view);
|
|
125
|
-
const runtime = await require_runtime.createRuntime();
|
|
126
|
-
const path = argv.path;
|
|
127
|
-
const result = await require_ls.lsCommand(runtime, path, {
|
|
128
|
-
maxDepth: argv.depth,
|
|
129
|
-
limit: argv.limit,
|
|
130
|
-
maxChildren: argv["max-children"],
|
|
131
|
-
pattern: argv.pattern
|
|
132
|
-
});
|
|
133
|
-
console.log(require_ls.formatLsOutput(result, view, { path }));
|
|
134
|
-
}).command("stat <path>", "Get file or directory info", (yargs$2) => yargs$2.positional("path", {
|
|
135
|
-
type: "string",
|
|
136
|
-
demandOption: true,
|
|
137
|
-
description: "Path to stat"
|
|
138
|
-
}), async (argv) => {
|
|
139
|
-
const view = getViewType(argv);
|
|
140
|
-
await maybeShowHeader(view);
|
|
141
|
-
const result = await require_stat.statCommand(await require_runtime.createRuntime(), argv.path);
|
|
142
|
-
console.log(require_stat.formatStatOutput(result, view));
|
|
143
|
-
}).command("read <path>", "Read file content", (yargs$2) => yargs$2.positional("path", {
|
|
144
|
-
type: "string",
|
|
145
|
-
demandOption: true,
|
|
146
|
-
description: "Path to read"
|
|
147
|
-
}), async (argv) => {
|
|
148
|
-
const view = getViewType(argv);
|
|
149
|
-
await maybeShowHeader(view);
|
|
150
|
-
const result = await require_read.readCommand(await require_runtime.createRuntime(), argv.path);
|
|
151
|
-
console.log(require_read.formatReadOutput(result, view));
|
|
152
|
-
}).command("write <path>", "Write content to file (from --content or stdin)", (yargs$2) => yargs$2.positional("path", {
|
|
153
|
-
type: "string",
|
|
154
|
-
demandOption: true,
|
|
155
|
-
description: "Path to write"
|
|
156
|
-
}).option("content", {
|
|
157
|
-
type: "string",
|
|
158
|
-
description: "Content to write (if not provided, reads from stdin)"
|
|
159
|
-
}).option("append", {
|
|
160
|
-
type: "boolean",
|
|
161
|
-
default: false,
|
|
162
|
-
description: "Append to file instead of overwrite"
|
|
163
|
-
}).option("set", {
|
|
164
|
-
type: "array",
|
|
165
|
-
string: true,
|
|
166
|
-
description: "Set metadata field (format: key=value), can be repeated"
|
|
167
|
-
}), async (argv) => {
|
|
168
|
-
const view = getViewType(argv);
|
|
169
|
-
await maybeShowHeader(view);
|
|
170
|
-
let content;
|
|
171
|
-
if (argv.content !== void 0) content = argv.content;
|
|
172
|
-
else if (argv.set && argv.set.length > 0) content = void 0;
|
|
173
|
-
else {
|
|
174
|
-
const chunks = [];
|
|
175
|
-
for await (const chunk of process.stdin) chunks.push(chunk);
|
|
176
|
-
content = Buffer.concat(chunks).toString("utf-8");
|
|
177
|
-
}
|
|
178
|
-
const result = await require_write.writeCommand(await require_runtime.createRuntime(), argv.path, content, {
|
|
179
|
-
append: argv.append,
|
|
180
|
-
set: argv.set
|
|
181
|
-
});
|
|
182
|
-
console.log(require_write.formatWriteOutput(result, view));
|
|
183
|
-
if (!result.success) process.exit(require_errors.ExitCode.RUNTIME_ERROR);
|
|
184
|
-
}).command("exec <path>", "Execute an executable path (e.g., MCP tool)", (yargs$2) => yargs$2.positional("path", {
|
|
185
|
-
type: "string",
|
|
186
|
-
demandOption: true,
|
|
187
|
-
description: "Path to execute (must be executable)"
|
|
188
|
-
}).option("args", {
|
|
189
|
-
type: "string",
|
|
190
|
-
description: "JSON arguments: --args '{\"key\": \"value\"}'"
|
|
191
|
-
}).option("yaml", {
|
|
192
|
-
type: "boolean",
|
|
193
|
-
description: "Output in YAML format"
|
|
194
|
-
}).example("$0 exec /modules/mcp/tools/echo --message hello", "Execute with named param").example("$0 exec /modules/mcp/tools/query --args '{\"sql\": \"SELECT 1\"}'", "Execute with JSON args").strict(false), async (argv) => {
|
|
195
|
-
let view = "human";
|
|
196
|
-
if (argv.json) view = "json";
|
|
197
|
-
else if (argv.yaml) view = "yaml";
|
|
198
|
-
else if (argv.view) view = argv.view;
|
|
199
|
-
await maybeShowHeader(view);
|
|
200
|
-
const args = await require_exec.parseExecArgsWithStdin(argv);
|
|
201
|
-
const result = await require_exec.execCommand(await require_runtime.createRuntime(), argv.path, args);
|
|
202
|
-
console.log(require_exec.formatExecOutput(result, view));
|
|
203
|
-
if (!result.success) process.exit(require_errors.ExitCode.RUNTIME_ERROR);
|
|
204
|
-
}).command("mount", "Manage mount configurations", (yargs$2) => yargs$2.command(["list", "ls"], "List all mounts", () => {}, async (argv) => {
|
|
205
|
-
const view = getViewType(argv);
|
|
206
|
-
await maybeShowHeader(view);
|
|
207
|
-
const result = await require_mount.mountListCommand(process.cwd());
|
|
208
|
-
console.log(require_mount.formatMountListOutput(result.mounts, view));
|
|
209
|
-
}).command("add <path> <uri>", "Add a new mount (path=virtual path, uri=data source)", (yargs$3) => yargs$3.positional("path", {
|
|
210
|
-
type: "string",
|
|
211
|
-
demandOption: true,
|
|
212
|
-
description: "Virtual path in AFS namespace (e.g., /src, /data)"
|
|
213
|
-
}).positional("uri", {
|
|
214
|
-
type: "string",
|
|
215
|
-
demandOption: true,
|
|
216
|
-
description: "Data source URI: fs:///local/path, git://repo, sqlite:///db.sqlite"
|
|
217
|
-
}).option("description", {
|
|
218
|
-
type: "string",
|
|
219
|
-
description: "Human-readable description for this mount"
|
|
220
|
-
}).option("token", {
|
|
221
|
-
type: "string",
|
|
222
|
-
description: "Bearer token for HTTP provider authorization"
|
|
223
|
-
}), async (argv) => {
|
|
224
|
-
const view = getViewType(argv);
|
|
225
|
-
await maybeShowHeader(view);
|
|
226
|
-
const result = await require_mount.mountAddCommand(process.cwd(), argv.path, argv.uri, {
|
|
227
|
-
description: argv.description,
|
|
228
|
-
token: argv.token
|
|
229
|
-
});
|
|
230
|
-
if (view === "json") console.log(JSON.stringify(result, null, 2));
|
|
231
|
-
else if (result.success) {
|
|
232
|
-
const msg = view === "human" ? `${require_index.colors.success("Added mount")} ${require_index.colors.cyan(result.normalizedPath)}` : `Added mount ${result.normalizedPath}`;
|
|
233
|
-
console.log(msg);
|
|
234
|
-
} else {
|
|
235
|
-
const msg = view === "human" ? require_index.colors.error(result.message) : result.message;
|
|
236
|
-
console.error(msg);
|
|
237
|
-
process.exit(require_errors.ExitCode.RUNTIME_ERROR);
|
|
238
|
-
}
|
|
239
|
-
}).command(["remove <path>", "rm <path>"], "Remove a mount", (yargs$3) => yargs$3.positional("path", {
|
|
240
|
-
type: "string",
|
|
241
|
-
demandOption: true,
|
|
242
|
-
description: "Virtual path to remove (e.g., /src)"
|
|
243
|
-
}), async (argv) => {
|
|
244
|
-
const view = getViewType(argv);
|
|
245
|
-
await maybeShowHeader(view);
|
|
246
|
-
const result = await require_mount.mountRemoveCommand(process.cwd(), argv.path);
|
|
247
|
-
if (view === "json") console.log(JSON.stringify(result, null, 2));
|
|
248
|
-
else if (result.success) {
|
|
249
|
-
const msg = view === "human" ? `${require_index.colors.success("Removed mount")} ${require_index.colors.cyan(argv.path)}` : `Removed mount ${argv.path}`;
|
|
250
|
-
console.log(msg);
|
|
251
|
-
} else {
|
|
252
|
-
const msg = view === "human" ? require_index.colors.error(result.message) : result.message;
|
|
253
|
-
console.error(msg);
|
|
254
|
-
process.exit(require_errors.ExitCode.RUNTIME_ERROR);
|
|
255
|
-
}
|
|
256
|
-
}).command("validate", "Validate mount configuration", () => {}, async (argv) => {
|
|
257
|
-
const view = getViewType(argv);
|
|
258
|
-
await maybeShowHeader(view);
|
|
259
|
-
const result = await require_mount.mountValidateCommand(process.cwd());
|
|
260
|
-
if (view === "json") console.log(JSON.stringify(result, null, 2));
|
|
261
|
-
else if (result.valid) {
|
|
262
|
-
const msg = view === "human" ? require_index.colors.success("Configuration is valid") : "Configuration is valid";
|
|
263
|
-
console.log(msg);
|
|
264
|
-
} else {
|
|
265
|
-
const titleMsg = view === "human" ? require_index.colors.error("Configuration has errors:") : "Configuration has errors:";
|
|
266
|
-
console.error(titleMsg);
|
|
267
|
-
for (const error of result.errors) {
|
|
268
|
-
const errMsg = view === "human" ? ` ${require_index.colors.dim("-")} ${require_index.colors.error(error)}` : ` - ${error}`;
|
|
269
|
-
console.error(errMsg);
|
|
270
|
-
}
|
|
271
|
-
process.exit(require_errors.ExitCode.RUNTIME_ERROR);
|
|
272
|
-
}
|
|
273
|
-
}).demandCommand(1, "Please specify a mount subcommand"), () => {}).command("explain [topic]", "Explain AFS concepts or AFS object", (yargs$2) => yargs$2.positional("topic", {
|
|
274
|
-
type: "string",
|
|
275
|
-
description: "Topic (mount, path, uri) or AFS path (e.g., /modules/src)"
|
|
276
|
-
}), async (argv) => {
|
|
277
|
-
const view = getViewType(argv);
|
|
278
|
-
await maybeShowHeader(view);
|
|
279
|
-
const topic = argv.topic;
|
|
280
|
-
if (topic?.startsWith("/")) {
|
|
281
|
-
const result = await require_explain.explainPathCommand(await require_runtime.createRuntime(), topic);
|
|
282
|
-
console.log(require_explain.formatPathExplainOutput(result, view));
|
|
283
|
-
} else {
|
|
284
|
-
const result = await require_explain.explainCommand(process.cwd(), topic);
|
|
285
|
-
console.log(require_explain.formatExplainOutput(result, view));
|
|
286
|
-
}
|
|
287
|
-
}).command("serve", "Start HTTP server to expose AFS providers", (yargs$2) => yargs$2.option("host", {
|
|
288
|
-
type: "string",
|
|
289
|
-
default: "localhost",
|
|
290
|
-
description: "Host address to listen on"
|
|
291
|
-
}).option("port", {
|
|
292
|
-
type: "number",
|
|
293
|
-
default: 3e3,
|
|
294
|
-
description: "Port to listen on"
|
|
295
|
-
}).option("path", {
|
|
296
|
-
type: "string",
|
|
297
|
-
default: "/afs",
|
|
298
|
-
description: "Base path for the server"
|
|
299
|
-
}).option("readonly", {
|
|
300
|
-
type: "boolean",
|
|
301
|
-
default: false,
|
|
302
|
-
description: "Run in readonly mode (disable write operations)"
|
|
303
|
-
}).option("cors", {
|
|
304
|
-
type: "boolean",
|
|
305
|
-
default: false,
|
|
306
|
-
description: "Enable CORS support"
|
|
307
|
-
}).option("max-body", {
|
|
308
|
-
type: "number",
|
|
309
|
-
description: "Maximum request body size in bytes (default: 10MB)"
|
|
310
|
-
}).option("token", {
|
|
311
|
-
type: "string",
|
|
312
|
-
description: "Bearer token for authorization"
|
|
313
|
-
}), async (argv) => {
|
|
314
|
-
await maybeShowHeader(getViewType(argv));
|
|
315
|
-
const result = await require_serve.serveCommand({
|
|
316
|
-
host: argv.host,
|
|
317
|
-
port: argv.port,
|
|
318
|
-
path: argv.path,
|
|
319
|
-
readonly: argv.readonly,
|
|
320
|
-
cors: argv.cors,
|
|
321
|
-
maxBodySize: argv["max-body"],
|
|
322
|
-
token: argv.token
|
|
323
|
-
});
|
|
324
|
-
console.log(require_serve.formatServeOutput(result));
|
|
325
|
-
await new Promise(() => {});
|
|
326
|
-
}).command("explore [path]", "Interactive TUI file explorer (PC Tools style)", (yargs$2) => yargs$2.positional("path", {
|
|
327
|
-
type: "string",
|
|
328
|
-
default: "/",
|
|
329
|
-
description: "Starting path to explore"
|
|
330
|
-
}), async (argv) => {
|
|
331
|
-
const configLoader = new require_loader.ConfigLoader();
|
|
332
|
-
const config = await configLoader.load(process.cwd());
|
|
333
|
-
await require_screen.createExplorerScreen({
|
|
334
|
-
runtime: await require_runtime.createRuntime(process.cwd(), { configLoader }),
|
|
335
|
-
startPath: argv.path,
|
|
336
|
-
version: require_version.VERSION,
|
|
337
|
-
mountCount: config.mounts.length
|
|
338
|
-
});
|
|
339
|
-
}).demandCommand(1, "Please specify a command").strict();
|
|
340
|
-
try {
|
|
341
|
-
await cli.parse();
|
|
342
|
-
} catch (error) {
|
|
343
|
-
if (error instanceof require_errors.CLIError) {
|
|
344
|
-
console.error(error.message);
|
|
345
|
-
process.exit(error.exitCode);
|
|
346
|
-
}
|
|
347
|
-
throw error;
|
|
12
|
+
const args = (0, yargs_helpers.hideBin)(process.argv);
|
|
13
|
+
const cwd = process.cwd();
|
|
14
|
+
if (args.includes("-i") || args.includes("--interactive")) {
|
|
15
|
+
const { startRepl } = await Promise.resolve().then(() => require("./repl.cjs"));
|
|
16
|
+
await startRepl({
|
|
17
|
+
cwd,
|
|
18
|
+
version: require_version.VERSION
|
|
19
|
+
});
|
|
20
|
+
process.exit(require_errors.ExitCode.OK);
|
|
21
|
+
}
|
|
22
|
+
const result = await new require_index.AFSCommandExecutor(void 0, {
|
|
23
|
+
cwd,
|
|
24
|
+
tty: process.stdout.isTTY ?? false,
|
|
25
|
+
version: require_version.VERSION
|
|
26
|
+
}).execute(args);
|
|
27
|
+
if (result.success) {
|
|
28
|
+
console.log(result.formatted);
|
|
29
|
+
process.exit(require_errors.ExitCode.OK);
|
|
30
|
+
} else {
|
|
31
|
+
console.error(result.formatted);
|
|
32
|
+
process.exit(result.error?.code ?? require_errors.ExitCode.RUNTIME_ERROR);
|
|
348
33
|
}
|
|
349
34
|
}
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
function formatErrorForDisplay(error) {
|
|
354
|
-
const message = error.message;
|
|
355
|
-
const lines = message.split("\n");
|
|
356
|
-
if (lines.length > 1) return lines.map((line, i) => i === 0 ? `${require_index.colors.red("Error:")} ${line}` : ` ${line}`).join("\n");
|
|
357
|
-
return `${require_index.colors.red("Error:")} ${message}`;
|
|
358
|
-
}
|
|
359
|
-
main().then(() => {
|
|
360
|
-
process.exit(0);
|
|
361
|
-
}).catch((error) => {
|
|
362
|
-
console.error(formatErrorForDisplay(error));
|
|
363
|
-
process.exit(error instanceof require_errors.CLIError ? error.exitCode : require_errors.ExitCode.RUNTIME_ERROR);
|
|
35
|
+
main().catch((error) => {
|
|
36
|
+
console.error(error instanceof Error ? error.message : String(error));
|
|
37
|
+
process.exit(require_errors.ExitCode.RUNTIME_ERROR);
|
|
364
38
|
});
|
|
365
39
|
|
|
366
40
|
//#endregion
|
package/dist/cli.d.cts
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import "./node_modules/.pnpm/urlpattern-polyfill@10.1.0/node_modules/urlpattern-polyfill/dist/index.cjs";
|
package/dist/cli.d.mts
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import "./node_modules/.pnpm/urlpattern-polyfill@10.1.0/node_modules/urlpattern-polyfill/dist/index.mjs";
|