@jutge.org/toolkit 4.2.2 → 4.2.4

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.
@@ -69,12 +69,6 @@ Choose the installation instructions for your operating system:
69
69
  sudo apt-get install pandoc
70
70
  ```
71
71
 
72
- - **ImageMagick** (for image processing):
73
-
74
- ```bash
75
- sudo apt-get install imagemagick
76
- ```
77
-
78
72
  - **Python 3** (if using Python in your problems):
79
73
 
80
74
  ```bash
@@ -141,12 +135,6 @@ Choose the installation instructions for your operating system:
141
135
  brew install pandoc
142
136
  ```
143
137
 
144
- - **ImageMagick** (for image processing):
145
-
146
- ```bash
147
- brew install imagemagick
148
- ```
149
-
150
138
  - **Python 3** (if using Python):
151
139
 
152
140
  ```bash
@@ -206,12 +194,6 @@ Choose the installation instructions for your operating system:
206
194
  winget install --id JohnMacFarlane.Pandoc
207
195
  ```
208
196
 
209
- - **ImageMagick** (for image processing):
210
-
211
- ```powershell
212
- winget install --id ImageMagick.ImageMagick
213
- ```
214
-
215
197
  - **Python 3** (if using Python):
216
198
 
217
199
  Install from https://www.python.org/downloads/windows/. Make sure to check "Add Python to PATH" during installation.
package/docs/windows.md CHANGED
@@ -59,14 +59,6 @@ jtk --version
59
59
  winget install --id JohnMacFarlane.Pandoc
60
60
  ```
61
61
 
62
- - Image Magick: ImageMagick is required to process images in problem statements. It is not necessary but recommended.
63
-
64
- Install it easily using the Windows Package Manager (`winget`):
65
-
66
- ```powershell
67
- winget install --id ImageMagick.ImageMagick
68
- ```
69
-
70
62
  - Python 3: You only need Python 3 if you plan to use Python scripts in your problems.
71
63
 
72
64
  Install Python from https://www.python.org/downloads/windows/. Make sure to check the option to add Python to the system PATH during installation. The toolkit uses `python3` command to run Python scripts.
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.2.2",
4
+ "version": "4.2.4",
5
5
  "homepage": "https://jutge.org",
6
6
  "author": {
7
7
  "name": "Jutge.org",
@@ -28,13 +28,14 @@
28
28
  "type": "module",
29
29
  "bin": {
30
30
  "jutge-toolkit": "dist/index.js",
31
- "jtk": "dist/index.js"
31
+ "jtk": "dist/index.js",
32
+ "dev": "toolkit/index.ts"
32
33
  },
33
34
  "scripts": {
34
35
  "lint": "eslint .",
35
36
  "format": "bun prettier --write .",
36
37
  "depcheck": "bunx depcheck",
37
- "dev": "bun build --target bun --minify --outfile dist/index.js ./toolkit --watch",
38
+ "dev": "bun build --target bun --outfile dist/index.js ./toolkit --watch",
38
39
  "build": "bun build --target bun --minify --outfile dist/index.js ./toolkit ",
39
40
  "update-jutge-client": "(cd lib ; rm -f jutge_api_client.ts ; https --download https://api.jutge.org/clients/download/typescript)"
40
41
  },
@@ -47,15 +48,17 @@
47
48
  "dependencies": {
48
49
  "@commander-js/extra-typings": "^14.0.0",
49
50
  "@eslint/js": "^9.39.2",
50
- "@inquirer/prompts": "^8.1.0",
51
+ "@inquirer/prompts": "^8.2.0",
51
52
  "archiver": "^7.0.1",
52
53
  "boxen": "^8.0.1",
53
54
  "bun-types": "^1.3.5",
54
55
  "chalk": "^5.6.2",
56
+ "cli-highlight": "^2.1.11",
55
57
  "commander": "^14.0.2",
56
58
  "env-paths": "^3.0.0",
57
59
  "eslint": "^9.39.2",
58
60
  "execa": "^9.6.1",
61
+ "extract-zip": "^2.0.1",
59
62
  "gpt-tokenizer": "^3.4.0",
60
63
  "handlebars": "^4.7.8",
61
64
  "image-size": "^2.0.2",
@@ -75,18 +78,18 @@
75
78
  "terminal-image": "^4.1.0",
76
79
  "terminal-link": "^5.0.0",
77
80
  "tree-node-cli": "^1.6.0",
78
- "typescript-eslint": "^8.51.0",
79
81
  "yaml": "^2.8.2",
80
82
  "zod": "^4.3.4",
81
83
  "zod-package-json": "^2.1.0",
82
84
  "zod-validation-error": "^5.0.0"
83
85
  },
84
86
  "devDependencies": {
87
+ "typescript-eslint": "^8.51.0",
85
88
  "@types/archiver": "^7.0.0",
86
89
  "@types/image-size": "^0.8.0",
87
90
  "@types/marked": "^6.0.0",
88
91
  "@types/marked-terminal": "^6.1.1",
89
- "@types/node": "^25.0.3",
92
+ "@types/node": "^25.0.7",
90
93
  "@types/ora": "^3.2.0",
91
94
  "@types/semver": "^7.7.1"
92
95
  },
package/toolkit/doctor.ts CHANGED
@@ -14,8 +14,8 @@ export const doctorCmd = new Command('doctor')
14
14
  await tui.section('Checking Java installation', doc.checkJava)
15
15
  await tui.section('Checking Rust installation', doc.checkRust)
16
16
  await tui.section('Checking XeLaTeX installation', doc.checkXeLaTeX)
17
+ await tui.section('Checking PdfLaTeX installation', doc.checkPdfLaTeX)
17
18
  await tui.section('Checking Pandoc installation', doc.checkPandoc)
18
- await tui.section('Checking ImageMagick installation', doc.checkImageMagick)
19
19
  await tui.section('Checking AI models', doc.checkAIEnvVars)
20
20
  await tui.section('Checking terminal', doc.checkTerminal)
21
21
  })
