Skip to content

feat(extension): add extension config init#1254

Draft
RoboShyim (roboshyim) wants to merge 1 commit into
shopware:mainfrom
roboshyim:feat/extension-config-init
Draft

feat(extension): add extension config init#1254
RoboShyim (roboshyim) wants to merge 1 commit into
shopware:mainfrom
roboshyim:feat/extension-config-init

Conversation

@roboshyim

Copy link
Copy Markdown
Contributor

Summary

Draft implementation of #1253 — mirror project config init with extension config init so existing extension checkouts get a CLI-readable .shopware-extension.yml.

Usage

# Auto-detect + interactive (TTY)
shopware-cli extension config init
shopware-cli extension config init --interactive

# Non-interactive
shopware-cli extension config init --type plugin -n
shopware-cli extension config init ./my-app --type app --name "My App" --description "" --maintainer "" -n

# Overwrite
shopware-cli extension config init --type plugin --force -n

Behaviour

Case Result
Plugin dir (composer.json) Config with zip assets+composer enabled, store.type: extension
App dir (manifest.xml) Config with assets enabled, composer disabled
Existing config Error unless --force or interactive confirm
Bad structure Clear error (missing manifest / composer.json)
Name / description Written to store.meta_title.en / store.description.en
Maintainer YAML comment only (authoritative author data stays in composer/manifest)

Layout

  • internal/extension/config_init.go — domain logic + tests
  • cmd/extension/extension_config.goextension config parent
  • cmd/extension/extension_config_init.go — cobra surface

Acceptance criteria

  • Create .shopware-extension.yml if missing
  • Interactive prompts (type, name, description, maintainer)
  • Non-interactive --type app|plugin
  • Existing config: refuse / --force / interactive overwrite
  • Validate structure (manifest / composer.json)
  • CLI-readable defaults for build/validate/zip
  • Clear errors on invalid structure
  • Docs page (can follow in shopware/docs)
  • Tests

Test plan

  • go test ./internal/extension/ -run Init
  • go test ./cmd/extension/
  • Manual smoke: plugin init, refuse overwrite, --force

Mirror project config init for existing extension checkouts. Creates
.shopware-extension.yml for validation, packaging, and build workflows.

- Non-interactive: --type app|plugin (auto-detect when structure is clear)
- Interactive prompts for type, name, description, maintainer
- Safe handling of existing config (--force / confirm)
- Validates manifest.xml (app) or composer.json (plugin)

Implements shopware#1253
@codecov-commenter

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 54.12844% with 100 lines in your changes missing coverage. Please review.
✅ Project coverage is 53.64%. Comparing base (3340b47) to head (1abe9f2).

Files with missing lines Patch % Lines
cmd/extension/extension_config_init.go 8.79% 83 Missing ⚠️
internal/extension/config_init.go 86.40% 17 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff            @@
##             main    #1254    +/-   ##
========================================
  Coverage   53.63%   53.64%            
========================================
  Files         303      306     +3     
  Lines       23325    23543   +218     
========================================
+ Hits        12511    12629   +118     
- Misses      10787    10887   +100     
  Partials       27       27            
Flag Coverage Δ
go-test 53.64% <54.12%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants