@qodalis/cli-files 2.0.0-beta.9 → 2.0.0-rc.1

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.
package/public-api.d.mts CHANGED
@@ -1,5 +1,4 @@
1
- import * as _qodalis_cli_core from '@qodalis/cli-core';
2
- import { ICliOwnership, ICliCommandProcessor, CliProcessCommand, ICliExecutionContext, ICliFileTransferService, ICliFileEntry, ICliCompletionProvider, ICliCompletionContext, ICliConfigurableModule } from '@qodalis/cli-core';
1
+ import { ICliOwnership, CliAccessAction, ICliCommandProcessor, CliProcessCommand, ICliExecutionContext, CliHeadersProvider, ICliFileTransferService, ICliFileEntry, ICliCompletionProvider, ICliCompletionContext, ICliConfigurableModule } from '@qodalis/cli-core';
3
2
  import { Subscription } from 'rxjs';
4
3
 
5
4
  /**
@@ -28,7 +27,18 @@ interface IFileNode {
28
27
  linkTarget?: string;
29
28
  }
30
29
 
31
- declare const IFileSystemService_TOKEN = "cli-file-system-service";
30
+ declare const IFileSystemService_TOKEN: any;
31
+ /**
32
+ * Decides whether the current principal may act on a node. Set by the files
33
+ * module from the generic authorization layer (`cliCanAccess`); when no policy
34
+ * is set (no auth module loaded) every operation is allowed.
35
+ */
36
+ interface CliFileAccessPolicy {
37
+ /** rwx check on a file or directory */
38
+ canAccess(node: IFileNode, action: CliAccessAction): boolean;
39
+ /** May the principal chmod/chown this node (owner, or `files:chown` / `files:admin`) */
40
+ canChangeOwnership(node: IFileNode, newOwnership?: ICliOwnership): boolean;
41
+ }
32
42
  /**
33
43
  * Abstraction for virtual filesystem operations.
34
44
  */
@@ -52,6 +62,17 @@ interface IFileSystemService {
52
62
  move(src: string, dest: string): void;
53
63
  chmod(path: string, permissions: string): void;
54
64
  chown(path: string, ownership: ICliOwnership): void;
65
+ setAccessPolicy?(policy?: CliFileAccessPolicy): void;
66
+ /** False when the current principal may not reach `path` (needs `x` on every parent) */
67
+ canTraverse?(path: string): boolean;
68
+ /** Run `fn` without access checks (system tasks such as creating home directories) */
69
+ runAsSystem?<T>(fn: () => T): T;
70
+ /**
71
+ * System task (no access checks): give every node owned by `fromUid`
72
+ * (case-insensitive) to `toUid`, e.g. after a user was renamed or deleted.
73
+ * Returns the number of nodes changed.
74
+ */
75
+ reassignOwner?(fromUid: string, toUid: string): number;
55
76
  initialize(): Promise<void>;
56
77
  persist(): Promise<void>;
57
78
  }
