@heroiclands/package-build 22.16.0 → 22.17.1

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/docs/commands.md CHANGED
@@ -382,9 +382,10 @@ package-build datefrom <calendar> <date>
382
382
 
383
383
  Reads the current content tree, resolves its world year and calendar eras, and
384
384
  prints `<year>.<day>[:HHMMSS]` to standard output. `<calendar>` is a calendar
385
- shortcode, full Address, or addressed era. The date uses the calendar's month
386
- name and era label, for example `23 Taranis 326 VR`. A date in a calendar with
387
- multiple eras must identify its era. A date must specify a day;
385
+ shortcode, full Address, or addressed era. The date follows the calendar's
386
+ `data.formats.std` pattern, or its first named pattern when `std` is absent.
387
+ For example, `MM/DD/Y GGG` reads `04/23/326 VR`. An era-relative year written
388
+ with `[yearInEra]` must identify its era. A date must specify a day;
388
389
  year-only and month-only dates do not identify one canonical day.
389
390
  Prefix the date with `~` to preserve an approximate value.
390
391
 
@@ -417,19 +418,20 @@ Express a canonical day in an authored calendar.
417
418
  **SYNOPSIS**
418
419
 
419
420
  ```
420
- package-build dateto <calendar> <canonical-date>
421
+ package-build dateto <calendar> <canonical-date> [--format <name>]
421
422
  ```
422
423
 
423
424
  **DESCRIPTION**
424
425
 
425
426
  Reads the current content tree, selects the era covering the canonical day, and
426
- prints the date with its named month and era label. The input is
427
+ prints the date using `data.formats.std`, or the first named pattern if `std`
428
+ is absent. The input is
427
429
  `<year>.<day>[:HHMMSS]`, optionally prefixed with `~`. A date in a gap between
428
430
  eras has no conversion.
429
431
 
430
432
  **OPTIONS**
431
433
 
432
- None.
434
+ `--format` selects another named pattern from the calendar note; pass its name as the value.
433
435
 
434
436
  **EXIT STATUS**
435
437
 
@@ -1710,82 +1712,118 @@ $ package-build docs item-fields --out docs/item-fields.md --title "Demo Item Fi
1710
1712
 
1711
1713
  [Configuration](configuration.md).
1712
1714
 
1713
- ### `package-build prose lint [path]`
1715
+ ### `package-build prose lint [path]` and `prose score [path]`
1714
1716
 
1715
1717
  **NAME**
1716
1718
 
1717
- Analyze note prose for readability and simpler wording.
1719
+ Review sentence readability or score each note against a package's prose bands.
1718
1720
 
1719
1721
  **SYNOPSIS**
1720
1722
 
1721
1723
  ```text
1722
- package-build prose lint [path] [--age <years>] [--threshold <count>] [--min-words <count>]
1724
+ package-build prose lint [path] [--age <years>] [--threshold <count>] [--min-words <count>] [--rules readability|simplify|all] [--fail-on-warning]
1725
+ package-build prose score [path] [--min-words <count>] [--fail-outside]
1723
1726
  ```
1724
1727
 
1725
1728
  **DESCRIPTION**
1726
1729
 
1727
- Run this command from the package root to review the readable prose in one
1728
- Markdown note or a content tree. Pass a note path while editing that note;
1729
- omit it to review the configured `paths.content` tree. A directory path scans
1730
- its Markdown files recursively and honors `skipDirectories`. A file path
1731
- analyzes that file alone, even if it sits in an excluded directory. The command
1732
- reads source files and writes nothing. It is an optional editorial check:
1733
- `package-build lint` and the normal lint scripts do not run it.
1730
+ Run the `lint` or `score` action from the package root. Pass a Markdown note while editing;
1731
+ omit the path to read the configured `paths.content` tree. A directory path
1732
+ scans Markdown files recursively and honors `skipDirectories`. A file path
1733
+ analyzes that file alone, even in an excluded directory. Both actions read
1734
+ source files and write nothing. They are optional editorial checks and are
1735
+ outside `package-build lint` and the normal build.
1734
1736
 
1735
1737
  Set defaults in `package-build.config.yaml` under `packageBuild.proseLint`:
1736
1738
 
1737
1739
  ```yaml
1738
1740
  packageBuild:
1739
- proseLint: { age: 21, threshold: 5, minWords: 8 }
1741
+ proseLint: { age: 21, threshold: 5, minWords: 8, rules: readability }
1742
+ proseScore:
1743
+ minWords: 80
1744
+ bands:
1745
+ flesch: { min: 45, max: 80 }
1746
+ syllablesPerWord: { max: 1.65 }
1740
1747
  ```
1741
1748
 
