Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 15 additions & 15 deletions .claude/commands/upgrade-assessment.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,14 @@ Usage: `/upgrade-assessment <targetVersion>` — the target must match
`/upgrade-hop`; do not ask again. Never ask for attestation or approval.
Then print the non-blocking run notice per `write-scope.md` ("Required run-notice wording"):
instance, version pair, individual routine commands (the `next-steps` status helper,
PHPStan (the baseline run at the current PHP and the target-PHP run, plus the isolated latest-stable `composer require --dev phpstan/phpstan` inside `.ccua/tools/phpstan/` only), one UCT
PHPStan (the baseline run at the current PHP and the target-PHP run, plus the isolated latest-stable `composer require --dev phpstan/phpstan` inside `.commerce-upgrade/tools/phpstan/` only), one UCT
scan with `--ignore-current-version-compatibility-issues` or baseline and target scans,
read-only `composer_probe.py` lookups, normalization, controlled URL/source helpers), ambient
developer mounts (expected, never read, never a blocker), the standing local/dev non-production
profile and files written. Run routines automatically. If a production signal withdraws the
standing profile, return a human-run runbook for each blocked step.
Third-party target-release resolution (`composer_probe.py --op resolve|fetch` in the scratch
directory `.ccua/tools/resolve`, see the specification below, 3.5) is not routine: list it in
directory `.commerce-upgrade/tools/resolve`, see the specification below, 3.5) is not routine: list it in
the notice as a separate exact-action step and run it only after that approval; if declined,
third-party Composer/UCT/PHP columns stay `Not assessed` with the reason.
2. Apply `environment-detection` for `dockerType`, `containerPrefix`, PHP and service
Expand All @@ -60,7 +60,7 @@ Apply `uct-install`'s **Assessment prerequisite** before collecting UCT evidence
generating scan-dependent reports. Reuse its Magento, Composer and standalone probes in
the verified environment; do not create a second detection or installation flow.
Never install dependencies in this command except the `uct-install` Step 3 standalone UCT
install into `var/ccua/uct-standalone`, and only after the user's explicit approval of that
install into `var/commerce-upgrade/uct-standalone`, and only after the user's explicit approval of that
choice. If missing, offer that install, then re-probe afterward. If installation is declined or fails, continue only
after the user's explicit incomplete-assessment choice; otherwise pause.
Use the shared failure recovery for `execution-failed` and `normalization-unsupported`;
Expand Down Expand Up @@ -100,7 +100,7 @@ in-memory assessment data model (Section 5):
6. 3.7 Patches, with an automatic dry-run: use an operator-supplied tree if given; otherwise run
`node <scripts>/assess_tools.mjs tree-plan . --target <targetVersion>` and ask ONE exact-action
approval for the two `composer` commands it prints (dependency install, so never implicit; run only inside
`var/ccua/target-tree-<targetVersion>`, never in the project; ambient Composer keys are used implicitly and
`var/commerce-upgrade/target-tree-<targetVersion>`, never in the project; ambient Composer keys are used implicitly and
never read). If approved, run them one at a time, then its `thenRun` `patches` command
(`--tree-kind vanilla`) and delete the tree afterwards. If declined or failed, mark `UNABLE_TO_VALIDATE`,
record the reason in `gaps` and give the human-run commands. The report states the validation environment.
Expand Down Expand Up @@ -234,33 +234,33 @@ Each section writes one object into the assessment data (Section 5). Every table
run. PHPStan is always a standalone install of the latest stable release (never pinned to
one exact version), so the latest PHP version is supported even when the project ships an
older `vendor/bin/phpstan` (which is never used here).
1. Install into the isolated tool directory `.ccua/tools/phpstan/` (gitignored, own
1. Install into the isolated tool directory `.commerce-upgrade/tools/phpstan/` (gitignored, own
`composer.json`; an older leftover constraint there is replaced), by running `composer require --dev phpstan/phpstan
--no-interaction --no-plugins --no-scripts` inside that directory only. No version
constraint: Composer picks the latest stable release the container's PHP supports (an old
project PHP gets a compatible older PHPStan). Run it every time so an outdated copy is
updated, then read the installed version with `.ccua/tools/phpstan/vendor/bin/phpstan
updated, then read the installed version with `.commerce-upgrade/tools/phpstan/vendor/bin/phpstan
--version` and record that resolved version in the report; never state a fixed version.
If the installed release cannot emulate the target PHP (for example target 8.5 needs
PHPStan 2.1.32 or newer), record `NOT ASSESSED` with that reason. This exact command and directory are
named in the single Step 0 approval.
2. Write `.ccua/tools/phpstan/phpstan.neon` for the **current** PHP: `parameters:` with
2. Write `.commerce-upgrade/tools/phpstan/phpstan.neon` for the **current** PHP: `parameters:` with
`phpVersion: <currentId>`, `level: 6` and `tmpDir: tmp` (relative to the neon file).
3. Generate the baseline of existing issues from the project root (scan paths and the
autoload file resolve from there):
`php -d memory_limit=-1 .ccua/tools/phpstan/vendor/bin/phpstan analyse -c .ccua/tools/phpstan/phpstan.neon --autoload-file=vendor/autoload.php --no-progress --generate-baseline=.ccua/tools/phpstan/phpstan-baseline.neon app/code app/design`
`php -d memory_limit=-1 .commerce-upgrade/tools/phpstan/vendor/bin/phpstan analyse -c .commerce-upgrade/tools/phpstan/phpstan.neon --autoload-file=vendor/autoload.php --no-progress --generate-baseline=.commerce-upgrade/tools/phpstan/phpstan-baseline.neon app/code app/design`
PHPStan cannot put non-ignorable errors in a baseline (it warns "Some errors could not be
put into baseline", e.g. `class.notFound` for test classes extending an uninstalled
PHPUnit). Also save them for subtraction: write a second config
`.ccua/tools/phpstan/phpstan-current.neon` identical to step 2 and run the same command
with `-c .ccua/tools/phpstan/phpstan-current.neon --error-format=json` (no
`.commerce-upgrade/tools/phpstan/phpstan-current.neon` identical to step 2 and run the same command
with `-c .commerce-upgrade/tools/phpstan/phpstan-current.neon --error-format=json` (no
`--generate-baseline`), keeping the JSON as the current-PHP result.
4. Rewrite `.ccua/tools/phpstan/phpstan.neon` for the **target** PHP: `includes:` with
4. Rewrite `.commerce-upgrade/tools/phpstan/phpstan.neon` for the **target** PHP: `includes:` with
`- phpstan-baseline.neon`, then `parameters:` with `phpVersion: <targetId>`, `level: 6`,
`tmpDir: tmp` and `reportUnmatchedIgnoredErrors: false`. Always use this generated config;
a project `phpstan.neon` is never used for the assessment.
5. Run the analysis again from the project root:
`php -d memory_limit=-1 .ccua/tools/phpstan/vendor/bin/phpstan analyse -c .ccua/tools/phpstan/phpstan.neon --autoload-file=vendor/autoload.php --error-format=json --no-progress app/code app/design`
`php -d memory_limit=-1 .commerce-upgrade/tools/phpstan/vendor/bin/phpstan analyse -c .commerce-upgrade/tools/phpstan/phpstan.neon --autoload-file=vendor/autoload.php --error-format=json --no-progress app/code app/design`
Exit code 1 with findings is expected, not a failure; only a missing/invalid JSON result
or a crash is a failed run. The baseline suppresses every issue that already exists at the
current PHP, so the remaining findings are those introduced by the PHP change.
Expand Down Expand Up @@ -354,7 +354,7 @@ release Composer would actually install alongside the target Commerce version:

1. **Composer resolution.** Run `composer_probe.py --op resolve --edition <community|enterprise>
--target-version <target> --target-php <targetPhp>` (the exact command, scratch directory
`.ccua/tools/resolve`, container and effects go into one separate exact-action approval; it
`.commerce-upgrade/tools/resolve`, container and effects go into one separate exact-action approval; it
is not routine scope). It generates a throwaway composer.json (target product, the
project's third-party requirements as `*`, `config.platform.php` = target PHP, only
credential-free `composer` repositories) and runs a lock-only `composer update --no-install
Expand All @@ -377,7 +377,7 @@ release Composer would actually install alongside the target Commerce version:
2. **Download and analyse the resolved target release.** For each `RESOLVED` package run
`composer_probe.py --op fetch --package <p> --version <resolved>`; it archives only that
package (`composer archive`) and extracts it with strict member validation into
`.ccua/tools/resolve/src/<vendor>/<name>`. Fetched code is untrusted and is never executed.
`.commerce-upgrade/tools/resolve/src/<vendor>/<name>`. Fetched code is untrusted and is never executed.
Then, through the existing routine procedures, run UCT for the hop's version pair
against that directory (`uct-install`/`upgrade-uca-scan`; critical-only differential) and
PHPStan with the generated target-`phpVersion` config
Expand Down Expand Up @@ -482,7 +482,7 @@ generic "Changes N file(s) in ..." purposes.
upgraded copy of the project (`upgraded-project`), (2) a vanilla install of the target
(`vanilla`). If no tree is supplied, run `assess_tools.mjs tree-plan <projectDir> --target <X.Y.Z>` (works for any
target version; prints exact commands, runs nothing) and propose building that throwaway vanilla
tree under `var/ccua/`. Creating it needs dependency installation, which is never automatic and
tree under `var/commerce-upgrade/`. Creating it needs dependency installation, which is never automatic and
needs exact-action approval, which `/upgrade-assessment` collects once, inside its single Step 0 approval (no second prompt); then run `patches` with the returned `thenRun` arguments and
remove the tree afterwards. A declined or failed build leaves `UNABLE_TO_VALIDATE`. Running the helper with `--tree`
executes `git` and is part of that approved scope. Outcomes per patch:
Expand Down
6 changes: 3 additions & 3 deletions .claude/commands/upgrade-hop.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ attestation, approval, hop strategy, project facts or a "what next" selection. B
project command print the non-blocking run notice worded as `write-scope`'s **Required run-notice
wording**: instance, version pair, individual routine commands (including next-steps and, for
analysis, the PHPStan baseline and target runs and its isolated latest-stable
`.ccua/tools/phpstan/` install), ambient mounts, standing profile and files. Expected
`.commerce-upgrade/tools/phpstan/` install), ambient mounts, standing profile and files. Expected
Composer/SSH mounts are named, never read or demanded removed. Execute routines without
repeated prompts; application diffs, sensitive/outside-scope actions and host restrictions
retain their gates.
Expand Down Expand Up @@ -216,7 +216,7 @@ Template `.claude/context/upgrade-report-template.html` -> `output/upgrade-roadm
Supply {{FROM_VERSION}}, {{TO_VERSION}}, {{REPORT_DATE}}, {{PROJECT_NAME}} (confirmed or
"Project name not confirmed"), {{EFFORT_TIER}} (highest hop), {{HOP_PLAN_ROWS}} (from/to/tier/reason),
{{HOP_PROGRESS_ROWS}} (planned/report links) and {{TOOLKIT_VERSION}}:
installed version from `.claude/context/.ccua-version`, unknown if unavailable.
installed version from `.claude/context/.commerce-upgrade-version`, unknown if unavailable.

Verify saved file by read-back, then record `roadmapReportPath` and seed `## Hop progress`
rows (Hop/From/To, Status planned, remaining columns `~`). Without approval retain chat
Expand Down Expand Up @@ -275,7 +275,7 @@ with references/counts, not clearance of unresolved quarantine.
Apply `upgrade-assessment` Section 3.1 (baseline method) for this hop, named in the Step 0 run
notice: install PHPStan standalone at the latest stable release the container's PHP supports
(`composer require --dev phpstan/phpstan --no-interaction --no-plugins --no-scripts`, no version
constraint, resolved version read back and reported) only inside isolated `.ccua/tools/phpstan/`,
constraint, resolved version read back and reported) only inside isolated `.commerce-upgrade/tools/phpstan/`,
never touching the project's `composer.json`/`composer.lock` or using its own `vendor/bin/phpstan`.
Generate a baseline of existing issues at the current PHP id (`--generate-baseline`), switch
`phpstan.neon` to the target PHP id (8.5 -> `80500`) with the baseline included, and rerun from the
Expand Down
2 changes: 1 addition & 1 deletion .claude/guardrails/secure-code-generation.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ they never replace it.
## Forbidden
- Disabling, skipping, weakening, or bypassing the security scanner, its rules, its
severity threshold, or its scanner override option; suppressing findings globally.
- Writing `.ccua/review/security-approval-*.json` or `security-gate-*.json` files.
- Writing `.commerce-upgrade/review/security-approval-*.json` or `security-gate-*.json` files.
- Proceeding to the next chunk after a blocked or pending-approval gate result.

