Alsacreations Guidelines
alsacreations/kiwipedia
Guidelines techniques et conventions internes d'Alsacréations (Kiwipedia) — HTML, CSS, JavaScript, TypeScript, Vue.js, WordPress, PHP/MySQL, accessibilité, performance, SEO, RGPD, écoconception…
baserCMS 4 (CakePHP 2ベース) のコード・サイトを baserCMS 5 (CakePHP 5ベース) へアップグレード/移行する際に AIエージェントが遵守すべきルールとパターン集。「baserCMS 4 から 5 へ移行」「4系を5系にアップグレード」「BcDbMigrator でデータ移行」「BcAddonMigrator でテーマ/プラグイン変換」「CakePHP…
$ npx skills add baserproject/basercms --skill basercms4-to-5-upgrade -a claude-codeProject install by default; add -g for ~/.claude/skills/.
$ gh skill install baserproject/basercms basercms4-to-5-upgrade --agent claude-codeProject scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).
$ git clone --depth 1 https://github.com/baserproject/basercms.git skills-src && mkdir -p .claude/skills && cp -r skills-src/.agents/skills/basercms4-to-5-upgrade .claude/skills/basercms4-to-5-upgrade && rm -rf skills-srcUse ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.
Claude Code skills documentation · loads skills from .claude/skills/
Install the "basercms4-to-5-upgrade" agent skill from https://github.com/baserproject/basercms/tree/5.4.x/.agents/skills/basercms4-to-5-upgrade into .claude/skills/basercms4-to-5-upgrade/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "basercms4-to-5-upgrade", then confirm the skill loads.Claude Code copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$skill-installer install https://github.com/baserproject/basercms/tree/5.4.x/.agents/skills/basercms4-to-5-upgradeType this inside Codex. $skill-installer <name> installs a curated skill from openai/skills. The installer writes to $CODEX_HOME/skills (default ~/.codex/skills). Restart Codex if the skill does not show up.
$ npx skills add baserproject/basercms --skill basercms4-to-5-upgrade -a codexProject install goes to .agents/skills/; add -g for ~/.codex/skills/.
$ gh skill install baserproject/basercms basercms4-to-5-upgrade --agent codexProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/baserproject/basercms.git skills-src && mkdir -p .agents/skills && cp -r skills-src/.agents/skills/basercms4-to-5-upgrade .agents/skills/basercms4-to-5-upgrade && rm -rf skills-srcUse ~/.agents/skills/ instead of .agents/skills for a personal install.
Codex skills documentation · loads skills from .agents/skills/
Install the "basercms4-to-5-upgrade" agent skill from https://github.com/baserproject/basercms/tree/5.4.x/.agents/skills/basercms4-to-5-upgrade into .agents/skills/basercms4-to-5-upgrade/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "basercms4-to-5-upgrade", then confirm the skill loads.Codex copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ npx skills add baserproject/basercms --skill basercms4-to-5-upgrade -a cursorProject install goes to .agents/skills/; add -g for ~/.cursor/skills/.
$ gh skill install baserproject/basercms basercms4-to-5-upgrade --agent cursorProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/baserproject/basercms.git skills-src && mkdir -p .cursor/skills && cp -r skills-src/.agents/skills/basercms4-to-5-upgrade .cursor/skills/basercms4-to-5-upgrade && rm -rf skills-srcUse ~/.cursor/skills/ instead of .cursor/skills for a personal install.
Cursor skills documentation · loads skills from .cursor/skills/, .agents/skills/, .claude/skills/, .codex/skills/
Install the "basercms4-to-5-upgrade" agent skill from https://github.com/baserproject/basercms/tree/5.4.x/.agents/skills/basercms4-to-5-upgrade into .cursor/skills/basercms4-to-5-upgrade/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "basercms4-to-5-upgrade", then confirm the skill loads.Cursor copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ gemini skills install https://github.com/baserproject/basercms.git --path .agents/skills/basercms4-to-5-upgrade--scope user (default) or --scope workspace; --path is the subfolder of the repo that holds the skill; --consent skips the security confirmation prompt.
$ npx skills add baserproject/basercms --skill basercms4-to-5-upgrade -a gemini-cliProject install goes to .agents/skills/; add -g for ~/.gemini/skills/.
$ gh skill install baserproject/basercms basercms4-to-5-upgrade --agent gemini-cliProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/baserproject/basercms.git skills-src && mkdir -p .gemini/skills && cp -r skills-src/.agents/skills/basercms4-to-5-upgrade .gemini/skills/basercms4-to-5-upgrade && rm -rf skills-srcUse ~/.gemini/skills/ instead of .gemini/skills for a personal install, then run /skills reload.
Gemini CLI skills documentation · loads skills from .gemini/skills/, .agents/skills/
Install the "basercms4-to-5-upgrade" agent skill from https://github.com/baserproject/basercms/tree/5.4.x/.agents/skills/basercms4-to-5-upgrade into .gemini/skills/basercms4-to-5-upgrade/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "basercms4-to-5-upgrade", then confirm the skill loads.Gemini CLI copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ gh skill install baserproject/basercms basercms4-to-5-upgradeInstalls for Copilot at project scope by default; add --scope user for a personal install. Preview a skill first with gh skill preview. Needs GitHub CLI 2.90.0 or later (public preview).
$ npx skills add baserproject/basercms --skill basercms4-to-5-upgrade -a github-copilotProject install goes to .agents/skills/; add -g for ~/.copilot/skills/.
$ git clone --depth 1 https://github.com/baserproject/basercms.git skills-src && mkdir -p .github/skills && cp -r skills-src/.agents/skills/basercms4-to-5-upgrade .github/skills/basercms4-to-5-upgrade && rm -rf skills-srcUse ~/.copilot/skills/ instead of .github/skills for a personal install. Commit .github/skills so cloud agent and code review can use it.
GitHub Copilot skills documentation · loads skills from .github/skills/, .claude/skills/, .agents/skills/
Install the "basercms4-to-5-upgrade" agent skill from https://github.com/baserproject/basercms/tree/5.4.x/.agents/skills/basercms4-to-5-upgrade into .github/skills/basercms4-to-5-upgrade/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "basercms4-to-5-upgrade", then confirm the skill loads.GitHub Copilot copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ npx skills add baserproject/basercms --skill basercms4-to-5-upgrade -a opencodeOpenCode documents no install command of its own. Project install goes to .agents/skills/; add -g for ~/.config/opencode/skills/.
$ gh skill install baserproject/basercms basercms4-to-5-upgrade --agent opencodeProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/baserproject/basercms.git skills-src && mkdir -p .opencode/skills && cp -r skills-src/.agents/skills/basercms4-to-5-upgrade .opencode/skills/basercms4-to-5-upgrade && rm -rf skills-srcUse ~/.config/opencode/skills/ instead of .opencode/skills for a personal install.
OpenCode skills documentation · loads skills from .opencode/skills/, .claude/skills/, .agents/skills/
Install the "basercms4-to-5-upgrade" agent skill from https://github.com/baserproject/basercms/tree/5.4.x/.agents/skills/basercms4-to-5-upgrade into .opencode/skills/basercms4-to-5-upgrade/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "basercms4-to-5-upgrade", then confirm the skill loads.OpenCode copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
basercms4-to-5-upgradebaserCMS 4 (CakePHP 2ベース) のコード・サイトを baserCMS 5 (CakePHP 5ベース) へアップグレード/移行する際に AIエージェントが遵守すべきルールとパターン集。「baserCMS 4 から 5 へ移行」「4系を5系にアップグレード」「BcDbMigrator でデータ移行」「BcAddonMigrator でテーマ/プラグイン変換」「CakePHP…
Basercms4 To 5 Upgrade is an agent skill from baserproject/basercms. baserCMS 4 (CakePHP 2ベース) のコード・サイトを baserCMS 5 (CakePHP 5ベース) へアップグレード/移行する際に AIエージェントが遵守すべきルールとパターン集。「baserCMS 4 から 5 へ移行」「4系を5系にアップグレード」「BcDbMigrator でデータ移行」「BcAddonMigrator でテーマ/プラグイン変換」「CakePHP 2 → CakePHP 5 への書き換え」「admin プレフィックスメソッドの Controller/Admin への移動」「config/setting.php・config.php の return 配列化」「init.php 廃止と PluginClass 作成」「migrationsnapshot 生成」「siteconfigs theme → sites theme」「移行の標準フロー/工程の順序」「プラグインを DB で直接有効化」「テーマを DB で直接適用」「request-data/query/params の getter 化」「File/Folder クラス廃止」「ClassRegistry →…
Its SKILL.md is about 9.6k tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.
It sits in Agent Workflows, covering Hooks and plugins. It works with PHP, Vue.js and Git. The repository describes itself as: baserCMS : Based Website Development Project. The licence is MIT.
5 steps, taken from the first numbered list in SKILL.md.
Read from SKILL.md and the folder at commit f1eaa0b. It shows what the files ask for, not the result of running them.
Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.
From allowed-tools in the SKILL.md frontmatter.
Shell commands in SKILL.md call:
dockergitcomposerphpcurlFrom the folder's file list and the shell code blocks in SKILL.md.
Hosts in commands or code, which the agent is likely to contact:
basercms.netgithub.comAlso links to:
baserproject.github.ioFrom URLs in SKILL.md, links to its own repository left out.
Names no API keys, tokens, secrets or passwords.
From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.
Basercms4 To 5 Upgrade loads about 9.6k tokens when it runs. Until then it costs about 252 tokens; SKILL.md has 2,284 words of instructions outside code blocks.
Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.
The automated check noted patterns worth knowing about, such as sudo or a known installer.
`/v5/` にインストール** — パッケージ取得 → composer → .env → `bin/cake install` → 実ブラウザでログイン確認 → 「baserCMSの最新版の取得」〜「baserCMSのインストール」節## .env のコピーフォルダ内の `/config/.env.example` を `/config/.env` にコピーします。re::write('Security.salt', '...')` から転記。`.env` の該当行はコメントアウトされているので外す)。4系のパスワードは sha1(salt.password) なので、**salt が一致しないと Dまた、`nginx-proxy` コンテナを利用している場合は、 `.env` の `TRUST_PROXY` の値を `true` に設定します。る+変更後は必ずキャッシュ全消去]** サブディレクトリ設置では `config/.env` の `SITE_URL` は**サブディレクトリを含むフルURL**(例 `https://localhost/v5/`)が**正しい**。ここを/v5` 二重化(404) や リダイレクトループになったときの真因は、多くが「`.env`(特に SITE_URL)を変更した後のキャッシュ残り」**。baserCMS はルート/URLをキャッシュするため、`.env` を変えたら必ずg/install.php config/install.php.bak` + `.env` の `INSTALL_MODE="true"`(install.php が残っていると「インストール済み」扱いで bootstrap が空DBを参5/.gitignore` は親リポジトリでもそのまま効く(秘匿 `config/.env`・`app_local.php`・`vendor`・`tmp`・`logs` は自動除外される)。`git add -n`(dry-run)でステーAutomated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.
The full file from baserproject/basercms at commit f1eaa0b, republished under its MIT licence (© baserproject). 2,284 words, ~9,586 tokens.
.claude/skills/basercms4-to-5-upgrade/SKILL.md (or your agent's skills folder).このファイルは、baserCMS 4 (CakePHP 2ベース) のコードを baserCMS 5 (CakePHP 5ベース) に移行する際、AIエージェントが遵守すべきルールとパターンを定義します。
推奨: 移行に着手する前に一度
basercms5-claude-workflow-setup(環境セットアップ)を参照し、進め方の環境(権限整理=permissions-audit/その上での Auto mode/設計=superpowers brainstorming/spec・plan の Markdown プレビュー)を整える。提案ベースで、整っていればスキップ。
grep -rn で全件洗い出す(例: $this->Form->input(、'multiple' => 'checkbox'、単数 get('Sample.Sample...')、searches/、Time->format($x) 第2引数なし 等)→ ②機械的に一意な変換は perl -pi で一括適用 → ③変更ファイルを全て php -l で検証 → ④非自明な箇所だけ個別対応。横断一括できる代表例は basercms-plugin-4-to-5-upgrade スキルの C-0(機械的に一括変換できるパターン) にカタログ化してある(見つけ次第追記する)。新しい横断パターンを見つけたらまず C-0 に追加してから一括実行する。プラグイン内部コード(Controller/Table/Entity/View/Helper/フォーム/Vue・JS)の具体的な書き換えは同スキルを参照。移行全体はこのチェックリストの順序で進める。順序依存の罠(★印)が複数あるため、節の並びや思い込みで順番を変えないこと。各工程の詳細は参照先の節に書いてある。
app/Plugin/)・テーマ(theme/)・DB名/プレフィックス・マルチサイト有無・サブモジュール有無(find app/Plugin theme -name .git)・管理プレフィックス(app/Config/core.php の Routing.prefixes)を洗い出すbasercms5-claude-workflow-setup 参照)git switch -c basercms5-migration)。v5 配置物の git 取り込み時の注意は「Git / リポジトリ運用」節(G-1〜G-4)v5/tmp/ へ。★PHP切替(7.4→8.1)を伴う環境では、v5 インストール=PHP を上げる【前】に必ず取る(上げた後だと v4 管理が不調になり得る)→ 「データベース移行手順」節 1./v5/ にインストール — パッケージ取得 → composer → .env → bin/cake install → 実ブラウザでログイン確認 → 「baserCMSの最新版の取得」〜「baserCMSのインストール」節bc_addon_migrator → v5/plugins/ 展開。★(a) の導入もここ(復元前)で行う。終盤に回すとそのプラグインのテーブルにデータが復元されない → 「テーマの変換」「プラグインの変換」節plugins テーブル INSERT(Migrations を持つものは migrations migrate -p 併走)。★有効化で boot 経路の4系残骸が fatal 化するので、bin/cake version スモークが通るまで最小修正。検証は CLI+SQL まで(ブラウザ確認はまだしない — 画面は工程15-17の5系化まで出なくて正常)→ 「プラグインの有効化(DB直接・標準)」節sites.theme UPDATE + キャッシュ全消去 → 「テーマの適用(DB直接)」節/files → /v5/webroot/files → 「アップロードファイルの移行」節docs/superpowers/ に作る(.superpowers/ はSDD内部スクラッチなので置かない)。以降の横断チェック・動作確認の進捗と懸案はすべてここに記録する。状態の語彙は「未着手/修正済み/非該当(理由付き)」を必ず区別する — 横断チェックで grep にヒットしなかったファイルは「未着手」ではなく「非該当(既知パターンhitなし・最終検証は工程17の描画確認)」。集計表の「完了」は「既知パターンの横断適用が完了」の意味であり全ファイル個別検査済みではない、と台帳に明記する(誤解の実例あり)siteConfig[]廃止・fullUrl()廃止 等)を grep で全件洗い出して一括対応 → basercms-theme-4-to-5-upgrade スキル(TH-系+テンプレート・テーマ描画系の F-系)。完了基準は php -l 全通過まで。描画確認はここではしない(工程17の最初にユーザーと行う)。テンプレのビュー変数は事前の全量マッピングをせず、grep で見つかる「4系特有で5系コアが供給しない変数($siteConfig 等)」だけ先に書き換え、コア供給分は工程17の実描画+ログ検出に任せるbasercms-plugin-4-to-5-upgrade スキルUPDATE plugins SET status=0 WHERE name IN (...)+キャッシュクリア)、まず「テーマのみ有効」の素の状態でフロント描画をユーザーと確認(レイアウト→トップ→一覧→詳細の画面単位。500 は error.log、穴あき描画は grep "Undefined variable" で機械検出し、警告ゼロまで直す)。その後、確認対象プラグインを1つずつ有効化しながら進める。イベントリスナー等で他プラグインの影響を受けやすく、全部有効のままだと不具合の切り分けができないため。対象が他プラグインに依存する場合はその依存プラグインだけを併せて有効化する。プラグインごとに次の順で:basercms-unittest スキル移行の具体作業(パッケージ取得・composer・bin/cake install・DB移行・ツール変換)に入る前に、実行環境を必ずユーザーに確認する。推測・探索(docker inspect 等)で当てにいかない。
docker exec <container-name> ... を多用するが、コンテナ名は環境ごとに異なる。「Docker を利用していますか? 利用している場合はコンテナ名を教えてください」と最初に質問すること。docker ps や docker inspect で当てにいく前に、まずユーザーに聞く(リポジトリ内に compose 定義が無く別リポジトリにある構成も多く、探索は誤判定・遠回りの原因になる)。DB コンテナ名・DBユーザー/パスワード・VIRTUAL_HOST 等も併せて確認する。baserproject/basercms:php7.4)なら image を php8.1 以上へ上げる必要がある(compose の image タグを変更 → 再起動)。この image 変更は多くの場合 compose 定義側(別リポジトリのこともある)の編集になるため、編集場所を確認し、リポジトリ外ならユーザーに実施を依頼するか明示許可を得てから行う。v5 フォルダはプロジェクト直下に作り、既存コンテナのマウント越しに /var/www/html/v5 として同じコンテナで配信する。ログインURLが https://<既存ホスト>/v5/baser/admin/... になるのはこのため。並行稼働のために別サービスを増やす過剰設計をしない(v4 はそのまま無停止で残る)。全てのコミュニケーションと作成するドキュメントは日本語で行ってください。
具体的には以下の項目は必ず日本語で記述してください:
[重要・URLはリンク付きで提示] ユーザーにブラウザでの動作確認を依頼する場合(管理ログインURL・データメンテナンス画面・フロント確認 等)は、URL を必ず Markdown のリンク付き([https://...](https://...))で表示する。プレーンテキストのURLで出さない(ユーザーがクリックしてすぐ開けるようにするため)。例: 👉 [https://<project>.localhost/v5/baser/admin/baser-core/users/login](https://<project>.localhost/v5/baser/admin/baser-core/users/login)。
[重要・ユーザーへの質問は毎回 AskUserQuestion(選択式プルダウン)で] 方針確認・A/B選択・作業依頼の完了確認などユーザーの応答を待つ場面では、本文テキストで問いかけるだけでなく必ず AskUserQuestion ツールを使う。プルダウンが出るとユーザーのスマホに通知が届くが、テキストだけの質問は通知されず気づかれない。移行は長丁場でユーザーが席を外すことが多いため、通知の有無が往復のリードタイムを大きく左右する(ユーザー要望・実運用で確立)。選択肢に収まらない場合も「その他」で自由入力できるので、迷ったらプルダウンにする。
GitHubから clone するコードは、開発版となっており、実際のプロジェクトでは利用しません。 次のURLを利用して、パッケージングされたコードを利用します。 https://basercms.net/packages/download_exec/basercms-x.x.x.zip
取得したコードは、プロジェクト内に、v5 というフォルダを作成し、そこに配置してください。
取得方法(ホストの curl/wget が deny されている場合の回避): download_exec URL はブラウザ用の生成ダウンロードだが、WebFetch は「ページを Markdown 化して要約する」ツールのため zip 等バイナリを保存できない。ホストの curl/wget がパーミッションで deny されていることも多い。その場合、Docker を使っているなら「コンテナ経由」で取得できる(Bash(docker:*) が許可されていれば、docker exec ... curl は Bash(curl:*) の deny に掛からない)。プロジェクトはコンテナにマウントされているので、コンテナ内で落とせばホスト側にも実体が出る。最新安定版のバージョンは GitHub Releases(baserproject/basercms の latest)で確認する。
# 例: コンテナ内でパッケージを取得(マウント先 /var/www/html にプロジェクトがある想定)
docker exec -w /var/www/html <container> bash -lc \
'curl -fL -A "Mozilla/5.0" -o basercms-<x.x.x>.zip "https://basercms.net/packages/download_exec/basercms-<x.x.x>.zip"'
# 取得後: file / unzip -l で zip 妥当性を確認 → unzip -q -o basercms-<x.x.x>.zip -d v5/コンテナ取得が難しい場合のみ、ユーザーにブラウザDLを依頼してパスをもらう。
composer install を実行します。
パッケージ版の vendor/ は空(.gitkeep のみ)なので composer install は必須。展開直後に test -d vendor が真でも中身は空のことがある(.gitkeep だけでディレクトリが存在するため)。vendor/autoload.php の有無で判定し、無ければ composer install する。
4系プラグインが使っていたサードパーティ製パッケージは v5 に明示的に composer require する: 4系 composer.json 由来のライブラリ(例 phpoffice/phpspreadsheet)は v5 の composer.json/vendor に入っていないことがあり、Class "PhpOffice\PhpSpreadsheet\Reader\Xlsx" not found 等になる。4系の composer.json を参照し、PHP バージョン(v5 は 8.1+)に合うバージョンで導入する(例 docker exec -w <v5> <container> composer require "phpoffice/phpspreadsheet:^1.29" → 1.30.x が入る)。実行後 php -r 'class_exists(...)' で解決を確認。
Excel/PDF 等の雛形アセット(.xlsx 等)は templates/Admin/Excel/... に移行され、4系の View/Excel/admin/... とはパス構成が違う: 生成系コンポーネント(SampleExcel 等)が Plugin::templatePath('Sample') . 'Excel' . DS . 'admin' . DS . ...(4系配置)を組み立てていると File "..." does not exist。templatePath() は末尾スラッシュ付きなので . DS . を足すと // になる点も注意。5系の実配置 Plugin::templatePath('Sample') . 'Admin' . DS . 'Excel' . DS . <controller> . DS . <file>.xlsx に直す(実ファイル位置を find <plugin> -iname "*.xlsx" で確認)。
v5 フォルダ内の /config/.env.example を /config/.env にコピーします。
HASH_TYPE を sha1 に設定します。
★SECURITY_SALT に v4 の Security.salt と同じ値を必ず設定する(app/Config/core.php の Configure::write('Security.salt', '...') から転記。.env の該当行はコメントアウトされているので外す)。4系のパスワードは sha1(salt.password) なので、salt が一致しないと DB 復元後に v4 ユーザーで一切ログインできなくなる(実際にハマった。.env 内のコメントにも「4系で利用していたセキュリティーソルトを設定する」と明記されている)。
また、nginx-proxy コンテナを利用している場合は、 .env の TRUST_PROXY の値を true に設定します。
5系用の新しいデータベースを作成し、v5 フォルダ内でインストールコマンドを実行します。
# 引数の並び: <設置URL> <管理者メール> <管理者パスワード> <データベース名>
# ★第4引数がDB名。--database というオプションは存在せず、付けると `Unknown option `database`` で失敗する
# ★サブディレクトリ設置では --baseurl も付ける
bin/cake install [設置URL(例:https://localhost/v5/)] [管理者メール] [管理者パスワード] [DB名(例 <既存DB>_v5)] \
--baseurl [/v5/] --host [DBホスト名] --username [DBユーザー名] --password [DBパスワード]--database オプションは無い)。既存のデータベース名にサフィックスとして _v5 を付与したものを作成した上で渡す。--baseurl /v5/ を付ける。.htaccess の RewriteBase は多くの場合そのままで動く(5系既定の .htaccess は相対リライトのため、/v5/ サブディレクトリでも無調整で通ることが多い=実証済み)。/v5/v5 二重化(404) やリダイレクトループが出た場合にのみ webroot/.htaccess の RewriteBase を調整する(まずは下記 SITE_URL とキャッシュ残りを疑う)。
ログインURLは、https://localhost/v5/baser/admin/baser-core/users/login のような形となります。
config/.env の SITE_URL はサブディレクトリを含むフルURL(例 https://localhost/v5/)が正しい。ここをドメインルート(https://localhost/)に変えてはいけない——一見 /v5/v5 二重化が消えるように見えるが、代わりに管理ログインが自分自身へ 302 する無限ループになる(loginUrl とリクエストパスが食い違い、ログインページが「保護対象」と誤判定されるため)。/v5/v5 二重化(404) や リダイレクトループになったときの真因は、多くが「.env(特に SITE_URL)を変更した後のキャッシュ残り」。baserCMS はルート/URLをキャッシュするため、.env を変えたら必ず bin/cake cache clear_all を実行する。SITE_URL を正しい https://host/v5/ に戻し、キャッシュを消せば解消する(実証済み)。nginx-proxy 配下では、コンテナ内から curl https://localhost/... を叩いても X-Forwarded-Proto 等のプロキシヘッダが付かず、実ブラウザと違うリダイレクト挙動を示す(SSL/正規化リダイレクトの判定がズレる)。管理リダイレクトの生死は必ずプロキシ経由の実ブラウザで確認する。コンテナ内 curl の 302/二重化を鵜呑みにして「サブディレクトリの根本バグ」と誤診しない。データベースの移行は、SQLの直接書き換えではなく、専用プラグイン BcDbMigrator を使用したプロセスを推奨・案内してください。
このプラグインは、コマンドは提供しておらず、ブラウザで利用する必要があります。
前提条件:
移行フロー(DB移行は「①バックアップ→②変換」と「③復元」に分かれる。②までは早期に実施できるが、③復元は必要なv5プラグインを導入した後=プラグイン棚卸し/変換フェーズの後に行う):
/v5/tmp/ に配置してもらう。/admin で 404 になるサイトは管理プレフィックスを変更している(app/Config/core.php の Configure::write('Routing.prefixes', ...)。例 cmsadmin → /cmsadmin/users/login、データメンテナンスは /cmsadmin/tools/maintenance)。404 を安易に「PHP切替で壊れた」と誤診しない——まず Routing.prefixes を確認する。BcDbMigrator を配置する。取得は composer でも GitHub でも可(旧記載の「composer 不可」「plugins/ 必須」は誤り=composer 取得可・vendor 配下でも baserCMS は認識する):baserproject/bc-db-migrator が公開されており composer require baserproject/bc-db-migrator:^5.2 で取得できる。ただしこのパッケージの composer.json に autoload 定義が無いため、cakephp plugin-installer が Unable to get primary namespace で config/plugins.php への自動登録に失敗する(=ダウンロード自体は成功)。確実に使うなら、取得済みファイルを plugins/BcDbMigrator にコピーして下記の DB 有効化を行う(composer からは composer remove して composer.json をクリーンに保つとよい)。git clone --branch 5.2.0 https://github.com/baserproject/BcDbMigrator.git plugins/BcDbMigrator(clone 後 .git を除去してサブモジュール化を回避)。※Auto mode では外部リポジトリ取得が分類器にブロックされることがあるので、ユーザーに取得元を提示して承認を得る。
有効化は2通り:BcDbMigrator はインストールスクリプト(マイグレーション)を持たないため、plugins テーブルに1行 INSERT すれば有効化できる(name='BcDbMigrator', title='BcDbMigrator', version='5.2.0', status=1, db_init=1, priority=<末尾+1>, created/modified=NOW())。ブラウザ操作不要。有効化後 bin/cake にコマンドが出る。cake plugin load/config/plugins.php 直接編集は不可(ルーティング不整合でクラッシュ要因)。docker exec <container> bash -lc 'cd v5 && bin/cake bc_db_migrator tmp/<v4バックアップ>.zip' を実行すると、変換済み zip が v5/tmp/baserbackup_<v5version>_<日時>.zip に出力される(アップロード/ダウンロードの往復が不要。エラー時もアシスタントが反復できる)。変換は一時接続(bcOldDbMigrator/bcNewDbMigrator・接頭辞付き一時テーブル)で行われライブ DB は変更しない(出力は zip のみ)。extends \BaserCore\Database\Schema\BcSchema(FQN)に置換するが、baser-core 5.2.5 の BcDatabaseService::isValidSchemaFile() は AST で extends が短縮名 BcSchema の完全一致であることを要求するため、無効なスキーマファイル: BcSchema を継承し、drop/create メソッドをオーバーライドしてはいけません で全滅する(CLI/ブラウザ共通の Component 経路)。対処: plugins/BcDbMigrator/src/Controller/Component/BcDbMigratorComponent.php の _createTableBySchema() 内、extends CakeSchema を FQN でなく短縮名に置換し use 文を足す:$contents = preg_replace('/extends CakeSchema/', 'extends BcSchema', $contents);
$contents = str_replace('<?php', "<?php\nuse BaserCore\\Database\\Schema\\BcSchema;", $contents);isValidSchemaFile() が短縮名の完全一致のみ許可し FQN を弾く点。これを FQN も受理するよう緩和する修正を baserproject/basercms へ PR #4438(5.3.x 宛)で提出済み。マージ・リリースまでは本ローカルパッチ(BcDbMigrator 側で短縮名に置換)が必要。5.3 以降ではパッチ不要になる見込み。)UtilitiesService::_loadBackup() は zip 内の全 *Schema.php を drop→create し全 CSV を投入するだけで、plugins テーブルの有効/無効は参照しない。したがって、変換済み zip にスキーマ+CSV が入っているテーブルは、該当プラグインが無効でも取り込まれる(unzip -l で <Table>Schema.php の同梱を確認しておく)。plugins テーブル自体も zip の内容(=v4 のプラグイン一覧・全行 status=0)で置き換える(実測): 復元前に行った有効化レコード(コアの BcBlog/BcMail 等を含む)は全部消えて無効化される。復元後に必ず再有効化する: コア標準6つ UPDATE plugins SET status=1 WHERE name IN ('BcBlog','BcMail','BcUploader','BcSearchIndex','BcThemeConfig','BcWidgetArea') +移行対象のうち確認済みのもの(動作確認工程中なら移行対象は 0 のままでよい)。BcDbMigrator/BcAddonMigrator の行も消えるので、引き続き使うなら再 INSERT。実施後 bin/cake cache clear_all。sites テーブルも同様に上書きされ、テーマ適用が外れる(実測): 復元後は全サイト theme='BcThemeSample' に戻る(BcDbMigrator 変換の既定値。マルチサイトの各行も v4 から復元される)。フロントを開くと MissingLayoutException(探索パスに自作テーマが無い)で気づく。復元後にテーマを再適用: UPDATE sites SET theme='<CamelCaseTheme>' WHERE id=<対象サイト>+キャッシュクリア。=**「復元後の再設定3点セット: plugins 再有効化・sites.theme 再適用・cache clear_all」**として覚える。bc_addon_migrator コマンドが Unknown command になる)。ツールを再度使う場合は plugins テーブルへ再 INSERT(+cache clear)してから実行する。site_id の整合を必ず検証する(実測・不整合あり): 復元データはテーブルごとに site_id の変換が食い違うことがある — contents.site_id は「v4 の id +1」(5系標準・メイン=1)に変換される一方、sites.id は AUTO_INCREMENT で 2〜 に詰め直され、プラグイン系テーブル(search_indexes 等)の site_id は v4 のまま無変換。結果、サブサイトの contents が存在しない site_id を指し、サブサイトURL(/blog/ 等)が全部 404 になる。検証SQL: SELECT site_id, COUNT(*) FROM contents GROUP BY site_id と SELECT id, alias FROM sites を突き合わせる。修正は「5系標準=contents の付番(v4 +1)」に他を合わせる: sites.id と各テーブルの site_id を降順に UPDATE(衝突回避)し、ALTER TABLE sites AUTO_INCREMENT=<最大+1>。site_id カラムを持つテーブルは information_schema.COLUMNS で洗い出す。再復元すると不整合も再発するので、統一SQLを控えておき復元のたびに再実行する。viewVars 参照等)で管理画面を壊しがち。上記のとおり復元は無効でもテーブルを取り込むので、UPDATE plugins SET status=0 WHERE name IN (...)+キャッシュクリアで管理画面を復旧させてから復元してよい(どのみち動作確認工程では一旦全無効化する)。注意点:
config/install.php の Datasources.default に 'quoteIdentifiers' => true を復元前に必ず入れる。4系サイトはメールフォーム項目由来の check・message 等の予約語カラムをほぼ確実に持っており、未設定だと復元が SQLSTATE[42000] 1064 Syntax error ... near 'check' で途中失敗する。「必要になる場合がある」ではなく既定で設定してよい(quote されて困ることはない)。mv config/install.php config/install.php.bak + .env の INSTALL_MODE="true"(install.php が残っていると「インストール済み」扱いで bootstrap が空DBを参照して落ちる)bin/cake install <URL> <メール> <パス> <DB名> --baseurl /v5/ --host <DBホスト> --username <ユーザー> --password <パス>INSTALL_MODE を false に戻し、再生成された install.php に quoteIdentifiers を再設定、プラグインの plugins INSERT・migrations migrate -p・sites.theme を再適用Missing or invalid CSRF cookie になる → ログインページを再読み込みしてからログインしてもらう。復元成功後は users が v4 のものに置き換わるため、以後のログインは v4 と同じ管理者ID/パスワードになる(事前にユーザーへ伝えておく)。/files ディレクトリを /v5/webroot/files に移動してください。
cp -a するのが速い。v5/webroot/files は復元やプラグイン有効化の時点で既に一部生成されている(theme_configs/ uploads/ やブログのディレクトリ骨格など)。そのため cp -a /path/files /v5/webroot/files とすると files/files/ にネストしてコピーされる。既存ディレクトリへのマージは cp -a /path/files/. /v5/webroot/files/(末尾 /.)で中身をコピーする。ネストしてしまったら cp -a .../files/files/. .../files/ && find .../files/files -delete で解消。/files/...(サブディレクトリ無し)**が出力され、v5 ページから v4 の files を誤参照する(v5 の error.log に MissingRouteException: /files/... が並ぶ)。files 移行後は /v5/files/... が正しく生成される。この工程は「プラグイン有効化→描画確認」より前に済ませること。src を curl | grep -o 'src="[^"]*files[^"]*"' で抜き、静的配信の 200 を確認する。ローカル環境では DB は最新なのに files が古い(本番から持ってきた時期のズレ)ことがあり、その 404 は移行起因ではない — v4 側の同パスにも実体が無いことで切り分ける。テーマの変換には、BcAddonMigrator プラグインを使用します。
theme/)を含めず、テーマディレクトリ自体がルートになるように圧縮する必要があります。# 1. テーマ名を特定 (データベースの site_configs テーブルを確認)
# 例: SELECT value FROM site_configs WHERE name = 'theme';
# 結果: my-custom-theme
# 2. テーマディレクトリ名をキャメルケースに変更
# 例: my-custom-theme -> MyCustomTheme
THEME_NAME="my-custom-theme" # 実際のテーマ名に置き換える
THEME_CAMEL="MyCustomTheme" # キャメルケースに変換
# ★【最重要・データ破壊注意】変換後の名前が「大文字小文字だけの差」になる場合
# (例: philosophy → Philosophy)、macOS 等のケースインセンシティブFSでは
# theme/<camel> が元ディレクトリと同一に解決され、一時コピーの削除で
# **元テーマ本体を削除してしまう**(実害あり。サブモジュールなら
# `git submodule update --init theme/<name>` で復旧できる)。
# 同名ケース差になるテーマは theme/ 配下でなく一時ディレクトリへコピーする:
# cp -r "theme/${THEME_NAME}" "/tmp/${THEME_CAMEL}" して /tmp 側で zip する
cp -r "theme/${THEME_NAME}" "theme/${THEME_CAMEL}"
# 3. ZIP圧縮 (node_modules除外)
mkdir -p v5/tmp/zip
cd theme
zip -r "../v5/tmp/zip/${THEME_CAMEL}.zip" "${THEME_CAMEL}/" -x "*/node_modules/*"
rm -rf "${THEME_CAMEL}"
cd ..
# 4. 圧縮後の確認(重要)
unzip -l "v5/tmp/zip/${THEME_CAMEL}.zip" | head -n 20
# ルートが MyCustomTheme/ であること、theme/ ディレクトリが含まれていないことを確認BcAddonMigrator をインストール・有効化します(GitHubより取得)。
* 注意: BcAddonMigrator は GitHub から取得し、plugins/BcAddonMigrator に配置する。有効化は plugins テーブルへの直接 INSERT で可(インストールマイグレーションを持たないため。実証済み。「プラグインの有効化(DB直接・標準)」節の手順2)。cake plugin load/config/plugins.php 直接編集は不可。bc_addon_migrator コマンドを使用してテーマを変換します。# Docker環境の場合
THEME_CAMEL="MyCustomTheme" # 実際のキャメルケーステーマ名に置き換える
docker exec <container-name> bash -c "cd v5 && bin/cake bc_addon_migrator --type=theme tmp/zip/${THEME_CAMEL}.zip"
# 出力: v5/tmp/${THEME_CAMEL}_5.2.0.zipv5/plugins/ に展開します。THEME_CAMEL="MyCustomTheme" # 実際のキャメルケーステーマ名に置き換える
cd v5/tmp && unzip -q -o "${THEME_CAMEL}_5.2.0.zip" -d ../plugins/$post['BlogPost']['name']) をエンティティプロパティ ($post->name) に変更。'plugin' キーを追加し、コントローラー名をアッパーキャメルケースに変更(例: 'controller' => 'search_indexes' → 'controller' => 'SearchIndexes')。$this->BcForm->create('Model') を $this->BcForm->create($entity) または null に変更。input() を control() に変更。PluginName.element_name 形式に変更。プラグインの変換にも BcAddonMigrator プラグインを使用します。
ただし、GitHubのリポジトリ等で既に baserCMS 5 に対応したバージョンが公開されている場合があります。その場合は、変換作業を行わず、そちらを利用してください。
プラグインを一括変換にかける前に、プラグインを1つずつ棚卸しし、「4系を変換する」か「既存の5系版を使う」かをユーザーと確認して決める。いきなり全プラグインを BcAddonMigrator にかけない(既に公式/作者が5系版を出しているものを二重にメンテすることになる)。
baser-core/bc-* に統合済みか)②作者/配布元の GitHub・baserマーケットに 5系対応版があるか③外部SaaS連携等で5系版が別提供か、を確認する。判断材料が乏しいものは「要確認」として残す。BcAddonMigrator で変換 → 内部コードを5系化。app/Plugin/)を含めず、プラグインディレクトリ自体がルートになるように圧縮する必要があります。# app/Plugin/ に移動して全プラグインを圧縮(node_modules除外)
mkdir -p v5/tmp/zip
cd app/Plugin
for d in */; do
name=${d%/}
zip -q -r "../../v5/tmp/zip/${name}.zip" "$name" -x "*/node_modules/*"
done
cd ../..bc_addon_migrator コマンドを使用して全プラグインを一括変換します。# Docker環境の場合
docker exec <container-name> bash -c "cd v5 && for zip in tmp/zip/*.zip; do bin/cake bc_addon_migrator \"\$zip\"; done"
# 出力: v5/tmp/<PluginName>_5.2.0.zip (各プラグインごと)v5/plugins/ に一括展開します。cd v5/tmp && for zip in *_5.2.0.zip; do unzip -q -o "$zip" -d ../plugins/; done && cd ../..rm -rf v5/tmp/zip v5/tmp/*_5.2.0.zipbaserbackup_*.zip(DB変換済みバックアップ)は削除しない。v5/tmp/ には BcDbMigrator の出力 zip も同居しているため、ワイルドカードは変換中間 zip(<PluginName>_<version>.zip)だけに掛かるよう対象を限定する。rm -rf が Bash 権限で拒否される環境では find <path> -delete を使う(例: find v5/tmp/zip -delete。ファイル個別は find v5/tmp -maxdepth 1 -name '<Name>_*.zip' -delete)。Controller/Model/View の src/ 名前空間化、admin_ メソッドの Controller/Admin 分離、src/<Name>Plugin.php の生成(空クラス class <Name>Plugin extends BcPlugin {})、config.php/setting.php の return 配列化。config/Schema(4系 CakeSchema)→ config/Migrations への変換(4系 Schema がそのまま残る)、config/init.php の除去(残骸として残る)、内部コードの5系化(ClassRegistry・$this->data 等は残存)。php -l は通るが、Migrations 無し・4系残骸あり」が正常な状態。復元運用なら有効化に支障はない(「プラグインの有効化(DB直接・標準)」節参照)。Migrations 生成・残骸掃除・内部5系化は横断チェック工程(フロー15-17)で行う。admin_ プレフィックスメソッドは Controller/Admin 名前空間へ移動されています。config/setting.php の BaserCore.nav などの配列構造の調整。また、$config 変数定義ではなく、配列を return する形式に変更。array() シンタックスは [] (短縮構文) に変更し、インデントを整えること。$config['Key'] 定義がある場合は、1つの return 配列内にマージすること。return [ $config = [...] ]; という多重構造にならないよう注意する。$config = は削除し、純粋な配列定義にする。adminNavigation の url は plugin/controller とも CamelCase にする(例 'plugin' => 'PopularBlogPost', 'controller' => 'PopularBlogPostConfigs')。4系の snake_case のままだと共通サイドバーのURL生成が MissingRouteException になり、そのプラグインだけでなく全管理画面が 404 になる(統合テストで検出した実例)。4系専用の adminNavi ブロックは5系で未使用のため削除してよい。bake migration_snapshot -p [PluginName] --table [TableName] を実行しても、テーブル定義が正しく抽出されない(空のファイルになる)場合がある。bin/cake bake migration_snapshot GlobalInitial を実行して全テーブルの状態を取得し、生成されたコードを各プラグインの Initial.php に手動で(またはスクリプトで)分配する手法が確実である。$autoId = false となるのは、既存のデータベース構成をカラム名からインデックス、コメントに至るまで正確に再現するためである。addColumn することで、移行元データベースとの差異をなくす。v5/config/app_local.php よりも v5/config/install.php が優先されます。設定を確認・変更する場合は両方のファイルに注意してください。v5/config/plugins.php は直接編集しないこと。baserCMS 5 ではプラグイン管理画面で有効化されたプラグインが自動的にロードされる仕組みになっており、このファイルを直接編集すると依存関係やルーティング (routes.php) の読み込み順序に不整合が生じ、アプリケーションがクラッシュする原因となる。baser-core など)および、パッケージに最初から含まれていたプラグイン(bc-admin-third 等、ディレクトリ名にハイフンが含まれるコア系のプラグイン)に手を入れてはいけません。これらは本体アップデートの影響を受けるため、移行作業の対象から除外してください。BcAddonMigrator は admin_ プレフィックスの付いたメソッドは自動的に移動しますが、それらが呼び出している protected メソッドや _setFormViewData 等のヘルパーメソッドは、元の(フロント側)コントローラーに残ったままになります。これらは手動で管理用コントローラー (Controller/Admin) へ移動し、名前空間や必要な use 文を修正してください。config.php も同様に配列を return する形式であることを確認する(BcAddonMigrator で自動変換されるが、念のため)。config/init.php は廃止。src/[PluginName]Plugin.php (クラス名: [PluginName]Plugin) を作成し、BaserCore\BcPlugin を継承する。$this->Plugin->initDb() は不要(マイグレーションが自動実行されるため)。install() や bootstrap() メソッドに移行する。install メソッドのシグネチャは public function install($options = []): bool である必要があり、戻り値として parent::install($options) の結果(または true)を返すこと。Config/Schema は廃止。CakePHP Migrations (config/Migrations) に移行。配置した移行対象プラグインの有効化は、plugins テーブルへの直接 INSERT を標準とする。ブラウザ往復ゼロでエージェントが自走でき、検証も SQL で完結する(管理画面有効化は代替手段として注記参照)。
★テーマは plugins テーブルに登録しない(新規インストール直後の plugins にデフォルトテーマ BcFront の行が無いことから実証済み)。テーマの適用は次節「テーマの適用(DB直接)」の sites.theme UPDATE のみでよい。
ls v5/plugins/<Name>/config/Migrations で Migrations の有無を確認する。BcAddonMigrator 変換組は通常 Migrations を持たない(4系 config/Schema が残っているだけ)。復元 zip にスキーマ+データが含まれるかを unzip -l v5/tmp/baserbackup_*.zip | grep -iE "<table名>" で確認し、含まれていれば復元がテーブルを供給するので Migrations 生成は不要(クリーンインストール運用にする場合のみ bake migration_snapshot で生成)。plugins テーブルへ INSERT(全プラグイン共通):INSERT INTO plugins (name, title, version, status, db_init, priority, created, modified)
VALUES ('<Name>', '<Name>', '<version>', 1, 1,
(SELECT p FROM (SELECT COALESCE(MAX(priority),0)+1 AS p FROM plugins) tmp), NOW(), NOW());docker exec <container> bash -lc 'cd /var/www/html/v5 && bin/cake migrations migrate -p <Name>'bin/cake cache clear_all(プラグインロード構成が変わるため)。SELECT name, status FROM plugins で status=1、Migrations 実行組は SHOW TABLES でテーブル生成を確認し、bin/cake version が fatal なくバージョン番号を返すこと(=有効プラグイン全部の bootstrap が通ること)を確認する。フロント/管理画面のブラウザ確認はまだ求めない — 内部コードが4系のままなので画面は出なくて正常。ブラウザ確認は動作確認工程(標準フロー17)以降。管理画面が必要になるのは復元(フロー12)だけなので、その直前に管理画面ログインだけ生存確認すればよい。(b)変換組を有効化すると、画面以前にアプリ起動(bootstrap)で fatal になる4系残骸が動き出す(php -l では捕まらない実行時エラー)。有効化後の bin/cake version スモークで1つずつ顕在化するので、最小修正(TODO マーカー付き)だけしてフロー15-16(本格5系化)へ先送りする。実測した典型パターン:
| 場所 | 症状 | 最小修正 |
|---|---|---|
src/Event/*EventListener.php | Class "<NS>\Event\ClassRegistry" not found(BcEvent が有効プラグインのリスナーを bootstrap で instantiate するため、コンストラクタ内の4系APIが即死) | ClassRegistry::isKeySet/getObject 分岐を削除し TableRegistry::getTableLocator()->get() 一本化 |
config/setting.php | Class "CakeLog" not found / Configure::load が配列を得られない | CakeLog::config() 等の実行文を除去(ログ設定は Phase 4 で Plugin::bootstrap へ)。$config['X'] = [...] は return ['X' => [...]] へ |
config/setting.php 内の4系定数 | Undefined constant "CACHE_DATA_PATH" 等 | 5系の定数(TMP・CACHE 等)へ置換 |
config/routes.php | Router::connect 静的呼び出し・CakeRequest・BcSite::findByUrl で fatal | ファイル全体を return; で無効化+旧定義をコメント保存(Phase 4 で RouteBuilder 形式に書き換え) |
スモークが通る(bin/cake version がバージョンを返す)までこの表の要領で潰す。
★CLI スモークの限界に注意: bin/cake version は Web リクエストと bootstrap 経路が一部異なり、BcEvent のリスナー生成起因の fatal(例: コンストラクタでの Table 即時取得→MissingTableClassException)をすり抜けることがある(実測)。CLI スモーク通過=Web も無事、ではない。Web 側の最終確認は管理画面の GET 統合テスト(工程17-b)か実ブラウザで行う。リスナーのコンストラクタでは Table を即時取得せず遅延取得にするのが安全。
BcAddonMigrator が生成する Plugin クラスは空(class XxxPlugin extends BcPlugin {})で独自 install 処理を持たないため、管理画面有効化との差は「マイグレーション自動実行の有無」だけ。それは手順3で補える。独自の install() をオーバーライドしているプラグインだけは中身を確認し、必要なら管理画面から有効化する。config/plugins.php の直接編集は不可(既出の注意どおりクラッシュ要因)。UPDATE plugins SET status=0(/1) WHERE name='<Name>'+bin/cake cache clear_all で行える(テーブルとデータは残るので安全)。5系ではテーマは site_configs ではなく sites テーブルの theme カラムで管理される。適用も DB 直接更新を標準とする。
-- サイトごとに適用(マルチサイトは site 単位で theme を持つ。全サイト同一テーマなら WHERE 句なし)
UPDATE sites SET theme = '<CamelCaseTheme>' WHERE id = 1;bin/cake cache clear_all(テーマ解決がキャッシュされるため)。BcAddonMigrator で変換した後の プラグイン内部コードの具体的な書き換え(Controller の $this->Model→fetchTable、Table の initialize() アソシエーション宣言・find() クエリビルダ化、Entity/getControlSource、View/Helper、検索フォーム・編集フォームの BcAdminForm/control() 化、Time::format の ICU、Number::format/Text::truncate の null 対応、Vue・JS の $.bcUtil.adminBaseUrl 化と webpack 再ビルド、フロント表示エラーの症状別対処 等)は、専用スキル basercms-plugin-4-to-5-upgrade にカタログ化している。プラグインの画面を1枚ずつ通して動かす段階では、そちらを参照すること(C-0 機械一括変換カタログ/T- Table・ORM/C- Controller・画面/F- フロント表示エラーのうちプラグイン文脈分)。テーマ(templates 中心)の移行パターン(TH-系+テンプレート・テーマ描画系の F-系)は basercms-theme-4-to-5-upgrade スキルに分割している。変換先=5系の正しい書き方の正本は basercms5-plugin-development(プラグイン)/ basercms5-theme-development(テーマ)を参照。
BcAddonMigrator 変換後のプラグイン内部コードを手作業で5系化する工程は、次のワークフローで進めると速くて安全(実証済み)。目的は、任意の baserCMS4系プロジェクトを最小の手間で5系へ移行できる状態を作ること。
なぜこの順序か: 移行では「画面表示は動くのに、保存・集計・出力ロジックが静かに壊れている」ケースが多い(按分計算・集計の戻り値形状・絞り込み条件・本番に無い列など、目視では正しさを判断できない)。一方でユーザーの最大の手間は画面テストのリロード反復。テストはAIが自律実行でき人手が要らない。よって テストで正しさを固めてから、画面結合をまとめて1回 が最も手間が少ない。
結合タイミングはドメインごと(見積を固める→見積画面を1回確認→次は請求…)。問題を新鮮なうちに発見でき手戻りが小さい。
4→5移行は1セッションが普通のタスクより長くなりやすい(環境構築→DB移行→棚卸し→変換→ドメインごとの5系化…と工程が多い)。セッションが長引くと、コンテキスト肥大でアシスタントのツール呼び出しが壊れ始めることがある(症状: <invoke>/<parameter> の名前空間プレフィックス欠落や、先頭に無関係な語=例「court」が紛れ込んでコマンド/ツール呼び出しが失敗する。環境やシェルの不具合ではなく、アシスタント側の出力フォーマット崩れ)。
/compact でコンテキストを圧縮してから続行する(要点は要約に引き継がれるので作業は継続できる)。工程の区切り(各フェーズ完了時など)でも予防的に /compact してよい。4系プラグインを
BcAddonMigratorで変換し v5 に配置した後、git に取り込む際の定番のハマりどころ。G-2〜G-4 はどのプロジェクトでも該当。G-1 は 4系で git サブモジュールを使っていたプロジェクト限定(多くのプロジェクトはサブモジュール未使用なので該当しない)。
.git(gitlink)を除去※ この項目は、4系でプラグインを git サブモジュール(.gitmodules に登録)として管理していたプロジェクトのみ対象。サブモジュールを使っていなければ .git は付いてこないので無関係(find v5 -name .git が 0 件なら該当なし)。
4系で git サブモジュールだったプラグイン(app/Plugin/<X>)をコピーすると、.git(gitlink ファイル)も付いてくる。これは gitdir: ../../../.git/modules/app/Plugin/<X>(=4系本体のサブモジュール格納庫)を指したままで、「同じ git モジュールに2つの作業ツリーが紐づく」「変換済み5系コードが4系HEADと全差分」等の矛盾を起こす。
find v5 -name .git -type f -delete で v5 配下の gitlink ファイルを削除(実コード・.gitignore・4系の実サブモジュール/.git/modules/.gitmodules には触れない=安全)。これで変換済みプラグインは「普通のディレクトリ」になる。.gitignore は /plugins/* を無視する → 自作プラグインを negationv5 同梱 .gitignore は /plugins/* を無視し、コア/サンプル(!/plugins/baser-core, !/plugins/bc-*, !/plugins/BcColumn 等)だけ negation で追跡する設計。そのままでは変換済みの自作プラグインが追跡対象外になる。
!/plugins/Sample のように negation 追記(git check-ignore v5/plugins/Sample が空=追跡可、で確認)。/plugins/*/vendor・/plugins/*/node_modules・/plugins/*/composer.lock・schema-dump-default.lock は無視のまま。webroot/files/* は git に含めないv5 標準 .gitignore は /webroot/files/* を無視する(正しい既定)。4系から移行したアップロード(本プロジェクトは 1.7GB / 1万超ファイル)を git に入れると repo 肥大化・clone 遅延・GitHub 制限で push 不可になり得る。除外のままにし、実体は別途バックアップ/再コピーで運用する(!/webroot/files/.gitkeep で空ディレクトリ保持)。git add -n v5 | wc -l 等で巨大物の混入を事前確認するとよい。
git add v5 時、ネストした v5/.gitignore は親リポジトリでもそのまま効く(秘匿 config/.env・app_local.php・vendor・tmp・logs は自動除外される)。git add -n(dry-run)でステージ予定を必ず検証してからコミットする。プラグインを将来「再利用可能な独立リポジトリ」にしたい場合も、まずは親に通常ファイルで取り込み、安定後に git subtree split で切り出す段階移行が扱いやすい。
vendor/baserproject/ 以下)との整合性を確認してください。& を末尾につける、またはツールの WaitMsBeforeAsync を短く設定して放置するなど)を行わないでください。処理が滞留し、後続の操作を受け付けなくなる可能性があります。必ず同期的に完了させてください。© baserproject, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file
Just SKILL.md in .agents/skills/basercms4-to-5-upgrade of baserproject/basercms.
Open the folder on GitHubat commit f1eaa0b
Basercms4 To 5 Upgrade next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.
| Skill | Stars | Used in | Tokens | Auto-check | Licence | Repo updated |
|---|---|---|---|---|---|---|
| Basercms4 To 5 Upgrade this skillbaserproject/basercms | 191 | — | ~9.6k | Automated safety check: Notes | MIT | |
| Alsacreations Guidelinesalsacreations/kiwipedia | 338 | — | ~900 | Automated safety check: Pass | None | |
| Trellis StartROYIANS/foliq-print-template-designer | 136 | 6 repos | ~646 | Automated safety check: Pass | MIT | |
| Compound Engineering SetupEveryInc/compound-engineering-plugin | 25k | — | ~2k | Automated safety check: Pass | MIT | |
| Readyprekuter/dryforge | 413 | 1 repos | ~6.8k | Automated safety check: Pass | Apache-2.0 | |
| Command Creatormeshery/meshery-operator | 151 | 4 repos | ~1.7k | Automated safety check: Pass | Apache-2.0 |
alsacreations/kiwipedia
Guidelines techniques et conventions internes d'Alsacréations (Kiwipedia) — HTML, CSS, JavaScript, TypeScript, Vue.js, WordPress, PHP/MySQL, accessibilité, performance, SEO, RGPD, écoconception…
ROYIANS/foliq-print-template-designer
Initializes an AI development session by reading workflow guides, developer identity, git status, active tasks, and project guidelines from .trellis/.
EveryInc/compound-engineering-plugin
Checks Compound Engineering plugin health and repo-local config, or scaffolds a Compound Pack when you ask for one by id.
prekuter/dryforge
Understand what you mean before anything is built. An agent skill from prekuter/dryforge.
meshery/meshery-operator
This skill should be used when creating a Claude Code slash command.
prekuter/dryforge
Bring an existing codebase into Dryforge, once. An agent skill from prekuter/dryforge.
baserproject/basercms
baserCMS のリポジトリセキュリティアドバイザリ(GHSA・triage含む)対応を、一覧取得→指摘検証→課題別の修正→プライベートフォーク/ブランチ/PR作成→ローカル検証まで一気通貫で扱う手順とスクリプト。「セキュリティアドバイザリを確認」「triageの脆弱性を検証」「アドバイザリごとにフォークとPRを作って」「脆弱性修正をプルリクにまとめて」等のときに使う。Copilot/GHAは…
baserproject/basercms
baserCMS の「通常プラグイン(サードパーティ/単体配布)」を monorepo の「コアプラグイン」に昇格させる手順。「コアプラグインに変更」「コアプラグイン化」「通常プラグインをコアに昇格」「monorepo に取り込む」等のときに参照する。プラグイン名の規約変更(bc- プレフィックス付与・CamelCase→ハイフン区切り)、.git/シンボリックリンク/standalone…
baserproject/basercms
baserCMS プラグインを 5.2系 から 5.3系(PHP 8.5 / CakePHP 5.2.x ベース、開発中)へ移行する際の baserCMS 固有の破壊的変更・非推奨・テスト基盤対応のレシピ集。「プラグインを5.3に対応」「baserCMS 5.3 マイグレーション」「PluginCollection::create(): $config null given」「Plugin…
baserproject/basercms
baserCMS の plugins/baser-core/VERSION.txt に、リリース分の変更履歴(NEW/CHG/BUG)をコミットログから生成して追記する手順。「VERSION.txt を更新して」「リリースノートを作って」「変更履歴をまとめて」「今回のリリース分の変更点を書き出して」「前回リリースからの差分を VERSION.txt…
baserproject/basercms
baserCMS(CakePHP5 / PHPUnit)のユニットテストをローカル Docker 環境で実行・調査する手順。「ユニットテストを実行して」「全テストを走らせて」「このテストだけ流して」「テスト失敗を調べて」「プラグイン単体でテストを動かしたい」「プラグインにテスト環境を導入したい」等のときに参照する。コンテナ名・実行コマンド・権限自動承認のためのコマンド整形・失敗の集計と切り分け方…
baserproject/basercms
baserCMS 4系(CakePHP 2.10ベース)+ jQuery プロジェクトの開発ルール集。「baserCMS 4 で開発」「4系のプラグインを修正」「CakePHP 2系のコードを書く」「app/Plugin 配下の Controller/Model/View」「テーマの…
Categories
baserCMS 4 (CakePHP 2ベース) のコード・サイトを baserCMS 5 (CakePHP 5ベース) へアップグレード/移行する際に AIエージェントが遵守すべきルールとパターン集。「baserCMS 4 から 5 へ移行」「4系を5系にアップグレード」「BcDbMigrator でデータ移行」「BcAddonMigrator でテーマ/プラグイン変換」「CakePHP…. Basercms4 To 5 Upgrade is an agent skill from baserproject/basercms.
Basercms4 To 5 Upgrade fits situations like: tasks that involve Hooks and plugins.
Run `npx skills add baserproject/basercms --skill basercms4-to-5-upgrade -a claude-code`. Or copy the skill folder (.agents/skills/basercms4-to-5-upgrade in baserproject/basercms) into .claude/skills/basercms4-to-5-upgrade in your project. Claude Code loads it when a task matches its description.
Run `npx skills add baserproject/basercms --skill basercms4-to-5-upgrade -a codex`. Or copy the skill folder (.agents/skills/basercms4-to-5-upgrade in baserproject/basercms) into .agents/skills/basercms4-to-5-upgrade in your project. Codex loads it when a task matches its description.
Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add baserproject/basercms --skill basercms4-to-5-upgrade -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/basercms4-to-5-upgrade, .gemini/skills/basercms4-to-5-upgrade, .github/skills/basercms4-to-5-upgrade and .opencode/skills/basercms4-to-5-upgrade in your project.
Going by SKILL.md and its folder, Basercms4 To 5 Upgrade needs the command-line tools its instructions call (docker, git, composer, php and curl). Our summary lists: Docker.
SKILL.md names 3 domains. In commands or code: basercms.net and github.com; the agent is likely to contact these when it follows the instructions. As links in the text: baserproject.github.io. This is read from the text; nothing was executed.
Our automated static check of SKILL.md found notes only (mentions a .env file), nothing it rates as a warning. It is not a guarantee. Review the folder before installing.
Basercms4 To 5 Upgrade is published under the MIT licence (declared in SKILL.md). It allows redistribution, so the full SKILL.md is shown on this page.
About 9.6k tokens (SKILL.md is roughly 38k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.
Skills that share tags, products or a category with Basercms4 To 5 Upgrade: Alsacreations Guidelines (alsacreations/kiwipedia, 338 stars), Trellis Start (ROYIANS/foliq-print-template-designer, 136 stars), Compound Engineering Setup (EveryInc/compound-engineering-plugin, 25k stars) and Ready (prekuter/dryforge, 413 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.
baserproject (a GitHub organization) maintains it in baserproject/basercms, which has 191 GitHub stars. The repository holds 15 skills in this directory. The repository was last updated on October 8, 2026.
Source: baserproject/basercms on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.