@@ -59,7 +80,7 @@ interface IFileSystemService {
59
80
  declare class CliLsCommandProcessor implements ICliCommandProcessor {
60
81
  command: string;
61
82
  description: string;
62
- author: _qodalis_cli_core.ICliCommandAuthor;
83
+ author: any;
63
84
  version: string;
64
85
  acceptsRawInput: boolean;
65
86
  metadata: {
@@ -76,38 +97,42 @@ declare class CliLsCommandProcessor implements ICliCommandProcessor {
76
97
  processCommand(command: CliProcessCommand, context: ICliExecutionContext): Promise<void>;
77
98
  writeDescription(context: ICliExecutionContext): void;
78
99
  private writeLongFormat;
100
+ private humanReadable;
101
+ private formatSize;
79
102
  private writeShortFormat;
80
103
  }
81
104
 
82
105
  declare class CliCdCommandProcessor implements ICliCommandProcessor {
83
106
  command: string;
84
107
  description: string;
85
- author: _qodalis_cli_core.ICliCommandAuthor;
108
+ author: any;
86
109
  version: string;
87
110
  acceptsRawInput: boolean;
88
111
  metadata: {
89
112
  icon: string;
90
113
  module: string;
91
114
  };
115
+ writeDescription(context: ICliExecutionContext): void;
92
116
  processCommand(command: CliProcessCommand, context: ICliExecutionContext): Promise<void>;
93
117
  }
94
118
 
95
119
  declare class CliPwdCommandProcessor implements ICliCommandProcessor {
96
120
  command: string;
97
121
  description: string;
98
- author: _qodalis_cli_core.ICliCommandAuthor;
122
+ author: any;
99
123
  version: string;
100
124
  metadata: {
101
125
  icon: string;
102
126
  module: string;
103
127
  };
128
+ writeDescription(context: ICliExecutionContext): void;
104
129
  processCommand(command: CliProcessCommand, context: ICliExecutionContext): Promise<void>;
105
130
  }
106
131
 
107
132
  declare class CliMkdirCommandProcessor implements ICliCommandProcessor {
108
133
  command: string;
109
134
  description: string;
110
- author: _qodalis_cli_core.ICliCommandAuthor;
135
+ author: any;
111
136
  version: string;
112
137
  acceptsRawInput: boolean;
113
138
  valueRequired: boolean;
@@ -122,13 +147,14 @@ declare class CliMkdirCommandProcessor implements ICliCommandProcessor {
122
147
  required: boolean;
123
148
  type: "boolean";
124
149
  }[];
150
+ writeDescription(context: ICliExecutionContext): void;
125
151
  processCommand(command: CliProcessCommand, context: ICliExecutionContext): Promise<void>;
126
152
  }
127
153
 
128
154
  declare class CliRmdirCommandProcessor implements ICliCommandProcessor {
129
155
  command: string;
130
156
  description: string;
131
- author: _qodalis_cli_core.ICliCommandAuthor;
157
+ author: any;
132
158
  version: string;
133
159
  acceptsRawInput: boolean;
134
160
  valueRequired: boolean;
@@ -136,13 +162,14 @@ declare class CliRmdirCommandProcessor implements ICliCommandProcessor {
136
162
  icon: string;
137
163
  module: string;
138
164
  };
165
+ writeDescription(context: ICliExecutionContext): void;
139
166
  processCommand(command: CliProcessCommand, context: ICliExecutionContext): Promise<void>;
140
167
  }
141
168
 
142
169
  declare class CliTouchCommandProcessor implements ICliCommandProcessor {
143
170
  command: string;
144
171
  description: string;
145
- author: _qodalis_cli_core.ICliCommandAuthor;
172
+ author: any;
146
173
  version: string;
147
174
  acceptsRawInput: boolean;
148
175
  valueRequired: boolean;
@@ -150,13 +177,14 @@ declare class CliTouchCommandProcessor implements ICliCommandProcessor {
150
177
  icon: string;
151
178
  module: string;
152
179
  };
180
+ writeDescription(context: ICliExecutionContext): void;
153
181
  processCommand(command: CliProcessCommand, context: ICliExecutionContext): Promise<void>;
154
182
  }
155
183
 
156
184
  declare class CliCatCommandProcessor implements ICliCommandProcessor {
157
185
  command: string;
158
186
  description: string;
159
- author: _qodalis_cli_core.ICliCommandAuthor;
187
+ author: any;
160
188
  version: string;
161
189
  acceptsRawInput: boolean;
162
190
  valueRequired: boolean;
@@ -164,13 +192,14 @@ declare class CliCatCommandProcessor implements ICliCommandProcessor {
164
192
  icon: string;
165
193
  module: string;
166
194
  };
195
+ writeDescription(context: ICliExecutionContext): void;
167
196
  processCommand(command: CliProcessCommand, context: ICliExecutionContext): Promise<void>;
168
197
  }
169
198
 
170
199
  declare class CliEchoCommandProcessor implements ICliCommandProcessor {
171
200
  command: string;
172
201
  description: string;
173
- author: _qodalis_cli_core.ICliCommandAuthor;
202
+ author: any;
174
203
  version: string;
175
204
  acceptsRawInput: boolean;
176
205
  extendsProcessor: boolean;
@@ -179,13 +208,14 @@ declare class CliEchoCommandProcessor implements ICliCommandProcessor {
179
208
  icon: string;
180
209
  module: string;
181
210
  };
211
+ writeDescription(context: ICliExecutionContext): void;
182
212
  processCommand(command: CliProcessCommand, context: ICliExecutionContext): Promise<void>;
183
213
  }
184
214
 
185
215
  declare class CliRmCommandProcessor implements ICliCommandProcessor {
186
216
  command: string;
187
217
  description: string;
188
- author: _qodalis_cli_core.ICliCommandAuthor;
218
+ author: any;
189
219
  version: string;
190
220
  acceptsRawInput: boolean;
191
221
  valueRequired: boolean;
@@ -200,13 +230,14 @@ declare class CliRmCommandProcessor implements ICliCommandProcessor {
200
230
  required: boolean;
201
231
  type: "boolean";
202
232
  }[];
233
+ writeDescription(context: ICliExecutionContext): void;
203
234
  processCommand(command: CliProcessCommand, context: ICliExecutionContext): Promise<void>;
204
235
  }
205
236
 
206
237
  declare class CliCpCommandProcessor implements ICliCommandProcessor {
207
238
  command: string;
208
239
  description: string;
209
- author: _qodalis_cli_core.ICliCommandAuthor;
240
+ author: any;
210
241
  version: string;
211
242
  acceptsRawInput: boolean;
212
243
  metadata: {
@@ -220,6 +251,7 @@ declare class CliCpCommandProcessor implements ICliCommandProcessor {
220
251
  required: boolean;
221
252
  type: "boolean";
222
253
  }[];
254
+ writeDescription(context: ICliExecutionContext): void;
223
255
  processCommand(command: CliProcessCommand, context: ICliExecutionContext): Promise<void>;
224
256
  private parseArgs;
225
257
  }
@@ -227,13 +259,14 @@ declare class CliCpCommandProcessor implements ICliCommandProcessor {
227
259
  declare class CliMvCommandProcessor implements ICliCommandProcessor {
228
260
  command: string;
229
261
  description: string;
230
- author: _qodalis_cli_core.ICliCommandAuthor;
262
+ author: any;
231
263
  version: string;
232
264
  acceptsRawInput: boolean;
233
265
  metadata: {
234
266
  icon: string;
235
267
  module: string;
236
268
  };
269
+ writeDescription(context: ICliExecutionContext): void;
237
270
  processCommand(command: CliProcessCommand, context: ICliExecutionContext): Promise<void>;
238
271
  private parseArgs;
239
272
  }
@@ -241,7 +274,7 @@ declare class CliMvCommandProcessor implements ICliCommandProcessor {
241
274
  declare class CliTreeCommandProcessor implements ICliCommandProcessor {
242
275
  command: string;
243
276
  description: string;
244
- author: _qodalis_cli_core.ICliCommandAuthor;
277
+ author: any;
245
278
  version: string;
246
279
  acceptsRawInput: boolean;
247
280
  metadata: {
@@ -255,14 +288,17 @@ declare class CliTreeCommandProcessor implements ICliCommandProcessor {
255
288
  required: boolean;
256
289
  type: "number";
257
290
  }[];
291
+ writeDescription(context: ICliExecutionContext): void;
258
292
  processCommand(command: CliProcessCommand, context: ICliExecutionContext): Promise<void>;
293
+ /** File system of the running command (listing goes through access checks) */
294
+ private fs?;
259
295
  private printTree;
260
296
  }
261
297
 
262
298
  declare class CliHeadCommandProcessor implements ICliCommandProcessor {
263
299
  command: string;
264
300
  description: string;
265
- author: _qodalis_cli_core.ICliCommandAuthor;
301
+ author: any;
266
302
  version: string;
267
303
  acceptsRawInput: boolean;
268
304
  valueRequired: boolean;
@@ -277,6 +313,7 @@ declare class CliHeadCommandProcessor implements ICliCommandProcessor {
277
313
  required: boolean;
278
314
  type: "number";
279
315
  }[];
316
+ writeDescription(context: ICliExecutionContext): void;
280
317
  processCommand(command: CliProcessCommand, context: ICliExecutionContext): Promise<void>;
281
318
  private parsePaths;
282
319
  }
@@ -284,7 +321,7 @@ declare class CliHeadCommandProcessor implements ICliCommandProcessor {
284
321
  declare class CliTailCommandProcessor implements ICliCommandProcessor {
285
322
  command: string;
286
323
  description: string;
287
- author: _qodalis_cli_core.ICliCommandAuthor;
324
+ author: any;
288
325
  version: string;
289
326
  acceptsRawInput: boolean;
290
327
  valueRequired: boolean;
@@ -299,6 +336,7 @@ declare class CliTailCommandProcessor implements ICliCommandProcessor {
299
336
  required: boolean;
300
337
  type: "number";
301
338
  }[];
339
+ writeDescription(context: ICliExecutionContext): void;
302
340
  processCommand(command: CliProcessCommand, context: ICliExecutionContext): Promise<void>;
303
341
  private parsePaths;
304
342
  }
@@ -306,7 +344,7 @@ declare class CliTailCommandProcessor implements ICliCommandProcessor {
306
344
  declare class CliWcCommandProcessor implements ICliCommandProcessor {
307
345
  command: string;
308
346
  description: string;
309
- author: _qodalis_cli_core.ICliCommandAuthor;
347
+ author: any;
310
348
  version: string;
311
349
  acceptsRawInput: boolean;
312
350
  valueRequired: boolean;
@@ -321,14 +359,17 @@ declare class CliWcCommandProcessor implements ICliCommandProcessor {
321
359
  required: boolean;
322
360
  type: "boolean";
323
361
  }[];
362
+ writeDescription(context: ICliExecutionContext): void;
324
363
  processCommand(command: CliProcessCommand, context: ICliExecutionContext): Promise<void>;
364
+ /** Counts like Unix wc: lines are newline characters. */
365
+ private count;
325
366
  private parsePaths;
326
367
  }
327
368
 
328
369
  declare class CliFindCommandProcessor implements ICliCommandProcessor {
329
370
  command: string;
330
371
  description: string;
331
- author: _qodalis_cli_core.ICliCommandAuthor;
372
+ author: any;
332
373
  version: string;
333
374
  acceptsRawInput: boolean;
334
375
  metadata: {
@@ -346,16 +387,23 @@ declare class CliFindCommandProcessor implements ICliCommandProcessor {
346
387
  required: boolean;
347
388
  type: "number";
348
389
  })[];
390
+ writeDescription(context: ICliExecutionContext): void;
349
391
  processCommand(command: CliProcessCommand, context: ICliExecutionContext): Promise<void>;
392
+ /** `--name` matches case-sensitively, `--iname` ignoring case. */
393
+ private nameRegex;
394
+ private matches;
350
395
  private parseSearchPath;
351
396
  private globToRegex;
397
+ /** File system of the running command (listing goes through access checks) */
398
+ private fs?;
399
+ /** Lists the children of `node`, which are at `depth` (1 = direct children). */
352
400
  private walk;
353
401
  }
354
402
 
355
403
  declare class CliGrepCommandProcessor implements ICliCommandProcessor {
356
404
  command: string;
357
405
  description: string;
358
- author: _qodalis_cli_core.ICliCommandAuthor;
406
+ author: any;
359
407
  version: string;
360
408
  acceptsRawInput: boolean;
361
409
  metadata: {
@@ -369,7 +417,13 @@ declare class CliGrepCommandProcessor implements ICliCommandProcessor {
369
417
  required: boolean;
370
418
  type: "boolean";
371
419
  }[];
420
+ writeDescription(context: ICliExecutionContext): void;
372
421
  processCommand(command: CliProcessCommand, context: ICliExecutionContext): Promise<void>;
422
+ /**
423
+ * As Unix grep: 0 when a line matched, 1 when none did, 2 after an
424
+ * error (so `if grep -q ...` and `grep x f && ...` work).
425
+ */
426
+ private exitStatus;
373
427
  private grepContent;
374
428
  private parseArgs;
375
429
  private collectFiles;
@@ -378,7 +432,7 @@ declare class CliGrepCommandProcessor implements ICliCommandProcessor {
378
432
  declare class CliTacCommandProcessor implements ICliCommandProcessor {
379
433
  command: string;
380
434
  description: string;
381
- author: _qodalis_cli_core.ICliCommandAuthor;
435
+ author: any;
382
436
  version: string;
383
437
  acceptsRawInput: boolean;
384
438
  valueRequired: boolean;
@@ -386,6 +440,7 @@ declare class CliTacCommandProcessor implements ICliCommandProcessor {
386
440
  icon: string;
387
441
  module: string;
388
442
  };
443
+ writeDescription(context: ICliExecutionContext): void;
389
444
  processCommand(command: CliProcessCommand, context: ICliExecutionContext): Promise<void>;
390
445
  private parsePaths;
391
446
  }
@@ -393,7 +448,7 @@ declare class CliTacCommandProcessor implements ICliCommandProcessor {
393
448
  declare class CliBasenameCommandProcessor implements ICliCommandProcessor {
394
449
  command: string;
395
450
  description: string;
396
- author: _qodalis_cli_core.ICliCommandAuthor;
451
+ author: any;
397
452
  version: string;
398
453
  acceptsRawInput: boolean;
399
454
  valueRequired: boolean;
@@ -401,6 +456,7 @@ declare class CliBasenameCommandProcessor implements ICliCommandProcessor {
401
456
  icon: string;
402
457
  module: string;
403
458
  };
459
+ writeDescription(context: ICliExecutionContext): void;
404
460
  processCommand(command: CliProcessCommand, context: ICliExecutionContext): Promise<void>;
405
461
  private parseTokens;
406
462
  }
@@ -408,7 +464,7 @@ declare class CliBasenameCommandProcessor implements ICliCommandProcessor {
408
464
  declare class CliDirnameCommandProcessor implements ICliCommandProcessor {
409
465
  command: string;
410
466
  description: string;
411
- author: _qodalis_cli_core.ICliCommandAuthor;
467
+ author: any;
412
468
  version: string;
413
469
  acceptsRawInput: boolean;
414
470
  valueRequired: boolean;
@@ -416,6 +472,7 @@ declare class CliDirnameCommandProcessor implements ICliCommandProcessor {
416
472
  icon: string;
417
473
  module: string;
418
474
  };
475
+ writeDescription(context: ICliExecutionContext): void;
419
476
  processCommand(command: CliProcessCommand, context: ICliExecutionContext): Promise<void>;
420
477
  private parseTokens;
421
478
  }
@@ -423,7 +480,7 @@ declare class CliDirnameCommandProcessor implements ICliCommandProcessor {
423
480
  declare class CliSortCommandProcessor implements ICliCommandProcessor {
424
481
  command: string;
425
482
  description: string;
426
- author: _qodalis_cli_core.ICliCommandAuthor;
483
+ author: any;
427
484
  version: string;
428
485
  acceptsRawInput: boolean;
429
486
  valueRequired: boolean;
@@ -444,6 +501,7 @@ declare class CliSortCommandProcessor implements ICliCommandProcessor {
444
501
  required: boolean;
445
502
  type: "string";
446
503
  })[];
504
+ writeDescription(context: ICliExecutionContext): void;
447
505
  processCommand(command: CliProcessCommand, context: ICliExecutionContext): Promise<void>;
448
506
  private parsePaths;
449
507
  }
@@ -451,7 +509,7 @@ declare class CliSortCommandProcessor implements ICliCommandProcessor {
451
509
  declare class CliUniqCommandProcessor implements ICliCommandProcessor {
452
510
  command: string;
453
511
  description: string;
454
- author: _qodalis_cli_core.ICliCommandAuthor;
512
+ author: any;
455
513
  version: string;
456
514
  acceptsRawInput: boolean;
457
515
  valueRequired: boolean;
@@ -466,6 +524,7 @@ declare class CliUniqCommandProcessor implements ICliCommandProcessor {
466
524
  required: boolean;
467
525
  type: "boolean";
468
526
  }[];
527
+ writeDescription(context: ICliExecutionContext): void;
469
528
  processCommand(command: CliProcessCommand, context: ICliExecutionContext): Promise<void>;
470
529
  private parsePaths;
471
530
  }
@@ -473,7 +532,7 @@ declare class CliUniqCommandProcessor implements ICliCommandProcessor {
473
532
  declare class CliCutCommandProcessor implements ICliCommandProcessor {
474
533
  command: string;
475
534
  description: string;
476
- author: _qodalis_cli_core.ICliCommandAuthor;
535
+ author: any;
477
536
  version: string;
478
537
  acceptsRawInput: boolean;
479
538
  valueRequired: boolean;
@@ -488,6 +547,7 @@ declare class CliCutCommandProcessor implements ICliCommandProcessor {
488
547
  required: boolean;
489
548
  type: "string";
490
549
  }[];
550
+ writeDescription(context: ICliExecutionContext): void;
491
551
  processCommand(command: CliProcessCommand, context: ICliExecutionContext): Promise<void>;
492
552
  private parseSpec;
493
553
  private resolveIndices;
@@ -497,7 +557,7 @@ declare class CliCutCommandProcessor implements ICliCommandProcessor {
497
557
  declare class CliPasteCommandProcessor implements ICliCommandProcessor {
498
558
  command: string;
499
559
  description: string;
500
- author: _qodalis_cli_core.ICliCommandAuthor;
560
+ author: any;
501
561
  version: string;
502
562
  acceptsRawInput: boolean;
503
563
  valueRequired: boolean;
@@ -518,14 +578,21 @@ declare class CliPasteCommandProcessor implements ICliCommandProcessor {
518
578
  required: boolean;
519
579
  type: "boolean";
520
580
  })[];
581
+ writeDescription(context: ICliExecutionContext): void;
521
582
  processCommand(command: CliProcessCommand, context: ICliExecutionContext): Promise<void>;
583
+ /** `-d` list: each character in turn, with \t, \n, \\ and \0 (empty) escapes. */
584
+ private parseDelimiters;
585
+ /**
586
+ * The file operands. The engine drops a lone `-` from the value, so with
587
+ * piped input they are read from the raw command line to keep it.
588
+ */
522
589
  private parsePaths;
523
590
  }
524
591
 
525
592
  declare class CliTrCommandProcessor implements ICliCommandProcessor {
526
593
  command: string;
527
594
  description: string;
528
- author: _qodalis_cli_core.ICliCommandAuthor;
595
+ author: any;
529
596
  version: string;
530
597
  acceptsRawInput: boolean;
531
598
  valueRequired: boolean;
@@ -535,11 +602,14 @@ declare class CliTrCommandProcessor implements ICliCommandProcessor {
535
602
  };
536
603
  parameters: {
537
604
  name: string;
605
+ aliases: string[];
538
606
  description: string;
539
607
  required: boolean;
540
608
  type: "boolean";
541
609
  }[];
610
+ writeDescription(context: ICliExecutionContext): void;
542
611
  processCommand(command: CliProcessCommand, context: ICliExecutionContext): Promise<void>;
612
+ private fail;
543
613
  private deleteChars;
544
614
  private squeezeChars;
545
615
  private translateChars;
@@ -548,7 +618,7 @@ declare class CliTrCommandProcessor implements ICliCommandProcessor {
548
618
  declare class CliStatCommandProcessor implements ICliCommandProcessor {
549
619
  command: string;
550
620
  description: string;
551
- author: _qodalis_cli_core.ICliCommandAuthor;
621
+ author: any;
552
622
  version: string;
553
623
  acceptsRawInput: boolean;
554
624
  valueRequired: boolean;
@@ -557,6 +627,7 @@ declare class CliStatCommandProcessor implements ICliCommandProcessor {
557
627
  module: string;
558
628
  };
559
629
  parameters: never[];
630
+ writeDescription(context: ICliExecutionContext): void;
560
631
  processCommand(command: CliProcessCommand, context: ICliExecutionContext): Promise<void>;
561
632
  private parsePaths;
562
633
  }
@@ -564,7 +635,7 @@ declare class CliStatCommandProcessor implements ICliCommandProcessor {
564
635
  declare class CliChmodCommandProcessor implements ICliCommandProcessor {
565
636
  command: string;
566
637
  description: string;
567
- author: _qodalis_cli_core.ICliCommandAuthor;
638
+ author: any;
568
639
  version: string;
569
640
  acceptsRawInput: boolean;
570
641
  valueRequired: boolean;
@@ -578,6 +649,7 @@ declare class CliChmodCommandProcessor implements ICliCommandProcessor {
578
649
  required: boolean;
579
650
  type: "boolean";
580
651
  }[];
652
+ writeDescription(context: ICliExecutionContext): void;
581
653
  processCommand(command: CliProcessCommand, context: ICliExecutionContext): Promise<void>;
582
654
  private parseArgs;
583
655
  private resolvePermissions;
@@ -588,7 +660,7 @@ declare class CliChmodCommandProcessor implements ICliCommandProcessor {
588
660
  declare class CliChownCommandProcessor implements ICliCommandProcessor {
589
661
  command: string;
590
662
  description: string;
591
- author: _qodalis_cli_core.ICliCommandAuthor;
663
+ author: any;
592
664
  version: string;
593
665
  acceptsRawInput: boolean;
594
666
  valueRequired: boolean;
@@ -602,6 +674,7 @@ declare class CliChownCommandProcessor implements ICliCommandProcessor {
602
674
  required: boolean;
603
675
  type: "boolean";
604
676
  }[];
677
+ writeDescription(context: ICliExecutionContext): void;
605
678
  processCommand(command: CliProcessCommand, context: ICliExecutionContext): Promise<void>;
606
679
  private parseArgs;
607
680
  /** Parse "user:group", "user:", ":group", or "user" */
@@ -612,10 +685,9 @@ declare class CliChownCommandProcessor implements ICliCommandProcessor {
612
685
  declare class CliDuCommandProcessor implements ICliCommandProcessor {
613
686
  command: string;
614
687
  description: string;
615
- author: _qodalis_cli_core.ICliCommandAuthor;
688
+ author: any;
616
689
  version: string;
617
690
  acceptsRawInput: boolean;
618
- valueRequired: boolean;
619
691
  metadata: {
620
692
  icon: string;
621
693
  module: string;
@@ -633,8 +705,11 @@ declare class CliDuCommandProcessor implements ICliCommandProcessor {
633
705
  required: boolean;
634
706
  type: "number";
635
707
  })[];
708
+ writeDescription(context: ICliExecutionContext): void;
636
709
  processCommand(command: CliProcessCommand, context: ICliExecutionContext): Promise<void>;
637
710
  private parseArgs;
711
+ /** File system of the running command (listing goes through access checks) */
712
+ private fs?;
638
713
  private collectSizes;
639
714
  private formatSize;
640
715
  }
@@ -642,7 +717,7 @@ declare class CliDuCommandProcessor implements ICliCommandProcessor {
642
717
  declare class CliLnCommandProcessor implements ICliCommandProcessor {
643
718
  command: string;
644
719
  description: string;
645
- author: _qodalis_cli_core.ICliCommandAuthor;
720
+ author: any;
646
721
  version: string;
647
722
  acceptsRawInput: boolean;
648
723
  valueRequired: boolean;
@@ -650,12 +725,20 @@ declare class CliLnCommandProcessor implements ICliCommandProcessor {
650
725
  icon: string;
651
726
  module: string;
652
727
  };
653
- parameters: {
728
+ parameters: ({
654
729
  name: string;
655
730
  description: string;
656
731
  required: boolean;
657
732
  type: "boolean";
658
- }[];
733
+ aliases?: undefined;
734
+ } | {
735
+ name: string;
736
+ aliases: string[];
737
+ description: string;
738
+ required: boolean;
739
+ type: "boolean";
740
+ })[];
741
+ writeDescription(context: ICliExecutionContext): void;
659
742
  processCommand(command: CliProcessCommand, context: ICliExecutionContext): Promise<void>;
660
743
  private parseArgs;
661
744
  }
@@ -663,7 +746,7 @@ declare class CliLnCommandProcessor implements ICliCommandProcessor {
663
746
  declare class CliSedCommandProcessor implements ICliCommandProcessor {
664
747
  command: string;
665
748
  description: string;
666
- author: _qodalis_cli_core.ICliCommandAuthor;
749
+ author: any;
667
750
  version: string;
668
751
  acceptsRawInput: boolean;
669
752
  metadata: {
@@ -681,21 +764,41 @@ declare class CliSedCommandProcessor implements ICliCommandProcessor {
681
764
  aliases: string[];
682
765
  description: string;
683
766
  required: boolean;
684
- type: "string";
767
+ type: "array";
685
768
  })[];
769
+ writeDescription(context: ICliExecutionContext): void;
686
770
  processCommand(command: CliProcessCommand, context: ICliExecutionContext): Promise<void>;
771
+ private writeLines;
772
+ /** Runs the script over the lines and returns the output lines. */
773
+ private run;
774
+ /** `&` is the match, `\1`..`\9` the groups, `\n` a newline, `\x` a literal x. */
775
+ private expandReplacement;
687
776
  private parseRawCommand;
688
777
  private tokenize;
689
- private parseExpression;
778
+ /** Commands of a script, separated by `;` or newlines. */
779
+ private parseScript;
780
+ private parseCommand;
690
781
  private parseAddress;
782
+ /**
783
+ * Text up to the next unescaped delimiter, escapes kept (an escaped
784
+ * delimiter becomes the plain character when it has no regex meaning).
785
+ */
786
+ private readDelimited;
787
+ /**
788
+ * Basic regular expressions use \( \) \{ \} \+ \? \| for groups and
789
+ * operators. When a pattern uses them (or never in -E mode), they are
790
+ * turned into the JavaScript form and the bare characters made literal.
791
+ */
792
+ private toJsRegex;
691
793
  private parseSubstitution;
692
794
  private addressMatches;
795
+ private singleMatches;
693
796
  }
694
797
 
695
798
  declare class CliAwkCommandProcessor implements ICliCommandProcessor {
696
799
  command: string;
697
800
  description: string;
698
- author: _qodalis_cli_core.ICliCommandAuthor;
801
+ author: any;
699
802
  version: string;
700
803
  acceptsRawInput: boolean;
701
804
  metadata: {
@@ -709,8 +812,16 @@ declare class CliAwkCommandProcessor implements ICliCommandProcessor {
709
812
  required: boolean;
710
813
  type: "string";
711
814
  }[];
815
+ writeDescription(context: ICliExecutionContext): void;
712
816
  processCommand(command: CliProcessCommand, context: ICliExecutionContext): Promise<void>;
817
+ /**
818
+ * The program is the first operand, usually quoted. Unquoted, it may span
819
+ * several words (`awk {print $1} file`): it is then everything before the
820
+ * trailing operands that are existing files, or the whole value with
821
+ * piped input.
822
+ */
713
823
  private parseArgs;
824
+ private bracesBalanced;
714
825
  private parseProgram;
715
826
  private findMatchingBrace;
716
827
  private matchesPattern;
@@ -730,7 +841,7 @@ declare class CliAwkCommandProcessor implements ICliCommandProcessor {
730
841
  declare class CliDiffCommandProcessor implements ICliCommandProcessor {
731
842
  command: string;
732
843
  description: string;
733
- author: _qodalis_cli_core.ICliCommandAuthor;
844
+ author: any;
734
845
  version: string;
735
846
  acceptsRawInput: boolean;
736
847
  valueRequired: boolean;
@@ -745,6 +856,7 @@ declare class CliDiffCommandProcessor implements ICliCommandProcessor {
745
856
  required: boolean;
746
857
  type: "boolean";
747
858
  }[];
859
+ writeDescription(context: ICliExecutionContext): void;
748
860
  processCommand(command: CliProcessCommand, context: ICliExecutionContext): Promise<void>;
749
861
  private linesEqual;
750
862
  private computeLCS;
@@ -756,7 +868,7 @@ declare class CliDiffCommandProcessor implements ICliCommandProcessor {
756
868
  declare class CliTeeCommandProcessor implements ICliCommandProcessor {
757
869
  command: string;
758
870
  description: string;
759
- author: _qodalis_cli_core.ICliCommandAuthor;
871
+ author: any;
760
872
  version: string;
761
873
  acceptsRawInput: boolean;
762
874
  valueRequired: boolean;
@@ -771,15 +883,15 @@ declare class CliTeeCommandProcessor implements ICliCommandProcessor {
771
883
  required: boolean;
772
884
  type: "boolean";
773
885
  }[];
886
+ writeDescription(context: ICliExecutionContext): void;
774
887
  processCommand(command: CliProcessCommand, context: ICliExecutionContext): Promise<void>;
775
888
  private getAllPaths;
776
- private parseArgs;
777
889
  }
778
890
 
779
891
  declare class CliXargsCommandProcessor implements ICliCommandProcessor {
780
892
  command: string;
781
893
  description: string;
782
- author: _qodalis_cli_core.ICliCommandAuthor;
894
+ author: any;
783
895
  version: string;
784
896
  acceptsRawInput: boolean;
785
897
  valueRequired: boolean;
@@ -800,28 +912,24 @@ declare class CliXargsCommandProcessor implements ICliCommandProcessor {
800
912
  required: boolean;
801
913
  type: "number";
802
914
  })[];
915
+ writeDescription(context: ICliExecutionContext): void;
803
916
  processCommand(command: CliProcessCommand, context: ICliExecutionContext): Promise<void>;
804
- private getAllNonFlagTokens;
805
917
  private escapeRegex;
806
- private parseArgs;
807
918
  }
808
919
 
809
920
  /**
810
921
  * Execute a script file containing CLI commands.
811
922
  *
812
- * Supported syntax inside scripts:
813
- * - One command per line (pipes, operators, redirects all work)
814
- * - `# comment` lines and blank lines are ignored
815
- * - `set -e` (default) — stop on first error
816
- * - `set +e` — continue on errors
817
- * - `VAR=value` — variable assignment (script-scoped)
818
- * - `$VAR` / `${VAR}` — variable substitution
923
+ * Scripts run through the engine's shell runner (`@qodalis/cli`
924
+ * `runScript`): commands, `;`, comments, `set -e`/`set +e`, `VAR=value`,
925
+ * `if`/`elif`/`else`/`fi`, `for`/`while`/`until` loops, `break`/`continue`,
926
+ * `exit`, and `test`/`[ ]` conditions.
819
927
  */
820
928
  declare class CliShCommandProcessor implements ICliCommandProcessor {
821
929
  command: string;
822
930
  aliases: string[];
823
931
  description: string;
824
- author: _qodalis_cli_core.ICliCommandAuthor;
932
+ author: any;
825
933
  version: string;
826
934
  acceptsRawInput: boolean;
827
935
  metadata: {
@@ -839,18 +947,38 @@ declare class CliShCommandProcessor implements ICliCommandProcessor {
839
947
  writeDescription(context: ICliExecutionContext): void;
840
948
  }
841
949
  /**
842
- * Parse and execute script content line by line.
843
- *
844
- * Exported so the executor can reuse it for `./script.sh` execution.
950
+ * Execute script content with the engine's shell runner (control flow,
951
+ * variables, `set -e`), the same one used for `./script.sh`.
845
952
  */
846
953
  declare function executeScript(content: string, context: ICliExecutionContext): Promise<void>;
847
954
 
955
+ /** Owner of system directories and of legacy nodes created without an owner */
956
+ declare const SYSTEM_OWNERSHIP: ICliOwnership;
957
+ /** Owner of files created while nobody is signed in */
958
+ declare const ANONYMOUS_OWNERSHIP: ICliOwnership;
848
959
  declare class IndexedDbFileSystemService implements IFileSystemService {
849
960
  private root;
850
961
  private cwd;
851
962
  private homePath;
852
963
  private currentUid;
853
964
  private currentGroups;
965
+ private accessPolicy?;
966
+ private systemDepth;
967
+ setAccessPolicy(policy?: CliFileAccessPolicy): void;
968
+ runAsSystem<T>(fn: () => T): T;
969
+ reassignOwner(fromUid: string, toUid: string): number;
970
+ canTraverse(path: string): boolean;
971
+ private get enforcing();
972
+ private deny;
973
+ /** `x` on every existing directory on the way to `resolved` (excluding the target). */
974
+ private assertTraverse;
975
+ private assertAccess;
976
+ /** Recursive delete: every directory inside must allow removing its entries (`w` + `x`, readable). */
977
+ private assertRemovableTree;
978
+ /** Copying reads everything it copies: `r` on every file, `r` + `x` on every directory. */
979
+ private assertReadableTree;
980
+ /** Creating/removing entries needs `w` and `x` on the containing directory. */
981
+ private assertModifyDir;
854
982
  setCurrentUser(uid: string, groups: string[]): void;
855
983
  private getDefaultOwnership;
856
984
  getCurrentDirectory(): string;
@@ -873,6 +1001,8 @@ declare class IndexedDbFileSystemService implements IFileSystemService {
873
1001
  chown(path: string, ownership: ICliOwnership): void;
874
1002
  initialize(): Promise<void>;
875
1003
  persist(): Promise<void>;
1004
+ /** A copy belongs to whoever made it (like `cp` without `-p`) */
1005
+ private ownedByCurrentUser;
876
1006
  private cloneNode;
877
1007
  private openDb;
878
1008
  private idbGet;
@@ -884,6 +1014,8 @@ declare class IndexedDbFileSystemService implements IFileSystemService {
884
1014
  interface ServerFileSystemOptions {
885
1015
  /** Base URL of the CLI server, e.g. 'http://localhost:8047' */
886
1016
  baseUrl: string;
1017
+ /** Custom headers sent with every request (e.g. auth tokens) */
1018
+ headers?: CliHeadersProvider;
887
1019
  }
888
1020
  /**
889
1021
  * IFileSystemService implementation that delegates operations to a CLI server's
@@ -902,6 +1034,7 @@ declare class ServerFileSystemService implements IFileSystemService {
902
1034
  private currentUid;
903
1035
  private currentGroups;
904
1036
  private readonly baseUrl;
1037
+ private readonly headersProvider;
905
1038
  constructor(options: ServerFileSystemOptions);
906
1039
  setCurrentUser(uid: string, groups: string[]): void;
907
1040
  private getDefaultOwnership;
@@ -966,6 +1099,35 @@ declare class VirtualFsFileTransferService implements ICliFileTransferService {
966
1099
  } | null>;
967
1100
  }
968
1101
 
1102
+ /** Permissions the files module understands. */
1103
+ declare const CliFilesPermissions: {
1104
+ /** Bypass all file permission checks */
1105
+ readonly Admin: "files:admin";
1106
+ /** chmod/chown files you do not own */
1107
+ readonly Chown: "files:chown";
1108
+ };
1109
+ /** Mode for newly created home directories (owner full, group read/traverse) */
1110
+ declare const HOME_DIR_PERMISSIONS = "rwxr-x---";
1111
+ /**
1112
+ * Access policy built on the generic authorization layer. Allows everything
1113
+ * when no authorization service is registered (no auth module loaded).
1114
+ */
1115
+ declare function createFileAccessPolicy(context: ICliExecutionContext): CliFileAccessPolicy;
1116
+ /**
1117
+ * Follow the signed-in user (from any auth module that provides
1118
+ * {@link ICliUserSessionService}): ownership for new files, home directory
1119
+ * creation and `~`, and moving to the home directory when the user changes.
1120
+ */
1121
+ declare function followUserSession(context: ICliExecutionContext, fs: IFileSystemService): Subscription | undefined;
1122
+ /**
1123
+ * Keep file ownership (stored by login name) in step with the accounts of
1124
+ * any auth module that emits {@link ICliUserEventService} events: a rename
1125
+ * moves the user's files to the new name, a deletion gives them to `root`, so
1126
+ * a later account with the same name never inherits them. Runs as a system
1127
+ * task (no rwx checks for the acting user). No-op without such a module.
1128
+ */
1129
+ declare function followUserAccounts(context: ICliExecutionContext, fs: IFileSystemService): Subscription | undefined;
1130
+
969
1131
  /**
970
1132
  * Provides tab-completion for file and directory names from the virtual filesystem.
971
1133
  * Priority 50 (checked before command/parameter providers for file-related commands).
@@ -991,7 +1153,12 @@ interface CliFilesModuleConfig {
991
1153
  interface ICliFilesModule extends ICliConfigurableModule<CliFilesModuleConfig> {
992
1154
  /** Subscription for drag-and-drop file uploads, cleaned up in onDestroy */
993
1155
  _dragDropSubscription?: Subscription;
1156
+ /** Subscription following the signed-in user, cleaned up in onDestroy */
1157
+ _sessionSubscription?: Subscription;
1158
+ /** Subscription following account renames/deletions, cleaned up in onDestroy */
1159
+ _accountsSubscription?: Subscription;
994
1160
  }
995
1161
  declare const filesModule: ICliFilesModule;
996
1162
 
997
- export { CliAwkCommandProcessor, CliBasenameCommandProcessor, CliCatCommandProcessor, CliCdCommandProcessor, CliChmodCommandProcessor, CliChownCommandProcessor, CliCpCommandProcessor, CliCutCommandProcessor, CliDiffCommandProcessor, CliDirnameCommandProcessor, CliDuCommandProcessor, CliEchoCommandProcessor, type CliFilesModuleConfig, CliFindCommandProcessor, CliGrepCommandProcessor, CliHeadCommandProcessor, CliLnCommandProcessor, CliLsCommandProcessor, CliMkdirCommandProcessor, CliMvCommandProcessor, CliPasteCommandProcessor, CliPwdCommandProcessor, CliRmCommandProcessor, CliRmdirCommandProcessor, CliSedCommandProcessor, CliShCommandProcessor, CliSortCommandProcessor, CliStatCommandProcessor, CliTacCommandProcessor, CliTailCommandProcessor, CliTeeCommandProcessor, CliTouchCommandProcessor, CliTrCommandProcessor, CliTreeCommandProcessor, CliUniqCommandProcessor, CliWcCommandProcessor, CliXargsCommandProcessor, FilePathCompletionProvider, type IFileNode, type IFileSystemService, IFileSystemService_TOKEN, IndexedDbFileSystemService, type ServerFileSystemOptions, ServerFileSystemService, VirtualFsFileTransferService, executeScript, filesModule };
1163
+ export { ANONYMOUS_OWNERSHIP, CliAwkCommandProcessor, CliBasenameCommandProcessor, CliCatCommandProcessor, CliCdCommandProcessor, CliChmodCommandProcessor, CliChownCommandProcessor, CliCpCommandProcessor, CliCutCommandProcessor, CliDiffCommandProcessor, CliDirnameCommandProcessor, CliDuCommandProcessor, CliEchoCommandProcessor, CliFilesPermissions, CliFindCommandProcessor, CliGrepCommandProcessor, CliHeadCommandProcessor, CliLnCommandProcessor, CliLsCommandProcessor, CliMkdirCommandProcessor, CliMvCommandProcessor, CliPasteCommandProcessor, CliPwdCommandProcessor, CliRmCommandProcessor, CliRmdirCommandProcessor, CliSedCommandProcessor, CliShCommandProcessor, CliSortCommandProcessor, CliStatCommandProcessor, CliTacCommandProcessor, CliTailCommandProcessor, CliTeeCommandProcessor, CliTouchCommandProcessor, CliTrCommandProcessor, CliTreeCommandProcessor, CliUniqCommandProcessor, CliWcCommandProcessor, CliXargsCommandProcessor, FilePathCompletionProvider, HOME_DIR_PERMISSIONS, IFileSystemService_TOKEN, IndexedDbFileSystemService, SYSTEM_OWNERSHIP, ServerFileSystemService, VirtualFsFileTransferService, createFileAccessPolicy, executeScript, filesModule, followUserAccounts, followUserSession };
1164
+ export type { CliFileAccessPolicy, CliFilesModuleConfig, IFileNode, IFileSystemService, ServerFileSystemOptions };