arf-console 0.3.2

A cross-platform R console written in Rust
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
---
source: crates/arf-console/src/cli.rs
expression: completions
---
#compdef arf

autoload -U is-at-least

_arf() {
    typeset -A opt_args
    typeset -a _arguments_options
    local ret=1

    if is-at-least 5.2; then
        _arguments_options=(-s -S -C)
    else
        _arguments_options=(-s -C)
    fi

    local context curcontext="$curcontext" state line
    _arguments "${_arguments_options[@]}" : \
'-e+[Evaluate R expression and exit]:EVAL:_default' \
'--eval=[Evaluate R expression and exit]:EVAL:_default' \
'(-e --eval)-f+[\[R\] Take input from FILE]:FILE:_files' \
'(-e --eval)--file=[\[R\] Take input from FILE]:FILE:_files' \
'-c+[Path to configuration file]:CONFIG:_files' \
'--config=[Path to configuration file]:CONFIG:_files' \
'(--r-home)--with-r-version=[R version to use via rig (overrides r_source config)]:R_VERSION:_default' \
'(--with-r-version)--r-home=[Explicit R_HOME path (overrides r_source config)]:R_HOME:_files -/' \
'--encoding=[\[R\] Specify encoding to be used for stdin (no-op)]:ENCODING:_default' \
'--max-connections=[\[R\] Set max number of connections to N]:MAX_CONNECTIONS:_default' \
'--max-ppsize=[\[R\] Set max size of protect stack to N]:MAX_PPSIZE:_default' \
'--min-nsize=[\[R\] Set min number of fixed size obj'\''s ("cons cells") to N]:MIN_NSIZE:_default' \
'--min-vsize=[\[R\] Set vector heap minimum to N bytes; '\''4M'\'' = 4 MegaB]:MIN_VSIZE:_default' \
'-d+[\[R\] Run R through debugger NAME (no-op)]:DEBUGGER:_default' \
'--debugger=[\[R\] Run R through debugger NAME (no-op)]:DEBUGGER:_default' \
'--debugger-args=[\[R\] Pass ARGS as arguments to the debugger (no-op)]:DEBUGGER_ARGS:_default' \
'-g+[\[R\] Use TYPE as GUI (no-op)]:GUI:_default' \
'--gui=[\[R\] Use TYPE as GUI (no-op)]:GUI:_default' \
'--arch=[\[R\] Specify a sub-architecture (no-op)]:ARCH:_default' \
'--history-dir=[Custom history directory (overrides default XDG location)]:HISTORY_DIR:_files -/' \
'--reprex[Enable reprex mode (no prompt, output prefixed with #>)]' \
'--auto-format[Enable auto-formatting of R code in reprex mode (requires Air CLI)]' \
'--no-banner[Suppress the startup banner]' \
'--vanilla[Start R in vanilla mode (no init files, no save/restore)]' \
'-q[\[R\] Don'\''t print R startup message]' \
'--quiet[\[R\] Don'\''t print R startup message]' \
'--no-save[\[R\] Don'\''t save workspace at end of session (default)]' \
'(--no-save)--save[\[R\] Save workspace at end of session]' \
'--no-restore[\[R\] Don'\''t restore previously saved objects (default)]' \
'--no-restore-data[\[R\] Don'\''t restore previously saved objects]' \
'(--no-restore --no-restore-data)--restore-data[\[R\] Restore previously saved objects]' \
'--no-environ[\[R\] Don'\''t read the site and user environment files]' \
'--no-site-file[\[R\] Don'\''t read the site-wide Rprofile]' \
'--no-init-file[\[R\] Don'\''t read the user'\''s .Rprofile]' \
'--interactive[\[R\] Force R to run interactively (no-op, always interactive)]' \
'--no-echo[\[R\] Don'\''t echo input (no-op, arf controls its own echo)]' \
'--slave[\[R\] Combine --quiet --no-save --no-restore (deprecated in R 4.0, use --no-echo)]' \
'(--no-restore --no-restore-data)--restore[\[R\] Restore previously saved objects (opposite of --no-restore)]' \
'--verbose[\[R\] Print more information about progress (no-op)]' \
'--args[\[R\] In R, skip the rest of the command line. arf accepts this flag for compatibility but does NOT consume trailing arguments; unknown flags after --args will still cause a parse error]' \
'--no-readline[\[R\] Don'\''t use readline (no-op)]' \
'--no-restore-history[\[R\] Don'\''t restore history (no-op)]' \
'--with-ipc[Enable IPC server for external tool access (AI agents, vscode-R, etc.)]' \
'--no-auto-match[Disable auto-matching of brackets and quotes (for testing)]' \
'--no-completion[Disable completion menu (for testing)]' \
'--no-history[Disable history (no history saved or loaded)]' \
'-h[Print help (see more with '\''--help'\'')]' \
'--help[Print help (see more with '\''--help'\'')]' \
'-V[Print version]' \
'--version[Print version]' \
":: :_arf_commands" \
"*::: :->arf" \
&& ret=0
    case $state in
    (arf)
        words=($line[1] "${words[@]}")
        (( CURRENT += 1 ))
        curcontext="${curcontext%:*:*}:arf-command-$line[1]:"
        case $line[1] in
            (completions)
_arguments "${_arguments_options[@]}" : \
'-h[Print help]' \
'--help[Print help]' \
':shell -- The shell to generate completions for:(bash elvish fish powershell zsh)' \
&& ret=0
;;
(config)
_arguments "${_arguments_options[@]}" : \
'-h[Print help]' \
'--help[Print help]' \
":: :_arf__subcmd__config_commands" \
"*::: :->config" \
&& ret=0

    case $state in
    (config)
        words=($line[1] "${words[@]}")
        (( CURRENT += 1 ))
        curcontext="${curcontext%:*:*}:arf-config-command-$line[1]:"
        case $line[1] in
            (init)
_arguments "${_arguments_options[@]}" : \
'-f[Overwrite existing configuration file]' \
'--force[Overwrite existing configuration file]' \
'-h[Print help]' \
'--help[Print help]' \
&& ret=0
;;
(check)
_arguments "${_arguments_options[@]}" : \
'-c+[Path to configuration file to check (defaults to XDG config location)]:CONFIG:_files' \
'--config=[Path to configuration file to check (defaults to XDG config location)]:CONFIG:_files' \
'-h[Print help (see more with '\''--help'\'')]' \
'--help[Print help (see more with '\''--help'\'')]' \
&& ret=0
;;
(help)
_arguments "${_arguments_options[@]}" : \
":: :_arf__subcmd__config__subcmd__help_commands" \
"*::: :->help" \
&& ret=0

    case $state in
    (help)
        words=($line[1] "${words[@]}")
        (( CURRENT += 1 ))
        curcontext="${curcontext%:*:*}:arf-config-help-command-$line[1]:"
        case $line[1] in
            (init)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(check)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(help)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
        esac
    ;;
