feat(utility): add PrettyName utility to generate human-readable names from slugs #4

Merged
Copilot merged 10 commits from copilot/generate-pretty-names into main 2026-03-06 08:14:22 +00:00
Copilot commented 2026-03-06 07:41:08 +00:00 (Migrated from github.com)
  • CHANGELOG.md — fix FILE INFORMATION header (wrong DEFGROUP/INGROUP/REPO from template), rewrite 1.0.0 entry (stale template content), clean up Unreleased section, fix Release Notes and bottom links to point to this repo
  • CONTRIBUTING.md — fix FILE INFORMATION header, fix title (wrong project name), fix clone URL, remove non-existent make commands (replace with php -l), remove JavaScript section, fix links
  • SECURITY.md — fix FILE INFORMATION header, replace "template" references with "MokoJoomTOS plugin", remove non-existent make commands, fix subject line format, fix links
  • CODE_OF_CONDUCT.md — fix FILE INFORMATION header (wrong DEFGROUP/INGROUP/REPO)
  • README.md — add proper MokoStandard file header, fix onAfterInitialiseonAfterRoute in Technical Details, add Utility/ directory to project structure, remove duplicate inline Changelog section, remove stale reference to non-existent scripts/ directory
  • index.md — rewrite: remove wrong template title and rebuild_indexes.py reference, make it a proper MokoJoomTOS root navigation index
  • docs/index.md — rewrite: same template artefacts, make it a proper docs navigation index

💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

- [ ] **CHANGELOG.md** — fix FILE INFORMATION header (wrong DEFGROUP/INGROUP/REPO from template), rewrite 1.0.0 entry (stale template content), clean up Unreleased section, fix Release Notes and bottom links to point to this repo - [ ] **CONTRIBUTING.md** — fix FILE INFORMATION header, fix title (wrong project name), fix clone URL, remove non-existent `make` commands (replace with `php -l`), remove JavaScript section, fix links - [ ] **SECURITY.md** — fix FILE INFORMATION header, replace "template" references with "MokoJoomTOS plugin", remove non-existent `make` commands, fix subject line format, fix links - [ ] **CODE_OF_CONDUCT.md** — fix FILE INFORMATION header (wrong DEFGROUP/INGROUP/REPO) - [ ] **README.md** — add proper MokoStandard file header, fix `onAfterInitialise` → `onAfterRoute` in Technical Details, add `Utility/` directory to project structure, remove duplicate inline Changelog section, remove stale reference to non-existent `scripts/` directory - [ ] **index.md** — rewrite: remove wrong template title and `rebuild_indexes.py` reference, make it a proper MokoJoomTOS root navigation index - [ ] **docs/index.md** — rewrite: same template artefacts, make it a proper docs navigation index <!-- START COPILOT CODING AGENT TIPS --> --- 💬 We'd love your input! Share your thoughts on Copilot coding agent in our [2 minute survey](https://gh.io/copilot-coding-agent-survey).
copilot-pull-request-reviewer[bot] (Migrated from github.com) reviewed 2026-03-06 08:19:15 +00:00
copilot-pull-request-reviewer[bot] (Migrated from github.com) left a comment

Pull request overview

This PR introduces a small PHP utility to derive human-readable labels from menu slugs (used in the plugin’s configuration UI), while also removing a large set of repository automation assets (scripts/workflows/templates) that appear to be template carry-overs.

Changes:

  • Add PrettyName utility to convert slugs like terms-of-service into display text like Terms of Service.
  • Update MenuslugField to fall back to the generated pretty name when a menu item has an empty title.
  • Remove numerous scripts/ utilities and .github/ workflows/issue templates (significant repo/CI surface change).

Reviewed changes

