Skip to content

Added capability map tools and reuse-gate skills - #48

Merged
geronica merged 19 commits into
masterfrom
feature/capability-map-tools
Nov 20, 2026
Merged

geronica merged 19 commits into
masterfrom
feature/capability-map-tools

Conversation

@demkos

@demkos demkos commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

What

Two MCP tools that read the Spryker capability map, and two plugin skills that use them. Agents in Spryker projects check whether Spryker already ships a capability before they plan a new module. A shipped capability is then extended or installed instead of rebuilt.

The capability map has one card per Spryker capability: modules, feature metapackage, extension points, configuration, data flow, and an Install section with the guide URL. The suite publishes it to the public bucket spryker-capability-map (590 cards, index.json and one markdown file per card).

MCP tools

  • searchSprykerCapabilities(query, limit = 10): ranked capability search.
    • The ranking is ported from the suite's capability_lookup.py. It counts capability title and synonym hits first, then module paths, then body text. Shipped cards come before partial ones. Terms of 4 characters or fewer match whole words only.
    • Each hit carries an installStatus read from the project's composer.lock: installed, partially_installed, not_installed, or unknown when there is no lock file. It also lists the missing packages and a composer require line.
    • API packages (*-rest-api, *-storefront-api, *-backend-api) are reported separately, as optional.
    • A card that lists several features is offering alternatives, so the composer require line names the feature only when the card has exactly one.
  • getSprykerCapability(slug): the full card, with the install status of every feature and module.

Data source: AiDevConfig::getCapabilityMapIndexUrl() downloads the bucket's index.json. A mirror can be set with AiDevConstants::CAPABILITY_MAP_INDEX_URL. The index is cached in data/tmp/ai-dev/capability-map/index.json for 24 hours, and an expired cache is used when the download fails. Cards with status: planned are dropped at read time. If the cache cannot be written, the lookup still works.

Skills

  • find-existing-capability: the reuse gate. It turns a request into short queries, searches, opens the top cards, and reports a verdict per capability:

    • extend it (installed);
    • install the missing part;
    • install the feature, then extend it;
    • build only the gap (partial card);
    • build new, only after a docs and module cross-check, because a miss is not proof of absence.

    It is report-only, and when the MCP server is not connected it falls back to the bucket's INDEX.md.

  • spryker-feature-install: installs a feature from its official guide.

    • It resolves the feature and the features it requires.
    • It confirms scope with the user, then runs composer require and applies the guide's integration steps in the project layer only.
    • It finishes with codegen through spryker-refresher, verification, and a report of steps done and skipped.
  • The gate is wired into product-requirement-document (first Phase 0 call), spryker-customization (before the solution design), the spryker-feature-expert agent and demo-intake.

  • Plugin version is 0.9.0.

Tests

  • 25 new unit tests for the reader (Guzzle mock handler), the search, the install status and the composer.lock reader. composer test passes (163 tests).
  • phpcs and phpmd pass. phpstan reports nothing in the new files; its existing errors come from Spryker constants and generated classes.
  • bin/lint-plugins.php, the hook test, the hook parity check and the rule sync test all pass.
  • Smoke test against the live bucket with the b2b marketplace demo's composer.lock. The first call downloads the 2.5 MB index in about 0.5 s; later calls take about 30 ms. "budget spending limit" ranks purchasing-control first, as installed.
  • Not tested yet: the tools through a real MCP client (MCP Inspector or a coding agent) in a running project.

Optional Yves Twig integration (second commit)

