@aigne/afs-cli 1.11.0-beta.1 → 1.11.0-beta.11
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 +192 -0
- package/dist/credential/mcp-auth-context.d.mts +1 -0
- package/dist/credential/mcp-auth-context.mjs +192 -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
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { resolveAFS } from "./types.mjs";
|
|
2
|
+
import { VERSION } from "../../version.mjs";
|
|
3
|
+
|
|
4
|
+
//#region src/core/commands/explore.ts
|
|
5
|
+
/**
|
|
6
|
+
* Create explore command
|
|
7
|
+
*/
|
|
8
|
+
function createExploreCommand(options) {
|
|
9
|
+
return {
|
|
10
|
+
command: "explore [path]",
|
|
11
|
+
describe: "Interactive TUI explorer",
|
|
12
|
+
builder: { path: {
|
|
13
|
+
type: "string",
|
|
14
|
+
default: "/",
|
|
15
|
+
description: "Starting path"
|
|
16
|
+
} },
|
|
17
|
+
handler: async (argv) => {
|
|
18
|
+
const afs = await resolveAFS(options);
|
|
19
|
+
const { createExplorerScreen } = await import("../../explorer/screen.mjs");
|
|
20
|
+
await createExplorerScreen({
|
|
21
|
+
afs,
|
|
22
|
+
startPath: argv.path,
|
|
23
|
+
version: VERSION
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
//#endregion
|
|
30
|
+
export { createExploreCommand };
|
|
31
|
+
//# sourceMappingURL=explore.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"explore.mjs","names":[],"sources":["../../../src/core/commands/explore.ts"],"sourcesContent":["/**\n * AFS Explore Command\n *\n * Interactive TUI explorer for AFS\n */\n\nimport type { CommandModule } from \"yargs\";\nimport { VERSION } from \"../../version.js\";\nimport { type CommandFactoryOptions, resolveAFS } from \"./types.js\";\n\nexport interface ExploreArgs {\n path: string;\n}\n\n/**\n * Create explore command\n */\nexport function createExploreCommand(\n options: CommandFactoryOptions,\n): CommandModule<unknown, ExploreArgs> {\n return {\n command: \"explore [path]\",\n describe: \"Interactive TUI explorer\",\n builder: {\n path: { type: \"string\", default: \"/\", description: \"Starting path\" },\n },\n handler: async (argv) => {\n const afs = await resolveAFS(options);\n const { createExplorerScreen } = await import(\"../../explorer/screen.js\");\n await createExplorerScreen({ afs, startPath: argv.path, version: VERSION });\n },\n };\n}\n"],"mappings":";;;;;;;AAiBA,SAAgB,qBACd,SACqC;AACrC,QAAO;EACL,SAAS;EACT,UAAU;EACV,SAAS,EACP,MAAM;GAAE,MAAM;GAAU,SAAS;GAAK,aAAa;GAAiB,EACrE;EACD,SAAS,OAAO,SAAS;GACvB,MAAM,MAAM,MAAM,WAAW,QAAQ;GACrC,MAAM,EAAE,yBAAyB,MAAM,OAAO;AAC9C,SAAM,qBAAqB;IAAE;IAAK,WAAW,KAAK;IAAM,SAAS;IAAS,CAAC;;EAE9E"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
const require_types = require('./types.cjs');
|
|
2
|
+
const require_delete = require('./delete.cjs');
|
|
3
|
+
const require_exec_args = require('../helpers/exec-args.cjs');
|
|
4
|
+
const require_exec = require('./exec.cjs');
|
|
5
|
+
const require_explain = require('./explain.cjs');
|
|
6
|
+
const require_explore = require('./explore.cjs');
|
|
7
|
+
const require_ls = require('./ls.cjs');
|
|
8
|
+
const require_mount = require('./mount.cjs');
|
|
9
|
+
const require_read = require('./read.cjs');
|
|
10
|
+
const require_search = require('./search.cjs');
|
|
11
|
+
const require_serve = require('./serve.cjs');
|
|
12
|
+
const require_stat = require('./stat.cjs');
|
|
13
|
+
const require_write = require('./write.cjs');
|
|
14
|
+
|
|
15
|
+
//#region src/core/commands/index.ts
|
|
16
|
+
/**
|
|
17
|
+
* Array of all command factories
|
|
18
|
+
*
|
|
19
|
+
* Used by AFSCommandExecutor to register all commands.
|
|
20
|
+
*/
|
|
21
|
+
const commandFactories = [
|
|
22
|
+
require_ls.createLsCommand,
|
|
23
|
+
require_read.createReadCommand,
|
|
24
|
+
require_write.createWriteCommand,
|
|
25
|
+
require_delete.createDeleteCommand,
|
|
26
|
+
require_stat.createStatCommand,
|
|
27
|
+
require_exec.createExecCommand,
|
|
28
|
+
require_explain.createExplainCommand,
|
|
29
|
+
require_search.createSearchCommand,
|
|
30
|
+
require_mount.createMountCommand,
|
|
31
|
+
require_serve.createServeCommand,
|
|
32
|
+
require_explore.createExploreCommand
|
|
33
|
+
];
|
|
34
|
+
|
|
35
|
+
//#endregion
|
|
36
|
+
exports.commandFactories = commandFactories;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { CommandFactory, CommandFactoryOptions, CommandOutput, FormatFunction } from "./types.cjs";
|
|
2
|
+
import { DeleteArgs, createDeleteCommand } from "./delete.cjs";
|
|
3
|
+
import { parseExecArgs, parseValueBySchema } from "../helpers/exec-args.cjs";
|
|
4
|
+
import { ExecArgs, createExecCommand } from "./exec.cjs";
|
|
5
|
+
import { ExplainArgs, createExplainCommand } from "./explain.cjs";
|
|
6
|
+
import { LsArgs, createLsCommand } from "./ls.cjs";
|
|
7
|
+
import { MountAddArgs, MountListArgs, MountRemoveArgs, createMountCommand } from "./mount.cjs";
|
|
8
|
+
import { ReadArgs, createReadCommand } from "./read.cjs";
|
|
9
|
+
import { StatArgs, createStatCommand } from "./stat.cjs";
|
|
10
|
+
import { WriteArgs, createWriteCommand } from "./write.cjs";
|
|
11
|
+
|
|
12
|
+
//#region src/core/commands/index.d.ts
|
|
13
|
+
/**
|
|
14
|
+
* Array of all command factories
|
|
15
|
+
*
|
|
16
|
+
* Used by AFSCommandExecutor to register all commands.
|
|
17
|
+
*/
|
|
18
|
+
declare const commandFactories: CommandFactory[];
|
|
19
|
+
//#endregion
|
|
20
|
+
export { commandFactories };
|
|
21
|
+
//# sourceMappingURL=index.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.cts","names":[],"sources":["../../../src/core/commands/index.ts"],"mappings":";;;;;;;;;;;;;;;;;cAmDa,gBAAA,EAAkB,cAAA"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { CommandFactory, CommandFactoryOptions, CommandOutput, FormatFunction } from "./types.mjs";
|
|
2
|
+
import { DeleteArgs, createDeleteCommand } from "./delete.mjs";
|
|
3
|
+
import { parseExecArgs, parseValueBySchema } from "../helpers/exec-args.mjs";
|
|
4
|
+
import { ExecArgs, createExecCommand } from "./exec.mjs";
|
|
5
|
+
import { ExplainArgs, createExplainCommand } from "./explain.mjs";
|
|
6
|
+
import "./explore.mjs";
|
|
7
|
+
import { LsArgs, createLsCommand } from "./ls.mjs";
|
|
8
|
+
import { MountAddArgs, MountListArgs, MountRemoveArgs, createMountCommand } from "./mount.mjs";
|
|
9
|
+
import { ReadArgs, createReadCommand } from "./read.mjs";
|
|
10
|
+
import "./search.mjs";
|
|
11
|
+
import "./serve.mjs";
|
|
12
|
+
import { StatArgs, createStatCommand } from "./stat.mjs";
|
|
13
|
+
import { WriteArgs, createWriteCommand } from "./write.mjs";
|
|
14
|
+
|
|
15
|
+
//#region src/core/commands/index.d.ts
|
|
16
|
+
/**
|
|
17
|
+
* Array of all command factories
|
|
18
|
+
*
|
|
19
|
+
* Used by AFSCommandExecutor to register all commands.
|
|
20
|
+
*/
|
|
21
|
+
declare const commandFactories: CommandFactory[];
|
|
22
|
+
//#endregion
|
|
23
|
+
export { commandFactories };
|
|
24
|
+
//# sourceMappingURL=index.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../../../src/core/commands/index.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;cAmDa,gBAAA,EAAkB,cAAA"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { resolveAFS } from "./types.mjs";
|
|
2
|
+
import { createDeleteCommand } from "./delete.mjs";
|
|
3
|
+
import { parseExecArgs, parseValueBySchema } from "../helpers/exec-args.mjs";
|
|
4
|
+
import { createExecCommand } from "./exec.mjs";
|
|
5
|
+
import { createExplainCommand } from "./explain.mjs";
|
|
6
|
+
import { createExploreCommand } from "./explore.mjs";
|
|
7
|
+
import { createLsCommand } from "./ls.mjs";
|
|
8
|
+
import { createMountCommand } from "./mount.mjs";
|
|
9
|
+
import { createReadCommand } from "./read.mjs";
|
|
10
|
+
import { createSearchCommand } from "./search.mjs";
|
|
11
|
+
import { createServeCommand } from "./serve.mjs";
|
|
12
|
+
import { createStatCommand } from "./stat.mjs";
|
|
13
|
+
import { createWriteCommand } from "./write.mjs";
|
|
14
|
+
|
|
15
|
+
//#region src/core/commands/index.ts
|
|
16
|
+
/**
|
|
17
|
+
* Array of all command factories
|
|
18
|
+
*
|
|
19
|
+
* Used by AFSCommandExecutor to register all commands.
|
|
20
|
+
*/
|
|
21
|
+
const commandFactories = [
|
|
22
|
+
createLsCommand,
|
|
23
|
+
createReadCommand,
|
|
24
|
+
createWriteCommand,
|
|
25
|
+
createDeleteCommand,
|
|
26
|
+
createStatCommand,
|
|
27
|
+
createExecCommand,
|
|
28
|
+
createExplainCommand,
|
|
29
|
+
createSearchCommand,
|
|
30
|
+
createMountCommand,
|
|
31
|
+
createServeCommand,
|
|
32
|
+
createExploreCommand
|
|
33
|
+
];
|
|
34
|
+
|
|
35
|
+
//#endregion
|
|
36
|
+
export { commandFactories };
|
|
37
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","names":[],"sources":["../../../src/core/commands/index.ts"],"sourcesContent":["/**\n * CLI Core Commands\n *\n * Re-exports all command implementations and factories.\n */\n\n// Command factories and types\nexport { createDeleteCommand, type DeleteArgs } from \"./delete.js\";\nexport { createExecCommand, type ExecArgs, parseExecArgs, parseValueBySchema } from \"./exec.js\";\nexport { createExplainCommand, type ExplainArgs } from \"./explain.js\";\nexport { createExploreCommand, type ExploreArgs } from \"./explore.js\";\nexport { createLsCommand, type LsArgs } from \"./ls.js\";\nexport {\n createMountCommand,\n type MountAddArgs,\n type MountListArgs,\n type MountRemoveArgs,\n} from \"./mount.js\";\nexport { createReadCommand, type ReadArgs } from \"./read.js\";\nexport { createSearchCommand, type SearchArgs } from \"./search.js\";\nexport { createServeCommand, type ServeArgs, type ServeResult } from \"./serve.js\";\nexport { createStatCommand, type StatArgs } from \"./stat.js\";\n// Types and helpers\nexport type {\n CommandFactory,\n CommandFactoryOptions,\n CommandOutput,\n FormatFunction,\n} from \"./types.js\";\nexport { resolveAFS } from \"./types.js\";\nexport { createWriteCommand, type WriteArgs } from \"./write.js\";\n\n// Import factories for array export\nimport { createDeleteCommand } from \"./delete.js\";\nimport { createExecCommand } from \"./exec.js\";\nimport { createExplainCommand } from \"./explain.js\";\nimport { createExploreCommand } from \"./explore.js\";\nimport { createLsCommand } from \"./ls.js\";\nimport { createMountCommand } from \"./mount.js\";\nimport { createReadCommand } from \"./read.js\";\nimport { createSearchCommand } from \"./search.js\";\nimport { createServeCommand } from \"./serve.js\";\nimport { createStatCommand } from \"./stat.js\";\nimport type { CommandFactory } from \"./types.js\";\nimport { createWriteCommand } from \"./write.js\";\n\n/**\n * Array of all command factories\n *\n * Used by AFSCommandExecutor to register all commands.\n */\nexport const commandFactories: CommandFactory[] = [\n createLsCommand,\n createReadCommand,\n createWriteCommand,\n createDeleteCommand,\n createStatCommand,\n createExecCommand,\n createExplainCommand,\n createSearchCommand,\n createMountCommand,\n createServeCommand,\n createExploreCommand,\n];\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAmDA,MAAa,mBAAqC;CAChD;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACD"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
const require_ls = require('../formatters/ls.cjs');
|
|
2
|
+
const require_path_utils = require('../../path-utils.cjs');
|
|
3
|
+
require('../path-utils.cjs');
|
|
4
|
+
const require_types = require('./types.cjs');
|
|
5
|
+
|
|
6
|
+
//#region src/core/commands/ls.ts
|
|
7
|
+
/**
|
|
8
|
+
* Create ls command factory
|
|
9
|
+
*/
|
|
10
|
+
function createLsCommand(options) {
|
|
11
|
+
return {
|
|
12
|
+
command: ["ls [path]", "list [path]"],
|
|
13
|
+
describe: "List directory contents",
|
|
14
|
+
builder: {
|
|
15
|
+
path: {
|
|
16
|
+
type: "string",
|
|
17
|
+
default: "/",
|
|
18
|
+
description: "Path to list"
|
|
19
|
+
},
|
|
20
|
+
depth: {
|
|
21
|
+
type: "number",
|
|
22
|
+
default: 1,
|
|
23
|
+
description: "Maximum depth to list"
|
|
24
|
+
},
|
|
25
|
+
limit: {
|
|
26
|
+
type: "number",
|
|
27
|
+
description: "Maximum number of entries to return"
|
|
28
|
+
},
|
|
29
|
+
"max-children": {
|
|
30
|
+
type: "number",
|
|
31
|
+
description: "Maximum children per directory"
|
|
32
|
+
},
|
|
33
|
+
pattern: {
|
|
34
|
+
type: "string",
|
|
35
|
+
description: "Glob pattern to filter entries"
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
handler: async (argv) => {
|
|
39
|
+
const afs = await require_types.resolveAFS(options);
|
|
40
|
+
const canonicalPath = require_path_utils.cliPathToCanonical(argv.path || "/");
|
|
41
|
+
const result = await afs.list(canonicalPath, {
|
|
42
|
+
maxDepth: argv.depth ?? 1,
|
|
43
|
+
limit: argv.limit,
|
|
44
|
+
maxChildren: argv.maxChildren,
|
|
45
|
+
pattern: argv.pattern
|
|
46
|
+
});
|
|
47
|
+
options.onResult({
|
|
48
|
+
command: "ls",
|
|
49
|
+
result,
|
|
50
|
+
format: require_ls.formatLsOutput
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
//#endregion
|
|
57
|
+
exports.createLsCommand = createLsCommand;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { CommandFactoryOptions } from "./types.cjs";
|
|
2
|
+
import { CommandModule } from "yargs";
|
|
3
|
+
|
|
4
|
+
//#region src/core/commands/ls.d.ts
|
|
5
|
+
/**
|
|
6
|
+
* Ls command arguments
|
|
7
|
+
*/
|
|
8
|
+
interface LsArgs {
|
|
9
|
+
path: string;
|
|
10
|
+
depth: number;
|
|
11
|
+
limit?: number;
|
|
12
|
+
maxChildren?: number;
|
|
13
|
+
pattern?: string;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Create ls command factory
|
|
17
|
+
*/
|
|
18
|
+
declare function createLsCommand(options: CommandFactoryOptions): CommandModule<unknown, LsArgs>;
|
|
19
|
+
//#endregion
|
|
20
|
+
export { LsArgs, createLsCommand };
|
|
21
|
+
//# sourceMappingURL=ls.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ls.d.cts","names":[],"sources":["../../../src/core/commands/ls.ts"],"mappings":";;;;;;;UAeiB,MAAA;EACf,IAAA;EACA,KAAA;EACA,KAAA;EACA,WAAA;EACA,OAAA;AAAA;;;;iBAMc,eAAA,CAAgB,OAAA,EAAS,qBAAA,GAAwB,aAAA,UAAuB,MAAA"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { CommandFactoryOptions } from "./types.mjs";
|
|
2
|
+
import { CommandModule } from "yargs";
|
|
3
|
+
|
|
4
|
+
//#region src/core/commands/ls.d.ts
|
|
5
|
+
/**
|
|
6
|
+
* Ls command arguments
|
|
7
|
+
*/
|
|
8
|
+
interface LsArgs {
|
|
9
|
+
path: string;
|
|
10
|
+
depth: number;
|
|
11
|
+
limit?: number;
|
|
12
|
+
maxChildren?: number;
|
|
13
|
+
pattern?: string;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Create ls command factory
|
|
17
|
+
*/
|
|
18
|
+
declare function createLsCommand(options: CommandFactoryOptions): CommandModule<unknown, LsArgs>;
|
|
19
|
+
//#endregion
|
|
20
|
+
export { LsArgs, createLsCommand };
|
|
21
|
+
//# sourceMappingURL=ls.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ls.d.mts","names":[],"sources":["../../../src/core/commands/ls.ts"],"mappings":";;;;;;;UAeiB,MAAA;EACf,IAAA;EACA,KAAA;EACA,KAAA;EACA,WAAA;EACA,OAAA;AAAA;;;;iBAMc,eAAA,CAAgB,OAAA,EAAS,qBAAA,GAAwB,aAAA,UAAuB,MAAA"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { formatLsOutput } from "../formatters/ls.mjs";
|
|
2
|
+
import { cliPathToCanonical } from "../../path-utils.mjs";
|
|
3
|
+
import "../path-utils.mjs";
|
|
4
|
+
import { resolveAFS } from "./types.mjs";
|
|
5
|
+
|
|
6
|
+
//#region src/core/commands/ls.ts
|
|
7
|
+
/**
|
|
8
|
+
* Create ls command factory
|
|
9
|
+
*/
|
|
10
|
+
function createLsCommand(options) {
|
|
11
|
+
return {
|
|
12
|
+
command: ["ls [path]", "list [path]"],
|
|
13
|
+
describe: "List directory contents",
|
|
14
|
+
builder: {
|
|
15
|
+
path: {
|
|
16
|
+
type: "string",
|
|
17
|
+
default: "/",
|
|
18
|
+
description: "Path to list"
|
|
19
|
+
},
|
|
20
|
+
depth: {
|
|
21
|
+
type: "number",
|
|
22
|
+
default: 1,
|
|
23
|
+
description: "Maximum depth to list"
|
|
24
|
+
},
|
|
25
|
+
limit: {
|
|
26
|
+
type: "number",
|
|
27
|
+
description: "Maximum number of entries to return"
|
|
28
|
+
},
|
|
29
|
+
"max-children": {
|
|
30
|
+
type: "number",
|
|
31
|
+
description: "Maximum children per directory"
|
|
32
|
+
},
|
|
33
|
+
pattern: {
|
|
34
|
+
type: "string",
|
|
35
|
+
description: "Glob pattern to filter entries"
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
handler: async (argv) => {
|
|
39
|
+
const afs = await resolveAFS(options);
|
|
40
|
+
const canonicalPath = cliPathToCanonical(argv.path || "/");
|
|
41
|
+
const result = await afs.list(canonicalPath, {
|
|
42
|
+
maxDepth: argv.depth ?? 1,
|
|
43
|
+
limit: argv.limit,
|
|
44
|
+
maxChildren: argv.maxChildren,
|
|
45
|
+
pattern: argv.pattern
|
|
46
|
+
});
|
|
47
|
+
options.onResult({
|
|
48
|
+
command: "ls",
|
|
49
|
+
result,
|
|
50
|
+
format: formatLsOutput
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
//#endregion
|
|
57
|
+
export { createLsCommand };
|
|
58
|
+
//# sourceMappingURL=ls.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ls.mjs","names":[],"sources":["../../../src/core/commands/ls.ts"],"sourcesContent":["/**\n * ls Command - Core Implementation\n *\n * Lists directory contents. Accepts AFS instance directly.\n * Returns AFSListResult directly (no custom type).\n */\n\nimport type { CommandModule } from \"yargs\";\nimport { formatLsOutput } from \"../formatters/index.js\";\nimport { cliPathToCanonical } from \"../path-utils.js\";\nimport { type CommandFactoryOptions, resolveAFS } from \"./types.js\";\n\n/**\n * Ls command arguments\n */\nexport interface LsArgs {\n path: string;\n depth: number;\n limit?: number;\n maxChildren?: number;\n pattern?: string;\n}\n\n/**\n * Create ls command factory\n */\nexport function createLsCommand(options: CommandFactoryOptions): CommandModule<unknown, LsArgs> {\n return {\n command: [\"ls [path]\", \"list [path]\"],\n describe: \"List directory contents\",\n builder: {\n path: {\n type: \"string\",\n default: \"/\",\n description: \"Path to list\",\n },\n depth: {\n type: \"number\",\n default: 1,\n description: \"Maximum depth to list\",\n },\n limit: {\n type: \"number\",\n description: \"Maximum number of entries to return\",\n },\n \"max-children\": {\n type: \"number\",\n description: \"Maximum children per directory\",\n },\n pattern: {\n type: \"string\",\n description: \"Glob pattern to filter entries\",\n },\n },\n handler: async (argv) => {\n const afs = await resolveAFS(options);\n const canonicalPath = cliPathToCanonical(argv.path || \"/\");\n const result = await afs.list(canonicalPath, {\n maxDepth: argv.depth ?? 1,\n limit: argv.limit,\n maxChildren: argv.maxChildren,\n pattern: argv.pattern,\n });\n options.onResult({\n command: \"ls\",\n result,\n format: formatLsOutput,\n });\n },\n };\n}\n"],"mappings":";;;;;;;;;AA0BA,SAAgB,gBAAgB,SAAgE;AAC9F,QAAO;EACL,SAAS,CAAC,aAAa,cAAc;EACrC,UAAU;EACV,SAAS;GACP,MAAM;IACJ,MAAM;IACN,SAAS;IACT,aAAa;IACd;GACD,OAAO;IACL,MAAM;IACN,SAAS;IACT,aAAa;IACd;GACD,OAAO;IACL,MAAM;IACN,aAAa;IACd;GACD,gBAAgB;IACd,MAAM;IACN,aAAa;IACd;GACD,SAAS;IACP,MAAM;IACN,aAAa;IACd;GACF;EACD,SAAS,OAAO,SAAS;GACvB,MAAM,MAAM,MAAM,WAAW,QAAQ;GACrC,MAAM,gBAAgB,mBAAmB,KAAK,QAAQ,IAAI;GAC1D,MAAM,SAAS,MAAM,IAAI,KAAK,eAAe;IAC3C,UAAU,KAAK,SAAS;IACxB,OAAO,KAAK;IACZ,aAAa,KAAK;IAClB,SAAS,KAAK;IACf,CAAC;AACF,WAAQ,SAAS;IACf,SAAS;IACT;IACA,QAAQ;IACT,CAAC;;EAEL"}
|
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
const require_schema = require('../../config/schema.cjs');
|
|
2
|
+
const require_mount_commands = require('../../config/mount-commands.cjs');
|
|
3
|
+
const require_mount = require('../formatters/mount.cjs');
|
|
4
|
+
|
|
5
|
+
//#region src/core/commands/mount.ts
|
|
6
|
+
/**
|
|
7
|
+
* Create mount command factory (with subcommands)
|
|
8
|
+
*/
|
|
9
|
+
function createMountCommand(options) {
|
|
10
|
+
return {
|
|
11
|
+
command: "mount",
|
|
12
|
+
describe: "Mount management",
|
|
13
|
+
builder: (yargs) => yargs.command(createMountListSubcommand(options)).command(createMountAddSubcommand(options)).command(createMountRemoveSubcommand(options)).command(createMountValidateSubcommand(options)).demandCommand(1, "Please specify a subcommand").alias("help", "h"),
|
|
14
|
+
handler: () => {}
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Create mount list subcommand
|
|
19
|
+
*/
|
|
20
|
+
function createMountListSubcommand(options) {
|
|
21
|
+
return {
|
|
22
|
+
command: ["list", "ls"],
|
|
23
|
+
describe: "List all mounts",
|
|
24
|
+
builder: { namespace: {
|
|
25
|
+
type: "string",
|
|
26
|
+
description: "Filter by namespace"
|
|
27
|
+
} },
|
|
28
|
+
handler: async () => {
|
|
29
|
+
const result = await require_mount_commands.configMountListCommand(options.cwd ?? process.cwd());
|
|
30
|
+
options.onResult({
|
|
31
|
+
command: "mount list",
|
|
32
|
+
result: result.mounts,
|
|
33
|
+
format: require_mount.formatMountListOutput
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Create mount add subcommand
|
|
40
|
+
*/
|
|
41
|
+
/** Known argv keys that are NOT provider options */
|
|
42
|
+
const KNOWN_MOUNT_KEYS = new Set([
|
|
43
|
+
"path",
|
|
44
|
+
"uri",
|
|
45
|
+
"namespace",
|
|
46
|
+
"description",
|
|
47
|
+
"sensitive-args",
|
|
48
|
+
"sensitiveArgs",
|
|
49
|
+
"_",
|
|
50
|
+
"$0",
|
|
51
|
+
"help",
|
|
52
|
+
"h",
|
|
53
|
+
"version",
|
|
54
|
+
"v",
|
|
55
|
+
"json",
|
|
56
|
+
"yaml",
|
|
57
|
+
"view",
|
|
58
|
+
"interactive"
|
|
59
|
+
]);
|
|
60
|
+
function createMountAddSubcommand(options) {
|
|
61
|
+
return {
|
|
62
|
+
command: "add <path> <uri>",
|
|
63
|
+
describe: "Add a mount",
|
|
64
|
+
builder: (yargs) => yargs.strict(false).positional("path", {
|
|
65
|
+
type: "string",
|
|
66
|
+
demandOption: true,
|
|
67
|
+
description: "Mount path (e.g., /src)"
|
|
68
|
+
}).positional("uri", {
|
|
69
|
+
type: "string",
|
|
70
|
+
demandOption: true,
|
|
71
|
+
description: "Provider URI (e.g., fs://./src)"
|
|
72
|
+
}).option("namespace", {
|
|
73
|
+
type: "string",
|
|
74
|
+
description: "Mount namespace"
|
|
75
|
+
}).option("description", {
|
|
76
|
+
type: "string",
|
|
77
|
+
description: "Mount description"
|
|
78
|
+
}).option("sensitive-args", {
|
|
79
|
+
type: "string",
|
|
80
|
+
array: true,
|
|
81
|
+
description: "Field names to treat as sensitive credentials"
|
|
82
|
+
}),
|
|
83
|
+
handler: async (argv) => {
|
|
84
|
+
const cwd = options.cwd ?? process.cwd();
|
|
85
|
+
if (!argv.uri || argv.uri.trim() === "") throw new Error("URI is required");
|
|
86
|
+
const resolvedUri = require_mount_commands.resolveUriPath(argv.uri, cwd);
|
|
87
|
+
const validation = require_schema.MountSchema.safeParse({
|
|
88
|
+
path: argv.path,
|
|
89
|
+
uri: resolvedUri,
|
|
90
|
+
description: argv.description
|
|
91
|
+
});
|
|
92
|
+
if (!validation.success) {
|
|
93
|
+
const errors = validation.error.issues.map((e) => e.message).join("; ");
|
|
94
|
+
throw new Error(errors);
|
|
95
|
+
}
|
|
96
|
+
const extraOptions = {};
|
|
97
|
+
for (const [key, value] of Object.entries(argv)) if (!KNOWN_MOUNT_KEYS.has(key) && !key.startsWith("-")) extraOptions[key] = value;
|
|
98
|
+
const sensitiveArgs = argv["sensitive-args"] ?? [];
|
|
99
|
+
const { resolveCredentialsForMount } = await Promise.resolve().then(() => require("../../config/afs-loader.cjs"));
|
|
100
|
+
const { createCLIAuthContext } = await Promise.resolve().then(() => require("../../credential/cli-auth-context.cjs"));
|
|
101
|
+
const { createCredentialStore } = await Promise.resolve().then(() => require("../../credential/store.cjs"));
|
|
102
|
+
const authContext = createCLIAuthContext();
|
|
103
|
+
const credentialStore = createCredentialStore();
|
|
104
|
+
const credResolveOptions = {
|
|
105
|
+
cwd,
|
|
106
|
+
uri: resolvedUri,
|
|
107
|
+
mountPath: validation.data.path,
|
|
108
|
+
authContext,
|
|
109
|
+
credentialStore,
|
|
110
|
+
extraOptions: Object.keys(extraOptions).length > 0 ? extraOptions : void 0,
|
|
111
|
+
sensitiveArgs
|
|
112
|
+
};
|
|
113
|
+
let credResult = await resolveCredentialsForMount(credResolveOptions);
|
|
114
|
+
const { verifyMount } = await Promise.resolve().then(() => require("../../config/afs-loader.cjs"));
|
|
115
|
+
let verifyOptions = {
|
|
116
|
+
...extraOptions,
|
|
117
|
+
...credResult?.allValues ?? {}
|
|
118
|
+
};
|
|
119
|
+
try {
|
|
120
|
+
await verifyMount(resolvedUri, validation.data.path, Object.keys(verifyOptions).length > 0 ? verifyOptions : void 0);
|
|
121
|
+
} catch (verifyError) {
|
|
122
|
+
if (credResult && !credResult.collected) {
|
|
123
|
+
credResult = await resolveCredentialsForMount({
|
|
124
|
+
...credResolveOptions,
|
|
125
|
+
forceCollect: true
|
|
126
|
+
});
|
|
127
|
+
verifyOptions = {
|
|
128
|
+
...extraOptions,
|
|
129
|
+
...credResult?.allValues ?? {}
|
|
130
|
+
};
|
|
131
|
+
await verifyMount(resolvedUri, validation.data.path, Object.keys(verifyOptions).length > 0 ? verifyOptions : void 0);
|
|
132
|
+
} else throw verifyError;
|
|
133
|
+
}
|
|
134
|
+
if (credResult) await credResult.persistCredentials();
|
|
135
|
+
const nonSensitiveFromCreds = credResult?.nonSensitive ?? {};
|
|
136
|
+
const mountOptions = {
|
|
137
|
+
...extraOptions,
|
|
138
|
+
...nonSensitiveFromCreds
|
|
139
|
+
};
|
|
140
|
+
if (credResult?.sensitiveFields) for (const field of credResult.sensitiveFields) delete mountOptions[field];
|
|
141
|
+
const finalMountOptions = Object.keys(mountOptions).length > 0 ? mountOptions : void 0;
|
|
142
|
+
const persistUri = credResult?.configUri ?? validation.data.uri;
|
|
143
|
+
const result = await require_mount_commands.persistMount(cwd, {
|
|
144
|
+
path: validation.data.path,
|
|
145
|
+
uri: persistUri,
|
|
146
|
+
description: argv.description,
|
|
147
|
+
options: finalMountOptions
|
|
148
|
+
});
|
|
149
|
+
if (!result.success) throw new Error(result.message ?? "Failed to add mount");
|
|
150
|
+
options.onResult({
|
|
151
|
+
command: "mount add",
|
|
152
|
+
result: {
|
|
153
|
+
success: true,
|
|
154
|
+
path: argv.path,
|
|
155
|
+
uri: resolvedUri
|
|
156
|
+
},
|
|
157
|
+
format: (res) => `Mounted ${res.uri} at ${res.path}`
|
|
158
|
+
});
|
|
159
|
+
}
|
|
160
|
+
};
|
|
161
|
+
}
|
|
162
|
+
/**
|
|
163
|
+
* Create mount remove subcommand
|
|
164
|
+
*/
|
|
165
|
+
function createMountRemoveSubcommand(options) {
|
|
166
|
+
return {
|
|
167
|
+
command: ["remove <path>", "rm <path>"],
|
|
168
|
+
describe: "Unmount a path",
|
|
169
|
+
builder: {
|
|
170
|
+
path: {
|
|
171
|
+
type: "string",
|
|
172
|
+
demandOption: true,
|
|
173
|
+
description: "Mount path to remove"
|
|
174
|
+
},
|
|
175
|
+
namespace: {
|
|
176
|
+
type: "string",
|
|
177
|
+
description: "Namespace of the mount"
|
|
178
|
+
}
|
|
179
|
+
},
|
|
180
|
+
handler: async (argv) => {
|
|
181
|
+
const result = await require_mount_commands.mountRemoveCommand(options.cwd ?? process.cwd(), argv.path);
|
|
182
|
+
if (!result.success) throw new Error(result.message ?? "Failed to remove mount");
|
|
183
|
+
options.onResult({
|
|
184
|
+
command: "mount remove",
|
|
185
|
+
result: {
|
|
186
|
+
success: true,
|
|
187
|
+
path: argv.path
|
|
188
|
+
},
|
|
189
|
+
format: (res) => res.success ? `Unmounted ${res.path}` : `Failed to unmount ${res.path}`
|
|
190
|
+
});
|
|
191
|
+
}
|
|
192
|
+
};
|
|
193
|
+
}
|
|
194
|
+
/**
|
|
195
|
+
* Format mount validate output
|
|
196
|
+
*/
|
|
197
|
+
function formatMountValidateOutput(result, view) {
|
|
198
|
+
if (view === "json") return JSON.stringify(result, null, 2);
|
|
199
|
+
if (result.valid) return "Configuration is valid";
|
|
200
|
+
return ["Configuration validation failed:", ...result.errors.map((e) => ` - ${e}`)].join("\n");
|
|
201
|
+
}
|
|
202
|
+
/**
|
|
203
|
+
* Create mount validate subcommand
|
|
204
|
+
*/
|
|
205
|
+
function createMountValidateSubcommand(options) {
|
|
206
|
+
return {
|
|
207
|
+
command: "validate",
|
|
208
|
+
describe: "Validate mount configuration",
|
|
209
|
+
handler: async () => {
|
|
210
|
+
const result = await require_mount_commands.mountValidateCommand(options.cwd ?? process.cwd());
|
|
211
|
+
options.onResult({
|
|
212
|
+
command: "mount validate",
|
|
213
|
+
result,
|
|
214
|
+
format: formatMountValidateOutput,
|
|
215
|
+
error: result.valid ? void 0 : { message: result.errors.join("; ") }
|
|
216
|
+
});
|
|
217
|
+
}
|
|
218
|
+
};
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
//#endregion
|
|
222
|
+
exports.createMountCommand = createMountCommand;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { CommandFactoryOptions } from "./types.cjs";
|
|
2
|
+
import { CommandModule } from "yargs";
|
|
3
|
+
|
|
4
|
+
//#region src/core/commands/mount.d.ts
|
|
5
|
+
/**
|
|
6
|
+
* Mount list subcommand arguments
|
|
7
|
+
*/
|
|
8
|
+
interface MountListArgs {
|
|
9
|
+
namespace?: string;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Mount add subcommand arguments
|
|
13
|
+
*/
|
|
14
|
+
interface MountAddArgs {
|
|
15
|
+
path: string;
|
|
16
|
+
uri: string;
|
|
17
|
+
namespace?: string;
|
|
18
|
+
description?: string;
|
|
19
|
+
"sensitive-args"?: string[];
|
|
20
|
+
[key: string]: unknown;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Mount remove subcommand arguments
|
|
24
|
+
*/
|
|
25
|
+
interface MountRemoveArgs {
|
|
26
|
+
path: string;
|
|
27
|
+
namespace?: string;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Create mount command factory (with subcommands)
|
|
31
|
+
*/
|
|
32
|
+
declare function createMountCommand(options: CommandFactoryOptions): CommandModule;
|
|
33
|
+
//#endregion
|
|
34
|
+
export { MountAddArgs, MountListArgs, MountRemoveArgs, createMountCommand };
|
|
35
|
+
//# sourceMappingURL=mount.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mount.d.cts","names":[],"sources":["../../../src/core/commands/mount.ts"],"mappings":";;;;;AA+BA;;UAPiB,aAAA;EACf,SAAA;AAAA;;;;UAMe,YAAA;EACf,IAAA;EACA,GAAA;EACA,SAAA;EACA,WAAA;EACA,gBAAA;EAAA,CACC,GAAA;AAAA;;AAcH;;UARiB,eAAA;EACf,IAAA;EACA,SAAA;AAAA;;;;iBAMc,kBAAA,CAAmB,OAAA,EAAS,qBAAA,GAAwB,aAAA"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { CommandFactoryOptions } from "./types.mjs";
|
|
2
|
+
import { CommandModule } from "yargs";
|
|
3
|
+
|
|
4
|
+
//#region src/core/commands/mount.d.ts
|
|
5
|
+
/**
|
|
6
|
+
* Mount list subcommand arguments
|
|
7
|
+
*/
|
|
8
|
+
interface MountListArgs {
|
|
9
|
+
namespace?: string;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Mount add subcommand arguments
|
|
13
|
+
*/
|
|
14
|
+
interface MountAddArgs {
|
|
15
|
+
path: string;
|
|
16
|
+
uri: string;
|
|
17
|
+
namespace?: string;
|
|
18
|
+
description?: string;
|
|
19
|
+
"sensitive-args"?: string[];
|
|
20
|
+
[key: string]: unknown;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Mount remove subcommand arguments
|
|
24
|
+
*/
|
|
25
|
+
interface MountRemoveArgs {
|
|
26
|
+
path: string;
|
|
27
|
+
namespace?: string;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Create mount command factory (with subcommands)
|
|
31
|
+
*/
|
|
32
|
+
declare function createMountCommand(options: CommandFactoryOptions): CommandModule;
|
|
33
|
+
//#endregion
|
|
34
|
+
export { MountAddArgs, MountListArgs, MountRemoveArgs, createMountCommand };
|
|
35
|
+
//# sourceMappingURL=mount.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mount.d.mts","names":[],"sources":["../../../src/core/commands/mount.ts"],"mappings":";;;;;AA+BA;;UAPiB,aAAA;EACf,SAAA;AAAA;;;;UAMe,YAAA;EACf,IAAA;EACA,GAAA;EACA,SAAA;EACA,WAAA;EACA,gBAAA;EAAA,CACC,GAAA;AAAA;;AAcH;;UARiB,eAAA;EACf,IAAA;EACA,SAAA;AAAA;;;;iBAMc,kBAAA,CAAmB,OAAA,EAAS,qBAAA,GAAwB,aAAA"}
|