From 08cd5171b2d508aac3f85af0144f244fa5f17d97 Mon Sep 17 00:00:00 2001 From: Michael Scott-Nelson Date: Thu, 19 Mar 2026 11:50:53 -0400 Subject: [PATCH 1/5] build: add .dev-kit submodule for shared dev infrastructure Integrate the shared .dev-kit submodule to bring standardized tooling to the Magento 2 extension repo. This adds shared git hooks (commit-msg linting, pre-commit checks), a self-documenting Makefile powered by common.mk, and consistent editor/git configuration via .editorconfig and .gitattributes templates. The existing Makefile targets are preserved but reorganized to follow the .dev-kit convention: `test` and `lint` now delegate through the standard interface in common.mk to project-specific `_test` and `_lint` implementations. Project-specific targets like `test-unit`, `test-compatibility`, `test-local`, and `lint-fix` remain directly accessible and are annotated for `make help` discoverability. Ticket: TAX-102 --- .dev-kit | 1 + .editorconfig | 45 +++++++++++++++++++++ .gitattributes | 108 ++++++++++++++++++++++++++++++++++++++++++++----- .gitmodules | 3 ++ Makefile | 43 +++++++++----------- 5 files changed, 165 insertions(+), 35 deletions(-) create mode 160000 .dev-kit create mode 100644 .editorconfig create mode 100644 .gitmodules diff --git a/.dev-kit b/.dev-kit new file mode 160000 index 0000000..f5aa347 --- /dev/null +++ b/.dev-kit @@ -0,0 +1 @@ +Subproject commit f5aa3470c2bc5bb2a824a0e62e7b6c099372063b diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..b24b4e2 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,45 @@ +# .editorconfig — Shared editor settings for TaxCloud repos. +# +# Installed by .dev-kit/install.sh as .editorconfig in the repo root. +# Most editors (VS Code, JetBrains, vim, etc.) respect this natively +# or via plugin. See https://editorconfig.org +# +# Like .gitattributes, this is committed and applies to all contributors. + +root = true + +# Default: 2-space indent, UTF-8, LF, trim trailing whitespace +[*] +charset = utf-8 +end_of_line = lf +indent_style = space +indent_size = 2 +insert_final_newline = true +trim_trailing_whitespace = true + +# Makefiles require tabs +[Makefile] +indent_style = tab + +[*.mk] +indent_style = tab + +# Awk: tabs (idiomatic) +[*.awk] +indent_style = tab + +# Go: tabs (gofmt standard) +[*.go] +indent_style = tab + +# Shell scripts: 4-space indent (Google style, widely adopted) +[*.sh] +indent_size = 4 + +# YAML: 2-space (standard) +[*.{yml,yaml}] +indent_size = 2 + +# Markdown: preserve trailing whitespace (line breaks) +[*.md] +trim_trailing_whitespace = false diff --git a/.gitattributes b/.gitattributes index 82b7f42..233f6a5 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,10 +1,98 @@ -# Exclude dev/CI files from git archive (GitHub release ZIPs) -.gitignore export-ignore -.gitattributes export-ignore -.github/ export-ignore -.cursorrules export-ignore -Test/ export-ignore -Makefile export-ignore -run-test.sh export-ignore -scripts/ export-ignore -docs/images/ export-ignore +# .gitattributes — Shared line-ending, diff, and merge settings. +# +# Installed by .dev-kit/install.sh as .gitattributes in the repo root. +# Committed to the repo, so these rules apply to all contributors +# regardless of their local git config. +# +# This file makes core.autocrlf largely irrelevant: the rules below +# override it on a per-path basis, which is more precise and portable. + +# ============================================================================= +# Line Endings +# ============================================================================= +# Normalize to LF on commit, use platform-native on checkout. +# This single rule prevents most cross-platform line-ending bugs. +* text=auto + +# Force LF for files that break with CRLF (scripts, configs, Makefiles). +# A Windows checkout with CRLF in a shell script is a runtime error. +*.sh text eol=lf +*.bash text eol=lf +*.awk text eol=lf +Makefile text eol=lf +*.mk text eol=lf +*.yml text eol=lf +*.yaml text eol=lf +*.json text eol=lf +*.toml text eol=lf +Dockerfile text eol=lf +*.dockerfile text eol=lf + +# ============================================================================= +# Binary Files +# ============================================================================= +# Prevent git from applying line-ending conversion or textual merge +# to files that aren't text. Without these rules, git may corrupt +# binaries by "fixing" line endings. + +# Images +*.png binary +*.jpg binary +*.jpeg binary +*.gif binary +*.ico binary +*.webp binary +*.svg binary + +# Fonts +*.woff binary +*.woff2 binary +*.ttf binary +*.otf binary +*.eot binary + +# Archives +*.zip binary +*.tar binary +*.tar.gz binary +*.tgz binary +*.gz binary + +# Documents +*.pdf binary + +# ============================================================================= +# Better Diffs +# ============================================================================= +# Tell git which language driver to use for diff hunk headers. +# Instead of showing the nearest line, git shows the enclosing +# function/class name — much easier to orient yourself in a diff. +*.go diff=golang +*.py diff=python +*.rb diff=ruby +*.html diff=html +*.htm diff=html +*.css diff=css +*.md diff=markdown +*.markdown diff=markdown + +# ============================================================================= +# Lock Files +# ============================================================================= +# Generated lock files produce huge, unreadable diffs. Suppress the +# diff output (they still show as changed, just without the noise). +package-lock.json -diff +yarn.lock -diff +pnpm-lock.yaml -diff +go.sum -diff +Cargo.lock -diff +Gemfile.lock -diff +poetry.lock -diff +composer.lock -diff + +# Merge strategy: lock files should be regenerated, not merged. +# "ours" keeps the current branch's version; the developer then +# re-runs the package manager to reconcile. +package-lock.json merge=ours +yarn.lock merge=ours +pnpm-lock.yaml merge=ours diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..5f04e2f --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule ".dev-kit"] + path = .dev-kit + url = git@github.com:FedTax/.dev-kit.git diff --git a/Makefile b/Makefile index 0e055c5..76040c8 100644 --- a/Makefile +++ b/Makefile @@ -1,23 +1,18 @@ -.PHONY: test test-local test-unit test-compatibility lint lint-fix help - -# Default target -help: - @echo "Available commands:" - @echo " make test - Run all tests using Docker" - @echo " make test-local - Run all tests locally (requires PHP)" - @echo " make test-unit - Run unit tests only" - @echo " make test-compatibility - Run Adobe Commerce 2.4.8-p1 compatibility tests" - @echo " make lint - Run PHP CodeSniffer linting" - @echo " make lint-fix - Auto-fix linting issues where possible" - @echo " make help - Show this help message" - -# Run all tests using Docker -test: +include .dev-kit/mk/common.mk + +.PHONY: _test _lint test-local test-unit test-compatibility lint-fix + +# -------------------------------------------------------------------------- +# Standard interface implementations +# -------------------------------------------------------------------------- + +##@ Testing + +_test: ## Run all tests using Docker @echo "Running all tests with Docker..." @./run-test.sh -# Run tests locally (requires PHP) -test-local: +test-local: ## Run all tests locally (requires PHP) @echo "Running all tests locally..." @vendor/bin/phpunit Test/Unit/ --testdox @for test_file in Test/Integration/*.php; do \ @@ -25,18 +20,17 @@ test-local: php "$$test_file"; \ done -# Run unit tests only -test-unit: +test-unit: ## Run unit tests only @echo "Running unit tests..." @vendor/bin/phpunit Test/Unit/ --testdox -# Run Adobe Commerce 2.4.8-p1 compatibility tests -test-compatibility: +test-compatibility: ## Run Adobe Commerce 2.4.8-p1 compatibility tests @echo "Running Adobe Commerce 2.4.8-p1 compatibility tests..." @php Test/Integration/AdobeCommerce248p1CompatibilityTest.php -# Run PHP CodeSniffer linting -lint: +##@ Code Quality + +_lint: ## Run PHP CodeSniffer linting @echo "Running PHP CodeSniffer..." @lint_output=$$(phpcs --standard=PSR2 --extensions=php Model/ Observer/ Logger/ Setup/ --ignore=Test/ 2>&1 || true); \ if echo "$$lint_output" | grep -q "FOUND [1-9][0-9]* ERROR"; then \ @@ -48,7 +42,6 @@ lint: echo "$$lint_output"; \ fi -# Auto-fix PHP CodeSniffer issues where possible -lint-fix: +lint-fix: ## Auto-fix PHP CodeSniffer issues where possible @echo "Auto-fixing PHP CodeSniffer issues..." @phpcbf --standard=PSR2 --extensions=php Model/ Observer/ Logger/ Setup/ --ignore=Test/ From 62360fb295d219b0de01bf1281d1d8fe07820cc0 Mon Sep 17 00:00:00 2001 From: Michael Scott-Nelson Date: Thu, 19 Mar 2026 14:59:31 -0400 Subject: [PATCH 2/5] build: update .dev-kit to v1.3.0, add dependabot, auto-merge, and release Adds dependency management (dependabot + auto-merge for .dev-kit updates) and release workflow. Existing CI workflows are untouched. Ticket: TAX-102 --- .dev-kit | 2 +- .github/dependabot.yml | 18 ++++++++++++ .github/workflows/auto-merge-devkit.yml | 32 +++++++++++++++++++++ .github/workflows/ci.yml | 38 +++++++++++++++++++++++++ .github/workflows/release.yml | 33 +++++++++++++++++++++ 5 files changed, 122 insertions(+), 1 deletion(-) create mode 100644 .github/dependabot.yml create mode 100644 .github/workflows/auto-merge-devkit.yml create mode 100644 .github/workflows/ci.yml create mode 100644 .github/workflows/release.yml diff --git a/.dev-kit b/.dev-kit index f5aa347..e5fa5c1 160000 --- a/.dev-kit +++ b/.dev-kit @@ -1 +1 @@ -Subproject commit f5aa3470c2bc5bb2a824a0e62e7b6c099372063b +Subproject commit e5fa5c1fa4c9e5eeb4a7adb62740b282d68bb170 diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..c49bc07 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,18 @@ +# Dependabot configuration — generated by .dev-kit/ci/scaffold.sh +# Source: .dev-kit/ci/templates/dependabot.yml +# Keeps GitHub Actions and submodules up to date. + +version: 2 +updates: + - package-ecosystem: github-actions + directory: / + schedule: + interval: weekly + groups: + actions: + patterns: ["*"] + + - package-ecosystem: gitsubmodule + directory: / + schedule: + interval: weekly diff --git a/.github/workflows/auto-merge-devkit.yml b/.github/workflows/auto-merge-devkit.yml new file mode 100644 index 0000000..11e7bf9 --- /dev/null +++ b/.github/workflows/auto-merge-devkit.yml @@ -0,0 +1,32 @@ +# Auto-merge .dev-kit submodule updates — generated by .dev-kit/ci/scaffold.sh +# Source: .dev-kit/ci/templates/auto-merge-devkit.yml +# Automatically merges Dependabot PRs that bump the .dev-kit submodule +# after CI passes. Requires Dependabot to be configured (see dependabot.yml). + +name: Auto-merge .dev-kit + +on: pull_request + +permissions: + contents: write + pull-requests: write + +jobs: + auto-merge: + name: Auto-merge .dev-kit updates + if: github.actor == 'dependabot[bot]' + runs-on: ubuntu-latest + + steps: + - name: Dependabot metadata + id: meta + uses: dependabot/fetch-metadata@v2 + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + + - name: Auto-merge .dev-kit submodule bumps + if: steps.meta.outputs.dependency-names == '.dev-kit' + run: gh pr merge --auto --squash "$PR_URL" + env: + PR_URL: ${{ github.event.pull_request.html_url }} + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..e4d1411 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,38 @@ +# CI workflow — generated by .dev-kit/ci/scaffold.sh +# Source: .dev-kit/ci/templates/ci.yml +# Runs lint, test, and build on every push and pull request. +# +# Relies on standard Make targets from .dev-kit/mk/common.mk. +# Customize behavior by defining _lint, _test, _build in your Makefile. + +name: CI + +on: + push: + branches: [main] + pull_request: + branches: [main] + +concurrency: + group: ci-${{ github.ref }} + cancel-in-progress: true + +jobs: + ci: + name: Lint / Test / Build + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + submodules: true + + - name: Lint + run: make lint + + - name: Test + run: make test + + - name: Build + run: make build diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..2a35cac --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,33 @@ +# Release workflow — generated by .dev-kit/ci/scaffold.sh +# Source: .dev-kit/ci/templates/release.yml +# Creates a GitHub release when a version tag is pushed. +# +# Tag format: v1.2.3 + +name: Release + +on: + push: + tags: ['v*'] + +permissions: + contents: write + +jobs: + release: + name: Create Release + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + submodules: true + + - name: Build + run: make build + + - name: Create GitHub Release + uses: softprops/action-gh-release@v2 + with: + generate_release_notes: true From 349844b523dbc7155aaa06418446c670d6693aed Mon Sep 17 00:00:00 2001 From: Michael Scott-Nelson Date: Thu, 19 Mar 2026 15:32:36 -0400 Subject: [PATCH 3/5] build: update .dev-kit to v1.3.2 Bump the .dev-kit submodule from the previous pinned version to v1.3.2, which includes the v1.3.1 fix for extensionless binary files in .gitattributes. The updated .gitattributes is also copied into the repo root so that Git LFS and diff behavior apply correctly to binaries that lack a file extension. Ticket: TAX-102 --- .dev-kit | 2 +- .gitattributes | 16 ++++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/.dev-kit b/.dev-kit index e5fa5c1..84a57af 160000 --- a/.dev-kit +++ b/.dev-kit @@ -1 +1 @@ -Subproject commit e5fa5c1fa4c9e5eeb4a7adb62740b282d68bb170 +Subproject commit 84a57afd5fe588178b8ffc3e1279419d3c8a1b01 diff --git a/.gitattributes b/.gitattributes index 233f6a5..89d2b37 100644 --- a/.gitattributes +++ b/.gitattributes @@ -61,6 +61,22 @@ Dockerfile text eol=lf # Documents *.pdf binary +# Compiled binaries (extensionless) +# Go, Rust, and C projects typically output to bin/ or dist/. +# Mark these directories as binary to prevent line-ending corruption. +bin/** binary +dist/** binary +out/** binary + +# Other binary formats that lack common extensions +*.wasm binary +*.pb binary +*.pyc binary +*.so binary +*.dylib binary +*.dll binary +*.exe binary + # ============================================================================= # Better Diffs # ============================================================================= From 55290fe7fc7ae316a7482bd7d5e7e353105bd720 Mon Sep 17 00:00:00 2001 From: Michael Scott-Nelson Date: Thu, 19 Mar 2026 17:51:46 -0400 Subject: [PATCH 4/5] chore: bump .dev-kit to v1.3.3 v1.3.3 auto-skips npm script discovery in repos without package.json, removing the need for NPM_SCRIPTS_DISABLE. --- .dev-kit | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.dev-kit b/.dev-kit index 84a57af..970034d 160000 --- a/.dev-kit +++ b/.dev-kit @@ -1 +1 @@ -Subproject commit 84a57afd5fe588178b8ffc3e1279419d3c8a1b01 +Subproject commit 970034d5e367931db998fa60e5b0b3c60d19a3ea From 2c9203089859a77888d87bcabd44d5ecc219f68c Mon Sep 17 00:00:00 2001 From: Michael Scott-Nelson Date: Sun, 22 Mar 2026 13:59:39 -0400 Subject: [PATCH 5/5] chore: update .dev-kit submodule to v1.5.0 Picks up smart auto-detect for standard targets (Go, Rust, Node), consolidated target extraction, description promotion, test infrastructure improvements, and Rust tooling support. --- .dev-kit | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.dev-kit b/.dev-kit index 970034d..646f903 160000 --- a/.dev-kit +++ b/.dev-kit @@ -1 +1 @@ -Subproject commit 970034d5e367931db998fa60e5b0b3c60d19a3ea +Subproject commit 646f903ef30dd44f07c0481b67d63507f703411e