Skip to content

refactor(architecture): modernise generation and module boundaries - #150

Draft
LMLiam wants to merge 89 commits into
masterfrom
refactor/microsmith-modernisation
Draft

LMLiam wants to merge 89 commits into
masterfrom
refactor/microsmith-modernisation

Conversation

@LMLiam

@LMLiam LMLiam commented Sep 27, 2026 •

Copy link
Copy Markdown
Owner

Summary

This draft modernises Microsmith's generation pipeline and module structure. Review the focused Conventional Commits in their implementation order.

Why

The previous implementation mixed authoring rules, resolution, rendering, and integration code. This draft adds explicit pipeline contracts and organises components by responsibility.

Changes

  • Update the Kotlin and Gradle baseline. Configure Arrow, Metro, and Mappie compiler integration.
  • Add shared DSL, resolution, artifact, compiler, and rendering contracts.
  • Add typed Protobuf and RPC authoring models, semantic resolution, and artifact rendering.
  • Extend the pipeline to service, ASP.NET, and package generation.
  • Add automatic script symbols, script caching, isolation, and host APIs.
  • Organise the CLI, Gradle, and Maven integrations by responsibility. Add onboarding profiles and provider checks.
  • Replace KtLint with KtFmt and retain Detekt.
  • Remove sbt support and the kotest module. Move installation and CI guidance into docs/.
  • Remove Scala support: the onboarding profile, both Scala fixtures, the CI coverage, and the last sbt code path in the CLI.
  • Split tests into src/test, src/integrationTest, and src/e2eTest source sets, each with its own Kotest task. Move pipeline-level CLI and generation specs to src/integrationTest, and the Gradle TestKit test to src/e2eTest.
  • Group the 38 Gradle modules by capability under modules/engine, modules/schemas, modules/services, modules/runtime, and modules/integrations. Keep project names and published artifact IDs unchanged.
  • Replace the custom repository quality plugin with Detekt rules. Delete 1,363 lines of build logic and tests. Drop the one-type-per-file and explicit-package house rules.
  • Remove the CLI and runtime scripting source scanners. Declare the entry points as constants. Delete 446 lines.
  • Replace the hand-written Maven plugin descriptor writer with the GradleX maven-plugin-development plugin. Delete 380 lines.
  • Move the CLI implementation dependencies into modules/integrations/cli/build.gradle. Split the packaging names into CliPackagingNames and BundledPlugins, and remove an unused directory constant.
  • Resolve the test version catalog explicitly in the root build script, which removes the Gradle 9 implicit parent-lookup warnings.
  • Delete the per-fixture workflows, which GitHub never ran. Split the README into docs/ and drop the duplicated CLI usage block.
  • Share reference-name resolution between Protobuf and RPC. Cover local, relative, qualified, and symbolic references.
  • Repair imports after the module moves, remove the duplicate checksum function, and restore complete C# error strings in generated ASP.NET controllers.
  • Set executable Unix launcher permissions in ZIP and TAR distributions. Track the permission policy as an archive input and verify it before release packaging.

Validation

./gradlew build passes, including Detekt, KtFmt, the build-logic tests, the CLI integration suite, and the Gradle TestKit e2e suite. The build also passes the native Gradle fixture checks and validates the native Maven fixtures and the IDE fallback assets.

The Maven plugin descriptor keeps the 55 dependencies and the generate goal, and mvn microsmith:generate passes for the Java and Kotlin examples. The CLI distribution launcher runs, and the ZIP and TAR release archives pass the launcher-permission checks.

Known limitation: the generated Maven descriptor has no goal or parameter descriptions, because Maven Plugin Tools reads Javadoc and not KDoc.

Remaining plan work

This PR remains a draft. The modernisation plan is not complete.

  • Strengthen resolved Protobuf types and finish typed failure accumulation and operation context capabilities. Remove duplicate semantic validation from the artifact stage after the resolver proves those invariants.
  • Add Mappie mappings at suitable structural projection boundaries.
  • Add an external plugin fixture for symbol contribution, cache invalidation, and process isolation. Complete the plugin author guidance.

