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

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 (75) hide show
  1. package/README.md +240 -12
  2. package/dist/cli.cjs +144 -26
  3. package/dist/cli.mjs +144 -26
  4. package/dist/cli.mjs.map +1 -1
  5. package/dist/commands/index.cjs +1 -0
  6. package/dist/commands/index.mjs +1 -0
  7. package/dist/commands/ls.cjs +12 -5
  8. package/dist/commands/ls.mjs +13 -5
  9. package/dist/commands/ls.mjs.map +1 -1
  10. package/dist/commands/mount.cjs +53 -17
  11. package/dist/commands/mount.mjs +53 -17
  12. package/dist/commands/mount.mjs.map +1 -1
  13. package/dist/commands/serve.cjs +142 -0
  14. package/dist/commands/serve.mjs +141 -0
  15. package/dist/commands/serve.mjs.map +1 -0
  16. package/dist/config/loader.cjs +28 -6
  17. package/dist/config/loader.mjs +28 -6
  18. package/dist/config/loader.mjs.map +1 -1
  19. package/dist/config/provider-factory.cjs +19 -1
  20. package/dist/config/provider-factory.mjs +19 -1
  21. package/dist/config/provider-factory.mjs.map +1 -1
  22. package/dist/config/schema.cjs +70 -3
  23. package/dist/config/schema.mjs +69 -3
  24. package/dist/config/schema.mjs.map +1 -1
  25. package/dist/config/uri-parser.cjs +17 -0
  26. package/dist/config/uri-parser.mjs +17 -0
  27. package/dist/config/uri-parser.mjs.map +1 -1
  28. package/dist/explorer/actions.cjs +246 -0
  29. package/dist/explorer/actions.mjs +240 -0
  30. package/dist/explorer/actions.mjs.map +1 -0
  31. package/dist/explorer/components/dialog.cjs +231 -0
  32. package/dist/explorer/components/dialog.mjs +232 -0
  33. package/dist/explorer/components/dialog.mjs.map +1 -0
  34. package/dist/explorer/components/file-list.cjs +107 -0
  35. package/dist/explorer/components/file-list.mjs +107 -0
  36. package/dist/explorer/components/file-list.mjs.map +1 -0
  37. package/dist/explorer/components/function-bar.cjs +55 -0
  38. package/dist/explorer/components/function-bar.mjs +55 -0
  39. package/dist/explorer/components/function-bar.mjs.map +1 -0
  40. package/dist/explorer/components/index.cjs +5 -0
  41. package/dist/explorer/components/index.mjs +7 -0
  42. package/dist/explorer/components/metadata-panel.cjs +122 -0
  43. package/dist/explorer/components/metadata-panel.mjs +122 -0
  44. package/dist/explorer/components/metadata-panel.mjs.map +1 -0
  45. package/dist/explorer/components/status-bar.cjs +53 -0
  46. package/dist/explorer/components/status-bar.mjs +54 -0
  47. package/dist/explorer/components/status-bar.mjs.map +1 -0
  48. package/dist/explorer/keybindings.cjs +214 -0
  49. package/dist/explorer/keybindings.mjs +213 -0
  50. package/dist/explorer/keybindings.mjs.map +1 -0
  51. package/dist/explorer/screen.cjs +200 -0
  52. package/dist/explorer/screen.mjs +199 -0
  53. package/dist/explorer/screen.mjs.map +1 -0
  54. package/dist/explorer/state.cjs +53 -0
  55. package/dist/explorer/state.mjs +53 -0
  56. package/dist/explorer/state.mjs.map +1 -0
  57. package/dist/explorer/theme.cjs +158 -0
  58. package/dist/explorer/theme.mjs +155 -0
  59. package/dist/explorer/theme.mjs.map +1 -0
  60. package/dist/path-utils.cjs +104 -0
  61. package/dist/path-utils.mjs +104 -0
  62. package/dist/path-utils.mjs.map +1 -0
  63. package/dist/runtime.cjs +47 -33
  64. package/dist/runtime.mjs +47 -33
  65. package/dist/runtime.mjs.map +1 -1
  66. package/dist/ui/header.cjs +60 -0
  67. package/dist/ui/header.mjs +59 -0
  68. package/dist/ui/header.mjs.map +1 -0
  69. package/dist/ui/index.cjs +17 -0
  70. package/dist/ui/index.mjs +15 -0
  71. package/dist/ui/index.mjs.map +1 -0
  72. package/dist/ui/terminal.cjs +97 -0
  73. package/dist/ui/terminal.mjs +95 -0
  74. package/dist/ui/terminal.mjs.map +1 -0
  75. package/package.json +9 -6