esac
;;
        esac
    ;;
esac
;;
(history)
_arguments "${_arguments_options[@]}" : \
'-h[Print help]' \
'--help[Print help]' \
":: :_arf__subcmd__history_commands" \
"*::: :->history" \
&& ret=0

    case $state in
    (history)
        words=($line[1] "${words[@]}")
        (( CURRENT += 1 ))
        curcontext="${curcontext%:*:*}:arf-history-command-$line[1]:"
        case $line[1] in
            (schema)
_arguments "${_arguments_options[@]}" : \
'-h[Print help]' \
'--help[Print help]' \
&& ret=0
;;
(import)
_arguments "${_arguments_options[@]}" : \
'--from=[Source format to import from]:FROM:((radian\:"radian history file (~/.radian_history)"
r\:"R native history file (.Rhistory)"
arf\:"Another arf SQLite history database"))' \
'--file=[Path to the history file/database to import. Defaults\: radian=~/.radian_history, r=.Rhistory, arf=history.dir/r.db]:FILE:_files' \
'--hostname=[Override hostname for imported entries. Marks entries to distinguish them from native arf history]:HOSTNAME:_default' \
'--r-table=[Table name for R history when importing from unified export file]:R_TABLE:_default' \
'--shell-table=[Table name for shell history when importing from unified export file]:SHELL_TABLE:_default' \
'--dry-run[Perform a dry run without actually importing]' \
'--import-duplicates[Import duplicate entries instead of skipping them. By default, entries that already exist in the target database are skipped (anti-join on command text and timestamp)]' \
'--unified[Force unified export file mode (imports both R and shell history)]' \
'-h[Print help (see more with '\''--help'\'')]' \
'--help[Print help (see more with '\''--help'\'')]' \
&& ret=0
;;
(export)
_arguments "${_arguments_options[@]}" : \
'--file=[Path to the output SQLite file]:FILE:_files' \
'--r-table=[Table name for R history in the output file]:R_TABLE:_default' \
'--shell-table=[Table name for shell history in the output file]:SHELL_TABLE:_default' \
'-h[Print help (see more with '\''--help'\'')]' \
'--help[Print help (see more with '\''--help'\'')]' \
&& ret=0
;;
(help)
_arguments "${_arguments_options[@]}" : \
":: :_arf__subcmd__history__subcmd__help_commands" \
"*::: :->help" \
&& ret=0

    case $state in
    (help)
        words=($line[1] "${words[@]}")
        (( CURRENT += 1 ))
        curcontext="${curcontext%:*:*}:arf-history-help-command-$line[1]:"
        case $line[1] in
            (schema)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(import)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(export)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(help)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
        esac
    ;;