1742
- No configuration is required; the values above are the defaults. `age` is the
1749
+ No configuration is required. `proseLint` uses the defaults shown. The
1750
+ `proseScore` default is `minWords: 80` with no bands; the example bands express
1751
+ one package's editorial preference, not a toolchain standard. `age` is the
1743
1752
  intended reader's age in years. `threshold` is the number of seven readability
1744
1753
  algorithms that must classify a sentence as difficult before it is reported.
1745
1754
  For example, a threshold of 5 reports a sentence if five or more algorithms
1746
- flag it; a threshold of 7 reports only unanimous findings. `minWords` excludes
1747
- shorter sentences from readability analysis. Each setting is a positive integer,
1748
- and `threshold` must be at most 7. CLI options override individual settings:
1749
- `--min-words` overrides `minWords`, while `--age` and `--threshold` override
1750
- their matching keys.
1751
-
1752
- The command analyzes Markdown prose with `retext-english`,
1753
- `retext-readability`, and `retext-simplify`; `retext-stringify` completes the
1754
- text pipeline. YAML frontmatter, code blocks, wikilink addresses, and inline
1755
- expressions are excluded. Each suggestion is a warning with a file, line,
1755
+ flag it; a threshold of 7 reports only unanimous findings. Lint's `minWords`
1756
+ excludes shorter sentences. `rules: readability` reports difficult sentences;
1757
+ `simplify` reports wording suggestions; `all` reports both. The CLI options
1758
+ override individual settings. Lint numeric settings are positive integers;
1759
+ `threshold` is at most 7.
1760
+
1761
+ Lint analyzes Markdown paragraphs, including those in blockquotes, with `retext-english` and the selected
1762
+ readability or simplify rules; `retext-stringify` completes the text pipeline.
1763
+ Frontmatter, headings, lists, GFM tables, code blocks and inline code, image
1764
+ embeds, wikilinks, and inline expressions are excluded. The body of an ordinary
1765
+ directive such as `:::info` remains prose; SQL directive bodies are excluded.
1766
+ Each suggestion is a warning with a file, line,
1756
1767
  column, rule ID, confidence, offending sentence, and `expected` replacement
1757
1768
  list. The source location marks the difficult sentence or the specific phrase
1758
1769
  that could be simplified. Readability confidence is the number of algorithms
1759
1770
  that found the sentence difficult, out of seven. Simplify suggestions have no
1760
1771
  numeric confidence score, so they say `unscored`. `expected` lists suggested
1761
1772
  replacements; `[]` means the rule offers no replacement and may recommend
1762
- deleting a word or rewriting a sentence. Suggestions are advisory, are never
1763
- applied automatically, and do not make the command fail. Unreadable paths and
1764
- invalid options do.
1773
+ deleting a word or rewriting a sentence. Suggestions are advisory and are
1774
+ never applied automatically. `--fail-on-warning` makes a selected rule's
1775
+ suggestions an explicit exit-code gate.
1776
+
1777
+ Score uses the same paragraph selection. It reports Flesch reading ease,
1778
+ syllables per word, mean and longest sentence length, unfamiliar-word percentage
1779
+ against the Dale–Chall list, and nominalizations per thousand words. A
1780
+ nominalization is counted by its word ending (`-tion`, `-sion`, `-ment`,
1781
+ `-ness`, `-ity`, `-ance`, `-ence`, or `-ism`); this is a mechanical count, not a
1782
+ grammar judgment. Coverage is the percentage of readable body words included
1783
+ in the score: headings and lists count toward the body but are not scored.
1784
+ Review low-coverage notes in context. A note with fewer than score's `minWords`
1785
+ is reported as insufficient and is not compared with bands.
1786
+
1787
+ Under `packageBuild.proseScore.bands`, any of `flesch`, `syllablesPerWord`,
1788
+ `meanSentenceWords`, `longestSentenceWords`, `unfamiliarWordPercent`, and
1789
+ `nominalizationsPer1000Words` may set `min`, `max`, or both. Limits are finite
1790
+ numbers and a minimum cannot exceed a maximum. Violations are warnings. The
1791
+ directory summary pools sentence, word, and syllable counts across sufficiently
1792
+ long notes before computing Flesch; it is not an average of note scores.
1793
+ `--fail-outside` makes band violations an explicit gate. No band is enforced
1794
+ until the package declares it.
1765
1795
 
1766
1796
  **OPTIONS**
1767
1797
 
