@jutge.org/toolkit 4.4.36 → 4.4.38

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.
@@ -0,0 +1,560 @@
1
+ # Jutge toolkit — command reference
2
+
3
+ This document describes the **jutge-toolkit**, which helps you **author, build, check, and publish programming problems** for [Jutge.org](https://jutge.org): a platform where students submit code that is automatically judged against test cases.
4
+
5
+ If you are new to the command line: you run commands in a **terminal** (also called a shell). You type the program name, then optional **subcommands** (verbs like `upload` or `make`), then **arguments** (things the command acts on), and **options** (flags like `-d` that change behavior). Options often have a short form (`-d`) and a long form (`--directory`); they mean the same thing.
6
+
7
+ ---
8
+
9
+ ## How to invoke the program
10
+
11
+ The same program is available under several names:
12
+
13
+ | Command | Typical use |
14
+ | --------------- | ------------------------------------------------------ |
15
+ | `jtk` | Short alias; use this once installed. |
16
+ | `jutge-toolkit` | Full name; same as `jtk`. |
17
+ | `jtk-dev` | Runs the toolkit from source during development (Bun). |
18
+
19
+ Examples in this document use **`jtk`**. Replace with `jutge-toolkit` if you prefer.
20
+
21
+ ---
22
+
23
+ ## Getting help
24
+
25
+ - **`jtk --help`** — Lists all top-level commands and global options.
26
+ - **`jtk help`** or **`jtk help <command>`** — Shows help for the main program or for a specific command (e.g. `jtk help make`).
27
+ - **`jtk <command> --help`** — Same idea for a single command (e.g. `jtk make --help`).
28
+
29
+ Global options on the main program:
30
+
31
+ - **`-V`, `--version`** — Print the toolkit version and exit.
32
+ - **`-h`, `--help`** — Show help.
33
+
34
+ More documentation: [toolkit docs on GitHub](https://github.com/jutge-org/new-jutge-toolkit/tree/main/docs).
35
+
36
+ ---
37
+
38
+ ## Problems and directories
39
+
40
+ Most commands work on a **problem directory**: a folder that contains your problem’s sources, statements, tests, and metadata (these must have a `.pbm` suffix in the name, e.g. `my-problem.pbm`). Many commands accept:
41
+
42
+ - **`-d`, `--directory <path>`** — Which folder to use.
43
+
44
+ The default is often the current directory `.`.
45
+
46
+ Paths can be relative (e.g. `.` or `../other-problem.pbm`) or absolute.
47
+
48
+ ---
49
+
50
+ ## Command overview (top level)
51
+
52
+ | Command | Purpose (short) |
53
+ | ----------------------------- | --------------------------------------------------------------------- |
54
+ | `make` | Build generated files (executables, statements, correct outputs, …). |
55
+ | `upload` | Send the problem to Jutge.org (create or update). |
56
+ | `remove` | Delete the problem from Jutge.org (when allowed). |
57
+ | `share` | Control sharing (passcode, testcases, solutions) and email passcodes. |
58
+ | `clean` | Remove disposable/generated files from disk. |
59
+ | `clone` | Create a new problem from a template. |
60
+ | `download` | Fetch an existing problem from Jutge.org into a folder. |
61
+ | `generate` | Use JutgeAI to generate or extend problem content. |
62
+ | `verify` | Check that candidate solutions match the golden solution on tests. |
63
+ | `lint` | Validate problem configuration and files. |
64
+ | `metrics` | Print code metrics for source files. |
65
+ | `submit` | Submit solutions to Jutge.org as a student would. |
66
+ | `convert` | One-off conversions (e.g. statement LaTeX syntax). |
67
+ | `stage` | Prepare a “staged” view of the problem for packaging or checks. |
68
+ | `doctor` | Check that compilers and tools are installed on your machine. |
69
+ | `config` | Read or edit toolkit configuration (name, email, AI model, …). |
70
+ | `upgrade` | Update the toolkit to the latest version. |
71
+ | `completion` | Install or print shell tab-completion scripts. |
72
+ | `about` | Show version, authors, and links. |
73
+ | `ask` | Ask questions about the toolkit via JutgeAI (needs login). |
74
+ | `for-dummies` / `interactive` | Guided menus for users who prefer not to type commands. |
75
+
76
+ The sections below describe each command in more detail.
77
+
78
+ ---
79
+
80
+ ## `make`
81
+
82
+ **Purpose:** **Build** everything needed for a problem locally: compile solutions, generate **correct outputs** (`.cor`) for test cases, build **PDF/HTML/Markdown/text** statements, and so on. This is the main “compile my problem” command while you are editing it.
83
+
84
+ **Arguments:**
85
+
86
+ - **`[tasks...]`** — What to build. If omitted, defaults to **`all`**. You cannot combine `all` with other task names.
87
+
88
+ **Tasks:**
89
+
90
+ | Task | Meaning |
91
+ | ------------------- | --------------------------------------------------------- |
92
+ | `all` | Full build (default). |
93
+ | `info` | Problem metadata (largely covered during initialization). |
94
+ | `exe` | Build executables / solution binaries as needed. |
95
+ | `cor` | Generate correct outputs for test cases. |
96
+ | `pdf` | Build PDF statements. |
97
+ | `txt`, `md`, `html` | Build full and short textual statements in those formats. |
98
+
99
+ **Options:**
100
+
101
+ - **`-d`, `--directory <directory>`** — Problem directory (default: `.`). Can resolve to multiple problem folders when the path expands that way.
102
+ - **`-i`, `--ignore-errors`** — If something fails in one directory, log the error and continue with others (default: false).
103
+ - **`-e`, `--only-errors`** — In the final summary, only list directories that had errors (default: false).
104
+ - **`-p`, `--problem_nm <id>`** — Problem identifier to use when needed (default: `DRAFT`).
105
+ - **`-w`, `--watch`** — **Watch** files for changes and rebuild incrementally. Experimental: only the first directory is watched if several are given; quiz/game handlers may not benefit. While watching, you can use key shortcuts (e.g. full rebuild, lint, quit) as shown in the terminal.
106
+
107
+ ---
108
+
109
+ ## `upload`
110
+
111
+ **Purpose:** **Publish** your problem to Jutge.org. If `problem.yml` already exists, the problem is **updated** using that metadata (including its id). If there is no `problem.yml`, a **new** problem is created and `problem.yml` is written for you.
112
+
113
+ **Tip:** Run **`clean`** first so you do not upload unnecessary build artifacts (unless you intend to).
114
+
115
+ **Options:**
116
+
117
+ - **`-d`, `--directory <directory>`** — Problem directory (default: `.`).
118
+
119
+ ---
120
+
121
+ ## `remove`
122
+
123
+ **Purpose:** **Remove** a problem **from the server** (not only delete local files). Only problems with **few submissions** can be removed; Jutge.org enforces this. On success, local **`problem.yml`** is deleted.
124
+
125
+ **Options:**
126
+
127
+ - **`-d`, `--directory <directory>`** — Problem directory (default: `.`).
128
+ - **`-y`, `--yes`** — Do not ask for confirmation.
129
+
130
+ ---
131
+
132
+ ## `share`
133
+
134
+ **Purpose:** Manage **who can see what** for a problem on Jutge.org: passcode, sharing **test cases**, sharing **solutions**. The command syncs with the server, applies your changes, then refreshes **`problem.yml`** and shows the result.
135
+
136
+ ### `share` (default)
137
+
138
+ Runs the update flow with optional flags:
139
+
140
+ **Options:**
141
+
142
+ - **`-d`, `--directory <directory>`** — Problem directory (default: `.`).
143
+ - **`--passcode [code]`** — Set a passcode; if you omit `code`, you are prompted securely.
144
+ - **`--no-passcode`** — Remove the passcode.
145
+ - **`--testcases`** — Enable sharing test cases.
146
+ - **`--no-testcases`** — Stop sharing test cases.
147
+ - **`--solutions`** — Enable sharing solutions.
148
+ - **`--no-solutions`** — Stop sharing solutions.
149
+
150
+ ### `share show`
151
+
152
+ **Purpose:** Display current sharing settings **without** changing them.
153
+
154
+ **Options:**
155
+
156
+ - **`-d`, `--directory <directory>`** — Problem directory (default: `.`).
157
+
158
+ ### `share with`
159
+
160
+ **Purpose:** **Email** the passcode to Jutge.org users by address. Invalid or unknown addresses are skipped; valid users get the passcode on their account and an informational email.
161
+
162
+ **Arguments:**
163
+
164
+ - **`<emails...>`** — One or more email addresses.
165
+
166
+ **Options:**
167
+
168
+ - **`-d`, `--directory <directory>`** — Problem directory (default: `.`).
169
+ - **`-t`, `--text <text>`** — Extra text included in the email (default: empty).
170
+
171
+ ---
172
+
173
+ ## `clean`
174
+
175
+ **Purpose:** **Delete disposable files** in a problem directory: build artifacts, toolkit temp files, object files, etc. Use **`--all`** to also remove generated statements and correct outputs (more aggressive).
176
+
177
+ **Options:**
178
+
179
+ - **`-d`, `--directory <directory>`** — Problem directory (default: `.`).
180
+ - **`-a`, `--all`** — Include generated statements and `.cor` files, etc. (default: false).
181
+ - **`-f`, `--force`** — Delete listed files **without** asking for confirmation (cannot be used together with `--dry-run`).
182
+ - **`-n`, `--dry-run`** — Described in `jtk clean --help` as listing candidates without removing them; cannot be used together with `--force`. _If in doubt, run without `--force`: the tool lists what it would remove and asks you to confirm before deleting._
183
+
184
+ ---
185
+
186
+ ## `clone`
187
+
188
+ **Purpose:** **Create a new problem folder** from a **template** (starter structure and config). If you omit the template name, the tool guides you interactively.
189
+
190
+ **Arguments:**
191
+
192
+ - **`[template]`** — Template name (optional; interactive if omitted).
193
+
194
+ **Options:**
195
+
196
+ - **`-d`, `--directory <path>`** — Where to create the problem (default: `new-problem.pbm`).
197
+
198
+ ---
199
+
200
+ ## `download`
201
+
202
+ **Purpose:** **Download** a problem you have access to on Jutge.org into a local `.pbm` directory.
203
+
204
+ **Arguments:**
205
+
206
+ - **`<problem_nm>`** — Server-side problem name / id.
207
+
208
+ **Options:**
209
+
210
+ - **`-d`, `--directory <path>`** — Output folder. If omitted, defaults to **`<problem_nm>.pbm`**. Must end with **`.pbm`**.
211
+
212
+ ---
213
+
214
+ ## `generate`
215
+
216
+ **Purpose:** Use **JutgeAI** (requires being logged in to Jutge) to generate drafts: full problems, translations, statements from code, alternative solutions, mains, test generators, or award assets.
217
+
218
+ Running **`jtk generate`** with no subcommand prints help.
219
+
220
+ ### `generate problem`
221
+
222
+ **Purpose:** Create a **new** problem directory from a specification, using AI. Treat the result as a **draft** to edit by hand afterward.
223
+
224
+ **Kinds:**
225
+
226
+ - **`io`** — Classic stdin/stdout problems (several languages supported).
227
+ - **`funcs`** — Implement-one-or-more-functions style (Python, Haskell, Clojure via specific compilers).
228
+
229
+ **Options:**
230
+
231
+ - **`-k`, `--kind <kind>`** — `io` or `funcs` (default: `io`).
232
+ - **`-d`, `--directory <path>`** — Output directory; must end with **`.pbm`** and must not exist.
233
+ - **`-i`, `--input <path>`** — Read specification from a file.
234
+ - **`-o`, `--output <path>`** — Write the specification to a file.
235
+ - **`-n`, `--do-not-ask`** — Non-interactive when combined with `--input` (default: false).
236
+ - **`-m`, `--model <model>`** — AI model id (default: from settings).
237
+
238
+ ### `generate translations`
239
+
240
+ **Purpose:** Add **statement translations** for given natural languages. May overwrite existing translation files.
241
+
242
+ **Arguments:**
243
+
244
+ - **`<languages...>`** — Language codes (e.g. `en`, `ca`, `es`, `fr`, `de`).
245
+
246
+ **Options:**
247
+
248
+ - **`-d`, `--directory <path>`** — Problem directory (default: `.`).
249
+ - **`-m`, `--model <model>`** — AI model (default: from settings).
250
+
251
+ ### `generate statement`
252
+
253
+ **Purpose:** Generate a **`problem.<lang>.tex`** statement from an existing **solution**, using AI.
254
+
255
+ **Arguments:**
256
+
257
+ - **`<proglang>`** — Solution language key (e.g. `cc`, `py`, `hs`, …).
258
+ - **`<language>`** — Target statement language (e.g. `en`, `ca`).
259
+ - **`[prompt]`** — Optional extra instructions for the AI.
260
+
261
+ **Options:**
262
+
263
+ - **`-d`, `--directory <path>`** — Problem directory (default: `.`).
264
+ - **`-m`, `--model <model>`** — AI model (default: from settings).
265
+
266
+ ### `generate solutions`
267
+
268
+ **Purpose:** Add **alternative solutions** in other programming languages, using the golden solution as reference. May overwrite files.
269
+
270
+ **Arguments:**
271
+
272
+ - **`<proglangs...>`** — One or more language keys (e.g. `py`, `java`, `rs`).
273
+
274
+ **Options:**
275
+
276
+ - **`-d`, `--directory <path>`** — Problem directory (default: `.`).
277
+ - **`-m`, `--model <model>`** — AI model (default: from settings).
278
+
279
+ ### `generate mains`
280
+
281
+ **Purpose:** Generate **main** entry files for languages where the student implements functions/classes (not a full program).
282
+
283
+ **Arguments:**
284
+
285
+ - **`<proglangs...>`** — Target languages.
286
+
287
+ **Options:**
288
+
289
+ - **`-d`, `--directory <path>`** — Problem directory (default: `.`).
290
+ - **`-m`, `--model <model>`** — AI model (default: from settings).
291
+
292
+ ### `generate generators`
293
+
294
+ **Purpose:** Generate **Python test-case generator** scripts (random, hard, efficiency).
295
+
296
+ **Options:**
297
+
298
+ - **`--random`** — Generator for random tests.
299
+ - **`--hard`** — Generator for hard tests.
300
+ - **`--efficiency`** — Generator for efficiency tests.
301
+ - **`--all`** — All three.
302
+ - **`-d`, `--directory <path>`** — Problem directory (default: `.`).
303
+ - **`-o`, `--output <path>`** — Output filename pattern (default: `generator-{{type}}.py`).
304
+ - **`-m`, `--model <model>`** — AI model (default: from settings).
305
+
306
+ ### `generate award.png`
307
+
308
+ **Purpose:** Generate an **award image** (shown when a user solves the problem) via an image model.
309
+
310
+ **Arguments:**
311
+
312
+ - **`[prompt]`** — What to depict; if empty, a default prompt is used.
313
+
314
+ **Options:**
315
+
316
+ - **`-d`, `--directory <path>`** — Problem directory (default: `.`).
317
+ - **`-m`, `--model <model>`** — Image model (default: `openai/dall-e-3`).
318
+
319
+ ### `generate award.html`
320
+
321
+ **Purpose:** Generate a short **award message** (HTML) for successful solvers.
322
+
323
+ **Arguments:**
324
+
325
+ - **`[prompt]`** — Instructions for the message (default prompt is built in).
326
+
327
+ **Options:**
328
+
329
+ - **`-d`, `--directory <path>`** — Problem directory (default: `.`).
330
+ - **`-m`, `--model <model>`** — AI model (default: from settings).
331
+
332
+ ---
333
+
334
+ ## `verify`
335
+
336
+ **Purpose:** Check that **candidate solutions** (e.g. `solution.py`, `alt.cc`) produce the **same outputs** as the **golden** solution on the problem’s tests—without submitting to the website.
337
+
338
+ **Arguments:**
339
+
340
+ - **`<programs...>`** — Solution filenames to verify.
341
+
342
+ **Options:**
343
+
344
+ - **`-d`, `--directory <path>`** — Problem directory (default: `.`).
345
+
346
+ ---
347
+
348
+ ## `lint`
349
+
350
+ **Purpose:** **Validate** your problem folder: configuration (`handler.yml`, schemas, …) and related rules. Use this to catch mistakes before **`make`** or **`upload`**.
351
+
352
+ **Options:**
353
+
354
+ - **`-d`, `--directory <directory>`** — Problem directory (default: `.`).
355
+ - **`-v`, `--verbose`** — Also show checks that passed.
356
+
357
+ Exit code is non-zero if there are **errors** (warnings alone may still pass depending on implementation).
358
+
359
+ ---
360
+
361
+ ## `metrics`
362
+
363
+ **Purpose:** Print **multimetric “overall”** complexity-style metrics for the given **source files** (useful for reviewing student or solution code). This is **not** the same as `lint`; it analyzes listed files.
364
+
365
+ **Arguments:**
366
+
367
+ - **`<files...>`** — One or more source file paths (required).
368
+
369
+ ---
370
+
371
+ ## `submit`
372
+
373
+ **Purpose:** **Submit** programs to Jutge.org **as if you were a student**, to see verdicts (useful for authors testing their own problem). Uses login and browser integration as configured.
374
+
375
+ **Arguments:**
376
+
377
+ - **`<programs...>`** — Files to submit (e.g. `solution.cc` `slow.py`).
378
+
379
+ **Options:**
380
+
381
+ - **`-d`, `--directory <directory>`** — Problem directory (default: `.`).
382
+ - **`-c`, `--compiler <id>`** — Compiler id (default: `auto` — detect from file extension).
383
+ - **`-l`, `--language <code>`** — Statement/UI language (e.g. `ca`, `es`, `en`; default: `en`).
384
+ - **`-n`, `--no-wait`** — Do not wait for judging to finish.
385
+ - **`--no-browser`** — Do not open the submission page in a browser; still prints URL and/or waits in the terminal depending on other flags.
386
+ - **`-a`, `--annotation <text>`** — Label for the submission (default: auto-generated `jtk-submit-…`).
387
+
388
+ ---
389
+
390
+ ## `convert`
391
+
392
+ **Purpose:** **Migrate** old statement markup to new formats. With no subcommand, prints help.
393
+
394
+ ### `convert transform-at-signs`
395
+
396
+ **Purpose:** In each `problem.<lang>.tex`, replace legacy **`@code@`** inline markers with LaTeX **`\lstinline|...|`**. Backs up the original as `problem.<lang>.tex.original.bak` when changes are made.
397
+
398
+ **Options:**
399
+
400
+ - **`-d`, `--directory <directory>`** — Problem directory (default: `.`).
401
+
402
+ ---
403
+
404
+ ## `stage`
405
+
406
+ **Purpose:** **Stage** the problem: prepare a layout suitable for packaging or further processing (implementation details depend on the stager). Authors use this as a step before distribution or checks.
407
+
408
+ **Options:**
409
+
410
+ - **`-d`, `--directory <directory>`** — Problem directory (default: `.`).
411
+ - **`-p`, `--problem_nm <id>`** — Problem id (default: `DRAFT`).
412
+
413
+ ---
414
+
415
+ ## `doctor`
416
+
417
+ **Purpose:** **Diagnose your machine**: check that interpreters, compilers, and tools the toolkit may call (Python, GCC, Haskell, Clojure, Java, Rust, Verilog, R, CodeMetrics, XeLaTeX, Pandoc, terminal capabilities) are installed and usable. Use this when **`make`** or **`verify`** fails and you suspect a missing dependency.
418
+
419
+ No arguments or options at the top level.
420
+
421
+ ---
422
+
423
+ ## `config`
424
+
425
+ **Purpose:** Manage **toolkit settings** stored in a YAML file (path is printed when you run `jtk config --help` or `config show`). Typical keys include your **name**, **email**, **default AI model**, **notifications**, and **developer** flag.
426
+
427
+ Running **`jtk config`** with no subcommand prints help.
428
+
429
+ ### `config show` (alias: `config list`)
430
+
431
+ **Purpose:** Print the full configuration as YAML.
432
+
433
+ ### `config get <key>`
434
+
435
+ **Purpose:** Print a **single** setting value.
436
+
437
+ ### `config set <key> <value>`
438
+
439
+ **Purpose:** Set a key. Values are parsed (booleans, numbers, strings) automatically.
440
+
441
+ ### `config edit`
442
+
443
+ **Purpose:** Open the configuration in your **editor** (`$EDITOR` or `$VISUAL`). Invalid YAML/schema errors are reported; you can retry or cancel.
444
+
445
+ ### `config reset`
446
+
447
+ **Purpose:** Restore **defaults**.
448
+
449
+ **Options:**
450
+
451
+ - **`-f`, `--force`** — Skip confirmation.
452
+
453
+ ---
454
+
455
+ ## `upgrade`
456
+
457
+ **Purpose:** **Update** the installed toolkit to the **latest** version (mechanism depends on how you installed the package).
458
+
459
+ No arguments or options.
460
+
461
+ ---
462
+
463
+ ## `completion`
464
+
465
+ **Purpose:** **Tab completion**: print scripts or install them so your shell can suggest `jtk` subcommands and options when you press Tab.
466
+
467
+ Running **`jtk completion`** with no subcommand prints help.
468
+
469
+ ### `completion bash` | `completion zsh` | `completion fish` | `completion powershell`
470
+
471
+ **Purpose:** Print the completion script for that shell to **stdout** (you can save it manually).
472
+
473
+ ### `completion install [shell]`
474
+
475
+ **Purpose:** **Install** completion for the current shell, or for a named shell: `bash`, `zsh`, `fish`, or `powershell`. May create or update files under your home directory and print **restart** or **source** instructions.
476
+
477
+ ---
478
+
479
+ ## `about`
480
+
481
+ **Purpose:** Show the toolkit **version**, **description**, **homepage**, **authors**, **contributors**, and a link to documentation.
482
+
483
+ No arguments or options.
484
+
485
+ ---
486
+
487
+ ## `ask`
488
+
489
+ **Purpose:** Ask a **natural-language question** about the toolkit; answers are generated by **JutgeAI** using bundled docs and source as context. **Not authoritative**—use for hints; verify against this reference and official docs.
490
+
491
+ **Arguments:**
492
+
493
+ - **`[question]`** — Your question (optional; can be empty in edge cases).
494
+
495
+ **Options:**
496
+
497
+ - **`-m`, `--model <model>`** — AI model (default: from settings).
498
+
499
+ Requires **login** to Jutge like other AI features.
500
+
501
+ ---
502
+
503
+ ## `for-dummies` / `interactive`
504
+
505
+ **Purpose:** **Interactive menus** that walk you through choosing a command and entering arguments/options via prompts—useful if you do not remember command names or prefer not to type flags.
506
+
507
+ No required arguments; the command navigates subcommands of the main program and then runs the selected tool.
508
+
509
+ ---
510
+
511
+ ## `quiz`
512
+
513
+ **Purpose:** Work with **quiz** handler problems (different from standard stdin/stdout tasks).
514
+
515
+ Running **`jtk quiz`** with no subcommand prints help.
516
+
517
+ ### `quiz lint`
518
+
519
+ **Purpose:** Run **quiz-specific** checks in the problem directory.
520
+
521
+ **Options:**
522
+
523
+ - **`-d`, `--directory <directory>`** — Problem directory (default: `.`).
524
+
525
+ ### `quiz run`
526
+
527
+ **Purpose:** **Execute** the quiz and print the resulting object (random seed if not given).
528
+
529
+ **Options:**
530
+
531
+ - **`-d`, `--directory <directory>`** — Problem directory (default: `.`).
532
+ - **`-s`, `--seed <seed>`** — Random seed (integer).
533
+ - **`-f`, `--format <format>`** — `json` or `yaml` (default: `json`).
534
+
535
+ ### `quiz play`
536
+
537
+ **Purpose:** **Interactive** quiz session: answer questions, optionally review, then see results. Input can be a JSON file from **`quiz run`**, or a new run from a directory.
538
+
539
+ **Options:**
540
+
541
+ - **`-i`, `--input <file>`** — JSON from `quiz run`.
542
+ - **`-o`, `--output <file>`** — Write results (answers, correctness, scores).
543
+ - **`-d`, `--directory <directory>`** — Used when `--input` is omitted (default: `.`).
544
+ - **`-s`, `--seed <seed>`** — Used when `--input` is omitted.
545
+
546
+ ---
547
+
548
+ ## Configuration keys (reference)
549
+
550
+ These are the settings keys defined in the toolkit schema (see `jtk config show`):
551
+
552
+ | Key | Meaning |
553
+ | --------------- | --------------------------------------------------------------- |
554
+ | `name` | Display name (default placeholder in schema). |
555
+ | `email` | Your email (for identification / account-related features). |
556
+ | `defaultModel` | Default AI model id for `generate`, `ask`, etc. |
557
+ | `notifications` | Toggle notifications (meaning depends on platform integration). |
558
+ | `showPrompts` | Whether to show prompts in interactive flows. |
559
+ | `showAnswers` | Whether to show answers in teaching/quiz-style flows. |
560
+ | `developer` | Enable extra commands (`quiz`, `compilers`). |
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@jutge.org/toolkit",
3
3
  "description": "Toolkit to prepare problems for Jutge.org",
4
- "version": "4.4.36",
4
+ "version": "4.4.38",
5
5
  "homepage": "https://jutge.org",
6
6
  "author": {
7
7
  "name": "Jutge.org",
package/toolkit/index.ts CHANGED
@@ -25,6 +25,7 @@ import { askCmd } from './ask'
25
25
  import { convertCmd } from './convert'
26
26
  import { stageCmd } from './stage'
27
27
  import { lintCmd } from './lint'
28
+ import { metricsCmd } from './metrics'
28
29
  import { completeInternalCmd, completionCmd } from './completion'
29
30
  import { dummiesCmd } from './dummies'
30
31
 
@@ -45,12 +46,13 @@ program.addCommand(downloadCmd)
45
46
  program.addCommand(generateCmd)
46
47
  program.addCommand(verifyCmd)
47
48
  program.addCommand(lintCmd)
49
+ program.addCommand(metricsCmd)
48
50
  program.addCommand(submitCmd)
49
51
  program.addCommand(convertCmd)
50
52
  program.addCommand(stageCmd)
51
53
  program.addCommand(doctorCmd)
54
+ program.addCommand(quizCmd)
52
55
  if (settings.developer) {
53
- program.addCommand(quizCmd)
54
56
  program.addCommand(compilersCmd)
55
57
  }
56
58
  program.addCommand(configCmd)
@@ -0,0 +1,20 @@
1
+ import { Command } from '@commander-js/extra-typings'
2
+ import { collectMultimetricOverall } from '../lib/metrics'
3
+ import tui from '../lib/tui'
4
+
5
+ export const metricsCmd = new Command('metrics')
6
+ .summary('Print multimetric overall metrics for source files')
7
+ .description(`Print multimetric overall metrics for source files
8
+
9
+ The metrics are calculated using the Python multimetric package.
10
+ See https://github.com/priv-kweihmann/multimetric for item structure and recommended thresholds.`)
11
+
12
+ .argument('<files...>', 'source files to analyze')
13
+
14
+ .action(async (files) => {
15
+ if (files.length === 0) {
16
+ throw new Error('At least one source file is required')
17
+ }
18
+ const metrics = await collectMultimetricOverall(files)
19
+ tui.yaml(metrics)
20
+ })