This page follows a change to the v2 engine from a report to a merged pull request. It complements the repository’s own CONTRIBUTING.md, which has the fork-and-clone steps and the code style.

Triage and reproduce a report

Before you change anything, make the report something you can run:

  1. Which version? monogatari.version in the console of the reporter’s game answers it. A report against 2.8.0 or older may be fixed already; check git log v<their version>..develop.
  2. Served or opened from a file, and in which browser? v2 behaves differently opened from a file (What works opened from a file).
  3. The smallest script that shows it. Rebuild it in a copy of dist/ (Debugging the Engine), with the reporter’s settings from js/options.js.
  4. A spec that fails. Turn the script into a Cypress test in the spec of the action or component involved, and watch it fail before you touch the code (Testing the Engine).

A report that turns out to be a game’s mistake (a typo in js/script.js, a missing asset) is a docs question: answer it, and if the error dialog didn’t make the mistake clear, that’s worth an issue of its own.

Branches

Branch Holds
develop the work in progress. Every change starts from it and goes back into it by pull request. It’s the GitHub repository’s default branch.
master the latest release: CONTRIBUTING.md says it “usually hosts the code of the latest stable release”.

After a release both point at the same commit, the one tagged with its version (v2.8.1 is fea01a2e). Releases are tagged v<version> (v2.8.0, v2.8.1, v2.9.0) with lightweight tags.

Make a branch from develop for your change, on your fork:

git switch develop
git pull
git switch -c fix-move-transition

Before you open the pull request

  1. The specs your change touches pass, and the full suite has no new failures: bunx cypress run --browser chromium. The whole suite passes on develop (Known failures covers a test that fails once and passes when run again).
  2. bun run build passes. It lints, type-checks and rebuilds.
  3. The rebuilt files are committed with the source. git status after the build lists the changed bundles in dist/engine/core/, dist/engine/debug/, dist/types/ and lib/; commit them in the same branch. CI rebuilds on its own and won’t notice if you forget, but the starter game and the npm package would ship the old engine.
  4. The docs say what changed. A new statement gets a page in docs/script-actions/, a new component one in docs/components/, a changed behavior a corrected page (Writing and Publishing the Docs).
  5. Nothing else is in the diff. No stray formatting changes, no unrelated fixes.

Commits

CONTRIBUTING.md asks for messages that say what the commit does, in the present tense, starting with a capital letter: “Fix volume getting reset on fade in”, “Add show and hide textbox actions”. Keep one change per commit, so each can be reviewed, reverted or bisected on its own; the 2.8.1 commit, which mixed two fixes, a vendored library and a README rewrite, is the example not to follow (stage 6 of the learning path).

Whether the rebuilt bundles go in the same commit as the source or a commit of their own right after it, the branch must end with them current. A commit whose src/ and dist/engine/core/ agree is one git bisect can test without building (Debugging the Engine), so keeping them together is better.

v2 has no changelog file. What changed in a release is written in its GitHub release notes when it’s released (Releasing a 2.8.x Patch), so say it clearly in the pull request: the release notes are written from them.

Write the pull request

Open it against develop. In the description:

  • what was wrong, as a player or game developer would see it, with the report it fixes;
  • what you changed and why that’s the right place;
  • how you checked it: the spec you added and saw fail, the specs you ran, the browsers you tried;
  • what a game developer has to do, if anything: a setting that changed, CSS that games may have overridden, saves that won’t load the same.

What CI runs

The lint.yml workflow (lint and type check) and the test.yml workflow (build and every Cypress spec, in Chrome) run on the pull request when it changes TypeScript, JavaScript, JSON or CSS outside dist/ (Testing the Engine). A change only to dist/ (the starter game’s files) runs neither: run the specs yourself.

What done means

A change is done when it’s merged into develop with its spec, its rebuilt files and its docs, and the next release’s notes can describe it in a sentence. It reaches players with the next release: Releasing a 2.8.x Patch.