@fnndsc/chell 4.3.2 → 5.0.0

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 (233) hide show
  1. package/dist/builtins/sys/prompt.js +2 -2
  2. package/dist/builtins/sys/prompt.js.map +1 -1
  3. package/dist/chell.d.ts +2 -1
  4. package/dist/chell.js +2 -1
  5. package/dist/chell.js.map +1 -1
  6. package/dist/config/settings.d.ts +4 -2
  7. package/dist/config/settings.js +7 -2
  8. package/dist/config/settings.js.map +1 -1
  9. package/dist/core/boot.d.ts +3 -1
  10. package/dist/core/boot.js +93 -154
  11. package/dist/core/boot.js.map +1 -1
  12. package/dist/core/cli.d.ts +3 -1
  13. package/dist/core/cli.js +11 -1
  14. package/dist/core/cli.js.map +1 -1
  15. package/dist/core/cliSurface.d.ts +26 -0
  16. package/dist/core/cliSurface.js +152 -0
  17. package/dist/core/cliSurface.js.map +1 -0
  18. package/dist/core/progressRenderer.d.ts +42 -0
  19. package/dist/core/progressRenderer.js +176 -0
  20. package/dist/core/progressRenderer.js.map +1 -0
  21. package/dist/core/prompt/session.d.ts +45 -0
  22. package/dist/core/prompt/session.js +48 -0
  23. package/dist/core/prompt/session.js.map +1 -0
  24. package/dist/core/repl.d.ts +25 -5
  25. package/dist/core/repl.js +58 -45
  26. package/dist/core/repl.js.map +1 -1
  27. package/dist/core/surfaceDispatch.d.ts +21 -0
  28. package/dist/core/surfaceDispatch.js +33 -0
  29. package/dist/core/surfaceDispatch.js.map +1 -0
  30. package/dist/core/warnings.d.ts +14 -0
  31. package/dist/core/warnings.js +25 -0
  32. package/dist/core/warnings.js.map +1 -0
  33. package/dist/index.js +2 -12
  34. package/dist/index.js.map +1 -1
  35. package/dist/remote/client.d.ts +6 -0
  36. package/dist/remote/client.js +71 -0
  37. package/dist/remote/client.js.map +1 -0
  38. package/dist/remote/remoteEngine.d.ts +125 -0
  39. package/dist/remote/remoteEngine.js +286 -0
  40. package/dist/remote/remoteEngine.js.map +1 -0
  41. package/package.json +5 -3
  42. package/dist/builtins/debug.d.ts +0 -6
  43. package/dist/builtins/debug.js +0 -47
  44. package/dist/builtins/debug.js.map +0 -1
  45. package/dist/builtins/executable.d.ts +0 -22
  46. package/dist/builtins/executable.js +0 -115
  47. package/dist/builtins/executable.js.map +0 -1
  48. package/dist/builtins/fs/cat.d.ts +0 -16
  49. package/dist/builtins/fs/cat.js +0 -249
  50. package/dist/builtins/fs/cat.js.map +0 -1
  51. package/dist/builtins/fs/cd.d.ts +0 -41
  52. package/dist/builtins/fs/cd.js +0 -178
  53. package/dist/builtins/fs/cd.js.map +0 -1
  54. package/dist/builtins/fs/cp.d.ts +0 -7
  55. package/dist/builtins/fs/cp.js +0 -73
  56. package/dist/builtins/fs/cp.js.map +0 -1
  57. package/dist/builtins/fs/download.d.ts +0 -6
  58. package/dist/builtins/fs/download.js +0 -41
  59. package/dist/builtins/fs/download.js.map +0 -1
  60. package/dist/builtins/fs/du.d.ts +0 -58
  61. package/dist/builtins/fs/du.js +0 -210
  62. package/dist/builtins/fs/du.js.map +0 -1
  63. package/dist/builtins/fs/edit.d.ts +0 -7
  64. package/dist/builtins/fs/edit.js +0 -86
  65. package/dist/builtins/fs/edit.js.map +0 -1
  66. package/dist/builtins/fs/ls.d.ts +0 -8
  67. package/dist/builtins/fs/ls.js +0 -68
  68. package/dist/builtins/fs/ls.js.map +0 -1
  69. package/dist/builtins/fs/mkdir.d.ts +0 -6
  70. package/dist/builtins/fs/mkdir.js +0 -38
  71. package/dist/builtins/fs/mkdir.js.map +0 -1
  72. package/dist/builtins/fs/mv.d.ts +0 -7
  73. package/dist/builtins/fs/mv.js +0 -75
  74. package/dist/builtins/fs/mv.js.map +0 -1
  75. package/dist/builtins/fs/pull.args.d.ts +0 -22
  76. package/dist/builtins/fs/pull.args.js +0 -30
  77. package/dist/builtins/fs/pull.args.js.map +0 -1
  78. package/dist/builtins/fs/pull.d.ts +0 -26
  79. package/dist/builtins/fs/pull.js +0 -417
  80. package/dist/builtins/fs/pull.js.map +0 -1
  81. package/dist/builtins/fs/pwd.d.ts +0 -7
  82. package/dist/builtins/fs/pwd.js +0 -75
  83. package/dist/builtins/fs/pwd.js.map +0 -1
  84. package/dist/builtins/fs/rm.d.ts +0 -31
  85. package/dist/builtins/fs/rm.js +0 -148
  86. package/dist/builtins/fs/rm.js.map +0 -1
  87. package/dist/builtins/fs/touch.d.ts +0 -6
  88. package/dist/builtins/fs/touch.js +0 -64
  89. package/dist/builtins/fs/touch.js.map +0 -1
  90. package/dist/builtins/fs/tree.d.ts +0 -15
  91. package/dist/builtins/fs/tree.js +0 -84
  92. package/dist/builtins/fs/tree.js.map +0 -1
  93. package/dist/builtins/fs/upload.d.ts +0 -6
  94. package/dist/builtins/fs/upload.js +0 -45
  95. package/dist/builtins/fs/upload.js.map +0 -1
  96. package/dist/builtins/help.d.ts +0 -74
  97. package/dist/builtins/help.js +0 -1217
  98. package/dist/builtins/help.js.map +0 -1
  99. package/dist/builtins/index.d.ts +0 -45
  100. package/dist/builtins/index.js +0 -45
  101. package/dist/builtins/index.js.map +0 -1
  102. package/dist/builtins/net/connect.d.ts +0 -7
  103. package/dist/builtins/net/connect.js +0 -42
  104. package/dist/builtins/net/connect.js.map +0 -1
  105. package/dist/builtins/net/cubepath.d.ts +0 -18
  106. package/dist/builtins/net/cubepath.js +0 -102
  107. package/dist/builtins/net/cubepath.js.map +0 -1
  108. package/dist/builtins/net/logout.d.ts +0 -6
  109. package/dist/builtins/net/logout.js +0 -24
  110. package/dist/builtins/net/logout.js.map +0 -1
  111. package/dist/builtins/net/pacs.d.ts +0 -24
  112. package/dist/builtins/net/pacs.js +0 -121
  113. package/dist/builtins/net/pacs.js.map +0 -1
  114. package/dist/builtins/net/pacsUtils.d.ts +0 -85
  115. package/dist/builtins/net/pacsUtils.js +0 -184
  116. package/dist/builtins/net/pacsUtils.js.map +0 -1
  117. package/dist/builtins/net/query.d.ts +0 -60
  118. package/dist/builtins/net/query.js +0 -324
  119. package/dist/builtins/net/query.js.map +0 -1
  120. package/dist/builtins/parametersofplugin.d.ts +0 -13
  121. package/dist/builtins/parametersofplugin.js +0 -43
  122. package/dist/builtins/parametersofplugin.js.map +0 -1
  123. package/dist/builtins/pluginExecute.d.ts +0 -27
  124. package/dist/builtins/pluginExecute.js +0 -165
  125. package/dist/builtins/pluginExecute.js.map +0 -1
  126. package/dist/builtins/proc.d.ts +0 -6
  127. package/dist/builtins/proc.helpers.d.ts +0 -68
  128. package/dist/builtins/proc.helpers.js +0 -102
  129. package/dist/builtins/proc.helpers.js.map +0 -1
  130. package/dist/builtins/proc.js +0 -289
  131. package/dist/builtins/proc.js.map +0 -1
  132. package/dist/builtins/res/compute.d.ts +0 -6
  133. package/dist/builtins/res/compute.js +0 -55
  134. package/dist/builtins/res/compute.js.map +0 -1
  135. package/dist/builtins/res/feed.d.ts +0 -6
  136. package/dist/builtins/res/feed.js +0 -244
  137. package/dist/builtins/res/feed.js.map +0 -1
  138. package/dist/builtins/res/feed.notes.d.ts +0 -28
  139. package/dist/builtins/res/feed.notes.js +0 -24
  140. package/dist/builtins/res/feed.notes.js.map +0 -1
  141. package/dist/builtins/res/files.d.ts +0 -18
  142. package/dist/builtins/res/files.js +0 -85
  143. package/dist/builtins/res/files.js.map +0 -1
  144. package/dist/builtins/res/group.d.ts +0 -6
  145. package/dist/builtins/res/group.js +0 -54
  146. package/dist/builtins/res/group.js.map +0 -1
  147. package/dist/builtins/res/pipeline.args.d.ts +0 -22
  148. package/dist/builtins/res/pipeline.args.js +0 -28
  149. package/dist/builtins/res/pipeline.args.js.map +0 -1
  150. package/dist/builtins/res/pipeline.d.ts +0 -20
  151. package/dist/builtins/res/pipeline.js +0 -252
  152. package/dist/builtins/res/pipeline.js.map +0 -1
  153. package/dist/builtins/res/plugin.d.ts +0 -13
  154. package/dist/builtins/res/plugin.js +0 -140
  155. package/dist/builtins/res/plugin.js.map +0 -1
  156. package/dist/builtins/res/plugininstance.d.ts +0 -6
  157. package/dist/builtins/res/plugininstance.js +0 -53
  158. package/dist/builtins/res/plugininstance.js.map +0 -1
  159. package/dist/builtins/res/pluginmeta.d.ts +0 -6
  160. package/dist/builtins/res/pluginmeta.js +0 -53
  161. package/dist/builtins/res/pluginmeta.js.map +0 -1
  162. package/dist/builtins/res/tag.d.ts +0 -6
  163. package/dist/builtins/res/tag.js +0 -53
  164. package/dist/builtins/res/tag.js.map +0 -1
  165. package/dist/builtins/res/workflow.d.ts +0 -6
  166. package/dist/builtins/res/workflow.js +0 -53
  167. package/dist/builtins/res/workflow.js.map +0 -1
  168. package/dist/builtins/store.d.ts +0 -6
  169. package/dist/builtins/store.js +0 -108
  170. package/dist/builtins/store.js.map +0 -1
  171. package/dist/builtins/sys/context.d.ts +0 -6
  172. package/dist/builtins/sys/context.js +0 -50
  173. package/dist/builtins/sys/context.js.map +0 -1
  174. package/dist/builtins/sys/physicalmode.d.ts +0 -6
  175. package/dist/builtins/sys/physicalmode.js +0 -41
  176. package/dist/builtins/sys/physicalmode.js.map +0 -1
  177. package/dist/builtins/sys/timing.d.ts +0 -6
  178. package/dist/builtins/sys/timing.js +0 -41
  179. package/dist/builtins/sys/timing.js.map +0 -1
  180. package/dist/builtins/sys/whoami.d.ts +0 -12
  181. package/dist/builtins/sys/whoami.js +0 -37
  182. package/dist/builtins/sys/whoami.js.map +0 -1
  183. package/dist/builtins/utils.d.ts +0 -55
  184. package/dist/builtins/utils.js +0 -145
  185. package/dist/builtins/utils.js.map +0 -1
  186. package/dist/builtins/wildcard.d.ts +0 -26
  187. package/dist/builtins/wildcard.js +0 -120
  188. package/dist/builtins/wildcard.js.map +0 -1
  189. package/dist/command-keys.d.ts +0 -8
  190. package/dist/command-keys.js +0 -32
  191. package/dist/command-keys.js.map +0 -1
  192. package/dist/core/dispatch.d.ts +0 -48
  193. package/dist/core/dispatch.js +0 -544
  194. package/dist/core/dispatch.js.map +0 -1
  195. package/dist/core/preprocess.d.ts +0 -46
  196. package/dist/core/preprocess.js +0 -146
  197. package/dist/core/preprocess.js.map +0 -1
  198. package/dist/core/question.d.ts +0 -34
  199. package/dist/core/question.js +0 -76
  200. package/dist/core/question.js.map +0 -1
  201. package/dist/lib/completer/index.d.ts +0 -15
  202. package/dist/lib/completer/index.js +0 -212
  203. package/dist/lib/completer/index.js.map +0 -1
  204. package/dist/lib/completer/pathComplete.helpers.d.ts +0 -22
  205. package/dist/lib/completer/pathComplete.helpers.js +0 -49
  206. package/dist/lib/completer/pathComplete.helpers.js.map +0 -1
  207. package/dist/lib/parser.d.ts +0 -13
  208. package/dist/lib/parser.js +0 -52
  209. package/dist/lib/parser.js.map +0 -1
  210. package/dist/lib/pipe.d.ts +0 -11
  211. package/dist/lib/pipe.js +0 -90
  212. package/dist/lib/pipe.js.map +0 -1
  213. package/dist/lib/prefetch.d.ts +0 -25
  214. package/dist/lib/prefetch.js +0 -64
  215. package/dist/lib/prefetch.js.map +0 -1
  216. package/dist/lib/semicolonParser.d.ts +0 -22
  217. package/dist/lib/semicolonParser.js +0 -53
  218. package/dist/lib/semicolonParser.js.map +0 -1
  219. package/dist/lib/spinner.d.ts +0 -23
  220. package/dist/lib/spinner.js +0 -70
  221. package/dist/lib/spinner.js.map +0 -1
  222. package/dist/lib/vfs/providers/static.d.ts +0 -65
  223. package/dist/lib/vfs/providers/static.js +0 -164
  224. package/dist/lib/vfs/providers/static.js.map +0 -1
  225. package/dist/lib/vfs/providers/static_content.d.ts +0 -27
  226. package/dist/lib/vfs/providers/static_content.js +0 -180
  227. package/dist/lib/vfs/providers/static_content.js.map +0 -1
  228. package/dist/lib/vfs/vfs.d.ts +0 -59
  229. package/dist/lib/vfs/vfs.js +0 -198
  230. package/dist/lib/vfs/vfs.js.map +0 -1
  231. package/dist/session/index.d.ts +0 -76
  232. package/dist/session/index.js +0 -120
  233. package/dist/session/index.js.map +0 -1
