@jutge.org/toolkit 4.4.51 → 4.4.53
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 +646 -562
- package/docs/reference.md +1 -1
- package/package.json +36 -36
- package/toolkit/convert.ts +8 -1
- package/toolkit/generate.ts +1 -1
- package/toolkit/lint.ts +5 -7
- package/toolkit/metrics.ts +4 -2
- package/toolkit/quiz.ts +5 -8
- package/toolkit/share.ts +5 -3
package/docs/reference.md
CHANGED
|
@@ -314,7 +314,7 @@ Running **`jtk generate`** with no subcommand prints help.
|
|
|
314
314
|
**Options:**
|
|
315
315
|
|
|
316
316
|
- **`-d`, `--directory <path>`** — Problem directory (default: `.`).
|
|
317
|
-
- **`-m`, `--model <model>`** — Image model (default: `openai/
|
|
317
|
+
- **`-m`, `--model <model>`** — Image model (default: `openai/gpt-image-2.5-sunburst`).
|
|
318
318
|
|
|
319
319
|
### `generate award.html`
|
|
320
320
|
|
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.
|
|
4
|
+
"version": "4.4.53",
|
|
5
5
|
"homepage": "https://jutge.org",
|
|
6
6
|
"author": {
|
|
7
7
|
"name": "Jutge.org",
|
|
@@ -60,55 +60,55 @@
|
|
|
60
60
|
"assets"
|
|
61
61
|
],
|
|
62
62
|
"dependencies": {
|
|
63
|
-
"@commander-js/extra-typings": "^
|
|
64
|
-
"@dicebear/collection": "^9.
|
|
65
|
-
"@dicebear/core": "^9.
|
|
63
|
+
"@commander-js/extra-typings": "^15.0.0",
|
|
64
|
+
"@dicebear/collection": "^9.4.2",
|
|
65
|
+
"@dicebear/core": "^9.4.2",
|
|
66
66
|
"@eslint/js": "^10.0.1",
|
|
67
|
-
"@inquirer/prompts": "^8.
|
|
68
|
-
"adm-zip": "^0.
|
|
69
|
-
"archiver": "^
|
|
70
|
-
"boxen": "^
|
|
71
|
-
"bun-types": "^1.
|
|
72
|
-
"chalk": "^
|
|
73
|
-
"chokidar": "^
|
|
67
|
+
"@inquirer/prompts": "^8.7.5",
|
|
68
|
+
"adm-zip": "^0.6.1",
|
|
69
|
+
"archiver": "^8.0.0",
|
|
70
|
+
"boxen": "^9.0.0",
|
|
71
|
+
"bun-types": "^1.4.4",
|
|
72
|
+
"chalk": "^6.0.1",
|
|
73
|
+
"chokidar": "^6.0.0",
|
|
74
74
|
"cli-highlight": "^2.1.11",
|
|
75
75
|
"cli-table3": "^0.6.5",
|
|
76
|
-
"commander": "^
|
|
77
|
-
"dayjs": "^1.11.
|
|
76
|
+
"commander": "^15.0.0",
|
|
77
|
+
"dayjs": "^1.11.23",
|
|
78
78
|
"env-paths": "^4.0.0",
|
|
79
|
-
"eslint": "^10.0
|
|
80
|
-
"execa": "^
|
|
81
|
-
"handlebars": "^4.7.
|
|
82
|
-
"image-size": "^2.0.
|
|
83
|
-
"inquirer-checkbox-plus-plus": "^1.
|
|
84
|
-
"marked": "^
|
|
85
|
-
"marked-terminal": "^
|
|
86
|
-
"nanoid": "^
|
|
87
|
-
"open": "^11.0.
|
|
88
|
-
"pretty-bytes": "^7.
|
|
89
|
-
"pretty-ms": "^
|
|
79
|
+
"eslint": "^10.14.0",
|
|
80
|
+
"execa": "^10.2.1",
|
|
81
|
+
"handlebars": "^4.7.10",
|
|
82
|
+
"image-size": "^2.0.4",
|
|
83
|
+
"inquirer-checkbox-plus-plus": "^1.2.0",
|
|
84
|
+
"marked": "^18.1.2",
|
|
85
|
+
"marked-terminal": "^8.0.0",
|
|
86
|
+
"nanoid": "^6.0.2",
|
|
87
|
+
"open": "^11.0.4",
|
|
88
|
+
"pretty-bytes": "^7.2.0",
|
|
89
|
+
"pretty-ms": "^10.0.0",
|
|
90
90
|
"radash": "^12.1.1",
|
|
91
|
-
"semver": "^7.
|
|
92
|
-
"sharp": "^0.
|
|
91
|
+
"semver": "^7.8.5",
|
|
92
|
+
"sharp": "^0.35.5",
|
|
93
93
|
"terminal-link": "^5.0.0",
|
|
94
|
-
"tree-node-cli": "^
|
|
95
|
-
"yaml": "^2.
|
|
96
|
-
"zod": "^4.
|
|
94
|
+
"tree-node-cli": "^3.0.0",
|
|
95
|
+
"yaml": "^2.9.1",
|
|
96
|
+
"zod": "^4.6.7",
|
|
97
97
|
"zod-package-json": "^2.1.0",
|
|
98
98
|
"zod-validation-error": "^5.0.0"
|
|
99
99
|
},
|
|
100
100
|
"devDependencies": {
|
|
101
|
-
"@types/adm-zip": "^0.
|
|
102
|
-
"@types/archiver": "^
|
|
101
|
+
"@types/adm-zip": "^0.6.0",
|
|
102
|
+
"@types/archiver": "^8.0.0",
|
|
103
103
|
"@types/image-size": "^0.8.0",
|
|
104
104
|
"@types/marked-terminal": "^6.1.1",
|
|
105
|
-
"@types/node": "^
|
|
106
|
-
"@types/semver": "^7.
|
|
107
|
-
"prettier": "^3.
|
|
108
|
-
"typescript-eslint": "^8.
|
|
105
|
+
"@types/node": "^26.6.6",
|
|
106
|
+
"@types/semver": "^7.8.0",
|
|
107
|
+
"prettier": "^3.9.10",
|
|
108
|
+
"typescript-eslint": "^8.72.1"
|
|
109
109
|
},
|
|
110
110
|
"peerDependencies": {
|
|
111
|
-
"typescript": "^
|
|
111
|
+
"typescript": "^7.0.2"
|
|
112
112
|
},
|
|
113
113
|
"prettier": {
|
|
114
114
|
"semi": false,
|
package/toolkit/convert.ts
CHANGED
|
@@ -23,7 +23,14 @@ convertCmd
|
|
|
23
23
|
for (const realDirectory of realDirectories) {
|
|
24
24
|
await tui.section(`Processing ${realDirectory}`, async () => {
|
|
25
25
|
const problem = await newProblem(realDirectory)
|
|
26
|
-
|
|
26
|
+
// Single structure keeps one language per directory (ca/, en/, …).
|
|
27
|
+
// findRealDirectories visits each of those directories on its own,
|
|
28
|
+
// so only the statement in the current directory belongs here.
|
|
29
|
+
const languages =
|
|
30
|
+
problem.structure === 'single' && problem.language
|
|
31
|
+
? problem.languages.filter((language) => language === problem.language)
|
|
32
|
+
: problem.languages
|
|
33
|
+
for (const language of languages) {
|
|
27
34
|
await tui.section(`Converting problem.${language}.tex`, async () => {
|
|
28
35
|
const originalText = await readTextInDir(realDirectory, `problem.${language}.tex`)
|
|
29
36
|
const convertedText = replaceAtSigns(originalText)
|
package/toolkit/generate.ts
CHANGED
|
@@ -274,7 +274,7 @@ The new image will be saved as award.png in the problem directory, overriding an
|
|
|
274
274
|
)
|
|
275
275
|
|
|
276
276
|
.option('-d, --directory <path>', 'problem directory', '.')
|
|
277
|
-
.option('-m, --model <model>', 'graphic AI model to use', 'openai/
|
|
277
|
+
.option('-m, --model <model>', 'graphic AI model to use', 'openai/gpt-image-2.5-sunburst')
|
|
278
278
|
.argument('[prompt]', 'prompt to generate the image', '')
|
|
279
279
|
|
|
280
280
|
.action(async (prompt, { directory, model }) => {
|
package/toolkit/lint.ts
CHANGED
|
@@ -7,18 +7,17 @@ import tui from '../lib/tui'
|
|
|
7
7
|
|
|
8
8
|
export function formatLintIssue(issue: LintIssue): string {
|
|
9
9
|
// Pad path to 20 spaces, left-aligned file path before the code/info
|
|
10
|
-
const pathPart = issue.path ? chalk.gray(`${issue.path.padEnd(20, ' ')}`) : ' '.repeat(20)
|
|
11
|
-
const prefix = issue.severity === 'error' ? chalk.red('×') : chalk.yellow('⚠️')
|
|
12
|
-
return `${prefix} ${pathPart} ${issue.code}: ${issue.message}
|
|
10
|
+
const pathPart = issue.path ? chalk.gray(`${issue.path.padEnd(20, ' ')}`) : ' '.repeat(20)
|
|
11
|
+
const prefix = issue.severity === 'error' ? chalk.red('×') : chalk.yellow('⚠️')
|
|
12
|
+
return `${prefix} ${pathPart} ${issue.code}: ${issue.message}`
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
export function formatLintPassed(passed: LintPassed): string {
|
|
16
16
|
// Pad path to 20 spaces, left-aligned file path before the code/info
|
|
17
|
-
const pathPart = passed.path ? chalk.gray(`${passed.path.padEnd(20, ' ')}`) : ' '.repeat(20)
|
|
18
|
-
return `${chalk.green('✓')} ${pathPart} ${passed.code}: ${passed.message}
|
|
17
|
+
const pathPart = passed.path ? chalk.gray(`${passed.path.padEnd(20, ' ')}`) : ' '.repeat(20)
|
|
18
|
+
return `${chalk.green('✓')} ${pathPart} ${passed.code}: ${passed.message}`
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
-
|
|
22
21
|
export function printLintResults(
|
|
23
22
|
results: LintResult[],
|
|
24
23
|
directories: string[],
|
|
@@ -64,7 +63,6 @@ export const lintCmd = new Command('lint')
|
|
|
64
63
|
.option('-v, --verbose', 'show all validations, including passed checks')
|
|
65
64
|
|
|
66
65
|
.action(async ({ directory, verbose }) => {
|
|
67
|
-
|
|
68
66
|
await tui.section(`Linting ${tui.hyperlink(resolve(directory))}`, async () => {
|
|
69
67
|
const results = await lintDirectories([directory], { verbose })
|
|
70
68
|
if (results.length === 0) throw new Error(noProblemDirsMessage)
|
package/toolkit/metrics.ts
CHANGED
|
@@ -4,10 +4,12 @@ import tui from '../lib/tui'
|
|
|
4
4
|
|
|
5
5
|
export const metricsCmd = new Command('metrics')
|
|
6
6
|
.summary('Print multimetric overall metrics for source files')
|
|
7
|
-
.description(
|
|
7
|
+
.description(
|
|
8
|
+
`Print multimetric overall metrics for source files
|
|
8
9
|
|
|
9
10
|
The metrics are calculated using the Python multimetric package.
|
|
10
|
-
See https://github.com/priv-kweihmann/multimetric for item structure and recommended thresholds
|
|
11
|
+
See https://github.com/priv-kweihmann/multimetric for item structure and recommended thresholds.`,
|
|
12
|
+
)
|
|
11
13
|
|
|
12
14
|
.argument('<files...>', 'source files to analyze')
|
|
13
15
|
|
package/toolkit/quiz.ts
CHANGED
|
@@ -1,10 +1,6 @@
|
|
|
1
1
|
import { Command } from '@commander-js/extra-typings'
|
|
2
2
|
import { runQuiz, lintQuiz } from '../lib/quiz'
|
|
3
|
-
import {
|
|
4
|
-
loadQuizTestInput,
|
|
5
|
-
playQuiz,
|
|
6
|
-
writeQuizTestOutput,
|
|
7
|
-
} from '../lib/play-quiz'
|
|
3
|
+
import { loadQuizTestInput, playQuiz, writeQuizTestOutput } from '../lib/play-quiz'
|
|
8
4
|
import tui from '../lib/tui'
|
|
9
5
|
import { findRealDirectories } from '../lib/helpers'
|
|
10
6
|
import { random } from 'radash'
|
|
@@ -39,7 +35,8 @@ quizCmd
|
|
|
39
35
|
|
|
40
36
|
This command will run the quiz problem and print the resulting object to stdout.
|
|
41
37
|
A random seed will be generated if not provided.
|
|
42
|
-
|
|
38
|
+
`,
|
|
39
|
+
)
|
|
43
40
|
|
|
44
41
|
.option('-d, --directory <directory>', 'problem directory', '.')
|
|
45
42
|
.option('-s, --seed <seed>', 'random seed')
|
|
@@ -55,14 +52,14 @@ A random seed will be generated if not provided.
|
|
|
55
52
|
}
|
|
56
53
|
})
|
|
57
54
|
|
|
58
|
-
|
|
59
55
|
quizCmd
|
|
60
56
|
.command('play')
|
|
61
57
|
.summary('Play a quiz problem')
|
|
62
58
|
.description(
|
|
63
59
|
`Play an interactive quiz test. Questions are shown in sequence; you can review and change answers before submitting.
|
|
64
60
|
Input is a JSON file from \`quiz run\`; if --input is omitted, a run is generated with a random seed from the given directory.
|
|
65
|
-
If --output is given, the results (your answers, correct answers, and score per question) are written to that file
|
|
61
|
+
If --output is given, the results (your answers, correct answers, and score per question) are written to that file.`,
|
|
62
|
+
)
|
|
66
63
|
|
|
67
64
|
.option('-i, --input <input>', 'input JSON file from quiz run')
|
|
68
65
|
.option('-o, --output <output>', 'output file for results')
|
package/toolkit/share.ts
CHANGED
|
@@ -49,7 +49,8 @@ Finally, it updates problem.yml file with the current sharing settings and shows
|
|
|
49
49
|
await updateSharingSettings(opts.directory, { passcode, testcases, solutions })
|
|
50
50
|
})
|
|
51
51
|
|
|
52
|
-
cmdShare
|
|
52
|
+
cmdShare
|
|
53
|
+
.command('show')
|
|
53
54
|
.summary('Show sharing settings')
|
|
54
55
|
.description(
|
|
55
56
|
`Show sharing settings
|
|
@@ -62,7 +63,8 @@ This command shows the current sharing settings for the problem.
|
|
|
62
63
|
await showSharingSettings(directory)
|
|
63
64
|
})
|
|
64
65
|
|
|
65
|
-
cmdShare
|
|
66
|
+
cmdShare
|
|
67
|
+
.command('with')
|
|
66
68
|
.summary('Share passcode with users')
|
|
67
69
|
.description(
|
|
68
70
|
`Share passcode with users
|
|
@@ -80,4 +82,4 @@ Valid users will be have the problem passcode added to their account and will re
|
|
|
80
82
|
|
|
81
83
|
.action(async (emails, { directory, text }) => {
|
|
82
84
|
await shareWith(directory, emails, text)
|
|
83
|
-
})
|
|
85
|
+
})
|