esac
;;
        esac
    ;;
esac
;;
(ipc)
_arguments "${_arguments_options[@]}" : \
'-h[Print help (see more with '\''--help'\'')]' \
'--help[Print help (see more with '\''--help'\'')]' \
":: :_arf__subcmd__ipc_commands" \
"*::: :->ipc" \
&& ret=0

    case $state in
    (ipc)
        words=($line[1] "${words[@]}")
        (( CURRENT += 1 ))
        curcontext="${curcontext%:*:*}:arf-ipc-command-$line[1]:"
        case $line[1] in
            (list)
_arguments "${_arguments_options[@]}" : \
'-h[Print help (see more with '\''--help'\'')]' \
'--help[Print help (see more with '\''--help'\'')]' \
&& ret=0
;;
(eval)
_arguments "${_arguments_options[@]}" : \
'--pid=[PID of the target arf session (optional if only one session is running)]:PID:_default' \
'--timeout=[Timeout in milliseconds for waiting for the response (default\: 300000 = 5 minutes). This does NOT cancel the R evaluation — long-running code keeps R busy after timeout]:TIMEOUT:_default' \
'--visible[Also show output in the session (REPL or headless stdout)]' \
'-h[Print help (see more with '\''--help'\'')]' \
'--help[Print help (see more with '\''--help'\'')]' \
':code -- R code to evaluate:_default' \
&& ret=0
;;
(send)
_arguments "${_arguments_options[@]}" : \
'--pid=[PID of the target arf session (optional if only one session is running)]:PID:_default' \
'-h[Print help (see more with '\''--help'\'')]' \
'--help[Print help (see more with '\''--help'\'')]' \
':code -- R code to send:_default' \
&& ret=0
;;
(session)
_arguments "${_arguments_options[@]}" : \
'--pid=[PID of the target arf session (optional if only one session is running)]:PID:_default' \
'-h[Print help (see more with '\''--help'\'')]' \
'--help[Print help (see more with '\''--help'\'')]' \
&& ret=0
;;
(shutdown)
_arguments "${_arguments_options[@]}" : \
'--pid=[PID of the target arf session (optional if only one session is running)]:PID:_default' \
'-h[Print help (see more with '\''--help'\'')]' \
'--help[Print help (see more with '\''--help'\'')]' \
&& ret=0
;;
(history)
_arguments "${_arguments_options[@]}" : \
'--limit=[Maximum number of entries to return (must be positive)]:LIMIT:_default' \
'--cwd=[Filter entries by exact working directory]:CWD:_default' \
'--grep=[Filter entries whose command contains this substring]:GREP:_default' \
'--since=[Only return entries after this timestamp (RFC 3339 or YYYY-MM-DD)]:SINCE:_default' \
'--pid=[PID of the target arf session (optional if only one session is running)]:PID:_default' \
'--all-sessions[Include entries from all sessions, not just the current one]' \
'-h[Print help (see more with '\''--help'\'')]' \
'--help[Print help (see more with '\''--help'\'')]' \
&& ret=0
;;
(help)
_arguments "${_arguments_options[@]}" : \
":: :_arf__subcmd__ipc__subcmd__help_commands" \
"*::: :->help" \
&& ret=0

    case $state in
    (help)
        words=($line[1] "${words[@]}")
        (( CURRENT += 1 ))
        curcontext="${curcontext%:*:*}:arf-ipc-help-command-$line[1]:"
        case $line[1] in
            (list)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(eval)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(send)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(session)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(shutdown)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(history)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(help)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
        esac
    ;;
