Skip to content

Cordon Modulith 0.1 - #1

Merged
ChrisAbner merged 18 commits into
mainfrom
claude/cordon-modulith-naming-1w2srv
Sep 29, 2026
Merged

ChrisAbner merged 18 commits into
mainfrom
claude/cordon-modulith-naming-1w2srv

Conversation

@ChrisAbner

Copy link
Copy Markdown
Owner

No description provided.

ChrisAbner and others added 18 commits September 29, 2026 00:57
Initial import of the package: static module-boundary verification for
Laravel (resolvers, php-parser extraction, rules, baseline, reporters,
artisan commands, Boost guideline, tests, docs and planning briefs).

Set the project name to Cordon Modulith and the Composer package to
chrisabner/cordon-modulith. The PHP namespace (Cordon\), artisan
commands (cordon:*), config file and baseline file keep their names.
- Pint: collapse empty attribute constructors (single_line_empty_body).
- PHPStan: inject the config repository into the commands instead of
  array access on the application, and validate the --format option.
- Tests: check excluded directories against the fixture-relative path,
  so the suite passes when the project itself lives under a tests/ path.
Enums, traits, anonymous classes, first-class callables, match,
attribute arguments, instanceof, multi-catch, union/intersection/DNF
types, ::class, static closures, promoted properties, static members
and new in initializers are detected. Unused imports, functions,
constants, docblocks, strings and self/static/parent are not.
Five anonymised layouts (nwidart v11 with app/, nwidart with custom
path and namespace, InterNACHI, layered app/Modules with a shared
kernel, and a clean src/Domain project), each with its reviewed list
of expected violations. RealProjectsTest runs the full pipeline,
including resolver auto-detection, against every real-* fixture.

The cordon-fix-violations Boost skill explains how to read the JSON
report and fix each rule without touching the baseline.
tests/Benchmark/run.php generates a synthetic project and times the
full pipeline. Locally (PHP 8.4): 1,000 files in 1.1 s and 5,000 files
in 5.5 s, about 1.1 ms per file. composer bench and a CI job fail when
1,000 files take longer than 10 seconds.
- cordon:verify --module=NAME (repeatable) narrows the report to the
  violations a module causes and the cycles it takes part in. Unknown
  modules and --module with --generate-baseline exit with 2.
- The resolve/configure/analyse/baseline flow moves into
  Cordon\Laravel\Verifier so the command and tests share it.
- expect('Billing')->toRespectBoundaries() and
  expect(Cordon::modules())->each->toRespectBoundaries(), registered
  only when Pest is installed. One analysis per process, invalidated
  when the config or the baseline file changes.
- ADR 0005 and 0006 (proposed).
- Cordon\PHPStan\InternalAccessRule reports internal_access per file
  (identifier cordon.internalAccess), reusing the extractor and public
  API policy and honouring #[Internal]/#[PublicApi] through PHPStan's
  static reflection. Registered by extension.neon and
  extra.phpstan.includes for phpstan/extension-installer.
- StandaloneConfig reads config/cordon.php (and the nwidart/InterNACHI
  configs when they load without the framework) outside Laravel.
- action.yml: composite action running cordon:verify with github
  annotations; docs/ci.md documents inputs and a job per module.
- README: CI action, --module, Pest and PHPStan sections, Boost skill.
- ADR 0007 (proposed).
php artisan cordon:docs writes deterministic Markdown to
docs/architecture: an overview with a Mermaid dependency diagram
(internal access in red), a canvas per module (public API, uses, used
by, events, violations) and an event inventory with publishers and
listeners, detected statically.

Analyzer is split into snapshot() and check() so the generator can
reuse edges and declarations; analyze() keeps its behaviour.
ADR 0008 (proposed).
The rules config now accepts classes implementing Cordon\Contracts\Rule
next to the built-in switches. They run after the built-in rules, are
built through the Laravel container and must use a unique id; invalid
classes and duplicated ids throw with the fix. docs/custom-rules.md
explains the extension API. ADR 0009 (proposed).
docs-site/ covers introduction, installation, the public API model,
rules, configuration, baseline adoption, CI, Pest, PHPStan, AI agents,
living documentation, custom rules, three recipes (expose a service,
break a cycle with an event, replace a cross-module relation), an
honest comparison with Deptrac, Pest arch() and laravel-true-modular,
and a FAQ. The docs workflow deploys it to GitHub Pages from main.
docs/plan/lanzamiento/: RFC for Discussions, Laravel News submission,
r/laravel post, X thread, dev.to article in English and Spanish (with
real output from the namespace-app fixture), message to nwidart and
InterNACHI maintainers and a talk proposal. docs/plan/video.md: three
minute video script.
Record the new features in the changelog, mark the plan phases that are
done (with the ADRs still to approve), and state in AGENTS.md which
layers must stay framework-agnostic. Verified locally on PHP 8.4 with
Laravel 13 and 12; src also analyses clean against PHP 8.3.
docs/plan/originales/ keeps the files the project started from,
unmodified: cordon.zip, README.md, PLAN.md and referencias.md.
- StandaloneConfig evaluates project config files against a bare
  ProjectContainer, so base_path() and friends resolve to the project
  root. Files that still cannot be evaluated produce a warning that the
  PHPStan rule reports as cordon.configuration instead of silently
  falling back to defaults.
- Module::ownsPath() normalises directory separators (Windows).
- cordon:verify and cordon:docs warn on stderr when Xdebug is active.
- .gitattributes: force LF and stop export-ignoring action.yml, which
  GitHub needs when it downloads the action archive.
- composer.json: homepage and support links.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Pest and PHPStan setup on a fresh app, public namespace matching,
cycles through events, depends_on behaviour, performance with Xdebug,
known limitations, English roadmap and non-affiliation notice.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Publication drafts (PR, release notes, GitHub and Packagist steps),
launch drafts with real links and verified output, and the results of
the local CI matrix, real-project tests and name research.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@ChrisAbner
ChrisAbner merged commit aac383e into main Sep 29, 2026
6 checks passed
@ChrisAbner
ChrisAbner deleted the claude/cordon-modulith-naming-1w2srv branch September 29, 2026 03:43
ChrisAbner added a commit that referenced this pull request Sep 29, 2026
@ChrisAbner ChrisAbner changed the title Claude/cordon modulith naming 1w2srv Cordon Modulith 0.1 Sep 29, 2026
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.

2 participants