@aigne/afs-cli 1.11.0-beta.1 → 1.11.0-beta.2

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.
Files changed (70) hide show
  1. package/README.md +13 -9
  2. package/dist/_virtual/rolldown_runtime.cjs +29 -0
  3. package/dist/cli.cjs +215 -0
  4. package/dist/cli.d.cts +1 -0
  5. package/dist/cli.mjs +205 -19
  6. package/dist/cli.mjs.map +1 -0
  7. package/dist/commands/exec.cjs +46 -0
  8. package/dist/commands/exec.mjs +45 -0
  9. package/dist/commands/exec.mjs.map +1 -0
  10. package/dist/commands/explain.cjs +244 -0
  11. package/dist/commands/explain.mjs +242 -0
  12. package/dist/commands/explain.mjs.map +1 -0
  13. package/dist/commands/index.cjs +7 -0
  14. package/dist/commands/index.mjs +9 -0
  15. package/dist/commands/ls.cjs +136 -0
  16. package/dist/commands/ls.mjs +135 -0
  17. package/dist/commands/ls.mjs.map +1 -0
  18. package/dist/commands/mount.cjs +157 -0
  19. package/dist/commands/mount.mjs +153 -0
  20. package/dist/commands/mount.mjs.map +1 -0
  21. package/dist/commands/read.cjs +65 -0
  22. package/dist/commands/read.mjs +64 -0
  23. package/dist/commands/read.mjs.map +1 -0
  24. package/dist/commands/stat.cjs +113 -0
  25. package/dist/commands/stat.mjs +112 -0
  26. package/dist/commands/stat.mjs.map +1 -0
  27. package/dist/commands/write.cjs +52 -0
  28. package/dist/commands/write.mjs +51 -0
  29. package/dist/commands/write.mjs.map +1 -0
  30. package/dist/config/env.cjs +46 -0
  31. package/dist/config/env.mjs +46 -0
  32. package/dist/config/env.mjs.map +1 -0
  33. package/dist/config/loader.cjs +160 -0
  34. package/dist/config/loader.mjs +158 -0
  35. package/dist/config/loader.mjs.map +1 -0
  36. package/dist/config/provider-factory.cjs +74 -0
  37. package/dist/config/provider-factory.mjs +75 -0
  38. package/dist/config/provider-factory.mjs.map +1 -0
  39. package/dist/config/schema.cjs +22 -0
  40. package/dist/config/schema.mjs +22 -0
  41. package/dist/config/schema.mjs.map +1 -0
  42. package/dist/config/uri-parser.cjs +75 -0
  43. package/dist/config/uri-parser.mjs +75 -0
  44. package/dist/config/uri-parser.mjs.map +1 -0
  45. package/dist/errors.cjs +29 -0
  46. package/dist/errors.mjs +28 -0
  47. package/dist/errors.mjs.map +1 -0
  48. package/dist/index.cjs +3 -0
  49. package/dist/index.d.cts +2 -0
  50. package/dist/index.d.mts +1 -3
  51. package/dist/index.mjs +1 -1
  52. package/dist/runtime.cjs +82 -0
  53. package/dist/runtime.mjs +82 -0
  54. package/dist/runtime.mjs.map +1 -0
  55. package/dist/version.cjs +9 -0
  56. package/dist/version.d.cts +5 -0
  57. package/dist/version.d.cts.map +1 -0
  58. package/dist/version.d.mts +5 -0
  59. package/dist/version.d.mts.map +1 -0
  60. package/dist/version.mjs +9 -0
  61. package/dist/version.mjs.map +1 -0
  62. package/package.json +51 -11
  63. package/.turbo/turbo-build.log +0 -18
  64. package/.turbo/turbo-check-types.log +0 -4
  65. package/dist/version--p6A8sKX.mjs +0 -5
  66. package/src/cli.test.ts +0 -8
  67. package/src/cli.ts +0 -29
  68. package/src/index.ts +0 -7
  69. package/src/version.ts +0 -1
  70. package/tsconfig.json +0 -16