Copilot reviewed 28 out of 30 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
src/src/Utility/PrettyName.php Adds slug→pretty-name helper used for UI display text.
src/src/Field/MenuslugField.php Uses PrettyName as a fallback display label for menu items with empty titles.
scripts/wrappers/bash/validate_file_headers.sh Removes bash wrapper (repo tooling cleanup).
scripts/wrappers/bash/rebuild_indexes.sh Removes bash wrapper (repo tooling cleanup).
scripts/wrappers/bash/check_markdown_links.sh Removes bash wrapper (repo tooling cleanup).
scripts/validate/check_version_consistency.php Removes validation script (repo tooling cleanup).
scripts/validate/check_repo_health.php Removes validation script (repo tooling cleanup).
scripts/validate/auto_detect_platform.php Removes validation script (repo tooling cleanup).
scripts/index.md Removes scripts index (template artefact removal).
scripts/README.md Removes scripts README (template artefact removal).
scripts/!.gitkeep Keeps scripts/ directory present after tooling removals.
TESTING.md Removes legacy/testing guide document.
IMPLEMENTATION_SUMMARY.md Removes legacy implementation summary document.
IMPLEMENTATION.md Removes legacy implementation notes document.
.github/workflows/standards-compliance.yml Removes workflow (CI/compliance automation removal).
.github/workflows/security-scan.yml Removes workflow (security automation removal).
.github/workflows/dependency-review.yml Removes workflow (dependency review removal).
.github/workflows/comprehensive-validation.yml Removes workflow (validation automation removal).
.github/workflows/codeql-analysis.yml Removes workflow (CodeQL scanning removal).
.github/workflows/auto-create-dev-branch.yml Removes workflow (branch automation removal).
.github/pull_request_template.md Removes PR template.
.github/dependabot.yml Removes Dependabot configuration.
.github/ISSUE_TEMPLATE/sub-task.yml Removes issue template.
.github/ISSUE_TEMPLATE/security.md Removes issue template.
.github/ISSUE_TEMPLATE/request-license.md Removes issue template.
.github/ISSUE_TEMPLATE/question.md Removes issue template.
.github/ISSUE_TEMPLATE/feature_request.md Removes issue template.
.github/ISSUE_TEMPLATE/documentation.md Removes issue template.
.github/ISSUE_TEMPLATE/dev-branch-tracking.md Removes issue template.
.github/ISSUE_TEMPLATE/bug_report.md Removes issue template.
## Pull request overview This PR introduces a small PHP utility to derive human-readable labels from menu slugs (used in the plugin’s configuration UI), while also removing a large set of repository automation assets (scripts/workflows/templates) that appear to be template carry-overs. **Changes:** - Add `PrettyName` utility to convert slugs like `terms-of-service` into display text like `Terms of Service`. - Update `MenuslugField` to fall back to the generated pretty name when a menu item has an empty title. - Remove numerous `scripts/` utilities and `.github/` workflows/issue templates (significant repo/CI surface change). ### Reviewed changes Copilot reviewed 28 out of 30 changed files in this pull request and generated 5 comments. <details> <summary>Show a summary per file</summary> | File | Description | | ---- | ----------- | | `src/src/Utility/PrettyName.php` | Adds slug→pretty-name helper used for UI display text. | | `src/src/Field/MenuslugField.php` | Uses `PrettyName` as a fallback display label for menu items with empty titles. | | `scripts/wrappers/bash/validate_file_headers.sh` | Removes bash wrapper (repo tooling cleanup). | | `scripts/wrappers/bash/rebuild_indexes.sh` | Removes bash wrapper (repo tooling cleanup). | | `scripts/wrappers/bash/check_markdown_links.sh` | Removes bash wrapper (repo tooling cleanup). | | `scripts/validate/check_version_consistency.php` | Removes validation script (repo tooling cleanup). | | `scripts/validate/check_repo_health.php` | Removes validation script (repo tooling cleanup). | | `scripts/validate/auto_detect_platform.php` | Removes validation script (repo tooling cleanup). | | `scripts/index.md` | Removes scripts index (template artefact removal). | | `scripts/README.md` | Removes scripts README (template artefact removal). | | `scripts/!.gitkeep` | Keeps `scripts/` directory present after tooling removals. | | `TESTING.md` | Removes legacy/testing guide document. | | `IMPLEMENTATION_SUMMARY.md` | Removes legacy implementation summary document. | | `IMPLEMENTATION.md` | Removes legacy implementation notes document. | | `.github/workflows/standards-compliance.yml` | Removes workflow (CI/compliance automation removal). | | `.github/workflows/security-scan.yml` | Removes workflow (security automation removal). | | `.github/workflows/dependency-review.yml` | Removes workflow (dependency review removal). | | `.github/workflows/comprehensive-validation.yml` | Removes workflow (validation automation removal). | | `.github/workflows/codeql-analysis.yml` | Removes workflow (CodeQL scanning removal). | | `.github/workflows/auto-create-dev-branch.yml` | Removes workflow (branch automation removal). | | `.github/pull_request_template.md` | Removes PR template. | | `.github/dependabot.yml` | Removes Dependabot configuration. | | `.github/ISSUE_TEMPLATE/sub-task.yml` | Removes issue template. | | `.github/ISSUE_TEMPLATE/security.md` | Removes issue template. | | `.github/ISSUE_TEMPLATE/request-license.md` | Removes issue template. | | `.github/ISSUE_TEMPLATE/question.md` | Removes issue template. | | `.github/ISSUE_TEMPLATE/feature_request.md` | Removes issue template. | | `.github/ISSUE_TEMPLATE/documentation.md` | Removes issue template. | | `.github/ISSUE_TEMPLATE/dev-branch-tracking.md` | Removes issue template. | | `.github/ISSUE_TEMPLATE/bug_report.md` | Removes issue template. | </details>
copilot-pull-request-reviewer[bot] (Migrated from github.com) commented 2026-03-06 08:19:15 +00:00

The PR title/description focus on adding PrettyName and documentation cleanups, but this PR also appears to remove a large amount of workflows/scripts/issue templates. Please ensure the PR description explicitly calls out those operational/CI changes (or split them into a separate PR) so reviewers can assess impact and rollback risk appropriately.

The PR title/description focus on adding `PrettyName` and documentation cleanups, but this PR also appears to remove a large amount of workflows/scripts/issue templates. Please ensure the PR description explicitly calls out those operational/CI changes (or split them into a separate PR) so reviewers can assess impact and rollback risk appropriately.
@@ -0,0 +17,4 @@
* and other machine-friendly string formats.
*
* @since 03.08.05
*/
copilot-pull-request-reviewer[bot] (Migrated from github.com) commented 2026-03-06 08:19:15 +00:00

