Skip to content

DevEx: Keep phpc init --profile miniwebapp template in sync with examples/003-MiniWebApp #695

@PurHur

Description

@PurHur

Problem

./phpc init --profile miniwebapp scaffolds from templates/init-miniwebapp/ (#632), but the canonical reference app is examples/003-MiniWebApp/. The trees have drifted (e.g. public/index.php, src/Router.php differ today).

New projects get an older skeleton; bugs fixed in the example do not reach phpc init users.

Goal

Treat examples/003-MiniWebApp as source of truth and keep templates/init-miniwebapp/ aligned (or generate the template from the example in CI).

Scope

  • Document sync policy in templates/init-miniwebapp/README.md and examples/003-MiniWebApp/README.md
  • Add script/check-init-miniwebapp-parity.sh (diff key files: public/index.php, src/Router.php, phpc.json, config.php, template partials)
  • Wire check into ./script/ci-fast.sh or ExamplesManifestTest (fast, no LLVM)
  • When intentional divergence is needed, require a comment marker in both trees

Acceptance criteria

./script/check-init-miniwebapp-parity.sh   # exit 0 when in sync
./script/ci-fast.sh

After phpc init --profile miniwebapp /tmp/mw && ./phpc lint --all /tmp/mw, lint matches example capabilities (PATH_INFO, REQUEST_METHOD, templates).

Verification (local / Docker only)

./phpc init --profile miniwebapp /tmp/mw-test
./phpc lint --all /tmp/mw-test
./script/check-init-miniwebapp-parity.sh
docker run --rm -v "$(pwd):/compiler" -w /compiler php-compiler:22.04-dev ./script/ci-fast.sh

Dependencies

Non-goals

  • Auto-sync on every commit without an explicit check (silent drift)
  • Changing example routes without updating init template in the same PR

Links

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions