A Civilization-style strategy game about governing Israel from 15 May 1948. Real ministers, real map, every fact sourced. Unity + deterministic C# sim.
CI: changelog fragments, so PRs stop conflicting in CHANGELOG.md (#1188)
Eyal Golanc8f4bc027e32
diff --git a/.github/pull_request_template.md b/.github/pull_request_template.mdindex f8381f274..69540d2cd 100644--- a/.github/pull_request_template.md+++ b/.github/pull_request_template.md@@ -22,7 +22,7 @@- [ ] Tests cover the change, and they fail without it.- [ ] Test count did not go down, or this description explains why.- [ ] The goldens (`Hash1950`, `Hash1952`, smoke) did not move, or this description says why they moved and they were re-pinned in `sim/Statecraft.Sim.Tests/golden/manifest.txt` with `STATECRAFT_UPDATE_GOLDEN=1 dotnet test sim/Statecraft.sln` (`docs/determinism.md`).-- [ ] `CHANGELOG.md` has a line under `## [Unreleased]` if this changes `sim/`, `content/` or `unity/`.+- [ ] A new `changelog.d/<branch-or-issue>.md` fragment (or a line under `## [Unreleased]` in `CHANGELOG.md`) if this changes `sim/`, `content/` or `unity/`.- [ ] Every fact added or changed in `content/` has `sources:` with a checked date (`docs/CONTENT_POLICY.md`).- [ ] No quote is attributed to a real person unless it is sourced verbatim.- [ ] Every new image, video, font, audio or map-data file has an `ASSETS.yaml` row.diff --git a/AGENTS.md b/AGENTS.mdindex 2d9e0d976..3a9a03d32 100644--- a/AGENTS.md+++ b/AGENTS.md@@ -56,7 +56,7 @@ Before writing or editing content, review:- `dotnet test sim/Statecraft.sln` loads all of `content/` and must pass with 0 warnings.- `uv run scripts/oss/check_repo.py` runs the repository policy checks that CI runs.-- If you change `sim/`, `content/` or `unity/`, add a line under `## [Unreleased]` in `CHANGELOG.md`.+- If you change `sim/`, `content/` or `unity/`, add a changelog fragment `changelog.d/<branch-or-issue>.md` (`changelog.d/README.md`); a line under `## [Unreleased]` in `CHANGELOG.md` still works.- If the PR finishes a Phase 1 PR or a phase of #374, update the Roadmap table in `README.md` and `README.he.md` (`CONTRIBUTING.md`, rule 9).- `scripts/check.sh` runs every check CI runs in one command: the changelog rule, the reviewed_by guard, the GDD lint, the policy checker tests, `check_repo.py`, the rule IDs, the sim build, the sim tests and the tools tests. It stops at the first failure.@@ -98,7 +98,7 @@ For changes under `sim/`, `tools/`, `scripts/` or `unity/`, not only content.**Pull requests**- Branch from `main`, one focused change per PR, no force-push to `main`. Fill in `.github/pull_request_template.md`, including "AI assistance". Use "Fixes #N" only if the PR completes the issue, otherwise "Refs #N".-- Add a line under `## [Unreleased]` in `CHANGELOG.md` for any change to `sim/`, `content/` or `unity/` (tests excepted).+- Add a changelog fragment `changelog.d/<branch-or-issue>.md` (or a line under `## [Unreleased]` in `CHANGELOG.md`) for any change to `sim/`, `content/` or `unity/` (tests excepted).- Write the test first and check it fails without the change.- A change a player can see (models, the map, characters, the UI, the website) needs before/after screenshots in the PR description: the same game state, camera and zoom, with the changed area labelled. Reviewers can't judge a visual change from the diff alone.diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 25eb2b384..3f52b2dc7 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -3,7 +3,8 @@All notable changes to Statecraft: Israel. The format follows[Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and versions follow[Semantic Versioning](https://semver.org/). Every pull request that changes the game (`sim/`, `content/`, `unity/`)-adds a line under **Unreleased**; CI's `Changelog` job checks this (see `CONTRIBUTING.md`).+adds a line under **Unreleased**, or a fragment in `changelog.d/` that a release folds in here; CI's `Changelog` job+checks this (see `CONTRIBUTING.md`).## [Unreleased]diff --git a/CONTRIBUTING.md b/CONTRIBUTING.mdindex b119673e4..b5f191919 100644--- a/CONTRIBUTING.md+++ b/CONTRIBUTING.md@@ -46,7 +46,7 @@ Follow [docs/dev-setup.md](docs/dev-setup.md). In short:`"$UNITY" -batchmode -CI false -GITHUB_ACTIONS false -TF_BUILD false -projectPath unity -buildTarget OSXUniversal -runTests -testPlatform EditMode -testResults "$PWD/unity-editmode.xml" -logFile unity-tests.log`. There must be 0 `warning CS` in the log.4. **Text the player sees** has no internal ids, gives dates as "15 May 1948", and shows money as "IL 1.2m" or "$1.2m". The tests enforce this.5. **Keep the pull request focused:** one change per PR, and no unrelated refactors.-6. **Changelog.** If you change `sim/`, `content/` or `unity/` (tests excepted), add a line under `## [Unreleased]` in [CHANGELOG.md](CHANGELOG.md). CI's `Changelog` job checks it; the maintainer can add the `no-changelog` label to a change no player would notice.+6. **Changelog.** If you change `sim/`, `content/` or `unity/` (tests excepted), add a new file `changelog.d/<branch-or-issue>.md` with your entry as a bullet ([changelog.d/README.md](changelog.d/README.md)); fragments never conflict with other pull requests. A line under `## [Unreleased]` in [CHANGELOG.md](CHANGELOG.md) still works. CI's `Changelog` job checks it; the maintainer can add the `no-changelog` label to a change no player would notice.7. **Rule IDs.** A rule that has an ID (`R-ECON-014`, defined in `docs/rules/`, see [docs/rules/README.md](docs/rules/README.md)) is cited by that ID in the test that checks it (`// R-ECON-014`), in YAML comments that depend on it, and in the PR body ("implements R-ECON-014"). `uv run scripts/oss/rule_ids.py` fails on a rule with no citing test and on a citation of an ID that does not exist.8. **Provenance.** Every new image, video, font, audio, 3D-model or map-data file gets a row in [ASSETS.yaml](ASSETS.yaml) with its source, licence and status. CI's `Repo policy` job fails on a file with no row.9. **Roadmap status.** If your PR finishes a Phase 1 PR or a whole phase of [#374](https://github.com/eyalgolan/statecraft-israel/issues/374), update the Roadmap table in [README.md](README.md#roadmap) and the same table in [README.he.md](README.he.md), and tick the item in #374 if you can (otherwise ask the maintainer in the PR). The Phase 1 count must match in both files; `test_readme.py` checks it.diff --git a/changelog.d/README.md b/changelog.d/README.mdnew file mode 100644index 000000000..e1ee2b770--- /dev/null+++ b/changelog.d/README.md@@ -0,0 +1,14 @@+# Changelog fragments++A pull request that changes the game (`sim/`, `content/`, `unity/`) can add its changelog entry here as a new file+instead of editing [CHANGELOG.md](../CHANGELOG.md). Two pull requests never add the same file, so they never conflict.++- Name the file after the branch or the issue: `changelog.d/<branch-or-issue>.md`, for example `changelog.d/1116.md`.+- Write each entry as a bullet (`- `) in the voice of the lines under `## [Unreleased]`; wrap long lines with two+ spaces, as there. Put `### Fixed` (or `### Changed`, `### Removed`) above entries that are not additions; without a+ heading an entry goes under Added.+- Add a new file; editing or deleting an existing one does not count. CI's `Changelog` job accepts a new file with at+ least one entry, or a line under `## [Unreleased]` in CHANGELOG.md.++At a release, `uv run scripts/oss/changelog_fold.py` moves every entry into CHANGELOG.md, in filename order, and+deletes the files ([docs/RELEASING.md](../docs/RELEASING.md), step 2). This README stays.diff --git a/docs/RELEASING.md b/docs/RELEASING.mdindex b0a0efbc8..c570e057c 100644--- a/docs/RELEASING.md+++ b/docs/RELEASING.md@@ -5,8 +5,10 @@ GitHub Releases page (and, from M4, on itch.io). Steps 1–3 are a normal pull r1. **Choose the version** (Semantic Versioning, pre-1.0 while the game is pre-release).2. **Bump every version site in one pull request:** `sim/Statecraft.Sim/SimInfo.cs` (`Version`) and- `unity/ProjectSettings/ProjectSettings.asset` (`bundleVersion`). Then move the `## [Unreleased]` entries in- `CHANGELOG.md` under `## [X.Y.Z] - YYYY-MM-DD` and leave an empty `## [Unreleased]` above it.+ `unity/ProjectSettings/ProjectSettings.asset` (`bundleVersion`). Fold the changelog fragments with+ `uv run scripts/oss/changelog_fold.py`: it moves each `changelog.d/*.md` entry into `## [Unreleased]`, in filename+ order, and deletes the fragments (it refuses, changing nothing, if one has no entry). Then move the+ `## [Unreleased]` entries in `CHANGELOG.md` under `## [X.Y.Z] - YYYY-MM-DD` and leave an empty `## [Unreleased]` above it.`scripts/oss/tests/test_release.py::test_versions_agree` fails if the three disagree.3. **Merge** the pull request (squash).4. **Run the release gate** on the merged `main` (it refuses to run elsewhere): `bash scripts/oss/release_gate.sh`. It must printdiff --git a/scripts/oss/changelog_check.py b/scripts/oss/changelog_check.pyindex 11e3d460a..798e13113 100755--- a/scripts/oss/changelog_check.py+++ b/scripts/oss/changelog_check.py@@ -2,8 +2,9 @@# requires-python = ">=3.11"# dependencies = []# ///-"""Per-pull-request changelog rule: if the PR changes a user-visible path, it must touch CHANGELOG.md or carry the-`no-changelog` label. Looks at the PR's own diff only, never at earlier history.+"""Per-pull-request changelog rule: if the PR changes a user-visible path, it must touch CHANGELOG.md, add a+changelog.d/<name>.md fragment with at least one entry, or carry the `no-changelog` label. Looks at the PR's own diff+only, never at earlier history.Usage: uv run scripts/oss/changelog_check.py --base <base-sha> [--head HEAD] [--skip-label true|false]"""from __future__ import annotations@@ -11,27 +12,42 @@ from __future__ import annotationsimport argparseimport subprocessimport sys+from collections.abc import SequenceUSER_VISIBLE = ("content/", "sim/Statecraft.Sim/", "sim/Statecraft.Cli/", "unity/Assets/", "unity/ProjectSettings/","unity/Packages/")NOT_USER_VISIBLE = ("unity/Assets/Tests/",)+FRAGMENTS = "changelog.d/"def user_visible(paths: list[str]) -> list[str]:return [p for p in paths if p.startswith(USER_VISIBLE) and not p.startswith(NOT_USER_VISIBLE)]-def verdict(paths: list[str], skip_label: bool) -> tuple[bool, str]:+def is_fragment(path: str) -> bool:+ name = path.removeprefix(FRAGMENTS)+ return path.startswith(FRAGMENTS) and name.endswith(".md") and "/" not in name and name != "README.md"+++def has_entry(text: str) -> bool:+ """A fragment counts only with a bullet that says something; a blank file or a bare heading does not."""+ return any(line.startswith("- ") and line[2:].strip() for line in text.splitlines())+++def verdict(paths: list[str], skip_label: bool, fragments: Sequence[str] = ()) -> tuple[bool, str]:visible = user_visible(paths)if not visible:return True, "No user-visible change; no CHANGELOG entry needed."if "CHANGELOG.md" in paths:return True, "CHANGELOG.md is updated."+ if fragments:+ return True, "A changelog fragment is added: " + ", ".join(fragments)if skip_label:return True, "The no-changelog label is set."listed = "\n".join(f" {p}" for p in visible)return False, ("These user-visible paths changed without a CHANGELOG.md entry:\n" + listed +- "\nAdd a line under ## [Unreleased] in CHANGELOG.md, or ask a maintainer for the no-changelog label.")+ "\nAdd a changelog.d/<name>.md fragment (see changelog.d/README.md) or a line under ## [Unreleased] "+ "in CHANGELOG.md, or ask a maintainer for the no-changelog label.")def changed_paths(base: str, head: str) -> list[str]:@@ -39,13 +55,21 @@ def changed_paths(base: str, head: str) -> list[str]:return [p for p in out.stdout.splitlines() if p]+def added_fragments(base: str, head: str) -> list[str]:+ """Fragments the PR adds with an entry in them. An edited, renamed or deleted fragment does not count."""+ out = subprocess.run(["git", "diff", "--name-only", "--find-renames", "--diff-filter=A", f"{base}...{head}", "--",+ FRAGMENTS], capture_output=True, text=True, check=True)+ return [p for p in out.stdout.splitlines() if is_fragment(p) and has_entry(+ subprocess.run(["git", "show", f"{head}:{p}"], capture_output=True, text=True, check=True).stdout)]++def main(argv: list[str] | None = None) -> int:ap = argparse.ArgumentParser()ap.add_argument("--base", required=True)ap.add_argument("--head", default="HEAD")ap.add_argument("--skip-label", default="false")a = ap.parse_args(argv)- ok, msg = verdict(changed_paths(a.base, a.head), a.skip_label.lower() == "true")+ ok, msg = verdict(changed_paths(a.base, a.head), a.skip_label.lower() == "true", added_fragments(a.base, a.head))print(msg)return 0 if ok else 1diff --git a/scripts/oss/changelog_fold.py b/scripts/oss/changelog_fold.pynew file mode 100644index 000000000..143854b66--- /dev/null+++ b/scripts/oss/changelog_fold.py@@ -0,0 +1,68 @@+# /// script+# requires-python = ">=3.11"+# dependencies = []+# ///+"""Release step (docs/RELEASING.md, step 2): moves every changelog.d/<name>.md fragment into CHANGELOG.md under+## [Unreleased] and deletes the fragments. Fragments are read in filename order. A fragment's entries go under the+`### <Section>` line above them in the fragment (Added when there is none), at the top of the first such section in+Unreleased, which is added at Unreleased's end if missing. It refuses, and changes nothing, if a fragment has no entry.++Usage: uv run scripts/oss/changelog_fold.py [--root .]"""+from __future__ import annotations++import argparse+import sys+from pathlib import Path++from changelog_check import FRAGMENTS, has_entry, is_fragment++UNRELEASED = "## [Unreleased]"+++def fold(changelog: str, fragments: list[tuple[str, str]]) -> str:+ """fragments: (file name, text) pairs, in any order."""+ sections: dict[str, list[str]] = {}+ for name, text in sorted(fragments):+ if not has_entry(text):+ raise ValueError(f"{name}: no entry (a line starting with '- ')")+ section = "Added"+ for line in text.splitlines():+ if line.startswith("### "):+ section = line[4:].strip()+ elif line.strip():+ sections.setdefault(section, []).append(line)+ lines = changelog.splitlines()+ if UNRELEASED not in lines:+ raise ValueError(f"CHANGELOG.md has no '{UNRELEASED}' line")+ start = lines.index(UNRELEASED)+ for section, entries in sections.items():+ end = next((i for i in range(start + 1, len(lines)) if lines[i].startswith("## ")), len(lines))+ heading = next((i for i in range(start + 1, end) if lines[i] == f"### {section}"), None)+ if heading is None:+ last = max(i for i in range(start, end) if lines[i].strip())+ lines[last + 1:last + 1] = ["", f"### {section}", *entries]+ else:+ lines[heading + 1:heading + 1] = entries+ return "\n".join(lines) + "\n"+++def main(argv: list[str] | None = None) -> int:+ ap = argparse.ArgumentParser()+ ap.add_argument("--root", default=".")+ root = Path(ap.parse_args(argv).root)+ paths = sorted(p for p in (root / FRAGMENTS).glob("*.md") if is_fragment(f"{FRAGMENTS}{p.name}"))+ log = root / "CHANGELOG.md"+ try:+ folded = fold(log.read_text(encoding="utf-8"), [(p.name, p.read_text(encoding="utf-8")) for p in paths])+ except ValueError as e:+ print(f"REFUSED: {e}")+ return 1+ log.write_text(folded, encoding="utf-8")+ for p in paths:+ p.unlink()+ print(f"Folded {len(paths)} fragments into CHANGELOG.md.")+ return 0+++if __name__ == "__main__":+ sys.exit(main())diff --git a/scripts/oss/tests/test_changelog_check.py b/scripts/oss/tests/test_changelog_check.pyindex 49d3821d1..2f33dea65 100644--- a/scripts/oss/tests/test_changelog_check.py+++ b/scripts/oss/tests/test_changelog_check.py@@ -1,4 +1,5 @@import changelog_check as cc+from conftest import commit_alldef test_user_visible_change_without_changelog_fails_and_names_the_paths():@@ -24,3 +25,80 @@ def test_every_user_visible_root_is_named():for p in ("content/people.yaml", "sim/Statecraft.Sim/Rng.cs", "sim/Statecraft.Cli/Program.cs","unity/Assets/UI/Game.uxml", "unity/ProjectSettings/ProjectSettings.asset", "unity/Packages/manifest.json"):assert cc.user_visible([p]) == [p], p+++def test_an_added_fragment_satisfies_it_and_the_failure_names_that_way():+ ok, msg = cc.verdict(["content/people.yaml", "changelog.d/1180.md"], skip_label=False,+ fragments=["changelog.d/1180.md"])+ assert ok and "changelog.d/1180.md" in msg+ assert "changelog.d/" in cc.verdict(["content/people.yaml"], skip_label=False)[1]+++def test_only_a_changelog_d_markdown_file_other_than_the_readme_is_a_fragment():+ assert cc.is_fragment("changelog.d/fix-zoom.md")+ for p in ("changelog.d/README.md", "changelog.d/x.txt", "changelog.d/sub/x.md", "docs/changelog.d/x.md",+ "CHANGELOG.md"):+ assert not cc.is_fragment(p), p+++def test_a_fragment_needs_a_bullet_that_says_something():+ assert cc.has_entry("- The map zooms from the keyboard.\n")+ assert cc.has_entry("### Fixed\n- Money negatives put the sign next to the number.\n It wraps.\n")+ for text in ("", " \n\t\n", "### Added\n", "- \n-\n", "The map zooms.\n"):+ assert not cc.has_entry(text), repr(text)+++def _pr(make_repo, base_files, head_changes):+ """Commits base_files, then head_changes (None deletes the file) as the PR's commit. Returns (root, base, head)."""+ root = make_repo({"README.md": "x\n", **base_files})+ base = commit_all(root, "base")+ for rel, data in head_changes.items():+ p = root / rel+ if data is None:+ p.unlink()+ else:+ p.parent.mkdir(parents=True, exist_ok=True)+ p.write_text(data, encoding="utf-8")+ return root, base, commit_all(root, "pr")+++def _run(root, base, head, capsys, monkeypatch):+ monkeypatch.chdir(root)+ code = cc.main(["--base", base, "--head", head])+ return code, capsys.readouterr().out+++def test_a_pr_adding_a_fragment_passes(make_repo, capsys, monkeypatch):+ root, base, head = _pr(make_repo, {"content/a.yaml": "a: 1\n"},+ {"content/a.yaml": "a: 2\n", "changelog.d/a.md": "- Content: a is 2.\n"})+ assert _run(root, base, head, capsys, monkeypatch) == (0, "A changelog fragment is added: changelog.d/a.md\n")+++def test_an_empty_blank_readme_or_non_markdown_fragment_fails_closed(make_repo, capsys, monkeypatch):+ root, base, head = _pr(make_repo, {"content/a.yaml": "a: 1\n"},+ {"content/a.yaml": "a: 2\n", "changelog.d/a.md": "", "changelog.d/b.md": " \n\n",+ "changelog.d/README.md": "- Not an entry.\n", "changelog.d/c.txt": "- Not an entry.\n"})+ code, out = _run(root, base, head, capsys, monkeypatch)+ assert code == 1 and "content/a.yaml" in out+++def test_editing_an_existing_fragment_fails_closed(make_repo, capsys, monkeypatch):+ root, base, head = _pr(make_repo, {"content/a.yaml": "a: 1\n", "changelog.d/old.md": "- Old entry.\n"},+ {"content/a.yaml": "a: 2\n", "changelog.d/old.md": "- Old entry.\n- A second one.\n"})+ code, out = _run(root, base, head, capsys, monkeypatch)+ assert code == 1 and "content/a.yaml" in out+++def test_deleting_or_renaming_an_existing_fragment_fails_closed(make_repo, capsys, monkeypatch):+ root, base, head = _pr(make_repo, {"content/a.yaml": "a: 1\n", "changelog.d/old.md": "- Old entry.\n",+ "changelog.d/older.md": "- An older entry, long enough to match a rename.\n"},+ {"content/a.yaml": "a: 2\n", "changelog.d/old.md": None, "changelog.d/older.md": None,+ "changelog.d/new.md": "- An older entry, long enough to match a rename.\n"})+ code, out = _run(root, base, head, capsys, monkeypatch)+ assert code == 1 and "content/a.yaml" in out+++def test_a_changelog_line_still_passes_end_to_end(make_repo, capsys, monkeypatch):+ root, base, head = _pr(make_repo, {"content/a.yaml": "a: 1\n", "CHANGELOG.md": "## [Unreleased]\n"},+ {"content/a.yaml": "a: 2\n", "CHANGELOG.md": "## [Unreleased]\n- Content: a is 2.\n"})+ assert _run(root, base, head, capsys, monkeypatch) == (0, "CHANGELOG.md is updated.\n")diff --git a/scripts/oss/tests/test_changelog_fold.py b/scripts/oss/tests/test_changelog_fold.pynew file mode 100644index 000000000..a2c174e52--- /dev/null+++ b/scripts/oss/tests/test_changelog_fold.py@@ -0,0 +1,70 @@+import pytest++import changelog_fold as cf++LOG = """# Changelog++Intro.++## [Unreleased]++### Added+- An entry already here.++### Fixed+- A fix already here.++## [0.1.2] - 2026-10-19++### Added+- Released.+"""+++def test_entries_go_to_the_top_of_their_section_in_filename_order():+ out = cf.fold(LOG, [("b.md", "- B, added.\n Wrapped.\n"),+ ("a.md", "### Fixed\n- A, fixed.\n\n### Added\n- A, added.\n")])+ assert out == LOG.replace("### Added\n- An entry", "### Added\n- A, added.\n- B, added.\n Wrapped.\n- An entry") \+ .replace("### Fixed\n- A fix", "### Fixed\n- A, fixed.\n- A fix")+++def test_a_section_unreleased_lacks_is_added_at_its_end():+ out = cf.fold(LOG, [("a.md", "### Changed\n- A, changed.\n")])+ assert out == LOG.replace("- A fix already here.\n", "- A fix already here.\n\n### Changed\n- A, changed.\n")+++def test_an_empty_unreleased_after_a_release():+ log = "# Changelog\n\n## [Unreleased]\n\n## [0.1.2] - 2026-10-19\n\n### Added\n- Released.\n"+ out = cf.fold(log, [("a.md", "- A.\n")])+ assert out == log.replace("## [Unreleased]\n", "## [Unreleased]\n\n### Added\n- A.\n")+++def test_it_refuses_a_fragment_with_no_entry_or_a_changelog_with_no_unreleased():+ with pytest.raises(ValueError, match="a.md"):+ cf.fold(LOG, [("a.md", "### Added\n\n")])+ with pytest.raises(ValueError, match="Unreleased"):+ cf.fold("# Changelog\n", [("a.md", "- A.\n")])+++def test_main_folds_and_deletes_the_fragments_but_keeps_the_readme(tmp_path, capsys):+ (tmp_path / "CHANGELOG.md").write_text(LOG, encoding="utf-8")+ d = tmp_path / "changelog.d"+ d.mkdir()+ (d / "README.md").write_text("- Not an entry.\n", encoding="utf-8")+ (d / "z.md").write_text("- Z.\n", encoding="utf-8")+ (d / "a.md").write_text("- A.\n", encoding="utf-8")+ assert cf.main(["--root", str(tmp_path)]) == 0+ assert "- A.\n- Z.\n- An entry already here." in (tmp_path / "CHANGELOG.md").read_text(encoding="utf-8")+ assert sorted(p.name for p in d.iterdir()) == ["README.md"]+ assert "2 fragments" in capsys.readouterr().out+++def test_main_changes_nothing_when_a_fragment_is_refused(tmp_path):+ (tmp_path / "CHANGELOG.md").write_text(LOG, encoding="utf-8")+ d = tmp_path / "changelog.d"+ d.mkdir()+ (d / "a.md").write_text("- A.\n", encoding="utf-8")+ (d / "b.md").write_text("\n", encoding="utf-8")+ assert cf.main(["--root", str(tmp_path)]) == 1+ assert (tmp_path / "CHANGELOG.md").read_text(encoding="utf-8") == LOG+ assert sorted(p.name for p in d.iterdir()) == ["a.md", "b.md"]