@@ -0,0 +1,82 @@
1
+ const require_rolldown_runtime = require('./_virtual/rolldown_runtime.cjs');
2
+ const require_loader = require('./config/loader.cjs');
3
+ const require_provider_factory = require('./config/provider-factory.cjs');
4
+ let _aigne_afs = require("@aigne/afs");
5
+
6
+ //#region src/runtime.ts
7
+ /**
8
+ * AFS Runtime wrapper that provides custom path mounting
9
+ *
10
+ * The core AFS mounts modules under /modules/{name}. This runtime
11
+ * allows mounting at custom paths by creating a path translation layer.
12
+ */
13
+ var AFSRuntime = class {
14
+ afs;
15
+ mountMap = /* @__PURE__ */ new Map();
16
+ constructor() {
17
+ this.afs = new _aigne_afs.AFS();
18
+ }
19
+ /**
20
+ * Mount a provider at a custom path
21
+ */
22
+ async mount(provider, mountPath) {
23
+ this.afs.mount(provider);
24
+ const modulePath = `/modules/${provider.name}`;
25
+ this.mountMap.set(mountPath, modulePath);
26
+ }
27
+ /**
28
+ * Translate user path to internal module path
29
+ */
30
+ translatePath(userPath) {
31
+ let bestMatch = "";
32
+ let internalPrefix = "";
33
+ for (const [mountPath, modulePath] of this.mountMap.entries()) if (userPath === mountPath || userPath.startsWith(`${mountPath}/`)) {
34
+ if (mountPath.length > bestMatch.length) {
35
+ bestMatch = mountPath;
36
+ internalPrefix = modulePath;
37
+ }
38
+ }
39
+ if (!bestMatch) return userPath;
40
+ const suffix = userPath.slice(bestMatch.length);
41
+ return internalPrefix + suffix;
42
+ }
43
+ async list(path, options) {
44
+ const internalPath = this.translatePath(path);
45
+ return await this.afs.list(internalPath, options);
46
+ }
47
+ async read(path, options) {
48
+ const internalPath = this.translatePath(path);
49
+ return this.afs.read(internalPath, options);
50
+ }
51
+ async write(path, content, options) {
52
+ const internalPath = this.translatePath(path);
53
+ return this.afs.write(internalPath, content, options);
54
+ }
55
+ async search(path, query, options) {
56
+ const internalPath = this.translatePath(path);
57
+ return this.afs.search(internalPath, query, options);
58
+ }
59
+ async delete(path, options) {
60
+ const internalPath = this.translatePath(path);
61
+ return this.afs.delete(internalPath, options);
62
+ }
63
+ };
64
+ /**
65
+ * Create an AFS runtime from configuration
66
+ *
67
+ * @param cwd - Working directory to load config from
68
+ * @param options - Runtime options
69
+ * @returns Configured AFS runtime
70
+ */
71
+ async function createRuntime(cwd = process.cwd(), options = {}) {
72
+ const config = await (options.configLoader ?? new require_loader.ConfigLoader()).load(cwd);
73
+ const runtime = new AFSRuntime();
74
+ for (const mount of config.mounts) {
75
+ const provider = await require_provider_factory.createProvider(mount);
76
+ await runtime.mount(provider, mount.path);
77
+ }
78
+ return runtime;
79
+ }
80
+
81
+ //#endregion
82
+ exports.createRuntime = createRuntime;
@@ -0,0 +1,82 @@
1
+ import { ConfigLoader } from "./config/loader.mjs";
2
+ import { createProvider } from "./config/provider-factory.mjs";
3
+ import { AFS } from "@aigne/afs";
4
+
5
+ //#region src/runtime.ts
6
+ /**
7
+ * AFS Runtime wrapper that provides custom path mounting
8
+ *
9
+ * The core AFS mounts modules under /modules/{name}. This runtime
10
+ * allows mounting at custom paths by creating a path translation layer.
11
+ */
12
+ var AFSRuntime = class {
13
+ afs;
14
+ mountMap = /* @__PURE__ */ new Map();
15
+ constructor() {
16
+ this.afs = new AFS();
17
+ }
18
+ /**
19
+ * Mount a provider at a custom path
20
+ */
21
+ async mount(provider, mountPath) {
22
+ this.afs.mount(provider);
23
+ const modulePath = `/modules/${provider.name}`;
24
+ this.mountMap.set(mountPath, modulePath);
25
+ }
26
+ /**
27
+ * Translate user path to internal module path
28
+ */
29
+ translatePath(userPath) {
30
+ let bestMatch = "";
31
+ let internalPrefix = "";
32
+ for (const [mountPath, modulePath] of this.mountMap.entries()) if (userPath === mountPath || userPath.startsWith(`${mountPath}/`)) {
33
+ if (mountPath.length > bestMatch.length) {
34
+ bestMatch = mountPath;
35
+ internalPrefix = modulePath;
36
+ }
37
+ }
38
+ if (!bestMatch) return userPath;
39
+ const suffix = userPath.slice(bestMatch.length);
40
+ return internalPrefix + suffix;
41
+ }
42
+ async list(path, options) {
43
+ const internalPath = this.translatePath(path);
44
+ return await this.afs.list(internalPath, options);
45
+ }
46
+ async read(path, options) {
47
+ const internalPath = this.translatePath(path);
48
+ return this.afs.read(internalPath, options);
49
+ }
50
+ async write(path, content, options) {
51
+ const internalPath = this.translatePath(path);
52
+ return this.afs.write(internalPath, content, options);
53
+ }
54
+ async search(path, query, options) {
55
+ const internalPath = this.translatePath(path);
56
+ return this.afs.search(internalPath, query, options);
57
+ }
58
+ async delete(path, options) {
59
+ const internalPath = this.translatePath(path);
60
+ return this.afs.delete(internalPath, options);
61
+ }
62
+ };
63
+ /**
64
+ * Create an AFS runtime from configuration
65
+ *
66
+ * @param cwd - Working directory to load config from
67
+ * @param options - Runtime options
68
+ * @returns Configured AFS runtime
69
+ */
70
+ async function createRuntime(cwd = process.cwd(), options = {}) {
71
+ const config = await (options.configLoader ?? new ConfigLoader()).load(cwd);
72
+ const runtime = new AFSRuntime();
73
+ for (const mount of config.mounts) {
74
+ const provider = await createProvider(mount);
75
+ await runtime.mount(provider, mount.path);
76
+ }
77
+ return runtime;
78
+ }
79
+
80
+ //#endregion
81
+ export { createRuntime };
82
+ //# sourceMappingURL=runtime.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runtime.mjs","names":[],"sources":["../src/runtime.ts"],"sourcesContent":["import type {\n AFSDeleteOptions,\n AFSListOptions,\n AFSModule,\n AFSReadOptions,\n AFSRoot,\n AFSSearchOptions,\n AFSWriteEntryPayload,\n AFSWriteOptions,\n} from \"@aigne/afs\";\nimport { AFS } from \"@aigne/afs\";\nimport { ConfigLoader } from \"./config/loader.js\";\nimport { createProvider } from \"./config/provider-factory.js\";\n\nexport interface RuntimeOptions {\n /** Custom config loader (for testing) */\n configLoader?: ConfigLoader;\n}\n\n/**\n * AFS Runtime wrapper that provides custom path mounting\n *\n * The core AFS mounts modules under /modules/{name}. This runtime\n * allows mounting at custom paths by creating a path translation layer.\n */\nexport class AFSRuntime implements Pick<AFSRoot, \"list\" | \"read\" | \"write\" | \"search\" | \"delete\"> {\n private afs: AFS;\n private mountMap: Map<string, string> = new Map(); // userPath -> modulePath\n\n constructor() {\n this.afs = new AFS();\n }\n\n /**\n * Mount a provider at a custom path\n */\n async mount(provider: AFSModule, mountPath: string): Promise<void> {\n this.afs.mount(provider);\n // Map the user-facing path to the internal module path\n const modulePath = `/modules/${provider.name}`;\n this.mountMap.set(mountPath, modulePath);\n }\n\n /**\n * Translate user path to internal module path\n */\n private translatePath(userPath: string): string {\n // Find the longest matching mount path\n let bestMatch = \"\";\n let internalPrefix = \"\";\n\n for (const [mountPath, modulePath] of this.mountMap.entries()) {\n if (userPath === mountPath || userPath.startsWith(`${mountPath}/`)) {\n if (mountPath.length > bestMatch.length) {\n bestMatch = mountPath;\n internalPrefix = modulePath;\n }\n }\n }\n\n if (!bestMatch) {\n // No translation needed, return as-is\n return userPath;\n }\n\n // Replace the mount path with the internal path\n const suffix = userPath.slice(bestMatch.length);\n return internalPrefix + suffix;\n }\n\n async list(path: string, options?: AFSListOptions) {\n const internalPath = this.translatePath(path);\n const result = await this.afs.list(internalPath, options);\n\n // Return results as-is without path translation\n return result;\n }\n\n async read(path: string, options?: AFSReadOptions) {\n const internalPath = this.translatePath(path);\n return this.afs.read(internalPath, options);\n }\n\n async write(path: string, content: AFSWriteEntryPayload, options?: AFSWriteOptions) {\n const internalPath = this.translatePath(path);\n return this.afs.write(internalPath, content, options);\n }\n\n async search(path: string, query: string, options?: AFSSearchOptions) {\n const internalPath = this.translatePath(path);\n return this.afs.search(internalPath, query, options);\n }\n\n async delete(path: string, options?: AFSDeleteOptions) {\n const internalPath = this.translatePath(path);\n return this.afs.delete(internalPath, options);\n }\n}\n\n/**\n * Create an AFS runtime from configuration\n *\n * @param cwd - Working directory to load config from\n * @param options - Runtime options\n * @returns Configured AFS runtime\n */\nexport async function createRuntime(\n cwd: string = process.cwd(),\n options: RuntimeOptions = {},\n): Promise<AFSRuntime> {\n const loader = options.configLoader ?? new ConfigLoader();\n const config = await loader.load(cwd);\n\n const runtime = new AFSRuntime();\n\n for (const mount of config.mounts) {\n const provider = await createProvider(mount);\n await runtime.mount(provider, mount.path);\n }\n\n return runtime;\n}\n"],"mappings":";;;;;;;;;;;AAyBA,IAAa,aAAb,MAAkG;CAChG,AAAQ;CACR,AAAQ,2BAAgC,IAAI,KAAK;CAEjD,cAAc;AACZ,OAAK,MAAM,IAAI,KAAK;;;;;CAMtB,MAAM,MAAM,UAAqB,WAAkC;AACjE,OAAK,IAAI,MAAM,SAAS;EAExB,MAAM,aAAa,YAAY,SAAS;AACxC,OAAK,SAAS,IAAI,WAAW,WAAW;;;;;CAM1C,AAAQ,cAAc,UAA0B;EAE9C,IAAI,YAAY;EAChB,IAAI,iBAAiB;AAErB,OAAK,MAAM,CAAC,WAAW,eAAe,KAAK,SAAS,SAAS,CAC3D,KAAI,aAAa,aAAa,SAAS,WAAW,GAAG,UAAU,GAAG,EAChE;OAAI,UAAU,SAAS,UAAU,QAAQ;AACvC,gBAAY;AACZ,qBAAiB;;;AAKvB,MAAI,CAAC,UAEH,QAAO;EAIT,MAAM,SAAS,SAAS,MAAM,UAAU,OAAO;AAC/C,SAAO,iBAAiB;;CAG1B,MAAM,KAAK,MAAc,SAA0B;EACjD,MAAM,eAAe,KAAK,cAAc,KAAK;AAI7C,SAHe,MAAM,KAAK,IAAI,KAAK,cAAc,QAAQ;;CAM3D,MAAM,KAAK,MAAc,SAA0B;EACjD,MAAM,eAAe,KAAK,cAAc,KAAK;AAC7C,SAAO,KAAK,IAAI,KAAK,cAAc,QAAQ;;CAG7C,MAAM,MAAM,MAAc,SAA+B,SAA2B;EAClF,MAAM,eAAe,KAAK,cAAc,KAAK;AAC7C,SAAO,KAAK,IAAI,MAAM,cAAc,SAAS,QAAQ;;CAGvD,MAAM,OAAO,MAAc,OAAe,SAA4B;EACpE,MAAM,eAAe,KAAK,cAAc,KAAK;AAC7C,SAAO,KAAK,IAAI,OAAO,cAAc,OAAO,QAAQ;;CAGtD,MAAM,OAAO,MAAc,SAA4B;EACrD,MAAM,eAAe,KAAK,cAAc,KAAK;AAC7C,SAAO,KAAK,IAAI,OAAO,cAAc,QAAQ;;;;;;;;;;AAWjD,eAAsB,cACpB,MAAc,QAAQ,KAAK,EAC3B,UAA0B,EAAE,EACP;CAErB,MAAM,SAAS,OADA,QAAQ,gBAAgB,IAAI,cAAc,EAC7B,KAAK,IAAI;CAErC,MAAM,UAAU,IAAI,YAAY;AAEhC,MAAK,MAAM,SAAS,OAAO,QAAQ;EACjC,MAAM,WAAW,MAAM,eAAe,MAAM;AAC5C,QAAM,QAAQ,MAAM,UAAU,MAAM,KAAK;;AAG3C,QAAO"}
@@ -0,0 +1,9 @@
1
+ const require_rolldown_runtime = require('./_virtual/rolldown_runtime.cjs');
2
+ let node_module = require("node:module");
3
+
4
+ //#region src/version.ts
5
+ const pkg = (0, node_module.createRequire)(require("url").pathToFileURL(__filename).href)("../package.json");
6
+ const VERSION = pkg.version;
7
+
8
+ //#endregion
9
+ exports.VERSION = VERSION;
@@ -0,0 +1,5 @@
1
+ //#region src/version.d.ts
2
+ declare const VERSION: string;
3
+ //#endregion
4
+ export { VERSION };
5
+ //# sourceMappingURL=version.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"version.d.cts","names":[],"sources":["../src/version.ts"],"mappings":";cAKa,OAAA"}
@@ -0,0 +1,5 @@
1
+ //#region src/version.d.ts
2
+ declare const VERSION: string;
3
+ //#endregion
4
+ export { VERSION };
5
+ //# sourceMappingURL=version.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"version.d.mts","names":[],"sources":["../src/version.ts"],"mappings":";cAKa,OAAA"}
@@ -0,0 +1,9 @@
1
+ import { createRequire } from "node:module";
2
+
3
+ //#region src/version.ts
4
+ const pkg = createRequire(import.meta.url)("../package.json");
5
+ const VERSION = pkg.version;
6
+
7
+ //#endregion
8
+ export { VERSION };
9
+ //# sourceMappingURL=version.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"version.mjs","names":[],"sources":["../src/version.ts"],"sourcesContent":["import { createRequire } from \"node:module\";\n\nconst require = createRequire(import.meta.url);\nconst pkg = require(\"../package.json\") as { version: string };\n\nexport const VERSION = pkg.version;\n"],"mappings":";;;AAGA,MAAM,MADU,cAAc,OAAO,KAAK,IAAI,CAC1B,kBAAkB;AAEtC,MAAa,UAAU,IAAI"}
package/package.json CHANGED
@@ -1,29 +1,69 @@
1
1
  {
2
2
  "name": "@aigne/afs-cli",
3
- "version": "1.11.0-beta.1",
3
+ "version": "1.11.0-beta.2",
4
4
  "description": "AFS Command Line Interface",
5
5
  "license": "UNLICENSED",
6
+ "publishConfig": {
7
+ "access": "public"
8
+ },
9
+ "author": "Arcblock <blocklet@arcblock.io> https://github.com/arcblock",
10
+ "homepage": "https://github.com/arcblock/afs",
11
+ "repository": {
12
+ "type": "git",
13
+ "url": "git+https://github.com/arcblock/afs"
14
+ },
15
+ "bugs": {
16
+ "url": "https://github.com/arcblock/afs/issues"
17
+ },
6
18
  "type": "module",
7
19
  "bin": {
8
- "afs": "./dist/cli.js"
20
+ "afs": "./dist/cli.mjs"
9
21
  },
22
+ "main": "./dist/index.cjs",
23
+ "module": "./dist/index.mjs",
24
+ "types": "./dist/index.d.cts",
10
25
  "exports": {
11
26
  ".": {
12
- "import": "./dist/index.js",
13
- "types": "./dist/index.d.ts"
14
- }
27
+ "require": "./dist/index.cjs",
28
+ "import": "./dist/index.mjs"
29
+ },
30
+ "./cli": {
31
+ "require": "./dist/cli.cjs",
32
+ "import": "./dist/cli.mjs"
33
+ },
34
+ "./*": "./*"
15
35
  },
