@aigne/afs-cli 1.11.0-beta.5 → 1.11.0-beta.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.cjs +25 -328
- package/dist/cli.d.cts +2 -1
- package/dist/cli.d.mts +2 -1
- package/dist/cli.mjs +26 -328
- package/dist/cli.mjs.map +1 -1
- package/dist/config/afs-loader.cjs +123 -0
- package/dist/config/afs-loader.d.cts +14 -0
- package/dist/config/afs-loader.d.cts.map +1 -0
- package/dist/config/afs-loader.d.mts +14 -0
- package/dist/config/afs-loader.d.mts.map +1 -0
- package/dist/config/afs-loader.mjs +122 -0
- package/dist/config/afs-loader.mjs.map +1 -0
- package/dist/config/loader.cjs +14 -3
- package/dist/config/loader.mjs +14 -3
- package/dist/config/loader.mjs.map +1 -1
- package/dist/{commands/mount.cjs → config/mount-commands.cjs} +13 -49
- package/dist/config/mount-commands.d.cts +20 -0
- package/dist/config/mount-commands.d.cts.map +1 -0
- package/dist/config/mount-commands.d.mts +20 -0
- package/dist/config/mount-commands.d.mts.map +1 -0
- package/dist/{commands/mount.mjs → config/mount-commands.mjs} +14 -49
- package/dist/config/mount-commands.mjs.map +1 -0
- package/dist/config/schema.cjs +9 -1
- package/dist/config/schema.mjs +9 -1
- package/dist/config/schema.mjs.map +1 -1
- package/dist/core/commands/delete.cjs +41 -0
- package/dist/core/commands/delete.d.cts +18 -0
- package/dist/core/commands/delete.d.cts.map +1 -0
- package/dist/core/commands/delete.d.mts +18 -0
- package/dist/core/commands/delete.d.mts.map +1 -0
- package/dist/core/commands/delete.mjs +42 -0
- package/dist/core/commands/delete.mjs.map +1 -0
- package/dist/core/commands/exec.cjs +95 -0
- package/dist/core/commands/exec.d.cts +26 -0
- package/dist/core/commands/exec.d.cts.map +1 -0
- package/dist/core/commands/exec.d.mts +26 -0
- package/dist/core/commands/exec.d.mts.map +1 -0
- package/dist/core/commands/exec.mjs +96 -0
- package/dist/core/commands/exec.mjs.map +1 -0
- package/dist/core/commands/explain.cjs +254 -0
- package/dist/core/commands/explain.d.cts +25 -0
- package/dist/core/commands/explain.d.cts.map +1 -0
- package/dist/core/commands/explain.d.mts +25 -0
- package/dist/core/commands/explain.d.mts.map +1 -0
- package/dist/core/commands/explain.mjs +255 -0
- package/dist/core/commands/explain.mjs.map +1 -0
- package/dist/core/commands/explore.cjs +30 -0
- package/dist/core/commands/explore.d.mts +2 -0
- package/dist/core/commands/explore.mjs +31 -0
- package/dist/core/commands/explore.mjs.map +1 -0
- package/dist/core/commands/index.cjs +36 -0
- package/dist/core/commands/index.d.cts +21 -0
- package/dist/core/commands/index.d.cts.map +1 -0
- package/dist/core/commands/index.d.mts +24 -0
- package/dist/core/commands/index.d.mts.map +1 -0
- package/dist/core/commands/index.mjs +37 -0
- package/dist/core/commands/index.mjs.map +1 -0
- package/dist/core/commands/ls.cjs +57 -0
- package/dist/core/commands/ls.d.cts +21 -0
- package/dist/core/commands/ls.d.cts.map +1 -0
- package/dist/core/commands/ls.d.mts +21 -0
- package/dist/core/commands/ls.d.mts.map +1 -0
- package/dist/core/commands/ls.mjs +58 -0
- package/dist/core/commands/ls.mjs.map +1 -0
- package/dist/core/commands/mount.cjs +139 -0
- package/dist/core/commands/mount.d.cts +33 -0
- package/dist/core/commands/mount.d.cts.map +1 -0
- package/dist/core/commands/mount.d.mts +33 -0
- package/dist/core/commands/mount.d.mts.map +1 -0
- package/dist/core/commands/mount.mjs +140 -0
- package/dist/core/commands/mount.mjs.map +1 -0
- package/dist/core/commands/read.cjs +48 -0
- package/dist/core/commands/read.d.cts +17 -0
- package/dist/core/commands/read.d.cts.map +1 -0
- package/dist/core/commands/read.d.mts +17 -0
- package/dist/core/commands/read.d.mts.map +1 -0
- package/dist/core/commands/read.mjs +49 -0
- package/dist/core/commands/read.mjs.map +1 -0
- package/dist/core/commands/search.cjs +40 -0
- package/dist/core/commands/search.d.mts +2 -0
- package/dist/core/commands/search.mjs +41 -0
- package/dist/core/commands/search.mjs.map +1 -0
- package/dist/core/commands/serve.cjs +242 -0
- package/dist/core/commands/serve.d.mts +2 -0
- package/dist/core/commands/serve.mjs +242 -0
- package/dist/core/commands/serve.mjs.map +1 -0
- package/dist/core/commands/stat.cjs +53 -0
- package/dist/core/commands/stat.d.cts +17 -0
- package/dist/core/commands/stat.d.cts.map +1 -0
- package/dist/core/commands/stat.d.mts +17 -0
- package/dist/core/commands/stat.d.mts.map +1 -0
- package/dist/core/commands/stat.mjs +54 -0
- package/dist/core/commands/stat.mjs.map +1 -0
- package/dist/core/commands/types.cjs +13 -0
- package/dist/core/commands/types.d.cts +54 -0
- package/dist/core/commands/types.d.cts.map +1 -0
- package/dist/core/commands/types.d.mts +54 -0
- package/dist/core/commands/types.d.mts.map +1 -0
- package/dist/core/commands/types.mjs +14 -0
- package/dist/core/commands/types.mjs.map +1 -0
- package/dist/core/commands/write.cjs +70 -0
- package/dist/core/commands/write.d.cts +20 -0
- package/dist/core/commands/write.d.cts.map +1 -0
- package/dist/core/commands/write.d.mts +20 -0
- package/dist/core/commands/write.d.mts.map +1 -0
- package/dist/core/commands/write.mjs +71 -0
- package/dist/core/commands/write.mjs.map +1 -0
- package/dist/core/executor/index.cjs +196 -0
- package/dist/core/executor/index.d.cts +77 -0
- package/dist/core/executor/index.d.cts.map +1 -0
- package/dist/core/executor/index.d.mts +77 -0
- package/dist/core/executor/index.d.mts.map +1 -0
- package/dist/core/executor/index.mjs +195 -0
- package/dist/core/executor/index.mjs.map +1 -0
- package/dist/core/formatters/delete.cjs +37 -0
- package/dist/core/formatters/delete.d.cts +18 -0
- package/dist/core/formatters/delete.d.cts.map +1 -0
- package/dist/core/formatters/delete.d.mts +18 -0
- package/dist/core/formatters/delete.d.mts.map +1 -0
- package/dist/core/formatters/delete.mjs +37 -0
- package/dist/core/formatters/delete.mjs.map +1 -0
- package/dist/core/formatters/exec.cjs +60 -0
- package/dist/core/formatters/exec.d.cts +18 -0
- package/dist/core/formatters/exec.d.cts.map +1 -0
- package/dist/core/formatters/exec.d.mts +18 -0
- package/dist/core/formatters/exec.d.mts.map +1 -0
- package/dist/core/formatters/exec.mjs +60 -0
- package/dist/core/formatters/exec.mjs.map +1 -0
- package/dist/core/formatters/explain.cjs +97 -0
- package/dist/core/formatters/explain.d.cts +11 -0
- package/dist/core/formatters/explain.d.cts.map +1 -0
- package/dist/core/formatters/explain.d.mts +11 -0
- package/dist/core/formatters/explain.d.mts.map +1 -0
- package/dist/core/formatters/explain.mjs +96 -0
- package/dist/core/formatters/explain.mjs.map +1 -0
- package/dist/core/formatters/index.d.mts +9 -0
- package/dist/core/formatters/ls.cjs +179 -0
- package/dist/core/formatters/ls.d.cts +20 -0
- package/dist/core/formatters/ls.d.cts.map +1 -0
- package/dist/core/formatters/ls.d.mts +20 -0
- package/dist/core/formatters/ls.d.mts.map +1 -0
- package/dist/core/formatters/ls.mjs +179 -0
- package/dist/core/formatters/ls.mjs.map +1 -0
- package/dist/core/formatters/mount.cjs +55 -0
- package/dist/core/formatters/mount.d.cts +15 -0
- package/dist/core/formatters/mount.d.cts.map +1 -0
- package/dist/core/formatters/mount.d.mts +15 -0
- package/dist/core/formatters/mount.d.mts.map +1 -0
- package/dist/core/formatters/mount.mjs +55 -0
- package/dist/core/formatters/mount.mjs.map +1 -0
- package/dist/core/formatters/read.cjs +100 -0
- package/dist/core/formatters/read.d.cts +22 -0
- package/dist/core/formatters/read.d.cts.map +1 -0
- package/dist/core/formatters/read.d.mts +22 -0
- package/dist/core/formatters/read.d.mts.map +1 -0
- package/dist/core/formatters/read.mjs +100 -0
- package/dist/core/formatters/read.mjs.map +1 -0
- package/dist/core/formatters/search.cjs +44 -0
- package/dist/core/formatters/search.d.mts +1 -0
- package/dist/core/formatters/search.mjs +44 -0
- package/dist/core/formatters/search.mjs.map +1 -0
- package/dist/core/formatters/stat.cjs +155 -0
- package/dist/core/formatters/stat.d.cts +15 -0
- package/dist/core/formatters/stat.d.cts.map +1 -0
- package/dist/core/formatters/stat.d.mts +15 -0
- package/dist/core/formatters/stat.d.mts.map +1 -0
- package/dist/core/formatters/stat.mjs +155 -0
- package/dist/core/formatters/stat.mjs.map +1 -0
- package/dist/core/formatters/write.cjs +51 -0
- package/dist/core/formatters/write.d.cts +22 -0
- package/dist/core/formatters/write.d.cts.map +1 -0
- package/dist/core/formatters/write.d.mts +22 -0
- package/dist/core/formatters/write.d.mts.map +1 -0
- package/dist/core/formatters/write.mjs +51 -0
- package/dist/core/formatters/write.mjs.map +1 -0
- package/dist/core/helpers/exec-args.cjs +142 -0
- package/dist/core/helpers/exec-args.d.cts +46 -0
- package/dist/core/helpers/exec-args.d.cts.map +1 -0
- package/dist/core/helpers/exec-args.d.mts +46 -0
- package/dist/core/helpers/exec-args.d.mts.map +1 -0
- package/dist/core/helpers/exec-args.mjs +139 -0
- package/dist/core/helpers/exec-args.mjs.map +1 -0
- package/dist/core/helpers/stdin.cjs +41 -0
- package/dist/core/helpers/stdin.d.cts +15 -0
- package/dist/core/helpers/stdin.d.cts.map +1 -0
- package/dist/core/helpers/stdin.d.mts +15 -0
- package/dist/core/helpers/stdin.d.mts.map +1 -0
- package/dist/core/helpers/stdin.mjs +41 -0
- package/dist/core/helpers/stdin.mjs.map +1 -0
- package/dist/core/index.cjs +49 -0
- package/dist/core/index.d.cts +24 -0
- package/dist/core/index.d.mts +25 -0
- package/dist/core/index.mjs +24 -0
- package/dist/core/path-utils.cjs +1 -0
- package/dist/core/path-utils.mjs +3 -0
- package/dist/core/types.d.cts +24 -0
- package/dist/core/types.d.cts.map +1 -0
- package/dist/core/types.d.mts +24 -0
- package/dist/core/types.d.mts.map +1 -0
- package/dist/errors.cjs +0 -11
- package/dist/errors.mjs +1 -11
- package/dist/errors.mjs.map +1 -1
- package/dist/explorer/actions.cjs +113 -48
- package/dist/explorer/actions.mjs +113 -48
- package/dist/explorer/actions.mjs.map +1 -1
- package/dist/explorer/components/dialog.cjs +287 -10
- package/dist/explorer/components/dialog.mjs +287 -10
- package/dist/explorer/components/dialog.mjs.map +1 -1
- package/dist/explorer/components/file-list.mjs.map +1 -1
- package/dist/explorer/components/metadata-panel.cjs +121 -24
- package/dist/explorer/components/metadata-panel.mjs +121 -24
- package/dist/explorer/components/metadata-panel.mjs.map +1 -1
- package/dist/explorer/screen.cjs +72 -21
- 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 +73 -22
- package/dist/explorer/screen.mjs.map +1 -1
- package/dist/explorer/theme.cjs +4 -2
- package/dist/explorer/theme.mjs +4 -2
- package/dist/explorer/theme.mjs.map +1 -1
- package/dist/index.cjs +7 -1
- package/dist/index.d.cts +4 -1
- package/dist/index.d.mts +4 -1
- package/dist/index.mjs +4 -1
- package/dist/mcp/http-transport.cjs +68 -0
- package/dist/mcp/http-transport.mjs +68 -0
- package/dist/mcp/http-transport.mjs.map +1 -0
- package/dist/mcp/prompts.cjs +48 -0
- package/dist/mcp/prompts.mjs +48 -0
- package/dist/mcp/prompts.mjs.map +1 -0
- package/dist/mcp/resources.cjs +25 -0
- package/dist/mcp/resources.mjs +25 -0
- package/dist/mcp/resources.mjs.map +1 -0
- package/dist/mcp/server.cjs +30 -0
- package/dist/mcp/server.mjs +30 -0
- package/dist/mcp/server.mjs.map +1 -0
- package/dist/mcp/tools.cjs +196 -0
- package/dist/mcp/tools.mjs +196 -0
- package/dist/mcp/tools.mjs.map +1 -0
- package/dist/node_modules/.pnpm/urlpattern-polyfill@10.1.0/node_modules/urlpattern-polyfill/dist/index.d.cts +10 -0
- package/dist/node_modules/.pnpm/urlpattern-polyfill@10.1.0/node_modules/urlpattern-polyfill/dist/index.d.cts.map +1 -0
- package/dist/node_modules/.pnpm/urlpattern-polyfill@10.1.0/node_modules/urlpattern-polyfill/dist/index.d.mts +10 -0
- package/dist/node_modules/.pnpm/urlpattern-polyfill@10.1.0/node_modules/urlpattern-polyfill/dist/index.d.mts.map +1 -0
- package/dist/node_modules/.pnpm/urlpattern-polyfill@10.1.0/node_modules/urlpattern-polyfill/dist/types.d.cts +46 -0
- package/dist/node_modules/.pnpm/urlpattern-polyfill@10.1.0/node_modules/urlpattern-polyfill/dist/types.d.cts.map +1 -0
- package/dist/node_modules/.pnpm/urlpattern-polyfill@10.1.0/node_modules/urlpattern-polyfill/dist/types.d.mts +46 -0
- package/dist/node_modules/.pnpm/urlpattern-polyfill@10.1.0/node_modules/urlpattern-polyfill/dist/types.d.mts.map +1 -0
- package/dist/node_modules/.pnpm/urlpattern-polyfill@10.1.0/node_modules/urlpattern-polyfill/dist/urlpattern.cjs +902 -0
- package/dist/node_modules/.pnpm/urlpattern-polyfill@10.1.0/node_modules/urlpattern-polyfill/dist/urlpattern.mjs +902 -0
- package/dist/node_modules/.pnpm/urlpattern-polyfill@10.1.0/node_modules/urlpattern-polyfill/dist/urlpattern.mjs.map +1 -0
- package/dist/node_modules/.pnpm/urlpattern-polyfill@10.1.0/node_modules/urlpattern-polyfill/index.cjs +6 -0
- package/dist/node_modules/.pnpm/urlpattern-polyfill@10.1.0/node_modules/urlpattern-polyfill/index.mjs +8 -0
- package/dist/node_modules/.pnpm/urlpattern-polyfill@10.1.0/node_modules/urlpattern-polyfill/index.mjs.map +1 -0
- package/dist/path-utils.cjs +2 -1
- 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 +1 -1
- package/dist/repl.cjs +485 -0
- package/dist/repl.d.cts +15 -0
- package/dist/repl.d.cts.map +1 -0
- package/dist/repl.d.mts +16 -0
- package/dist/repl.d.mts.map +1 -0
- package/dist/repl.mjs +485 -0
- package/dist/repl.mjs.map +1 -0
- package/dist/serve.cjs +146 -0
- package/dist/serve.d.cts +41 -0
- package/dist/serve.d.cts.map +1 -0
- package/dist/serve.d.mts +41 -0
- package/dist/serve.d.mts.map +1 -0
- package/dist/serve.mjs +146 -0
- package/dist/serve.mjs.map +1 -0
- package/dist/ui/header.cjs +1 -49
- package/dist/ui/header.mjs +1 -47
- package/dist/ui/header.mjs.map +1 -1
- package/dist/ui/index.cjs +2 -11
- package/dist/ui/index.mjs +2 -8
- 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 +32 -9
- package/dist/commands/exec.cjs +0 -46
- package/dist/commands/exec.mjs +0 -45
- 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 -143
- package/dist/commands/ls.mjs +0 -143
- package/dist/commands/ls.mjs.map +0 -1
- package/dist/commands/mount.mjs.map +0 -1
- package/dist/commands/read.cjs +0 -65
- package/dist/commands/read.mjs +0 -64
- 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 -113
- package/dist/commands/stat.mjs +0 -112
- package/dist/commands/stat.mjs.map +0 -1
- package/dist/commands/write.cjs +0 -52
- package/dist/commands/write.mjs +0 -51
- package/dist/commands/write.mjs.map +0 -1
- package/dist/config/provider-factory.cjs +0 -93
- package/dist/config/provider-factory.mjs +0 -94
- package/dist/config/provider-factory.mjs.map +0 -1
- package/dist/config/uri-parser.cjs +0 -92
- package/dist/config/uri-parser.mjs +0 -92
- package/dist/config/uri-parser.mjs.map +0 -1
- package/dist/runtime.cjs +0 -96
- package/dist/runtime.mjs +0 -96
- package/dist/runtime.mjs.map +0 -1
|
@@ -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,139 @@
|
|
|
1
|
+
const require_mount = require('../formatters/mount.cjs');
|
|
2
|
+
const require_mount_commands = require('../../config/mount-commands.cjs');
|
|
3
|
+
|
|
4
|
+
//#region src/core/commands/mount.ts
|
|
5
|
+
/**
|
|
6
|
+
* Create mount command factory (with subcommands)
|
|
7
|
+
*/
|
|
8
|
+
function createMountCommand(options) {
|
|
9
|
+
return {
|
|
10
|
+
command: "mount",
|
|
11
|
+
describe: "Mount management",
|
|
12
|
+
builder: (yargs) => yargs.command(createMountListSubcommand(options)).command(createMountAddSubcommand(options)).command(createMountRemoveSubcommand(options)).command(createMountValidateSubcommand(options)).demandCommand(1, "Please specify a subcommand").alias("help", "h"),
|
|
13
|
+
handler: () => {}
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Create mount list subcommand
|
|
18
|
+
*/
|
|
19
|
+
function createMountListSubcommand(options) {
|
|
20
|
+
return {
|
|
21
|
+
command: ["list", "ls"],
|
|
22
|
+
describe: "List all mounts",
|
|
23
|
+
builder: { namespace: {
|
|
24
|
+
type: "string",
|
|
25
|
+
description: "Filter by namespace"
|
|
26
|
+
} },
|
|
27
|
+
handler: async () => {
|
|
28
|
+
const result = await require_mount_commands.configMountListCommand(options.cwd ?? process.cwd());
|
|
29
|
+
options.onResult({
|
|
30
|
+
command: "mount list",
|
|
31
|
+
result: result.mounts,
|
|
32
|
+
format: require_mount.formatMountListOutput
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Create mount add subcommand
|
|
39
|
+
*/
|
|
40
|
+
function createMountAddSubcommand(options) {
|
|
41
|
+
return {
|
|
42
|
+
command: "add <path> <uri>",
|
|
43
|
+
describe: "Add a mount",
|
|
44
|
+
builder: {
|
|
45
|
+
path: {
|
|
46
|
+
type: "string",
|
|
47
|
+
demandOption: true,
|
|
48
|
+
description: "Mount path (e.g., /src)"
|
|
49
|
+
},
|
|
50
|
+
uri: {
|
|
51
|
+
type: "string",
|
|
52
|
+
demandOption: true,
|
|
53
|
+
description: "Provider URI (e.g., fs://./src)"
|
|
54
|
+
},
|
|
55
|
+
namespace: {
|
|
56
|
+
type: "string",
|
|
57
|
+
description: "Mount namespace"
|
|
58
|
+
},
|
|
59
|
+
description: {
|
|
60
|
+
type: "string",
|
|
61
|
+
description: "Mount description"
|
|
62
|
+
}
|
|
63
|
+
},
|
|
64
|
+
handler: async (argv) => {
|
|
65
|
+
const result = await require_mount_commands.mountAddCommand(options.cwd ?? process.cwd(), argv.path, argv.uri, { description: argv.description });
|
|
66
|
+
if (!result.success) throw new Error(result.message ?? "Failed to add mount");
|
|
67
|
+
options.onResult({
|
|
68
|
+
command: "mount add",
|
|
69
|
+
result: {
|
|
70
|
+
success: true,
|
|
71
|
+
path: argv.path,
|
|
72
|
+
uri: argv.uri
|
|
73
|
+
},
|
|
74
|
+
format: (res) => `Mounted ${res.uri} at ${res.path}`
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Create mount remove subcommand
|
|
81
|
+
*/
|
|
82
|
+
function createMountRemoveSubcommand(options) {
|
|
83
|
+
return {
|
|
84
|
+
command: ["remove <path>", "rm <path>"],
|
|
85
|
+
describe: "Unmount a path",
|
|
86
|
+
builder: {
|
|
87
|
+
path: {
|
|
88
|
+
type: "string",
|
|
89
|
+
demandOption: true,
|
|
90
|
+
description: "Mount path to remove"
|
|
91
|
+
},
|
|
92
|
+
namespace: {
|
|
93
|
+
type: "string",
|
|
94
|
+
description: "Namespace of the mount"
|
|
95
|
+
}
|
|
96
|
+
},
|
|
97
|
+
handler: async (argv) => {
|
|
98
|
+
const result = await require_mount_commands.mountRemoveCommand(options.cwd ?? process.cwd(), argv.path);
|
|
99
|
+
if (!result.success) throw new Error(result.message ?? "Failed to remove mount");
|
|
100
|
+
options.onResult({
|
|
101
|
+
command: "mount remove",
|
|
102
|
+
result: {
|
|
103
|
+
success: true,
|
|
104
|
+
path: argv.path
|
|
105
|
+
},
|
|
106
|
+
format: (res) => res.success ? `Unmounted ${res.path}` : `Failed to unmount ${res.path}`
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Format mount validate output
|
|
113
|
+
*/
|
|
114
|
+
function formatMountValidateOutput(result, view) {
|
|
115
|
+
if (view === "json") return JSON.stringify(result, null, 2);
|
|
116
|
+
if (result.valid) return "Configuration is valid";
|
|
117
|
+
return ["Configuration validation failed:", ...result.errors.map((e) => ` - ${e}`)].join("\n");
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* Create mount validate subcommand
|
|
121
|
+
*/
|
|
122
|
+
function createMountValidateSubcommand(options) {
|
|
123
|
+
return {
|
|
124
|
+
command: "validate",
|
|
125
|
+
describe: "Validate mount configuration",
|
|
126
|
+
handler: async () => {
|
|
127
|
+
const result = await require_mount_commands.mountValidateCommand(options.cwd ?? process.cwd());
|
|
128
|
+
options.onResult({
|
|
129
|
+
command: "mount validate",
|
|
130
|
+
result,
|
|
131
|
+
format: formatMountValidateOutput,
|
|
132
|
+
error: result.valid ? void 0 : { message: result.errors.join("; ") }
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
//#endregion
|
|
139
|
+
exports.createMountCommand = createMountCommand;
|
|
@@ -0,0 +1,33 @@
|
|
|
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
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Mount remove subcommand arguments
|
|
22
|
+
*/
|
|
23
|
+
interface MountRemoveArgs {
|
|
24
|
+
path: string;
|
|
25
|
+
namespace?: string;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Create mount command factory (with subcommands)
|
|
29
|
+
*/
|
|
30
|
+
declare function createMountCommand(options: CommandFactoryOptions): CommandModule;
|
|
31
|
+
//#endregion
|
|
32
|
+
export { MountAddArgs, MountListArgs, MountRemoveArgs, createMountCommand };
|
|
33
|
+
//# sourceMappingURL=mount.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mount.d.cts","names":[],"sources":["../../../src/core/commands/mount.ts"],"mappings":";;;;;AA6BA;;UAPiB,aAAA;EACf,SAAA;AAAA;;;;UAMe,YAAA;EACf,IAAA;EACA,GAAA;EACA,SAAA;EACA,WAAA;AAAA;;AAcF;;UARiB,eAAA;EACf,IAAA;EACA,SAAA;AAAA;;;;iBAMc,kBAAA,CAAmB,OAAA,EAAS,qBAAA,GAAwB,aAAA"}
|
|
@@ -0,0 +1,33 @@
|
|
|
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
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Mount remove subcommand arguments
|
|
22
|
+
*/
|
|
23
|
+
interface MountRemoveArgs {
|
|
24
|
+
path: string;
|
|
25
|
+
namespace?: string;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Create mount command factory (with subcommands)
|
|
29
|
+
*/
|
|
30
|
+
declare function createMountCommand(options: CommandFactoryOptions): CommandModule;
|
|
31
|
+
//#endregion
|
|
32
|
+
export { MountAddArgs, MountListArgs, MountRemoveArgs, createMountCommand };
|
|
33
|
+
//# sourceMappingURL=mount.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mount.d.mts","names":[],"sources":["../../../src/core/commands/mount.ts"],"mappings":";;;;;AA6BA;;UAPiB,aAAA;EACf,SAAA;AAAA;;;;UAMe,YAAA;EACf,IAAA;EACA,GAAA;EACA,SAAA;EACA,WAAA;AAAA;;AAcF;;UARiB,eAAA;EACf,IAAA;EACA,SAAA;AAAA;;;;iBAMc,kBAAA,CAAmB,OAAA,EAAS,qBAAA,GAAwB,aAAA"}
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
import { formatMountListOutput } from "../formatters/mount.mjs";
|
|
2
|
+
import { configMountListCommand, mountAddCommand, mountRemoveCommand, mountValidateCommand } from "../../config/mount-commands.mjs";
|
|
3
|
+
|
|
4
|
+
//#region src/core/commands/mount.ts
|
|
5
|
+
/**
|
|
6
|
+
* Create mount command factory (with subcommands)
|
|
7
|
+
*/
|
|
8
|
+
function createMountCommand(options) {
|
|
9
|
+
return {
|
|
10
|
+
command: "mount",
|
|
11
|
+
describe: "Mount management",
|
|
12
|
+
builder: (yargs) => yargs.command(createMountListSubcommand(options)).command(createMountAddSubcommand(options)).command(createMountRemoveSubcommand(options)).command(createMountValidateSubcommand(options)).demandCommand(1, "Please specify a subcommand").alias("help", "h"),
|
|
13
|
+
handler: () => {}
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Create mount list subcommand
|
|
18
|
+
*/
|
|
19
|
+
function createMountListSubcommand(options) {
|
|
20
|
+
return {
|
|
21
|
+
command: ["list", "ls"],
|
|
22
|
+
describe: "List all mounts",
|
|
23
|
+
builder: { namespace: {
|
|
24
|
+
type: "string",
|
|
25
|
+
description: "Filter by namespace"
|
|
26
|
+
} },
|
|
27
|
+
handler: async () => {
|
|
28
|
+
const result = await configMountListCommand(options.cwd ?? process.cwd());
|
|
29
|
+
options.onResult({
|
|
30
|
+
command: "mount list",
|
|
31
|
+
result: result.mounts,
|
|
32
|
+
format: formatMountListOutput
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Create mount add subcommand
|
|
39
|
+
*/
|
|
40
|
+
function createMountAddSubcommand(options) {
|
|
41
|
+
return {
|
|
42
|
+
command: "add <path> <uri>",
|
|
43
|
+
describe: "Add a mount",
|
|
44
|
+
builder: {
|
|
45
|
+
path: {
|
|
46
|
+
type: "string",
|
|
47
|
+
demandOption: true,
|
|
48
|
+
description: "Mount path (e.g., /src)"
|
|
49
|
+
},
|
|
50
|
+
uri: {
|
|
51
|
+
type: "string",
|
|
52
|
+
demandOption: true,
|
|
53
|
+
description: "Provider URI (e.g., fs://./src)"
|
|
54
|
+
},
|
|
55
|
+
namespace: {
|
|
56
|
+
type: "string",
|
|
57
|
+
description: "Mount namespace"
|
|
58
|
+
},
|
|
59
|
+
description: {
|
|
60
|
+
type: "string",
|
|
61
|
+
description: "Mount description"
|
|
62
|
+
}
|
|
63
|
+
},
|
|
64
|
+
handler: async (argv) => {
|
|
65
|
+
const result = await mountAddCommand(options.cwd ?? process.cwd(), argv.path, argv.uri, { description: argv.description });
|
|
66
|
+
if (!result.success) throw new Error(result.message ?? "Failed to add mount");
|
|
67
|
+
options.onResult({
|
|
68
|
+
command: "mount add",
|
|
69
|
+
result: {
|
|
70
|
+
success: true,
|
|
71
|
+
path: argv.path,
|
|
72
|
+
uri: argv.uri
|
|
73
|
+
},
|
|
74
|
+
format: (res) => `Mounted ${res.uri} at ${res.path}`
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Create mount remove subcommand
|
|
81
|
+
*/
|
|
82
|
+
function createMountRemoveSubcommand(options) {
|
|
83
|
+
return {
|
|
84
|
+
command: ["remove <path>", "rm <path>"],
|
|
85
|
+
describe: "Unmount a path",
|
|
86
|
+
builder: {
|
|
87
|
+
path: {
|
|
88
|
+
type: "string",
|
|
89
|
+
demandOption: true,
|
|
90
|
+
description: "Mount path to remove"
|
|
91
|
+
},
|
|
92
|
+
namespace: {
|
|
93
|
+
type: "string",
|
|
94
|
+
description: "Namespace of the mount"
|
|
95
|
+
}
|
|
96
|
+
},
|
|
97
|
+
handler: async (argv) => {
|
|
98
|
+
const result = await mountRemoveCommand(options.cwd ?? process.cwd(), argv.path);
|
|
99
|
+
if (!result.success) throw new Error(result.message ?? "Failed to remove mount");
|
|
100
|
+
options.onResult({
|
|
101
|
+
command: "mount remove",
|
|
102
|
+
result: {
|
|
103
|
+
success: true,
|
|
104
|
+
path: argv.path
|
|
105
|
+
},
|
|
106
|
+
format: (res) => res.success ? `Unmounted ${res.path}` : `Failed to unmount ${res.path}`
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Format mount validate output
|
|
113
|
+
*/
|
|
114
|
+
function formatMountValidateOutput(result, view) {
|
|
115
|
+
if (view === "json") return JSON.stringify(result, null, 2);
|
|
116
|
+
if (result.valid) return "Configuration is valid";
|
|
117
|
+
return ["Configuration validation failed:", ...result.errors.map((e) => ` - ${e}`)].join("\n");
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* Create mount validate subcommand
|
|
121
|
+
*/
|
|
122
|
+
function createMountValidateSubcommand(options) {
|
|
123
|
+
return {
|
|
124
|
+
command: "validate",
|
|
125
|
+
describe: "Validate mount configuration",
|
|
126
|
+
handler: async () => {
|
|
127
|
+
const result = await mountValidateCommand(options.cwd ?? process.cwd());
|
|
128
|
+
options.onResult({
|
|
129
|
+
command: "mount validate",
|
|
130
|
+
result,
|
|
131
|
+
format: formatMountValidateOutput,
|
|
132
|
+
error: result.valid ? void 0 : { message: result.errors.join("; ") }
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
//#endregion
|
|
139
|
+
export { createMountCommand };
|
|
140
|
+
//# 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 mountAddCommand,\n mountRemoveCommand,\n mountValidateCommand,\n} from \"../../config/mount-commands.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}\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 */\nfunction createMountAddSubcommand(\n options: CommandFactoryOptions,\n): CommandModule<unknown, MountAddArgs> {\n return {\n command: \"add <path> <uri>\",\n describe: \"Add a mount\",\n builder: {\n path: {\n type: \"string\",\n demandOption: true,\n description: \"Mount path (e.g., /src)\",\n },\n uri: {\n type: \"string\",\n demandOption: true,\n description: \"Provider URI (e.g., fs://./src)\",\n },\n namespace: {\n type: \"string\",\n description: \"Mount namespace\",\n },\n description: {\n type: \"string\",\n description: \"Mount description\",\n },\n },\n handler: async (argv) => {\n const cwd = options.cwd ?? process.cwd();\n const result = await mountAddCommand(cwd, argv.path, argv.uri, {\n description: argv.description,\n });\n if (!result.success) {\n throw new Error(result.message ?? \"Failed to add mount\");\n }\n options.onResult({\n command: \"mount add\",\n result: { success: true, path: argv.path, uri: argv.uri },\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":";;;;;;;AA+CA,SAAgB,mBAAmB,SAA+C;AAChF,QAAO;EACL,SAAS;EACT,UAAU;EACV,UAAU,UACR,MACG,QAAQ,0BAA0B,QAAQ,CAAC,CAC3C,QAAQ,yBAAyB,QAAQ,CAAC,CAC1C,QAAQ,4BAA4B,QAAQ,CAAC,CAC7C,QAAQ,8BAA8B,QAAQ,CAAC,CAC/C,cAAc,GAAG,8BAA8B,CAC/C,MAAM,QAAQ,IAAI;EACvB,eAAe;EAChB;;;;;AAMH,SAAS,0BACP,SACuC;AACvC,QAAO;EACL,SAAS,CAAC,QAAQ,KAAK;EACvB,UAAU;EACV,SAAS,EACP,WAAW;GACT,MAAM;GACN,aAAa;GACd,EACF;EACD,SAAS,YAAY;GAEnB,MAAM,SAAS,MAAM,uBADT,QAAQ,OAAO,QAAQ,KAAK,CACQ;AAChD,WAAQ,SAAS;IACf,SAAS;IACT,QAAQ,OAAO;IACf,QAAQ;IACT,CAAC;;EAEL;;;;;AAMH,SAAS,yBACP,SACsC;AACtC,QAAO;EACL,SAAS;EACT,UAAU;EACV,SAAS;GACP,MAAM;IACJ,MAAM;IACN,cAAc;IACd,aAAa;IACd;GACD,KAAK;IACH,MAAM;IACN,cAAc;IACd,aAAa;IACd;GACD,WAAW;IACT,MAAM;IACN,aAAa;IACd;GACD,aAAa;IACX,MAAM;IACN,aAAa;IACd;GACF;EACD,SAAS,OAAO,SAAS;GAEvB,MAAM,SAAS,MAAM,gBADT,QAAQ,OAAO,QAAQ,KAAK,EACE,KAAK,MAAM,KAAK,KAAK,EAC7D,aAAa,KAAK,aACnB,CAAC;AACF,OAAI,CAAC,OAAO,QACV,OAAM,IAAI,MAAM,OAAO,WAAW,sBAAsB;AAE1D,WAAQ,SAAS;IACf,SAAS;IACT,QAAQ;KAAE,SAAS;KAAM,MAAM,KAAK;KAAM,KAAK,KAAK;KAAK;IACzD,SAAS,QAAuC,WAAW,IAAI,IAAI,MAAM,IAAI;IAC9E,CAAC;;EAEL;;;;;AAMH,SAAS,4BACP,SACyC;AACzC,QAAO;EACL,SAAS,CAAC,iBAAiB,YAAY;EACvC,UAAU;EACV,SAAS;GACP,MAAM;IACJ,MAAM;IACN,cAAc;IACd,aAAa;IACd;GACD,WAAW;IACT,MAAM;IACN,aAAa;IACd;GACF;EACD,SAAS,OAAO,SAAS;GAEvB,MAAM,SAAS,MAAM,mBADT,QAAQ,OAAO,QAAQ,KAAK,EACK,KAAK,KAAK;AACvD,OAAI,CAAC,OAAO,QACV,OAAM,IAAI,MAAM,OAAO,WAAW,yBAAyB;AAE7D,WAAQ,SAAS;IACf,SAAS;IACT,QAAQ;KAAE,SAAS;KAAM,MAAM,KAAK;KAAM;IAC1C,SAAS,QACP,IAAI,UAAU,aAAa,IAAI,SAAS,qBAAqB,IAAI;IACpE,CAAC;;EAEL;;;;;AAMH,SAAS,0BAA0B,QAA6B,MAAyB;AACvF,KAAI,SAAS,OACX,QAAO,KAAK,UAAU,QAAQ,MAAM,EAAE;AAGxC,KAAI,OAAO,MACT,QAAO;AAIT,QADc,CAAC,oCAAoC,GAAG,OAAO,OAAO,KAAK,MAAM,OAAO,IAAI,CAAC,CAC9E,KAAK,KAAK;;;;;AAMzB,SAAS,8BAA8B,SAA+C;AACpF,QAAO;EACL,SAAS;EACT,UAAU;EACV,SAAS,YAAY;GAEnB,MAAM,SAAS,MAAM,qBADT,QAAQ,OAAO,QAAQ,KAAK,CACM;AAE9C,WAAQ,SAAS;IACf,SAAS;IACT;IACA,QAAQ;IACR,OAAO,OAAO,QAAQ,SAAY,EAAE,SAAS,OAAO,OAAO,KAAK,KAAK,EAAE;IACxE,CAAC;;EAEL"}
|
|
@@ -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"}
|