@@ -161,16 +161,21 @@ Provide an interesting prompt to customize the image content. For example:
161
161
  - "A star made of sparkling diamonds on a black background."
162
162
  - "A minimalist image with a white background using Van Gogh style."
163
163
 
164
+ If no prompt is provided, the original problem title will be used.
165
+
164
166
  The new image will be saved as award.png in the problem directory, overriding any existing file.`,
165
167
  )
166
168
 
167
169
  .option('-d, --directory <path>', 'problem directory', '.')
168
170
  .option('-m, --model <model>', 'graphic AI model to use', 'openai/dall-e-3')
169
- .argument('[prompt]', 'prompt to generate the image', 'A colorful image on a white background. ')
171
+ .argument('[prompt]', 'prompt to generate the image', '')
170
172
 
171
173
  .action(async (prompt, { directory, model }) => {
172
174
  const output = join(directory, 'award.png')
173
175
  const problem = await newProblem(directory)
176
+ if (prompt.trim() === '') {
177
+ prompt = problem.problemLangYmls[problem.originalLanguage!].title || 'A colorful award'
178
+ }
174
179
  const image = await generateImage(model, prompt)
175
180
  await sharp(image).resize(512, 512).toFile(output)
176
181
  await tui.image(output, 20, 10)
package/toolkit/index.ts CHANGED
@@ -25,6 +25,7 @@ program.alias(Object.keys(packageJson.bin as Record<string, string>)[1] as strin
25
25
  program.version(packageJson.version)
26
26
  program.description(packageJson.description!)
27
27
  program.helpCommand('help [command]', 'Display help for command') // To get the message with uppercase :-)
28
+ program.addHelpText('after', '\nMore documentation:\n https://github.com/jutge-org/new-jutge-toolkit/tree/main/docs')
28
29
 
29
30
  program.addCommand(configCmd)
30
31
  program.addCommand(cloneCmd)
package/toolkit/make.ts CHANGED
@@ -49,7 +49,7 @@ export const makeCmd = new Command('make')
49
49
  await maker.makeExecutables()
50
50
  }
51
51
  if (tasks.includes('cor')) {
52
- await maker.makeCorrects()
52
+ await maker.makeCorrectOutputs()
53
53
  }
54
54
  if (tasks.includes('pdf')) {
55
55
  await maker.makePdfStatements()
package/toolkit/upload.ts CHANGED
@@ -1,6 +1,5 @@
1
1
  import { Command } from '@commander-js/extra-typings'
2
- import { uploadProblem } from '../lib/upload'
3
- import { newProblem } from '../lib/problem'
2
+ import { uploadProblemInDirectory } from '../lib/upload'
4
3
 
5
4
  export const uploadCmd = new Command('upload')
6
5
  .summary('Upload problem to Jutge.org')
@@ -15,6 +14,5 @@ If problem.yml does not exist, a new problem will be created at Jutge.org and pr
15
14
  .option('-d, --directory <directory>', 'problem directory', '.')
16
15
 
17
16
  .action(async ({ directory }) => {
18
- const problem = await newProblem(directory)
19
- await uploadProblem(problem)
17
+ await uploadProblemInDirectory(directory)
20
18
  })