@jutge.org/toolkit 4.2.3 → 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.
- package/dist/index.js +636 -678
- package/package.json +9 -6
- package/toolkit/doctor.ts +1 -0
- package/toolkit/generate.ts +6 -1
- package/toolkit/make.ts +1 -1
- package/toolkit/upload.ts +2 -4
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.
|
|
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 --
|
|
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.
|
|
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.
|
|
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,6 +14,7 @@ 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
19
|
await tui.section('Checking AI models', doc.checkAIEnvVars)
|
|
19
20
|
await tui.section('Checking terminal', doc.checkTerminal)
|
package/toolkit/generate.ts
CHANGED
|
@@ -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', '
|
|
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/make.ts
CHANGED
package/toolkit/upload.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { Command } from '@commander-js/extra-typings'
|
|
2
|
-
import {
|
|
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
|
-
|
|
19
|
-
await uploadProblem(problem)
|
|
17
|
+
await uploadProblemInDirectory(directory)
|
|
20
18
|
})
|