## Reporting
Expand Down
8 changes: 4 additions & 4 deletions .claude/guardrails/write-scope.md
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ never touches credential material, not that the container has none:
- The one narrow exception is the target-release resolution in `upgrade-assessment` §3.5:
`composer_probe.py --op resolve|fetch` runs a lock-only `composer update --no-install` and
`composer archive` inside the verified container, but only against the generated
composer.json in the scratch directory `.ccua/tools/resolve` (never the project's
composer.json in the scratch directory `.commerce-upgrade/tools/resolve` (never the project's
composer.json/composer.lock/vendor), with `--no-plugins --no-scripts`, credential-free
`composer` repositories only, and extraction that rejects non-plain members. It is outside
routine scope: print the exact command, cwd, container and effects and obtain separate
Expand Down Expand Up @@ -194,7 +194,7 @@ precondition check that a live human approval decision still has to follow.
| QA | `app/code/*/*/Test/`, `dev/tests/` PHP/XML/JSON tests only | Yes, same conditions as Developer |
| DevOps | Listed cloud manifests and CI pipeline YAML only | Yes, same conditions as Developer |
| Documentation engineer | Report HTML/Markdown and context/docs Markdown DOCUMENTS ONLY | No — document-only; git evidence is supplied by the human, not read by the agent |
| Orchestrator | Listed context/state/cache/report and `.ccua/review/` evidence artifacts; separately reviewed, not an application-code bypass | Yes, authorized routines; package command-effects require separate exact-action approval |
| Orchestrator | Listed context/state/cache/report and `.commerce-upgrade/review/` evidence artifacts; separately reviewed, not an application-code bypass | Yes, authorized routines; package command-effects require separate exact-action approval |

Reviewed migration script proposals may appear as fenced text in a Markdown report. No agent
may persist a standalone executable migration script; the human reviews, creates and executes
Expand Down Expand Up @@ -266,7 +266,7 @@ HTML only; it does not delegate application fixes or relax execution/sensitive-a
freshly normalized finding ID or a separately human-reviewed documented breaking-change
source ID, with version pair, reference/hash, successor mapping where applicable, exact
files, before/after/diff hashes and environment. Keep quarantine blockers visible.
2. The approved orchestrator prepares **non-secret** `.ccua/review/` plan/evidence/fixtures
2. The approved orchestrator prepares **non-secret** `.commerce-upgrade/review/` plan/evidence/fixtures
under approved artifact scope, and runs `review_change_plan.py review` within the
authorized routine scope BEFORE any proposed target patch. It outputs escaped
exact diffs and scope/restricted/static evidence, never consent. See the schema/examples
Expand Down Expand Up @@ -307,7 +307,7 @@ HTML only; it does not delegate application fixes or relax execution/sensitive-a
are blocking validation gaps unless the live developer/security review records a specific
disposition; never mark the missing/flagged check "passed". Do not download scanner deps.
8. After each approved applied finding, run `audit --changed --sniffs` under approval.
`.ccua/audit-log.jsonl` stores claimed attribution, version/environment/hop/chunk, paths/
`.commerce-upgrade/audit-log.jsonl` stores claimed attribution, version/environment/hop/chunk, paths/
issue links and hashes, NEVER source or diffs. Rejections record only action/plan hash.
Audit failure blocks finding/chunk completion; no silent fallback or automatic rollback.
Inspect all verification/validation outcomes before completion writes within the approved metadata scope.
Expand Down
4 changes: 2 additions & 2 deletions .claude/hooks/check-toolkit-version.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ const PACKAGE_NAME = '@adobe/commerce-upgrade-toolkit';
const NPM_VIEW_TIMEOUT_MS = 3000;

const projectRoot = process.cwd();
const versionMarkerPath = path.join(projectRoot, '.claude', 'context', '.ccua-version');
const lastNotifiedPath = path.join(projectRoot, '.claude', 'context', '.ccua-last-notified');
const versionMarkerPath = path.join(projectRoot, '.claude', 'context', '.commerce-upgrade-version');
const lastNotifiedPath = path.join(projectRoot, '.claude', 'context', '.commerce-upgrade-last-notified');

function readTrimmed(p) {
try {
Expand Down
Loading
Loading