LMLiam added 20 commits October 11, 2026 13:49
Delete the sbt plugin, its fixtures, CI job, repository, and versions. Fold the Kotest dependency bundle into the shared build convention and delete the kotest module. Remove the allJar task. Move installation and CI guidance into docs/ and retarget the Scala IDE smoke to the Gradle fixture.
Delete the Scala onboarding profile and marker finder, both Scala fixtures, the CI fixture and smoke steps, and the Scala README guidance. Remove the remaining sbt handling from the CLI init guidance: JvmNativeBuildSystem no longer has an sbt case and build.sbt is no longer a detection marker. Drop the unused scala comment style from the generated-file banner.
Delete the 14 per-fixture workflows. GitHub never ran them, and 11 of them
referenced an undefined MICROSMITH_VERSION, so a copy failed immediately.

Delete examples/jvm/kotlin-gradle, which duplicated examples/gradle/kotlin,
and point the Kotlin CLI verification at the native fixture. Keep
examples/jvm/java-maven: examples/maven/java already ships a
build.microsmith.kts, so init would not create one there and the check would
pass trivially.

Remove the README usage check. The CLI usage text now has one source:
microsmith --help.

Rename every "Smoke test" step to "Verify" and the cli-smoke job to
cli-verification. A smoke test is a build-stability check, not an ad-hoc
activity, and these steps run the shipped artifact on three operating
systems.

Split the README into docs/. README: 1,491 -> 133 lines.

Add the testing policy to AGENTS.md.
Add integrationTest and e2eTest source sets with their own Kotest tasks, wired into check. Move existing integration specs out of src/test. Run every layer through the Kotest runner rather than JUnit Platform. Extend the detekt test-path exclusions to the new source sets. Document the layer layout in AGENTS.md and remove two tests that only asserted removed CLI flags.
Move the CLI onboarding, doctor, IDE helper, plugin resolution, provider discovery, and generation failure tests to integrationTest. Move the Gradle TestKit harness and its plugin test to e2eTest. Associate the new Kotlin compilations with main so tests can see internal production types. Allow a temporary directory in the unit layer when the unit writes files.
Move the 38 Gradle projects into engine, schemas, services, runtime, and integrations directories. Keep the logical project names and published artifact IDs. Remap each project directory in settings.gradle, update the repository quality policy paths, and update the release documentation and workflows.
Replace the hand-written Maven plugin descriptor writer with the GradleX maven-plugin-development plugin. Annotate the mojo and its parameters, and keep a small verification task that checks the goal prefix and the generate goal. Keep the maven-plugin packaging in the published POM.
…dules

The CLI and runtime-scripting plugins configured the modules that applied them.
Each module therefore hid its dependency list and its packaging names inside
build-logic. The modules now declare their own configuration and register typed
packaging tasks. build-logic keeps the archive parsing, the catalog verifier,
and the launcher permission logic, which must stay compiled and tested.
Derive the bundled plugin dependencies from the single manifest list, wrap that
list, and share the archive contents between the ZIP and TAR tasks. The generated
catalog and both archive layouts are unchanged.
Record the rule in AGENTS.md and drop the explanatory KDoc from the build task
types, which the class names already describe.
Agents must not add a co-author trailer, a "generated with" line, or an agent
name to a commit, a pull request, or a file.
@LMLiam
LMLiam force-pushed the refactor/microsmith-modernisation branch from 5e2fad5 to a54ea99 Compare October 25, 2026 18:06
Nothing read `.microsmith/origins.json`. The CLI, Gradle, and Maven paths all
use the output roots that the run returns. Removing the manifest also removes
the origins field that every artifact, contribution, and compiler carried only
to populate it.
…esent

Out-of-range, fractional, and negative-for-unsigned defaults were written
straight into property initialisers, so generation succeeded and dotnet build
failed later. The range check existed but lost its caller when the literal
renderer was replaced.
The renderers passed "string", "object", and "int" as literals while the
shared type vocabulary already declared them. Referencing the declared types
removes the last stringly typed call sites.
The modules have no Java sources, so each javadoc jar held only a manifest.
The locking block checked for lockfiles that were never committed and printed
a lifecycle line for every subproject on every build.
The integration and end-to-end tasks were registered in every module and
started the Kotest engine even when the source set was empty, which printed
"No tests found" 69 times per build.
These helpers outlived the renderers that used them: the endpoint extension
surface, the pre-pipeline progress reports, and the package lookup accessors.
The build and the test suites confirm that no code path reaches them.
The new parameterised fixture and the old nuint fixture built the same
artifact, so one call site can cover both and the copy can go.
Reservation validation had no direct tests. These cover the name, span, and
number rules for messages and enums, and the order in which issues appear.
…flow

The message and enum entry points ran the same name, span, and number steps
and differed only in the span validator. One private helper now takes that
validator as a parameter.
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.

1 participant