Integration guides register a feature's widgets but never place them in Twig. The vendor templates do place them, but when a project overrides one of those templates (page layouts, header, footer, product item), the call is gone and the registered widget renders nothing.

  • New skill yves-twig-integration with the scanner scripts/yves-integration-scan.php (plain PHP, no Spryker boot, about 1 s on a full storefront).
    • It builds the template tree the project actually renders: project templates, vendor templates the project does not override, and the vendor blocks an extending override keeps ({% embed %} blocks belong to the embedded component).
    • It reports each widget or component as placed, missing (with the vendor call site, block chain, snippet, neighbouring lines and the project file that replaced it), not_registered or no_reference.
    • Modes: --package/--module scope for a feature, snapshot/diff for upgrades.
  • The skill presents a suggestion table and applies only the items the developer picks. Each placement takes the widget tag, arguments and guard from the vendor template, and the variables, wrappers and components from the project template (references/placement-rules.md). It is then verified by rendering the page.
  • spryker-feature-install: optional Step 6b after the backend steps.
  • spryker-upgrade: a Phase 0 snapshot, plus an optional Phase 6.1 that suggests only the gaps added since Phase 0. Deferred items go into handover report section 3.5.
  • Pointers added in yves-atomic-frontend and the spryker-customization delegation table.
  • Tests: php plugins/spryker-ai-dev-sdk/skills/yves-twig-integration/scripts/yves-integration-scan.test.php (17 checks on a generated fixture project). Plugin lint passes.
  • Not tested yet: an actual placement in a running shop.

Notes for review

  • Search matches word stems and substrings, like the suite script ("points" also hits service-point). The gate skill tells agents to drop such hits.
  • The map describes the latest release line. The tools report installed versions, but not whether an older version already has the capability; the skill sends agents to the vendor/ code and to spryker-upgrade in that case.
  • The public docs (ai-dev-mcp-server.md in spryker-docs) get both tools and the mirror setting in a separate PR.

demkos and others added 8 commits November 6, 2026 13:58
searchSprykerCapabilities and getSprykerCapability read the published Spryker capability map (S3 index.json, 24h cache, stale fallback) and add the project's install status from composer.lock. New skills find-existing-capability and spryker-feature-install, wired into the PRD, customization, feature-expert and demo-intake flows. Plugin version 0.9.0.
yves-twig-integration scans which feature widgets and components the project's storefront no longer renders because a project override replaced the vendor template that places them, suggests the placements, and applies only the picked ones in the project's design. spryker-feature-install offers it as Step 6b, spryker-upgrade as Phase 6.1 (gaps new since the Phase 0 snapshot).
… verify skills

- yves-integration-scan: strip Twig comments, check that the including vendor template is reachable or replaced in the project, report placedUndecided and overrideMode "unreachable".
- spryker-feature-install: environment preflight reference (stack check, bootstrap proposal, never reset) and glossary-key-check script; spryker-upgrade points to the same preflight.
- spryker-refresher: resolve Glue applications from public/Glue*/index.php and deploy entry points instead of the install recipe; API Platform resource, composer.lock and frontend drift rows.
- find-existing-capability: capability-search script fallback when the MCP tools are not registered; near-equivalent and leftover-wiring rules.
- spryker-verifier: authenticate once per surface before the first AC, check the fixture password hash, report BLOCKED with credentials or environment cause.

Co-Authored-By: Claude <noreply@anthropic.com>
getSprykerCapability and searchSprykerCapabilities returned failures (unknown slug, query without a usable term, map not loadable) as a successful result with an "error" field, so clients saw isError false. The plugins now throw ToolCallException, which the MCP SDK returns as a tool result with isError true and the message as text. The business layer keeps its error key and stays free of MCP code.

Co-Authored-By: Claude <noreply@anthropic.com>
…install

- Parse the install guide into a checklist with one row per step; gate the
  install and the report on undecided or open rows (check-checklist.php).
- Reconcile each row with the reference demo shop (b2b-demo-marketplace):
  plugin subset and order, merged config, and the files the guide does not
  name (find-feature-change.php adds them as reference-only rows).
- Resolve the release the feature needs; allow the module moves it needs,
  stop on another feature package or a third-party root pin.
- Record baselines; check overrides after module moves; verify each guide
  Verification block; find and prove release steps (diff-release-steps.php).
- Hand data rows to project-data with a fixed row list.
- find-existing-capability hands installs to spryker-feature-install;
  spryker-upgrade Phase 6 hands accepted features over after the upgrade PR.
geronica and others added 11 commits November 17, 2026 16:31
…back