36
+ "files": [
37
+ "dist",
38
+ "LICENSE",
39
+ "README.md",
40
+ "CHANGELOG.md"
41
+ ],
16
42
  "dependencies": {
17
- "@aigne/afs": "1.11.0-beta.1"
43
+ "smol-toml": "^1.3.1",
44
+ "yargs": "^17.7.2",
45
+ "zod": "^3.24.1",
46
+ "@aigne/afs-git": "1.11.0-beta.2",
47
+ "@aigne/afs-json": "1.11.0-beta.2",
48
+ "@aigne/afs-fs": "1.11.0-beta.2",
49
+ "@aigne/afs-sqlite": "1.11.0-beta.2",
50
+ "@aigne/afs": "1.11.0-beta.2"
18
51
  },
19
52
  "devDependencies": {
20
- "tsdown": "^0.20.0-beta.3",
21
- "typescript": "^5.9.0"
53
+ "@types/bun": "^1.3.6",
54
+ "@types/yargs": "^17.0.33",
55
+ "npm-run-all": "^4.1.5",
56
+ "rimraf": "^6.1.2",
57
+ "tsdown": "0.20.0-beta.3",
58
+ "typescript": "5.9.2",
59
+ "@aigne/scripts": "0.0.0",
60
+ "@aigne/typescript-config": "0.0.0"
22
61
  },