@@ -1,146 +0,0 @@
1
- /**
2
- * @file Command-line preprocessing: pure parsing of pipes, redirects and
3
- * wildcard/shell-escape detection.
4
- *
5
- * @module
6
- */
7
- import * as path from 'path';
8
- import { statSync } from 'fs';
9
- import { Ok, Err, errorStack } from '@fnndsc/cumin';
10
- import { args_tokenize } from '../lib/parser.js';
11
- /** Commands whose arguments benefit from glob/wildcard expansion. */
12
- const WILDCARD_COMMANDS = ['ls', 'rm', 'cat', 'mv', 'cp', 'du', 'tree'];
13
- /**
14
- * Determines if a command should have its arguments expanded for wildcards.
15
- *
16
- * @param command - The command name.
17
- * @returns True if wildcards should be expanded.
18
- */
19
- export function wildcards_expandCheck(command) {
20
- return WILDCARD_COMMANDS.includes(command);
21
- }
22
- /**
23
- * Returns true if the input line is a shell escape (starts with `!`).
24
- *
25
- * @param line - Trimmed input line.
26
- */
27
- export function command_shellEscape_detect(line) {
28
- return line.startsWith('!');
29
- }
30
- /**
31
- * Parses a command line for pipe operators and returns segments.
32
- * Respects single and double quotes.
33
- *
34
- * @param line - The full command line.
35
- * @returns An array of command segments.
36
- */
37
- export function pipes_parse(line) {
38
- const segments = [];
39
- let currentSegment = '';
40
- let inSingleQuote = false;
41
- let inDoubleQuote = false;
42
- for (let i = 0; i < line.length; i++) {
43
- const char = line[i];
44
- if (char === "'" && !inDoubleQuote) {
45
- inSingleQuote = !inSingleQuote;
46
- currentSegment += char;
47
- }
48
- else if (char === '"' && !inSingleQuote) {
49
- inDoubleQuote = !inDoubleQuote;
50
- currentSegment += char;
51
- }
52
- else if (char === '|' && !inSingleQuote && !inDoubleQuote) {
53
- segments.push(currentSegment.trim());
54
- currentSegment = '';
55
- }
56
- else {
57
- currentSegment += char;
58
- }
59
- }
60
- if (currentSegment.trim()) {
61
- segments.push(currentSegment.trim());
62
- }
63
- return segments;
64
- }
65
- /**
66
- * Parses a command line for output redirection operators (> or >>).
67
- * Respects single and double quotes.
68
- *
69
- * @param line - The full command line.
70
- * @returns An object with the command and redirect info, or null if no redirection.
71
- */
72
- export function redirect_parse(line) {
73
- let inSingleQuote = false;
74
- let inDoubleQuote = false;
75
- for (let i = 0; i < line.length; i++) {
76
- const char = line[i];
77
- if (char === "'" && !inDoubleQuote) {
78
- inSingleQuote = !inSingleQuote;
79
- }
80
- else if (char === '"' && !inSingleQuote) {
81
- inDoubleQuote = !inDoubleQuote;
82
- }
83
- else if (!inSingleQuote && !inDoubleQuote) {
84
- // Check for >>
85
- if (i < line.length - 1 && line[i] === '>' && line[i + 1] === '>') {
86
- const command = line.substring(0, i).trim();
87
- const filePath = line.substring(i + 2).trim();
88
- return { command, operator: '>>', filePath };
89
- }
90
- // Check for >
91
- else if (line[i] === '>') {
92
- const command = line.substring(0, i).trim();
93
- const filePath = line.substring(i + 1).trim();
94
- return { command, operator: '>', filePath };
95
- }
96
- }
97
- }
98
- return null;
99
- }
100
- /**
101
- * Resolves the final redirect target path. If the target is an existing directory
102
- * and the source command is `cat <file>`, resolves to `<dir>/<basename>`.
103
- * Returns Err (with message on errorStack) when the filename cannot be determined.
104
- *
105
- * @param filePath - The redirect target path as written by the user.
106
- * @param commandLine - The command whose output is being redirected.
107
- * @returns Ok(resolved path) or Err on failure.
108
- */
109
- export function redirectTarget_resolve(filePath, commandLine) {
110
- try {
111
- const stats = statSync(filePath);
112
- if (!stats.isDirectory()) {
113
- return Ok(filePath);
114
- }
115
- }
116
- catch (err) {
117
- const nodeErr = err;
118
- if (nodeErr.code === 'ENOENT') {
119
- return Ok(filePath);
120
- }
121
- errorStack.stack_push('error', `Redirect: filesystem error for '${filePath}': ${String(err)}`);
122
- return Err();
123
- }
124
- const tokens = args_tokenize(commandLine);
125
- if (tokens.length === 0) {
126
- errorStack.stack_push('error', `Redirect target '${filePath}' is a directory and no source command was provided.`);
127
- return Err();
128
- }
129
- const [command, ...args] = tokens;
130
- if (command !== 'cat') {
131
- errorStack.stack_push('error', `Redirect target '${filePath}' is a directory; cannot infer filename for command '${command}'.`);
132
- return Err();
133
- }
134
- const sourceArgs = args.filter((arg) => arg !== '--binary');
135
- if (sourceArgs.length === 0) {
136
- errorStack.stack_push('error', `Redirect target '${filePath}' is a directory; no source file provided to 'cat'.`);
137
- return Err();
138
- }
139
- if (sourceArgs.length > 1) {
140
- errorStack.stack_push('error', `Redirect target '${filePath}' is a directory; 'cat' with multiple files cannot choose a single output name.`);
141
- return Err();
142
- }
143
- const sourceName = path.basename(sourceArgs[0]);
144
- return Ok(path.join(filePath, sourceName));
145
- }
146
- //# sourceMappingURL=preprocess.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"preprocess.js","sourceRoot":"","sources":["../../src/core/preprocess.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAC7B,OAAO,EAAE,QAAQ,EAAE,MAAM,IAAI,CAAC;AAC9B,OAAO,EAAU,EAAE,EAAE,GAAG,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC5D,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAEjD,qEAAqE;AACrE,MAAM,iBAAiB,GAAsB,CAAC,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC;AAE3F;;;;;GAKG;AACH,MAAM,UAAU,qBAAqB,CAAC,OAAe;IACnD,OAAO,iBAAiB,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;AAC7C,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,0BAA0B,CAAC,IAAY;IACrD,OAAO,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC;AAC9B,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,WAAW,CAAC,IAAY;IACtC,MAAM,QAAQ,GAAa,EAAE,CAAC;IAC9B,IAAI,cAAc,GAAW,EAAE,CAAC;IAChC,IAAI,aAAa,GAAY,KAAK,CAAC;IACnC,IAAI,aAAa,GAAY,KAAK,CAAC;IAEnC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;Q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MAAM,UAAU,GAAW,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC;IACxD,OAAO,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,UAAU,CAAC,CAAC,CAAC;AAC7C,CAAC"}
@@ -1,34 +0,0 @@
1
- /**
2
- * @file Shared question helper for builtins.
3
- *
4
- * Provides a single question() function that builtins use for interactive
5
- * prompts. The active REPL registers its readline interface here so input
6
- * is routed through one interface only — preventing leaked input when a
7
- * second readline interface would otherwise consume the same stdin.
8
- *
9
- * @module
10
- */
11
- /**
12
- * Registers the REPL's readline question functions.
13
- * Called once by REPL.start() before any commands run.
14
- *
15
- * @param fn - Wrapper around rl.question() on the active interface.
16
- * @param hiddenFn - Raw-stdin reader that suppresses echo.
17
- */
18
- export declare function repl_questionRegister(fn: (prompt: string) => Promise<string>, hiddenFn: (prompt: string) => Promise<string>): void;
19
- /**
20
- * Asks a question using the active REPL's readline interface so that
21
- * the answer is not double-consumed by a second interface on the same stdin.
22
- *
23
- * @param prompt - The question string to display.
24
- * @returns The trimmed user answer.
25
- */
26
- export declare function repl_question(prompt: string): Promise<string>;
27
- /**
28
- * Asks for a password (no echo) using the REPL's raw-stdin reader.
29
- * Falls back to a muted readline interface outside the REPL.
30
- *
31
- * @param prompt - The prompt string to display.
32
- * @returns The trimmed password string.
33
- */
34
- export declare function repl_questionHidden(prompt: string): Promise<string>;
@@ -1,76 +0,0 @@
1
- /**
2
- * @file Shared question helper for builtins.
3
- *
4
- * Provides a single question() function that builtins use for interactive
5
- * prompts. The active REPL registers its readline interface here so input
6
- * is routed through one interface only — preventing leaked input when a
7
- * second readline interface would otherwise consume the same stdin.
8
- *
9
- * @module
10
- */
11
- import * as readline from 'readline';
12
- /** Registered by the REPL on startup. */
13
- let _questionFn = null;
14
- let _questionHiddenFn = null;
15
- /**
16
- * Registers the REPL's readline question functions.
17
- * Called once by REPL.start() before any commands run.
18
- *
19
- * @param fn - Wrapper around rl.question() on the active interface.
20
- * @param hiddenFn - Raw-stdin reader that suppresses echo.
21
- */
22
- export function repl_questionRegister(fn, hiddenFn) {
23
- _questionFn = fn;
24
- _questionHiddenFn = hiddenFn;
25
- }
26
- /**
27
- * Asks a question using the active REPL's readline interface so that
28
- * the answer is not double-consumed by a second interface on the same stdin.
29
- *
30
- * @param prompt - The question string to display.
31
- * @returns The trimmed user answer.
32
- */
33
- export function repl_question(prompt) {
34
- if (_questionFn) {
35
- return _questionFn(prompt);
36
- }
37
- // Fallback: one-shot interface (pre-REPL startup / single-shot mode)
38
- return new Promise((resolve) => {
39
- const rl = readline.createInterface({
40
- input: process.stdin,
41
- output: process.stdout,
42
- });
43
- rl.question(prompt, (answer) => { rl.close(); resolve(answer.trim()); });
44
- });
45
- }
46
- /**
47
- * Asks for a password (no echo) using the REPL's raw-stdin reader.
48
- * Falls back to a muted readline interface outside the REPL.
49
- *
50
- * @param prompt - The prompt string to display.
51
- * @returns The trimmed password string.
52
- */
53
- export function repl_questionHidden(prompt) {
54
- if (_questionHiddenFn) {
55
- return _questionHiddenFn(prompt);
56
- }
57
- // Fallback: muted one-shot readline (used outside the REPL, e.g. chili standalone)
58
- return new Promise((resolve) => {
59
- const { Writable } = require('stream');
60
- const muted = new Writable({
61
- write(_c, _e, cb) { cb(); }
62
- });
63
- const rl = readline.createInterface({
64
- input: process.stdin,
65
- output: muted,
66
- terminal: true,
67
- });
68
- process.stdout.write(prompt);
69
- rl.question('', (answer) => {
70
- process.stdout.write('\n');
71
- rl.close();
72
- resolve(answer.trim());
73
- });
74
- });
75
- }
76
- //# sourceMappingURL=question.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"question.js","sourceRoot":"","sources":["../../src/core/question.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,QAAQ,MAAM,UAAU,CAAC;AAErC,yCAAyC;AACzC,IAAI,WAAW,GAAiD,IAAI,CAAC;AACrE,IAAI,iBAAiB,GAAiD,IAAI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K;YACpB,MAAM,EAAE,KAAK;YACb,QAAQ,EAAE,IAAI;SACf,CAAC,CAAC;QACH,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;QAC7B,EAAE,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC,MAAc,EAAE,EAAE;YACjC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;YAC3B,EAAE,CAAC,KAAK,EAAE,CAAC;YACX,OAAO,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC,CAAC;QACzB,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC"}
@@ -1,15 +0,0 @@
1
- /**
2
- * Callback function type for autocomplete results.
3
- * @param err - Error if completion failed, null otherwise.
4
- * @param result - Tuple of [matches array, original input string].
5
- */
6
- type CompleterCallback = (err: Error | null, result: [string[], string]) => void;
7
- /**
8
- * Computes autocomplete suggestions for a given input line.
9
- * Uses the callback style to support asynchronous operations (fetching files).
10
- *
11
- * @param line - The current input line.
12
- * @param callback - The callback function to return results.
13
- */
14
- export declare function input_complete(line: string, callback: CompleterCallback): void;
15
- export {};
@@ -1,212 +0,0 @@
1
- /**
2
- * @file REPL Autocompletion.
3
- *
4
- * Provides tab-completion logic for the REPL, including built-in commands
5
- * and path completion.
6
- *
7
- * @module
8
- */
9
- import { session } from '../../session/index.js';
10
- import { plugins_listAll, vfsDispatcher, context_getSingle } from '@fnndsc/salsa';
11
- import { partialPath_split, completions_build } from './pathComplete.helpers.js';
12
- import { listCache_get } from '@fnndsc/cumin';
13
- import * as path from 'path';
14
- import { builtinCommands_list } from '../../builtins/help.js';
15
- import { args_tokenize } from '../parser.js';
16
- function completionWord_get(line) {
17
- let start = 0;
18
- let quote = null;
19
- let escapeNext = false;
20
- for (let index = 0; index < line.length; index++) {
21
- const char = line[index];
22
- if (escapeNext) {
23
- escapeNext = false;
24
- continue;
25
- }
26
- if (char === '\\' && quote !== "'") {
27
- escapeNext = true;
28
- continue;
29
- }
30
- if ((char === "'" || char === '"') && (!quote || quote === char)) {
31
- quote = quote ? null : char;
32
- continue;
33
- }
34
- if (!quote && /\s/.test(char)) {
35
- start = index + 1;
36
- }
37
- }
38
- const raw = line.substring(start);
39
- const tokens = args_tokenize(raw);
40
- const value = tokens.length > 0 ? tokens[0] : '';
41
- const openingQuote = raw.startsWith("'") ? "'" : raw.startsWith('"') ? '"' : null;
42
- return { raw, value, quote: openingQuote };
43
- }
44
- function completion_format(completion, word) {
45
- if (word.quote === "'") {
46
- return `'${completion.replace(/'/g, `'\\''`)}`;
47
- }
48
- if (word.quote === '"') {
49
- return `"${completion.replace(/(["\\])/g, '\\$1')}`;
50
- }
51
- return completion.replace(/([\\\s'"`])/g, '\\$1');
52
- }
53
- /**
54
- * Fetches available plugin names from /bin in the format: name-vVersion.
55
- * This matches the display format used in /bin listings.
56
- * Uses cache first for fast completion.
57
- * @returns Array of plugin names with version suffixes.
58
- */
59
- async function plugins_getNames() {
60
- try {
61
- // Check cache first for /bin
62
- const listCache = listCache_get();
63
- const cached = listCache.cache_get('/bin');
64
- if (cached && cached.data) {
65
- // Return cached plugin names immediately
66
- return cached.data.map((item) => item.name);
67
- }
68
- // Cache miss - fetch from API (only on first tab completion)
69
- const plugins = await plugins_listAll({});
70
- if (plugins && plugins.tableData) {
71
- const pluginNames = plugins.tableData.map((p) => {
72
- const name = typeof p.name === 'string' ? p.name : String(p.name ?? '');
73
- const version = typeof p.version === 'string' ? p.version : String(p.version ?? '');
74
- // Format as name-vVersion to match /bin display format
75
- return version ? `${name}-v${version}` : name;
76
- });
77
- // Cache it for next time
78
- const lsItems = plugins.tableData.map((p) => {
79
- const name = typeof p.name === 'string' ? p.name : String(p.name ?? '');
80
- const version = typeof p.version === 'string' ? p.version : String(p.version ?? '');
81
- return {
82
- name: version ? `${name}-v${version}` : name,
83
- type: 'plugin',
84
- size: 0,
85
- owner: 'system',
86
- date: p.creation_date ? String(p.creation_date) : '',
87
- };
88
- });
89
- listCache.cache_set('/bin', lsItems);
90
- return pluginNames;
91
- }
92
- }
93
- catch (e) {
94
- // Silently fail if plugins cannot be fetched
95
- }
96
- return [];
97
- }
98
- /**
99
- * Computes autocomplete suggestions for a given input line.
100
- * Uses the callback style to support asynchronous operations (fetching files).
101
- *
102
- * @param line - The current input line.
103
- * @param callback - The callback function to return results.
104
- */
105
- export function input_complete(line, callback) {
106
- const trimmed = line.trimStart();
107
- const args = args_tokenize(trimmed);
108
- // Case 1: Command Completion (First word)
109
- // If we have only one token and the line doesn't end with space, we are typing the command
110
- // Or if line is empty
111
- const isCommandCompletion = args.length === 0 || (args.length === 1 && !line.endsWith(' '));
112
- if (isCommandCompletion) {
113
- // Check builtins first (instant, no async)
114
- const builtinHits = builtinCommands_list().filter((c) => c.startsWith(trimmed));
115
- // Always check plugins and combine results
116
- plugins_getNames().then((pluginNames) => {
117
- const pluginHits = pluginNames.filter((c) => c.startsWith(trimmed));
118
- // Combine both builtins and plugins
119
- const allHits = [...builtinHits, ...pluginHits];
120
- callback(null, [allHits, trimmed]);
121
- }).catch(() => {
122
- // On error, return only builtin matches
123
- callback(null, [builtinHits, trimmed]);
124
- });
125
- return;
126
- }
127
- // Case 2: Path Completion (Argument to specific commands)
128
- const cmd = args[0];
129
- if (['cd', 'ls', 'mkdir', 'touch', 'cat', 'edit', 'cp', 'mv', 'rm', 'upload', 'download', 'du', 'tree', 'pull', 'cubepath', 'query'].includes(cmd)) {
130
- const word = completionWord_get(line);
131
- path_complete(word.value).then((matches) => {
132
- callback(null, [matches.map((match) => completion_format(match, word)), word.raw]);
133
- }).catch((err) => {
134
- // On error, return no matches, don't crash REPL
135
- callback(null, [[], word.raw]);
136
- });
137
- return;
138
- }
139
- // Default: no completion
140
- callback(null, [[], line]);
141
- }
142
- /**
143
- * Resolves directory contents for completion.
144
- * @param partial - The partial path string typed so far.
145
- */
146
- async function path_complete(partial) {
147
- // 1. Handle ~ expansion for the partial path base
148
- let effectivePartial = partial;
149
- if (partial.startsWith('~')) {
150
- const context = await context_getSingle();
151
- const user = context.user;
152
- const home = user ? `/home/${user}` : '/';
153
- if (partial === '~' || partial === '~/') {
154
- effectivePartial = home + (partial.endsWith('/') ? '/' : '');
155
- }
156
- else if (partial.startsWith('~/')) {
157
- effectivePartial = path.posix.join(home, partial.substring(2));
158
- }
159
- }
160
- // Resolve the directory to list and the prefix to match
161
- const { dirToList, prefix } = partialPath_split(effectivePartial);
162
- // 2. Resolve absolute path for listing
163
- let absDirToList;
164
- if (dirToList.startsWith('/')) {
165
- absDirToList = dirToList;
166
- }
167
- else {
168
- const cwd = await session.getCWD();
169
- absDirToList = dirToList ? path.posix.resolve(cwd, dirToList) : cwd;
170
- }
171
- // 3. Fetch contents (check cache first)
172
- let items = [];
173
- const listCache = listCache_get();
174
- // Check cache first
175
- const cached = listCache.cache_get(absDirToList);
176
- if (cached) {
177
- items = cached.data;
178
- }
179
- else {
180
- try {
181
- // Use vfsDispatcher for all path types — handles /pacs, /bin, native, etc.
182
- const vfsResult = await vfsDispatcher.list(absDirToList);
183
- if (vfsResult.ok) {
184
- items = vfsResult.value;
185
- }
186
- // Inject virtual directories at root if missing
187
- if (absDirToList === '/' || absDirToList === '') {
188
- const hasItem = (name) => items.some((i) => i.name === name);
189
- if (!hasItem('bin')) {
190
- items.push({ name: 'bin', type: 'vfs', size: 0, owner: 'root', date: new Date().toISOString() });
191
- }
192
- if (!hasItem('usr')) {
193
- items.push({ name: 'usr', type: 'vfs', size: 0, owner: 'root', date: new Date().toISOString() });
194
- }
195
- if (!hasItem('pacs')) {
196
- items.push({ name: 'pacs', type: 'vfs', size: 0, owner: 'root', date: new Date().toISOString() });
197
- }
198
- }
199
- // Cache the results
200
- if (items.length > 0) {
201
- listCache.cache_set(absDirToList, items);
202
- }
203
- }
204
- catch (e) {
205
- // Ignore errors (e.g., perms, not a dir)
206
- }
207
- }
208
- // 4. Filter and format matches, preserving the original partial's style
209
- // (tilde/relative) and appending "/" to directory-like entries.
210
- return completions_build(items, prefix, partial);
211
- }
212
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/lib/completer/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAGlF,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AACjF,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAC9C,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAC7B,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAe7C,SAAS,kBAAkB,CAAC,IAAY;IACtC,IAAI,KAAK,GAAW,CAAC,CAAC;IACtB,IAAI,KAAK,GAAqB,IAAI,CAAC;IACnC,IAAI,UAAU,GAAY,KAAK,CAAC;IAEhC,KAAK,IAAI,KAAK,GAAW,CAAC,EAAE,KAAK,GAAG,IAAI,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE,CAAC;QACzD,MAAM,IAAI,GAAW,IAAI,CAAC,KAAK,CAAC,CAAC;QACjC,IAAI,UAAU,EAAE,CAAC;YACf,UAAU,GAAG,KAAK,CAAC;YACnB,SAAS;QACX,CAAC;QACD,IAAI,IAAI,KAAK,IAAI,IAAI,KAAK,KAAK,GAAG,EAAE,CAAC;YACnC,UAAU,GAAG,IAAI,CAAC;YAClB,SAAS;QACX,CAAC;QACD,IAAI,CAAC,IAAI,KAAK,GAAG,IAAI,IAAI,KAAK,GAAG,CAAC,IAAI,CAAC,CAAC,KAAK,IAAI,KAAK,KAAK,IAAI,CAAC,EAAE,CAAC;YACjE,KAAK,GAAG,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,I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CAAC,WAAW,EAAE,EAAE,CAAC,CAAC;gBACnG,CAAC;gBACD,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;oBACpB,KAAK,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC;gBACnG,CAAC;gBACD,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC;oBACrB,KAAK,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC;gBACpG,CAAC;YACH,CAAC;YAED,oBAAoB;YACpB,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;gBACrB,SAAS,CAAC,SAAS,CAAC,YAAY,EAAE,KAAK,CAAC,CAAC;YAC3C,CAAC;QACH,CAAC;QAAC,OAAO,CAAU,EAAE,CAAC;YACpB,yCAAyC;QAC3C,CAAC;IACH,CAAC;IAED,wEAAwE;IACxE,gEAAgE;IAChE,OAAO,iBAAiB,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;AACnD,CAAC"}
@@ -1,22 +0,0 @@
1
- import type { ListingItem } from '@fnndsc/chili/models/listing.js';
2
- /**
3
- * Splits an (already tilde-expanded) partial path into the directory to list
4
- * and the basename prefix to match against.
5
- *
6
- * @param effectivePartial - The tilde-expanded partial path.
7
- * @returns The directory to list (empty = cwd) and the prefix.
8
- */
9
- export declare function partialPath_split(effectivePartial: string): {
10
- dirToList: string;
11
- prefix: string;
12
- };
13
- /**
14
- * Builds completion strings from listing items, preserving the original
15
- * partial's style (tilde/relative) and appending `/` to directory-like entries.
16
- *
17
- * @param items - The listing items in the target directory.
18
- * @param prefix - The basename prefix being completed.
19
- * @param partial - The original (unexpanded) partial the user typed.
20
- * @returns The completion strings for matching items.
21
- */
22
- export declare function completions_build(items: ListingItem[], prefix: string, partial: string): string[];
@@ -1,49 +0,0 @@
1
- /**
2
- * @file Pure helpers for filesystem path tab-completion.
3
- *
4
- * Splits a partial path into the directory to list and the prefix to match, and
5
- * reconstructs completion strings from matching listing items. Dependency-free
6
- * (path module only) for easy unit testing.
7
- *
8
- * @module
9
- */
10
- import path from 'path';
11
- /**
12
- * Splits an (already tilde-expanded) partial path into the directory to list
13
- * and the basename prefix to match against.
14
- *
15
- * @param effectivePartial - The tilde-expanded partial path.
16
- * @returns The directory to list (empty = cwd) and the prefix.
17
- */
18
- export function partialPath_split(effectivePartial) {
19
- if (effectivePartial.endsWith('/')) {
20
- return { dirToList: effectivePartial, prefix: '' };
21
- }
22
- let dirToList = path.posix.dirname(effectivePartial);
23
- const prefix = path.posix.basename(effectivePartial);
24
- if (dirToList === '.')
25
- dirToList = ''; // Relative current dir
26
- return { dirToList, prefix };
27
- }
28
- /**
29
- * Builds completion strings from listing items, preserving the original
30
- * partial's style (tilde/relative) and appending `/` to directory-like entries.
31
- *
32
- * @param items - The listing items in the target directory.
33
- * @param prefix - The basename prefix being completed.
34
- * @param partial - The original (unexpanded) partial the user typed.
35
- * @returns The completion strings for matching items.
36
- */
37
- export function completions_build(items, prefix, partial) {
38
- return items
39
- .filter((i) => i.name.startsWith(prefix))
40
- .map((hit) => {
41
- const remainingSegment = hit.name.substring(prefix.length);
42
- let completion = partial + remainingSegment;
43
- if (hit.type === 'dir' || hit.type === 'vfs' || hit.type === 'link') {
44
- completion += '/';
45
- }
46
- return completion;
47
- });
48
- }
49
- //# sourceMappingURL=pathComplete.helpers.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"pathComplete.helpers.js","sourceRoot":"","sources":["../../../src/lib/completer/pathComplete.helpers.ts"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line argument tokenizer.
3
- *
4
- * Splits a command line into tokens while respecting single/double quotes
5
- * and backslash escapes. Quotes are stripped from the resulting tokens.
6
- */
7
- /**
8
- * Tokenizes a command line preserving quoted segments with spaces.
9
- *
10
- * @param line - Raw command line input.
11
- * @returns Array of tokens with quotes removed.
12
- */
13
- export declare function args_tokenize(line: string): string[];
@@ -1,52 +0,0 @@
1
- /**
2
- * @file Command line argument tokenizer.
3
- *
4
- * Splits a command line into tokens while respecting single/double quotes
5
- * and backslash escapes. Quotes are stripped from the resulting tokens.
6
- */
7
- /**
8
- * Tokenizes a command line preserving quoted segments with spaces.
9
- *
10
- * @param line - Raw command line input.
11
- * @returns Array of tokens with quotes removed.
12
- */
13
- export function args_tokenize(line) {
14
- const tokens = [];
15
- let current = '';
16
- let inSingle = false;
17
- let inDouble = false;
18
- let escapeNext = false;
19
- for (let i = 0; i < line.length; i++) {
20
- const char = line[i];
21
- if (escapeNext) {
22
- current += char;
23
- escapeNext = false;
24
- continue;
25
- }
26
- if (char === '\\') {
27
- escapeNext = true;
28
- continue;
29
- }
30
- if (char === "'" && !inDouble) {
31
- inSingle = !inSingle;
32
- continue;
33
- }
34
- if (char === '"' && !inSingle) {
35
- inDouble = !inDouble;
36
- continue;
37
- }
38
- if (!inSingle && !inDouble && /\s/.test(char)) {
39
- if (current.length > 0) {
40
- tokens.push(current);
41
- current = '';
42
- }
43
- continue;
44
- }
45
- current += char;
46
- }
47
- if (current.length > 0) {
48
- tokens.push(current);
49
- }
50
- return tokens;
51
- }
52
- //# sourceMappingURL=parser.js.map