@barmark/cli 0.11.3 → 0.13.0
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/CHANGELOG.md +33 -1
- package/README.md +9 -3
- package/dist/args.js +1 -1
- package/dist/check.js +6 -1
- package/dist/help.js +2 -0
- package/dist/render.js +16 -0
- package/dist/report.js +9 -2
- package/package.json +6 -6
package/CHANGELOG.md
CHANGED
|
@@ -6,6 +6,36 @@ package uses [semantic versioning](https://semver.org/).
|
|
|
6
6
|
|
|
7
7
|
## [Unreleased]
|
|
8
8
|
|
|
9
|
+
## [0.13.0] - 2026-11-14
|
|
10
|
+
|
|
11
|
+
### Changed
|
|
12
|
+
|
|
13
|
+
- **`check` prints a problem's suggestion** (so do `part`, `transpose` and
|
|
14
|
+
`export`, which print problems the same way): `bad.chart.md:4: error: C(b2): "b2" is
|
|
15
|
+
not a tone a parenthesis can add (write C(b9))`, for errors and warnings.
|
|
16
|
+
`--format github` carries the same sentence in the annotation, and
|
|
17
|
+
`--format json` a `suggestion` field beside `message`, absent when there
|
|
18
|
+
is none. A problem with no suggestion prints as before.
|
|
19
|
+
- **`check`, `format`, `render` and the exports read a flat sixth, an
|
|
20
|
+
`add` before any tone and `Δ9`** (`F#m(b6)`, `Cadd13`, `CΔ9`), as
|
|
21
|
+
`barmark` now reads them.
|
|
22
|
+
- **Uses** barmark 0.24.0, @barmark/render 0.20.1, @barmark/musicxml
|
|
23
|
+
0.9.2, @barmark/score 0.6.1 and @barmark/midi 0.3.4 (and through them
|
|
24
|
+
@barmark/fretboard 0.1.1 and @barmark/sync 0.4.2).
|
|
25
|
+
|
|
26
|
+
## [0.12.0] - 2026-11-13
|
|
27
|
+
|
|
28
|
+
### Added
|
|
29
|
+
|
|
30
|
+
- **`render --diagrams guitar`** draws a strip of guitar chord diagrams
|
|
31
|
+
above the grid, and **`--left-handed`** mirrors them (it needs
|
|
32
|
+
`--diagrams`). Both are grid flags, refused with `--score`.
|
|
33
|
+
|
|
34
|
+
### Changed
|
|
35
|
+
|
|
36
|
+
- **Uses** @barmark/render 0.20.0 and @barmark/score 0.6.0, and through
|
|
37
|
+
render @barmark/fretboard 0.1.0, whose shapes the diagrams draw.
|
|
38
|
+
|
|
9
39
|
## [0.11.3] - 2026-11-12
|
|
10
40
|
|
|
11
41
|
### Changed
|
|
@@ -381,7 +411,9 @@ The first release of the `barmark` command. Uses `barmark` 0.8.0 and
|
|
|
381
411
|
- **The `barmark` command:** `check`, `format`, `render` and `transpose`
|
|
382
412
|
for `.chart.md` files, on npm and as standalone binaries.
|
|
383
413
|
|
|
384
|
-
[Unreleased]: https://github.com/kevinpeckham/barmark/compare/cli-v0.
|
|
414
|
+
[Unreleased]: https://github.com/kevinpeckham/barmark/compare/cli-v0.13.0...HEAD
|
|
415
|
+
[0.13.0]: https://github.com/kevinpeckham/barmark/compare/cli-v0.12.0...cli-v0.13.0
|
|
416
|
+
[0.12.0]: https://github.com/kevinpeckham/barmark/compare/cli-v0.11.3...cli-v0.12.0
|
|
385
417
|
[0.11.3]: https://github.com/kevinpeckham/barmark/compare/cli-v0.11.2...cli-v0.11.3
|
|
386
418
|
[0.11.2]: https://github.com/kevinpeckham/barmark/compare/cli-v0.11.1...cli-v0.11.2
|
|
387
419
|
[0.11.1]: https://github.com/kevinpeckham/barmark/compare/cli-v0.11.0...cli-v0.11.1
|
package/README.md
CHANGED
|
@@ -45,13 +45,19 @@ barmark format --check songs # list them and fail, for CI
|
|
|
45
45
|
barmark part Bass song.chart.md # one part of a chart of several
|
|
46
46
|
barmark render song.chart.md --out song.html # a standalone page, font included
|
|
47
47
|
barmark render --score song.chart.md --out song.html # the full engraved score
|
|
48
|
+
barmark render song.chart.md --diagrams guitar --left-handed --out song.html # with chord diagrams
|
|
48
49
|
barmark transpose song.chart.md --to E # or --semitones -2
|
|
49
50
|
```
|
|
50
51
|
|
|
51
|
-
|
|
52
|
+
A problem the parser can suggest a fix for ends with it, as `song.chart.md:4:
|
|
53
|
+
error: C(b2): "b2" is not a tone a parenthesis can add (write C(b9))`
|
|
54
|
+
(`check`, `export`, `part` and `transpose`; `--format json` gives it as a
|
|
55
|
+
`suggestion` field). `check --format json` prints the diagnostics for other tools. `render`
|
|
52
56
|
takes the renderer's options as flags: `--theme auto|light|dark`,
|
|
53
57
|
`--numerals nashville|roman`, `--no-bar-numbers`, `--rehearsal-letters`,
|
|
54
|
-
`--no-wrap`, `--columns shared|row`, `--
|
|
58
|
+
`--no-wrap`, `--columns shared|row`, `--diagrams guitar` (a strip of guitar
|
|
59
|
+
chord diagrams above the grid; `--left-handed` mirrors them),
|
|
60
|
+
`--diagnostics`, `--part <label>` to draw one part, and `--font-url <url>` to link the font
|
|
55
61
|
instead of embedding it. `barmark <command> --help` lists each command's
|
|
56
62
|
flags; `barmark --version` prints the versions of the CLI, its
|
|
57
63
|
libraries and Verovio.
|
|
@@ -67,7 +73,7 @@ it does the grid, `--part <label>` engraves that part alone, and
|
|
|
67
73
|
window or the paper, so the width decides how many bars go on a line,
|
|
68
74
|
not how big the page is). The grid's own flags (`--numerals`,
|
|
69
75
|
`--no-bar-numbers`, `--rehearsal-letters`, `--no-wrap`, `--columns`,
|
|
70
|
-
`--diagnostics`, `--font-url`) are usage errors with `--score`, and `--width` is one
|
|
76
|
+
`--diagrams`, `--left-handed`, `--diagnostics`, `--font-url`) are usage errors with `--score`, and `--width` is one
|
|
71
77
|
without it. A chart that won't engrave (one with errors, or no bars)
|
|
72
78
|
writes nothing: the reason goes to stderr as `song.chart.md: Line 5:
|
|
73
79
|
message`, and the exit code is 1. The score's text is set in Verovio's own
|
package/dist/args.js
CHANGED
|
@@ -17,7 +17,7 @@ export function parseFlags(args, options) {
|
|
|
17
17
|
export function oneOf(flag, value, allowed) {
|
|
18
18
|
if (allowed.includes(value))
|
|
19
19
|
return value;
|
|
20
|
-
const list = `${allowed.slice(0, -1).join(", ")} or ${allowed.at(-1)}`;
|
|
20
|
+
const list = allowed.length === 1 ? allowed[0] : `${allowed.slice(0, -1).join(", ")} or ${allowed.at(-1)}`;
|
|
21
21
|
throw new UsageError(`--${flag} must be ${list}, not "${value}"`);
|
|
22
22
|
}
|
|
23
23
|
/** `--semitones -2`: join a negative number to its flag, which parseArgs would read as a flag. */
|
package/dist/check.js
CHANGED
|
@@ -20,7 +20,12 @@ export async function check(args, io) {
|
|
|
20
20
|
if (format === "json") {
|
|
21
21
|
const files = results.map(({ path, diagnostics }) => ({
|
|
22
22
|
file: path,
|
|
23
|
-
diagnostics: diagnostics.map(({ line, severity, message }) => ({
|
|
23
|
+
diagnostics: diagnostics.map(({ line, severity, message, suggestion }) => ({
|
|
24
|
+
line,
|
|
25
|
+
severity,
|
|
26
|
+
message,
|
|
27
|
+
...(suggestion ? { suggestion } : {}),
|
|
28
|
+
})),
|
|
24
29
|
}));
|
|
25
30
|
io.stdout(`${JSON.stringify(files, null, 2)}\n`);
|
|
26
31
|
}
|
package/dist/help.js
CHANGED
|
@@ -72,6 +72,8 @@ The grid only:
|
|
|
72
72
|
--columns shared|row row: each row sizes its own bars, so a busy bar widens
|
|
73
73
|
only its own row (default shared: bar lines line up
|
|
74
74
|
down each section)
|
|
75
|
+
--diagrams guitar Show a strip of guitar chord diagrams above the grid
|
|
76
|
+
--left-handed With --diagrams: mirror the diagrams for a left hand
|
|
75
77
|
--diagnostics List the chart's problems below it
|
|
76
78
|
--font-url <url> Link the font instead of embedding it
|
|
77
79
|
`,
|
package/dist/render.js
CHANGED
|
@@ -13,6 +13,7 @@ import { DEFAULT_WIDTH, MAX_WIDTH, MIN_WIDTH, scoreBody } from "./score.js";
|
|
|
13
13
|
const THEMES = ["auto", "light", "dark"];
|
|
14
14
|
const NUMERALS = ["nashville", "roman"];
|
|
15
15
|
const COLUMNS = ["shared", "row"];
|
|
16
|
+
const DIAGRAMS = ["guitar"];
|
|
16
17
|
const escapeHtml = (text) => text.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">");
|
|
17
18
|
function htmlDocument(title, body) {
|
|
18
19
|
return `<!doctype html>
|
|
@@ -36,6 +37,8 @@ const FLAGS = {
|
|
|
36
37
|
"rehearsal-letters": { type: "boolean", default: false },
|
|
37
38
|
"no-wrap": { type: "boolean", default: false },
|
|
38
39
|
columns: { type: "string" },
|
|
40
|
+
diagrams: { type: "string" },
|
|
41
|
+
"left-handed": { type: "boolean", default: false },
|
|
39
42
|
diagnostics: { type: "boolean", default: false },
|
|
40
43
|
"font-url": { type: "string" },
|
|
41
44
|
part: { type: "string" },
|
|
@@ -49,6 +52,8 @@ const GRID_ONLY = [
|
|
|
49
52
|
"rehearsal-letters",
|
|
50
53
|
"no-wrap",
|
|
51
54
|
"columns",
|
|
55
|
+
"diagrams",
|
|
56
|
+
"left-handed",
|
|
52
57
|
"diagnostics",
|
|
53
58
|
"font-url",
|
|
54
59
|
];
|
|
@@ -80,8 +85,19 @@ function gridOptions(values, theme, io) {
|
|
|
80
85
|
options.wrap = false;
|
|
81
86
|
if (values.diagnostics)
|
|
82
87
|
options.diagnostics = true;
|
|
88
|
+
Object.assign(options, diagramOptions(values));
|
|
83
89
|
return Object.assign(options, columnsOption(values.columns));
|
|
84
90
|
}
|
|
91
|
+
/** `--diagrams guitar` as the strip, `--left-handed` as its hand; the hand alone has nothing to turn. */
|
|
92
|
+
function diagramOptions(values) {
|
|
93
|
+
if (values.diagrams === undefined) {
|
|
94
|
+
if (values["left-handed"])
|
|
95
|
+
throw new UsageError("--left-handed needs --diagrams");
|
|
96
|
+
return {};
|
|
97
|
+
}
|
|
98
|
+
const chordDiagrams = oneOf("diagrams", values.diagrams, DIAGRAMS);
|
|
99
|
+
return values["left-handed"] ? { chordDiagrams, diagramHand: "left" } : { chordDiagrams };
|
|
100
|
+
}
|
|
85
101
|
/** `--columns row` as the option; `shared`, the default, as none, so the page is the default's. */
|
|
86
102
|
function columnsOption(value) {
|
|
87
103
|
if (value === undefined)
|
package/dist/report.js
CHANGED
|
@@ -1,11 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A diagnostic's message, ending with what to write instead when the parser
|
|
3
|
+
* has a suggestion the message does not already spell out.
|
|
4
|
+
*/
|
|
5
|
+
const sentence = (d) => d.suggestion && !d.message.includes(d.suggestion)
|
|
6
|
+
? `${d.message} (write ${d.suggestion})`
|
|
7
|
+
: d.message;
|
|
1
8
|
export function textLine(path, d) {
|
|
2
|
-
return `${path}:${d.line}: ${d.severity}: ${d
|
|
9
|
+
return `${path}:${d.line}: ${d.severity}: ${sentence(d)}`;
|
|
3
10
|
}
|
|
4
11
|
/** GitHub's workflow-command escaping for a message. */
|
|
5
12
|
const escapeData = (text) => text.replace(/%/g, "%25").replace(/\r/g, "%0D").replace(/\n/g, "%0A");
|
|
6
13
|
export function githubLine(path, d) {
|
|
7
14
|
const file = escapeData(path).replace(/:/g, "%3A").replace(/,/g, "%2C");
|
|
8
|
-
return `::${d.severity} file=${file},line=${d.line}::${escapeData(d
|
|
15
|
+
return `::${d.severity} file=${file},line=${d.line}::${escapeData(sentence(d))}`;
|
|
9
16
|
}
|
|
10
17
|
const count = (n, noun) => `${n} ${noun}${n === 1 ? "" : "s"}`;
|
|
11
18
|
export function summary(files, errors, warnings) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@barmark/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.13.0",
|
|
4
4
|
"description": "The barmark command: check, format, render, transpose and export barmark chord charts (.chart.md) from the terminal and in CI.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -37,11 +37,11 @@
|
|
|
37
37
|
"url": "https://github.com/kevinpeckham/barmark/issues"
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"barmark": "0.
|
|
41
|
-
"@barmark/render": "0.
|
|
42
|
-
"@barmark/musicxml": "0.9.
|
|
43
|
-
"@barmark/midi": "0.3.
|
|
44
|
-
"@barmark/score": "0.
|
|
40
|
+
"barmark": "0.24.0",
|
|
41
|
+
"@barmark/render": "0.20.1",
|
|
42
|
+
"@barmark/musicxml": "0.9.2",
|
|
43
|
+
"@barmark/midi": "0.3.4",
|
|
44
|
+
"@barmark/score": "0.6.1",
|
|
45
45
|
"verovio": "6.4.1"
|
|
46
46
|
},
|
|
47
47
|
"scripts": {
|