23
62
  "scripts": {
24
- "build": "tsdown src/index.ts src/cli.ts --format esm --dts",
25
- "dev": "tsdown src/index.ts src/cli.ts --format esm --dts --watch",
63
+ "build": "tsdown",
64
+ "check-types": "tsc --noEmit",
65
+ "clean": "rimraf dist coverage",
26
66
  "test": "bun test",
27
- "check-types": "tsc --noEmit"
67
+ "test:coverage": "bun test --coverage --coverage-reporter=lcov --coverage-reporter=text"
28
68
  }
29
69
  }
@@ -1,18 +0,0 @@
1
-
2
- > @aigne/afs-cli@1.11.0-beta.1 build /home/runner/work/afs/afs/packages/cli
3
- > tsdown src/index.ts src/cli.ts --format esm --dts
4
-
5
- ℹ tsdown v0.20.0-beta.3 powered by rolldown v1.0.0-beta.60
6
- ℹ entry: src/index.ts, src/cli.ts
7
- ℹ tsconfig: tsconfig.json
8
- ℹ Build start
9
- ℹ Granting execute permission to dist/cli.mjs
10
- ℹ dist/cli.mjs 0.76 kB │ gzip: 0.54 kB
11
- ℹ dist/index.mjs 0.07 kB │ gzip: 0.08 kB
12
- ℹ dist/version--p6A8sKX.mjs 0.09 kB │ gzip: 0.10 kB
13
- ℹ dist/index.d.mts 0.10 kB │ gzip: 0.11 kB
14
- ℹ dist/cli.d.mts 0.01 kB │ gzip: 0.03 kB
15
- ℹ 5 files, total: 1.03 kB
16
- [PLUGIN_TIMINGS] Warning: Your build spent significant time in plugin `rolldown-plugin-dts:generate`. See https://rolldown.rs/options/checks#plugintimings for more details.
17
-
18
- ✔ Build complete in 7128ms
@@ -1,4 +0,0 @@
1
-
2
- > @aigne/afs-cli@1.11.0-beta.1 check-types /home/runner/work/afs/afs/packages/cli
3
- > tsc --noEmit
4
-
@@ -1,5 +0,0 @@
1
- //#region src/version.ts
2
- const VERSION = "1.11.0-beta";
3
-
4
- //#endregion
5
- export { VERSION as t };
package/src/cli.test.ts DELETED
@@ -1,8 +0,0 @@
1
- import { describe, expect, it } from "bun:test";
2
- import { VERSION } from "./version.js";
3
-
4
- describe("afs-cli", () => {
5
- it("should have correct version", () => {
6
- expect(VERSION).toBe("1.11.0-beta");
7
- });
8
- });
package/src/cli.ts DELETED
@@ -1,29 +0,0 @@
1
- #!/usr/bin/env node
2
-
3
- /**
4
- * AFS CLI - Command Line Interface
5
- *
6
- * 命令:
7
- * - afs ls [path] 列出目录
8
- * - afs cat <path> 读取文件
9
- * - afs write <path> 写入文件
10
- * - afs search <path> <pattern> 搜索内容
11
- * - afs exec <path> <action> 执行操作
12
- * - afs explain <path> 语义解释
13
- *
14
- * 输出模式:
15
- * - 默认: Machine Truth (LLM/脚本友好)
16
- * - --json: 结构化 JSON
17
- * - --view=llm: LLM 优化输出
18
- * - --view=human: 人类友好格式
19
- *
20
- * 运行模式:
21
- * - 直接模式 (默认): 直接调用 @aigne/afs
22
- * - daemon 模式 (--daemon): 通过 afsd 代理
23
- */
24
-
25
- import { VERSION } from "./version.js";
26
-
27
- console.log(`afs-cli v${VERSION}`);
28
-
29
- // TODO: 实现 CLI
package/src/index.ts DELETED
@@ -1,7 +0,0 @@
1
- /**
2
- * @aigne/afs-cli
3
- *
4
- * AFS Command Line Interface
5
- */
6
-
7
- export { VERSION } from "./version.js";
package/src/version.ts DELETED
@@ -1 +0,0 @@
1
- export const VERSION = "1.11.0-beta";
package/tsconfig.json DELETED
@@ -1,16 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- "target": "ES2022",
4
- "module": "NodeNext",
5
- "moduleResolution": "NodeNext",
6
- "declaration": true,
7
- "outDir": "./dist",
8
- "rootDir": "./src",
9
- "strict": true,
10
- "esModuleInterop": true,
11
- "skipLibCheck": true,
12
- "forceConsistentCasingInFileNames": true
13
- },
14
- "include": ["src/**/*"],
15
- "exclude": ["node_modules", "dist"]
16
- }