mk 0.7.13

Yet another simple task runner 🦀
Documentation
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
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
{
  "$defs": {
    "CommandRunner": {
      "anyOf": [
        {
          "$ref": "#/$defs/ContainerBuild"
        },
        {
          "$ref": "#/$defs/ContainerRun"
        },
        {
          "$ref": "#/$defs/LocalRun"
        },
        {
          "$ref": "#/$defs/TaskRun"
        },
        {
          "type": "string"
        }
      ],
      "description": "A single command entry in a task. Can be a shell string or a structured runner object."
    },
    "ContainerBuild": {
      "properties": {
        "container_build": {
          "$ref": "#/$defs/ContainerBuildArgs",
          "description": "The command to run in the container"
        },
        "verbose": {
          "default": null,
          "description": "Show verbose output",
          "type": [
            "boolean",
            "null"
          ]
        }
      },
      "required": [
        "container_build"
      ],
      "type": "object"
    },
    "ContainerBuildArgs": {
      "properties": {
        "build_args": {
          "default": null,
          "description": "Build arguments to pass to the container",
          "items": {
            "type": "string"
          },
          "type": [
            "array",
            "null"
          ]
        },
        "containerfile": {
          "default": null,
          "description": "The containerfile or dockerfile to use",
          "type": [
            "string",
            "null"
          ]
        },
        "context": {
          "description": "Defines the path to a directory to build the container",
          "type": "string"
        },
        "force_rm": {
          "default": false,
          "description": "Always remove intermediate containers",
          "type": "boolean"
        },
        "image_name": {
          "description": "The image name to build",
          "type": "string"
        },
        "labels": {
          "default": null,
          "description": "Labels to apply to the container image",
          "items": {
            "type": "string"
          },
          "type": [
            "array",
            "null"
          ]
        },
        "no_cache": {
          "default": false,
          "description": "Do not use cache when building the container",
          "type": "boolean"
        },
        "runtime": {
          "anyOf": [
            {
              "$ref": "#/$defs/ContainerRuntime"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "The container runtime to use"
        },
        "sbom": {
          "default": false,
          "description": "Generate a Software Bill of Materials (SBOM) for the container image",
          "type": "boolean"
        },
        "tags": {
          "default": null,
          "description": "The tags to apply to the container image",
          "items": {
            "type": "string"
          },
          "type": [
            "array",
            "null"
          ]
        }
      },
      "required": [
        "image_name",
        "context"
      ],
      "type": "object"
    },
    "ContainerRun": {
      "properties": {
        "container_command": {
          "description": "The command to run in the container",
          "items": {
            "type": "string"
          },
          "type": "array"
        },
        "ignore_errors": {
          "default": null,
          "description": "Ignore errors if the command fails",
          "type": [
            "boolean",
            "null"
          ]
        },
        "image": {
          "description": "The container image to use",
          "type": "string"
        },
        "mounted_paths": {
          "default": [],
          "description": "The mounted paths to bind mount into the container",
          "items": {
            "type": "string"
          },
          "type": "array"
        },
        "runtime": {
          "anyOf": [
            {
              "$ref": "#/$defs/ContainerRuntime"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "The container runtime to use"
        },
        "verbose": {
          "default": null,
          "description": "Show verbose output",
          "type": [
            "boolean",
            "null"
          ]
        }
      },
      "required": [
        "container_command",
        "image"
      ],
      "type": "object"
    },
    "ContainerRuntime": {
      "description": "The container runtime to use.",
      "enum": [
        "auto",
        "docker",
        "podman"
      ],
      "type": "string"
    },
    "ExecutionMode": {
      "enum": [
        "sequential",
        "parallel"
      ],
      "type": "string"
    },
    "Include": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "$ref": "#/$defs/IncludeArgs"
        }
      ]
    },
    "IncludeArgs": {
      "properties": {
        "name": {
          "type": "string"
        },
        "overwrite": {
          "default": false,
          "type": "boolean"
        }
      },
      "required": [
        "name"
      ],
      "type": "object"
    },
    "LocalRun": {
      "properties": {
        "command": {
          "description": "The command to run",
          "type": "string"
        },
        "ignore_errors": {
          "default": null,
          "description": "Ignore errors if the command fails",
          "type": [
            "boolean",
            "null"
          ]
        },
        "interactive": {
          "default": null,
          "description": "Interactive mode\nIf true, the command will be interactive accepting user input",
          "type": [
            "boolean",
            "null"
          ]
        },
        "retrigger": {
          "default": null,
          "description": "Allow pressing `R` to manually stop and restart a non-interactive command.",
          "type": [
            "boolean",
            "null"
          ]
        },
        "save_output_as": {
          "default": null,
          "description": "Save the command stdout to a task-scoped output name",
          "type": [
            "string",
            "null"
          ]
        },
        "shell": {
          "anyOf": [
            {
              "$ref": "#/$defs/Shell"
            },
            {
              "type": "null"
            }
          ],
          "description": "The shell to use to run the command"
        },
        "test": {
          "default": null,
          "description": "The test to run before running command\nIf the test fails, the command will not run",
          "type": [
            "string",
            "null"
          ]
        },
        "verbose": {
          "default": null,
          "description": "Show verbose output",
          "type": [
            "boolean",
            "null"
          ]
        },
        "work_dir": {
          "default": null,
          "description": "The working directory to run the command in",
          "type": [
            "string",
            "null"
          ]
        }
      },
      "required": [
        "command"
      ],
      "type": "object"
    },
    "Precondition": {
      "description": "This struct represents a precondition that must be met before a task can be\nexecuted.",
      "properties": {
        "command": {
          "description": "The command to run",
          "type": "string"
        },
        "message": {
          "default": null,
          "description": "The message to display if the command fails",
          "type": [
            "string",
            "null"
          ]
        },
        "shell": {
          "anyOf": [
            {
              "$ref": "#/$defs/Shell"
            },
            {
              "type": "null"
            }
          ],
          "description": "The shell to use to run the command"
        },
        "verbose": {
          "default": null,
          "description": "Show verbose output",
          "type": [
            "boolean",
            "null"
          ]
        },
        "work_dir": {
          "default": null,
          "description": "The working directory to run the command in",
          "type": [
            "string",
            "null"
          ]
        }
      },
      "required": [
        "command"
      ],
      "type": "object"
    },
    "SecretBackend": {
      "enum": [
        "built_in_pgp",
        "gpg"
      ],
      "type": "string"
    },
    "SecretSettings": {
      "properties": {
        "backend": {
          "anyOf": [
            {
              "$ref": "#/$defs/SecretBackend"
            },
            {
              "type": "null"
            }
          ],
          "default": null
        },
        "gpg_key_id": {
          "default": null,
          "type": [
            "string",
            "null"
          ]
        },
        "key_name": {
          "default": null,
          "type": [
            "string",
            "null"
          ]
        },
        "keys_location": {
          "default": null,
          "type": [
            "string",
            "null"
          ]
        },
        "secrets_path": {
          "default": null,
          "items": {
            "type": "string"
          },
          "type": [
            "array",
            "null"
          ]
        },
        "vault_location": {
          "default": null,
          "type": [
            "string",
            "null"
          ]
        }
      },
      "type": "object"
    },
    "Shell": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "$ref": "#/$defs/ShellArgs"
        }
      ],
      "description": "The shell to use. Either a string name (e.g. \"bash\") or an object with `command` and optional `args`."
    },
    "ShellArgs": {
      "description": "Shell command with optional flags.",
      "properties": {
        "args": {
          "description": "The flags to pass to the shell command",
          "items": {
            "type": "string"
          },
          "type": [
            "array",
            "null"
          ]
        },
        "command": {
          "description": "The shell command to run",
          "type": "string"
        }
      },
      "required": [
        "command"
      ],
      "type": "object"
    },
    "Task": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "$ref": "#/$defs/TaskArgs"
        }
      ],
      "description": "A task definition: either a command string shorthand or a full task object."
    },
    "TaskArgs": {
      "description": "This struct represents a task that can be executed. A task can contain multiple\ncommands that are executed sequentially. A task can also have preconditions that\nmust be met before the task can be executed.",
      "properties": {
        "cache": {
          "anyOf": [
            {
              "$ref": "#/$defs/TaskCache"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Task caching configuration"
        },
        "commands": {
          "description": "The commands to run",
          "items": {
            "$ref": "#/$defs/CommandRunner"
          },
          "type": "array"
        },
        "depends_on": {
          "description": "The tasks that must be executed before this task can be executed",
          "items": {
            "$ref": "#/$defs/TaskDependency"
          },
          "type": "array"
        },
        "description": {
          "default": "",
          "description": "The description of the task",
          "type": "string"
        },
        "env_file": {
          "default": [],
          "description": "The environment files to load before running the task",
          "items": {
            "type": "string"
          },
          "type": "array"
        },
        "environment": {
          "additionalProperties": {
            "type": "string"
          },
          "default": {},
          "description": "The environment variables to set before running the task",
          "type": "object"
        },
        "execution": {
          "anyOf": [
            {
              "$ref": "#/$defs/TaskExecution"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Richer execution configuration"
        },
        "gpg_key_id": {
          "default": null,
          "description": "GPG key ID or fingerprint for hardware/passphrase-protected keys (delegates to system gpg)",
          "type": [
            "string",
            "null"
          ]
        },
        "ignore_errors": {
          "default": null,
          "description": "Ignore errors if the task fails",
          "type": [
            "boolean",
            "null"
          ]
        },
        "inputs": {
          "default": [],
          "description": "Files or glob patterns that affect task output",
          "items": {
            "type": "string"
          },
          "type": "array"
        },
        "key_name": {
          "default": null,
          "description": "The key name to use for secret decryption",
          "type": [
            "string",
            "null"
          ]
        },
        "keys_location": {
          "default": null,
          "description": "The path to the private keys used for secret decryption",
          "type": [
            "string",
            "null"
          ]
        },
        "labels": {
          "additionalProperties": {
            "type": "string"
          },
          "default": {},
          "description": "The labels for the task",
          "type": "object"
        },
        "outputs": {
          "default": [],
          "description": "Files produced by the task",
          "items": {
            "type": "string"
          },
          "type": "array"
        },
        "parallel": {
          "default": null,
          "description": "Run the commands in parallel\nIt should only work if the task are local_run commands",
          "type": [
            "boolean",
            "null"
          ]
        },
        "preconditions": {
          "description": "The preconditions that must be met before the task can be executed",
          "items": {
            "$ref": "#/$defs/Precondition"
          },
          "type": "array"
        },
        "secrets": {
          "anyOf": [
            {
              "$ref": "#/$defs/SecretSettings"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Canonical task secret settings block."
        },
        "secrets_path": {
          "default": [],
          "description": "Secret paths to load as dotenv-style environment entries before running the task",
          "items": {
            "type": "string"
          },
          "type": "array"
        },
        "shell": {
          "anyOf": [
            {
              "$ref": "#/$defs/Shell"
            },
            {
              "type": "null"
            }
          ],
          "description": "The shell to use when running the task"
        },
        "vault_location": {
          "default": null,
          "description": "The path to the secret vault",
          "type": [
            "string",
            "null"
          ]
        },
        "verbose": {
          "default": null,
          "description": "Show verbose output",
          "type": [
            "boolean",
            "null"
          ]
        }
      },
      "required": [
        "commands"
      ],
      "type": "object"
    },
    "TaskCache": {
      "properties": {
        "enabled": {
          "default": true,
          "type": "boolean"
        }
      },
      "type": "object"
    },
    "TaskDependency": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "$ref": "#/$defs/TaskDependencyArgs"
        }
      ],
      "description": "A task dependency: either a task name string or an object with a `name` field."
    },
    "TaskDependencyArgs": {
      "description": "This struct represents a task dependency. A task can depend on other tasks.\nIf a task depends on another task, the dependent task must be executed before\nthe dependent task.",
      "properties": {
        "name": {
          "description": "The name of the task to depend on",
          "type": "string"
        }
      },
      "required": [
        "name"
      ],
      "type": "object"
    },
    "TaskExecution": {
      "properties": {
        "fail_fast": {
          "default": true,
          "type": "boolean"
        },
        "max_parallel": {
          "default": null,
          "format": "uint",
          "minimum": 0,
          "type": [
            "integer",
            "null"
          ]
        },
        "mode": {
          "anyOf": [
            {
              "$ref": "#/$defs/ExecutionMode"
            },
            {
              "type": "null"
            }
          ],
          "default": null
        }
      },
      "type": "object"
    },
    "TaskRun": {
      "properties": {
        "ignore_errors": {
          "default": null,
          "description": "Ignore errors if the task commands fail",
          "type": [
            "boolean",
            "null"
          ]
        },
        "task": {
          "description": "The name of the task to run",
          "type": "string"
        },
        "verbose": {
          "default": null,
          "description": "Show verbose output",
          "type": [
            "boolean",
            "null"
          ]
        }
      },
      "required": [
        "task"
      ],
      "type": "object"
    },
    "UseCargo": {
      "anyOf": [
        {
          "type": "boolean"
        },
        {
          "$ref": "#/$defs/UseCargoArgs"
        }
      ],
      "description": "Enable cargo commands as tasks. Either `true` or an object with optional settings."
    },
    "UseCargoArgs": {
      "properties": {
        "work_dir": {
          "default": null,
          "description": "The working directory to run the command in",
          "type": [
            "string",
            "null"
          ]
        }
      },
      "type": "object"
    },
    "UseNpm": {
      "anyOf": [
        {
          "type": "boolean"
        },
        {
          "$ref": "#/$defs/UseNpmArgs"
        }
      ],
      "description": "Enable npm scripts as tasks. Either `true` or an object with optional settings."
    },
    "UseNpmArgs": {
      "properties": {
        "package_manager": {
          "default": null,
          "description": "The package manager to use",
          "type": [
            "string",
            "null"
          ]
        },
        "work_dir": {
          "default": null,
          "description": "The working directory to run the command in",
          "type": [
            "string",
            "null"
          ]
        }
      },
      "type": "object"
    }
  },
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "description": "This struct represents the root of the task schema. It contains all the tasks\nthat can be executed.",
  "properties": {
    "container_runtime": {
      "anyOf": [
        {
          "$ref": "#/$defs/ContainerRuntime"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Default container runtime to use for container commands"
    },
    "env_file": {
      "default": [],
      "description": "The environment files to load before running any task",
      "items": {
        "type": "string"
      },
      "type": "array"
    },
    "environment": {
      "additionalProperties": {
        "type": "string"
      },
      "default": {},
      "description": "The environment variables to set before running any task",
      "type": "object"
    },
    "extends": {
      "default": null,
      "description": "Extend another root task file",
      "type": [
        "string",
        "null"
      ]
    },
    "gpg_key_id": {
      "default": null,
      "description": "The GPG key ID or fingerprint to use for secret encryption/decryption via the system gpg binary.\nWhen set, mk delegates all vault crypto operations to `gpg` instead of the built-in PGP engine,\nenabling hardware keys (e.g. YubiKey) and passphrase-protected keys.",
      "type": [
        "string",
        "null"
      ]
    },
    "include": {
      "description": "Includes additional files to be merged into the current file",
      "items": {
        "$ref": "#/$defs/Include"
      },
      "type": [
        "array",
        "null"
      ]
    },
    "key_name": {
      "default": null,
      "description": "The key name to use for secret decryption",
      "type": [
        "string",
        "null"
      ]
    },
    "keys_location": {
      "default": null,
      "description": "The path to the private keys used for secret decryption",
      "type": [
        "string",
        "null"
      ]
    },
    "secrets": {
      "anyOf": [
        {
          "$ref": "#/$defs/SecretSettings"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Canonical secret settings block."
    },
    "secrets_path": {
      "default": [],
      "description": "Secret paths to load as dotenv-style environment entries before running any task",
      "items": {
        "type": "string"
      },
      "type": "array"
    },
    "tasks": {
      "additionalProperties": {
        "$ref": "#/$defs/Task"
      },
      "description": "The tasks that can be executed",
      "type": "object"
    },
    "use_cargo": {
      "anyOf": [
        {
          "$ref": "#/$defs/UseCargo"
        },
        {
          "type": "null"
        }
      ],
      "description": "This allows mk to use cargo commands as tasks"
    },
    "use_npm": {
      "anyOf": [
        {
          "$ref": "#/$defs/UseNpm"
        },
        {
          "type": "null"
        }
      ],
      "description": "This allows mk to use npm scripts as tasks"
    },
    "vault_location": {
      "default": null,
      "description": "The path to the secret vault",
      "type": [
        "string",
        "null"
      ]
    }
  },
  "required": [
    "tasks"
  ],
  "title": "TaskRoot",
  "type": "object"
}