esac
;;
        esac
    ;;
esac
;;
(headless)
_arguments "${_arguments_options[@]}" : \
'-c+[Path to configuration file]:CONFIG:_files' \
'--config=[Path to configuration file]:CONFIG:_files' \
'(--r-home)--with-r-version=[R version to use via rig (overrides r_source config)]:R_VERSION:_default' \
'(--with-r-version)--r-home=[Explicit R_HOME path (overrides r_source config)]:R_HOME:_files -/' \
'--bind=[Bind IPC socket to a specific path instead of the default. On Unix, ensure the parent directory is user-private (mode 0700) to avoid a brief permission window before the socket is restricted]:BIND:_files' \
'--pid-file=[Write server PID to a file (removed on shutdown)]:PID_FILE:_files' \
'--log-file=[Redirect log output to a file instead of stderr]:LOG_FILE:_files' \
'--max-connections=[\[R\] Set max number of connections to N]:MAX_CONNECTIONS:_default' \
'--max-ppsize=[\[R\] Set max size of protect stack to N]:MAX_PPSIZE:_default' \
'--history-dir=[Custom history directory (overrides default XDG location)]:HISTORY_DIR:_files -/' \
'--min-nsize=[\[R\] Set min number of fixed size obj'\''s ("cons cells") to N]:MIN_NSIZE:_default' \
'--min-vsize=[\[R\] Set vector heap minimum to N bytes; '\''4M'\'' = 4 MegaB]:MIN_VSIZE:_default' \
'--quiet[Suppress status messages on stderr (IPC path, ready, shutdown)]' \
'--json[Print session info as JSON to stdout when ready]' \
'--vanilla[Start R in vanilla mode (no init files, no save/restore)]' \
'--no-environ[\[R\] Don'\''t read the site and user environment files]' \
'--no-site-file[\[R\] Don'\''t read the site-wide Rprofile]' \
'--no-init-file[\[R\] Don'\''t read the user'\''s .Rprofile]' \
'--no-history[Disable history (no history saved)]' \
'-h[Print help (see more with '\''--help'\'')]' \
'--help[Print help (see more with '\''--help'\'')]' \
&& ret=0
;;
(help)
_arguments "${_arguments_options[@]}" : \
":: :_arf__subcmd__help_commands" \
"*::: :->help" \
&& ret=0

    case $state in
    (help)
        words=($line[1] "${words[@]}")
        (( CURRENT += 1 ))
        curcontext="${curcontext%:*:*}:arf-help-command-$line[1]:"
        case $line[1] in
            (completions)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(config)
_arguments "${_arguments_options[@]}" : \
":: :_arf__subcmd__help__subcmd__config_commands" \
"*::: :->config" \
&& ret=0

    case $state in
    (config)
        words=($line[1] "${words[@]}")
        (( CURRENT += 1 ))
        curcontext="${curcontext%:*:*}:arf-help-config-command-$line[1]:"
        case $line[1] in
            (init)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(check)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
        esac
    ;;
esac
;;
(history)
_arguments "${_arguments_options[@]}" : \
":: :_arf__subcmd__help__subcmd__history_commands" \
"*::: :->history" \
&& ret=0

    case $state in
    (history)
        words=($line[1] "${words[@]}")
        (( CURRENT += 1 ))
        curcontext="${curcontext%:*:*}:arf-help-history-command-$line[1]:"
        case $line[1] in
            (schema)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(import)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(export)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
        esac
    ;;