@@ -0,0 +1,97 @@
1
+
2
+ //#region src/ui/terminal.ts
3
+ /**
4
+ * Terminal utilities for CLI output
5
+ *
6
+ * Handles:
7
+ * - ANSI color codes
8
+ * - TTY detection
9
+ * - Environment variable checks (NO_COLOR, AFS_NO_HEADER)
10
+ */
11
+ /**
12
+ * ANSI color codes
13
+ */
14
+ const ANSI = {
15
+ reset: "\x1B[0m",
16
+ bold: "\x1B[1m",
17
+ dim: "\x1B[2m",
18
+ black: "\x1B[30m",
19
+ red: "\x1B[31m",
20
+ green: "\x1B[32m",
21
+ yellow: "\x1B[33m",
22
+ blue: "\x1B[34m",
23
+ magenta: "\x1B[35m",
24
+ cyan: "\x1B[36m",
25
+ white: "\x1B[37m",
26
+ brightBlack: "\x1B[90m",
27
+ brightRed: "\x1B[91m",
28
+ brightGreen: "\x1B[92m",
29
+ brightYellow: "\x1B[93m",
30
+ brightBlue: "\x1B[94m",
31
+ brightMagenta: "\x1B[95m",
32
+ brightCyan: "\x1B[96m",
33
+ brightWhite: "\x1B[97m"
34
+ };
35
+ /**
36
+ * Check if stdout is a TTY (interactive terminal)
37
+ */
38
+ function isTTY() {
39
+ return process.stdout.isTTY === true;
40
+ }
41
+ /**
42
+ * Check if colors should be disabled
43
+ * Respects NO_COLOR environment variable (https://no-color.org/)
44
+ */
45
+ function isColorDisabled() {
46
+ return process.env.NO_COLOR !== void 0;
47
+ }
48
+ /**
49
+ * Check if header should be displayed
50
+ * Disabled by AFS_NO_HEADER environment variable
51
+ */
52
+ function isHeaderDisabled() {
53
+ return process.env.AFS_NO_HEADER !== void 0;
54
+ }
55
+ /**
56
+ * Check if we should use colorized output
57
+ * Colors are enabled when:
58
+ * - stdout is a TTY
59
+ * - NO_COLOR is not set
60
+ */
61
+ function shouldUseColors() {
62
+ return isTTY() && !isColorDisabled();
63
+ }
64
+ /**
65
+ * Color helper functions
66
+ * Returns plain text if colors are disabled
67
+ */
68
+ const colors = {
69
+ _wrap: (code, text) => {
70
+ if (!shouldUseColors()) return text;
71
+ return `${code}${text}${ANSI.reset}`;
72
+ },
73
+ bold: (text) => colors._wrap(ANSI.bold, text),
74
+ dim: (text) => colors._wrap(ANSI.dim, text),
75
+ red: (text) => colors._wrap(ANSI.red, text),
76
+ green: (text) => colors._wrap(ANSI.green, text),
77
+ yellow: (text) => colors._wrap(ANSI.yellow, text),
78
+ blue: (text) => colors._wrap(ANSI.blue, text),
79
+ magenta: (text) => colors._wrap(ANSI.magenta, text),
80
+ cyan: (text) => colors._wrap(ANSI.cyan, text),
81
+ white: (text) => colors._wrap(ANSI.white, text),
82
+ brightCyan: (text) => colors._wrap(ANSI.brightCyan, text),
83
+ brightGreen: (text) => colors._wrap(ANSI.brightGreen, text),
84
+ brightYellow: (text) => colors._wrap(ANSI.brightYellow, text),
85
+ brightRed: (text) => colors._wrap(ANSI.brightRed, text),
86
+ error: (text) => colors._wrap(ANSI.red, text),
87
+ warning: (text) => colors._wrap(ANSI.yellow, text),
88
+ success: (text) => colors._wrap(ANSI.green, text),
89
+ info: (text) => colors._wrap(ANSI.cyan, text),
90
+ path: (text) => colors._wrap(ANSI.cyan, text),
91
+ muted: (text) => colors._wrap(ANSI.dim, text)
92
+ };
93
+
94
+ //#endregion
95
+ exports.colors = colors;
96
+ exports.isHeaderDisabled = isHeaderDisabled;
97
+ exports.isTTY = isTTY;
@@ -0,0 +1,95 @@
1
+ //#region src/ui/terminal.ts
2
+ /**
3
+ * Terminal utilities for CLI output
4
+ *
5
+ * Handles:
6
+ * - ANSI color codes
7
+ * - TTY detection
8
+ * - Environment variable checks (NO_COLOR, AFS_NO_HEADER)
9
+ */
10
+ /**
11
+ * ANSI color codes
12
+ */
13
+ const ANSI = {
14
+ reset: "\x1B[0m",
15
+ bold: "\x1B[1m",
16
+ dim: "\x1B[2m",
17
+ black: "\x1B[30m",
18
+ red: "\x1B[31m",
19
+ green: "\x1B[32m",
20
+ yellow: "\x1B[33m",
21
+ blue: "\x1B[34m",
22
+ magenta: "\x1B[35m",
23
+ cyan: "\x1B[36m",
24
+ white: "\x1B[37m",
25
+ brightBlack: "\x1B[90m",
26
+ brightRed: "\x1B[91m",
27
+ brightGreen: "\x1B[92m",
28
+ brightYellow: "\x1B[93m",
29
+ brightBlue: "\x1B[94m",
30
+ brightMagenta: "\x1B[95m",
31
+ brightCyan: "\x1B[96m",
32
+ brightWhite: "\x1B[97m"
33
+ };
34
+ /**
35
+ * Check if stdout is a TTY (interactive terminal)
36
+ */
37
+ function isTTY() {
38
+ return process.stdout.isTTY === true;
39
+ }
40
+ /**
41
+ * Check if colors should be disabled
42
+ * Respects NO_COLOR environment variable (https://no-color.org/)
43
+ */
44
+ function isColorDisabled() {
45
+ return process.env.NO_COLOR !== void 0;
46
+ }
47
+ /**
48
+ * Check if header should be displayed
49
+ * Disabled by AFS_NO_HEADER environment variable
50
+ */
51
+ function isHeaderDisabled() {
52
+ return process.env.AFS_NO_HEADER !== void 0;
53
+ }
54
+ /**
55
+ * Check if we should use colorized output
56
+ * Colors are enabled when:
57
+ * - stdout is a TTY
58
+ * - NO_COLOR is not set
59
+ */
60
+ function shouldUseColors() {
61
+ return isTTY() && !isColorDisabled();
62
+ }
63
+ /**
64
+ * Color helper functions
65
+ * Returns plain text if colors are disabled
66
+ */
67
+ const colors = {
68
+ _wrap: (code, text) => {
69
+ if (!shouldUseColors()) return text;
70
+ return `${code}${text}${ANSI.reset}`;
71
+ },
72
+ bold: (text) => colors._wrap(ANSI.bold, text),
73
+ dim: (text) => colors._wrap(ANSI.dim, text),
74
+ red: (text) => colors._wrap(ANSI.red, text),
75
+ green: (text) => colors._wrap(ANSI.green, text),
76
+ yellow: (text) => colors._wrap(ANSI.yellow, text),
77
+ blue: (text) => colors._wrap(ANSI.blue, text),
78
+ magenta: (text) => colors._wrap(ANSI.magenta, text),
79
+ cyan: (text) => colors._wrap(ANSI.cyan, text),
80
+ white: (text) => colors._wrap(ANSI.white, text),
81
+ brightCyan: (text) => colors._wrap(ANSI.brightCyan, text),
82
+ brightGreen: (text) => colors._wrap(ANSI.brightGreen, text),
83
+ brightYellow: (text) => colors._wrap(ANSI.brightYellow, text),
84
+ brightRed: (text) => colors._wrap(ANSI.brightRed, text),
85
+ error: (text) => colors._wrap(ANSI.red, text),
86
+ warning: (text) => colors._wrap(ANSI.yellow, text),
87
+ success: (text) => colors._wrap(ANSI.green, text),
88
+ info: (text) => colors._wrap(ANSI.cyan, text),
89
+ path: (text) => colors._wrap(ANSI.cyan, text),
90
+ muted: (text) => colors._wrap(ANSI.dim, text)
91
+ };
92
+
93
+ //#endregion
94
+ export { colors, isHeaderDisabled, isTTY };
95
+ //# sourceMappingURL=terminal.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"terminal.mjs","names":[],"sources":["../../src/ui/terminal.ts"],"sourcesContent":["/**\n * Terminal utilities for CLI output\n *\n * Handles:\n * - ANSI color codes\n * - TTY detection\n * - Environment variable checks (NO_COLOR, AFS_NO_HEADER)\n */\n\n/**\n * ANSI color codes\n */\nconst ANSI = {\n reset: \"\\x1b[0m\",\n bold: \"\\x1b[1m\",\n dim: \"\\x1b[2m\",\n\n // Foreground colors\n black: \"\\x1b[30m\",\n red: \"\\x1b[31m\",\n green: \"\\x1b[32m\",\n yellow: \"\\x1b[33m\",\n blue: \"\\x1b[34m\",\n magenta: \"\\x1b[35m\",\n cyan: \"\\x1b[36m\",\n white: \"\\x1b[37m\",\n\n // Bright foreground colors\n brightBlack: \"\\x1b[90m\",\n brightRed: \"\\x1b[91m\",\n brightGreen: \"\\x1b[92m\",\n brightYellow: \"\\x1b[93m\",\n brightBlue: \"\\x1b[94m\",\n brightMagenta: \"\\x1b[95m\",\n brightCyan: \"\\x1b[96m\",\n brightWhite: \"\\x1b[97m\",\n} as const;\n\n/**\n * Check if stdout is a TTY (interactive terminal)\n */\nexport function isTTY(): boolean {\n return process.stdout.isTTY === true;\n}\n\n/**\n * Check if colors should be disabled\n * Respects NO_COLOR environment variable (https://no-color.org/)\n */\nexport function isColorDisabled(): boolean {\n return process.env.NO_COLOR !== undefined;\n}\n\n/**\n * Check if header should be displayed\n * Disabled by AFS_NO_HEADER environment variable\n */\nexport function isHeaderDisabled(): boolean {\n return process.env.AFS_NO_HEADER !== undefined;\n}\n\n/**\n * Check if we should use colorized output\n * Colors are enabled when:\n * - stdout is a TTY\n * - NO_COLOR is not set\n */\nexport function shouldUseColors(): boolean {\n return isTTY() && !isColorDisabled();\n}\n\n/**\n * Color helper functions\n * Returns plain text if colors are disabled\n */\nexport const colors = {\n // Create a colorizer function\n _wrap: (code: string, text: string): string => {\n if (!shouldUseColors()) return text;\n return `${code}${text}${ANSI.reset}`;\n },\n\n // Basic styles\n bold: (text: string) => colors._wrap(ANSI.bold, text),\n dim: (text: string) => colors._wrap(ANSI.dim, text),\n\n // Standard colors\n red: (text: string) => colors._wrap(ANSI.red, text),\n green: (text: string) => colors._wrap(ANSI.green, text),\n yellow: (text: string) => colors._wrap(ANSI.yellow, text),\n blue: (text: string) => colors._wrap(ANSI.blue, text),\n magenta: (text: string) => colors._wrap(ANSI.magenta, text),\n cyan: (text: string) => colors._wrap(ANSI.cyan, text),\n white: (text: string) => colors._wrap(ANSI.white, text),\n\n // Bright colors\n brightCyan: (text: string) => colors._wrap(ANSI.brightCyan, text),\n brightGreen: (text: string) => colors._wrap(ANSI.brightGreen, text),\n brightYellow: (text: string) => colors._wrap(ANSI.brightYellow, text),\n brightRed: (text: string) => colors._wrap(ANSI.brightRed, text),\n\n // Semantic colors (for consistency)\n error: (text: string) => colors._wrap(ANSI.red, text),\n warning: (text: string) => colors._wrap(ANSI.yellow, text),\n success: (text: string) => colors._wrap(ANSI.green, text),\n info: (text: string) => colors._wrap(ANSI.cyan, text),\n path: (text: string) => colors._wrap(ANSI.cyan, text),\n muted: (text: string) => colors._wrap(ANSI.dim, text),\n};\n"],"mappings":";;;;;;;;;;;;AAYA,MAAM,OAAO;CACX,OAAO;CACP,MAAM;CACN,KAAK;CAGL,OAAO;CACP,KAAK;CACL,OAAO;CACP,QAAQ;CACR,MAAM;CACN,SAAS;CACT,MAAM;CACN,OAAO;CAGP,aAAa;CACb,WAAW;CACX,aAAa;CACb,cAAc;CACd,YAAY;CACZ,eAAe;CACf,YAAY;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AAK,MAAM,KAAK;CACrD,OAAO,SAAiB,OAAO,MAAM,KAAK,MAAM,KAAK;CACrD,QAAQ,SAAiB,OAAO,MAAM,KAAK,KAAK,KAAK;CACtD"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aigne/afs-cli",
3
- "version": "1.11.0-beta.2",
3
+ "version": "1.11.0-beta.4",
4
4
  "description": "AFS Command Line Interface",
5
5
  "license": "UNLICENSED",
6
6
  "publishConfig": {
@@ -40,16 +40,19 @@
40
40
  "CHANGELOG.md"
41
41
  ],
42
42
  "dependencies": {
43
+ "blessed": "^0.1.81",
43
44
  "smol-toml": "^1.3.1",
44
45
  "yargs": "^17.7.2",
45
46
  "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"
47
+ "@aigne/afs": "1.11.0-beta.4",
48
+ "@aigne/afs-git": "1.11.0-beta.4",
49
+ "@aigne/afs-json": "1.11.0-beta.4",
50
+ "@aigne/afs-fs": "1.11.0-beta.4",
51
+ "@aigne/afs-sqlite": "1.11.0-beta.4",
52
+ "@aigne/afs-http": "1.11.0-beta.4"
51
53
  },
52
54
  "devDependencies": {
55
+ "@types/blessed": "^0.1.25",
53
56
  "@types/bun": "^1.3.6",
54
57
  "@types/yargs": "^17.0.33",
55
58
  "npm-run-all": "^4.1.5",