4.9 KiB
4.9 KiB
Repository Instructions
Scope and source layout
- These instructions apply to the whole repository.
- Treat root PHP files,
includes/,assets/,languages/, andreadme.txtas source. Never editbuild/or release ZIP files directly;./build.sh buildrecreates them. - Read README.md for installation, shortcode, feed, cache, build, and layout details. Keep README_zh.md synchronized when changing shared documentation.
- The plugin supports WordPress 6.4+ and PHP 7.4+. Do not introduce syntax requiring a newer PHP version.
- Preserve the existing WordPress naming and security conventions:
OICS_classes/constants,oics_hooks/handles/keys/functions, direct-access guards, safe remote requests, sanitization, and context-appropriate escaping.
Architecture
vblg-oi-contest-schedule.phpowns plugin metadata, constants, loading, and startup hooks.includes/class-plugin.phpowns WordPress integration, widgets, shortcode registration, and asset enqueueing.includes/class-contest-client.phpowns remote fetching, transient caching, validation, normalization, and sorting.includes/class-schedule-renderer.phpowns escaped server-rendered markup.assets/js/schedule.jsformats Unix timestamps in the visitor's locale/time zone and updates countdowns;assets/css/schedule.cssowns presentation.- Keep the transient key synchronized between the contest client and
uninstall.php.
Localization and text changes
- Whenever modifying a file that contains text, explicitly check whether the change adds, removes, or changes user-facing/translatable strings and whether
languages/vblg-oi-contest-schedule.potandlanguages/vblg-oi-contest-schedule-zh_CN.pomust also change. - PHP gettext calls use the
vblg-oi-contest-scheduletext domain. Translations are loaded by WordPress automatically; the plugin does not callload_plugin_textdomain(), and the packaged ZIP does not includelanguages/. JavaScript-facing translated strings are localized from PHP. - Treat POT and PO files as editable localization sources. MO files are generated by the build and must not be committed from the source tree.
- After PO changes, run
./build.sh build; it validates gettext syntax and format placeholders withmsgfmt.
Validation
- Run
./build.sh buildafter code, metadata, readme, asset, or translation changes. This is the repository's packaging and automated validation command. - Use
./build.sh cleanonly to remove generatedbuild/and ZIP artifacts. - There is no separate test, lint, Composer, or npm command. Do not invent one; add focused manual checks when behavior cannot be covered by the build.
Release requests
When the user's message is exactly release X.Y.Z or release vX.Y.Z (allowing surrounding whitespace), perform the release preparation workflow below. Normalize the requested version to X.Y.Z and the tag to vX.Y.Z.
- Confirm the version is valid SemVer and inspect the worktree before editing. Do not overwrite unrelated user changes.
- Find the previous release tag from Git history, preferring the nearest reachable version tag:
git describe --tags --abbrev=0 --match 'v*'. If none exists, state that the release notes cover the full repository history. - Search tracked source files for the current version and release metadata. Update every applicable version occurrence, including the plugin header and
OICS_VERSIONinvblg-oi-contest-schedule.php,Stable tagplus changelog/upgrade-notice headings inreadme.txt, andProject-Id-Versionin both PO and POT files. Review other search results rather than assuming this list is exhaustive. Do not edit generated copies underbuild/. - Review
git diff <previous-tag>..HEADand the commit log over the same range. Derive release notes only from that evidence; group user-visible changes, fixes, compatibility changes, and developer-facing changes as appropriate. Do not include uncommitted release-preparation edits as previously completed work unless clearly labeled. - Add concise release entries to the repository changelog/upgrade notice where appropriate, keeping WordPress.org formatting valid. Check whether English and Chinese documentation or translations need corresponding updates.
- Run
./build.sh buildand report any validation failures. Confirm the produced ZIP version and the requested tag agree with the plugin header andStable tag. - Return release notes in both English and Simplified Chinese. The notes must be Markdown wrapped in a fenced code block, with clear
Englishand简体中文sections. Include the version and comparison range (<previous-tag>...vX.Y.Z, or full history when no tag exists). Do not create a commit, tag, GitHub Release, or push unless the user explicitly requests it.
The release tag must equal v<plugin-header-version> because the packaging workflow enforces that relationship. WordPress.org version tags are immutable; never attempt to overwrite an existing release tag.