@fnndsc/chell 4.2.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (231) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +325 -0
  3. package/dist/builtins/debug.d.ts +6 -0
  4. package/dist/builtins/debug.js +47 -0
  5. package/dist/builtins/debug.js.map +1 -0
  6. package/dist/builtins/executable.d.ts +22 -0
  7. package/dist/builtins/executable.js +115 -0
  8. package/dist/builtins/executable.js.map +1 -0
  9. package/dist/builtins/fs/cat.d.ts +16 -0
  10. package/dist/builtins/fs/cat.js +249 -0
  11. package/dist/builtins/fs/cat.js.map +1 -0
  12. package/dist/builtins/fs/cd.d.ts +41 -0
  13. package/dist/builtins/fs/cd.js +178 -0
  14. package/dist/builtins/fs/cd.js.map +1 -0
  15. package/dist/builtins/fs/cp.d.ts +7 -0
  16. package/dist/builtins/fs/cp.js +73 -0
  17. package/dist/builtins/fs/cp.js.map +1 -0
  18. package/dist/builtins/fs/download.d.ts +6 -0
  19. package/dist/builtins/fs/download.js +41 -0
  20. package/dist/builtins/fs/download.js.map +1 -0
  21. package/dist/builtins/fs/du.d.ts +58 -0
  22. package/dist/builtins/fs/du.js +210 -0
  23. package/dist/builtins/fs/du.js.map +1 -0
  24. package/dist/builtins/fs/edit.d.ts +7 -0
  25. package/dist/builtins/fs/edit.js +86 -0
  26. package/dist/builtins/fs/edit.js.map +1 -0
  27. package/dist/builtins/fs/ls.d.ts +8 -0
  28. package/dist/builtins/fs/ls.js +68 -0
  29. package/dist/builtins/fs/ls.js.map +1 -0
  30. package/dist/builtins/fs/mkdir.d.ts +6 -0
  31. package/dist/builtins/fs/mkdir.js +38 -0
  32. package/dist/builtins/fs/mkdir.js.map +1 -0
  33. package/dist/builtins/fs/mv.d.ts +7 -0
  34. package/dist/builtins/fs/mv.js +75 -0
  35. package/dist/builtins/fs/mv.js.map +1 -0
  36. package/dist/builtins/fs/pull.args.d.ts +22 -0
  37. package/dist/builtins/fs/pull.args.js +30 -0
  38. package/dist/builtins/fs/pull.args.js.map +1 -0
  39. package/dist/builtins/fs/pull.d.ts +26 -0
  40. package/dist/builtins/fs/pull.js +413 -0
  41. package/dist/builtins/fs/pull.js.map +1 -0
  42. package/dist/builtins/fs/pwd.d.ts +7 -0
  43. package/dist/builtins/fs/pwd.js +75 -0
  44. package/dist/builtins/fs/pwd.js.map +1 -0
  45. package/dist/builtins/fs/rm.d.ts +31 -0
  46. package/dist/builtins/fs/rm.js +148 -0
  47. package/dist/builtins/fs/rm.js.map +1 -0
  48. package/dist/builtins/fs/touch.d.ts +6 -0
  49. package/dist/builtins/fs/touch.js +64 -0
  50. package/dist/builtins/fs/touch.js.map +1 -0
  51. package/dist/builtins/fs/tree.d.ts +15 -0
  52. package/dist/builtins/fs/tree.js +84 -0
  53. package/dist/builtins/fs/tree.js.map +1 -0
  54. package/dist/builtins/fs/upload.d.ts +6 -0
  55. package/dist/builtins/fs/upload.js +45 -0
  56. package/dist/builtins/fs/upload.js.map +1 -0
  57. package/dist/builtins/help.d.ts +74 -0
  58. package/dist/builtins/help.js +1217 -0
  59. package/dist/builtins/help.js.map +1 -0
  60. package/dist/builtins/index.d.ts +45 -0
  61. package/dist/builtins/index.js +45 -0
  62. package/dist/builtins/index.js.map +1 -0
  63. package/dist/builtins/net/connect.d.ts +7 -0
  64. package/dist/builtins/net/connect.js +42 -0
  65. package/dist/builtins/net/connect.js.map +1 -0
  66. package/dist/builtins/net/cubepath.d.ts +18 -0
  67. package/dist/builtins/net/cubepath.js +102 -0
  68. package/dist/builtins/net/cubepath.js.map +1 -0
  69. package/dist/builtins/net/logout.d.ts +6 -0
  70. package/dist/builtins/net/logout.js +24 -0
  71. package/dist/builtins/net/logout.js.map +1 -0
  72. package/dist/builtins/net/pacs.d.ts +24 -0
  73. package/dist/builtins/net/pacs.js +121 -0
  74. package/dist/builtins/net/pacs.js.map +1 -0
  75. package/dist/builtins/net/pacsUtils.d.ts +85 -0
  76. package/dist/builtins/net/pacsUtils.js +184 -0
  77. package/dist/builtins/net/pacsUtils.js.map +1 -0
  78. package/dist/builtins/net/query.d.ts +60 -0
  79. package/dist/builtins/net/query.js +304 -0
  80. package/dist/builtins/net/query.js.map +1 -0
  81. package/dist/builtins/parametersofplugin.d.ts +13 -0
  82. package/dist/builtins/parametersofplugin.js +43 -0
  83. package/dist/builtins/parametersofplugin.js.map +1 -0
  84. package/dist/builtins/pluginExecute.d.ts +27 -0
  85. package/dist/builtins/pluginExecute.js +165 -0
  86. package/dist/builtins/pluginExecute.js.map +1 -0
  87. package/dist/builtins/proc.d.ts +6 -0
  88. package/dist/builtins/proc.helpers.d.ts +68 -0
  89. package/dist/builtins/proc.helpers.js +102 -0
  90. package/dist/builtins/proc.helpers.js.map +1 -0
  91. package/dist/builtins/proc.js +289 -0
  92. package/dist/builtins/proc.js.map +1 -0
  93. package/dist/builtins/res/compute.d.ts +6 -0
  94. package/dist/builtins/res/compute.js +55 -0
  95. package/dist/builtins/res/compute.js.map +1 -0
  96. package/dist/builtins/res/feed.d.ts +6 -0
  97. package/dist/builtins/res/feed.js +244 -0
  98. package/dist/builtins/res/feed.js.map +1 -0
  99. package/dist/builtins/res/feed.notes.d.ts +28 -0
  100. package/dist/builtins/res/feed.notes.js +24 -0
  101. package/dist/builtins/res/feed.notes.js.map +1 -0
  102. package/dist/builtins/res/files.d.ts +18 -0
  103. package/dist/builtins/res/files.js +85 -0
  104. package/dist/builtins/res/files.js.map +1 -0
  105. package/dist/builtins/res/group.d.ts +6 -0
  106. package/dist/builtins/res/group.js +54 -0
  107. package/dist/builtins/res/group.js.map +1 -0
  108. package/dist/builtins/res/pipeline.args.d.ts +22 -0
  109. package/dist/builtins/res/pipeline.args.js +28 -0
  110. package/dist/builtins/res/pipeline.args.js.map +1 -0
  111. package/dist/builtins/res/pipeline.d.ts +20 -0
  112. package/dist/builtins/res/pipeline.js +252 -0
  113. package/dist/builtins/res/pipeline.js.map +1 -0
  114. package/dist/builtins/res/plugin.d.ts +13 -0
  115. package/dist/builtins/res/plugin.js +140 -0
  116. package/dist/builtins/res/plugin.js.map +1 -0
  117. package/dist/builtins/res/plugininstance.d.ts +6 -0
  118. package/dist/builtins/res/plugininstance.js +53 -0
  119. package/dist/builtins/res/plugininstance.js.map +1 -0
  120. package/dist/builtins/res/pluginmeta.d.ts +6 -0
  121. package/dist/builtins/res/pluginmeta.js +53 -0
  122. package/dist/builtins/res/pluginmeta.js.map +1 -0
  123. package/dist/builtins/res/tag.d.ts +6 -0
  124. package/dist/builtins/res/tag.js +53 -0
  125. package/dist/builtins/res/tag.js.map +1 -0
  126. package/dist/builtins/res/workflow.d.ts +6 -0
  127. package/dist/builtins/res/workflow.js +53 -0
  128. package/dist/builtins/res/workflow.js.map +1 -0
  129. package/dist/builtins/store.d.ts +6 -0
  130. package/dist/builtins/store.js +108 -0
  131. package/dist/builtins/store.js.map +1 -0
  132. package/dist/builtins/sys/context.d.ts +6 -0
  133. package/dist/builtins/sys/context.js +50 -0
  134. package/dist/builtins/sys/context.js.map +1 -0
  135. package/dist/builtins/sys/physicalmode.d.ts +6 -0
  136. package/dist/builtins/sys/physicalmode.js +41 -0
  137. package/dist/builtins/sys/physicalmode.js.map +1 -0
  138. package/dist/builtins/sys/prompt.d.ts +13 -0
  139. package/dist/builtins/sys/prompt.helpers.d.ts +31 -0
  140. package/dist/builtins/sys/prompt.helpers.js +36 -0
  141. package/dist/builtins/sys/prompt.helpers.js.map +1 -0
  142. package/dist/builtins/sys/prompt.js +182 -0
  143. package/dist/builtins/sys/prompt.js.map +1 -0
  144. package/dist/builtins/sys/timing.d.ts +6 -0
  145. package/dist/builtins/sys/timing.js +41 -0
  146. package/dist/builtins/sys/timing.js.map +1 -0
  147. package/dist/builtins/sys/whoami.d.ts +12 -0
  148. package/dist/builtins/sys/whoami.js +37 -0
  149. package/dist/builtins/sys/whoami.js.map +1 -0
  150. package/dist/builtins/utils.d.ts +55 -0
  151. package/dist/builtins/utils.js +145 -0
  152. package/dist/builtins/utils.js.map +1 -0
  153. package/dist/builtins/wildcard.d.ts +26 -0
  154. package/dist/builtins/wildcard.js +120 -0
  155. package/dist/builtins/wildcard.js.map +1 -0
  156. package/dist/chell.d.ts +16 -0
  157. package/dist/chell.js +1193 -0
  158. package/dist/chell.js.map +1 -0
  159. package/dist/command-keys.d.ts +8 -0
  160. package/dist/command-keys.js +32 -0
  161. package/dist/command-keys.js.map +1 -0
  162. package/dist/config/settings.d.ts +39 -0
  163. package/dist/config/settings.js +93 -0
  164. package/dist/config/settings.js.map +1 -0
  165. package/dist/core/bootFlags.d.ts +32 -0
  166. package/dist/core/bootFlags.js +25 -0
  167. package/dist/core/bootFlags.js.map +1 -0
  168. package/dist/core/cli.d.ts +58 -0
  169. package/dist/core/cli.js +251 -0
  170. package/dist/core/cli.js.map +1 -0
  171. package/dist/core/prompt/index.d.ts +80 -0
  172. package/dist/core/prompt/index.js +29 -0
  173. package/dist/core/prompt/index.js.map +1 -0
  174. package/dist/core/prompt/theme_default.d.ts +19 -0
  175. package/dist/core/prompt/theme_default.js +47 -0
  176. package/dist/core/prompt/theme_default.js.map +1 -0
  177. package/dist/core/prompt/theme_p10k.d.ts +22 -0
  178. package/dist/core/prompt/theme_p10k.js +164 -0
  179. package/dist/core/prompt/theme_p10k.js.map +1 -0
  180. package/dist/core/prompt/utils.d.ts +23 -0
  181. package/dist/core/prompt/utils.js +40 -0
  182. package/dist/core/prompt/utils.js.map +1 -0
  183. package/dist/core/question.d.ts +34 -0
  184. package/dist/core/question.js +76 -0
  185. package/dist/core/question.js.map +1 -0
  186. package/dist/core/repl.d.ts +31 -0
  187. package/dist/core/repl.js +146 -0
  188. package/dist/core/repl.js.map +1 -0
  189. package/dist/index.d.ts +7 -0
  190. package/dist/index.js +34 -0
  191. package/dist/index.js.map +1 -0
  192. package/dist/lib/bootsequence.d.ts +62 -0
  193. package/dist/lib/bootsequence.js +222 -0
  194. package/dist/lib/bootsequence.js.map +1 -0
  195. package/dist/lib/completer/index.d.ts +15 -0
  196. package/dist/lib/completer/index.js +212 -0
  197. package/dist/lib/completer/index.js.map +1 -0
  198. package/dist/lib/completer/pathComplete.helpers.d.ts +22 -0
  199. package/dist/lib/completer/pathComplete.helpers.js +49 -0
  200. package/dist/lib/completer/pathComplete.helpers.js.map +1 -0
  201. package/dist/lib/logo.d.ts +47 -0
  202. package/dist/lib/logo.js +313 -0
  203. package/dist/lib/logo.js.map +1 -0
  204. package/dist/lib/parser.d.ts +13 -0
  205. package/dist/lib/parser.js +52 -0
  206. package/dist/lib/parser.js.map +1 -0
  207. package/dist/lib/pipe.d.ts +11 -0
  208. package/dist/lib/pipe.js +90 -0
  209. package/dist/lib/pipe.js.map +1 -0
  210. package/dist/lib/prefetch.d.ts +25 -0
  211. package/dist/lib/prefetch.js +64 -0
  212. package/dist/lib/prefetch.js.map +1 -0
  213. package/dist/lib/semicolonParser.d.ts +22 -0
  214. package/dist/lib/semicolonParser.js +53 -0
  215. package/dist/lib/semicolonParser.js.map +1 -0
  216. package/dist/lib/spinner.d.ts +23 -0
  217. package/dist/lib/spinner.js +68 -0
  218. package/dist/lib/spinner.js.map +1 -0
  219. package/dist/lib/vfs/providers/static.d.ts +65 -0
  220. package/dist/lib/vfs/providers/static.js +164 -0
  221. package/dist/lib/vfs/providers/static.js.map +1 -0
  222. package/dist/lib/vfs/providers/static_content.d.ts +27 -0
  223. package/dist/lib/vfs/providers/static_content.js +180 -0
  224. package/dist/lib/vfs/providers/static_content.js.map +1 -0
  225. package/dist/lib/vfs/vfs.d.ts +59 -0
  226. package/dist/lib/vfs/vfs.js +198 -0
  227. package/dist/lib/vfs/vfs.js.map +1 -0
  228. package/dist/session/index.d.ts +76 -0
  229. package/dist/session/index.js +120 -0
  230. package/dist/session/index.js.map +1 -0
  231. package/package.json +65 -0
@@ -0,0 +1,148 @@
1
+ /**
2
+ * @file Builtin rm command.
3
+ * Removes files or directories.
4
+ */
5
+ import chalk from 'chalk';
6
+ import path from 'path';
7
+ import * as readline from 'readline';
8
+ import { path_resolve } from '../utils.js';
9
+ import { files_rm as chefs_rm_cmd } from '@fnndsc/chili/commands/fs/rm.js';
10
+ import { rm_render } from '@fnndsc/chili/views/fs.js';
11
+ import { listCache_get } from '@fnndsc/cumin';
12
+ /**
13
+ * Prompts the user for confirmation.
14
+ *
15
+ * @param message - The prompt message.
16
+ * @returns A Promise resolving to true if user confirms (y/Y), false otherwise.
17
+ */
18
+ async function prompt_confirm(message) {
19
+ return new Promise((resolve) => {
20
+ const rl = readline.createInterface({
21
+ input: process.stdin,
22
+ output: process.stdout
23
+ });
24
+ rl.question(message, (answer) => {
25
+ rl.close();
26
+ const confirmed = answer.trim().toLowerCase() === 'y';
27
+ resolve(confirmed);
28
+ });
29
+ });
30
+ }
31
+ /**
32
+ * Parses `rm` arguments, supporting combined short flags (`-rf`, `-rfi`) and the
33
+ * `--` end-of-options separator.
34
+ *
35
+ * @param args - Raw command arguments.
36
+ * @returns The parsed flags and path operands.
37
+ */
38
+ export function rmArgs_parse(args) {
39
+ let recursive = false;
40
+ let force = false;
41
+ let interactive = false;
42
+ const paths = [];
43
+ let endOfOptions = false;
44
+ for (const arg of args) {
45
+ if (arg === '--') {
46
+ endOfOptions = true;
47
+ continue;
48
+ }
49
+ if (endOfOptions) {
50
+ paths.push(arg);
51
+ continue;
52
+ }
53
+ if (arg.startsWith('-') && arg.length > 1) {
54
+ for (const ch of arg.substring(1)) {
55
+ if (ch === 'r' || ch === 'R')
56
+ recursive = true;
57
+ else if (ch === 'f')
58
+ force = true;
59
+ else if (ch === 'i')
60
+ interactive = true;
61
+ }
62
+ }
63
+ else if (!arg.startsWith('-')) {
64
+ paths.push(arg);
65
+ }
66
+ }
67
+ return { recursive, force, interactive, paths };
68
+ }
69
+ /**
70
+ * Formats the multi-target removal summary line.
71
+ *
72
+ * @param successCount - Number of items removed successfully.
73
+ * @param failCount - Number of items that failed to remove.
74
+ * @returns The summary string, or null if there is nothing to summarise.
75
+ */
76
+ export function rmSummary_format(successCount, failCount) {
77
+ if (!(successCount > 0 || failCount > 0))
78
+ return null;
79
+ if (successCount > 0 && failCount === 0) {
80
+ return chalk.green(`Successfully removed ${successCount} item${successCount !== 1 ? 's' : ''}`);
81
+ }
82
+ if (successCount > 0 && failCount > 0) {
83
+ return chalk.yellow(`Removed ${successCount} item${successCount !== 1 ? 's' : ''}, failed ${failCount}`);
84
+ }
85
+ return chalk.red(`Failed to remove ${failCount} item${failCount !== 1 ? 's' : ''}`);
86
+ }
87
+ /**
88
+ * Removes one or more files or directories.
89
+ *
90
+ * @param args - Command line arguments (flags and paths).
91
+ */
92
+ export async function builtin_rm(args) {
93
+ const { recursive, force, interactive, paths } = rmArgs_parse(args);
94
+ if (paths.length === 0) {
95
+ console.error(chalk.red('Usage: rm [-rf] <path> [path...]'));
96
+ return;
97
+ }
98
+ const options = { recursive, force };
99
+ let successCount = 0;
100
+ let failCount = 0;
101
+ for (const pathArg of paths) {
102
+ try {
103
+ const target = await path_resolve(pathArg);
104
+ if (target.startsWith('/bin/')) {
105
+ console.error(chalk.red(`rm: cannot remove '${pathArg}': virtual /bin directory`));
106
+ failCount++;
107
+ continue;
108
+ }
109
+ if (interactive) {
110
+ const confirmed = await prompt_confirm(`rm: remove '${pathArg}'? (y/n): `);
111
+ if (!confirmed) {
112
+ console.log(chalk.gray(`skipped '${pathArg}'`));
113
+ continue;
114
+ }
115
+ }
116
+ const result = await chefs_rm_cmd(target, options);
117
+ if (result.success) {
118
+ if (paths.length > 1) {
119
+ console.log(chalk.gray(`removed '${pathArg}'`));
120
+ }
121
+ else {
122
+ console.log(rm_render(result));
123
+ }
124
+ successCount++;
125
+ const listCache = listCache_get();
126
+ const parentDir = path.posix.dirname(target);
127
+ listCache.cache_invalidate(parentDir);
128
+ }
129
+ else {
130
+ console.error(chalk.red(`rm: cannot remove '${pathArg}': ${result.error || 'unknown error'}`));
131
+ failCount++;
132
+ }
133
+ }
134
+ catch (e) {
135
+ const msg = e instanceof Error ? e.message : String(e);
136
+ console.error(chalk.red(`rm: cannot remove '${pathArg}': ${msg}`));
137
+ failCount++;
138
+ }
139
+ }
140
+ if (paths.length > 1) {
141
+ const summary = rmSummary_format(successCount, failCount);
142
+ if (summary) {
143
+ console.log('');
144
+ console.log(summary);
145
+ }
146
+ }
147
+ }
148
+ //# sourceMappingURL=rm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rm.js","sourceRoot":"","sources":["../../../src/builtins/fs/rm.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,KAAK,QAAQ,MAAM,UAAU,CAAC;AACrC,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EAAE,QAAQ,IAAI,YAAY,EAAuB,MAAM,iCAAiC,CAAC;AAChG,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AACtD,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAE9C;;;;;GAKG;AACH,KAAK,UAAU,cAAc,CAAC,OAAe;IAC3C,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;QAC7B,MAAM,EAAE,GAAuB,QAAQ,CAAC,eAAe,CAAC;YACtD,KAAK,EAAE,OAAO,CAAC,KAAK;YACpB,MAAM,EAAE,OAAO,CAAC,MAAM;SACvB,CAAC,CAAC;QAEH,EAAE,CAAC,QAAQ,CAAC,OAAO,EAAE,CAAC,MAAc,EAAE,EAAE;YACtC,EAAE,CAAC,KAAK,EAAE,CAAC;YACX,MAAM,SAAS,GAAY,MAAM,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,KAAK,GAAG,CAAC;YAC/D,OAAO,CAAC,SAAS,CAAC,CAAC;QACrB,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC;AAYD;;;;;;GAMG;AACH,MAAM,UAAU,YAAY,CAAC,IAAc;IACzC,IAAI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W,CAAC,YAAY,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;YAC/D,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,sBAAsB,OAAO,MAAM,GAAG,EAAE,CAAC,CAAC,CAAC;YACnE,SAAS,EAAE,CAAC;QACd,CAAC;IACH,CAAC;IAED,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACrB,MAAM,OAAO,GAAkB,gBAAgB,CAAC,YAAY,EAAE,SAAS,CAAC,CAAC;QACzE,IAAI,OAAO,EAAE,CAAC;YACZ,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;YAChB,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;QACvB,CAAC;IACH,CAAC;AACH,CAAC"}
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Creates empty files or updates timestamps.
3
+ *
4
+ * @param args - Command line arguments (file paths).
5
+ */
6
+ export declare function builtin_touch(args: string[]): Promise<void>;
@@ -0,0 +1,64 @@
1
+ /**
2
+ * @file Builtin touch command.
3
+ * Creates files.
4
+ */
5
+ import chalk from 'chalk';
6
+ import path from 'path';
7
+ import { commandArgs_process, path_resolve, error_stripDebugPrefix } from '../utils.js';
8
+ import { files_touch as chefs_touch_cmd } from '@fnndsc/chili/commands/fs/touch.js';
9
+ import { touch_render } from '@fnndsc/chili/views/fs.js';
10
+ import { listCache_get, errorStack } from '@fnndsc/cumin';
11
+ /**
12
+ * Creates empty files or updates timestamps.
13
+ *
14
+ * @param args - Command line arguments (file paths).
15
+ */
16
+ export async function builtin_touch(args) {
17
+ const parsed = commandArgs_process(args);
18
+ const pathArgs = parsed._;
19
+ if (pathArgs.length === 0) {
20
+ console.error(chalk.red('Usage: touch [--withContents <string>] [--withContentsFromFile <file>] <file>'));
21
+ return;
22
+ }
23
+ // Build options from parsed flags
24
+ const options = {};
25
+ if (parsed['withContents']) {
26
+ options.withContents = String(parsed['withContents']);
27
+ }
28
+ if (parsed['withContentsFromFile']) {
29
+ options.withContentsFromFile = String(parsed['withContentsFromFile']);
30
+ }
31
+ // Only process the first file argument when using content options
32
+ const filesToTouch = (options.withContents || options.withContentsFromFile)
33
+ ? [pathArgs[0]] // Only one file when injecting content
34
+ : pathArgs; // Multiple files allowed for empty touch
35
+ for (const pathArg of filesToTouch) {
36
+ try {
37
+ const targetPath = await path_resolve(pathArg);
38
+ const success = await chefs_touch_cmd(targetPath, options);
39
+ if (success) {
40
+ console.log(touch_render(targetPath, success));
41
+ // Invalidate cache for parent directory
42
+ const listCache = listCache_get();
43
+ const parentDir = path.posix.dirname(targetPath);
44
+ listCache.cache_invalidate(parentDir);
45
+ }
46
+ else {
47
+ // Touch failed, display error from errorStack
48
+ const lastError = errorStack.stack_pop();
49
+ if (lastError) {
50
+ console.error(chalk.red(`Failed to create file: ${targetPath}`));
51
+ console.error(chalk.gray(` ${error_stripDebugPrefix(lastError.message)}`));
52
+ }
53
+ else {
54
+ console.error(chalk.red(`Failed to create file: ${targetPath}`));
55
+ }
56
+ }
57
+ }
58
+ catch (e) {
59
+ const msg = e instanceof Error ? e.message : String(e);
60
+ console.error(chalk.red(`touch: ${pathArg}: ${msg}`));
61
+ }
62
+ }
63
+ }
64
+ //# sourceMappingURL=touch.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"touch.js","sourceRoot":"","sources":["../../../src/builtins/fs/touch.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAc,mBAAmB,EAAE,YAAY,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAC;AACpG,OAAO,EAAE,WAAW,IAAI,eAAe,EAAgB,MAAM,oCAAoC,CAAC;AAClG,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,EAAE,aAAa,EAAE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;gBACxC,MAAM,SAAS,GAAG,aAAa,EAAE,CAAC;gBAClC,MAAM,SAAS,GAAW,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;gBACzD,SAAS,CAAC,gBAAgB,CAAC,SAAS,CAAC,CAAC;YACxC,CAAC;iBAAM,CAAC;gBACN,8CAA8C;gBAC9C,MAAM,SAAS,GAAG,UAAU,CAAC,SAAS,EAAE,CAAC;gBACzC,IAAI,SAAS,EAAE,CAAC;oBACd,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,0BAA0B,UAAU,EAAE,CAAC,CAAC,CAAC;oBACjE,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,sBAAsB,CAAC,SAAS,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,CAAC;gBAC9E,CAAC;qBAAM,CAAC;oBACN,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,0BAA0B,UAAU,EAAE,CAAC,CAAC,CAAC;gBACnE,CAAC;YACH,CAAC;QACH,CAAC;QAAC,OAAO,CAAU,EAAE,CAAC;YACpB,MAAM,GAAG,GAAW,CAAC,YAAY,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;YAC/D,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,UAAU,OAAO,KAAK,GAAG,EAAE,CAAC,CAAC,CAAC;QACxD,CAAC;IACH,CAAC;AACH,CAAC"}
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Displays a directory tree of the ChRIS filesystem.
3
+ * Uses chili's scan_do machinery for recursive filesystem traversal.
4
+ *
5
+ * @param args - Command line arguments (optional path and flags).
6
+ * @returns A Promise that resolves when the tree is displayed.
7
+ *
8
+ * @example
9
+ * ```
10
+ * tree # Tree of current directory
11
+ * tree /home/user/data # Tree of specific path
12
+ * tree --follow # Follow symbolic links
13
+ * ```
14
+ */
15
+ export declare function builtin_tree(args: string[]): Promise<void>;
@@ -0,0 +1,84 @@
1
+ /**
2
+ * @file Builtin tree command.
3
+ * Displays directory structure.
4
+ */
5
+ import chalk from 'chalk';
6
+ import { commandArgs_process, path_resolve, error_stripDebugPrefix } from '../utils.js';
7
+ import { session } from '../../session/index.js';
8
+ import { spinner } from '../../lib/spinner.js';
9
+ import { errorStack } from '@fnndsc/cumin';
10
+ import { scan_do, archyTree_create } from '@fnndsc/chili/path/pathCommand.js';
11
+ import { bytes_format } from '@fnndsc/chili/commands/fs/upload.js';
12
+ /**
13
+ * Displays a directory tree of the ChRIS filesystem.
14
+ * Uses chili's scan_do machinery for recursive filesystem traversal.
15
+ *
16
+ * @param args - Command line arguments (optional path and flags).
17
+ * @returns A Promise that resolves when the tree is displayed.
18
+ *
19
+ * @example
20
+ * ```
21
+ * tree # Tree of current directory
22
+ * tree /home/user/data # Tree of specific path
23
+ * tree --follow # Follow symbolic links
24
+ * ```
25
+ */
26
+ export async function builtin_tree(args) {
27
+ const parsed = commandArgs_process(args);
28
+ const pathArgs = parsed._;
29
+ const pathMode = !!parsed['path'];
30
+ // Determine target path
31
+ let targetPath;
32
+ if (pathArgs.length > 0) {
33
+ targetPath = await path_resolve(pathArgs[0]);
34
+ }
35
+ // Build scan options
36
+ const scanOptions = {
37
+ silent: true,
38
+ tree: false, // We'll format it ourselves
39
+ follow: !!parsed['follow'],
40
+ dirsOnly: false,
41
+ };
42
+ // If path specified, temporarily set context
43
+ const originalFolder = await session.getCWD();
44
+ if (targetPath) {
45
+ await session.setCWD(targetPath);
46
+ }
47
+ try {
48
+ spinner.start(`Scanning ${targetPath || 'current directory'}...`);
49
+ const scanResult = await scan_do(scanOptions);
50
+ if (!scanResult) {
51
+ spinner.stop();
52
+ const lastError = errorStack.stack_pop();
53
+ if (lastError) {
54
+ console.error(chalk.red(error_stripDebugPrefix(lastError.message)));
55
+ }
56
+ else {
57
+ console.error(chalk.red('Failed to scan directory tree.'));
58
+ }
59
+ return;
60
+ }
61
+ spinner.stop();
62
+ if (pathMode) {
63
+ // --path: emit one full chrisPath per entry — grep-friendly
64
+ for (const item of scanResult.fileInfo) {
65
+ console.log(item.chrisPath);
66
+ }
67
+ }
68
+ else {
69
+ // Default: ASCII tree
70
+ const treeOutput = archyTree_create(scanResult.fileInfo);
71
+ console.log(treeOutput);
72
+ }
73
+ // Display summary
74
+ console.log(chalk.green(`Total size: ${bytes_format(scanResult.totalSize)}`));
75
+ console.log(chalk.gray(`${scanResult.fileInfo.length} items`));
76
+ }
77
+ finally {
78
+ // Restore original path
79
+ if (targetPath) {
80
+ await session.setCWD(originalFolder);
81
+ }
82
+ }
83
+ }
84
+ //# sourceMappingURL=tree.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tree.js","sourceRoot":"","sources":["../../../src/builtins/fs/tree.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAc,mBAAmB,EAAE,YAAY,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAC;AACpG,OAAO,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAC/C,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,OAAO,EAAE,gBAAgB,EAAiC,MAAM,mCAAmC,CAAC;AAC7G,OAAO,EAAE,YAAY,EAAE,MAAM,qCAAqC,CAAC;AAEnE;;;;;;;;;;;;;GAaG;AACH,MAAM,CAAC,KAAK,UAAU,YAAY,CAAC,IAAc;IAC/C,MAAM,MAAM,GAAe,mBAAmB,CAAC,IAAI,CAAC,CAAC;IACrD,MAAM,QAAQ,GAAa,MAAM,CAAC,CAAa,CAAC;IAChD,MAAM,QAAQ,GAAY,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;IAE3C,wBAAwB;IACxB,IAAI,UAA8B,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AC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;YAC9B,CAAC;QACH,CAAC;aAAM,CAAC;YACN,sBAAsB;YACtB,MAAM,UAAU,GAAW,gBAAgB,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC;YACjE,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;QAC1B,CAAC;QAED,kBAAkB;QAClB,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,eAAe,YAAY,CAAC,UAAU,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC,CAAC;QAC9E,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,UAAU,CAAC,QAAQ,CAAC,MAAM,QAAQ,CAAC,CAAC,CAAC;IAEjE,CAAC;YAAS,CAAC;QACT,wBAAwB;QACxB,IAAI,UAAU,EAAE,CAAC;YACf,MAAM,OAAO,CAAC,MAAM,CAAC,cAAc,CAAC,CAAC;QACvC,CAAC;IACH,CAAC;AACH,CAAC"}
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Uploads a local file or directory to ChRIS.
3
+ *
4
+ * @param args - [localPath, remotePath]
5
+ */
6
+ export declare function builtin_upload(args: string[]): Promise<void>;
@@ -0,0 +1,45 @@
1
+ /**
2
+ * @file Builtin upload command.
3
+ * Uploads files to ChRIS.
4
+ */
5
+ import chalk from 'chalk';
6
+ import { path_resolve } from '../utils.js';
7
+ import { files_uploadWithProgress as chefs_upload_cmd, bytes_format } from '@fnndsc/chili/commands/fs/upload.js';
8
+ import { listCache_get } from '@fnndsc/cumin';
9
+ /**
10
+ * Uploads a local file or directory to ChRIS.
11
+ *
12
+ * @param args - [localPath, remotePath]
13
+ */
14
+ export async function builtin_upload(args) {
15
+ if (args.length < 2) {
16
+ console.log(chalk.red('Usage: upload <local_path> <remote_path>'));
17
+ return;
18
+ }
19
+ const localPath = args[0];
20
+ const remotePath = args[1];
21
+ const targetRemote = await path_resolve(remotePath);
22
+ try {
23
+ const summary = await chefs_upload_cmd(localPath, targetRemote);
24
+ console.log('');
25
+ if (summary.failedCount === 0) {
26
+ console.log(chalk.green(`✓ Successfully uploaded ${summary.transferredCount} file(s)`));
27
+ }
28
+ else {
29
+ console.log(chalk.yellow(`⚠ Uploaded ${summary.transferredCount} file(s), ${summary.failedCount} failed`));
30
+ }
31
+ console.log(chalk.gray(` Total: ${bytes_format(summary.transferSize)} in ${summary.duration.toFixed(1)}s (${bytes_format(summary.speed)}/s)`));
32
+ // Invalidate cache for actual target directory where files were uploaded
33
+ if (summary.transferredCount > 0) {
34
+ const listCache = listCache_get();
35
+ listCache.cache_invalidate(summary.actualTargetPath);
36
+ // Also invalidate parent to refresh its listing
37
+ listCache.cache_invalidate(targetRemote);
38
+ }
39
+ }
40
+ catch (e) {
41
+ const msg = e instanceof Error ? e.message : String(e);
42
+ console.error(chalk.red(`Upload error: ${msg}`));
43
+ }
44
+ }
45
+ //# sourceMappingURL=upload.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"upload.js","sourceRoot":"","sources":["../../../src/builtins/fs/upload.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EAAE,wBAAwB,IAAI,gBAAgB,EAAiB,YAAY,EAAE,MAAM,qCAAqC,CAAC;AAChI,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAG9C;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,cAAc,CAAC,IAAc;IACjD,IAAI,IAAI,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACpB,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,0CAA0C,CAAC,CAAC,CAAC;QACnE,OAAO;IACT,CAAC;IACD,MAAM,SAAS,GAAW,IAAI,CAAC,CAAC,CAAC,CAAC;IAClC,MAAM,UAAU,GAAW,IAAI,CAAC,CAAC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GAAG,CAAC,iBAAiB,GAAG,EAAE,CAAC,CAAC,CAAC;IACnD,CAAC;AACH,CAAC"}
@@ -0,0 +1,74 @@
1
+ interface CommandHelp {
2
+ usage: string;
3
+ summary?: string;
4
+ description: string;
5
+ subcommands?: string[];
6
+ options?: string[];
7
+ examples?: string[];
8
+ }
9
+ /**
10
+ * Standard subcommands and options injected into every resource help entry.
11
+ * Captures the Resource Contract documented in CONTEXT.md.
12
+ */
13
+ export declare const RESOURCE_LIST_OPTIONS: string[];
14
+ /**
15
+ * Help-text registry keyed by builtin command name.
16
+ */
17
+ export declare const helpText: Record<string, CommandHelp>;
18
+ /**
19
+ * Displays help text for a command.
20
+ *
21
+ * @param command - The command to display help for.
22
+ */
23
+ /**
24
+ * Formats and returns the detailed help text for a specific command as a string.
25
+ *
26
+ * @param command - The command name to retrieve help for.
27
+ /**
28
+ * Word-wraps a flat string to fit within a given width, with uniform indentation.
29
+ *
30
+ * @param str - Input text (single line or freeform).
31
+ * @param width - Total line width including indent (default 78).
32
+ * @param indent - Leading spaces on every line (default 2).
33
+ * @returns Multi-line string, each line at most `width` chars wide.
34
+ */
35
+ export declare function text_boxFormat(str: string, width?: number, indent?: number): string;
36
+ /**
37
+ * @returns The formatted help text string, or undefined if no help exists.
38
+ */
39
+ export declare function commandHelp_get(command: string): string | undefined;
40
+ /**
41
+ * Displays help text for a command.
42
+ *
43
+ * @param command - The command to display help for.
44
+ */
45
+ export declare function help_show(command: string): void;
46
+ /**
47
+ * Checks if arguments contain --help flag.
48
+ * -h is treated as help unless the command uses it for "human-readable" (ls, du).
49
+ *
50
+ * @param args - Command arguments.
51
+ * @param command - The command name (optional).
52
+ * @returns True if help is requested.
53
+ */
54
+ export declare function args_checkHasHelpFlag(args: string[], command?: string): boolean;
55
+ /**
56
+ * Builtin help command - displays command list or specific command help.
57
+ *
58
+ * @param args - Command arguments (optional command name).
59
+ */
60
+ export declare function builtin_help(args: string[]): Promise<void>;
61
+ /**
62
+ * Gets the list of all builtin command names.
63
+ *
64
+ * @returns Array of builtin command names.
65
+ */
66
+ export declare function builtinCommands_list(): string[];
67
+ /**
68
+ * Gets the description for a builtin command.
69
+ *
70
+ * @param command - The command name.
71
+ * @returns The command description, or undefined if not found.
72
+ */
73
+ export declare function builtinCommand_descriptionGet(command: string): string | undefined;
74
+ export {};