1768
- | Input | Default | Meaning |
1769
- | ------------- | -------------------------- | ---------------------------------------- |
1770
- | `path` | configured `paths.content` | Markdown file or content tree |
1771
- | `--age` | 21 | Reader age in years |
1772
- | `--threshold` | 5 | Number of readability algorithms (1–7) |
1773
- | `--min-words` | 8 | Minimum words for readability assessment |
1798
+ | Input | Default | Meaning |
1799
+ | ------------------- | -------------------------- | -------------------------------------------- |
1800
+ | `path` | configured `paths.content` | Markdown file or content tree |
1801
+ | `--age` | 21 | Lint reader age in years |
1802
+ | `--threshold` | 5 | Lint readability algorithms required (1–7) |
1803
+ | `--rules` | `readability` | Lint rules: `readability`, `simplify`, `all` |
1804
+ | `--min-words` | 8 lint; 80 score | Minimum words per sentence or note |
1805
+ | `--fail-on-warning` | false | Fail lint on selected rule findings |
1806
+ | `--fail-outside` | false | Fail score when a note crosses a band |
1774
1807
 
1775
1808
  **EXIT STATUS**
1776
1809
 
1777
- 0 after reporting suggestions; 1 for invalid options or unreadable paths.
1810
+ 0 after an advisory report; 1 for invalid options, unreadable paths, or an
1811
+ explicit failure condition.
1778
1812
 
1779
1813
  **EXAMPLES**
1780
1814
 
1781
1815
  ```bash
1782
1816
  package-build prose lint assets/content/Lore/Harbor.md
1817
+ package-build prose lint assets/content/Lore/Harbor.md --rules simplify
1818
+ package-build prose lint assets/content/Lore/Harbor.md --fail-on-warning
1783
1819
  package-build prose lint
1784
1820
  package-build prose lint assets/content --age 18 --threshold 6 --min-words 10
1821
+ package-build prose score assets/content/Lore/Harbor.md
1822
+ package-build prose score assets/content/Lore --fail-outside
1785
1823
  ```
1786
1824
 
1787
- For a note whose fifth line says `The utilization is very high.`, the command
1788
- can report:
1825
+ For a note whose fifth line says `The utilization is very high.`, lint with
1826
+ `--rules simplify` can report:
1789
1827
 
1790
1828
  ```text
1791
1829
  assets/content/Lore/Harbor.md:5:5: warning: retext-simplify/utilization: confidence=unscored; sentence="The utilization is very high."; expected=["use"]; Unexpected `utilization`, use `use` instead
@@ -1457,38 +1457,65 @@ packageBuild:
1457
1457
  envPrefix: SOHL
1458
1458
  ```
1459
1459
 
