Add TemplateString and Placeholder#927
Conversation
Introduces `spine.string.TemplateString` Protobuf message together with the `Placeholder` interface and `TemplateString` Kotlin extensions in `io.spine.string` package. These are general-purpose string manipulation utilities adapted from the Validation library. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
This PR introduces a Protobuf-based TemplateString message and a companion Placeholder Kotlin interface in io.spine.string, plus extension functions (format, formatUnsafe, checkPlaceholdersHasValue, extractPlaceholders) and tests. Alongside it, the PR pulls in a sizable config refresh covering Gradle 9.5.1 wrapper, dependency version bumps (Compiler, ToolBase, Time, TestLib, Logging, CoreJvm, Validation, Base, Dokka 2.2.0, Kotest 6.1.11, Shadow 9.4.1), publishing/POM/license-report relocation under docs/dependencies/, refactored ShadowJar and SpinePublishing setup, regenerated pom.xml, and many .agents skill additions/updates.
Changes:
- Add
TemplateStringproto +Placeholderinterface and Kotlin extensions with tests. - Bump project version to
2.0.0-SNAPSHOT.388and refreshconfig(dependencies, Gradle wrapper, publishing/report tooling, agent skills). - Move generated dependency reports under
docs/dependencies/and adjustLicenseReporter/PomGeneratoraccordingly.
Reviewed changes
Copilot reviewed 64 out of 68 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| version.gradle.kts | Bump to SNAPSHOT.388. |
| gradlew, gradlew.bat, gradle/wrapper/gradle-wrapper.properties | Update wrapper to 9.5.1 with regenerated scripts. |
| docs/dependencies/pom.xml | New generated POM under the relocated reports directory. |
| buildSrc/src/test/kotlin/io/spine/gradle/report/license/DependencyReportOutputTest.kt | New tests for the relocated report outputs. |
| buildSrc/src/test/kotlin/io/spine/gradle/publish/SpinePublishingTest.kt | Use the new extensionName constant. |
| buildSrc/src/test/kotlin/io/spine/gradle/docs/UpdatePluginVersionTest.kt | Add @DisplayName, drop unused import. |
| buildSrc/src/main/kotlin/kmp-module.gradle.kts, jvm-module.gradle.kts | Force Jackson/Kotlin BOM in resolution strategy; drop Kotest datatest. |
| buildSrc/src/main/kotlin/io/spine/gradle/report/pom/PomGenerator.kt | Write pom.xml to docs/dependencies. |
| buildSrc/src/main/kotlin/io/spine/gradle/report/license/Paths.kt, LicenseReporter.kt | New outputFile helper writing reports under docs/dependencies. |
| buildSrc/src/main/kotlin/io/spine/gradle/publish/SpinePublishing.kt | Expose extensionName; tweak artifactId builder. |
| buildSrc/src/main/kotlin/io/spine/gradle/publish/PublicationHandler.kt | New artifactId derivation handling KMP suffixes; license distribution set to repo. |
| buildSrc/src/main/kotlin/io/spine/gradle/publish/ShadowJarExts.kt | Replace service-file enumeration with setup() + dedup logic. |
| buildSrc/src/main/kotlin/io/spine/gradle/ProjectExtensions.kt | Doc tweak. |
| buildSrc/src/main/kotlin/io/spine/gradle/github/pages/UpdateGitHubPages.kt | Remove TODO and dead commented block. |
| buildSrc/src/main/kotlin/io/spine/gradle/docs/UpdatePluginVersion.kt | Escape plugin id in regex. |
| buildSrc/src/main/kotlin/io/spine/dependency/test/Kotest.kt | Bump to 6.1.11; restructure deprecations; add common. |
| buildSrc/src/main/kotlin/io/spine/dependency/local/*.kt | Bump local Spine dependency versions and align artifact names. |
| buildSrc/src/main/kotlin/io/spine/dependency/lib/JetBrainsAnnotations.kt | Replace prior LicenseReport declaration with new JetBrainsAnnotations object. |
| buildSrc/src/main/kotlin/io/spine/dependency/build/Dokka.kt | Bump to 2.2.0; use Spine.toolsGroup. |
| buildSrc/build.gradle.kts | Drop license-report plugin from buildSrc; bump Dokka, Shadow, license-report; add JUnit/Kotest test versions. |
| base/src/test/kotlin/io/spine/string/TemplateStringExtsSpec.kt | New tests for TemplateString extensions. |
| base/src/main/proto/spine/string/template_string.proto | New TemplateString Protobuf type. |
| base/src/main/kotlin/io/spine/string/TemplateStringExts.kt | New Kotlin extensions (format, formatUnsafe, checkPlaceholdersHasValue, extractPlaceholders). |
| base/src/main/kotlin/io/spine/string/Placeholder.kt | New Placeholder interface. |
| .junie/, .idea/, .gitignore, .github/workflows/*, .agents/** | Misc agent and CI/workflow renames; add new .agents skills (bump-version, bump-gradle, move-files, update-copyright, java-to-kotlin). |
Files not reviewed (1)
- .idea/inspectionProfiles/Project_Default.xml: Language not supported
Comments suppressed due to low confidence (1)
buildSrc/src/main/kotlin/io/spine/dependency/lib/JetBrainsAnnotations.kt:42
- Reusing a single file (
JetBrainsAnnotations.kt) to wholesale replace the previousLicenseReportdeclaration is confusing in history: the old object lived in packageio.spine.dependency.buildand the new one lives inio.spine.dependency.lib. While the oldLicenseReportis no longer referenced, mixing a delete-and-rename with a package change in the same file makes the diff harder to review and breaksgit-blame/log tracking. Consider deletingLicenseReport.ktand addingJetBrainsAnnotations.ktas a separate new file underio/spine/dependency/lib/.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a2f47a4168
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 65 out of 69 changed files in this pull request and generated 3 comments.
Files not reviewed (1)
- .idea/inspectionProfiles/Project_Default.xml: Language not supported
Comments suppressed due to low confidence (1)
buildSrc/src/main/kotlin/io/spine/dependency/lib/JetBrainsAnnotations.kt:42
- The file declares
package io.spine.dependency.lib, but it lives underio/spine/dependency/lib/JetBrainsAnnotations.ktonly if it was moved. The diff header showsJetBrainsAnnotations.kt, but the previous content in the diff was forLicenseReportinio.spine.dependency.build— please verify the file path matches the new package and that the previousLicenseReportdefinitions have been preserved (or intentionally removed) elsewhere, since the diff is effectively replacing one type with another in the same physical file.
| // | ||
| // Example usage: | ||
| // template_string = "My dog's name is ${dog.name}." | ||
| // placeholder_values = { "dog.name": "Fido" } |
| <version>null</version> | ||
| <scope>compile</scope> | ||
| </dependency> | ||
| <dependency> | ||
| <groupId>com.fasterxml.jackson.dataformat</groupId> | ||
| <artifactId>jackson-dataformat-yaml</artifactId> | ||
| <version>null</version> | ||
| <scope>compile</scope> | ||
| </dependency> | ||
| <dependency> | ||
| <groupId>com.fasterxml.jackson.datatype</groupId> | ||
| <artifactId>jackson-datatype-guava</artifactId> | ||
| <version>null</version> | ||
| <scope>compile</scope> | ||
| </dependency> | ||
| <dependency> | ||
| <groupId>com.fasterxml.jackson.datatype</groupId> | ||
| <artifactId>jackson-datatype-jdk8</artifactId> | ||
| <version>null</version> | ||
| <scope>compile</scope> | ||
| </dependency> | ||
| <dependency> | ||
| <groupId>com.fasterxml.jackson.datatype</groupId> | ||
| <artifactId>jackson-datatype-jsr310</artifactId> | ||
| <version>null</version> | ||
| <scope>compile</scope> | ||
| </dependency> | ||
| <dependency> | ||
| <groupId>com.google.guava</groupId> | ||
| <artifactId>guava</artifactId> | ||
| <version>33.5.0-jre</version> | ||
| <scope>compile</scope> | ||
| </dependency> | ||
| <dependency> | ||
| <groupId>com.google.protobuf</groupId> | ||
| <artifactId>protobuf-java</artifactId> | ||
| <version>4.34.1</version> | ||
| <scope>compile</scope> | ||
| </dependency> | ||
| <dependency> | ||
| <groupId>com.google.protobuf</groupId> | ||
| <artifactId>protobuf-java-util</artifactId> | ||
| <version>4.34.1</version> | ||
| <scope>compile</scope> | ||
| </dependency> | ||
| <dependency> | ||
| <groupId>com.google.protobuf</groupId> | ||
| <artifactId>protobuf-kotlin</artifactId> | ||
| <version>4.34.1</version> | ||
| <scope>compile</scope> | ||
| </dependency> | ||
| <dependency> | ||
| <groupId>io.spine</groupId> | ||
| <artifactId>spine-logging</artifactId> | ||
| <version>2.0.0-SNAPSHOT.417</version> | ||
| <scope>compile</scope> | ||
| </dependency> | ||
| <dependency> | ||
| <groupId>io.spine</groupId> | ||
| <artifactId>spine-reflect</artifactId> | ||
| <version>2.0.0-SNAPSHOT.200</version> | ||
| <scope>compile</scope> | ||
| </dependency> | ||
| <dependency> | ||
| <groupId>org.jetbrains.kotlin</groupId> | ||
| <artifactId>kotlin-bom</artifactId> | ||
| <version>2.3.20</version> | ||
| <scope>compile</scope> | ||
| </dependency> | ||
| <dependency> | ||
| <groupId>org.jetbrains.kotlin</groupId> | ||
| <artifactId>kotlin-reflect</artifactId> | ||
| <version>2.3.20</version> | ||
| <scope>compile</scope> | ||
| </dependency> | ||
| <dependency> | ||
| <groupId>org.jetbrains.kotlin</groupId> | ||
| <artifactId>kotlin-stdlib</artifactId> | ||
| <version>2.3.20</version> | ||
| <scope>compile</scope> | ||
| </dependency> | ||
| <dependency> | ||
| <groupId>org.jetbrains.kotlinx</groupId> | ||
| <artifactId>kotlinx-coroutines-bom</artifactId> | ||
| <version>1.10.2</version> | ||
| <scope>compile</scope> | ||
| </dependency> | ||
| <dependency> | ||
| <groupId>org.jspecify</groupId> | ||
| <artifactId>jspecify</artifactId> | ||
| <version>1.0.0</version> | ||
| <scope>compile</scope> | ||
| </dependency> | ||
| <dependency> | ||
| <groupId>com.fasterxml.jackson.module</groupId> | ||
| <artifactId>jackson-module-kotlin</artifactId> | ||
| <version>null</version> | ||
| <scope>runtime</scope> |
|
|
||
| /** | ||
| * The Compiler belongs to the `tools` group. | ||
| * The Compiler belongs the `tools` group. |
This PR adds Protobuf-based
TemplateStringtype and relevantPlaceholderinterface toio.spine.stringpackage of Spine Base. Previously, these types were adopted in Validation, and we want these types be available to other purposes related to working with formatted messages. Releated general extensions toTemplateStringwere added too.Other notable changes
configwas updated.