The @since 03.08.05 tags introduce a version that doesn't appear to be the current plugin version (repo still references 03.08.04 in the manifest). Either bump the plugin version everywhere for this release or change these @since annotations to match the version this ships in to keep versioning consistent.

The `@since 03.08.05` tags introduce a version that doesn't appear to be the current plugin version (repo still references 03.08.04 in the manifest). Either bump the plugin version everywhere for this release or change these `@since` annotations to match the version this ships in to keep versioning consistent.
@@ -0,0 +54,4 @@
}
$words = explode(' ', str_replace(['-', '_'], ' ', $slug));
copilot-pull-request-reviewer[bot] (Migrated from github.com) commented 2026-03-06 08:19:14 +00:00

fromSlug() uses empty($slug) which treats the string "0" as empty, and it doesn't trim/normalize whitespace or repeated separators. This can yield an empty result or output with extra spaces for inputs like " terms--of__service ". Consider using a trim check (trim($slug) === '') and splitting on a regex (e.g., one-or-more of [-_\s]) while filtering out empty parts before title-casing.

		// Treat only truly empty / whitespace-only slugs as empty,
		// so that values like "0" are still processed.
		if (trim($slug) === '')
		{
			return '';
		}

		// Normalize the slug by trimming and splitting on any sequence of
		// hyphens, underscores, or whitespace characters.
		$normalizedSlug = trim($slug);
		$parts          = preg_split('/[-_\s]+/', $normalizedSlug);

		// Filter out any empty parts to avoid extra spaces in the result.
		$words = array_values(
			array_filter(
				$parts,
				static function ($part)
				{
					return $part !== '';
				}
			)
		);
`fromSlug()` uses `empty($slug)` which treats the string "0" as empty, and it doesn't trim/normalize whitespace or repeated separators. This can yield an empty result or output with extra spaces for inputs like " terms--of__service ". Consider using a trim check (`trim($slug) === ''`) and splitting on a regex (e.g., one-or-more of `[-_\s]`) while filtering out empty parts before title-casing. ```suggestion // Treat only truly empty / whitespace-only slugs as empty, // so that values like "0" are still processed. if (trim($slug) === '') { return ''; } // Normalize the slug by trimming and splitting on any sequence of // hyphens, underscores, or whitespace characters. $normalizedSlug = trim($slug); $parts = preg_split('/[-_\s]+/', $normalizedSlug); // Filter out any empty parts to avoid extra spaces in the result. $words = array_values( array_filter( $parts, static function ($part) { return $part !== ''; } ) ); ```
@@ -0,0 +57,4 @@
foreach ($words as $index => &$word)
{
$lower = strtolower($word);
copilot-pull-request-reviewer[bot] (Migrated from github.com) commented 2026-03-06 08:19:15 +00:00

The foreach ($words as $index => &$word) loop uses a by-reference variable but doesn't unset($word) afterward. In PHP this can cause subtle bugs if $word is reused later in the method/file. Prefer iterating without references (building a new array) or explicitly unset($word) after the loop.

The `foreach ($words as $index => &$word)` loop uses a by-reference variable but doesn't `unset($word)` afterward. In PHP this can cause subtle bugs if `$word` is reused later in the method/file. Prefer iterating without references (building a new array) or explicitly `unset($word)` after the loop.
@@ -0,0 +61,4 @@
if ($index === 0 || !\in_array($lower, self::LOWERCASE_WORDS, true))
{
$word = ucfirst($lower);
copilot-pull-request-reviewer[bot] (Migrated from github.com) commented 2026-03-06 08:19:14 +00:00

strtolower()/ucfirst() are not UTF-8/multibyte safe, so non-ASCII slugs (e.g., with accented characters) may be cased incorrectly. Consider using multibyte-aware casing (e.g., mb_convert_case(..., MB_CASE_TITLE, 'UTF-8')/mb_strtolower) or a Joomla Unicode-safe helper if available.

			$lower = mb_strtolower($word, 'UTF-8');

			if ($index === 0 || !\in_array($lower, self::LOWERCASE_WORDS, true))
			{
				$word = mb_convert_case($lower, MB_CASE_TITLE, 'UTF-8');
`strtolower()`/`ucfirst()` are not UTF-8/multibyte safe, so non-ASCII slugs (e.g., with accented characters) may be cased incorrectly. Consider using multibyte-aware casing (e.g., `mb_convert_case(..., MB_CASE_TITLE, 'UTF-8')`/`mb_strtolower`) or a Joomla Unicode-safe helper if available. ```suggestion $lower = mb_strtolower($word, 'UTF-8'); if ($index === 0 || !\in_array($lower, self::LOWERCASE_WORDS, true)) { $word = mb_convert_case($lower, MB_CASE_TITLE, 'UTF-8'); ```
Sign in to join this conversation.
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: MokoConsulting/MokoJoomTOS#4