@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
|
@@ -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"}
|
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
import { MountSchema } from "../../config/schema.mjs";
|
|
2
|
+
import { configMountListCommand, mountRemoveCommand, mountValidateCommand, persistMount, resolveUriPath } from "../../config/mount-commands.mjs";
|
|
3
|
+
import { formatMountListOutput } from "../formatters/mount.mjs";
|
|
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 configMountListCommand(options.cwd ?? process.cwd());
|
|
30
|
+
options.onResult({
|
|
31
|
+
command: "mount list",
|
|
32
|
+
result: result.mounts,
|
|
33
|
+
format: 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 = resolveUriPath(argv.uri, cwd);
|
|
87
|
+
const validation = 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 import("../../config/afs-loader.mjs");
|
|
100
|
+
const { createCLIAuthContext } = await import("../../credential/cli-auth-context.mjs");
|
|
101
|
+
const { createCredentialStore } = await import("../../credential/store.mjs");
|
|
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 import("../../config/afs-loader.mjs");
|
|
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 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 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 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
|
+
export { createMountCommand };
|
|
223
|
+
//# sourceMappingURL=mount.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mount.mjs","names":[],"sources":["../../../src/core/commands/mount.ts"],"sourcesContent":["/**\n * mount Command - Core Implementation\n *\n * Mount management commands for config file operations.\n * Changes are persisted to .afs-config/config.toml.\n */\n\nimport type { Argv, CommandModule } from \"yargs\";\nimport {\n configMountListCommand,\n type MountValidateResult,\n mountRemoveCommand,\n mountValidateCommand,\n persistMount,\n resolveUriPath,\n} from \"../../config/mount-commands.js\";\nimport { MountSchema } from \"../../config/schema.js\";\nimport { formatMountListOutput } from \"../formatters/index.js\";\nimport type { ViewType } from \"../types.js\";\nimport type { CommandFactoryOptions } from \"./types.js\";\n\n/**\n * Mount list subcommand arguments\n */\nexport interface MountListArgs {\n namespace?: string;\n}\n\n/**\n * Mount add subcommand arguments\n */\nexport interface MountAddArgs {\n path: string;\n uri: string;\n namespace?: string;\n description?: string;\n \"sensitive-args\"?: string[];\n [key: string]: unknown;\n}\n\n/**\n * Mount remove subcommand arguments\n */\nexport interface MountRemoveArgs {\n path: string;\n namespace?: string;\n}\n\n/**\n * Create mount command factory (with subcommands)\n */\nexport function createMountCommand(options: CommandFactoryOptions): CommandModule {\n return {\n command: \"mount\",\n describe: \"Mount management\",\n builder: (yargs: Argv) =>\n yargs\n .command(createMountListSubcommand(options))\n .command(createMountAddSubcommand(options))\n .command(createMountRemoveSubcommand(options))\n .command(createMountValidateSubcommand(options))\n .demandCommand(1, \"Please specify a subcommand\")\n .alias(\"help\", \"h\"),\n handler: () => {},\n };\n}\n\n/**\n * Create mount list subcommand\n */\nfunction createMountListSubcommand(\n options: CommandFactoryOptions,\n): CommandModule<unknown, MountListArgs> {\n return {\n command: [\"list\", \"ls\"],\n describe: \"List all mounts\",\n builder: {\n namespace: {\n type: \"string\",\n description: \"Filter by namespace\",\n },\n },\n handler: async () => {\n const cwd = options.cwd ?? process.cwd();\n const result = await configMountListCommand(cwd);\n options.onResult({\n command: \"mount list\",\n result: result.mounts,\n format: formatMountListOutput,\n });\n },\n };\n}\n\n/**\n * Create mount add subcommand\n */\n/** Known argv keys that are NOT provider options */\nconst KNOWN_MOUNT_KEYS = new Set([\n \"path\",\n \"uri\",\n \"namespace\",\n \"description\",\n \"sensitive-args\",\n \"sensitiveArgs\",\n \"_\",\n \"$0\",\n \"help\",\n \"h\",\n \"version\",\n \"v\",\n // Global options from executor\n \"json\",\n \"yaml\",\n \"view\",\n \"interactive\",\n]);\n\nfunction createMountAddSubcommand(\n options: CommandFactoryOptions,\n): CommandModule<unknown, MountAddArgs> {\n return {\n command: \"add <path> <uri>\",\n describe: \"Add a mount\",\n builder: (yargs) =>\n yargs\n .strict(false)\n .positional(\"path\", {\n type: \"string\",\n demandOption: true,\n description: \"Mount path (e.g., /src)\",\n })\n .positional(\"uri\", {\n type: \"string\",\n demandOption: true,\n description: \"Provider URI (e.g., fs://./src)\",\n })\n .option(\"namespace\", {\n type: \"string\",\n description: \"Mount namespace\",\n })\n .option(\"description\", {\n type: \"string\",\n description: \"Mount description\",\n })\n .option(\"sensitive-args\", {\n type: \"string\",\n array: true,\n description: \"Field names to treat as sensitive credentials\",\n }) as Argv<MountAddArgs>,\n handler: async (argv) => {\n const cwd = options.cwd ?? process.cwd();\n\n // Step 1: Validate and resolve URI\n if (!argv.uri || argv.uri.trim() === \"\") {\n throw new Error(\"URI is required\");\n }\n const resolvedUri = resolveUriPath(argv.uri, cwd);\n\n const validation = MountSchema.safeParse({\n path: argv.path,\n uri: resolvedUri,\n description: argv.description,\n });\n if (!validation.success) {\n const errors = validation.error.issues.map((e) => e.message).join(\"; \");\n throw new Error(errors);\n }\n\n // Collect extra options (any unknown --key value pairs)\n const extraOptions: Record<string, unknown> = {};\n for (const [key, value] of Object.entries(argv)) {\n if (!KNOWN_MOUNT_KEYS.has(key) && !key.startsWith(\"-\")) {\n extraOptions[key] = value;\n }\n }\n const sensitiveArgs = argv[\"sensitive-args\"] ?? [];\n\n // Step 2: Resolve credentials FIRST (opens browser if needed)\n // This must happen before persisting mount config, so that if the user\n // cancels, no incomplete mount is left in config.toml.\n const { resolveCredentialsForMount } = await import(\"../../config/afs-loader.js\");\n const { createCLIAuthContext } = await import(\"../../credential/cli-auth-context.js\");\n const { createCredentialStore } = await import(\"../../credential/store.js\");\n\n const authContext = createCLIAuthContext();\n const credentialStore = createCredentialStore();\n const credResolveOptions = {\n cwd,\n uri: resolvedUri,\n mountPath: validation.data.path,\n authContext,\n credentialStore,\n extraOptions: Object.keys(extraOptions).length > 0 ? extraOptions : undefined,\n sensitiveArgs,\n };\n\n let credResult = await resolveCredentialsForMount(credResolveOptions);\n\n // Step 3: Verify mount works before persisting\n // Use all resolved values (including sensitive) for provider creation verification\n const { verifyMount } = await import(\"../../config/afs-loader.js\");\n let verifyOptions = { ...extraOptions, ...(credResult?.allValues ?? {}) };\n\n try {\n await verifyMount(\n resolvedUri,\n validation.data.path,\n Object.keys(verifyOptions).length > 0 ? verifyOptions : undefined,\n );\n } catch (verifyError) {\n // Health check failed with silently resolved credentials →\n // retry once with forced interactive collection so user can fix values\n if (credResult && !credResult.collected) {\n credResult = await resolveCredentialsForMount({\n ...credResolveOptions,\n forceCollect: true,\n });\n verifyOptions = { ...extraOptions, ...(credResult?.allValues ?? {}) };\n await verifyMount(\n resolvedUri,\n validation.data.path,\n Object.keys(verifyOptions).length > 0 ? verifyOptions : undefined,\n );\n } else {\n throw verifyError;\n }\n }\n\n // Step 4: Persist credentials (only after health check succeeds) and mount config\n if (credResult) {\n await credResult.persistCredentials();\n }\n\n const nonSensitiveFromCreds = credResult?.nonSensitive ?? {};\n const mountOptions = { ...extraOptions, ...nonSensitiveFromCreds };\n // Strip sensitive fields — they go to credentials.toml, not config.toml\n if (credResult?.sensitiveFields) {\n for (const field of credResult.sensitiveFields) {\n delete mountOptions[field];\n }\n }\n const finalMountOptions = Object.keys(mountOptions).length > 0 ? mountOptions : undefined;\n\n // Use configUri (env params stripped) for config.toml — env values are in credentials.toml\n const persistUri = credResult?.configUri ?? validation.data.uri;\n\n const result = await persistMount(cwd, {\n path: validation.data.path,\n uri: persistUri,\n description: argv.description,\n options: finalMountOptions,\n });\n if (!result.success) {\n throw new Error(result.message ?? \"Failed to add mount\");\n }\n\n options.onResult({\n command: \"mount add\",\n result: { success: true, path: argv.path, uri: resolvedUri },\n format: (res: { path: string; uri: string }) => `Mounted ${res.uri} at ${res.path}`,\n });\n },\n };\n}\n\n/**\n * Create mount remove subcommand\n */\nfunction createMountRemoveSubcommand(\n options: CommandFactoryOptions,\n): CommandModule<unknown, MountRemoveArgs> {\n return {\n command: [\"remove <path>\", \"rm <path>\"],\n describe: \"Unmount a path\",\n builder: {\n path: {\n type: \"string\",\n demandOption: true,\n description: \"Mount path to remove\",\n },\n namespace: {\n type: \"string\",\n description: \"Namespace of the mount\",\n },\n },\n handler: async (argv) => {\n const cwd = options.cwd ?? process.cwd();\n const result = await mountRemoveCommand(cwd, argv.path);\n if (!result.success) {\n throw new Error(result.message ?? \"Failed to remove mount\");\n }\n options.onResult({\n command: \"mount remove\",\n result: { success: true, path: argv.path },\n format: (res: { success: boolean; path: string }) =>\n res.success ? `Unmounted ${res.path}` : `Failed to unmount ${res.path}`,\n });\n },\n };\n}\n\n/**\n * Format mount validate output\n */\nfunction formatMountValidateOutput(result: MountValidateResult, view?: ViewType): string {\n if (view === \"json\") {\n return JSON.stringify(result, null, 2);\n }\n\n if (result.valid) {\n return \"Configuration is valid\";\n }\n\n const lines = [\"Configuration validation failed:\", ...result.errors.map((e) => ` - ${e}`)];\n return lines.join(\"\\n\");\n}\n\n/**\n * Create mount validate subcommand\n */\nfunction createMountValidateSubcommand(options: CommandFactoryOptions): CommandModule {\n return {\n command: \"validate\",\n describe: \"Validate mount configuration\",\n handler: async () => {\n const cwd = options.cwd ?? process.cwd();\n const result = await mountValidateCommand(cwd);\n\n options.onResult({\n command: \"mount validate\",\n result,\n format: formatMountValidateOutput,\n error: result.valid ? undefined : { message: result.errors.join(\"; \") },\n });\n },\n };\n}\n"],"mappings":"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"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
const require_read = require('../formatters/read.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/read.ts
|
|
7
|
+
/**
|
|
8
|
+
* Create read command factory
|
|
9
|
+
*/
|
|
10
|
+
function createReadCommand(options) {
|
|
11
|
+
return {
|
|
12
|
+
command: "read <path>",
|
|
13
|
+
describe: "Read file content",
|
|
14
|
+
builder: { path: {
|
|
15
|
+
type: "string",
|
|
16
|
+
demandOption: true,
|
|
17
|
+
description: "Path to read"
|
|
18
|
+
} },
|
|
19
|
+
handler: async (argv) => {
|
|
20
|
+
const afs = await require_types.resolveAFS(options);
|
|
21
|
+
const canonicalPath = require_path_utils.cliPathToCanonical(argv.path);
|
|
22
|
+
const result = await afs.read(canonicalPath);
|
|
23
|
+
if (result.data) {
|
|
24
|
+
result.data.path = argv.path;
|
|
25
|
+
const isMeta = argv.path.endsWith("/.meta") || argv.path.includes("/.meta/");
|
|
26
|
+
const isAction = argv.path.includes("/.actions");
|
|
27
|
+
if (!isMeta && !isAction) try {
|
|
28
|
+
const statResult = await afs.stat(canonicalPath);
|
|
29
|
+
if (statResult.data) {
|
|
30
|
+
result.data.meta = {
|
|
31
|
+
...result.data.meta,
|
|
32
|
+
...statResult.data.meta
|
|
33
|
+
};
|
|
34
|
+
result.data.actions = statResult.data.actions;
|
|
35
|
+
}
|
|
36
|
+
} catch {}
|
|
37
|
+
}
|
|
38
|
+
options.onResult({
|
|
39
|
+
command: "read",
|
|
40
|
+
result,
|
|
41
|
+
format: require_read.formatReadOutput
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
//#endregion
|
|
48
|
+
exports.createReadCommand = createReadCommand;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { CommandFactoryOptions } from "./types.cjs";
|
|
2
|
+
import { CommandModule } from "yargs";
|
|
3
|
+
|
|
4
|
+
//#region src/core/commands/read.d.ts
|
|
5
|
+
/**
|
|
6
|
+
* Read command arguments
|
|
7
|
+
*/
|
|
8
|
+
interface ReadArgs {
|
|
9
|
+
path: string;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Create read command factory
|
|
13
|
+
*/
|
|
14
|
+
declare function createReadCommand(options: CommandFactoryOptions): CommandModule<unknown, ReadArgs>;
|
|
15
|
+
//#endregion
|
|
16
|
+
export { ReadArgs, createReadCommand };
|
|
17
|
+
//# sourceMappingURL=read.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"read.d.cts","names":[],"sources":["../../../src/core/commands/read.ts"],"mappings":";;;;;AAsBA;;UAPiB,QAAA;EACf,IAAA;AAAA;;;;iBAMc,iBAAA,CACd,OAAA,EAAS,qBAAA,GACR,aAAA,UAAuB,QAAA"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { CommandFactoryOptions } from "./types.mjs";
|
|
2
|
+
import { CommandModule } from "yargs";
|
|
3
|
+
|
|
4
|
+
//#region src/core/commands/read.d.ts
|
|
5
|
+
/**
|
|
6
|
+
* Read command arguments
|
|
7
|
+
*/
|
|
8
|
+
interface ReadArgs {
|
|
9
|
+
path: string;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Create read command factory
|
|
13
|
+
*/
|
|
14
|
+
declare function createReadCommand(options: CommandFactoryOptions): CommandModule<unknown, ReadArgs>;
|
|
15
|
+
//#endregion
|
|
16
|
+
export { ReadArgs, createReadCommand };
|
|
17
|
+
//# sourceMappingURL=read.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"read.d.mts","names":[],"sources":["../../../src/core/commands/read.ts"],"mappings":";;;;;AAsBA;;UAPiB,QAAA;EACf,IAAA;AAAA;;;;iBAMc,iBAAA,CACd,OAAA,EAAS,qBAAA,GACR,aAAA,UAAuB,QAAA"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { formatReadOutput } from "../formatters/read.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/read.ts
|
|
7
|
+
/**
|
|
8
|
+
* Create read command factory
|
|
9
|
+
*/
|
|
10
|
+
function createReadCommand(options) {
|
|
11
|
+
return {
|
|
12
|
+
command: "read <path>",
|
|
13
|
+
describe: "Read file content",
|
|
14
|
+
builder: { path: {
|
|
15
|
+
type: "string",
|
|
16
|
+
demandOption: true,
|
|
17
|
+
description: "Path to read"
|
|
18
|
+
} },
|
|
19
|
+
handler: async (argv) => {
|
|
20
|
+
const afs = await resolveAFS(options);
|
|
21
|
+
const canonicalPath = cliPathToCanonical(argv.path);
|
|
22
|
+
const result = await afs.read(canonicalPath);
|
|
23
|
+
if (result.data) {
|
|
24
|
+
result.data.path = argv.path;
|
|
25
|
+
const isMeta = argv.path.endsWith("/.meta") || argv.path.includes("/.meta/");
|
|
26
|
+
const isAction = argv.path.includes("/.actions");
|
|
27
|
+
if (!isMeta && !isAction) try {
|
|
28
|
+
const statResult = await afs.stat(canonicalPath);
|
|
29
|
+
if (statResult.data) {
|
|
30
|
+
result.data.meta = {
|
|
31
|
+
...result.data.meta,
|
|
32
|
+
...statResult.data.meta
|
|
33
|
+
};
|
|
34
|
+
result.data.actions = statResult.data.actions;
|
|
35
|
+
}
|
|
36
|
+
} catch {}
|
|
37
|
+
}
|
|
38
|
+
options.onResult({
|
|
39
|
+
command: "read",
|
|
40
|
+
result,
|
|
41
|
+
format: formatReadOutput
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
//#endregion
|
|
48
|
+
export { createReadCommand };
|
|
49
|
+
//# sourceMappingURL=read.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"read.mjs","names":[],"sources":["../../../src/core/commands/read.ts"],"sourcesContent":["/**\n * read Command - Core Implementation\n *\n * Reads file/node content. Accepts AFS instance directly.\n * Returns AFSReadResult directly (no custom type).\n */\n\nimport type { CommandModule } from \"yargs\";\nimport { formatReadOutput } from \"../formatters/index.js\";\nimport { cliPathToCanonical } from \"../path-utils.js\";\nimport { type CommandFactoryOptions, resolveAFS } from \"./types.js\";\n\n/**\n * Read command arguments\n */\nexport interface ReadArgs {\n path: string;\n}\n\n/**\n * Create read command factory\n */\nexport function createReadCommand(\n options: CommandFactoryOptions,\n): CommandModule<unknown, ReadArgs> {\n return {\n command: \"read <path>\",\n describe: \"Read file content\",\n builder: {\n path: {\n type: \"string\",\n demandOption: true,\n description: \"Path to read\",\n },\n },\n handler: async (argv) => {\n const afs = await resolveAFS(options);\n const canonicalPath = cliPathToCanonical(argv.path);\n const result = await afs.read(canonicalPath);\n\n // Use the original CLI path for display (UX-friendly, e.g. /fs instead of $afs/fs)\n if (result.data) {\n result.data.path = argv.path;\n\n // Fetch metadata and actions from stat for non-virtual paths\n const isMeta = argv.path.endsWith(\"/.meta\") || argv.path.includes(\"/.meta/\");\n const isAction = argv.path.includes(\"/.actions\");\n\n if (!isMeta && !isAction) {\n try {\n const statResult = await afs.stat(canonicalPath);\n if (statResult.data) {\n result.data.meta = { ...result.data.meta, ...statResult.data.meta };\n result.data.actions = statResult.data.actions;\n }\n } catch {\n // stat not supported\n }\n }\n }\n\n options.onResult({\n command: \"read\",\n result,\n format: formatReadOutput,\n });\n },\n };\n}\n"],"mappings":";;;;;;;;;AAsBA,SAAgB,kBACd,SACkC;AAClC,QAAO;EACL,SAAS;EACT,UAAU;EACV,SAAS,EACP,MAAM;GACJ,MAAM;GACN,cAAc;GACd,aAAa;GACd,EACF;EACD,SAAS,OAAO,SAAS;GACvB,MAAM,MAAM,MAAM,WAAW,QAAQ;GACrC,MAAM,gBAAgB,mBAAmB,KAAK,KAAK;GACnD,MAAM,SAAS,MAAM,IAAI,KAAK,cAAc;AAG5C,OAAI,OAAO,MAAM;AACf,WAAO,KAAK,OAAO,KAAK;IAGxB,MAAM,SAAS,KAAK,KAAK,SAAS,SAAS,IAAI,KAAK,KAAK,SAAS,UAAU;IAC5E,MAAM,WAAW,KAAK,KAAK,SAAS,YAAY;AAEhD,QAAI,CAAC,UAAU,CAAC,SACd,KAAI;KACF,MAAM,aAAa,MAAM,IAAI,KAAK,cAAc;AAChD,SAAI,WAAW,MAAM;AACnB,aAAO,KAAK,OAAO;OAAE,GAAG,OAAO,KAAK;OAAM,GAAG,WAAW,KAAK;OAAM;AACnE,aAAO,KAAK,UAAU,WAAW,KAAK;;YAElC;;AAMZ,WAAQ,SAAS;IACf,SAAS;IACT;IACA,QAAQ;IACT,CAAC;;EAEL"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
const require_search = require('../formatters/search.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/search.ts
|
|
7
|
+
/**
|
|
8
|
+
* Create search command factory
|
|
9
|
+
*/
|
|
10
|
+
function createSearchCommand(options) {
|
|
11
|
+
return {
|
|
12
|
+
command: "search <path> <query>",
|
|
13
|
+
describe: "Search for content within an AFS path",
|
|
14
|
+
builder: {
|
|
15
|
+
path: {
|
|
16
|
+
type: "string",
|
|
17
|
+
demandOption: true,
|
|
18
|
+
description: "Path to search in"
|
|
19
|
+
},
|
|
20
|
+
query: {
|
|
21
|
+
type: "string",
|
|
22
|
+
demandOption: true,
|
|
23
|
+
description: "Search query"
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
handler: async (argv) => {
|
|
27
|
+
const afs = await require_types.resolveAFS(options);
|
|
28
|
+
const canonicalPath = require_path_utils.cliPathToCanonical(argv.path);
|
|
29
|
+
const result = await afs.search(canonicalPath, argv.query);
|
|
30
|
+
options.onResult({
|
|
31
|
+
command: "search",
|
|
32
|
+
result,
|
|
33
|
+
format: require_search.formatSearchOutput
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
//#endregion
|
|
40
|
+
exports.createSearchCommand = createSearchCommand;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { formatSearchOutput } from "../formatters/search.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/search.ts
|
|
7
|
+
/**
|
|
8
|
+
* Create search command factory
|
|
9
|
+
*/
|
|
10
|
+
function createSearchCommand(options) {
|
|
11
|
+
return {
|
|
12
|
+
command: "search <path> <query>",
|
|
13
|
+
describe: "Search for content within an AFS path",
|
|
14
|
+
builder: {
|
|
15
|
+
path: {
|
|
16
|
+
type: "string",
|
|
17
|
+
demandOption: true,
|
|
18
|
+
description: "Path to search in"
|
|
19
|
+
},
|
|
20
|
+
query: {
|
|
21
|
+
type: "string",
|
|
22
|
+
demandOption: true,
|
|
23
|
+
description: "Search query"
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
handler: async (argv) => {
|
|
27
|
+
const afs = await resolveAFS(options);
|
|
28
|
+
const canonicalPath = cliPathToCanonical(argv.path);
|
|
29
|
+
const result = await afs.search(canonicalPath, argv.query);
|
|
30
|
+
options.onResult({
|
|
31
|
+
command: "search",
|
|
32
|
+
result,
|
|
33
|
+
format: formatSearchOutput
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
//#endregion
|
|
40
|
+
export { createSearchCommand };
|
|
41
|
+
//# sourceMappingURL=search.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"search.mjs","names":[],"sources":["../../../src/core/commands/search.ts"],"sourcesContent":["/**\n * search Command - Core Implementation\n *\n * Searches for content within an AFS path.\n * Returns AFSSearchResult directly (no custom type).\n */\n\nimport type { CommandModule } from \"yargs\";\nimport { formatSearchOutput } from \"../formatters/index.js\";\nimport { cliPathToCanonical } from \"../path-utils.js\";\nimport { type CommandFactoryOptions, resolveAFS } from \"./types.js\";\n\n/**\n * Search command arguments\n */\nexport interface SearchArgs {\n path: string;\n query: string;\n}\n\n/**\n * Create search command factory\n */\nexport function createSearchCommand(\n options: CommandFactoryOptions,\n): CommandModule<unknown, SearchArgs> {\n return {\n command: \"search <path> <query>\",\n describe: \"Search for content within an AFS path\",\n builder: {\n path: {\n type: \"string\",\n demandOption: true,\n description: \"Path to search in\",\n },\n query: {\n type: \"string\",\n demandOption: true,\n description: \"Search query\",\n },\n },\n handler: async (argv) => {\n const afs = await resolveAFS(options);\n const canonicalPath = cliPathToCanonical(argv.path);\n const result = await afs.search(canonicalPath, argv.query);\n options.onResult({\n command: \"search\",\n result,\n format: formatSearchOutput,\n });\n },\n };\n}\n"],"mappings":";;;;;;;;;AAuBA,SAAgB,oBACd,SACoC;AACpC,QAAO;EACL,SAAS;EACT,UAAU;EACV,SAAS;GACP,MAAM;IACJ,MAAM;IACN,cAAc;IACd,aAAa;IACd;GACD,OAAO;IACL,MAAM;IACN,cAAc;IACd,aAAa;IACd;GACF;EACD,SAAS,OAAO,SAAS;GACvB,MAAM,MAAM,MAAM,WAAW,QAAQ;GACrC,MAAM,gBAAgB,mBAAmB,KAAK,KAAK;GACnD,MAAM,SAAS,MAAM,IAAI,OAAO,eAAe,KAAK,MAAM;AAC1D,WAAQ,SAAS;IACf,SAAS;IACT;IACA,QAAQ;IACT,CAAC;;EAEL"}
|