esac
;;
(ipc)
_arguments "${_arguments_options[@]}" : \
":: :_arf__subcmd__help__subcmd__ipc_commands" \
"*::: :->ipc" \
&& ret=0

    case $state in
    (ipc)
        words=($line[1] "${words[@]}")
        (( CURRENT += 1 ))
        curcontext="${curcontext%:*:*}:arf-help-ipc-command-$line[1]:"
        case $line[1] in
            (list)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(eval)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(send)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(session)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(shutdown)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(history)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
        esac
    ;;
esac
;;
(headless)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(help)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
        esac
    ;;
esac
;;
        esac
    ;;
esac
}

(( $+functions[_arf_commands] )) ||
_arf_commands() {
    local commands; commands=(
'completions:Generate shell completion scripts' \
'config:Configuration management' \
'history:History management' \
'ipc:Interact with a running arf session via IPC' \
'headless:Run R with IPC server only (no interactive REPL)' \
'help:Print this message or the help of the given subcommand(s)' \
    )
    _describe -t commands 'arf commands' commands "$@"
}
(( $+functions[_arf__subcmd__completions_commands] )) ||
_arf__subcmd__completions_commands() {
    local commands; commands=()
    _describe -t commands 'arf completions commands' commands "$@"
}
(( $+functions[_arf__subcmd__config_commands] )) ||
_arf__subcmd__config_commands() {
    local commands; commands=(
'init:Generate a default configuration file' \
'check:Validate the configuration file' \
'help:Print this message or the help of the given subcommand(s)' \
    )
    _describe -t commands 'arf config commands' commands "$@"
}
(( $+functions[_arf__subcmd__config__subcmd__check_commands] )) ||
_arf__subcmd__config__subcmd__check_commands() {
    local commands; commands=()
    _describe -t commands 'arf config check commands' commands "$@"
}
(( $+functions[_arf__subcmd__config__subcmd__help_commands] )) ||
_arf__subcmd__config__subcmd__help_commands() {
    local commands; commands=(
'init:Generate a default configuration file' \
'check:Validate the configuration file' \
'help:Print this message or the help of the given subcommand(s)' \
    )
    _describe -t commands 'arf config help commands' commands "$@"
}
(( $+functions[_arf__subcmd__config__subcmd__help__subcmd__check_commands] )) ||
_arf__subcmd__config__subcmd__help__subcmd__check_commands() {
    local commands; commands=()
    _describe -t commands 'arf config help check commands' commands "$@"
}
(( $+functions[_arf__subcmd__config__subcmd__help__subcmd__help_commands] )) ||
_arf__subcmd__config__subcmd__help__subcmd__help_commands() {
    local commands; commands=()
    _describe -t commands 'arf config help help commands' commands "$@"
}
(( $+functions[_arf__subcmd__config__subcmd__help__subcmd__init_commands] )) ||
_arf__subcmd__config__subcmd__help__subcmd__init_commands() {
    local commands; commands=()
    _describe -t commands 'arf config help init commands' commands "$@"
}
(( $+functions[_arf__subcmd__config__subcmd__init_commands] )) ||
_arf__subcmd__config__subcmd__init_commands() {
    local commands; commands=()
    _describe -t commands 'arf config init commands' commands "$@"
}
(( $+functions[_arf__subcmd__headless_commands] )) ||
_arf__subcmd__headless_commands() {
    local commands; commands=()
    _describe -t commands 'arf headless commands' commands "$@"
}
(( $+functions[_arf__subcmd__help_commands] )) ||
_arf__subcmd__help_commands() {
    local commands; commands=(
'completions:Generate shell completion scripts' \
'config:Configuration management' \
'history:History management' \
'ipc:Interact with a running arf session via IPC' \
'headless:Run R with IPC server only (no interactive REPL)' \
'help:Print this message or the help of the given subcommand(s)' \
    )
    _describe -t commands 'arf help commands' commands "$@"
}
(( $+functions[_arf__subcmd__help__subcmd__completions_commands] )) ||
_arf__subcmd__help__subcmd__completions_commands() {
    local commands; commands=()
    _describe -t commands 'arf help completions commands' commands "$@"
}
(( $+functions[_arf__subcmd__help__subcmd__config_commands] )) ||
_arf__subcmd__help__subcmd__config_commands() {
    local commands; commands=(
'init:Generate a default configuration file' \
'check:Validate the configuration file' \
    )
    _describe -t commands 'arf help config commands' commands "$@"
}
(( $+functions[_arf__subcmd__help__subcmd__config__subcmd__check_commands] )) ||
_arf__subcmd__help__subcmd__config__subcmd__check_commands() {
    local commands; commands=()
    _describe -t commands 'arf help config check commands' commands "$@"
}
(( $+functions[_arf__subcmd__help__subcmd__config__subcmd__init_commands] )) ||
_arf__subcmd__help__subcmd__config__subcmd__init_commands() {
    local commands; commands=()
    _describe -t commands 'arf help config init commands' commands "$@"
}
(( $+functions[_arf__subcmd__help__subcmd__headless_commands] )) ||
_arf__subcmd__help__subcmd__headless_commands() {
    local commands; commands=()
    _describe -t commands 'arf help headless commands' commands "$@"
}
(( $+functions[_arf__subcmd__help__subcmd__help_commands] )) ||
_arf__subcmd__help__subcmd__help_commands() {
    local commands; commands=()
    _describe -t commands 'arf help help commands' commands "$@"
}
(( $+functions[_arf__subcmd__help__subcmd__history_commands] )) ||
_arf__subcmd__help__subcmd__history_commands() {
    local commands; commands=(
'schema:Display history database schema and example R code' \
'import:Import history from another source (experimental)' \
'export:Export history to a unified SQLite file (experimental)' \
    )
    _describe -t commands 'arf help history commands' commands "$@"
}
(( $+functions[_arf__subcmd__help__subcmd__history__subcmd__export_commands] )) ||
_arf__subcmd__help__subcmd__history__subcmd__export_commands() {
    local commands; commands=()
    _describe -t commands 'arf help history export commands' commands "$@"
}
(( $+functions[_arf__subcmd__help__subcmd__history__subcmd__import_commands] )) ||
_arf__subcmd__help__subcmd__history__subcmd__import_commands() {
    local commands; commands=()
    _describe -t commands 'arf help history import commands' commands "$@"
}
(( $+functions[_arf__subcmd__help__subcmd__history__subcmd__schema_commands] )) ||
_arf__subcmd__help__subcmd__history__subcmd__schema_commands() {
    local commands; commands=()
    _describe -t commands 'arf help history schema commands' commands "$@"
}
(( $+functions[_arf__subcmd__help__subcmd__ipc_commands] )) ||
_arf__subcmd__help__subcmd__ipc_commands() {
    local commands; commands=(
'list:List active arf sessions as JSON' \
'eval:Evaluate R code and return captured output as JSON' \
'send:Send code as user input to a running session' \
'session:Get session information as JSON (arf + R environment)' \
'shutdown:Shut down a running arf headless session (returns JSON \`{"accepted"\: true}\`)' \
'history:Query command history from a running session' \
    )
    _describe -t commands 'arf help ipc commands' commands "$@"
}
(( $+functions[_arf__subcmd__help__subcmd__ipc__subcmd__eval_commands] )) ||
_arf__subcmd__help__subcmd__ipc__subcmd__eval_commands() {
    local commands; commands=()
    _describe -t commands 'arf help ipc eval commands' commands "$@"
}
(( $+functions[_arf__subcmd__help__subcmd__ipc__subcmd__history_commands] )) ||
_arf__subcmd__help__subcmd__ipc__subcmd__history_commands() {
    local commands; commands=()
    _describe -t commands 'arf help ipc history commands' commands "$@"
}
(( $+functions[_arf__subcmd__help__subcmd__ipc__subcmd__list_commands] )) ||
_arf__subcmd__help__subcmd__ipc__subcmd__list_commands() {
    local commands; commands=()
    _describe -t commands 'arf help ipc list commands' commands "$@"
}
(( $+functions[_arf__subcmd__help__subcmd__ipc__subcmd__send_commands] )) ||
_arf__subcmd__help__subcmd__ipc__subcmd__send_commands() {
    local commands; commands=()
    _describe -t commands 'arf help ipc send commands' commands "$@"
}
(( $+functions[_arf__subcmd__help__subcmd__ipc__subcmd__session_commands] )) ||
_arf__subcmd__help__subcmd__ipc__subcmd__session_commands() {
    local commands; commands=()
    _describe -t commands 'arf help ipc session commands' commands "$@"
}
(( $+functions[_arf__subcmd__help__subcmd__ipc__subcmd__shutdown_commands] )) ||
_arf__subcmd__help__subcmd__ipc__subcmd__shutdown_commands() {
    local commands; commands=()
    _describe -t commands 'arf help ipc shutdown commands' commands "$@"
}
(( $+functions[_arf__subcmd__history_commands] )) ||
_arf__subcmd__history_commands() {
    local commands; commands=(
'schema:Display history database schema and example R code' \
'import:Import history from another source (experimental)' \
'export:Export history to a unified SQLite file (experimental)' \
'help:Print this message or the help of the given subcommand(s)' \
    )
    _describe -t commands 'arf history commands' commands "$@"
}
(( $+functions[_arf__subcmd__history__subcmd__export_commands] )) ||
_arf__subcmd__history__subcmd__export_commands() {
    local commands; commands=()
    _describe -t commands 'arf history export commands' commands "$@"
}
(( $+functions[_arf__subcmd__history__subcmd__help_commands] )) ||
_arf__subcmd__history__subcmd__help_commands() {
    local commands; commands=(
'schema:Display history database schema and example R code' \
'import:Import history from another source (experimental)' \
'export:Export history to a unified SQLite file (experimental)' \
'help:Print this message or the help of the given subcommand(s)' \
    )
    _describe -t commands 'arf history help commands' commands "$@"
}
(( $+functions[_arf__subcmd__history__subcmd__help__subcmd__export_commands] )) ||
_arf__subcmd__history__subcmd__help__subcmd__export_commands() {
    local commands; commands=()
    _describe -t commands 'arf history help export commands' commands "$@"
}
(( $+functions[_arf__subcmd__history__subcmd__help__subcmd__help_commands] )) ||
_arf__subcmd__history__subcmd__help__subcmd__help_commands() {
    local commands; commands=()
    _describe -t commands 'arf history help help commands' commands "$@"
}
(( $+functions[_arf__subcmd__history__subcmd__help__subcmd__import_commands] )) ||
_arf__subcmd__history__subcmd__help__subcmd__import_commands() {
    local commands; commands=()
    _describe -t commands 'arf history help import commands' commands "$@"
}
(( $+functions[_arf__subcmd__history__subcmd__help__subcmd__schema_commands] )) ||
_arf__subcmd__history__subcmd__help__subcmd__schema_commands() {
    local commands; commands=()
    _describe -t commands 'arf history help schema commands' commands "$@"
}
(( $+functions[_arf__subcmd__history__subcmd__import_commands] )) ||
_arf__subcmd__history__subcmd__import_commands() {
    local commands; commands=()
    _describe -t commands 'arf history import commands' commands "$@"
}
(( $+functions[_arf__subcmd__history__subcmd__schema_commands] )) ||
_arf__subcmd__history__subcmd__schema_commands() {
    local commands; commands=()
    _describe -t commands 'arf history schema commands' commands "$@"
}
(( $+functions[_arf__subcmd__ipc_commands] )) ||
_arf__subcmd__ipc_commands() {
    local commands; commands=(
'list:List active arf sessions as JSON' \
'eval:Evaluate R code and return captured output as JSON' \
'send:Send code as user input to a running session' \
'session:Get session information as JSON (arf + R environment)' \
'shutdown:Shut down a running arf headless session (returns JSON \`{"accepted"\: true}\`)' \
'history:Query command history from a running session' \
'help:Print this message or the help of the given subcommand(s)' \
    )
    _describe -t commands 'arf ipc commands' commands "$@"
}
(( $+functions[_arf__subcmd__ipc__subcmd__eval_commands] )) ||
_arf__subcmd__ipc__subcmd__eval_commands() {
    local commands; commands=()
    _describe -t commands 'arf ipc eval commands' commands "$@"
}
(( $+functions[_arf__subcmd__ipc__subcmd__help_commands] )) ||
_arf__subcmd__ipc__subcmd__help_commands() {
    local commands; commands=(
'list:List active arf sessions as JSON' \
'eval:Evaluate R code and return captured output as JSON' \
'send:Send code as user input to a running session' \
'session:Get session information as JSON (arf + R environment)' \
'shutdown:Shut down a running arf headless session (returns JSON \`{"accepted"\: true}\`)' \
'history:Query command history from a running session' \
'help:Print this message or the help of the given subcommand(s)' \
    )
    _describe -t commands 'arf ipc help commands' commands "$@"
}
(( $+functions[_arf__subcmd__ipc__subcmd__help__subcmd__eval_commands] )) ||
_arf__subcmd__ipc__subcmd__help__subcmd__eval_commands() {
    local commands; commands=()
    _describe -t commands 'arf ipc help eval commands' commands "$@"
}
(( $+functions[_arf__subcmd__ipc__subcmd__help__subcmd__help_commands] )) ||
_arf__subcmd__ipc__subcmd__help__subcmd__help_commands() {
    local commands; commands=()
    _describe -t commands 'arf ipc help help commands' commands "$@"
}
(( $+functions[_arf__subcmd__ipc__subcmd__help__subcmd__history_commands] )) ||
_arf__subcmd__ipc__subcmd__help__subcmd__history_commands() {
    local commands; commands=()
    _describe -t commands 'arf ipc help history commands' commands "$@"
}
(( $+functions[_arf__subcmd__ipc__subcmd__help__subcmd__list_commands] )) ||
_arf__subcmd__ipc__subcmd__help__subcmd__list_commands() {
    local commands; commands=()
    _describe -t commands 'arf ipc help list commands' commands "$@"
}
(( $+functions[_arf__subcmd__ipc__subcmd__help__subcmd__send_commands] )) ||
_arf__subcmd__ipc__subcmd__help__subcmd__send_commands() {
    local commands; commands=()
    _describe -t commands 'arf ipc help send commands' commands "$@"
}
(( $+functions[_arf__subcmd__ipc__subcmd__help__subcmd__session_commands] )) ||
_arf__subcmd__ipc__subcmd__help__subcmd__session_commands() {
    local commands; commands=()
    _describe -t commands 'arf ipc help session commands' commands "$@"
}
(( $+functions[_arf__subcmd__ipc__subcmd__help__subcmd__shutdown_commands] )) ||
_arf__subcmd__ipc__subcmd__help__subcmd__shutdown_commands() {
    local commands; commands=()
    _describe -t commands 'arf ipc help shutdown commands' commands "$@"
}
(( $+functions[_arf__subcmd__ipc__subcmd__history_commands] )) ||
_arf__subcmd__ipc__subcmd__history_commands() {
    local commands; commands=()
    _describe -t commands 'arf ipc history commands' commands "$@"
}
(( $+functions[_arf__subcmd__ipc__subcmd__list_commands] )) ||
_arf__subcmd__ipc__subcmd__list_commands() {
    local commands; commands=()
    _describe -t commands 'arf ipc list commands' commands "$@"
}
(( $+functions[_arf__subcmd__ipc__subcmd__send_commands] )) ||
_arf__subcmd__ipc__subcmd__send_commands() {
    local commands; commands=()
    _describe -t commands 'arf ipc send commands' commands "$@"
}
(( $+functions[_arf__subcmd__ipc__subcmd__session_commands] )) ||
_arf__subcmd__ipc__subcmd__session_commands() {
    local commands; commands=()
    _describe -t commands 'arf ipc session commands' commands "$@"
}
(( $+functions[_arf__subcmd__ipc__subcmd__shutdown_commands] )) ||
_arf__subcmd__ipc__subcmd__shutdown_commands() {
    local commands; commands=()
    _describe -t commands 'arf ipc shutdown commands' commands "$@"
}

if [ "$funcstack[1]" = "_arf" ]; then
    _arf "$@"
else
    compdef _arf arf
fi