1460
- | Key | Type | Required | Default |
1461
- | ------------------------------------------------------------------------------------------ | ------------------------------------------- | -------- | -------------------------------------- |
1462
- | [`packageBuild.stageDir`](#packagebuildstagedir-and-packagebuildassets) | string | no | `build/stage` |
1463
- | [`packageBuild.assets`](#packagebuildstagedir-and-packagebuildassets) | array | no | `[]` |
1464
- | [`packageBuild.assetTransform`](#packagebuildassettransform-and-packagebuildmanifestflags) | string (path to a module) | no | `null` |
1465
- | [`packageBuild.manifest`](#packagebuildmanifest) | object, pass-through | no | `{}` |
1466
- | [`packageBuild.manifestFlags`](#packagebuildassettransform-and-packagebuildmanifestflags) | string (path to a module) | no | `null` |
1467
- | [`packageBuild.schema`](#packagebuildschema) | object (`{documentType: {from, registry}}`) | no | `[]` |
1468
- | [`packageBuild.clean`](#packagebuildclean) | object | no | `{extra: []}` |
1469
- | [`packageBuild.lang`](#packagebuildlang) | object | no | see below |
1470
- | [`packageBuild.deploy`](#packagebuilddeploy) | object | no | `{envPrefix: "SOHL"}` |
1471
- | [`packageBuild.release`](#packagebuildrelease) | object | no | `{artifact: <from packageKind>}` |
1472
- | [`packageBuild.bundle`](#packagebuildbundle) | object | no | `{entry: "<foundryPackage>.mjs"}` |
1473
- | [`packageBuild.container`](#packagebuildcontainer) | object | no | see below |
1474
- | [`packageBuild.e2e`](#packagebuilde2e) | object | no | see below |
1475
- | [`packageBuild.proseLint`](#packagebuildproselint) | object | no | `{age: 21, threshold: 5, minWords: 8}` |
1476
-
1477
- > ``package-build config: `packageBuild.<key>` is not a recognised key (expected one of: stageDir, assets, assetTransform, manifest, manifestFlags, schema, clean, lang, deploy, release, bundle, container, e2e, proseLint).``
1460
+ | Key | Type | Required | Default |
1461
+ | ------------------------------------------------------------------------------------------ | ------------------------------------------- | -------- | ---------------------------------------------------------- |
1462
+ | [`packageBuild.stageDir`](#packagebuildstagedir-and-packagebuildassets) | string | no | `build/stage` |
1463
+ | [`packageBuild.assets`](#packagebuildstagedir-and-packagebuildassets) | array | no | `[]` |
1464
+ | [`packageBuild.assetTransform`](#packagebuildassettransform-and-packagebuildmanifestflags) | string (path to a module) | no | `null` |
1465
+ | [`packageBuild.manifest`](#packagebuildmanifest) | object, pass-through | no | `{}` |
1466
+ | [`packageBuild.manifestFlags`](#packagebuildassettransform-and-packagebuildmanifestflags) | string (path to a module) | no | `null` |
1467
+ | [`packageBuild.schema`](#packagebuildschema) | object (`{documentType: {from, registry}}`) | no | `[]` |
1468
+ | [`packageBuild.clean`](#packagebuildclean) | object | no | `{extra: []}` |
1469
+ | [`packageBuild.lang`](#packagebuildlang) | object | no | see below |
1470
+ | [`packageBuild.deploy`](#packagebuilddeploy) | object | no | `{envPrefix: "SOHL"}` |
1471
+ | [`packageBuild.release`](#packagebuildrelease) | object | no | `{artifact: <from packageKind>}` |
1472
+ | [`packageBuild.bundle`](#packagebuildbundle) | object | no | `{entry: "<foundryPackage>.mjs"}` |
1473
+ | [`packageBuild.container`](#packagebuildcontainer) | object | no | see below |
1474
+ | [`packageBuild.e2e`](#packagebuilde2e) | object | no | see below |
1475
+ | [`packageBuild.proseLint`](#packagebuildproselint) | object | no | `{age: 21, threshold: 5, minWords: 8, rules: readability}` |
1476
+ | [`packageBuild.proseScore`](#packagebuildprosescore) | object | no | `{minWords: 80, bands: {}}` |
1477
+
1478
+ > ``package-build config: `packageBuild.<key>` is not a recognised key (expected one of: stageDir, assets, assetTransform, manifest, manifestFlags, schema, clean, lang, deploy, release, bundle, container, e2e, proseLint, proseScore).``
1478
1479
 
1479
1480
  ### `packageBuild.proseLint`
1480
1481
 
1481
- Optional defaults for [`package-build prose lint`](commands.md#package-build-prose-lint-path).
1482
+ Optional defaults for [`package-build prose lint`](commands.md#package-build-prose-lint-path-and-prose-score-path).
1482
1483
  `age` is the reader age, `threshold` is the number of readability algorithms
1483
1484
  required to flag a sentence (1–7), and `minWords` is the minimum sentence
1484
- length. Each setting is a positive integer; command-line options can override
1485
- them for one analysis.
1485
+ length. `rules` is `readability`, `simplify`, or `all`. Each numeric setting is
1486
+ a positive integer; command-line options can override them for one analysis.
1486
1487
 
1487
1488
  ```yaml
1488
1489
  packageBuild:
1489
- proseLint: { age: 21, threshold: 5, minWords: 8 }
1490
+ proseLint: { age: 21, threshold: 5, minWords: 8, rules: readability }
1490
1491
  ```
1491
1492
 
1493
+ ### `packageBuild.proseScore`
1494
+
1495
+ Optional defaults for [`package-build prose score`](commands.md#package-build-prose-lint-path-and-prose-score-path).
1496
+ `minWords` is the minimum number of analyzed words for a note to receive a
1497
+ score. `bands` states the package's acceptable range for any reported metric;
1498
+ there are no default bands. Each band has `min`, `max`, or both, as finite
1499
+ numbers. An omitted bound is open. The score report stays advisory unless
1500
+ `--fail-outside` is requested.
1501
+
1502
+ ```yaml
1503
+ packageBuild:
1504
+ proseScore:
1505
+ minWords: 80
1506
+ bands:
1507
+ flesch: { min: 45, max: 80 }
1508
+ syllablesPerWord: { max: 1.65 }
1509
+ meanSentenceWords: { max: 28 }
1510
+ longestSentenceWords: { max: 55 }
1511
+ unfamiliarWordPercent: { max: 35 }
1512
+ nominalizationsPer1000Words: { max: 30 }
1513
+ ```
1514
+
1515
+ Flesch is a reading-ease score, so a value below its minimum is harder prose
1516
+ and one above its maximum is simpler prose. These sample bounds are editorial
1517
+ choices for illustration. `--min-words` overrides `minWords` for one score run.
1518
+
1492
1519
  ### `packageBuild.stageDir` and `packageBuild.assets`
1493
1520
 
1494
1521
  `stageDir` is where the package is assembled before it is zipped or