The install skill told the agent to fetch <slug>.md when the capability
tools are missing, so it guessed slugs and package names. It now tells a
missing MCP registration from a lost connection, as find-existing-capability
does, and runs find-existing-capability/scripts/capability-search.php by
feature name and synonyms. Never guess a slug or a package name.
- Phase 6b ports the reference demo shop's tests for the feature and adds
  functional, Glue API or Cypress tests, only for the suites the project
  already runs, after verification passes.
- find-feature-change.php adds the reference change's tests as rows of
  kind test instead of listing them as not a step.
- check-checklist.php --phase report fails when no test row is done,
  unless tests_waived holds the developer's reason.
- The confirmation block names the planned tests; the report lists them.
…quisites

- Phase 1 dry-runs the composer require at every install release, with -w
  and -W, and shows the developer every update, major bump and removal of
  both. A feature at the project's own release can still move many modules.
- The parser marks a prerequisite optional when the table says (optional)
  or the text below the table (an info box included) calls it optional.
  Phase 1 asks about a missing optional prerequisite instead of installing
  it first, and skips the rows that need it when declined.
- New fixture: the Recurring Orders guide (two optional prerequisites).
- check-dod.php decides DONE or NOT DONE from evidence in the state dir:
  scope, valid baselines, module moves with reasons, the checklist, the
  wiring, after-install checks and builds, verifications, tests, approved
  agent-written content, and proven release steps. Ten items, each met or
  not, with the reasons.
- dod.json records the evidence no script can measure; only the
  developer's answer can waive an item.
- The report's first line is check-dod.php's first line. While it says
  NOT DONE, the run is not described as installed, working or done.
- A blocker stops the run in the phase where it is found, and the
  developer decides: fix, waive with a reason, or stop.
- Phase 5 moves back modules the feature does not need unless the
  developer gives a reason; content the agent writes needs approval.
The test suite and its four guide fixtures (360 KB of copied integration
guides) are maintainer tooling, so they no longer ship with the plugin.
They now live in tests/scripts/feature-install/, and CI runs them in the
plugins job.
references/report.md holds the report developers share with colleagues:
versions table (releases only, never package version tags), what was
done, branch and pull request, steps after the deploy, the guide link
pinned to the version followed, the guide steps not installed and why,
what was validated and how, and what upgrading the project to the latest
release would add. It is written only when check-dod.php says DONE;
project problems the install did not cause go to the developer as ticket
candidates, not into the report.
… Orders report

The template now has the same sections, headings and fixed sentences as
the report shared with the team, including the date and author line, and
the report itself is the worked example.
…glossary and release steps

- check-needed-moves.php judges every moved package: needed (a requirer
  or a conflict rules out the old version), not needed (the old version
  satisfies every requirer) or unknown. Not-needed moves go back unless
  the developer gives a reason. Composer constraint matching is in lib.php.
- compare-baselines.php checks that each baseline holds a result and
  compares PHPStan, sniffer, tests (by failing test), Back Office crawl,
  storage counts and frontend builds after the install with it. Baseline
  files use the names spryker-upgrade's check-baselines.php validates.
- check-data-manifests.php checks that every data file the install wrote
  is imported by a manifest a deploy recipe runs.
- glossary-key-check.php also reads keys from PHP (mail subjects through
  constants, messages), keys a package ships, files like
  partial_glossary.csv, and takes --locales.
- dump-state.php dumps tables and search indices without ids and
  timestamps and compares a deployed environment with a fresh install.
- check-dod.php measures items 2, 3, 6, 8 and 9 from these files;
  dod.json keeps only scope, reasons, approvals, data files and waivers.
tests/ is in the CI code-style check, so the moved test suite now follows
phpcs.xml: phpcbf fixes plus two @PARAM doc blocks.
…, not gated

Translations and CMS text the agent writes are recorded in dod.json
authored_content (file and what) and listed in the report as not validated
and needing a review, like any code the agent writes. DoD item 9 checks
that each entry is complete and its file exists; it no longer needs an
approval.
spryker-feature-install: checklist engine, reconcile and release steps
@geronica
geronica merged commit ab09289 into master Nov 20, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants