@fnndsc/chili 3.2.5

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 (219) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +113 -0
  3. package/dist/chefs/chefs.d.ts +15 -0
  4. package/dist/chefs/chefs.js +195 -0
  5. package/dist/commands/compute/fields.d.ts +6 -0
  6. package/dist/commands/compute/fields.js +13 -0
  7. package/dist/commands/compute/list.d.ts +19 -0
  8. package/dist/commands/compute/list.js +20 -0
  9. package/dist/commands/connect/login.d.ts +16 -0
  10. package/dist/commands/connect/login.js +18 -0
  11. package/dist/commands/connect/logout.d.ts +6 -0
  12. package/dist/commands/connect/logout.js +16 -0
  13. package/dist/commands/feed/comments.d.ts +41 -0
  14. package/dist/commands/feed/comments.js +45 -0
  15. package/dist/commands/feed/create.d.ts +13 -0
  16. package/dist/commands/feed/create.js +40 -0
  17. package/dist/commands/feed/note.d.ts +21 -0
  18. package/dist/commands/feed/note.js +24 -0
  19. package/dist/commands/feeds/delete.d.ts +14 -0
  20. package/dist/commands/feeds/delete.js +34 -0
  21. package/dist/commands/feeds/fields.d.ts +6 -0
  22. package/dist/commands/feeds/fields.js +17 -0
  23. package/dist/commands/feeds/list.d.ts +17 -0
  24. package/dist/commands/feeds/list.js +38 -0
  25. package/dist/commands/feeds/share.d.ts +17 -0
  26. package/dist/commands/feeds/share.js +19 -0
  27. package/dist/commands/file/view.d.ts +8 -0
  28. package/dist/commands/file/view.js +25 -0
  29. package/dist/commands/files/delete.d.ts +16 -0
  30. package/dist/commands/files/delete.js +36 -0
  31. package/dist/commands/files/fields.d.ts +7 -0
  32. package/dist/commands/files/fields.js +18 -0
  33. package/dist/commands/files/list.d.ts +11 -0
  34. package/dist/commands/files/list.js +23 -0
  35. package/dist/commands/fs/cat.d.ts +15 -0
  36. package/dist/commands/fs/cat.js +26 -0
  37. package/dist/commands/fs/cp.d.ts +17 -0
  38. package/dist/commands/fs/cp.js +26 -0
  39. package/dist/commands/fs/create.d.ts +15 -0
  40. package/dist/commands/fs/create.js +83 -0
  41. package/dist/commands/fs/download.d.ts +25 -0
  42. package/dist/commands/fs/download.js +235 -0
  43. package/dist/commands/fs/edit.d.ts +16 -0
  44. package/dist/commands/fs/edit.js +25 -0
  45. package/dist/commands/fs/ls.d.ts +18 -0
  46. package/dist/commands/fs/ls.js +142 -0
  47. package/dist/commands/fs/mkdir.d.ts +8 -0
  48. package/dist/commands/fs/mkdir.js +21 -0
  49. package/dist/commands/fs/mv.d.ts +13 -0
  50. package/dist/commands/fs/mv.js +73 -0
  51. package/dist/commands/fs/rm.d.ts +24 -0
  52. package/dist/commands/fs/rm.js +108 -0
  53. package/dist/commands/fs/touch.d.ts +16 -0
  54. package/dist/commands/fs/touch.js +62 -0
  55. package/dist/commands/fs/upload.d.ts +55 -0
  56. package/dist/commands/fs/upload.js +221 -0
  57. package/dist/commands/groups/fields.d.ts +6 -0
  58. package/dist/commands/groups/fields.js +13 -0
  59. package/dist/commands/groups/list.d.ts +16 -0
  60. package/dist/commands/groups/list.js +26 -0
  61. package/dist/commands/man/doc.d.ts +16 -0
  62. package/dist/commands/man/doc.js +32 -0
  63. package/dist/commands/man/topics.d.ts +6 -0
  64. package/dist/commands/man/topics.js +27 -0
  65. package/dist/commands/pipeline/fields.d.ts +6 -0
  66. package/dist/commands/pipeline/fields.js +13 -0
  67. package/dist/commands/pipeline/run.d.ts +18 -0
  68. package/dist/commands/pipeline/run.js +33 -0
  69. package/dist/commands/plugin/readme.d.ts +14 -0
  70. package/dist/commands/plugin/readme.js +49 -0
  71. package/dist/commands/plugin/run.d.ts +10 -0
  72. package/dist/commands/plugin/run.js +29 -0
  73. package/dist/commands/plugin/search.d.ts +7 -0
  74. package/dist/commands/plugin/search.js +18 -0
  75. package/dist/commands/plugininstances/fields.d.ts +6 -0
  76. package/dist/commands/plugininstances/fields.js +13 -0
  77. package/dist/commands/plugininstances/list.d.ts +16 -0
  78. package/dist/commands/plugininstances/list.js +26 -0
  79. package/dist/commands/pluginmetas/fields.d.ts +6 -0
  80. package/dist/commands/pluginmetas/fields.js +13 -0
  81. package/dist/commands/pluginmetas/list.d.ts +16 -0
  82. package/dist/commands/pluginmetas/list.js +26 -0
  83. package/dist/commands/plugins/add.d.ts +34 -0
  84. package/dist/commands/plugins/add.js +374 -0
  85. package/dist/commands/plugins/delete.d.ts +14 -0
  86. package/dist/commands/plugins/delete.js +34 -0
  87. package/dist/commands/plugins/fields.d.ts +6 -0
  88. package/dist/commands/plugins/fields.js +17 -0
  89. package/dist/commands/plugins/list.d.ts +17 -0
  90. package/dist/commands/plugins/list.js +40 -0
  91. package/dist/commands/plugins/overview.d.ts +6 -0
  92. package/dist/commands/plugins/overview.js +17 -0
  93. package/dist/commands/store/list.d.ts +23 -0
  94. package/dist/commands/store/list.js +48 -0
  95. package/dist/commands/tags/fields.d.ts +6 -0
  96. package/dist/commands/tags/fields.js +13 -0
  97. package/dist/commands/tags/list.d.ts +16 -0
  98. package/dist/commands/tags/list.js +26 -0
  99. package/dist/commands/workflows/fields.d.ts +6 -0
  100. package/dist/commands/workflows/fields.js +13 -0
  101. package/dist/commands/workflows/list.d.ts +16 -0
  102. package/dist/commands/workflows/list.js +26 -0
  103. package/dist/config/colorConfig.d.ts +56 -0
  104. package/dist/config/colorConfig.js +161 -0
  105. package/dist/connect/connectHandler.d.ts +15 -0
  106. package/dist/connect/connectHandler.js +48 -0
  107. package/dist/context/contextCommand.d.ts +13 -0
  108. package/dist/context/contextCommand.js +193 -0
  109. package/dist/controllers/baseController.d.ts +43 -0
  110. package/dist/controllers/baseController.js +67 -0
  111. package/dist/controllers/feedController.d.ts +35 -0
  112. package/dist/controllers/feedController.js +53 -0
  113. package/dist/controllers/fileController.d.ts +56 -0
  114. package/dist/controllers/fileController.js +93 -0
  115. package/dist/controllers/pluginContextController.d.ts +24 -0
  116. package/dist/controllers/pluginContextController.js +49 -0
  117. package/dist/controllers/pluginController.d.ts +70 -0
  118. package/dist/controllers/pluginController.js +98 -0
  119. package/dist/controllers/pluginMetaController.d.ts +41 -0
  120. package/dist/controllers/pluginMetaController.js +52 -0
  121. package/dist/feeds/feedHandler.d.ts +64 -0
  122. package/dist/feeds/feedHandler.js +203 -0
  123. package/dist/filesystem/fileGroupHandler.d.ts +92 -0
  124. package/dist/filesystem/fileGroupHandler.js +318 -0
  125. package/dist/filesystem/filesystemHandler.d.ts +12 -0
  126. package/dist/filesystem/filesystemHandler.js +135 -0
  127. package/dist/filesystem/inodeCommand.d.ts +12 -0
  128. package/dist/filesystem/inodeCommand.js +37 -0
  129. package/dist/handlers/baseGroupHandler.d.ts +103 -0
  130. package/dist/handlers/baseGroupHandler.js +342 -0
  131. package/dist/index.d.ts +7 -0
  132. package/dist/index.js +239 -0
  133. package/dist/lfs/lfs.d.ts +25 -0
  134. package/dist/lfs/lfs.js +74 -0
  135. package/dist/man/man.d.ts +15 -0
  136. package/dist/man/man.js +31 -0
  137. package/dist/man/renderer.d.ts +26 -0
  138. package/dist/man/renderer.js +187 -0
  139. package/dist/models/feed.d.ts +18 -0
  140. package/dist/models/feed.js +8 -0
  141. package/dist/models/listing.d.ts +33 -0
  142. package/dist/models/listing.js +9 -0
  143. package/dist/models/plugin.d.ts +27 -0
  144. package/dist/models/plugin.js +1 -0
  145. package/dist/models/resource.d.ts +39 -0
  146. package/dist/models/resource.js +9 -0
  147. package/dist/pacs/pacsQueryHandler.d.ts +55 -0
  148. package/dist/pacs/pacsQueryHandler.js +196 -0
  149. package/dist/pacs/pacsQueryPayload.d.ts +19 -0
  150. package/dist/pacs/pacsQueryPayload.js +44 -0
  151. package/dist/pacs/pacsResultRender.d.ts +20 -0
  152. package/dist/pacs/pacsResultRender.js +141 -0
  153. package/dist/pacs/pacsRetrieveHandler.d.ts +87 -0
  154. package/dist/pacs/pacsRetrieveHandler.js +272 -0
  155. package/dist/pacs/pacsServerHandler.d.ts +15 -0
  156. package/dist/pacs/pacsServerHandler.js +32 -0
  157. package/dist/path/pathCommand.d.ts +64 -0
  158. package/dist/path/pathCommand.js +805 -0
  159. package/dist/path/pathMapper.d.ts +189 -0
  160. package/dist/path/pathMapper.js +382 -0
  161. package/dist/plugins/pluginGroupHandler.d.ts +42 -0
  162. package/dist/plugins/pluginGroupHandler.js +90 -0
  163. package/dist/plugins/pluginHandler.d.ts +87 -0
  164. package/dist/plugins/pluginHandler.js +303 -0
  165. package/dist/plugins/pluginMetaHandler.d.ts +21 -0
  166. package/dist/plugins/pluginMetaHandler.js +27 -0
  167. package/dist/screen/screen.d.ts +214 -0
  168. package/dist/screen/screen.js +478 -0
  169. package/dist/utils/admin_prompt.d.ts +42 -0
  170. package/dist/utils/admin_prompt.js +105 -0
  171. package/dist/utils/cli.d.ts +67 -0
  172. package/dist/utils/cli.js +112 -0
  173. package/dist/utils/docker.d.ts +74 -0
  174. package/dist/utils/docker.js +155 -0
  175. package/dist/utils/input_format.d.ts +77 -0
  176. package/dist/utils/input_format.js +135 -0
  177. package/dist/utils/sort.d.ts +29 -0
  178. package/dist/utils/sort.js +63 -0
  179. package/dist/utils/ui.d.ts +7 -0
  180. package/dist/utils/ui.js +26 -0
  181. package/dist/utils.d.ts +15 -0
  182. package/dist/utils.js +14 -0
  183. package/dist/views/compute.d.ts +17 -0
  184. package/dist/views/compute.js +40 -0
  185. package/dist/views/connect.d.ts +13 -0
  186. package/dist/views/connect.js +35 -0
  187. package/dist/views/feed.d.ts +44 -0
  188. package/dist/views/feed.js +110 -0
  189. package/dist/views/file.d.ts +25 -0
  190. package/dist/views/file.js +71 -0
  191. package/dist/views/fs.d.ts +51 -0
  192. package/dist/views/fs.js +105 -0
  193. package/dist/views/ls.d.ts +37 -0
  194. package/dist/views/ls.js +190 -0
  195. package/dist/views/plugin.d.ts +28 -0
  196. package/dist/views/plugin.js +71 -0
  197. package/dist/views/pluginParameters.d.ts +17 -0
  198. package/dist/views/pluginParameters.js +79 -0
  199. package/docs/00_intro.adoc +25 -0
  200. package/docs/01_setup.adoc +63 -0
  201. package/docs/02_context.adoc +128 -0
  202. package/docs/03_searchable.adoc +134 -0
  203. package/docs/10_everyday_examples.adoc +9 -0
  204. package/docs/11_upload_data.adoc +146 -0
  205. package/docs/12_create_a_feed.adoc +9 -0
  206. package/docs/13_run_a_plugin.adoc +271 -0
  207. package/docs/20_plugins.adoc +16 -0
  208. package/docs/21_pluginReadme.adoc +123 -0
  209. package/docs/30_filesystem.adoc +93 -0
  210. package/docs/31_fileops.adoc +51 -0
  211. package/docs/32_file_content.adoc +471 -0
  212. package/docs/_architecture.adoc +48 -0
  213. package/docs/_deepContext.adoc +84 -0
  214. package/docs/_roadmap.adoc +42 -0
  215. package/docs/_searchable.adoc +187 -0
  216. package/docs/_state.adoc +68 -0
  217. package/docs/pacs.adoc +101 -0
  218. package/docs/pathMapper.md +246 -0
  219. package/package.json +92 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 FNNDSC / BCH
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,113 @@
1
+ ```
2
+ ____ _ ___ _ ___
3
+ / ___| |__ |_ _| | |_ _|
4
+ | | | '_ \ | || | | |
5
+ | |___| | | || || |___ | |
6
+ \____|_| |_|___|_____|___|
7
+ ```
8
+ **ChILI handles Intelligent Line Interactions**
9
+
10
+ `chili` is both a standalone CLI and a reusable library for interacting with the ChRIS ecosystem. It serves as the controller layer in the ChRIS interface stack, bridging raw business logic (`salsa`) and user presentation.
11
+
12
+ ## Installation
13
+
14
+ Install globally to use the `chili` command:
15
+
16
+ ```bash
17
+ npm install -g @fnndsc/chili
18
+ chili --help
19
+ ```
20
+
21
+ Requires Node.js ≥ 20.12. See [Quick Start](#quick-start) for usage.
22
+
23
+ `chili` is also consumed as a library (e.g. by [`chell`](https://github.com/FNNDSC/chell)): its headless **Commands** return typed **Models**, free of presentation concerns.
24
+
25
+ ```bash
26
+ npm install @fnndsc/chili
27
+ ```
28
+
29
+ ## Abstract
30
+
31
+ Designed for developers and power-users who want to script and control a ChRIS instance from the terminal. Maintains a persistent local context: connection details, active user, and current ChRIS working directory survive across invocations.
32
+
33
+ ## Architecture: The Sandwich Model
34
+
35
+ `chili` implements the controller layer:
36
+
37
+ 1. **`chili` (Library & CLI)**:
38
+ * **Commands (`src/commands`)**: Headless controllers that execute logic via `salsa` and return typed **Models**. Consumed directly by `chell`.
39
+ * **Models (`src/models`)**: Explicit interfaces (`Plugin`, `Feed`, `ListingItem`, etc.) defining data structures.
40
+ * **Views (`src/views`)**: Pure functions that render Models into formatted strings and tables.
41
+ * **CLI (`src/index.ts`)**: Commander.js entry point orchestrating Commands and Views.
42
+ 2. **[`salsa`](https://github.com/FNNDSC/salsa) (Logic)**: Shared Application Logic and Service Assets — high-level business intents.
43
+ 3. **[`cumin`](https://github.com/FNNDSC/cumin) (Infrastructure)**: State and connection layer — authentication, context persistence, low-level API.
44
+
45
+ ## Installation & Development
46
+
47
+ ### Full build (all layers)
48
+
49
+ ```bash
50
+ cd chili
51
+ make meal
52
+ ```
53
+
54
+ ### Individual steps
55
+
56
+ | Target | Action |
57
+ |--------|--------|
58
+ | `make shop` | Clone `cumin` and `salsa` if missing |
59
+ | `make prep` | `npm install` across all packages |
60
+ | `make cook` | Build (compile TypeScript) all packages |
61
+ | `make taste` | Run tests |
62
+ | `make serve` | Link packages globally |
63
+ | `make scrub` | Clean build artifacts and `node_modules` |
64
+
65
+ > Use [NVM](https://github.com/nvm-sh/nvm) to avoid needing `sudo` for global links.
66
+
67
+ ## Core Features
68
+
69
+ - **Context-Aware**: Remembers active server, user, and working directory between invocations.
70
+ - **Library Mode**: Exports strictly-typed commands and views consumed by `chell` and other frontends.
71
+ - **Resource Commands**: Full CRUD for plugins, feeds, files, links, pipelines, compute resources, groups, tags, and more.
72
+ - **Plugin Management**: Search, install (from peer store or Docker), and register plugins.
73
+ - **Feed Sub-resources**: Notes and comments on feeds (create, read, update, delete).
74
+
75
+ ## Quick Start
76
+
77
+ **Connect to ChRIS:**
78
+ ```bash
79
+ chili connect <URL> --user <USERNAME> --password <PASSWORD>
80
+ ```
81
+
82
+ **Plugins:**
83
+ ```bash
84
+ chili plugins list
85
+ chili plugins list --search "name:pl-dircopy"
86
+ chili plugin run pl-dircopy-v2.1.0 --args "..."
87
+ ```
88
+
89
+ **Feeds:**
90
+ ```bash
91
+ chili feeds list
92
+ chili feeds list --user rudolphpienaar
93
+ chili feed note 42
94
+ chili feed comments 42
95
+ ```
96
+
97
+ **Store / plugin install:**
98
+ ```bash
99
+ chili plugins add pl-fshack # auto-discovers compute resources
100
+ chili plugins add pl-fshack --compute ares,argentum
101
+ ```
102
+
103
+ **Files:**
104
+ ```bash
105
+ chili files list --path /home/user/uploads
106
+ ```
107
+
108
+ ## License
109
+
110
+ MIT — part of the [ChRIS Project](https://chrisproject.org).
111
+
112
+ ---
113
+ _-30-_
@@ -0,0 +1,15 @@
1
+ /**
2
+ * @file ChEFS - ChRIS Experimental File System Shell Primitives.
3
+ *
4
+ * This module provides basic shell-like commands (`ls`, `cd`, `mkdir`, `touch`, `pwd`)
5
+ * that operate on the ChRIS filesystem context.
6
+ *
7
+ * @module
8
+ */
9
+ import { Command } from "commander";
10
+ /**
11
+ * Sets up the 'chefs' command group in Commander.
12
+ *
13
+ * @param program - The Commander program instance.
14
+ */
15
+ export declare function chefsCommand_setup(program: Command): void;
@@ -0,0 +1,195 @@
1
+ import { chrisContext, Context } from "@fnndsc/cumin";
2
+ import { files_list } from '../commands/fs/ls.js';
3
+ import { grid_render, long_render } from '../views/ls.js';
4
+ import { files_mkdir } from '../commands/fs/mkdir.js';
5
+ import { files_touch } from '../commands/fs/touch.js';
6
+ import { files_upload } from '../commands/fs/upload.js';
7
+ import { files_cat } from '../commands/fs/cat.js';
8
+ import { files_rm } from '../commands/fs/rm.js';
9
+ import { files_cp } from '../commands/fs/cp.js';
10
+ import { files_mv } from '../commands/fs/mv.js';
11
+ import { mkdir_render, touch_render, upload_render, cat_render, rm_render, cp_render, mv_render } from '../views/fs.js';
12
+ /**
13
+ * Lists directory contents.
14
+ *
15
+ * @param options - Listing options.
16
+ * @param pathStr - The path to list.
17
+ */
18
+ async function chefs_ls(options, pathStr = "") {
19
+ const items = await files_list(options, pathStr); // Call the core logic
20
+ if (items.length === 0) {
21
+ return;
22
+ }
23
+ if (options.long) {
24
+ console.log(long_render(items, { human: !!options.human }));
25
+ }
26
+ else {
27
+ console.log(grid_render(items));
28
+ }
29
+ }
30
+ /**
31
+ * Copies a file or directory.
32
+ *
33
+ * @param src - Source path.
34
+ * @param dest - Destination path.
35
+ * @param options - Copy options.
36
+ */
37
+ async function chefs_cp(src, dest, options) {
38
+ const success = await files_cp(src, dest, options);
39
+ console.log(cp_render(src, dest, success));
40
+ }
41
+ /**
42
+ * Moves a file or directory.
43
+ *
44
+ * @param src - Source path.
45
+ * @param dest - Destination path.
46
+ * @param options - Move options.
47
+ */
48
+ async function chefs_mv(src, dest, _options) {
49
+ const success = await files_mv(src, dest);
50
+ console.log(mv_render(src, dest, success));
51
+ }
52
+ /**
53
+ * Creates a directory.
54
+ *
55
+ * @param dirPath - The path of the directory to create.
56
+ */
57
+ async function chefs_mkdir(dirPath) {
58
+ const success = await files_mkdir(dirPath);
59
+ console.log(mkdir_render(dirPath, success));
60
+ }
61
+ /**
62
+ * Creates an empty file.
63
+ *
64
+ * @param filePath - The path of the file to create.
65
+ */
66
+ async function chefs_touch(filePath) {
67
+ const success = await files_touch(filePath);
68
+ console.log(touch_render(filePath, success));
69
+ }
70
+ /**
71
+ * Uploads a local file or directory to ChRIS.
72
+ *
73
+ * @param localPath - Local path.
74
+ * @param remotePath - Remote ChRIS path.
75
+ */
76
+ async function chefs_upload(localPath, remotePath) {
77
+ console.log(`Uploading ${localPath} to ${remotePath}...`);
78
+ const success = await files_upload(localPath, remotePath);
79
+ console.log(upload_render(localPath, remotePath, success));
80
+ }
81
+ /**
82
+ * Changes the current working directory.
83
+ *
84
+ * @param path - The path to change to.
85
+ */
86
+ async function chefs_cd(path) {
87
+ if (!path) {
88
+ await chefs_pwd();
89
+ return;
90
+ }
91
+ await chrisContext.current_set(Context.ChRISfolder, path);
92
+ await chefs_pwd();
93
+ }
94
+ /**
95
+ * Prints the current working directory.
96
+ */
97
+ async function chefs_pwd() {
98
+ const current = await chrisContext.current_get(Context.ChRISfolder);
99
+ console.log(current || "/");
100
+ }
101
+ /**
102
+ * Displays file content.
103
+ *
104
+ * @param filePath - The path of the file to read.
105
+ */
106
+ async function chefs_cat(filePath) {
107
+ const result = await files_cat(filePath);
108
+ const content = result.ok ? result.value : null;
109
+ console.log(cat_render(content, filePath));
110
+ }
111
+ /**
112
+ * Removes a file or directory.
113
+ *
114
+ * @param targetPath - The path to remove.
115
+ * @param options - Options including recursive flag.
116
+ */
117
+ async function chefs_rm(targetPath, options) {
118
+ const result = await files_rm(targetPath, options);
119
+ console.log(rm_render(result));
120
+ }
121
+ /**
122
+ * Sets up the 'chefs' command group in Commander.
123
+ *
124
+ * @param program - The Commander program instance.
125
+ */
126
+ export function chefsCommand_setup(program) {
127
+ const chefsCommand = program
128
+ .command("chefs")
129
+ .description("Chris Experimental File System - Shell primitives");
130
+ chefsCommand
131
+ .command("ls [path]")
132
+ .description("List filesystem elements (files, dirs, links)")
133
+ .option("-l, --long", "Long listing format")
134
+ .option("-h, --human", "Human readable sizes")
135
+ .action(async (path, options) => {
136
+ await chefs_ls(options, path || "");
137
+ });
138
+ chefsCommand
139
+ .command("cp <src> <dest>")
140
+ .description("Copy files or directories")
141
+ .option("-r, --recursive", "Recursive copy")
142
+ .action(async (src, dest, options) => {
143
+ await chefs_cp(src, dest, options);
144
+ });
145
+ chefsCommand
146
+ .command("mv <src> <dest>")
147
+ .description("Move or rename files or directories")
148
+ .action(async (src, dest, options) => {
149
+ await chefs_mv(src, dest, options);
150
+ });
151
+ chefsCommand
152
+ .command("cat <path>")
153
+ .description("Display file content")
154
+ .action(async (path) => {
155
+ await chefs_cat(path);
156
+ });
157
+ chefsCommand
158
+ .command("mkdir <path>")
159
+ .description("Create a new folder")
160
+ .action(async (path) => {
161
+ await chefs_mkdir(path);
162
+ });
163
+ chefsCommand
164
+ .command("touch <path>")
165
+ .description("Create an empty file")
166
+ .action(async (path) => {
167
+ await chefs_touch(path);
168
+ });
169
+ chefsCommand
170
+ .command("upload <local> <remote>")
171
+ .description("Upload a local file or directory to ChRIS")
172
+ .action(async (local, remote) => {
173
+ await chefs_upload(local, remote);
174
+ });
175
+ chefsCommand
176
+ .command("cd [path]")
177
+ .description("Change current working directory")
178
+ .action(async (path) => {
179
+ await chefs_cd(path);
180
+ });
181
+ chefsCommand
182
+ .command("pwd")
183
+ .description("Print working directory")
184
+ .action(async () => {
185
+ await chefs_pwd();
186
+ });
187
+ chefsCommand
188
+ .command("rm <path>")
189
+ .description("Remove a file or directory")
190
+ .option("-r, --recursive", "Remove directories and their contents recursively")
191
+ .option("-f, --force", "Force removal (ignore nonexistent files)")
192
+ .action(async (path, options) => {
193
+ await chefs_rm(path, options);
194
+ });
195
+ }
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Fetches the available compute resource field names.
3
+ *
4
+ * @returns The compute resource field names, or null on failure.
5
+ */
6
+ export declare function computeFields_fetch(): Promise<string[] | null>;
@@ -0,0 +1,13 @@
1
+ /**
2
+ * @file Fetches available fields for compute resources.
3
+ * @module
4
+ */
5
+ import { computeResourceFields_get } from '@fnndsc/salsa';
6
+ /**
7
+ * Fetches the available compute resource field names.
8
+ *
9
+ * @returns The compute resource field names, or null on failure.
10
+ */
11
+ export async function computeFields_fetch() {
12
+ return await computeResourceFields_get();
13
+ }
@@ -0,0 +1,19 @@
1
+ /**
2
+ * @file Implements compute resource listing for ChRIS CUBE.
3
+ *
4
+ * @module
5
+ */
6
+ import { ComputeResource } from '@fnndsc/cumin';
7
+ /**
8
+ * Result structure for compute resource listing.
9
+ */
10
+ export interface ComputeListResult {
11
+ resources: ComputeResource[];
12
+ selectedFields: string[];
13
+ }
14
+ /**
15
+ * Fetches all available compute resources from ChRIS CUBE.
16
+ *
17
+ * @returns Promise resolving to ComputeListResult.
18
+ */
19
+ export declare function computeResources_fetchList(): Promise<ComputeListResult>;
@@ -0,0 +1,20 @@
1
+ /**
2
+ * @file Implements compute resource listing for ChRIS CUBE.
3
+ *
4
+ * @module
5
+ */
6
+ import { computeResources_getAll } from '@fnndsc/cumin';
7
+ /**
8
+ * Fetches all available compute resources from ChRIS CUBE.
9
+ *
10
+ * @returns Promise resolving to ComputeListResult.
11
+ */
12
+ export async function computeResources_fetchList() {
13
+ const result = await computeResources_getAll();
14
+ if (!result.ok)
15
+ return { resources: [], selectedFields: [] };
16
+ return {
17
+ resources: result.value,
18
+ selectedFields: ['id', 'name', 'compute_url', 'description'],
19
+ };
20
+ }
@@ -0,0 +1,16 @@
1
+ /**
2
+ * @file Implements the logic for logging into the ChRIS backend.
3
+ *
4
+ * This module provides functionality to authenticate the user
5
+ * with a ChRIS instance.
6
+ *
7
+ * @module
8
+ */
9
+ import { ConnectOptions } from "@fnndsc/salsa";
10
+ /**
11
+ * Handles the login process.
12
+ *
13
+ * @param options - Connection options (url, username, password).
14
+ * @returns A Promise resolving to true on success, false on failure.
15
+ */
16
+ export declare function connect_login(options: ConnectOptions): Promise<boolean>;
@@ -0,0 +1,18 @@
1
+ /**
2
+ * @file Implements the logic for logging into the ChRIS backend.
3
+ *
4
+ * This module provides functionality to authenticate the user
5
+ * with a ChRIS instance.
6
+ *
7
+ * @module
8
+ */
9
+ import { connect_do as salsaConnect_do } from "@fnndsc/salsa";
10
+ /**
11
+ * Handles the login process.
12
+ *
13
+ * @param options - Connection options (url, username, password).
14
+ * @returns A Promise resolving to true on success, false on failure.
15
+ */
16
+ export async function connect_login(options) {
17
+ return await salsaConnect_do(options);
18
+ }
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Handles the logout process.
3
+ *
4
+ * @returns A Promise resolving to `void`.
5
+ */
6
+ export declare function connect_logout(): Promise<void>;
@@ -0,0 +1,16 @@
1
+ /**
2
+ * @file Implements the logic for logging out from the ChRIS backend.
3
+ *
4
+ * This module provides functionality to clear the user's authentication session.
5
+ *
6
+ * @module
7
+ */
8
+ import { logout_do as salsaLogout_do } from "@fnndsc/salsa";
9
+ /**
10
+ * Handles the logout process.
11
+ *
12
+ * @returns A Promise resolving to `void`.
13
+ */
14
+ export async function connect_logout() {
15
+ await salsaLogout_do();
16
+ }
@@ -0,0 +1,41 @@
1
+ import type { FeedComment } from '@fnndsc/salsa';
2
+ import { Result } from '@fnndsc/cumin';
3
+ export type { FeedComment };
4
+ /**
5
+ * Lists the comments on a feed.
6
+ *
7
+ * @param feedId - The feed ID.
8
+ * @returns Result wrapping the comments.
9
+ */
10
+ export declare function feed_commentsList(feedId: number): Promise<Result<FeedComment[]>>;
11
+ /**
12
+ * Creates a comment on a feed.
13
+ *
14
+ * @param feedId - The feed ID.
15
+ * @param data - Comment title and/or content.
16
+ * @returns Result wrapping the created comment.
17
+ */
18
+ export declare function feed_commentCreate(feedId: number, data: {
19
+ title?: string;
20
+ content?: string;
21
+ }): Promise<Result<FeedComment>>;
22
+ /**
23
+ * Deletes a feed comment.
24
+ *
25
+ * @param feedId - The feed ID.
26
+ * @param commentId - The comment ID.
27
+ * @returns Result indicating success.
28
+ */
29
+ export declare function feed_commentDelete(feedId: number, commentId: number): Promise<Result<boolean>>;
30
+ /**
31
+ * Updates a feed comment.
32
+ *
33
+ * @param feedId - The feed ID.
34
+ * @param commentId - The comment ID.
35
+ * @param data - Updated title and/or content.
36
+ * @returns Result indicating success.
37
+ */
38
+ export declare function feed_commentUpdate(feedId: number, commentId: number, data: {
39
+ title?: string;
40
+ content?: string;
41
+ }): Promise<Result<boolean>>;
@@ -0,0 +1,45 @@
1
+ /**
2
+ * @file Feed comments command logic.
3
+ * @module
4
+ */
5
+ import { feedComments_list, feedComment_create, feedComment_delete, feedComment_update, } from '@fnndsc/salsa';
6
+ /**
7
+ * Lists the comments on a feed.
8
+ *
9
+ * @param feedId - The feed ID.
10
+ * @returns Result wrapping the comments.
11
+ */
12
+ export async function feed_commentsList(feedId) {
13
+ return feedComments_list(feedId);
14
+ }
15
+ /**
16
+ * Creates a comment on a feed.
17
+ *
18
+ * @param feedId - The feed ID.
19
+ * @param data - Comment title and/or content.
20
+ * @returns Result wrapping the created comment.
21
+ */
22
+ export async function feed_commentCreate(feedId, data) {
23
+ return feedComment_create(feedId, data);
24
+ }
25
+ /**
26
+ * Deletes a feed comment.
27
+ *
28
+ * @param feedId - The feed ID.
29
+ * @param commentId - The comment ID.
30
+ * @returns Result indicating success.
31
+ */
32
+ export async function feed_commentDelete(feedId, commentId) {
33
+ return feedComment_delete(feedId, commentId);
34
+ }
35
+ /**
36
+ * Updates a feed comment.
37
+ *
38
+ * @param feedId - The feed ID.
39
+ * @param commentId - The comment ID.
40
+ * @param data - Updated title and/or content.
41
+ * @returns Result indicating success.
42
+ */
43
+ export async function feed_commentUpdate(feedId, commentId, data) {
44
+ return feedComment_update(feedId, commentId, data);
45
+ }
@@ -0,0 +1,13 @@
1
+ import { CLIoptions } from "../../utils/cli.js";
2
+ import { Feed } from "../../models/feed.js";
3
+ /**
4
+ * Creates a new ChRIS feed.
5
+ *
6
+ * Parses CLI options to extract feed parameters and input directories,
7
+ * then invokes the creation process.
8
+ *
9
+ * @param options - CLI options including `params` (string) and `dirs` (string or array).
10
+ * @returns A Promise resolving to a `Feed` object representing the created feed, or `null` on failure.
11
+ * @throws {Error} If feed parameters cannot be parsed or if directories are missing.
12
+ */
13
+ export declare function feed_create(options: CLIoptions): Promise<Feed | null>;
@@ -0,0 +1,40 @@
1
+ /**
2
+ * @file Implements the logic for creating new ChRIS feeds.
3
+ *
4
+ * This module provides functionality to create a new feed
5
+ * from a set of directories and parameters.
6
+ *
7
+ * @module
8
+ */
9
+ import { dictionary_fromCLI } from "@fnndsc/cumin";
10
+ import { feed_create as salsaFeed_create } from "@fnndsc/salsa";
11
+ /**
12
+ * Creates a new ChRIS feed.
13
+ *
14
+ * Parses CLI options to extract feed parameters and input directories,
15
+ * then invokes the creation process.
16
+ *
17
+ * @param options - CLI options including `params` (string) and `dirs` (string or array).
18
+ * @returns A Promise resolving to a `Feed` object representing the created feed, or `null` on failure.
19
+ * @throws {Error} If feed parameters cannot be parsed or if directories are missing.
20
+ */
21
+ export async function feed_create(options) {
22
+ const params = options.params;
23
+ const dirs = options.dirs; // Expects a comma-separated string for directories
24
+ let feedParams = {};
25
+ if (params) {
26
+ try {
27
+ feedParams = dictionary_fromCLI(params);
28
+ }
29
+ catch (e) {
30
+ // Original error handling without errorStack.push
31
+ throw new Error(`Error parsing feed parameters: ${e}`);
32
+ }
33
+ }
34
+ const dirsArray = typeof dirs === 'string' ? dirs.split(',') : (Array.isArray(dirs) ? dirs : []);
35
+ if (dirsArray.length === 0) {
36
+ throw new Error("Directories for feed creation are required (e.g., --dirs '/some/path').");
37
+ }
38
+ const result = await salsaFeed_create(dirsArray, feedParams);
39
+ return result;
40
+ }
@@ -0,0 +1,21 @@
1
+ import type { FeedNote } from '@fnndsc/salsa';
2
+ import { Result } from '@fnndsc/cumin';
3
+ export type { FeedNote };
4
+ /**
5
+ * Fetches the note for a feed.
6
+ *
7
+ * @param feedId - Feed ID.
8
+ * @returns Result containing note data.
9
+ */
10
+ export declare function feed_noteGet(feedId: number): Promise<Result<FeedNote>>;
11
+ /**
12
+ * Updates the note for a feed.
13
+ *
14
+ * @param feedId - Feed ID.
15
+ * @param data - Fields to update.
16
+ * @returns Result containing true on success.
17
+ */
18
+ export declare function feed_noteUpdate(feedId: number, data: {
19
+ title?: string;
20
+ content?: string;
21
+ }): Promise<Result<boolean>>;
@@ -0,0 +1,24 @@
1
+ /**
2
+ * @file Feed note command logic.
3
+ * @module
4
+ */
5
+ import { feedNote_get, feedNote_update } from '@fnndsc/salsa';
6
+ /**
7
+ * Fetches the note for a feed.
8
+ *
9
+ * @param feedId - Feed ID.
10
+ * @returns Result containing note data.
11
+ */
12
+ export async function feed_noteGet(feedId) {
13
+ return feedNote_get(feedId);
14
+ }
15
+ /**
16
+ * Updates the note for a feed.
17
+ *
18
+ * @param feedId - Feed ID.
19
+ * @param data - Fields to update.
20
+ * @returns Result containing true on success.
21
+ */
22
+ export async function feed_noteUpdate(feedId, data) {
23
+ return feedNote_update(feedId, data);
24
+ }
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Resolves search terms to a list of feed items.
3
+ *
4
+ * @param searchable - The search string.
5
+ * @returns A Promise resolving to an array of feed items (table data).
6
+ */
7
+ export declare function feeds_searchByTerm(searchable: string): Promise<Record<string, unknown>[]>;
8
+ /**
9
+ * Deletes a feed by its ID.
10
+ *
11
+ * @param id - The ID of the feed to delete.
12
+ * @returns A Promise resolving to `true` on success, `false` otherwise.
13
+ */
14
+ export declare function feed_deleteById(id: number): Promise<boolean>;